diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..8cb80ba0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,49 @@ +node_modules/ + +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..13566b81 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 00000000..0bf359d6 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +cs4241_Assignment_3 \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 00000000..a55e7a17 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 00000000..1a2fb332 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/cs4241_Assignment_3.iml b/.idea/cs4241_Assignment_3.iml new file mode 100644 index 00000000..d4dd8722 --- /dev/null +++ b/.idea/cs4241_Assignment_3.iml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/cs4241_Assignment_4.iml b/.idea/cs4241_Assignment_4.iml new file mode 100644 index 00000000..0c8867d7 --- /dev/null +++ b/.idea/cs4241_Assignment_4.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/cs4241_assignment_2.iml b/.idea/cs4241_assignment_2.iml new file mode 100644 index 00000000..0c8867d7 --- /dev/null +++ b/.idea/cs4241_assignment_2.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml new file mode 100644 index 00000000..518879b2 --- /dev/null +++ b/.idea/dataSources.xml @@ -0,0 +1,12 @@ + + + + + mongo + true + com.dbschema.MongoJdbcDriver + mongodb+srv://canvas.ng8r68j.mongodb.net/?retryWrites=true&w=majority + $ProjectFileDir$ + + + \ No newline at end of file diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml new file mode 100644 index 00000000..7b4368e1 --- /dev/null +++ b/.idea/jsLibraryMappings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..bcc1b4e8 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..94a25f7f --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/watcherTasks.xml b/.idea/watcherTasks.xml new file mode 100644 index 00000000..c70980f4 --- /dev/null +++ b/.idea/watcherTasks.xml @@ -0,0 +1,25 @@ + + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index 4ac8bbff..314f2696 100644 --- a/README.md +++ b/README.md @@ -1,61 +1,24 @@ -Assignment 4 - Creative Coding: Interactive Multimedia Experiences -=== -Due: October 4th, by 11:59 AM. +## 3D Boids -For this assignment we will focus on client-side development using popular audio/graphics/visualization technologies. The goal of this assignment is to refine our JavaScript knowledge while exploring the multimedia capabilities of the browser. +Link to my website: https://cjacobson32.github.io/cs4241_Assignment_4/ -[WebAudio + Canvas Tutorial](https://github.com/cs4241-22a/cs4241-22a.github.io/blob/main/using_webaudio_canvas.md) -[SVG + D3 tutorial](https://github.com/cs4241-21a/cs4241-21a.github.io/blob/main/using_svg_and_d3.md) +This project is a 3d simulation of boids with flocking behavior. You can use the gizmo to move a cursor around and repel +the boids as they fly. -Baseline Requirements ---- +### Challenges +I had an initial understanding of the algorithm for flocking boids in 2D, however converting these to 3D in the notation +Babylon JS was not trivial. Babylon ended up having several technicalities such as simulation-time and render-time being +separate. This meant I had to handle position/velocity updates separate from the viewport's framerate. This was a major +shift to ways in which I had previously implemented this algorithm which was tied to the viewport's framerate. -Your application is required to implement the following functionalities: +There were also some struggles I had with performance. This app initially ran at about 2fps on my machine. A major +optimization I implemented was chunking. Each boid initially had to check their distance from every other boid on the +screen. This resulted in an `O(n^2)` runtime. To improve this, I divided the scene into a 3d grid of cubic chunks whose +side length was the same as the max distance boids would detect one another. This way boids would only have to check their +chunks and their neighboring chunks. This increased the performance by an order of magnitude, I started getting 30fps or +more. -- A server created using Express. This server can be as simple as needed. -- A client-side interactive experience using at least one of the following web technologies frameworks. - - [Three.js](https://threejs.org/): A library for 3D graphics / VR experiences - - [D3.js](https://d3js.org): A library that is primarily used for interactive data visualizations - - [Canvas](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API): A 2D raster drawing API included in all modern browsers - - [SVG](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API): A 2D vector drawing framework that enables shapes to be defined via XML. - - [Web Audio API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API): An API for audio synthesis, analysis, processing, and file playback. -- A user interface for interaction with your project, which must expose at least four parameters for user control. [tweakpane](https://cocopon.github.io/tweakpane/) is highly recommended for this, but you can also use regular HTML `` tags (the `range` type is useful to create sliders). You might also explore interaction by tracking mouse movement via the `window.onmousemove` event handler in tandem with the `event.clientX` and `event.clientY` properties. Consider using the [Pointer Events API](https://developer.mozilla.org/en-US/docs/Web/API/Pointer_events) to ensure that that both mouse and touch events will both be supported in your app. -- Your application should display basic documentation for the user interface when the application first loads. +I did have a system for rendering the chunks to the viewport to demonstrate how the optimization worked, but it lagged +the whole scene far more than the boids did, so I opted not to include it in the submission. -The interactive experience should possess a reasonable level of complexity. Some examples: -### Three.js -- A generative algorithm creates simple agents that move through a virtual world. Your interface controls the behavior / appearance of these agents. -- A simple 3D game... you really want this to be a simple as possible or it will be outside the scope of this assignment. -- An 3D audio visualization of a song of your choosing. User interaction should control aspects of the visualization. -### Canvas -- Implement a generative algorithm such as [Conway's Game of Life](https://bitstorm.org/gameoflife/) (or 1D cellular automata) and provide interactive controls. Note that the Game of Life has been created by 100s of people using ; we'll be checking to ensure that your implementation is not a copy of these. -- Design a 2D audio visualizer of a song of your choosing. User interaction should control visual aspects of the experience. -### Web Audio API -- Create a screen-based musical instrument using the Web Audio API. You can use projects such as [Interface.js](http://charlie-roberts.com/interface/) or [Nexus UI](https://nexus-js.github.io/ui/api/#Piano) to provide common musical interface elements, or use dat.GUI in combination with mouse/touch events (use the Pointer Events API). Your GUI should enable users to control aspects of sound synthesis. If you want to use higher-level instruments instead of the raw WebAudio API sounds, consider trying the instruments provided by [Tone.js]() or [Gibber](https://github.com/charlieroberts/gibber.audio.lib). -### D3.js -- Create visualizations using the datasets found at [Awesome JSON Datasets](https://github.com/jdorfman/Awesome-JSON-Datasets). Experiment with providing different visualizations of the same data set, and providing users interactive control over visualization parameters and/or data filtering. Alternatively, create a single visualization with using one of the more complicated techniques shown at [d3js.org](d3js.org) and provide meaningful points of interaction for users. - -Deliverables ---- - -Do the following to complete this assignment: - -1. Implement your project with the above requirements. -3. Test your project to make sure that when someone goes to your main page on Glitch/Heroku/etc., it displays correctly. -4. Ensure that your project has the proper naming scheme `a4-firstname-lastname` so we can find it. -5. Fork this repository and modify the README to the specifications below. *NOTE: If you don't use Glitch for hosting (where we can see the files) then you must include all project files that you author in your repo for this assignment*. -6. Create and submit a Pull Request to the original repo. Name the pull request using the following template: `a4-firstname-lastname`. - -Sample Readme (delete the above when you're ready to submit, and modify the below so with your links and descriptions) ---- - -## Your Web Application Title - -your hosting link e.g. http://a4-charlieroberts.glitch.me - -Include a very brief summary of your project here. Images are encouraged when needed, along with concise, high-level text. Be sure to include: - -- the goal of the application -- challenges you faced in realizing the application -- the instructions you present in the website should be clear enough to use the application, but if you feel any need to provide additional instructions please do so here. diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..8bade4f6 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,3705 @@ +{ + "name": "cs4241_assignment_3", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "cs4241_assignment_3", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "babylonjs": "^5.26.1", + "express": "^4.18.1" + }, + "devDependencies": { + "@types/babylonjs": "^2.4.1", + "@types/express": "^4.17.14", + "@types/node": "^18.7.18", + "ts-loader": "^9.4.1", + "typescript": "^4.8.3", + "webpack": "^5.74.0", + "webpack-cli": "^4.10.0" + } + }, + "node_modules/@discoveryjs/json-ext": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", + "integrity": "sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==", + "dev": true, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz", + "integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==", + "dev": true, + "dependencies": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", + "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/source-map": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.2.tgz", + "integrity": "sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.15", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.15.tgz", + "integrity": "sha512-oWZNOULl+UbhsgB51uuZzglikfIKSUBO/M9W2OfEjn7cmqoAiCgmv9lyACTUacZwBz0ITnJ2NqjU8Tx0DHL88g==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/@types/babylonjs": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@types/babylonjs/-/babylonjs-2.4.1.tgz", + "integrity": "sha512-vt6db2PxisxsnLvL5holHLV9vMJzELAhFq54syX/tKncTmjeraQSR1W20j9/KYLEpAFU18u76rK8utb8JlUrtQ==", + "deprecated": "This is a stub types definition for BabylonJS (http://www.babylonjs.com/). BabylonJS provides its own type definitions, so you don't need @types/babylonjs installed!", + "dev": true, + "dependencies": { + "babylonjs": "*" + } + }, + "node_modules/@types/body-parser": { + "version": "1.19.2", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz", + "integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==", + "dev": true, + "dependencies": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "node_modules/@types/connect": { + "version": "3.4.35", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", + "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/eslint": { + "version": "8.4.6", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.4.6.tgz", + "integrity": "sha512-/fqTbjxyFUaYNO7VcW5g+4npmqVACz1bB7RTHYuLj+PRjw9hrCwrUXVQFpChUS0JsyEFvMZ7U/PfmvWgxJhI9g==", + "dev": true, + "dependencies": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, + "node_modules/@types/eslint-scope": { + "version": "3.7.4", + "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.4.tgz", + "integrity": "sha512-9K4zoImiZc3HlIp6AVUDE4CWYx22a+lhSZMYNpbjW04+YF0KWj4pJXnEMjdnFTiQibFFmElcsasJXDbdI/EPhA==", + "dev": true, + "dependencies": { + "@types/eslint": "*", + "@types/estree": "*" + } + }, + "node_modules/@types/estree": { + "version": "0.0.51", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.51.tgz", + "integrity": "sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ==", + "dev": true + }, + "node_modules/@types/express": { + "version": "4.17.14", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.14.tgz", + "integrity": "sha512-TEbt+vaPFQ+xpxFLFssxUDXj5cWCxZJjIcB7Yg0k0GMHGtgtQgpvx/MUQUeAkNbA9AAGrwkAsoeItdTgS7FMyg==", + "dev": true, + "dependencies": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.18", + "@types/qs": "*", + "@types/serve-static": "*" + } + }, + "node_modules/@types/express-serve-static-core": { + "version": "4.17.31", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.31.tgz", + "integrity": "sha512-DxMhY+NAsTwMMFHBTtJFNp5qiHKJ7TeqOo23zVEM9alT1Ml27Q3xcTH0xwxn7Q0BbMcVEJOs/7aQtUWupUQN3Q==", + "dev": true, + "dependencies": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*" + } + }, + "node_modules/@types/json-schema": { + "version": "7.0.11", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", + "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "dev": true + }, + "node_modules/@types/mime": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-3.0.1.tgz", + "integrity": "sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA==", + "dev": true + }, + "node_modules/@types/node": { + "version": "18.7.18", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.18.tgz", + "integrity": "sha512-m+6nTEOadJZuTPkKR/SYK3A2d7FZrgElol9UP1Kae90VVU4a6mxnPuLiIW1m4Cq4gZ/nWb9GrdVXJCoCazDAbg==", + "dev": true + }, + "node_modules/@types/qs": { + "version": "6.9.7", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", + "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==", + "dev": true + }, + "node_modules/@types/range-parser": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz", + "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==", + "dev": true + }, + "node_modules/@types/serve-static": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.0.tgz", + "integrity": "sha512-z5xyF6uh8CbjAu9760KDKsH2FcDxZ2tFCsA4HIMWE6IkiYMXfVoa+4f9KX+FN0ZLsaMw1WNG2ETLA6N+/YA+cg==", + "dev": true, + "dependencies": { + "@types/mime": "*", + "@types/node": "*" + } + }, + "node_modules/@webassemblyjs/ast": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz", + "integrity": "sha512-ukBh14qFLjxTQNTXocdyksN5QdM28S1CxHt2rdskFyL+xFV7VremuBLVbmCePj+URalXBENx/9Lm7lnhihtCSw==", + "dev": true, + "dependencies": { + "@webassemblyjs/helper-numbers": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1" + } + }, + "node_modules/@webassemblyjs/floating-point-hex-parser": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.1.tgz", + "integrity": "sha512-iGRfyc5Bq+NnNuX8b5hwBrRjzf0ocrJPI6GWFodBFzmFnyvrQ83SHKhmilCU/8Jv67i4GJZBMhEzltxzcNagtQ==", + "dev": true + }, + "node_modules/@webassemblyjs/helper-api-error": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.1.tgz", + "integrity": "sha512-RlhS8CBCXfRUR/cwo2ho9bkheSXG0+NwooXcc3PAILALf2QLdFyj7KGsKRbVc95hZnhnERon4kW/D3SZpp6Tcg==", + "dev": true + }, + "node_modules/@webassemblyjs/helper-buffer": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.1.tgz", + "integrity": "sha512-gwikF65aDNeeXa8JxXa2BAk+REjSyhrNC9ZwdT0f8jc4dQQeDQ7G4m0f2QCLPJiMTTO6wfDmRmj/pW0PsUvIcA==", + "dev": true + }, + "node_modules/@webassemblyjs/helper-numbers": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.1.tgz", + "integrity": "sha512-vDkbxiB8zfnPdNK9Rajcey5C0w+QJugEglN0of+kmO8l7lDb77AnlKYQF7aarZuCrv+l0UvqL+68gSDr3k9LPQ==", + "dev": true, + "dependencies": { + "@webassemblyjs/floating-point-hex-parser": "1.11.1", + "@webassemblyjs/helper-api-error": "1.11.1", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webassemblyjs/helper-wasm-bytecode": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.1.tgz", + "integrity": "sha512-PvpoOGiJwXeTrSf/qfudJhwlvDQxFgelbMqtq52WWiXC6Xgg1IREdngmPN3bs4RoO83PnL/nFrxucXj1+BX62Q==", + "dev": true + }, + "node_modules/@webassemblyjs/helper-wasm-section": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.1.tgz", + "integrity": "sha512-10P9No29rYX1j7F3EVPX3JvGPQPae+AomuSTPiF9eBQeChHI6iqjMIwR9JmOJXwpnn/oVGDk7I5IlskuMwU/pg==", + "dev": true, + "dependencies": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-buffer": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/wasm-gen": "1.11.1" + } + }, + "node_modules/@webassemblyjs/ieee754": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.1.tgz", + "integrity": "sha512-hJ87QIPtAMKbFq6CGTkZYJivEwZDbQUgYd3qKSadTNOhVY7p+gfP6Sr0lLRVTaG1JjFj+r3YchoqRYxNH3M0GQ==", + "dev": true, + "dependencies": { + "@xtuc/ieee754": "^1.2.0" + } + }, + "node_modules/@webassemblyjs/leb128": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.1.tgz", + "integrity": "sha512-BJ2P0hNZ0u+Th1YZXJpzW6miwqQUGcIHT1G/sf72gLVD9DZ5AdYTqPNbHZh6K1M5VmKvFXwGSWZADz+qBWxeRw==", + "dev": true, + "dependencies": { + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webassemblyjs/utf8": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.1.tgz", + "integrity": "sha512-9kqcxAEdMhiwQkHpkNiorZzqpGrodQQ2IGrHHxCy+Ozng0ofyMA0lTqiLkVs1uzTRejX+/O0EOT7KxqVPuXosQ==", + "dev": true + }, + "node_modules/@webassemblyjs/wasm-edit": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.1.tgz", + "integrity": "sha512-g+RsupUC1aTHfR8CDgnsVRVZFJqdkFHpsHMfJuWQzWU3tvnLC07UqHICfP+4XyL2tnr1amvl1Sdp06TnYCmVkA==", + "dev": true, + "dependencies": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-buffer": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/helper-wasm-section": "1.11.1", + "@webassemblyjs/wasm-gen": "1.11.1", + "@webassemblyjs/wasm-opt": "1.11.1", + "@webassemblyjs/wasm-parser": "1.11.1", + "@webassemblyjs/wast-printer": "1.11.1" + } + }, + "node_modules/@webassemblyjs/wasm-gen": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.1.tgz", + "integrity": "sha512-F7QqKXwwNlMmsulj6+O7r4mmtAlCWfO/0HdgOxSklZfQcDu0TpLiD1mRt/zF25Bk59FIjEuGAIyn5ei4yMfLhA==", + "dev": true, + "dependencies": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/ieee754": "1.11.1", + "@webassemblyjs/leb128": "1.11.1", + "@webassemblyjs/utf8": "1.11.1" + } + }, + "node_modules/@webassemblyjs/wasm-opt": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.1.tgz", + "integrity": "sha512-VqnkNqnZlU5EB64pp1l7hdm3hmQw7Vgqa0KF/KCNO9sIpI6Fk6brDEiX+iCOYrvMuBWDws0NkTOxYEb85XQHHw==", + "dev": true, + "dependencies": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-buffer": "1.11.1", + "@webassemblyjs/wasm-gen": "1.11.1", + "@webassemblyjs/wasm-parser": "1.11.1" + } + }, + "node_modules/@webassemblyjs/wasm-parser": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.1.tgz", + "integrity": "sha512-rrBujw+dJu32gYB7/Lup6UhdkPx9S9SnobZzRVL7VcBH9Bt9bCBLEuX/YXOOtBsOZ4NQrRykKhffRWHvigQvOA==", + "dev": true, + "dependencies": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-api-error": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/ieee754": "1.11.1", + "@webassemblyjs/leb128": "1.11.1", + "@webassemblyjs/utf8": "1.11.1" + } + }, + "node_modules/@webassemblyjs/wast-printer": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.11.1.tgz", + "integrity": "sha512-IQboUWM4eKzWW+N/jij2sRatKMh99QEelo3Eb2q0qXkvPRISAj8Qxtmw5itwqK+TTkBuUIE45AxYPToqPtL5gg==", + "dev": true, + "dependencies": { + "@webassemblyjs/ast": "1.11.1", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webpack-cli/configtest": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.2.0.tgz", + "integrity": "sha512-4FB8Tj6xyVkyqjj1OaTqCjXYULB9FMkqQ8yGrZjRDrYh0nOE+7Lhs45WioWQQMV+ceFlE368Ukhe6xdvJM9Egg==", + "dev": true, + "peerDependencies": { + "webpack": "4.x.x || 5.x.x", + "webpack-cli": "4.x.x" + } + }, + "node_modules/@webpack-cli/info": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.5.0.tgz", + "integrity": "sha512-e8tSXZpw2hPl2uMJY6fsMswaok5FdlGNRTktvFk2sD8RjH0hE2+XistawJx1vmKteh4NmGmNUrp+Tb2w+udPcQ==", + "dev": true, + "dependencies": { + "envinfo": "^7.7.3" + }, + "peerDependencies": { + "webpack-cli": "4.x.x" + } + }, + "node_modules/@webpack-cli/serve": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.7.0.tgz", + "integrity": "sha512-oxnCNGj88fL+xzV+dacXs44HcDwf1ovs3AuEzvP7mqXw7fQntqIhQ1BRmynh4qEKQSSSRSWVyXRjmTbZIX9V2Q==", + "dev": true, + "peerDependencies": { + "webpack-cli": "4.x.x" + }, + "peerDependenciesMeta": { + "webpack-dev-server": { + "optional": true + } + } + }, + "node_modules/@xtuc/ieee754": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", + "dev": true + }, + "node_modules/@xtuc/long": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", + "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", + "dev": true + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/acorn": { + "version": "8.8.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz", + "integrity": "sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-import-assertions": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz", + "integrity": "sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw==", + "dev": true, + "peerDependencies": { + "acorn": "^8" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-keywords": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", + "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", + "dev": true, + "peerDependencies": { + "ajv": "^6.9.1" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" + }, + "node_modules/babylonjs": { + "version": "5.26.1", + "resolved": "https://registry.npmjs.org/babylonjs/-/babylonjs-5.26.1.tgz", + "integrity": "sha512-Qyr7UZW4XxJTFQZJZi2QkYrEIq0NzYITaMKOhpI++0XjacqYO0NAIPuGLykVSKdJseAwOPQIHvY/TfY2i/FjVA==", + "hasInstallScript": true + }, + "node_modules/body-parser": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.0.tgz", + "integrity": "sha512-DfJ+q6EPcGKZD1QWUjSpqp+Q7bDQTsQIF4zfUAtZ6qk+H/3/QRhg9CEp39ss+/T2vw0+HaidC0ecJj/DRLIaKg==", + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.10.3", + "raw-body": "2.5.1", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browserslist": { + "version": "4.21.4", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.4.tgz", + "integrity": "sha512-CBHJJdDmgjl3daYjN5Cp5kbTf1mUhZoS+beLklHIvkOWscs83YAhLlF3Wsh/lciQYAcbBJgTOD44VtG31ZM4Hw==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + } + ], + "dependencies": { + "caniuse-lite": "^1.0.30001400", + "electron-to-chromium": "^1.4.251", + "node-releases": "^2.0.6", + "update-browserslist-db": "^1.0.9" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001406", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001406.tgz", + "integrity": "sha512-bWTlaXUy/rq0BBtYShc/jArYfBPjEV95euvZ8JVtO43oQExEN/WquoqpufFjNu4kSpi5cy5kMbNvzztWDfv1Jg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + } + ] + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chalk/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chrome-trace-event": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz", + "integrity": "sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==", + "dev": true, + "engines": { + "node": ">=6.0" + } + }, + "node_modules/clone-deep": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", + "dev": true, + "dependencies": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/colorette": { + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.19.tgz", + "integrity": "sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==", + "dev": true + }, + "node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", + "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" + }, + "node_modules/electron-to-chromium": { + "version": "1.4.254", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.254.tgz", + "integrity": "sha512-Sh/7YsHqQYkA6ZHuHMy24e6TE4eX6KZVsZb9E/DvU1nQRIrH4BflO/4k+83tfdYvDl+MObvlqHPRICzEdC9c6Q==", + "dev": true + }, + "node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/enhanced-resolve": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.10.0.tgz", + "integrity": "sha512-T0yTFjdpldGY8PmuXXR0PyQ1ufZpEGiHVrp7zHKB7jdR4qlmZHhONVM5AQOAWXuF/w3dnHbEQVrNptJgt7F+cQ==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/envinfo": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.8.1.tgz", + "integrity": "sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw==", + "dev": true, + "bin": { + "envinfo": "dist/cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/es-module-lexer": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz", + "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==", + "dev": true + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" + }, + "node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "dev": true, + "engines": { + "node": ">=0.8.x" + } + }, + "node_modules/express": { + "version": "4.18.1", + "resolved": "https://registry.npmjs.org/express/-/express-4.18.1.tgz", + "integrity": "sha512-zZBcOX9TfehHQhtupq57OF8lFZ3UZi08Y97dwFCkD8p9d/d2Y3M+ykKcwaMDEL+4qyUolgBDX6AblpR3fL212Q==", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.0", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.5.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.2.0", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.7", + "qs": "6.10.3", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.18.0", + "serve-static": "1.15.0", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/fastest-levenshtein": { + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", + "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", + "dev": true, + "engines": { + "node": ">= 4.9.1" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/finalhandler": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", + "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "node_modules/get-intrinsic": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", + "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/glob-to-regexp": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", + "dev": true + }, + "node_modules/graceful-fs": { + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", + "dev": true + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/import-local": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", + "integrity": "sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==", + "dev": true, + "dependencies": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/interpret": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz", + "integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==", + "dev": true, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-core-module": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz", + "integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/jest-worker": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", + "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", + "dev": true, + "dependencies": { + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/loader-runner": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz", + "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==", + "dev": true, + "engines": { + "node": ">=6.11.5" + } + }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "dev": true + }, + "node_modules/node-releases": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.6.tgz", + "integrity": "sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==", + "dev": true + }, + "node_modules/object-inspect": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", + "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/qs": { + "version": "6.10.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", + "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", + "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/rechoir": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.1.tgz", + "integrity": "sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==", + "dev": true, + "dependencies": { + "resolve": "^1.9.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/resolve": { + "version": "1.22.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", + "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", + "dev": true, + "dependencies": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "dev": true, + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/schema-utils": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz", + "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/semver": { + "version": "7.3.7", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", + "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/send": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", + "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/serialize-javascript": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", + "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "dev": true, + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/serve-static": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", + "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "dependencies": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.18.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, + "node_modules/shallow-clone": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", + "dev": true, + "dependencies": { + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/tapable": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", + "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/terser": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.15.0.tgz", + "integrity": "sha512-L1BJiXVmheAQQy+as0oF3Pwtlo4s3Wi1X2zNZ2NxOB4wx9bdS9Vk67XQENLFdLYGCK/Z2di53mTj/hBafR+dTA==", + "dev": true, + "dependencies": { + "@jridgewell/source-map": "^0.3.2", + "acorn": "^8.5.0", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + }, + "bin": { + "terser": "bin/terser" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/terser-webpack-plugin": { + "version": "5.3.6", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.6.tgz", + "integrity": "sha512-kfLFk+PoLUQIbLmB1+PZDMRSZS99Mp+/MHqDNmMA6tOItzRt+Npe3E+fsMs5mfcM0wCtrrdU387UnV+vnSffXQ==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.14", + "jest-worker": "^27.4.5", + "schema-utils": "^3.1.1", + "serialize-javascript": "^6.0.0", + "terser": "^5.14.1" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.1.0" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "uglify-js": { + "optional": true + } + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/ts-loader": { + "version": "9.4.1", + "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.4.1.tgz", + "integrity": "sha512-384TYAqGs70rn9F0VBnh6BPTfhga7yFNdC5gXbQpDrBj9/KsT4iRkGqKXhziofHOlE2j6YEaiTYVGKKvPhGWvw==", + "dev": true, + "dependencies": { + "chalk": "^4.1.0", + "enhanced-resolve": "^5.0.0", + "micromatch": "^4.0.0", + "semver": "^7.3.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "typescript": "*", + "webpack": "^5.0.0" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/typescript": { + "version": "4.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.3.tgz", + "integrity": "sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.9.tgz", + "integrity": "sha512-/xsqn21EGVdXI3EXSum1Yckj3ZVZugqyOZQ/CxYPBD/R+ko9NSUScf8tFF4dOKY+2pvSSJA/S+5B8s4Zr4kyvg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + } + ], + "dependencies": { + "escalade": "^3.1.1", + "picocolors": "^1.0.0" + }, + "bin": { + "browserslist-lint": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/watchpack": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", + "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", + "dev": true, + "dependencies": { + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.1.2" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/webpack": { + "version": "5.74.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.74.0.tgz", + "integrity": "sha512-A2InDwnhhGN4LYctJj6M1JEaGL7Luj6LOmyBHjcI8529cm5p6VXiTIW2sn6ffvEAKmveLzvu4jrihwXtPojlAA==", + "dev": true, + "dependencies": { + "@types/eslint-scope": "^3.7.3", + "@types/estree": "^0.0.51", + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/wasm-edit": "1.11.1", + "@webassemblyjs/wasm-parser": "1.11.1", + "acorn": "^8.7.1", + "acorn-import-assertions": "^1.7.6", + "browserslist": "^4.14.5", + "chrome-trace-event": "^1.0.2", + "enhanced-resolve": "^5.10.0", + "es-module-lexer": "^0.9.0", + "eslint-scope": "5.1.1", + "events": "^3.2.0", + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.2.9", + "json-parse-even-better-errors": "^2.3.1", + "loader-runner": "^4.2.0", + "mime-types": "^2.1.27", + "neo-async": "^2.6.2", + "schema-utils": "^3.1.0", + "tapable": "^2.1.1", + "terser-webpack-plugin": "^5.1.3", + "watchpack": "^2.4.0", + "webpack-sources": "^3.2.3" + }, + "bin": { + "webpack": "bin/webpack.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependenciesMeta": { + "webpack-cli": { + "optional": true + } + } + }, + "node_modules/webpack-cli": { + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.10.0.tgz", + "integrity": "sha512-NLhDfH/h4O6UOy+0LSso42xvYypClINuMNBVVzX4vX98TmTaTUxwRbXdhucbFMd2qLaCTcLq/PdYrvi8onw90w==", + "dev": true, + "dependencies": { + "@discoveryjs/json-ext": "^0.5.0", + "@webpack-cli/configtest": "^1.2.0", + "@webpack-cli/info": "^1.5.0", + "@webpack-cli/serve": "^1.7.0", + "colorette": "^2.0.14", + "commander": "^7.0.0", + "cross-spawn": "^7.0.3", + "fastest-levenshtein": "^1.0.12", + "import-local": "^3.0.2", + "interpret": "^2.2.0", + "rechoir": "^0.7.0", + "webpack-merge": "^5.7.3" + }, + "bin": { + "webpack-cli": "bin/cli.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "4.x.x || 5.x.x" + }, + "peerDependenciesMeta": { + "@webpack-cli/generators": { + "optional": true + }, + "@webpack-cli/migrate": { + "optional": true + }, + "webpack-bundle-analyzer": { + "optional": true + }, + "webpack-dev-server": { + "optional": true + } + } + }, + "node_modules/webpack-cli/node_modules/commander": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", + "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "dev": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/webpack-merge": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.8.0.tgz", + "integrity": "sha512-/SaI7xY0831XwP6kzuwhKWVKDP9t1QY1h65lAFLbZqMPIuYcD9QAW4u9STIbU9kaJbPBB/geU/gLr1wDjOhQ+Q==", + "dev": true, + "dependencies": { + "clone-deep": "^4.0.1", + "wildcard": "^2.0.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/webpack-sources": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", + "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", + "dev": true, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wildcard": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.0.tgz", + "integrity": "sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==", + "dev": true + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + } + }, + "dependencies": { + "@discoveryjs/json-ext": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", + "integrity": "sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==", + "dev": true + }, + "@jridgewell/gen-mapping": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz", + "integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==", + "dev": true, + "requires": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "@jridgewell/resolve-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", + "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "dev": true + }, + "@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "dev": true + }, + "@jridgewell/source-map": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.2.tgz", + "integrity": "sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw==", + "dev": true, + "requires": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "@jridgewell/sourcemap-codec": { + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", + "dev": true + }, + "@jridgewell/trace-mapping": { + "version": "0.3.15", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.15.tgz", + "integrity": "sha512-oWZNOULl+UbhsgB51uuZzglikfIKSUBO/M9W2OfEjn7cmqoAiCgmv9lyACTUacZwBz0ITnJ2NqjU8Tx0DHL88g==", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "@types/babylonjs": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@types/babylonjs/-/babylonjs-2.4.1.tgz", + "integrity": "sha512-vt6db2PxisxsnLvL5holHLV9vMJzELAhFq54syX/tKncTmjeraQSR1W20j9/KYLEpAFU18u76rK8utb8JlUrtQ==", + "dev": true, + "requires": { + "babylonjs": "*" + } + }, + "@types/body-parser": { + "version": "1.19.2", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz", + "integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==", + "dev": true, + "requires": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "@types/connect": { + "version": "3.4.35", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", + "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/eslint": { + "version": "8.4.6", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.4.6.tgz", + "integrity": "sha512-/fqTbjxyFUaYNO7VcW5g+4npmqVACz1bB7RTHYuLj+PRjw9hrCwrUXVQFpChUS0JsyEFvMZ7U/PfmvWgxJhI9g==", + "dev": true, + "requires": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, + "@types/eslint-scope": { + "version": "3.7.4", + "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.4.tgz", + "integrity": "sha512-9K4zoImiZc3HlIp6AVUDE4CWYx22a+lhSZMYNpbjW04+YF0KWj4pJXnEMjdnFTiQibFFmElcsasJXDbdI/EPhA==", + "dev": true, + "requires": { + "@types/eslint": "*", + "@types/estree": "*" + } + }, + "@types/estree": { + "version": "0.0.51", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.51.tgz", + "integrity": "sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ==", + "dev": true + }, + "@types/express": { + "version": "4.17.14", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.14.tgz", + "integrity": "sha512-TEbt+vaPFQ+xpxFLFssxUDXj5cWCxZJjIcB7Yg0k0GMHGtgtQgpvx/MUQUeAkNbA9AAGrwkAsoeItdTgS7FMyg==", + "dev": true, + "requires": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.18", + "@types/qs": "*", + "@types/serve-static": "*" + } + }, + "@types/express-serve-static-core": { + "version": "4.17.31", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.31.tgz", + "integrity": "sha512-DxMhY+NAsTwMMFHBTtJFNp5qiHKJ7TeqOo23zVEM9alT1Ml27Q3xcTH0xwxn7Q0BbMcVEJOs/7aQtUWupUQN3Q==", + "dev": true, + "requires": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*" + } + }, + "@types/json-schema": { + "version": "7.0.11", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", + "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "dev": true + }, + "@types/mime": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-3.0.1.tgz", + "integrity": "sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA==", + "dev": true + }, + "@types/node": { + "version": "18.7.18", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.18.tgz", + "integrity": "sha512-m+6nTEOadJZuTPkKR/SYK3A2d7FZrgElol9UP1Kae90VVU4a6mxnPuLiIW1m4Cq4gZ/nWb9GrdVXJCoCazDAbg==", + "dev": true + }, + "@types/qs": { + "version": "6.9.7", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", + "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==", + "dev": true + }, + "@types/range-parser": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz", + "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==", + "dev": true + }, + "@types/serve-static": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.0.tgz", + "integrity": "sha512-z5xyF6uh8CbjAu9760KDKsH2FcDxZ2tFCsA4HIMWE6IkiYMXfVoa+4f9KX+FN0ZLsaMw1WNG2ETLA6N+/YA+cg==", + "dev": true, + "requires": { + "@types/mime": "*", + "@types/node": "*" + } + }, + "@webassemblyjs/ast": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz", + "integrity": "sha512-ukBh14qFLjxTQNTXocdyksN5QdM28S1CxHt2rdskFyL+xFV7VremuBLVbmCePj+URalXBENx/9Lm7lnhihtCSw==", + "dev": true, + "requires": { + "@webassemblyjs/helper-numbers": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1" + } + }, + "@webassemblyjs/floating-point-hex-parser": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.1.tgz", + "integrity": "sha512-iGRfyc5Bq+NnNuX8b5hwBrRjzf0ocrJPI6GWFodBFzmFnyvrQ83SHKhmilCU/8Jv67i4GJZBMhEzltxzcNagtQ==", + "dev": true + }, + "@webassemblyjs/helper-api-error": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.1.tgz", + "integrity": "sha512-RlhS8CBCXfRUR/cwo2ho9bkheSXG0+NwooXcc3PAILALf2QLdFyj7KGsKRbVc95hZnhnERon4kW/D3SZpp6Tcg==", + "dev": true + }, + "@webassemblyjs/helper-buffer": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.1.tgz", + "integrity": "sha512-gwikF65aDNeeXa8JxXa2BAk+REjSyhrNC9ZwdT0f8jc4dQQeDQ7G4m0f2QCLPJiMTTO6wfDmRmj/pW0PsUvIcA==", + "dev": true + }, + "@webassemblyjs/helper-numbers": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.1.tgz", + "integrity": "sha512-vDkbxiB8zfnPdNK9Rajcey5C0w+QJugEglN0of+kmO8l7lDb77AnlKYQF7aarZuCrv+l0UvqL+68gSDr3k9LPQ==", + "dev": true, + "requires": { + "@webassemblyjs/floating-point-hex-parser": "1.11.1", + "@webassemblyjs/helper-api-error": "1.11.1", + "@xtuc/long": "4.2.2" + } + }, + "@webassemblyjs/helper-wasm-bytecode": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.1.tgz", + "integrity": "sha512-PvpoOGiJwXeTrSf/qfudJhwlvDQxFgelbMqtq52WWiXC6Xgg1IREdngmPN3bs4RoO83PnL/nFrxucXj1+BX62Q==", + "dev": true + }, + "@webassemblyjs/helper-wasm-section": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.1.tgz", + "integrity": "sha512-10P9No29rYX1j7F3EVPX3JvGPQPae+AomuSTPiF9eBQeChHI6iqjMIwR9JmOJXwpnn/oVGDk7I5IlskuMwU/pg==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-buffer": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/wasm-gen": "1.11.1" + } + }, + "@webassemblyjs/ieee754": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.1.tgz", + "integrity": "sha512-hJ87QIPtAMKbFq6CGTkZYJivEwZDbQUgYd3qKSadTNOhVY7p+gfP6Sr0lLRVTaG1JjFj+r3YchoqRYxNH3M0GQ==", + "dev": true, + "requires": { + "@xtuc/ieee754": "^1.2.0" + } + }, + "@webassemblyjs/leb128": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.1.tgz", + "integrity": "sha512-BJ2P0hNZ0u+Th1YZXJpzW6miwqQUGcIHT1G/sf72gLVD9DZ5AdYTqPNbHZh6K1M5VmKvFXwGSWZADz+qBWxeRw==", + "dev": true, + "requires": { + "@xtuc/long": "4.2.2" + } + }, + "@webassemblyjs/utf8": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.1.tgz", + "integrity": "sha512-9kqcxAEdMhiwQkHpkNiorZzqpGrodQQ2IGrHHxCy+Ozng0ofyMA0lTqiLkVs1uzTRejX+/O0EOT7KxqVPuXosQ==", + "dev": true + }, + "@webassemblyjs/wasm-edit": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.1.tgz", + "integrity": "sha512-g+RsupUC1aTHfR8CDgnsVRVZFJqdkFHpsHMfJuWQzWU3tvnLC07UqHICfP+4XyL2tnr1amvl1Sdp06TnYCmVkA==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-buffer": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/helper-wasm-section": "1.11.1", + "@webassemblyjs/wasm-gen": "1.11.1", + "@webassemblyjs/wasm-opt": "1.11.1", + "@webassemblyjs/wasm-parser": "1.11.1", + "@webassemblyjs/wast-printer": "1.11.1" + } + }, + "@webassemblyjs/wasm-gen": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.1.tgz", + "integrity": "sha512-F7QqKXwwNlMmsulj6+O7r4mmtAlCWfO/0HdgOxSklZfQcDu0TpLiD1mRt/zF25Bk59FIjEuGAIyn5ei4yMfLhA==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/ieee754": "1.11.1", + "@webassemblyjs/leb128": "1.11.1", + "@webassemblyjs/utf8": "1.11.1" + } + }, + "@webassemblyjs/wasm-opt": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.1.tgz", + "integrity": "sha512-VqnkNqnZlU5EB64pp1l7hdm3hmQw7Vgqa0KF/KCNO9sIpI6Fk6brDEiX+iCOYrvMuBWDws0NkTOxYEb85XQHHw==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-buffer": "1.11.1", + "@webassemblyjs/wasm-gen": "1.11.1", + "@webassemblyjs/wasm-parser": "1.11.1" + } + }, + "@webassemblyjs/wasm-parser": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.1.tgz", + "integrity": "sha512-rrBujw+dJu32gYB7/Lup6UhdkPx9S9SnobZzRVL7VcBH9Bt9bCBLEuX/YXOOtBsOZ4NQrRykKhffRWHvigQvOA==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-api-error": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/ieee754": "1.11.1", + "@webassemblyjs/leb128": "1.11.1", + "@webassemblyjs/utf8": "1.11.1" + } + }, + "@webassemblyjs/wast-printer": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.11.1.tgz", + "integrity": "sha512-IQboUWM4eKzWW+N/jij2sRatKMh99QEelo3Eb2q0qXkvPRISAj8Qxtmw5itwqK+TTkBuUIE45AxYPToqPtL5gg==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.11.1", + "@xtuc/long": "4.2.2" + } + }, + "@webpack-cli/configtest": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.2.0.tgz", + "integrity": "sha512-4FB8Tj6xyVkyqjj1OaTqCjXYULB9FMkqQ8yGrZjRDrYh0nOE+7Lhs45WioWQQMV+ceFlE368Ukhe6xdvJM9Egg==", + "dev": true, + "requires": {} + }, + "@webpack-cli/info": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.5.0.tgz", + "integrity": "sha512-e8tSXZpw2hPl2uMJY6fsMswaok5FdlGNRTktvFk2sD8RjH0hE2+XistawJx1vmKteh4NmGmNUrp+Tb2w+udPcQ==", + "dev": true, + "requires": { + "envinfo": "^7.7.3" + } + }, + "@webpack-cli/serve": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.7.0.tgz", + "integrity": "sha512-oxnCNGj88fL+xzV+dacXs44HcDwf1ovs3AuEzvP7mqXw7fQntqIhQ1BRmynh4qEKQSSSRSWVyXRjmTbZIX9V2Q==", + "dev": true, + "requires": {} + }, + "@xtuc/ieee754": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", + "dev": true + }, + "@xtuc/long": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", + "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", + "dev": true + }, + "accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "requires": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + } + }, + "acorn": { + "version": "8.8.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz", + "integrity": "sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==", + "dev": true + }, + "acorn-import-assertions": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz", + "integrity": "sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw==", + "dev": true, + "requires": {} + }, + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ajv-keywords": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", + "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", + "dev": true, + "requires": {} + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" + }, + "babylonjs": { + "version": "5.26.1", + "resolved": "https://registry.npmjs.org/babylonjs/-/babylonjs-5.26.1.tgz", + "integrity": "sha512-Qyr7UZW4XxJTFQZJZi2QkYrEIq0NzYITaMKOhpI++0XjacqYO0NAIPuGLykVSKdJseAwOPQIHvY/TfY2i/FjVA==" + }, + "body-parser": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.0.tgz", + "integrity": "sha512-DfJ+q6EPcGKZD1QWUjSpqp+Q7bDQTsQIF4zfUAtZ6qk+H/3/QRhg9CEp39ss+/T2vw0+HaidC0ecJj/DRLIaKg==", + "requires": { + "bytes": "3.1.2", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.10.3", + "raw-body": "2.5.1", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "browserslist": { + "version": "4.21.4", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.4.tgz", + "integrity": "sha512-CBHJJdDmgjl3daYjN5Cp5kbTf1mUhZoS+beLklHIvkOWscs83YAhLlF3Wsh/lciQYAcbBJgTOD44VtG31ZM4Hw==", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30001400", + "electron-to-chromium": "^1.4.251", + "node-releases": "^2.0.6", + "update-browserslist-db": "^1.0.9" + } + }, + "buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==" + }, + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, + "caniuse-lite": { + "version": "1.0.30001406", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001406.tgz", + "integrity": "sha512-bWTlaXUy/rq0BBtYShc/jArYfBPjEV95euvZ8JVtO43oQExEN/WquoqpufFjNu4kSpi5cy5kMbNvzztWDfv1Jg==", + "dev": true + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "dependencies": { + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "chrome-trace-event": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz", + "integrity": "sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==", + "dev": true + }, + "clone-deep": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "colorette": { + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.19.tgz", + "integrity": "sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==", + "dev": true + }, + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, + "content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "requires": { + "safe-buffer": "5.2.1" + } + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + }, + "cookie": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", + "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==" + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==" + }, + "destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==" + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" + }, + "electron-to-chromium": { + "version": "1.4.254", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.254.tgz", + "integrity": "sha512-Sh/7YsHqQYkA6ZHuHMy24e6TE4eX6KZVsZb9E/DvU1nQRIrH4BflO/4k+83tfdYvDl+MObvlqHPRICzEdC9c6Q==", + "dev": true + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==" + }, + "enhanced-resolve": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.10.0.tgz", + "integrity": "sha512-T0yTFjdpldGY8PmuXXR0PyQ1ufZpEGiHVrp7zHKB7jdR4qlmZHhONVM5AQOAWXuF/w3dnHbEQVrNptJgt7F+cQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" + } + }, + "envinfo": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.8.1.tgz", + "integrity": "sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw==", + "dev": true + }, + "es-module-lexer": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz", + "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==", + "dev": true + }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" + }, + "eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + } + }, + "esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "requires": { + "estraverse": "^5.2.0" + }, + "dependencies": { + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + } + } + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==" + }, + "events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "dev": true + }, + "express": { + "version": "4.18.1", + "resolved": "https://registry.npmjs.org/express/-/express-4.18.1.tgz", + "integrity": "sha512-zZBcOX9TfehHQhtupq57OF8lFZ3UZi08Y97dwFCkD8p9d/d2Y3M+ykKcwaMDEL+4qyUolgBDX6AblpR3fL212Q==", + "requires": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.0", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.5.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.2.0", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.7", + "qs": "6.10.3", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.18.0", + "serve-static": "1.15.0", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + } + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "fastest-levenshtein": { + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", + "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", + "dev": true + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "finalhandler": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", + "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + } + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==" + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==" + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "get-intrinsic": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", + "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.3" + } + }, + "glob-to-regexp": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", + "dev": true + }, + "graceful-fs": { + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", + "dev": true + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" + }, + "http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "requires": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + } + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "import-local": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", + "integrity": "sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==", + "dev": true, + "requires": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "interpret": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz", + "integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==", + "dev": true + }, + "ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" + }, + "is-core-module": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz", + "integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "dev": true + }, + "jest-worker": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", + "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", + "dev": true, + "requires": { + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + } + }, + "json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true + }, + "loader-runner": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz", + "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==", + "dev": true + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==" + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" + }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==" + }, + "micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "requires": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + } + }, + "mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" + }, + "mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" + }, + "mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "requires": { + "mime-db": "1.52.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==" + }, + "neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "dev": true + }, + "node-releases": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.6.tgz", + "integrity": "sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==", + "dev": true + }, + "object-inspect": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", + "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==" + }, + "on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "requires": { + "ee-first": "1.1.1" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" + }, + "picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true + }, + "pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "requires": { + "find-up": "^4.0.0" + } + }, + "proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "requires": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + } + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, + "qs": { + "version": "6.10.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", + "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", + "requires": { + "side-channel": "^1.0.4" + } + }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" + }, + "raw-body": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", + "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "requires": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + } + }, + "rechoir": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.1.tgz", + "integrity": "sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==", + "dev": true, + "requires": { + "resolve": "^1.9.0" + } + }, + "resolve": { + "version": "1.22.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", + "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", + "dev": true, + "requires": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "dev": true, + "requires": { + "resolve-from": "^5.0.0" + } + }, + "resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "schema-utils": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz", + "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + } + }, + "semver": { + "version": "7.3.7", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", + "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "send": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", + "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "requires": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "dependencies": { + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + } + } + }, + "serialize-javascript": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", + "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "dev": true, + "requires": { + "randombytes": "^2.1.0" + } + }, + "serve-static": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", + "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.18.0" + } + }, + "setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, + "shallow-clone": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", + "dev": true, + "requires": { + "kind-of": "^6.0.2" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "requires": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==" + }, + "supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true + }, + "tapable": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", + "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", + "dev": true + }, + "terser": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.15.0.tgz", + "integrity": "sha512-L1BJiXVmheAQQy+as0oF3Pwtlo4s3Wi1X2zNZ2NxOB4wx9bdS9Vk67XQENLFdLYGCK/Z2di53mTj/hBafR+dTA==", + "dev": true, + "requires": { + "@jridgewell/source-map": "^0.3.2", + "acorn": "^8.5.0", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + } + }, + "terser-webpack-plugin": { + "version": "5.3.6", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.6.tgz", + "integrity": "sha512-kfLFk+PoLUQIbLmB1+PZDMRSZS99Mp+/MHqDNmMA6tOItzRt+Npe3E+fsMs5mfcM0wCtrrdU387UnV+vnSffXQ==", + "dev": true, + "requires": { + "@jridgewell/trace-mapping": "^0.3.14", + "jest-worker": "^27.4.5", + "schema-utils": "^3.1.1", + "serialize-javascript": "^6.0.0", + "terser": "^5.14.1" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" + }, + "ts-loader": { + "version": "9.4.1", + "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.4.1.tgz", + "integrity": "sha512-384TYAqGs70rn9F0VBnh6BPTfhga7yFNdC5gXbQpDrBj9/KsT4iRkGqKXhziofHOlE2j6YEaiTYVGKKvPhGWvw==", + "dev": true, + "requires": { + "chalk": "^4.1.0", + "enhanced-resolve": "^5.0.0", + "micromatch": "^4.0.0", + "semver": "^7.3.4" + } + }, + "type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + } + }, + "typescript": { + "version": "4.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.3.tgz", + "integrity": "sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig==", + "dev": true + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==" + }, + "update-browserslist-db": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.9.tgz", + "integrity": "sha512-/xsqn21EGVdXI3EXSum1Yckj3ZVZugqyOZQ/CxYPBD/R+ko9NSUScf8tFF4dOKY+2pvSSJA/S+5B8s4Zr4kyvg==", + "dev": true, + "requires": { + "escalade": "^3.1.1", + "picocolors": "^1.0.0" + } + }, + "uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==" + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==" + }, + "watchpack": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", + "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", + "dev": true, + "requires": { + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.1.2" + } + }, + "webpack": { + "version": "5.74.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.74.0.tgz", + "integrity": "sha512-A2InDwnhhGN4LYctJj6M1JEaGL7Luj6LOmyBHjcI8529cm5p6VXiTIW2sn6ffvEAKmveLzvu4jrihwXtPojlAA==", + "dev": true, + "requires": { + "@types/eslint-scope": "^3.7.3", + "@types/estree": "^0.0.51", + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/wasm-edit": "1.11.1", + "@webassemblyjs/wasm-parser": "1.11.1", + "acorn": "^8.7.1", + "acorn-import-assertions": "^1.7.6", + "browserslist": "^4.14.5", + "chrome-trace-event": "^1.0.2", + "enhanced-resolve": "^5.10.0", + "es-module-lexer": "^0.9.0", + "eslint-scope": "5.1.1", + "events": "^3.2.0", + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.2.9", + "json-parse-even-better-errors": "^2.3.1", + "loader-runner": "^4.2.0", + "mime-types": "^2.1.27", + "neo-async": "^2.6.2", + "schema-utils": "^3.1.0", + "tapable": "^2.1.1", + "terser-webpack-plugin": "^5.1.3", + "watchpack": "^2.4.0", + "webpack-sources": "^3.2.3" + } + }, + "webpack-cli": { + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.10.0.tgz", + "integrity": "sha512-NLhDfH/h4O6UOy+0LSso42xvYypClINuMNBVVzX4vX98TmTaTUxwRbXdhucbFMd2qLaCTcLq/PdYrvi8onw90w==", + "dev": true, + "requires": { + "@discoveryjs/json-ext": "^0.5.0", + "@webpack-cli/configtest": "^1.2.0", + "@webpack-cli/info": "^1.5.0", + "@webpack-cli/serve": "^1.7.0", + "colorette": "^2.0.14", + "commander": "^7.0.0", + "cross-spawn": "^7.0.3", + "fastest-levenshtein": "^1.0.12", + "import-local": "^3.0.2", + "interpret": "^2.2.0", + "rechoir": "^0.7.0", + "webpack-merge": "^5.7.3" + }, + "dependencies": { + "commander": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", + "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "dev": true + } + } + }, + "webpack-merge": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.8.0.tgz", + "integrity": "sha512-/SaI7xY0831XwP6kzuwhKWVKDP9t1QY1h65lAFLbZqMPIuYcD9QAW4u9STIbU9kaJbPBB/geU/gLr1wDjOhQ+Q==", + "dev": true, + "requires": { + "clone-deep": "^4.0.1", + "wildcard": "^2.0.0" + } + }, + "webpack-sources": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", + "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "wildcard": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.0.tgz", + "integrity": "sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==", + "dev": true + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 00000000..8fbc4407 --- /dev/null +++ b/package.json @@ -0,0 +1,36 @@ +{ + "name": "cs4241_assignment_3", + "version": "1.0.0", + "description": "Assignment 3 - Persistence: Two-tier Web Application with Database, Express server, and CSS template", + "type": "module", + "main": "/server/server.js", + "scripts": { + "start": "node server/server.mjs", + "build": "tsc && webpack", + "prestart": "npm run build" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/CJACOBSON32/cs4241_Assignment_3.git" + }, + "keywords": [], + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/CJACOBSON32/cs4241_Assignment_3/issues" + }, + "dependencies": { + "babylonjs": "^5.26.1", + "express": "^4.18.1" + }, + "homepage": "https://github.com/CJACOBSON32/cs4241_Assignment_3#readme", + "devDependencies": { + "@types/babylonjs": "^2.4.1", + "@types/express": "^4.17.14", + "@types/node": "^18.7.18", + "ts-loader": "^9.4.1", + "typescript": "^4.8.3", + "webpack": "^5.74.0", + "webpack-cli": "^4.10.0" + } +} diff --git a/server/server.js b/server/server.js new file mode 100644 index 00000000..86c4c9f1 --- /dev/null +++ b/server/server.js @@ -0,0 +1,7 @@ +import express from "express"; +const port = '3000'; +// Setup static express +const app = express(); +app.use(express.static('src')); +app.listen(process.env.PORT || port); +console.log(`Listening on port ${process.env.PORT || port}`); diff --git a/server/server.ts b/server/server.ts new file mode 100644 index 00000000..7538fcb3 --- /dev/null +++ b/server/server.ts @@ -0,0 +1,12 @@ +import express from "express"; + +const port = '3000'; + +// Setup static express +const app = express(); + +app.use(express.static('src')); + + +app.listen( process.env.PORT || port ); +console.log(`Listening on port ${process.env.PORT || port}`); \ No newline at end of file diff --git a/src/assets/eraser-variant.svg b/src/assets/eraser-variant.svg new file mode 100644 index 00000000..fe220c55 --- /dev/null +++ b/src/assets/eraser-variant.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/css/styles.css b/src/css/styles.css new file mode 100644 index 00000000..61187617 --- /dev/null +++ b/src/css/styles.css @@ -0,0 +1,77 @@ +/*fonts*/ +@import +url('https://fonts.googleapis.com/css2?family=Roboto&display=swap'); + +* { + font-family: 'Roboto', sans-serif; +} + +/*Global fonts*/ +h1 { + font-size: 60pt; +} + +h1, h2, h3 { + font-weight: 100; +} + +/*Universal formatting*/ +* { + box-sizing: border-box; +} + +/*Fill the screen*/ +body { + height: 100vh; + max-height: 100vh; + display: flex; + flex-direction: column; + align-items: center; +} + +/*Animate a fade-in entry for every site element*/ +:not(body, div, section, html) { + animation: loadin 1s ease forwards; +} + +@keyframes loadin { + from { + opacity: 0; + transform: translateY(10pt); + } + to { + opacity: 1; + transform: translateY(0pt); + } +} + +/* Organizational */ +.content { /* Dynamically sets side margins to center content cross-platform */ + width: clamp(400px, 67%, 1280px); +} + +.hbox { + display: flex; + flex-direction: row; +} + +.vbox { + display: flex; + flex-direction: column; +} + +.flex-center { + display: flex; + align-content: center; + justify-items: center; +} + +/* Canvas Styles */ +#canvas-container { + width: 80%; + flex-grow: 1; +} +canvas { + width: 100%; + height: 100%; +} \ No newline at end of file diff --git a/src/dist/index.bundle.js b/src/dist/index.bundle.js new file mode 100644 index 00000000..17de3adb --- /dev/null +++ b/src/dist/index.bundle.js @@ -0,0 +1,152 @@ +/* + * 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/babylonjs/babylon.js": +/*!*******************************************!*\ + !*** ./node_modules/babylonjs/babylon.js ***! + \*******************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +eval("!function(e,t){ true?module.exports=t():0}(\"undefined\"!=typeof self?self:\"undefined\"!=typeof __webpack_require__.g?__webpack_require__.g:this,(()=>(()=>{\"use strict\";var e={d:(t,i)=>{for(var n in i)e.o(i,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:i[n]})}};e.g=function(){if(\"object\"==typeof globalThis)return globalThis;try{return this||new Function(\"return this\")()}catch(e){if(\"object\"==typeof window)return window}}(),e.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),e.r=e=>{\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(e,\"__esModule\",{value:!0})};var t={};e.d(t,{default:()=>aS});var i={};e.r(i),e.d(i,{AxesViewer:()=>Vc,BoneAxesViewer:()=>kc,DebugLayer:()=>Gc,DebugLayerTab:()=>Lc,DirectionalLightFrustumViewer:()=>vu,PhysicsViewer:()=>Zc,RayHelper:()=>cu,SkeletonViewer:()=>gu});var n={};e.r(n),e.d(n,{AbstractActionManager:()=>s,AbstractAssetTask:()=>hT,AbstractMesh:()=>Sr,AbstractScene:()=>o,AcquireNativeObjectAsync:()=>dh,Action:()=>w,ActionEvent:()=>B,ActionManager:()=>le,AddBlock:()=>lg,AddressMode:()=>Mh,AdvancedTimer:()=>$f,AlphaState:()=>Lt,AmmoJSPlugin:()=>X_,AnaglyphArcRotateCamera:()=>rl,AnaglyphFreeCamera:()=>ol,AnaglyphGamepadCamera:()=>al,AnaglyphPostProcess:()=>il,AnaglyphUniversalCamera:()=>sl,Analyser:()=>zr,AndOrNotEvaluator:()=>he,Angle:()=>An,Animatable:()=>bn,AnimatedInputBlockTypes:()=>$o,Animation:()=>ze,AnimationEvent:()=>zn,AnimationGroup:()=>Hn,AnimationKeyInterpolation:()=>Ne,AnimationPropertiesOverride:()=>En,AnimationRange:()=>we,AnisotropyBlock:()=>Qg,ApplyPostProcess:()=>Uu,Arc2:()=>Rn,ArcFollowCamera:()=>Gs,ArcRotateCamera:()=>Ls,ArcRotateCameraGamepadInput:()=>cs,ArcRotateCameraInputsManager:()=>ps,ArcRotateCameraKeyboardMoveInput:()=>us,ArcRotateCameraMouseWheelInput:()=>hs,ArcRotateCameraPointersInput:()=>ds,ArcRotateCameraVRDeviceOrientationInput:()=>fs,ArcTan2Block:()=>Og,AssetContainer:()=>Gr,AssetTaskState:()=>lT,AssetsManager:()=>ET,AssetsProgressEvent:()=>dT,AsyncLoop:()=>vi,AttachToBoxBehavior:()=>ho,AudioEngine:()=>Wr,AudioSceneComponent:()=>jr,AutoLayoutMode:()=>Uh,AutoReleaseWorkerPool:()=>Pf,AutoRotationBehavior:()=>so,AxesViewer:()=>Vc,Axis:()=>vn,AxisDragGizmo:()=>Uc,AxisScaleGizmo:()=>Tp,BRDFTextureTools:()=>Jp,BabylonFileLoaderConfiguration:()=>K_,BackEase:()=>On,BackgroundMaterial:()=>jp,BakedVertexAnimationManager:()=>Kr,BaseCameraMouseWheelInput:()=>is,BaseCameraPointersInput:()=>ns,BaseError:()=>ot,BaseParticleSystem:()=>Pa,BaseSixDofDragBehavior:()=>Eo,BaseTexture:()=>qr,BasisTools:()=>xm,BasisToolsOptions:()=>vm,BasisTranscodeConfiguration:()=>gm,BezierCurve:()=>Sn,BezierCurveEase:()=>Gn,BinaryFileAssetTask:()=>mT,BlackAndWhitePostProcess:()=>nb,BlendFactor:()=>Wh,BlendOperation:()=>Hh,BloomEffect:()=>sb,BloomMergePostProcess:()=>ab,BlurPostProcess:()=>zp,Bone:()=>yn,BoneAxesViewer:()=>kc,BoneIKController:()=>Ja,BoneLookController:()=>$a,BonesBlock:()=>Vm,BounceEase:()=>Dn,BouncingBehavior:()=>lo,BoundingBox:()=>tr,BoundingBoxGizmo:()=>Ep,BoundingBoxRenderer:()=>Wb,BoundingInfo:()=>sr,BoundingSphere:()=>ir,BoxBuilder:()=>Hc,BoxParticleEmitter:()=>va,Buffer:()=>Fi,BufferBindingType:()=>Nh,BufferUsage:()=>Eh,CSG:()=>Ov,Camera:()=>xr,CameraGizmo:()=>Gp,CameraInputTypes:()=>rs,CameraInputsManager:()=>os,CannonJSPlugin:()=>W_,CanvasAlphaMode:()=>ed,CapsuleBuilder:()=>qc,CascadedShadowGenerator:()=>P_,ChromaticAberrationPostProcess:()=>lb,CircleEase:()=>In,CircleOfConfusionPostProcess:()=>cb,ClampBlock:()=>ug,ClearCoatBlock:()=>Zg,ClipPlanesBlock:()=>sg,ClipboardEventTypes:()=>hp,ClipboardInfo:()=>dp,CloudBlock:()=>sv,CloudPoint:()=>Wy,Collider:()=>Cc,Color3:()=>N,Color3Gradient:()=>Py,Color4:()=>L,ColorCorrectionPostProcess:()=>ub,ColorCurves:()=>Si,ColorGradient:()=>Cy,ColorGradingTexture:()=>lm,ColorMergerBlock:()=>_g,ColorSplitterBlock:()=>Ma,ColorWriteFlags:()=>zh,CombineAction:()=>ne,CompareFunction:()=>Oh,CompatibilityOptions:()=>pr,CompilationMessageType:()=>Bh,ComputeBindingType:()=>Mc,ComputeEffect:()=>Ic,ComputePassTimestampLocation:()=>Qh,ComputePressureObserverWrapper:()=>fn,ComputeShader:()=>Oc,ComputeShaderParticleSystem:()=>Ry,Condition:()=>X,ConditionalBlock:()=>av,ConditionalBlockConditions:()=>rv,ConeParticleEmitter:()=>ya,Constants:()=>a,ContainerAssetTask:()=>pT,ConvolutionPostProcess:()=>hb,Coordinate:()=>gn,CopyTools:()=>eo,CreateBox:()=>Wc,CreateBoxVertexData:()=>zc,CreateCapsule:()=>Qc,CreateCapsuleVertexData:()=>Kc,CreateCylinder:()=>sc,CreateCylinderVertexData:()=>ac,CreateDashedLines:()=>su,CreateDashedLinesVertexData:()=>ru,CreateDecal:()=>ty,CreateDisc:()=>Fp,CreateDiscVertexData:()=>Lp,CreateEnvTextureAsync:()=>Qu,CreateGeodesic:()=>sy,CreateGoldberg:()=>cy,CreateGoldbergVertexData:()=>ly,CreateGround:()=>mc,CreateGroundFromHeightMap:()=>vc,CreateGroundFromHeightMapVertexData:()=>_c,CreateGroundVertexData:()=>pc,CreateHemisphere:()=>Bp,CreateIcoSphere:()=>Va,CreateIcoSphereVertexData:()=>Ua,CreateImageDataArrayBufferViews:()=>Zu,CreateLathe:()=>Zv,CreateLineSystem:()=>ou,CreateLineSystemVertexData:()=>nu,CreateLines:()=>au,CreatePlane:()=>go,CreatePlaneVertexData:()=>mo,CreatePolygon:()=>Kv,CreatePolygonVertexData:()=>Yv,CreatePolyhedron:()=>Pp,CreatePolyhedronVertexData:()=>Cp,CreateResizedCopy:()=>Bu,CreateRibbon:()=>hu,CreateRibbonVertexData:()=>uu,CreateScreenshot:()=>HT,CreateScreenshotAsync:()=>XT,CreateScreenshotUsingRenderTarget:()=>YT,CreateScreenshotUsingRenderTargetAsync:()=>KT,CreateScreenshotWithResizeAsync:()=>jT,CreateSphere:()=>jc,CreateSphereVertexData:()=>Xc,CreateTiledBox:()=>Uv,CreateTiledBoxVertexData:()=>Bv,CreateTiledGround:()=>gc,CreateTiledGroundVertexData:()=>fc,CreateTiledPlane:()=>Fv,CreateTiledPlaneVertexData:()=>Lv,CreateTorus:()=>uc,CreateTorusKnot:()=>Gv,CreateTorusKnotVertexData:()=>kv,CreateTorusVertexData:()=>cc,CreateTube:()=>$v,CrossBlock:()=>hg,CubeMapToSphericalPolynomialTools:()=>Hu,CubeTexture:()=>Hp,CubeTextureAssetTask:()=>yT,CubicEase:()=>Nn,CullMode:()=>Gh,CurrentScreenBlock:()=>aa,Curve3:()=>Pn,CustomBlock:()=>dg,CustomOptimization:()=>NT,CustomParticleEmitter:()=>xa,CustomProceduralTexture:()=>Dm,CylinderBuilder:()=>lc,CylinderDirectedParticleEmitter:()=>Ta,CylinderParticleEmitter:()=>ba,DDSTools:()=>Sf,DataBuffer:()=>Vt,DataReader:()=>$T,DataStorage:()=>eE,Database:()=>Ey,DaydreamController:()=>pp,DebugLayer:()=>Gc,DebugLayerTab:()=>Lc,DecalBuilder:()=>iy,Decode:()=>ut,DecodeBase64ToBinary:()=>pt,DecodeBase64ToString:()=>dt,DecodeBase64UrlToBinary:()=>ci,DecodeBase64UrlToString:()=>hi,DeepCopier:()=>se,DefaultCollisionCoordinator:()=>Pc,DefaultLoadingScreen:()=>O_,DefaultRenderingPipeline:()=>Ob,Deferred:()=>ST,DepthCullingState:()=>Dt,DepthOfFieldBlurPostProcess:()=>db,DepthOfFieldEffect:()=>mb,DepthOfFieldEffectBlurLevel:()=>pb,DepthOfFieldMergePostProcess:()=>_b,DepthOfFieldMergePostProcessOptions:()=>fb,DepthPeelingRenderer:()=>jb,DepthPeelingSceneComponent:()=>Yb,DepthReducer:()=>E_,DepthRenderer:()=>b_,DepthRendererSceneComponent:()=>Hb,DepthSortedParticle:()=>ky,DerivativeBlock:()=>Km,DesaturateBlock:()=>Yg,DetailMapConfiguration:()=>zl,DeviceInputEventType:()=>Ni,DeviceLostReason:()=>td,DeviceOrientationCamera:()=>Fs,DeviceSource:()=>rn,DeviceSourceManager:()=>an,DeviceType:()=>xi,DirectionalLight:()=>Np,DirectionalLightFrustumViewer:()=>vu,DiscBuilder:()=>wp,DiscardBlock:()=>jm,DisplayPassPostProcess:()=>gb,DistanceBlock:()=>xg,DistanceJoint:()=>Io,DivideBlock:()=>vg,DoNothingAction:()=>ie,DomManagement:()=>tt,DotBlock:()=>pg,DracoCompression:()=>Av,DrawWrapper:()=>Ht,DualSenseInput:()=>Ii,DualShockButton:()=>js,DualShockDpad:()=>Ys,DualShockInput:()=>Mi,DualShockPad:()=>Qs,DynamicFloat32Array:()=>lE,DynamicTexture:()=>jl,EasingFunction:()=>Mn,EdgesRenderer:()=>Qb,Effect:()=>Ot,EffectFallbacks:()=>ua,EffectLayer:()=>c_,EffectLayerSceneComponent:()=>u_,EffectRenderer:()=>L_,EffectWrapper:()=>F_,ElasticEase:()=>Ln,ElbowBlock:()=>cv,EncodeArrayBufferToBase64:()=>ht,EndsWith:()=>lt,Engine:()=>vr,EngineFactory:()=>up,EngineInstrumentation:()=>s_,EngineStore:()=>S,EngineView:()=>Au,EnvironmentHelper:()=>Yp,EnvironmentTextureTools:()=>nh,Epsilon:()=>_,EquiRectangularCubeTexture:()=>cm,EquiRectangularCubeTextureAssetTask:()=>TT,ErrorCodes:()=>at,ErrorFilter:()=>id,EventConstants:()=>Ji,EventState:()=>l,ExecuteCodeAction:()=>re,ExponentialEase:()=>Fn,ExternalTexture:()=>Ud,ExtractHighlightsPostProcess:()=>ob,ExtrudePolygon:()=>Qv,ExtrudeShape:()=>pu,ExtrudeShapeCustom:()=>fu,FactorGradient:()=>My,FadeInOutBehavior:()=>po,FeatureName:()=>Th,FileTools:()=>ui,FileToolsOptions:()=>$t,FilesInput:()=>RT,FilesInputStore:()=>nt,FilterMode:()=>Ih,FilterPostProcess:()=>vb,FlyCamera:()=>Bs,FlyCameraInputsManager:()=>ws,FlyCameraKeyboardInput:()=>_s,FlyCameraMouseInput:()=>ms,FogBlock:()=>eg,FollowBehavior:()=>Ro,FollowCamera:()=>ks,FollowCameraInputsManager:()=>Us,FollowCameraKeyboardMoveInput:()=>gs,FollowCameraMouseWheelInput:()=>vs,FollowCameraPointersInput:()=>ys,FragCoordBlock:()=>Qm,FragmentOutputBlock:()=>Jo,FramingBehavior:()=>co,FreeCamera:()=>Ds,FreeCameraDeviceOrientationInput:()=>xs,FreeCameraGamepadInput:()=>Ps,FreeCameraInputsManager:()=>Rs,FreeCameraKeyboardMoveInput:()=>bs,FreeCameraMouseInput:()=>Es,FreeCameraMouseWheelInput:()=>Ss,FreeCameraTouchInput:()=>As,FreeCameraVirtualJoystickInput:()=>Is,FresnelBlock:()=>Sg,FresnelParameters:()=>nm,FromHalfFloat:()=>ku,FrontFace:()=>kh,FrontFacingBlock:()=>Ym,Frustum:()=>hn,FxaaPostProcess:()=>yb,GPUParticleSystem:()=>Ly,GUID:()=>_i,Gamepad:()=>ss,GamepadCamera:()=>$s,GamepadManager:()=>qs,GamepadSystemSceneComponent:()=>Zs,GearVRController:()=>fp,GenerateBase64StringFromPixelData:()=>Zr,GenerateBase64StringFromTexture:()=>Jr,GenerateBase64StringFromTextureAsync:()=>$r,GenericController:()=>_p,GenericPad:()=>ls,GeodesicData:()=>ay,Geometry:()=>fr,GeometryBufferRenderer:()=>Eb,GeometryBufferRendererSceneComponent:()=>Ab,GetClass:()=>T,GetDOMTextContent:()=>$e,GetEnvInfo:()=>Yu,GetEnvironmentBRDFTexture:()=>Zp,GetInternalFormatFromBasisFormat:()=>ym,GetTGAHeader:()=>hm,Gizmo:()=>Bc,GizmoManager:()=>Op,GlowLayer:()=>h_,GoldbergMesh:()=>Dv,GradientBlock:()=>Vg,GradientBlockColorStep:()=>Ug,GradientHelper:()=>Iy,GrainPostProcess:()=>bb,GroundBuilder:()=>yc,GroundMesh:()=>dc,HDRCubeTexture:()=>B_,HDRCubeTextureAssetTask:()=>bT,HDRFiltering:()=>w_,HDRTools:()=>N_,HandConstraintBehavior:()=>Za,HandConstraintOrientation:()=>Xa,HandConstraintVisibility:()=>ja,HandConstraintZone:()=>Ha,HandPart:()=>Ga,HardwareScalingOptimization:()=>MT,HeightToNormalBlock:()=>$m,HemisphereBuilder:()=>Up,HemisphericLight:()=>Pl,HemisphericParticleEmitter:()=>Ea,HighlightLayer:()=>p_,HighlightsPostProcess:()=>Tb,Hinge2Joint:()=>No,HingeJoint:()=>Do,HtmlElementTexture:()=>um,IWebXRControllerPhysicsOptions:()=>SE,IcoSphereBuilder:()=>Wa,ImageAssetTask:()=>gT,ImageProcessingBlock:()=>Wm,ImageProcessingConfiguration:()=>Ri,ImageProcessingConfigurationDefines:()=>Ai,ImageProcessingPostProcess:()=>Ql,ImageSourceBlock:()=>ig,IncrementValueAction:()=>$,IndexFormat:()=>jh,InputBlock:()=>oa,InputStepMode:()=>Kh,InspectableType:()=>qT,InstancedLinesMesh:()=>iu,InstancedMesh:()=>Jc,InstancesBlock:()=>km,InstantiatedEntries:()=>kr,InternalTexture:()=>wt,InternalTextureSource:()=>Rt,InterpolateValueAction:()=>We,IntersectionInfo:()=>er,IsBase64DataUrl:()=>si,IsDocumentAvailable:()=>Je,IsFileURL:()=>ai,IsNavigatorAvailable:()=>Ze,IsWindowObjectExist:()=>qe,JoystickAxis:()=>Cs,KeepAssets:()=>Vr,KeyboardEventTypes:()=>Ki,KeyboardInfo:()=>Qi,KeyboardInfoPre:()=>qi,KhronosTextureContainer:()=>xf,KhronosTextureContainer2:()=>Mf,LatheBuilder:()=>Jv,Layer:()=>__,LayerSceneComponent:()=>f_,LengthBlock:()=>Cg,LensFlare:()=>m_,LensFlareSystem:()=>g_,LensFlareSystemSceneComponent:()=>v_,LensFlaresOptimization:()=>DT,LensRenderingPipeline:()=>Db,LerpBlock:()=>gg,Light:()=>Cl,LightBlock:()=>tg,LightGizmo:()=>kp,LightInformationBlock:()=>zm,LineEdgesRenderer:()=>qb,LinesBuilder:()=>lu,LinesMesh:()=>tu,LoadFile:()=>ri,LoadFileError:()=>qt,LoadImage:()=>ii,LoadOp:()=>Zh,LoadTextureFromTranscodeResult:()=>Rm,Logger:()=>Q,MapMode:()=>Sh,Material:()=>Ir,MaterialAnisotropicDefines:()=>af,MaterialClearCoatDefines:()=>tf,MaterialDefines:()=>Ei,MaterialDetailMapDefines:()=>Gl,MaterialFlags:()=>Nl,MaterialHelper:()=>Pr,MaterialIridescenceDefines:()=>rf,MaterialPluginBase:()=>kl,MaterialPluginEvent:()=>Ar,MaterialPluginManager:()=>Ll,MaterialSheenDefines:()=>lf,MaterialSubSurfaceDefines:()=>uf,Matrix:()=>M,MatrixBuilderBlock:()=>ov,MaxBlock:()=>Ag,MergeMeshesOptimization:()=>wT,Mesh:()=>Ur,MeshAssetTask:()=>fT,MeshBuilder:()=>hy,MeshExploder:()=>AT,MeshLODLevel:()=>Dr,MeshParticleEmitter:()=>Ca,MeshoptCompression:()=>Rv,MinBlock:()=>Rg,MinMaxReducer:()=>T_,MirrorTexture:()=>Wp,ModBlock:()=>nv,ModelShape:()=>Vy,MorphTarget:()=>U_,MorphTargetManager:()=>k_,MorphTargetsBlock:()=>Gm,MotionBlurPostProcess:()=>Rb,MotorEnabledJoint:()=>Oo,MultiMaterial:()=>Or,MultiObserver:()=>xT,MultiPointerScaleBehavior:()=>To,MultiRenderTarget:()=>Mm,MultiplyBlock:()=>ga,NLerpBlock:()=>kg,NativeDataStream:()=>Iu,NativeEngine:()=>vh,NativePointerInput:()=>Pi,NativeXRFrame:()=>tS,NativeXRLayerRenderTargetTextureProvider:()=>nc,NativeXRLayerWrapper:()=>ic,NativeXRRenderTarget:()=>rc,NegateBlock:()=>Pg,Node:()=>Ue,NodeMaterial:()=>Ba,NodeMaterialBlock:()=>Xo,NodeMaterialBlockConnectionPointMode:()=>qo,NodeMaterialBlockConnectionPointTypes:()=>wo,NodeMaterialBlockTargets:()=>Bo,NodeMaterialConnectionPoint:()=>Ho,NodeMaterialConnectionPointCompatibilityStates:()=>ko,NodeMaterialConnectionPointCustomObject:()=>Um,NodeMaterialConnectionPointDirection:()=>Go,NodeMaterialDefines:()=>wa,NodeMaterialModes:()=>ma,NodeMaterialOptimizer:()=>uv,NodeMaterialSystemValues:()=>Zo,NoiseProceduralTexture:()=>Nm,NormalBlendBlock:()=>Wg,NormalizeBlock:()=>fg,NullEngine:()=>bu,NullEngineOptions:()=>yu,Observable:()=>u,Observer:()=>c,OcclusionMaterial:()=>rm,Octree:()=>Nc,OctreeBlock:()=>Dc,OctreeSceneComponent:()=>Fc,OculusTouchController:()=>mp,OimoJSPlugin:()=>H_,OnAfterEnteringVRObservableEvent:()=>Ac,OneMinusBlock:()=>Tg,Orientation:()=>Tn,OutlineRenderer:()=>nT,PBRAnisotropicConfiguration:()=>sf,PBRBaseMaterial:()=>ff,PBRBaseSimpleMaterial:()=>om,PBRClearCoatConfiguration:()=>nf,PBRIridescenceConfiguration:()=>of,PBRMaterial:()=>_f,PBRMaterialDefines:()=>pf,PBRMetallicRoughnessBlock:()=>iv,PBRMetallicRoughnessMaterial:()=>am,PBRSheenConfiguration:()=>cf,PBRSpecularGlossinessMaterial:()=>sm,PBRSubSurfaceConfiguration:()=>hf,PHI:()=>f,PadNumber:()=>ft,PanoramaToCubeMapTools:()=>D_,Particle:()=>Oy,ParticleBlendMultiplyBlock:()=>ca,ParticleHelper:()=>wy,ParticleRampGradientBlock:()=>la,ParticleSystem:()=>Ny,ParticleSystemSet:()=>Fy,ParticleTextureBlock:()=>sa,ParticlesOptimization:()=>LT,PassCubePostProcess:()=>tl,PassPostProcess:()=>el,Path2:()=>xn,Path3D:()=>Cn,PathCursor:()=>Xn,PerfCollectionStrategy:()=>mE,PerfCounter:()=>cn,PerformanceConfigurator:()=>E,PerformanceMonitor:()=>_r,PerformanceViewerCollector:()=>fE,PerturbNormalBlock:()=>Xm,PhotoDome:()=>Qp,PhysicsEngine:()=>G_,PhysicsEngineSceneComponent:()=>Ky,PhysicsHelper:()=>Qy,PhysicsImpostor:()=>Fo,PhysicsJoint:()=>Mo,PhysicsRadialExplosionEventOptions:()=>eb,PhysicsRadialImpulseFalloff:()=>jy,PhysicsUpdraftEventOptions:()=>tb,PhysicsUpdraftMode:()=>Yy,PhysicsViewer:()=>Zc,PhysicsVortexEventOptions:()=>ib,PickingInfo:()=>Bi,PivotTools:()=>_o,Plane:()=>un,PlaneBuilder:()=>vo,PlaneDragGizmo:()=>Rp,PlaneRotationGizmo:()=>Sp,PlayAnimationAction:()=>ee,PlaySoundAction:()=>ce,PointColor:()=>By,PointLight:()=>I_,PointParticleEmitter:()=>Sa,PointerDragBehavior:()=>bo,PointerEventTypes:()=>Hi,PointerInfo:()=>Yi,PointerInfoBase:()=>Xi,PointerInfoPre:()=>ji,PointerInput:()=>Ci,PointsCloudSystem:()=>Xy,PointsGroup:()=>Hy,Polar:()=>bv,Polygon:()=>Xv,PolygonBuilder:()=>qv,PolygonMeshBuilder:()=>jv,PolyhedronBuilder:()=>Mp,PolyhedronData:()=>oy,PoseEnabledController:()=>Xs,PoseEnabledControllerHelper:()=>Hs,PoseEnabledControllerType:()=>Vs,PositionGizmo:()=>xp,PositionNormalTextureVertex:()=>ta,PositionNormalVertex:()=>ea,PostProcess:()=>pa,PostProcessManager:()=>Ui,PostProcessRenderEffect:()=>rb,PostProcessRenderPipeline:()=>Pb,PostProcessRenderPipelineManager:()=>Mb,PostProcessRenderPipelineManagerSceneComponent:()=>Ib,PostProcessesOptimization:()=>OT,PosterizeBlock:()=>wg,PowBlock:()=>Mg,PowerEase:()=>wn,PowerPreference:()=>bh,PrePassRenderer:()=>Jb,PrePassRendererSceneComponent:()=>$b,PrecisionDate:()=>it,PredefinedColorSpace:()=>yh,PredicateCondition:()=>Y,PrimitiveTopology:()=>Vh,ProceduralTexture:()=>Na,ProceduralTextureSceneComponent:()=>Oa,PropertyTypeForEdition:()=>Yo,PushMaterial:()=>Vo,QuadraticEase:()=>Bn,QuadraticErrorSimplification:()=>vy,QuarticEase:()=>Un,Quaternion:()=>P,QueryType:()=>$h,QuinticEase:()=>Vn,RGBDTextureTools:()=>zu,RandomGUID:()=>fi,RandomNumberBlock:()=>Ig,RawCubeTexture:()=>Lm,RawTexture:()=>oo,RawTexture2DArray:()=>V_,RawTexture3D:()=>Fm,Ray:()=>fo,RayHelper:()=>cu,ReadFile:()=>ni,ReadFileError:()=>Jt,RecastJSCrowd:()=>Ty,RecastJSPlugin:()=>by,ReciprocalBlock:()=>Ng,ReflectBlock:()=>Xg,ReflectionBlock:()=>qg,ReflectionProbe:()=>j_,ReflectionTextureBlock:()=>og,Reflector:()=>sE,RefractBlock:()=>jg,RefractionBlock:()=>$g,RefractionPostProcess:()=>xb,RefractionTexture:()=>wm,RegisterClass:()=>b,RegisterMaterialPlugin:()=>Bl,RegisterNativeTypeAsync:()=>ph,RemapBlock:()=>_a,RenderPassTimestampLocation:()=>qh,RenderTargetTexture:()=>Ia,RenderTargetWrapper:()=>ha,RenderTargetsOptimization:()=>FT,RenderingGroup:()=>Vi,RenderingGroupInfo:()=>ki,RenderingManager:()=>Gi,ReplaceColorBlock:()=>Lg,RequestFile:()=>oi,RequestFileError:()=>Zt,RetryStrategy:()=>rt,RibbonBuilder:()=>du,RollingAverage:()=>mr,Rotate2dBlock:()=>Hg,RotationGizmo:()=>Ap,RuntimeAnimation:()=>Qe,RuntimeError:()=>st,SSAO2RenderingPipeline:()=>Lb,SSAORenderingPipeline:()=>Fb,SamplerBindingType:()=>Lh,Scalar:()=>h,ScaleBlock:()=>cg,ScaleGizmo:()=>Ip,Scene:()=>mn,SceneComponentConstants:()=>zi,SceneDepthBlock:()=>ag,SceneInstrumentation:()=>l_,SceneLoader:()=>Uo,SceneLoaderAnimationGroupLoadingMode:()=>Lo,SceneLoaderFlags:()=>dr,SceneOptimization:()=>CT,SceneOptimizer:()=>UT,SceneOptimizerOptions:()=>BT,ScenePerformancePriority:()=>Zi,SceneRecorder:()=>tE,SceneSerializer:()=>zT,ScreenSizeBlock:()=>qm,ScreenSpaceBlock:()=>Zm,ScreenSpaceCurvaturePostProcess:()=>zb,ScreenSpaceReflectionPostProcess:()=>Bb,ScreenshotTools:()=>ZT,SerializationHelper:()=>Le,SetCorsBehavior:()=>ti,SetParentAction:()=>oe,SetStateAction:()=>Z,SetValueAction:()=>J,ShaderCodeInliner:()=>uh,ShaderLanguage:()=>et,ShaderMaterial:()=>eu,ShaderStage:()=>Dh,ShaderStore:()=>It,ShadowDepthWrapper:()=>dv,ShadowGenerator:()=>y_,ShadowGeneratorSceneComponent:()=>M_,ShadowLight:()=>Dp,ShadowsOptimization:()=>IT,ShapeBuilder:()=>mu,SharpenPostProcess:()=>Cb,SheenBlock:()=>Kg,SimplexPerlin3DBlock:()=>zg,SimplicationQueueSceneComponent:()=>yy,SimplificationQueue:()=>py,SimplificationSettings:()=>dy,SimplificationType:()=>uy,SineEase:()=>kn,SixDofDragBehavior:()=>So,Size:()=>Ve,Skeleton:()=>es,SkeletonViewer:()=>gu,SmartArray:()=>yi,SmartArrayNoDuplicate:()=>bi,SmoothStepBlock:()=>Dg,SolidParticle:()=>Uy,SolidParticleSystem:()=>zy,SolidParticleVertex:()=>Gy,Sound:()=>Hr,SoundTrack:()=>Xr,Space:()=>_n,SphereBuilder:()=>Yc,SphereDirectedParticleEmitter:()=>Ra,SphereParticleEmitter:()=>Aa,Spherical:()=>Tv,SphericalHarmonics:()=>Fu,SphericalPolynomial:()=>wu,SpotLight:()=>Vp,Sprite:()=>rT,SpriteManager:()=>sT,SpriteMap:()=>cT,SpritePackedManager:()=>uT,SpriteSceneComponent:()=>oT,Stage:()=>Wi,StandardMaterial:()=>Xl,StandardMaterialDefines:()=>Hl,StandardRenderingPipeline:()=>Ub,StartsWith:()=>ct,StateCondition:()=>K,StencilOperation:()=>Xh,StencilState:()=>Nt,StencilStateComposer:()=>Xt,StepBlock:()=>bg,StereoscopicArcRotateCamera:()=>hl,StereoscopicFreeCamera:()=>dl,StereoscopicGamepadCamera:()=>pl,StereoscopicInterlacePostProcess:()=>cl,StereoscopicInterlacePostProcessI:()=>ll,StereoscopicScreenUniversalCamera:()=>_l,StereoscopicUniversalCamera:()=>fl,StickValues:()=>as,StopAnimationAction:()=>te,StopSoundAction:()=>ue,StorageBuffer:()=>ts,StorageTextureAccess:()=>wh,StoreOp:()=>Jh,StringDictionary:()=>Ti,StringTools:()=>_t,SubEmitter:()=>Dy,SubEmitterType:()=>xy,SubMesh:()=>hr,SubSurfaceBlock:()=>ev,SubSurfaceSceneComponent:()=>iT,SubtractBlock:()=>yg,SurfaceMagnetismBehavior:()=>Ao,SwitchBooleanAction:()=>q,SwitchInput:()=>Di,TBNBlock:()=>Hm,TGATools:()=>pm,Tags:()=>de,TargetCamera:()=>Os,TargetedAnimation:()=>Wn,TestBase64DataUrl:()=>li,TextFileAssetTask:()=>_T,Texture:()=>to,TextureAspect:()=>Ch,TextureAssetTask:()=>vT,TextureBlock:()=>ng,TextureDimension:()=>Ah,TextureFormat:()=>Ph,TextureOptimization:()=>PT,TexturePacker:()=>Om,TexturePackerFrame:()=>Im,TextureSampleType:()=>Fh,TextureSampler:()=>Ft,TextureTools:()=>Gu,TextureUsage:()=>Rh,TextureViewDimension:()=>xh,ThinEngine:()=>Yt,ThinMaterialHelper:()=>Cr,ThinRenderTargetTexture:()=>Bm,ThinTexture:()=>Qr,TiledBoxBuilder:()=>Vv,TiledPlaneBuilder:()=>wv,TimerState:()=>Kf,TmpColors:()=>F,TmpVectors:()=>O,ToGammaSpace:()=>d,ToHalfFloat:()=>Vu,ToLinearSpace:()=>p,TonemapPostProcess:()=>kb,TonemappingOperator:()=>Vb,Tools:()=>mi,TorusBuilder:()=>hc,TorusKnotBuilder:()=>zv,TouchCamera:()=>Ns,TrailMesh:()=>Nv,Trajectory:()=>iE,TrajectoryClassifier:()=>aE,TranscodeAsync:()=>Sm,TransformBlock:()=>jo,TransformNode:()=>yr,TrigonometryBlock:()=>La,TrigonometryBlockOperations:()=>Da,TubeBuilder:()=>ey,TwirlBlock:()=>Jm,UniformBuffer:()=>Li,UniversalCamera:()=>Js,UnregisterAllMaterialPlugins:()=>Vl,UnregisterMaterialPlugin:()=>Ul,UploadContent:()=>dm,UploadEnvLevelsAsync:()=>Ju,UploadEnvSpherical:()=>th,UploadLevelsAsync:()=>eh,UtilityLayerRenderer:()=>wc,VRCameraMetrics:()=>gl,VRDeviceOrientationArcRotateCamera:()=>Al,VRDeviceOrientationFreeCamera:()=>Rl,VRDeviceOrientationGamepadCamera:()=>xl,VRDistortionCorrectionPostProcess:()=>vl,VRExperienceHelper:()=>Rc,VRMultiviewToSingleviewPostProcess:()=>El,ValidatedNativeDataStream:()=>nd,ValueCondition:()=>j,Vector2:()=>R,Vector3:()=>x,Vector4:()=>C,VectorMergerBlock:()=>fa,VectorSplitterBlock:()=>mg,VertexAnimationBaker:()=>ao,VertexBuffer:()=>wi,VertexData:()=>$n,VertexFormat:()=>Yh,VertexOutputBlock:()=>Ko,VideoDome:()=>a_,VideoRecorder:()=>WT,VideoTexture:()=>o_,ViewDirectionBlock:()=>Eg,Viewport:()=>Rr,VirtualJoystick:()=>Ms,VirtualJoysticksCamera:()=>ml,ViveController:()=>gp,VolumetricLightScatteringPostProcess:()=>Gb,VoronoiNoiseBlock:()=>lv,WaveBlock:()=>Bg,WaveBlockKind:()=>Fg,WebGL2ParticleSystem:()=>Ay,WebGL2ShaderProcessor:()=>Ut,WebGLDataBuffer:()=>kt,WebGLHardwareTexture:()=>Wt,WebGLPipelineContext:()=>zt,WebGPUCacheBindGroups:()=>zd,WebGPUCacheRenderPipeline:()=>Nd,WebGPUCacheRenderPipelineTree:()=>Fd,WebGPUCacheSampler:()=>Id,WebGPUDataBuffer:()=>Ad,WebGPUDrawContext:()=>kd,WebGPUEngine:()=>rp,WebGPUTintWASM:()=>ip,WebRequest:()=>ke,WebVRController:()=>Ol,WebVRFreeCamera:()=>Il,WebXRAbstractFeature:()=>Po,WebXRAbstractMotionController:()=>Ff,WebXRAnchorSystem:()=>yE,WebXRBackgroundRemover:()=>EE,WebXRCamera:()=>Df,WebXRCompositionLayerWrapper:()=>kE,WebXRControllerComponent:()=>Lf,WebXRControllerMovement:()=>DE,WebXRControllerPhysics:()=>AE,WebXRControllerPointerSelection:()=>jf,WebXRDefaultExperience:()=>i_,WebXRDefaultExperienceOptions:()=>t_,WebXRDomOverlay:()=>OE,WebXREnterExitUI:()=>Zf,WebXREnterExitUIButton:()=>Qf,WebXREnterExitUIOptions:()=>qf,WebXRExperienceHelper:()=>Nf,WebXREyeTracking:()=>LE,WebXRFeatureName:()=>xo,WebXRFeaturePointSystem:()=>xE,WebXRFeaturesManager:()=>Co,WebXRGenericHandController:()=>YE,WebXRGenericTriggerMotionController:()=>wf,WebXRHTCViveMotionController:()=>$E,WebXRHand:()=>Qa,WebXRHandTracking:()=>qa,WebXRHitTest:()=>RE,WebXRHitTestLegacy:()=>gE,WebXRImageTracking:()=>IE,WebXRInput:()=>Xf,WebXRInputSource:()=>Hf,WebXRLayers:()=>jE,WebXRLightEstimation:()=>NE,WebXRManagedOutputCanvas:()=>tc,WebXRManagedOutputCanvasOptions:()=>ec,WebXRMeshDetector:()=>ME,WebXRMicrosoftMixedRealityController:()=>QE,WebXRMotionControllerManager:()=>kf,WebXRMotionControllerTeleportation:()=>e_,WebXRNearControllerMode:()=>zf,WebXRNearInteraction:()=>Yf,WebXROculusTouchMotionController:()=>ZE,WebXRPlaneDetector:()=>TE,WebXRProfiledMotionController:()=>Uf,WebXRProjectionLayerWrapper:()=>zE,WebXRSessionManager:()=>oc,WebXRState:()=>Yl,WebXRTrackingState:()=>Kl,WebXRWalkingLocomotion:()=>VE,WeightedSound:()=>Yr,WindowsMotionController:()=>yp,WorkerPool:()=>Cf,WorleyNoise3DBlock:()=>Gg,XRHandJoint:()=>za,XRWindowsMotionController:()=>bp,Xbox360Button:()=>zs,Xbox360Dpad:()=>Ws,Xbox360Pad:()=>Ks,XboxInput:()=>Oi,_BabylonLoaderRegistered:()=>Y_,_BasisTextureLoader:()=>Pm,_CreationDataStorage:()=>Nr,_DDSTextureLoader:()=>Af,_ENVTextureLoader:()=>Rf,_HDRTextureLoader:()=>_m,_IAnimationState:()=>Ge,_InstancesBatch:()=>Fr,_KTXTextureLoader:()=>Of,_MeshCollisionData:()=>br,_OcclusionDataStorage:()=>Eu,_PrimaryIsoTriangle:()=>ry,_TGATextureLoader:()=>fm,_TimeToken:()=>Tu,_UpdateRGBDAsync:()=>ih,_forceSceneHelpersToBundle:()=>n_,_forceTransformFeedbackToBundle:()=>Su,_injectLTSFileTools:()=>di,allocateAndCopyTypedBuffer:()=>gr,className:()=>gi,createDetailMapPlugin:()=>yv,createPBRAnisotropicPlugin:()=>pv,createPBRBRDFPlugin:()=>fv,createPBRClearCoatPlugin:()=>_v,createPBRIridescencePlugin:()=>mv,createPBRSheenPlugin:()=>gv,createPBRSubSurfacePlugin:()=>vv,createYieldingScheduler:()=>Yn,editableInPropertyPage:()=>Qo,expandToProperty:()=>ye,extractMinAndMax:()=>ur,extractMinAndMaxIndexed:()=>cr,inlineScheduler:()=>jn,makeAsyncFunction:()=>Jn,makeSyncFunction:()=>Zn,nativeOverride:()=>Fe,normalizeEnvInfo:()=>Ku,runCoroutine:()=>Kn,runCoroutineAsync:()=>qn,runCoroutineSync:()=>Qn,serialize:()=>be,serializeAsCameraReference:()=>De,serializeAsColor3:()=>Ee,serializeAsColor4:()=>Pe,serializeAsColorCurves:()=>Ce,serializeAsFresnelParameters:()=>Se,serializeAsImageProcessingConfiguration:()=>Me,serializeAsMatrix:()=>Oe,serializeAsMeshReference:()=>xe,serializeAsQuaternion:()=>Ie,serializeAsTexture:()=>Te,serializeAsVector2:()=>Ae,serializeAsVector3:()=>Re,setAndStartTimer:()=>Jf,setStereoscopicAnaglyphRigMode:()=>nl,setStereoscopicRigMode:()=>ul,setVRRigMode:()=>Sl,setWebVRRigMode:()=>Ml});var r={};e.r(r),e.d(r,{AbstractActionManager:()=>s,AbstractAssetTask:()=>hT,AbstractMesh:()=>Sr,AbstractScene:()=>o,AcquireNativeObjectAsync:()=>dh,Action:()=>w,ActionEvent:()=>B,ActionManager:()=>le,AddBlock:()=>lg,AddressMode:()=>Mh,AdvancedTimer:()=>$f,AlphaState:()=>Lt,AmmoJSPlugin:()=>X_,AnaglyphArcRotateCamera:()=>rl,AnaglyphFreeCamera:()=>ol,AnaglyphGamepadCamera:()=>al,AnaglyphPostProcess:()=>il,AnaglyphUniversalCamera:()=>sl,Analyser:()=>zr,AndOrNotEvaluator:()=>he,Angle:()=>An,Animatable:()=>bn,AnimatedInputBlockTypes:()=>$o,Animation:()=>ze,AnimationEvent:()=>zn,AnimationGroup:()=>Hn,AnimationKeyInterpolation:()=>Ne,AnimationPropertiesOverride:()=>En,AnimationRange:()=>we,AnisotropyBlock:()=>Qg,ApplyPostProcess:()=>Uu,Arc2:()=>Rn,ArcFollowCamera:()=>Gs,ArcRotateCamera:()=>Ls,ArcRotateCameraGamepadInput:()=>cs,ArcRotateCameraInputsManager:()=>ps,ArcRotateCameraKeyboardMoveInput:()=>us,ArcRotateCameraMouseWheelInput:()=>hs,ArcRotateCameraPointersInput:()=>ds,ArcRotateCameraVRDeviceOrientationInput:()=>fs,ArcTan2Block:()=>Og,AssetContainer:()=>Gr,AssetTaskState:()=>lT,AssetsManager:()=>ET,AssetsProgressEvent:()=>dT,AsyncLoop:()=>vi,AttachToBoxBehavior:()=>ho,AudioEngine:()=>Wr,AudioSceneComponent:()=>jr,AutoLayoutMode:()=>Uh,AutoReleaseWorkerPool:()=>Pf,AutoRotationBehavior:()=>so,AxesViewer:()=>Vc,Axis:()=>vn,AxisDragGizmo:()=>Uc,AxisScaleGizmo:()=>Tp,BRDFTextureTools:()=>Jp,BabylonFileLoaderConfiguration:()=>K_,BackEase:()=>On,BackgroundMaterial:()=>jp,BakedVertexAnimationManager:()=>Kr,BaseCameraMouseWheelInput:()=>is,BaseCameraPointersInput:()=>ns,BaseError:()=>ot,BaseParticleSystem:()=>Pa,BaseSixDofDragBehavior:()=>Eo,BaseTexture:()=>qr,BasisTools:()=>xm,BasisToolsOptions:()=>vm,BasisTranscodeConfiguration:()=>gm,BezierCurve:()=>Sn,BezierCurveEase:()=>Gn,BinaryFileAssetTask:()=>mT,BlackAndWhitePostProcess:()=>nb,BlendFactor:()=>Wh,BlendOperation:()=>Hh,BloomEffect:()=>sb,BloomMergePostProcess:()=>ab,BlurPostProcess:()=>zp,Bone:()=>yn,BoneAxesViewer:()=>kc,BoneIKController:()=>Ja,BoneLookController:()=>$a,BonesBlock:()=>Vm,BounceEase:()=>Dn,BouncingBehavior:()=>lo,BoundingBox:()=>tr,BoundingBoxGizmo:()=>Ep,BoundingBoxRenderer:()=>Wb,BoundingInfo:()=>sr,BoundingSphere:()=>ir,BoxBuilder:()=>Hc,BoxParticleEmitter:()=>va,Buffer:()=>Fi,BufferBindingType:()=>Nh,BufferUsage:()=>Eh,CSG:()=>Ov,Camera:()=>xr,CameraGizmo:()=>Gp,CameraInputTypes:()=>rs,CameraInputsManager:()=>os,CannonJSPlugin:()=>W_,CanvasAlphaMode:()=>ed,CapsuleBuilder:()=>qc,CascadedShadowGenerator:()=>P_,ChromaticAberrationPostProcess:()=>lb,CircleEase:()=>In,CircleOfConfusionPostProcess:()=>cb,ClampBlock:()=>ug,ClearCoatBlock:()=>Zg,ClipPlanesBlock:()=>sg,ClipboardEventTypes:()=>hp,ClipboardInfo:()=>dp,CloudBlock:()=>sv,CloudPoint:()=>Wy,Collider:()=>Cc,Color3:()=>N,Color3Gradient:()=>Py,Color4:()=>L,ColorCorrectionPostProcess:()=>ub,ColorCurves:()=>Si,ColorGradient:()=>Cy,ColorGradingTexture:()=>lm,ColorMergerBlock:()=>_g,ColorSplitterBlock:()=>Ma,ColorWriteFlags:()=>zh,CombineAction:()=>ne,CompareFunction:()=>Oh,CompatibilityOptions:()=>pr,CompilationMessageType:()=>Bh,ComputeBindingType:()=>Mc,ComputeEffect:()=>Ic,ComputePassTimestampLocation:()=>Qh,ComputePressureObserverWrapper:()=>fn,ComputeShader:()=>Oc,ComputeShaderParticleSystem:()=>Ry,Condition:()=>X,ConditionalBlock:()=>av,ConditionalBlockConditions:()=>rv,ConeParticleEmitter:()=>ya,Constants:()=>a,ContainerAssetTask:()=>pT,ConvolutionPostProcess:()=>hb,Coordinate:()=>gn,CopyTools:()=>eo,CreateBox:()=>Wc,CreateBoxVertexData:()=>zc,CreateCapsule:()=>Qc,CreateCapsuleVertexData:()=>Kc,CreateCylinder:()=>sc,CreateCylinderVertexData:()=>ac,CreateDashedLines:()=>su,CreateDashedLinesVertexData:()=>ru,CreateDecal:()=>ty,CreateDisc:()=>Fp,CreateDiscVertexData:()=>Lp,CreateEnvTextureAsync:()=>Qu,CreateGeodesic:()=>sy,CreateGoldberg:()=>cy,CreateGoldbergVertexData:()=>ly,CreateGround:()=>mc,CreateGroundFromHeightMap:()=>vc,CreateGroundFromHeightMapVertexData:()=>_c,CreateGroundVertexData:()=>pc,CreateHemisphere:()=>Bp,CreateIcoSphere:()=>Va,CreateIcoSphereVertexData:()=>Ua,CreateImageDataArrayBufferViews:()=>Zu,CreateLathe:()=>Zv,CreateLineSystem:()=>ou,CreateLineSystemVertexData:()=>nu,CreateLines:()=>au,CreatePlane:()=>go,CreatePlaneVertexData:()=>mo,CreatePolygon:()=>Kv,CreatePolygonVertexData:()=>Yv,CreatePolyhedron:()=>Pp,CreatePolyhedronVertexData:()=>Cp,CreateResizedCopy:()=>Bu,CreateRibbon:()=>hu,CreateRibbonVertexData:()=>uu,CreateScreenshot:()=>HT,CreateScreenshotAsync:()=>XT,CreateScreenshotUsingRenderTarget:()=>YT,CreateScreenshotUsingRenderTargetAsync:()=>KT,CreateScreenshotWithResizeAsync:()=>jT,CreateSphere:()=>jc,CreateSphereVertexData:()=>Xc,CreateTiledBox:()=>Uv,CreateTiledBoxVertexData:()=>Bv,CreateTiledGround:()=>gc,CreateTiledGroundVertexData:()=>fc,CreateTiledPlane:()=>Fv,CreateTiledPlaneVertexData:()=>Lv,CreateTorus:()=>uc,CreateTorusKnot:()=>Gv,CreateTorusKnotVertexData:()=>kv,CreateTorusVertexData:()=>cc,CreateTube:()=>$v,CrossBlock:()=>hg,CubeMapToSphericalPolynomialTools:()=>Hu,CubeTexture:()=>Hp,CubeTextureAssetTask:()=>yT,CubicEase:()=>Nn,CullMode:()=>Gh,CurrentScreenBlock:()=>aa,Curve3:()=>Pn,CustomBlock:()=>dg,CustomOptimization:()=>NT,CustomParticleEmitter:()=>xa,CustomProceduralTexture:()=>Dm,CylinderBuilder:()=>lc,CylinderDirectedParticleEmitter:()=>Ta,CylinderParticleEmitter:()=>ba,DDSTools:()=>Sf,DataBuffer:()=>Vt,DataReader:()=>$T,DataStorage:()=>eE,Database:()=>Ey,DaydreamController:()=>pp,Debug:()=>oS,DebugLayer:()=>Gc,DebugLayerTab:()=>Lc,DecalBuilder:()=>iy,Decode:()=>ut,DecodeBase64ToBinary:()=>pt,DecodeBase64ToString:()=>dt,DecodeBase64UrlToBinary:()=>ci,DecodeBase64UrlToString:()=>hi,DeepCopier:()=>se,DefaultCollisionCoordinator:()=>Pc,DefaultLoadingScreen:()=>O_,DefaultRenderingPipeline:()=>Ob,Deferred:()=>ST,DepthCullingState:()=>Dt,DepthOfFieldBlurPostProcess:()=>db,DepthOfFieldEffect:()=>mb,DepthOfFieldEffectBlurLevel:()=>pb,DepthOfFieldMergePostProcess:()=>_b,DepthOfFieldMergePostProcessOptions:()=>fb,DepthPeelingRenderer:()=>jb,DepthPeelingSceneComponent:()=>Yb,DepthReducer:()=>E_,DepthRenderer:()=>b_,DepthRendererSceneComponent:()=>Hb,DepthSortedParticle:()=>ky,DerivativeBlock:()=>Km,DesaturateBlock:()=>Yg,DetailMapConfiguration:()=>zl,DeviceInputEventType:()=>Ni,DeviceLostReason:()=>td,DeviceOrientationCamera:()=>Fs,DeviceSource:()=>rn,DeviceSourceManager:()=>an,DeviceType:()=>xi,DirectionalLight:()=>Np,DirectionalLightFrustumViewer:()=>vu,DiscBuilder:()=>wp,DiscardBlock:()=>jm,DisplayPassPostProcess:()=>gb,DistanceBlock:()=>xg,DistanceJoint:()=>Io,DivideBlock:()=>vg,DoNothingAction:()=>ie,DomManagement:()=>tt,DotBlock:()=>pg,DracoCompression:()=>Av,DrawWrapper:()=>Ht,DualSenseInput:()=>Ii,DualShockButton:()=>js,DualShockDpad:()=>Ys,DualShockInput:()=>Mi,DualShockPad:()=>Qs,DynamicFloat32Array:()=>lE,DynamicTexture:()=>jl,EasingFunction:()=>Mn,EdgesRenderer:()=>Qb,Effect:()=>Ot,EffectFallbacks:()=>ua,EffectLayer:()=>c_,EffectLayerSceneComponent:()=>u_,EffectRenderer:()=>L_,EffectWrapper:()=>F_,ElasticEase:()=>Ln,ElbowBlock:()=>cv,EncodeArrayBufferToBase64:()=>ht,EndsWith:()=>lt,Engine:()=>vr,EngineFactory:()=>up,EngineInstrumentation:()=>s_,EngineStore:()=>S,EngineView:()=>Au,EnvironmentHelper:()=>Yp,EnvironmentTextureTools:()=>nh,Epsilon:()=>_,EquiRectangularCubeTexture:()=>cm,EquiRectangularCubeTextureAssetTask:()=>TT,ErrorCodes:()=>at,ErrorFilter:()=>id,EventConstants:()=>Ji,EventState:()=>l,ExecuteCodeAction:()=>re,ExponentialEase:()=>Fn,ExternalTexture:()=>Ud,ExtractHighlightsPostProcess:()=>ob,ExtrudePolygon:()=>Qv,ExtrudeShape:()=>pu,ExtrudeShapeCustom:()=>fu,FactorGradient:()=>My,FadeInOutBehavior:()=>po,FeatureName:()=>Th,FileTools:()=>ui,FileToolsOptions:()=>$t,FilesInput:()=>RT,FilesInputStore:()=>nt,FilterMode:()=>Ih,FilterPostProcess:()=>vb,FlyCamera:()=>Bs,FlyCameraInputsManager:()=>ws,FlyCameraKeyboardInput:()=>_s,FlyCameraMouseInput:()=>ms,FogBlock:()=>eg,FollowBehavior:()=>Ro,FollowCamera:()=>ks,FollowCameraInputsManager:()=>Us,FollowCameraKeyboardMoveInput:()=>gs,FollowCameraMouseWheelInput:()=>vs,FollowCameraPointersInput:()=>ys,FragCoordBlock:()=>Qm,FragmentOutputBlock:()=>Jo,FramingBehavior:()=>co,FreeCamera:()=>Ds,FreeCameraDeviceOrientationInput:()=>xs,FreeCameraGamepadInput:()=>Ps,FreeCameraInputsManager:()=>Rs,FreeCameraKeyboardMoveInput:()=>bs,FreeCameraMouseInput:()=>Es,FreeCameraMouseWheelInput:()=>Ss,FreeCameraTouchInput:()=>As,FreeCameraVirtualJoystickInput:()=>Is,FresnelBlock:()=>Sg,FresnelParameters:()=>nm,FromHalfFloat:()=>ku,FrontFace:()=>kh,FrontFacingBlock:()=>Ym,Frustum:()=>hn,FxaaPostProcess:()=>yb,GPUParticleSystem:()=>Ly,GUID:()=>_i,Gamepad:()=>ss,GamepadCamera:()=>$s,GamepadManager:()=>qs,GamepadSystemSceneComponent:()=>Zs,GearVRController:()=>fp,GenerateBase64StringFromPixelData:()=>Zr,GenerateBase64StringFromTexture:()=>Jr,GenerateBase64StringFromTextureAsync:()=>$r,GenericController:()=>_p,GenericPad:()=>ls,GeodesicData:()=>ay,Geometry:()=>fr,GeometryBufferRenderer:()=>Eb,GeometryBufferRendererSceneComponent:()=>Ab,GetClass:()=>T,GetDOMTextContent:()=>$e,GetEnvInfo:()=>Yu,GetEnvironmentBRDFTexture:()=>Zp,GetInternalFormatFromBasisFormat:()=>ym,GetTGAHeader:()=>hm,Gizmo:()=>Bc,GizmoManager:()=>Op,GlowLayer:()=>h_,GoldbergMesh:()=>Dv,GradientBlock:()=>Vg,GradientBlockColorStep:()=>Ug,GradientHelper:()=>Iy,GrainPostProcess:()=>bb,GroundBuilder:()=>yc,GroundMesh:()=>dc,HDRCubeTexture:()=>B_,HDRCubeTextureAssetTask:()=>bT,HDRFiltering:()=>w_,HDRTools:()=>N_,HandConstraintBehavior:()=>Za,HandConstraintOrientation:()=>Xa,HandConstraintVisibility:()=>ja,HandConstraintZone:()=>Ha,HandPart:()=>Ga,HardwareScalingOptimization:()=>MT,HeightToNormalBlock:()=>$m,HemisphereBuilder:()=>Up,HemisphericLight:()=>Pl,HemisphericParticleEmitter:()=>Ea,HighlightLayer:()=>p_,HighlightsPostProcess:()=>Tb,Hinge2Joint:()=>No,HingeJoint:()=>Do,HtmlElementTexture:()=>um,IWebXRControllerPhysicsOptions:()=>SE,IcoSphereBuilder:()=>Wa,ImageAssetTask:()=>gT,ImageProcessingBlock:()=>Wm,ImageProcessingConfiguration:()=>Ri,ImageProcessingConfigurationDefines:()=>Ai,ImageProcessingPostProcess:()=>Ql,ImageSourceBlock:()=>ig,IncrementValueAction:()=>$,IndexFormat:()=>jh,InputBlock:()=>oa,InputStepMode:()=>Kh,InspectableType:()=>qT,InstancedLinesMesh:()=>iu,InstancedMesh:()=>Jc,InstancesBlock:()=>km,InstantiatedEntries:()=>kr,InternalTexture:()=>wt,InternalTextureSource:()=>Rt,InterpolateValueAction:()=>We,IntersectionInfo:()=>er,IsBase64DataUrl:()=>si,IsDocumentAvailable:()=>Je,IsFileURL:()=>ai,IsNavigatorAvailable:()=>Ze,IsWindowObjectExist:()=>qe,JoystickAxis:()=>Cs,KeepAssets:()=>Vr,KeyboardEventTypes:()=>Ki,KeyboardInfo:()=>Qi,KeyboardInfoPre:()=>qi,KhronosTextureContainer:()=>xf,KhronosTextureContainer2:()=>Mf,LatheBuilder:()=>Jv,Layer:()=>__,LayerSceneComponent:()=>f_,LengthBlock:()=>Cg,LensFlare:()=>m_,LensFlareSystem:()=>g_,LensFlareSystemSceneComponent:()=>v_,LensFlaresOptimization:()=>DT,LensRenderingPipeline:()=>Db,LerpBlock:()=>gg,Light:()=>Cl,LightBlock:()=>tg,LightGizmo:()=>kp,LightInformationBlock:()=>zm,LineEdgesRenderer:()=>qb,LinesBuilder:()=>lu,LinesMesh:()=>tu,LoadFile:()=>ri,LoadFileError:()=>qt,LoadImage:()=>ii,LoadOp:()=>Zh,LoadTextureFromTranscodeResult:()=>Rm,Logger:()=>Q,MapMode:()=>Sh,Material:()=>Ir,MaterialAnisotropicDefines:()=>af,MaterialClearCoatDefines:()=>tf,MaterialDefines:()=>Ei,MaterialDetailMapDefines:()=>Gl,MaterialFlags:()=>Nl,MaterialHelper:()=>Pr,MaterialIridescenceDefines:()=>rf,MaterialPluginBase:()=>kl,MaterialPluginEvent:()=>Ar,MaterialPluginManager:()=>Ll,MaterialSheenDefines:()=>lf,MaterialSubSurfaceDefines:()=>uf,Matrix:()=>M,MatrixBuilderBlock:()=>ov,MaxBlock:()=>Ag,MergeMeshesOptimization:()=>wT,Mesh:()=>Ur,MeshAssetTask:()=>fT,MeshBuilder:()=>hy,MeshExploder:()=>AT,MeshLODLevel:()=>Dr,MeshParticleEmitter:()=>Ca,MeshoptCompression:()=>Rv,MinBlock:()=>Rg,MinMaxReducer:()=>T_,MirrorTexture:()=>Wp,ModBlock:()=>nv,ModelShape:()=>Vy,MorphTarget:()=>U_,MorphTargetManager:()=>k_,MorphTargetsBlock:()=>Gm,MotionBlurPostProcess:()=>Rb,MotorEnabledJoint:()=>Oo,MultiMaterial:()=>Or,MultiObserver:()=>xT,MultiPointerScaleBehavior:()=>To,MultiRenderTarget:()=>Mm,MultiplyBlock:()=>ga,NLerpBlock:()=>kg,NativeDataStream:()=>Iu,NativeEngine:()=>vh,NativePointerInput:()=>Pi,NativeXRFrame:()=>tS,NativeXRLayerRenderTargetTextureProvider:()=>nc,NativeXRLayerWrapper:()=>ic,NativeXRRenderTarget:()=>rc,NegateBlock:()=>Pg,Node:()=>Ue,NodeMaterial:()=>Ba,NodeMaterialBlock:()=>Xo,NodeMaterialBlockConnectionPointMode:()=>qo,NodeMaterialBlockConnectionPointTypes:()=>wo,NodeMaterialBlockTargets:()=>Bo,NodeMaterialConnectionPoint:()=>Ho,NodeMaterialConnectionPointCompatibilityStates:()=>ko,NodeMaterialConnectionPointCustomObject:()=>Um,NodeMaterialConnectionPointDirection:()=>Go,NodeMaterialDefines:()=>wa,NodeMaterialModes:()=>ma,NodeMaterialOptimizer:()=>uv,NodeMaterialSystemValues:()=>Zo,NoiseProceduralTexture:()=>Nm,NormalBlendBlock:()=>Wg,NormalizeBlock:()=>fg,NullEngine:()=>bu,NullEngineOptions:()=>yu,Observable:()=>u,Observer:()=>c,OcclusionMaterial:()=>rm,Octree:()=>Nc,OctreeBlock:()=>Dc,OctreeSceneComponent:()=>Fc,OculusTouchController:()=>mp,OimoJSPlugin:()=>H_,OnAfterEnteringVRObservableEvent:()=>Ac,OneMinusBlock:()=>Tg,Orientation:()=>Tn,OutlineRenderer:()=>nT,PBRAnisotropicConfiguration:()=>sf,PBRBaseMaterial:()=>ff,PBRBaseSimpleMaterial:()=>om,PBRClearCoatConfiguration:()=>nf,PBRIridescenceConfiguration:()=>of,PBRMaterial:()=>_f,PBRMaterialDefines:()=>pf,PBRMetallicRoughnessBlock:()=>iv,PBRMetallicRoughnessMaterial:()=>am,PBRSheenConfiguration:()=>cf,PBRSpecularGlossinessMaterial:()=>sm,PBRSubSurfaceConfiguration:()=>hf,PHI:()=>f,PadNumber:()=>ft,PanoramaToCubeMapTools:()=>D_,Particle:()=>Oy,ParticleBlendMultiplyBlock:()=>ca,ParticleHelper:()=>wy,ParticleRampGradientBlock:()=>la,ParticleSystem:()=>Ny,ParticleSystemSet:()=>Fy,ParticleTextureBlock:()=>sa,ParticlesOptimization:()=>LT,PassCubePostProcess:()=>tl,PassPostProcess:()=>el,Path2:()=>xn,Path3D:()=>Cn,PathCursor:()=>Xn,PerfCollectionStrategy:()=>mE,PerfCounter:()=>cn,PerformanceConfigurator:()=>E,PerformanceMonitor:()=>_r,PerformanceViewerCollector:()=>fE,PerturbNormalBlock:()=>Xm,PhotoDome:()=>Qp,PhysicsEngine:()=>G_,PhysicsEngineSceneComponent:()=>Ky,PhysicsHelper:()=>Qy,PhysicsImpostor:()=>Fo,PhysicsJoint:()=>Mo,PhysicsRadialExplosionEventOptions:()=>eb,PhysicsRadialImpulseFalloff:()=>jy,PhysicsUpdraftEventOptions:()=>tb,PhysicsUpdraftMode:()=>Yy,PhysicsViewer:()=>Zc,PhysicsVortexEventOptions:()=>ib,PickingInfo:()=>Bi,PivotTools:()=>_o,Plane:()=>un,PlaneBuilder:()=>vo,PlaneDragGizmo:()=>Rp,PlaneRotationGizmo:()=>Sp,PlayAnimationAction:()=>ee,PlaySoundAction:()=>ce,PointColor:()=>By,PointLight:()=>I_,PointParticleEmitter:()=>Sa,PointerDragBehavior:()=>bo,PointerEventTypes:()=>Hi,PointerInfo:()=>Yi,PointerInfoBase:()=>Xi,PointerInfoPre:()=>ji,PointerInput:()=>Ci,PointsCloudSystem:()=>Xy,PointsGroup:()=>Hy,Polar:()=>bv,Polygon:()=>Xv,PolygonBuilder:()=>qv,PolygonMeshBuilder:()=>jv,PolyhedronBuilder:()=>Mp,PolyhedronData:()=>oy,PoseEnabledController:()=>Xs,PoseEnabledControllerHelper:()=>Hs,PoseEnabledControllerType:()=>Vs,PositionGizmo:()=>xp,PositionNormalTextureVertex:()=>ta,PositionNormalVertex:()=>ea,PostProcess:()=>pa,PostProcessManager:()=>Ui,PostProcessRenderEffect:()=>rb,PostProcessRenderPipeline:()=>Pb,PostProcessRenderPipelineManager:()=>Mb,PostProcessRenderPipelineManagerSceneComponent:()=>Ib,PostProcessesOptimization:()=>OT,PosterizeBlock:()=>wg,PowBlock:()=>Mg,PowerEase:()=>wn,PowerPreference:()=>bh,PrePassRenderer:()=>Jb,PrePassRendererSceneComponent:()=>$b,PrecisionDate:()=>it,PredefinedColorSpace:()=>yh,PredicateCondition:()=>Y,PrimitiveTopology:()=>Vh,ProceduralTexture:()=>Na,ProceduralTextureSceneComponent:()=>Oa,PropertyTypeForEdition:()=>Yo,PushMaterial:()=>Vo,QuadraticEase:()=>Bn,QuadraticErrorSimplification:()=>vy,QuarticEase:()=>Un,Quaternion:()=>P,QueryType:()=>$h,QuinticEase:()=>Vn,RGBDTextureTools:()=>zu,RandomGUID:()=>fi,RandomNumberBlock:()=>Ig,RawCubeTexture:()=>Lm,RawTexture:()=>oo,RawTexture2DArray:()=>V_,RawTexture3D:()=>Fm,Ray:()=>fo,RayHelper:()=>cu,ReadFile:()=>ni,ReadFileError:()=>Jt,RecastJSCrowd:()=>Ty,RecastJSPlugin:()=>by,ReciprocalBlock:()=>Ng,ReflectBlock:()=>Xg,ReflectionBlock:()=>qg,ReflectionProbe:()=>j_,ReflectionTextureBlock:()=>og,Reflector:()=>sE,RefractBlock:()=>jg,RefractionBlock:()=>$g,RefractionPostProcess:()=>xb,RefractionTexture:()=>wm,RegisterClass:()=>b,RegisterMaterialPlugin:()=>Bl,RegisterNativeTypeAsync:()=>ph,RemapBlock:()=>_a,RenderPassTimestampLocation:()=>qh,RenderTargetTexture:()=>Ia,RenderTargetWrapper:()=>ha,RenderTargetsOptimization:()=>FT,RenderingGroup:()=>Vi,RenderingGroupInfo:()=>ki,RenderingManager:()=>Gi,ReplaceColorBlock:()=>Lg,RequestFile:()=>oi,RequestFileError:()=>Zt,RetryStrategy:()=>rt,RibbonBuilder:()=>du,RollingAverage:()=>mr,Rotate2dBlock:()=>Hg,RotationGizmo:()=>Ap,RuntimeAnimation:()=>Qe,RuntimeError:()=>st,SSAO2RenderingPipeline:()=>Lb,SSAORenderingPipeline:()=>Fb,SamplerBindingType:()=>Lh,Scalar:()=>h,ScaleBlock:()=>cg,ScaleGizmo:()=>Ip,Scene:()=>mn,SceneComponentConstants:()=>zi,SceneDepthBlock:()=>ag,SceneInstrumentation:()=>l_,SceneLoader:()=>Uo,SceneLoaderAnimationGroupLoadingMode:()=>Lo,SceneLoaderFlags:()=>dr,SceneOptimization:()=>CT,SceneOptimizer:()=>UT,SceneOptimizerOptions:()=>BT,ScenePerformancePriority:()=>Zi,SceneRecorder:()=>tE,SceneSerializer:()=>zT,ScreenSizeBlock:()=>qm,ScreenSpaceBlock:()=>Zm,ScreenSpaceCurvaturePostProcess:()=>zb,ScreenSpaceReflectionPostProcess:()=>Bb,ScreenshotTools:()=>ZT,SerializationHelper:()=>Le,SetCorsBehavior:()=>ti,SetParentAction:()=>oe,SetStateAction:()=>Z,SetValueAction:()=>J,ShaderCodeInliner:()=>uh,ShaderLanguage:()=>et,ShaderMaterial:()=>eu,ShaderStage:()=>Dh,ShaderStore:()=>It,ShadowDepthWrapper:()=>dv,ShadowGenerator:()=>y_,ShadowGeneratorSceneComponent:()=>M_,ShadowLight:()=>Dp,ShadowsOptimization:()=>IT,ShapeBuilder:()=>mu,SharpenPostProcess:()=>Cb,SheenBlock:()=>Kg,SimplexPerlin3DBlock:()=>zg,SimplicationQueueSceneComponent:()=>yy,SimplificationQueue:()=>py,SimplificationSettings:()=>dy,SimplificationType:()=>uy,SineEase:()=>kn,SixDofDragBehavior:()=>So,Size:()=>Ve,Skeleton:()=>es,SkeletonViewer:()=>gu,SmartArray:()=>yi,SmartArrayNoDuplicate:()=>bi,SmoothStepBlock:()=>Dg,SolidParticle:()=>Uy,SolidParticleSystem:()=>zy,SolidParticleVertex:()=>Gy,Sound:()=>Hr,SoundTrack:()=>Xr,Space:()=>_n,SphereBuilder:()=>Yc,SphereDirectedParticleEmitter:()=>Ra,SphereParticleEmitter:()=>Aa,Spherical:()=>Tv,SphericalHarmonics:()=>Fu,SphericalPolynomial:()=>wu,SpotLight:()=>Vp,Sprite:()=>rT,SpriteManager:()=>sT,SpriteMap:()=>cT,SpritePackedManager:()=>uT,SpriteSceneComponent:()=>oT,Stage:()=>Wi,StandardMaterial:()=>Xl,StandardMaterialDefines:()=>Hl,StandardRenderingPipeline:()=>Ub,StartsWith:()=>ct,StateCondition:()=>K,StencilOperation:()=>Xh,StencilState:()=>Nt,StencilStateComposer:()=>Xt,StepBlock:()=>bg,StereoscopicArcRotateCamera:()=>hl,StereoscopicFreeCamera:()=>dl,StereoscopicGamepadCamera:()=>pl,StereoscopicInterlacePostProcess:()=>cl,StereoscopicInterlacePostProcessI:()=>ll,StereoscopicScreenUniversalCamera:()=>_l,StereoscopicUniversalCamera:()=>fl,StickValues:()=>as,StopAnimationAction:()=>te,StopSoundAction:()=>ue,StorageBuffer:()=>ts,StorageTextureAccess:()=>wh,StoreOp:()=>Jh,StringDictionary:()=>Ti,StringTools:()=>_t,SubEmitter:()=>Dy,SubEmitterType:()=>xy,SubMesh:()=>hr,SubSurfaceBlock:()=>ev,SubSurfaceSceneComponent:()=>iT,SubtractBlock:()=>yg,SurfaceMagnetismBehavior:()=>Ao,SwitchBooleanAction:()=>q,SwitchInput:()=>Di,TBNBlock:()=>Hm,TGATools:()=>pm,Tags:()=>de,TargetCamera:()=>Os,TargetedAnimation:()=>Wn,TestBase64DataUrl:()=>li,TextFileAssetTask:()=>_T,Texture:()=>to,TextureAspect:()=>Ch,TextureAssetTask:()=>vT,TextureBlock:()=>ng,TextureDimension:()=>Ah,TextureFormat:()=>Ph,TextureOptimization:()=>PT,TexturePacker:()=>Om,TexturePackerFrame:()=>Im,TextureSampleType:()=>Fh,TextureSampler:()=>Ft,TextureTools:()=>Gu,TextureUsage:()=>Rh,TextureViewDimension:()=>xh,ThinEngine:()=>Yt,ThinMaterialHelper:()=>Cr,ThinRenderTargetTexture:()=>Bm,ThinTexture:()=>Qr,TiledBoxBuilder:()=>Vv,TiledPlaneBuilder:()=>wv,TimerState:()=>Kf,TmpColors:()=>F,TmpVectors:()=>O,ToGammaSpace:()=>d,ToHalfFloat:()=>Vu,ToLinearSpace:()=>p,TonemapPostProcess:()=>kb,TonemappingOperator:()=>Vb,Tools:()=>mi,TorusBuilder:()=>hc,TorusKnotBuilder:()=>zv,TouchCamera:()=>Ns,TrailMesh:()=>Nv,Trajectory:()=>iE,TrajectoryClassifier:()=>aE,TranscodeAsync:()=>Sm,TransformBlock:()=>jo,TransformNode:()=>yr,TrigonometryBlock:()=>La,TrigonometryBlockOperations:()=>Da,TubeBuilder:()=>ey,TwirlBlock:()=>Jm,UniformBuffer:()=>Li,UniversalCamera:()=>Js,UnregisterAllMaterialPlugins:()=>Vl,UnregisterMaterialPlugin:()=>Ul,UploadContent:()=>dm,UploadEnvLevelsAsync:()=>Ju,UploadEnvSpherical:()=>th,UploadLevelsAsync:()=>eh,UtilityLayerRenderer:()=>wc,VRCameraMetrics:()=>gl,VRDeviceOrientationArcRotateCamera:()=>Al,VRDeviceOrientationFreeCamera:()=>Rl,VRDeviceOrientationGamepadCamera:()=>xl,VRDistortionCorrectionPostProcess:()=>vl,VRExperienceHelper:()=>Rc,VRMultiviewToSingleviewPostProcess:()=>El,ValidatedNativeDataStream:()=>nd,ValueCondition:()=>j,Vector2:()=>R,Vector3:()=>x,Vector4:()=>C,VectorMergerBlock:()=>fa,VectorSplitterBlock:()=>mg,VertexAnimationBaker:()=>ao,VertexBuffer:()=>wi,VertexData:()=>$n,VertexFormat:()=>Yh,VertexOutputBlock:()=>Ko,VideoDome:()=>a_,VideoRecorder:()=>WT,VideoTexture:()=>o_,ViewDirectionBlock:()=>Eg,Viewport:()=>Rr,VirtualJoystick:()=>Ms,VirtualJoysticksCamera:()=>ml,ViveController:()=>gp,VolumetricLightScatteringPostProcess:()=>Gb,VoronoiNoiseBlock:()=>lv,WaveBlock:()=>Bg,WaveBlockKind:()=>Fg,WebGL2ParticleSystem:()=>Ay,WebGL2ShaderProcessor:()=>Ut,WebGLDataBuffer:()=>kt,WebGLHardwareTexture:()=>Wt,WebGLPipelineContext:()=>zt,WebGPUCacheBindGroups:()=>zd,WebGPUCacheRenderPipeline:()=>Nd,WebGPUCacheRenderPipelineTree:()=>Fd,WebGPUCacheSampler:()=>Id,WebGPUDataBuffer:()=>Ad,WebGPUDrawContext:()=>kd,WebGPUEngine:()=>rp,WebGPUTintWASM:()=>ip,WebRequest:()=>ke,WebVRController:()=>Ol,WebVRFreeCamera:()=>Il,WebXRAbstractFeature:()=>Po,WebXRAbstractMotionController:()=>Ff,WebXRAnchorSystem:()=>yE,WebXRBackgroundRemover:()=>EE,WebXRCamera:()=>Df,WebXRCompositionLayerWrapper:()=>kE,WebXRControllerComponent:()=>Lf,WebXRControllerMovement:()=>DE,WebXRControllerPhysics:()=>AE,WebXRControllerPointerSelection:()=>jf,WebXRDefaultExperience:()=>i_,WebXRDefaultExperienceOptions:()=>t_,WebXRDomOverlay:()=>OE,WebXREnterExitUI:()=>Zf,WebXREnterExitUIButton:()=>Qf,WebXREnterExitUIOptions:()=>qf,WebXRExperienceHelper:()=>Nf,WebXREyeTracking:()=>LE,WebXRFeatureName:()=>xo,WebXRFeaturePointSystem:()=>xE,WebXRFeaturesManager:()=>Co,WebXRGenericHandController:()=>YE,WebXRGenericTriggerMotionController:()=>wf,WebXRHTCViveMotionController:()=>$E,WebXRHand:()=>Qa,WebXRHandTracking:()=>qa,WebXRHitTest:()=>RE,WebXRHitTestLegacy:()=>gE,WebXRImageTracking:()=>IE,WebXRInput:()=>Xf,WebXRInputSource:()=>Hf,WebXRLayers:()=>jE,WebXRLightEstimation:()=>NE,WebXRManagedOutputCanvas:()=>tc,WebXRManagedOutputCanvasOptions:()=>ec,WebXRMeshDetector:()=>ME,WebXRMicrosoftMixedRealityController:()=>QE,WebXRMotionControllerManager:()=>kf,WebXRMotionControllerTeleportation:()=>e_,WebXRNearControllerMode:()=>zf,WebXRNearInteraction:()=>Yf,WebXROculusTouchMotionController:()=>ZE,WebXRPlaneDetector:()=>TE,WebXRProfiledMotionController:()=>Uf,WebXRProjectionLayerWrapper:()=>zE,WebXRSessionManager:()=>oc,WebXRState:()=>Yl,WebXRTrackingState:()=>Kl,WebXRWalkingLocomotion:()=>VE,WeightedSound:()=>Yr,WindowsMotionController:()=>yp,WorkerPool:()=>Cf,WorleyNoise3DBlock:()=>Gg,XRHandJoint:()=>za,XRWindowsMotionController:()=>bp,Xbox360Button:()=>zs,Xbox360Dpad:()=>Ws,Xbox360Pad:()=>Ks,XboxInput:()=>Oi,_BabylonLoaderRegistered:()=>Y_,_BasisTextureLoader:()=>Pm,_CreationDataStorage:()=>Nr,_DDSTextureLoader:()=>Af,_ENVTextureLoader:()=>Rf,_HDRTextureLoader:()=>_m,_IAnimationState:()=>Ge,_InstancesBatch:()=>Fr,_KTXTextureLoader:()=>Of,_MeshCollisionData:()=>br,_OcclusionDataStorage:()=>Eu,_PrimaryIsoTriangle:()=>ry,_TGATextureLoader:()=>fm,_TimeToken:()=>Tu,_UpdateRGBDAsync:()=>ih,_forceSceneHelpersToBundle:()=>n_,_forceTransformFeedbackToBundle:()=>Su,_injectLTSFileTools:()=>di,allocateAndCopyTypedBuffer:()=>gr,className:()=>gi,createDetailMapPlugin:()=>yv,createPBRAnisotropicPlugin:()=>pv,createPBRBRDFPlugin:()=>fv,createPBRClearCoatPlugin:()=>_v,createPBRIridescencePlugin:()=>mv,createPBRSheenPlugin:()=>gv,createPBRSubSurfacePlugin:()=>vv,createYieldingScheduler:()=>Yn,editableInPropertyPage:()=>Qo,expandToProperty:()=>ye,extractMinAndMax:()=>ur,extractMinAndMaxIndexed:()=>cr,inlineScheduler:()=>jn,makeAsyncFunction:()=>Jn,makeSyncFunction:()=>Zn,nativeOverride:()=>Fe,normalizeEnvInfo:()=>Ku,runCoroutine:()=>Kn,runCoroutineAsync:()=>qn,runCoroutineSync:()=>Qn,serialize:()=>be,serializeAsCameraReference:()=>De,serializeAsColor3:()=>Ee,serializeAsColor4:()=>Pe,serializeAsColorCurves:()=>Ce,serializeAsFresnelParameters:()=>Se,serializeAsImageProcessingConfiguration:()=>Me,serializeAsMatrix:()=>Oe,serializeAsMeshReference:()=>xe,serializeAsQuaternion:()=>Ie,serializeAsTexture:()=>Te,serializeAsVector2:()=>Ae,serializeAsVector3:()=>Re,setAndStartTimer:()=>Jf,setStereoscopicAnaglyphRigMode:()=>nl,setStereoscopicRigMode:()=>ul,setVRRigMode:()=>Sl,setWebVRRigMode:()=>Ml});var o=function(){function e(){this.rootNodes=new Array,this.cameras=new Array,this.lights=new Array,this.meshes=new Array,this.skeletons=new Array,this.particleSystems=new Array,this.animations=[],this.animationGroups=new Array,this.multiMaterials=new Array,this.materials=new Array,this.morphTargetManagers=new Array,this.geometries=new Array,this.transformNodes=new Array,this.actionManagers=new Array,this.textures=new Array,this._environmentTexture=null,this.postProcesses=new Array}return e.AddParser=function(e,t){this._BabylonFileParsers[e]=t},e.GetParser=function(e){return this._BabylonFileParsers[e]?this._BabylonFileParsers[e]:null},e.AddIndividualParser=function(e,t){this._IndividualBabylonFileParsers[e]=t},e.GetIndividualParser=function(e){return this._IndividualBabylonFileParsers[e]?this._IndividualBabylonFileParsers[e]:null},e.Parse=function(e,t,i,n){for(var r in this._BabylonFileParsers)Object.prototype.hasOwnProperty.call(this._BabylonFileParsers,r)&&this._BabylonFileParsers[r](e,t,i,n)},Object.defineProperty(e.prototype,\"environmentTexture\",{get:function(){return this._environmentTexture},set:function(e){this._environmentTexture=e},enumerable:!1,configurable:!0}),e.prototype.getNodes=function(){var e=new Array;return e=(e=(e=(e=e.concat(this.meshes)).concat(this.lights)).concat(this.cameras)).concat(this.transformNodes),this.skeletons.forEach((function(t){return e=e.concat(t.bones)})),e},e._BabylonFileParsers={},e._IndividualBabylonFileParsers={},e}(),a=function(){function e(){}return e.ALPHA_DISABLE=0,e.ALPHA_ADD=1,e.ALPHA_COMBINE=2,e.ALPHA_SUBTRACT=3,e.ALPHA_MULTIPLY=4,e.ALPHA_MAXIMIZED=5,e.ALPHA_ONEONE=6,e.ALPHA_PREMULTIPLIED=7,e.ALPHA_PREMULTIPLIED_PORTERDUFF=8,e.ALPHA_INTERPOLATE=9,e.ALPHA_SCREENMODE=10,e.ALPHA_ONEONE_ONEONE=11,e.ALPHA_ALPHATOCOLOR=12,e.ALPHA_REVERSEONEMINUS=13,e.ALPHA_SRC_DSTONEMINUSSRCALPHA=14,e.ALPHA_ONEONE_ONEZERO=15,e.ALPHA_EXCLUSION=16,e.ALPHA_LAYER_ACCUMULATE=17,e.ALPHA_EQUATION_ADD=0,e.ALPHA_EQUATION_SUBSTRACT=1,e.ALPHA_EQUATION_REVERSE_SUBTRACT=2,e.ALPHA_EQUATION_MAX=3,e.ALPHA_EQUATION_MIN=4,e.ALPHA_EQUATION_DARKEN=5,e.DELAYLOADSTATE_NONE=0,e.DELAYLOADSTATE_LOADED=1,e.DELAYLOADSTATE_LOADING=2,e.DELAYLOADSTATE_NOTLOADED=4,e.NEVER=512,e.ALWAYS=519,e.LESS=513,e.EQUAL=514,e.LEQUAL=515,e.GREATER=516,e.GEQUAL=518,e.NOTEQUAL=517,e.KEEP=7680,e.ZERO=0,e.REPLACE=7681,e.INCR=7682,e.DECR=7683,e.INVERT=5386,e.INCR_WRAP=34055,e.DECR_WRAP=34056,e.TEXTURE_CLAMP_ADDRESSMODE=0,e.TEXTURE_WRAP_ADDRESSMODE=1,e.TEXTURE_MIRROR_ADDRESSMODE=2,e.TEXTURE_CREATIONFLAG_STORAGE=1,e.TEXTUREFORMAT_ALPHA=0,e.TEXTUREFORMAT_LUMINANCE=1,e.TEXTUREFORMAT_LUMINANCE_ALPHA=2,e.TEXTUREFORMAT_RGB=4,e.TEXTUREFORMAT_RGBA=5,e.TEXTUREFORMAT_RED=6,e.TEXTUREFORMAT_R=6,e.TEXTUREFORMAT_RG=7,e.TEXTUREFORMAT_RED_INTEGER=8,e.TEXTUREFORMAT_R_INTEGER=8,e.TEXTUREFORMAT_RG_INTEGER=9,e.TEXTUREFORMAT_RGB_INTEGER=10,e.TEXTUREFORMAT_RGBA_INTEGER=11,e.TEXTUREFORMAT_BGRA=12,e.TEXTUREFORMAT_DEPTH24_STENCIL8=13,e.TEXTUREFORMAT_DEPTH32_FLOAT=14,e.TEXTUREFORMAT_DEPTH16=15,e.TEXTUREFORMAT_DEPTH24=16,e.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8=17,e.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8=18,e.TEXTUREFORMAT_COMPRESSED_RGBA_BPTC_UNORM=36492,e.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_BPTC_UNORM=36493,e.TEXTUREFORMAT_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT=36495,e.TEXTUREFORMAT_COMPRESSED_RGB_BPTC_SIGNED_FLOAT=36494,e.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT5=33779,e.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919,e.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT3=33778,e.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918,e.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT1=33777,e.TEXTUREFORMAT_COMPRESSED_RGB_S3TC_DXT1=33776,e.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917,e.TEXTUREFORMAT_COMPRESSED_SRGB_S3TC_DXT1_EXT=35916,e.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_4x4=37808,e.TEXTUREFORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840,e.TEXTUREFORMAT_COMPRESSED_RGB_ETC1_WEBGL=36196,e.TEXTUREFORMAT_COMPRESSED_RGB8_ETC2=37492,e.TEXTUREFORMAT_COMPRESSED_SRGB8_ETC2=37493,e.TEXTUREFORMAT_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494,e.TEXTUREFORMAT_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495,e.TEXTUREFORMAT_COMPRESSED_RGBA8_ETC2_EAC=37496,e.TEXTUREFORMAT_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497,e.TEXTURETYPE_UNSIGNED_BYTE=0,e.TEXTURETYPE_UNSIGNED_INT=0,e.TEXTURETYPE_FLOAT=1,e.TEXTURETYPE_HALF_FLOAT=2,e.TEXTURETYPE_BYTE=3,e.TEXTURETYPE_SHORT=4,e.TEXTURETYPE_UNSIGNED_SHORT=5,e.TEXTURETYPE_INT=6,e.TEXTURETYPE_UNSIGNED_INTEGER=7,e.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4=8,e.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1=9,e.TEXTURETYPE_UNSIGNED_SHORT_5_6_5=10,e.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV=11,e.TEXTURETYPE_UNSIGNED_INT_24_8=12,e.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV=13,e.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV=14,e.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV=15,e.TEXTURETYPE_UNDEFINED=16,e.TEXTURE_NEAREST_SAMPLINGMODE=1,e.TEXTURE_NEAREST_NEAREST=1,e.TEXTURE_BILINEAR_SAMPLINGMODE=2,e.TEXTURE_LINEAR_LINEAR=2,e.TEXTURE_TRILINEAR_SAMPLINGMODE=3,e.TEXTURE_LINEAR_LINEAR_MIPLINEAR=3,e.TEXTURE_NEAREST_NEAREST_MIPNEAREST=4,e.TEXTURE_NEAREST_LINEAR_MIPNEAREST=5,e.TEXTURE_NEAREST_LINEAR_MIPLINEAR=6,e.TEXTURE_NEAREST_LINEAR=7,e.TEXTURE_NEAREST_NEAREST_MIPLINEAR=8,e.TEXTURE_LINEAR_NEAREST_MIPNEAREST=9,e.TEXTURE_LINEAR_NEAREST_MIPLINEAR=10,e.TEXTURE_LINEAR_LINEAR_MIPNEAREST=11,e.TEXTURE_LINEAR_NEAREST=12,e.TEXTURE_EXPLICIT_MODE=0,e.TEXTURE_SPHERICAL_MODE=1,e.TEXTURE_PLANAR_MODE=2,e.TEXTURE_CUBIC_MODE=3,e.TEXTURE_PROJECTION_MODE=4,e.TEXTURE_SKYBOX_MODE=5,e.TEXTURE_INVCUBIC_MODE=6,e.TEXTURE_EQUIRECTANGULAR_MODE=7,e.TEXTURE_FIXED_EQUIRECTANGULAR_MODE=8,e.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE=9,e.TEXTURE_FILTERING_QUALITY_OFFLINE=4096,e.TEXTURE_FILTERING_QUALITY_HIGH=64,e.TEXTURE_FILTERING_QUALITY_MEDIUM=16,e.TEXTURE_FILTERING_QUALITY_LOW=8,e.SCALEMODE_FLOOR=1,e.SCALEMODE_NEAREST=2,e.SCALEMODE_CEILING=3,e.MATERIAL_TextureDirtyFlag=1,e.MATERIAL_LightDirtyFlag=2,e.MATERIAL_FresnelDirtyFlag=4,e.MATERIAL_AttributesDirtyFlag=8,e.MATERIAL_MiscDirtyFlag=16,e.MATERIAL_PrePassDirtyFlag=32,e.MATERIAL_AllDirtyFlag=63,e.MATERIAL_TriangleFillMode=0,e.MATERIAL_WireFrameFillMode=1,e.MATERIAL_PointFillMode=2,e.MATERIAL_PointListDrawMode=3,e.MATERIAL_LineListDrawMode=4,e.MATERIAL_LineLoopDrawMode=5,e.MATERIAL_LineStripDrawMode=6,e.MATERIAL_TriangleStripDrawMode=7,e.MATERIAL_TriangleFanDrawMode=8,e.MATERIAL_ClockWiseSideOrientation=0,e.MATERIAL_CounterClockWiseSideOrientation=1,e.ACTION_NothingTrigger=0,e.ACTION_OnPickTrigger=1,e.ACTION_OnLeftPickTrigger=2,e.ACTION_OnRightPickTrigger=3,e.ACTION_OnCenterPickTrigger=4,e.ACTION_OnPickDownTrigger=5,e.ACTION_OnDoublePickTrigger=6,e.ACTION_OnPickUpTrigger=7,e.ACTION_OnPickOutTrigger=16,e.ACTION_OnLongPressTrigger=8,e.ACTION_OnPointerOverTrigger=9,e.ACTION_OnPointerOutTrigger=10,e.ACTION_OnEveryFrameTrigger=11,e.ACTION_OnIntersectionEnterTrigger=12,e.ACTION_OnIntersectionExitTrigger=13,e.ACTION_OnKeyDownTrigger=14,e.ACTION_OnKeyUpTrigger=15,e.PARTICLES_BILLBOARDMODE_Y=2,e.PARTICLES_BILLBOARDMODE_ALL=7,e.PARTICLES_BILLBOARDMODE_STRETCHED=8,e.MESHES_CULLINGSTRATEGY_STANDARD=0,e.MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY=1,e.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION=2,e.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY=3,e.SCENELOADER_NO_LOGGING=0,e.SCENELOADER_MINIMAL_LOGGING=1,e.SCENELOADER_SUMMARY_LOGGING=2,e.SCENELOADER_DETAILED_LOGGING=3,e.PREPASS_IRRADIANCE_TEXTURE_TYPE=0,e.PREPASS_POSITION_TEXTURE_TYPE=1,e.PREPASS_VELOCITY_TEXTURE_TYPE=2,e.PREPASS_REFLECTIVITY_TEXTURE_TYPE=3,e.PREPASS_COLOR_TEXTURE_TYPE=4,e.PREPASS_DEPTH_TEXTURE_TYPE=5,e.PREPASS_NORMAL_TEXTURE_TYPE=6,e.PREPASS_ALBEDO_SQRT_TEXTURE_TYPE=7,e.BUFFER_CREATIONFLAG_READ=1,e.BUFFER_CREATIONFLAG_WRITE=2,e.BUFFER_CREATIONFLAG_READWRITE=3,e.BUFFER_CREATIONFLAG_UNIFORM=4,e.BUFFER_CREATIONFLAG_VERTEX=8,e.BUFFER_CREATIONFLAG_INDEX=16,e.BUFFER_CREATIONFLAG_STORAGE=32,e.RENDERPASS_MAIN=0,e.INPUT_ALT_KEY=18,e.INPUT_CTRL_KEY=17,e.INPUT_META_KEY1=91,e.INPUT_META_KEY2=92,e.INPUT_META_KEY3=93,e.INPUT_SHIFT_KEY=16,e.SNAPSHOTRENDERING_STANDARD=0,e.SNAPSHOTRENDERING_FAST=1,e.PERSPECTIVE_CAMERA=0,e.ORTHOGRAPHIC_CAMERA=1,e.FOVMODE_VERTICAL_FIXED=0,e.FOVMODE_HORIZONTAL_FIXED=1,e.RIG_MODE_NONE=0,e.RIG_MODE_STEREOSCOPIC_ANAGLYPH=10,e.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL=11,e.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED=12,e.RIG_MODE_STEREOSCOPIC_OVERUNDER=13,e.RIG_MODE_STEREOSCOPIC_INTERLACED=14,e.RIG_MODE_VR=20,e.RIG_MODE_WEBVR=21,e.RIG_MODE_CUSTOM=22,e.MAX_SUPPORTED_UV_SETS=6,e.GL_ALPHA_EQUATION_ADD=32774,e.GL_ALPHA_EQUATION_MIN=32775,e.GL_ALPHA_EQUATION_MAX=32776,e.GL_ALPHA_EQUATION_SUBTRACT=32778,e.GL_ALPHA_EQUATION_REVERSE_SUBTRACT=32779,e.GL_ALPHA_FUNCTION_SRC=768,e.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR=769,e.GL_ALPHA_FUNCTION_SRC_ALPHA=770,e.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA=771,e.GL_ALPHA_FUNCTION_DST_ALPHA=772,e.GL_ALPHA_FUNCTION_ONE_MINUS_DST_ALPHA=773,e.GL_ALPHA_FUNCTION_DST_COLOR=774,e.GL_ALPHA_FUNCTION_ONE_MINUS_DST_COLOR=775,e.GL_ALPHA_FUNCTION_SRC_ALPHA_SATURATED=776,e.GL_ALPHA_FUNCTION_CONSTANT_COLOR=32769,e.GL_ALPHA_FUNCTION_ONE_MINUS_CONSTANT_COLOR=32770,e.GL_ALPHA_FUNCTION_CONSTANT_ALPHA=32771,e.GL_ALPHA_FUNCTION_ONE_MINUS_CONSTANT_ALPHA=32772,e.SnippetUrl=\"https://snippet.babylonjs.com\",e}(),s=function(){function e(){this.hoverCursor=\"\",this.actions=new Array,this.isRecursive=!1}return Object.defineProperty(e,\"HasTriggers\",{get:function(){for(var t in e.Triggers)if(Object.prototype.hasOwnProperty.call(e.Triggers,t))return!0;return!1},enumerable:!1,configurable:!0}),Object.defineProperty(e,\"HasPickTriggers\",{get:function(){for(var t in e.Triggers)if(Object.prototype.hasOwnProperty.call(e.Triggers,t)){var i=parseInt(t);if(i>=a.ACTION_OnPickTrigger&&i<=a.ACTION_OnPickUpTrigger)return!0}return!1},enumerable:!1,configurable:!0}),e.HasSpecificTrigger=function(t){for(var i in e.Triggers)if(Object.prototype.hasOwnProperty.call(e.Triggers,i)&&parseInt(i)===t)return!0;return!1},e.Triggers={},e}(),l=function(){function e(e,t,i,n){void 0===t&&(t=!1),this.initialize(e,t,i,n)}return e.prototype.initialize=function(e,t,i,n){return void 0===t&&(t=!1),this.mask=e,this.skipNextObservers=t,this.target=i,this.currentTarget=n,this},e}(),c=function(e,t,i){void 0===i&&(i=null),this.callback=e,this.mask=t,this.scope=i,this._willBeUnregistered=!1,this.unregisterOnNextCall=!1},u=function(){function e(e){this._observers=new Array,this._eventState=new l(0),e&&(this._onObserverAdded=e)}return e.FromPromise=function(t,i){var n=new e;return t.then((function(e){n.notifyObservers(e)})).catch((function(e){if(!i)throw e;i.notifyObservers(e)})),n},Object.defineProperty(e.prototype,\"observers\",{get:function(){return this._observers},enumerable:!1,configurable:!0}),e.prototype.add=function(e,t,i,n,r){if(void 0===t&&(t=-1),void 0===i&&(i=!1),void 0===n&&(n=null),void 0===r&&(r=!1),!e)return null;var o=new c(e,t,n);return o.unregisterOnNextCall=r,i?this._observers.unshift(o):this._observers.push(o),this._onObserverAdded&&this._onObserverAdded(o),o},e.prototype.addOnce=function(e){return this.add(e,void 0,void 0,void 0,!0)},e.prototype.remove=function(e){return!!e&&-1!==this._observers.indexOf(e)&&(this._deferUnregister(e),!0)},e.prototype.removeCallback=function(e,t){for(var i=0;i0},e.prototype.clear=function(){this._observers=new Array,this._onObserverAdded=null},e.prototype.clone=function(){var t=new e;return t._observers=this._observers.slice(0),t},e.prototype.hasSpecificMask=function(e){void 0===e&&(e=-1);for(var t=0,i=this._observers;t0?1:-1},e.Clamp=function(e,t,i){return void 0===t&&(t=0),void 0===i&&(i=1),Math.min(i,Math.max(t,e))},e.Log2=function(e){return Math.log(e)*Math.LOG2E},e.ILog2=function(e){if(Math.log2)return Math.floor(Math.log2(e));if(e<0)return NaN;if(0===e)return-1/0;var t=0;if(e<1){for(;e<1;)t++,e*=2;t=-t}else if(e>1)for(;e>1;)t++,e=Math.floor(e/2);return t},e.Repeat=function(e,t){return e-Math.floor(e/t)*t},e.Normalize=function(e,t,i){return(e-t)/(i-t)},e.Denormalize=function(e,t,i){return e*(i-t)+t},e.DeltaAngle=function(t,i){var n=e.Repeat(i-t,360);return n>180&&(n-=360),n},e.PingPong=function(t,i){var n=e.Repeat(t,2*i);return i-Math.abs(n-i)},e.SmoothStep=function(t,i,n){var r=e.Clamp(n);return i*(r=-2*r*r*r+3*r*r)+t*(1-r)},e.MoveTowards=function(t,i,n){return Math.abs(i-t)<=n?i:t+e.Sign(i-t)*n},e.MoveTowardsAngle=function(t,i,n){var r=e.DeltaAngle(t,i),o=0;return-n180&&(r-=360),t+r*e.Clamp(n)},e.InverseLerp=function(t,i,n){return t!=i?e.Clamp((n-t)/(i-t)):0},e.Hermite=function(e,t,i,n,r){var o=r*r,a=r*o;return e*(2*a-3*o+1)+i*(-2*a+3*o)+t*(a-2*o+r)+n*(a-o)},e.Hermite1stDerivative=function(e,t,i,n,r){var o=r*r;return 6*(o-r)*e+(3*o-4*r+1)*t+6*(-o+r)*i+(3*o-2*r)*n},e.RandomRange=function(e,t){return e===t?e:Math.random()*(t-e)+e},e.RangeToPercent=function(e,t,i){return(e-t)/(i-t)},e.PercentToRange=function(e,t,i){return(i-t)*e+t},e.NormalizeRadians=function(t){return t-e.TwoPi*Math.floor((t+Math.PI)/e.TwoPi)},e.HCF=function(t,i){var n=t%i;return 0===n?i:e.HCF(i,n)},e.TwoPi=2*Math.PI,e}(),d=1/2.2,p=2.2,f=(1+Math.sqrt(5))/2,_=.001,m=function(){function e(){}return e.BuildArray=function(e,t){for(var i=[],n=0;nn.x?n.x:r)n.y?n.y:o)i.x?t.x:i.x,t.y>i.y?t.y:i.y)},e.Transform=function(t,i){var n=e.Zero();return e.TransformToRef(t,i,n),n},e.TransformToRef=function(e,t,i){var n=t.m,r=e.x*n[0]+e.y*n[4]+n[12],o=e.x*n[1]+e.y*n[5]+n[13];i.x=r,i.y=o},e.PointInTriangle=function(e,t,i,n){var r=.5*(-i.y*n.x+t.y*(-i.x+n.x)+t.x*(i.y-n.y)+i.x*n.y),o=r<0?-1:1,a=(t.y*n.x-t.x*n.y+(n.y-t.y)*e.x+(t.x-n.x)*e.y)*o,s=(t.x*i.y-t.y*i.x+(t.y-i.y)*e.x+(i.x-t.x)*e.y)*o;return a>0&&s>0&&a+s<2*r*o},e.Distance=function(t,i){return Math.sqrt(e.DistanceSquared(t,i))},e.DistanceSquared=function(e,t){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n},e.Center=function(t,i){return e.CenterToRef(t,i,e.Zero())},e.CenterToRef=function(e,t,i){return i.copyFromFloats((e.x+t.x)/2,(e.y+t.y)/2)},e.DistanceOfPointFromSegment=function(t,i,n){var r=e.DistanceSquared(i,n);if(0===r)return e.Distance(t,i);var o=n.subtract(i),a=Math.max(0,Math.min(1,e.Dot(t.subtract(i),o)/r)),s=i.add(o.multiplyByFloats(a,a));return e.Distance(t,s)},e._ZeroReadOnly=e.Zero(),e}(),x=function(){function e(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),this._isDirty=!0,this._x=e,this._y=t,this._z=i}return Object.defineProperty(e.prototype,\"x\",{get:function(){return this._x},set:function(e){this._x=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"y\",{get:function(){return this._y},set:function(e){this._y=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"z\",{get:function(){return this._z},set:function(e){this._z=e,this._isDirty=!0},enumerable:!1,configurable:!0}),e.prototype.toString=function(){return\"{X: \".concat(this._x,\" Y: \").concat(this._y,\" Z: \").concat(this._z,\"}\")},e.prototype.getClassName=function(){return\"Vector3\"},e.prototype.getHashCode=function(){var e=A(this._x);return 397*(e=397*e^A(this._y))^A(this._z)},e.prototype.asArray=function(){var e=[];return this.toArray(e,0),e},e.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,this},e.prototype.fromArray=function(t,i){return void 0===i&&(i=0),e.FromArrayToRef(t,i,this),this},e.prototype.toQuaternion=function(){return P.RotationYawPitchRoll(this._y,this._x,this._z)},e.prototype.addInPlace=function(e){return this.addInPlaceFromFloats(e._x,e._y,e._z)},e.prototype.addInPlaceFromFloats=function(e,t,i){return this.x+=e,this.y+=t,this.z+=i,this},e.prototype.add=function(t){return new e(this._x+t._x,this._y+t._y,this._z+t._z)},e.prototype.addToRef=function(e,t){return t.copyFromFloats(this._x+e._x,this._y+e._y,this._z+e._z)},e.prototype.subtractInPlace=function(e){return this.x-=e._x,this.y-=e._y,this.z-=e._z,this},e.prototype.subtract=function(t){return new e(this._x-t._x,this._y-t._y,this._z-t._z)},e.prototype.subtractToRef=function(e,t){return this.subtractFromFloatsToRef(e._x,e._y,e._z,t)},e.prototype.subtractFromFloats=function(t,i,n){return new e(this._x-t,this._y-i,this._z-n)},e.prototype.subtractFromFloatsToRef=function(e,t,i,n){return n.copyFromFloats(this._x-e,this._y-t,this._z-i)},e.prototype.negate=function(){return new e(-this._x,-this._y,-this._z)},e.prototype.negateInPlace=function(){return this.x*=-1,this.y*=-1,this.z*=-1,this},e.prototype.negateToRef=function(e){return e.copyFromFloats(-1*this._x,-1*this._y,-1*this._z)},e.prototype.scaleInPlace=function(e){return this.x*=e,this.y*=e,this.z*=e,this},e.prototype.scale=function(t){return new e(this._x*t,this._y*t,this._z*t)},e.prototype.scaleToRef=function(e,t){return t.copyFromFloats(this._x*e,this._y*e,this._z*e)},e.prototype._getNormalToRef=function(e){var t=this.length(),i=Math.acos(this.y/t),n=Math.atan2(this.z,this.x);i>Math.PI/2?i-=Math.PI/2:i+=Math.PI/2;var r=t*Math.sin(i)*Math.cos(n),o=t*Math.cos(i),a=t*Math.sin(i)*Math.sin(n);return e.set(r,o,a),e},e.prototype.applyRotationQuaternionToRef=function(e,t){var i=e.w*this.x+e.y*this.z-e.z*this.y,n=e.w*this.y+e.z*this.x-e.x*this.z,r=e.w*this.z+e.x*this.y-e.y*this.x,o=-e.x*this.x-e.y*this.y-e.z*this.z;return t.x=i*e.w+o*-e.x+n*-e.z-r*-e.y,t.y=n*e.w+o*-e.y+r*-e.x-i*-e.z,t.z=r*e.w+o*-e.z+i*-e.y-n*-e.x,t},e.prototype.applyRotationQuaternionInPlace=function(e){return this.applyRotationQuaternionToRef(e,this)},e.prototype.applyRotationQuaternion=function(t){return this.applyRotationQuaternionToRef(t,e.Zero())},e.prototype.scaleAndAddToRef=function(e,t){return t.addInPlaceFromFloats(this._x*e,this._y*e,this._z*e)},e.prototype.projectOnPlane=function(t,i){var n=e.Zero();return this.projectOnPlaneToRef(t,i,n),n},e.prototype.projectOnPlaneToRef=function(t,i,n){var r=t.normal,o=t.d,a=I.Vector3[0];this.subtractToRef(i,a),a.normalize();var s=e.Dot(a,r);if(Math.abs(s)this._x&&(this.x=e),t>this._y&&(this.y=t),i>this._z&&(this.z=i),this},e.prototype.isNonUniformWithinEpsilon=function(e){var t=Math.abs(this._x),i=Math.abs(this._y);if(!h.WithinEpsilon(t,i,e))return!0;var n=Math.abs(this._z);return!h.WithinEpsilon(t,n,e)||!h.WithinEpsilon(i,n,e)},Object.defineProperty(e.prototype,\"isNonUniform\",{get:function(){var e=Math.abs(this._x);return e!==Math.abs(this._y)||e!==Math.abs(this._z)},enumerable:!1,configurable:!0}),e.prototype.floor=function(){return new e(Math.floor(this._x),Math.floor(this._y),Math.floor(this._z))},e.prototype.fract=function(){return new e(this._x-Math.floor(this._x),this._y-Math.floor(this._y),this._z-Math.floor(this._z))},e.prototype.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z)},e.prototype.lengthSquared=function(){return this._x*this._x+this._y*this._y+this._z*this._z},Object.defineProperty(e.prototype,\"hasAZeroComponent\",{get:function(){return this._x*this._y*this._z==0},enumerable:!1,configurable:!0}),e.prototype.normalize=function(){return this.normalizeFromLength(this.length())},e.prototype.reorderInPlace=function(e){var t=this;return\"xyz\"===(e=e.toLowerCase())||(I.Vector3[0].copyFrom(this),[\"x\",\"y\",\"z\"].forEach((function(i,n){t[i]=I.Vector3[0][e[n]]}))),this},e.prototype.rotateByQuaternionToRef=function(t,i){return t.toRotationMatrix(I.Matrix[0]),e.TransformCoordinatesToRef(this,I.Matrix[0],i),i},e.prototype.rotateByQuaternionAroundPointToRef=function(e,t,i){return this.subtractToRef(t,I.Vector3[0]),I.Vector3[0].rotateByQuaternionToRef(e,I.Vector3[0]),t.addToRef(I.Vector3[0],i),i},e.prototype.cross=function(t){return e.Cross(this,t)},e.prototype.normalizeFromLength=function(e){return 0===e||1===e?this:this.scaleInPlace(1/e)},e.prototype.normalizeToNew=function(){var t=new e(0,0,0);return this.normalizeToRef(t),t},e.prototype.normalizeToRef=function(e){var t=this.length();return 0===t||1===t?e.copyFromFloats(this._x,this._y,this._z):this.scaleToRef(1/t,e)},e.prototype.clone=function(){return new e(this._x,this._y,this._z)},e.prototype.copyFrom=function(e){return this.copyFromFloats(e._x,e._y,e._z)},e.prototype.copyFromFloats=function(e,t,i){return this.x=e,this.y=t,this.z=i,this},e.prototype.set=function(e,t,i){return this.copyFromFloats(e,t,i)},e.prototype.setAll=function(e){return this.x=this.y=this.z=e,this},e.GetClipFactor=function(t,i,n,r){var o=e.Dot(t,n)-r;return o/(o-(e.Dot(i,n)-r))},e.GetAngleBetweenVectors=function(t,i,n){var r=t.normalizeToRef(I.Vector3[1]),o=i.normalizeToRef(I.Vector3[2]),a=e.Dot(r,o);a=h.Clamp(a,-1,1);var s=Math.acos(a),l=I.Vector3[3];return e.CrossToRef(r,o,l),e.Dot(l,n)>0?isNaN(s)?0:s:isNaN(s)?-Math.PI:-Math.acos(a)},e.GetAngleBetweenVectorsOnPlane=function(t,i,n){I.Vector3[0].copyFrom(t);var r=I.Vector3[0];I.Vector3[1].copyFrom(i);var o=I.Vector3[1];I.Vector3[2].copyFrom(n);var a=I.Vector3[2],s=I.Vector3[3],l=I.Vector3[4];r.normalize(),o.normalize(),a.normalize(),e.CrossToRef(a,r,s),e.CrossToRef(s,a,l);var c=Math.atan2(e.Dot(o,s),e.Dot(o,l));return h.NormalizeRadians(c)},e.PitchYawRollToMoveBetweenPointsToRef=function(e,t,i){var n=O.Vector3[0];return t.subtractToRef(e,n),i.y=Math.atan2(n.x,n.z)||0,i.x=Math.atan2(Math.sqrt(Math.pow(n.x,2)+Math.pow(n.z,2)),n.y)||0,i.z=0,i},e.PitchYawRollToMoveBetweenPoints=function(t,i){var n=e.Zero();return e.PitchYawRollToMoveBetweenPointsToRef(t,i,n)},e.SlerpToRef=function(t,i,n,r){n=h.Clamp(n,0,1);var o=I.Vector3[0],a=I.Vector3[1];o.copyFrom(t);var s=o.length();o.normalizeFromLength(s),a.copyFrom(i);var l=a.length();a.normalizeFromLength(l);var c,u,d=e.Dot(o,a);if(d<1-_){var p=Math.acos(d),f=1/Math.sin(p);c=Math.sin((1-n)*p)*f,u=Math.sin(n*p)*f}else c=1-n,u=n;o.scaleInPlace(c),a.scaleInPlace(u),r.copyFrom(o).addInPlace(a),r.scaleInPlace(h.Lerp(s,l,n))},e.SmoothToRef=function(t,i,n,r,o){e.SlerpToRef(t,i,0===r?1:n/r,o)},e.FromArray=function(t,i){return void 0===i&&(i=0),new e(t[i],t[i+1],t[i+2])},e.FromFloatArray=function(t,i){return e.FromArray(t,i)},e.FromArrayToRef=function(e,t,i){i.x=e[t],i.y=e[t+1],i.z=e[t+2]},e.FromFloatArrayToRef=function(t,i,n){return e.FromArrayToRef(t,i,n)},e.FromFloatsToRef=function(e,t,i,n){n.copyFromFloats(e,t,i)},e.Zero=function(){return new e(0,0,0)},e.One=function(){return new e(1,1,1)},e.Up=function(){return new e(0,1,0)},Object.defineProperty(e,\"UpReadOnly\",{get:function(){return e._UpReadOnly},enumerable:!1,configurable:!0}),Object.defineProperty(e,\"DownReadOnly\",{get:function(){return e._DownReadOnly},enumerable:!1,configurable:!0}),Object.defineProperty(e,\"RightReadOnly\",{get:function(){return e._RightReadOnly},enumerable:!1,configurable:!0}),Object.defineProperty(e,\"LeftReadOnly\",{get:function(){return e._LeftReadOnly},enumerable:!1,configurable:!0}),Object.defineProperty(e,\"LeftHandedForwardReadOnly\",{get:function(){return e._LeftHandedForwardReadOnly},enumerable:!1,configurable:!0}),Object.defineProperty(e,\"RightHandedForwardReadOnly\",{get:function(){return e._RightHandedForwardReadOnly},enumerable:!1,configurable:!0}),Object.defineProperty(e,\"ZeroReadOnly\",{get:function(){return e._ZeroReadOnly},enumerable:!1,configurable:!0}),e.Down=function(){return new e(0,-1,0)},e.Forward=function(t){return void 0===t&&(t=!1),new e(0,0,t?-1:1)},e.Backward=function(t){return void 0===t&&(t=!1),new e(0,0,t?1:-1)},e.Right=function(){return new e(1,0,0)},e.Left=function(){return new e(-1,0,0)},e.TransformCoordinates=function(t,i){var n=e.Zero();return e.TransformCoordinatesToRef(t,i,n),n},e.TransformCoordinatesToRef=function(t,i,n){e.TransformCoordinatesFromFloatsToRef(t._x,t._y,t._z,i,n)},e.TransformCoordinatesFromFloatsToRef=function(e,t,i,n,r){var o=n.m,a=e*o[0]+t*o[4]+i*o[8]+o[12],s=e*o[1]+t*o[5]+i*o[9]+o[13],l=e*o[2]+t*o[6]+i*o[10]+o[14],c=1/(e*o[3]+t*o[7]+i*o[11]+o[15]);r.x=a*c,r.y=s*c,r.z=l*c},e.TransformNormal=function(t,i){var n=e.Zero();return e.TransformNormalToRef(t,i,n),n},e.TransformNormalToRef=function(e,t,i){this.TransformNormalFromFloatsToRef(e._x,e._y,e._z,t,i)},e.TransformNormalFromFloatsToRef=function(e,t,i,n,r){var o=n.m;r.x=e*o[0]+t*o[4]+i*o[8],r.y=e*o[1]+t*o[5]+i*o[9],r.z=e*o[2]+t*o[6]+i*o[10]},e.CatmullRom=function(t,i,n,r,o){var a=o*o,s=o*a;return new e(.5*(2*i._x+(-t._x+n._x)*o+(2*t._x-5*i._x+4*n._x-r._x)*a+(-t._x+3*i._x-3*n._x+r._x)*s),.5*(2*i._y+(-t._y+n._y)*o+(2*t._y-5*i._y+4*n._y-r._y)*a+(-t._y+3*i._y-3*n._y+r._y)*s),.5*(2*i._z+(-t._z+n._z)*o+(2*t._z-5*i._z+4*n._z-r._z)*a+(-t._z+3*i._z-3*n._z+r._z)*s))},e.Clamp=function(t,i,n){var r=new e;return e.ClampToRef(t,i,n,r),r},e.ClampToRef=function(e,t,i,n){var r=e._x;r=(r=r>i._x?i._x:r)i._y?i._y:o)i._z?i._z:a)0&&C<0?(D.copyFrom(a),P=i,M=n):C>0&&O<0?(D.copyFrom(l),P=n,M=r):(D.copyFrom(s).scaleInPlace(-1),P=r,M=i);var N=I.Vector3[9],L=I.Vector3[4];if(P.subtractToRef(b,A),M.subtractToRef(b,N),e.CrossToRef(A,N,L),!(e.Dot(L,c)<0))return o.copyFrom(b),Math.abs(g*v);var F=I.Vector3[5];e.CrossToRef(D,L,F),F.normalize();var w=I.Vector3[9];w.copyFrom(P).subtractInPlace(b);var B=w.length();if(B<_)return o.copyFrom(P),e.Distance(t,P);w.normalizeFromLength(B);var U=e.Dot(F,w),V=I.Vector3[7];V.copyFrom(b).addInPlace(F.scaleInPlace(B*U)),A.copyFrom(V).subtractInPlace(P),g=D.length(),D.normalizeFromLength(g);var k=e.Dot(A,D)/Math.max(g,_);return k=h.Clamp(k,0,1),V.copyFrom(P).addInPlace(D.scaleInPlace(k*g)),o.copyFrom(V),e.Distance(t,V)},e.Center=function(t,i){return e.CenterToRef(t,i,e.Zero())},e.CenterToRef=function(e,t,i){return i.copyFromFloats((e._x+t._x)/2,(e._y+t._y)/2,(e._z+t._z)/2)},e.RotationFromAxis=function(t,i,n){var r=e.Zero();return e.RotationFromAxisToRef(t,i,n,r),r},e.RotationFromAxisToRef=function(e,t,i,n){var r=I.Quaternion[0];P.RotationQuaternionFromAxisToRef(e,t,i,r),r.toEulerAnglesToRef(n)},e._UpReadOnly=e.Up(),e._DownReadOnly=e.Down(),e._LeftHandedForwardReadOnly=e.Forward(!1),e._RightHandedForwardReadOnly=e.Forward(!0),e._RightReadOnly=e.Right(),e._LeftReadOnly=e.Left(),e._ZeroReadOnly=e.Zero(),e}(),C=function(){function e(e,t,i,n){this.x=e,this.y=t,this.z=i,this.w=n}return e.prototype.toString=function(){return\"{X: \".concat(this.x,\" Y: \").concat(this.y,\" Z: \").concat(this.z,\" W: \").concat(this.w,\"}\")},e.prototype.getClassName=function(){return\"Vector4\"},e.prototype.getHashCode=function(){var e=A(this.x);return 397*(e=397*(e=397*e^A(this.y))^A(this.z))^A(this.w)},e.prototype.asArray=function(){var e=new Array;return this.toArray(e,0),e},e.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,this},e.prototype.fromArray=function(t,i){return void 0===i&&(i=0),e.FromArrayToRef(t,i,this),this},e.prototype.addInPlace=function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this},e.prototype.add=function(t){return new e(this.x+t.x,this.y+t.y,this.z+t.z,this.w+t.w)},e.prototype.addToRef=function(e,t){return t.x=this.x+e.x,t.y=this.y+e.y,t.z=this.z+e.z,t.w=this.w+e.w,this},e.prototype.subtractInPlace=function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this},e.prototype.subtract=function(t){return new e(this.x-t.x,this.y-t.y,this.z-t.z,this.w-t.w)},e.prototype.subtractToRef=function(e,t){return t.x=this.x-e.x,t.y=this.y-e.y,t.z=this.z-e.z,t.w=this.w-e.w,this},e.prototype.subtractFromFloats=function(t,i,n,r){return new e(this.x-t,this.y-i,this.z-n,this.w-r)},e.prototype.subtractFromFloatsToRef=function(e,t,i,n,r){return r.x=this.x-e,r.y=this.y-t,r.z=this.z-i,r.w=this.w-n,this},e.prototype.negate=function(){return new e(-this.x,-this.y,-this.z,-this.w)},e.prototype.negateInPlace=function(){return this.x*=-1,this.y*=-1,this.z*=-1,this.w*=-1,this},e.prototype.negateToRef=function(e){return e.copyFromFloats(-1*this.x,-1*this.y,-1*this.z,-1*this.w)},e.prototype.scaleInPlace=function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},e.prototype.scale=function(t){return new e(this.x*t,this.y*t,this.z*t,this.w*t)},e.prototype.scaleToRef=function(e,t){return t.x=this.x*e,t.y=this.y*e,t.z=this.z*e,t.w=this.w*e,this},e.prototype.scaleAndAddToRef=function(e,t){return t.x+=this.x*e,t.y+=this.y*e,t.z+=this.z*e,t.w+=this.w*e,this},e.prototype.equals=function(e){return e&&this.x===e.x&&this.y===e.y&&this.z===e.z&&this.w===e.w},e.prototype.equalsWithEpsilon=function(e,t){return void 0===t&&(t=_),e&&h.WithinEpsilon(this.x,e.x,t)&&h.WithinEpsilon(this.y,e.y,t)&&h.WithinEpsilon(this.z,e.z,t)&&h.WithinEpsilon(this.w,e.w,t)},e.prototype.equalsToFloats=function(e,t,i,n){return this.x===e&&this.y===t&&this.z===i&&this.w===n},e.prototype.multiplyInPlace=function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this},e.prototype.multiply=function(t){return new e(this.x*t.x,this.y*t.y,this.z*t.z,this.w*t.w)},e.prototype.multiplyToRef=function(e,t){return t.x=this.x*e.x,t.y=this.y*e.y,t.z=this.z*e.z,t.w=this.w*e.w,this},e.prototype.multiplyByFloats=function(t,i,n,r){return new e(this.x*t,this.y*i,this.z*n,this.w*r)},e.prototype.divide=function(t){return new e(this.x/t.x,this.y/t.y,this.z/t.z,this.w/t.w)},e.prototype.divideToRef=function(e,t){return t.x=this.x/e.x,t.y=this.y/e.y,t.z=this.z/e.z,t.w=this.w/e.w,this},e.prototype.divideInPlace=function(e){return this.divideToRef(e,this)},e.prototype.minimizeInPlace=function(e){return e.xthis.x&&(this.x=e.x),e.y>this.y&&(this.y=e.y),e.z>this.z&&(this.z=e.z),e.w>this.w&&(this.w=e.w),this},e.prototype.floor=function(){return new e(Math.floor(this.x),Math.floor(this.y),Math.floor(this.z),Math.floor(this.w))},e.prototype.fract=function(){return new e(this.x-Math.floor(this.x),this.y-Math.floor(this.y),this.z-Math.floor(this.z),this.w-Math.floor(this.w))},e.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.prototype.normalize=function(){var e=this.length();return 0===e?this:this.scaleInPlace(1/e)},e.prototype.toVector3=function(){return new x(this.x,this.y,this.z)},e.prototype.clone=function(){return new e(this.x,this.y,this.z,this.w)},e.prototype.copyFrom=function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this},e.prototype.copyFromFloats=function(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this},e.prototype.set=function(e,t,i,n){return this.copyFromFloats(e,t,i,n)},e.prototype.setAll=function(e){return this.x=this.y=this.z=this.w=e,this},e.FromArray=function(t,i){return i||(i=0),new e(t[i],t[i+1],t[i+2],t[i+3])},e.FromArrayToRef=function(e,t,i){i.x=e[t],i.y=e[t+1],i.z=e[t+2],i.w=e[t+3]},e.FromFloatArrayToRef=function(t,i,n){e.FromArrayToRef(t,i,n)},e.FromFloatsToRef=function(e,t,i,n,r){r.x=e,r.y=t,r.z=i,r.w=n},e.Zero=function(){return new e(0,0,0,0)},e.One=function(){return new e(1,1,1,1)},Object.defineProperty(e,\"ZeroReadOnly\",{get:function(){return e._ZeroReadOnly},enumerable:!1,configurable:!0}),e.Normalize=function(t){var i=e.Zero();return e.NormalizeToRef(t,i),i},e.NormalizeToRef=function(e,t){t.copyFrom(e),t.normalize()},e.Minimize=function(e,t){var i=e.clone();return i.minimizeInPlace(t),i},e.Maximize=function(e,t){var i=e.clone();return i.maximizeInPlace(t),i},e.Distance=function(t,i){return Math.sqrt(e.DistanceSquared(t,i))},e.DistanceSquared=function(e,t){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z,o=e.w-t.w;return i*i+n*n+r*r+o*o},e.Center=function(t,i){return e.CenterToRef(t,i,e.Zero())},e.CenterToRef=function(e,t,i){return i.copyFromFloats((e.x+t.x)/2,(e.y+t.y)/2,(e.z+t.z)/2,(e.w+t.w)/2)},e.TransformCoordinates=function(t,i){var n=e.Zero();return e.TransformCoordinatesToRef(t,i,n),n},e.TransformCoordinatesToRef=function(t,i,n){e.TransformCoordinatesFromFloatsToRef(t._x,t._y,t._z,i,n)},e.TransformCoordinatesFromFloatsToRef=function(e,t,i,n,r){var o=n.m,a=e*o[0]+t*o[4]+i*o[8]+o[12],s=e*o[1]+t*o[5]+i*o[9]+o[13],l=e*o[2]+t*o[6]+i*o[10]+o[14],c=e*o[3]+t*o[7]+i*o[11]+o[15];r.x=a,r.y=s,r.z=l,r.w=c},e.TransformNormal=function(t,i){var n=e.Zero();return e.TransformNormalToRef(t,i,n),n},e.TransformNormalToRef=function(e,t,i){var n=t.m,r=e.x*n[0]+e.y*n[4]+e.z*n[8],o=e.x*n[1]+e.y*n[5]+e.z*n[9],a=e.x*n[2]+e.y*n[6]+e.z*n[10];i.x=r,i.y=o,i.z=a,i.w=e.w},e.TransformNormalFromFloatsToRef=function(e,t,i,n,r,o){var a=r.m;o.x=e*a[0]+t*a[4]+i*a[8],o.y=e*a[1]+t*a[5]+i*a[9],o.z=e*a[2]+t*a[6]+i*a[10],o.w=n},e.FromVector3=function(t,i){return void 0===i&&(i=0),new e(t._x,t._y,t._z,i)},e._ZeroReadOnly=e.Zero(),e}(),P=function(){function e(e,t,i,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=1),this._isDirty=!0,this._x=e,this._y=t,this._z=i,this._w=n}return Object.defineProperty(e.prototype,\"x\",{get:function(){return this._x},set:function(e){this._x=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"y\",{get:function(){return this._y},set:function(e){this._y=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"z\",{get:function(){return this._z},set:function(e){this._z=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"w\",{get:function(){return this._w},set:function(e){this._w=e,this._isDirty=!0},enumerable:!1,configurable:!0}),e.prototype.toString=function(){return\"{X: \".concat(this._x,\" Y: \").concat(this._y,\" Z: \").concat(this._z,\" W: \").concat(this._w,\"}\")},e.prototype.getClassName=function(){return\"Quaternion\"},e.prototype.getHashCode=function(){var e=A(this._x);return 397*(e=397*(e=397*e^A(this._y))^A(this._z))^A(this._w)},e.prototype.asArray=function(){return[this._x,this._y,this._z,this._w]},e.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,this},e.prototype.equals=function(e){return e&&this._x===e._x&&this._y===e._y&&this._z===e._z&&this._w===e._w},e.prototype.equalsWithEpsilon=function(e,t){return void 0===t&&(t=_),e&&h.WithinEpsilon(this._x,e._x,t)&&h.WithinEpsilon(this._y,e._y,t)&&h.WithinEpsilon(this._z,e._z,t)&&h.WithinEpsilon(this._w,e._w,t)},e.prototype.clone=function(){return new e(this._x,this._y,this._z,this._w)},e.prototype.copyFrom=function(e){return this.x=e._x,this.y=e._y,this.z=e._z,this.w=e._w,this},e.prototype.copyFromFloats=function(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this},e.prototype.set=function(e,t,i,n){return this.copyFromFloats(e,t,i,n)},e.prototype.add=function(t){return new e(this._x+t._x,this._y+t._y,this._z+t._z,this._w+t._w)},e.prototype.addInPlace=function(e){return this._x+=e._x,this._y+=e._y,this._z+=e._z,this._w+=e._w,this},e.prototype.subtract=function(t){return new e(this._x-t._x,this._y-t._y,this._z-t._z,this._w-t._w)},e.prototype.subtractInPlace=function(e){return this._x-=e._x,this._y-=e._y,this._z-=e._z,this._w-=e._w,this},e.prototype.scale=function(t){return new e(this._x*t,this._y*t,this._z*t,this._w*t)},e.prototype.scaleToRef=function(e,t){return t.x=this._x*e,t.y=this._y*e,t.z=this._z*e,t.w=this._w*e,this},e.prototype.scaleInPlace=function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},e.prototype.scaleAndAddToRef=function(e,t){return t.x+=this._x*e,t.y+=this._y*e,t.z+=this._z*e,t.w+=this._w*e,this},e.prototype.multiply=function(t){var i=new e(0,0,0,1);return this.multiplyToRef(t,i),i},e.prototype.multiplyToRef=function(e,t){var i=this._x*e._w+this._y*e._z-this._z*e._y+this._w*e._x,n=-this._x*e._z+this._y*e._w+this._z*e._x+this._w*e._y,r=this._x*e._y-this._y*e._x+this._z*e._w+this._w*e._z,o=-this._x*e._x-this._y*e._y-this._z*e._z+this._w*e._w;return t.copyFromFloats(i,n,r,o),this},e.prototype.multiplyInPlace=function(e){return this.multiplyToRef(e,this),this},e.prototype.conjugateToRef=function(e){return e.copyFromFloats(-this._x,-this._y,-this._z,this._w),this},e.prototype.conjugateInPlace=function(){return this.x*=-1,this.y*=-1,this.z*=-1,this},e.prototype.conjugate=function(){return new e(-this._x,-this._y,-this._z,this._w)},e.prototype.invert=function(){var e=this.conjugate(),t=this.lengthSquared();return 0==t||1==t||e.scaleInPlace(1/t),e},e.prototype.invertInPlace=function(){this.conjugateInPlace();var e=this.lengthSquared();return 0==e||1==e||this.scaleInPlace(1/e),this},e.prototype.lengthSquared=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},e.prototype.length=function(){return Math.sqrt(this.lengthSquared())},e.prototype.normalize=function(){var e=this.length();if(0===e)return this;var t=1/e;return this.scaleInPlace(t),this},e.prototype.normalizeToNew=function(){var e=this.length();if(0===e)return this.clone();var t=1/e;return this.scale(t)},e.prototype.toEulerAngles=function(){var e=x.Zero();return this.toEulerAnglesToRef(e),e},e.prototype.toEulerAnglesToRef=function(e){var t=this._z,i=this._x,n=this._y,r=this._w,o=n*t-i*r,a=.4999999;if(o<-a)e.y=2*Math.atan2(n,r),e.x=Math.PI/2,e.z=0;else if(o>a)e.y=2*Math.atan2(n,r),e.x=-Math.PI/2,e.z=0;else{var s=r*r,l=t*t,c=i*i,u=n*n;e.z=Math.atan2(2*(i*n+t*r),-l-c+u+s),e.x=Math.asin(-2*o),e.y=Math.atan2(2*(t*i+n*r),l-c-u+s)}return this},e.prototype.toRotationMatrix=function(e){return M.FromQuaternionToRef(this,e),this},e.prototype.fromRotationMatrix=function(t){return e.FromRotationMatrixToRef(t,this),this},e.FromRotationMatrix=function(t){var i=new e;return e.FromRotationMatrixToRef(t,i),i},e.FromRotationMatrixToRef=function(e,t){var i,n=e.m,r=n[0],o=n[4],a=n[8],s=n[1],l=n[5],c=n[9],u=n[2],h=n[6],d=n[10],p=r+l+d;p>0?(i=.5/Math.sqrt(p+1),t.w=.25/i,t.x=(h-c)*i,t.y=(a-u)*i,t.z=(s-o)*i):r>l&&r>d?(i=2*Math.sqrt(1+r-l-d),t.w=(h-c)/i,t.x=.25*i,t.y=(o+s)/i,t.z=(a+u)/i):l>d?(i=2*Math.sqrt(1+l-r-d),t.w=(a-u)/i,t.x=(o+s)/i,t.y=.25*i,t.z=(c+h)/i):(i=2*Math.sqrt(1+d-r-l),t.w=(s-o)/i,t.x=(a+u)/i,t.y=(c+h)/i,t.z=.25*i)},e.RotationQuaternionFromOnto=function(t,i){var n=e.Zero();return e.RotationQuaternionFromOntoToRef(t,i,n)},e.RotationQuaternionFromOntoToRef=function(t,i,n){var r=O.Vector3[0];x.CrossToRef(t,i,r),r.equals(x.ZeroReadOnly)&&t._getNormalToRef(r);var o=x.GetAngleBetweenVectors(t,i,r);return e.RotationAxisToRef(r,o,n)},e.Dot=function(e,t){return e._x*t._x+e._y*t._y+e._z*t._z+e._w*t._w},e.AreClose=function(t,i){return e.Dot(t,i)>=0},e.SmoothToRef=function(t,i,n,r,o){var a=0===r?1:n/r;a=h.Clamp(a,0,1),e.SlerpToRef(t,i,a,o)},e.Zero=function(){return new e(0,0,0,0)},e.Inverse=function(t){return new e(-t._x,-t._y,-t._z,t._w)},e.InverseToRef=function(e,t){return t.set(-e._x,-e._y,-e._z,e._w),t},e.Identity=function(){return new e(0,0,0,1)},e.IsIdentity=function(e){return e&&0===e._x&&0===e._y&&0===e._z&&1===e._w},e.RotationAxis=function(t,i){return e.RotationAxisToRef(t,i,new e)},e.RotationAxisToRef=function(e,t,i){var n=Math.sin(t/2);return e.normalize(),i.w=Math.cos(t/2),i.x=e._x*n,i.y=e._y*n,i.z=e._z*n,i},e.FromArray=function(t,i){return i||(i=0),new e(t[i],t[i+1],t[i+2],t[i+3])},e.FromArrayToRef=function(e,t,i){i.x=e[t],i.y=e[t+1],i.z=e[t+2],i.w=e[t+3]},e.FromEulerAngles=function(t,i,n){var r=new e;return e.RotationYawPitchRollToRef(i,t,n,r),r},e.FromEulerAnglesToRef=function(t,i,n,r){return e.RotationYawPitchRollToRef(i,t,n,r),r},e.FromEulerVector=function(t){var i=new e;return e.RotationYawPitchRollToRef(t._y,t._x,t._z,i),i},e.FromEulerVectorToRef=function(t,i){return e.RotationYawPitchRollToRef(t._y,t._x,t._z,i),i},e.FromUnitVectorsToRef=function(e,t,i){var n=x.Dot(e,t)+1;return n<_?Math.abs(e.x)>Math.abs(e.z)?i.set(-e.y,e.x,0,0):i.set(0,-e.z,e.y,0):(x.CrossToRef(e,t,O.Vector3[0]),i.set(O.Vector3[0].x,O.Vector3[0].y,O.Vector3[0].z,n)),i.normalize()},e.RotationYawPitchRoll=function(t,i,n){var r=new e;return e.RotationYawPitchRollToRef(t,i,n,r),r},e.RotationYawPitchRollToRef=function(e,t,i,n){var r=.5*i,o=.5*t,a=.5*e,s=Math.sin(r),l=Math.cos(r),c=Math.sin(o),u=Math.cos(o),h=Math.sin(a),d=Math.cos(a);n.x=d*c*l+h*u*s,n.y=h*u*l-d*c*s,n.z=d*u*s-h*c*l,n.w=d*u*l+h*c*s},e.RotationAlphaBetaGamma=function(t,i,n){var r=new e;return e.RotationAlphaBetaGammaToRef(t,i,n,r),r},e.RotationAlphaBetaGammaToRef=function(e,t,i,n){var r=.5*(i+e),o=.5*(i-e),a=.5*t;n.x=Math.cos(o)*Math.sin(a),n.y=Math.sin(o)*Math.sin(a),n.z=Math.sin(r)*Math.cos(a),n.w=Math.cos(r)*Math.cos(a)},e.RotationQuaternionFromAxis=function(t,i,n){var r=new e(0,0,0,0);return e.RotationQuaternionFromAxisToRef(t,i,n,r),r},e.RotationQuaternionFromAxisToRef=function(t,i,n,r){var o=I.Matrix[0];M.FromXYZAxesToRef(t.normalize(),i.normalize(),n.normalize(),o),e.FromRotationMatrixToRef(o,r)},e.FromLookDirectionLH=function(t,i){var n=new e;return e.FromLookDirectionLHToRef(t,i,n),n},e.FromLookDirectionLHToRef=function(t,i,n){var r=I.Matrix[0];M.LookDirectionLHToRef(t,i,r),e.FromRotationMatrixToRef(r,n)},e.FromLookDirectionRH=function(t,i){var n=new e;return e.FromLookDirectionRHToRef(t,i,n),n},e.FromLookDirectionRHToRef=function(t,i,n){var r=I.Matrix[0];return M.LookDirectionRHToRef(t,i,r),e.FromRotationMatrixToRef(r,n)},e.Slerp=function(t,i,n){var r=e.Identity();return e.SlerpToRef(t,i,n,r),r},e.SlerpToRef=function(e,t,i,n){var r,o,a=e._x*t._x+e._y*t._y+e._z*t._z+e._w*t._w,s=!1;if(a<0&&(s=!0,a=-a),a>.999999)o=1-i,r=s?-i:i;else{var l=Math.acos(a),c=1/Math.sin(l);o=Math.sin((1-i)*l)*c,r=s?-Math.sin(i*l)*c:Math.sin(i*l)*c}n.x=o*e._x+r*t._x,n.y=o*e._y+r*t._y,n.z=o*e._z+r*t._z,n.w=o*e._w+r*t._w},e.Hermite=function(t,i,n,r,o){var a=o*o,s=o*a,l=2*s-3*a+1,c=-2*s+3*a,u=s-2*a+o,h=s-a;return new e(t._x*l+n._x*c+i._x*u+r._x*h,t._y*l+n._y*c+i._y*u+r._y*h,t._z*l+n._z*c+i._z*u+r._z*h,t._w*l+n._w*c+i._w*u+r._w*h)},e.Hermite1stDerivative=function(t,i,n,r,o){var a=e.Zero();return this.Hermite1stDerivativeToRef(t,i,n,r,o,a),a},e.Hermite1stDerivativeToRef=function(e,t,i,n,r,o){var a=r*r;o.x=6*(a-r)*e.x+(3*a-4*r+1)*t.x+6*(-a+r)*i.x+(3*a-2*r)*n.x,o.y=6*(a-r)*e.y+(3*a-4*r+1)*t.y+6*(-a+r)*i.y+(3*a-2*r)*n.y,o.z=6*(a-r)*e.z+(3*a-4*r+1)*t.z+6*(-a+r)*i.z+(3*a-2*r)*n.z,o.w=6*(a-r)*e.w+(3*a-4*r+1)*t.w+6*(-a+r)*i.w+(3*a-2*r)*n.w},e}(),M=function(){function e(){this._isIdentity=!1,this._isIdentityDirty=!0,this._isIdentity3x2=!0,this._isIdentity3x2Dirty=!0,this.updateFlag=-1,E.MatrixTrackPrecisionChange&&E.MatrixTrackedMatrices.push(this),this._m=new E.MatrixCurrentType(16),this.markAsUpdated()}return Object.defineProperty(e,\"Use64Bits\",{get:function(){return E.MatrixUse64Bits},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"m\",{get:function(){return this._m},enumerable:!1,configurable:!0}),e.prototype.markAsUpdated=function(){this.updateFlag=e._UpdateFlagSeed++,this._isIdentity=!1,this._isIdentity3x2=!1,this._isIdentityDirty=!0,this._isIdentity3x2Dirty=!0},e.prototype._updateIdentityStatus=function(e,t,i,n){void 0===t&&(t=!1),void 0===i&&(i=!1),void 0===n&&(n=!0),this._isIdentity=e,this._isIdentity3x2=e||i,this._isIdentityDirty=!this._isIdentity&&t,this._isIdentity3x2Dirty=!this._isIdentity3x2&&n},e.prototype.isIdentity=function(){if(this._isIdentityDirty){this._isIdentityDirty=!1;var e=this._m;this._isIdentity=1===e[0]&&0===e[1]&&0===e[2]&&0===e[3]&&0===e[4]&&1===e[5]&&0===e[6]&&0===e[7]&&0===e[8]&&0===e[9]&&1===e[10]&&0===e[11]&&0===e[12]&&0===e[13]&&0===e[14]&&1===e[15]}return this._isIdentity},e.prototype.isIdentityAs3x2=function(){return this._isIdentity3x2Dirty&&(this._isIdentity3x2Dirty=!1,1!==this._m[0]||1!==this._m[5]||1!==this._m[15]||0!==this._m[1]||0!==this._m[2]||0!==this._m[3]||0!==this._m[4]||0!==this._m[6]||0!==this._m[7]||0!==this._m[8]||0!==this._m[9]||0!==this._m[10]||0!==this._m[11]||0!==this._m[12]||0!==this._m[13]||0!==this._m[14]?this._isIdentity3x2=!1:this._isIdentity3x2=!0),this._isIdentity3x2},e.prototype.determinant=function(){if(!0===this._isIdentity)return 1;var e=this._m,t=e[0],i=e[1],n=e[2],r=e[3],o=e[4],a=e[5],s=e[6],l=e[7],c=e[8],u=e[9],h=e[10],d=e[11],p=e[12],f=e[13],_=e[14],m=e[15],g=h*m-_*d,v=u*m-f*d,y=u*_-f*h,b=c*m-p*d,T=c*_-h*p,E=c*f-p*u;return t*+(a*g-s*v+l*y)+i*-(o*g-s*b+l*T)+n*+(o*v-a*b+l*E)+r*-(o*y-a*T+s*E)},e.prototype.toArray=function(){return this._m},e.prototype.asArray=function(){return this._m},e.prototype.invert=function(){return this.invertToRef(this),this},e.prototype.reset=function(){return e.FromValuesToRef(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,this),this._updateIdentityStatus(!1),this},e.prototype.add=function(t){var i=new e;return this.addToRef(t,i),i},e.prototype.addToRef=function(e,t){for(var i=this._m,n=t._m,r=e.m,o=0;o<16;o++)n[o]=i[o]+r[o];return t.markAsUpdated(),this},e.prototype.addToSelf=function(e){for(var t=this._m,i=e.m,n=0;n<16;n++)t[n]+=i[n];return this.markAsUpdated(),this},e.prototype.invertToRef=function(t){if(!0===this._isIdentity)return e.IdentityToRef(t),this;var i=this._m,n=i[0],r=i[1],o=i[2],a=i[3],s=i[4],l=i[5],c=i[6],u=i[7],h=i[8],d=i[9],p=i[10],f=i[11],_=i[12],m=i[13],g=i[14],v=i[15],y=p*v-g*f,b=d*v-m*f,T=d*g-m*p,E=h*v-_*f,S=h*g-p*_,A=h*m-_*d,R=+(l*y-c*b+u*T),x=-(s*y-c*E+u*S),C=+(s*b-l*E+u*A),P=-(s*T-l*S+c*A),M=n*R+r*x+o*C+a*P;if(0===M)return t.copyFrom(this),this;var I=1/M,O=c*v-g*u,D=l*v-m*u,N=l*g-m*c,L=s*v-_*u,F=s*g-_*c,w=s*m-_*l,B=c*f-p*u,U=l*f-d*u,V=l*p-d*c,k=s*f-h*u,G=s*p-h*c,z=s*d-h*l,W=-(r*y-o*b+a*T),H=+(n*y-o*E+a*S),X=-(n*b-r*E+a*A),j=+(n*T-r*S+o*A),Y=+(r*O-o*D+a*N),K=-(n*O-o*L+a*F),Q=+(n*D-r*L+a*w),q=-(n*N-r*F+o*w),Z=-(r*B-o*U+a*V),J=+(n*B-o*k+a*G),$=-(n*U-r*k+a*z),ee=+(n*V-r*G+o*z);return e.FromValuesToRef(R*I,W*I,Y*I,Z*I,x*I,H*I,K*I,J*I,C*I,X*I,Q*I,$*I,P*I,j*I,q*I,ee*I,t),this},e.prototype.addAtIndex=function(e,t){return this._m[e]+=t,this.markAsUpdated(),this},e.prototype.multiplyAtIndex=function(e,t){return this._m[e]*=t,this.markAsUpdated(),this},e.prototype.setTranslationFromFloats=function(e,t,i){return this._m[12]=e,this._m[13]=t,this._m[14]=i,this.markAsUpdated(),this},e.prototype.addTranslationFromFloats=function(e,t,i){return this._m[12]+=e,this._m[13]+=t,this._m[14]+=i,this.markAsUpdated(),this},e.prototype.setTranslation=function(e){return this.setTranslationFromFloats(e._x,e._y,e._z)},e.prototype.getTranslation=function(){return new x(this._m[12],this._m[13],this._m[14])},e.prototype.getTranslationToRef=function(e){return e.x=this._m[12],e.y=this._m[13],e.z=this._m[14],this},e.prototype.removeRotationAndScaling=function(){var t=this.m;return e.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,t[12],t[13],t[14],t[15],this),this._updateIdentityStatus(0===t[12]&&0===t[13]&&0===t[14]&&1===t[15]),this},e.prototype.multiply=function(t){var i=new e;return this.multiplyToRef(t,i),i},e.prototype.copyFrom=function(e){e.copyToArray(this._m);var t=e;return this.updateFlag=t.updateFlag,this._updateIdentityStatus(t._isIdentity,t._isIdentityDirty,t._isIdentity3x2,t._isIdentity3x2Dirty),this},e.prototype.copyToArray=function(e,t){void 0===t&&(t=0);var i=this._m;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],this},e.prototype.multiplyToRef=function(e,t){return this._isIdentity?(t.copyFrom(e),this):e._isIdentity?(t.copyFrom(this),this):(this.multiplyToArray(e,t._m,0),t.markAsUpdated(),this)},e.prototype.multiplyToArray=function(e,t,i){var n=this._m,r=e.m,o=n[0],a=n[1],s=n[2],l=n[3],c=n[4],u=n[5],h=n[6],d=n[7],p=n[8],f=n[9],_=n[10],m=n[11],g=n[12],v=n[13],y=n[14],b=n[15],T=r[0],E=r[1],S=r[2],A=r[3],R=r[4],x=r[5],C=r[6],P=r[7],M=r[8],I=r[9],O=r[10],D=r[11],N=r[12],L=r[13],F=r[14],w=r[15];return t[i]=o*T+a*R+s*M+l*N,t[i+1]=o*E+a*x+s*I+l*L,t[i+2]=o*S+a*C+s*O+l*F,t[i+3]=o*A+a*P+s*D+l*w,t[i+4]=c*T+u*R+h*M+d*N,t[i+5]=c*E+u*x+h*I+d*L,t[i+6]=c*S+u*C+h*O+d*F,t[i+7]=c*A+u*P+h*D+d*w,t[i+8]=p*T+f*R+_*M+m*N,t[i+9]=p*E+f*x+_*I+m*L,t[i+10]=p*S+f*C+_*O+m*F,t[i+11]=p*A+f*P+_*D+m*w,t[i+12]=g*T+v*R+y*M+b*N,t[i+13]=g*E+v*x+y*I+b*L,t[i+14]=g*S+v*C+y*O+b*F,t[i+15]=g*A+v*P+y*D+b*w,this},e.prototype.equals=function(e){var t=e;if(!t)return!1;if((this._isIdentity||t._isIdentity)&&!this._isIdentityDirty&&!t._isIdentityDirty)return this._isIdentity&&t._isIdentity;var i=this.m,n=t.m;return i[0]===n[0]&&i[1]===n[1]&&i[2]===n[2]&&i[3]===n[3]&&i[4]===n[4]&&i[5]===n[5]&&i[6]===n[6]&&i[7]===n[7]&&i[8]===n[8]&&i[9]===n[9]&&i[10]===n[10]&&i[11]===n[11]&&i[12]===n[12]&&i[13]===n[13]&&i[14]===n[14]&&i[15]===n[15]},e.prototype.clone=function(){var t=new e;return t.copyFrom(this),t},e.prototype.getClassName=function(){return\"Matrix\"},e.prototype.getHashCode=function(){for(var e=A(this._m[0]),t=1;t<16;t++)e=397*e^A(this._m[t]);return e},e.prototype.decomposeToTransformNode=function(e){return e.rotationQuaternion=e.rotationQuaternion||new P,this.decompose(e.scaling,e.rotationQuaternion,e.position)},e.prototype.decompose=function(t,i,n,r){if(this._isIdentity)return n&&n.setAll(0),t&&t.setAll(1),i&&i.copyFromFloats(0,0,0,1),!0;var o=this._m;if(n&&n.copyFromFloats(o[12],o[13],o[14]),(t=t||I.Vector3[0]).x=Math.sqrt(o[0]*o[0]+o[1]*o[1]+o[2]*o[2]),t.y=Math.sqrt(o[4]*o[4]+o[5]*o[5]+o[6]*o[6]),t.z=Math.sqrt(o[8]*o[8]+o[9]*o[9]+o[10]*o[10]),r){var a=r.scaling.x<0?-1:1,s=r.scaling.y<0?-1:1,l=r.scaling.z<0?-1:1;t.x*=a,t.y*=s,t.z*=l}else this.determinant()<=0&&(t.y*=-1);if(0===t._x||0===t._y||0===t._z)return i&&i.copyFromFloats(0,0,0,1),!1;if(i){var c=1/t._x,u=1/t._y,h=1/t._z;e.FromValuesToRef(o[0]*c,o[1]*c,o[2]*c,0,o[4]*u,o[5]*u,o[6]*u,0,o[8]*h,o[9]*h,o[10]*h,0,0,0,0,1,I.Matrix[0]),P.FromRotationMatrixToRef(I.Matrix[0],i)}return!0},e.prototype.getRow=function(e){if(e<0||e>3)return null;var t=4*e;return new C(this._m[t+0],this._m[t+1],this._m[t+2],this._m[t+3])},e.prototype.getRowToRef=function(e,t){if(e>=0&&e<3){var i=4*e;t.x=this._m[i+0],t.y=this._m[i+1],t.z=this._m[i+2],t.w=this._m[i+3]}return this},e.prototype.setRow=function(e,t){return this.setRowFromFloats(e,t.x,t.y,t.z,t.w)},e.prototype.transpose=function(){return e.Transpose(this)},e.prototype.transposeToRef=function(t){return e.TransposeToRef(this,t),this},e.prototype.setRowFromFloats=function(e,t,i,n,r){if(e<0||e>3)return this;var o=4*e;return this._m[o+0]=t,this._m[o+1]=i,this._m[o+2]=n,this._m[o+3]=r,this.markAsUpdated(),this},e.prototype.scale=function(t){var i=new e;return this.scaleToRef(t,i),i},e.prototype.scaleToRef=function(e,t){for(var i=0;i<16;i++)t._m[i]=this._m[i]*e;return t.markAsUpdated(),this},e.prototype.scaleAndAddToRef=function(e,t){for(var i=0;i<16;i++)t._m[i]+=this._m[i]*e;return t.markAsUpdated(),this},e.prototype.toNormalMatrix=function(t){var i=I.Matrix[0];this.invertToRef(i),i.transposeToRef(t);var n=t._m;e.FromValuesToRef(n[0],n[1],n[2],0,n[4],n[5],n[6],0,n[8],n[9],n[10],0,0,0,0,1,t)},e.prototype.getRotationMatrix=function(){var t=new e;return this.getRotationMatrixToRef(t),t},e.prototype.getRotationMatrixToRef=function(t){var i=I.Vector3[0];if(!this.decompose(i))return e.IdentityToRef(t),this;var n=this._m,r=1/i._x,o=1/i._y,a=1/i._z;return e.FromValuesToRef(n[0]*r,n[1]*r,n[2]*r,0,n[4]*o,n[5]*o,n[6]*o,0,n[8]*a,n[9]*a,n[10]*a,0,0,0,0,1,t),this},e.prototype.toggleModelMatrixHandInPlace=function(){var e=this._m;e[2]*=-1,e[6]*=-1,e[8]*=-1,e[9]*=-1,e[14]*=-1,this.markAsUpdated()},e.prototype.toggleProjectionMatrixHandInPlace=function(){var e=this._m;e[8]*=-1,e[9]*=-1,e[10]*=-1,e[11]*=-1,this.markAsUpdated()},e.FromArray=function(t,i){void 0===i&&(i=0);var n=new e;return e.FromArrayToRef(t,i,n),n},e.FromArrayToRef=function(e,t,i){for(var n=0;n<16;n++)i._m[n]=e[n+t];i.markAsUpdated()},e.FromFloat32ArrayToRefScaled=function(e,t,i,n){for(var r=0;r<16;r++)n._m[r]=e[r+t]*i;n.markAsUpdated()},Object.defineProperty(e,\"IdentityReadOnly\",{get:function(){return e._IdentityReadOnly},enumerable:!1,configurable:!0}),e.FromValuesToRef=function(e,t,i,n,r,o,a,s,l,c,u,h,d,p,f,_,m){var g=m._m;g[0]=e,g[1]=t,g[2]=i,g[3]=n,g[4]=r,g[5]=o,g[6]=a,g[7]=s,g[8]=l,g[9]=c,g[10]=u,g[11]=h,g[12]=d,g[13]=p,g[14]=f,g[15]=_,m.markAsUpdated()},e.FromValues=function(t,i,n,r,o,a,s,l,c,u,h,d,p,f,_,m){var g=new e,v=g._m;return v[0]=t,v[1]=i,v[2]=n,v[3]=r,v[4]=o,v[5]=a,v[6]=s,v[7]=l,v[8]=c,v[9]=u,v[10]=h,v[11]=d,v[12]=p,v[13]=f,v[14]=_,v[15]=m,g.markAsUpdated(),g},e.Compose=function(t,i,n){var r=new e;return e.ComposeToRef(t,i,n,r),r},e.ComposeToRef=function(e,t,i,n){var r=n._m,o=t._x,a=t._y,s=t._z,l=t._w,c=o+o,u=a+a,h=s+s,d=o*c,p=o*u,f=o*h,_=a*u,m=a*h,g=s*h,v=l*c,y=l*u,b=l*h,T=e._x,E=e._y,S=e._z;r[0]=(1-(_+g))*T,r[1]=(p+b)*T,r[2]=(f-y)*T,r[3]=0,r[4]=(p-b)*E,r[5]=(1-(d+g))*E,r[6]=(m+v)*E,r[7]=0,r[8]=(f+y)*S,r[9]=(m-v)*S,r[10]=(1-(d+_))*S,r[11]=0,r[12]=i._x,r[13]=i._y,r[14]=i._z,r[15]=1,n.markAsUpdated()},e.Identity=function(){var t=e.FromValues(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return t._updateIdentityStatus(!0),t},e.IdentityToRef=function(t){e.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,t),t._updateIdentityStatus(!0)},e.Zero=function(){var t=e.FromValues(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);return t._updateIdentityStatus(!1),t},e.RotationX=function(t){var i=new e;return e.RotationXToRef(t,i),i},e.Invert=function(t){var i=new e;return t.invertToRef(i),i},e.RotationXToRef=function(t,i){var n=Math.sin(t),r=Math.cos(t);e.FromValuesToRef(1,0,0,0,0,r,n,0,0,-n,r,0,0,0,0,1,i),i._updateIdentityStatus(1===r&&0===n)},e.RotationY=function(t){var i=new e;return e.RotationYToRef(t,i),i},e.RotationYToRef=function(t,i){var n=Math.sin(t),r=Math.cos(t);e.FromValuesToRef(r,0,-n,0,0,1,0,0,n,0,r,0,0,0,0,1,i),i._updateIdentityStatus(1===r&&0===n)},e.RotationZ=function(t){var i=new e;return e.RotationZToRef(t,i),i},e.RotationZToRef=function(t,i){var n=Math.sin(t),r=Math.cos(t);e.FromValuesToRef(r,n,0,0,-n,r,0,0,0,0,1,0,0,0,0,1,i),i._updateIdentityStatus(1===r&&0===n)},e.RotationAxis=function(t,i){var n=new e;return e.RotationAxisToRef(t,i,n),n},e.RotationAxisToRef=function(e,t,i){var n=Math.sin(-t),r=Math.cos(-t),o=1-r;e.normalize();var a=i._m;a[0]=e._x*e._x*o+r,a[1]=e._x*e._y*o-e._z*n,a[2]=e._x*e._z*o+e._y*n,a[3]=0,a[4]=e._y*e._x*o+e._z*n,a[5]=e._y*e._y*o+r,a[6]=e._y*e._z*o-e._x*n,a[7]=0,a[8]=e._z*e._x*o-e._y*n,a[9]=e._z*e._y*o+e._x*n,a[10]=e._z*e._z*o+r,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,i.markAsUpdated()},e.RotationAlignToRef=function(e,t,i){var n=x.Dot(t,e),r=i._m;if(n<-1+_)r[0]=-1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0;else{var o=x.Cross(t,e),a=1/(1+n);r[0]=o._x*o._x*a+n,r[1]=o._y*o._x*a-o._z,r[2]=o._z*o._x*a+o._y,r[3]=0,r[4]=o._x*o._y*a+o._z,r[5]=o._y*o._y*a+n,r[6]=o._z*o._y*a-o._x,r[7]=0,r[8]=o._x*o._z*a-o._y,r[9]=o._y*o._z*a+o._x,r[10]=o._z*o._z*a+n,r[11]=0}r[12]=0,r[13]=0,r[14]=0,r[15]=1,i.markAsUpdated()},e.RotationYawPitchRoll=function(t,i,n){var r=new e;return e.RotationYawPitchRollToRef(t,i,n,r),r},e.RotationYawPitchRollToRef=function(e,t,i,n){P.RotationYawPitchRollToRef(e,t,i,I.Quaternion[0]),I.Quaternion[0].toRotationMatrix(n)},e.Scaling=function(t,i,n){var r=new e;return e.ScalingToRef(t,i,n,r),r},e.ScalingToRef=function(t,i,n,r){e.FromValuesToRef(t,0,0,0,0,i,0,0,0,0,n,0,0,0,0,1,r),r._updateIdentityStatus(1===t&&1===i&&1===n)},e.Translation=function(t,i,n){var r=new e;return e.TranslationToRef(t,i,n,r),r},e.TranslationToRef=function(t,i,n,r){e.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,t,i,n,1,r),r._updateIdentityStatus(0===t&&0===i&&0===n)},e.Lerp=function(t,i,n){var r=new e;return e.LerpToRef(t,i,n,r),r},e.LerpToRef=function(e,t,i,n){for(var r=n._m,o=e.m,a=t.m,s=0;s<16;s++)r[s]=o[s]*(1-i)+a[s]*i;n.markAsUpdated()},e.DecomposeLerp=function(t,i,n){var r=new e;return e.DecomposeLerpToRef(t,i,n,r),r},e.DecomposeLerpToRef=function(t,i,n,r){var o=I.Vector3[0],a=I.Quaternion[0],s=I.Vector3[1];t.decompose(o,a,s);var l=I.Vector3[2],c=I.Quaternion[1],u=I.Vector3[3];i.decompose(l,c,u);var h=I.Vector3[4];x.LerpToRef(o,l,n,h);var d=I.Quaternion[2];P.SlerpToRef(a,c,n,d);var p=I.Vector3[5];x.LerpToRef(s,u,n,p),e.ComposeToRef(h,d,p,r)},e.LookAtLH=function(t,i,n){var r=new e;return e.LookAtLHToRef(t,i,n,r),r},e.LookAtLHToRef=function(t,i,n,r){var o=I.Vector3[0],a=I.Vector3[1],s=I.Vector3[2];i.subtractToRef(t,s),s.normalize(),x.CrossToRef(n,s,o);var l=o.lengthSquared();0===l?o.x=1:o.normalizeFromLength(Math.sqrt(l)),x.CrossToRef(s,o,a),a.normalize();var c=-x.Dot(o,t),u=-x.Dot(a,t),h=-x.Dot(s,t);e.FromValuesToRef(o._x,a._x,s._x,0,o._y,a._y,s._y,0,o._z,a._z,s._z,0,c,u,h,1,r)},e.LookAtRH=function(t,i,n){var r=new e;return e.LookAtRHToRef(t,i,n,r),r},e.LookAtRHToRef=function(t,i,n,r){var o=I.Vector3[0],a=I.Vector3[1],s=I.Vector3[2];t.subtractToRef(i,s),s.normalize(),x.CrossToRef(n,s,o);var l=o.lengthSquared();0===l?o.x=1:o.normalizeFromLength(Math.sqrt(l)),x.CrossToRef(s,o,a),a.normalize();var c=-x.Dot(o,t),u=-x.Dot(a,t),h=-x.Dot(s,t);e.FromValuesToRef(o._x,a._x,s._x,0,o._y,a._y,s._y,0,o._z,a._z,s._z,0,c,u,h,1,r)},e.LookDirectionLH=function(t,i){var n=new e;return e.LookDirectionLHToRef(t,i,n),n},e.LookDirectionLHToRef=function(t,i,n){var r=I.Vector3[0];r.copyFrom(t),r.scaleInPlace(-1);var o=I.Vector3[1];x.CrossToRef(i,r,o),e.FromValuesToRef(o._x,o._y,o._z,0,i._x,i._y,i._z,0,r._x,r._y,r._z,0,0,0,0,1,n)},e.LookDirectionRH=function(t,i){var n=new e;return e.LookDirectionRHToRef(t,i,n),n},e.LookDirectionRHToRef=function(t,i,n){var r=I.Vector3[2];x.CrossToRef(i,t,r),e.FromValuesToRef(r._x,r._y,r._z,0,i._x,i._y,i._z,0,t._x,t._y,t._z,0,0,0,0,1,n)},e.OrthoLH=function(t,i,n,r,o){var a=new e;return e.OrthoLHToRef(t,i,n,r,a,o),a},e.OrthoLHToRef=function(t,i,n,r,o,a){var s=2/t,l=2/i,c=2/(r-n),u=-(r+n)/(r-n);e.FromValuesToRef(s,0,0,0,0,l,0,0,0,0,c,0,0,0,u,1,o),a&&o.multiplyToRef(D,o),o._updateIdentityStatus(1===s&&1===l&&1===c&&0===u)},e.OrthoOffCenterLH=function(t,i,n,r,o,a,s){var l=new e;return e.OrthoOffCenterLHToRef(t,i,n,r,o,a,l,s),l},e.OrthoOffCenterLHToRef=function(t,i,n,r,o,a,s,l){var c=2/(i-t),u=2/(r-n),h=2/(a-o),d=-(a+o)/(a-o),p=(t+i)/(t-i),f=(r+n)/(n-r);e.FromValuesToRef(c,0,0,0,0,u,0,0,0,0,h,0,p,f,d,1,s),l&&s.multiplyToRef(D,s),s.markAsUpdated()},e.OrthoOffCenterRH=function(t,i,n,r,o,a,s){var l=new e;return e.OrthoOffCenterRHToRef(t,i,n,r,o,a,l,s),l},e.OrthoOffCenterRHToRef=function(t,i,n,r,o,a,s,l){e.OrthoOffCenterLHToRef(t,i,n,r,o,a,s,l),s._m[10]*=-1},e.PerspectiveLH=function(t,i,n,r,o,a){void 0===a&&(a=0);var s=new e,l=2*n/t,c=2*n/i,u=(r+n)/(r-n),h=-2*r*n/(r-n),d=Math.tan(a);return e.FromValuesToRef(l,0,0,0,0,c,0,d,0,0,u,1,0,0,h,0,s),o&&s.multiplyToRef(D,s),s._updateIdentityStatus(!1),s},e.PerspectiveFovLH=function(t,i,n,r,o,a,s){void 0===a&&(a=0),void 0===s&&(s=!1);var l=new e;return e.PerspectiveFovLHToRef(t,i,n,r,l,!0,o,a,s),l},e.PerspectiveFovLHToRef=function(t,i,n,r,o,a,s,l,c){void 0===a&&(a=!0),void 0===l&&(l=0),void 0===c&&(c=!1);var u=n,h=r,d=1/Math.tan(.5*t),p=a?d/i:d,f=a?d:d*i,_=c&&0===u?-1:0!==h?(h+u)/(h-u):1,m=c&&0===u?2*h:0!==h?-2*h*u/(h-u):-2*u,g=Math.tan(l);e.FromValuesToRef(p,0,0,0,0,f,0,g,0,0,_,1,0,0,m,0,o),s&&o.multiplyToRef(D,o),o._updateIdentityStatus(!1)},e.PerspectiveFovReverseLHToRef=function(t,i,n,r,o,a,s,l){void 0===a&&(a=!0),void 0===l&&(l=0);var c=1/Math.tan(.5*t),u=a?c/i:c,h=a?c:c*i,d=Math.tan(l);e.FromValuesToRef(u,0,0,0,0,h,0,d,0,0,-n,1,0,0,1,0,o),s&&o.multiplyToRef(D,o),o._updateIdentityStatus(!1)},e.PerspectiveFovRH=function(t,i,n,r,o,a,s){void 0===a&&(a=0),void 0===s&&(s=!1);var l=new e;return e.PerspectiveFovRHToRef(t,i,n,r,l,!0,o,a,s),l},e.PerspectiveFovRHToRef=function(t,i,n,r,o,a,s,l,c){void 0===a&&(a=!0),void 0===l&&(l=0),void 0===c&&(c=!1);var u=n,h=r,d=1/Math.tan(.5*t),p=a?d/i:d,f=a?d:d*i,_=c&&0===u?1:0!==h?-(h+u)/(h-u):-1,m=c&&0===u?2*h:0!==h?-2*h*u/(h-u):-2*u,g=Math.tan(l);e.FromValuesToRef(p,0,0,0,0,f,0,g,0,0,_,-1,0,0,m,0,o),s&&o.multiplyToRef(D,o),o._updateIdentityStatus(!1)},e.PerspectiveFovReverseRHToRef=function(t,i,n,r,o,a,s,l){void 0===a&&(a=!0),void 0===l&&(l=0);var c=1/Math.tan(.5*t),u=a?c/i:c,h=a?c:c*i,d=Math.tan(l);e.FromValuesToRef(u,0,0,0,0,h,0,d,0,0,-n,-1,0,0,-1,0,o),s&&o.multiplyToRef(D,o),o._updateIdentityStatus(!1)},e.PerspectiveFovWebVRToRef=function(e,t,i,n,r,o,a){void 0===r&&(r=!1),void 0===a&&(a=0);var s=r?-1:1,l=Math.tan(e.upDegrees*Math.PI/180),c=Math.tan(e.downDegrees*Math.PI/180),u=Math.tan(e.leftDegrees*Math.PI/180),h=Math.tan(e.rightDegrees*Math.PI/180),d=2/(u+h),p=2/(l+c),f=Math.tan(a),_=n._m;_[0]=d,_[1]=_[2]=_[3]=_[4]=0,_[5]=p,_[6]=0,_[7]=f,_[8]=(u-h)*d*.5,_[9]=-(l-c)*p*.5,_[10]=-i/(t-i),_[11]=1*s,_[12]=_[13]=_[15]=0,_[14]=-2*i*t/(i-t),o&&n.multiplyToRef(D,n),n.markAsUpdated()},e.GetFinalMatrix=function(t,i,n,r,o,a){var s=t.width,l=t.height,c=t.x,u=t.y,h=e.FromValues(s/2,0,0,0,0,-l/2,0,0,0,0,a-o,0,c+s/2,l/2+u,o,1),d=I.Matrix[0];return i.multiplyToRef(n,d),d.multiplyToRef(r,d),d.multiply(h)},e.GetAsMatrix2x2=function(e){var t=e.m,i=[t[0],t[1],t[4],t[5]];return E.MatrixUse64Bits?i:new Float32Array(i)},e.GetAsMatrix3x3=function(e){var t=e.m,i=[t[0],t[1],t[2],t[4],t[5],t[6],t[8],t[9],t[10]];return E.MatrixUse64Bits?i:new Float32Array(i)},e.Transpose=function(t){var i=new e;return e.TransposeToRef(t,i),i},e.TransposeToRef=function(e,t){var i=t._m,n=e.m;i[0]=n[0],i[1]=n[4],i[2]=n[8],i[3]=n[12],i[4]=n[1],i[5]=n[5],i[6]=n[9],i[7]=n[13],i[8]=n[2],i[9]=n[6],i[10]=n[10],i[11]=n[14],i[12]=n[3],i[13]=n[7],i[14]=n[11],i[15]=n[15],t.markAsUpdated(),t._updateIdentityStatus(e._isIdentity,e._isIdentityDirty)},e.Reflection=function(t){var i=new e;return e.ReflectionToRef(t,i),i},e.ReflectionToRef=function(t,i){t.normalize();var n=t.normal.x,r=t.normal.y,o=t.normal.z,a=-2*n,s=-2*r,l=-2*o;e.FromValuesToRef(a*n+1,s*n,l*n,0,a*r,s*r+1,l*r,0,a*o,s*o,l*o+1,0,a*t.d,s*t.d,l*t.d,1,i)},e.FromXYZAxesToRef=function(t,i,n,r){e.FromValuesToRef(t._x,t._y,t._z,0,i._x,i._y,i._z,0,n._x,n._y,n._z,0,0,0,0,1,r)},e.FromQuaternionToRef=function(e,t){var i=e._x*e._x,n=e._y*e._y,r=e._z*e._z,o=e._x*e._y,a=e._z*e._w,s=e._z*e._x,l=e._y*e._w,c=e._y*e._z,u=e._x*e._w;t._m[0]=1-2*(n+r),t._m[1]=2*(o+a),t._m[2]=2*(s-l),t._m[3]=0,t._m[4]=2*(o-a),t._m[5]=1-2*(r+i),t._m[6]=2*(c+u),t._m[7]=0,t._m[8]=2*(s+l),t._m[9]=2*(c-u),t._m[10]=1-2*(n+i),t._m[11]=0,t._m[12]=0,t._m[13]=0,t._m[14]=0,t._m[15]=1,t.markAsUpdated()},e._UpdateFlagSeed=0,e._IdentityReadOnly=e.Identity(),e}(),I=function(){function e(){}return e.Vector3=m.BuildTuple(11,x.Zero),e.Matrix=m.BuildTuple(2,M.Identity),e.Quaternion=m.BuildTuple(3,P.Zero),e}(),O=function(){function e(){}return e.Vector2=m.BuildTuple(3,R.Zero),e.Vector3=m.BuildTuple(13,x.Zero),e.Vector4=m.BuildTuple(3,C.Zero),e.Quaternion=m.BuildTuple(2,P.Zero),e.Matrix=m.BuildTuple(8,M.Identity),e}();b(\"BABYLON.Vector2\",R),b(\"BABYLON.Vector3\",x),b(\"BABYLON.Vector4\",C),b(\"BABYLON.Matrix\",M);var D=M.FromValues(1,0,0,0,0,1,0,0,0,0,.5,0,0,0,.5,1),N=function(){function e(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),this.r=e,this.g=t,this.b=i}return e.prototype.toString=function(){return\"{R: \"+this.r+\" G:\"+this.g+\" B:\"+this.b+\"}\"},e.prototype.getClassName=function(){return\"Color3\"},e.prototype.getHashCode=function(){var e=255*this.r|0;return 397*(e=397*e^(255*this.g|0))^(255*this.b|0)},e.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,this},e.prototype.fromArray=function(t,i){return void 0===i&&(i=0),e.FromArrayToRef(t,i,this),this},e.prototype.toColor4=function(e){return void 0===e&&(e=1),new L(this.r,this.g,this.b,e)},e.prototype.asArray=function(){return[this.r,this.g,this.b]},e.prototype.toLuminance=function(){return.3*this.r+.59*this.g+.11*this.b},e.prototype.multiply=function(t){return new e(this.r*t.r,this.g*t.g,this.b*t.b)},e.prototype.multiplyToRef=function(e,t){return t.r=this.r*e.r,t.g=this.g*e.g,t.b=this.b*e.b,this},e.prototype.equals=function(e){return e&&this.r===e.r&&this.g===e.g&&this.b===e.b},e.prototype.equalsFloats=function(e,t,i){return this.r===e&&this.g===t&&this.b===i},e.prototype.scale=function(t){return new e(this.r*t,this.g*t,this.b*t)},e.prototype.scaleInPlace=function(e){return this.r*=e,this.g*=e,this.b*=e,this},e.prototype.scaleToRef=function(e,t){return t.r=this.r*e,t.g=this.g*e,t.b=this.b*e,this},e.prototype.scaleAndAddToRef=function(e,t){return t.r+=this.r*e,t.g+=this.g*e,t.b+=this.b*e,this},e.prototype.clampToRef=function(e,t,i){return void 0===e&&(e=0),void 0===t&&(t=1),i.r=h.Clamp(this.r,e,t),i.g=h.Clamp(this.g,e,t),i.b=h.Clamp(this.b,e,t),this},e.prototype.add=function(t){return new e(this.r+t.r,this.g+t.g,this.b+t.b)},e.prototype.addToRef=function(e,t){return t.r=this.r+e.r,t.g=this.g+e.g,t.b=this.b+e.b,this},e.prototype.subtract=function(t){return new e(this.r-t.r,this.g-t.g,this.b-t.b)},e.prototype.subtractToRef=function(e,t){return t.r=this.r-e.r,t.g=this.g-e.g,t.b=this.b-e.b,this},e.prototype.clone=function(){return new e(this.r,this.g,this.b)},e.prototype.copyFrom=function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},e.prototype.copyFromFloats=function(e,t,i){return this.r=e,this.g=t,this.b=i,this},e.prototype.set=function(e,t,i){return this.copyFromFloats(e,t,i)},e.prototype.toHexString=function(){var e=Math.round(255*this.r),t=Math.round(255*this.g),i=Math.round(255*this.b);return\"#\"+h.ToHex(e)+h.ToHex(t)+h.ToHex(i)},e.prototype.toLinearSpace=function(){var t=new e;return this.toLinearSpaceToRef(t),t},e.prototype.toHSV=function(){var t=new e;return this.toHSVToRef(t),t},e.prototype.toHSVToRef=function(e){var t=this.r,i=this.g,n=this.b,r=Math.max(t,i,n),o=Math.min(t,i,n),a=0,s=0,l=r,c=r-o;0!==r&&(s=c/r),r!=o&&(r==t?(a=(i-n)/c,i=0&&o<=1?(s=r,l=a):o>=1&&o<=2?(s=a,l=r):o>=2&&o<=3?(l=r,c=a):o>=3&&o<=4?(l=a,c=r):o>=4&&o<=5?(s=a,c=r):o>=5&&o<=6&&(s=r,c=a);var u=i-r;n.set(s+u,l+u,c+u)},e.FromHSV=function(t,i,n){var r=new e(0,0,0);return e.HSVtoRGBToRef(t,i,n,r),r},e.FromHexString=function(t){if(\"#\"!==t.substring(0,1)||7!==t.length)return new e(0,0,0);var i=parseInt(t.substring(1,3),16),n=parseInt(t.substring(3,5),16),r=parseInt(t.substring(5,7),16);return e.FromInts(i,n,r)},e.FromArray=function(t,i){return void 0===i&&(i=0),new e(t[i],t[i+1],t[i+2])},e.FromArrayToRef=function(e,t,i){void 0===t&&(t=0),i.r=e[t],i.g=e[t+1],i.b=e[t+2]},e.FromInts=function(t,i,n){return new e(t/255,i/255,n/255)},e.Lerp=function(t,i,n){var r=new e(0,0,0);return e.LerpToRef(t,i,n,r),r},e.LerpToRef=function(e,t,i,n){n.r=e.r+(t.r-e.r)*i,n.g=e.g+(t.g-e.g)*i,n.b=e.b+(t.b-e.b)*i},e.Hermite=function(t,i,n,r,o){var a=o*o,s=o*a,l=2*s-3*a+1,c=-2*s+3*a,u=s-2*a+o,h=s-a;return new e(t.r*l+n.r*c+i.r*u+r.r*h,t.g*l+n.g*c+i.g*u+r.g*h,t.b*l+n.b*c+i.b*u+r.b*h)},e.Hermite1stDerivative=function(t,i,n,r,o){var a=e.Black();return this.Hermite1stDerivativeToRef(t,i,n,r,o,a),a},e.Hermite1stDerivativeToRef=function(e,t,i,n,r,o){var a=r*r;o.r=6*(a-r)*e.r+(3*a-4*r+1)*t.r+6*(-a+r)*i.r+(3*a-2*r)*n.r,o.g=6*(a-r)*e.g+(3*a-4*r+1)*t.g+6*(-a+r)*i.g+(3*a-2*r)*n.g,o.b=6*(a-r)*e.b+(3*a-4*r+1)*t.b+6*(-a+r)*i.b+(3*a-2*r)*n.b},e.Red=function(){return new e(1,0,0)},e.Green=function(){return new e(0,1,0)},e.Blue=function(){return new e(0,0,1)},e.Black=function(){return new e(0,0,0)},Object.defineProperty(e,\"BlackReadOnly\",{get:function(){return e._BlackReadOnly},enumerable:!1,configurable:!0}),e.White=function(){return new e(1,1,1)},e.Purple=function(){return new e(.5,0,.5)},e.Magenta=function(){return new e(1,0,1)},e.Yellow=function(){return new e(1,1,0)},e.Gray=function(){return new e(.5,.5,.5)},e.Teal=function(){return new e(0,1,1)},e.Random=function(){return new e(Math.random(),Math.random(),Math.random())},e._BlackReadOnly=e.Black(),e}(),L=function(){function e(e,t,i,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=1),this.r=e,this.g=t,this.b=i,this.a=n}return e.prototype.addInPlace=function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this.a+=e.a,this},e.prototype.asArray=function(){return[this.r,this.g,this.b,this.a]},e.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e[t+3]=this.a,this},e.prototype.fromArray=function(t,i){return void 0===i&&(i=0),e.FromArrayToRef(t,i,this),this},e.prototype.equals=function(e){return e&&this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a},e.prototype.add=function(t){return new e(this.r+t.r,this.g+t.g,this.b+t.b,this.a+t.a)},e.prototype.subtract=function(t){return new e(this.r-t.r,this.g-t.g,this.b-t.b,this.a-t.a)},e.prototype.subtractToRef=function(e,t){return t.r=this.r-e.r,t.g=this.g-e.g,t.b=this.b-e.b,t.a=this.a-e.a,this},e.prototype.scale=function(t){return new e(this.r*t,this.g*t,this.b*t,this.a*t)},e.prototype.scaleInPlace=function(e){return this.r*=e,this.g*=e,this.b*=e,this.a*=e,this},e.prototype.scaleToRef=function(e,t){return t.r=this.r*e,t.g=this.g*e,t.b=this.b*e,t.a=this.a*e,this},e.prototype.scaleAndAddToRef=function(e,t){return t.r+=this.r*e,t.g+=this.g*e,t.b+=this.b*e,t.a+=this.a*e,this},e.prototype.clampToRef=function(e,t,i){return void 0===e&&(e=0),void 0===t&&(t=1),i.r=h.Clamp(this.r,e,t),i.g=h.Clamp(this.g,e,t),i.b=h.Clamp(this.b,e,t),i.a=h.Clamp(this.a,e,t),this},e.prototype.multiply=function(t){return new e(this.r*t.r,this.g*t.g,this.b*t.b,this.a*t.a)},e.prototype.multiplyToRef=function(e,t){return t.r=this.r*e.r,t.g=this.g*e.g,t.b=this.b*e.b,t.a=this.a*e.a,t},e.prototype.toString=function(){return\"{R: \"+this.r+\" G:\"+this.g+\" B:\"+this.b+\" A:\"+this.a+\"}\"},e.prototype.getClassName=function(){return\"Color4\"},e.prototype.getHashCode=function(){var e=255*this.r|0;return 397*(e=397*(e=397*e^(255*this.g|0))^(255*this.b|0))^(255*this.a|0)},e.prototype.clone=function(){return new e(this.r,this.g,this.b,this.a)},e.prototype.copyFrom=function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this},e.prototype.copyFromFloats=function(e,t,i,n){return this.r=e,this.g=t,this.b=i,this.a=n,this},e.prototype.set=function(e,t,i,n){return this.copyFromFloats(e,t,i,n)},e.prototype.toHexString=function(e){void 0===e&&(e=!1);var t=Math.round(255*this.r),i=Math.round(255*this.g),n=Math.round(255*this.b);if(e)return\"#\"+h.ToHex(t)+h.ToHex(i)+h.ToHex(n);var r=Math.round(255*this.a);return\"#\"+h.ToHex(t)+h.ToHex(i)+h.ToHex(n)+h.ToHex(r)},e.prototype.toLinearSpace=function(){var t=new e;return this.toLinearSpaceToRef(t),t},e.prototype.toLinearSpaceToRef=function(e){return e.r=Math.pow(this.r,p),e.g=Math.pow(this.g,p),e.b=Math.pow(this.b,p),e.a=this.a,this},e.prototype.toGammaSpace=function(){var t=new e;return this.toGammaSpaceToRef(t),t},e.prototype.toGammaSpaceToRef=function(e){return e.r=Math.pow(this.r,d),e.g=Math.pow(this.g,d),e.b=Math.pow(this.b,d),e.a=this.a,this},e.FromHexString=function(t){if(\"#\"!==t.substring(0,1)||9!==t.length&&7!==t.length)return new e(0,0,0,0);var i=parseInt(t.substring(1,3),16),n=parseInt(t.substring(3,5),16),r=parseInt(t.substring(5,7),16),o=9===t.length?parseInt(t.substring(7,9),16):255;return e.FromInts(i,n,r,o)},e.Lerp=function(t,i,n){var r=new e(0,0,0,0);return e.LerpToRef(t,i,n,r),r},e.LerpToRef=function(e,t,i,n){n.r=e.r+(t.r-e.r)*i,n.g=e.g+(t.g-e.g)*i,n.b=e.b+(t.b-e.b)*i,n.a=e.a+(t.a-e.a)*i},e.Hermite=function(t,i,n,r,o){var a=o*o,s=o*a,l=2*s-3*a+1,c=-2*s+3*a,u=s-2*a+o,h=s-a;return new e(t.r*l+n.r*c+i.r*u+r.r*h,t.g*l+n.g*c+i.g*u+r.g*h,t.b*l+n.b*c+i.b*u+r.b*h,t.a*l+n.a*c+i.a*u+r.a*h)},e.Hermite1stDerivative=function(t,i,n,r,o){var a=new e;return this.Hermite1stDerivativeToRef(t,i,n,r,o,a),a},e.Hermite1stDerivativeToRef=function(e,t,i,n,r,o){var a=r*r;o.r=6*(a-r)*e.r+(3*a-4*r+1)*t.r+6*(-a+r)*i.r+(3*a-2*r)*n.r,o.g=6*(a-r)*e.g+(3*a-4*r+1)*t.g+6*(-a+r)*i.g+(3*a-2*r)*n.g,o.b=6*(a-r)*e.b+(3*a-4*r+1)*t.b+6*(-a+r)*i.b+(3*a-2*r)*n.b,o.a=6*(a-r)*e.a+(3*a-4*r+1)*t.a+6*(-a+r)*i.a+(3*a-2*r)*n.a},e.FromColor3=function(t,i){return void 0===i&&(i=1),new e(t.r,t.g,t.b,i)},e.FromArray=function(t,i){return void 0===i&&(i=0),new e(t[i],t[i+1],t[i+2],t[i+3])},e.FromArrayToRef=function(e,t,i){void 0===t&&(t=0),i.r=e[t],i.g=e[t+1],i.b=e[t+2],i.a=e[t+3]},e.FromInts=function(t,i,n,r){return new e(t/255,i/255,n/255,r/255)},e.CheckColors4=function(e,t){if(e.length===3*t){for(var i=[],n=0;n=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,i,a):r(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a}function z(e,t,i,n){return new(i||(i=Promise))((function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))}function W(e,t){var i,n,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},\"function\"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(i)throw new TypeError(\"Generator is already executing.\");for(;a;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]this.value;case t.IsLesser:return this._effectiveTarget[this._property]\").concat(r,\"
\");e._AddLogEntry(a),e._GenerateLimitMessage(i,t)}},Object.defineProperty(e,\"LogCache\",{get:function(){return e._LogCache},enumerable:!1,configurable:!0}),e.ClearLogCache=function(){e._LogCache=\"\",e._LogLimitOutputs={},e.errorsCount=0},Object.defineProperty(e,\"LogLevels\",{set:function(t){var i=this;e.Log=e._LogDisabled,e.Warn=e._LogDisabled,e.Error=e._LogDisabled,[e.MessageLogLevel,e.WarningLogLevel,e.ErrorLogLevel].forEach((function(n){(t&n)===n&&(e[i._Levels[n].name]=e._LogEnabled.bind(e,n))}))},enumerable:!1,configurable:!0}),e.NoneLogLevel=0,e.MessageLogLevel=1,e.WarningLogLevel=2,e.ErrorLogLevel=4,e.AllLogLevel=7,e.MessageLimitReached=\"Too many %TYPE%s (%LIMIT%), no more %TYPE%s will be reported for this message.\",e._LogCache=\"\",e._LogLimitOutputs={},e._Levels=[{},{color:\"white\",logFunc:console.log,name:\"Log\"},{color:\"orange\",logFunc:console.warn,name:\"Warn\"},{},{color:\"red\",logFunc:console.error,name:\"Error\"}],e.errorsCount=0,e.Log=e._LogEnabled.bind(e,e.MessageLogLevel),e.Warn=e._LogEnabled.bind(e,e.WarningLogLevel),e.Error=e._LogEnabled.bind(e,e.ErrorLogLevel),e}(),q=function(e){function t(t,i,n,r){var o=e.call(this,t,r)||this;return o.propertyPath=n,o._target=o._effectiveTarget=i,o}return V(t,e),t.prototype._prepare=function(){this._effectiveTarget=this._getEffectiveTarget(this._effectiveTarget,this.propertyPath),this._property=this._getProperty(this.propertyPath)},t.prototype.execute=function(){this._effectiveTarget[this._property]=!this._effectiveTarget[this._property]},t.prototype.serialize=function(t){return e.prototype._serialize.call(this,{name:\"SwitchBooleanAction\",properties:[w._GetTargetProperty(this._target),{name:\"propertyPath\",value:this.propertyPath}]},t)},t}(w),Z=function(e){function t(t,i,n,r){var o=e.call(this,t,r)||this;return o.value=n,o._target=i,o}return V(t,e),t.prototype.execute=function(){this._target.state=this.value},t.prototype.serialize=function(t){return e.prototype._serialize.call(this,{name:\"SetStateAction\",properties:[w._GetTargetProperty(this._target),{name:\"value\",value:this.value}]},t)},t}(w),J=function(e){function t(t,i,n,r,o){var a=e.call(this,t,o)||this;return a.propertyPath=n,a.value=r,a._target=a._effectiveTarget=i,a}return V(t,e),t.prototype._prepare=function(){this._effectiveTarget=this._getEffectiveTarget(this._effectiveTarget,this.propertyPath),this._property=this._getProperty(this.propertyPath)},t.prototype.execute=function(){this._effectiveTarget[this._property]=this.value,this._target.markAsDirty&&this._target.markAsDirty(this._property)},t.prototype.serialize=function(t){return e.prototype._serialize.call(this,{name:\"SetValueAction\",properties:[w._GetTargetProperty(this._target),{name:\"propertyPath\",value:this.propertyPath},{name:\"value\",value:w._SerializeValueAsString(this.value)}]},t)},t}(w),$=function(e){function t(t,i,n,r,o){var a=e.call(this,t,o)||this;return a.propertyPath=n,a.value=r,a._target=a._effectiveTarget=i,a}return V(t,e),t.prototype._prepare=function(){this._effectiveTarget=this._getEffectiveTarget(this._effectiveTarget,this.propertyPath),this._property=this._getProperty(this.propertyPath),\"number\"!=typeof this._effectiveTarget[this._property]&&Q.Warn(\"Warning: IncrementValueAction can only be used with number values\")},t.prototype.execute=function(){this._effectiveTarget[this._property]+=this.value,this._target.markAsDirty&&this._target.markAsDirty(this._property)},t.prototype.serialize=function(t){return e.prototype._serialize.call(this,{name:\"IncrementValueAction\",properties:[w._GetTargetProperty(this._target),{name:\"propertyPath\",value:this.propertyPath},{name:\"value\",value:w._SerializeValueAsString(this.value)}]},t)},t}(w),ee=function(e){function t(t,i,n,r,o,a){var s=e.call(this,t,a)||this;return s.from=n,s.to=r,s.loop=o,s._target=i,s}return V(t,e),t.prototype._prepare=function(){},t.prototype.execute=function(){this._actionManager.getScene().beginAnimation(this._target,this.from,this.to,this.loop)},t.prototype.serialize=function(t){return e.prototype._serialize.call(this,{name:\"PlayAnimationAction\",properties:[w._GetTargetProperty(this._target),{name:\"from\",value:String(this.from)},{name:\"to\",value:String(this.to)},{name:\"loop\",value:w._SerializeValueAsString(this.loop)||!1}]},t)},t}(w),te=function(e){function t(t,i,n){var r=e.call(this,t,n)||this;return r._target=i,r}return V(t,e),t.prototype._prepare=function(){},t.prototype.execute=function(){this._actionManager.getScene().stopAnimation(this._target)},t.prototype.serialize=function(t){return e.prototype._serialize.call(this,{name:\"StopAnimationAction\",properties:[w._GetTargetProperty(this._target)]},t)},t}(w),ie=function(e){function t(t,i){return void 0===t&&(t=a.ACTION_NothingTrigger),e.call(this,t,i)||this}return V(t,e),t.prototype.execute=function(){},t.prototype.serialize=function(t){return e.prototype._serialize.call(this,{name:\"DoNothingAction\",properties:[]},t)},t}(w),ne=function(e){function t(t,i,n,r){void 0===r&&(r=!0);var o=e.call(this,t,n)||this;return o.children=i,o.enableChildrenConditions=r,o}return V(t,e),t.prototype._prepare=function(){for(var e=0;e0)if(\"object\"==typeof l[0])for(var u=0;u-1&&this._scene.actionManagers.splice(e,1)},t.prototype.getScene=function(){return this._scene},t.prototype.hasSpecificTriggers=function(e){for(var t=0;t-1)return!0}return!1},t.prototype.hasSpecificTriggers2=function(e,t){for(var i=0;i=t.OnPickTrigger&&i.trigger<=t.OnPointerOutTrigger)return!0}return!1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"hasPickTriggers\",{get:function(){for(var e=0;e=t.OnPickTrigger&&i.trigger<=t.OnPickUpTrigger)return!0}return!1},enumerable:!1,configurable:!0}),t.prototype.registerAction=function(e){return e.trigger===t.OnEveryFrameTrigger&&this.getScene().actionManager!==this?(Q.Warn(\"OnEveryFrameTrigger can only be used with scene.actionManager\"),null):(this.actions.push(e),t.Triggers[e.trigger]?t.Triggers[e.trigger]++:t.Triggers[e.trigger]=1,e._actionManager=this,e._prepare(),e)},t.prototype.unregisterAction=function(e){var i=this.actions.indexOf(e);return-1!==i&&(this.actions.splice(i,1),t.Triggers[e.trigger]-=1,0===t.Triggers[e.trigger]&&delete t.Triggers[e.trigger],e._actionManager=null,!0)},t.prototype.processTrigger=function(e,i){for(var n=0;n0;if(2===e.type?u.push(r):u.push(i),p){for(var f=new Array,_=0;_0){var u=c.properties[0].value,h=null===c.properties[0].targetType?u:n.getMeshByName(u);h._meshId&&(h.mesh=n.getMeshById(h._meshId)),l={trigger:t[c.name],parameter:h}}else l=t[c.name];for(var d=0;d1)for(var l=0;l=0?i:0;var s=0,l=a._keys[0],c=a._keys.length-1,u=a._keys[c],h={referenceValue:l.value,referencePosition:O.Vector3[0],referenceQuaternion:O.Quaternion[0],referenceScaling:O.Vector3[1],keyPosition:O.Vector3[2],keyQuaternion:O.Quaternion[1],keyScaling:O.Vector3[3]},d=!1,p=l.frame,f=u.frame;if(n){var _=a.getRange(n);_&&(p=_.from,f=_.to)}var m=l.frame===p,g=u.frame===f;if(1===a._keys.length){var v=a._getKeyValue(a._keys[0]);h.referenceValue=v.clone?v.clone():v,d=!0}else i<=l.frame?(v=a._getKeyValue(l.value),h.referenceValue=v.clone?v.clone():v,d=!0):i>=u.frame&&(v=a._getKeyValue(u.value),h.referenceValue=v.clone?v.clone():v,d=!0);for(var y=0;!d||!m||!g&&y=b.frame&&i<=T.frame){if(v=void 0,i===b.frame)v=a._getKeyValue(b.value);else if(i===T.frame)v=a._getKeyValue(T.value);else{var E={key:y,repeatCount:0,loopMode:this.ANIMATIONLOOPMODE_CONSTANT};v=a._interpolate(i,E)}h.referenceValue=v.clone?v.clone():v,d=!0}if(!m&&p>=b.frame&&p<=T.frame){if(p===b.frame)s=y;else if(p===T.frame)s=y+1;else{E={key:y,repeatCount:0,loopMode:this.ANIMATIONLOOPMODE_CONSTANT};var S={frame:p,value:(v=a._interpolate(p,E)).clone?v.clone():v};a._keys.splice(y+1,0,S),s=y+1}m=!0}!g&&f>=b.frame&&f<=T.frame&&(f===b.frame?c=y:(f===T.frame||(E={key:y,repeatCount:0,loopMode:this.ANIMATIONLOOPMODE_CONSTANT},S={frame:f,value:(v=a._interpolate(f,E)).clone?v.clone():v},a._keys.splice(y+1,0,S)),c=y+1),g=!0),y++}for(a.dataType===e.ANIMATIONTYPE_QUATERNION?h.referenceValue.normalize().conjugateInPlace():a.dataType===e.ANIMATIONTYPE_MATRIX&&(h.referenceValue.decompose(h.referenceScaling,h.referenceQuaternion,h.referencePosition),h.referenceQuaternion.normalize().conjugateInPlace()),y=s;y<=c;y++)if(S=a._keys[y],!y||a.dataType===e.ANIMATIONTYPE_FLOAT||S.value!==l.value)switch(a.dataType){case e.ANIMATIONTYPE_MATRIX:S.value.decompose(h.keyScaling,h.keyQuaternion,h.keyPosition),h.keyPosition.subtractInPlace(h.referencePosition),h.keyScaling.divideInPlace(h.referenceScaling),h.referenceQuaternion.multiplyToRef(h.keyQuaternion,h.keyQuaternion),M.ComposeToRef(h.keyScaling,h.keyQuaternion,h.keyPosition,S.value);break;case e.ANIMATIONTYPE_QUATERNION:h.referenceValue.multiplyToRef(S.value,S.value);break;case e.ANIMATIONTYPE_VECTOR2:case e.ANIMATIONTYPE_VECTOR3:case e.ANIMATIONTYPE_COLOR3:case e.ANIMATIONTYPE_COLOR4:S.value.subtractToRef(h.referenceValue,S.value);break;case e.ANIMATIONTYPE_SIZE:S.value.width-=h.referenceValue.width,S.value.height-=h.referenceValue.height;break;default:S.value-=h.referenceValue}return a},e.TransitionTo=function(e,t,i,n,r,o,a,s){if(void 0===s&&(s=null),a<=0)return i[e]=t,s&&s(),null;var l=r*(a/1e3);o.setKeys([{frame:0,value:i[e].clone?i[e].clone():i[e]},{frame:l,value:t}]),i.animations||(i.animations=[]),i.animations.push(o);var c=n.beginAnimation(i,0,l,!1);return c.onAnimationEnd=s,c},Object.defineProperty(e.prototype,\"runtimeAnimations\",{get:function(){return this._runtimeAnimations},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"hasRunningRuntimeAnimations\",{get:function(){for(var e=0,t=this._runtimeAnimations;e=0;o--)this._keys[o].frame>=n&&this._keys[o].frame<=r&&this._keys.splice(o,1);this._ranges[e]=null}},e.prototype.getRange=function(e){return this._ranges[e]},e.prototype.getKeys=function(){return this._keys},e.prototype.getHighestFrame=function(){for(var e=0,t=0,i=this._keys.length;t0)return i.highLimitValue.clone?i.highLimitValue.clone():i.highLimitValue;for(var n=this._keys,r=n.length,o=i.key;o>=0&&t=n[o+1].frame;)++o;if(i.key=o,o<0)return this._getKeyValue(n[0].value);if(o+1>r-1)return this._getKeyValue(n[r-1].value);var a=n[o],s=n[o+1],l=this._getKeyValue(a.value),c=this._getKeyValue(s.value);if(a.interpolation===Ne.STEP)return s.frame>t?l:c;var u=void 0!==a.outTangent&&void 0!==s.inTangent,h=s.frame-a.frame,d=(t-a.frame)/h,p=this.getEasingFunction();switch(null!==p&&(d=p.ease(d)),this.dataType){case e.ANIMATIONTYPE_FLOAT:var f=u?this.floatInterpolateFunctionWithTangents(l,a.outTangent*h,c,s.inTangent*h,d):this.floatInterpolateFunction(l,c,d);switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return f;case e.ANIMATIONLOOPMODE_RELATIVE:return i.offsetValue*i.repeatCount+f}break;case e.ANIMATIONTYPE_QUATERNION:var _=u?this.quaternionInterpolateFunctionWithTangents(l,a.outTangent.scale(h),c,s.inTangent.scale(h),d):this.quaternionInterpolateFunction(l,c,d);switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return _;case e.ANIMATIONLOOPMODE_RELATIVE:return _.addInPlace(i.offsetValue.scale(i.repeatCount))}return _;case e.ANIMATIONTYPE_VECTOR3:var m=u?this.vector3InterpolateFunctionWithTangents(l,a.outTangent.scale(h),c,s.inTangent.scale(h),d):this.vector3InterpolateFunction(l,c,d);switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return m;case e.ANIMATIONLOOPMODE_RELATIVE:return m.add(i.offsetValue.scale(i.repeatCount))}break;case e.ANIMATIONTYPE_VECTOR2:var g=u?this.vector2InterpolateFunctionWithTangents(l,a.outTangent.scale(h),c,s.inTangent.scale(h),d):this.vector2InterpolateFunction(l,c,d);switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return g;case e.ANIMATIONLOOPMODE_RELATIVE:return g.add(i.offsetValue.scale(i.repeatCount))}break;case e.ANIMATIONTYPE_SIZE:switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return this.sizeInterpolateFunction(l,c,d);case e.ANIMATIONLOOPMODE_RELATIVE:return this.sizeInterpolateFunction(l,c,d).add(i.offsetValue.scale(i.repeatCount))}break;case e.ANIMATIONTYPE_COLOR3:var v=u?this.color3InterpolateFunctionWithTangents(l,a.outTangent.scale(h),c,s.inTangent.scale(h),d):this.color3InterpolateFunction(l,c,d);switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return v;case e.ANIMATIONLOOPMODE_RELATIVE:return v.add(i.offsetValue.scale(i.repeatCount))}break;case e.ANIMATIONTYPE_COLOR4:var y=u?this.color4InterpolateFunctionWithTangents(l,a.outTangent.scale(h),c,s.inTangent.scale(h),d):this.color4InterpolateFunction(l,c,d);switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return y;case e.ANIMATIONLOOPMODE_RELATIVE:return y.add(i.offsetValue.scale(i.repeatCount))}break;case e.ANIMATIONTYPE_MATRIX:switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return e.AllowMatricesInterpolation?this.matrixInterpolateFunction(l,c,d,i.workValue):l;case e.ANIMATIONLOOPMODE_RELATIVE:return l}}return 0},e.prototype.matrixInterpolateFunction=function(t,i,n,r){return e.AllowMatrixDecomposeForInterpolation?r?(M.DecomposeLerpToRef(t,i,n,r),r):M.DecomposeLerp(t,i,n):r?(M.LerpToRef(t,i,n,r),r):M.Lerp(t,i,n)},e.prototype.clone=function(){var t=new e(this.name,this.targetPropertyPath.join(\".\"),this.framePerSecond,this.dataType,this.loopMode);if(t.enableBlending=this.enableBlending,t.blendingSpeed=this.blendingSpeed,this._keys&&t.setKeys(this._keys),this._ranges)for(var i in t._ranges={},this._ranges){var n=this._ranges[i];n&&(t._ranges[i]=n.clone())}return t},e.prototype.setKeys=function(e){this._keys=e.slice(0)},e.prototype.serialize=function(){var t={};t.name=this.name,t.property=this.targetProperty,t.framePerSecond=this.framePerSecond,t.dataType=this.dataType,t.loopBehavior=this.loopMode,t.enableBlending=this.enableBlending,t.blendingSpeed=this.blendingSpeed;var i=this.dataType;t.keys=[];for(var n=this.getKeys(),r=0;r=2&&(l=s.values[1]),s.values.length>=3&&(c=s.values[2]),s.values.length>=4&&(u=s.values[3]);break;case e.ANIMATIONTYPE_QUATERNION:if(i=P.FromArray(s.values),s.values.length>=8){var h=P.FromArray(s.values.slice(4,8));h.equals(P.Zero())||(l=h)}if(s.values.length>=12){var d=P.FromArray(s.values.slice(8,12));d.equals(P.Zero())||(c=d)}s.values.length>=13&&(u=s.values[12]);break;case e.ANIMATIONTYPE_MATRIX:i=M.FromArray(s.values),s.values.length>=17&&(u=s.values[16]);break;case e.ANIMATIONTYPE_COLOR3:i=N.FromArray(s.values),s.values[3]&&(l=N.FromArray(s.values[3])),s.values[4]&&(c=N.FromArray(s.values[4])),s.values[5]&&(u=s.values[5]);break;case e.ANIMATIONTYPE_COLOR4:i=L.FromArray(s.values),s.values[4]&&(l=L.FromArray(s.values[4])),s.values[5]&&(c=L.FromArray(s.values[5])),s.values[6]&&(u=L.FromArray(s.values[6]));break;case e.ANIMATIONTYPE_VECTOR3:default:i=x.FromArray(s.values),s.values[3]&&(l=x.FromArray(s.values[3])),s.values[4]&&(c=x.FromArray(s.values[4])),s.values[5]&&(u=s.values[5])}var p={};p.frame=s.frame,p.value=i,null!=l&&(p.inTangent=l),null!=c&&(p.outTangent=c),null!=u&&(p.interpolation=u),a.push(p)}if(r.setKeys(a),t.ranges)for(n=0;n0&&u.forEach((function(e){r._events.push(e._clone())})),this._enableBlending=e&&e.animationPropertiesOverride?e.animationPropertiesOverride.enableBlending:this._animation.enableBlending}return Object.defineProperty(e.prototype,\"currentFrame\",{get:function(){return this._currentFrame},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"weight\",{get:function(){return this._weight},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"currentValue\",{get:function(){return this._currentValue},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"targetPath\",{get:function(){return this._targetPath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"target\",{get:function(){return this._currentActiveTarget},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"isAdditive\",{get:function(){return this._host&&this._host.isAdditive},enumerable:!1,configurable:!0}),e.prototype._preparePath=function(e,t){void 0===t&&(t=0);var i=this._animation.targetPropertyPath;if(i.length>1){for(var n=e[i[0]],r=1;r-1&&this._animation.runtimeAnimations.splice(e,1)},e.prototype.setValue=function(e,t){if(this._targetIsArray)for(var i=0;it[t.length-1].frame&&(e=t[t.length-1].frame);var i=this._events;if(i.length)for(var n=0;nthis._maxFrame)&&(t=this._minFrame),(ithis._maxFrame)&&(i=this._maxFrame);var c,u,h=i-t,d=e*(a.framePerSecond*r)/1e3+this._ratioOffset,p=0;if(this._previousDelay=e,this._previousRatio=d,!n&&i>=t&&d>=h)l=!1,p=a._getKeyValue(this._maxValue);else if(!n&&t>=i&&d<=h)l=!1,p=a._getKeyValue(this._minValue);else if(this._animationState.loopMode!==ze.ANIMATIONLOOPMODE_CYCLE){var f=i.toString()+t.toString();if(!this._offsetsCache[f]){this._animationState.repeatCount=0,this._animationState.loopMode=ze.ANIMATIONLOOPMODE_CYCLE;var _=a._interpolate(t,this._animationState),m=a._interpolate(i,this._animationState);switch(this._animationState.loopMode=this._getCorrectLoopMode(),a.dataType){case ze.ANIMATIONTYPE_FLOAT:this._offsetsCache[f]=m-_;break;case ze.ANIMATIONTYPE_QUATERNION:case ze.ANIMATIONTYPE_VECTOR3:case ze.ANIMATIONTYPE_VECTOR2:case ze.ANIMATIONTYPE_SIZE:case ze.ANIMATIONTYPE_COLOR3:this._offsetsCache[f]=m.subtract(_)}this._highLimitsCache[f]=m}p=this._highLimitsCache[f],c=this._offsetsCache[f]}if(void 0===c)switch(a.dataType){case ze.ANIMATIONTYPE_FLOAT:c=0;break;case ze.ANIMATIONTYPE_QUATERNION:c=He;break;case ze.ANIMATIONTYPE_VECTOR3:c=Xe;break;case ze.ANIMATIONTYPE_VECTOR2:c=je;break;case ze.ANIMATIONTYPE_SIZE:c=Ye;break;case ze.ANIMATIONTYPE_COLOR3:c=Ke}if(this._host&&this._host.syncRoot){var g=this._host.syncRoot;u=t+(i-t)*((g.masterFrame-g.fromFrame)/(g.toFrame-g.fromFrame))}else u=d>0&&t>i||d<0&&t0&&this.currentFrame>u||r<0&&this.currentFrame0?0:a.getKeys().length-1}this._currentFrame=u,this._animationState.repeatCount=0===h?0:d/h>>0,this._animationState.highLimitValue=p,this._animationState.offsetValue=c;var b=a._interpolate(u,this._animationState);if(this.setValue(b,o),v.length)for(y=0;y0&&u>=v[y].frame&&v[y].frame>=t||h<0&&u<=v[y].frame&&v[y].frame<=t){var T=v[y];T.isDone||(T.onlyOnce&&(v.splice(y,1),y--),T.isDone=!0,T.action(u))}return l||(this._stopped=!0),l},e}();function qe(){return\"undefined\"!=typeof window}function Ze(){return\"undefined\"!=typeof navigator}function Je(){return\"undefined\"!=typeof document}function $e(e){for(var t=\"\",i=e.firstChild;i;)3===i.nodeType&&(t+=i.textContent),i=i.nextSibling;return t}var et,tt={IsWindowObjectExist:qe,IsNavigatorAvailable:Ze,IsDocumentAvailable:Je,GetDOMTextContent:$e},it=function(){function e(){}return Object.defineProperty(e,\"Now\",{get:function(){return tt.IsWindowObjectExist()&&window.performance&&window.performance.now?window.performance.now():Date.now()},enumerable:!1,configurable:!0}),e}(),nt=function(){function e(){}return e.FilesToLoad={},e}(),rt=function(){function e(){}return e.ExponentialBackoff=function(e,t){return void 0===e&&(e=3),void 0===t&&(t=500),function(i,n,r){return 0!==n.status||r>=e||-1!==i.indexOf(\"file:\")?-1:Math.pow(2,r)*t}},e}(),ot=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return V(t,e),t._setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t}(Error),at={MeshInvalidPositionsError:0,UnsupportedTextureError:1e3,GLTFLoaderUnexpectedMagicError:2e3,SceneLoaderError:3e3,LoadFileError:4e3,RequestFileError:4001,ReadFileError:4002},st=function(e){function t(i,n,r){var o=e.call(this,i)||this;return o.errorCode=n,o.innerError=r,o.name=\"RuntimeError\",ot._setPrototypeOf(o,t.prototype),o}return V(t,e),t}(ot),lt=function(e,t){return e.endsWith(t)},ct=function(e,t){return!!e&&e.startsWith(t)},ut=function(e){if(\"undefined\"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t=\"\",i=0;i>2,o=(3&t)<<4|(i=u>4,a=(15&i)<<2|(n=u>6,s=63&n,isNaN(i)?a=s=64:isNaN(n)&&(s=64),c+=l.charAt(r)+l.charAt(o)+l.charAt(a)+l.charAt(s);return c},dt=function(e){return atob(e)},pt=function(e){for(var t=dt(e),i=t.length,n=new Uint8Array(new ArrayBuffer(i)),r=0;r1){for(r();-1!==n&&e._OperatorPriority[a()]>=e._OperatorPriority[h];)i.push(s());o(h),l++}else c+=u;l++}for(r();-1!==n;)\"(\"===a()?s():i.push(s());return i},e._OperatorPriority={\")\":0,\"(\":1,\"||\":2,\"&&\":3},e._Stack=[\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"],e}(),Tt=function(e){function t(t,i){void 0===i&&(i=!1);var n=e.call(this)||this;return n.define=t,n.not=i,n}return V(t,e),t.prototype.isTrue=function(e){var t=void 0!==e[this.define];return this.not&&(t=!t),t},t}(bt),Et=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return V(t,e),t.prototype.isTrue=function(e){return this.leftOperand.isTrue(e)||this.rightOperand.isTrue(e)},t}(bt),St=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return V(t,e),t.prototype.isTrue=function(e){return this.leftOperand.isTrue(e)&&this.rightOperand.isTrue(e)},t}(bt),At=function(e){function t(t,i,n){var r=e.call(this)||this;return r.define=t,r.operand=i,r.testValue=n,r}return V(t,e),t.prototype.isTrue=function(e){var t=e[this.define];void 0===t&&(t=this.define);var i=!1,n=parseInt(t),r=parseInt(this.testValue);switch(this.operand){case\">\":i=n>r;break;case\"<\":i=n=\":i=n>=r;break;case\"==\":i=n===r}return i},t}(bt);!function(e){e[e.GLSL=0]=\"GLSL\",e[e.WGSL=1]=\"WGSL\"}(et||(et={}));var Rt,xt=/defined\\s*?\\((.+?)\\)/g,Ct=/defined\\s*?\\[(.+?)\\]/g,Pt=/#include\\s?<(.+)>(\\((.*)\\))*(\\[(.*)\\])*/g,Mt=function(){function e(){}return e.Initialize=function(e){e.processor&&e.processor.initializeShaders&&e.processor.initializeShaders(e.processingContext)},e.Process=function(e,t,i,n){var r,o=this;(null===(r=t.processor)||void 0===r?void 0:r.preProcessShaderCode)&&(e=t.processor.preProcessShaderCode(e,t.isFragment)),this._ProcessIncludes(e,t,(function(e){t.processCodeAfterIncludes&&(e=t.processCodeAfterIncludes(t.isFragment?\"fragment\":\"vertex\",e));var r=o._ProcessShaderConversion(e,t,n);i(r)}))},e.PreProcess=function(e,t,i,n){var r,o=this;(null===(r=t.processor)||void 0===r?void 0:r.preProcessShaderCode)&&(e=t.processor.preProcessShaderCode(e,t.isFragment)),this._ProcessIncludes(e,t,(function(e){t.processCodeAfterIncludes&&(e=t.processCodeAfterIncludes(t.isFragment?\"fragment\":\"vertex\",e));var r=o._ApplyPreProcessing(e,t,n);i(r)}))},e.Finalize=function(e,t,i){return i.processor&&i.processor.finalizeShaders?i.processor.finalizeShaders(e,t,i.processingContext):{vertexCode:e,fragmentCode:t}},e._ProcessPrecision=function(e,t){var i;if(null===(i=t.processor)||void 0===i?void 0:i.noPrecision)return e;var n=t.shouldUseHighPrecisionShader;return-1===e.indexOf(\"precision highp float\")?e=n?\"precision highp float;\\n\"+e:\"precision mediump float;\\n\"+e:n||(e=e.replace(\"precision highp float\",\"precision mediump float\")),e},e._ExtractOperation=function(e){var t=/defined\\((.+)\\)/.exec(e);if(t&&t.length)return new Tt(t[1].trim(),\"!\"===e[0]);for(var i=\"\",n=0,r=0,o=[\"==\",\">=\",\"<=\",\"<\",\">\"];r-1));r++);if(-1===n)return new Tt(e);var a=e.substring(0,n).trim(),s=e.substring(n+i.length).trim();return new At(a,i,s)},e._BuildSubExpression=function(e){e=e.replace(xt,\"defined[$1]\");for(var t=[],i=0,n=bt.infixToPostfix(e);i=2){var o=t[t.length-1],a=t[t.length-2];t.length-=2;var s=\"&&\"==r?new St:new Et;\"string\"==typeof o&&(o=o.replace(Ct,\"defined($1)\")),\"string\"==typeof a&&(a=a.replace(Ct,\"defined($1)\")),s.leftOperand=\"string\"==typeof a?this._ExtractOperation(a):a,s.rightOperand=\"string\"==typeof o?this._ExtractOperation(o):o,t.push(s)}}var l=t[t.length-1];return\"string\"==typeof l&&(l=l.replace(Ct,\"defined($1)\")),\"string\"==typeof l?this._ExtractOperation(l):l},e._BuildExpression=function(e,t){var i=new yt,n=e.substring(0,t),r=e.substring(t);return r=r.substring(0,(r.indexOf(\"//\")+1||r.length+1)-1).trim(),i.testExpression=\"#ifdef\"===n?new Tt(r):\"#ifndef\"===n?new Tt(r,!0):this._BuildSubExpression(r),i},e._MoveCursorWithinIf=function(e,t,i){for(var n=e.currentLine;this._MoveCursor(e,i);){var r=(n=e.currentLine).substring(0,5).toLowerCase();if(\"#else\"===r){var o=new mt;return t.children.push(o),void this._MoveCursor(e,o)}if(\"#elif\"===r){var a=this._BuildExpression(n,5);t.children.push(a),i=a}}},e._MoveCursor=function(e,t){for(;e.canRead;){e.lineIndex++;var i=e.currentLine,n=/(#ifdef)|(#else)|(#elif)|(#endif)|(#ifndef)|(#if)/.exec(i);if(n&&n.length)switch(n[0]){case\"#ifdef\":var r=new vt;t.children.push(r);var o=this._BuildExpression(i,6);r.children.push(o),this._MoveCursorWithinIf(e,r,o);break;case\"#else\":case\"#elif\":return!0;case\"#endif\":return!1;case\"#ifndef\":r=new vt,t.children.push(r),o=this._BuildExpression(i,7),r.children.push(o),this._MoveCursorWithinIf(e,r,o);break;case\"#if\":r=new vt,o=this._BuildExpression(i,3),t.children.push(r),r.children.push(o),this._MoveCursorWithinIf(e,r,o)}else{var a=new mt;if(a.line=i,t.children.push(a),\"#\"===i[0]&&\"d\"===i[1]){var s=i.replace(\";\",\"\").split(\" \");a.additionalDefineKey=s[1],3===s.length&&(a.additionalDefineValue=s[2])}}}return!1},e._EvaluatePreProcessors=function(e,t,i){var n=new mt,r=new gt;return r.lineIndex=-1,r.lines=e.split(\"\\n\"),this._MoveCursor(r,n),n.process(t,i)},e._PreparePreProcessors=function(e,t){for(var i,n={},r=0,o=e.defines;r1?a[1]:\"\"}return(null===(i=e.processor)||void 0===i?void 0:i.shaderLanguage)===et.GLSL&&(n.GL_ES=\"true\"),n.__VERSION__=e.version,n[e.platformName]=\"true\",t._getGlobalDefines(n),n},e._ProcessShaderConversion=function(e,t,i){var n=this._ProcessPrecision(e,t);if(!t.processor)return n;if(t.processor.shaderLanguage===et.GLSL&&-1!==n.indexOf(\"#version 3\"))return n.replace(\"#version 300 es\",\"\");var r=t.defines,o=this._PreparePreProcessors(t,i);return t.processor.preProcessor&&(n=t.processor.preProcessor(n,r,t.isFragment,t.processingContext)),n=this._EvaluatePreProcessors(n,o,t),t.processor.postProcessor&&(n=t.processor.postProcessor(n,r,t.isFragment,t.processingContext,i)),i._features.needShaderCodeInlining&&(n=i.inlineShaderCode(n)),n},e._ApplyPreProcessing=function(e,t,i){var n,r,o=e,a=t.defines,s=this._PreparePreProcessors(t,i);return(null===(n=t.processor)||void 0===n?void 0:n.preProcessor)&&(o=t.processor.preProcessor(o,a,t.isFragment,t.processingContext)),o=this._EvaluatePreProcessors(o,s,t),(null===(r=t.processor)||void 0===r?void 0:r.postProcessor)&&(o=t.processor.postProcessor(o,a,t.isFragment,t.processingContext,i)),i._features.needShaderCodeInlining&&(o=i.inlineShaderCode(o)),o},e._ProcessIncludes=function(t,i,n){for(var r=this,o=Pt.exec(t),a=new String(t),s=!1,l=function(){var l=o[1];if(-1!==l.indexOf(\"__decl__\")&&(l=l.replace(/__decl__/,\"\"),i.supportsUniformBuffers&&(l=(l=l.replace(/Vertex/,\"Ubo\")).replace(/Fragment/,\"Ubo\")),l+=\"Declaration\"),!i.includesShadersStore[l]){var c=i.shadersRepository+\"ShadersInclude/\"+l+\".fx\";return e._FileToolsLoadFile(c,(function(e){i.includesShadersStore[l]=e,r._ProcessIncludes(a,i,n)})),{value:void 0}}var u=i.includesShadersStore[l];if(o[2])for(var h=o[3].split(\",\"),d=0;d=0||u.indexOf(\"#include <\")>=0,o=Pt.exec(t)};null!=o;){var c=l();if(\"object\"==typeof c)return c.value}s?this._ProcessIncludes(a.toString(),i,n):n(a)},e._FileToolsLoadFile=function(e,t,i,n,r,o){throw pe(\"FileTools\")},e}(),It=function(){function e(){}return e.GetShadersRepository=function(t){return void 0===t&&(t=et.GLSL),t===et.GLSL?e.ShadersRepository:e.ShadersRepositoryWGSL},e.GetShadersStore=function(t){return void 0===t&&(t=et.GLSL),t===et.GLSL?e.ShadersStore:e.ShadersStoreWGSL},e.GetIncludesShadersStore=function(t){return void 0===t&&(t=et.GLSL),t===et.GLSL?e.IncludesShadersStore:e.IncludesShadersStoreWGSL},e.ShadersRepository=\"src/Shaders/\",e.ShadersStore={},e.IncludesShadersStore={},e.ShadersRepositoryWGSL=\"src/ShadersWGSL/\",e.ShadersStoreWGSL={},e.IncludesShadersStoreWGSL={},e}(),Ot=function(){function e(t,i,n,r,o,a,s,l,c,h,d,p){void 0===r&&(r=null),void 0===a&&(a=null),void 0===s&&(s=null),void 0===l&&(l=null),void 0===c&&(c=null),void 0===d&&(d=\"\"),void 0===p&&(p=et.GLSL);var f,_,m,g=this;this.name=null,this.defines=\"\",this.onCompiled=null,this.onError=null,this.onBind=null,this.uniqueId=0,this.onCompileObservable=new u,this.onErrorObservable=new u,this._onBindObservable=null,this._wasPreviouslyReady=!1,this._wasPreviouslyUsingInstances=null,this._isDisposed=!1,this._bonesComputationForcedToCPU=!1,this._uniformBuffersNames={},this._multiTarget=!1,this._samplers={},this._isReady=!1,this._compilationError=\"\",this._allFallbacksProcessed=!1,this._uniforms={},this._key=\"\",this._fallbacks=null,this._vertexSourceCodeOverride=\"\",this._fragmentSourceCodeOverride=\"\",this._transformFeedbackVaryings=null,this._pipelineContext=null,this._vertexSourceCode=\"\",this._fragmentSourceCode=\"\",this._rawVertexSourceCode=\"\",this._rawFragmentSourceCode=\"\",this.name=t,this._key=d;var v,y,b=void 0,T=null;if(i.attributes){var E=i;if(this._engine=n,this._attributesNames=E.attributes,this._uniformsNames=E.uniformsNames.concat(E.samplers),this._samplerList=E.samplers.slice(),this.defines=E.defines,this.onError=E.onError,this.onCompiled=E.onCompiled,this._fallbacks=E.fallbacks,this._indexParameters=E.indexParameters,this._transformFeedbackVaryings=E.transformFeedbackVaryings||null,this._multiTarget=!!E.multiTarget,this._shaderLanguage=null!==(f=E.shaderLanguage)&&void 0!==f?f:et.GLSL,E.uniformBuffersNames){this._uniformBuffersNamesList=E.uniformBuffersNames.slice();for(var S=0;S-1?e:It.GetShadersRepository(this._shaderLanguage)+e,this._engine._loadFile(r+\".\"+t.toLowerCase()+\".fx\",n))}else n(window.atob(e.substr(7)));else n(e.substr(7))},Object.defineProperty(e.prototype,\"vertexSourceCode\",{get:function(){var e,t;return this._vertexSourceCodeOverride&&this._fragmentSourceCodeOverride?this._vertexSourceCodeOverride:null!==(t=null===(e=this._pipelineContext)||void 0===e?void 0:e._getVertexShaderCode())&&void 0!==t?t:this._vertexSourceCode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"fragmentSourceCode\",{get:function(){var e,t;return this._vertexSourceCodeOverride&&this._fragmentSourceCodeOverride?this._fragmentSourceCodeOverride:null!==(t=null===(e=this._pipelineContext)||void 0===e?void 0:e._getFragmentShaderCode())&&void 0!==t?t:this._fragmentSourceCode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"rawVertexSourceCode\",{get:function(){return this._rawVertexSourceCode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"rawFragmentSourceCode\",{get:function(){return this._rawFragmentSourceCode},enumerable:!1,configurable:!0}),e.prototype._rebuildProgram=function(e,t,i,n){var r=this;this._isReady=!1,this._vertexSourceCodeOverride=e,this._fragmentSourceCodeOverride=t,this.onError=function(e,t){n&&n(t)},this.onCompiled=function(){var e=r.getEngine().scenes;if(e)for(var t=0;t=a&&(r=\"Offending line [\".concat(a,\"] in \").concat(i?\"fragment\":\"vertex\",\" code: \").concat(s[a-1]))}}return[e,r]},e.prototype._processCompilationErrors=function(t,i){var n,r,o,a,s,l=this;void 0===i&&(i=null),this._compilationError=t.message;var c=this._attributesNames,u=this._fallbacks;if(Q.Error(\"Unable to compile effect:\"),Q.Error(\"Uniforms: \"+this._uniformsNames.map((function(e){return\" \"+e}))),Q.Error(\"Attributes: \"+c.map((function(e){return\" \"+e}))),Q.Error(\"Defines:\\r\\n\"+this.defines),e.LogShaderCodeOnCompilationError){var h=null,d=null,p=null;(null===(o=this._pipelineContext)||void 0===o?void 0:o._getVertexShaderCode())&&(p=(n=this._getShaderCodeAndErrorLine(this._pipelineContext._getVertexShaderCode(),this._compilationError,!1))[0],h=n[1],p&&(Q.Error(\"Vertex code:\"),Q.Error(p))),(null===(a=this._pipelineContext)||void 0===a?void 0:a._getFragmentShaderCode())&&(p=(r=this._getShaderCodeAndErrorLine(null===(s=this._pipelineContext)||void 0===s?void 0:s._getFragmentShaderCode(),this._compilationError,!0))[0],d=r[1],p&&(Q.Error(\"Fragment code:\"),Q.Error(p))),h&&Q.Error(h),d&&Q.Error(d)}Q.Error(\"Error: \"+this._compilationError);var f=function(){l.onError&&l.onError(l,l._compilationError),l.onErrorObservable.notifyObservers(l)};i&&(this._pipelineContext=i,this._isReady=!0,f()),u?(this._pipelineContext=null,u.hasMoreFallbacks?(this._allFallbacksProcessed=!1,Q.Error(\"Trying next fallback.\"),this.defines=u.reduce(this.defines,this),this._prepareEffect()):(this._allFallbacksProcessed=!0,f(),this.onErrorObservable.clear(),this._fallbacks&&this._fallbacks.unBindMesh())):(this._allFallbacksProcessed=!0,i||f())},Object.defineProperty(e.prototype,\"isSupported\",{get:function(){return\"\"===this._compilationError},enumerable:!1,configurable:!0}),e.prototype._bindTexture=function(e,t){this._engine._bindTexture(this._samplers[e],t,e)},e.prototype.setTexture=function(e,t){this._engine.setTexture(this._samplers[e],this._uniforms[e],t,e)},e.prototype.setDepthStencilTexture=function(e,t){this._engine.setDepthStencilTexture(this._samplers[e],this._uniforms[e],t,e)},e.prototype.setTextureArray=function(e,t){var i=e+\"Ex\";if(-1===this._samplerList.indexOf(i+\"0\")){for(var n=this._samplerList.indexOf(e),r=1;r0&&parseInt(g[g.length-1])>=m)continue}for(var v=0,y=f;v1?new Ut:new Bt,this._badOS=/iPad/i.test(navigator.userAgent)||/iPhone/i.test(navigator.userAgent);var R=\"Babylon.js v\".concat(e.Version);console.log(R+\" - \".concat(this.description)),this._renderingCanvas&&this._renderingCanvas.setAttribute&&this._renderingCanvas.setAttribute(\"data-engine\",R)}}return Object.defineProperty(e,\"NpmPackage\",{get:function(){return\"babylonjs@5.26.1\"},enumerable:!1,configurable:!0}),Object.defineProperty(e,\"Version\",{get:function(){return\"5.26.1\"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"description\",{get:function(){var e=this.name+this.webGLVersion;return this._caps.parallelShaderCompile&&(e+=\" - Parallel shader compilation\"),e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"name\",{get:function(){return this._name},set:function(e){this._name=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"version\",{get:function(){return this._webGLVersion},enumerable:!1,configurable:!0}),Object.defineProperty(e,\"ShadersRepository\",{get:function(){return Ot.ShadersRepository},set:function(e){Ot.ShadersRepository=e},enumerable:!1,configurable:!0}),e.prototype._getShaderProcessor=function(e){return this._shaderProcessor},Object.defineProperty(e.prototype,\"useReverseDepthBuffer\",{get:function(){return this._useReverseDepthBuffer},set:function(e){e!==this._useReverseDepthBuffer&&(this._useReverseDepthBuffer=e,this._depthCullingState.depthFunc=e?a.GEQUAL:a.LEQUAL)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"frameId\",{get:function(){return this._frameId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"supportsUniformBuffers\",{get:function(){return this.webGLVersion>1&&!this.disableUniformBuffers},enumerable:!1,configurable:!0}),e.prototype.getCreationOptions=function(){return this._creationOptions},Object.defineProperty(e.prototype,\"_shouldUseHighPrecisionShader\",{get:function(){return!(!this._caps.highPrecisionShaderSupported||!this._highPrecisionShadersAllowed)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"needPOTTextures\",{get:function(){return this._webGLVersion<2||this.forcePOTTextures},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"activeRenderLoops\",{get:function(){return this._activeRenderLoops},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"doNotHandleContextLost\",{get:function(){return this._doNotHandleContextLost},set:function(e){this._doNotHandleContextLost=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"_supportsHardwareTextureRescaling\",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"framebufferDimensionsObject\",{set:function(e){this._framebufferDimensionsObject=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"currentViewport\",{get:function(){return this._cachedViewport},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"emptyTexture\",{get:function(){return this._emptyTexture||(this._emptyTexture=this.createRawTexture(new Uint8Array(4),1,1,a.TEXTUREFORMAT_RGBA,!1,!1,a.TEXTURE_NEAREST_SAMPLINGMODE)),this._emptyTexture},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"emptyTexture3D\",{get:function(){return this._emptyTexture3D||(this._emptyTexture3D=this.createRawTexture3D(new Uint8Array(4),1,1,1,a.TEXTUREFORMAT_RGBA,!1,!1,a.TEXTURE_NEAREST_SAMPLINGMODE)),this._emptyTexture3D},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"emptyTexture2DArray\",{get:function(){return this._emptyTexture2DArray||(this._emptyTexture2DArray=this.createRawTexture2DArray(new Uint8Array(4),1,1,1,a.TEXTUREFORMAT_RGBA,!1,!1,a.TEXTURE_NEAREST_SAMPLINGMODE)),this._emptyTexture2DArray},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"emptyCubeTexture\",{get:function(){if(!this._emptyCubeTexture){var e=new Uint8Array(4),t=[e,e,e,e,e,e];this._emptyCubeTexture=this.createRawCubeTexture(t,1,a.TEXTUREFORMAT_RGBA,a.TEXTURETYPE_UNSIGNED_INT,!1,!1,a.TEXTURE_NEAREST_SAMPLINGMODE)}return this._emptyCubeTexture},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"isWebGPU\",{get:function(){return this._isWebGPU},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"shaderPlatformName\",{get:function(){return this._shaderPlatformName},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"snapshotRendering\",{get:function(){return!1},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"snapshotRenderingMode\",{get:function(){return this._snapshotRenderingMode},set:function(e){this._snapshotRenderingMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"useExactSrgbConversions\",{get:function(){return this._useExactSrgbConversions},enumerable:!1,configurable:!0}),e.prototype.snapshotRenderingReset=function(){this.snapshotRendering=!1},e._CreateCanvas=function(e,t){if(\"undefined\"==typeof document)return new OffscreenCanvas(e,t);var i=document.createElement(\"canvas\");return i.width=e,i.height=t,i},e.prototype.createCanvas=function(t,i){return e._CreateCanvas(t,i)},e.prototype.createCanvasImage=function(){return document.createElement(\"img\")},e.prototype._restoreEngineAfterContextLost=function(e){var t=this;setTimeout((function(){return z(t,void 0,void 0,(function(){var t,i,n,r,o;return W(this,(function(a){switch(a.label){case 0:return this._dummyFramebuffer=null,t=this._depthCullingState.depthTest,i=this._depthCullingState.depthFunc,n=this._depthCullingState.depthMask,r=this._stencilState.stencilTest,[4,e()];case 1:return a.sent(),this._rebuildEffects(),null===(o=this._rebuildComputeEffects)||void 0===o||o.call(this),this._rebuildInternalTextures(),this._rebuildRenderTargetWrappers(),this._rebuildBuffers(),this.wipeCaches(!0),this._depthCullingState.depthTest=t,this._depthCullingState.depthFunc=i,this._depthCullingState.depthMask=n,this._stencilState.stencilTest=r,Q.Warn(this.name+\" context successfully restored.\"),this.onContextRestoredObservable.notifyObservers(this),this._contextWasLost=!1,[2]}}))}))}),0)},e.prototype._sharedInit=function(e,t,i){this._renderingCanvas=e},e.prototype._getShaderProcessingContext=function(e){return null},e.prototype._rebuildInternalTextures=function(){for(var e=0,t=this._internalTexturesCache.slice();e1?this._gl.getParameter(this._gl.MAX_SAMPLES):1,maxCubemapTextureSize:this._gl.getParameter(this._gl.MAX_CUBE_MAP_TEXTURE_SIZE),maxRenderTextureSize:this._gl.getParameter(this._gl.MAX_RENDERBUFFER_SIZE),maxVertexAttribs:this._gl.getParameter(this._gl.MAX_VERTEX_ATTRIBS),maxVaryingVectors:this._gl.getParameter(this._gl.MAX_VARYING_VECTORS),maxFragmentUniformVectors:this._gl.getParameter(this._gl.MAX_FRAGMENT_UNIFORM_VECTORS),maxVertexUniformVectors:this._gl.getParameter(this._gl.MAX_VERTEX_UNIFORM_VECTORS),parallelShaderCompile:this._gl.getExtension(\"KHR_parallel_shader_compile\")||void 0,standardDerivatives:this._webGLVersion>1||null!==this._gl.getExtension(\"OES_standard_derivatives\"),maxAnisotropy:1,astc:this._gl.getExtension(\"WEBGL_compressed_texture_astc\")||this._gl.getExtension(\"WEBKIT_WEBGL_compressed_texture_astc\"),bptc:this._gl.getExtension(\"EXT_texture_compression_bptc\")||this._gl.getExtension(\"WEBKIT_EXT_texture_compression_bptc\"),s3tc:this._gl.getExtension(\"WEBGL_compressed_texture_s3tc\")||this._gl.getExtension(\"WEBKIT_WEBGL_compressed_texture_s3tc\"),s3tc_srgb:this._gl.getExtension(\"WEBGL_compressed_texture_s3tc_srgb\")||this._gl.getExtension(\"WEBKIT_WEBGL_compressed_texture_s3tc_srgb\"),pvrtc:this._gl.getExtension(\"WEBGL_compressed_texture_pvrtc\")||this._gl.getExtension(\"WEBKIT_WEBGL_compressed_texture_pvrtc\"),etc1:this._gl.getExtension(\"WEBGL_compressed_texture_etc1\")||this._gl.getExtension(\"WEBKIT_WEBGL_compressed_texture_etc1\"),etc2:this._gl.getExtension(\"WEBGL_compressed_texture_etc\")||this._gl.getExtension(\"WEBKIT_WEBGL_compressed_texture_etc\")||this._gl.getExtension(\"WEBGL_compressed_texture_es3_0\"),textureAnisotropicFilterExtension:this._gl.getExtension(\"EXT_texture_filter_anisotropic\")||this._gl.getExtension(\"WEBKIT_EXT_texture_filter_anisotropic\")||this._gl.getExtension(\"MOZ_EXT_texture_filter_anisotropic\"),uintIndices:this._webGLVersion>1||null!==this._gl.getExtension(\"OES_element_index_uint\"),fragmentDepthSupported:this._webGLVersion>1||null!==this._gl.getExtension(\"EXT_frag_depth\"),highPrecisionShaderSupported:!1,timerQuery:this._gl.getExtension(\"EXT_disjoint_timer_query_webgl2\")||this._gl.getExtension(\"EXT_disjoint_timer_query\"),supportOcclusionQuery:this._webGLVersion>1,canUseTimestampForTimerQuery:!1,drawBuffersExtension:!1,maxMSAASamples:1,colorBufferFloat:!!(this._webGLVersion>1&&this._gl.getExtension(\"EXT_color_buffer_float\")),textureFloat:!!(this._webGLVersion>1||this._gl.getExtension(\"OES_texture_float\")),textureHalfFloat:!!(this._webGLVersion>1||this._gl.getExtension(\"OES_texture_half_float\")),textureHalfFloatRender:!1,textureFloatLinearFiltering:!1,textureFloatRender:!1,textureHalfFloatLinearFiltering:!1,vertexArrayObject:!1,instancedArrays:!1,textureLOD:!!(this._webGLVersion>1||this._gl.getExtension(\"EXT_shader_texture_lod\")),blendMinMax:!1,multiview:this._gl.getExtension(\"OVR_multiview2\"),oculusMultiview:this._gl.getExtension(\"OCULUS_multiview\"),depthTextureExtension:!1,canUseGLInstanceID:this._webGLVersion>1,canUseGLVertexID:this._webGLVersion>1,supportComputeShaders:!1,supportSRGBBuffers:!1,supportTransformFeedbacks:this._webGLVersion>1,textureMaxLevel:this._webGLVersion>1,texture2DArrayMaxLayerCount:this._webGLVersion>1?256:128},this._glVersion=this._gl.getParameter(this._gl.VERSION);var t=this._gl.getExtension(\"WEBGL_debug_renderer_info\");if(null!=t&&(this._glRenderer=this._gl.getParameter(t.UNMASKED_RENDERER_WEBGL),this._glVendor=this._gl.getParameter(t.UNMASKED_VENDOR_WEBGL)),this._glVendor||(this._glVendor=this._gl.getParameter(this._gl.VENDOR)||\"Unknown vendor\"),this._glRenderer||(this._glRenderer=this._gl.getParameter(this._gl.RENDERER)||\"Unknown renderer\"),36193!==this._gl.HALF_FLOAT_OES&&(this._gl.HALF_FLOAT_OES=36193),34842!==this._gl.RGBA16F&&(this._gl.RGBA16F=34842),34836!==this._gl.RGBA32F&&(this._gl.RGBA32F=34836),35056!==this._gl.DEPTH24_STENCIL8&&(this._gl.DEPTH24_STENCIL8=35056),this._caps.timerQuery&&(1===this._webGLVersion&&(this._gl.getQuery=this._caps.timerQuery.getQueryEXT.bind(this._caps.timerQuery)),this._caps.canUseTimestampForTimerQuery=(null!==(e=this._gl.getQuery(this._caps.timerQuery.TIMESTAMP_EXT,this._caps.timerQuery.QUERY_COUNTER_BITS_EXT))&&void 0!==e?e:0)>0),this._caps.maxAnisotropy=this._caps.textureAnisotropicFilterExtension?this._gl.getParameter(this._caps.textureAnisotropicFilterExtension.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,this._caps.textureFloatLinearFiltering=!(!this._caps.textureFloat||!this._gl.getExtension(\"OES_texture_float_linear\")),this._caps.textureFloatRender=!(!this._caps.textureFloat||!this._canRenderToFloatFramebuffer()),this._caps.textureHalfFloatLinearFiltering=!!(this._webGLVersion>1||this._caps.textureHalfFloat&&this._gl.getExtension(\"OES_texture_half_float_linear\")),this._caps.astc&&(this._gl.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=this._caps.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR),this._caps.bptc&&(this._gl.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=this._caps.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT),this._caps.s3tc_srgb&&(this._gl.COMPRESSED_SRGB_S3TC_DXT1_EXT=this._caps.s3tc_srgb.COMPRESSED_SRGB_S3TC_DXT1_EXT,this._gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=this._caps.s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,this._gl.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=this._caps.s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT),this._caps.etc2&&(this._gl.COMPRESSED_SRGB8_ETC2=this._caps.etc2.COMPRESSED_SRGB8_ETC2,this._gl.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=this._caps.etc2.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC),this._webGLVersion>1&&5131!==this._gl.HALF_FLOAT_OES&&(this._gl.HALF_FLOAT_OES=5131),this._caps.textureHalfFloatRender=this._caps.textureHalfFloat&&this._canRenderToHalfFloatFramebuffer(),this._webGLVersion>1)this._caps.drawBuffersExtension=!0,this._caps.maxMSAASamples=null!==this._maxMSAASamplesOverride?this._maxMSAASamplesOverride:this._gl.getParameter(this._gl.MAX_SAMPLES);else{var i=this._gl.getExtension(\"WEBGL_draw_buffers\");if(null!==i){this._caps.drawBuffersExtension=!0,this._gl.drawBuffers=i.drawBuffersWEBGL.bind(i),this._gl.DRAW_FRAMEBUFFER=this._gl.FRAMEBUFFER;for(var n=0;n<16;n++)this._gl[\"COLOR_ATTACHMENT\"+n+\"_WEBGL\"]=i[\"COLOR_ATTACHMENT\"+n+\"_WEBGL\"]}}if(this._webGLVersion>1)this._caps.depthTextureExtension=!0;else{var r=this._gl.getExtension(\"WEBGL_depth_texture\");null!=r&&(this._caps.depthTextureExtension=!0,this._gl.UNSIGNED_INT_24_8=r.UNSIGNED_INT_24_8_WEBGL)}if(this.disableVertexArrayObjects)this._caps.vertexArrayObject=!1;else if(this._webGLVersion>1)this._caps.vertexArrayObject=!0;else{var o=this._gl.getExtension(\"OES_vertex_array_object\");null!=o&&(this._caps.vertexArrayObject=!0,this._gl.createVertexArray=o.createVertexArrayOES.bind(o),this._gl.bindVertexArray=o.bindVertexArrayOES.bind(o),this._gl.deleteVertexArray=o.deleteVertexArrayOES.bind(o))}if(this._webGLVersion>1)this._caps.instancedArrays=!0;else{var a=this._gl.getExtension(\"ANGLE_instanced_arrays\");null!=a?(this._caps.instancedArrays=!0,this._gl.drawArraysInstanced=a.drawArraysInstancedANGLE.bind(a),this._gl.drawElementsInstanced=a.drawElementsInstancedANGLE.bind(a),this._gl.vertexAttribDivisor=a.vertexAttribDivisorANGLE.bind(a)):this._caps.instancedArrays=!1}if(this._gl.getShaderPrecisionFormat){var s=this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER,this._gl.HIGH_FLOAT),l=this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER,this._gl.HIGH_FLOAT);s&&l&&(this._caps.highPrecisionShaderSupported=0!==s.precision&&0!==l.precision)}if(this._webGLVersion>1)this._caps.blendMinMax=!0;else{var c=this._gl.getExtension(\"EXT_blend_minmax\");null!=c&&(this._caps.blendMinMax=!0,this._gl.MAX=c.MAX_EXT,this._gl.MIN=c.MIN_EXT)}if(!this._caps.supportSRGBBuffers){if(this._webGLVersion>1)this._caps.supportSRGBBuffers=!0;else{var u=this._gl.getExtension(\"EXT_sRGB\");null!=u&&(this._caps.supportSRGBBuffers=!0,this._gl.SRGB=u.SRGB_EXT,this._gl.SRGB8=u.SRGB_ALPHA_EXT,this._gl.SRGB8_ALPHA8=u.SRGB_ALPHA_EXT)}this._caps.supportSRGBBuffers=this._caps.supportSRGBBuffers&&!(!this._creationOptions||!this._creationOptions.forceSRGBBufferSupportState)}this._depthCullingState.depthTest=!0,this._depthCullingState.depthFunc=this._gl.LEQUAL,this._depthCullingState.depthMask=!0,this._maxSimultaneousTextures=this._caps.maxCombinedTexturesImageUnits;for(var h=0;h=0&&this._activeRenderLoops.splice(t,1)}else this._activeRenderLoops=[]},e.prototype._renderLoop=function(){if(!this._contextWasLost){var e=!0;if(!this.renderEvenInBackground&&this._windowIsBackground&&(e=!1),e){this.beginFrame();for(var t=0;t0?this._frameHandler=this._queueNewFrame(this._boundRenderFunction,this.getHostWindow()):this._renderingQueueLaunched=!1},e.prototype.getRenderingCanvas=function(){return this._renderingCanvas},e.prototype.getAudioContext=function(){return this._audioContext},e.prototype.getAudioDestination=function(){return this._audioDestination},e.prototype.getHostWindow=function(){return qe()?this._renderingCanvas&&this._renderingCanvas.ownerDocument&&this._renderingCanvas.ownerDocument.defaultView?this._renderingCanvas.ownerDocument.defaultView:window:null},e.prototype.getRenderWidth=function(e){return void 0===e&&(e=!1),!e&&this._currentRenderTarget?this._currentRenderTarget.width:this._framebufferDimensionsObject?this._framebufferDimensionsObject.framebufferWidth:this._gl.drawingBufferWidth},e.prototype.getRenderHeight=function(e){return void 0===e&&(e=!1),!e&&this._currentRenderTarget?this._currentRenderTarget.height:this._framebufferDimensionsObject?this._framebufferDimensionsObject.framebufferHeight:this._gl.drawingBufferHeight},e.prototype._queueNewFrame=function(t,i){return e.QueueNewFrame(t,i)},e.prototype.runRenderLoop=function(e){-1===this._activeRenderLoops.indexOf(e)&&(this._activeRenderLoops.push(e),this._renderingQueueLaunched||(this._renderingQueueLaunched=!0,this._boundRenderFunction=this._renderLoop.bind(this),this._frameHandler=this._queueNewFrame(this._boundRenderFunction,this.getHostWindow())))},e.prototype.clear=function(e,t,i,n){void 0===n&&(n=!1);var r=this.stencilStateComposer.useStencilGlobalOnly;this.stencilStateComposer.useStencilGlobalOnly=!0,this.applyStates(),this.stencilStateComposer.useStencilGlobalOnly=r;var o=0;t&&e&&(this._gl.clearColor(e.r,e.g,e.b,void 0!==e.a?e.a:1),o|=this._gl.COLOR_BUFFER_BIT),i&&(this.useReverseDepthBuffer?(this._depthCullingState.depthFunc=this._gl.GEQUAL,this._gl.clearDepth(0)):this._gl.clearDepth(1),o|=this._gl.DEPTH_BUFFER_BIT),n&&(this._gl.clearStencil(0),o|=this._gl.STENCIL_BUFFER_BIT),this._gl.clear(o)},e.prototype._viewport=function(e,t,i,n){e===this._viewportCached.x&&t===this._viewportCached.y&&i===this._viewportCached.z&&n===this._viewportCached.w||(this._viewportCached.x=e,this._viewportCached.y=t,this._viewportCached.z=i,this._viewportCached.w=n,this._gl.viewport(e,t,i,n))},e.prototype.setViewport=function(e,t,i){var n=t||this.getRenderWidth(),r=i||this.getRenderHeight(),o=e.x||0,a=e.y||0;this._cachedViewport=e,this._viewport(o*n,a*r,n*e.width,r*e.height)},e.prototype.beginFrame=function(){},e.prototype.endFrame=function(){this._badOS&&this.flushFramebuffer(),this._frameId++},e.prototype.resize=function(e){var t,i;if(void 0===e&&(e=!1),this.adaptToDeviceRatio){var n=qe()&&window.devicePixelRatio||1,r=this._lastDevicePixelRatio/n;this._lastDevicePixelRatio=n,this._hardwareScalingLevel*=r}qe()?(t=this._renderingCanvas?this._renderingCanvas.clientWidth||this._renderingCanvas.width:window.innerWidth,i=this._renderingCanvas?this._renderingCanvas.clientHeight||this._renderingCanvas.height:window.innerHeight):(t=this._renderingCanvas?this._renderingCanvas.width:100,i=this._renderingCanvas?this._renderingCanvas.height:100),this.setSize(t/this._hardwareScalingLevel,i/this._hardwareScalingLevel,e)},e.prototype.setSize=function(e,t,i){return void 0===i&&(i=!1),!(!this._renderingCanvas||(e|=0,t|=0,!i&&this._renderingCanvas.width===e&&this._renderingCanvas.height===t||(this._renderingCanvas.width=e,this._renderingCanvas.height=t,0)))},e.prototype.bindFramebuffer=function(e,t,i,n,r,o,a){var s,l,c,u,h;void 0===t&&(t=0),void 0===o&&(o=0),void 0===a&&(a=0);var d=e;this._currentRenderTarget&&this.unBindFramebuffer(this._currentRenderTarget),this._currentRenderTarget=e,this._bindUnboundFramebuffer(d._MSAAFramebuffer?d._MSAAFramebuffer:d._framebuffer);var p=this._gl;e.is2DArray?p.framebufferTextureLayer(p.FRAMEBUFFER,p.COLOR_ATTACHMENT0,null===(s=e.texture._hardwareTexture)||void 0===s?void 0:s.underlyingResource,o,a):e.isCube&&p.framebufferTexture2D(p.FRAMEBUFFER,p.COLOR_ATTACHMENT0,p.TEXTURE_CUBE_MAP_POSITIVE_X+t,null===(l=e.texture._hardwareTexture)||void 0===l?void 0:l.underlyingResource,o);var f=e._depthStencilTexture;if(f){var _=e._depthStencilTextureWithStencil?p.DEPTH_STENCIL_ATTACHMENT:p.DEPTH_ATTACHMENT;e.is2DArray?p.framebufferTextureLayer(p.FRAMEBUFFER,_,null===(c=f._hardwareTexture)||void 0===c?void 0:c.underlyingResource,o,a):e.isCube?p.framebufferTexture2D(p.FRAMEBUFFER,_,p.TEXTURE_CUBE_MAP_POSITIVE_X+t,null===(u=f._hardwareTexture)||void 0===u?void 0:u.underlyingResource,o):p.framebufferTexture2D(p.FRAMEBUFFER,_,p.TEXTURE_2D,null===(h=f._hardwareTexture)||void 0===h?void 0:h.underlyingResource,o)}this._cachedViewport&&!r?this.setViewport(this._cachedViewport,i,n):(i||(i=e.width,o&&(i/=Math.pow(2,o))),n||(n=e.height,o&&(n/=Math.pow(2,o))),this._viewport(0,0,i,n)),this.wipeCaches()},e.prototype.setState=function(e,t,i,n,r,o,a){var s,l;void 0===t&&(t=0),void 0===n&&(n=!1),void 0===a&&(a=0),(this._depthCullingState.cull!==e||i)&&(this._depthCullingState.cull=e);var c=null===(l=null!==(s=this.cullBackFaces)&&void 0!==s?s:r)||void 0===l||l?this._gl.BACK:this._gl.FRONT;(this._depthCullingState.cullFace!==c||i)&&(this._depthCullingState.cullFace=c),this.setZOffset(t),this.setZOffsetUnits(a);var u=n?this._gl.CW:this._gl.CCW;(this._depthCullingState.frontFace!==u||i)&&(this._depthCullingState.frontFace=u),this._stencilStateComposer.stencilMaterial=o},e.prototype.getDepthBuffer=function(){return this._depthCullingState.depthTest},e.prototype.setDepthBuffer=function(e){this._depthCullingState.depthTest=e},e.prototype.setZOffset=function(e){this._depthCullingState.zOffset=this.useReverseDepthBuffer?-e:e},e.prototype.getZOffset=function(){var e=this._depthCullingState.zOffset;return this.useReverseDepthBuffer?-e:e},e.prototype.setZOffsetUnits=function(e){this._depthCullingState.zOffsetUnits=this.useReverseDepthBuffer?-e:e},e.prototype.getZOffsetUnits=function(){var e=this._depthCullingState.zOffsetUnits;return this.useReverseDepthBuffer?-e:e},e.prototype._bindUnboundFramebuffer=function(e){this._currentFramebuffer!==e&&(this._gl.bindFramebuffer(this._gl.FRAMEBUFFER,e),this._currentFramebuffer=e)},e.prototype._currentFrameBufferIsDefaultFrameBuffer=function(){return null===this._currentFramebuffer},e.prototype.generateMipmaps=function(e){this._bindTextureDirectly(this._gl.TEXTURE_2D,e,!0),this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(this._gl.TEXTURE_2D,null)},e.prototype.unBindFramebuffer=function(e,t,i){var n;void 0===t&&(t=!1);var r=e;this._currentRenderTarget=null;var o=this._gl;if(r._MSAAFramebuffer){if(e.isMulti)return void this.unBindMultiColorAttachmentFramebuffer(e,t,i);o.bindFramebuffer(o.READ_FRAMEBUFFER,r._MSAAFramebuffer),o.bindFramebuffer(o.DRAW_FRAMEBUFFER,r._framebuffer),o.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,o.COLOR_BUFFER_BIT,o.NEAREST)}!(null===(n=e.texture)||void 0===n?void 0:n.generateMipMaps)||t||e.isCube||this.generateMipmaps(e.texture),i&&(r._MSAAFramebuffer&&this._bindUnboundFramebuffer(r._framebuffer),i()),this._bindUnboundFramebuffer(null)},e.prototype.flushFramebuffer=function(){this._gl.flush()},e.prototype.restoreDefaultFramebuffer=function(){this._currentRenderTarget?this.unBindFramebuffer(this._currentRenderTarget):this._bindUnboundFramebuffer(null),this._cachedViewport&&this.setViewport(this._cachedViewport),this.wipeCaches()},e.prototype._resetVertexBufferBinding=function(){this.bindArrayBuffer(null),this._cachedVertexBuffers=null},e.prototype.createVertexBuffer=function(e){return this._createVertexBuffer(e,this._gl.STATIC_DRAW)},e.prototype._createVertexBuffer=function(e,t){var i=this._gl.createBuffer();if(!i)throw new Error(\"Unable to create vertex buffer\");var n=new kt(i);return this.bindArrayBuffer(n),e instanceof Array?this._gl.bufferData(this._gl.ARRAY_BUFFER,new Float32Array(e),t):this._gl.bufferData(this._gl.ARRAY_BUFFER,e,t),this._resetVertexBufferBinding(),n.references=1,n},e.prototype.createDynamicVertexBuffer=function(e){return this._createVertexBuffer(e,this._gl.DYNAMIC_DRAW)},e.prototype._resetIndexBufferBinding=function(){this.bindIndexBuffer(null),this._cachedIndexBuffer=null},e.prototype.createIndexBuffer=function(e,t){var i=this._gl.createBuffer(),n=new kt(i);if(!i)throw new Error(\"Unable to create index buffer\");this.bindIndexBuffer(n);var r=this._normalizeIndexData(e);return this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,r,t?this._gl.DYNAMIC_DRAW:this._gl.STATIC_DRAW),this._resetIndexBufferBinding(),n.references=1,n.is32Bits=4===r.BYTES_PER_ELEMENT,n},e.prototype._normalizeIndexData=function(e){if(2===e.BYTES_PER_ELEMENT)return e;if(this._caps.uintIndices){if(e instanceof Uint32Array)return e;for(var t=0;t=65535)return new Uint32Array(e);return new Uint16Array(e)}return new Uint16Array(e)},e.prototype.bindArrayBuffer=function(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this._bindBuffer(e,this._gl.ARRAY_BUFFER)},e.prototype.bindUniformBlock=function(e,t,i){var n=e.program,r=this._gl.getUniformBlockIndex(n,t);this._gl.uniformBlockBinding(n,r,i)},e.prototype.bindIndexBuffer=function(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this._bindBuffer(e,this._gl.ELEMENT_ARRAY_BUFFER)},e.prototype._bindBuffer=function(e,t){(this._vaoRecordInProgress||this._currentBoundBuffer[t]!==e)&&(this._gl.bindBuffer(t,e?e.underlyingResource:null),this._currentBoundBuffer[t]=e)},e.prototype.updateArrayBuffer=function(e){this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,e)},e.prototype._vertexAttribPointer=function(e,t,i,n,r,o,a){var s=this._currentBufferPointers[t];if(s){var l=!1;s.active?(s.buffer!==e&&(s.buffer=e,l=!0),s.size!==i&&(s.size=i,l=!0),s.type!==n&&(s.type=n,l=!0),s.normalized!==r&&(s.normalized=r,l=!0),s.stride!==o&&(s.stride=o,l=!0),s.offset!==a&&(s.offset=a,l=!0)):(l=!0,s.active=!0,s.index=t,s.size=i,s.type=n,s.normalized=r,s.stride=o,s.offset=a,s.buffer=e),(l||this._vaoRecordInProgress)&&(this.bindArrayBuffer(e),n===this._gl.UNSIGNED_INT||n===this._gl.INT?this._gl.vertexAttribIPointer(t,i,n,o,a):this._gl.vertexAttribPointer(t,i,n,r,o,a))}},e.prototype._bindIndexBufferWithCache=function(e){null!=e&&this._cachedIndexBuffer!==e&&(this._cachedIndexBuffer=e,this.bindIndexBuffer(e),this._uintIndicesCurrentlySet=e.is32Bits)},e.prototype._bindVertexBuffersAttributes=function(e,t,i){var n=t.getAttributesNames();this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.unbindAllAttributes();for(var r=0;r=0){var a=n[r],s=null;if(i&&(s=i[a]),s||(s=e[a]),!s)continue;this._gl.enableVertexAttribArray(o),this._vaoRecordInProgress||(this._vertexAttribArraysEnabled[o]=!0);var l=s.getBuffer();l&&(this._vertexAttribPointer(l,o,s.getSize(),s.type,s.normalized,s.byteStride,s.byteOffset),s.getIsInstanced()&&(this._gl.vertexAttribDivisor(o,s.getInstanceDivisor()),this._vaoRecordInProgress||(this._currentInstanceLocations.push(o),this._currentInstanceBuffers.push(l))))}}},e.prototype.recordVertexArrayObject=function(e,t,i,n){var r=this._gl.createVertexArray();if(!r)throw new Error(\"Unable to create VAO\");return this._vaoRecordInProgress=!0,this._gl.bindVertexArray(r),this._mustWipeVertexAttributes=!0,this._bindVertexBuffersAttributes(e,i,n),this.bindIndexBuffer(t),this._vaoRecordInProgress=!1,this._gl.bindVertexArray(null),r},e.prototype.bindVertexArrayObject=function(e,t){this._cachedVertexArrayObject!==e&&(this._cachedVertexArrayObject=e,this._gl.bindVertexArray(e),this._cachedVertexBuffers=null,this._cachedIndexBuffer=null,this._uintIndicesCurrentlySet=null!=t&&t.is32Bits,this._mustWipeVertexAttributes=!0)},e.prototype.bindBuffersDirectly=function(e,t,i,n,r){if(this._cachedVertexBuffers!==e||this._cachedEffectForVertexBuffers!==r){this._cachedVertexBuffers=e,this._cachedEffectForVertexBuffers=r;var o=r.getAttributesCount();this._unbindVertexArrayObject(),this.unbindAllAttributes();for(var a=0,s=0;s=0&&(this._gl.enableVertexAttribArray(l),this._vertexAttribArraysEnabled[l]=!0,this._vertexAttribPointer(e,l,i[s],this._gl.FLOAT,!1,n,a)),a+=4*i[s]}}this._bindIndexBufferWithCache(t)},e.prototype._unbindVertexArrayObject=function(){this._cachedVertexArrayObject&&(this._cachedVertexArrayObject=null,this._gl.bindVertexArray(null))},e.prototype.bindBuffers=function(e,t,i,n){this._cachedVertexBuffers===e&&this._cachedEffectForVertexBuffers===i||(this._cachedVertexBuffers=e,this._cachedEffectForVertexBuffers=i,this._bindVertexBuffersAttributes(e,i,n)),this._bindIndexBufferWithCache(t)},e.prototype.unbindInstanceAttributes=function(){for(var e,t=0,i=this._currentInstanceLocations.length;t1?\"#version 300 es\\n#define WEBGL2 \\n\":\"\",s=this._compileShader(t,\"vertex\",n,a),l=this._compileShader(i,\"fragment\",n,a);return this._createShaderProgram(e,s,l,r,o)},e.prototype.inlineShaderCode=function(e){return e},e.prototype.createPipelineContext=function(e){var t=new zt;return t.engine=this,this._caps.parallelShaderCompile&&(t.isParallelCompiled=!0),t},e.prototype.createMaterialContext=function(){},e.prototype.createDrawContext=function(){},e.prototype._createShaderProgram=function(e,t,i,n,r){void 0===r&&(r=null);var o=n.createProgram();if(e.program=o,!o)throw new Error(\"Unable to create program\");return n.attachShader(o,t),n.attachShader(o,i),n.linkProgram(o),e.context=n,e.vertexShader=t,e.fragmentShader=i,e.isParallelCompiled||this._finalizePipelineContext(e),o},e.prototype._finalizePipelineContext=function(e){var t=e.context,i=e.vertexShader,n=e.fragmentShader,r=e.program;if(!t.getProgramParameter(r,t.LINK_STATUS)){var o,a;if(!this._gl.getShaderParameter(i,this._gl.COMPILE_STATUS)&&(o=this._gl.getShaderInfoLog(i)))throw e.vertexCompilationError=o,new Error(\"VERTEX SHADER \"+o);if(!this._gl.getShaderParameter(n,this._gl.COMPILE_STATUS)&&(o=this._gl.getShaderInfoLog(n)))throw e.fragmentCompilationError=o,new Error(\"FRAGMENT SHADER \"+o);if(a=t.getProgramInfoLog(r))throw e.programLinkError=a,new Error(a)}if(this.validateShaderPrograms&&(t.validateProgram(r),!t.getProgramParameter(r,t.VALIDATE_STATUS)&&(a=t.getProgramInfoLog(r))))throw e.programValidationError=a,new Error(a);t.deleteShader(i),t.deleteShader(n),e.vertexShader=void 0,e.fragmentShader=void 0,e.onCompiled&&(e.onCompiled(),e.onCompiled=void 0)},e.prototype._preparePipelineContext=function(e,t,i,n,r,o,a,s,l,c){var u=e;u.program=n?this.createRawShaderProgram(u,t,i,void 0,l):this.createShaderProgram(u,t,i,s,void 0,l),u.program.__SPECTOR_rebuildProgram=a},e.prototype._isRenderingStateCompiled=function(e){var t=e;return!!this._gl.getProgramParameter(t.program,this._caps.parallelShaderCompile.COMPLETION_STATUS_KHR)&&(this._finalizePipelineContext(t),!0)},e.prototype._executeWhenRenderingStateIsCompiled=function(e,t){var i=e;if(i.isParallelCompiled){var n=i.onCompiled;i.onCompiled=n?function(){n(),t()}:t}else t()},e.prototype.getUniforms=function(e,t){for(var i=new Array,n=e,r=0;r1||this.isWebGPU),(r.type!==a.TEXTURETYPE_FLOAT||this._caps.textureFloatLinearFiltering)&&(r.type!==a.TEXTURETYPE_HALF_FLOAT||this._caps.textureHalfFloatLinearFiltering)||(r.samplingMode=a.TEXTURE_NEAREST_SAMPLINGMODE),r.type!==a.TEXTURETYPE_FLOAT||this._caps.textureFloat||(r.type=a.TEXTURETYPE_UNSIGNED_INT,Q.Warn(\"Float textures are not supported. Type forced to TEXTURETYPE_UNSIGNED_BYTE\"));var o=this._gl,s=new wt(this,n);s._useSRGBBuffer=!!r.useSRGBBuffer;var l=e.width||e,c=e.height||e,u=e.layers||0,h=this._getSamplingParameters(r.samplingMode,!!r.generateMipMaps),d=0!==u?o.TEXTURE_2D_ARRAY:o.TEXTURE_2D,p=this._getRGBABufferInternalSizedFormat(r.type,r.format,r.useSRGBBuffer),f=this._getInternalFormat(r.format),_=this._getWebGLTextureType(r.type);return this._bindTextureDirectly(d,s),0!==u?(s.is2DArray=!0,o.texImage3D(d,0,p,l,c,u,0,f,_,null)):o.texImage2D(d,0,p,l,c,0,f,_,null),o.texParameteri(d,o.TEXTURE_MAG_FILTER,h.mag),o.texParameteri(d,o.TEXTURE_MIN_FILTER,h.min),o.texParameteri(d,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(d,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),r.generateMipMaps&&this._gl.generateMipmap(d),this._bindTextureDirectly(d,null),s.baseWidth=l,s.baseHeight=c,s.width=l,s.height=c,s.depth=u,s.isReady=!0,s.samples=1,s.generateMipMaps=!!r.generateMipMaps,s.samplingMode=r.samplingMode,s.type=r.type,s.format=r.format,this._internalTexturesCache.push(s),s},e.prototype._getUseSRGBBuffer=function(e,t){return e&&this._caps.supportSRGBBuffers&&(this.webGLVersion>1||this.isWebGPU||t)},e.prototype._createTextureBase=function(t,i,n,r,o,s,l,c,u,h,d,p,f,_,m,g){var v=this;void 0===o&&(o=a.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===s&&(s=null),void 0===l&&(l=null),void 0===h&&(h=null),void 0===d&&(d=null),void 0===p&&(p=null),void 0===f&&(f=null);var y=\"data:\"===(t=t||\"\").substr(0,5),b=\"blob:\"===t.substr(0,5),T=y&&-1!==t.indexOf(\";base64,\"),E=d||new wt(this,Rt.Url),A=t;!this._transformTextureUrl||T||d||h||(t=this._transformTextureUrl(t)),A!==t&&(E._originalUrl=A);var R=t.lastIndexOf(\".\"),x=f||(R>-1?t.substring(R).toLowerCase():\"\"),C=null;x.indexOf(\"?\")>-1&&(x=x.split(\"?\")[0]);for(var P=0,M=e._TextureLoaders;Pd||i.height>d||!m._supportsHardwareTextureRescaling)return m._prepareWorkingCanvas(),!(!m._workingCanvas||!m._workingContext||(m._workingCanvas.width=e,m._workingCanvas.height=t,m._workingContext.drawImage(i,0,0,i.width,i.height,0,0,e,t),s.texImage2D(s.TEXTURE_2D,0,c,h,s.UNSIGNED_BYTE,m._workingCanvas),o.width=e,o.height=t,1));var p=new wt(m,Rt.Temp);return m._bindTextureDirectly(s.TEXTURE_2D,p,!0),s.texImage2D(s.TEXTURE_2D,0,c,h,s.UNSIGNED_BYTE,i),m._rescaleTexture(p,o,n,c,(function(){m._releaseTexture(p),m._bindTextureDirectly(s.TEXTURE_2D,o,!0),a()})),!0}),l,c,u,h,d,p,_)},e._FileToolsLoadImage=function(e,t,i,n,r,o){throw pe(\"FileTools\")},e.prototype._rescaleTexture=function(e,t,i,n,r){},e.prototype.createRawTexture=function(e,t,i,n,r,o,s,l,c,u,h){throw void 0===l&&(l=null),void 0===c&&(c=a.TEXTURETYPE_UNSIGNED_INT),void 0===u&&(u=0),void 0===h&&(h=!1),pe(\"Engine.RawTexture\")},e.prototype.createRawCubeTexture=function(e,t,i,n,r,o,a,s){throw void 0===s&&(s=null),pe(\"Engine.RawTexture\")},e.prototype.createRawTexture3D=function(e,t,i,n,r,o,s,l,c,u){throw void 0===c&&(c=null),void 0===u&&(u=a.TEXTURETYPE_UNSIGNED_INT),pe(\"Engine.RawTexture\")},e.prototype.createRawTexture2DArray=function(e,t,i,n,r,o,s,l,c,u){throw void 0===c&&(c=null),void 0===u&&(u=a.TEXTURETYPE_UNSIGNED_INT),pe(\"Engine.RawTexture\")},e.prototype._unpackFlipY=function(e){this._unpackFlipYCached!==e&&(this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL,e?1:0),this.enableUnpackFlipYCached&&(this._unpackFlipYCached=e))},e.prototype._getUnpackAlignement=function(){return this._gl.getParameter(this._gl.UNPACK_ALIGNMENT)},e.prototype._getTextureTarget=function(e){return e.isCube?this._gl.TEXTURE_CUBE_MAP:e.is3D?this._gl.TEXTURE_3D:e.is2DArray||e.isMultiview?this._gl.TEXTURE_2D_ARRAY:this._gl.TEXTURE_2D},e.prototype.updateTextureSamplingMode=function(e,t,i){void 0===i&&(i=!1);var n=this._getTextureTarget(t),r=this._getSamplingParameters(e,t.generateMipMaps||i);this._setTextureParameterInteger(n,this._gl.TEXTURE_MAG_FILTER,r.mag,t),this._setTextureParameterInteger(n,this._gl.TEXTURE_MIN_FILTER,r.min),i&&(t.generateMipMaps=!0,this._gl.generateMipmap(n)),this._bindTextureDirectly(n,null),t.samplingMode=e},e.prototype.updateTextureDimensions=function(e,t,i,n){void 0===n&&(n=1)},e.prototype.updateTextureWrappingMode=function(e,t,i,n){void 0===i&&(i=null),void 0===n&&(n=null);var r=this._getTextureTarget(e);null!==t&&(this._setTextureParameterInteger(r,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(t),e),e._cachedWrapU=t),null!==i&&(this._setTextureParameterInteger(r,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(i),e),e._cachedWrapV=i),(e.is2DArray||e.is3D)&&null!==n&&(this._setTextureParameterInteger(r,this._gl.TEXTURE_WRAP_R,this._getTextureWrapMode(n),e),e._cachedWrapR=n),this._bindTextureDirectly(r,null)},e.prototype._setupDepthStencilTexture=function(e,t,i,n,r,o){void 0===o&&(o=1);var s=t.width||t,l=t.height||t,c=t.layers||0;e.baseWidth=s,e.baseHeight=l,e.width=s,e.height=l,e.is2DArray=c>0,e.depth=c,e.isReady=!0,e.samples=o,e.generateMipMaps=!1,e.samplingMode=n?a.TEXTURE_BILINEAR_SAMPLINGMODE:a.TEXTURE_NEAREST_SAMPLINGMODE,e.type=a.TEXTURETYPE_UNSIGNED_INT,e._comparisonFunction=r;var u=this._gl,h=this._getTextureTarget(e),d=this._getSamplingParameters(e.samplingMode,!1);u.texParameteri(h,u.TEXTURE_MAG_FILTER,d.mag),u.texParameteri(h,u.TEXTURE_MIN_FILTER,d.min),u.texParameteri(h,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(h,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),this.webGLVersion>1&&(0===r?(u.texParameteri(h,u.TEXTURE_COMPARE_FUNC,a.LEQUAL),u.texParameteri(h,u.TEXTURE_COMPARE_MODE,u.NONE)):(u.texParameteri(h,u.TEXTURE_COMPARE_FUNC,r),u.texParameteri(h,u.TEXTURE_COMPARE_MODE,u.COMPARE_REF_TO_TEXTURE)))},e.prototype._uploadCompressedDataToTextureDirectly=function(e,t,i,n,r,o,s){void 0===o&&(o=0),void 0===s&&(s=0);var l=this._gl,c=l.TEXTURE_2D;if(e.isCube&&(c=l.TEXTURE_CUBE_MAP_POSITIVE_X+o),e._useSRGBBuffer)switch(t){case a.TEXTUREFORMAT_COMPRESSED_RGB8_ETC2:case a.TEXTUREFORMAT_COMPRESSED_RGB_ETC1_WEBGL:this._caps.etc2?t=l.COMPRESSED_SRGB8_ETC2:e._useSRGBBuffer=!1;break;case a.TEXTUREFORMAT_COMPRESSED_RGBA8_ETC2_EAC:this._caps.etc2?t=l.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:e._useSRGBBuffer=!1;break;case a.TEXTUREFORMAT_COMPRESSED_RGBA_BPTC_UNORM:t=l.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT;break;case a.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_4x4:t=l.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;break;case a.TEXTUREFORMAT_COMPRESSED_RGB_S3TC_DXT1:this._caps.s3tc_srgb?t=l.COMPRESSED_SRGB_S3TC_DXT1_EXT:e._useSRGBBuffer=!1;break;case a.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT1:this._caps.s3tc_srgb?t=l.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:e._useSRGBBuffer=!1;break;case a.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT5:this._caps.s3tc_srgb?t=l.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:e._useSRGBBuffer=!1;break;default:e._useSRGBBuffer=!1}this._gl.compressedTexImage2D(c,s,t,i,n,0,r)},e.prototype._uploadDataToTextureDirectly=function(e,t,i,n,r,o){void 0===i&&(i=0),void 0===n&&(n=0),void 0===o&&(o=!1);var a=this._gl,s=this._getWebGLTextureType(e.type),l=this._getInternalFormat(e.format),c=void 0===r?this._getRGBABufferInternalSizedFormat(e.type,e.format,e._useSRGBBuffer):this._getInternalFormat(r,e._useSRGBBuffer);this._unpackFlipY(e.invertY);var u=a.TEXTURE_2D;e.isCube&&(u=a.TEXTURE_CUBE_MAP_POSITIVE_X+i);var h=Math.round(Math.log(e.width)*Math.LOG2E),d=Math.round(Math.log(e.height)*Math.LOG2E),p=o?e.width:Math.pow(2,Math.max(h-n,0)),f=o?e.height:Math.pow(2,Math.max(d-n,0));a.texImage2D(u,n,c,p,f,0,l,s,t)},e.prototype.updateTextureData=function(e,t,i,n,r,o,a,s,l){void 0===a&&(a=0),void 0===s&&(s=0),void 0===l&&(l=!1);var c=this._gl,u=this._getWebGLTextureType(e.type),h=this._getInternalFormat(e.format);this._unpackFlipY(e.invertY);var d=c.TEXTURE_2D;e.isCube&&(d=c.TEXTURE_CUBE_MAP_POSITIVE_X+a),this._bindTextureDirectly(d,e,!0),c.texSubImage2D(d,s,i,n,r,o,h,u,t),l&&this._gl.generateMipmap(d),this._bindTextureDirectly(d,null)},e.prototype._uploadArrayBufferViewToTexture=function(e,t,i,n){void 0===i&&(i=0),void 0===n&&(n=0);var r=this._gl,o=e.isCube?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D;this._bindTextureDirectly(o,e,!0),this._uploadDataToTextureDirectly(e,t,i,n),this._bindTextureDirectly(o,null,!0)},e.prototype._prepareWebGLTextureContinuation=function(e,t,i,n,r){var o=this._gl;if(o){var a=this._getSamplingParameters(r,!i);o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,a.mag),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,a.min),i||n||o.generateMipmap(o.TEXTURE_2D),this._bindTextureDirectly(o.TEXTURE_2D,null),t&&t.removePendingData(e),e.onLoadedObservable.notifyObservers(e),e.onLoadedObservable.clear()}},e.prototype._prepareWebGLTexture=function(t,i,n,r,o,s,l,c,u){var h=this;void 0===u&&(u=a.TEXTURE_TRILINEAR_SAMPLINGMODE);var d=this.getCaps().maxTextureSize,p=Math.min(d,this.needPOTTextures?e.GetExponentOfTwo(r.width,d):r.width),f=Math.min(d,this.needPOTTextures?e.GetExponentOfTwo(r.height,d):r.height),_=this._gl;_&&(t._hardwareTexture?(this._bindTextureDirectly(_.TEXTURE_2D,t,!0),this._unpackFlipY(void 0===o||!!o),t.baseWidth=r.width,t.baseHeight=r.height,t.width=p,t.height=f,t.isReady=!0,c(p,f,r,i,t,(function(){h._prepareWebGLTextureContinuation(t,n,s,l,u)}))||this._prepareWebGLTextureContinuation(t,n,s,l,u)):n&&n.removePendingData(t))},e.prototype._setupFramebufferDepthAttachments=function(e,t,i,n,r){void 0===r&&(r=1);var o=this._gl;if(e&&t)return this._createRenderBuffer(i,n,r,o.DEPTH_STENCIL,o.DEPTH24_STENCIL8,o.DEPTH_STENCIL_ATTACHMENT);if(t){var a=o.DEPTH_COMPONENT16;return this._webGLVersion>1&&(a=o.DEPTH_COMPONENT32F),this._createRenderBuffer(i,n,r,a,a,o.DEPTH_ATTACHMENT)}return e?this._createRenderBuffer(i,n,r,o.STENCIL_INDEX8,o.STENCIL_INDEX8,o.STENCIL_ATTACHMENT):null},e.prototype._createRenderBuffer=function(e,t,i,n,r,o,a){void 0===a&&(a=!0);var s=this._gl.createRenderbuffer();return this._updateRenderBuffer(s,e,t,i,n,r,o,a)},e.prototype._updateRenderBuffer=function(e,t,i,n,r,o,a,s){void 0===s&&(s=!0);var l=this._gl;return l.bindRenderbuffer(l.RENDERBUFFER,e),n>1&&l.renderbufferStorageMultisample?l.renderbufferStorageMultisample(l.RENDERBUFFER,n,o,t,i):l.renderbufferStorage(l.RENDERBUFFER,r,t,i),l.framebufferRenderbuffer(l.FRAMEBUFFER,a,l.RENDERBUFFER,e),s&&l.bindRenderbuffer(l.RENDERBUFFER,null),e},e.prototype._releaseTexture=function(e){var t;this._deleteTexture(null===(t=e._hardwareTexture)||void 0===t?void 0:t.underlyingResource),this.unbindAllTextures();var i=this._internalTexturesCache.indexOf(e);-1!==i&&this._internalTexturesCache.splice(i,1),e._lodTextureHigh&&e._lodTextureHigh.dispose(),e._lodTextureMid&&e._lodTextureMid.dispose(),e._lodTextureLow&&e._lodTextureLow.dispose(),e._irradianceTexture&&e._irradianceTexture.dispose()},e.prototype._releaseRenderTargetWrapper=function(e){var t=this._renderTargetWrapperCache.indexOf(e);-1!==t&&this._renderTargetWrapperCache.splice(t,1)},e.prototype._deleteTexture=function(e){e&&this._gl.deleteTexture(e)},e.prototype._setProgram=function(e){this._currentProgram!==e&&(this._gl.useProgram(e),this._currentProgram=e)},e.prototype.bindSamplers=function(e){var t=e.getPipelineContext();this._setProgram(t.program);for(var i=e.getSamplers(),n=0;n-1;if(i&&s&&(this._activeChannel=t._associatedChannel),this._boundTexturesCache[this._activeChannel]!==t||n){if(this._activateCurrentTexture(),t&&t.isMultiview)throw console.error(e,t),\"_bindTextureDirectly called with a multiview texture!\";this._gl.bindTexture(e,null!==(o=null===(r=null==t?void 0:t._hardwareTexture)||void 0===r?void 0:r.underlyingResource)&&void 0!==o?o:null),this._boundTexturesCache[this._activeChannel]=t,t&&(t._associatedChannel=this._activeChannel)}else i&&(a=!0,this._activateCurrentTexture());return s&&!i&&this._bindSamplerUniformToChannel(t._associatedChannel,this._activeChannel),a},e.prototype._bindTexture=function(e,t,i){if(void 0!==e){t&&(t._associatedChannel=e),this._activeChannel=e;var n=t?this._getTextureTarget(t):this._gl.TEXTURE_2D;this._bindTextureDirectly(n,t)}},e.prototype.unbindAllTextures=function(){for(var e=0;e1&&(this._bindTextureDirectly(this._gl.TEXTURE_3D,null),this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY,null))},e.prototype.setTexture=function(e,t,i,n){void 0!==e&&(t&&(this._boundUniforms[e]=t),this._setTexture(e,i))},e.prototype._bindSamplerUniformToChannel=function(e,t){var i=this._boundUniforms[e];i&&i._currentState!==t&&(this._gl.uniform1i(i,t),i._currentState=t)},e.prototype._getTextureWrapMode=function(e){switch(e){case a.TEXTURE_WRAP_ADDRESSMODE:return this._gl.REPEAT;case a.TEXTURE_CLAMP_ADDRESSMODE:return this._gl.CLAMP_TO_EDGE;case a.TEXTURE_MIRROR_ADDRESSMODE:return this._gl.MIRRORED_REPEAT}return this._gl.REPEAT},e.prototype._setTexture=function(e,t,i,n,r){if(void 0===i&&(i=!1),void 0===n&&(n=!1),void 0===r&&(r=\"\"),!t)return null!=this._boundTexturesCache[e]&&(this._activeChannel=e,this._bindTextureDirectly(this._gl.TEXTURE_2D,null),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null),this.webGLVersion>1&&(this._bindTextureDirectly(this._gl.TEXTURE_3D,null),this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY,null))),!1;if(t.video)this._activeChannel=e,t.update();else if(t.delayLoadState===a.DELAYLOADSTATE_NOTLOADED)return t.delayLoad(),!1;var o;o=n?t.depthStencilTexture:t.isReady()?t.getInternalTexture():t.isCube?this.emptyCubeTexture:t.is3D?this.emptyTexture3D:t.is2DArray?this.emptyTexture2DArray:this.emptyTexture,!i&&o&&(o._associatedChannel=e);var s=!0;this._boundTexturesCache[e]===o&&(i||this._bindSamplerUniformToChannel(o._associatedChannel,e),s=!1),this._activeChannel=e;var l=this._getTextureTarget(o);if(s&&this._bindTextureDirectly(l,o,i),o&&!o.isMultiview){if(o.isCube&&o._cachedCoordinatesMode!==t.coordinatesMode){o._cachedCoordinatesMode=t.coordinatesMode;var c=t.coordinatesMode!==a.TEXTURE_CUBIC_MODE&&t.coordinatesMode!==a.TEXTURE_SKYBOX_MODE?a.TEXTURE_WRAP_ADDRESSMODE:a.TEXTURE_CLAMP_ADDRESSMODE;t.wrapU=c,t.wrapV=c}o._cachedWrapU!==t.wrapU&&(o._cachedWrapU=t.wrapU,this._setTextureParameterInteger(l,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(t.wrapU),o)),o._cachedWrapV!==t.wrapV&&(o._cachedWrapV=t.wrapV,this._setTextureParameterInteger(l,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(t.wrapV),o)),o.is3D&&o._cachedWrapR!==t.wrapR&&(o._cachedWrapR=t.wrapR,this._setTextureParameterInteger(l,this._gl.TEXTURE_WRAP_R,this._getTextureWrapMode(t.wrapR),o)),this._setAnisotropicLevel(l,o,t.anisotropicFilteringLevel)}return!0},e.prototype.setTextureArray=function(e,t,i,n){if(void 0!==e&&t){this._textureUnits&&this._textureUnits.length===i.length||(this._textureUnits=new Int32Array(i.length));for(var r=0;r=this._caps.maxVertexAttribs||!this._vertexAttribArraysEnabled[e]||this.disableAttributeByIndex(e)}},e.prototype.releaseEffects=function(){for(var e in this._compiledEffects){var t=this._compiledEffects[e].getPipelineContext();this._deletePipelineContext(t)}this._compiledEffects={}},e.prototype.dispose=function(){var e;this.stopRenderLoop(),this.onBeforeTextureInitObservable&&this.onBeforeTextureInitObservable.clear(),this._emptyTexture&&(this._releaseTexture(this._emptyTexture),this._emptyTexture=null),this._emptyCubeTexture&&(this._releaseTexture(this._emptyCubeTexture),this._emptyCubeTexture=null),this._dummyFramebuffer&&this._gl.deleteFramebuffer(this._dummyFramebuffer),this.releaseEffects(),null===(e=this.releaseComputeEffects)||void 0===e||e.call(this),this.unbindAllAttributes(),this._boundUniforms={},qe()&&this._renderingCanvas&&(this._doNotHandleContextLost||(this._renderingCanvas.removeEventListener(\"webglcontextlost\",this._onContextLost),this._renderingCanvas.removeEventListener(\"webglcontextrestored\",this._onContextRestored)),window.removeEventListener(\"resize\",this._checkForMobile)),this._workingCanvas=null,this._workingContext=null,this._currentBufferPointers.length=0,this._renderingCanvas=null,this._currentProgram=null,this._boundRenderFunction=null,Ot.ResetCache();for(var t=0,i=this._activeRequests;t1?this._caps.colorBufferFloat:this._canRenderToFramebuffer(a.TEXTURETYPE_FLOAT)},e.prototype._canRenderToHalfFloatFramebuffer=function(){return this._webGLVersion>1?this._caps.colorBufferFloat:this._canRenderToFramebuffer(a.TEXTURETYPE_HALF_FLOAT)},e.prototype._canRenderToFramebuffer=function(e){for(var t=this._gl;t.getError()!==t.NO_ERROR;);var i=!0,n=t.createTexture();t.bindTexture(t.TEXTURE_2D,n),t.texImage2D(t.TEXTURE_2D,0,this._getRGBABufferInternalSizedFormat(e),1,1,0,t.RGBA,this._getWebGLTextureType(e),null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST);var r=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0);var o=t.checkFramebufferStatus(t.FRAMEBUFFER);if((i=(i=i&&o===t.FRAMEBUFFER_COMPLETE)&&t.getError()===t.NO_ERROR)&&(t.clear(t.COLOR_BUFFER_BIT),i=i&&t.getError()===t.NO_ERROR),i){t.bindFramebuffer(t.FRAMEBUFFER,null);var a=t.RGBA,s=t.UNSIGNED_BYTE,l=new Uint8Array(4);t.readPixels(0,0,1,1,a,s,l),i=i&&t.getError()===t.NO_ERROR}for(t.deleteTexture(n),t.deleteFramebuffer(r),t.bindFramebuffer(t.FRAMEBUFFER,null);!i&&t.getError()!==t.NO_ERROR;);return i},e.prototype._getWebGLTextureType=function(e){if(1===this._webGLVersion){switch(e){case a.TEXTURETYPE_FLOAT:return this._gl.FLOAT;case a.TEXTURETYPE_HALF_FLOAT:return this._gl.HALF_FLOAT_OES;case a.TEXTURETYPE_UNSIGNED_BYTE:return this._gl.UNSIGNED_BYTE;case a.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:return this._gl.UNSIGNED_SHORT_4_4_4_4;case a.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:return this._gl.UNSIGNED_SHORT_5_5_5_1;case a.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:return this._gl.UNSIGNED_SHORT_5_6_5}return this._gl.UNSIGNED_BYTE}switch(e){case a.TEXTURETYPE_BYTE:return this._gl.BYTE;case a.TEXTURETYPE_UNSIGNED_BYTE:return this._gl.UNSIGNED_BYTE;case a.TEXTURETYPE_SHORT:return this._gl.SHORT;case a.TEXTURETYPE_UNSIGNED_SHORT:return this._gl.UNSIGNED_SHORT;case a.TEXTURETYPE_INT:return this._gl.INT;case a.TEXTURETYPE_UNSIGNED_INTEGER:return this._gl.UNSIGNED_INT;case a.TEXTURETYPE_FLOAT:return this._gl.FLOAT;case a.TEXTURETYPE_HALF_FLOAT:return this._gl.HALF_FLOAT;case a.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:return this._gl.UNSIGNED_SHORT_4_4_4_4;case a.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:return this._gl.UNSIGNED_SHORT_5_5_5_1;case a.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:return this._gl.UNSIGNED_SHORT_5_6_5;case a.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV:return this._gl.UNSIGNED_INT_2_10_10_10_REV;case a.TEXTURETYPE_UNSIGNED_INT_24_8:return this._gl.UNSIGNED_INT_24_8;case a.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV:return this._gl.UNSIGNED_INT_10F_11F_11F_REV;case a.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV:return this._gl.UNSIGNED_INT_5_9_9_9_REV;case a.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV:return this._gl.FLOAT_32_UNSIGNED_INT_24_8_REV}return this._gl.UNSIGNED_BYTE},e.prototype._getInternalFormat=function(e,t){void 0===t&&(t=!1);var i=t?this._gl.SRGB8_ALPHA8:this._gl.RGBA;switch(e){case a.TEXTUREFORMAT_ALPHA:i=this._gl.ALPHA;break;case a.TEXTUREFORMAT_LUMINANCE:i=this._gl.LUMINANCE;break;case a.TEXTUREFORMAT_LUMINANCE_ALPHA:i=this._gl.LUMINANCE_ALPHA;break;case a.TEXTUREFORMAT_RED:i=this._gl.RED;break;case a.TEXTUREFORMAT_RG:i=this._gl.RG;break;case a.TEXTUREFORMAT_RGB:i=t?this._gl.SRGB:this._gl.RGB;break;case a.TEXTUREFORMAT_RGBA:i=t?this._gl.SRGB8_ALPHA8:this._gl.RGBA}if(this._webGLVersion>1)switch(e){case a.TEXTUREFORMAT_RED_INTEGER:i=this._gl.RED_INTEGER;break;case a.TEXTUREFORMAT_RG_INTEGER:i=this._gl.RG_INTEGER;break;case a.TEXTUREFORMAT_RGB_INTEGER:i=this._gl.RGB_INTEGER;break;case a.TEXTUREFORMAT_RGBA_INTEGER:i=this._gl.RGBA_INTEGER}return i},e.prototype._getRGBABufferInternalSizedFormat=function(e,t,i){if(void 0===i&&(i=!1),1===this._webGLVersion){if(void 0!==t)switch(t){case a.TEXTUREFORMAT_ALPHA:return this._gl.ALPHA;case a.TEXTUREFORMAT_LUMINANCE:return this._gl.LUMINANCE;case a.TEXTUREFORMAT_LUMINANCE_ALPHA:return this._gl.LUMINANCE_ALPHA;case a.TEXTUREFORMAT_RGB:return i?this._gl.SRGB:this._gl.RGB}return this._gl.RGBA}switch(e){case a.TEXTURETYPE_BYTE:switch(t){case a.TEXTUREFORMAT_RED:return this._gl.R8_SNORM;case a.TEXTUREFORMAT_RG:return this._gl.RG8_SNORM;case a.TEXTUREFORMAT_RGB:return this._gl.RGB8_SNORM;case a.TEXTUREFORMAT_RED_INTEGER:return this._gl.R8I;case a.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG8I;case a.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB8I;case a.TEXTUREFORMAT_RGBA_INTEGER:return this._gl.RGBA8I;default:return this._gl.RGBA8_SNORM}case a.TEXTURETYPE_UNSIGNED_BYTE:switch(t){case a.TEXTUREFORMAT_RED:return this._gl.R8;case a.TEXTUREFORMAT_RG:return this._gl.RG8;case a.TEXTUREFORMAT_RGB:return i?this._gl.SRGB8:this._gl.RGB8;case a.TEXTUREFORMAT_RGBA:return i?this._gl.SRGB8_ALPHA8:this._gl.RGBA8;case a.TEXTUREFORMAT_RED_INTEGER:return this._gl.R8UI;case a.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG8UI;case a.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB8UI;case a.TEXTUREFORMAT_RGBA_INTEGER:return this._gl.RGBA8UI;case a.TEXTUREFORMAT_ALPHA:return this._gl.ALPHA;case a.TEXTUREFORMAT_LUMINANCE:return this._gl.LUMINANCE;case a.TEXTUREFORMAT_LUMINANCE_ALPHA:return this._gl.LUMINANCE_ALPHA;default:return this._gl.RGBA8}case a.TEXTURETYPE_SHORT:switch(t){case a.TEXTUREFORMAT_RED_INTEGER:return this._gl.R16I;case a.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG16I;case a.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB16I;case a.TEXTUREFORMAT_RGBA_INTEGER:default:return this._gl.RGBA16I}case a.TEXTURETYPE_UNSIGNED_SHORT:switch(t){case a.TEXTUREFORMAT_RED_INTEGER:return this._gl.R16UI;case a.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG16UI;case a.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB16UI;case a.TEXTUREFORMAT_RGBA_INTEGER:default:return this._gl.RGBA16UI}case a.TEXTURETYPE_INT:switch(t){case a.TEXTUREFORMAT_RED_INTEGER:return this._gl.R32I;case a.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG32I;case a.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB32I;case a.TEXTUREFORMAT_RGBA_INTEGER:default:return this._gl.RGBA32I}case a.TEXTURETYPE_UNSIGNED_INTEGER:switch(t){case a.TEXTUREFORMAT_RED_INTEGER:return this._gl.R32UI;case a.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG32UI;case a.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB32UI;case a.TEXTUREFORMAT_RGBA_INTEGER:default:return this._gl.RGBA32UI}case a.TEXTURETYPE_FLOAT:switch(t){case a.TEXTUREFORMAT_RED:return this._gl.R32F;case a.TEXTUREFORMAT_RG:return this._gl.RG32F;case a.TEXTUREFORMAT_RGB:return this._gl.RGB32F;case a.TEXTUREFORMAT_RGBA:default:return this._gl.RGBA32F}case a.TEXTURETYPE_HALF_FLOAT:switch(t){case a.TEXTUREFORMAT_RED:return this._gl.R16F;case a.TEXTUREFORMAT_RG:return this._gl.RG16F;case a.TEXTUREFORMAT_RGB:return this._gl.RGB16F;case a.TEXTUREFORMAT_RGBA:default:return this._gl.RGBA16F}case a.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:return this._gl.RGB565;case a.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV:return this._gl.R11F_G11F_B10F;case a.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV:return this._gl.RGB9_E5;case a.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:return this._gl.RGBA4;case a.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:return this._gl.RGB5_A1;case a.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV:switch(t){case a.TEXTUREFORMAT_RGBA:return this._gl.RGB10_A2;case a.TEXTUREFORMAT_RGBA_INTEGER:return this._gl.RGB10_A2UI;default:return this._gl.RGB10_A2}}return i?this._gl.SRGB8_ALPHA8:this._gl.RGBA8},e.prototype._getRGBAMultiSampleBufferFormat=function(e){return e===a.TEXTURETYPE_FLOAT?this._gl.RGBA32F:e===a.TEXTURETYPE_HALF_FLOAT?this._gl.RGBA16F:this._gl.RGBA8},e.prototype._loadFile=function(t,i,n,r,o,a){var s=this,l=e._FileToolsLoadFile(t,i,n,r,o,a);return this._activeRequests.push(l),l.onCompleteObservable.add((function(e){s._activeRequests.splice(s._activeRequests.indexOf(e),1)})),l},e._FileToolsLoadFile=function(e,t,i,n,r,o){throw pe(\"FileTools\")},e.prototype.readPixels=function(e,t,i,n,r,o){void 0===r&&(r=!0),void 0===o&&(o=!0);var a=r?4:3,s=r?this._gl.RGBA:this._gl.RGB,l=new Uint8Array(n*i*a);return o&&this.flushFramebuffer(),this._gl.readPixels(e,t,i,n,s,this._gl.UNSIGNED_BYTE,l),Promise.resolve(l)},Object.defineProperty(e,\"IsSupportedAsync\",{get:function(){return Promise.resolve(this.isSupported())},enumerable:!1,configurable:!0}),Object.defineProperty(e,\"IsSupported\",{get:function(){return this.isSupported()},enumerable:!1,configurable:!0}),e.isSupported=function(){if(null!==this._HasMajorPerformanceCaveat)return!this._HasMajorPerformanceCaveat;if(null===this._IsSupported)try{var e=this._CreateCanvas(1,1),t=e.getContext(\"webgl\")||e.getContext(\"experimental-webgl\");this._IsSupported=null!=t&&!!window.WebGLRenderingContext}catch(e){this._IsSupported=!1}return this._IsSupported},Object.defineProperty(e,\"HasMajorPerformanceCaveat\",{get:function(){if(null===this._HasMajorPerformanceCaveat)try{var e=this._CreateCanvas(1,1),t=e.getContext(\"webgl\",{failIfMajorPerformanceCaveat:!0})||e.getContext(\"experimental-webgl\",{failIfMajorPerformanceCaveat:!0});this._HasMajorPerformanceCaveat=!t}catch(e){this._HasMajorPerformanceCaveat=!1}return this._HasMajorPerformanceCaveat},enumerable:!1,configurable:!0}),e.CeilingPOT=function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e},e.FloorPOT=function(e){return e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,(e|=e>>16)-(e>>1)},e.NearestPOT=function(t){var i=e.CeilingPOT(t),n=e.FloorPOT(t);return i-t>t-n?n:i},e.GetExponentOfTwo=function(t,i,n){var r;switch(void 0===n&&(n=a.SCALEMODE_NEAREST),n){case a.SCALEMODE_FLOOR:r=e.FloorPOT(t);break;case a.SCALEMODE_NEAREST:r=e.NearestPOT(t);break;case a.SCALEMODE_CEILING:default:r=e.CeilingPOT(t)}return Math.min(r,i)},e.QueueNewFrame=function(e,t){return qe()?(t||(t=window),t.requestPostAnimationFrame?t.requestPostAnimationFrame(e):t.requestAnimationFrame?t.requestAnimationFrame(e):window.setTimeout(e,16)):\"undefined\"!=typeof requestAnimationFrame?requestAnimationFrame(e):setTimeout(e,16)},e.prototype.getHostDocument=function(){return this._renderingCanvas&&this._renderingCanvas.ownerDocument?this._renderingCanvas.ownerDocument:Je()?document:null},e.ExceptionList=[{key:\"Chrome/63.0\",capture:\"63\\\\.0\\\\.3239\\\\.(\\\\d+)\",captureConstraint:108,targets:[\"uniformBuffer\"]},{key:\"Firefox/58\",capture:null,captureConstraint:null,targets:[\"uniformBuffer\"]},{key:\"Firefox/59\",capture:null,captureConstraint:null,targets:[\"uniformBuffer\"]},{key:\"Chrome/72.+?Mobile\",capture:null,captureConstraint:null,targets:[\"vao\"]},{key:\"Chrome/73.+?Mobile\",capture:null,captureConstraint:null,targets:[\"vao\"]},{key:\"Chrome/74.+?Mobile\",capture:null,captureConstraint:null,targets:[\"vao\"]},{key:\"Mac OS.+Chrome/71\",capture:null,captureConstraint:null,targets:[\"vao\"]},{key:\"Mac OS.+Chrome/72\",capture:null,captureConstraint:null,targets:[\"vao\"]},{key:\"Mac OS.+Chrome\",capture:null,captureConstraint:null,targets:[\"uniformBuffer\"]},{key:\".*AppleWebKit.*(15.4).*Safari\",capture:null,captureConstraint:null,targets:[\"antialias\",\"maxMSAASamples\"]},{key:\".*(15.4).*AppleWebKit.*Safari\",capture:null,captureConstraint:null,targets:[\"antialias\",\"maxMSAASamples\"]}],e._TextureLoaders=[],e.CollisionsEpsilon=.001,e._IsSupported=null,e._HasMajorPerformanceCaveat=null,e}(),Kt=function(){function e(){}return e.SetImmediate=function(e){qe()&&window.setImmediate?window.setImmediate(e):setTimeout(e,1)},e}(),Qt=new RegExp(/^data:([^,]+\\/[^,]+)?;base64,/i),qt=function(e){function t(i,n){var r=e.call(this,i,at.LoadFileError)||this;return r.name=\"LoadFileError\",ot._setPrototypeOf(r,t.prototype),n instanceof ke?r.request=n:r.file=n,r}return V(t,e),t}(st),Zt=function(e){function t(i,n){var r=e.call(this,i,at.RequestFileError)||this;return r.request=n,r.name=\"RequestFileError\",ot._setPrototypeOf(r,t.prototype),r}return V(t,e),t}(st),Jt=function(e){function t(i,n){var r=e.call(this,i,at.ReadFileError)||this;return r.file=n,r.name=\"ReadFileError\",ot._setPrototypeOf(r,t.prototype),r}return V(t,e),t}(st),$t={DefaultRetryStrategy:rt.ExponentialBackoff(),BaseUrl:\"\",CorsBehavior:\"anonymous\",PreprocessUrl:function(e){return e}},ei=function(e){return e.replace(/#/gm,\"%23\")},ti=function(e,t){if((!e||0!==e.indexOf(\"data:\"))&&$t.CorsBehavior)if(\"string\"==typeof $t.CorsBehavior||$t.CorsBehavior instanceof String)t.crossOrigin=$t.CorsBehavior;else{var i=$t.CorsBehavior(e);i&&(t.crossOrigin=i)}},ii=function(e,t,i,n,r,o){var a,s;void 0===r&&(r=\"\");var l=!1;e instanceof ArrayBuffer||ArrayBuffer.isView(e)?\"undefined\"!=typeof Blob&&\"undefined\"!=typeof URL?(s=URL.createObjectURL(new Blob([e],{type:r})),l=!0):s=\"data:\".concat(r,\";base64,\")+ht(e):e instanceof Blob?(s=URL.createObjectURL(e),l=!0):(s=ei(e),s=$t.PreprocessUrl(e));var c=S.LastCreatedEngine,u=function(t){if(i){var n=s||e.toString();i(\"Error while trying to load image: \".concat(0===n.indexOf(\"http\")||n.length<=128?n:n.slice(0,128)+\"...\"),t)}};if(\"undefined\"==typeof Image||null!==(a=null==c?void 0:c._features.forceBitmapOverHTMLImageElement)&&void 0!==a&&a)return ri(s,(function(n){c.createImageBitmap(new Blob([n],{type:r}),k({premultiplyAlpha:\"none\"},o)).then((function(e){t(e),l&&URL.revokeObjectURL(s)})).catch((function(t){i&&i(\"Error while trying to load image: \"+e,t)}))}),void 0,n||void 0,!0,(function(e,t){u(t)})),null;var h=new Image;ti(s,h);var d=function(){h.removeEventListener(\"load\",d),h.removeEventListener(\"error\",p),t(h),l&&h.src&&URL.revokeObjectURL(h.src)},p=function(e){h.removeEventListener(\"load\",d),h.removeEventListener(\"error\",p),u(e),l&&h.src&&URL.revokeObjectURL(h.src)};h.addEventListener(\"load\",d),h.addEventListener(\"error\",p);var f=\"blob:\"===s.substring(0,5),_=\"data:\"===s.substring(0,5),m=function(){f||_?h.src=s:ri(s,(function(e,t,i){var n=new Blob([e],{type:!r&&i?i:r}),o=URL.createObjectURL(n);l=!0,h.src=o}),void 0,n||void 0,!0,(function(e,t){u(t)}))};if(!f&&!_&&n&&n.enableTexturesOffline)n.open((function(){n&&n.loadImage(s,h)}),m);else{if(-1!==s.indexOf(\"file:\")){var g=decodeURIComponent(s.substring(5).toLowerCase());if(nt.FilesToLoad[g]&&\"undefined\"!=typeof URL){try{var v=void 0;try{v=URL.createObjectURL(nt.FilesToLoad[g])}catch(e){v=URL.createObjectURL(nt.FilesToLoad[g])}h.src=v,l=!0}catch(e){h.src=\"\"}return h}}m()}return h},ni=function(e,t,i,n,r){var o=new FileReader,a={onCompleteObservable:new u,abort:function(){return o.abort()}};return o.onloadend=function(){return a.onCompleteObservable.notifyObservers(a)},r&&(o.onerror=function(){r(new Jt(\"Unable to read \".concat(e.name),e))}),o.onload=function(e){t(e.target.result)},i&&(o.onprogress=i),n?o.readAsArrayBuffer(e):o.readAsText(e),a},ri=function(e,t,i,n,r,o,a){if(e.name)return ni(e,t,i,r,o?function(e){o(void 0,e)}:void 0);var s=e;if(-1!==s.indexOf(\"file:\")){var l=decodeURIComponent(s.substring(5).toLowerCase());0===l.indexOf(\"./\")&&(l=l.substring(2));var c=nt.FilesToLoad[l];if(c)return ni(c,t,i,r,o?function(e){return o(void 0,new qt(e.message,e.file))}:void 0)}var h=li(s),d=h.match,p=h.type;if(d){var f={onCompleteObservable:new u,abort:function(){return function(){}}};try{var _=r?ci(s):hi(s);t(_,void 0,p)}catch(e){o?o(void 0,e):Q.Error(e.message||\"Failed to parse the Data URL\")}return Kt.SetImmediate((function(){f.onCompleteObservable.notifyObservers(f)})),f}return oi(s,(function(e,i){t(e,null==i?void 0:i.responseURL,null==i?void 0:i.getResponseHeader(\"content-type\"))}),i,n,r,o?function(e){o(e.request,new qt(e.message,e.request))}:void 0,a)},oi=function(e,t,i,n,r,o,a){e=ei(e),e=$t.PreprocessUrl(e);var s=$t.BaseUrl+e,l=!1,c={onCompleteObservable:new u,abort:function(){return l=!0}},h=function(){var e,n=new ke,u=null,h=function(){n&&(i&&n.removeEventListener(\"progress\",i),e&&n.removeEventListener(\"readystatechange\",e),n.removeEventListener(\"loadend\",d))},d=function(){h(),c.onCompleteObservable.notifyObservers(c),c.onCompleteObservable.clear(),i=void 0,e=null,d=null,o=void 0,a=void 0,t=void 0};c.abort=function(){l=!0,d&&d(),n&&n.readyState!==(XMLHttpRequest.DONE||4)&&n.abort(),null!==u&&(clearTimeout(u),u=null),n=null};var p=function(e){var t=e.message||\"Unknown error\";o&&n?o(new Zt(t,n)):Q.Error(t)},f=function(c){if(n){if(n.open(\"GET\",s),a)try{a(n)}catch(e){return void p(e)}r&&(n.responseType=\"arraybuffer\"),i&&n.addEventListener(\"progress\",i),d&&n.addEventListener(\"loadend\",d),e=function(){if(!l&&n&&n.readyState===(XMLHttpRequest.DONE||4)){if(e&&n.removeEventListener(\"readystatechange\",e),n.status>=200&&n.status<300||0===n.status&&(!qe()||ai())){try{t&&t(r?n.response:n.responseText,n)}catch(e){p(e)}return}var i=$t.DefaultRetryStrategy;if(i){var a=i(s,n,c);if(-1!==a)return h(),n=new ke,void(u=setTimeout((function(){return f(c+1)}),a))}var d=new Zt(\"Error status: \"+n.status+\" \"+n.statusText+\" - Unable to load \"+s,n);o&&o(d)}},n.addEventListener(\"readystatechange\",e),n.send()}};f(0)};if(n&&n.enableSceneOffline){var d=function(e){e&&e.status>400?o&&o(e):h()};n.open((function(){n&&n.loadFile($t.BaseUrl+e,(function(e){!l&&t&&t(e),c.onCompleteObservable.notifyObservers(c)}),i?function(e){!l&&i&&i(e)}:void 0,d,r)}),d)}else h();return c},ai=function(){return\"undefined\"!=typeof location&&\"file:\"===location.protocol},si=function(e){return Qt.test(e)},li=function(e){var t=Qt.exec(e);return null===t||0===t.length?{match:!1,type:\"\"}:{match:!0,type:t[0].replace(\"data:\",\"\").replace(\"base64,\",\"\")}};function ci(e){return pt(e.split(\",\")[1])}var ui,hi=function(e){return dt(e.split(\",\")[1])};Yt._FileToolsLoadImage=ii,Yt._FileToolsLoadFile=ri,Mt._FileToolsLoadFile=ri;var di=function(e,t,i,n,r,o,a,s,l,c){ui={DecodeBase64UrlToBinary:e,DecodeBase64UrlToString:t,DefaultRetryStrategy:i.DefaultRetryStrategy,BaseUrl:i.BaseUrl,CorsBehavior:i.CorsBehavior,PreprocessUrl:i.PreprocessUrl,IsBase64DataUrl:n,IsFileURL:r,LoadFile:o,LoadImage:a,ReadFile:s,RequestFile:l,SetCorsBehavior:c},Object.defineProperty(ui,\"DefaultRetryStrategy\",{get:function(){return i.DefaultRetryStrategy},set:function(e){i.DefaultRetryStrategy=e}}),Object.defineProperty(ui,\"BaseUrl\",{get:function(){return i.BaseUrl},set:function(e){i.BaseUrl=e}}),Object.defineProperty(ui,\"PreprocessUrl\",{get:function(){return i.PreprocessUrl},set:function(e){i.PreprocessUrl=e}}),Object.defineProperty(ui,\"CorsBehavior\",{get:function(){return i.CorsBehavior},set:function(e){i.CorsBehavior=e}})};di(ci,hi,$t,si,ai,ri,ii,ni,oi,ti);var pi=function(){function e(){}return e.Instantiate=function(e){if(this.RegisteredExternalClasses&&this.RegisteredExternalClasses[e])return this.RegisteredExternalClasses[e];var t=T(e);if(t)return t;Q.Warn(e+\" not found, you may have missed an import.\");for(var i=e.split(\".\"),n=window||this,r=0,o=i.length;r1?1:Math.round(255*p)}n=h}var f=u.createImageData(t,i);f.data.set(n),u.putImageData(f,0,0);var _=e._ScreenshotCanvas;if(s){var m=document.createElement(\"canvas\");m.width=t,m.height=i;var g=m.getContext(\"2d\");if(!g)return;g.translate(0,i),g.scale(1,-1),g.drawImage(e._ScreenshotCanvas,0,0),_=m}l?e.ToBlob(_,(function(e){var t=new FileReader;t.onload=function(e){var t=e.target.result;r&&r(t)},t.readAsArrayBuffer(e)}),o,c):e.EncodeScreenshotCanvasData(r,o,a,_,c)}},e.DumpDataAsync=function(t,i,n,r,o,a,s,l){return void 0===r&&(r=\"image/png\"),void 0===a&&(a=!1),void 0===s&&(s=!1),new Promise((function(c){e.DumpData(t,i,n,(function(e){return c(e)}),r,o,a,s,l)}))},e.ToBlob=function(e,t,i,n){void 0===i&&(i=\"image/png\"),e.toBlob||(e.toBlob=function(e,t,i){var n=this;setTimeout((function(){for(var r=atob(n.toDataURL(t,i).split(\",\")[1]),o=r.length,a=new Uint8Array(o),s=0;s=t)break;if(n(a),o&&o()){e.breakLoop();break}}e.executeNext()}),a)}),r)},e}();S.FallbackTexture=\"data:image/jpg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4QBmRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAAExAAIAAAAQAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQubmV0IDQuMC41AP/bAEMABAIDAwMCBAMDAwQEBAQFCQYFBQUFCwgIBgkNCw0NDQsMDA4QFBEODxMPDAwSGBITFRYXFxcOERkbGRYaFBYXFv/bAEMBBAQEBQUFCgYGChYPDA8WFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFv/AABEIAQABAAMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/APH6KKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76P//Z\";var yi=function(){function e(t){this.length=0,this.data=new Array(t),this._id=e._GlobalId++}return e.prototype.push=function(e){this.data[this.length++]=e,this.length>this.data.length&&(this.data.length*=2)},e.prototype.forEach=function(e){for(var t=0;tthis.data.length&&(this.data.length=2*(this.length+e.length));for(var t=0;t=this.length?-1:t},e.prototype.contains=function(e){return-1!==this.indexOf(e)},e._GlobalId=0,e}(),bi=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._duplicateId=0,t}return V(t,e),t.prototype.push=function(t){e.prototype.push.call(this,t),t.__smartArrayFlags||(t.__smartArrayFlags={}),t.__smartArrayFlags[this._id]=this._duplicateId},t.prototype.pushNoDuplicate=function(e){return!(e.__smartArrayFlags&&e.__smartArrayFlags[this._id]===this._duplicateId||(this.push(e),0))},t.prototype.reset=function(){e.prototype.reset.call(this),this._duplicateId++},t.prototype.concatWithNoDuplicate=function(e){if(0!==e.length){this.length+e.length>this.data.length&&(this.data.length=2*(this.length+e.length));for(var t=0;t0){if(t instanceof Array)throw\"addUniform should not be use with Array in UBO: \"+e;this._fillAlignment(4),this._uniformArraySizes[e]={strideSize:t,arraySize:i},16==t?t*=i:t=t*i+(4-t)*i,n=[];for(var r=0;r1&&this._buffers[this._bufferIndex][1]){if(this._buffersEqual(this._bufferData,this._buffers[this._bufferIndex][1]))return this._needSync=!1,void(this._createBufferOnWrite=this._engine._features.trackUbosInFrame);this._copyBuffer(this._bufferData,this._buffers[this._bufferIndex][1])}this._engine.updateUniformBuffer(this._buffer,this._bufferData),this._engine._features._collectUbosUpdatedInFrame&&(e._UpdatedUbosInFrame[this._name]||(e._UpdatedUbosInFrame[this._name]=0),e._UpdatedUbosInFrame[this._name]++),this._needSync=!1,this._createBufferOnWrite=this._engine._features.trackUbosInFrame}else this._createBufferOnWrite=this._engine._features.trackUbosInFrame;else this.create()},e.prototype._createNewBuffer=function(){this._bufferIndex+10?(this._needSync=0!==this._bufferIndex,this._bufferIndex=0,this._buffer=this._buffers[this._bufferIndex][0]):this._bufferIndex=-1)},e.prototype.updateUniform=function(e,t,i){this._checkNewFrame();var n=this._uniformLocations[e];if(void 0===n){if(this._buffer)return void Q.Error(\"Cannot add an uniform after UBO has been created.\");this.addUniform(e,i),n=this._uniformLocations[e]}if(this._buffer||this.create(),this._dynamic)for(o=0;oi._alphaIndex?1:t._alphaIndext._distanceToCamera?-1:0},e.frontToBackSortCompare=function(e,t){return e._distanceToCamerat._distanceToCamera?1:0},e.PainterSortCompare=function(e,t){var i=e.getMesh(),n=t.getMesh();return i.material&&n.material?i.material.uniqueId-n.material.uniqueId:i.uniqueId-n.uniqueId},e.prototype.prepare=function(){this._opaqueSubMeshes.reset(),this._transparentSubMeshes.reset(),this._alphaTestSubMeshes.reset(),this._depthOnlySubMeshes.reset(),this._particleSystems.reset(),this._spriteManagers.reset(),this._edgesRenderers.reset(),this._empty=!0},e.prototype.dispose=function(){this._opaqueSubMeshes.dispose(),this._transparentSubMeshes.dispose(),this._alphaTestSubMeshes.dispose(),this._depthOnlySubMeshes.dispose(),this._particleSystems.dispose(),this._spriteManagers.dispose(),this._edgesRenderers.dispose()},e.prototype.dispatch=function(e,t,i){void 0===t&&(t=e.getMesh()),void 0===i&&(i=e.getMaterial()),null!=i&&(i.needAlphaBlendingForMesh(t)?this._transparentSubMeshes.push(e):i.needAlphaTesting()?(i.needDepthPrePass&&this._depthOnlySubMeshes.push(e),this._alphaTestSubMeshes.push(e)):(i.needDepthPrePass&&this._depthOnlySubMeshes.push(e),this._opaqueSubMeshes.push(e)),t._renderingGroup=this,t._edgesRenderer&&t._edgesRenderer.isEnabled&&this._edgesRenderers.pushNoDuplicate(t._edgesRenderer),this._empty=!1)},e.prototype.dispatchSprites=function(e){this._spriteManagers.push(e),this._empty=!1},e.prototype.dispatchParticles=function(e){this._particleSystems.push(e),this._empty=!1},e.prototype._renderParticles=function(e){if(0!==this._particleSystems.length){var t=this._scene.activeCamera;this._scene.onBeforeParticlesRenderingObservable.notifyObservers(this._scene);for(var i=0;i=Ci.LeftClick&&i<=Ci.RightClick&&(a.type=1===n?\"pointerdown\":\"pointerup\",a.button=i-2),a},e._CreateWheelEvent=function(e,t,i,n,r,o){var a=this._CreateMouseEvent(e,t,i,n,r,o);switch(a.type=\"wheel\",a.deltaMode=Ji.DOM_DELTA_PIXEL,a.deltaX=0,a.deltaY=0,a.deltaZ=0,i){case Ci.MouseWheelX:a.deltaX=n;break;case Ci.MouseWheelY:a.deltaY=n;break;case Ci.MouseWheelZ:a.deltaZ=n}return a},e._CreateMouseEvent=function(e,t,i,n,r,o){var a=this._CreateEvent(o),s=r.pollInput(e,t,Ci.Horizontal),l=r.pollInput(e,t,Ci.Vertical);return o?(a.movementX=0,a.movementY=0,a.offsetX=a.movementX-o.getBoundingClientRect().x,a.offsetY=a.movementY-o.getBoundingClientRect().y):(a.movementX=r.pollInput(e,t,Pi.DeltaHorizontal),a.movementY=r.pollInput(e,t,Pi.DeltaVertical),a.offsetX=0,a.offsetY=0),this._CheckNonCharacterKeys(a,r),a.clientX=s,a.clientY=l,a.x=s,a.y=l,a.deviceType=e,a.deviceSlot=t,a.inputIndex=i,a},e._CreateKeyboardEvent=function(e,t,i,n){var r=this._CreateEvent(n);return this._CheckNonCharacterKeys(r,i),r.deviceType=xi.Keyboard,r.deviceSlot=0,r.inputIndex=e,r.type=1===t?\"keydown\":\"keyup\",r.key=String.fromCharCode(e),r.keyCode=e,r},e._CheckNonCharacterKeys=function(e,t){var i=t.isDeviceAvailable(xi.Keyboard),n=i&&1===t.pollInput(xi.Keyboard,0,a.INPUT_ALT_KEY),r=i&&1===t.pollInput(xi.Keyboard,0,a.INPUT_CTRL_KEY),o=i&&(1===t.pollInput(xi.Keyboard,0,a.INPUT_META_KEY1)||1===t.pollInput(xi.Keyboard,0,a.INPUT_META_KEY2)||1===t.pollInput(xi.Keyboard,0,a.INPUT_META_KEY3)),s=i&&1===t.pollInput(xi.Keyboard,0,a.INPUT_SHIFT_KEY);e.altKey=n,e.ctrlKey=r,e.metaKey=o,e.shiftKey=s},e._CreateEvent=function(e){var t={preventDefault:function(){}};return t.target=e,t},e}(),en=function(){function e(e,t,i){var n=this;this._nativeInput=_native.DeviceInputSystem?new _native.DeviceInputSystem(e,t,(function(e,t,r,o){var a=$i.CreateDeviceEvent(e,t,r,o,n);i(e,t,a)})):this._createDummyNativeInput()}return e.prototype.pollInput=function(e,t,i){return this._nativeInput.pollInput(e,t,i)},e.prototype.isDeviceAvailable=function(e){return e===xi.Mouse||e===xi.Touch},e.prototype.dispose=function(){this._nativeInput.dispose()},e.prototype._createDummyNativeInput=function(){return{pollInput:function(){return 0},isDeviceAvailable:function(){return!1},dispose:function(){}}},e}(),tn=Object.keys(Ci).length/2,nn=function(){function e(e,t,i,n){var r=this;this._inputs=[],this._keyboardActive=!1,this._pointerActive=!1,this._usingSafari=mi.IsSafari(),this._usingMacOS=/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),this._keyboardDownEvent=function(e){},this._keyboardUpEvent=function(e){},this._keyboardBlurEvent=function(e){},this._pointerMoveEvent=function(e){},this._pointerDownEvent=function(e){},this._pointerUpEvent=function(e){},this._pointerCancelEvent=function(e){},this._pointerWheelEvent=function(e){},this._pointerBlurEvent=function(e){},this._eventsAttached=!1,this._mouseId=-1,this._isUsingFirefox=tt.IsNavigatorAvailable()&&navigator.userAgent&&-1!==navigator.userAgent.indexOf(\"Firefox\"),this._maxTouchPoints=0,this._pointerInputClearObserver=null,this._gamepadConnectedEvent=function(e){},this._gamepadDisconnectedEvent=function(e){},this._eventPrefix=mi.GetPointerPrefix(e),this._engine=e,this._onDeviceConnected=t,this._onDeviceDisconnected=i,this._onInputChanged=n,this._enableEvents(),this._usingMacOS&&(this._metaKeys=[]),this._engine._onEngineViewChanged||(this._engine._onEngineViewChanged=function(){r._enableEvents()})}return e.prototype.pollInput=function(e,t,i){var n=this._inputs[e][t];if(!n)throw\"Unable to find device \".concat(xi[e]);e>=xi.DualShock&&e<=xi.DualSense&&this._updateDevice(e,t,i);var r=n[i];if(void 0===r)throw\"Unable to find input \".concat(i,\" for device \").concat(xi[e],\" in slot \").concat(t);return i===Ci.Move&&mi.Warn(\"Unable to provide information for PointerInput.Move. Try using PointerInput.Horizontal or PointerInput.Vertical for move data.\"),r},e.prototype.isDeviceAvailable=function(e){return void 0!==this._inputs[e]},e.prototype.dispose=function(){this._onDeviceConnected=function(){},this._onDeviceDisconnected=function(){},this._onInputChanged=function(){},delete this._engine._onEngineViewChanged,this._elementToAttachTo&&this._disableEvents()},e.prototype._enableEvents=function(){var e=null==this?void 0:this._engine.getInputElement();if(e&&(!this._eventsAttached||this._elementToAttachTo!==e)){if(this._disableEvents(),this._inputs)for(var t=0,i=this._inputs;t0){for(var r=0,o=e._metaKeys;r=0))return void mi.Warn(\"Max number of touches exceeded. Ignoring touches in excess of \".concat(e._maxTouchPoints));n=r,e._activeTouchIds[r]=t.pointerId}e._inputs[i]||(e._inputs[i]={}),e._inputs[i][n]?i===xi.Touch&&e._onDeviceConnected(i,n):e._addPointerDevice(i,n,t.clientX,t.clientY);var o=e._inputs[i][n];if(o){var a=o[Ci.Horizontal],s=o[Ci.Vertical];if(i===xi.Mouse){if(-1===e._mouseId&&(void 0===t.pointerId?e._mouseId=e._isUsingFirefox?0:1:e._mouseId=t.pointerId),!document.pointerLockElement)try{e._elementToAttachTo.setPointerCapture(e._mouseId)}catch(e){}}else if(t.pointerId&&!document.pointerLockElement)try{e._elementToAttachTo.setPointerCapture(t.pointerId)}catch(e){}o[Ci.Horizontal]=t.clientX,o[Ci.Vertical]=t.clientY,o[t.button+2]=1;var l=t;l.inputIndex=t.button+2,e._onInputChanged(i,n,l),a===t.clientX&&s===t.clientY||(l.inputIndex=Ci.Move,e._onInputChanged(i,n,l))}},this._pointerUpEvent=function(t){var i,n,r,o,a,s=e._getPointerType(t),l=s===xi.Mouse?0:e._activeTouchIds.indexOf(t.pointerId);if(s===xi.Touch){if(-1===l)return;e._activeTouchIds[l]=-1}var c=null===(i=e._inputs[s])||void 0===i?void 0:i[l];if(c&&0!==c[t.button+2]){var u=c[Ci.Horizontal],h=c[Ci.Vertical];c[Ci.Horizontal]=t.clientX,c[Ci.Vertical]=t.clientY,c[t.button+2]=0;var d=t;u===t.clientX&&h===t.clientY||(d.inputIndex=Ci.Move,e._onInputChanged(s,l,d)),d.inputIndex=t.button+2,s===xi.Mouse&&e._mouseId>=0&&(null===(r=(n=e._elementToAttachTo).hasPointerCapture)||void 0===r?void 0:r.call(n,e._mouseId))?e._elementToAttachTo.releasePointerCapture(e._mouseId):t.pointerId&&(null===(a=(o=e._elementToAttachTo).hasPointerCapture)||void 0===a?void 0:a.call(o,t.pointerId))&&e._elementToAttachTo.releasePointerCapture(t.pointerId),e._onInputChanged(s,l,d),s===xi.Touch&&e._onDeviceDisconnected(s,l)}},this._pointerCancelEvent=function(t){var i,n,r,o;if(\"mouse\"===t.pointerType){var a=e._inputs[xi.Mouse][0];e._mouseId>=0&&(null===(n=(i=e._elementToAttachTo).hasPointerCapture)||void 0===n?void 0:n.call(i,e._mouseId))&&e._elementToAttachTo.releasePointerCapture(e._mouseId);for(var s=Ci.LeftClick;s<=Ci.BrowserForward;s++)if(1===a[s]){a[s]=0;var l=$i.CreateDeviceEvent(xi.Mouse,0,s,0,e,e._elementToAttachTo);e._onInputChanged(xi.Mouse,0,l)}}else{var c=e._activeTouchIds.indexOf(t.pointerId);(null===(o=(r=e._elementToAttachTo).hasPointerCapture)||void 0===o?void 0:o.call(r,t.pointerId))&&e._elementToAttachTo.releasePointerCapture(t.pointerId),e._inputs[xi.Touch][c][Ci.LeftClick]=0,l=$i.CreateDeviceEvent(xi.Touch,c,Ci.LeftClick,0,e,e._elementToAttachTo),e._onInputChanged(xi.Touch,c,l),e._activeTouchIds[c]=-1,e._onDeviceDisconnected(xi.Touch,c)}},this._wheelEventName=\"onwheel\"in document.createElement(\"div\")?\"wheel\":void 0!==document.onmousewheel?\"mousewheel\":\"DOMMouseScroll\";var i=!1,n=function(){};try{var r=Object.defineProperty({},\"passive\",{get:function(){i=!0}});this._elementToAttachTo.addEventListener(\"test\",n,r),this._elementToAttachTo.removeEventListener(\"test\",n,r)}catch(e){}this._pointerBlurEvent=function(){var t,i,n,r,o;if(e.isDeviceAvailable(xi.Mouse)){var a=e._inputs[xi.Mouse][0];e._mouseId>=0&&(null===(i=(t=e._elementToAttachTo).hasPointerCapture)||void 0===i?void 0:i.call(t,e._mouseId))&&e._elementToAttachTo.releasePointerCapture(e._mouseId);for(var s=Ci.LeftClick;s<=Ci.BrowserForward;s++)if(1===a[s]){a[s]=0;var l=$i.CreateDeviceEvent(xi.Mouse,0,s,0,e,e._elementToAttachTo);e._onInputChanged(xi.Mouse,0,l)}}if(e.isDeviceAvailable(xi.Touch)){a=e._inputs[xi.Touch];for(var c=0;c=n.buttons.length?r[i]=n.axes[i-n.buttons.length].valueOf():r[i]=n.buttons[i].value}},e.prototype._getGamepadDeviceType=function(e){return-1!==e.indexOf(\"054c\")?-1!==e.indexOf(\"0ce6\")?xi.DualSense:xi.DualShock:-1!==e.indexOf(\"Xbox One\")||-1!==e.search(\"Xbox 360\")||-1!==e.search(\"xinput\")?xi.Xbox:-1!==e.indexOf(\"057e\")?xi.Switch:xi.Generic},e.prototype._getPointerType=function(e){var t=xi.Mouse;return(\"touch\"===e.pointerType||\"pen\"===e.pointerType||e.touches)&&(t=xi.Touch),t},e}(),rn=function(){function e(e,t,i){void 0===i&&(i=0),this.deviceType=t,this.deviceSlot=i,this.onInputChangedObservable=new u,this._deviceInputSystem=e}return e.prototype.getInput=function(e){return this._deviceInputSystem.pollInput(this.deviceType,this.deviceSlot,e)},e}(),on=function(){function e(e){var t=this;this._registeredManagers=new Array,this._refCount=0,this.registerManager=function(e){for(var i=0;i-1&&t._registeredManagers.splice(i,1)};var i=Object.keys(xi).length/2;this._devices=new Array(i);var n=function(e,i){t._devices[e]||(t._devices[e]=new Array),t._devices[e][i]||(t._devices[e][i]=i);for(var n=0,r=t._registeredManagers;n=Ci.MouseWheelX&&t.inputIndex<=Ci.MouseWheelZ?Hi.POINTERWHEEL:Hi.POINTERMOVE;if(i.onPointerMove&&i.onPointerMove(t,e,c),i.onPointerObservable.hasObservers()){var u=new Yi(c,t,e);this._setRayOnPointerInfo(u),i.onPointerObservable.notifyObservers(u,c)}}},e.prototype._setRayOnPointerInfo=function(e){var t=this._scene;e.pickInfo&&!e.pickInfo._pickingUnavailable&&(e.pickInfo.ray||(e.pickInfo.ray=t.createPickingRay(e.event.offsetX,e.event.offsetY,M.Identity(),t.activeCamera)))},e.prototype._checkPrePointerObservable=function(e,t,i){var n=this._scene,r=new ji(i,t,this._unTranslatedPointerX,this._unTranslatedPointerY);return e&&(r.originalPickingInfo=e,r.ray=e.ray,e.originMesh&&(r.nearInteractionPickingInfo=e)),n.onPrePointerObservable.notifyObservers(r,i),!!r.skipOnPointerObservable},e.prototype.simulatePointerMove=function(e,t){var i=new PointerEvent(\"pointermove\",t);i.inputIndex=Ci.Move,this._checkPrePointerObservable(e,i,Hi.POINTERMOVE)||this._processPointerMove(e,i)},e.prototype.simulatePointerDown=function(e,t){var i=new PointerEvent(\"pointerdown\",t);i.inputIndex=i.button+2,this._checkPrePointerObservable(e,i,Hi.POINTERDOWN)||this._processPointerDown(e,i)},e.prototype._processPointerDown=function(t,i){var n=this,r=this._scene;if(t&&t.hit&&t.pickedMesh){this._pickedDownMesh=t.pickedMesh;var o=t.pickedMesh._getActionManagerForTrigger();if(o){if(o.hasPickTriggers)switch(o.processTrigger(a.ACTION_OnPickDownTrigger,B.CreateNew(t.pickedMesh,i)),i.button){case 0:o.processTrigger(a.ACTION_OnLeftPickTrigger,B.CreateNew(t.pickedMesh,i));break;case 1:o.processTrigger(a.ACTION_OnCenterPickTrigger,B.CreateNew(t.pickedMesh,i));break;case 2:o.processTrigger(a.ACTION_OnRightPickTrigger,B.CreateNew(t.pickedMesh,i))}o.hasSpecificTrigger(a.ACTION_OnLongPressTrigger)&&window.setTimeout((function(){var t=r.pick(n._unTranslatedPointerX,n._unTranslatedPointerY,(function(e){return e.isPickable&&e.isVisible&&e.isReady()&&e.actionManager&&e.actionManager.hasSpecificTrigger(a.ACTION_OnLongPressTrigger)&&e===n._pickedDownMesh}),!1,r.cameraToUseForPointers);t&&t.hit&&t.pickedMesh&&o&&0!==n._totalPointersPressed&&Date.now()-n._startingPointerTime>e.LongPressDelay&&!n._isPointerSwiping()&&(n._startingPointerTime=0,o.processTrigger(a.ACTION_OnLongPressTrigger,B.CreateNew(t.pickedMesh,i)))}),e.LongPressDelay)}}else for(var s=0,l=r._pointerDownStage;se.DragMovementThreshold||Math.abs(this._startingPointerPosition.y-this._pointerY)>e.DragMovementThreshold},e.prototype.simulatePointerUp=function(e,t,i){var n=new PointerEvent(\"pointerup\",t);n.inputIndex=Ci.Move;var r=new sn;i?r.doubleClick=!0:r.singleClick=!0,this._checkPrePointerObservable(e,n,Hi.POINTERUP)||this._processPointerUp(e,n,r)},e.prototype._processPointerUp=function(e,t,i){var n=this._scene;if(e&&e.hit&&e.pickedMesh){if(this._pickedUpMesh=e.pickedMesh,this._pickedDownMesh===this._pickedUpMesh&&(n.onPointerPick&&n.onPointerPick(t,e),i.singleClick&&!i.ignore&&n.onPointerObservable.hasObservers())){var r=Hi.POINTERPICK,o=new Yi(r,t,e);this._setRayOnPointerInfo(o),n.onPointerObservable.notifyObservers(o,r)}var s=e.pickedMesh._getActionManagerForTrigger();if(s&&!i.ignore){s.processTrigger(a.ACTION_OnPickUpTrigger,B.CreateNew(e.pickedMesh,t,e)),!i.hasSwiped&&i.singleClick&&s.processTrigger(a.ACTION_OnPickTrigger,B.CreateNew(e.pickedMesh,t,e));var l=e.pickedMesh._getActionManagerForTrigger(a.ACTION_OnDoublePickTrigger);i.doubleClick&&l&&l.processTrigger(a.ACTION_OnDoublePickTrigger,B.CreateNew(e.pickedMesh,t,e))}}else if(!i.ignore)for(var c=0,u=n._pointerUpStage;ce.DoubleClickDelay&&!o._doubleClickOccured||t!==o._previousButtonPressed)&&(o._doubleClickOccured=!1,i.singleClick=!0,i.ignore=!1,n(i,o._currentPickResult))},this._initClickEvent=function(t,i,n,r){var l=new sn;o._currentPickResult=null;var c=null,u=t.hasSpecificMask(Hi.POINTERPICK)||i.hasSpecificMask(Hi.POINTERPICK)||t.hasSpecificMask(Hi.POINTERTAP)||i.hasSpecificMask(Hi.POINTERTAP)||t.hasSpecificMask(Hi.POINTERDOUBLETAP)||i.hasSpecificMask(Hi.POINTERDOUBLETAP);!u&&s&&(c=o._initActionManager(c,l))&&(u=c.hasPickTriggers);var h=!1;if(u){var d=n.button;if(l.hasSwiped=o._isPointerSwiping(),!l.hasSwiped){var p=!e.ExclusiveDoubleClickMode;p||(p=!t.hasSpecificMask(Hi.POINTERDOUBLETAP)&&!i.hasSpecificMask(Hi.POINTERDOUBLETAP))&&!s.HasSpecificTrigger(a.ACTION_OnDoublePickTrigger)&&(c=o._initActionManager(c,l))&&(p=!c.hasSpecificTrigger(a.ACTION_OnDoublePickTrigger)),p?(Date.now()-o._previousStartingPointerTime>e.DoubleClickDelay||d!==o._previousButtonPressed)&&(l.singleClick=!0,r(l,o._currentPickResult),h=!0):(o._previousDelayedSimpleClickTimeout=o._delayedSimpleClickTimeout,o._delayedSimpleClickTimeout=window.setTimeout(o._delayedSimpleClick.bind(o,d,l,r),e.DoubleClickDelay));var f=t.hasSpecificMask(Hi.POINTERDOUBLETAP)||i.hasSpecificMask(Hi.POINTERDOUBLETAP);!f&&s.HasSpecificTrigger(a.ACTION_OnDoublePickTrigger)&&(c=o._initActionManager(c,l))&&(f=c.hasSpecificTrigger(a.ACTION_OnDoublePickTrigger)),f&&(d===o._previousButtonPressed&&Date.now()-o._previousStartingPointerTime=Ci.MouseWheelX&&e.inputIndex<=Ci.MouseWheelZ?Hi.POINTERWHEEL:Hi.POINTERMOVE)&&(l.cameraToUseForPointers||l.activeCamera))if(l.skipPointerMovePicking)o._processPointerMove(new Bi,e);else{l.pointerMovePredicate||(l.pointerMovePredicate=function(e){return e.isPickable&&e.isVisible&&e.isReady()&&e.isEnabled()&&(e.enablePointerMoveEvents||l.constantlyUpdateMeshUnderPointer||null!==e._getActionManagerForTrigger())&&(!l.cameraToUseForPointers||0!=(l.cameraToUseForPointers.layerMask&e.layerMask))});var t=l.pick(o._unTranslatedPointerX,o._unTranslatedPointerY,l.pointerMovePredicate,!1,l.cameraToUseForPointers,l.pointerMoveTrianglePredicate);o._processPointerMove(t,e)}},this._onPointerDown=function(e){var t;o._totalPointersPressed++,o._pickedDownMesh=null,o._meshPickProceed=!1,void 0===e.pointerId&&(e.pointerId=0),o._updatePointerPosition(e),l.preventDefaultOnPointerDown&&r&&(e.preventDefault(),r.focus()),o._startingPointerPosition.x=o._pointerX,o._startingPointerPosition.y=o._pointerY,o._startingPointerTime=Date.now(),o._checkPrePointerObservable(null,e,Hi.POINTERDOWN)||(l.cameraToUseForPointers||l.activeCamera)&&(o._pointerCaptures[e.pointerId]=!0,l.pointerDownPredicate||(l.pointerDownPredicate=function(e){return e.isPickable&&e.isVisible&&e.isReady()&&e.isEnabled()&&(!l.cameraToUseForPointers||0!=(l.cameraToUseForPointers.layerMask&e.layerMask))}),o._pickedDownMesh=null,t=l.skipPointerDownPicking?new Bi:l.pick(o._unTranslatedPointerX,o._unTranslatedPointerY,l.pointerDownPredicate,!1,l.cameraToUseForPointers),o._processPointerDown(t,e))},this._onPointerUp=function(e){0!==o._totalPointersPressed&&(o._totalPointersPressed--,o._pickedUpMesh=null,o._meshPickProceed=!1,void 0===e.pointerId&&(e.pointerId=0),o._updatePointerPosition(e),l.preventDefaultOnPointerUp&&r&&(e.preventDefault(),r.focus()),o._initClickEvent(l.onPrePointerObservable,l.onPointerObservable,e,(function(t,i){if(l.onPrePointerObservable.hasObservers()&&!t.ignore){if(!t.hasSwiped){if(t.singleClick&&l.onPrePointerObservable.hasSpecificMask(Hi.POINTERTAP)&&o._checkPrePointerObservable(null,e,Hi.POINTERTAP))return;if(t.doubleClick&&l.onPrePointerObservable.hasSpecificMask(Hi.POINTERDOUBLETAP)&&o._checkPrePointerObservable(null,e,Hi.POINTERDOUBLETAP))return}if(o._checkPrePointerObservable(null,e,Hi.POINTERUP))return}o._pointerCaptures[e.pointerId]=!1,(l.cameraToUseForPointers||l.activeCamera)&&(l.pointerUpPredicate||(l.pointerUpPredicate=function(e){return e.isPickable&&e.isVisible&&e.isReady()&&e.isEnabled()&&(!l.cameraToUseForPointers||0!=(l.cameraToUseForPointers.layerMask&e.layerMask))}),!o._meshPickProceed&&(s&&s.HasTriggers||l.onPointerObservable.hasObservers())&&o._initActionManager(null,t),i||(i=o._currentPickResult),o._processPointerUp(i,e,t),o._previousPickResult=o._currentPickResult)})))},this._onKeyDown=function(e){var t=Ki.KEYDOWN;if(l.onPreKeyboardObservable.hasObservers()){var i=new qi(t,e);if(l.onPreKeyboardObservable.notifyObservers(i,t),i.skipOnKeyboardObservable)return}l.onKeyboardObservable.hasObservers()&&(i=new Qi(t,e),l.onKeyboardObservable.notifyObservers(i,t)),l.actionManager&&l.actionManager.processTrigger(a.ACTION_OnKeyDownTrigger,B.CreateNewFromScene(l,e))},this._onKeyUp=function(e){var t=Ki.KEYUP;if(l.onPreKeyboardObservable.hasObservers()){var i=new qi(t,e);if(l.onPreKeyboardObservable.notifyObservers(i,t),i.skipOnKeyboardObservable)return}l.onKeyboardObservable.hasObservers()&&(i=new Qi(t,e),l.onKeyboardObservable.notifyObservers(i,t)),l.actionManager&&l.actionManager.processTrigger(a.ACTION_OnKeyUpTrigger,B.CreateNewFromScene(l,e))},this._deviceSourceManager.onDeviceConnectedObservable.add((function(e){e.deviceType===xi.Mouse?e.onInputChangedObservable.add((function(r){r.inputIndex===Ci.LeftClick||r.inputIndex===Ci.MiddleClick||r.inputIndex===Ci.RightClick||r.inputIndex===Ci.BrowserBack||r.inputIndex===Ci.BrowserForward?i&&1===e.getInput(r.inputIndex)?o._onPointerDown(r):t&&0===e.getInput(r.inputIndex)&&o._onPointerUp(r):n&&(r.inputIndex===Ci.Move?o._onPointerMove(r):r.inputIndex!==Ci.MouseWheelX&&r.inputIndex!==Ci.MouseWheelY&&r.inputIndex!==Ci.MouseWheelZ||o._onPointerMove(r))})):e.deviceType===xi.Touch?e.onInputChangedObservable.add((function(r){r.inputIndex===Ci.LeftClick&&(i&&1===e.getInput(r.inputIndex)?o._onPointerDown(r):t&&0===e.getInput(r.inputIndex)&&o._onPointerUp(r)),n&&r.inputIndex===Ci.Move&&o._onPointerMove(r)})):e.deviceType===xi.Keyboard&&e.onInputChangedObservable.add((function(e){\"keydown\"===e.type?o._onKeyDown(e):\"keyup\"===e.type&&o._onKeyUp(e)}))})),this._alreadyAttached=!0},e.prototype.detachControl=function(){this._alreadyAttached&&(this._deviceSourceManager.dispose(),this._deviceSourceManager=null,this._alreadyAttachedTo&&!this._scene.doNotHandleCursors&&(this._alreadyAttachedTo.style.cursor=this._scene.defaultCursor),this._alreadyAttached=!1,this._alreadyAttachedTo=null)},e.prototype.setPointerOverMesh=function(e,t,i){if(void 0===t&&(t=0),this._meshUnderPointerId[t]!==e){var n,r=this._meshUnderPointerId[t];r&&(n=r._getActionManagerForTrigger(a.ACTION_OnPointerOutTrigger))&&n.processTrigger(a.ACTION_OnPointerOutTrigger,B.CreateNew(r,void 0,{pointerId:t})),e?(this._meshUnderPointerId[t]=e,this._pointerOverMesh=e,(n=e._getActionManagerForTrigger(a.ACTION_OnPointerOverTrigger))&&n.processTrigger(a.ACTION_OnPointerOverTrigger,B.CreateNew(e,void 0,{pointerId:t,pickResult:i}))):(delete this._meshUnderPointerId[t],this._pointerOverMesh=null)}},e.prototype.getPointerOverMesh=function(){return this._pointerOverMesh},e.prototype._invalidateMesh=function(e){for(var t in this._pointerOverMesh===e&&(this._pointerOverMesh=null),this._pickedDownMesh===e&&(this._pickedDownMesh=null),this._pickedUpMesh===e&&(this._pickedUpMesh=null),this._meshUnderPointerId)this._meshUnderPointerId[t]===e&&delete this._meshUnderPointerId[t]},e.DragMovementThreshold=10,e.LongPressDelay=500,e.DoubleClickDelay=300,e.ExclusiveDoubleClickMode=!1,e}(),cn=function(){function e(){this._startMonitoringTime=0,this._min=0,this._max=0,this._average=0,this._lastSecAverage=0,this._current=0,this._totalValueCount=0,this._totalAccumulated=0,this._lastSecAccumulated=0,this._lastSecTime=0,this._lastSecValueCount=0}return Object.defineProperty(e.prototype,\"min\",{get:function(){return this._min},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"max\",{get:function(){return this._max},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"average\",{get:function(){return this._average},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"lastSecAverage\",{get:function(){return this._lastSecAverage},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"current\",{get:function(){return this._current},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"total\",{get:function(){return this._totalAccumulated},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"count\",{get:function(){return this._totalValueCount},enumerable:!1,configurable:!0}),e.prototype.fetchNewFrame=function(){this._totalValueCount++,this._current=0,this._lastSecValueCount++},e.prototype.addCount=function(t,i){e.Enabled&&(this._current+=t,i&&this._fetchResult())},e.prototype.beginMonitoring=function(){e.Enabled&&(this._startMonitoringTime=it.Now)},e.prototype.endMonitoring=function(t){if(void 0===t&&(t=!0),e.Enabled){t&&this.fetchNewFrame();var i=it.Now;this._current=i-this._startMonitoringTime,t&&this._fetchResult()}},e.prototype._fetchResult=function(){this._totalAccumulated+=this._current,this._lastSecAccumulated+=this._current,this._min=Math.min(this._min,this._current),this._max=Math.max(this._max,this._current),this._average=this._totalAccumulated/this._totalValueCount;var e=it.Now;e-this._lastSecTime>1e3&&(this._lastSecAverage=this._lastSecAccumulated/this._lastSecValueCount,this._lastSecTime=e,this._lastSecAccumulated=0,this._lastSecValueCount=0)},e.Enabled=!0,e}(),un=function(){function e(e,t,i,n){this.normal=new x(e,t,i),this.d=n}return e.prototype.asArray=function(){return[this.normal.x,this.normal.y,this.normal.z,this.d]},e.prototype.clone=function(){return new e(this.normal.x,this.normal.y,this.normal.z,this.d)},e.prototype.getClassName=function(){return\"Plane\"},e.prototype.getHashCode=function(){var e=this.normal.getHashCode();return 397*e^(0|this.d)},e.prototype.normalize=function(){var e=Math.sqrt(this.normal.x*this.normal.x+this.normal.y*this.normal.y+this.normal.z*this.normal.z),t=0;return 0!==e&&(t=1/e),this.normal.x*=t,this.normal.y*=t,this.normal.z*=t,this.d*=t,this},e.prototype.transform=function(t){var i=e._TmpMatrix;t.invertToRef(i);var n=i.m,r=this.normal.x,o=this.normal.y,a=this.normal.z,s=this.d;return new e(r*n[0]+o*n[1]+a*n[2]+s*n[3],r*n[4]+o*n[5]+a*n[6]+s*n[7],r*n[8]+o*n[9]+a*n[10]+s*n[11],r*n[12]+o*n[13]+a*n[14]+s*n[15])},e.prototype.dotCoordinate=function(e){return this.normal.x*e.x+this.normal.y*e.y+this.normal.z*e.z+this.d},e.prototype.copyFromPoints=function(e,t,i){var n,r=t.x-e.x,o=t.y-e.y,a=t.z-e.z,s=i.x-e.x,l=i.y-e.y,c=i.z-e.z,u=o*c-a*l,h=a*s-r*c,d=r*l-o*s,p=Math.sqrt(u*u+h*h+d*d);return n=0!==p?1/p:0,this.normal.x=u*n,this.normal.y=h*n,this.normal.z=d*n,this.d=-(this.normal.x*e.x+this.normal.y*e.y+this.normal.z*e.z),this},e.prototype.isFrontFacingTo=function(e,t){return x.Dot(this.normal,e)<=t},e.prototype.signedDistanceTo=function(e){return x.Dot(e,this.normal)+this.d},e.FromArray=function(t){return new e(t[0],t[1],t[2],t[3])},e.FromPoints=function(t,i,n){var r=new e(0,0,0,0);return r.copyFromPoints(t,i,n),r},e.FromPositionAndNormal=function(t,i){var n=new e(0,0,0,0);return i.normalize(),n.normal=i,n.d=-(i.x*t.x+i.y*t.y+i.z*t.z),n},e.SignedDistanceToPlaneFromPositionAndNormal=function(e,t,i){var n=-(t.x*e.x+t.y*e.y+t.z*e.z);return x.Dot(i,t)+n},e._TmpMatrix=M.Identity(),e}(),hn=function(){function e(){}return e.GetPlanes=function(t){for(var i=[],n=0;n<6;n++)i.push(new un(0,0,0,0));return e.GetPlanesToRef(t,i),i},e.GetNearPlaneToRef=function(e,t){var i=e.m;t.normal.x=i[3]+i[2],t.normal.y=i[7]+i[6],t.normal.z=i[11]+i[10],t.d=i[15]+i[14],t.normalize()},e.GetFarPlaneToRef=function(e,t){var i=e.m;t.normal.x=i[3]-i[2],t.normal.y=i[7]-i[6],t.normal.z=i[11]-i[10],t.d=i[15]-i[14],t.normalize()},e.GetLeftPlaneToRef=function(e,t){var i=e.m;t.normal.x=i[3]+i[0],t.normal.y=i[7]+i[4],t.normal.z=i[11]+i[8],t.d=i[15]+i[12],t.normalize()},e.GetRightPlaneToRef=function(e,t){var i=e.m;t.normal.x=i[3]-i[0],t.normal.y=i[7]-i[4],t.normal.z=i[11]-i[8],t.d=i[15]-i[12],t.normalize()},e.GetTopPlaneToRef=function(e,t){var i=e.m;t.normal.x=i[3]-i[1],t.normal.y=i[7]-i[5],t.normal.z=i[11]-i[9],t.d=i[15]-i[13],t.normalize()},e.GetBottomPlaneToRef=function(e,t){var i=e.m;t.normal.x=i[3]+i[1],t.normal.y=i[7]+i[5],t.normal.z=i[11]+i[9],t.d=i[15]+i[13],t.normalize()},e.GetPlanesToRef=function(t,i){e.GetNearPlaneToRef(t,i[0]),e.GetFarPlaneToRef(t,i[1]),e.GetLeftPlaneToRef(t,i[2]),e.GetRightPlaneToRef(t,i[3]),e.GetTopPlaneToRef(t,i[4]),e.GetBottomPlaneToRef(t,i[5])},e}(),dn=function(){function e(){}return Object.defineProperty(e,\"UniqueId\",{get:function(){var e=this._UniqueIdCounter;return this._UniqueIdCounter++,e},enumerable:!1,configurable:!0}),e._UniqueIdCounter=1,e}(),pn=function(){function e(){}return e.CompareLightsPriority=function(e,t){return e.shadowEnabled!==t.shadowEnabled?(t.shadowEnabled?1:0)-(e.shadowEnabled?1:0):t.renderPriority-e.renderPriority},e.FALLOFF_DEFAULT=0,e.FALLOFF_PHYSICAL=1,e.FALLOFF_GLTF=2,e.FALLOFF_STANDARD=3,e.LIGHTMAP_DEFAULT=0,e.LIGHTMAP_SPECULAR=1,e.LIGHTMAP_SHADOWSONLY=2,e.INTENSITYMODE_AUTOMATIC=0,e.INTENSITYMODE_LUMINOUSPOWER=1,e.INTENSITYMODE_LUMINOUSINTENSITY=2,e.INTENSITYMODE_ILLUMINANCE=3,e.INTENSITYMODE_LUMINANCE=4,e.LIGHTTYPEID_POINTLIGHT=0,e.LIGHTTYPEID_DIRECTIONALLIGHT=1,e.LIGHTTYPEID_SPOTLIGHT=2,e.LIGHTTYPEID_HEMISPHERICLIGHT=3,e}(),fn=function(){function e(t,i){e.IsAvailable&&(this._observer=new window.ComputePressureObserver(t,i))}return Object.defineProperty(e,\"IsAvailable\",{get:function(){var e,t;return qe()&&\"ComputePressureObserver\"in window&&(null===(t=null===(e=window.ComputePressureObserver)||void 0===e?void 0:e.supportedSources)||void 0===t?void 0:t.includes(\"cpu\"))},enumerable:!1,configurable:!0}),e.prototype.observe=function(e){var t,i;(null===(t=this._observer)||void 0===t?void 0:t.observe)&&(null===(i=this._observer)||void 0===i||i.observe(e).catch((function(){})))},e.prototype.unobserve=function(e){var t,i;try{(null===(t=this._observer)||void 0===t?void 0:t.unobserve)&&(null===(i=this._observer)||void 0===i||i.unobserve(e))}catch(e){}},e}();!function(e){e[e.BackwardCompatible=0]=\"BackwardCompatible\",e[e.Intermediate=1]=\"Intermediate\",e[e.Aggressive=2]=\"Aggressive\"}(Zi||(Zi={}));var _n,mn=function(e){function t(i,n){var r=e.call(this)||this;r._inputManager=new ln(r),r.cameraToUseForPointers=null,r._isScene=!0,r._blockEntityCollection=!1,r.autoClear=!0,r.autoClearDepthAndStencil=!0,r.clearColor=new L(.2,.2,.3,1),r.ambientColor=new N(0,0,0),r.environmentIntensity=1,r._performancePriority=Zi.BackwardCompatible,r._forceWireframe=!1,r._skipFrustumClipping=!1,r._forcePointsCloud=!1,r.animationsEnabled=!0,r._animationPropertiesOverride=null,r.useConstantAnimationDeltaTime=!1,r.constantlyUpdateMeshUnderPointer=!1,r.hoverCursor=\"pointer\",r.defaultCursor=\"\",r.doNotHandleCursors=!1,r.preventDefaultOnPointerDown=!0,r.preventDefaultOnPointerUp=!0,r.metadata=null,r.reservedDataStore=null,r.disableOfflineSupportExceptionRules=new Array,r.onDisposeObservable=new u,r._onDisposeObserver=null,r.onBeforeRenderObservable=new u,r._onBeforeRenderObserver=null,r.onAfterRenderObservable=new u,r.onAfterRenderCameraObservable=new u,r._onAfterRenderObserver=null,r.onBeforeAnimationsObservable=new u,r.onAfterAnimationsObservable=new u,r.onBeforeDrawPhaseObservable=new u,r.onAfterDrawPhaseObservable=new u,r.onReadyObservable=new u,r.onBeforeCameraRenderObservable=new u,r._onBeforeCameraRenderObserver=null,r.onAfterCameraRenderObservable=new u,r._onAfterCameraRenderObserver=null,r.onBeforeActiveMeshesEvaluationObservable=new u,r.onAfterActiveMeshesEvaluationObservable=new u,r.onBeforeParticlesRenderingObservable=new u,r.onAfterParticlesRenderingObservable=new u,r.onDataLoadedObservable=new u,r.onNewCameraAddedObservable=new u,r.onCameraRemovedObservable=new u,r.onNewLightAddedObservable=new u,r.onLightRemovedObservable=new u,r.onNewGeometryAddedObservable=new u,r.onGeometryRemovedObservable=new u,r.onNewTransformNodeAddedObservable=new u,r.onTransformNodeRemovedObservable=new u,r.onNewMeshAddedObservable=new u,r.onMeshRemovedObservable=new u,r.onNewSkeletonAddedObservable=new u,r.onSkeletonRemovedObservable=new u,r.onNewMaterialAddedObservable=new u,r.onNewMultiMaterialAddedObservable=new u,r.onMaterialRemovedObservable=new u,r.onMultiMaterialRemovedObservable=new u,r.onNewTextureAddedObservable=new u,r.onTextureRemovedObservable=new u,r.onBeforeRenderTargetsRenderObservable=new u,r.onAfterRenderTargetsRenderObservable=new u,r.onBeforeStepObservable=new u,r.onAfterStepObservable=new u,r.onActiveCameraChanged=new u,r.onActiveCamerasChanged=new u,r.onBeforeRenderingGroupObservable=new u,r.onAfterRenderingGroupObservable=new u,r.onMeshImportedObservable=new u,r.onAnimationFileImportedObservable=new u,r._registeredForLateAnimationBindings=new bi(256),r.skipPointerMovePicking=!1,r.skipPointerDownPicking=!1,r.skipPointerUpPicking=!1,r.onPrePointerObservable=new u,r.onPointerObservable=new u,r.onPreKeyboardObservable=new u,r.onKeyboardObservable=new u,r._useRightHandedSystem=!1,r._timeAccumulator=0,r._currentStepId=0,r._currentInternalStep=0,r._fogEnabled=!0,r._fogMode=t.FOGMODE_NONE,r.fogColor=new N(.2,.2,.3),r.fogDensity=.1,r.fogStart=0,r.fogEnd=1e3,r.needsPreviousWorldMatrices=!1,r._shadowsEnabled=!0,r._lightsEnabled=!0,r._unObserveActiveCameras=null,r._texturesEnabled=!0,r.physicsEnabled=!0,r.particlesEnabled=!0,r.spritesEnabled=!0,r._skeletonsEnabled=!0,r.lensFlaresEnabled=!0,r.collisionsEnabled=!0,r.gravity=new x(0,-9.807,0),r.postProcessesEnabled=!0,r.renderTargetsEnabled=!0,r.dumpNextRenderTargets=!1,r.customRenderTargets=new Array,r.importedMeshesFiles=new Array,r.probesEnabled=!0,r._meshesForIntersections=new bi(256),r.proceduralTexturesEnabled=!0,r._totalVertices=new cn,r._activeIndices=new cn,r._activeParticles=new cn,r._activeBones=new cn,r._animationTime=0,r.animationTimeScale=1,r._renderId=0,r._frameId=0,r._executeWhenReadyTimeoutId=null,r._intermediateRendering=!1,r._defaultFrameBufferCleared=!1,r._viewUpdateFlag=-1,r._projectionUpdateFlag=-1,r._toBeDisposed=new Array(256),r._activeRequests=new Array,r._pendingData=new Array,r._isDisposed=!1,r.dispatchAllSubMeshesOfActiveMeshes=!1,r._activeMeshes=new yi(256),r._processedMaterials=new yi(256),r._renderTargets=new bi(256),r._materialsRenderTargets=new bi(256),r._activeParticleSystems=new yi(256),r._activeSkeletons=new bi(32),r._softwareSkinnedMeshes=new bi(32),r._activeAnimatables=new Array,r._transformMatrix=M.Zero(),r.requireLightSorting=!1,r._components=[],r._serializableComponents=[],r._transientComponents=[],r._beforeCameraUpdateStage=Wi.Create(),r._beforeClearStage=Wi.Create(),r._beforeRenderTargetClearStage=Wi.Create(),r._gatherRenderTargetsStage=Wi.Create(),r._gatherActiveCameraRenderTargetsStage=Wi.Create(),r._isReadyForMeshStage=Wi.Create(),r._beforeEvaluateActiveMeshStage=Wi.Create(),r._evaluateSubMeshStage=Wi.Create(),r._preActiveMeshStage=Wi.Create(),r._cameraDrawRenderTargetStage=Wi.Create(),r._beforeCameraDrawStage=Wi.Create(),r._beforeRenderTargetDrawStage=Wi.Create(),r._beforeRenderingGroupDrawStage=Wi.Create(),r._beforeRenderingMeshStage=Wi.Create(),r._afterRenderingMeshStage=Wi.Create(),r._afterRenderingGroupDrawStage=Wi.Create(),r._afterCameraDrawStage=Wi.Create(),r._afterCameraPostProcessStage=Wi.Create(),r._afterRenderTargetDrawStage=Wi.Create(),r._afterRenderTargetPostProcessStage=Wi.Create(),r._afterRenderStage=Wi.Create(),r._pointerMoveStage=Wi.Create(),r._pointerDownStage=Wi.Create(),r._pointerUpStage=Wi.Create(),r._geometriesByUniqueId=null,r._defaultMeshCandidates={data:[],length:0},r._defaultSubMeshCandidates={data:[],length:0},r._preventFreeActiveMeshesAndRenderingGroups=!1,r._activeMeshesFrozen=!1,r._activeMeshesFrozenButKeepClipping=!1,r._skipEvaluateActiveMeshesCompletely=!1,r._allowPostProcessClearColor=!0,r.getDeterministicFrameTime=function(){return r._engine.getTimeStep()},r._blockMaterialDirtyMechanism=!1,r._perfCollector=null,r.onComputePressureChanged=new u,r.activeCameras=new Array;var o=k({useGeometryUniqueIdsMap:!0,useMaterialMeshMap:!0,useClonedMeshMap:!0,virtual:!1},n);return r._engine=i||S.LastCreatedEngine,o.virtual?r._engine._virtualScenes.push(r):(S._LastCreatedScene=r,r._engine.scenes.push(r)),r._uid=null,r._renderingManager=new Gi(r),Ui&&(r.postProcessManager=new Ui(r)),qe()&&r.attachControl(),r._createUbo(),Ri&&(r._imageProcessingConfiguration=new Ri),r.setDefaultCandidateProviders(),o.useGeometryUniqueIdsMap&&(r._geometriesByUniqueId={}),r.useMaterialMeshMap=o.useMaterialMeshMap,r.useClonedMeshMap=o.useClonedMeshMap,n&&n.virtual||r._engine.onNewSceneAddedObservable.notifyObservers(r),fn.IsAvailable&&(r._computePressureObserver=new fn((function(e){r.onComputePressureChanged.notifyObservers(e)}),{cpuUtilizationThresholds:[.25,.5,.75,.9],cpuSpeedThresholds:[.5]}),r._computePressureObserver.observe(\"cpu\")),r}return V(t,e),t.DefaultMaterialFactory=function(e){throw pe(\"StandardMaterial\")},t.CollisionCoordinatorFactory=function(){throw pe(\"DefaultCollisionCoordinator\")},Object.defineProperty(t.prototype,\"environmentTexture\",{get:function(){return this._environmentTexture},set:function(e){this._environmentTexture!==e&&(this._environmentTexture=e,this.markAllMaterialsAsDirty(a.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"imageProcessingConfiguration\",{get:function(){return this._imageProcessingConfiguration},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"performancePriority\",{get:function(){return this._performancePriority},set:function(e){if(e!==this._performancePriority)switch(this._performancePriority=e,e){case Zi.BackwardCompatible:this.skipFrustumClipping=!1,this._renderingManager.maintainStateBetweenFrames=!1,this.skipPointerMovePicking=!1,this.autoClear=!0;break;case Zi.Intermediate:this.skipFrustumClipping=!1,this._renderingManager.maintainStateBetweenFrames=!1,this.skipPointerMovePicking=!0,this.autoClear=!1;break;case Zi.Aggressive:this.skipFrustumClipping=!0,this._renderingManager.maintainStateBetweenFrames=!0,this.skipPointerMovePicking=!0,this.autoClear=!1}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"forceWireframe\",{get:function(){return this._forceWireframe},set:function(e){this._forceWireframe!==e&&(this._forceWireframe=e,this.markAllMaterialsAsDirty(a.MATERIAL_MiscDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"skipFrustumClipping\",{get:function(){return this._skipFrustumClipping},set:function(e){this._skipFrustumClipping!==e&&(this._skipFrustumClipping=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"forcePointsCloud\",{get:function(){return this._forcePointsCloud},set:function(e){this._forcePointsCloud!==e&&(this._forcePointsCloud=e,this.markAllMaterialsAsDirty(a.MATERIAL_MiscDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"animationPropertiesOverride\",{get:function(){return this._animationPropertiesOverride},set:function(e){this._animationPropertiesOverride=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"onDispose\",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"beforeRender\",{set:function(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),e&&(this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"afterRender\",{set:function(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),e&&(this._onAfterRenderObserver=this.onAfterRenderObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"beforeCameraRender\",{set:function(e){this._onBeforeCameraRenderObserver&&this.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),this._onBeforeCameraRenderObserver=this.onBeforeCameraRenderObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"afterCameraRender\",{set:function(e){this._onAfterCameraRenderObserver&&this.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver),this._onAfterCameraRenderObserver=this.onAfterCameraRenderObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"unTranslatedPointer\",{get:function(){return this._inputManager.unTranslatedPointer},enumerable:!1,configurable:!0}),Object.defineProperty(t,\"DragMovementThreshold\",{get:function(){return ln.DragMovementThreshold},set:function(e){ln.DragMovementThreshold=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,\"LongPressDelay\",{get:function(){return ln.LongPressDelay},set:function(e){ln.LongPressDelay=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,\"DoubleClickDelay\",{get:function(){return ln.DoubleClickDelay},set:function(e){ln.DoubleClickDelay=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,\"ExclusiveDoubleClickMode\",{get:function(){return ln.ExclusiveDoubleClickMode},set:function(e){ln.ExclusiveDoubleClickMode=e},enumerable:!1,configurable:!0}),t.prototype.bindEyePosition=function(e,t,i){var n;void 0===t&&(t=\"vEyePosition\"),void 0===i&&(i=!1);var r=this._forcedViewPosition?this._forcedViewPosition:this._mirroredCameraPosition?this._mirroredCameraPosition:null!==(n=this.activeCamera.globalPosition)&&void 0!==n?n:this.activeCamera.devicePosition,o=this.useRightHandedSystem===(null!=this._mirroredCameraPosition);return O.Vector4[0].set(r.x,r.y,r.z,o?-1:1),e&&(i?e.setFloat3(t,O.Vector4[0].x,O.Vector4[0].y,O.Vector4[0].z):e.setVector4(t,O.Vector4[0])),O.Vector4[0]},t.prototype.finalizeSceneUbo=function(){var e=this.getSceneUniformBuffer(),t=this.bindEyePosition(null);return e.updateFloat4(\"vEyePosition\",t.x,t.y,t.z,t.w),e.update(),e},Object.defineProperty(t.prototype,\"useRightHandedSystem\",{get:function(){return this._useRightHandedSystem},set:function(e){this._useRightHandedSystem!==e&&(this._useRightHandedSystem=e,this.markAllMaterialsAsDirty(a.MATERIAL_MiscDirtyFlag))},enumerable:!1,configurable:!0}),t.prototype.setStepId=function(e){this._currentStepId=e},t.prototype.getStepId=function(){return this._currentStepId},t.prototype.getInternalStep=function(){return this._currentInternalStep},Object.defineProperty(t.prototype,\"fogEnabled\",{get:function(){return this._fogEnabled},set:function(e){this._fogEnabled!==e&&(this._fogEnabled=e,this.markAllMaterialsAsDirty(a.MATERIAL_MiscDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"fogMode\",{get:function(){return this._fogMode},set:function(e){this._fogMode!==e&&(this._fogMode=e,this.markAllMaterialsAsDirty(a.MATERIAL_MiscDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"prePass\",{get:function(){return!!this.prePassRenderer&&this.prePassRenderer.defaultRT.enabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"shadowsEnabled\",{get:function(){return this._shadowsEnabled},set:function(e){this._shadowsEnabled!==e&&(this._shadowsEnabled=e,this.markAllMaterialsAsDirty(a.MATERIAL_LightDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"lightsEnabled\",{get:function(){return this._lightsEnabled},set:function(e){this._lightsEnabled!==e&&(this._lightsEnabled=e,this.markAllMaterialsAsDirty(a.MATERIAL_LightDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"activeCameras\",{get:function(){return this._activeCameras},set:function(e){var t=this;this._unObserveActiveCameras&&(this._unObserveActiveCameras(),this._unObserveActiveCameras=null),e&&(this._unObserveActiveCameras=v(e,(function(){t.onActiveCamerasChanged.notifyObservers(t)}))),this._activeCameras=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"activeCamera\",{get:function(){return this._activeCamera},set:function(e){e!==this._activeCamera&&(this._activeCamera=e,this.onActiveCameraChanged.notifyObservers(this))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"defaultMaterial\",{get:function(){return this._defaultMaterial||(this._defaultMaterial=t.DefaultMaterialFactory(this)),this._defaultMaterial},set:function(e){this._defaultMaterial=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"texturesEnabled\",{get:function(){return this._texturesEnabled},set:function(e){this._texturesEnabled!==e&&(this._texturesEnabled=e,this.markAllMaterialsAsDirty(a.MATERIAL_TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"skeletonsEnabled\",{get:function(){return this._skeletonsEnabled},set:function(e){this._skeletonsEnabled!==e&&(this._skeletonsEnabled=e,this.markAllMaterialsAsDirty(a.MATERIAL_AttributesDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"collisionCoordinator\",{get:function(){return this._collisionCoordinator||(this._collisionCoordinator=t.CollisionCoordinatorFactory(),this._collisionCoordinator.init(this)),this._collisionCoordinator},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"renderingManager\",{get:function(){return this._renderingManager},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"frustumPlanes\",{get:function(){return this._frustumPlanes},enumerable:!1,configurable:!0}),t.prototype._registerTransientComponents=function(){if(this._transientComponents.length>0){for(var e=0,t=this._transientComponents;e0&&(n=!1),e&&(this._processedMaterials.reset(),this._materialsRenderTargets.reset()),t=0;t0,s=0,l=this._isReadyForMeshStage;s0){for(var p=0,f=this.activeCameras;p0},enumerable:!1,configurable:!0}),t.prototype.executeWhenReady=function(e,t){void 0===t&&(t=!1),this.onReadyObservable.add(e),null===this._executeWhenReadyTimeoutId&&this._checkIsReady(t)},t.prototype.whenReadyAsync=function(e){var t=this;return void 0===e&&(e=!1),new Promise((function(i){t.executeWhenReady((function(){i()}),e)}))},t.prototype._checkIsReady=function(e){var t=this;return void 0===e&&(e=!1),this._registerTransientComponents(),this.isReady(e)?(this.onReadyObservable.notifyObservers(this),this.onReadyObservable.clear(),void(this._executeWhenReadyTimeoutId=null)):this._isDisposed?(this.onReadyObservable.clear(),void(this._executeWhenReadyTimeoutId=null)):void(this._executeWhenReadyTimeoutId=setTimeout((function(){t.incrementRenderId(),t._checkIsReady(e)}),100))},Object.defineProperty(t.prototype,\"animatables\",{get:function(){return this._activeAnimatables},enumerable:!1,configurable:!0}),t.prototype.resetLastAnimationTimeFrame=function(){this._animationTimeLast=it.Now},t.prototype.getViewMatrix=function(){return this._viewMatrix},t.prototype.getProjectionMatrix=function(){return this._projectionMatrix},t.prototype.getTransformMatrix=function(){return this._transformMatrix},t.prototype.setTransformMatrix=function(e,t,i,n){i||n||!this._multiviewSceneUbo||(this._multiviewSceneUbo.dispose(),this._multiviewSceneUbo=null),this._viewUpdateFlag===e.updateFlag&&this._projectionUpdateFlag===t.updateFlag||(this._viewUpdateFlag=e.updateFlag,this._projectionUpdateFlag=t.updateFlag,this._viewMatrix=e,this._projectionMatrix=t,this._viewMatrix.multiplyToRef(this._projectionMatrix,this._transformMatrix),this._frustumPlanes?hn.GetPlanesToRef(this._transformMatrix,this._frustumPlanes):this._frustumPlanes=hn.GetPlanes(this._transformMatrix),this._multiviewSceneUbo&&this._multiviewSceneUbo.useUbo?this._updateMultiviewUbo(i,n):this._sceneUbo.useUbo&&(this._sceneUbo.updateMatrix(\"viewProjection\",this._transformMatrix),this._sceneUbo.updateMatrix(\"view\",this._viewMatrix),this._sceneUbo.updateMatrix(\"projection\",this._projectionMatrix)))},t.prototype.getSceneUniformBuffer=function(){return this._multiviewSceneUbo?this._multiviewSceneUbo:this._sceneUbo},t.prototype.createSceneUniformBuffer=function(e){var t=new Li(this._engine,void 0,!1,null!=e?e:\"scene\");return t.addUniform(\"viewProjection\",16),t.addUniform(\"view\",16),t.addUniform(\"projection\",16),t.addUniform(\"vEyePosition\",4),t},t.prototype.setSceneUniformBuffer=function(e){this._sceneUbo=e,this._viewUpdateFlag=-1,this._projectionUpdateFlag=-1},t.prototype.getUniqueId=function(){return dn.UniqueId},t.prototype.addMesh=function(e,t){var i=this;void 0===t&&(t=!1),this._blockEntityCollection||(this.meshes.push(e),e._resyncLightSources(),e.parent||e._addToSceneRootNodes(),this.onNewMeshAddedObservable.notifyObservers(e),t&&e.getChildMeshes().forEach((function(e){i.addMesh(e)})))},t.prototype.removeMesh=function(e,t){var i=this;void 0===t&&(t=!1);var n=this.meshes.indexOf(e);return-1!==n&&(this.meshes[n]=this.meshes[this.meshes.length-1],this.meshes.pop(),e.parent||e._removeFromSceneRootNodes()),this._inputManager._invalidateMesh(e),this.onMeshRemovedObservable.notifyObservers(e),t&&e.getChildMeshes().forEach((function(e){i.removeMesh(e)})),n},t.prototype.addTransformNode=function(e){this._blockEntityCollection||e.getScene()===this&&-1!==e._indexInSceneTransformNodesArray||(e._indexInSceneTransformNodesArray=this.transformNodes.length,this.transformNodes.push(e),e.parent||e._addToSceneRootNodes(),this.onNewTransformNodeAddedObservable.notifyObservers(e))},t.prototype.removeTransformNode=function(e){var t=e._indexInSceneTransformNodesArray;if(-1!==t){if(t!==this.transformNodes.length-1){var i=this.transformNodes[this.transformNodes.length-1];this.transformNodes[t]=i,i._indexInSceneTransformNodesArray=t}e._indexInSceneTransformNodesArray=-1,this.transformNodes.pop(),e.parent||e._removeFromSceneRootNodes()}return this.onTransformNodeRemovedObservable.notifyObservers(e),t},t.prototype.removeSkeleton=function(e){var t=this.skeletons.indexOf(e);return-1!==t&&(this.skeletons.splice(t,1),this.onSkeletonRemovedObservable.notifyObservers(e),this._executeActiveContainerCleanup(this._activeSkeletons)),t},t.prototype.removeMorphTargetManager=function(e){var t=this.morphTargetManagers.indexOf(e);return-1!==t&&this.morphTargetManagers.splice(t,1),t},t.prototype.removeLight=function(e){var t=this.lights.indexOf(e);if(-1!==t){for(var i=0,n=this.meshes;i0?this.activeCamera=this.cameras[0]:this.activeCamera=null),this.onCameraRemovedObservable.notifyObservers(e),t},t.prototype.removeParticleSystem=function(e){var t=this.particleSystems.indexOf(e);return-1!==t&&(this.particleSystems.splice(t,1),this._executeActiveContainerCleanup(this._activeParticleSystems)),t},t.prototype.removeAnimation=function(e){var t=this.animations.indexOf(e);return-1!==t&&this.animations.splice(t,1),t},t.prototype.stopAnimation=function(e,t,i){},t.prototype.removeAnimationGroup=function(e){var t=this.animationGroups.indexOf(e);return-1!==t&&this.animationGroups.splice(t,1),t},t.prototype.removeMultiMaterial=function(e){var t=this.multiMaterials.indexOf(e);return-1!==t&&this.multiMaterials.splice(t,1),this.onMultiMaterialRemovedObservable.notifyObservers(e),t},t.prototype.removeMaterial=function(e){var t=e._indexInSceneMaterialArray;if(-1!==t&&t=0;i--)if(this.materials[i].id===e)return this.materials[i];if(t)for(i=this.multiMaterials.length-1;i>=0;i--)if(this.multiMaterials[i].id===e)return this.multiMaterials[i];return null},t.prototype.getMaterialByName=function(e){for(var t=0;t=0;t--)if(this.meshes[t].id===e)return this.meshes[t];return null},t.prototype.getLastEntryById=function(e){var t;for(t=this.meshes.length-1;t>=0;t--)if(this.meshes[t].id===e)return this.meshes[t];for(t=this.transformNodes.length-1;t>=0;t--)if(this.transformNodes[t].id===e)return this.transformNodes[t];for(t=this.cameras.length-1;t>=0;t--)if(this.cameras[t].id===e)return this.cameras[t];for(t=this.lights.length-1;t>=0;t--)if(this.lights[t].id===e)return this.lights[t];return null},t.prototype.getNodeById=function(e){var t=this.getMeshById(e);if(t)return t;var i=this.getTransformNodeById(e);if(i)return i;var n=this.getLightById(e);if(n)return n;var r=this.getCameraById(e);return r||(this.getBoneById(e)||null)},t.prototype.getNodeByName=function(e){var t=this.getMeshByName(e);if(t)return t;var i=this.getTransformNodeByName(e);if(i)return i;var n=this.getLightByName(e);if(n)return n;var r=this.getCameraByName(e);return r||(this.getBoneByName(e)||null)},t.prototype.getMeshByName=function(e){for(var t=0;t=0;t--)if(this.skeletons[t].id===e)return this.skeletons[t];return null},t.prototype.getSkeletonByUniqueId=function(e){for(var t=0;t0&&(null===(e=this.activeCamera)||void 0===e||e._activeMeshes.reset(),this._activeMeshes.reset(),this._renderingManager.reset(),this._processedMaterials.reset(),this._activeParticleSystems.reset(),this._activeSkeletons.reset(),this._softwareSkinnedMeshes.reset());else if(this._activeMeshesFrozen&&this._activeMeshes.length){if(!this._skipEvaluateActiveMeshesCompletely)for(var t=this._activeMeshes.length,i=0;i0&&0!=(c.layerMask&this.activeCamera.layerMask)&&(this._skipFrustumClipping||c.alwaysSelectAsActiveMesh||c.isInFrustum(this._frustumPlanes)))){this._activeMeshes.push(c),this.activeCamera._activeMeshes.push(c),u!==c&&u._activate(this._renderId,!1);for(var h=0,d=this._preActiveMeshStage;h0){var n=this.getActiveSubMeshCandidates(t),r=n.length;i=i||1===r;for(var o=0;o0&&this._renderTargets.concatWithNoDuplicate(e.customRenderTargets),t&&t.customRenderTargets&&t.customRenderTargets.length>0&&this._renderTargets.concatWithNoDuplicate(t.customRenderTargets),this.environmentTexture&&this.environmentTexture.isRenderTarget&&this._renderTargets.pushNoDuplicate(this.environmentTexture);for(var h=0,d=this._gatherActiveCameraRenderTargetsStage;h0){mi.StartPerformanceCounter(\"Render targets\",this._renderTargets.length>0);for(var f=0;f0),this._renderId++}for(var g=0,v=this._cameraDrawRenderTargetStage;g-1&&(i.trigger===a.ACTION_OnIntersectionExitTrigger&&i._executeCurrent(B.CreateNew(t,void 0,r)),t.actionManager.hasSpecificTrigger(a.ACTION_OnIntersectionExitTrigger,(function(e){var t=e.mesh?e.mesh:e;return r===t}))&&i.trigger!==a.ACTION_OnIntersectionExitTrigger||t._intersectionsInProgress.splice(s,1))}},n=0;t.actionManager&&n0&&r0)for(var l=0;l0),this._intermediateRendering=!0;for(var p=0;p0),this._intermediateRendering=!1,this._renderId++}this._engine.currentRenderPassId=null!==(r=null==d?void 0:d.renderPassId)&&void 0!==r?r:a.RENDERPASS_MAIN,this.activeCamera=d,this._activeCamera&&this._activeCamera.cameraRigMode!==a.RIG_MODE_CUSTOM&&!this.prePass&&this._bindFrameBuffer(this._activeCamera,!1),this.onAfterRenderTargetsRenderObservable.notifyObservers(this);for(var _=0,m=this._beforeClearStage;_0)for(l=0;l0);else{if(!this.activeCamera)throw new Error(\"No camera defined\");this._processSubCameras(this.activeCamera,!!this.activeCamera.outputRenderTarget)}this._activeCamera=y,this._checkIntersections();for(var b=0,T=this._afterRenderStage;b-1&&this._engine.scenes.splice(o,1),S._LastCreatedScene===this&&(this._engine.scenes.length>0?S._LastCreatedScene=this._engine.scenes[this._engine.scenes.length-1]:S._LastCreatedScene=null),(o=this._engine._virtualScenes.indexOf(this))>-1&&this._engine._virtualScenes.splice(o,1),this._engine.wipeCaches(!0),this._isDisposed=!0}},t.prototype._disposeList=function(e,t){t=null!=t?t:function(e){return e.dispose()};for(var i=0,n=e.slice(0);i-1&&(this._scene._activeAnimatables.splice(t,1),this._scene._activeAnimatables.push(this))}return this},e.prototype.getAnimations=function(){return this._runtimeAnimations},e.prototype.appendAnimations=function(e,t){for(var i=this,n=0;n-1){for(var n=(o=this._runtimeAnimations).length-1;n>=0;n--){var r=o[n];e&&r.animation.name!=e||t&&!t(r.target)||(r.dispose(),o.splice(n,1))}0==o.length&&(this._scene._activeAnimatables.splice(i,1),this._raiseOnAnimationEnd())}}else if((n=this._scene._activeAnimatables.indexOf(this))>-1){this._scene._activeAnimatables.splice(n,1);for(var o=this._runtimeAnimations,a=0;a0)return;this._animationTimeLast=e}this.deltaTime=this.useConstantAnimationDeltaTime?16:(e-this._animationTimeLast)*this.animationTimeScale,this._animationTimeLast=e;var t=this._activeAnimatables;if(0!==t.length){this._animationTime+=this.deltaTime;for(var i=this._animationTime,n=0;ni&&r>0&&(r*=-1),s&&this.stopAnimation(e,void 0,l),a||(a=new bn(this,e,t,i,n,r,o,void 0,c,u));var h=!l||l(e);if(e.animations&&h&&a.appendAnimations(e,e.animations),e.getAnimatables)for(var d=e.getAnimatables(),p=0;pn&&o>0)o*=-1;else if(n>i&&o<0){var c=n;n=i,i=c}return new bn(this,e,i,n,r,o,a,t,s,l)},mn.prototype.beginDirectHierarchyAnimation=function(e,t,i,n,r,o,a,s,l,c){void 0===c&&(c=!1);var u=e.getDescendants(t),h=[];h.push(this.beginDirectAnimation(e,i,n,r,o,a,s,l,c));for(var d=0,p=u;d0?l:-l,r),h.scaleAndAddToRef(l,i)}r.normalize()}for(u=0;u0)r.copyFrom(n);else if(1===e.animations.length){if(P.SlerpToRef(n,i.currentValue,Math.min(1,e.totalWeight),r),0===e.totalAdditiveWeight)return r}else if(e.animations.length>1){var o=1,a=void 0,s=void 0;if(e.totalWeight<1){var l=1-e.totalWeight;s=[],(a=[]).push(n),s.push(l)}else{if(2===e.animations.length&&(P.SlerpToRef(e.animations[0].currentValue,e.animations[1].currentValue,e.animations[1].weight/e.totalWeight,t),0===e.totalAdditiveWeight))return t;a=[],s=[],o=e.totalWeight}for(var c=0;c=c&&a.frame<=u&&(n?(l=a.value.clone(),_?(s=l.getTranslation(),l.setTranslation(s.scaleInPlace(m))):g&&r?(s=l.getTranslation(),l.setTranslation(s.multiplyInPlace(r))):l=a.value):l=a.value,v.push({frame:a.frame+i,value:l}));return this.animations[0].createRange(t,c+i,u+i),!0};var Tn,En=function(){this.enableBlending=!1,this.blendingSpeed=.01,this.loopMode=ze.ANIMATIONLOOPMODE_CYCLE};!function(e){e[e.CW=0]=\"CW\",e[e.CCW=1]=\"CCW\"}(Tn||(Tn={}));var Sn=function(){function e(){}return e.Interpolate=function(e,t,i,n,r){for(var o=1-3*n+3*t,a=3*n-6*t,s=3*t,l=e,c=0;c<5;c++){var u=l*l;l-=1/(3*o*u+2*a*l+s)*(o*(u*l)+a*u+s*l-e),l=Math.min(1,Math.max(0,l))}return 3*Math.pow(1-l,2)*l*i+3*(1-l)*Math.pow(l,2)*r+Math.pow(l,3)},e}(),An=function(){function e(e){this._radians=e,this._radians<0&&(this._radians+=2*Math.PI)}return e.prototype.degrees=function(){return 180*this._radians/Math.PI},e.prototype.radians=function(){return this._radians},e.BetweenTwoPoints=function(t,i){var n=i.subtract(t);return new e(Math.atan2(n.y,n.x))},e.FromRadians=function(t){return new e(t)},e.FromDegrees=function(t){return new e(t*Math.PI/180)},e}(),Rn=function(e,t,i){this.startPoint=e,this.midPoint=t,this.endPoint=i;var n=Math.pow(t.x,2)+Math.pow(t.y,2),r=(Math.pow(e.x,2)+Math.pow(e.y,2)-n)/2,o=(n-Math.pow(i.x,2)-Math.pow(i.y,2))/2,a=(e.x-t.x)*(t.y-i.y)-(t.x-i.x)*(e.y-t.y);this.centerPoint=new R((r*(t.y-i.y)-o*(e.y-t.y))/a,((e.x-t.x)*o-(t.x-i.x)*r)/a),this.radius=this.centerPoint.subtract(this.startPoint).length(),this.startAngle=An.BetweenTwoPoints(this.centerPoint,this.startPoint);var s=this.startAngle.degrees(),l=An.BetweenTwoPoints(this.centerPoint,this.midPoint).degrees(),c=An.BetweenTwoPoints(this.centerPoint,this.endPoint).degrees();l-s>180&&(l-=360),l-s<-180&&(l+=360),c-l>180&&(c-=360),c-l<-180&&(c+=360),this.orientation=l-s<0?Tn.CW:Tn.CCW,this.angle=An.FromDegrees(this.orientation===Tn.CW?s-c:c-s)},xn=function(){function e(e,t){this._points=new Array,this._length=0,this.closed=!1,this._points.push(new R(e,t))}return e.prototype.addLineTo=function(e,t){if(this.closed)return this;var i=new R(e,t),n=this._points[this._points.length-1];return this._points.push(i),this._length+=i.subtract(n).length(),this},e.prototype.addArcTo=function(e,t,i,n,r){if(void 0===r&&(r=36),this.closed)return this;var o=this._points[this._points.length-1],a=new R(e,t),s=new R(i,n),l=new Rn(o,a,s),c=l.angle.radians()/r;l.orientation===Tn.CW&&(c*=-1);for(var u=l.startAngle.radians()+c,h=0;h1)return R.Zero();for(var t=e*this.length(),i=0,n=0;n=i&&t<=s){var l=a.normalize(),c=t-i;return new R(o.x+l.x*c,o.y+l.y*c)}i=s}return R.Zero()},e.StartingAt=function(t,i){return new e(t,i)},e}(),Cn=function(){function e(e,t,i,n){void 0===t&&(t=null),void 0===n&&(n=!1),this.path=e,this._curve=new Array,this._distances=new Array,this._tangents=new Array,this._normals=new Array,this._binormals=new Array,this._pointAtData={id:0,point:x.Zero(),previousPointArrayIndex:0,position:0,subPosition:0,interpolateReady:!1,interpolationMatrix:M.Identity()};for(var r=0;ri){var n=t;t=i,i=n}var r=this.getCurve(),o=this.getPointAt(t),a=this.getPreviousPointIndexAt(t),s=this.getPointAt(i),l=this.getPreviousPointIndexAt(i)+1,c=[];return 0!==t&&(a++,c.push(o)),c.push.apply(c,r.slice(a,l)),1===i&&1!==t||c.push(s),new e(c,this.getNormalAt(t),this._raw,this._alignTangentsWithPath)},e.prototype.update=function(e,t,i){void 0===t&&(t=null),void 0===i&&(i=!1);for(var n=0;nt+1;)t++,i=this._curve[e].subtract(this._curve[e-t]);return i},e.prototype._normalVector=function(e,t){var i,n=e.length();if(0===n&&(n=1),null==t){var r;r=h.WithinEpsilon(Math.abs(e.y)/n,1,_)?h.WithinEpsilon(Math.abs(e.x)/n,1,_)?h.WithinEpsilon(Math.abs(e.z)/n,1,_)?x.Zero():new x(0,0,1):new x(1,0,0):new x(0,-1,0),i=x.Cross(e,r)}else i=x.Cross(e,t),x.CrossToRef(i,e,i);return i.normalize(),i},e.prototype._updatePointAtData=function(e,t){if(void 0===t&&(t=!1),this._pointAtData.id===e)return this._pointAtData.interpolateReady||this._updateInterpolationMatrix(),this._pointAtData;this._pointAtData.id=e;var i=this.getPoints();if(e<=0)return this._setPointAtData(0,0,i[0],0,t);if(e>=1)return this._setPointAtData(1,1,i[i.length-1],i.length-1,t);for(var n,r=i[0],o=0,a=e*this.length(),s=1;sa){var c=(o-a)/l,u=r.subtract(n),h=n.add(u.scaleInPlace(c));return this._setPointAtData(e,1-c,h,s-1,t)}r=n}return this._pointAtData},e.prototype._setPointAtData=function(e,t,i,n,r){return this._pointAtData.point=i,this._pointAtData.position=e,this._pointAtData.subPosition=t,this._pointAtData.previousPointArrayIndex=n,this._pointAtData.interpolateReady=r,r&&this._updateInterpolationMatrix(),this._pointAtData},e.prototype._updateInterpolationMatrix=function(){this._pointAtData.interpolationMatrix=M.Identity();var e=this._pointAtData.previousPointArrayIndex;if(e!==this._tangents.length-1){var t=e+1,i=this._tangents[e].clone(),n=this._normals[e].clone(),r=this._binormals[e].clone(),o=this._tangents[t].clone(),a=this._normals[t].clone(),s=this._binormals[t].clone(),l=P.RotationQuaternionFromAxis(n,r,i),c=P.RotationQuaternionFromAxis(a,s,o);P.Slerp(l,c,this._pointAtData.subPosition).toRotationMatrix(this._pointAtData.interpolationMatrix)}},e}(),Pn=function(){function e(e){this._length=0,this._points=e,this._length=this._computeLength(e)}return e.CreateQuadraticBezier=function(t,i,n,r){r=r>2?r:3;for(var o=new Array,a=function(e,t,i,n){return(1-e)*(1-e)*t+2*e*(1-e)*i+e*e*n},s=0;s<=r;s++)o.push(new x(a(s/r,t.x,i.x,n.x),a(s/r,t.y,i.y,n.y),a(s/r,t.z,i.z,n.z)));return new e(o)},e.CreateCubicBezier=function(t,i,n,r,o){o=o>3?o:4;for(var a=new Array,s=function(e,t,i,n,r){return(1-e)*(1-e)*(1-e)*t+3*e*(1-e)*(1-e)*i+3*e*e*(1-e)*n+e*e*e*r},l=0;l<=o;l++)a.push(new x(s(l/o,t.x,i.x,n.x,r.x),s(l/o,t.y,i.y,n.y,r.y),s(l/o,t.z,i.z,n.z,r.z)));return new e(a)},e.CreateHermiteSpline=function(t,i,n,r,o){for(var a=new Array,s=1/o,l=0;l<=o;l++)a.push(x.Hermite(t,i,n,r,l*s));return new e(a)},e.CreateCatmullRomSpline=function(t,i,n){var r=new Array,o=1/i,a=0;if(n){for(var s=t.length,l=0;l=.5?.5*(1-this.easeInCore(2*(1-t)))+.5:.5*this.easeInCore(2*t)},e.EASINGMODE_EASEIN=0,e.EASINGMODE_EASEOUT=1,e.EASINGMODE_EASEINOUT=2,e}(),In=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return V(t,e),t.prototype.easeInCore=function(e){return e=Math.max(0,Math.min(1,e)),1-Math.sqrt(1-e*e)},t}(Mn),On=function(e){function t(t){void 0===t&&(t=1);var i=e.call(this)||this;return i.amplitude=t,i}return V(t,e),t.prototype.easeInCore=function(e){var t=Math.max(0,this.amplitude);return Math.pow(e,3)-e*t*Math.sin(3.141592653589793*e)},t}(Mn),Dn=function(e){function t(t,i){void 0===t&&(t=3),void 0===i&&(i=2);var n=e.call(this)||this;return n.bounces=t,n.bounciness=i,n}return V(t,e),t.prototype.easeInCore=function(e){var t=Math.max(0,this.bounces),i=this.bounciness;i<=1&&(i=1.001);var n=Math.pow(i,t),r=1-i,o=(1-n)/r+.5*n,a=e*o,s=Math.log(-a*(1-i)+1)/Math.log(i),l=Math.floor(s),c=l+1,u=(1-Math.pow(i,l))/(r*o),h=.5*(u+(1-Math.pow(i,c))/(r*o)),d=e-h,p=h-u;return-Math.pow(1/i,t-l)/(p*p)*(d-p)*(d+p)},t}(Mn),Nn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return V(t,e),t.prototype.easeInCore=function(e){return e*e*e},t}(Mn),Ln=function(e){function t(t,i){void 0===t&&(t=3),void 0===i&&(i=3);var n=e.call(this)||this;return n.oscillations=t,n.springiness=i,n}return V(t,e),t.prototype.easeInCore=function(e){var t=Math.max(0,this.oscillations),i=Math.max(0,this.springiness);return(0==i?e:(Math.exp(i*e)-1)/(Math.exp(i)-1))*Math.sin((6.283185307179586*t+1.5707963267948966)*e)},t}(Mn),Fn=function(e){function t(t){void 0===t&&(t=2);var i=e.call(this)||this;return i.exponent=t,i}return V(t,e),t.prototype.easeInCore=function(e){return this.exponent<=0?e:(Math.exp(this.exponent*e)-1)/(Math.exp(this.exponent)-1)},t}(Mn),wn=function(e){function t(t){void 0===t&&(t=2);var i=e.call(this)||this;return i.power=t,i}return V(t,e),t.prototype.easeInCore=function(e){var t=Math.max(0,this.power);return Math.pow(e,t)},t}(Mn),Bn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return V(t,e),t.prototype.easeInCore=function(e){return e*e},t}(Mn),Un=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return V(t,e),t.prototype.easeInCore=function(e){return e*e*e*e},t}(Mn),Vn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return V(t,e),t.prototype.easeInCore=function(e){return e*e*e*e*e},t}(Mn),kn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return V(t,e),t.prototype.easeInCore=function(e){return 1-Math.sin(1.5707963267948966*(1-e))},t}(Mn),Gn=function(e){function t(t,i,n,r){void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=1);var o=e.call(this)||this;return o.x1=t,o.y1=i,o.x2=n,o.y2=r,o}return V(t,e),t.prototype.easeInCore=function(e){return Sn.Interpolate(e,this.x1,this.y1,this.x2,this.y2)},t}(Mn),zn=function(){function e(e,t,i){this.frame=e,this.action=t,this.onlyOnce=i,this.isDone=!1}return e.prototype._clone=function(){return new e(this.frame,this.action,this.onlyOnce)},e}(),Wn=function(){function e(){}return e.prototype.getClassName=function(){return\"TargetedAnimation\"},e.prototype.serialize=function(){var e={};return e.animation=this.animation.serialize(),e.targetId=this.target.id,e},e}(),Hn=function(){function e(e,t){void 0===t&&(t=null),this.name=e,this._targetedAnimations=new Array,this._animatables=new Array,this._from=Number.MAX_VALUE,this._to=-Number.MAX_VALUE,this._speedRatio=1,this._loopAnimation=!1,this._isAdditive=!1,this._parentContainer=null,this.onAnimationEndObservable=new u,this.onAnimationLoopObservable=new u,this.onAnimationGroupLoopObservable=new u,this.onAnimationGroupEndObservable=new u,this.onAnimationGroupPauseObservable=new u,this.onAnimationGroupPlayObservable=new u,this.metadata=null,this._animationLoopFlags=[],this._scene=t||S.LastCreatedScene,this.uniqueId=this._scene.getUniqueId(),this._scene.addAnimationGroup(this)}return Object.defineProperty(e.prototype,\"from\",{get:function(){return this._from},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"to\",{get:function(){return this._to},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"isStarted\",{get:function(){return this._isStarted},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"isPlaying\",{get:function(){return this._isStarted&&!this._isPaused},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"speedRatio\",{get:function(){return this._speedRatio},set:function(e){if(this._speedRatio!==e){this._speedRatio=e;for(var t=0;tn[0].frame&&(this._from=n[0].frame),this._toe){var a={frame:e,value:r.value,inTangent:r.inTangent,outTangent:r.outTangent,interpolation:r.interpolation};n.splice(0,0,a)}o.frame-1&&this._scene.animationGroups.splice(e,1),this._parentContainer){var t=this._parentContainer.animationGroups.indexOf(this);t>-1&&this._parentContainer.animationGroups.splice(t,1),this._parentContainer=null}this.onAnimationEndObservable.clear(),this.onAnimationGroupEndObservable.clear(),this.onAnimationGroupPauseObservable.clear(),this.onAnimationGroupPlayObservable.clear(),this.onAnimationLoopObservable.clear(),this.onAnimationGroupLoopObservable.clear()},e.prototype._checkAnimationGroupEnded=function(e){var t=this._animatables.indexOf(e);t>-1&&this._animatables.splice(t,1),0===this._animatables.length&&(this._isStarted=!1,this.onAnimationGroupEndObservable.notifyObservers(this))},e.prototype.clone=function(t,i,n){void 0===n&&(n=!1);for(var r=new e(t||this.name,this._scene),o=0,a=this._targetedAnimations;o1)throw\"step size should be less than 1.\";return this.value+=e,this._ensureLimits(),this._raiseOnChange(),this},e.prototype._ensureLimits=function(){for(;this.value>1;)this.value-=1;for(;this.value<0;)this.value+=1;return this},e.prototype._raiseOnChange=function(){var e=this;return this._onchange.forEach((function(t){return t(e)})),this},e.prototype.onchange=function(e){return this._onchange.push(e),this},e}();function jn(e,t,i){try{var n=e.next();n.done?t(n):n.value?n.value.then((function(){n.value=void 0,t(n)}),i):t(n)}catch(e){i(e)}}function Yn(e){var t;return void 0===e&&(e=25),function(i,n,r){var o=performance.now();void 0===t||o-t>e?(t=o,setTimeout((function(){jn(i,n,r)}),0)):jn(i,n,r)}}function Kn(e,t,i,n,r){var o=function(){var a,s=function(e){e.done?i(e.value):void 0===a?a=!0:o()};do{a=void 0,r&&r.aborted?n(new Error(\"Aborted\")):t(e,s,n),void 0===a&&(a=!1)}while(a)};o()}function Qn(e,t){var i;return Kn(e,jn,(function(e){return i=e}),(function(e){throw e}),t),i}function qn(e,t,i){return new Promise((function(n,r){Kn(e,t,n,r,i)}))}function Zn(e,t){return function(){for(var i=[],n=0;n0))return[3,4];d=null!==(A=null==h?void 0:h.length)&&void 0!==A?A:0,h||(h=new Array(c)),h.length!==c&&(Array.isArray(h)?h.length=c:((p=n||h instanceof Uint32Array?new Uint32Array(c):new Uint16Array(c)).set(h),h=p),t&&t.determinant()<0&&e._FlipFaces(h,0,d)),f=this.positions?this.positions.length/3:0,_=0,m=i,x.label=1;case 1:if(!(_c-n||s-uu-r||l-hh-o)},e.prototype.intersectsSphere=function(t){return e.IntersectsSphere(this.minimumWorld,this.maximumWorld,t.centerWorld,t.radiusWorld)},e.prototype.intersectsMinMax=function(e,t){var i=this.minimumWorld,n=this.maximumWorld,r=i.x,o=i.y,a=i.z,s=n.x,l=n.y,c=n.z,u=e.x,h=e.y,d=e.z,p=t.x,f=t.y,_=t.z;return!(sp||lf||c_)},e.prototype.dispose=function(){var e,t;null===(e=this._drawWrapperFront)||void 0===e||e.dispose(),null===(t=this._drawWrapperBack)||void 0===t||t.dispose()},e.Intersects=function(e,t){return e.intersectsMinMax(t.minimumWorld,t.maximumWorld)},e.IntersectsSphere=function(t,i,n,r){var o=e._TmpVector3[0];return x.ClampToRef(n,t,i,o),x.DistanceSquared(n,o)<=r*r},e.IsCompletelyInFrustum=function(e,t){for(var i=0;i<6;++i)for(var n=t[i],r=0;r<8;++r)if(n.dotCoordinate(e[r])<0)return!1;return!0},e.IsInFrustum=function(e,t){for(var i=0;i<6;++i){for(var n=!0,r=t[i],o=0;o<8;++o)if(r.dotCoordinate(e[o])>=0){n=!1;break}if(n)return!1}return!0},e._TmpVector3=m.BuildArray(3,x.Zero),e}(),ir=function(){function e(e,t,i){this.center=x.Zero(),this.centerWorld=x.Zero(),this.minimum=x.Zero(),this.maximum=x.Zero(),this.reConstruct(e,t,i)}return e.prototype.reConstruct=function(e,t,i){this.minimum.copyFrom(e),this.maximum.copyFrom(t);var n=x.Distance(e,t);t.addToRef(e,this.center).scaleInPlace(.5),this.radius=.5*n,this._update(i||M.IdentityReadOnly)},e.prototype.scale=function(t){var i=this.radius*t,n=e._TmpVector3,r=n[0].setAll(i),o=this.center.subtractToRef(r,n[1]),a=this.center.addToRef(r,n[2]);return this.reConstruct(o,a,this._worldMatrix),this},e.prototype.getWorldMatrix=function(){return this._worldMatrix},e.prototype._update=function(t){if(t.isIdentity())this.centerWorld.copyFrom(this.center),this.radiusWorld=this.radius;else{x.TransformCoordinatesToRef(this.center,t,this.centerWorld);var i=e._TmpVector3[0];x.TransformNormalFromFloatsToRef(1,1,1,t,i),this.radiusWorld=Math.max(Math.abs(i.x),Math.abs(i.y),Math.abs(i.z))*this.radius}},e.prototype.isInFrustum=function(e){for(var t=this.centerWorld,i=this.radiusWorld,n=0;n<6;n++)if(e[n].dotCoordinate(t)<=-i)return!1;return!0},e.prototype.isCenterInFrustum=function(e){for(var t=this.centerWorld,i=0;i<6;i++)if(e[i].dotCoordinate(t)<0)return!1;return!0},e.prototype.intersectsPoint=function(e){var t=x.DistanceSquared(this.centerWorld,e);return!(this.radiusWorld*this.radiusWorldrr.max||rr.min>nr.max)},sr=function(){function e(e,t,i){this._isLocked=!1,this.boundingBox=new tr(e,t,i),this.boundingSphere=new ir(e,t,i)}return e.prototype.reConstruct=function(e,t,i){this.boundingBox.reConstruct(e,t,i),this.boundingSphere.reConstruct(e,t,i)},Object.defineProperty(e.prototype,\"minimum\",{get:function(){return this.boundingBox.minimum},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"maximum\",{get:function(){return this.boundingBox.maximum},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"isLocked\",{get:function(){return this._isLocked},set:function(e){this._isLocked=e},enumerable:!1,configurable:!0}),e.prototype.update=function(e){this._isLocked||(this.boundingBox._update(e),this.boundingSphere._update(e))},e.prototype.centerOn=function(t,i){var n=e._TmpVector3[0].copyFrom(t).subtractInPlace(i),r=e._TmpVector3[1].copyFrom(t).addInPlace(i);return this.boundingBox.reConstruct(n,r,this.boundingBox.getWorldMatrix()),this.boundingSphere.reConstruct(n,r,this.boundingBox.getWorldMatrix()),this},e.prototype.encapsulate=function(e){var t=x.Minimize(this.minimum,e),i=x.Maximize(this.maximum,e);return this.reConstruct(t,i,this.boundingBox.getWorldMatrix()),this},e.prototype.encapsulateBoundingInfo=function(e){return this.encapsulate(e.boundingBox.centerWorld.subtract(e.boundingBox.extendSizeWorld)),this.encapsulate(e.boundingBox.centerWorld.add(e.boundingBox.extendSizeWorld)),this},e.prototype.scale=function(e){return this.boundingBox.scale(e),this.boundingSphere.scale(e),this},e.prototype.isInFrustum=function(e,t){return void 0===t&&(t=a.MESHES_CULLINGSTRATEGY_STANDARD),!(t!==a.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION&&t!==a.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY||!this.boundingSphere.isCenterInFrustum(e))||!!this.boundingSphere.isInFrustum(e)&&(!(t!==a.MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY&&t!==a.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY)||this.boundingBox.isInFrustum(e))},Object.defineProperty(e.prototype,\"diagonalLength\",{get:function(){var t=this.boundingBox;return t.maximumWorld.subtractToRef(t.minimumWorld,e._TmpVector3[0]).length()},enumerable:!1,configurable:!0}),e.prototype.isCompletelyInFrustum=function(e){return this.boundingBox.isCompletelyInFrustum(e)},e.prototype._checkCollision=function(e){return e._canDoCollision(this.boundingSphere.centerWorld,this.boundingSphere.radiusWorld,this.boundingBox.minimumWorld,this.boundingBox.maximumWorld)},e.prototype.intersectsPoint=function(e){return!!this.boundingSphere.centerWorld&&!!this.boundingSphere.intersectsPoint(e)&&!!this.boundingBox.intersectsPoint(e)},e.prototype.intersects=function(e,t){if(!ir.Intersects(this.boundingSphere,e.boundingSphere))return!1;if(!tr.Intersects(this.boundingBox,e.boundingBox))return!1;if(!t)return!0;var i=this.boundingBox,n=e.boundingBox;return!!(ar(i.directions[0],i,n)&&ar(i.directions[1],i,n)&&ar(i.directions[2],i,n)&&ar(n.directions[0],i,n)&&ar(n.directions[1],i,n)&&ar(n.directions[2],i,n)&&ar(x.Cross(i.directions[0],n.directions[0]),i,n)&&ar(x.Cross(i.directions[0],n.directions[1]),i,n)&&ar(x.Cross(i.directions[0],n.directions[2]),i,n)&&ar(x.Cross(i.directions[1],n.directions[0]),i,n)&&ar(x.Cross(i.directions[1],n.directions[1]),i,n)&&ar(x.Cross(i.directions[1],n.directions[2]),i,n)&&ar(x.Cross(i.directions[2],n.directions[0]),i,n)&&ar(x.Cross(i.directions[2],n.directions[1]),i,n)&&ar(x.Cross(i.directions[2],n.directions[2]),i,n))},e._TmpVector3=m.BuildArray(2,x.Zero),e}(),lr=function(){function e(){}return e.extractMinAndMaxIndexed=function(e,t,i,n,r,o){for(var a=i;al&&(l=h)}return new e(t,s,l-s+1,i,n,r,o,a)},e}(),dr=function(){function e(){}return Object.defineProperty(e,\"ForceFullSceneLoadingForIncremental\",{get:function(){return e._ForceFullSceneLoadingForIncremental},set:function(t){e._ForceFullSceneLoadingForIncremental=t},enumerable:!1,configurable:!0}),Object.defineProperty(e,\"ShowLoadingScreen\",{get:function(){return e._ShowLoadingScreen},set:function(t){e._ShowLoadingScreen=t},enumerable:!1,configurable:!0}),Object.defineProperty(e,\"loggingLevel\",{get:function(){return e._LoggingLevel},set:function(t){e._LoggingLevel=t},enumerable:!1,configurable:!0}),Object.defineProperty(e,\"CleanBoneMatrixWeights\",{get:function(){return e._CleanBoneMatrixWeights},set:function(t){e._CleanBoneMatrixWeights=t},enumerable:!1,configurable:!0}),e._ForceFullSceneLoadingForIncremental=!1,e._ShowLoadingScreen=!0,e._CleanBoneMatrixWeights=!1,e._LoggingLevel=a.SCENELOADER_NO_LOGGING,e}(),pr=function(){function e(){}return e.UseOpenGLOrientationForUV=!1,e}(),fr=function(){function e(e,t,i,n,r){void 0===n&&(n=!1),void 0===r&&(r=null),this.delayLoadState=a.DELAYLOADSTATE_NONE,this._totalVertices=0,this._isDisposed=!1,this._indexBufferIsUpdatable=!1,this._positionsCache=[],this._parentContainer=null,this.useBoundingInfoFromGeometry=!1,this._scene=t||S.LastCreatedScene,this._scene&&(this.id=e,this.uniqueId=this._scene.getUniqueId(),this._engine=this._scene.getEngine(),this._meshes=[],this._vertexBuffers={},this._indices=[],this._updatable=n,i?this.setAllVerticesData(i,n):this._totalVertices=0,this._engine.getCaps().vertexArrayObject&&(this._vertexArrayObjects={}),r&&(this.applyToMesh(r),r.computeWorldMatrix(!0)))}return Object.defineProperty(e.prototype,\"boundingBias\",{get:function(){return this._boundingBias},set:function(e){this._boundingBias?this._boundingBias.copyFrom(e):this._boundingBias=e.clone(),this._updateBoundingInfo(!0,null)},enumerable:!1,configurable:!0}),e.CreateGeometryForMesh=function(t){var i=new e(e.RandomId(),t.getScene());return i.applyToMesh(t),i},Object.defineProperty(e.prototype,\"meshes\",{get:function(){return this._meshes},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"extend\",{get:function(){return this._extend},enumerable:!1,configurable:!0}),e.prototype.getScene=function(){return this._scene},e.prototype.getEngine=function(){return this._engine},e.prototype.isReady=function(){return this.delayLoadState===a.DELAYLOADSTATE_LOADED||this.delayLoadState===a.DELAYLOADSTATE_NONE},Object.defineProperty(e.prototype,\"doNotSerialize\",{get:function(){for(var e=0;e0&&(this._indexBuffer=this._engine.createIndexBuffer(this._indices,this._updatable)),e._syncGeometryWithMorphTargetManager(),e.synchronizeInstances()},e.prototype._notifyUpdate=function(e){this.onGeometryUpdated&&this.onGeometryUpdated(this,e),this._vertexArrayObjects&&this._disposeVertexArrayObjects();for(var t=0,i=this._meshes;t0){for(var t=0;t0){for(t=0;t0){for(t=0;t-1&&this._parentContainer.geometries.splice(r,1),this._parentContainer=null}this._isDisposed=!0},e.prototype.copy=function(t){var i=new $n;i.indices=[];var n=this.getIndices();if(n)for(var r=0;r0){var l=new Float32Array(t,s.positionsAttrDesc.offset,s.positionsAttrDesc.count);i.setVerticesData(wi.PositionKind,l,!1)}if(s.normalsAttrDesc&&s.normalsAttrDesc.count>0){var c=new Float32Array(t,s.normalsAttrDesc.offset,s.normalsAttrDesc.count);i.setVerticesData(wi.NormalKind,c,!1)}if(s.tangetsAttrDesc&&s.tangetsAttrDesc.count>0){var u=new Float32Array(t,s.tangetsAttrDesc.offset,s.tangetsAttrDesc.count);i.setVerticesData(wi.TangentKind,u,!1)}if(s.uvsAttrDesc&&s.uvsAttrDesc.count>0){var h=new Float32Array(t,s.uvsAttrDesc.offset,s.uvsAttrDesc.count);if(pr.UseOpenGLOrientationForUV)for(var d=1;d0){var p=new Float32Array(t,s.uvs2AttrDesc.offset,s.uvs2AttrDesc.count);if(pr.UseOpenGLOrientationForUV)for(d=1;d0){var f=new Float32Array(t,s.uvs3AttrDesc.offset,s.uvs3AttrDesc.count);if(pr.UseOpenGLOrientationForUV)for(d=1;d0){var _=new Float32Array(t,s.uvs4AttrDesc.offset,s.uvs4AttrDesc.count);if(pr.UseOpenGLOrientationForUV)for(d=1;d<_.length;d+=2)_[d]=1-_[d];i.setVerticesData(wi.UV4Kind,_,!1)}if(s.uvs5AttrDesc&&s.uvs5AttrDesc.count>0){var m=new Float32Array(t,s.uvs5AttrDesc.offset,s.uvs5AttrDesc.count);if(pr.UseOpenGLOrientationForUV)for(d=1;d0){var g=new Float32Array(t,s.uvs6AttrDesc.offset,s.uvs6AttrDesc.count);if(pr.UseOpenGLOrientationForUV)for(d=1;d0){var v=new Float32Array(t,s.colorsAttrDesc.offset,s.colorsAttrDesc.count);i.setVerticesData(wi.ColorKind,v,!1,s.colorsAttrDesc.stride)}if(s.matricesIndicesAttrDesc&&s.matricesIndicesAttrDesc.count>0){for(var y=new Int32Array(t,s.matricesIndicesAttrDesc.offset,s.matricesIndicesAttrDesc.count),b=[],T=0;T>8),b.push((16711680&d)>>16),b.push(d>>24&255);i.setVerticesData(wi.MatricesIndicesKind,b,!1)}if(s.matricesIndicesExtraAttrDesc&&s.matricesIndicesExtraAttrDesc.count>0){for(y=new Int32Array(t,s.matricesIndicesExtraAttrDesc.offset,s.matricesIndicesExtraAttrDesc.count),b=[],T=0;T>8),b.push((16711680&d)>>16),b.push(d>>24&255);i.setVerticesData(wi.MatricesIndicesExtraKind,b,!1)}if(s.matricesWeightsAttrDesc&&s.matricesWeightsAttrDesc.count>0){var E=new Float32Array(t,s.matricesWeightsAttrDesc.offset,s.matricesWeightsAttrDesc.count);i.setVerticesData(wi.MatricesWeightsKind,E,!1)}if(s.indicesAttrDesc&&s.indicesAttrDesc.count>0){var S=new Int32Array(t,s.indicesAttrDesc.offset,s.indicesAttrDesc.count);i.setIndices(S,null)}if(s.subMeshesAttrDesc&&s.subMeshesAttrDesc.count>0){var A=new Int32Array(t,s.subMeshesAttrDesc.offset,5*s.subMeshesAttrDesc.count);for(i.subMeshes=[],T=0;T>8),b.push((16711680&I)>>16),b.push(I>>24&255)}i.setVerticesData(wi.MatricesIndicesKind,b,t.matricesIndices._updatable)}if(t.matricesIndicesExtra)if(t.matricesIndicesExtra._isExpanded)delete t.matricesIndices._isExpanded,i.setVerticesData(wi.MatricesIndicesExtraKind,t.matricesIndicesExtra,t.matricesIndicesExtra._updatable);else{for(b=[],T=0;T>8),b.push((16711680&I)>>16),b.push(I>>24&255);i.setVerticesData(wi.MatricesIndicesExtraKind,b,t.matricesIndicesExtra._updatable)}t.matricesWeights&&(e._CleanMatricesWeights(t,i),i.setVerticesData(wi.MatricesWeightsKind,t.matricesWeights,t.matricesWeights._updatable)),t.matricesWeightsExtra&&i.setVerticesData(wi.MatricesWeightsExtraKind,t.matricesWeightsExtra,t.matricesWeights._updatable),i.setIndices(t.indices,null)}if(t.subMeshes){i.subMeshes=[];for(var O=0;O-1){var r=t.getScene().getLastSkeletonById(e.skeletonId);if(r){n=r.bones.length;for(var o=t.getVerticesData(wi.MatricesIndicesKind),a=t.getVerticesData(wi.MatricesIndicesExtraKind),s=e.matricesWeights,l=e.matricesWeightsExtra,c=e.numBoneInfluencer,u=s.length,h=0;hc-1)&&(p=c-1),d>i){var m=1/d;for(f=0;f<4;f++)s[h+f]*=m;if(l)for(f=0;f<4;f++)l[h+f]*=m}else p>=4?(l[h+p-4]=1-d,a[h+p-4]=n):(s[h+p]=1-d,o[h+p]=n)}t.setVerticesData(wi.MatricesIndicesKind,o),e.matricesWeightsExtra&&t.setVerticesData(wi.MatricesIndicesExtraKind,a)}}}},e.Parse=function(t,i,n){var r=new e(t.id,i,void 0,t.updatable);return r._loadedUniqueId=t.uniqueId,de&&de.AddTagsTo(r,t.tags),t.delayLoadingFile?(r.delayLoadState=a.DELAYLOADSTATE_NOTLOADED,r.delayLoadingFile=n+t.delayLoadingFile,r._boundingInfo=new sr(x.FromArray(t.boundingBoxMinimum),x.FromArray(t.boundingBoxMaximum)),r._delayInfo=[],t.hasUVs&&r._delayInfo.push(wi.UVKind),t.hasUVs2&&r._delayInfo.push(wi.UV2Kind),t.hasUVs3&&r._delayInfo.push(wi.UV3Kind),t.hasUVs4&&r._delayInfo.push(wi.UV4Kind),t.hasUVs5&&r._delayInfo.push(wi.UV5Kind),t.hasUVs6&&r._delayInfo.push(wi.UV6Kind),t.hasColors&&r._delayInfo.push(wi.ColorKind),t.hasMatricesIndices&&r._delayInfo.push(wi.MatricesIndicesKind),t.hasMatricesWeights&&r._delayInfo.push(wi.MatricesWeightsKind),r._delayLoadingFunction=$n.ImportVertexData):$n.ImportVertexData(t,r),i.pushGeometry(r,!0),r},e}(),_r=function(){function e(e){void 0===e&&(e=30),this._enabled=!0,this._rollingFrameTime=new mr(e)}return e.prototype.sampleFrame=function(e){if(void 0===e&&(e=it.Now),this._enabled){if(null!=this._lastFrameTimeMs){var t=e-this._lastFrameTimeMs;this._rollingFrameTime.add(t)}this._lastFrameTimeMs=e}},Object.defineProperty(e.prototype,\"averageFrameTime\",{get:function(){return this._rollingFrameTime.average},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"averageFrameTimeVariance\",{get:function(){return this._rollingFrameTime.variance},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"instantaneousFrameTime\",{get:function(){return this._rollingFrameTime.history(0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"averageFPS\",{get:function(){return 1e3/this._rollingFrameTime.average},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"instantaneousFPS\",{get:function(){var e=this._rollingFrameTime.history(0);return 0===e?0:1e3/e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"isSaturated\",{get:function(){return this._rollingFrameTime.isSaturated()},enumerable:!1,configurable:!0}),e.prototype.enable=function(){this._enabled=!0},e.prototype.disable=function(){this._enabled=!1,this._lastFrameTimeMs=null},Object.defineProperty(e.prototype,\"isEnabled\",{get:function(){return this._enabled},enumerable:!1,configurable:!0}),e.prototype.reset=function(){this._lastFrameTimeMs=null,this._rollingFrameTime.reset()},e}(),mr=function(){function e(e){this._samples=new Array(e),this.reset()}return e.prototype.add=function(e){var t;if(this.isSaturated()){var i=this._samples[this._pos];t=i-this.average,this.average-=t/(this._sampleCount-1),this._m2-=t*(i-this.average)}else this._sampleCount++;t=e-this.average,this.average+=t/this._sampleCount,this._m2+=t*(e-this.average),this.variance=this._m2/(this._sampleCount-1),this._samples[this._pos]=e,this._pos++,this._pos%=this._samples.length},e.prototype.history=function(e){if(e>=this._sampleCount||e>=this._samples.length)return 0;var t=this._wrapPosition(this._pos-1);return this._samples[this._wrapPosition(t-e)]},e.prototype.isSaturated=function(){return this._sampleCount>=this._samples.length},e.prototype.reset=function(){this.average=0,this.variance=0,this._sampleCount=0,this._pos=0,this._m2=0},e.prototype._wrapPosition=function(e){var t=this._samples.length;return(e%t+t)%t},e}();function gr(e,t,i,n){switch(void 0===i&&(i=!1),e){case a.TEXTURETYPE_BYTE:var r=(ArrayBuffer,new Int8Array(t));return n&&r.set(new Int8Array(n)),r;case a.TEXTURETYPE_UNSIGNED_BYTE:var o=(ArrayBuffer,new Uint8Array(t));return n&&o.set(new Uint8Array(n)),o;case a.TEXTURETYPE_SHORT:var s=t instanceof ArrayBuffer?new Int16Array(t):new Int16Array(i?t/2:t);return n&&s.set(new Int16Array(n)),s;case a.TEXTURETYPE_UNSIGNED_SHORT:case a.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:case a.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:case a.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:case a.TEXTURETYPE_HALF_FLOAT:var l=t instanceof ArrayBuffer?new Uint16Array(t):new Uint16Array(i?t/2:t);return n&&l.set(new Uint16Array(n)),l;case a.TEXTURETYPE_INT:var c=t instanceof ArrayBuffer?new Int32Array(t):new Int32Array(i?t/4:t);return n&&c.set(new Int32Array(n)),c;case a.TEXTURETYPE_UNSIGNED_INTEGER:case a.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV:case a.TEXTURETYPE_UNSIGNED_INT_24_8:case a.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV:case a.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV:case a.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV:var u=t instanceof ArrayBuffer?new Uint32Array(t):new Uint32Array(i?t/4:t);return n&&u.set(new Uint32Array(n)),u;case a.TEXTURETYPE_FLOAT:var h=t instanceof ArrayBuffer?new Float32Array(t):new Float32Array(i?t/4:t);return n&&h.set(new Float32Array(n)),h}var d=(ArrayBuffer,new Uint8Array(t));return n&&d.set(new Uint8Array(n)),d}Yt.prototype.setAlphaConstants=function(e,t,i,n){this._alphaState.setAlphaBlendConstants(e,t,i,n)},Yt.prototype.setAlphaMode=function(e,t){if(void 0===t&&(t=!1),this._alphaMode!==e){switch(e){case a.ALPHA_DISABLE:this._alphaState.alphaBlend=!1;break;case a.ALPHA_PREMULTIPLIED:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case a.ALPHA_PREMULTIPLIED_PORTERDUFF:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0;break;case a.ALPHA_COMBINE:this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case a.ALPHA_ONEONE:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE,this._gl.ZERO,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case a.ALPHA_ADD:this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA,this._gl.ONE,this._gl.ZERO,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case a.ALPHA_SUBTRACT:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ZERO,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case a.ALPHA_MULTIPLY:this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_COLOR,this._gl.ZERO,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case a.ALPHA_MAXIMIZED:this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case a.ALPHA_INTERPOLATE:this._alphaState.setAlphaBlendFunctionParameters(this._gl.CONSTANT_COLOR,this._gl.ONE_MINUS_CONSTANT_COLOR,this._gl.CONSTANT_ALPHA,this._gl.ONE_MINUS_CONSTANT_ALPHA),this._alphaState.alphaBlend=!0;break;case a.ALPHA_SCREENMODE:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0;break;case a.ALPHA_ONEONE_ONEONE:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case a.ALPHA_ALPHATOCOLOR:this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_ALPHA,this._gl.ONE,this._gl.ZERO,this._gl.ZERO),this._alphaState.alphaBlend=!0;break;case a.ALPHA_REVERSEONEMINUS:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE_MINUS_DST_COLOR,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ONE_MINUS_DST_ALPHA,this._gl.ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0;break;case a.ALPHA_SRC_DSTONEMINUSSRCALPHA:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0;break;case a.ALPHA_ONEONE_ONEZERO:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE,this._gl.ONE,this._gl.ZERO),this._alphaState.alphaBlend=!0;break;case a.ALPHA_EXCLUSION:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE_MINUS_DST_COLOR,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ZERO,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case a.ALPHA_LAYER_ACCUMULATE:this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0}t||(this.depthCullingState.depthMask=e===a.ALPHA_DISABLE),this._alphaMode=e}},Yt.prototype.getAlphaMode=function(){return this._alphaMode},Yt.prototype.setAlphaEquation=function(e){if(this._alphaEquation!==e){switch(e){case a.ALPHA_EQUATION_ADD:this._alphaState.setAlphaEquationParameters(a.GL_ALPHA_EQUATION_ADD,a.GL_ALPHA_EQUATION_ADD);break;case a.ALPHA_EQUATION_SUBSTRACT:this._alphaState.setAlphaEquationParameters(a.GL_ALPHA_EQUATION_SUBTRACT,a.GL_ALPHA_EQUATION_SUBTRACT);break;case a.ALPHA_EQUATION_REVERSE_SUBTRACT:this._alphaState.setAlphaEquationParameters(a.GL_ALPHA_EQUATION_REVERSE_SUBTRACT,a.GL_ALPHA_EQUATION_REVERSE_SUBTRACT);break;case a.ALPHA_EQUATION_MAX:this._alphaState.setAlphaEquationParameters(a.GL_ALPHA_EQUATION_MAX,a.GL_ALPHA_EQUATION_MAX);break;case a.ALPHA_EQUATION_MIN:this._alphaState.setAlphaEquationParameters(a.GL_ALPHA_EQUATION_MIN,a.GL_ALPHA_EQUATION_MIN);break;case a.ALPHA_EQUATION_DARKEN:this._alphaState.setAlphaEquationParameters(a.GL_ALPHA_EQUATION_MIN,a.GL_ALPHA_EQUATION_ADD)}this._alphaEquation=e}},Yt.prototype.getAlphaEquation=function(){return this._alphaEquation},Yt.prototype._readTexturePixelsSync=function(e,t,i,n,r,o,a,s,l,c){var u,h;void 0===n&&(n=-1),void 0===r&&(r=0),void 0===o&&(o=null),void 0===a&&(a=!0),void 0===s&&(s=!1),void 0===l&&(l=0),void 0===c&&(c=0);var d=this._gl;if(!d)throw new Error(\"Engine does not have gl rendering context.\");if(!this._dummyFramebuffer){var p=d.createFramebuffer();if(!p)throw new Error(\"Unable to create dummy framebuffer\");this._dummyFramebuffer=p}d.bindFramebuffer(d.FRAMEBUFFER,this._dummyFramebuffer),n>-1?d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_CUBE_MAP_POSITIVE_X+n,null===(u=e._hardwareTexture)||void 0===u?void 0:u.underlyingResource,r):d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,null===(h=e._hardwareTexture)||void 0===h?void 0:h.underlyingResource,r);var f=void 0!==e.type?this._getWebGLTextureType(e.type):d.UNSIGNED_BYTE;return s?o||(o=gr(e.type,4*t*i)):f===d.UNSIGNED_BYTE?(o||(o=new Uint8Array(4*t*i)),f=d.UNSIGNED_BYTE):(o||(o=new Float32Array(4*t*i)),f=d.FLOAT),a&&this.flushFramebuffer(),d.readPixels(l,c,t,i,d.RGBA,f,o),d.bindFramebuffer(d.FRAMEBUFFER,this._currentFramebuffer),o},Yt.prototype._readTexturePixels=function(e,t,i,n,r,o,a,s,l,c){return void 0===n&&(n=-1),void 0===r&&(r=0),void 0===o&&(o=null),void 0===a&&(a=!0),void 0===s&&(s=!1),void 0===l&&(l=0),void 0===c&&(c=0),Promise.resolve(this._readTexturePixelsSync(e,t,i,n,r,o,a,s,l,c))},Yt.prototype.updateDynamicIndexBuffer=function(e,t,i){var n;void 0===i&&(i=0),this._currentBoundBuffer[this._gl.ELEMENT_ARRAY_BUFFER]=null,this.bindIndexBuffer(e),n=e.is32Bits?t instanceof Uint32Array?t:new Uint32Array(t):t instanceof Uint16Array?t:new Uint16Array(t),this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,n,this._gl.DYNAMIC_DRAW),this._resetIndexBufferBinding()},Yt.prototype.updateDynamicVertexBuffer=function(e,t,i,n){this.bindArrayBuffer(e),void 0===i&&(i=0);var r=t.byteLength||t.length;void 0===n||n>=r&&0===i?t instanceof Array?this._gl.bufferSubData(this._gl.ARRAY_BUFFER,i,new Float32Array(t)):this._gl.bufferSubData(this._gl.ARRAY_BUFFER,i,t):t instanceof Array?this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,new Float32Array(t).subarray(i,i+n)):(t=t instanceof ArrayBuffer?new Uint8Array(t,i,n):new Uint8Array(t.buffer,t.byteOffset+i,n),this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,t)),this._resetVertexBufferBinding()};var vr=function(e){function t(i,n,r,o){void 0===o&&(o=!1);var s=e.call(this,i,n,r,o)||this;if(s.enableOfflineSupport=!1,s.disableManifestCheck=!1,s.disableContextMenu=!0,s.scenes=new Array,s._virtualScenes=new Array,s.onNewSceneAddedObservable=new u,s.postProcesses=new Array,s.isPointerLock=!1,s.onResizeObservable=new u,s.onCanvasBlurObservable=new u,s.onCanvasFocusObservable=new u,s.onCanvasPointerOutObservable=new u,s.onBeginFrameObservable=new u,s.customAnimationFrameRequester=null,s.onEndFrameObservable=new u,s.onBeforeShaderCompilationObservable=new u,s.onAfterShaderCompilationObservable=new u,s._deterministicLockstep=!1,s._lockstepMaxSteps=4,s._timeStep=1/60,s._fps=60,s._deltaTime=0,s._drawCalls=new cn,s.canvasTabIndex=1,s.disablePerformanceMonitorInBackground=!1,s._performanceMonitor=new _r,s._compatibilityMode=!0,s.currentRenderPassId=a.RENDERPASS_MAIN,s._renderPassNames=[\"main\"],t.Instances.push(s),!i)return s;if(s._features.supportRenderPasses=!0,r=s._creationOptions,i.getContext){var l=i;s._sharedInit(l,!!r.doNotHandleTouchAction,r.audioEngine),qe()&&(s._onFullscreenChange=function(){s.isFullscreen=!!document.fullscreenElement,s.isFullscreen&&s._pointerLockRequested&&l&&t._RequestPointerlock(l)},document.addEventListener(\"fullscreenchange\",s._onFullscreenChange,!1),document.addEventListener(\"webkitfullscreenchange\",s._onFullscreenChange,!1),s._onPointerLockChange=function(){s.isPointerLock=document.pointerLockElement===l},document.addEventListener(\"pointerlockchange\",s._onPointerLockChange,!1),document.addEventListener(\"webkitpointerlockchange\",s._onPointerLockChange,!1),!t.audioEngine&&r.audioEngine&&t.AudioEngineFactory&&(t.audioEngine=t.AudioEngineFactory(s.getRenderingCanvas(),s.getAudioContext(),s.getAudioDestination()))),s._connectVREvents(),s.enableOfflineSupport=void 0!==t.OfflineProviderFactory,s._deterministicLockstep=!!r.deterministicLockstep,s._lockstepMaxSteps=r.lockstepMaxSteps||0,s._timeStep=r.timeStep||1/60}return s._prepareVRComponent(),r.autoEnableWebVR&&s.initWebVR(),s}return V(t,e),Object.defineProperty(t,\"NpmPackage\",{get:function(){return Yt.NpmPackage},enumerable:!1,configurable:!0}),Object.defineProperty(t,\"Version\",{get:function(){return Yt.Version},enumerable:!1,configurable:!0}),Object.defineProperty(t,\"Instances\",{get:function(){return S.Instances},enumerable:!1,configurable:!0}),Object.defineProperty(t,\"LastCreatedEngine\",{get:function(){return S.LastCreatedEngine},enumerable:!1,configurable:!0}),Object.defineProperty(t,\"LastCreatedScene\",{get:function(){return S.LastCreatedScene},enumerable:!1,configurable:!0}),t.prototype._createImageBitmapFromSource=function(e,t){var i=this;return new Promise((function(n,r){var o=new Image;o.onload=function(){o.decode().then((function(){i.createImageBitmap(o,t).then((function(e){n(e)}))}))},o.onerror=function(){r(\"Error loading image \".concat(o.src))},o.src=e}))},t.prototype.createImageBitmap=function(e,t){return createImageBitmap(e,t)},t.prototype.resizeImageBitmap=function(e,t,i){var n=this.createCanvas(t,i).getContext(\"2d\");if(!n)throw new Error(\"Unable to get 2d context for resizeImageBitmap\");return n.drawImage(e,0,0),n.getImageData(0,0,t,i).data},t.MarkAllMaterialsAsDirty=function(e,i){for(var n=0;n0?this.customAnimationFrameRequester?(this.customAnimationFrameRequester.requestID=this._queueNewFrame(this.customAnimationFrameRequester.renderFunction||this._boundRenderFunction,this.customAnimationFrameRequester),this._frameHandler=this.customAnimationFrameRequester.requestID):this.isVRPresenting()?this._requestVRFrame():this._frameHandler=this._queueNewFrame(this._boundRenderFunction,this.getHostWindow()):this._renderingQueueLaunched=!1},t.prototype._renderViews=function(){return!1},t.prototype.switchFullscreen=function(e){this.isFullscreen?this.exitFullscreen():this.enterFullscreen(e)},t.prototype.enterFullscreen=function(e){this.isFullscreen||(this._pointerLockRequested=e,this._renderingCanvas&&t._RequestFullscreen(this._renderingCanvas))},t.prototype.exitFullscreen=function(){this.isFullscreen&&t._ExitFullscreen()},t.prototype.enterPointerlock=function(){this._renderingCanvas&&t._RequestPointerlock(this._renderingCanvas)},t.prototype.exitPointerlock=function(){t._ExitPointerlock()},t.prototype.beginFrame=function(){this._measureFps(),this.onBeginFrameObservable.notifyObservers(this),e.prototype.beginFrame.call(this)},t.prototype.endFrame=function(){e.prototype.endFrame.call(this),this._submitVRFrame(),this.onEndFrameObservable.notifyObservers(this)},t.prototype.resize=function(t){void 0===t&&(t=!1),this.isVRPresenting()||e.prototype.resize.call(this,t)},t.prototype.setSize=function(t,i,n){if(void 0===n&&(n=!1),!this._renderingCanvas)return!1;if(!e.prototype.setSize.call(this,t,i,n))return!1;if(this.scenes){for(var r=0;r1&&r){var a=this.createTransformFeedback();this.bindTransformFeedback(a),this.setTranformFeedbackVaryings(o,r),e.transformFeedback=a}return n.linkProgram(o),this.webGLVersion>1&&r&&this.bindTransformFeedback(null),e.context=n,e.vertexShader=t,e.fragmentShader=i,e.isParallelCompiled||this._finalizePipelineContext(e),o},t.prototype._releaseTexture=function(t){e.prototype._releaseTexture.call(this,t)},t.prototype._releaseRenderTargetWrapper=function(t){e.prototype._releaseRenderTargetWrapper.call(this,t),this.scenes.forEach((function(e){e.postProcesses.forEach((function(e){e._outputTexture===t&&(e._outputTexture=null)})),e.cameras.forEach((function(e){e._postProcesses.forEach((function(e){e&&e._outputTexture===t&&(e._outputTexture=null)}))}))}))},t.prototype.getRenderPassNames=function(){return this._renderPassNames},t.prototype.getCurrentRenderPassName=function(){return this._renderPassNames[this.currentRenderPassId]},t.prototype.createRenderPassId=function(e){var i=++t._RenderPassIdCounter;return this._renderPassNames[i]=null!=e?e:\"NONAME\",i},t.prototype.releaseRenderPassId=function(e){this._renderPassNames[e]=void 0;for(var t=0;t=0&&t.Instances.splice(i,1),this.onResizeObservable.clear(),this.onCanvasBlurObservable.clear(),this.onCanvasFocusObservable.clear(),this.onCanvasPointerOutObservable.clear(),this.onBeginFrameObservable.clear(),this.onEndFrameObservable.clear()},t.prototype._disableTouchAction=function(){this._renderingCanvas&&this._renderingCanvas.setAttribute&&(this._renderingCanvas.setAttribute(\"touch-action\",\"none\"),this._renderingCanvas.style.touchAction=\"none\",this._renderingCanvas.style.webkitTapHighlightColor=\"transparent\")},t.prototype.displayLoadingUI=function(){if(qe()){var e=this.loadingScreen;e&&e.displayLoadingUI()}},t.prototype.hideLoadingUI=function(){if(qe()){var e=this._loadingScreen;e&&e.hideLoadingUI()}},Object.defineProperty(t.prototype,\"loadingScreen\",{get:function(){return!this._loadingScreen&&this._renderingCanvas&&(this._loadingScreen=t.DefaultLoadingScreenFactory(this._renderingCanvas)),this._loadingScreen},set:function(e){this._loadingScreen=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"loadingUIText\",{set:function(e){this.loadingScreen.loadingUIText=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"loadingUIBackgroundColor\",{set:function(e){this.loadingScreen.loadingUIBackgroundColor=e},enumerable:!1,configurable:!0}),t.prototype.createVideoElement=function(e){return document.createElement(\"video\")},t._RequestPointerlock=function(e){e.requestPointerLock&&(e.requestPointerLock(),e.focus())},t._ExitPointerlock=function(){document.exitPointerLock&&document.exitPointerLock()},t._RequestFullscreen=function(e){var t=e.requestFullscreen||e.webkitRequestFullscreen;t&&t.call(e)},t._ExitFullscreen=function(){var e=document;document.exitFullscreen?document.exitFullscreen():e.webkitCancelFullScreen&&e.webkitCancelFullScreen()},t.prototype.getFontOffset=function(e){var t=document.createElement(\"span\");t.innerHTML=\"Hg\",t.setAttribute(\"style\",\"font: \".concat(e,\" !important\"));var i=document.createElement(\"div\");i.style.display=\"inline-block\",i.style.width=\"1px\",i.style.height=\"0px\",i.style.verticalAlign=\"bottom\";var n=document.createElement(\"div\");n.style.whiteSpace=\"nowrap\",n.appendChild(t),n.appendChild(i),document.body.appendChild(n);var r=0,o=0;try{o=i.getBoundingClientRect().top-t.getBoundingClientRect().top,i.style.verticalAlign=\"baseline\",r=i.getBoundingClientRect().top-t.getBoundingClientRect().top}finally{document.body.removeChild(n)}return{ascent:r,height:o,descent:o-r}},t.ALPHA_DISABLE=a.ALPHA_DISABLE,t.ALPHA_ADD=a.ALPHA_ADD,t.ALPHA_COMBINE=a.ALPHA_COMBINE,t.ALPHA_SUBTRACT=a.ALPHA_SUBTRACT,t.ALPHA_MULTIPLY=a.ALPHA_MULTIPLY,t.ALPHA_MAXIMIZED=a.ALPHA_MAXIMIZED,t.ALPHA_ONEONE=a.ALPHA_ONEONE,t.ALPHA_PREMULTIPLIED=a.ALPHA_PREMULTIPLIED,t.ALPHA_PREMULTIPLIED_PORTERDUFF=a.ALPHA_PREMULTIPLIED_PORTERDUFF,t.ALPHA_INTERPOLATE=a.ALPHA_INTERPOLATE,t.ALPHA_SCREENMODE=a.ALPHA_SCREENMODE,t.DELAYLOADSTATE_NONE=a.DELAYLOADSTATE_NONE,t.DELAYLOADSTATE_LOADED=a.DELAYLOADSTATE_LOADED,t.DELAYLOADSTATE_LOADING=a.DELAYLOADSTATE_LOADING,t.DELAYLOADSTATE_NOTLOADED=a.DELAYLOADSTATE_NOTLOADED,t.NEVER=a.NEVER,t.ALWAYS=a.ALWAYS,t.LESS=a.LESS,t.EQUAL=a.EQUAL,t.LEQUAL=a.LEQUAL,t.GREATER=a.GREATER,t.GEQUAL=a.GEQUAL,t.NOTEQUAL=a.NOTEQUAL,t.KEEP=a.KEEP,t.REPLACE=a.REPLACE,t.INCR=a.INCR,t.DECR=a.DECR,t.INVERT=a.INVERT,t.INCR_WRAP=a.INCR_WRAP,t.DECR_WRAP=a.DECR_WRAP,t.TEXTURE_CLAMP_ADDRESSMODE=a.TEXTURE_CLAMP_ADDRESSMODE,t.TEXTURE_WRAP_ADDRESSMODE=a.TEXTURE_WRAP_ADDRESSMODE,t.TEXTURE_MIRROR_ADDRESSMODE=a.TEXTURE_MIRROR_ADDRESSMODE,t.TEXTUREFORMAT_ALPHA=a.TEXTUREFORMAT_ALPHA,t.TEXTUREFORMAT_LUMINANCE=a.TEXTUREFORMAT_LUMINANCE,t.TEXTUREFORMAT_LUMINANCE_ALPHA=a.TEXTUREFORMAT_LUMINANCE_ALPHA,t.TEXTUREFORMAT_RGB=a.TEXTUREFORMAT_RGB,t.TEXTUREFORMAT_RGBA=a.TEXTUREFORMAT_RGBA,t.TEXTUREFORMAT_RED=a.TEXTUREFORMAT_RED,t.TEXTUREFORMAT_R=a.TEXTUREFORMAT_R,t.TEXTUREFORMAT_RG=a.TEXTUREFORMAT_RG,t.TEXTUREFORMAT_RED_INTEGER=a.TEXTUREFORMAT_RED_INTEGER,t.TEXTUREFORMAT_R_INTEGER=a.TEXTUREFORMAT_R_INTEGER,t.TEXTUREFORMAT_RG_INTEGER=a.TEXTUREFORMAT_RG_INTEGER,t.TEXTUREFORMAT_RGB_INTEGER=a.TEXTUREFORMAT_RGB_INTEGER,t.TEXTUREFORMAT_RGBA_INTEGER=a.TEXTUREFORMAT_RGBA_INTEGER,t.TEXTURETYPE_UNSIGNED_BYTE=a.TEXTURETYPE_UNSIGNED_BYTE,t.TEXTURETYPE_UNSIGNED_INT=a.TEXTURETYPE_UNSIGNED_INT,t.TEXTURETYPE_FLOAT=a.TEXTURETYPE_FLOAT,t.TEXTURETYPE_HALF_FLOAT=a.TEXTURETYPE_HALF_FLOAT,t.TEXTURETYPE_BYTE=a.TEXTURETYPE_BYTE,t.TEXTURETYPE_SHORT=a.TEXTURETYPE_SHORT,t.TEXTURETYPE_UNSIGNED_SHORT=a.TEXTURETYPE_UNSIGNED_SHORT,t.TEXTURETYPE_INT=a.TEXTURETYPE_INT,t.TEXTURETYPE_UNSIGNED_INTEGER=a.TEXTURETYPE_UNSIGNED_INTEGER,t.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4=a.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4,t.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1=a.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1,t.TEXTURETYPE_UNSIGNED_SHORT_5_6_5=a.TEXTURETYPE_UNSIGNED_SHORT_5_6_5,t.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV=a.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV,t.TEXTURETYPE_UNSIGNED_INT_24_8=a.TEXTURETYPE_UNSIGNED_INT_24_8,t.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV=a.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV,t.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV=a.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV,t.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV=a.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV,t.TEXTURE_NEAREST_SAMPLINGMODE=a.TEXTURE_NEAREST_SAMPLINGMODE,t.TEXTURE_BILINEAR_SAMPLINGMODE=a.TEXTURE_BILINEAR_SAMPLINGMODE,t.TEXTURE_TRILINEAR_SAMPLINGMODE=a.TEXTURE_TRILINEAR_SAMPLINGMODE,t.TEXTURE_NEAREST_NEAREST_MIPLINEAR=a.TEXTURE_NEAREST_NEAREST_MIPLINEAR,t.TEXTURE_LINEAR_LINEAR_MIPNEAREST=a.TEXTURE_LINEAR_LINEAR_MIPNEAREST,t.TEXTURE_LINEAR_LINEAR_MIPLINEAR=a.TEXTURE_LINEAR_LINEAR_MIPLINEAR,t.TEXTURE_NEAREST_NEAREST_MIPNEAREST=a.TEXTURE_NEAREST_NEAREST_MIPNEAREST,t.TEXTURE_NEAREST_LINEAR_MIPNEAREST=a.TEXTURE_NEAREST_LINEAR_MIPNEAREST,t.TEXTURE_NEAREST_LINEAR_MIPLINEAR=a.TEXTURE_NEAREST_LINEAR_MIPLINEAR,t.TEXTURE_NEAREST_LINEAR=a.TEXTURE_NEAREST_LINEAR,t.TEXTURE_NEAREST_NEAREST=a.TEXTURE_NEAREST_NEAREST,t.TEXTURE_LINEAR_NEAREST_MIPNEAREST=a.TEXTURE_LINEAR_NEAREST_MIPNEAREST,t.TEXTURE_LINEAR_NEAREST_MIPLINEAR=a.TEXTURE_LINEAR_NEAREST_MIPLINEAR,t.TEXTURE_LINEAR_LINEAR=a.TEXTURE_LINEAR_LINEAR,t.TEXTURE_LINEAR_NEAREST=a.TEXTURE_LINEAR_NEAREST,t.TEXTURE_EXPLICIT_MODE=a.TEXTURE_EXPLICIT_MODE,t.TEXTURE_SPHERICAL_MODE=a.TEXTURE_SPHERICAL_MODE,t.TEXTURE_PLANAR_MODE=a.TEXTURE_PLANAR_MODE,t.TEXTURE_CUBIC_MODE=a.TEXTURE_CUBIC_MODE,t.TEXTURE_PROJECTION_MODE=a.TEXTURE_PROJECTION_MODE,t.TEXTURE_SKYBOX_MODE=a.TEXTURE_SKYBOX_MODE,t.TEXTURE_INVCUBIC_MODE=a.TEXTURE_INVCUBIC_MODE,t.TEXTURE_EQUIRECTANGULAR_MODE=a.TEXTURE_EQUIRECTANGULAR_MODE,t.TEXTURE_FIXED_EQUIRECTANGULAR_MODE=a.TEXTURE_FIXED_EQUIRECTANGULAR_MODE,t.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE=a.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE,t.SCALEMODE_FLOOR=a.SCALEMODE_FLOOR,t.SCALEMODE_NEAREST=a.SCALEMODE_NEAREST,t.SCALEMODE_CEILING=a.SCALEMODE_CEILING,t._RescalePostProcessFactory=null,t._RenderPassIdCounter=0,t}(Yt),yr=function(e){function t(i,n,r){void 0===n&&(n=null),void 0===r&&(r=!0);var o=e.call(this,i,n)||this;return o._forward=new x(0,0,1),o._up=new x(0,1,0),o._right=new x(1,0,0),o._position=x.Zero(),o._rotation=x.Zero(),o._rotationQuaternion=null,o._scaling=x.One(),o._transformToBoneReferal=null,o._isAbsoluteSynced=!1,o._billboardMode=t.BILLBOARDMODE_NONE,o._preserveParentRotationForBillboard=!1,o.scalingDeterminant=1,o._infiniteDistance=!1,o.ignoreNonUniformScaling=!1,o.reIntegrateRotationIntoRotationQuaternion=!1,o._poseMatrix=null,o._localMatrix=M.Zero(),o._usePivotMatrix=!1,o._absolutePosition=x.Zero(),o._absoluteScaling=x.Zero(),o._absoluteRotationQuaternion=P.Identity(),o._pivotMatrix=M.Identity(),o._postMultiplyPivotMatrix=!1,o._isWorldMatrixFrozen=!1,o._indexInSceneTransformNodesArray=-1,o.onAfterWorldMatrixUpdateObservable=new u,o._nonUniformScaling=!1,r&&o.getScene().addTransformNode(o),o}return V(t,e),Object.defineProperty(t.prototype,\"billboardMode\",{get:function(){return this._billboardMode},set:function(e){this._billboardMode!==e&&(this._billboardMode=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"preserveParentRotationForBillboard\",{get:function(){return this._preserveParentRotationForBillboard},set:function(e){e!==this._preserveParentRotationForBillboard&&(this._preserveParentRotationForBillboard=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"infiniteDistance\",{get:function(){return this._infiniteDistance},set:function(e){this._infiniteDistance!==e&&(this._infiniteDistance=e)},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return\"TransformNode\"},Object.defineProperty(t.prototype,\"position\",{get:function(){return this._position},set:function(e){this._position=e,this._isDirty=!0},enumerable:!1,configurable:!0}),t.prototype.isUsingPivotMatrix=function(){return this._usePivotMatrix},Object.defineProperty(t.prototype,\"rotation\",{get:function(){return this._rotation},set:function(e){this._rotation=e,this._rotationQuaternion=null,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"scaling\",{get:function(){return this._scaling},set:function(e){this._scaling=e,this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"rotationQuaternion\",{get:function(){return this._rotationQuaternion},set:function(e){this._rotationQuaternion=e,e&&this._rotation.setAll(0),this._isDirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"forward\",{get:function(){return x.TransformNormalFromFloatsToRef(0,0,this.getScene().useRightHandedSystem?-1:1,this.getWorldMatrix(),this._forward),this._forward.normalize()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"up\",{get:function(){return x.TransformNormalFromFloatsToRef(0,1,0,this.getWorldMatrix(),this._up),this._up.normalize()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"right\",{get:function(){return x.TransformNormalFromFloatsToRef(this.getScene().useRightHandedSystem?-1:1,0,0,this.getWorldMatrix(),this._right),this._right.normalize()},enumerable:!1,configurable:!0}),t.prototype.updatePoseMatrix=function(e){return this._poseMatrix?(this._poseMatrix.copyFrom(e),this):(this._poseMatrix=e.clone(),this)},t.prototype.getPoseMatrix=function(){return this._poseMatrix||(this._poseMatrix=M.Identity()),this._poseMatrix},t.prototype._isSynchronized=function(){var e=this._cache;return!(this._billboardMode!==e.billboardMode||this._billboardMode!==t.BILLBOARDMODE_NONE||e.pivotMatrixUpdated||this._infiniteDistance||this._position._isDirty||this._scaling._isDirty||this._rotationQuaternion&&this._rotationQuaternion._isDirty||this._rotation._isDirty)},t.prototype._initCache=function(){e.prototype._initCache.call(this);var t=this._cache;t.localMatrixUpdated=!1,t.billboardMode=-1,t.infiniteDistance=!1},Object.defineProperty(t.prototype,\"absolutePosition\",{get:function(){return this.getAbsolutePosition()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"absoluteScaling\",{get:function(){return this._syncAbsoluteScalingAndRotation(),this._absoluteScaling},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"absoluteRotationQuaternion\",{get:function(){return this._syncAbsoluteScalingAndRotation(),this._absoluteRotationQuaternion},enumerable:!1,configurable:!0}),t.prototype.setPreTransformMatrix=function(e){return this.setPivotMatrix(e,!1)},t.prototype.setPivotMatrix=function(e,t){return void 0===t&&(t=!0),this._pivotMatrix.copyFrom(e),this._usePivotMatrix=!this._pivotMatrix.isIdentity(),this._cache.pivotMatrixUpdated=!0,this._postMultiplyPivotMatrix=t,this._postMultiplyPivotMatrix&&(this._pivotMatrixInverse?this._pivotMatrix.invertToRef(this._pivotMatrixInverse):this._pivotMatrixInverse=M.Invert(this._pivotMatrix)),this},t.prototype.getPivotMatrix=function(){return this._pivotMatrix},t.prototype.instantiateHierarchy=function(e,t,i){void 0===e&&(e=null);var n=this.clone(\"Clone of \"+(this.name||this.id),e||this.parent,!0);n&&i&&i(this,n);for(var r=0,o=this.getChildTransformNodes(!0);r-1&&this._parentContainer.transformNodes.splice(n,1),this._parentContainer=null}if(this.onAfterWorldMatrixUpdateObservable.clear(),t)for(var r=0,o=this.getChildTransformNodes(!0);rvr.CollisionsEpsilon&&r.position.addInPlace(r._internalAbstractMeshDataInfo._meshCollisionData._diffPositionForCollisions),i&&r.onCollideObservable.notifyObservers(i),r.onCollisionPositionChangeObservable.notifyObservers(r.position)},(n=r.getScene()).addMesh(r),r._resyncLightSources(),r._uniformBuffer=new Li(r.getScene().getEngine(),void 0,void 0,i,!r.getScene().getEngine().isWebGPU),r._buildUniformLayout(),n.performancePriority){case Zi.Aggressive:r.doNotSyncBoundingInfo=!0;case Zi.Intermediate:r.alwaysSelectAsActiveMesh=!0,r.isPickable=!1}return r}return V(t,e),Object.defineProperty(t,\"BILLBOARDMODE_NONE\",{get:function(){return yr.BILLBOARDMODE_NONE},enumerable:!1,configurable:!0}),Object.defineProperty(t,\"BILLBOARDMODE_X\",{get:function(){return yr.BILLBOARDMODE_X},enumerable:!1,configurable:!0}),Object.defineProperty(t,\"BILLBOARDMODE_Y\",{get:function(){return yr.BILLBOARDMODE_Y},enumerable:!1,configurable:!0}),Object.defineProperty(t,\"BILLBOARDMODE_Z\",{get:function(){return yr.BILLBOARDMODE_Z},enumerable:!1,configurable:!0}),Object.defineProperty(t,\"BILLBOARDMODE_ALL\",{get:function(){return yr.BILLBOARDMODE_ALL},enumerable:!1,configurable:!0}),Object.defineProperty(t,\"BILLBOARDMODE_USE_POSITION\",{get:function(){return yr.BILLBOARDMODE_USE_POSITION},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"facetNb\",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetNb},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"partitioningSubdivisions\",{get:function(){return this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions},set:function(e){this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"partitioningBBoxRatio\",{get:function(){return this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio},set:function(e){this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"mustDepthSortFacets\",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetDepthSort},set:function(e){this._internalAbstractMeshDataInfo._facetData.facetDepthSort=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"facetDepthSortFrom\",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom},set:function(e){this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"collisionRetryCount\",{get:function(){return this._internalAbstractMeshDataInfo._collisionRetryCount},set:function(e){this._internalAbstractMeshDataInfo._collisionRetryCount=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"isFacetDataEnabled\",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetDataEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"morphTargetManager\",{get:function(){return this._internalAbstractMeshDataInfo._morphTargetManager},set:function(e){this._internalAbstractMeshDataInfo._morphTargetManager!==e&&(this._internalAbstractMeshDataInfo._morphTargetManager=e,this._syncGeometryWithMorphTargetManager())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"bakedVertexAnimationManager\",{get:function(){return this._internalAbstractMeshDataInfo._bakedVertexAnimationManager},set:function(e){this._internalAbstractMeshDataInfo._bakedVertexAnimationManager!==e&&(this._internalAbstractMeshDataInfo._bakedVertexAnimationManager=e,this._markSubMeshesAsAttributesDirty())},enumerable:!1,configurable:!0}),t.prototype._syncGeometryWithMorphTargetManager=function(){},t.prototype._updateNonUniformScalingState=function(t){return!!e.prototype._updateNonUniformScalingState.call(this,t)&&(this._markSubMeshesAsMiscDirty(),!0)},Object.defineProperty(t.prototype,\"onCollide\",{set:function(e){this._internalAbstractMeshDataInfo._meshCollisionData._onCollideObserver&&this.onCollideObservable.remove(this._internalAbstractMeshDataInfo._meshCollisionData._onCollideObserver),this._internalAbstractMeshDataInfo._meshCollisionData._onCollideObserver=this.onCollideObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"onCollisionPositionChange\",{set:function(e){this._internalAbstractMeshDataInfo._meshCollisionData._onCollisionPositionChangeObserver&&this.onCollisionPositionChangeObservable.remove(this._internalAbstractMeshDataInfo._meshCollisionData._onCollisionPositionChangeObserver),this._internalAbstractMeshDataInfo._meshCollisionData._onCollisionPositionChangeObserver=this.onCollisionPositionChangeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"visibility\",{get:function(){return this._internalAbstractMeshDataInfo._visibility},set:function(e){if(this._internalAbstractMeshDataInfo._visibility!==e){var t=this._internalAbstractMeshDataInfo._visibility;this._internalAbstractMeshDataInfo._visibility=e,(1===t&&1!==e||1!==t&&1===e)&&this._markSubMeshesAsMiscDirty()}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"renderingGroupId\",{get:function(){return this._internalAbstractMeshDataInfo._renderingGroupId},set:function(e){this._internalAbstractMeshDataInfo._renderingGroupId=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"material\",{get:function(){return this._internalAbstractMeshDataInfo._material},set:function(e){this._internalAbstractMeshDataInfo._material!==e&&(this._internalAbstractMeshDataInfo._material&&this._internalAbstractMeshDataInfo._material.meshMap&&(this._internalAbstractMeshDataInfo._material.meshMap[this.uniqueId]=void 0),this._internalAbstractMeshDataInfo._material=e,e&&e.meshMap&&(e.meshMap[this.uniqueId]=this),this.onMaterialChangedObservable.hasObservers()&&this.onMaterialChangedObservable.notifyObservers(this),this.subMeshes&&(this.resetDrawCache(),this._unBindEffect()))},enumerable:!1,configurable:!0}),t.prototype.getMaterialForRenderPass=function(e){var t;return null===(t=this._internalAbstractMeshDataInfo._materialForRenderPass)||void 0===t?void 0:t[e]},t.prototype.setMaterialForRenderPass=function(e,t){this.resetDrawCache(e),this._internalAbstractMeshDataInfo._materialForRenderPass||(this._internalAbstractMeshDataInfo._materialForRenderPass=[]),this._internalAbstractMeshDataInfo._materialForRenderPass[e]=t},Object.defineProperty(t.prototype,\"receiveShadows\",{get:function(){return this._internalAbstractMeshDataInfo._receiveShadows},set:function(e){this._internalAbstractMeshDataInfo._receiveShadows!==e&&(this._internalAbstractMeshDataInfo._receiveShadows=e,this._markSubMeshesAsLightDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"hasVertexAlpha\",{get:function(){return this._internalAbstractMeshDataInfo._hasVertexAlpha},set:function(e){this._internalAbstractMeshDataInfo._hasVertexAlpha!==e&&(this._internalAbstractMeshDataInfo._hasVertexAlpha=e,this._markSubMeshesAsAttributesDirty(),this._markSubMeshesAsMiscDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"useVertexColors\",{get:function(){return this._internalAbstractMeshDataInfo._useVertexColors},set:function(e){this._internalAbstractMeshDataInfo._useVertexColors!==e&&(this._internalAbstractMeshDataInfo._useVertexColors=e,this._markSubMeshesAsAttributesDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"computeBonesUsingShaders\",{get:function(){return this._internalAbstractMeshDataInfo._computeBonesUsingShaders},set:function(e){this._internalAbstractMeshDataInfo._computeBonesUsingShaders!==e&&(this._internalAbstractMeshDataInfo._computeBonesUsingShaders=e,this._markSubMeshesAsAttributesDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"numBoneInfluencers\",{get:function(){return this._internalAbstractMeshDataInfo._numBoneInfluencers},set:function(e){this._internalAbstractMeshDataInfo._numBoneInfluencers!==e&&(this._internalAbstractMeshDataInfo._numBoneInfluencers=e,this._markSubMeshesAsAttributesDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"applyFog\",{get:function(){return this._internalAbstractMeshDataInfo._applyFog},set:function(e){this._internalAbstractMeshDataInfo._applyFog!==e&&(this._internalAbstractMeshDataInfo._applyFog=e,this._markSubMeshesAsMiscDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"enableDistantPicking\",{get:function(){return this._internalAbstractMeshDataInfo._enableDistantPicking},set:function(e){this._internalAbstractMeshDataInfo._enableDistantPicking=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"layerMask\",{get:function(){return this._internalAbstractMeshDataInfo._layerMask},set:function(e){e!==this._internalAbstractMeshDataInfo._layerMask&&(this._internalAbstractMeshDataInfo._layerMask=e,this._resyncLightSources())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"collisionMask\",{get:function(){return this._internalAbstractMeshDataInfo._meshCollisionData._collisionMask},set:function(e){this._internalAbstractMeshDataInfo._meshCollisionData._collisionMask=isNaN(e)?-1:e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"collisionResponse\",{get:function(){return this._internalAbstractMeshDataInfo._meshCollisionData._collisionResponse},set:function(e){this._internalAbstractMeshDataInfo._meshCollisionData._collisionResponse=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"collisionGroup\",{get:function(){return this._internalAbstractMeshDataInfo._meshCollisionData._collisionGroup},set:function(e){this._internalAbstractMeshDataInfo._meshCollisionData._collisionGroup=isNaN(e)?-1:e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"surroundingMeshes\",{get:function(){return this._internalAbstractMeshDataInfo._meshCollisionData._surroundingMeshes},set:function(e){this._internalAbstractMeshDataInfo._meshCollisionData._surroundingMeshes=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"lightSources\",{get:function(){return this._lightSources},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"_positions\",{get:function(){return null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"skeleton\",{get:function(){return this._internalAbstractMeshDataInfo._skeleton},set:function(e){var t=this._internalAbstractMeshDataInfo._skeleton;t&&t.needInitialSkinMatrix&&t._unregisterMeshWithPoseMatrix(this),e&&e.needInitialSkinMatrix&&e._registerMeshWithPoseMatrix(this),this._internalAbstractMeshDataInfo._skeleton=e,this._internalAbstractMeshDataInfo._skeleton||(this._bonesTransformMatrices=null),this._markSubMeshesAsAttributesDirty()},enumerable:!1,configurable:!0}),t.prototype._buildUniformLayout=function(){this._uniformBuffer.addUniform(\"world\",16),this._uniformBuffer.addUniform(\"visibility\",1),this._uniformBuffer.create()},t.prototype.transferToEffect=function(e){var t=this._uniformBuffer;t.updateMatrix(\"world\",e),t.updateFloat(\"visibility\",this._internalAbstractMeshDataInfo._visibility),t.update()},t.prototype.getMeshUniformBuffer=function(){return this._uniformBuffer},t.prototype.getClassName=function(){return\"AbstractMesh\"},t.prototype.toString=function(e){var t=\"Name: \"+this.name+\", isInstance: \"+(\"InstancedMesh\"!==this.getClassName()?\"YES\":\"NO\");t+=\", # of submeshes: \"+(this.subMeshes?this.subMeshes.length:0);var i=this._internalAbstractMeshDataInfo._skeleton;return i&&(t+=\", skeleton: \"+i.name),e&&(t+=\", billboard mode: \"+[\"NONE\",\"X\",\"Y\",null,\"Z\",null,null,\"ALL\"][this.billboardMode],t+=\", freeze wrld mat: \"+(this._isWorldMatrixFrozen||this._waitingData.freezeWorldMatrix?\"YES\":\"NO\")),t},t.prototype._getEffectiveParent=function(){return this._masterMesh&&this.billboardMode!==yr.BILLBOARDMODE_NONE?this._masterMesh:e.prototype._getEffectiveParent.call(this)},t.prototype._getActionManagerForTrigger=function(e,t){if(void 0===t&&(t=!0),this.actionManager&&(t||this.actionManager.isRecursive)){if(!e)return this.actionManager;if(this.actionManager.hasSpecificTrigger(e))return this.actionManager}return this.parent?this.parent._getActionManagerForTrigger(e,!1):null},t.prototype._rebuild=function(e){if(void 0===e&&(e=!1),this.onRebuildObservable.notifyObservers(this),null!==this._occlusionQuery&&(this._occlusionQuery=null),this.subMeshes)for(var t=0,i=this.subMeshes;t0){var u=l.getPositions();u&&(i[a]+=(u[a]-i[a])*c)}}if(r++,n===wi.PositionKind&&this._positions&&3===r){r=0;var h=3*o;this._positions[o++].copyFromFloats(i[h],i[h+1],i[h+2])}}if(i&&e&&this.skeleton){var d=this.getVerticesData(wi.MatricesIndicesKind),p=this.getVerticesData(wi.MatricesWeightsKind);if(p&&d){var f=this.numBoneInfluencers>4,_=f?this.getVerticesData(wi.MatricesIndicesExtraKind):null,m=f?this.getVerticesData(wi.MatricesWeightsExtraKind):null,g=this.skeleton.getTransformMatrices(this),v=O.Vector3[0],y=O.Matrix[0],b=O.Matrix[1],T=0;for(h=0;h0&&(M.FromFloat32ArrayToRefScaled(g,Math.floor(16*d[T+E]),S,b),y.addToSelf(b));if(f)for(E=0;E<4;E++)(S=m[T+E])>0&&(M.FromFloat32ArrayToRefScaled(g,Math.floor(16*_[T+E]),S,b),y.addToSelf(b));n===wi.NormalKind?x.TransformNormalFromFloatsToRef(i[h],i[h+1],i[h+2],y,v):x.TransformCoordinatesFromFloatsToRef(i[h],i[h+1],i[h+2],y,v),v.toArray(i,h),n===wi.PositionKind&&this._positions&&this._positions[h/3].copyFrom(v)}}}return i},t.prototype.getNormalsData=function(e,t){return void 0===e&&(e=!1),void 0===t&&(t=!1),this._getData(e,t,null,wi.NormalKind)},t.prototype.getPositionData=function(e,t,i){return void 0===e&&(e=!1),void 0===t&&(t=!1),this._getData(e,t,i,wi.PositionKind)},t.prototype._getPositionData=function(e,t){var i,n=this.getVerticesData(wi.PositionKind);if(this._internalAbstractMeshDataInfo._positions&&(this._internalAbstractMeshDataInfo._positions=null),n&&(e&&this.skeleton||t&&this.morphTargetManager)){if(n=n.slice(),this._generatePointsArray(),this._positions){var r=this._positions;this._internalAbstractMeshDataInfo._positions=new Array(r.length);for(var o=0;o1||!n.IsGlobal)&&n.updateBoundingInfo(e)}return this},t.prototype._afterComputeWorldMatrix=function(){this.doNotSyncBoundingInfo||(this._boundingInfoIsDirty=!0)},t.prototype.isInFrustum=function(e){return this.getBoundingInfo().isInFrustum(e,this.cullingStrategy)},t.prototype.isCompletelyInFrustum=function(e){return this.getBoundingInfo().isCompletelyInFrustum(e)},t.prototype.intersectsMesh=function(e,t,i){void 0===t&&(t=!1);var n=this.getBoundingInfo(),r=e.getBoundingInfo();if(n.intersects(r,t))return!0;if(i)for(var o=0,a=this.getChildMeshes();o1&&!o._checkCollision(e)||this._collideForSubMesh(o,t,e)}return this},t.prototype._shouldConvertRHS=function(){return!1},t.prototype._checkCollision=function(e){if(!this.getBoundingInfo()._checkCollision(e))return this;var t=O.Matrix[0],i=O.Matrix[1];return M.ScalingToRef(1/e._radius.x,1/e._radius.y,1/e._radius.z,t),this.worldMatrixFromCache.multiplyToRef(t,i),this._processCollisionsForSubMeshes(e,i),this},t.prototype._generatePointsArray=function(){return!1},t.prototype.intersects=function(e,t,i,n,r,o){void 0===n&&(n=!1),void 0===o&&(o=!1);var s=new Bi,l=\"InstancedLinesMesh\"===this.getClassName()||\"LinesMesh\"===this.getClassName()?this.intersectionThreshold:0,c=this.getBoundingInfo();if(!this.subMeshes)return s;if(!(o||e.intersectsSphere(c.boundingSphere,l)&&e.intersectsBox(c.boundingBox,l)))return s;if(n)return s.hit=!o,s.pickedMesh=o?null:this,s.distance=o?0:x.Distance(e.origin,c.boundingSphere.center),s.subMeshId=0,s;if(!this._generatePointsArray())return s;for(var u=null,h=this._scene.getIntersectingSubMeshCandidates(this,e),d=h.length,p=!1,f=0;f1)||m.canIntersects(e)){var g=m.intersects(e,this._positions,this.getIndices(),t,i);if(g&&(t||!u||g.distance-1&&this._parentContainer.meshes.splice(l,1),this._parentContainer=null}if(i&&this.material&&(\"MultiMaterial\"===this.material.getClassName()?this.material.dispose(!1,!0,!0):this.material.dispose(!1,!0)),!t)for(n=0;n65535){o=!0;break}e.depthSortedIndices=o?new Uint32Array(i):new Uint16Array(i)}if(e.facetDepthSortFunction=function(e,t){return t.sqDistance-e.sqDistance},!e.facetDepthSortFrom){var s=this.getScene().activeCamera;e.facetDepthSortFrom=s?s.position:x.Zero()}e.depthSortedFacets=[];for(var l=0;l_?r.maximum.x-r.minimum.x:_,e.bbSize.y=r.maximum.y-r.minimum.y>_?r.maximum.y-r.minimum.y:_,e.bbSize.z=r.maximum.z-r.minimum.z>_?r.maximum.z-r.minimum.z:_;var u=e.bbSize.x>e.bbSize.y?e.bbSize.x:e.bbSize.y;if(u=u>e.bbSize.z?u:e.bbSize.z,e.subDiv.max=e.partitioningSubdivisions,e.subDiv.X=Math.floor(e.subDiv.max*e.bbSize.x/u),e.subDiv.Y=Math.floor(e.subDiv.max*e.bbSize.y/u),e.subDiv.Z=Math.floor(e.subDiv.max*e.bbSize.z/u),e.subDiv.X=e.subDiv.X<1?1:e.subDiv.X,e.subDiv.Y=e.subDiv.Y<1?1:e.subDiv.Y,e.subDiv.Z=e.subDiv.Z<1?1:e.subDiv.Z,e.facetParameters.facetNormals=this.getFacetLocalNormals(),e.facetParameters.facetPositions=this.getFacetLocalPositions(),e.facetParameters.facetPartitioning=this.getFacetLocalPartitioning(),e.facetParameters.bInfo=r,e.facetParameters.bbSize=e.bbSize,e.facetParameters.subDiv=e.subDiv,e.facetParameters.ratio=this.partitioningBBoxRatio,e.facetParameters.depthSort=e.facetDepthSort,e.facetDepthSort&&e.facetDepthSortEnabled&&(this.computeWorldMatrix(!0),this._worldMatrix.invertToRef(e.invertedMatrix),x.TransformCoordinatesToRef(e.facetDepthSortFrom,e.invertedMatrix,e.facetDepthSortOrigin),e.facetParameters.distanceTo=e.facetDepthSortOrigin),e.facetParameters.depthSortedFacets=e.depthSortedFacets,n&&$n.ComputeNormals(t,i,n,e.facetParameters),e.facetDepthSort&&e.facetDepthSortEnabled){e.depthSortedFacets.sort(e.facetDepthSortFunction);var h=e.depthSortedIndices.length/3|0;for(l=0;lr.subDiv.max||a<0||a>r.subDiv.max||s<0||s>r.subDiv.max?null:r.facetPartitioning[o+r.subDiv.max*a+r.subDiv.max*r.subDiv.max*s]},t.prototype.getClosestFacetAtCoordinates=function(e,t,i,n,r,o){void 0===r&&(r=!1),void 0===o&&(o=!0);var a=this.getWorldMatrix(),s=O.Matrix[5];a.invertToRef(s);var l=O.Vector3[8];x.TransformCoordinatesFromFloatsToRef(e,t,i,s,l);var c=this.getClosestFacetAtLocalCoordinates(l.x,l.y,l.z,n,r,o);return n&&x.TransformCoordinatesFromFloatsToRef(n.x,n.y,n.z,a,n),c},t.prototype.getClosestFacetAtLocalCoordinates=function(e,t,i,n,r,o){void 0===r&&(r=!1),void 0===o&&(o=!0);var a=null,s=0,l=0,c=0,u=0,h=0,d=0,p=0,f=0,_=this.getFacetLocalPositions(),m=this.getFacetLocalNormals(),g=this.getFacetsAtLocalCoordinates(e,t,i);if(!g)return null;for(var v,y,b,T=Number.MAX_VALUE,E=T,S=0;S=0||r&&!o&&u<=0)&&(u=y.x*b.x+y.y*b.y+y.z*b.z,h=-(y.x*e+y.y*t+y.z*i-u)/(y.x*y.x+y.y*y.y+y.z*y.z),(E=(s=(d=e+y.x*h)-e)*s+(l=(p=t+y.y*h)-t)*l+(c=(f=i+y.z*h)-i)*c)-1?(Q.Error(\"You're trying to reuse a post process not defined as reusable.\"),0):(null==t||t<0?this._postProcesses.push(e):null===this._postProcesses[t]?this._postProcesses[t]=e:this._postProcesses.splice(t,0,e),this._cascadePostProcessesToRigCams(),this._scene.prePassRenderer&&this._scene.prePassRenderer.markAsDirty(),this._postProcesses.indexOf(e))},t.prototype.detachPostProcess=function(e){var t=this._postProcesses.indexOf(e);-1!==t&&(this._postProcesses[t]=null),this._scene.prePassRenderer&&this._scene.prePassRenderer.markAsDirty(),this._cascadePostProcessesToRigCams()},t.prototype.getWorldMatrix=function(){return this._isSynchronizedViewMatrix()||this.getViewMatrix(),this._worldMatrix},t.prototype._getViewMatrix=function(){return M.Identity()},t.prototype.getViewMatrix=function(e){return!e&&this._isSynchronizedViewMatrix()||(this.updateCache(),this._computedViewMatrix=this._getViewMatrix(),this._currentRenderId=this.getScene().getRenderId(),this._childUpdateId++,this._refreshFrustumPlanes=!0,this._cameraRigParams&&this._cameraRigParams.vrPreViewMatrix&&this._computedViewMatrix.multiplyToRef(this._cameraRigParams.vrPreViewMatrix,this._computedViewMatrix),this.parent&&this.parent.onViewMatrixChangedObservable&&this.parent.onViewMatrixChangedObservable.notifyObservers(this.parent),this.onViewMatrixChangedObservable.notifyObservers(this),this._computedViewMatrix.invertToRef(this._worldMatrix)),this._computedViewMatrix},t.prototype.freezeProjectionMatrix=function(e){this._doNotComputeProjectionMatrix=!0,void 0!==e&&(this._projectionMatrix=e)},t.prototype.unfreezeProjectionMatrix=function(){this._doNotComputeProjectionMatrix=!1},t.prototype.getProjectionMatrix=function(e){var i,n,r,o,a,s,l,c;if(this._doNotComputeProjectionMatrix||!e&&this._isSynchronizedProjectionMatrix())return this._projectionMatrix;this._cache.mode=this.mode,this._cache.minZ=this.minZ,this._cache.maxZ=this.maxZ,this._refreshFrustumPlanes=!0;var u=this.getEngine(),h=this.getScene();if(this.mode===t.PERSPECTIVE_CAMERA){this._cache.fov=this.fov,this._cache.fovMode=this.fovMode,this._cache.aspectRatio=u.getAspectRatio(this),this._cache.projectionPlaneTilt=this.projectionPlaneTilt,this.minZ<=0&&(this.minZ=.1);var d=u.useReverseDepthBuffer;(h.useRightHandedSystem?M.PerspectiveFovRHToRef:M.PerspectiveFovLHToRef)(this.fov,u.getAspectRatio(this),d?this.maxZ:this.minZ,d?this.minZ:this.maxZ,this._projectionMatrix,this.fovMode===t.FOVMODE_VERTICAL_FIXED,u.isNDCHalfZRange,this.projectionPlaneTilt,u.useReverseDepthBuffer)}else{var p=u.getRenderWidth()/2,f=u.getRenderHeight()/2;h.useRightHandedSystem?M.OrthoOffCenterRHToRef(null!==(i=this.orthoLeft)&&void 0!==i?i:-p,null!==(n=this.orthoRight)&&void 0!==n?n:p,null!==(r=this.orthoBottom)&&void 0!==r?r:-f,null!==(o=this.orthoTop)&&void 0!==o?o:f,this.minZ,this.maxZ,this._projectionMatrix,u.isNDCHalfZRange):M.OrthoOffCenterLHToRef(null!==(a=this.orthoLeft)&&void 0!==a?a:-p,null!==(s=this.orthoRight)&&void 0!==s?s:p,null!==(l=this.orthoBottom)&&void 0!==l?l:-f,null!==(c=this.orthoTop)&&void 0!==c?c:f,this.minZ,this.maxZ,this._projectionMatrix,u.isNDCHalfZRange),this._cache.orthoLeft=this.orthoLeft,this._cache.orthoRight=this.orthoRight,this._cache.orthoBottom=this.orthoBottom,this._cache.orthoTop=this.orthoTop,this._cache.renderWidth=u.getRenderWidth(),this._cache.renderHeight=u.getRenderHeight()}return this.onProjectionMatrixChangedObservable.notifyObservers(this),this._projectionMatrix},t.prototype.getTransformationMatrix=function(){return this._computedViewMatrix.multiplyToRef(this._projectionMatrix,this._transformMatrix),this._transformMatrix},t.prototype._updateFrustumPlanes=function(){this._refreshFrustumPlanes&&(this.getTransformationMatrix(),this._frustumPlanes?hn.GetPlanesToRef(this._transformMatrix,this._frustumPlanes):this._frustumPlanes=hn.GetPlanes(this._transformMatrix),this._refreshFrustumPlanes=!1)},t.prototype.isInFrustum=function(e,t){if(void 0===t&&(t=!1),this._updateFrustumPlanes(),t&&this.rigCameras.length>0){var i=!1;return this.rigCameras.forEach((function(t){t._updateFrustumPlanes(),i=i||e.isInFrustum(t._frustumPlanes)})),i}return e.isInFrustum(this._frustumPlanes)},t.prototype.isCompletelyInFrustum=function(e){return this._updateFrustumPlanes(),e.isCompletelyInFrustum(this._frustumPlanes)},t.prototype.getForwardRay=function(e,t,i){throw void 0===e&&(e=100),pe(\"Ray\")},t.prototype.getForwardRayToRef=function(e,t,i,n){throw void 0===t&&(t=100),pe(\"Ray\")},t.prototype.dispose=function(i,n){for(void 0===n&&(n=!1),this.onViewMatrixChangedObservable.clear(),this.onProjectionMatrixChangedObservable.clear(),this.onAfterCheckInputsObservable.clear(),this.onRestoreStateObservable.clear(),this.inputs&&this.inputs.clear(),this.getScene().stopAnimation(this),this.getScene().removeCamera(this);this._rigCameras.length>0;){var r=this._rigCameras.pop();r&&r.dispose()}if(this._parentContainer){var o=this._parentContainer.cameras.indexOf(this);o>-1&&this._parentContainer.cameras.splice(o,1),this._parentContainer=null}if(this._rigPostProcess)this._rigPostProcess.dispose(this),this._rigPostProcess=null,this._postProcesses.length=0;else if(this.cameraRigMode!==t.RIG_MODE_NONE)this._rigPostProcess=null,this._postProcesses.length=0;else for(var a=this._postProcesses.length;--a>=0;){var s=this._postProcesses[a];s&&s.dispose(this)}for(var l=this.customRenderTargets.length;--l>=0;)this.customRenderTargets[l].dispose();this.customRenderTargets.length=0,this._activeMeshes.dispose(),this.getScene().getEngine().releaseRenderPassId(this.renderPassId),e.prototype.dispose.call(this,i,n)},Object.defineProperty(t.prototype,\"isLeftCamera\",{get:function(){return this._isLeftCamera},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"isRightCamera\",{get:function(){return this._isRightCamera},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"leftCamera\",{get:function(){return this._rigCameras.length<1?null:this._rigCameras[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"rightCamera\",{get:function(){return this._rigCameras.length<2?null:this._rigCameras[1]},enumerable:!1,configurable:!0}),t.prototype.getLeftTarget=function(){return this._rigCameras.length<1?null:this._rigCameras[0].getTarget()},t.prototype.getRightTarget=function(){return this._rigCameras.length<2?null:this._rigCameras[1].getTarget()},t.prototype.setCameraRigMode=function(e,i){if(this.cameraRigMode!==e){for(;this._rigCameras.length>0;){var n=this._rigCameras.pop();n&&n.dispose()}if(this.cameraRigMode=e,this._cameraRigParams={},this._cameraRigParams.interaxialDistance=i.interaxialDistance||.0637,this._cameraRigParams.stereoHalfAngle=mi.ToRadians(this._cameraRigParams.interaxialDistance/.0637),this.cameraRigMode!==t.RIG_MODE_NONE){var r=this.createRigCamera(this.name+\"_L\",0);r&&(r._isLeftCamera=!0);var o=this.createRigCamera(this.name+\"_R\",1);o&&(o._isRightCamera=!0),r&&o&&(this._rigCameras.push(r),this._rigCameras.push(o))}this._setRigMode(i),this._cascadePostProcessesToRigCams(),this.update()}},t.prototype._setRigMode=function(e){},t.prototype._getVRProjectionMatrix=function(){return M.PerspectiveFovLHToRef(this._cameraRigParams.vrMetrics.aspectRatioFov,this._cameraRigParams.vrMetrics.aspectRatio,this.minZ,this.maxZ,this._cameraRigParams.vrWorkMatrix,!0,this.getEngine().isNDCHalfZRange),this._cameraRigParams.vrWorkMatrix.multiplyToRef(this._cameraRigParams.vrHMatrix,this._projectionMatrix),this._projectionMatrix},t.prototype._updateCameraRotationMatrix=function(){},t.prototype._updateWebVRCameraRotationMatrix=function(){},t.prototype._getWebVRProjectionMatrix=function(){return M.Identity()},t.prototype._getWebVRViewMatrix=function(){return M.Identity()},t.prototype.setCameraRigParameter=function(e,t){this._cameraRigParams||(this._cameraRigParams={}),this._cameraRigParams[e]=t,\"interaxialDistance\"===e&&(this._cameraRigParams.stereoHalfAngle=mi.ToRadians(t/.0637))},t.prototype.createRigCamera=function(e,t){return null},t.prototype._updateRigCameras=function(){for(var e=0;e0,t.NUM_MORPH_INFLUENCERS=i.numInfluencers,t.MORPHTARGETS_TEXTURE=i.isUsingTextureForTargets):(t.MORPHTARGETS_UV=!1,t.MORPHTARGETS_TANGENT=!1,t.MORPHTARGETS_NORMAL=!1,t.MORPHTARGETS=!1,t.NUM_MORPH_INFLUENCERS=0)},e.PrepareDefinesForBakedVertexAnimation=function(e,t){var i=e.bakedVertexAnimationManager;t.BAKED_VERTEX_ANIMATION_TEXTURE=!(!i||!i.isEnabled)},e.PrepareDefinesForAttributes=function(e,t,i,n,r,o,s){if(void 0===r&&(r=!1),void 0===o&&(o=!0),void 0===s&&(s=!0),!t._areAttributesDirty&&t._needNormals===t._normals&&t._needUVs===t._uvs)return!1;t._normals=t._needNormals,t._uvs=t._needUVs,t.NORMAL=t._needNormals&&e.isVerticesDataPresent(wi.NormalKind),t._needNormals&&e.isVerticesDataPresent(wi.TangentKind)&&(t.TANGENT=!0);for(var l=1;l<=a.MAX_SUPPORTED_UV_SETS;++l)t[\"UV\"+l]=!!t._needUVs&&e.isVerticesDataPresent(\"uv\".concat(1===l?\"\":l));if(i){var c=e.useVertexColors&&e.isVerticesDataPresent(wi.ColorKind);t.VERTEXCOLOR=c,t.VERTEXALPHA=e.hasVertexAlpha&&c&&o}return e.isVerticesDataPresent(wi.ColorInstanceKind)&&(e.hasInstances||e.hasThinInstances)&&(t.INSTANCESCOLOR=!0),n&&this.PrepareDefinesForBones(e,t),r&&this.PrepareDefinesForMorphTargets(e,t),s&&this.PrepareDefinesForBakedVertexAnimation(e,t),!0},e.PrepareDefinesForMultiview=function(e,t){if(e.activeCamera){var i=t.MULTIVIEW;t.MULTIVIEW=null!==e.activeCamera.outputRenderTarget&&e.activeCamera.outputRenderTarget.getViewCount()>1,t.MULTIVIEW!=i&&t.markAsUnprocessed()}},e.PrepareDefinesForOIT=function(e,t,i){var n=t.ORDER_INDEPENDENT_TRANSPARENCY,r=t.ORDER_INDEPENDENT_TRANSPARENCY_16BITS;t.ORDER_INDEPENDENT_TRANSPARENCY=e.useOrderIndependentTransparency&&i,t.ORDER_INDEPENDENT_TRANSPARENCY_16BITS=!e.getEngine().getCaps().textureFloatLinearFiltering,n===t.ORDER_INDEPENDENT_TRANSPARENCY&&r===t.ORDER_INDEPENDENT_TRANSPARENCY_16BITS||t.markAsUnprocessed()},e.PrepareDefinesForPrePass=function(e,t,i){var n=t.PREPASS;if(t._arePrePassDirty){var r=[{type:a.PREPASS_POSITION_TEXTURE_TYPE,define:\"PREPASS_POSITION\",index:\"PREPASS_POSITION_INDEX\"},{type:a.PREPASS_VELOCITY_TEXTURE_TYPE,define:\"PREPASS_VELOCITY\",index:\"PREPASS_VELOCITY_INDEX\"},{type:a.PREPASS_REFLECTIVITY_TEXTURE_TYPE,define:\"PREPASS_REFLECTIVITY\",index:\"PREPASS_REFLECTIVITY_INDEX\"},{type:a.PREPASS_IRRADIANCE_TEXTURE_TYPE,define:\"PREPASS_IRRADIANCE\",index:\"PREPASS_IRRADIANCE_INDEX\"},{type:a.PREPASS_ALBEDO_SQRT_TEXTURE_TYPE,define:\"PREPASS_ALBEDO_SQRT\",index:\"PREPASS_ALBEDO_SQRT_INDEX\"},{type:a.PREPASS_DEPTH_TEXTURE_TYPE,define:\"PREPASS_DEPTH\",index:\"PREPASS_DEPTH_INDEX\"},{type:a.PREPASS_NORMAL_TEXTURE_TYPE,define:\"PREPASS_NORMAL\",index:\"PREPASS_NORMAL_INDEX\"}];if(e.prePassRenderer&&e.prePassRenderer.enabled&&i){t.PREPASS=!0,t.SCENE_MRT_COUNT=e.prePassRenderer.mrtCount;for(var o=0;o0&&(a.shadowEnabled=!0,s.prepareDefines(r,n))}}i.lightmapMode!=pn.LIGHTMAP_DEFAULT?(a.lightmapMode=!0,r[\"LIGHTMAPEXCLUDED\"+n]=!0,r[\"LIGHTMAPNOSPECULAR\"+n]=i.lightmapMode==pn.LIGHTMAP_SHADOWSONLY):(r[\"LIGHTMAPEXCLUDED\"+n]=!1,r[\"LIGHTMAPNOSPECULAR\"+n]=!1)},e.PrepareDefinesForLights=function(e,t,i,n,r,o){if(void 0===r&&(r=4),void 0===o&&(o=!1),!i._areLightsDirty)return i._needNormals;var a=0,s={needNormals:i._needNormals,needRebuild:!1,lightmapMode:!1,shadowEnabled:!1,specularEnabled:!1};if(e.lightsEnabled&&!o)for(var l=0,c=t.lightSources;l0&&(r=n+o,t.addFallback(r,\"LIGHT\"+o)),e.SHADOWS||(e[\"SHADOW\"+o]&&t.addFallback(n,\"SHADOW\"+o),e[\"SHADOWPCF\"+o]&&t.addFallback(n,\"SHADOWPCF\"+o),e[\"SHADOWPCSS\"+o]&&t.addFallback(n,\"SHADOWPCSS\"+o),e[\"SHADOWPOISSON\"+o]&&t.addFallback(n,\"SHADOWPOISSON\"+o),e[\"SHADOWESM\"+o]&&t.addFallback(n,\"SHADOWESM\"+o),e[\"SHADOWCLOSEESM\"+o]&&t.addFallback(n,\"SHADOWCLOSEESM\"+o));return r++},e.PrepareAttributesForMorphTargetsInfluencers=function(e,t,i){this._TmpMorphInfluencers.NUM_MORPH_INFLUENCERS=i,this.PrepareAttributesForMorphTargets(e,t,this._TmpMorphInfluencers)},e.PrepareAttributesForMorphTargets=function(e,t,i){var n=i.NUM_MORPH_INFLUENCERS;if(n>0&&S.LastCreatedEngine){var r=S.LastCreatedEngine.getCaps().maxVertexAttribs,o=t.morphTargetManager;if(null==o?void 0:o.isUsingTextureForTargets)return;for(var a=o&&o.supportsNormals&&i.NORMAL,s=o&&o.supportsTangents&&i.TANGENT,l=o&&o.supportsUVs&&i.UV1,c=0;cr&&Q.Error(\"Cannot add more vertex attributes for mesh \"+t.name)}},e.PrepareAttributesForBakedVertexAnimation=function(e,t,i){i.BAKED_VERTEX_ANIMATION_TEXTURE&&i.INSTANCES&&e.push(\"bakedVertexAnimationSettingsInstanced\")},e.PrepareAttributesForBones=function(e,t,i,n){i.NUM_BONE_INFLUENCERS>0&&(n.addCPUSkinningFallback(0,t),e.push(wi.MatricesIndicesKind),e.push(wi.MatricesWeightsKind),i.NUM_BONE_INFLUENCERS>4&&(e.push(wi.MatricesIndicesExtraKind),e.push(wi.MatricesWeightsExtraKind)))},e.PrepareAttributesForInstances=function(e,t){(t.INSTANCES||t.THIN_INSTANCES)&&this.PushAttributesForInstances(e,!!t.PREPASS_VELOCITY),t.INSTANCESCOLOR&&e.push(wi.ColorInstanceKind)},e.PushAttributesForInstances=function(e,t){void 0===t&&(t=!1),e.push(\"world0\"),e.push(\"world1\"),e.push(\"world2\"),e.push(\"world3\"),t&&(e.push(\"previousWorld0\"),e.push(\"previousWorld1\"),e.push(\"previousWorld2\"),e.push(\"previousWorld3\"))},e.BindLightProperties=function(e,t,i){e.transferToEffect(t,i+\"\")},e.BindLight=function(e,t,i,n,r,o){void 0===o&&(o=!0),e._bindLight(t,i,n,r,o)},e.BindLights=function(e,t,i,n,r){void 0===r&&(r=4);for(var o=Math.min(t.lightSources.length,r),a=0;a-1){var o=r.getTransformMatrixTexture(t);i.setTexture(\"boneSampler\",o),i.setFloat(\"boneTextureWidth\",4*(r.bones.length+1))}else{var s=r.getTransformMatrices(t);s&&(i.setMatrices(\"mBones\",s),n&&t.getScene().prePassRenderer&&t.getScene().prePassRenderer.getIndex(a.PREPASS_VELOCITY_TEXTURE_TYPE)&&(n.previousBones[t.uniqueId]||(n.previousBones[t.uniqueId]=s.slice()),i.setMatrices(\"mPreviousBones\",n.previousBones[t.uniqueId]),e._CopyBonesTransformationMatrices(s,n.previousBones[t.uniqueId])))}}},e._CopyBonesTransformationMatrices=function(e,t){return t.set(e),t},e.BindMorphTargetParameters=function(e,t){var i=e.morphTargetManager;e&&i&&t.setFloatArray(\"morphTargetInfluences\",i.influences)},e.BindLogDepth=function(e,t,i){if(!e||e.LOGARITHMICDEPTH||e.indexOf&&e.indexOf(\"LOGARITHMICDEPTH\")>=0){var n=i.activeCamera;n.mode===xr.ORTHOGRAPHIC_CAMERA&&Q.Error(\"Logarithmic depth is not compatible with orthographic cameras!\",20),t.setFloat(\"logarithmicDepthConstant\",2/(Math.log(n.maxZ+1)/Math.LN2))}},e.BindClipPlane=function(e,t){Cr.BindClipPlane(e,t)},e._TmpMorphInfluencers={NUM_MORPH_INFLUENCERS:0},e._TempFogColor=N.Black(),e}(),Mr=function(){function e(){this.reset()}return e.prototype.reset=function(){this.enabled=!1,this.mask=255,this.func=a.ALWAYS,this.funcRef=1,this.funcMask=255,this.opStencilFail=a.KEEP,this.opDepthFail=a.KEEP,this.opStencilDepthPass=a.REPLACE},Object.defineProperty(e.prototype,\"func\",{get:function(){return this._func},set:function(e){this._func=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"funcRef\",{get:function(){return this._funcRef},set:function(e){this._funcRef=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"funcMask\",{get:function(){return this._funcMask},set:function(e){this._funcMask=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"opStencilFail\",{get:function(){return this._opStencilFail},set:function(e){this._opStencilFail=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"opDepthFail\",{get:function(){return this._opDepthFail},set:function(e){this._opDepthFail=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"opStencilDepthPass\",{get:function(){return this._opStencilDepthPass},set:function(e){this._opStencilDepthPass=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"mask\",{get:function(){return this._mask},set:function(e){this._mask=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"enabled\",{get:function(){return this._enabled},set:function(e){this._enabled=e},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return\"MaterialStencilState\"},e.prototype.copyTo=function(e){Le.Clone((function(){return e}),this)},e.prototype.serialize=function(){return Le.Serialize(this)},e.prototype.parse=function(e,t,i){var n=this;Le.Parse((function(){return n}),e,t,i)},G([be()],e.prototype,\"func\",null),G([be()],e.prototype,\"funcRef\",null),G([be()],e.prototype,\"funcMask\",null),G([be()],e.prototype,\"opStencilFail\",null),G([be()],e.prototype,\"opDepthFail\",null),G([be()],e.prototype,\"opStencilDepthPass\",null),G([be()],e.prototype,\"mask\",null),G([be()],e.prototype,\"enabled\",null),e}();!function(e){e[e.Created=1]=\"Created\",e[e.Disposed=2]=\"Disposed\",e[e.GetDefineNames=4]=\"GetDefineNames\",e[e.PrepareUniformBuffer=8]=\"PrepareUniformBuffer\",e[e.IsReadyForSubMesh=16]=\"IsReadyForSubMesh\",e[e.PrepareDefines=32]=\"PrepareDefines\",e[e.BindForSubMesh=64]=\"BindForSubMesh\",e[e.PrepareEffect=128]=\"PrepareEffect\",e[e.GetAnimatables=256]=\"GetAnimatables\",e[e.GetActiveTextures=512]=\"GetActiveTextures\",e[e.HasTexture=1024]=\"HasTexture\",e[e.FillRenderTargetTextures=2048]=\"FillRenderTargetTextures\",e[e.HasRenderTargetTextures=4096]=\"HasRenderTargetTextures\",e[e.HardBindForSubMesh=8192]=\"HardBindForSubMesh\"}(Ar||(Ar={}));var Ir=function(){function e(t,i,n){this.shadowDepthWrapper=null,this.allowShaderHotSwapping=!0,this.metadata=null,this.reservedDataStore=null,this.checkReadyOnEveryCall=!1,this.checkReadyOnlyOnce=!1,this.state=\"\",this._alpha=1,this._backFaceCulling=!0,this._cullBackFaces=!0,this.onCompiled=null,this.onError=null,this.getRenderTargetTextures=null,this.doNotSerialize=!1,this._storeEffectOnSubMeshes=!1,this.animations=null,this.onDisposeObservable=new u,this._onDisposeObserver=null,this._onUnBindObservable=null,this._onBindObserver=null,this._alphaMode=a.ALPHA_COMBINE,this._needDepthPrePass=!1,this.disableDepthWrite=!1,this.disableColorWrite=!1,this.forceDepthWrite=!1,this.depthFunction=0,this.separateCullingPass=!1,this._fogEnabled=!0,this.pointSize=1,this.zOffset=0,this.zOffsetUnits=0,this.stencil=new Mr,this._useUBO=!1,this._fillMode=e.TriangleFillMode,this._cachedDepthWriteState=!1,this._cachedColorWriteState=!1,this._cachedDepthFunctionState=0,this._indexInSceneMaterialArray=-1,this.meshMap=null,this._parentContainer=null,this._uniformBufferLayoutBuilt=!1,this._eventInfo={},this._callbackPluginEventGeneric=function(){},this._callbackPluginEventIsReadyForSubMesh=function(){},this._callbackPluginEventPrepareDefines=function(){},this._callbackPluginEventPrepareDefinesBeforeAttributes=function(){},this._callbackPluginEventHardBindForSubMesh=function(){},this._callbackPluginEventBindForSubMesh=function(){},this._callbackPluginEventHasRenderTargetTextures=function(){},this._callbackPluginEventFillRenderTargetTextures=function(){},this._forceAlphaTest=!1,this._transparencyMode=null,this.name=t;var r=i||S.LastCreatedScene;r&&(this._scene=r,this._dirtyCallbacks={},this._dirtyCallbacks[a.MATERIAL_TextureDirtyFlag]=this._markAllSubMeshesAsTexturesDirty.bind(this),this._dirtyCallbacks[a.MATERIAL_LightDirtyFlag]=this._markAllSubMeshesAsLightsDirty.bind(this),this._dirtyCallbacks[a.MATERIAL_FresnelDirtyFlag]=this._markAllSubMeshesAsFresnelDirty.bind(this),this._dirtyCallbacks[a.MATERIAL_AttributesDirtyFlag]=this._markAllSubMeshesAsAttributesDirty.bind(this),this._dirtyCallbacks[a.MATERIAL_MiscDirtyFlag]=this._markAllSubMeshesAsMiscDirty.bind(this),this._dirtyCallbacks[a.MATERIAL_PrePassDirtyFlag]=this._markAllSubMeshesAsPrePassDirty.bind(this),this._dirtyCallbacks[a.MATERIAL_AllDirtyFlag]=this._markAllSubMeshesAsAllDirty.bind(this),this.id=t||mi.RandomId(),this.uniqueId=this._scene.getUniqueId(),this._materialContext=this._scene.getEngine().createMaterialContext(),this._drawWrapper=new Ht(this._scene.getEngine(),!1),this._drawWrapper.materialContext=this._materialContext,this._scene.useRightHandedSystem?this.sideOrientation=e.ClockWiseSideOrientation:this.sideOrientation=e.CounterClockWiseSideOrientation,this._uniformBuffer=new Li(this._scene.getEngine(),void 0,void 0,t),this._useUBO=this.getScene().getEngine().supportsUniformBuffers,n||this._scene.addMaterial(this),this._scene.useMaterialMeshMap&&(this.meshMap={}),e.OnEventObservable.notifyObservers(this,Ar.Created))}return Object.defineProperty(e.prototype,\"canRenderToMRT\",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"alpha\",{get:function(){return this._alpha},set:function(t){if(this._alpha!==t){var i=this._alpha;this._alpha=t,1!==i&&1!==t||this.markAsDirty(e.MiscDirtyFlag)}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"backFaceCulling\",{get:function(){return this._backFaceCulling},set:function(t){this._backFaceCulling!==t&&(this._backFaceCulling=t,this.markAsDirty(e.TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"cullBackFaces\",{get:function(){return this._cullBackFaces},set:function(t){this._cullBackFaces!==t&&(this._cullBackFaces=t,this.markAsDirty(e.TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"hasRenderTargetTextures\",{get:function(){return this._eventInfo.hasRenderTargetTextures=!1,this._callbackPluginEventHasRenderTargetTextures(this._eventInfo),this._eventInfo.hasRenderTargetTextures},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"onDispose\",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"onBindObservable\",{get:function(){return this._onBindObservable||(this._onBindObservable=new u),this._onBindObservable},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"onBind\",{set:function(e){this._onBindObserver&&this.onBindObservable.remove(this._onBindObserver),this._onBindObserver=this.onBindObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"onUnBindObservable\",{get:function(){return this._onUnBindObservable||(this._onUnBindObservable=new u),this._onUnBindObservable},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"onEffectCreatedObservable\",{get:function(){return this._onEffectCreatedObservable||(this._onEffectCreatedObservable=new u),this._onEffectCreatedObservable},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"alphaMode\",{get:function(){return this._alphaMode},set:function(t){this._alphaMode!==t&&(this._alphaMode=t,this.markAsDirty(e.TextureDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"needDepthPrePass\",{get:function(){return this._needDepthPrePass},set:function(e){this._needDepthPrePass!==e&&(this._needDepthPrePass=e,this._needDepthPrePass&&(this.checkReadyOnEveryCall=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"isPrePassCapable\",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"fogEnabled\",{get:function(){return this._fogEnabled},set:function(t){this._fogEnabled!==t&&(this._fogEnabled=t,this.markAsDirty(e.MiscDirtyFlag))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"wireframe\",{get:function(){switch(this._fillMode){case e.WireFrameFillMode:case e.LineListDrawMode:case e.LineLoopDrawMode:case e.LineStripDrawMode:return!0}return this._scene.forceWireframe},set:function(t){this.fillMode=t?e.WireFrameFillMode:e.TriangleFillMode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"pointsCloud\",{get:function(){switch(this._fillMode){case e.PointFillMode:case e.PointListDrawMode:return!0}return this._scene.forcePointsCloud},set:function(t){this.fillMode=t?e.PointFillMode:e.TriangleFillMode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"fillMode\",{get:function(){return this._fillMode},set:function(t){this._fillMode!==t&&(this._fillMode=t,this.markAsDirty(e.MiscDirtyFlag))},enumerable:!1,configurable:!0}),e.prototype._getDrawWrapper=function(){return this._drawWrapper},e.prototype._setDrawWrapper=function(e){this._drawWrapper=e},e.prototype.toString=function(e){return\"Name: \"+this.name},e.prototype.getClassName=function(){return\"Material\"},Object.defineProperty(e.prototype,\"isFrozen\",{get:function(){return this.checkReadyOnlyOnce},enumerable:!1,configurable:!0}),e.prototype.freeze=function(){this.markDirty(),this.checkReadyOnlyOnce=!0},e.prototype.unfreeze=function(){this.markDirty(),this.checkReadyOnlyOnce=!1},e.prototype.isReady=function(e,t){return!0},e.prototype.isReadyForSubMesh=function(e,t,i){var n=t.materialDefines;return!!n&&(this._eventInfo.isReadyForSubMesh=!0,this._eventInfo.defines=n,this._callbackPluginEventIsReadyForSubMesh(this._eventInfo),this._eventInfo.isReadyForSubMesh)},e.prototype.getEffect=function(){return this._drawWrapper.effect},e.prototype.getScene=function(){return this._scene},Object.defineProperty(e.prototype,\"transparencyMode\",{get:function(){return this._transparencyMode},set:function(t){this._transparencyMode!==t&&(this._transparencyMode=t,this._forceAlphaTest=t===e.MATERIAL_ALPHATESTANDBLEND,this._markAllSubMeshesAsTexturesAndMiscDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"_disableAlphaBlending\",{get:function(){return this._transparencyMode===e.MATERIAL_OPAQUE||this._transparencyMode===e.MATERIAL_ALPHATEST},enumerable:!1,configurable:!0}),e.prototype.needAlphaBlending=function(){return!this._disableAlphaBlending&&this.alpha<1},e.prototype.needAlphaBlendingForMesh=function(e){return e.visibility<1||!this._disableAlphaBlending&&(e.hasVertexAlpha||this.needAlphaBlending())},e.prototype.needAlphaTesting=function(){return!!this._forceAlphaTest},e.prototype._shouldTurnAlphaTestOn=function(e){return!this.needAlphaBlendingForMesh(e)&&this.needAlphaTesting()},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.markDirty=function(){for(var e=0,t=this.getScene().meshes;e-1&&this._parentContainer.materials.splice(r,1),this._parentContainer=null}if(!0!==i)if(this.meshMap)for(var o in this.meshMap)(l=this.meshMap[o])&&(l.material=null,this.releaseVertexArrayObject(l,e));else for(var a=0,s=n.meshes;a=this.subMaterials.length?this.getScene().defaultMaterial:this.subMaterials[e]},t.prototype.getActiveTextures=function(){var t;return(t=e.prototype.getActiveTextures.call(this)).concat.apply(t,this.subMaterials.map((function(e){return e?e.getActiveTextures():[]})))},t.prototype.hasTexture=function(t){var i;if(e.prototype.hasTexture.call(this,t))return!0;for(var n=0;n=0&&r.multiMaterials.splice(s,1),e.prototype.dispose.call(this,t,i)}},t.ParseMultiMaterial=function(e,i){var n=new t(e.name,i);return n.id=e.id,n._loadedUniqueId=e.uniqueId,de&&de.AddTagsTo(n,e.tags),e.materialsUniqueIds?n._waitingSubMaterialsUniqueIds=e.materialsUniqueIds:e.materials.forEach((function(e){return n.subMaterials.push(i.getLastMaterialById(e))})),n},t}(Ir);b(\"BABYLON.MultiMaterial\",Or);var Dr=function(e,t){this.distanceOrScreenCoverage=e,this.mesh=t},Nr=function(){},Lr=function(){this.visibleInstances={},this.batchCache=new Fr,this.batchCacheReplacementModeInFrozenMode=new Fr,this.instancesBufferSize=2048},Fr=function(){this.mustReturn=!1,this.visibleInstances=new Array,this.renderSelf=new Array,this.hardwareInstancedRendering=new Array},wr=function(){this.instancesCount=0,this.matrixBuffer=null,this.previousMatrixBuffer=null,this.matrixBufferSize=512,this.matrixData=null,this.boundingVectors=[],this.worldMatrices=null},Br=function(){this._areNormalsFrozen=!1,this._source=null,this.meshMap=null,this._preActivateId=-1,this._LODLevels=new Array,this._useLODScreenCoverage=!1,this._effectiveMaterial=null,this._forcedInstanceCount=0},Ur=function(e){function t(i,n,r,o,s,l){void 0===n&&(n=null),void 0===r&&(r=null),void 0===o&&(o=null),void 0===l&&(l=!0);var c=e.call(this,i,n)||this;if(c._internalMeshDataInfo=new Br,c.delayLoadState=a.DELAYLOADSTATE_NONE,c.instances=new Array,c._creationDataStorage=null,c._geometry=null,c._instanceDataStorage=new Lr,c._thinInstanceDataStorage=new wr,c._shouldGenerateFlatShading=!1,c._originalBuilderSideOrientation=t.DEFAULTSIDE,c.overrideMaterialSideOrientation=null,c.ignoreCameraMaxZ=!1,n=c.getScene(),c._onBeforeDraw=function(e,t,i){e&&i&&(c._uniformBuffer?c.transferToEffect(t):i.bindOnlyWorldMatrix(t))},o){if(o._geometry&&o._geometry.applyToMesh(c),se.DeepCopy(o,c,[\"name\",\"material\",\"skeleton\",\"instances\",\"parent\",\"uniqueId\",\"source\",\"metadata\",\"morphTargetManager\",\"hasInstances\",\"worldMatrixInstancedBuffer\",\"previousWorldMatrixInstancedBuffer\",\"hasLODLevels\",\"geometry\",\"isBlocked\",\"areNormalsFrozen\",\"facetNb\",\"isFacetDataEnabled\",\"lightSources\",\"useBones\",\"isAnInstance\",\"collider\",\"edgesRenderer\",\"forward\",\"up\",\"right\",\"absolutePosition\",\"absoluteScaling\",\"absoluteRotationQuaternion\",\"isWorldMatrixFrozen\",\"nonUniformScaling\",\"behaviors\",\"worldMatrixFromCache\",\"hasThinInstances\",\"cloneMeshMap\",\"hasBoundingInfo\"],[\"_poseMatrix\"]),c._internalMeshDataInfo._source=o,n.useClonedMeshMap&&(o._internalMeshDataInfo.meshMap||(o._internalMeshDataInfo.meshMap={}),o._internalMeshDataInfo.meshMap[c.uniqueId]=c),c._originalBuilderSideOrientation=o._originalBuilderSideOrientation,c._creationDataStorage=o._creationDataStorage,o._ranges){var h=o._ranges;for(var d in h)Object.prototype.hasOwnProperty.call(h,d)&&h[d]&&c.createAnimationRange(d,h[d].from,h[d].to)}if(o.metadata&&o.metadata.clone?c.metadata=o.metadata.clone():c.metadata=o.metadata,de&&de.HasTags(o)&&de.AddTagsTo(c,de.GetTags(o,!0)),c.setEnabled(o.isEnabled(!1)),c.parent=o.parent,c.setPivotMatrix(o.getPivotMatrix()),c.id=i+\".\"+o.id,c.material=o.material,!s)for(var p=o.getDescendants(!0),f=0;f0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"hasThinInstances\",{get:function(){var e;return(null!==(e=this._thinInstanceDataStorage.instancesCount)&&void 0!==e?e:0)>0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"forcedInstanceCount\",{get:function(){return this._internalMeshDataInfo._forcedInstanceCount},set:function(e){this._internalMeshDataInfo._forcedInstanceCount=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"source\",{get:function(){return this._internalMeshDataInfo._source},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"cloneMeshMap\",{get:function(){return this._internalMeshDataInfo.meshMap},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"isUnIndexed\",{get:function(){return this._unIndexed},set:function(e){this._unIndexed!==e&&(this._unIndexed=e,this._markSubMeshesAsAttributesDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"worldMatrixInstancedBuffer\",{get:function(){return this._instanceDataStorage.instancesData},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"previousWorldMatrixInstancedBuffer\",{get:function(){return this._instanceDataStorage.instancesPreviousData},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"manualUpdateOfWorldMatrixInstancedBuffer\",{get:function(){return this._instanceDataStorage.manualUpdate},set:function(e){this._instanceDataStorage.manualUpdate=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"manualUpdateOfPreviousWorldMatrixInstancedBuffer\",{get:function(){return this._instanceDataStorage.previousManualUpdate},set:function(e){this._instanceDataStorage.previousManualUpdate=e},enumerable:!1,configurable:!0}),t.prototype.instantiateHierarchy=function(e,t,i){void 0===e&&(e=null);var n=0===this.getTotalVertices()||t&&t.doNotInstantiate&&(!0===t.doNotInstantiate||t.doNotInstantiate(this))?this.clone(\"Clone of \"+(this.name||this.id),e||this.parent,!0):this.createInstance(\"instance of \"+(this.name||this.id));n.parent=e||this.parent,n.position=this.position.clone(),n.scaling=this.scaling.clone(),this.rotationQuaternion?n.rotationQuaternion=this.rotationQuaternion.clone():n.rotation=this.rotation.clone(),i&&i(this,n);for(var r=0,o=this.getChildTransformNodes(!0);r0},enumerable:!1,configurable:!0}),t.prototype.getLODLevels=function(){return this._internalMeshDataInfo._LODLevels},t.prototype._sortLODLevels=function(){var e=this._internalMeshDataInfo._useLODScreenCoverage?-1:1;this._internalMeshDataInfo._LODLevels.sort((function(t,i){return t.distanceOrScreenCoveragei.distanceOrScreenCoverage?-e:0}))},t.prototype.addLODLevel=function(e,t){if(t&&t._masterMesh)return Q.Warn(\"You cannot use a mesh as LOD level twice\"),this;var i=new Dr(e,t);return this._internalMeshDataInfo._LODLevels.push(i),t&&(t._masterMesh=this),this._sortLODLevels(),this},t.prototype.getLODLevelAtDistance=function(e){for(var t=this._internalMeshDataInfo,i=0;is*o)return this.onLODLevelSelection&&this.onLODLevelSelection(o,this,this),this;for(var u=0;u0||this.hasThinInstances);this.computeWorldMatrix();var p=this.material||h.defaultMaterial;if(p)if(p._storeEffectOnSubMeshes)for(var f=0,_=this.subMeshes;f<_.length;f++){var m=(S=_[f]).getMaterial();if(m)if(m._storeEffectOnSubMeshes){if(!m.isReadyForSubMesh(this,S,d))return!1}else if(!m.isReady(this,d))return!1}else if(!p.isReady(this,d))return!1;for(var g=u.currentRenderPassId,v=0,y=this.lightSources;v0){var i=this.getIndices();if(!i)return null;var n=i.length,r=!1;if(e)r=!0;else for(var o=0,a=this.subMeshes;on){r=!0;break}if(s.verticesStart+s.verticesCount>t){r=!0;break}}if(!r)return this.subMeshes[0]}return this.releaseSubMeshes(),new hr(0,0,t,0,this.getTotalIndices(),this)},t.prototype.subdivide=function(e){if(!(e<1)){for(var t=this.getTotalIndices(),i=t/e|0,n=0;i%3!=0;)i++;this.releaseSubMeshes();for(var r=0;r=t);r++)hr.CreateFromIndices(0,n,r===e-1?t-n:i,this),n+=i;this.synchronizeInstances()}},t.prototype.setVerticesData=function(e,t,i,n){if(void 0===i&&(i=!1),this._geometry)this._geometry.setVerticesData(e,t,i,n);else{var r=new $n;r.set(t,e);var o=this.getScene();new fr(fr.RandomId(),o,r,i,this)}return this},t.prototype.removeVerticesData=function(e){this._geometry&&this._geometry.removeVerticesData(e)},t.prototype.markVerticesDataAsUpdatable=function(e,t){void 0===t&&(t=!0);var i=this.getVertexBuffer(e);i&&i.isUpdatable()!==t&&this.setVerticesData(e,this.getVerticesData(e),t)},t.prototype.setVerticesBuffer=function(e,t){return void 0===t&&(t=!0),this._geometry||(this._geometry=fr.CreateGeometryForMesh(this)),this._geometry.setVerticesBuffer(e,null,t),this},t.prototype.updateVerticesData=function(e,t,i,n){return this._geometry?(n?(this.makeGeometryUnique(),this.updateVerticesData(e,t,i,!1)):this._geometry.updateVerticesData(e,t,i),this):this},t.prototype.updateMeshPositions=function(e,t){void 0===t&&(t=!0);var i=this.getVerticesData(wi.PositionKind);if(!i)return this;if(e(i),this.updateVerticesData(wi.PositionKind,i,!1,!1),t){var n=this.getIndices(),r=this.getVerticesData(wi.NormalKind);if(!r)return this;$n.ComputeNormals(i,n,r),this.updateVerticesData(wi.NormalKind,r,!1,!1)}return this},t.prototype.makeGeometryUnique=function(){if(!this._geometry)return this;if(1===this._geometry.meshes.length)return this;var e=this._geometry,t=this._geometry.copy(fr.RandomId());return e.releaseForMesh(this,!0),t.applyToMesh(this),this},t.prototype.setIndices=function(e,t,i){if(void 0===t&&(t=null),void 0===i&&(i=!1),this._geometry)this._geometry.setIndices(e,t,i);else{var n=new $n;n.indices=e;var r=this.getScene();new fr(fr.RandomId(),r,n,i,this)}return this},t.prototype.updateIndices=function(e,t,i){return void 0===i&&(i=!1),this._geometry?(this._geometry.updateIndices(e,t,i),this):this},t.prototype.toLeftHanded=function(){return this._geometry?(this._geometry.toLeftHanded(),this):this},t.prototype._bind=function(e,t,i){if(!this._geometry)return this;var n,r=this.getScene().getEngine();if(this.morphTargetManager&&this.morphTargetManager.isUsingTextureForTargets&&this.morphTargetManager._bind(t),this._unIndexed)n=null;else switch(i){case Ir.PointFillMode:n=null;break;case Ir.WireFrameFillMode:n=e._getLinesIndexBuffer(this.getIndices(),r);break;default:case Ir.TriangleFillMode:n=this._geometry.getIndexBuffer()}return!this._userInstancedBuffersStorage||this.hasThinInstances?this._geometry._bind(t,n):this._geometry._bind(t,n,this._userInstancedBuffersStorage.vertexBuffers,this._userInstancedBuffersStorage.vertexArrayObjects),this},t.prototype._draw=function(e,t,i){if(!this._geometry||!this._geometry.getVertexBuffers()||!this._unIndexed&&!this._geometry.getIndexBuffer())return this;this._internalMeshDataInfo._onBeforeDrawObservable&&this._internalMeshDataInfo._onBeforeDrawObservable.notifyObservers(this);var n=this.getScene().getEngine();return this._unIndexed||t==Ir.PointFillMode?n.drawArraysType(t,e.verticesStart,e.verticesCount,this.forcedInstanceCount||i):t==Ir.WireFrameFillMode?n.drawElementsType(t,0,e._linesIndexCount,this.forcedInstanceCount||i):n.drawElementsType(t,e.indexStart,e.indexCount,this.forcedInstanceCount||i),this},t.prototype.registerBeforeRender=function(e){return this.onBeforeRenderObservable.add(e),this},t.prototype.unregisterBeforeRender=function(e){return this.onBeforeRenderObservable.removeCallback(e),this},t.prototype.registerAfterRender=function(e){return this.onAfterRenderObservable.add(e),this},t.prototype.unregisterAfterRender=function(e){return this.onAfterRenderObservable.removeCallback(e),this},t.prototype._getInstancesRenderList=function(e,t){if(void 0===t&&(t=!1),this._instanceDataStorage.isFrozen){if(t)return this._instanceDataStorage.batchCacheReplacementModeInFrozenMode.hardwareInstancedRendering[e]=!1,this._instanceDataStorage.batchCacheReplacementModeInFrozenMode.renderSelf[e]=!0,this._instanceDataStorage.batchCacheReplacementModeInFrozenMode;if(this._instanceDataStorage.previousBatch)return this._instanceDataStorage.previousBatch}var i=this.getScene(),n=i._isInIntermediateRendering(),r=n?this._internalAbstractMeshDataInfo._onlyForInstancesIntermediate:this._internalAbstractMeshDataInfo._onlyForInstances,o=this._instanceDataStorage.batchCache;if(o.mustReturn=!1,o.renderSelf[e]=t||!r&&this.isEnabled()&&this.isVisible,o.visibleInstances[e]=null,this._instanceDataStorage.visibleInstances&&!t){var a=this._instanceDataStorage.visibleInstances,s=i.getRenderId(),l=n?a.intermediateDefaultRenderId:a.defaultRenderId;o.visibleInstances[e]=a[s],!o.visibleInstances[e]&&l&&(o.visibleInstances[e]=a[l])}return o.hardwareInstancedRendering[e]=!t&&this._instanceDataStorage.hardwareInstancedRendering&&null!==o.visibleInstances[e]&&void 0!==o.visibleInstances[e],this._instanceDataStorage.previousBatch=o,o},t.prototype._renderWithInstances=function(e,i,n,r,o){for(var a,s=n.visibleInstances[e._id],l=s?s.length:0,c=this._instanceDataStorage,u=c.instancesBufferSize,h=c.instancesBuffer,d=c.instancesPreviousBuffer,p=16*(l+1)*4;c.instancesBufferSizet._distanceToCamera?-1:e._distanceToCamerau&&n++,0!==f&&d++,h+=f,u=f}if(l[d]++,d>o&&(o=d),0===h)r++;else{var _=1/h,m=0;for(p=0;p.001&&a++}}var g=this.skeleton.bones.length,v=this.getVerticesData(wi.MatricesIndicesKind),y=this.getVerticesData(wi.MatricesIndicesExtraKind),b=0;for(c=0;c=g||T<0)&&b++}return{skinned:!0,valid:0===r&&0===a&&0===b,report:\"Number of Weights = \"+i/4+\"\\nMaximum influences = \"+o+\"\\nMissing Weights = \"+r+\"\\nNot Sorted = \"+n+\"\\nNot Normalized = \"+a+\"\\nWeightCounts = [\"+l+\"]\\nNumber of bones = \"+g+\"\\nBad Bone Indices = \"+b}},t.prototype._checkDelayState=function(){var e=this.getScene();return this._geometry?this._geometry.load(e):this.delayLoadState===a.DELAYLOADSTATE_NOTLOADED&&(this.delayLoadState=a.DELAYLOADSTATE_LOADING,this._queueLoad(e)),this},t.prototype._queueLoad=function(e){var t=this;e.addPendingData(this);var i=-1!==this.delayLoadingFile.indexOf(\".babylonbinarymeshdata\");return mi.LoadFile(this.delayLoadingFile,(function(i){i instanceof ArrayBuffer?t._delayLoadingFunction(i,t):t._delayLoadingFunction(JSON.parse(i),t),t.instances.forEach((function(e){e.refreshBoundingInfo(),e._syncSubMeshes()})),t.delayLoadState=a.DELAYLOADSTATE_LOADED,e.removePendingData(t)}),(function(){}),e.offlineProvider,i),this},t.prototype.isInFrustum=function(t){return this.delayLoadState!==a.DELAYLOADSTATE_LOADING&&!!e.prototype.isInFrustum.call(this,t)&&(this._checkDelayState(),!0)},t.prototype.setMaterialById=function(e){var t,i=this.getScene().materials;for(t=i.length-1;t>-1;t--)if(i[t].id===e)return this.material=i[t],this;var n=this.getScene().multiMaterials;for(t=n.length-1;t>-1;t--)if(n[t].id===e)return this.material=n[t],this;return this},t.prototype.getAnimatables=function(){var e=new Array;return this.material&&e.push(this.material),this.skeleton&&e.push(this.skeleton),e},t.prototype.bakeTransformIntoVertices=function(e){if(!this.isVerticesDataPresent(wi.PositionKind))return this;var t=this.subMeshes.splice(0);this._resetPointsArrayCache();var i,n=this.getVerticesData(wi.PositionKind),r=new Array;for(i=0;i-1&&(r.morphTargetManager=i.getMorphTargetManagerById(e.morphTargetManagerId)),void 0!==e.skeletonId&&null!==e.skeletonId&&(r.skeleton=i.getLastSkeletonById(e.skeletonId),e.numBoneInfluencers&&(r.numBoneInfluencers=e.numBoneInfluencers)),e.animations){for(var o=0;o4,u=c?this.getVerticesData(wi.MatricesIndicesExtraKind):null,h=c?this.getVerticesData(wi.MatricesWeightsExtraKind):null,d=e.getTransformMatrices(this),p=x.Zero(),f=new M,_=new M,m=0,g=0;g0&&(M.FromFloat32ArrayToRefScaled(d,Math.floor(16*a[m+l]),v,_),f.addToSelf(_));if(c)for(l=0;l<4;l++)(v=h[m+l])>0&&(M.FromFloat32ArrayToRefScaled(d,Math.floor(16*u[m+l]),v,_),f.addToSelf(_));x.TransformCoordinatesFromFloatsToRef(i._sourcePositions[g],i._sourcePositions[g+1],i._sourcePositions[g+2],f,p),p.toArray(r,g),t&&(x.TransformNormalFromFloatsToRef(i._sourceNormals[g],i._sourceNormals[g+1],i._sourceNormals[g+2],f,p),p.toArray(o,g)),f.reset()}return this.updateVerticesData(wi.PositionKind,r),t&&this.updateVerticesData(wi.NormalKind,o),this},t.MinMax=function(e){var t=null,i=null;return e.forEach((function(e){var n=e.getBoundingInfo().boundingBox;t&&i?(t.minimizeInPlace(n.minimumWorld),i.maximizeInPlace(n.maximumWorld)):(t=n.minimumWorld,i=n.maximumWorld)})),t&&i?{min:t,max:i}:{min:x.Zero(),max:x.Zero()}},t.Center=function(e){var i=e instanceof Array?t.MinMax(e):e;return x.Center(i.min,i.max)},t.MergeMeshes=function(e,i,n,r,o,a){return void 0===i&&(i=!0),Qn(t._MergeMeshesCoroutine(e,i,n,r,o,a,!1))},t.MergeMeshesAsync=function(e,i,n,r,o,a){return void 0===i&&(i=!0),qn(t._MergeMeshesCoroutine(e,i,n,r,o,a,!0),Yn())},t._MergeMeshesCoroutine=function(e,i,n,r,o,a,s){var l,c,u,h,d,p,f,_,m,g,v,y,b,T,E,S,A,R,x,C,P,M,I,O,D,N;return void 0===i&&(i=!0),W(this,(function(L){switch(L.label){case 0:if(0===(e=e.filter(Boolean)).length)return[2,null];if(!n)for(c=0,l=0;l=65536)return Q.Warn(\"Cannot merge meshes because resulting mesh will have more than 65536 vertices. Please use allow32BitsIndices = true to use 32 bits indices\"),[2,null];for(a&&(o=!1),u=new Array,h=new Array,d=new Array,p=e[0].overrideMaterialSideOrientation,l=0;l-1&&t.animations.splice(o,1)}},r=0,o=e.animations;r0&&(_=!0,this._soundLoaded(i));break;case\"AudioBuffer\":this._audioBufferLoaded(i);break;case\"String\":f.push(i);case\"Array\":0===f.length&&(f=i);for(var m=function(e){var t=f[e];if(_=o&&o.skipCodecCheck||-1!==t.indexOf(\".mp3\",t.length-4)&&vr.audioEngine.isMP3supported||-1!==t.indexOf(\".ogg\",t.length-4)&&vr.audioEngine.isOGGsupported||-1!==t.indexOf(\".wav\",t.length-4)||-1!==t.indexOf(\".m4a\",t.length-4)||-1!==t.indexOf(\".mp4\",t.length-4)||-1!==t.indexOf(\"blob:\"))return g._streaming?(g._htmlAudioElement=new Audio(t),g._htmlAudioElement.controls=!1,g._htmlAudioElement.loop=g.loop,mi.SetCorsBehavior(t,g._htmlAudioElement),g._htmlAudioElement.preload=\"auto\",g._htmlAudioElement.addEventListener(\"canplaythrough\",(function(){d._isReadyToPlay=!0,d.autoplay&&d.play(0,d._offset,d._length),d._readyToPlayCallback&&d._readyToPlayCallback()})),document.body.appendChild(g._htmlAudioElement),g._htmlAudioElement.load()):g._scene._loadFile(t,(function(e){d._soundLoaded(e)}),void 0,!0,!0,(function(e){e&&Q.Error(\"XHR \"+e.status+\" error on: \"+t+\".\"),Q.Error(\"Sound creation aborted.\"),d._scene.mainSoundTrack.removeSound(d)})),\"break\"},g=this,v=0;v0&&(this._htmlAudioElement.currentTime=0)):this._streamingSource.disconnect(),this.isPlaying=!1;else if((null===(t=vr.audioEngine)||void 0===t?void 0:t.audioContext)&&this._soundSource){var n=e?vr.audioEngine.audioContext.currentTime+e:void 0;this._soundSource.stop(n),void 0===n?(this.isPlaying=!1,this._soundSource.onended=function(){}):this._soundSource.onended=function(){i.isPlaying=!1},this.isPaused||(this._startOffset=0)}},e.prototype.pause=function(){var e;this.isPlaying&&(this.isPaused=!0,this._streaming?(this._htmlAudioElement?this._htmlAudioElement.pause():this._streamingSource.disconnect(),this.isPlaying=!1):(null===(e=vr.audioEngine)||void 0===e?void 0:e.audioContext)&&(this.stop(0),this._startOffset+=vr.audioEngine.audioContext.currentTime-this._startTime))},e.prototype.setVolume=function(e,t){var i;(null===(i=vr.audioEngine)||void 0===i?void 0:i.canUseWebAudio)&&this._soundGain&&(t&&vr.audioEngine.audioContext?(this._soundGain.gain.cancelScheduledValues(vr.audioEngine.audioContext.currentTime),this._soundGain.gain.setValueAtTime(this._soundGain.gain.value,vr.audioEngine.audioContext.currentTime),this._soundGain.gain.linearRampToValueAtTime(e,vr.audioEngine.audioContext.currentTime+t)):this._soundGain.gain.value=e),this._volume=e},e.prototype.setPlaybackRate=function(e){this._playbackRate=e,this.isPlaying&&(this._streaming&&this._htmlAudioElement?this._htmlAudioElement.playbackRate=this._playbackRate:this._soundSource&&(this._soundSource.playbackRate.value=this._playbackRate))},e.prototype.getVolume=function(){return this._volume},e.prototype.attachToMesh=function(e){var t=this;this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._registerFunc=null),this._connectedTransformNode=e,this._spatialSound||(this._spatialSound=!0,this._createSpatialParameters(),this.isPlaying&&this.loop&&(this.stop(),this.play(0,this._offset,this._length))),this._onRegisterAfterWorldMatrixUpdate(this._connectedTransformNode),this._registerFunc=function(e){return t._onRegisterAfterWorldMatrixUpdate(e)},this._connectedTransformNode.registerAfterWorldMatrixUpdate(this._registerFunc)},e.prototype.detachFromMesh=function(){this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._registerFunc=null,this._connectedTransformNode=null)},e.prototype._onRegisterAfterWorldMatrixUpdate=function(e){var t;if(e.getBoundingInfo){var i=e.getBoundingInfo();this.setPosition(i.boundingSphere.centerWorld)}else this.setPosition(e.absolutePosition);(null===(t=vr.audioEngine)||void 0===t?void 0:t.canUseWebAudio)&&this._isDirectional&&this.isPlaying&&this._updateDirection()},e.prototype.clone=function(){var t=this;if(this._streaming)return null;var i=function(){t._isReadyToPlay?(r._audioBuffer=t.getAudioBuffer(),r._isReadyToPlay=!0,r.autoplay&&r.play(0,t._offset,t._length)):window.setTimeout(i,300)},n={autoplay:this.autoplay,loop:this.loop,volume:this._volume,spatialSound:this._spatialSound,maxDistance:this.maxDistance,useCustomAttenuation:this.useCustomAttenuation,rolloffFactor:this.rolloffFactor,refDistance:this.refDistance,distanceModel:this.distanceModel},r=new e(this.name+\"_cloned\",new ArrayBuffer(0),this._scene,null,n);return this.useCustomAttenuation&&r.setAttenuationFunction(this._customAttenuationFunction),r.setPosition(this._position),r.setPlaybackRate(this._playbackRate),i(),r},e.prototype.getAudioBuffer=function(){return this._audioBuffer},e.prototype.getSoundSource=function(){return this._soundSource},e.prototype.getSoundGain=function(){return this._soundGain},e.prototype.serialize=function(){var e={name:this.name,url:this.name,autoplay:this.autoplay,loop:this.loop,volume:this._volume,spatialSound:this._spatialSound,maxDistance:this.maxDistance,rolloffFactor:this.rolloffFactor,refDistance:this.refDistance,distanceModel:this.distanceModel,playbackRate:this._playbackRate,panningModel:this._panningModel,soundTrackId:this.soundTrackId,metadata:this.metadata};return this._spatialSound&&(this._connectedTransformNode&&(e.connectedMeshId=this._connectedTransformNode.id),e.position=this._position.asArray(),e.refDistance=this.refDistance,e.distanceModel=this.distanceModel,e.isDirectional=this._isDirectional,e.localDirectionToMesh=this._localDirection.asArray(),e.coneInnerAngle=this._coneInnerAngle,e.coneOuterAngle=this._coneOuterAngle,e.coneOuterGain=this._coneOuterGain),e},e.Parse=function(t,i,n,r){var o,a=t.name;o=t.url?n+t.url:n+a;var s,l={autoplay:t.autoplay,loop:t.loop,volume:t.volume,spatialSound:t.spatialSound,maxDistance:t.maxDistance,rolloffFactor:t.rolloffFactor,refDistance:t.refDistance,distanceModel:t.distanceModel,playbackRate:t.playbackRate};if(r){var c=function(){r._isReadyToPlay?(s._audioBuffer=r.getAudioBuffer(),s._isReadyToPlay=!0,s.autoplay&&s.play(0,s._offset,s._length)):window.setTimeout(c,300)};s=new e(a,new ArrayBuffer(0),i,null,l),c()}else s=new e(a,o,i,(function(){i.removePendingData(s)}),l),i.addPendingData(s);if(t.position){var u=x.FromArray(t.position);s.setPosition(u)}if(t.isDirectional&&(s.setDirectionalCone(t.coneInnerAngle||360,t.coneOuterAngle||360,t.coneOuterGain||0),t.localDirectionToMesh)){var h=x.FromArray(t.localDirectionToMesh);s.setLocalDirectionToMesh(h)}if(t.connectedMeshId){var d=i.getMeshById(t.connectedMeshId);d&&s.attachToMesh(d)}return t.metadata&&(s.metadata=t.metadata),s},e._SceneComponentInitialization=function(e){throw pe(\"AudioSceneComponent\")},e}(),Xr=function(){function e(e,t){void 0===t&&(t={}),this.id=-1,this._isInitialized=!1,(e=e||S.LastCreatedScene)&&(this._scene=e,this.soundCollection=new Array,this._options=t,!this._options.mainTrack&&this._scene.soundTracks&&(this._scene.soundTracks.push(this),this.id=this._scene.soundTracks.length-1))}return e.prototype._initializeSoundTrackAudioGraph=function(){var e;(null===(e=vr.audioEngine)||void 0===e?void 0:e.canUseWebAudio)&&vr.audioEngine.audioContext&&(this._outputAudioNode=vr.audioEngine.audioContext.createGain(),this._outputAudioNode.connect(vr.audioEngine.masterGain),this._options&&this._options.volume&&(this._outputAudioNode.gain.value=this._options.volume),this._isInitialized=!0)},e.prototype.dispose=function(){if(vr.audioEngine&&vr.audioEngine.canUseWebAudio){for(this._connectedAnalyser&&this._connectedAnalyser.stopDebugCanvas();this.soundCollection.length;)this.soundCollection[0].dispose();this._outputAudioNode&&this._outputAudioNode.disconnect(),this._outputAudioNode=null}},e.prototype.addSound=function(e){var t;this._isInitialized||this._initializeSoundTrackAudioGraph(),(null===(t=vr.audioEngine)||void 0===t?void 0:t.canUseWebAudio)&&this._outputAudioNode&&e.connectToSoundTrackAudioNode(this._outputAudioNode),e.soundTrackId&&(-1===e.soundTrackId?this._scene.mainSoundTrack.removeSound(e):this._scene.soundTracks&&this._scene.soundTracks[e.soundTrackId].removeSound(e)),this.soundCollection.push(e),e.soundTrackId=this.id},e.prototype.removeSound=function(e){var t=this.soundCollection.indexOf(e);-1!==t&&this.soundCollection.splice(t,1)},e.prototype.setVolume=function(e){var t;(null===(t=vr.audioEngine)||void 0===t?void 0:t.canUseWebAudio)&&this._outputAudioNode&&(this._outputAudioNode.gain.value=e)},e.prototype.switchPanningModelToHRTF=function(){var e;if(null===(e=vr.audioEngine)||void 0===e?void 0:e.canUseWebAudio)for(var t=0;t0?i.activeCameras[0]:i.activeCamera)?(this._cachedCameraPosition.equals(o.globalPosition)||(this._cachedCameraPosition.copyFrom(o.globalPosition),n.audioContext.listener.setPosition(o.globalPosition.x,o.globalPosition.y,o.globalPosition.z)),o.rigCameras&&o.rigCameras.length>0&&(o=o.rigCameras[0]),o.getViewMatrix().invertToRef(this._invertMatrixTemp),x.TransformNormalToRef(e._CameraDirection,this._invertMatrixTemp,this._cameraDirectionTemp),this._cameraDirectionTemp.normalize(),isNaN(this._cameraDirectionTemp.x)||isNaN(this._cameraDirectionTemp.y)||isNaN(this._cameraDirectionTemp.z)||this._cachedCameraDirection.equals(this._cameraDirectionTemp)||(this._cachedCameraDirection.copyFrom(this._cameraDirectionTemp),n.audioContext.listener.setOrientation(this._cameraDirectionTemp.x,this._cameraDirectionTemp.y,this._cameraDirectionTemp.z,0,1,0))):n.audioContext.listener.setPosition(0,0,0)}var a=void 0;for(a=0;a0?1/r:0,l=0;l=0&&this._scene.textures.splice(t,1),this._scene.onTextureRemovedObservable.notifyObservers(this),this._scene=null,this._parentContainer){var i=this._parentContainer.textures.indexOf(this);i>-1&&this._parentContainer.textures.splice(i,1),this._parentContainer=null}}this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.metadata=null,e.prototype.dispose.call(this)},t.prototype.serialize=function(){if(!this.name)return null;var e=Le.Serialize(this);return Le.AppendSerializedAnimations(this,e),e},t.WhenAllReady=function(e,t){var i=e.length;if(0!==i)for(var n=0;n=0;){var s=e[o];s<0?s=0:s>1&&(s=1),a[o]=255*s}e=a}var l=document.createElement(\"canvas\");l.width=n,l.height=r;var c=l.getContext(\"2d\");if(!c)return null;var u=c.createImageData(n,r);if(u.data.set(e),c.putImageData(u,0,0),i){var h=document.createElement(\"canvas\");h.width=n,h.height=r;var d=h.getContext(\"2d\");return d?(d.translate(0,r),d.scale(1,-1),d.drawImage(l,0,0),h.toDataURL(\"image/png\")):null}return l.toDataURL(\"image/png\")}function Jr(e,t,i){void 0===t&&(t=0),void 0===i&&(i=0);var n=e.getInternalTexture();if(!n)return null;var r=e._readPixelsSync(t,i);return r?Zr(r,e.getSize(),n.invertY):null}function $r(e,t,i){return void 0===t&&(t=0),void 0===i&&(i=0),z(this,void 0,void 0,(function(){var n,r;return W(this,(function(o){switch(o.label){case 0:return(n=e.getInternalTexture())?[4,e.readPixels(t,i)]:[2,null];case 1:return(r=o.sent())?[2,Zr(r,e.getSize(),n.invertY)]:[2,null]}}))}))}var eo={GenerateBase64StringFromPixelData:Zr,GenerateBase64StringFromTexture:Jr,GenerateBase64StringFromTextureAsync:$r},to=function(e){function t(i,n,r,o,s,l,c,h,d,p,f,_,m,g){void 0===s&&(s=t.TRILINEAR_SAMPLINGMODE),void 0===l&&(l=null),void 0===c&&(c=null),void 0===h&&(h=null),void 0===d&&(d=!1);var v,y,b,T,E,S,A,R,x,C,P=this;(P=e.call(this,n)||this).url=null,P.uOffset=0,P.vOffset=0,P.uScale=1,P.vScale=1,P.uAng=0,P.vAng=0,P.wAng=0,P.uRotationCenter=.5,P.vRotationCenter=.5,P.wRotationCenter=.5,P.homogeneousRotationInUVTransform=!1,P.inspectableCustomProperties=null,P._noMipmap=!1,P._invertY=!1,P._rowGenerationMatrix=null,P._cachedTextureMatrix=null,P._projectionModeMatrix=null,P._t0=null,P._t1=null,P._t2=null,P._cachedUOffset=-1,P._cachedVOffset=-1,P._cachedUScale=0,P._cachedVScale=0,P._cachedUAng=-1,P._cachedVAng=-1,P._cachedWAng=-1,P._cachedProjectionMatrixId=-1,P._cachedURotationCenter=-1,P._cachedVRotationCenter=-1,P._cachedWRotationCenter=-1,P._cachedHomogeneousRotationInUVTransform=!1,P._cachedCoordinatesMode=-1,P._buffer=null,P._deleteBuffer=!1,P._format=null,P._delayedOnLoad=null,P._delayedOnError=null,P.onLoadObservable=new u,P._isBlocking=!0,P.name=i||\"\",P.url=i;var M=!1,I=null;\"object\"==typeof r&&null!==r?(C=null!==(v=r.noMipmap)&&void 0!==v&&v,o=null!==(y=r.invertY)&&void 0!==y?y:!pr.UseOpenGLOrientationForUV,s=null!==(b=r.samplingMode)&&void 0!==b?b:t.TRILINEAR_SAMPLINGMODE,l=null!==(T=r.onLoad)&&void 0!==T?T:null,c=null!==(E=r.onError)&&void 0!==E?E:null,h=null!==(S=r.buffer)&&void 0!==S?S:null,d=null!==(A=r.deleteBuffer)&&void 0!==A&&A,p=r.format,f=r.mimeType,_=r.loaderOptions,m=r.creationFlags,M=null!==(R=r.useSRGBBuffer)&&void 0!==R&&R,I=null!==(x=r.internalTexture)&&void 0!==x?x:null):C=!!r,P._noMipmap=C,P._invertY=void 0===o?!pr.UseOpenGLOrientationForUV:o,P._initialSamplingMode=s,P._buffer=h,P._deleteBuffer=d,P._mimeType=f,P._loaderOptions=_,P._creationFlags=m,P._useSRGBBuffer=M,P._forcedExtension=g,p&&(P._format=p);var O=P.getScene(),D=P._getEngine();if(!D)return P;D.onBeforeTextureInitObservable.notifyObservers(P);var N=function(){P._texture&&(P._texture._invertVScale&&(P.vScale*=-1,P.vOffset+=1),null!==P._texture._cachedWrapU&&(P.wrapU=P._texture._cachedWrapU,P._texture._cachedWrapU=null),null!==P._texture._cachedWrapV&&(P.wrapV=P._texture._cachedWrapV,P._texture._cachedWrapV=null),null!==P._texture._cachedWrapR&&(P.wrapR=P._texture._cachedWrapR,P._texture._cachedWrapR=null)),P.onLoadObservable.hasObservers()&&P.onLoadObservable.notifyObservers(P),l&&l(),!P.isBlocking&&O&&O.resetCachedMaterial()},L=function(e,i){P._loadingError=!0,P._errorObject={message:e,exception:i},c&&c(e,i),t.OnTextureLoadErrorObservable.notifyObservers(P)};if(!P.url)return P._delayedOnLoad=N,P._delayedOnError=L,P;if(P._texture=null!=I?I:P._getFromCache(P.url,C,s,P._invertY,M),P._texture)if(P._texture.isReady)Kt.SetImmediate((function(){return N()}));else{var F=P._texture.onLoadedObservable.add(N);P._texture.onErrorObservable.add((function(e){var t;L(e.message,e.exception),null===(t=P._texture)||void 0===t||t.onLoadedObservable.remove(F)}))}else if(O&&O.useDelayedTextureLoading)P.delayLoadState=a.DELAYLOADSTATE_NOTLOADED,P._delayedOnLoad=N,P._delayedOnError=L;else{try{P._texture=D.createTexture(P.url,C,P._invertY,O,s,N,L,P._buffer,void 0,P._format,P._forcedExtension,f,_,m,M)}catch(e){throw L(\"error loading\",e),e}d&&(P._buffer=null)}return P}return V(t,e),Object.defineProperty(t.prototype,\"noMipmap\",{get:function(){return this._noMipmap},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"mimeType\",{get:function(){return this._mimeType},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"isBlocking\",{get:function(){return this._isBlocking},set:function(e){this._isBlocking=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"invertY\",{get:function(){return this._invertY},enumerable:!1,configurable:!0}),t.prototype.updateURL=function(e,t,i,n){void 0===t&&(t=null),this.url&&(this.releaseInternalTexture(),this.getScene().markAllMaterialsAsDirty(a.MATERIAL_TextureDirtyFlag)),this.name&&!this.name.startsWith(\"data:\")||(this.name=e),this.url=e,this._buffer=t,this._forcedExtension=n,this.delayLoadState=a.DELAYLOADSTATE_NOTLOADED,i&&(this._delayedOnLoad=i),this.delayLoad()},t.prototype.delayLoad=function(){if(this.delayLoadState===a.DELAYLOADSTATE_NOTLOADED){var e=this.getScene();e&&(this.delayLoadState=a.DELAYLOADSTATE_LOADED,this._texture=this._getFromCache(this.url,this._noMipmap,this.samplingMode,this._invertY,this._useSRGBBuffer),this._texture?this._delayedOnLoad&&(this._texture.isReady?Kt.SetImmediate(this._delayedOnLoad):this._texture.onLoadedObservable.add(this._delayedOnLoad)):(this._texture=e.getEngine().createTexture(this.url,this._noMipmap,this._invertY,e,this.samplingMode,this._delayedOnLoad,this._delayedOnError,this._buffer,null,this._format,this._forcedExtension,this._mimeType,this._loaderOptions,this._creationFlags,this._useSRGBBuffer),this._deleteBuffer&&(this._buffer=null)),this._delayedOnLoad=null,this._delayedOnError=null)}},t.prototype._prepareRowForTextureGeneration=function(e,t,i,n){e*=this._cachedUScale,t*=this._cachedVScale,e-=this.uRotationCenter*this._cachedUScale,t-=this.vRotationCenter*this._cachedVScale,i-=this.wRotationCenter,x.TransformCoordinatesFromFloatsToRef(e,t,i,this._rowGenerationMatrix,n),n.x+=this.uRotationCenter*this._cachedUScale+this._cachedUOffset,n.y+=this.vRotationCenter*this._cachedVScale+this._cachedVOffset,n.z+=this.wRotationCenter},t.prototype.checkTransformsAreIdentical=function(e){return null!==e&&this.uOffset===e.uOffset&&this.vOffset===e.vOffset&&this.uScale===e.uScale&&this.vScale===e.vScale&&this.uAng===e.uAng&&this.vAng===e.vAng&&this.wAng===e.wAng},t.prototype.getTextureMatrix=function(e){var t=this;if(void 0===e&&(e=1),this.uOffset===this._cachedUOffset&&this.vOffset===this._cachedVOffset&&this.uScale*e===this._cachedUScale&&this.vScale===this._cachedVScale&&this.uAng===this._cachedUAng&&this.vAng===this._cachedVAng&&this.wAng===this._cachedWAng&&this.uRotationCenter===this._cachedURotationCenter&&this.vRotationCenter===this._cachedVRotationCenter&&this.wRotationCenter===this._cachedWRotationCenter&&this.homogeneousRotationInUVTransform===this._cachedHomogeneousRotationInUVTransform)return this._cachedTextureMatrix;this._cachedUOffset=this.uOffset,this._cachedVOffset=this.vOffset,this._cachedUScale=this.uScale*e,this._cachedVScale=this.vScale,this._cachedUAng=this.uAng,this._cachedVAng=this.vAng,this._cachedWAng=this.wAng,this._cachedURotationCenter=this.uRotationCenter,this._cachedVRotationCenter=this.vRotationCenter,this._cachedWRotationCenter=this.wRotationCenter,this._cachedHomogeneousRotationInUVTransform=this.homogeneousRotationInUVTransform,this._cachedTextureMatrix&&this._rowGenerationMatrix||(this._cachedTextureMatrix=M.Zero(),this._rowGenerationMatrix=new M,this._t0=x.Zero(),this._t1=x.Zero(),this._t2=x.Zero()),M.RotationYawPitchRollToRef(this.vAng,this.uAng,this.wAng,this._rowGenerationMatrix),this.homogeneousRotationInUVTransform?(M.TranslationToRef(-this._cachedURotationCenter,-this._cachedVRotationCenter,-this._cachedWRotationCenter,O.Matrix[0]),M.TranslationToRef(this._cachedURotationCenter,this._cachedVRotationCenter,this._cachedWRotationCenter,O.Matrix[1]),M.ScalingToRef(this._cachedUScale,this._cachedVScale,0,O.Matrix[2]),M.TranslationToRef(this._cachedUOffset,this._cachedVOffset,0,O.Matrix[3]),O.Matrix[0].multiplyToRef(this._rowGenerationMatrix,this._cachedTextureMatrix),this._cachedTextureMatrix.multiplyToRef(O.Matrix[1],this._cachedTextureMatrix),this._cachedTextureMatrix.multiplyToRef(O.Matrix[2],this._cachedTextureMatrix),this._cachedTextureMatrix.multiplyToRef(O.Matrix[3],this._cachedTextureMatrix),this._cachedTextureMatrix.setRowFromFloats(2,this._cachedTextureMatrix.m[12],this._cachedTextureMatrix.m[13],this._cachedTextureMatrix.m[14],1)):(this._prepareRowForTextureGeneration(0,0,0,this._t0),this._prepareRowForTextureGeneration(1,0,0,this._t1),this._prepareRowForTextureGeneration(0,1,0,this._t2),this._t1.subtractInPlace(this._t0),this._t2.subtractInPlace(this._t0),M.FromValuesToRef(this._t1.x,this._t1.y,this._t1.z,0,this._t2.x,this._t2.y,this._t2.z,0,this._t0.x,this._t0.y,this._t0.z,0,0,0,0,1,this._cachedTextureMatrix));var i=this.getScene();return i?(this.optimizeUVAllocation&&i.markAllMaterialsAsDirty(a.MATERIAL_TextureDirtyFlag,(function(e){return e.hasTexture(t)})),this._cachedTextureMatrix):this._cachedTextureMatrix},t.prototype.getReflectionTextureMatrix=function(){var e=this,i=this.getScene();if(!i)return this._cachedTextureMatrix;if(this.uOffset===this._cachedUOffset&&this.vOffset===this._cachedVOffset&&this.uScale===this._cachedUScale&&this.vScale===this._cachedVScale&&this.coordinatesMode===this._cachedCoordinatesMode){if(this.coordinatesMode!==t.PROJECTION_MODE)return this._cachedTextureMatrix;if(this._cachedProjectionMatrixId===i.getProjectionMatrix().updateFlag)return this._cachedTextureMatrix}this._cachedTextureMatrix||(this._cachedTextureMatrix=M.Zero()),this._projectionModeMatrix||(this._projectionModeMatrix=M.Zero());var n=this._cachedCoordinatesMode!==this.coordinatesMode;switch(this._cachedUOffset=this.uOffset,this._cachedVOffset=this.vOffset,this._cachedUScale=this.uScale,this._cachedVScale=this.vScale,this._cachedCoordinatesMode=this.coordinatesMode,this.coordinatesMode){case t.PLANAR_MODE:M.IdentityToRef(this._cachedTextureMatrix),this._cachedTextureMatrix[0]=this.uScale,this._cachedTextureMatrix[5]=this.vScale,this._cachedTextureMatrix[12]=this.uOffset,this._cachedTextureMatrix[13]=this.vOffset;break;case t.PROJECTION_MODE:M.FromValuesToRef(.5,0,0,0,0,-.5,0,0,0,0,0,0,.5,.5,1,1,this._projectionModeMatrix);var r=i.getProjectionMatrix();this._cachedProjectionMatrixId=r.updateFlag,r.multiplyToRef(this._projectionModeMatrix,this._cachedTextureMatrix);break;default:M.IdentityToRef(this._cachedTextureMatrix)}return n&&i.markAllMaterialsAsDirty(a.MATERIAL_TextureDirtyFlag,(function(t){return-1!==t.getActiveTextures().indexOf(e)})),this._cachedTextureMatrix},t.prototype.clone=function(){var e=this,i={noMipmap:this._noMipmap,invertY:this._invertY,samplingMode:this.samplingMode,onLoad:void 0,onError:void 0,buffer:this._texture?this._texture._buffer:void 0,deleteBuffer:this._deleteBuffer,format:this.textureFormat,mimeType:this.mimeType,loaderOptions:this._loaderOptions,creationFlags:this._creationFlags,useSRGBBuffer:this._useSRGBBuffer};return Le.Clone((function(){return new t(e._texture?e._texture.url:null,e.getScene(),i)}),this)},t.prototype.serialize=function(){var i=this.name;t.SerializeBuffers||this.name.startsWith(\"data:\")&&(this.name=\"\"),this.name.startsWith(\"data:\")&&this.url===this.name&&(this.url=\"\");var n=e.prototype.serialize.call(this);return n?((t.SerializeBuffers||t.ForceSerializeBuffers)&&(\"string\"==typeof this._buffer&&\"data:\"===this._buffer.substr(0,5)?(n.base64String=this._buffer,n.name=n.name.replace(\"data:\",\"\")):this.url&&this.url.startsWith(\"data:\")&&this._buffer instanceof Uint8Array?n.base64String=\"data:image/png;base64,\"+ht(this._buffer):(t.ForceSerializeBuffers||this.url&&this.url.startsWith(\"blob:\")||this._forceSerialize)&&(n.base64String=!this._engine||this._engine._features.supportSyncTextureRead?Jr(this):$r(this))),n.invertY=this._invertY,n.samplingMode=this.samplingMode,n._creationFlags=this._creationFlags,n._useSRGBBuffer=this._useSRGBBuffer,this.name=i,n):null},t.prototype.getClassName=function(){return\"Texture\"},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.onLoadObservable.clear(),this._delayedOnLoad=null,this._delayedOnError=null},t.Parse=function(e,i,n){if(e.customType){var r=pi.Instantiate(e.customType).Parse(e,i,n);return e.samplingMode&&r.updateSamplingMode&&r._samplingMode&&r._samplingMode!==e.samplingMode&&r.updateSamplingMode(e.samplingMode),r}if(e.isCube&&!e.isRenderTarget)return t._CubeTextureParser(e,i,n);if(!e.name&&!e.isRenderTarget)return null;var o=function(t){if(t&&t._texture&&(t._texture._cachedWrapU=null,t._texture._cachedWrapV=null,t._texture._cachedWrapR=null),e.samplingMode){var i=e.samplingMode;t&&t.samplingMode!==i&&t.updateSamplingMode(i)}if(t&&e.animations)for(var n=0;n0?e.name:n+e.name,e.url&&(e.url.startsWith(\"data:\")||t.UseSerializedUrlIfAny)&&(f=e.url),l=new t(f,i,!c,e.invertY,e.samplingMode,(function(){o(l)}))}return l}),e,i);return a},t.CreateFromBase64String=function(e,i,n,r,o,s,l,c,u,h){return void 0===s&&(s=t.TRILINEAR_SAMPLINGMODE),void 0===l&&(l=null),void 0===c&&(c=null),void 0===u&&(u=a.TEXTUREFORMAT_RGBA),new t(\"data:\"+i,n,r,o,s,l,c,e,!1,u,void 0,void 0,h)},t.LoadFromDataString=function(e,i,n,r,o,s,l,c,u,h,d){return void 0===r&&(r=!1),void 0===s&&(s=!0),void 0===l&&(l=t.TRILINEAR_SAMPLINGMODE),void 0===c&&(c=null),void 0===u&&(u=null),void 0===h&&(h=a.TEXTUREFORMAT_RGBA),\"data:\"!==e.substr(0,5)&&(e=\"data:\"+e),new t(e,n,o,s,l,c,u,i,r,h,void 0,void 0,d)},t.SerializeBuffers=!0,t.ForceSerializeBuffers=!1,t.OnTextureLoadErrorObservable=new u,t._CubeTextureParser=function(e,t,i){throw pe(\"CubeTexture\")},t._CreateMirror=function(e,t,i,n){throw pe(\"MirrorTexture\")},t._CreateRenderTargetTexture=function(e,t,i,n,r){throw pe(\"RenderTargetTexture\")},t.NEAREST_SAMPLINGMODE=a.TEXTURE_NEAREST_SAMPLINGMODE,t.NEAREST_NEAREST_MIPLINEAR=a.TEXTURE_NEAREST_NEAREST_MIPLINEAR,t.BILINEAR_SAMPLINGMODE=a.TEXTURE_BILINEAR_SAMPLINGMODE,t.LINEAR_LINEAR_MIPNEAREST=a.TEXTURE_LINEAR_LINEAR_MIPNEAREST,t.TRILINEAR_SAMPLINGMODE=a.TEXTURE_TRILINEAR_SAMPLINGMODE,t.LINEAR_LINEAR_MIPLINEAR=a.TEXTURE_LINEAR_LINEAR_MIPLINEAR,t.NEAREST_NEAREST_MIPNEAREST=a.TEXTURE_NEAREST_NEAREST_MIPNEAREST,t.NEAREST_LINEAR_MIPNEAREST=a.TEXTURE_NEAREST_LINEAR_MIPNEAREST,t.NEAREST_LINEAR_MIPLINEAR=a.TEXTURE_NEAREST_LINEAR_MIPLINEAR,t.NEAREST_LINEAR=a.TEXTURE_NEAREST_LINEAR,t.NEAREST_NEAREST=a.TEXTURE_NEAREST_NEAREST,t.LINEAR_NEAREST_MIPNEAREST=a.TEXTURE_LINEAR_NEAREST_MIPNEAREST,t.LINEAR_NEAREST_MIPLINEAR=a.TEXTURE_LINEAR_NEAREST_MIPLINEAR,t.LINEAR_LINEAR=a.TEXTURE_LINEAR_LINEAR,t.LINEAR_NEAREST=a.TEXTURE_LINEAR_NEAREST,t.EXPLICIT_MODE=a.TEXTURE_EXPLICIT_MODE,t.SPHERICAL_MODE=a.TEXTURE_SPHERICAL_MODE,t.PLANAR_MODE=a.TEXTURE_PLANAR_MODE,t.CUBIC_MODE=a.TEXTURE_CUBIC_MODE,t.PROJECTION_MODE=a.TEXTURE_PROJECTION_MODE,t.SKYBOX_MODE=a.TEXTURE_SKYBOX_MODE,t.INVCUBIC_MODE=a.TEXTURE_INVCUBIC_MODE,t.EQUIRECTANGULAR_MODE=a.TEXTURE_EQUIRECTANGULAR_MODE,t.FIXED_EQUIRECTANGULAR_MODE=a.TEXTURE_FIXED_EQUIRECTANGULAR_MODE,t.FIXED_EQUIRECTANGULAR_MIRRORED_MODE=a.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE,t.CLAMP_ADDRESSMODE=a.TEXTURE_CLAMP_ADDRESSMODE,t.WRAP_ADDRESSMODE=a.TEXTURE_WRAP_ADDRESSMODE,t.MIRROR_ADDRESSMODE=a.TEXTURE_MIRROR_ADDRESSMODE,t.UseSerializedUrlIfAny=!1,G([be()],t.prototype,\"url\",void 0),G([be()],t.prototype,\"uOffset\",void 0),G([be()],t.prototype,\"vOffset\",void 0),G([be()],t.prototype,\"uScale\",void 0),G([be()],t.prototype,\"vScale\",void 0),G([be()],t.prototype,\"uAng\",void 0),G([be()],t.prototype,\"vAng\",void 0),G([be()],t.prototype,\"wAng\",void 0),G([be()],t.prototype,\"uRotationCenter\",void 0),G([be()],t.prototype,\"vRotationCenter\",void 0),G([be()],t.prototype,\"wRotationCenter\",void 0),G([be()],t.prototype,\"homogeneousRotationInUVTransform\",void 0),G([be()],t.prototype,\"isBlocking\",null),t}(qr);function io(e,t,i,n){var r,o=1;n===a.TEXTURETYPE_FLOAT?r=new Float32Array(t*i*4):n===a.TEXTURETYPE_HALF_FLOAT?(r=new Uint16Array(t*i*4),o=15360):r=n===a.TEXTURETYPE_UNSIGNED_INTEGER?new Uint32Array(t*i*4):new Uint8Array(t*i*4);for(var s=0;s>v,b=0;b<6;b++){var T=g[v][b];m&&(T=io(T,y,y,r)),f.texImage2D(b,v,h,y,y,0,u,a,T)}p._bindTextureDirectly(f.TEXTURE_CUBE_MAP,null)}else p.updateRawCubeTexture(_,o,n,r,d);_.isReady=!0,null==t||t.removePendingData(_),_.onLoadedObservable.notifyObservers(_),_.onLoadedObservable.clear(),c&&c()}}(e)}),void 0,null==t?void 0:t.offlineProvider,!0,(function(e,i){null==t||t.removePendingData(_),u&&e&&u(e.status+\" \"+e.statusText,i)})),_},Yt.prototype.createRawTexture2DArray=no(!1),Yt.prototype.createRawTexture3D=no(!0),Yt.prototype.updateRawTexture2DArray=ro(!1),Yt.prototype.updateRawTexture3D=ro(!0);var oo=function(e){function t(t,i,n,r,o,s,l,c,u,h,d){void 0===s&&(s=!0),void 0===l&&(l=!1),void 0===c&&(c=a.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===u&&(u=a.TEXTURETYPE_UNSIGNED_INT);var p=e.call(this,null,o,!s,l,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,h)||this;return p.format=r,p._engine?(p._engine._caps.textureFloatLinearFiltering||u!==a.TEXTURETYPE_FLOAT||(c=a.TEXTURE_NEAREST_SAMPLINGMODE),p._engine._caps.textureHalfFloatLinearFiltering||u!==a.TEXTURETYPE_HALF_FLOAT||(c=a.TEXTURE_NEAREST_SAMPLINGMODE),p._texture=p._engine.createRawTexture(t,i,n,r,s,l,c,null,u,null!=h?h:0,null!=d&&d),p.wrapU=to.CLAMP_ADDRESSMODE,p.wrapV=to.CLAMP_ADDRESSMODE,p):p}return V(t,e),t.prototype.update=function(e){this._getEngine().updateRawTexture(this._texture,e,this._texture.format,this._texture.invertY,null,this._texture.type,this._texture._useSRGBBuffer)},t.CreateLuminanceTexture=function(e,i,n,r,o,s,l){return void 0===o&&(o=!0),void 0===s&&(s=!1),void 0===l&&(l=a.TEXTURE_TRILINEAR_SAMPLINGMODE),new t(e,i,n,a.TEXTUREFORMAT_LUMINANCE,r,o,s,l)},t.CreateLuminanceAlphaTexture=function(e,i,n,r,o,s,l){return void 0===o&&(o=!0),void 0===s&&(s=!1),void 0===l&&(l=a.TEXTURE_TRILINEAR_SAMPLINGMODE),new t(e,i,n,a.TEXTUREFORMAT_LUMINANCE_ALPHA,r,o,s,l)},t.CreateAlphaTexture=function(e,i,n,r,o,s,l){return void 0===o&&(o=!0),void 0===s&&(s=!1),void 0===l&&(l=a.TEXTURE_TRILINEAR_SAMPLINGMODE),new t(e,i,n,a.TEXTUREFORMAT_ALPHA,r,o,s,l)},t.CreateRGBTexture=function(e,i,n,r,o,s,l,c,u,h){return void 0===o&&(o=!0),void 0===s&&(s=!1),void 0===l&&(l=a.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===c&&(c=a.TEXTURETYPE_UNSIGNED_INT),void 0===u&&(u=0),void 0===h&&(h=!1),new t(e,i,n,a.TEXTUREFORMAT_RGB,r,o,s,l,c,u,h)},t.CreateRGBATexture=function(e,i,n,r,o,s,l,c,u,h){return void 0===o&&(o=!0),void 0===s&&(s=!1),void 0===l&&(l=a.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===c&&(c=a.TEXTURETYPE_UNSIGNED_INT),void 0===u&&(u=0),void 0===h&&(h=!1),new t(e,i,n,a.TEXTUREFORMAT_RGBA,r,o,s,l,c,u,h)},t.CreateRGBAStorageTexture=function(e,i,n,r,o,s,l,c,u){return void 0===o&&(o=!0),void 0===s&&(s=!1),void 0===l&&(l=a.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===c&&(c=a.TEXTURETYPE_UNSIGNED_INT),void 0===u&&(u=!1),new t(e,i,n,a.TEXTUREFORMAT_RGBA,r,o,s,l,c,a.TEXTURE_CREATIONFLAG_STORAGE,u)},t.CreateRTexture=function(e,i,n,r,o,s,l,c){return void 0===o&&(o=!0),void 0===s&&(s=!1),void 0===l&&(l=to.TRILINEAR_SAMPLINGMODE),void 0===c&&(c=a.TEXTURETYPE_FLOAT),new t(e,i,n,a.TEXTUREFORMAT_R,r,o,s,l,c)},t.CreateRStorageTexture=function(e,i,n,r,o,s,l,c){return void 0===o&&(o=!0),void 0===s&&(s=!1),void 0===l&&(l=to.TRILINEAR_SAMPLINGMODE),void 0===c&&(c=a.TEXTURETYPE_FLOAT),new t(e,i,n,a.TEXTUREFORMAT_R,r,o,s,l,c,a.TEXTURE_CREATIONFLAG_STORAGE)},t}(to),ao=function(){function e(e,t){this._scene=e,this._mesh=t}return e.prototype.bakeVertexData=function(e){return z(this,void 0,void 0,(function(){var t,i,n,r,o,a,s,l;return W(this,(function(c){switch(c.label){case 0:if(!this._mesh.skeleton)throw new Error(\"No skeleton in this mesh.\");if(t=this._mesh.skeleton.bones.length,i=e.reduce((function(e,t){return e+t.to-t.from+1}),0),isNaN(i))throw new Error(\"Invalid animation ranges.\");n=0,r=new Float32Array(4*(t+1)*4*i),this._scene.stopAnimation(this._mesh),this._mesh.skeleton.returnToRest(),o=0,a=e,c.label=1;case 1:if(!(o0},enumerable:!1,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(e){var t=this;this._attachedCamera=e;var i=this._attachedCamera.getScene();this._onPrePointerObservableObserver=i.onPrePointerObservable.add((function(e){e.type!==Hi.POINTERDOWN?e.type===Hi.POINTERUP&&(t._isPointerDown=!1):t._isPointerDown=!0})),this._onAfterCheckInputsObserver=e.onAfterCheckInputsObservable.add((function(){if(!t._reachTargetAlpha()){var e=it.Now,i=0;null!=t._lastFrameTime&&(i=e-t._lastFrameTime),t._lastFrameTime=e,t._applyUserInteraction();var n=e-t._lastInteractionTime-t._idleRotationWaitTime,r=Math.max(Math.min(n/t._idleRotationSpinupTime,1),0);t._cameraRotationSpeed=t._idleRotationSpeed*r,t._attachedCamera&&(t._attachedCamera.alpha-=t._cameraRotationSpeed*(i/1e3))}}))},e.prototype.detach=function(){if(this._attachedCamera){var e=this._attachedCamera.getScene();this._onPrePointerObservableObserver&&e.onPrePointerObservable.remove(this._onPrePointerObservableObserver),this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver),this._attachedCamera=null}},e.prototype.resetLastInteractionTime=function(e){this._lastInteractionTime=null!=e?e:it.Now},e.prototype._reachTargetAlpha=function(){return!(!this._attachedCamera||!this.targetAlpha)&&Math.abs(this._attachedCamera.alpha-this.targetAlpha)<_},e.prototype._userIsZooming=function(){return!!this._attachedCamera&&0!==this._attachedCamera.inertialRadiusOffset},e.prototype._shouldAnimationStopForInteraction=function(){if(!this._attachedCamera)return!1;var e=!1;return this._lastFrameRadius===this._attachedCamera.radius&&0!==this._attachedCamera.inertialRadiusOffset&&(e=!0),this._lastFrameRadius=this._attachedCamera.radius,this._zoomStopsAnimation?e:this._userIsZooming()},e.prototype._applyUserInteraction=function(){this._userIsMoving()&&!this._shouldAnimationStopForInteraction()&&(this._lastInteractionTime=it.Now)},e.prototype._userIsMoving=function(){return!!this._attachedCamera&&(0!==this._attachedCamera.inertialAlphaOffset||0!==this._attachedCamera.inertialBetaOffset||0!==this._attachedCamera.inertialRadiusOffset||0!==this._attachedCamera.inertialPanningX||0!==this._attachedCamera.inertialPanningY||this._isPointerDown)},e}(),lo=function(){function e(){this.transitionDuration=450,this.lowerRadiusTransitionRange=2,this.upperRadiusTransitionRange=-2,this._autoTransitionRange=!1,this._radiusIsAnimating=!1,this._radiusBounceTransition=null,this._animatables=new Array}return Object.defineProperty(e.prototype,\"name\",{get:function(){return\"Bouncing\"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"autoTransitionRange\",{get:function(){return this._autoTransitionRange},set:function(e){var t=this;if(this._autoTransitionRange!==e){this._autoTransitionRange=e;var i=this._attachedCamera;i&&(e?this._onMeshTargetChangedObserver=i.onMeshTargetChangedObservable.add((function(e){if(e){e.computeWorldMatrix(!0);var i=e.getBoundingInfo().diagonalLength;t.lowerRadiusTransitionRange=.05*i,t.upperRadiusTransitionRange=.05*i}})):this._onMeshTargetChangedObserver&&i.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver))}},enumerable:!1,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(e){var t=this;this._attachedCamera=e,this._onAfterCheckInputsObserver=e.onAfterCheckInputsObservable.add((function(){t._attachedCamera&&(t._isRadiusAtLimit(t._attachedCamera.lowerRadiusLimit)&&t._applyBoundRadiusAnimation(t.lowerRadiusTransitionRange),t._isRadiusAtLimit(t._attachedCamera.upperRadiusLimit)&&t._applyBoundRadiusAnimation(t.upperRadiusTransitionRange))}))},e.prototype.detach=function(){this._attachedCamera&&(this._onAfterCheckInputsObserver&&this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver),this._onMeshTargetChangedObserver&&this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver),this._attachedCamera=null)},e.prototype._isRadiusAtLimit=function(e){return!!this._attachedCamera&&this._attachedCamera.radius===e&&!this._radiusIsAnimating},e.prototype._applyBoundRadiusAnimation=function(t){var i=this;if(this._attachedCamera){this._radiusBounceTransition||(e.EasingFunction.setEasingMode(e.EasingMode),this._radiusBounceTransition=ze.CreateAnimation(\"radius\",ze.ANIMATIONTYPE_FLOAT,60,e.EasingFunction)),this._cachedWheelPrecision=this._attachedCamera.wheelPrecision,this._attachedCamera.wheelPrecision=1/0,this._attachedCamera.inertialRadiusOffset=0,this.stopAllAnimations(),this._radiusIsAnimating=!0;var n=ze.TransitionTo(\"radius\",this._attachedCamera.radius+t,this._attachedCamera,this._attachedCamera.getScene(),60,this._radiusBounceTransition,this.transitionDuration,(function(){return i._clearAnimationLocks()}));n&&this._animatables.push(n)}},e.prototype._clearAnimationLocks=function(){this._radiusIsAnimating=!1,this._attachedCamera&&(this._attachedCamera.wheelPrecision=this._cachedWheelPrecision)},e.prototype.stopAllAnimations=function(){for(this._attachedCamera&&(this._attachedCamera.animations=[]);this._animatables.length;)this._animatables[0].onAnimationEnd=null,this._animatables[0].stop(),this._animatables.shift()},e.EasingFunction=new On(.3),e.EasingMode=Mn.EASINGMODE_EASEOUT,e}(),co=function(){function e(){this.onTargetFramingAnimationEndObservable=new u,this._mode=e.FitFrustumSidesMode,this._radiusScale=1,this._positionScale=.5,this._defaultElevation=.3,this._elevationReturnTime=1500,this._elevationReturnWaitTime=1e3,this._zoomStopsAnimation=!1,this._framingTime=1500,this.autoCorrectCameraLimitsAndSensibility=!0,this._isPointerDown=!1,this._lastInteractionTime=-1/0,this._animatables=new Array,this._betaIsAnimating=!1}return Object.defineProperty(e.prototype,\"name\",{get:function(){return\"Framing\"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"mode\",{get:function(){return this._mode},set:function(e){this._mode=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"radiusScale\",{get:function(){return this._radiusScale},set:function(e){this._radiusScale=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"positionScale\",{get:function(){return this._positionScale},set:function(e){this._positionScale=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"defaultElevation\",{get:function(){return this._defaultElevation},set:function(e){this._defaultElevation=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"elevationReturnTime\",{get:function(){return this._elevationReturnTime},set:function(e){this._elevationReturnTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"elevationReturnWaitTime\",{get:function(){return this._elevationReturnWaitTime},set:function(e){this._elevationReturnWaitTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"zoomStopsAnimation\",{get:function(){return this._zoomStopsAnimation},set:function(e){this._zoomStopsAnimation=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"framingTime\",{get:function(){return this._framingTime},set:function(e){this._framingTime=e},enumerable:!1,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(t){var i=this;this._attachedCamera=t;var n=this._attachedCamera.getScene();e.EasingFunction.setEasingMode(e.EasingMode),this._onPrePointerObservableObserver=n.onPrePointerObservable.add((function(e){e.type!==Hi.POINTERDOWN?e.type===Hi.POINTERUP&&(i._isPointerDown=!1):i._isPointerDown=!0})),this._onMeshTargetChangedObserver=t.onMeshTargetChangedObservable.add((function(e){e&&i.zoomOnMesh(e,void 0,(function(){i.onTargetFramingAnimationEndObservable.notifyObservers()}))})),this._onAfterCheckInputsObserver=t.onAfterCheckInputsObservable.add((function(){i._applyUserInteraction(),i._maintainCameraAboveGround()}))},e.prototype.detach=function(){if(this._attachedCamera){var e=this._attachedCamera.getScene();this._onPrePointerObservableObserver&&e.onPrePointerObservable.remove(this._onPrePointerObservableObserver),this._onAfterCheckInputsObserver&&this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver),this._onMeshTargetChangedObserver&&this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver),this._attachedCamera=null}},e.prototype.zoomOnMesh=function(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=null),e.computeWorldMatrix(!0);var n=e.getBoundingInfo().boundingBox;this.zoomOnBoundingInfo(n.minimumWorld,n.maximumWorld,t,i)},e.prototype.zoomOnMeshHierarchy=function(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=null),e.computeWorldMatrix(!0);var n=e.getHierarchyBoundingVectors(!0);this.zoomOnBoundingInfo(n.min,n.max,t,i)},e.prototype.zoomOnMeshesHierarchy=function(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=null);for(var n=new x(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),r=new x(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),o=0;oc.upperRadiusLimit?c.upperRadiusLimit:l),l):0},e.prototype._maintainCameraAboveGround=function(){var t=this;if(!(this._elevationReturnTime<0)){var i=it.Now-this._lastInteractionTime,n=.5*Math.PI-this._defaultElevation,r=.5*Math.PI;if(this._attachedCamera&&!this._betaIsAnimating&&this._attachedCamera.beta>r&&i>=this._elevationReturnWaitTime){this._betaIsAnimating=!0,this.stopAllAnimations(),this._betaTransition||(this._betaTransition=ze.CreateAnimation(\"beta\",ze.ANIMATIONTYPE_FLOAT,60,e.EasingFunction));var o=ze.TransitionTo(\"beta\",n,this._attachedCamera,this._attachedCamera.getScene(),60,this._betaTransition,this._elevationReturnTime,(function(){t._clearAnimationLocks(),t.stopAllAnimations()}));o&&this._animatables.push(o)}}},e.prototype._getFrustumSlope=function(){var e=this._attachedCamera;if(!e)return R.Zero();var t=e.getScene().getEngine().getAspectRatio(e),i=Math.tan(e.fov/2);return new R(i*t,i)},e.prototype._clearAnimationLocks=function(){this._betaIsAnimating=!1},e.prototype._applyUserInteraction=function(){this.isUserIsMoving&&(this._lastInteractionTime=it.Now,this.stopAllAnimations(),this._clearAnimationLocks())},e.prototype.stopAllAnimations=function(){for(this._attachedCamera&&(this._attachedCamera.animations=[]);this._animatables.length;)this._animatables[0]&&(this._animatables[0].onAnimationEnd=null,this._animatables[0].stop()),this._animatables.shift()},Object.defineProperty(e.prototype,\"isUserIsMoving\",{get:function(){return!!this._attachedCamera&&(0!==this._attachedCamera.inertialAlphaOffset||0!==this._attachedCamera.inertialBetaOffset||0!==this._attachedCamera.inertialRadiusOffset||0!==this._attachedCamera.inertialPanningX||0!==this._attachedCamera.inertialPanningY||this._isPointerDown)},enumerable:!1,configurable:!0}),e.EasingFunction=new Fn,e.EasingMode=Mn.EASINGMODE_EASEINOUT,e.IgnoreBoundsSizeMode=0,e.FitFrustumSidesMode=1,e}(),uo=function(e,t,i,n){void 0===t&&(t=new x),void 0===i&&(i=0),void 0===n&&(n=!1),this.direction=e,this.rotatedDirection=t,this.diff=i,this.ignore=n},ho=function(){function e(e){this._ui=e,this.name=\"AttachToBoxBehavior\",this.distanceAwayFromFace=.15,this.distanceAwayFromBottomOfFace=.15,this._faceVectors=[new uo(x.Up()),new uo(x.Down()),new uo(x.Left()),new uo(x.Right()),new uo(x.Forward()),new uo(x.Forward().scaleInPlace(-1))],this._tmpMatrix=new M,this._tmpVector=new x,this._zeroVector=x.Zero(),this._lookAtTmpMatrix=new M}return e.prototype.init=function(){},e.prototype._closestFace=function(e){var t=this;return this._faceVectors.forEach((function(i){t._target.rotationQuaternion||(t._target.rotationQuaternion=P.RotationYawPitchRoll(t._target.rotation.y,t._target.rotation.x,t._target.rotation.z)),t._target.rotationQuaternion.toRotationMatrix(t._tmpMatrix),x.TransformCoordinatesToRef(i.direction,t._tmpMatrix,i.rotatedDirection),i.diff=x.GetAngleBetweenVectors(i.rotatedDirection,e,x.Cross(i.rotatedDirection,e))})),this._faceVectors.reduce((function(e,t){return e.ignore?t:t.ignore||e.diff1)return e._setAllVisibility(e._ownerNode,1),void(e._hoverValue=e.fadeInTime+e.delay);if(e._ownerNode.visibility<0&&(e._setAllVisibility(e._ownerNode,0),e._hoverValue<0))return void(e._hoverValue=0);setTimeout(e._update,e._millisecondsPerFrame)}}}return Object.defineProperty(e.prototype,\"name\",{get:function(){return\"FadeInOut\"},enumerable:!1,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(e){this._ownerNode=e,this._setAllVisibility(this._ownerNode,0)},e.prototype.detach=function(){this._ownerNode=null},e.prototype.fadeIn=function(e){this._hovered=e,this._update()},e.prototype._setAllVisibility=function(e,t){var i=this;e.visibility=t,e.getChildMeshes().forEach((function(e){i._setAllVisibility(e,t)}))},e}(),fo=function(){function e(e,t,i){void 0===i&&(i=Number.MAX_VALUE),this.origin=e,this.direction=t,this.length=i}return e.prototype.clone=function(){return new e(this.origin.clone(),this.direction.clone(),this.length)},e.prototype.intersectsBoxMinMax=function(t,i,n){void 0===n&&(n=0);var r,o,a,s,l=e._TmpVector3[0].copyFromFloats(t.x-n,t.y-n,t.z-n),c=e._TmpVector3[1].copyFromFloats(i.x+n,i.y+n,i.z+n),u=0,h=Number.MAX_VALUE;if(Math.abs(this.direction.x)<1e-7){if(this.origin.xc.x)return!1}else if(r=1/this.direction.x,o=(l.x-this.origin.x)*r,(a=(c.x-this.origin.x)*r)==-1/0&&(a=1/0),o>a&&(s=o,o=a,a=s),(u=Math.max(o,u))>(h=Math.min(a,h)))return!1;if(Math.abs(this.direction.y)<1e-7){if(this.origin.yc.y)return!1}else if(r=1/this.direction.y,o=(l.y-this.origin.y)*r,(a=(c.y-this.origin.y)*r)==-1/0&&(a=1/0),o>a&&(s=o,o=a,a=s),(u=Math.max(o,u))>(h=Math.min(a,h)))return!1;if(Math.abs(this.direction.z)<1e-7){if(this.origin.zc.z)return!1}else if(r=1/this.direction.z,o=(l.z-this.origin.z)*r,(a=(c.z-this.origin.z)*r)==-1/0&&(a=1/0),o>a&&(s=o,o=a,a=s),(u=Math.max(o,u))>(h=Math.min(a,h)))return!1;return!0},e.prototype.intersectsBox=function(e,t){return void 0===t&&(t=0),this.intersectsBoxMinMax(e.minimum,e.maximum,t)},e.prototype.intersectsSphere=function(e,t){void 0===t&&(t=0);var i=e.center.x-this.origin.x,n=e.center.y-this.origin.y,r=e.center.z-this.origin.z,o=i*i+n*n+r*r,a=e.radius+t,s=a*a;if(o<=s)return!0;var l=i*this.direction.x+n*this.direction.y+r*this.direction.z;return!(l<0)&&o-l*l<=s},e.prototype.intersectsTriangle=function(t,i,n){var r=e._TmpVector3[0],o=e._TmpVector3[1],a=e._TmpVector3[2],s=e._TmpVector3[3],l=e._TmpVector3[4];i.subtractToRef(t,r),n.subtractToRef(t,o),x.CrossToRef(this.direction,o,a);var c=x.Dot(r,a);if(0===c)return null;var u=1/c;this.origin.subtractToRef(t,s);var h=x.Dot(s,a)*u;if(h<0||h>1)return null;x.CrossToRef(s,r,l);var d=x.Dot(this.direction,l)*u;if(d<0||h+d>1)return null;var p=x.Dot(o,l)*u;return p>this.length?null:new er(1-h-d,h,p)},e.prototype.intersectsPlane=function(e){var t,i=x.Dot(e.normal,this.direction);if(Math.abs(i)<9.99999997475243e-7)return null;var n=x.Dot(e.normal,this.origin);return(t=(-e.d-n)/i)<0?t<-9.99999997475243e-7?null:0:t},e.prototype.intersectsAxis=function(e,t){switch(void 0===t&&(t=0),e){case\"y\":return(i=(this.origin.y-t)/this.direction.y)>0?null:new x(this.origin.x+this.direction.x*-i,t,this.origin.z+this.direction.z*-i);case\"x\":return(i=(this.origin.x-t)/this.direction.x)>0?null:new x(t,this.origin.y+this.direction.y*-i,this.origin.z+this.direction.z*-i);case\"z\":var i;return(i=(this.origin.z-t)/this.direction.z)>0?null:new x(this.origin.x+this.direction.x*-i,this.origin.y+this.direction.y*-i,t);default:return null}},e.prototype.intersectsMesh=function(t,i){var n=O.Matrix[0];return t.getWorldMatrix().invertToRef(n),this._tmpRay?e.TransformToRef(this,n,this._tmpRay):this._tmpRay=e.Transform(this,n),t.intersects(this._tmpRay,i)},e.prototype.intersectsMeshes=function(e,t,i){i?i.length=0:i=[];for(var n=0;nt.distance?1:0},e.prototype.intersectionSegment=function(t,i,n){var r=this.origin,o=O.Vector3[0],a=O.Vector3[1],s=O.Vector3[2],l=O.Vector3[3];i.subtractToRef(t,o),this.direction.scaleToRef(e._Rayl,s),r.addToRef(s,a),t.subtractToRef(r,l);var c,u,h=x.Dot(o,o),d=x.Dot(o,s),p=x.Dot(s,s),f=x.Dot(o,l),_=x.Dot(s,l),m=h*p-d*d,g=m,v=m;mg&&(c=g,u=_+d,v=p)),u<0?(u=0,-f<0?c=0:-f>h?c=g:(c=-f,g=h)):u>v&&(u=v,-f+d<0?c=0:-f+d>h?c=g:(c=-f+d,g=h));var y=Math.abs(c)0&&b<=this.length&&S.lengthSquared()=e.distance?null:c:null},mn.prototype._internalPick=function(e,t,i,n,r){if(!Bi)return null;for(var o=null,a=0;a1)throw\"Multiple drag modes specified in dragBehavior options. Only one expected\"}return Object.defineProperty(e.prototype,\"currentDraggingPointerID\",{get:function(){return this.currentDraggingPointerId},set:function(e){this.currentDraggingPointerId=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"enabled\",{get:function(){return this._enabled},set:function(e){e!=this._enabled&&this.onEnabledObservable.notifyObservers(e),this._enabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"options\",{get:function(){return this._options},set:function(e){this._options=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"name\",{get:function(){return\"PointerDrag\"},enumerable:!1,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(t,i){var n=this;this._scene=t.getScene(),t.isNearGrabbable=!0,this.attachedNode=t,e._PlaneScene||(this._debugMode?e._PlaneScene=this._scene:(e._PlaneScene=new mn(this._scene.getEngine(),{virtual:!0}),e._PlaneScene.detachControl(),this._scene.onDisposeObservable.addOnce((function(){e._PlaneScene.dispose(),e._PlaneScene=null})))),this._dragPlane=go(\"pointerDragPlane\",{size:this._debugMode?1:1e4,updatable:!1,sideOrientation:Ur.DOUBLESIDE},e._PlaneScene),this.lastDragPosition=new x(0,0,0);var r=i||function(e){return n.attachedNode==e||e.isDescendantOf(n.attachedNode)};this._pointerObserver=this._scene.onPointerObservable.add((function(t){if(n.enabled){if(t.type==Hi.POINTERDOWN)n.startAndReleaseDragOnPointerEvents&&!n.dragging&&t.pickInfo&&t.pickInfo.hit&&t.pickInfo.pickedMesh&&t.pickInfo.pickedPoint&&t.pickInfo.ray&&r(t.pickInfo.pickedMesh)&&-1===n._activeDragButton&&-1!==n.dragButtons.indexOf(t.event.button)&&(n._activeDragButton=t.event.button,n._startDrag(t.event.pointerId,t.pickInfo.ray,t.pickInfo.pickedPoint));else if(t.type==Hi.POINTERUP)n.startAndReleaseDragOnPointerEvents&&n.currentDraggingPointerId==t.event.pointerId&&n._activeDragButton===t.event.button&&(n.releaseDrag(),n._activeDragButton=-1);else if(t.type==Hi.POINTERMOVE){var i=t.event.pointerId;if(n.currentDraggingPointerId===e._AnyMouseId&&i!==e._AnyMouseId){var o=t.event;(\"mouse\"===o.pointerType||!n._scene.getEngine().hostInformation.isMobile&&o instanceof MouseEvent)&&(n._lastPointerRay[n.currentDraggingPointerId]&&(n._lastPointerRay[i]=n._lastPointerRay[n.currentDraggingPointerId],delete n._lastPointerRay[n.currentDraggingPointerId]),n.currentDraggingPointerId=i)}n._lastPointerRay[i]||(n._lastPointerRay[i]=new fo(new x,new x)),t.pickInfo&&t.pickInfo.ray&&(n._lastPointerRay[i].origin.copyFrom(t.pickInfo.ray.origin),n._lastPointerRay[i].direction.copyFrom(t.pickInfo.ray.direction),n.currentDraggingPointerId==i&&n.dragging&&n._moveDrag(t.pickInfo.ray))}}else n._attachedToElement&&(n.releaseDrag(),n._activeDragButton=-1)})),this._beforeRenderObserver=this._scene.onBeforeRenderObservable.add((function(){if(n._moving&&n.moveAttached){var e=!1;_o._RemoveAndStorePivotPoint(n.attachedNode),n._targetPosition.subtractToRef(n.attachedNode.absolutePosition,n._tmpVector),n._tmpVector.scaleInPlace(n.dragDeltaRatio),n.attachedNode.getAbsolutePosition().addToRef(n._tmpVector,n._tmpVector),n.validateDrag(n._tmpVector)&&(n.attachedNode.setAbsolutePosition(n._tmpVector),e=!0),_o._RestorePivotPoint(n.attachedNode),e&&n.attachedNode.computeWorldMatrix()}}))},e.prototype.releaseDrag=function(){if(this.dragging&&(this.dragging=!1,this.onDragEndObservable.notifyObservers({dragPlanePoint:this.lastDragPosition,pointerId:this.currentDraggingPointerId})),this.currentDraggingPointerId=-1,this._moving=!1,this.detachCameraControls&&this._attachedToElement&&this._scene.activeCamera&&!this._scene.activeCamera.leftCamera){if(\"ArcRotateCamera\"===this._scene.activeCamera.getClassName()){var e=this._scene.activeCamera;e.attachControl(!e.inputs||e.inputs.noPreventDefault,e._useCtrlForPanning,e._panningMouseButton)}else this._scene.activeCamera.attachControl(!this._scene.activeCamera.inputs||this._scene.activeCamera.inputs.noPreventDefault);this._attachedToElement=!1}},e.prototype.startDrag=function(t,i,n){void 0===t&&(t=e._AnyMouseId),this._startDrag(t,i,n);var r=this._lastPointerRay[t];t===e._AnyMouseId&&(r=this._lastPointerRay[Object.keys(this._lastPointerRay)[0]]),r&&this._moveDrag(r)},e.prototype._startDrag=function(e,t,i){if(this._scene.activeCamera&&!this.dragging&&this.attachedNode){_o._RemoveAndStorePivotPoint(this.attachedNode),t?(this._startDragRay.direction.copyFrom(t.direction),this._startDragRay.origin.copyFrom(t.origin)):(this._startDragRay.origin.copyFrom(this._scene.activeCamera.position),this.attachedNode.getWorldMatrix().getTranslationToRef(this._tmpVector),this._tmpVector.subtractToRef(this._scene.activeCamera.position,this._startDragRay.direction)),this._updateDragPlanePosition(this._startDragRay,i||this._tmpVector);var n=this._pickWithRayOnDragPlane(this._startDragRay);n&&(this.dragging=!0,this.currentDraggingPointerId=e,this.lastDragPosition.copyFrom(n),this.onDragStartObservable.notifyObservers({dragPlanePoint:n,pointerId:this.currentDraggingPointerId}),this._targetPosition.copyFrom(this.attachedNode.getAbsolutePosition()),this.detachCameraControls&&this._scene.activeCamera&&this._scene.activeCamera.inputs&&!this._scene.activeCamera.leftCamera&&(this._scene.activeCamera.inputs.attachedToElement?(this._scene.activeCamera.detachControl(),this._attachedToElement=!0):this._attachedToElement=!1)),_o._RestorePivotPoint(this.attachedNode)}},e.prototype._moveDrag=function(e){this._moving=!0;var t=this._pickWithRayOnDragPlane(e);if(t){_o._RemoveAndStorePivotPoint(this.attachedNode),this.updateDragPlane&&this._updateDragPlanePosition(e,t);var i=0;this._options.dragAxis?(this.useObjectOrientationForDragging?x.TransformCoordinatesToRef(this._options.dragAxis,this.attachedNode.getWorldMatrix().getRotationMatrix(),this._worldDragAxis):this._worldDragAxis.copyFrom(this._options.dragAxis),t.subtractToRef(this.lastDragPosition,this._tmpVector),i=x.Dot(this._tmpVector,this._worldDragAxis),this._worldDragAxis.scaleToRef(i,this._dragDelta)):(i=this._dragDelta.length(),t.subtractToRef(this.lastDragPosition,this._dragDelta)),this._targetPosition.addInPlace(this._dragDelta),this.onDragObservable.notifyObservers({dragDistance:i,delta:this._dragDelta,dragPlanePoint:t,dragPlaneNormal:this._dragPlane.forward,pointerId:this.currentDraggingPointerId}),this.lastDragPosition.copyFrom(t),_o._RestorePivotPoint(this.attachedNode)}},e.prototype._pickWithRayOnDragPlane=function(t){var i=this;if(!t)return null;var n=Math.acos(x.Dot(this._dragPlane.forward,t.direction));if(n>Math.PI/2&&(n=Math.PI-n),this.maxDragAngle>0&&n>this.maxDragAngle){if(this._useAlternatePickedPointAboveMaxDragAngle){this._tmpVector.copyFrom(t.direction),this.attachedNode.absolutePosition.subtractToRef(t.origin,this._alternatePickedPoint),this._alternatePickedPoint.normalize(),this._alternatePickedPoint.scaleInPlace(this._useAlternatePickedPointAboveMaxDragAngleDragSpeed*x.Dot(this._alternatePickedPoint,this._tmpVector)),this._tmpVector.addInPlace(this._alternatePickedPoint);var r=x.Dot(this._dragPlane.forward,this._tmpVector);return this._dragPlane.forward.scaleToRef(-r,this._alternatePickedPoint),this._alternatePickedPoint.addInPlace(this._tmpVector),this._alternatePickedPoint.addInPlace(this.attachedNode.absolutePosition),this._alternatePickedPoint}return null}var o=e._PlaneScene.pickWithRay(t,(function(e){return e==i._dragPlane}));return o&&o.hit&&o.pickedMesh&&o.pickedPoint?o.pickedPoint:null},e.prototype._updateDragPlanePosition=function(e,t){this._pointA.copyFrom(t),this._options.dragAxis?(this.useObjectOrientationForDragging?x.TransformCoordinatesToRef(this._options.dragAxis,this.attachedNode.getWorldMatrix().getRotationMatrix(),this._localAxis):this._localAxis.copyFrom(this._options.dragAxis),e.origin.subtractToRef(this._pointA,this._pointC),this._pointC.normalize(),Math.abs(x.Dot(this._localAxis,this._pointC))>.999?Math.abs(x.Dot(x.UpReadOnly,this._pointC))>.999?this._lookAt.copyFrom(x.Right()):this._lookAt.copyFrom(x.UpReadOnly):(x.CrossToRef(this._localAxis,this._pointC,this._lookAt),x.CrossToRef(this._localAxis,this._lookAt,this._lookAt),this._lookAt.normalize()),this._dragPlane.position.copyFrom(this._pointA),this._pointA.addToRef(this._lookAt,this._lookAt),this._dragPlane.lookAt(this._lookAt)):this._options.dragPlaneNormal?(this.useObjectOrientationForDragging?x.TransformCoordinatesToRef(this._options.dragPlaneNormal,this.attachedNode.getWorldMatrix().getRotationMatrix(),this._localAxis):this._localAxis.copyFrom(this._options.dragPlaneNormal),this._dragPlane.position.copyFrom(this._pointA),this._pointA.addToRef(this._localAxis,this._lookAt),this._dragPlane.lookAt(this._lookAt)):(this._dragPlane.position.copyFrom(this._pointA),this._dragPlane.lookAt(e.origin)),this._dragPlane.position.copyFrom(this.attachedNode.getAbsolutePosition()),this._dragPlane.computeWorldMatrix(!0)},e.prototype.detach=function(){this._lastPointerRay={},this.attachedNode&&(this.attachedNode.isNearGrabbable=!1),this._pointerObserver&&this._scene.onPointerObservable.remove(this._pointerObserver),this._beforeRenderObserver&&this._scene.onBeforeRenderObservable.remove(this._beforeRenderObserver),this._dragPlane&&this._dragPlane.dispose(),this.releaseDrag(),this._activeDragButton=-1},e._AnyMouseId=-2,e}(),To=function(){function e(){this._startDistance=0,this._initialScale=new x(0,0,0),this._targetScale=new x(0,0,0),this._sceneRenderObserver=null,this._dragBehaviorA=new bo({}),this._dragBehaviorA.moveAttached=!1,this._dragBehaviorB=new bo({}),this._dragBehaviorB.moveAttached=!1}return Object.defineProperty(e.prototype,\"name\",{get:function(){return\"MultiPointerScale\"},enumerable:!1,configurable:!0}),e.prototype.init=function(){},e.prototype._getCurrentDistance=function(){return this._dragBehaviorA.lastDragPosition.subtract(this._dragBehaviorB.lastDragPosition).length()},e.prototype.attach=function(e){var t=this;this._ownerNode=e,this._dragBehaviorA.onDragStartObservable.add((function(){t._dragBehaviorA.dragging&&t._dragBehaviorB.dragging&&(t._dragBehaviorA.currentDraggingPointerId==t._dragBehaviorB.currentDraggingPointerId?t._dragBehaviorA.releaseDrag():(t._initialScale.copyFrom(e.scaling),t._startDistance=t._getCurrentDistance()))})),this._dragBehaviorB.onDragStartObservable.add((function(){t._dragBehaviorA.dragging&&t._dragBehaviorB.dragging&&(t._dragBehaviorA.currentDraggingPointerId==t._dragBehaviorB.currentDraggingPointerId?t._dragBehaviorB.releaseDrag():(t._initialScale.copyFrom(e.scaling),t._startDistance=t._getCurrentDistance()))})),[this._dragBehaviorA,this._dragBehaviorB].forEach((function(e){e.onDragObservable.add((function(){if(t._dragBehaviorA.dragging&&t._dragBehaviorB.dragging){var e=t._getCurrentDistance()/t._startDistance;t._initialScale.scaleToRef(e,t._targetScale)}}))})),e.addBehavior(this._dragBehaviorA),e.addBehavior(this._dragBehaviorB),this._sceneRenderObserver=e.getScene().onBeforeRenderObservable.add((function(){if(t._dragBehaviorA.dragging&&t._dragBehaviorB.dragging){var i=t._targetScale.subtract(e.scaling).scaleInPlace(.1);i.length()>.01&&e.scaling.addInPlace(i)}}))},e.prototype.detach=function(){var e=this;this._ownerNode.getScene().onBeforeRenderObservable.remove(this._sceneRenderObserver),[this._dragBehaviorA,this._dragBehaviorB].forEach((function(t){t.onDragStartObservable.clear(),t.onDragObservable.clear(),e._ownerNode.removeBehavior(t)}))},e}(),Eo=function(){function e(){this._attachedToElement=!1,this._virtualMeshesInfo={},this._tmpVector=new x,this._tmpQuaternion=new P,this._dragType={NONE:0,DRAG:1,DRAG_WITH_CONTROLLER:2,NEAR_DRAG:3},this._moving=!1,this._dragging=this._dragType.NONE,this.draggableMeshes=null,this.zDragFactor=3,this.currentDraggingPointerIds=[],this.detachCameraControls=!0,this.onDragStartObservable=new u,this.onDragObservable=new u,this.onDragEndObservable=new u,this.allowMultiPointer=!0}return Object.defineProperty(e.prototype,\"currentDraggingPointerId\",{get:function(){return void 0!==this.currentDraggingPointerIds[0]?this.currentDraggingPointerIds[0]:-1},set:function(e){this.currentDraggingPointerIds[0]=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"currentDraggingPointerID\",{get:function(){return this.currentDraggingPointerId},set:function(e){this.currentDraggingPointerId=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"name\",{get:function(){return\"BaseSixDofDrag\"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"isMoving\",{get:function(){return this._moving},enumerable:!1,configurable:!0}),e.prototype.init=function(){},Object.defineProperty(e.prototype,\"_pointerCamera\",{get:function(){return this._scene.cameraToUseForPointers?this._scene.cameraToUseForPointers:this._scene.activeCamera},enumerable:!1,configurable:!0}),e.prototype._createVirtualMeshInfo=function(){var t=new Sr(\"\",e._virtualScene);t.rotationQuaternion=new P;var i=new Sr(\"\",e._virtualScene);i.rotationQuaternion=new P;var n=new Sr(\"\",e._virtualScene);return n.rotationQuaternion=new P,{dragging:!1,moving:!1,dragMesh:t,originMesh:i,pivotMesh:n,startingPivotPosition:new x,startingPivotOrientation:new P,startingPosition:new x,startingOrientation:new P,lastOriginPosition:new x,lastDragPosition:new x}},e.prototype._resetVirtualMeshesPosition=function(){for(var e=0;eh&&(h=Math.min(.01-u,0)),c.scaleInPlace(h),c.addToRef(r.pivotMesh.absolutePosition,this._tmpVector),r.pivotMesh.setAbsolutePosition(this._tmpVector),c.addToRef(r.dragMesh.absolutePosition,this._tmpVector),r.dragMesh.setAbsolutePosition(this._tmpVector)}},e.prototype.attach=function(t){var i=this;this._ownerNode=t,this._scene=this._ownerNode.getScene(),e._virtualScene||(e._virtualScene=new mn(this._scene.getEngine(),{virtual:!0}),e._virtualScene.detachControl()),this._pointerObserver=this._scene.onPointerObservable.add((function(e){var t=e.event.pointerId;i._virtualMeshesInfo[t]||(i._virtualMeshesInfo[t]=i._createVirtualMeshInfo());var n,r=i._virtualMeshesInfo[t],o=\"xr-near\"===e.event.pointerType;if(e.type==Hi.POINTERDOWN){if(!r.dragging&&e.pickInfo&&e.pickInfo.hit&&e.pickInfo.pickedMesh&&e.pickInfo.pickedPoint&&e.pickInfo.ray&&(!o||e.pickInfo.aimTransform)&&(n=e.pickInfo.pickedMesh,i._ownerNode===n||n.isDescendantOf(i._ownerNode)&&(!i.draggableMeshes||-1!==i.draggableMeshes.indexOf(n)))){if(!i.allowMultiPointer&&i.currentDraggingPointerIds.length>0)return;!i._pointerCamera||i._pointerCamera.cameraRigMode!==xr.RIG_MODE_NONE||i._pointerCamera._isLeftCamera||i._pointerCamera._isRightCamera||e.pickInfo.ray.origin.copyFrom(i._pointerCamera.globalPosition),i._ownerNode.computeWorldMatrix(!0);var a=i._virtualMeshesInfo[t];o?(i._dragging=e.pickInfo.originMesh?i._dragType.NEAR_DRAG:i._dragType.DRAG_WITH_CONTROLLER,a.originMesh.position.copyFrom(e.pickInfo.aimTransform.position),i._dragging===i._dragType.NEAR_DRAG&&e.pickInfo.gripTransform?a.originMesh.rotationQuaternion.copyFrom(e.pickInfo.gripTransform.rotationQuaternion):a.originMesh.rotationQuaternion.copyFrom(e.pickInfo.aimTransform.rotationQuaternion)):(i._dragging=i._dragType.DRAG,a.originMesh.position.copyFrom(e.pickInfo.ray.origin)),a.lastOriginPosition.copyFrom(a.originMesh.position),a.dragMesh.position.copyFrom(e.pickInfo.pickedPoint),a.lastDragPosition.copyFrom(e.pickInfo.pickedPoint),a.pivotMesh.position.copyFrom(i._ownerNode.getAbsolutePivotPoint()),a.pivotMesh.rotationQuaternion.copyFrom(i._ownerNode.absoluteRotationQuaternion),a.startingPosition.copyFrom(a.dragMesh.position),a.startingPivotPosition.copyFrom(a.pivotMesh.position),a.startingOrientation.copyFrom(a.dragMesh.rotationQuaternion),a.startingPivotOrientation.copyFrom(a.pivotMesh.rotationQuaternion),o?(a.originMesh.addChild(a.dragMesh),a.originMesh.addChild(a.pivotMesh)):a.originMesh.lookAt(a.dragMesh.position),a.dragging=!0,-1===i.currentDraggingPointerIds.indexOf(t)&&i.currentDraggingPointerIds.push(t),i.detachCameraControls&&i._pointerCamera&&!i._pointerCamera.leftCamera&&(i._pointerCamera.inputs&&i._pointerCamera.inputs.attachedToElement?(i._pointerCamera.detachControl(),i._attachedToElement=!0):i._attachedToElement=!1),i._targetDragStart(a.pivotMesh.position,a.pivotMesh.rotationQuaternion,t),i.onDragStartObservable.notifyObservers({position:a.pivotMesh.position})}}else if(e.type==Hi.POINTERUP||e.type==Hi.POINTERDOUBLETAP){var s=i.currentDraggingPointerIds.indexOf(t);r.dragging=!1,-1!==s&&(i.currentDraggingPointerIds.splice(s,1),0===i.currentDraggingPointerIds.length&&(i._moving=!1,i._dragging=i._dragType.NONE,i.detachCameraControls&&i._attachedToElement&&i._pointerCamera&&!i._pointerCamera.leftCamera&&(i._pointerCamera.attachControl(!0),i._attachedToElement=!1)),r.originMesh.removeChild(r.dragMesh),r.originMesh.removeChild(r.pivotMesh),i._targetDragEnd(t),i.onDragEndObservable.notifyObservers({}))}else if(e.type==Hi.POINTERMOVE&&-1!==(s=i.currentDraggingPointerIds.indexOf(t))&&r.dragging&&e.pickInfo&&(e.pickInfo.ray||e.pickInfo.aimTransform)){var l=i.zDragFactor;(i.currentDraggingPointerIds.length>1||e.pickInfo.originMesh)&&(l=0),i._ownerNode.computeWorldMatrix(!0),o?i._pointerUpdateXR(e.pickInfo.aimTransform,e.pickInfo.gripTransform,t,l):i._pointerUpdate2D(e.pickInfo.ray,t,l),i._tmpQuaternion.copyFrom(r.startingPivotOrientation),i._tmpQuaternion.x=-i._tmpQuaternion.x,i._tmpQuaternion.y=-i._tmpQuaternion.y,i._tmpQuaternion.z=-i._tmpQuaternion.z,r.pivotMesh.absoluteRotationQuaternion.multiplyToRef(i._tmpQuaternion,i._tmpQuaternion),r.pivotMesh.absolutePosition.subtractToRef(r.startingPivotPosition,i._tmpVector),i.onDragObservable.notifyObservers({delta:i._tmpVector,position:r.pivotMesh.position,pickInfo:e.pickInfo}),i._targetDrag(i._tmpVector,i._tmpQuaternion,t),r.lastDragPosition.copyFrom(r.dragMesh.absolutePosition),i._moving=!0}}))},e.prototype._applyZOffset=function(e,t,i){e.position.z-=e.position.z<1?t*i:t*i*e.position.z,e.position.z<0&&(e.position.z=0)},e.prototype._targetDragStart=function(e,t,i){},e.prototype._targetDrag=function(e,t,i){},e.prototype._targetDragEnd=function(e){},e.prototype.detach=function(){for(var e in this._scene&&(this.detachCameraControls&&this._attachedToElement&&this._pointerCamera&&!this._pointerCamera.leftCamera&&(this._pointerCamera.attachControl(!0),this._attachedToElement=!1),this._scene.onPointerObservable.remove(this._pointerObserver)),this._virtualMeshesInfo)this._virtualMeshesInfo[e].originMesh.dispose(),this._virtualMeshesInfo[e].dragMesh.dispose();this.onDragEndObservable.clear(),this.onDragObservable.clear(),this.onDragStartObservable.clear()},e}(),So=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._sceneRenderObserver=null,t._targetPosition=new x(0,0,0),t._targetOrientation=new P,t._targetScaling=new x(1,1,1),t._startingPosition=new x(0,0,0),t._startingOrientation=new P,t._startingScaling=new x(1,1,1),t.onPositionChangedObservable=new u,t.dragDeltaRatio=.2,t.rotateDraggedObject=!0,t.rotateAroundYOnly=!1,t.rotateWithMotionController=!0,t.disableMovement=!1,t.faceCameraOnDragStart=!1,t}return V(t,e),Object.defineProperty(t.prototype,\"name\",{get:function(){return\"SixDofDrag\"},enumerable:!1,configurable:!0}),t.prototype.attach=function(t){var i=this;e.prototype.attach.call(this,t),t.isNearGrabbable=!0,this._virtualTransformNode=new yr(\"virtual_sixDof\",Eo._virtualScene),this._virtualTransformNode.rotationQuaternion=P.Identity(),this._sceneRenderObserver=t.getScene().onBeforeRenderObservable.add((function(){if(1===i.currentDraggingPointerIds.length&&i._moving&&!i.disableMovement){var e=t.parent;t.setParent(null),t.position.addInPlace(i._targetPosition.subtract(t.position).scale(i.dragDeltaRatio)),i.onPositionChangedObservable.notifyObservers({position:t.absolutePosition}),(!e||e.scaling&&!e.scaling.isNonUniformWithinEpsilon(.001))&&P.SlerpToRef(t.rotationQuaternion,i._targetOrientation,i.dragDeltaRatio,t.rotationQuaternion),t.setParent(e)}}))},t.prototype._getPositionOffsetAround=function(e,t,i){var n=O.Matrix[0],r=O.Matrix[1],o=O.Matrix[2],a=O.Matrix[3],s=O.Matrix[4];return M.TranslationToRef(e.x,e.y,e.z,n),M.TranslationToRef(-e.x,-e.y,-e.z,r),M.FromQuaternionToRef(i,o),M.ScalingToRef(t,t,t,a),r.multiplyToRef(o,s),s.multiplyToRef(a,s),s.multiplyToRef(n,s),s.getTranslation()},t.prototype._onePointerPositionUpdated=function(e,t){O.Vector3[0].setAll(0),this._dragging===this._dragType.DRAG?this.rotateDraggedObject&&(this.rotateAroundYOnly?P.RotationYawPitchRollToRef(t.toEulerAngles().y,0,0,O.Quaternion[0]):O.Quaternion[0].copyFrom(t),O.Quaternion[0].multiplyToRef(this._startingOrientation,this._targetOrientation)):(this._dragging===this._dragType.NEAR_DRAG||this._dragging===this._dragType.DRAG_WITH_CONTROLLER&&this.rotateWithMotionController)&&t.multiplyToRef(this._startingOrientation,this._targetOrientation),this._targetPosition.copyFrom(this._startingPosition).addInPlace(e)},t.prototype._twoPointersPositionUpdated=function(){var e=this._virtualMeshesInfo[this.currentDraggingPointerIds[0]].startingPosition,t=this._virtualMeshesInfo[this.currentDraggingPointerIds[1]].startingPosition,i=O.Vector3[0];e.addToRef(t,i),i.scaleInPlace(.5);var n=O.Vector3[1];t.subtractToRef(e,n);var r=this._virtualMeshesInfo[this.currentDraggingPointerIds[0]].dragMesh.absolutePosition,o=this._virtualMeshesInfo[this.currentDraggingPointerIds[1]].dragMesh.absolutePosition,a=O.Vector3[2];r.addToRef(o,a),a.scaleInPlace(.5);var s=O.Vector3[3];o.subtractToRef(r,s);var l=s.length()/n.length(),c=a.subtract(i),u=P.FromEulerAngles(0,x.GetAngleBetweenVectorsOnPlane(n.normalize(),s.normalize(),x.UpReadOnly),0),h=this._ownerNode.parent;this._ownerNode.setParent(null);var d=this._getPositionOffsetAround(i.subtract(this._virtualTransformNode.getAbsolutePivotPoint()),l,u);this._virtualTransformNode.rotationQuaternion.multiplyToRef(u,this._ownerNode.rotationQuaternion),this._virtualTransformNode.scaling.scaleToRef(l,this._ownerNode.scaling),this._virtualTransformNode.position.addToRef(c.addInPlace(d),this._ownerNode.position),this.onPositionChangedObservable.notifyObservers({position:this._ownerNode.position}),this._ownerNode.setParent(h)},t.prototype._targetDragStart=function(){var e=this.currentDraggingPointerIds.length,t=this._ownerNode.parent;this._ownerNode.rotationQuaternion||(this._ownerNode.rotationQuaternion=P.RotationYawPitchRoll(this._ownerNode.rotation.y,this._ownerNode.rotation.x,this._ownerNode.rotation.z));var i=this._ownerNode.getAbsolutePivotPoint();if(this._ownerNode.setParent(null),1===e){if(this._targetPosition.copyFrom(this._ownerNode.position),this._targetOrientation.copyFrom(this._ownerNode.rotationQuaternion),this._targetScaling.copyFrom(this._ownerNode.scaling),this.faceCameraOnDragStart&&this._scene.activeCamera){var n=O.Vector3[0];this._scene.activeCamera.position.subtractToRef(i,n),n.normalize();var r=O.Quaternion[0];this._scene.useRightHandedSystem?P.FromLookDirectionRHToRef(n,new x(0,1,0),r):P.FromLookDirectionLHToRef(n,new x(0,1,0),r),r.normalize(),P.RotationYawPitchRollToRef(r.toEulerAngles().y,0,0,O.Quaternion[0]),this._targetOrientation.copyFrom(O.Quaternion[0])}this._startingPosition.copyFrom(this._targetPosition),this._startingOrientation.copyFrom(this._targetOrientation),this._startingScaling.copyFrom(this._targetScaling)}else 2===e&&(this._virtualTransformNode.setPivotPoint(new x(0,0,0),_n.LOCAL),this._virtualTransformNode.position.copyFrom(this._ownerNode.position),this._virtualTransformNode.scaling.copyFrom(this._ownerNode.scaling),this._virtualTransformNode.rotationQuaternion.copyFrom(this._ownerNode.rotationQuaternion),this._virtualTransformNode.setPivotPoint(i,_n.WORLD),this._resetVirtualMeshesPosition());this._ownerNode.setParent(t)},t.prototype._targetDrag=function(e,t){1===this.currentDraggingPointerIds.length?this._onePointerPositionUpdated(e,t):2===this.currentDraggingPointerIds.length&&this._twoPointersPositionUpdated()},t.prototype._targetDragEnd=function(){if(1===this.currentDraggingPointerIds.length){this._resetVirtualMeshesPosition();var e=this.faceCameraOnDragStart;this.faceCameraOnDragStart=!1,this._targetDragStart(),this.faceCameraOnDragStart=e}},t.prototype.detach=function(){e.prototype.detach.call(this),this._ownerNode&&(this._ownerNode.isNearGrabbable=!1,this._ownerNode.getScene().onBeforeRenderObservable.remove(this._sceneRenderObserver)),this._virtualTransformNode&&this._virtualTransformNode.dispose()},t}(Eo),Ao=function(){function e(){this._attachPointLocalOffset=new x,this._workingPosition=new x,this._workingQuaternion=new P,this._lastTick=-1,this._hit=!1,this.hitNormalOffset=.05,this.meshes=[],this.interpolatePose=!0,this.lerpTime=250,this.keepOrientationVertical=!0,this.enabled=!0,this.maxStickingDistance=.8}return Object.defineProperty(e.prototype,\"name\",{get:function(){return\"SurfaceMagnetism\"},enumerable:!1,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(e,t){this._attachedMesh=e,this._scene=t||e.getScene(),this._attachedMesh.rotationQuaternion||(this._attachedMesh.rotationQuaternion=P.RotationYawPitchRoll(this._attachedMesh.rotation.y,this._attachedMesh.rotation.x,this._attachedMesh.rotation.z)),this.updateAttachPoint(),this._workingPosition.copyFrom(this._attachedMesh.position),this._workingQuaternion.copyFrom(this._attachedMesh.rotationQuaternion),this._addObservables()},e.prototype.detach=function(){this._attachedMesh=null,this._removeObservables()},e.prototype._getTargetPose=function(e){if(!this._attachedMesh)return null;if(e&&e.hit){var t=e.getNormal(!0,!0),i=e.pickedPoint;if(!t||!i)return null;t.normalize();var n=O.Vector3[0];return n.copyFrom(t),n.scaleInPlace(this.hitNormalOffset),n.addInPlace(i),this._attachedMesh.parent&&(O.Matrix[0].copyFrom(this._attachedMesh.parent.getWorldMatrix()).invert(),x.TransformNormalToRef(n,O.Matrix[0],n)),{position:n,quaternion:P.RotationYawPitchRoll(-Math.atan2(t.x,-t.z),this.keepOrientationVertical?0:Math.atan2(t.y,Math.sqrt(t.z*t.z+t.x*t.x)),0)}}return null},e.prototype.updateAttachPoint=function(){this._getAttachPointOffsetToRef(this._attachPointLocalOffset)},e.prototype.findAndUpdateTarget=function(e){if(this._hit=!1,!e.ray)return!1;var t=e.ray.intersectsMeshes(this.meshes)[0];if(this._attachedMesh&&t&&t.hit&&t.pickedMesh){var i=this._getTargetPose(t);i&&x.Distance(this._attachedMesh.position,i.position)c&&(P.RotationAxisToRef(n,-l+c,a),t.rotateByQuaternionToRef(a,t),o=!0)}var u=this._angleBetweenVectorAndPlane(t,n)*(this._scene.useRightHandedSystem?-1:1),h=this.maxViewHorizontalDegrees*Math.PI/180*.5;return u<-h?(P.RotationAxisToRef(r,-u-h,a),t.rotateByQuaternionToRef(a,t),o=!0):u>h&&(P.RotationAxisToRef(r,-u+h,a),t.rotateByQuaternionToRef(a,t),o=!0),o},e.prototype._orientationClamp=function(e,t){var i,n=this._tmpVectors[0];n.copyFrom(e).scaleInPlace(-1).normalize();var r=this._tmpVectors[1],o=this._tmpVectors[2];r.copyFromFloats(0,1,0),x.CrossToRef(n,r,o);var a=o.length();a<_||(o.normalizeFromLength(a),x.CrossToRef(o,n,r),(null===(i=this.attachedNode)||void 0===i?void 0:i.getScene().useRightHandedSystem)?P.FromLookDirectionRHToRef(n,r,t):P.FromLookDirectionLHToRef(n,r,t))},e.prototype._passedOrientationDeadzone=function(e,t){var i=this._tmpVectors[5];return i.copyFrom(e),i.normalize(),180*Math.abs(x.GetAngleBetweenVectorsOnPlane(t,i,x.UpReadOnly))/Math.PI>this.orientToCameraDeadzoneDegrees},e.prototype._updateLeashing=function(e){if(this.attachedNode&&this._enabled){var t=this.attachedNode.parent;this.attachedNode.setParent(null);var i=this.attachedNode.getWorldMatrix(),n=this._workingPosition,r=this._workingQuaternion,o=this.attachedNode.getPivotPoint(),a=this._tmpInvertView;a.copyFrom(e.getViewMatrix()),a.invert(),x.TransformCoordinatesToRef(o,i,n);var s=this._tmpPosition;s.copyFromFloats(0,0,0),x.TransformCoordinatesToRef(s,i,s),s.scaleInPlace(-1).subtractInPlace(o),n.subtractInPlace(e.globalPosition),this.ignoreCameraPitchAndRoll&&this._applyPitchOffset(a);var l=!1,c=this._tmpForward;c.copyFromFloats(0,0,this._scene.useRightHandedSystem?-1:1),x.TransformNormalToRef(c,a,c);var u=this._tmpNodeForward;if(u.copyFromFloats(0,0,this._scene.useRightHandedSystem?-1:1),x.TransformNormalToRef(u,i,u),this._recenterNextUpdate)n.copyFrom(c).scaleInPlace(this.defaultDistance);else if(this.ignoreAngleClamp){var h=n.length();n.copyFrom(c).scaleInPlace(h)}else l=this._angularClamp(a,n);var d=!1;this.ignoreDistanceClamp||(d=this._distanceClamp(n,l),this._applyVerticalClamp(n)),this.useFixedVerticalOffset&&(n.y=s.y-e.globalPosition.y+this.fixedVerticalOffset),(l||d||this._passedOrientationDeadzone(n,u)||this._recenterNextUpdate)&&this._orientationClamp(n,r),this._workingPosition.subtractInPlace(o),this._recenterNextUpdate=!1,this.attachedNode.setParent(t)}},e.prototype._updateTransformToGoal=function(e){if(this.attachedNode&&this.followedCamera&&this._enabled){this.attachedNode.rotationQuaternion||(this.attachedNode.rotationQuaternion=P.Identity());var t=this.attachedNode.parent;if(this.attachedNode.setParent(null),!this.interpolatePose)return this.attachedNode.position.copyFrom(this.followedCamera.globalPosition).addInPlace(this._workingPosition),void this.attachedNode.rotationQuaternion.copyFrom(this._workingQuaternion);var i=new x;i.copyFrom(this.attachedNode.position).subtractInPlace(this.followedCamera.globalPosition),x.SmoothToRef(i,this._workingPosition,e,this.lerpTime,i),i.addInPlace(this.followedCamera.globalPosition),this.attachedNode.position.copyFrom(i);var n=new P;n.copyFrom(this.attachedNode.rotationQuaternion),P.SmoothToRef(n,this._workingQuaternion,e,this.lerpTime,this.attachedNode.rotationQuaternion),this.attachedNode.setParent(t)}},e.prototype._addObservables=function(){var e=this;this._lastTick=Date.now(),this._onBeforeRender=this._scene.onBeforeRenderObservable.add((function(){if(e.followedCamera){var t=Date.now();e._updateLeashing(e.followedCamera),e._updateTransformToGoal(t-e._lastTick),e._lastTick=t}}))},e.prototype._removeObservables=function(){this._onBeforeRender&&this._scene.onBeforeRenderObservable.remove(this._onBeforeRender)},e}(),xo=function(){function e(){}return e.ANCHOR_SYSTEM=\"xr-anchor-system\",e.BACKGROUND_REMOVER=\"xr-background-remover\",e.HIT_TEST=\"xr-hit-test\",e.MESH_DETECTION=\"xr-mesh-detection\",e.PHYSICS_CONTROLLERS=\"xr-physics-controller\",e.PLANE_DETECTION=\"xr-plane-detection\",e.POINTER_SELECTION=\"xr-controller-pointer-selection\",e.TELEPORTATION=\"xr-controller-teleportation\",e.FEATURE_POINTS=\"xr-feature-points\",e.HAND_TRACKING=\"xr-hand-tracking\",e.IMAGE_TRACKING=\"xr-image-tracking\",e.NEAR_INTERACTION=\"xr-near-interaction\",e.DOM_OVERLAY=\"xr-dom-overlay\",e.MOVEMENT=\"xr-controller-movement\",e.LIGHT_ESTIMATION=\"xr-light-estimation\",e.EYE_TRACKING=\"xr-eye-tracking\",e.WALKING_LOCOMOTION=\"xr-walking-locomotion\",e.LAYERS=\"xr-layers\",e}(),Co=function(){function e(e){var t=this;this._xrSessionManager=e,this._features={},this._xrSessionManager.onXRSessionInit.add((function(){t.getEnabledFeatures().forEach((function(e){var i=t._features[e];!i.enabled||i.featureImplementation.attached||i.featureImplementation.disableAutoAttach||t.attachFeature(e)}))})),this._xrSessionManager.onXRSessionEnded.add((function(){t.getEnabledFeatures().forEach((function(e){var i=t._features[e];i.enabled&&i.featureImplementation.attached&&t.detachFeature(e)}))}))}return e.AddWebXRFeature=function(e,t,i,n){void 0===i&&(i=1),void 0===n&&(n=!1),this._AvailableFeatures[e]=this._AvailableFeatures[e]||{latest:i},i>this._AvailableFeatures[e].latest&&(this._AvailableFeatures[e].latest=i),n&&(this._AvailableFeatures[e].stable=i),this._AvailableFeatures[e][i]=t},e.ConstructFeature=function(e,t,i,n){void 0===t&&(t=1);var r=this._AvailableFeatures[e][t];if(!r)throw new Error(\"feature not found\");return r(i,n)},e.GetAvailableFeatures=function(){return Object.keys(this._AvailableFeatures)},e.GetAvailableVersions=function(e){return Object.keys(this._AvailableFeatures[e])},e.GetLatestVersionOfFeature=function(e){return this._AvailableFeatures[e]&&this._AvailableFeatures[e].latest||-1},e.GetStableVersionOfFeature=function(e){return this._AvailableFeatures[e]&&this._AvailableFeatures[e].stable||-1},e.prototype.attachFeature=function(e){var t=this._features[e];t&&t.enabled&&!t.featureImplementation.attached&&t.featureImplementation.attach()},e.prototype.detachFeature=function(e){var t=this._features[e];t&&t.featureImplementation.attached&&t.featureImplementation.detach()},e.prototype.disableFeature=function(e){var t=\"string\"==typeof e?e:e.Name,i=this._features[t];return!(!i||!i.enabled||(i.enabled=!1,this.detachFeature(t),i.featureImplementation.dispose(),delete this._features[t],0))},e.prototype.dispose=function(){var e=this;this.getEnabledFeatures().forEach((function(t){e.disableFeature(t)}))},e.prototype.enableFeature=function(t,i,n,r,o){var a=this;void 0===i&&(i=\"latest\"),void 0===n&&(n={}),void 0===r&&(r=!0),void 0===o&&(o=!0);var s=\"string\"==typeof t?t:t.Name,l=0;if(\"string\"==typeof i){if(!i)throw new Error(\"Error in provided version - \".concat(s,\" (\").concat(i,\")\"));if(-1===(l=\"stable\"===i?e.GetStableVersionOfFeature(s):\"latest\"===i?e.GetLatestVersionOfFeature(s):+i)||isNaN(l))throw new Error(\"feature not found - \".concat(s,\" (\").concat(i,\")\"))}else l=i;var c=e._ConflictingFeatures[s];if(void 0!==c&&-1!==this.getEnabledFeatures().indexOf(c))throw new Error(\"Feature \".concat(s,\" cannot be enabled while \").concat(c,\" is enabled.\"));var u=this._features[s],h=e.ConstructFeature(s,l,this._xrSessionManager,n);if(!h)throw new Error(\"feature not found - \".concat(s));u&&this.disableFeature(s);var d=h();if(d.dependsOn){var p=d.dependsOn.every((function(e){return!!a._features[e]}));if(!p)throw new Error(\"Dependant features missing. Make sure the following features are enabled - \".concat(d.dependsOn.join(\", \")))}if(d.isCompatible())return this._features[s]={featureImplementation:d,enabled:!0,version:l,required:o},r?this._xrSessionManager.session&&!this._features[s].featureImplementation.attached&&this.attachFeature(s):this._features[s].featureImplementation.disableAutoAttach=!0,this._features[s].featureImplementation;if(o)throw new Error(\"required feature not compatible\");return mi.Warn(\"Feature \".concat(s,\" not compatible with the current environment/browser and was not enabled.\")),d},e.prototype.getEnabledFeature=function(e){return this._features[e]&&this._features[e].featureImplementation},e.prototype.getEnabledFeatures=function(){return Object.keys(this._features)},e.prototype._extendXRSessionInitObject=function(e){return z(this,void 0,void 0,(function(){var t,i,n,r,o,a,s;return W(this,(function(l){switch(l.label){case 0:t=this.getEnabledFeatures(),i=0,n=t,l.label=1;case 1:return i100&&(this.soft=!0),this._physicsEngine=this._scene.getPhysicsEngine(),this._physicsEngine?(this.object.rotationQuaternion||(this.object.rotation?this.object.rotationQuaternion=P.RotationYawPitchRoll(this.object.rotation.y,this.object.rotation.x,this.object.rotation.z):this.object.rotationQuaternion=new P),this._options.mass=void 0===n.mass?0:n.mass,this._options.friction=void 0===n.friction?.2:n.friction,this._options.restitution=void 0===n.restitution?.2:n.restitution,this.soft&&(this._options.mass=this._options.mass>0?this._options.mass:1,this._options.pressure=void 0===n.pressure?200:n.pressure,this._options.stiffness=void 0===n.stiffness?1:n.stiffness,this._options.velocityIterations=void 0===n.velocityIterations?20:n.velocityIterations,this._options.positionIterations=void 0===n.positionIterations?20:n.positionIterations,this._options.fixedPoints=void 0===n.fixedPoints?0:n.fixedPoints,this._options.margin=void 0===n.margin?0:n.margin,this._options.damping=void 0===n.damping?0:n.damping,this._options.path=void 0===n.path?null:n.path,this._options.shape=void 0===n.shape?null:n.shape),this._joints=[],!this.object.parent||this._options.ignoreParent?this._init():this.object.parent.physicsImpostor&&Q.Warn(\"You must affect impostors to children before affecting impostor to parent.\")):Q.Error(\"Physics not enabled. Please use scene.enablePhysics(...) before creating impostors.\"))):Q.Error(\"No object was provided. A physics object is obligatory\")}return Object.defineProperty(e.prototype,\"isDisposed\",{get:function(){return this._isDisposed},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"mass\",{get:function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getBodyMass(this):0},set:function(e){this.setMass(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"friction\",{get:function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getBodyFriction(this):0},set:function(e){this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setBodyFriction(this,e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"restitution\",{get:function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getBodyRestitution(this):0},set:function(e){this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setBodyRestitution(this,e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"pressure\",{get:function(){if(!this._physicsEngine)return 0;var e=this._physicsEngine.getPhysicsPlugin();return e.setBodyPressure?e.getBodyPressure(this):0},set:function(e){if(this._physicsEngine){var t=this._physicsEngine.getPhysicsPlugin();t.setBodyPressure&&t.setBodyPressure(this,e)}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"stiffness\",{get:function(){if(!this._physicsEngine)return 0;var e=this._physicsEngine.getPhysicsPlugin();return e.getBodyStiffness?e.getBodyStiffness(this):0},set:function(e){if(this._physicsEngine){var t=this._physicsEngine.getPhysicsPlugin();t.setBodyStiffness&&t.setBodyStiffness(this,e)}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"velocityIterations\",{get:function(){if(!this._physicsEngine)return 0;var e=this._physicsEngine.getPhysicsPlugin();return e.getBodyVelocityIterations?e.getBodyVelocityIterations(this):0},set:function(e){if(this._physicsEngine){var t=this._physicsEngine.getPhysicsPlugin();t.setBodyVelocityIterations&&t.setBodyVelocityIterations(this,e)}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"positionIterations\",{get:function(){if(!this._physicsEngine)return 0;var e=this._physicsEngine.getPhysicsPlugin();return e.getBodyPositionIterations?e.getBodyPositionIterations(this):0},set:function(e){if(this._physicsEngine){var t=this._physicsEngine.getPhysicsPlugin();t.setBodyPositionIterations&&t.setBodyPositionIterations(this,e)}},enumerable:!1,configurable:!0}),e.prototype._init=function(){this._physicsEngine&&(this._physicsEngine.removeImpostor(this),this.physicsBody=null,this._parent=this._parent||this._getPhysicsParent(),this._isDisposed||this.parent&&!this._options.ignoreParent||this._physicsEngine.addImpostor(this))},e.prototype._getPhysicsParent=function(){return this.object.parent instanceof Sr?this.object.parent.physicsImpostor:null},e.prototype.isBodyInitRequired=function(){return this._bodyUpdateRequired||!this._physicsBody&&(!this._parent||!!this._options.ignoreParent)},e.prototype.setScalingUpdated=function(){this.forceUpdate()},e.prototype.forceUpdate=function(){this._init(),this.parent&&!this._options.ignoreParent&&this.parent.forceUpdate()},Object.defineProperty(e.prototype,\"physicsBody\",{get:function(){return this._parent&&!this._options.ignoreParent?this._parent.physicsBody:this._physicsBody},set:function(e){this._physicsBody&&this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().removePhysicsBody(this),this._physicsBody=e,this.resetUpdateFlags()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"parent\",{get:function(){return!this._options.ignoreParent&&this._parent?this._parent:null},set:function(e){this._parent=e},enumerable:!1,configurable:!0}),e.prototype.resetUpdateFlags=function(){this._bodyUpdateRequired=!1},e.prototype.getObjectExtents=function(){if(this.object.getBoundingInfo){var t=this.object.rotationQuaternion,i=this.object.scaling.clone();this.object.rotationQuaternion=e.IDENTITY_QUATERNION;var n=this.object.computeWorldMatrix&&this.object.computeWorldMatrix(!0);n&&n.decompose(i,void 0,void 0);var r=this.object.getBoundingInfo().boundingBox.extendSize.scale(2).multiplyInPlace(i);return r.x=Math.abs(r.x),r.y=Math.abs(r.y),r.z=Math.abs(r.z),this.object.rotationQuaternion=t,this.object.computeWorldMatrix&&this.object.computeWorldMatrix(!0),r}return e.DEFAULT_OBJECT_SIZE},e.prototype.getObjectCenter=function(){return this.object.getBoundingInfo?this.object.getBoundingInfo().boundingBox.centerWorld:this.object.position},e.prototype.getParam=function(e){return this._options[e]},e.prototype.setParam=function(e,t){this._options[e]=t,this._bodyUpdateRequired=!0},e.prototype.setMass=function(e){this.getParam(\"mass\")!==e&&this.setParam(\"mass\",e),this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setBodyMass(this,e)},e.prototype.getLinearVelocity=function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getLinearVelocity(this):x.Zero()},e.prototype.setLinearVelocity=function(e){this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setLinearVelocity(this,e)},e.prototype.getAngularVelocity=function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getAngularVelocity(this):x.Zero()},e.prototype.setAngularVelocity=function(e){this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setAngularVelocity(this,e)},e.prototype.executeNativeFunction=function(e){this._physicsEngine&&e(this._physicsEngine.getPhysicsPlugin().world,this.physicsBody)},e.prototype.registerBeforePhysicsStep=function(e){this._onBeforePhysicsStepCallbacks.push(e)},e.prototype.unregisterBeforePhysicsStep=function(e){var t=this._onBeforePhysicsStepCallbacks.indexOf(e);t>-1?this._onBeforePhysicsStepCallbacks.splice(t,1):Q.Warn(\"Function to remove was not found\")},e.prototype.registerAfterPhysicsStep=function(e){this._onAfterPhysicsStepCallbacks.push(e)},e.prototype.unregisterAfterPhysicsStep=function(e){var t=this._onAfterPhysicsStepCallbacks.indexOf(e);t>-1?this._onAfterPhysicsStepCallbacks.splice(t,1):Q.Warn(\"Function to remove was not found\")},e.prototype.registerOnPhysicsCollide=function(e,t){var i=e instanceof Array?e:[e];this._onPhysicsCollideCallbacks.push({callback:t,otherImpostors:i})},e.prototype.unregisterOnPhysicsCollide=function(e,t){var i=e instanceof Array?e:[e],n=-1;this._onPhysicsCollideCallbacks.some((function(e,r){if(e.callback===t&&e.otherImpostors.length===i.length){var o=e.otherImpostors.every((function(e){return i.indexOf(e)>-1}));return o&&(n=r),o}return!1}))?this._onPhysicsCollideCallbacks.splice(n,1):Q.Warn(\"Function to remove was not found\")},e.prototype.getParentsRotation=function(){var e=this.object.parent;for(this._tmpQuat.copyFromFloats(0,0,0,1);e;)e.rotationQuaternion?this._tmpQuat2.copyFrom(e.rotationQuaternion):P.RotationYawPitchRollToRef(e.rotation.y,e.rotation.x,e.rotation.z,this._tmpQuat2),this._tmpQuat.multiplyToRef(this._tmpQuat2,this._tmpQuat),e=e.parent;return this._tmpQuat},e.prototype.applyForce=function(e,t){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().applyForce(this,e,t),this},e.prototype.applyImpulse=function(e,t){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().applyImpulse(this,e,t),this},e.prototype.createJoint=function(e,t,i){var n=new Mo(t,i);return this.addJoint(e,n),this},e.prototype.addJoint=function(e,t){return this._joints.push({otherImpostor:e,joint:t}),this._physicsEngine&&this._physicsEngine.addJoint(this,e,t),this},e.prototype.addAnchor=function(e,t,i,n,r){if(!this._physicsEngine)return this;var o=this._physicsEngine.getPhysicsPlugin();return o.appendAnchor?(this._physicsEngine&&o.appendAnchor(this,e,t,i,n,r),this):this},e.prototype.addHook=function(e,t,i,n){if(!this._physicsEngine)return this;var r=this._physicsEngine.getPhysicsPlugin();return r.appendAnchor?(this._physicsEngine&&r.appendHook(this,e,t,i,n),this):this},e.prototype.sleep=function(){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().sleepBody(this),this},e.prototype.wakeUp=function(){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().wakeUpBody(this),this},e.prototype.clone=function(t){return t?new e(t,this.type,this._options,this._scene):null},e.prototype.dispose=function(){var e=this;this._physicsEngine&&(this._joints.forEach((function(t){e._physicsEngine&&e._physicsEngine.removeJoint(e,t.otherImpostor,t.joint)})),this._physicsEngine.removeImpostor(this),this.parent&&this.parent.forceUpdate(),this._isDisposed=!0)},e.prototype.setDeltaPosition=function(e){this._deltaPosition.copyFrom(e)},e.prototype.setDeltaRotation=function(e){this._deltaRotation||(this._deltaRotation=new P),this._deltaRotation.copyFrom(e),this._deltaRotationConjugated=this._deltaRotation.conjugate()},e.prototype.getBoxSizeToRef=function(e){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().getBoxSizeToRef(this,e),this},e.prototype.getRadius=function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getRadius(this):0},e.prototype.syncBoneWithImpostor=function(t,i,n,r,o){var a=e._TmpVecs[0],s=this.object;if(s.rotationQuaternion)if(o){var l=e._TmpQuat;s.rotationQuaternion.multiplyToRef(o,l),t.setRotationQuaternion(l,_n.WORLD,i)}else t.setRotationQuaternion(s.rotationQuaternion,_n.WORLD,i);a.x=0,a.y=0,a.z=0,n&&(a.x=n.x,a.y=n.y,a.z=n.z,t.getDirectionToRef(a,i,a),null==r&&(r=n.length()),a.x*=r,a.y*=r,a.z*=r),t.getParent()?(a.addInPlace(s.getAbsolutePosition()),t.setAbsolutePosition(a,i)):(i.setAbsolutePosition(s.getAbsolutePosition()),i.position.x-=a.x,i.position.y-=a.y,i.position.z-=a.z)},e.prototype.syncImpostorWithBone=function(t,i,n,r,o,a){var s=this.object;if(s.rotationQuaternion)if(o){var l=e._TmpQuat;t.getRotationQuaternionToRef(_n.WORLD,i,l),l.multiplyToRef(o,s.rotationQuaternion)}else t.getRotationQuaternionToRef(_n.WORLD,i,s.rotationQuaternion);var c=e._TmpVecs[0],u=e._TmpVecs[1];a||((a=e._TmpVecs[2]).x=0,a.y=1,a.z=0),t.getDirectionToRef(a,i,u),t.getAbsolutePositionToRef(i,c),null==r&&n&&(r=n.length()),null!=r&&(c.x+=u.x*r,c.y+=u.y*r,c.z+=u.z*r),s.setAbsolutePosition(c)},e.DEFAULT_OBJECT_SIZE=new x(1,1,1),e.IDENTITY_QUATERNION=P.Identity(),e._TmpVecs=m.BuildArray(3,x.Zero),e._TmpQuat=P.Identity(),e.NoImpostor=0,e.SphereImpostor=1,e.BoxImpostor=2,e.PlaneImpostor=3,e.MeshImpostor=4,e.CapsuleImpostor=6,e.CylinderImpostor=7,e.ParticleImpostor=8,e.HeightmapImpostor=9,e.ConvexHullImpostor=10,e.CustomImpostor=100,e.RopeImpostor=101,e.ClothImpostor=102,e.SoftbodyImpostor=103,e}();!function(e){e[e.Clean=0]=\"Clean\",e[e.Stop=1]=\"Stop\",e[e.Sync=2]=\"Sync\",e[e.NoSync=3]=\"NoSync\"}(Lo||(Lo={}));var wo,Bo,Uo=function(){function e(){}return Object.defineProperty(e,\"ForceFullSceneLoadingForIncremental\",{get:function(){return dr.ForceFullSceneLoadingForIncremental},set:function(e){dr.ForceFullSceneLoadingForIncremental=e},enumerable:!1,configurable:!0}),Object.defineProperty(e,\"ShowLoadingScreen\",{get:function(){return dr.ShowLoadingScreen},set:function(e){dr.ShowLoadingScreen=e},enumerable:!1,configurable:!0}),Object.defineProperty(e,\"loggingLevel\",{get:function(){return dr.loggingLevel},set:function(e){dr.loggingLevel=e},enumerable:!1,configurable:!0}),Object.defineProperty(e,\"CleanBoneMatrixWeights\",{get:function(){return dr.CleanBoneMatrixWeights},set:function(e){dr.CleanBoneMatrixWeights=e},enumerable:!1,configurable:!0}),e.GetDefaultPlugin=function(){return e._RegisteredPlugins[\".babylon\"]},e._GetPluginForExtension=function(t){return e._RegisteredPlugins[t]||(Q.Warn(\"Unable to find a plugin to load \"+t+\" files. Trying to use .babylon default plugin. To load from a specific filetype (eg. gltf) see: https://doc.babylonjs.com/how_to/load_from_any_file_type\"),e.GetDefaultPlugin())},e._GetPluginForDirectLoad=function(t){for(var i in e._RegisteredPlugins){var n=e._RegisteredPlugins[i].plugin;if(n.canDirectLoad&&n.canDirectLoad(t))return e._RegisteredPlugins[i]}return e.GetDefaultPlugin()},e._GetPluginForFilename=function(t){var i=t.indexOf(\"?\");-1!==i&&(t=t.substring(0,i));var n=t.lastIndexOf(\".\"),r=t.substring(n,t.length).toLowerCase();return e._GetPluginForExtension(r)},e._GetDirectLoad=function(e){return\"data:\"===e.substr(0,5)?e.substr(5):null},e._FormatErrorMessage=function(e,t,i){var n=\"Unable to load from \"+e.url;return t?n+=\": \".concat(t):i&&(n+=\": \".concat(i)),n},e._LoadData=function(t,i,n,r,o,a,s){var l,c=e._GetDirectLoad(t.url),u=s?e._GetPluginForExtension(s):c?e._GetPluginForDirectLoad(t.url):e._GetPluginForFilename(t.url);if(!(l=void 0!==u.plugin.createPlugin?u.plugin.createPlugin():u.plugin))throw\"The loader plugin corresponding to the file type you are trying to load has not been found. If using es6, please import the plugin you wish to use before.\";if(e.OnPluginActivatedObservable.notifyObservers(l),c&&(l.canDirectLoad&&l.canDirectLoad(t.url)||!si(t.url))){if(l.directLoad){var h=l.directLoad(i,c);h.then?h.then((function(e){n(l,e)})).catch((function(e){o(\"Error in directLoad of _loadData: \"+e,e)})):n(l,h)}else n(l,c);return l}var d=u.isBinary,p=function(e,t){i.isDisposed?o(\"Scene has been disposed\"):n(l,e,t)},f=null,_=!1,m=l.onDisposeObservable;m&&m.add((function(){_=!0,f&&(f.abort(),f=null),a()}));var g=function(){if(!_){var e=function(e,t){o(null==e?void 0:e.statusText,t)},n=t.file||t.url;f=l.loadFile?l.loadFile(i,n,p,r,d,e):i._loadFile(n,p,r,!0,d,e)}},v=i.getEngine(),y=v.enableOfflineSupport;if(y){for(var b=!1,T=0,E=i.disableOfflineSupportExceptionRules;T[0..\").concat(i.repeatKey,\"]\\r\\n\");var n=Ot.IncludesShadersStore[e]+\"\\r\\n\";if(this.sharedData.emitComments&&(n=t+\"\\r\\n\"+n),!i)return n;if(i.replaceStrings)for(var r=0;r[0..\").concat(i.repeatKey,\"]\\r\\n\"):this.functions[r]=\"#include<\".concat(e,\">\\r\\n\"),void(this.sharedData.emitComments&&(this.functions[r]=t+\"\\r\\n\"+this.functions[r]));if(this.functions[r]=Ot.IncludesShadersStore[e],this.sharedData.emitComments&&(this.functions[r]=t+\"\\r\\n\"+this.functions[r]),i.removeIfDef&&(this.functions[r]=this.functions[r].replace(/^\\s*?#ifdef.+$/gm,\"\"),this.functions[r]=this.functions[r].replace(/^\\s*?#endif.*$/gm,\"\"),this.functions[r]=this.functions[r].replace(/^\\s*?#else.*$/gm,\"\"),this.functions[r]=this.functions[r].replace(/^\\s*?#elif.*$/gm,\"\")),i.removeAttributes&&(this.functions[r]=this.functions[r].replace(/^\\s*?attribute.+$/gm,\"\")),i.removeUniforms&&(this.functions[r]=this.functions[r].replace(/^\\s*?uniform.+$/gm,\"\")),i.removeVaryings&&(this.functions[r]=this.functions[r].replace(/^\\s*?varying.+$/gm,\"\")),i.replaceStrings)for(var o=0;o0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"isDirectlyConnectedToVertexOutput\",{get:function(){if(!this.hasEndpoints)return!1;for(var e=0,t=this._endpoints;e=0)&&(t.isExposedOnFrame=!0,t.exposedPortPosition=this.exposedPortPosition),t},e.prototype.dispose=function(){this.onConnectionObservable.clear()},e}(),Xo=function(){function e(e,t,i,n){void 0===t&&(t=Bo.Vertex),void 0===i&&(i=!1),void 0===n&&(n=!1),this._isFinalMerger=!1,this._isInput=!1,this._name=\"\",this._isUnique=!1,this.inputsAreExclusive=!1,this._codeVariableName=\"\",this._inputs=new Array,this._outputs=new Array,this.comments=\"\",this.visibleInInspector=!1,this.visibleOnFrame=!1,this._target=t,this._originalTargetIsNeutral=t===Bo.Neutral,this._isFinalMerger=i,this._isInput=n,this._name=e,this.uniqueId=dn.UniqueId}return Object.defineProperty(e.prototype,\"name\",{get:function(){return this._name},set:function(e){this.validateBlockName(e)&&(this._name=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"isUnique\",{get:function(){return this._isUnique},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"isFinalMerger\",{get:function(){return this._isFinalMerger},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"isInput\",{get:function(){return this._isInput},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"buildId\",{get:function(){return this._buildId},set:function(e){this._buildId=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"target\",{get:function(){return this._target},set:function(e){0==(this._target&e)&&(this._target=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"inputs\",{get:function(){return this._inputs},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"outputs\",{get:function(){return this._outputs},enumerable:!1,configurable:!0}),e.prototype.getInputByName=function(e){var t=this._inputs.filter((function(t){return t.name===e}));return t.length?t[0]:null},e.prototype.getOutputByName=function(e){var t=this._outputs.filter((function(t){return t.name===e}));return t.length?t[0]:null},e.prototype.initialize=function(e){},e.prototype.bind=function(e,t,i,n){},e.prototype._declareOutput=function(e,t){return\"\".concat(t._getGLType(e.type),\" \").concat(e.associatedVariableName)},e.prototype._writeVariable=function(e){return e.connectedPoint?\"\".concat(e.associatedVariableName):\"0.\"},e.prototype._writeFloat=function(e){var t=e.toString();return-1===t.indexOf(\".\")&&(t+=\".0\"),\"\".concat(t)},e.prototype.getClassName=function(){return\"NodeMaterialBlock\"},e.prototype.registerInput=function(e,t,i,n,r){return void 0===i&&(i=!1),(r=null!=r?r:new Ho(e,this,Go.Input)).type=t,r.isOptional=i,n&&(r.target=n),this._inputs.push(r),this},e.prototype.registerOutput=function(e,t,i,n){return(n=null!=n?n:new Ho(e,this,Go.Output)).type=t,i&&(n.target=i),this._outputs.push(n),this},e.prototype.getFirstAvailableInput=function(e){void 0===e&&(e=null);for(var t=0,i=this._inputs;t=this._outputs.length?null:this._outputs[t+1]},e.prototype.isAnAncestorOf=function(e){for(var t=0,i=this._outputs;tthis._maxRank&&(this._maxRank=e),this._defines[e]=new Array),this._defines[e].push(t)},e.prototype.addCPUSkinningFallback=function(e,t){this._mesh=t,ethis._maxRank&&(this._maxRank=e)},Object.defineProperty(e.prototype,\"hasMoreFallbacks\",{get:function(){return this._currentRank<=this._maxRank},enumerable:!1,configurable:!0}),e.prototype.reduce=function(e,t){if(this._mesh&&this._mesh.computeBonesUsingShaders&&this._mesh.numBoneInfluencers>0){this._mesh.computeBonesUsingShaders=!1,e=e.replace(\"#define NUM_BONE_INFLUENCERS \"+this._mesh.numBoneInfluencers,\"#define NUM_BONE_INFLUENCERS 0\"),t._bonesComputationForcedToCPU=!0;for(var i=this._mesh.getScene(),n=0;n0&&(r.computeBonesUsingShaders=!1)}}else{var s=this._defines[this._currentRank];if(s)for(n=0;n0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"size\",{get:function(){return this.width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"width\",{get:function(){return this._size.width||this._size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"height\",{get:function(){return this._size.height||this._size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"layers\",{get:function(){return this._size.layers||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"texture\",{get:function(){var e,t;return null!==(t=null===(e=this._textures)||void 0===e?void 0:e[0])&&void 0!==t?t:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"textures\",{get:function(){return this._textures},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"samples\",{get:function(){return this._samples},enumerable:!1,configurable:!0}),e.prototype.setSamples=function(e,t,i){if(void 0===t&&(t=!0),void 0===i&&(i=!1),this.samples===e&&!i)return e;var n=this._isMulti?this._engine.updateMultipleRenderTargetTextureSampleCount(this,e,t):this._engine.updateRenderTargetTextureSampleCount(this,e);return this._samples=e,n},e.prototype.setTextures=function(e){Array.isArray(e)?this._textures=e:this._textures=e?[e]:null},e.prototype.setTexture=function(e,t,i){void 0===t&&(t=0),void 0===i&&(i=!0),this._textures||(this._textures=[]),this._textures[t]&&i&&this._textures[t].dispose(),this._textures[t]=e},e.prototype.createDepthStencilTexture=function(e,t,i,n,r){var o;return void 0===e&&(e=0),void 0===t&&(t=!0),void 0===i&&(i=!1),void 0===n&&(n=1),void 0===r&&(r=a.TEXTUREFORMAT_DEPTH32_FLOAT),null===(o=this._depthStencilTexture)||void 0===o||o.dispose(),this._depthStencilTextureWithStencil=i,this._depthStencilTexture=this._engine.createDepthStencilTexture(this._size,{bilinearFiltering:t,comparisonFunction:e,generateStencil:i,isCube:this._isCube,samples:n,depthTextureFormat:r},this),this._depthStencilTexture},e.prototype._shareDepth=function(e){this._depthStencilTexture&&(e._depthStencilTexture&&e._depthStencilTexture.dispose(),e._depthStencilTexture=this._depthStencilTexture,this._depthStencilTexture.incrementReferences())},e.prototype._swapAndDie=function(e){this.texture&&this.texture._swapAndDie(e),this._textures=null,this.dispose(!0)},e.prototype._cloneRenderTargetWrapper=function(){var e,t,i,n,r,o,a=null;if(this._isMulti){var s=this.textures;if(s&&s.length>0){var l=!1,c=s.length,u=s[s.length-1]._source;u!==Rt.Depth&&u!==Rt.DepthStencil||(l=!0,c--);for(var h=[],d=[],p=0;p1&&e.setSamples(this.samples),e._swapRenderTargetWrapper(this),e.dispose()}},e.prototype.releaseTextures=function(){var e,t;if(this._textures)for(var i=0;null!==(t=i<(null===(e=this._textures)||void 0===e?void 0:e.length))&&void 0!==t&&t;++i)this._textures[i].dispose();this._textures=null},e.prototype.dispose=function(e){var t;void 0===e&&(e=!1),e||(null===(t=this._depthStencilTexture)||void 0===t||t.dispose(),this._depthStencilTexture=null,this.releaseTextures()),this._engine._releaseRenderTargetWrapper(this)},e}(),da=function(e){function t(t,i,n,r,o){var a=e.call(this,t,i,n,r)||this;return a._framebuffer=null,a._depthStencilBuffer=null,a._MSAAFramebuffer=null,a._colorTextureArray=null,a._depthStencilTextureArray=null,a._context=o,a}return V(t,e),t.prototype._cloneRenderTargetWrapper=function(){var t=null;return this._colorTextureArray&&this._depthStencilTextureArray?(t=this._engine.createMultiviewRenderTargetTexture(this.width,this.height)).texture.isReady=!0:t=e.prototype._cloneRenderTargetWrapper.call(this),t},t.prototype._swapRenderTargetWrapper=function(t){e.prototype._swapRenderTargetWrapper.call(this,t),t._framebuffer=this._framebuffer,t._depthStencilBuffer=this._depthStencilBuffer,t._MSAAFramebuffer=this._MSAAFramebuffer,t._colorTextureArray=this._colorTextureArray,t._depthStencilTextureArray=this._depthStencilTextureArray,this._framebuffer=this._depthStencilBuffer=this._MSAAFramebuffer=this._colorTextureArray=this._depthStencilTextureArray=null},t.prototype._shareDepth=function(t){e.prototype._shareDepth.call(this,t);var i=this._context,n=this._depthStencilBuffer,r=t._MSAAFramebuffer||t._framebuffer;t._depthStencilBuffer&&i.deleteRenderbuffer(t._depthStencilBuffer),t._depthStencilBuffer=this._depthStencilBuffer,this._engine._bindUnboundFramebuffer(r),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,n),this._engine._bindUnboundFramebuffer(null)},t.prototype._bindTextureRenderTarget=function(e,t,i,n){if(void 0===t&&(t=0),void 0===i&&(i=-1),void 0===n&&(n=0),e._hardwareTexture){var r=this._context,o=this._framebuffer,a=this._engine._currentFramebuffer;this._engine._bindUnboundFramebuffer(o);var s=r[this._engine.webGLVersion>1?\"COLOR_ATTACHMENT\"+t:\"COLOR_ATTACHMENT\"+t+\"_WEBGL\"],l=-1!==i?r.TEXTURE_CUBE_MAP_POSITIVE_X+i:r.TEXTURE_2D;r.framebufferTexture2D(r.FRAMEBUFFER,s,l,e._hardwareTexture.underlyingResource,n),this._engine._bindUnboundFramebuffer(a)}},t.prototype.setTexture=function(t,i,n){void 0===i&&(i=0),void 0===n&&(n=!0),e.prototype.setTexture.call(this,t,i,n),this._bindTextureRenderTarget(t,i)},t.prototype.dispose=function(t){void 0===t&&(t=!1);var i=this._context;t||(this._colorTextureArray&&(this._context.deleteTexture(this._colorTextureArray),this._colorTextureArray=null),this._depthStencilTextureArray&&(this._context.deleteTexture(this._depthStencilTextureArray),this._depthStencilTextureArray=null)),this._framebuffer&&(i.deleteFramebuffer(this._framebuffer),this._framebuffer=null),this._depthStencilBuffer&&(i.deleteRenderbuffer(this._depthStencilBuffer),this._depthStencilBuffer=null),this._MSAAFramebuffer&&(i.deleteFramebuffer(this._MSAAFramebuffer),this._MSAAFramebuffer=null),e.prototype.dispose.call(this,t)},t}(ha);Yt.prototype._createHardwareRenderTargetWrapper=function(e,t,i){var n=new da(e,t,i,this,this._gl);return this._renderTargetWrapperCache.push(n),n},Yt.prototype.createRenderTargetTexture=function(e,t){var i=this._createHardwareRenderTargetWrapper(!1,!1,e),n={};void 0!==t&&\"object\"==typeof t?(n.generateDepthBuffer=!!t.generateDepthBuffer,n.generateStencilBuffer=!!t.generateStencilBuffer,n.noColorTarget=!!t.noColorTarget):(n.generateDepthBuffer=!0,n.generateStencilBuffer=!1,n.noColorTarget=!1);var r=n.noColorTarget?null:this._createInternalTexture(e,t,!0,Rt.RenderTarget),o=e.width||e,a=e.height||e,s=this._currentFramebuffer,l=this._gl,c=l.createFramebuffer();return this._bindUnboundFramebuffer(c),i._depthStencilBuffer=this._setupFramebufferDepthAttachments(!!n.generateStencilBuffer,n.generateDepthBuffer,o,a),r&&!r.is2DArray&&l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,l.TEXTURE_2D,r._hardwareTexture.underlyingResource,0),this._bindUnboundFramebuffer(s),i._framebuffer=c,i._generateDepthBuffer=n.generateDepthBuffer,i._generateStencilBuffer=!!n.generateStencilBuffer,i.setTextures(r),i},Yt.prototype.createDepthStencilTexture=function(e,t,i){if(t.isCube){var n=e.width||e;return this._createDepthStencilCubeTexture(n,t,i)}return this._createDepthStencilTexture(e,t,i)},Yt.prototype._createDepthStencilTexture=function(e,t,i){var n=this._gl,r=e.layers||0,o=0!==r?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D,s=new wt(this,Rt.DepthStencil);if(!this._caps.depthTextureExtension)return Q.Error(\"Depth texture is not supported by your browser or hardware.\"),s;var l=k({bilinearFiltering:!1,comparisonFunction:0,generateStencil:!1},t);if(this._bindTextureDirectly(o,s,!0),this._setupDepthStencilTexture(s,e,l.generateStencil,0!==l.comparisonFunction&&l.bilinearFiltering,l.comparisonFunction),void 0!==l.depthTextureFormat){if(l.depthTextureFormat!==a.TEXTUREFORMAT_DEPTH16&&l.depthTextureFormat!==a.TEXTUREFORMAT_DEPTH24&&l.depthTextureFormat!==a.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8&&l.depthTextureFormat!==a.TEXTUREFORMAT_DEPTH24_STENCIL8&&l.depthTextureFormat!==a.TEXTUREFORMAT_DEPTH32_FLOAT&&l.depthTextureFormat!==a.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8)return Q.Error(\"Depth texture format is not supported.\"),s;s.format=l.depthTextureFormat}else s.format=l.generateStencil?a.TEXTUREFORMAT_DEPTH24_STENCIL8:a.TEXTUREFORMAT_DEPTH24;var c=s.format===a.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8||s.format===a.TEXTUREFORMAT_DEPTH24_STENCIL8||s.format===a.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8;i._depthStencilTexture=s,i._depthStencilTextureWithStencil=c;var u=n.UNSIGNED_INT;s.format===a.TEXTUREFORMAT_DEPTH16?u=n.UNSIGNED_SHORT:s.format===a.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8||s.format===a.TEXTUREFORMAT_DEPTH24_STENCIL8?u=n.UNSIGNED_INT_24_8:s.format===a.TEXTUREFORMAT_DEPTH32_FLOAT?u=n.FLOAT:s.format===a.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8&&(u=n.FLOAT_32_UNSIGNED_INT_24_8_REV);var h=c?n.DEPTH_STENCIL:n.DEPTH_COMPONENT,d=h;this.webGLVersion>1&&(s.format===a.TEXTUREFORMAT_DEPTH16?d=n.DEPTH_COMPONENT16:s.format===a.TEXTUREFORMAT_DEPTH24?d=n.DEPTH_COMPONENT24:s.format===a.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8||s.format===a.TEXTUREFORMAT_DEPTH24_STENCIL8?d=n.DEPTH24_STENCIL8:s.format===a.TEXTUREFORMAT_DEPTH32_FLOAT?d=n.DEPTH_COMPONENT32F:s.format===a.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8&&(d=n.DEPTH32F_STENCIL8)),s.is2DArray?n.texImage3D(o,0,d,s.width,s.height,r,0,h,u,null):n.texImage2D(o,0,d,s.width,s.height,0,h,u,null),this._bindTextureDirectly(o,null),this._internalTexturesCache.push(s);var p=i;if(p._depthStencilBuffer){var f=this._currentFramebuffer;this._bindUnboundFramebuffer(p._framebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,null),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,null),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.STENCIL_ATTACHMENT,n.RENDERBUFFER,null),this._bindUnboundFramebuffer(f),n.deleteRenderbuffer(p._depthStencilBuffer),p._depthStencilBuffer=null}return s},Yt.prototype.updateRenderTargetTextureSampleCount=function(e,t){if(this.webGLVersion<2||!e||!e.texture)return 1;if(e.samples===t)return t;var i=this._gl;t=Math.min(t,this.getCaps().maxMSAASamples),e._depthStencilBuffer&&(i.deleteRenderbuffer(e._depthStencilBuffer),e._depthStencilBuffer=null),e._MSAAFramebuffer&&(i.deleteFramebuffer(e._MSAAFramebuffer),e._MSAAFramebuffer=null);var n=e.texture._hardwareTexture;if(n._MSAARenderBuffer&&(i.deleteRenderbuffer(n._MSAARenderBuffer),n._MSAARenderBuffer=null),t>1&&i.renderbufferStorageMultisample){var r=i.createFramebuffer();if(!r)throw new Error(\"Unable to create multi sampled framebuffer\");e._MSAAFramebuffer=r,this._bindUnboundFramebuffer(e._MSAAFramebuffer);var o=this._createRenderBuffer(e.texture.width,e.texture.height,t,-1,this._getRGBAMultiSampleBufferFormat(e.texture.type),i.COLOR_ATTACHMENT0,!1);if(!o)throw new Error(\"Unable to create multi sampled framebuffer\");n._MSAARenderBuffer=o}else this._bindUnboundFramebuffer(e._framebuffer);return e.texture.samples=t,e._depthStencilBuffer=this._setupFramebufferDepthAttachments(e._generateStencilBuffer,e._generateDepthBuffer,e.texture.width,e.texture.height,t),this._bindUnboundFramebuffer(null),t};var pa=function(){function e(e,t,i,n,r,o,s,l,c,h,d,p,f,_,m){void 0===s&&(s=a.TEXTURE_NEAREST_SAMPLINGMODE),void 0===h&&(h=null),void 0===d&&(d=a.TEXTURETYPE_UNSIGNED_INT),void 0===p&&(p=\"postprocess\"),void 0===_&&(_=!1),void 0===m&&(m=a.TEXTUREFORMAT_RGBA),this._parentContainer=null,this.width=-1,this.height=-1,this.nodeMaterialSource=null,this._outputTexture=null,this.autoClear=!0,this.alphaMode=a.ALPHA_DISABLE,this.animations=new Array,this.enablePixelPerfectMode=!1,this.forceFullscreenViewport=!0,this.scaleMode=a.SCALEMODE_FLOOR,this.alwaysForcePOT=!1,this._samples=1,this.adaptScaleToCurrentViewport=!1,this._reusable=!1,this._renderId=0,this.externalTextureSamplerBinding=!1,this._textures=new yi(2),this._textureCache=[],this._currentRenderTextureInd=0,this._scaleRatio=new R(1,1),this._texelSize=R.Zero(),this.onActivateObservable=new u,this.onSizeChangedObservable=new u,this.onApplyObservable=new u,this.onBeforeRenderObservable=new u,this.onAfterRenderObservable=new u,this.name=e,null!=o?(this._camera=o,this._scene=o.getScene(),o.attachPostProcess(this),this._engine=this._scene.getEngine(),this._scene.postProcesses.push(this),this.uniqueId=this._scene.getUniqueId()):l&&(this._engine=l,this._engine.postProcesses.push(this)),this._options=r,this.renderTargetSamplingMode=s||a.TEXTURE_NEAREST_SAMPLINGMODE,this._reusable=c||!1,this._textureType=d,this._textureFormat=m,this._samplers=n||[],this._samplers.push(\"textureSampler\"),this._fragmentUrl=t,this._vertexUrl=p,this._parameters=i||[],this._parameters.push(\"scale\"),this._indexParameters=f,this._drawWrapper=new Ht(this._engine),_||this.updateEffect(h)}return Object.defineProperty(e.prototype,\"samples\",{get:function(){return this._samples},set:function(e){var t=this;this._samples=Math.min(e,this._engine.getCaps().maxMSAASamples),this._textures.forEach((function(e){e.samples!==t._samples&&t._engine.updateRenderTargetTextureSampleCount(e,t._samples)}))},enumerable:!1,configurable:!0}),e.prototype.getEffectName=function(){return this._fragmentUrl},Object.defineProperty(e.prototype,\"onActivate\",{set:function(e){this._onActivateObserver&&this.onActivateObservable.remove(this._onActivateObserver),e&&(this._onActivateObserver=this.onActivateObservable.add(e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"onSizeChanged\",{set:function(e){this._onSizeChangedObserver&&this.onSizeChangedObservable.remove(this._onSizeChangedObserver),this._onSizeChangedObserver=this.onSizeChangedObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"onApply\",{set:function(e){this._onApplyObserver&&this.onApplyObservable.remove(this._onApplyObserver),this._onApplyObserver=this.onApplyObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"onBeforeRender\",{set:function(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"onAfterRender\",{set:function(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),this._onAfterRenderObserver=this.onAfterRenderObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"inputTexture\",{get:function(){return this._textures.data[this._currentRenderTextureInd]},set:function(e){this._forcedOutputTexture=e},enumerable:!1,configurable:!0}),e.prototype.restoreDefaultInputTexture=function(){this._forcedOutputTexture&&(this._forcedOutputTexture=null,this.markTextureDirty())},e.prototype.getCamera=function(){return this._camera},Object.defineProperty(e.prototype,\"texelSize\",{get:function(){return this._shareOutputWithPostProcess?this._shareOutputWithPostProcess.texelSize:(this._forcedOutputTexture&&this._texelSize.copyFromFloats(1/this._forcedOutputTexture.width,1/this._forcedOutputTexture.height),this._texelSize)},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return\"PostProcess\"},e.prototype.getEngine=function(){return this._engine},e.prototype.getEffect=function(){return this._drawWrapper.effect},e.prototype.shareOutputWith=function(e){return this._disposeTextures(),this._shareOutputWithPostProcess=e,this},e.prototype.useOwnOutput=function(){0==this._textures.length&&(this._textures=new yi(2)),this._shareOutputWithPostProcess=null},e.prototype.updateEffect=function(e,t,i,n,r,o,a,s){void 0===e&&(e=null),void 0===t&&(t=null),void 0===i&&(i=null),this._postProcessDefines=e,this._drawWrapper.effect=this._engine.createEffect({vertex:null!=a?a:this._vertexUrl,fragment:null!=s?s:this._fragmentUrl},[\"position\"],t||this._parameters,i||this._samplers,null!==e?e:\"\",void 0,r,o,n||this._indexParameters)},e.prototype.isReusable=function(){return this._reusable},e.prototype.markTextureDirty=function(){this.width=-1},e.prototype._createRenderTargetTexture=function(e,t,i){void 0===i&&(i=0);for(var n=0;n=0;t--)if(e-this._textureCache[t].lastUsedRenderId>100){for(var i=!1,n=0;n0&&this._textures.reset(),this.width=e,this.height=t;for(var o=null,a=0;a=0;e--)this._textureCache[e].texture.dispose();this._textureCache.length=0},e.prototype.setPrePassRenderer=function(e){return!!this._prePassEffectConfiguration&&(this._prePassEffectConfiguration=e.addEffectConfiguration(this._prePassEffectConfiguration),this._prePassEffectConfiguration.enabled=!0,!0)},e.prototype.dispose=function(e){var t;if(e=e||this._camera,this._disposeTextures(),this._scene&&-1!==(t=this._scene.postProcesses.indexOf(this))&&this._scene.postProcesses.splice(t,1),this._parentContainer){var i=this._parentContainer.postProcesses.indexOf(this);i>-1&&this._parentContainer.postProcesses.splice(i,1),this._parentContainer=null}if(-1!==(t=this._engine.postProcesses.indexOf(this))&&this._engine.postProcesses.splice(t,1),e){if(e.detachPostProcess(this),0===(t=e._postProcesses.indexOf(this))&&e._postProcesses.length>0){var n=this._camera._getFirstPostProcess();n&&n.markTextureDirty()}this.onActivateObservable.clear(),this.onAfterRenderObservable.clear(),this.onApplyObservable.clear(),this.onBeforeRenderObservable.clear(),this.onSizeChangedObservable.clear()}},e.prototype.serialize=function(){var e=Le.Serialize(this),t=this.getCamera()||this._scene&&this._scene.activeCamera;return e.customType=\"BABYLON.\"+this.getClassName(),e.cameraId=t?t.id:null,e.reusable=this._reusable,e.textureType=this._textureType,e.fragmentUrl=this._fragmentUrl,e.parameters=this._parameters,e.samplers=this._samplers,e.options=this._options,e.defines=this._postProcessDefines,e.textureFormat=this._textureFormat,e.vertexUrl=this._vertexUrl,e.indexParameters=this._indexParameters,e},e.prototype.clone=function(){var t=this.serialize();t._engine=this._engine,t.cameraId=null;var i=e.Parse(t,this._scene,\"\");return i?(i.onActivateObservable=this.onActivateObservable.clone(),i.onSizeChangedObservable=this.onSizeChangedObservable.clone(),i.onApplyObservable=this.onApplyObservable.clone(),i.onBeforeRenderObservable=this.onBeforeRenderObservable.clone(),i.onAfterRenderObservable=this.onAfterRenderObservable.clone(),i._prePassEffectConfiguration=this._prePassEffectConfiguration,i):null},e.Parse=function(e,t,i){var n=T(e.customType);if(!n||!n._Parse)return null;var r=t?t.getCameraById(e.cameraId):null;return n._Parse(e,r,t,i)},e._Parse=function(t,i,n,r){return Le.Parse((function(){return new e(t.name,t.fragmentUrl,t.parameters,t.samplers,t.options,i,t.renderTargetSamplingMode,t._engine,t.reusable,t.defines,t.textureType,t.vertexUrl,t.indexParameters,!1,t.textureFormat)}),t,n,r)},G([be()],e.prototype,\"uniqueId\",void 0),G([be()],e.prototype,\"name\",void 0),G([be()],e.prototype,\"width\",void 0),G([be()],e.prototype,\"height\",void 0),G([be()],e.prototype,\"renderTargetSamplingMode\",void 0),G([Pe()],e.prototype,\"clearColor\",void 0),G([be()],e.prototype,\"autoClear\",void 0),G([be()],e.prototype,\"alphaMode\",void 0),G([be()],e.prototype,\"alphaConstants\",void 0),G([be()],e.prototype,\"enablePixelPerfectMode\",void 0),G([be()],e.prototype,\"forceFullscreenViewport\",void 0),G([be()],e.prototype,\"scaleMode\",void 0),G([be()],e.prototype,\"alwaysForcePOT\",void 0),G([be(\"samples\")],e.prototype,\"_samples\",void 0),G([be()],e.prototype,\"adaptScaleToCurrentViewport\",void 0),e}();b(\"BABYLON.PostProcess\",pa);var fa=function(e){function t(t){var i=e.call(this,t,Bo.Neutral)||this;return i.xSwizzle=\"x\",i.ySwizzle=\"y\",i.zSwizzle=\"z\",i.wSwizzle=\"w\",i.registerInput(\"xyzw \",wo.Vector4,!0),i.registerInput(\"xyz \",wo.Vector3,!0),i.registerInput(\"xy \",wo.Vector2,!0),i.registerInput(\"zw \",wo.Vector2,!0),i.registerInput(\"x\",wo.Float,!0),i.registerInput(\"y\",wo.Float,!0),i.registerInput(\"z\",wo.Float,!0),i.registerInput(\"w\",wo.Float,!0),i.registerOutput(\"xyzw\",wo.Vector4),i.registerOutput(\"xyz\",wo.Vector3),i.registerOutput(\"xy\",wo.Vector2),i.registerOutput(\"zw\",wo.Vector2),i}return V(t,e),t.prototype.getClassName=function(){return\"VectorMergerBlock\"},Object.defineProperty(t.prototype,\"xyzwIn\",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"xyzIn\",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"xyIn\",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"zwIn\",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"x\",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"y\",{get:function(){return this._inputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"z\",{get:function(){return this._inputs[6]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"w\",{get:function(){return this._inputs[7]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"xyzw\",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"xyzOut\",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"xyOut\",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"zwOut\",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"xy\",{get:function(){return this.xyOut},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"xyz\",{get:function(){return this.xyzOut},enumerable:!1,configurable:!0}),t.prototype._inputRename=function(e){return\"xyzw \"===e?\"xyzwIn\":\"xyz \"===e?\"xyzIn\":\"xy \"===e?\"xyIn\":\"zw \"===e?\"zwIn\":e},t.prototype._buildSwizzle=function(e){return\".\"+(this.xSwizzle+this.ySwizzle+this.zSwizzle+this.wSwizzle).substr(0,e)},t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t);var i=this.x,n=this.y,r=this.z,o=this.w,a=this.xyIn,s=this.zwIn,l=this.xyzIn,c=this.xyzwIn,u=this._outputs[0],h=this._outputs[1],d=this._outputs[2],p=this._outputs[3];return c.isConnected?(u.hasEndpoints&&(t.compilationString+=this._declareOutput(u,t)+\" = \".concat(c.associatedVariableName).concat(this._buildSwizzle(4),\";\\r\\n\")),h.hasEndpoints&&(t.compilationString+=this._declareOutput(h,t)+\" = \".concat(c.associatedVariableName).concat(this._buildSwizzle(3),\";\\r\\n\")),d.hasEndpoints&&(t.compilationString+=this._declareOutput(d,t)+\" = \".concat(c.associatedVariableName).concat(this._buildSwizzle(2),\";\\r\\n\"))):l.isConnected?(u.hasEndpoints&&(t.compilationString+=this._declareOutput(u,t)+\" = vec4(\".concat(l.associatedVariableName,\", \").concat(o.isConnected?this._writeVariable(o):\"0.0\",\")\").concat(this._buildSwizzle(4),\";\\r\\n\")),h.hasEndpoints&&(t.compilationString+=this._declareOutput(h,t)+\" = \".concat(l.associatedVariableName).concat(this._buildSwizzle(3),\";\\r\\n\")),d.hasEndpoints&&(t.compilationString+=this._declareOutput(d,t)+\" = \".concat(l.associatedVariableName).concat(this._buildSwizzle(2),\";\\r\\n\"))):a.isConnected?(u.hasEndpoints&&(s.isConnected?t.compilationString+=this._declareOutput(u,t)+\" = vec4(\".concat(a.associatedVariableName,\", \").concat(s.associatedVariableName,\")\").concat(this._buildSwizzle(4),\";\\r\\n\"):t.compilationString+=this._declareOutput(u,t)+\" = vec4(\".concat(a.associatedVariableName,\", \").concat(r.isConnected?this._writeVariable(r):\"0.0\",\", \").concat(o.isConnected?this._writeVariable(o):\"0.0\",\")\").concat(this._buildSwizzle(4),\";\\r\\n\")),h.hasEndpoints&&(t.compilationString+=this._declareOutput(h,t)+\" = vec3(\".concat(a.associatedVariableName,\", \").concat(r.isConnected?this._writeVariable(r):\"0.0\",\")\").concat(this._buildSwizzle(3),\";\\r\\n\")),d.hasEndpoints&&(t.compilationString+=this._declareOutput(d,t)+\" = \".concat(a.associatedVariableName).concat(this._buildSwizzle(2),\";\\r\\n\")),p.hasEndpoints&&(s.isConnected?t.compilationString+=this._declareOutput(p,t)+\" = \".concat(s.associatedVariableName).concat(this._buildSwizzle(2),\";\\r\\n\"):t.compilationString+=this._declareOutput(p,t)+\" = vec2(\".concat(r.isConnected?this._writeVariable(r):\"0.0\",\", \").concat(o.isConnected?this._writeVariable(o):\"0.0\",\")\").concat(this._buildSwizzle(2),\";\\r\\n\"))):(u.hasEndpoints&&(s.isConnected?t.compilationString+=this._declareOutput(u,t)+\" = vec4(\".concat(i.isConnected?this._writeVariable(i):\"0.0\",\", \").concat(n.isConnected?this._writeVariable(n):\"0.0\",\", \").concat(s.associatedVariableName,\")\").concat(this._buildSwizzle(4),\";\\r\\n\"):t.compilationString+=this._declareOutput(u,t)+\" = vec4(\".concat(i.isConnected?this._writeVariable(i):\"0.0\",\", \").concat(n.isConnected?this._writeVariable(n):\"0.0\",\", \").concat(r.isConnected?this._writeVariable(r):\"0.0\",\", \").concat(o.isConnected?this._writeVariable(o):\"0.0\",\")\").concat(this._buildSwizzle(4),\";\\r\\n\")),h.hasEndpoints&&(t.compilationString+=this._declareOutput(h,t)+\" = vec3(\".concat(i.isConnected?this._writeVariable(i):\"0.0\",\", \").concat(n.isConnected?this._writeVariable(n):\"0.0\",\", \").concat(r.isConnected?this._writeVariable(r):\"0.0\",\")\").concat(this._buildSwizzle(3),\";\\r\\n\")),d.hasEndpoints&&(t.compilationString+=this._declareOutput(d,t)+\" = vec2(\".concat(i.isConnected?this._writeVariable(i):\"0.0\",\", \").concat(n.isConnected?this._writeVariable(n):\"0.0\",\")\").concat(this._buildSwizzle(2),\";\\r\\n\")),p.hasEndpoints&&(s.isConnected?t.compilationString+=this._declareOutput(p,t)+\" = \".concat(s.associatedVariableName).concat(this._buildSwizzle(2),\";\\r\\n\"):t.compilationString+=this._declareOutput(p,t)+\" = vec2(\".concat(r.isConnected?this._writeVariable(r):\"0.0\",\", \").concat(o.isConnected?this._writeVariable(o):\"0.0\",\")\").concat(this._buildSwizzle(2),\";\\r\\n\"))),this},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.xSwizzle=this.xSwizzle,t.ySwizzle=this.ySwizzle,t.zSwizzle=this.zSwizzle,t.wSwizzle=this.wSwizzle,t},t.prototype._deserialize=function(t,i,n){var r,o,a,s;e.prototype._deserialize.call(this,t,i,n),this.xSwizzle=null!==(r=t.xSwizzle)&&void 0!==r?r:\"x\",this.ySwizzle=null!==(o=t.ySwizzle)&&void 0!==o?o:\"y\",this.zSwizzle=null!==(a=t.zSwizzle)&&void 0!==a?a:\"z\",this.wSwizzle=null!==(s=t.wSwizzle)&&void 0!==s?s:\"w\"},t.prototype._dumpPropertiesCode=function(){var t=e.prototype._dumpPropertiesCode.call(this);return t+=\"\".concat(this._codeVariableName,'.xSwizzle = \"').concat(this.xSwizzle,'\";\\r\\n'),t+=\"\".concat(this._codeVariableName,'.ySwizzle = \"').concat(this.ySwizzle,'\";\\r\\n'),(t+=\"\".concat(this._codeVariableName,'.zSwizzle = \"').concat(this.zSwizzle,'\";\\r\\n'))+\"\".concat(this._codeVariableName,'.wSwizzle = \"').concat(this.wSwizzle,'\";\\r\\n')},t}(Xo);b(\"BABYLON.VectorMergerBlock\",fa);var _a=function(e){function t(t){var i=e.call(this,t,Bo.Neutral)||this;return i.sourceRange=new R(-1,1),i.targetRange=new R(0,1),i.registerInput(\"input\",wo.AutoDetect),i.registerInput(\"sourceMin\",wo.Float,!0),i.registerInput(\"sourceMax\",wo.Float,!0),i.registerInput(\"targetMin\",wo.Float,!0),i.registerInput(\"targetMax\",wo.Float,!0),i.registerOutput(\"output\",wo.BasedOnInput),i._outputs[0]._typeConnectionSource=i._inputs[0],i}return V(t,e),t.prototype.getClassName=function(){return\"RemapBlock\"},Object.defineProperty(t.prototype,\"input\",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"sourceMin\",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"sourceMax\",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"targetMin\",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"targetMax\",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"output\",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t);var i=this._outputs[0],n=this.sourceMin.isConnected?this.sourceMin.associatedVariableName:this._writeFloat(this.sourceRange.x),r=this.sourceMax.isConnected?this.sourceMax.associatedVariableName:this._writeFloat(this.sourceRange.y),o=this.targetMin.isConnected?this.targetMin.associatedVariableName:this._writeFloat(this.targetRange.x),a=this.targetMax.isConnected?this.targetMax.associatedVariableName:this._writeFloat(this.targetRange.y);return t.compilationString+=this._declareOutput(i,t)+\" = \".concat(o,\" + (\").concat(this._inputs[0].associatedVariableName,\" - \").concat(n,\") * (\").concat(a,\" - \").concat(o,\") / (\").concat(r,\" - \").concat(n,\");\\r\\n\"),this},t.prototype._dumpPropertiesCode=function(){return e.prototype._dumpPropertiesCode.call(this)+\"\".concat(this._codeVariableName,\".sourceRange = new BABYLON.Vector2(\").concat(this.sourceRange.x,\", \").concat(this.sourceRange.y,\");\\r\\n\")+\"\".concat(this._codeVariableName,\".targetRange = new BABYLON.Vector2(\").concat(this.targetRange.x,\", \").concat(this.targetRange.y,\");\\r\\n\")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.sourceRange=this.sourceRange.asArray(),t.targetRange=this.targetRange.asArray(),t},t.prototype._deserialize=function(t,i,n){e.prototype._deserialize.call(this,t,i,n),this.sourceRange=R.FromArray(t.sourceRange),this.targetRange=R.FromArray(t.targetRange)},G([Qo(\"From\",Yo.Vector2)],t.prototype,\"sourceRange\",void 0),G([Qo(\"To\",Yo.Vector2)],t.prototype,\"targetRange\",void 0),t}(Xo);b(\"BABYLON.RemapBlock\",_a);var ma,ga=function(e){function t(t){var i=e.call(this,t,Bo.Neutral)||this;return i.registerInput(\"left\",wo.AutoDetect),i.registerInput(\"right\",wo.AutoDetect),i.registerOutput(\"output\",wo.BasedOnInput),i._outputs[0]._typeConnectionSource=i._inputs[0],i._linkConnectionTypes(0,1),i}return V(t,e),t.prototype.getClassName=function(){return\"MultiplyBlock\"},Object.defineProperty(t.prototype,\"left\",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"right\",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"output\",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t);var i=this._outputs[0];return t.compilationString+=this._declareOutput(i,t)+\" = \".concat(this.left.associatedVariableName,\" * \").concat(this.right.associatedVariableName,\";\\r\\n\"),this},t}(Xo);b(\"BABYLON.MultiplyBlock\",ga),function(e){e[e.Material=0]=\"Material\",e[e.PostProcess=1]=\"PostProcess\",e[e.Particle=2]=\"Particle\",e[e.ProceduralTexture=3]=\"ProceduralTexture\"}(ma||(ma={}));var va=function(){function e(){this.direction1=new x(0,1,0),this.direction2=new x(0,1,0),this.minEmitBox=new x(-.5,-.5,-.5),this.maxEmitBox=new x(.5,.5,.5)}return e.prototype.startDirectionFunction=function(e,t,i,n){var r=h.RandomRange(this.direction1.x,this.direction2.x),o=h.RandomRange(this.direction1.y,this.direction2.y),a=h.RandomRange(this.direction1.z,this.direction2.z);if(n)return t.x=r,t.y=o,void(t.z=a);x.TransformNormalFromFloatsToRef(r,o,a,e,t)},e.prototype.startPositionFunction=function(e,t,i,n){var r=h.RandomRange(this.minEmitBox.x,this.maxEmitBox.x),o=h.RandomRange(this.minEmitBox.y,this.maxEmitBox.y),a=h.RandomRange(this.minEmitBox.z,this.maxEmitBox.z);if(n)return t.x=r,t.y=o,void(t.z=a);x.TransformCoordinatesFromFloatsToRef(r,o,a,e,t)},e.prototype.clone=function(){var t=new e;return se.DeepCopy(this,t),t},e.prototype.applyToShader=function(e){e.setVector3(\"direction1\",this.direction1),e.setVector3(\"direction2\",this.direction2),e.setVector3(\"minEmitBox\",this.minEmitBox),e.setVector3(\"maxEmitBox\",this.maxEmitBox)},e.prototype.buildUniformLayout=function(e){e.addUniform(\"direction1\",3),e.addUniform(\"direction2\",3),e.addUniform(\"minEmitBox\",3),e.addUniform(\"maxEmitBox\",3)},e.prototype.getEffectDefines=function(){return\"#define BOXEMITTER\"},e.prototype.getClassName=function(){return\"BoxParticleEmitter\"},e.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.direction1=this.direction1.asArray(),e.direction2=this.direction2.asArray(),e.minEmitBox=this.minEmitBox.asArray(),e.maxEmitBox=this.maxEmitBox.asArray(),e},e.prototype.parse=function(e){x.FromArrayToRef(e.direction1,0,this.direction1),x.FromArrayToRef(e.direction2,0,this.direction2),x.FromArrayToRef(e.minEmitBox,0,this.minEmitBox),x.FromArrayToRef(e.maxEmitBox,0,this.maxEmitBox)},e}(),ya=function(){function e(e,t,i){void 0===e&&(e=1),void 0===t&&(t=Math.PI),void 0===i&&(i=0),this.directionRandomizer=i,this.radiusRange=1,this.heightRange=1,this.emitFromSpawnPointOnly=!1,this.angle=t,this.radius=e}return Object.defineProperty(e.prototype,\"radius\",{get:function(){return this._radius},set:function(e){this._radius=e,this._buildHeight()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"angle\",{get:function(){return this._angle},set:function(e){this._angle=e,this._buildHeight()},enumerable:!1,configurable:!0}),e.prototype._buildHeight=function(){0!==this._angle?this._height=this._radius/Math.tan(this._angle/2):this._height=1},e.prototype.startDirectionFunction=function(e,t,i,n){n?O.Vector3[0].copyFrom(i._localPosition).normalize():i.position.subtractToRef(e.getTranslation(),O.Vector3[0]).normalize();var r=h.RandomRange(0,this.directionRandomizer),o=h.RandomRange(0,this.directionRandomizer),a=h.RandomRange(0,this.directionRandomizer);t.x=O.Vector3[0].x+r,t.y=O.Vector3[0].y+o,t.z=O.Vector3[0].z+a,t.normalize()},e.prototype.startPositionFunction=function(e,t,i,n){var r,o=h.RandomRange(0,2*Math.PI);r=this.emitFromSpawnPointOnly?1e-4:1-(r=h.RandomRange(0,this.heightRange))*r;var a=this._radius-h.RandomRange(0,this._radius*this.radiusRange),s=(a*=r)*Math.sin(o),l=a*Math.cos(o),c=r*this._height;if(n)return t.x=s,t.y=c,void(t.z=l);x.TransformCoordinatesFromFloatsToRef(s,c,l,e,t)},e.prototype.clone=function(){var t=new e(this._radius,this._angle,this.directionRandomizer);return se.DeepCopy(this,t),t},e.prototype.applyToShader=function(e){e.setFloat2(\"radius\",this._radius,this.radiusRange),e.setFloat(\"coneAngle\",this._angle),e.setFloat2(\"height\",this._height,this.heightRange),e.setFloat(\"directionRandomizer\",this.directionRandomizer)},e.prototype.buildUniformLayout=function(e){e.addUniform(\"radius\",2),e.addUniform(\"coneAngle\",1),e.addUniform(\"height\",2),e.addUniform(\"directionRandomizer\",1)},e.prototype.getEffectDefines=function(){var e=\"#define CONEEMITTER\";return this.emitFromSpawnPointOnly&&(e+=\"\\n#define CONEEMITTERSPAWNPOINT\"),e},e.prototype.getClassName=function(){return\"ConeParticleEmitter\"},e.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.radius=this._radius,e.angle=this._angle,e.directionRandomizer=this.directionRandomizer,e.radiusRange=this.radiusRange,e.heightRange=this.heightRange,e.emitFromSpawnPointOnly=this.emitFromSpawnPointOnly,e},e.prototype.parse=function(e){this.radius=e.radius,this.angle=e.angle,this.directionRandomizer=e.directionRandomizer,this.radiusRange=void 0!==e.radiusRange?e.radiusRange:1,this.heightRange=void 0!==e.radiusRange?e.heightRange:1,this.emitFromSpawnPointOnly=void 0!==e.emitFromSpawnPointOnly&&e.emitFromSpawnPointOnly},e}(),ba=function(){function e(e,t,i,n){void 0===e&&(e=1),void 0===t&&(t=1),void 0===i&&(i=1),void 0===n&&(n=0),this.radius=e,this.height=t,this.radiusRange=i,this.directionRandomizer=n,this._tempVector=x.Zero()}return e.prototype.startDirectionFunction=function(e,t,i,n,r){i.position.subtractToRef(e.getTranslation(),this._tempVector),this._tempVector.normalize(),x.TransformNormalToRef(this._tempVector,r,this._tempVector);var o=h.RandomRange(-this.directionRandomizer/2,this.directionRandomizer/2),a=Math.atan2(this._tempVector.x,this._tempVector.z);a+=h.RandomRange(-Math.PI/2,Math.PI/2)*this.directionRandomizer,this._tempVector.y=o,this._tempVector.x=Math.sin(a),this._tempVector.z=Math.cos(a),this._tempVector.normalize(),n?t.copyFrom(this._tempVector):x.TransformNormalFromFloatsToRef(this._tempVector.x,this._tempVector.y,this._tempVector.z,e,t)},e.prototype.startPositionFunction=function(e,t,i,n){var r=h.RandomRange(-this.height/2,this.height/2),o=h.RandomRange(0,2*Math.PI),a=h.RandomRange((1-this.radiusRange)*(1-this.radiusRange),1),s=Math.sqrt(a)*this.radius,l=s*Math.cos(o),c=s*Math.sin(o);n?t.copyFromFloats(l,r,c):x.TransformCoordinatesFromFloatsToRef(l,r,c,e,t)},e.prototype.clone=function(){var t=new e(this.radius,this.directionRandomizer);return se.DeepCopy(this,t),t},e.prototype.applyToShader=function(e){e.setFloat(\"radius\",this.radius),e.setFloat(\"height\",this.height),e.setFloat(\"radiusRange\",this.radiusRange),e.setFloat(\"directionRandomizer\",this.directionRandomizer)},e.prototype.buildUniformLayout=function(e){e.addUniform(\"radius\",1),e.addUniform(\"height\",1),e.addUniform(\"radiusRange\",1),e.addUniform(\"directionRandomizer\",1)},e.prototype.getEffectDefines=function(){return\"#define CYLINDEREMITTER\"},e.prototype.getClassName=function(){return\"CylinderParticleEmitter\"},e.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.radius=this.radius,e.height=this.height,e.radiusRange=this.radiusRange,e.directionRandomizer=this.directionRandomizer,e},e.prototype.parse=function(e){this.radius=e.radius,this.height=e.height,this.radiusRange=e.radiusRange,this.directionRandomizer=e.directionRandomizer},e}(),Ta=function(e){function t(t,i,n,r,o){void 0===t&&(t=1),void 0===i&&(i=1),void 0===n&&(n=1),void 0===r&&(r=new x(0,1,0)),void 0===o&&(o=new x(0,1,0));var a=e.call(this,t,i,n)||this;return a.direction1=r,a.direction2=o,a}return V(t,e),t.prototype.startDirectionFunction=function(e,t){var i=h.RandomRange(this.direction1.x,this.direction2.x),n=h.RandomRange(this.direction1.y,this.direction2.y),r=h.RandomRange(this.direction1.z,this.direction2.z);x.TransformNormalFromFloatsToRef(i,n,r,e,t)},t.prototype.clone=function(){var e=new t(this.radius,this.height,this.radiusRange,this.direction1,this.direction2);return se.DeepCopy(this,e),e},t.prototype.applyToShader=function(e){e.setFloat(\"radius\",this.radius),e.setFloat(\"height\",this.height),e.setFloat(\"radiusRange\",this.radiusRange),e.setVector3(\"direction1\",this.direction1),e.setVector3(\"direction2\",this.direction2)},t.prototype.buildUniformLayout=function(e){e.addUniform(\"radius\",1),e.addUniform(\"height\",1),e.addUniform(\"radiusRange\",1),e.addUniform(\"direction1\",3),e.addUniform(\"direction2\",3)},t.prototype.getEffectDefines=function(){return\"#define CYLINDEREMITTER\\n#define DIRECTEDCYLINDEREMITTER\"},t.prototype.getClassName=function(){return\"CylinderDirectedParticleEmitter\"},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.direction1=this.direction1.asArray(),t.direction2=this.direction2.asArray(),t},t.prototype.parse=function(t){e.prototype.parse.call(this,t),this.direction1.copyFrom(t.direction1),this.direction2.copyFrom(t.direction2)},t}(ba),Ea=function(){function e(e,t,i){void 0===e&&(e=1),void 0===t&&(t=1),void 0===i&&(i=0),this.radius=e,this.radiusRange=t,this.directionRandomizer=i}return e.prototype.startDirectionFunction=function(e,t,i,n){var r=i.position.subtract(e.getTranslation()).normalize(),o=h.RandomRange(0,this.directionRandomizer),a=h.RandomRange(0,this.directionRandomizer),s=h.RandomRange(0,this.directionRandomizer);r.x+=o,r.y+=a,r.z+=s,r.normalize(),n?t.copyFrom(r):x.TransformNormalFromFloatsToRef(r.x,r.y,r.z,e,t)},e.prototype.startPositionFunction=function(e,t,i,n){var r=this.radius-h.RandomRange(0,this.radius*this.radiusRange),o=h.RandomRange(0,1),a=h.RandomRange(0,2*Math.PI),s=Math.acos(2*o-1),l=r*Math.cos(a)*Math.sin(s),c=r*Math.cos(s),u=r*Math.sin(a)*Math.sin(s);n?t.copyFromFloats(l,Math.abs(c),u):x.TransformCoordinatesFromFloatsToRef(l,Math.abs(c),u,e,t)},e.prototype.clone=function(){var t=new e(this.radius,this.directionRandomizer);return se.DeepCopy(this,t),t},e.prototype.applyToShader=function(e){e.setFloat(\"radius\",this.radius),e.setFloat(\"radiusRange\",this.radiusRange),e.setFloat(\"directionRandomizer\",this.directionRandomizer)},e.prototype.buildUniformLayout=function(e){e.addUniform(\"radius\",1),e.addUniform(\"radiusRange\",1),e.addUniform(\"directionRandomizer\",1)},e.prototype.getEffectDefines=function(){return\"#define HEMISPHERICEMITTER\"},e.prototype.getClassName=function(){return\"HemisphericParticleEmitter\"},e.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.radius=this.radius,e.radiusRange=this.radiusRange,e.directionRandomizer=this.directionRandomizer,e},e.prototype.parse=function(e){this.radius=e.radius,this.radiusRange=e.radiusRange,this.directionRandomizer=e.directionRandomizer},e}(),Sa=function(){function e(){this.direction1=new x(0,1,0),this.direction2=new x(0,1,0)}return e.prototype.startDirectionFunction=function(e,t,i,n){var r=h.RandomRange(this.direction1.x,this.direction2.x),o=h.RandomRange(this.direction1.y,this.direction2.y),a=h.RandomRange(this.direction1.z,this.direction2.z);n?t.copyFromFloats(r,o,a):x.TransformNormalFromFloatsToRef(r,o,a,e,t)},e.prototype.startPositionFunction=function(e,t,i,n){n?t.copyFromFloats(0,0,0):x.TransformCoordinatesFromFloatsToRef(0,0,0,e,t)},e.prototype.clone=function(){var t=new e;return se.DeepCopy(this,t),t},e.prototype.applyToShader=function(e){e.setVector3(\"direction1\",this.direction1),e.setVector3(\"direction2\",this.direction2)},e.prototype.buildUniformLayout=function(e){e.addUniform(\"direction1\",3),e.addUniform(\"direction2\",3)},e.prototype.getEffectDefines=function(){return\"#define POINTEMITTER\"},e.prototype.getClassName=function(){return\"PointParticleEmitter\"},e.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.direction1=this.direction1.asArray(),e.direction2=this.direction2.asArray(),e},e.prototype.parse=function(e){x.FromArrayToRef(e.direction1,0,this.direction1),x.FromArrayToRef(e.direction2,0,this.direction2)},e}(),Aa=function(){function e(e,t,i){void 0===e&&(e=1),void 0===t&&(t=1),void 0===i&&(i=0),this.radius=e,this.radiusRange=t,this.directionRandomizer=i}return e.prototype.startDirectionFunction=function(e,t,i,n){var r=i.position.subtract(e.getTranslation()).normalize(),o=h.RandomRange(0,this.directionRandomizer),a=h.RandomRange(0,this.directionRandomizer),s=h.RandomRange(0,this.directionRandomizer);r.x+=o,r.y+=a,r.z+=s,r.normalize(),n?t.copyFrom(r):x.TransformNormalFromFloatsToRef(r.x,r.y,r.z,e,t)},e.prototype.startPositionFunction=function(e,t,i,n){var r=this.radius-h.RandomRange(0,this.radius*this.radiusRange),o=h.RandomRange(0,1),a=h.RandomRange(0,2*Math.PI),s=Math.acos(2*o-1),l=r*Math.cos(a)*Math.sin(s),c=r*Math.cos(s),u=r*Math.sin(a)*Math.sin(s);n?t.copyFromFloats(l,c,u):x.TransformCoordinatesFromFloatsToRef(l,c,u,e,t)},e.prototype.clone=function(){var t=new e(this.radius,this.directionRandomizer);return se.DeepCopy(this,t),t},e.prototype.applyToShader=function(e){e.setFloat(\"radius\",this.radius),e.setFloat(\"radiusRange\",this.radiusRange),e.setFloat(\"directionRandomizer\",this.directionRandomizer)},e.prototype.buildUniformLayout=function(e){e.addUniform(\"radius\",1),e.addUniform(\"radiusRange\",1),e.addUniform(\"directionRandomizer\",1)},e.prototype.getEffectDefines=function(){return\"#define SPHEREEMITTER\"},e.prototype.getClassName=function(){return\"SphereParticleEmitter\"},e.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.radius=this.radius,e.radiusRange=this.radiusRange,e.directionRandomizer=this.directionRandomizer,e},e.prototype.parse=function(e){this.radius=e.radius,this.radiusRange=e.radiusRange,this.directionRandomizer=e.directionRandomizer},e}(),Ra=function(e){function t(t,i,n){void 0===t&&(t=1),void 0===i&&(i=new x(0,1,0)),void 0===n&&(n=new x(0,1,0));var r=e.call(this,t)||this;return r.direction1=i,r.direction2=n,r}return V(t,e),t.prototype.startDirectionFunction=function(e,t){var i=h.RandomRange(this.direction1.x,this.direction2.x),n=h.RandomRange(this.direction1.y,this.direction2.y),r=h.RandomRange(this.direction1.z,this.direction2.z);x.TransformNormalFromFloatsToRef(i,n,r,e,t)},t.prototype.clone=function(){var e=new t(this.radius,this.direction1,this.direction2);return se.DeepCopy(this,e),e},t.prototype.applyToShader=function(e){e.setFloat(\"radius\",this.radius),e.setFloat(\"radiusRange\",this.radiusRange),e.setVector3(\"direction1\",this.direction1),e.setVector3(\"direction2\",this.direction2)},t.prototype.buildUniformLayout=function(e){e.addUniform(\"radius\",1),e.addUniform(\"radiusRange\",1),e.addUniform(\"direction1\",3),e.addUniform(\"direction2\",3)},t.prototype.getEffectDefines=function(){return\"#define SPHEREEMITTER\\n#define DIRECTEDSPHEREEMITTER\"},t.prototype.getClassName=function(){return\"SphereDirectedParticleEmitter\"},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.direction1=this.direction1.asArray(),t.direction2=this.direction2.asArray(),t},t.prototype.parse=function(t){e.prototype.parse.call(this,t),this.direction1.copyFrom(t.direction1),this.direction2.copyFrom(t.direction2)},t}(Aa),xa=function(){function e(){this.particlePositionGenerator=function(){},this.particleDestinationGenerator=function(){}}return e.prototype.startDirectionFunction=function(e,t,i,n){var r=O.Vector3[0];if(this.particleDestinationGenerator){this.particleDestinationGenerator(-1,i,r);var o=O.Vector3[1];r.subtractToRef(i.position,o),o.scaleToRef(1/i.lifeTime,r)}else r.set(0,0,0);n?t.copyFrom(r):x.TransformNormalToRef(r,e,t)},e.prototype.startPositionFunction=function(e,t,i,n){var r=O.Vector3[0];this.particlePositionGenerator?this.particlePositionGenerator(-1,i,r):r.set(0,0,0),n?t.copyFrom(r):x.TransformCoordinatesToRef(r,e,t)},e.prototype.clone=function(){var t=new e;return se.DeepCopy(this,t),t},e.prototype.applyToShader=function(e){},e.prototype.buildUniformLayout=function(e){},e.prototype.getEffectDefines=function(){return\"#define CUSTOMEMITTER\"},e.prototype.getClassName=function(){return\"CustomParticleEmitter\"},e.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e},e.prototype.parse=function(e){},e}(),Ca=function(){function e(e){void 0===e&&(e=null),this._indices=null,this._positions=null,this._normals=null,this._storedNormal=x.Zero(),this._mesh=null,this.direction1=new x(0,1,0),this.direction2=new x(0,1,0),this.useMeshNormalsForDirection=!0,this.mesh=e}return Object.defineProperty(e.prototype,\"mesh\",{get:function(){return this._mesh},set:function(e){this._mesh!==e&&(this._mesh=e,e?(this._indices=e.getIndices(),this._positions=e.getVerticesData(wi.PositionKind),this._normals=e.getVerticesData(wi.NormalKind)):(this._indices=null,this._positions=null,this._normals=null))},enumerable:!1,configurable:!0}),e.prototype.startDirectionFunction=function(e,t,i,n){if(this.useMeshNormalsForDirection&&this._normals)x.TransformNormalToRef(this._storedNormal,e,t);else{var r=h.RandomRange(this.direction1.x,this.direction2.x),o=h.RandomRange(this.direction1.y,this.direction2.y),a=h.RandomRange(this.direction1.z,this.direction2.z);n?t.copyFromFloats(r,o,a):x.TransformNormalFromFloatsToRef(r,o,a,e,t)}},e.prototype.startPositionFunction=function(e,t,i,n){if(this._indices&&this._positions){var r=3*Math.random()*(this._indices.length/3)|0,o=Math.random(),a=Math.random()*(1-o),s=1-o-a,l=this._indices[r],c=this._indices[r+1],u=this._indices[r+2],h=O.Vector3[0],d=O.Vector3[1],p=O.Vector3[2],f=O.Vector3[3];x.FromArrayToRef(this._positions,3*l,h),x.FromArrayToRef(this._positions,3*c,d),x.FromArrayToRef(this._positions,3*u,p),f.x=o*h.x+a*d.x+s*p.x,f.y=o*h.y+a*d.y+s*p.y,f.z=o*h.z+a*d.z+s*p.z,n?t.copyFromFloats(f.x,f.y,f.z):x.TransformCoordinatesFromFloatsToRef(f.x,f.y,f.z,e,t),this.useMeshNormalsForDirection&&this._normals&&(x.FromArrayToRef(this._normals,3*l,h),x.FromArrayToRef(this._normals,3*c,d),x.FromArrayToRef(this._normals,3*u,p),this._storedNormal.x=o*h.x+a*d.x+s*p.x,this._storedNormal.y=o*h.y+a*d.y+s*p.y,this._storedNormal.z=o*h.z+a*d.z+s*p.z)}},e.prototype.clone=function(){var t=new e(this.mesh);return se.DeepCopy(this,t),t},e.prototype.applyToShader=function(e){e.setVector3(\"direction1\",this.direction1),e.setVector3(\"direction2\",this.direction2)},e.prototype.buildUniformLayout=function(e){e.addUniform(\"direction1\",3),e.addUniform(\"direction2\",3)},e.prototype.getEffectDefines=function(){return\"\"},e.prototype.getClassName=function(){return\"MeshParticleEmitter\"},e.prototype.serialize=function(){var e,t={};return t.type=this.getClassName(),t.direction1=this.direction1.asArray(),t.direction2=this.direction2.asArray(),t.meshId=null===(e=this.mesh)||void 0===e?void 0:e.id,t.useMeshNormalsForDirection=this.useMeshNormalsForDirection,t},e.prototype.parse=function(e,t){x.FromArrayToRef(e.direction1,0,this.direction1),x.FromArrayToRef(e.direction2,0,this.direction2),e.meshId&&t&&(this.mesh=t.getLastMeshById(e.meshId)),this.useMeshNormalsForDirection=e.useMeshNormalsForDirection},e}(),Pa=function(){function e(t){this.animations=[],this.renderingGroupId=0,this.emitter=x.Zero(),this.emitRate=10,this.manualEmitCount=-1,this.updateSpeed=.01,this.targetStopDuration=0,this.disposeOnStop=!1,this.minEmitPower=1,this.maxEmitPower=1,this.minLifeTime=1,this.maxLifeTime=1,this.minSize=1,this.maxSize=1,this.minScaleX=1,this.maxScaleX=1,this.minScaleY=1,this.maxScaleY=1,this.minInitialRotation=0,this.maxInitialRotation=0,this.minAngularSpeed=0,this.maxAngularSpeed=0,this.layerMask=268435455,this.customShader=null,this.preventAutoStart=!1,this._wasDispatched=!1,this._rootUrl=\"\",this.noiseStrength=new x(10,10,10),this.onAnimationEnd=null,this.blendMode=e.BLENDMODE_ONEONE,this.forceDepthWrite=!1,this.preWarmCycles=0,this.preWarmStepOffset=1,this.spriteCellChangeSpeed=1,this.startSpriteCellID=0,this.endSpriteCellID=0,this.spriteCellWidth=0,this.spriteCellHeight=0,this.spriteCellLoop=!0,this.spriteRandomStartCell=!1,this.translationPivot=new R(0,0),this.beginAnimationOnStart=!1,this.beginAnimationFrom=0,this.beginAnimationTo=60,this.beginAnimationLoop=!1,this.worldOffset=new x(0,0,0),this._useLogarithmicDepth=!1,this.gravity=x.Zero(),this._colorGradients=null,this._sizeGradients=null,this._lifeTimeGradients=null,this._angularSpeedGradients=null,this._velocityGradients=null,this._limitVelocityGradients=null,this._dragGradients=null,this._emitRateGradients=null,this._startSizeGradients=null,this._rampGradients=null,this._colorRemapGradients=null,this._alphaRemapGradients=null,this.startDelay=0,this.limitVelocityDamping=.4,this.color1=new L(1,1,1,1),this.color2=new L(1,1,1,1),this.colorDead=new L(0,0,0,1),this.textureMask=new L(1,1,1,1),this._isSubEmitter=!1,this._billboardMode=a.PARTICLES_BILLBOARDMODE_ALL,this._isBillboardBased=!0,this._imageProcessingConfigurationDefines=new Ai,this.id=t,this.name=t}return Object.defineProperty(e.prototype,\"noiseTexture\",{get:function(){return this._noiseTexture},set:function(e){this._noiseTexture!==e&&(this._noiseTexture=e,this._reset())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"isAnimationSheetEnabled\",{get:function(){return this._isAnimationSheetEnabled},set:function(e){this._isAnimationSheetEnabled!=e&&(this._isAnimationSheetEnabled=e,this._reset())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"useLogarithmicDepth\",{get:function(){return this._useLogarithmicDepth},set:function(e){this._useLogarithmicDepth=e&&this.getScene().getEngine().getCaps().fragmentDepthSupported},enumerable:!1,configurable:!0}),e.prototype.getScene=function(){return this._scene},e.prototype._hasTargetStopDurationDependantGradient=function(){return this._startSizeGradients&&this._startSizeGradients.length>0||this._emitRateGradients&&this._emitRateGradients.length>0||this._lifeTimeGradients&&this._lifeTimeGradients.length>0},e.prototype.getDragGradients=function(){return this._dragGradients},e.prototype.getLimitVelocityGradients=function(){return this._limitVelocityGradients},e.prototype.getColorGradients=function(){return this._colorGradients},e.prototype.getSizeGradients=function(){return this._sizeGradients},e.prototype.getColorRemapGradients=function(){return this._colorRemapGradients},e.prototype.getAlphaRemapGradients=function(){return this._alphaRemapGradients},e.prototype.getLifeTimeGradients=function(){return this._lifeTimeGradients},e.prototype.getAngularSpeedGradients=function(){return this._angularSpeedGradients},e.prototype.getVelocityGradients=function(){return this._velocityGradients},e.prototype.getStartSizeGradients=function(){return this._startSizeGradients},e.prototype.getEmitRateGradients=function(){return this._emitRateGradients},Object.defineProperty(e.prototype,\"direction1\",{get:function(){return this.particleEmitterType.direction1?this.particleEmitterType.direction1:x.Zero()},set:function(e){this.particleEmitterType.direction1&&(this.particleEmitterType.direction1=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"direction2\",{get:function(){return this.particleEmitterType.direction2?this.particleEmitterType.direction2:x.Zero()},set:function(e){this.particleEmitterType.direction2&&(this.particleEmitterType.direction2=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"minEmitBox\",{get:function(){return this.particleEmitterType.minEmitBox?this.particleEmitterType.minEmitBox:x.Zero()},set:function(e){this.particleEmitterType.minEmitBox&&(this.particleEmitterType.minEmitBox=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"maxEmitBox\",{get:function(){return this.particleEmitterType.maxEmitBox?this.particleEmitterType.maxEmitBox:x.Zero()},set:function(e){this.particleEmitterType.maxEmitBox&&(this.particleEmitterType.maxEmitBox=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"billboardMode\",{get:function(){return this._billboardMode},set:function(e){this._billboardMode!==e&&(this._billboardMode=e,this._reset())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"isBillboardBased\",{get:function(){return this._isBillboardBased},set:function(e){this._isBillboardBased!==e&&(this._isBillboardBased=e,this._reset())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"imageProcessingConfiguration\",{get:function(){return this._imageProcessingConfiguration},set:function(e){this._attachImageProcessingConfiguration(e)},enumerable:!1,configurable:!0}),e.prototype._attachImageProcessingConfiguration=function(e){e!==this._imageProcessingConfiguration&&(!e&&this._scene?this._imageProcessingConfiguration=this._scene.imageProcessingConfiguration:this._imageProcessingConfiguration=e)},e.prototype._reset=function(){},e.prototype._removeGradientAndTexture=function(e,t,i){if(!t)return this;for(var n=0,r=0,o=t;r0||0===n)&&(null===(i=T.getScene())||void 0===i||i.meshes.forEach((function(e){e._markSubMeshesAsLightDirty()})))},T.renderParticles=!0,T.renderSprites=!1,T.ignoreCameraViewport=!1,T.onBeforeBindObservable=new u,T.onAfterUnbindObservable=new u,T.onBeforeRenderObservable=new u,T.onAfterRenderObservable=new u,T.onClearObservable=new u,T.onResizeObservable=new u,T._cleared=!1,T.skipInitialClear=!1,T._currentRefreshId=-1,T._refreshRate=1,T._samples=1,T._canRescale=!0,T._renderTarget=null,T.boundingBoxPosition=x.Zero(),!(n=T.getScene()))return T;var E=T.getScene().getEngine();return T._coordinatesMode=to.PROJECTION_MODE,T.renderList=new Array,T.name=t,T.isRenderTarget=!0,T._initialSizeParameter=i,T._renderPassIds=[],T._isCubeData=l,T._processSizeParameter(i),T.renderPassId=T._renderPassIds[0],T._resizeObserver=E.onResizeObservable.add((function(){})),T._generateMipMaps=!!r,T._doNotChangeAspectRatio=o,T._renderingManager=new Gi(n),T._renderingManager._useSceneAutoClearSetup=!0,p||(T._renderTargetOptions={generateMipMaps:r,type:s,format:null!==(b=T._format)&&void 0!==b?b:void 0,samplingMode:T.samplingMode,generateDepthBuffer:h,generateStencilBuffer:d,samples:m,creationFlags:g,noColorTarget:v,useSRGBBuffer:y},T.samplingMode===to.NEAREST_SAMPLINGMODE&&(T.wrapU=to.CLAMP_ADDRESSMODE,T.wrapV=to.CLAMP_ADDRESSMODE),_||(l?(T._renderTarget=n.getEngine().createRenderTargetCubeTexture(T.getRenderSize(),T._renderTargetOptions),T.coordinatesMode=to.INVCUBIC_MODE,T._textureMatrix=M.Identity()):T._renderTarget=n.getEngine().createRenderTargetTexture(T._size,T._renderTargetOptions),T._texture=T._renderTarget.texture,void 0!==m&&(T.samples=m))),T}return V(t,e),Object.defineProperty(t.prototype,\"renderList\",{get:function(){return this._renderList},set:function(e){this._unObserveRenderList&&(this._unObserveRenderList(),this._unObserveRenderList=null),e&&(this._unObserveRenderList=v(e,this._renderListHasChanged)),this._renderList=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"postProcesses\",{get:function(){return this._postProcesses},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"_prePassEnabled\",{get:function(){return!!this._prePassRenderTarget&&this._prePassRenderTarget.enabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"onAfterUnbind\",{set:function(e){this._onAfterUnbindObserver&&this.onAfterUnbindObservable.remove(this._onAfterUnbindObserver),this._onAfterUnbindObserver=this.onAfterUnbindObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"onBeforeRender\",{set:function(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"onAfterRender\",{set:function(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),this._onAfterRenderObserver=this.onAfterRenderObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"onClear\",{set:function(e){this._onClearObserver&&this.onClearObservable.remove(this._onClearObserver),this._onClearObserver=this.onClearObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"renderPassIds\",{get:function(){return this._renderPassIds},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"currentRefreshId\",{get:function(){return this._currentRefreshId},enumerable:!1,configurable:!0}),t.prototype.setMaterialForRendering=function(e,t){var i;i=Array.isArray(e)?e:[e];for(var n=0;n0&&(this._postProcesses[0].autoClear=!1))}},t.prototype._shouldRender=function(){return-1===this._currentRefreshId||this.refreshRate===this._currentRefreshId?(this._currentRefreshId=1,!0):(this._currentRefreshId++,!1)},t.prototype.getRenderSize=function(){return this.getRenderWidth()},t.prototype.getRenderWidth=function(){return this._size.width?this._size.width:this._size},t.prototype.getRenderHeight=function(){return this._size.width?this._size.height:this._size},t.prototype.getRenderLayers=function(){return this._size.layers||0},t.prototype.disableRescaling=function(){this._canRescale=!1},Object.defineProperty(t.prototype,\"canRescale\",{get:function(){return this._canRescale},enumerable:!1,configurable:!0}),t.prototype.scale=function(e){var t=Math.max(1,this.getRenderSize()*e);this.resize(t)},t.prototype.getReflectionTextureMatrix=function(){return this.isCube?this._textureMatrix:e.prototype.getReflectionTextureMatrix.call(this)},t.prototype.resize=function(e){var t,i=this.isCube;null===(t=this._renderTarget)||void 0===t||t.dispose(),this._renderTarget=null;var n=this.getScene();n&&(this._processSizeParameter(e),this._renderTarget=i?n.getEngine().createRenderTargetCubeTexture(this.getRenderSize(),this._renderTargetOptions):n.getEngine().createRenderTargetTexture(this._size,this._renderTargetOptions),this._texture=this._renderTarget.texture,void 0!==this._renderTargetOptions.samples&&(this.samples=this._renderTargetOptions.samples),this.onResizeObservable.hasObservers()&&this.onResizeObservable.notifyObservers(this))},t.prototype.render=function(e,t){void 0===e&&(e=!1),void 0===t&&(t=!1),this._render(e,t)},t.prototype.isReadyForRendering=function(){return this._render(!1,!1,!0)},t.prototype._render=function(e,t,i){var n;void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===i&&(i=!1);var r=this.getScene();if(!r)return i;var o=r.getEngine();if(void 0!==this.useCameraPostProcesses&&(e=this.useCameraPostProcesses),this._waitingRenderList){this.renderList=[];for(var a=0;a1||this.activeCamera&&this.activeCamera!==r.activeCamera)&&r.setTransformMatrix(r.activeCamera.getViewMatrix(),r.activeCamera.getProjectionMatrix(!0)),o.setViewport(r.activeCamera.viewport)),r.resetCachedMaterial(),f},t.prototype._bestReflectionRenderTargetDimension=function(e,t){var i=e*t,n=vr.NearestPOT(i+16384/(128+i));return Math.min(vr.FloorPOT(e),n)},t.prototype._prepareRenderingManager=function(e,t,i,n){var r=this.getScene();if(r){this._renderingManager.reset();for(var o=r.getRenderId(),a=0;a=0&&this._renderingManager.dispatchParticles(p)}}},t.prototype._bindFrameBuffer=function(e,t){void 0===e&&(e=0),void 0===t&&(t=0);var i=this.getScene();if(i){var n=i.getEngine();this._renderTarget&&n.bindFramebuffer(this._renderTarget,this.isCube?e:void 0,void 0,void 0,this.ignoreCameraViewport,0,t)}},t.prototype._unbindFrameBuffer=function(e,t){var i=this;this._renderTarget&&e.unBindFramebuffer(this._renderTarget,this.isCube,(function(){i.onAfterRenderObservable.notifyObservers(t)}))},t.prototype._prepareFrame=function(e,t,i,n){this._postProcessManager?this._prePassEnabled||this._postProcessManager._prepareFrame(this._texture,this._postProcesses):n&&e.postProcessManager._prepareFrame(this._texture)||this._bindFrameBuffer(t,i)},t.prototype._renderToTarget=function(e,t,i,n,r){var o,s,l,c,u,h;void 0===n&&(n=0),void 0===r&&(r=null);var d=this.getScene();if(d){var p=d.getEngine();if(null===(o=p._debugPushGroup)||void 0===o||o.call(p,\"render to face #\".concat(e,\" layer #\").concat(n),1),this._prepareFrame(d,e,n,t),this.is2DArray?(p.currentRenderPassId=this._renderPassIds[n],this.onBeforeRenderObservable.notifyObservers(n)):(p.currentRenderPassId=this._renderPassIds[e],this.onBeforeRenderObservable.notifyObservers(e)),p.snapshotRendering&&p.snapshotRenderingMode===a.SNAPSHOTRENDERING_FAST)this.onClearObservable.hasObservers()?this.onClearObservable.notifyObservers(p):this.skipInitialClear||p.clear(this.clearColor||d.clearColor,!0,!0,!0);else{var f=null,_=this.renderList?this.renderList:d.getActiveMeshes().data,m=this.renderList?this.renderList.length:d.getActiveMeshes().length;this.getCustomRenderList&&(f=this.getCustomRenderList(this.is2DArray?n:e,_,m)),f?this._prepareRenderingManager(f,f.length,r,!1):(this._defaultRenderListPrepared||(this._prepareRenderingManager(_,m,r,!this.renderList),this._defaultRenderListPrepared=!0),f=_);for(var g=0,v=d._beforeRenderTargetClearStage;g=0&&i.customRenderTargets.splice(n,1);for(var r=0,o=i.cameras;r=0&&a.customRenderTargets.splice(n,1)}null===(t=this._renderTarget)||void 0===t||t.dispose(),this._renderTarget=null,this._texture=null,e.prototype.dispose.call(this)}},t.prototype._rebuild=function(){this.refreshRate===t.REFRESHRATE_RENDER_ONCE&&(this.refreshRate=t.REFRESHRATE_RENDER_ONCE),this._postProcessManager&&this._postProcessManager._rebuild()},t.prototype.freeRenderingGroups=function(){this._renderingManager&&this._renderingManager.freeRenderingGroups()},t.prototype.getViewCount=function(){return 1},t.REFRESHRATE_RENDER_ONCE=0,t.REFRESHRATE_RENDER_ONEVERYFRAME=1,t.REFRESHRATE_RENDER_ONEVERYTWOFRAMES=2,t}(to);to._CreateRenderTargetTexture=function(e,t,i,n,r){return new Ia(e,t,i,n)};var Oa=function(){function e(e){this.name=zi.NAME_PROCEDURALTEXTURE,this.scene=e,this.scene.proceduralTextures=new Array}return e.prototype.register=function(){this.scene._beforeClearStage.registerStep(zi.STEP_BEFORECLEAR_PROCEDURALTEXTURE,this,this._beforeClear)},e.prototype.rebuild=function(){},e.prototype.dispose=function(){},e.prototype._beforeClear=function(){if(this.scene.proceduralTexturesEnabled){mi.StartPerformanceCounter(\"Procedural textures\",this.scene.proceduralTextures.length>0);for(var e=0;e0)}},e}();It.ShadersStore.proceduralVertexShader=\"attribute vec2 position;\\nvarying vec2 vPosition;\\nvarying vec2 vUV;\\nconst vec2 madd=vec2(0.5,0.5);\\n#define CUSTOM_VERTEX_DEFINITIONS\\nvoid main(void) {\\n#define CUSTOM_VERTEX_MAIN_BEGIN\\nvPosition=position;\\nvUV=position*madd+madd;\\ngl_Position=vec4(position,0.0,1.0);\\n#define CUSTOM_VERTEX_MAIN_END\\n}\";var Da,Na=function(e){function t(t,i,n,r,o,s,l,c){void 0===o&&(o=null),void 0===s&&(s=!0),void 0===l&&(l=!1),void 0===c&&(c=a.TEXTURETYPE_UNSIGNED_INT);var h=e.call(this,null,r,!s)||this;h.isEnabled=!0,h.autoClear=!0,h.onGeneratedObservable=new u,h.onBeforeGenerationObservable=new u,h.nodeMaterialSource=null,h._textures={},h._currentRefreshId=-1,h._frameId=-1,h._refreshRate=1,h._vertexBuffers={},h._uniforms=new Array,h._samplers=new Array,h._floats={},h._ints={},h._floatsArrays={},h._colors3={},h._colors4={},h._vectors2={},h._vectors3={},h._matrices={},h._fallbackTextureUsed=!1,h._cachedDefines=null,h._contentUpdateId=-1,h._rtWrapper=null;var d=(r=h.getScene()||S.LastCreatedScene)._getComponent(zi.NAME_PROCEDURALTEXTURE);d||(d=new Oa(r),r._addComponent(d)),r.proceduralTextures.push(h),h._fullEngine=r.getEngine(),h.name=t,h.isRenderTarget=!0,h._size=i,h._textureType=c,h._generateMipMaps=s,h._drawWrapper=new Ht(h._fullEngine),h.setFragment(n),h._fallbackTexture=o;var p=h._createRtWrapper(l,i,s,c);h._texture=p.texture;var f=[];return f.push(1,1),f.push(-1,1),f.push(-1,-1),f.push(1,-1),h._vertexBuffers[wi.PositionKind]=new wi(h._fullEngine,f,wi.PositionKind,!1,!1,2),h._createIndexBuffer(),h}return V(t,e),t.prototype._createRtWrapper=function(e,t,i,n){return e?(this._rtWrapper=this._fullEngine.createRenderTargetCubeTexture(t,{generateMipMaps:i,generateDepthBuffer:!1,generateStencilBuffer:!1,type:n}),this.setFloat(\"face\",0)):this._rtWrapper=this._fullEngine.createRenderTargetTexture(t,{generateMipMaps:i,generateDepthBuffer:!1,generateStencilBuffer:!1,type:n}),this._rtWrapper},t.prototype.getEffect=function(){return this._drawWrapper.effect},t.prototype._setEffect=function(e){this._drawWrapper.effect=e},t.prototype.getContent=function(){var e=this;return this._contentData&&this._frameId===this._contentUpdateId||(this._contentData?this._contentData.then((function(t){e._contentData=e.readPixels(0,0,t),e._contentUpdateId=e._frameId})):(this._contentData=this.readPixels(0,0),this._contentUpdateId=this._frameId)),this._contentData},t.prototype._createIndexBuffer=function(){var e=this._fullEngine,t=[];t.push(0),t.push(1),t.push(2),t.push(0),t.push(2),t.push(3),this._indexBuffer=e.createIndexBuffer(t)},t.prototype._rebuild=function(){var e=this._vertexBuffers[wi.PositionKind];e&&e._rebuild(),this._createIndexBuffer(),this.refreshRate===Ia.REFRESHRATE_RENDER_ONCE&&(this.refreshRate=Ia.REFRESHRATE_RENDER_ONCE)},t.prototype.reset=function(){var e;null===(e=this._drawWrapper.effect)||void 0===e||e.dispose()},t.prototype._getDefines=function(){return\"\"},t.prototype.isReady=function(){var e,t=this,i=this._fullEngine;if(this.nodeMaterialSource)return this._drawWrapper.effect.isReady();if(!this._fragment)return!1;if(this._fallbackTextureUsed)return!0;if(!this._texture)return!1;var n=this._getDefines();return!(!this._drawWrapper.effect||n!==this._cachedDefines||!this._drawWrapper.effect.isReady())||(e=void 0!==this._fragment.fragmentElement?{vertex:\"procedural\",fragmentElement:this._fragment.fragmentElement}:{vertex:\"procedural\",fragment:this._fragment},this._cachedDefines!==n&&(this._cachedDefines=n,this._drawWrapper.effect=i.createEffect(e,[wi.PositionKind],this._uniforms,this._samplers,n,void 0,void 0,(function(){var e;null===(e=t._rtWrapper)||void 0===e||e.dispose(),t._rtWrapper=t._texture=null,t._fallbackTexture&&(t._texture=t._fallbackTexture._texture,t._texture&&t._texture.incrementReferences()),t._fallbackTextureUsed=!0}))),this._drawWrapper.effect.isReady())},t.prototype.resetRefreshCounter=function(){this._currentRefreshId=-1},t.prototype.setFragment=function(e){this._fragment=e},Object.defineProperty(t.prototype,\"refreshRate\",{get:function(){return this._refreshRate},set:function(e){this._refreshRate=e,this.resetRefreshCounter()},enumerable:!1,configurable:!0}),t.prototype._shouldRender=function(){return this.isEnabled&&this.isReady()&&this._texture?!this._fallbackTextureUsed&&(-1===this._currentRefreshId||this.refreshRate===this._currentRefreshId?(this._currentRefreshId=1,this._frameId++,!0):(this._currentRefreshId++,!1)):(this._texture&&(this._texture.isReady=!1),!1)},t.prototype.getRenderSize=function(){return this._size},t.prototype.resize=function(e,t){if(!this._fallbackTextureUsed&&this._rtWrapper&&this._texture){var i=this._texture.isCube;this._rtWrapper.dispose();var n=this._createRtWrapper(i,e,t,this._textureType);this._texture=n.texture,this._size=e,this._generateMipMaps=t}},t.prototype._checkUniform=function(e){-1===this._uniforms.indexOf(e)&&this._uniforms.push(e)},t.prototype.setTexture=function(e,t){return-1===this._samplers.indexOf(e)&&this._samplers.push(e),this._textures[e]=t,this},t.prototype.setFloat=function(e,t){return this._checkUniform(e),this._floats[e]=t,this},t.prototype.setInt=function(e,t){return this._checkUniform(e),this._ints[e]=t,this},t.prototype.setFloats=function(e,t){return this._checkUniform(e),this._floatsArrays[e]=t,this},t.prototype.setColor3=function(e,t){return this._checkUniform(e),this._colors3[e]=t,this},t.prototype.setColor4=function(e,t){return this._checkUniform(e),this._colors4[e]=t,this},t.prototype.setVector2=function(e,t){return this._checkUniform(e),this._vectors2[e]=t,this},t.prototype.setVector3=function(e,t){return this._checkUniform(e),this._vectors3[e]=t,this},t.prototype.setMatrix=function(e,t){return this._checkUniform(e),this._matrices[e]=t,this},t.prototype.render=function(e){var t,i,n=this.getScene();if(n){var r=this._fullEngine;if(r.enableEffect(this._drawWrapper),this.onBeforeGenerationObservable.notifyObservers(this),r.setState(!1),!this.nodeMaterialSource){for(var o in this._textures)this._drawWrapper.effect.setTexture(o,this._textures[o]);for(var a in this._ints)this._drawWrapper.effect.setInt(a,this._ints[a]);for(var s in this._floats)this._drawWrapper.effect.setFloat(s,this._floats[s]);for(var l in this._floatsArrays)this._drawWrapper.effect.setArray(l,this._floatsArrays[l]);for(var c in this._colors3)this._drawWrapper.effect.setColor3(c,this._colors3[c]);for(var u in this._colors4){var h=this._colors4[u];this._drawWrapper.effect.setFloat4(u,h.r,h.g,h.b,h.a)}for(var d in this._vectors2)this._drawWrapper.effect.setVector2(d,this._vectors2[d]);for(var p in this._vectors3)this._drawWrapper.effect.setVector3(p,this._vectors3[p]);for(var f in this._matrices)this._drawWrapper.effect.setMatrix(f,this._matrices[f])}if(this._texture&&this._rtWrapper){null===(t=r._debugPushGroup)||void 0===t||t.call(r,\"procedural texture generation for \".concat(this.name),1);var _=r.currentViewport;if(this.isCube)for(var m=0;m<6;m++)r.bindFramebuffer(this._rtWrapper,m,void 0,void 0,!0),r.bindBuffers(this._vertexBuffers,this._indexBuffer,this._drawWrapper.effect),this._drawWrapper.effect.setFloat(\"face\",m),this.autoClear&&r.clear(n.clearColor,!0,!1,!1),r.drawElementsType(Ir.TriangleFillMode,0,6);else r.bindFramebuffer(this._rtWrapper,0,void 0,void 0,!0),r.bindBuffers(this._vertexBuffers,this._indexBuffer,this._drawWrapper.effect),this.autoClear&&r.clear(n.clearColor,!0,!1,!1),r.drawElementsType(Ir.TriangleFillMode,0,6);r.unBindFramebuffer(this._rtWrapper,this.isCube),_&&r.setViewport(_),this.isCube&&r.generateMipMapsForCubemap(this._texture),null===(i=r._debugPopGroup)||void 0===i||i.call(r,1),this.onGenerated&&this.onGenerated(),this.onGeneratedObservable.notifyObservers(this)}}},t.prototype.clone=function(){var e=this.getSize(),i=new t(this.name,e.width,this._fragment,this.getScene(),this._fallbackTexture,this._generateMipMaps);return i.hasAlpha=this.hasAlpha,i.level=this.level,i.coordinatesMode=this.coordinatesMode,i},t.prototype.dispose=function(){var t=this.getScene();if(t){var i=t.proceduralTextures.indexOf(this);i>=0&&t.proceduralTextures.splice(i,1);var n=this._vertexBuffers[wi.PositionKind];n&&(n.dispose(),this._vertexBuffers[wi.PositionKind]=null),this._indexBuffer&&this._fullEngine._releaseBuffer(this._indexBuffer)&&(this._indexBuffer=null),this.onGeneratedObservable.clear(),this.onBeforeGenerationObservable.clear(),e.prototype.dispose.call(this)}},G([be()],t.prototype,\"isEnabled\",void 0),G([be()],t.prototype,\"autoClear\",void 0),G([be()],t.prototype,\"_generateMipMaps\",void 0),G([be()],t.prototype,\"_size\",void 0),G([be()],t.prototype,\"refreshRate\",null),t}(to);b(\"BABYLON.ProceduralTexture\",Na),function(e){e[e.Cos=0]=\"Cos\",e[e.Sin=1]=\"Sin\",e[e.Abs=2]=\"Abs\",e[e.Exp=3]=\"Exp\",e[e.Exp2=4]=\"Exp2\",e[e.Round=5]=\"Round\",e[e.Floor=6]=\"Floor\",e[e.Ceiling=7]=\"Ceiling\",e[e.Sqrt=8]=\"Sqrt\",e[e.Log=9]=\"Log\",e[e.Tan=10]=\"Tan\",e[e.ArcTan=11]=\"ArcTan\",e[e.ArcCos=12]=\"ArcCos\",e[e.ArcSin=13]=\"ArcSin\",e[e.Fract=14]=\"Fract\",e[e.Sign=15]=\"Sign\",e[e.Radians=16]=\"Radians\",e[e.Degrees=17]=\"Degrees\"}(Da||(Da={}));var La=function(e){function t(t){var i=e.call(this,t,Bo.Neutral)||this;return i.operation=Da.Cos,i.registerInput(\"input\",wo.AutoDetect),i.registerOutput(\"output\",wo.BasedOnInput),i._outputs[0]._typeConnectionSource=i._inputs[0],i}return V(t,e),t.prototype.getClassName=function(){return\"TrigonometryBlock\"},Object.defineProperty(t.prototype,\"input\",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"output\",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t);var i=this._outputs[0],n=\"\";switch(this.operation){case Da.Cos:n=\"cos\";break;case Da.Sin:n=\"sin\";break;case Da.Abs:n=\"abs\";break;case Da.Exp:n=\"exp\";break;case Da.Exp2:n=\"exp2\";break;case Da.Round:n=\"round\";break;case Da.Floor:n=\"floor\";break;case Da.Ceiling:n=\"ceil\";break;case Da.Sqrt:n=\"sqrt\";break;case Da.Log:n=\"log\";break;case Da.Tan:n=\"tan\";break;case Da.ArcTan:n=\"atan\";break;case Da.ArcCos:n=\"acos\";break;case Da.ArcSin:n=\"asin\";break;case Da.Fract:n=\"fract\";break;case Da.Sign:n=\"sign\";break;case Da.Radians:n=\"radians\";break;case Da.Degrees:n=\"degrees\"}return t.compilationString+=this._declareOutput(i,t)+\" = \".concat(n,\"(\").concat(this.input.associatedVariableName,\");\\r\\n\"),this},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.operation=this.operation,t},t.prototype._deserialize=function(t,i,n){e.prototype._deserialize.call(this,t,i,n),this.operation=t.operation},t.prototype._dumpPropertiesCode=function(){return e.prototype._dumpPropertiesCode.call(this)+\"\".concat(this._codeVariableName,\".operation = BABYLON.TrigonometryBlockOperations.\").concat(Da[this.operation],\";\\r\\n\")},t}(Xo);b(\"BABYLON.TrigonometryBlock\",La);var Fa={effect:null,subMesh:null},wa=function(e){function t(){var t=e.call(this)||this;return t.NORMAL=!1,t.TANGENT=!1,t.UV1=!1,t.UV2=!1,t.UV3=!1,t.UV4=!1,t.UV5=!1,t.UV6=!1,t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,t.BONETEXTURE=!1,t.MORPHTARGETS=!1,t.MORPHTARGETS_NORMAL=!1,t.MORPHTARGETS_TANGENT=!1,t.MORPHTARGETS_UV=!1,t.NUM_MORPH_INFLUENCERS=0,t.MORPHTARGETS_TEXTURE=!1,t.IMAGEPROCESSING=!1,t.VIGNETTE=!1,t.VIGNETTEBLENDMODEMULTIPLY=!1,t.VIGNETTEBLENDMODEOPAQUE=!1,t.TONEMAPPING=!1,t.TONEMAPPING_ACES=!1,t.CONTRAST=!1,t.EXPOSURE=!1,t.COLORCURVES=!1,t.COLORGRADING=!1,t.COLORGRADING3D=!1,t.SAMPLER3DGREENDEPTH=!1,t.SAMPLER3DBGRMAP=!1,t.DITHER=!1,t.IMAGEPROCESSINGPOSTPROCESS=!1,t.SKIPFINALCOLORCLAMP=!1,t.BUMPDIRECTUV=0,t.rebuild(),t}return V(t,e),t.prototype.setValue=function(e,t,i){void 0===i&&(i=!1),void 0===this[e]&&this._keys.push(e),i&&this[e]!==t&&this.markAsUnprocessed(),this[e]=t},t}(Ei),Ba=function(e){function t(i,n,r){void 0===r&&(r={});var o=e.call(this,i,n||S.LastCreatedScene)||this;return o._buildId=t._BuildIdGenerator++,o._buildWasSuccessful=!1,o._cachedWorldViewMatrix=new M,o._cachedWorldViewProjectionMatrix=new M,o._optimizers=new Array,o._animationFrame=-1,o.BJSNODEMATERIALEDITOR=o._getGlobalNodeMaterialEditor(),o.editorData=null,o.ignoreAlpha=!1,o.maxSimultaneousLights=4,o.onBuildObservable=new u,o._vertexOutputNodes=new Array,o._fragmentOutputNodes=new Array,o.attachedBlocks=new Array,o._mode=ma.Material,o.forceAlphaBlending=!1,o._options=k({emitComments:!1},r),o._attachImageProcessingConfiguration(null),o}return V(t,e),t.prototype._getGlobalNodeMaterialEditor=function(){return\"undefined\"!=typeof NODEEDITOR?NODEEDITOR:\"undefined\"!=typeof BABYLON&&void 0!==BABYLON.NodeEditor?BABYLON:void 0},Object.defineProperty(t.prototype,\"options\",{get:function(){return this._options},set:function(e){this._options=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"imageProcessingConfiguration\",{get:function(){return this._imageProcessingConfiguration},set:function(e){this._attachImageProcessingConfiguration(e),this._markAllSubMeshesAsTexturesDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"mode\",{get:function(){return this._mode},set:function(e){this._mode=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"buildId\",{get:function(){return this._buildId},set:function(e){this._buildId=e},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return\"NodeMaterial\"},t.prototype._attachImageProcessingConfiguration=function(e){var t=this;e!==this._imageProcessingConfiguration&&(this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),this._imageProcessingConfiguration=e||this.getScene().imageProcessingConfiguration,this._imageProcessingConfiguration&&(this._imageProcessingObserver=this._imageProcessingConfiguration.onUpdateParameters.add((function(){t._markAllSubMeshesAsImageProcessingDirty()}))))},t.prototype.getBlockByName=function(e){for(var t=null,i=0,n=this.attachedBlocks;i-1))return this._optimizers.push(e),this},t.prototype.unregisterOptimizer=function(e){var t=this._optimizers.indexOf(e);if(-1!==t)return this._optimizers.splice(t,1),this},t.prototype.addOutputNode=function(e){if(null===e.target)throw\"This node is not meant to be an output node. You may want to explicitly set its target value.\";return 0!=(e.target&Bo.Vertex)&&this._addVertexOutputNode(e),0!=(e.target&Bo.Fragment)&&this._addFragmentOutputNode(e),this},t.prototype.removeOutputNode=function(e){return null===e.target||(0!=(e.target&Bo.Vertex)&&this._removeVertexOutputNode(e),0!=(e.target&Bo.Fragment)&&this._removeFragmentOutputNode(e)),this},t.prototype._addVertexOutputNode=function(e){if(-1===this._vertexOutputNodes.indexOf(e))return e.target=Bo.Vertex,this._vertexOutputNodes.push(e),this},t.prototype._removeVertexOutputNode=function(e){var t=this._vertexOutputNodes.indexOf(e);if(-1!==t)return this._vertexOutputNodes.splice(t,1),this},t.prototype._addFragmentOutputNode=function(e){if(-1===this._fragmentOutputNodes.indexOf(e))return e.target=Bo.Fragment,this._fragmentOutputNodes.push(e),this},t.prototype._removeFragmentOutputNode=function(e){var t=this._fragmentOutputNodes.indexOf(e);if(-1!==t)return this._fragmentOutputNodes.splice(t,1),this},t.prototype.needAlphaBlending=function(){return!this.ignoreAlpha&&(this.forceAlphaBlending||this.alpha<1||this._sharedData&&this._sharedData.hints.needAlphaBlending)},t.prototype.needAlphaTesting=function(){return this._sharedData&&this._sharedData.hints.needAlphaTesting},t.prototype._initializeBlock=function(e,t,i,n){if(void 0===n&&(n=!0),e.initialize(t),n&&e.autoConfigure(this),e._preparationId=this._buildId,-1===this.attachedBlocks.indexOf(e)){if(e.isUnique)for(var r=e.getClassName(),o=0,a=this.attachedBlocks;o-1&&this.attachedBlocks.splice(t,1),e.isFinalMerger&&this.removeOutputNode(e)},t.prototype.build=function(e,i,n){void 0===e&&(e=!1),void 0===i&&(i=!0),void 0===n&&(n=!0),this._buildWasSuccessful=!1;var r=this.getScene().getEngine(),o=this._mode===ma.Particle;if(0===this._vertexOutputNodes.length&&!o)throw\"You must define at least one vertexOutputNode\";if(0===this._fragmentOutputNodes.length)throw\"You must define at least one fragmentOutputNode\";this._vertexCompilationState=new zo,this._vertexCompilationState.supportUniformBuffers=r.supportsUniformBuffers,this._vertexCompilationState.target=Bo.Vertex,this._fragmentCompilationState=new zo,this._fragmentCompilationState.supportUniformBuffers=r.supportsUniformBuffers,this._fragmentCompilationState.target=Bo.Fragment,this._sharedData=new Wo,this._sharedData.fragmentOutputNodes=this._fragmentOutputNodes,this._vertexCompilationState.sharedData=this._sharedData,this._fragmentCompilationState.sharedData=this._sharedData,this._sharedData.buildId=this._buildId,this._sharedData.emitComments=this._options.emitComments,this._sharedData.verbose=e,this._sharedData.scene=this.getScene(),this._sharedData.allowEmptyVertexProgram=o;for(var a=[],s=[],l=0,c=this._vertexOutputNodes;l0&&a.lengthSquared()-l2*this.palmUpStrictness-1&&(t=!0)}}this._node.setEnabled(t&&i)},e.prototype.detach=function(){this._scene.onBeforeRenderObservable.remove(this._sceneRenderObserver)},e.prototype.linkToXRExperience=function(e){try{this._eyeTracking=e.featuresManager.getEnabledFeature(xo.EYE_TRACKING)}catch(e){}try{this._handTracking=e.featuresManager.getEnabledFeature(xo.HAND_TRACKING)}catch(e){alert(\"Hand tracking must be enabled for the Hand Menu to work\")}},e}(),Ja=function(){function e(e,t,i){if(this.targetPosition=x.Zero(),this.poleTargetPosition=x.Zero(),this.poleTargetLocalOffset=x.Zero(),this.poleAngle=0,this.slerpAmount=1,this._bone1Quat=P.Identity(),this._bone1Mat=M.Identity(),this._bone2Ang=Math.PI,this._maxAngle=Math.PI,this._rightHandedSystem=!1,this._bendAxis=x.Right(),this._slerping=!1,this._adjustRoll=0,this._bone2=t,this._bone1=t.getParent(),this._bone1){this.mesh=e;var n=t.getPosition();if(t.getAbsoluteTransform().determinant()>0&&(this._rightHandedSystem=!0,this._bendAxis.x=0,this._bendAxis.y=0,this._bendAxis.z=-1,n.x>n.y&&n.x>n.z&&(this._adjustRoll=.5*Math.PI,this._bendAxis.z=1)),this._bone1.length){var r=this._bone1.getScale(),o=this._bone2.getScale();this._bone1Length=this._bone1.length*r.y*this.mesh.scaling.y,this._bone2Length=this._bone2.length*o.y*this.mesh.scaling.y}else if(this._bone1.children[0]){e.computeWorldMatrix(!0);var a=this._bone2.children[0].getAbsolutePosition(e),s=this._bone2.getAbsolutePosition(e),l=this._bone1.getAbsolutePosition(e);this._bone1Length=x.Distance(a,s),this._bone2Length=x.Distance(s,l)}this._bone1.getRotationMatrixToRef(_n.WORLD,e,this._bone1Mat),this.maxAngle=Math.PI,i&&(i.targetMesh&&(this.targetMesh=i.targetMesh,this.targetMesh.computeWorldMatrix(!0)),i.poleTargetMesh?(this.poleTargetMesh=i.poleTargetMesh,this.poleTargetMesh.computeWorldMatrix(!0)):i.poleTargetBone?this.poleTargetBone=i.poleTargetBone:this._bone1.getParent()&&(this.poleTargetBone=this._bone1.getParent()),i.poleTargetLocalOffset&&this.poleTargetLocalOffset.copyFrom(i.poleTargetLocalOffset),i.poleAngle&&(this.poleAngle=i.poleAngle),i.bendAxis&&this._bendAxis.copyFrom(i.bendAxis),i.maxAngle&&(this.maxAngle=i.maxAngle),i.slerpAmount&&(this.slerpAmount=i.slerpAmount))}}return Object.defineProperty(e.prototype,\"maxAngle\",{get:function(){return this._maxAngle},set:function(e){this._setMaxAngle(e)},enumerable:!1,configurable:!0}),e.prototype._setMaxAngle=function(e){e<0&&(e=0),(e>Math.PI||null==e)&&(e=Math.PI),this._maxAngle=e;var t=this._bone1Length,i=this._bone2Length;this._maxReach=Math.sqrt(t*t+i*i-2*t*i*Math.cos(e))},e.prototype.update=function(){var t=this._bone1;if(t){var i=this.targetPosition,n=this.poleTargetPosition,r=e._TmpMats[0],o=e._TmpMats[1];this.targetMesh&&i.copyFrom(this.targetMesh.getAbsolutePosition()),this.poleTargetBone?this.poleTargetBone.getAbsolutePositionFromLocalToRef(this.poleTargetLocalOffset,this.mesh,n):this.poleTargetMesh&&x.TransformCoordinatesToRef(this.poleTargetLocalOffset,this.poleTargetMesh.getWorldMatrix(),n);var a=e._TmpVecs[0],s=e._TmpVecs[1],l=e._TmpVecs[2],c=e._TmpVecs[3],u=e._TmpVecs[4],h=e._TmpQuat;t.getAbsolutePositionToRef(this.mesh,a),n.subtractToRef(a,u),0==u.x&&0==u.y&&0==u.z?u.y=1:u.normalize(),i.subtractToRef(a,c),c.normalize(),x.CrossToRef(c,u,s),s.normalize(),x.CrossToRef(c,s,l),l.normalize(),M.FromXYZAxesToRef(l,c,s,r);var d=this._bone1Length,p=this._bone2Length,f=x.Distance(a,i);this._maxReach>0&&(f=Math.min(this._maxReach,f));var _=(p*p+f*f-d*d)/(2*p*f),m=(f*f+d*d-p*p)/(2*f*d);_>1&&(_=1),m>1&&(m=1),_<-1&&(_=-1),m<-1&&(m=-1);var g=Math.acos(_),v=Math.acos(m),y=-g-v;if(this._rightHandedSystem)M.RotationYawPitchRollToRef(0,0,this._adjustRoll,o),o.multiplyToRef(r,r),M.RotationAxisToRef(this._bendAxis,v,o),o.multiplyToRef(r,r);else{var b=e._TmpVecs[5];b.copyFrom(this._bendAxis),b.x*=-1,M.RotationAxisToRef(b,-v,o),o.multiplyToRef(r,r)}this.poleAngle&&(M.RotationAxisToRef(c,this.poleAngle,o),r.multiplyToRef(o,r)),this._bone1&&(this.slerpAmount<1?(this._slerping||P.FromRotationMatrixToRef(this._bone1Mat,this._bone1Quat),P.FromRotationMatrixToRef(r,h),P.SlerpToRef(this._bone1Quat,h,this.slerpAmount,this._bone1Quat),y=this._bone2Ang*(1-this.slerpAmount)+y*this.slerpAmount,this._bone1.setRotationQuaternion(this._bone1Quat,_n.WORLD,this.mesh),this._slerping=!0):(this._bone1.setRotationMatrix(r,_n.WORLD,this.mesh),this._bone1Mat.copyFrom(r),this._slerping=!1),this._updateLinkedTransformRotation(this._bone1)),this._bone2.setAxisAngle(this._bendAxis,y,_n.LOCAL),this._updateLinkedTransformRotation(this._bone2),this._bone2Ang=y}},e.prototype._updateLinkedTransformRotation=function(e){e._linkedTransformNode&&(e._linkedTransformNode.rotationQuaternion||(e._linkedTransformNode.rotationQuaternion=new P),e.getRotationQuaternionToRef(_n.LOCAL,null,e._linkedTransformNode.rotationQuaternion))},e._TmpVecs=[x.Zero(),x.Zero(),x.Zero(),x.Zero(),x.Zero(),x.Zero()],e._TmpQuat=P.Identity(),e._TmpMats=[M.Identity(),M.Identity()],e}(),$a=function(){function e(e,t,i,n){if(this.upAxis=x.Up(),this.upAxisSpace=_n.LOCAL,this.adjustYaw=0,this.adjustPitch=0,this.adjustRoll=0,this.slerpAmount=1,this._boneQuat=P.Identity(),this._slerping=!1,this._firstFrameSkipped=!1,this._fowardAxis=x.Forward(),this.mesh=e,this.bone=t,this.target=i,n&&(n.adjustYaw&&(this.adjustYaw=n.adjustYaw),n.adjustPitch&&(this.adjustPitch=n.adjustPitch),n.adjustRoll&&(this.adjustRoll=n.adjustRoll),null!=n.maxYaw?this.maxYaw=n.maxYaw:this.maxYaw=Math.PI,null!=n.minYaw?this.minYaw=n.minYaw:this.minYaw=-Math.PI,null!=n.maxPitch?this.maxPitch=n.maxPitch:this.maxPitch=Math.PI,null!=n.minPitch?this.minPitch=n.minPitch:this.minPitch=-Math.PI,null!=n.slerpAmount&&(this.slerpAmount=n.slerpAmount),null!=n.upAxis&&(this.upAxis=n.upAxis),null!=n.upAxisSpace&&(this.upAxisSpace=n.upAxisSpace),null!=n.yawAxis||null!=n.pitchAxis)){var r=vn.Y,o=vn.X;null!=n.yawAxis&&(r=n.yawAxis.clone()).normalize(),null!=n.pitchAxis&&(o=n.pitchAxis.clone()).normalize();var a=x.Cross(o,r);this._transformYawPitch=M.Identity(),M.FromXYZAxesToRef(o,r,a,this._transformYawPitch),this._transformYawPitchInv=this._transformYawPitch.clone(),this._transformYawPitch.invert()}t.getParent()||this.upAxisSpace!=_n.BONE||(this.upAxisSpace=_n.LOCAL)}return Object.defineProperty(e.prototype,\"minYaw\",{get:function(){return this._minYaw},set:function(e){this._minYaw=e,this._minYawSin=Math.sin(e),this._minYawCos=Math.cos(e),null!=this._maxYaw&&(this._midYawConstraint=.5*this._getAngleDiff(this._minYaw,this._maxYaw)+this._minYaw,this._yawRange=this._maxYaw-this._minYaw)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"maxYaw\",{get:function(){return this._maxYaw},set:function(e){this._maxYaw=e,this._maxYawSin=Math.sin(e),this._maxYawCos=Math.cos(e),null!=this._minYaw&&(this._midYawConstraint=.5*this._getAngleDiff(this._minYaw,this._maxYaw)+this._minYaw,this._yawRange=this._maxYaw-this._minYaw)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"minPitch\",{get:function(){return this._minPitch},set:function(e){this._minPitch=e,this._minPitchTan=Math.tan(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"maxPitch\",{get:function(){return this._maxPitch},set:function(e){this._maxPitch=e,this._maxPitchTan=Math.tan(e)},enumerable:!1,configurable:!0}),e.prototype.update=function(){if(this.slerpAmount<1&&!this._firstFrameSkipped)this._firstFrameSkipped=!0;else{var t=this.bone,i=e._TmpVecs[0];t.getAbsolutePositionToRef(this.mesh,i);var n=this.target,r=e._TmpMats[0],o=e._TmpMats[1],a=this.mesh,s=t.getParent(),l=e._TmpVecs[1];l.copyFrom(this.upAxis),this.upAxisSpace==_n.BONE&&s?(this._transformYawPitch&&x.TransformCoordinatesToRef(l,this._transformYawPitchInv,l),s.getDirectionToRef(l,this.mesh,l)):this.upAxisSpace==_n.LOCAL&&(a.getDirectionToRef(l,l),1==a.scaling.x&&1==a.scaling.y&&1==a.scaling.z||l.normalize());var c=!1,u=!1;if(this._maxYaw==Math.PI&&this._minYaw==-Math.PI||(c=!0),this._maxPitch==Math.PI&&this._minPitch==-Math.PI||(u=!0),c||u){var h=e._TmpMats[2],d=e._TmpMats[3];if(this.upAxisSpace==_n.BONE&&1==l.y&&s)s.getRotationMatrixToRef(_n.WORLD,this.mesh,h);else if(this.upAxisSpace!=_n.LOCAL||1!=l.y||s){var p=e._TmpVecs[2];p.copyFrom(this._fowardAxis),this._transformYawPitch&&x.TransformCoordinatesToRef(p,this._transformYawPitchInv,p),s?s.getDirectionToRef(p,this.mesh,p):a.getDirectionToRef(p,p);var f=x.Cross(l,p);f.normalize(),p=x.Cross(f,l),M.FromXYZAxesToRef(f,l,p,h)}else h.copyFrom(a.getWorldMatrix());h.invertToRef(d);var _=null;if(u){var m=e._TmpVecs[3];n.subtractToRef(i,m),x.TransformCoordinatesToRef(m,d,m),_=Math.sqrt(m.x*m.x+m.z*m.z);var g=Math.atan2(m.y,_),v=g;g>this._maxPitch?(m.y=this._maxPitchTan*_,v=this._maxPitch):gthis._maxYaw||yMath.PI?this._isAngleBetween(y,this._maxYaw,this._midYawConstraint)?(m.z=this._maxYawCos*_,m.x=this._maxYawSin*_,b=this._maxYaw):this._isAngleBetween(y,this._midYawConstraint,this._minYaw)&&(m.z=this._minYawCos*_,m.x=this._minYawSin*_,b=this._minYaw):y>this._maxYaw?(m.z=this._maxYawCos*_,m.x=this._maxYawSin*_,b=this._maxYaw):yMath.PI){var T=e._TmpVecs[8];T.copyFrom(vn.Z),this._transformYawPitch&&x.TransformCoordinatesToRef(T,this._transformYawPitchInv,T);var E=e._TmpMats[4];this._boneQuat.toRotationMatrix(E),this.mesh.getWorldMatrix().multiplyToRef(E,E),x.TransformCoordinatesToRef(T,E,T),x.TransformCoordinatesToRef(T,d,T);var S=Math.atan2(T.x,T.z);if(this._getAngleBetween(S,y)>this._getAngleBetween(S,this._midYawConstraint)){null==_&&(_=Math.sqrt(m.x*m.x+m.z*m.z));var A=this._getAngleBetween(S,this._maxYaw);this._getAngleBetween(S,this._minYaw)Math.PI?i-=2*Math.PI:i<-Math.PI&&(i+=2*Math.PI),i},e.prototype._getAngleBetween=function(e,t){var i=0;return(i=(e=(e%=2*Math.PI)<0?e+2*Math.PI:e)<(t=(t%=2*Math.PI)<0?t+2*Math.PI:t)?t-e:e-t)>Math.PI&&(i=2*Math.PI-i),i},e.prototype._isAngleBetween=function(e,t,i){if(e=(e%=2*Math.PI)<0?e+2*Math.PI:e,(t=(t%=2*Math.PI)<0?t+2*Math.PI:t)<(i=(i%=2*Math.PI)<0?i+2*Math.PI:i)){if(e>t&&ei&&e0}return Object.defineProperty(e.prototype,\"useTextureToStoreBoneMatrices\",{get:function(){return this._useTextureToStoreBoneMatrices},set:function(e){this._useTextureToStoreBoneMatrices=e,this._markAsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"animationPropertiesOverride\",{get:function(){return this._animationPropertiesOverride?this._animationPropertiesOverride:this._scene.animationPropertiesOverride},set:function(e){this._animationPropertiesOverride=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"isUsingTextureForMatrices\",{get:function(){return this.useTextureToStoreBoneMatrices&&this._canUseTextureForBones},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"uniqueId\",{get:function(){return this._uniqueId},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return\"Skeleton\"},e.prototype.getChildren=function(){return this.bones.filter((function(e){return!e.getParent()}))},e.prototype.getTransformMatrices=function(e){return this.needInitialSkinMatrix?(e._bonesTransformMatrices||this.prepare(),e._bonesTransformMatrices):(this._transformMatrices||this.prepare(),this._transformMatrices)},e.prototype.getTransformMatrixTexture=function(e){return this.needInitialSkinMatrix&&e._transformMatrixTexture?e._transformMatrixTexture:this._transformMatrixTexture},e.prototype.getScene=function(){return this._scene},e.prototype.toString=function(e){var t=\"Name: \".concat(this.name,\", nBones: \").concat(this.bones.length);if(t+=\", nAnimationRanges: \".concat(this._ranges?Object.keys(this._ranges).length:\"none\"),e){t+=\", Ranges: {\";var i=!0;for(var n in this._ranges)i&&(t+=\", \",i=!1),t+=n;t+=\"}\"}return t},e.prototype.getBoneIndexByName=function(e){for(var t=0,i=this.bones.length;t-1&&this._meshesWithPoseMatrix.splice(t,1)},e.prototype._computeTransformMatrices=function(e,t){this.onBeforeComputeObservable.notifyObservers(this);for(var i=0;i0)for(var e=0,t=this.bones;e-1&&this._parentContainer.skeletons.splice(e,1),this._parentContainer=null}this._transformMatrixTexture&&(this._transformMatrixTexture.dispose(),this._transformMatrixTexture=null)},e.prototype.serialize=function(){var e,t={};t.name=this.name,t.id=this.id,this.dimensionsAtRest&&(t.dimensionsAtRest=this.dimensionsAtRest.asArray()),t.bones=[],t.needInitialSkinMatrix=this.needInitialSkinMatrix;for(var i=0;i0&&(o.animation=n.animations[0].serialize()),t.ranges=[],this._ranges){var s=this._ranges[a];if(s){var l={};l.name=a,l.from=s.from,l.to=s.to,t.ranges.push(l)}}}return t},e.Parse=function(t,i){var n,r=new e(t.name,t.id,i);for(t.dimensionsAtRest&&(r.dimensionsAtRest=x.FromArray(t.dimensionsAtRest)),r.needInitialSkinMatrix=t.needInitialSkinMatrix,n=0;n-1&&(s=r.bones[o.parentBoneIndex]);var l=o.rest?M.FromArray(o.rest):null,c=new yn(o.name,r,s,M.FromArray(o.matrix),l,null,a);void 0!==o.id&&null!==o.id&&(c.id=o.id),o.length&&(c.length=o.length),o.metadata&&(c.metadata=o.metadata),o.animation&&c.animations.push(ze.Parse(o.animation)),void 0!==o.linkedTransformNodeId&&null!==o.linkedTransformNodeId&&(r._hasWaitingData=!0,c._waitingTransformNodeId=o.linkedTransformNodeId)}if(t.ranges)for(n=0;n0&&(e=this._meshesWithPoseMatrix[0].getPoseMatrix()),e},e.prototype.sortBones=function(){for(var e=new Array,t=new Array(this.bones.length),i=0;i=2&&(this._leftStick={x:this.browserGamepad.axes[this._leftStickAxisX],y:this.browserGamepad.axes[this._leftStickAxisY]}),this.browserGamepad.axes.length>=4&&(this._rightStick={x:this.browserGamepad.axes[this._rightStickAxisX],y:this.browserGamepad.axes[this._rightStickAxisY]})}return Object.defineProperty(e.prototype,\"isConnected\",{get:function(){return this._isConnected},enumerable:!1,configurable:!0}),e.prototype.onleftstickchanged=function(e){this._onleftstickchanged=e},e.prototype.onrightstickchanged=function(e){this._onrightstickchanged=e},Object.defineProperty(e.prototype,\"leftStick\",{get:function(){return this._leftStick},set:function(e){!this._onleftstickchanged||this._leftStick.x===e.x&&this._leftStick.y===e.y||this._onleftstickchanged(e),this._leftStick=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"rightStick\",{get:function(){return this._rightStick},set:function(e){!this._onrightstickchanged||this._rightStick.x===e.x&&this._rightStick.y===e.y||this._onrightstickchanged(e),this._rightStick=e},enumerable:!1,configurable:!0}),e.prototype.update=function(){this._leftStick&&(this.leftStick={x:this.browserGamepad.axes[this._leftStickAxisX],y:this.browserGamepad.axes[this._leftStickAxisY]},this._invertLeftStickY&&(this.leftStick.y*=-1)),this._rightStick&&(this.rightStick={x:this.browserGamepad.axes[this._rightStickAxisX],y:this.browserGamepad.axes[this._rightStickAxisY]})},e.prototype.dispose=function(){},e.GAMEPAD=0,e.GENERIC=1,e.XBOX=2,e.POSE_ENABLED=3,e.DUALSHOCK=4,e}(),ls=function(e){function t(t,i,n){var r=e.call(this,t,i,n)||this;return r.onButtonDownObservable=new u,r.onButtonUpObservable=new u,r.type=ss.GENERIC,r._buttons=new Array(n.buttons.length),r}return V(t,e),t.prototype.onbuttondown=function(e){this._onbuttondown=e},t.prototype.onbuttonup=function(e){this._onbuttonup=e},t.prototype._setButtonValue=function(e,t,i){return e!==t&&(1===e&&(this._onbuttondown&&this._onbuttondown(i),this.onButtonDownObservable.notifyObservers(i)),0===e&&(this._onbuttonup&&this._onbuttonup(i),this.onButtonUpObservable.notifyObservers(i))),e},t.prototype.update=function(){e.prototype.update.call(this);for(var t=0;t.005&&(e.inertialAlphaOffset+=i)}if(0!=t.y){var n=t.y/this.gamepadRotationSensibility*this._yAxisScale;0!=n&&Math.abs(n)>.005&&(e.inertialBetaOffset+=n)}}var r=this.gamepad.leftStick;if(r&&0!=r.y){var o=r.y/this.gamepadMoveSensibility;0!=o&&Math.abs(o)>.005&&(this.camera.inertialRadiusOffset-=o)}}},e.prototype.getClassName=function(){return\"ArcRotateCameraGamepadInput\"},e.prototype.getSimpleName=function(){return\"gamepad\"},G([be()],e.prototype,\"gamepadRotationSensibility\",void 0),G([be()],e.prototype,\"gamepadMoveSensibility\",void 0),e}();rs.ArcRotateCameraGamepadInput=cs;var us=function(){function e(){this.keysUp=[38],this.keysDown=[40],this.keysLeft=[37],this.keysRight=[39],this.keysReset=[220],this.panningSensibility=50,this.zoomingSensibility=25,this.useAltToZoom=!0,this.angularSpeed=.01,this._keys=new Array}return e.prototype.attachControl=function(e){var t=this;e=mi.BackCompatCameraNoPreventDefault(arguments),this._onCanvasBlurObserver||(this._scene=this.camera.getScene(),this._engine=this._scene.getEngine(),this._onCanvasBlurObserver=this._engine.onCanvasBlurObservable.add((function(){t._keys.length=0})),this._onKeyboardObserver=this._scene.onKeyboardObservable.add((function(i){var n,r=i.event;r.metaKey||(i.type===Ki.KEYDOWN?(t._ctrlPressed=r.ctrlKey,t._altPressed=r.altKey,(-1!==t.keysUp.indexOf(r.keyCode)||-1!==t.keysDown.indexOf(r.keyCode)||-1!==t.keysLeft.indexOf(r.keyCode)||-1!==t.keysRight.indexOf(r.keyCode)||-1!==t.keysReset.indexOf(r.keyCode))&&(-1===(n=t._keys.indexOf(r.keyCode))&&t._keys.push(r.keyCode),r.preventDefault&&(e||r.preventDefault()))):-1===t.keysUp.indexOf(r.keyCode)&&-1===t.keysDown.indexOf(r.keyCode)&&-1===t.keysLeft.indexOf(r.keyCode)&&-1===t.keysRight.indexOf(r.keyCode)&&-1===t.keysReset.indexOf(r.keyCode)||((n=t._keys.indexOf(r.keyCode))>=0&&t._keys.splice(n,1),r.preventDefault&&(e||r.preventDefault())))})))},e.prototype.detachControl=function(){this._scene&&(this._onKeyboardObserver&&this._scene.onKeyboardObservable.remove(this._onKeyboardObserver),this._onCanvasBlurObserver&&this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver),this._onKeyboardObserver=null,this._onCanvasBlurObserver=null),this._keys.length=0},e.prototype.checkInputs=function(){if(this._onKeyboardObserver)for(var e=this.camera,t=0;t0?i/(1+this.wheelDeltaPercentage):i*(1+this.wheelDeltaPercentage)},e.prototype.attachControl=function(e){var t=this;e=mi.BackCompatCameraNoPreventDefault(arguments),this._wheel=function(i){if(i.type===Hi.POINTERWHEEL){var n=i.event,r=0,o=n.deltaMode===Ji.DOM_DELTA_LINE?40:1,a=-n.deltaY*o;if(t.customComputeDeltaFromMouseWheel)r=t.customComputeDeltaFromMouseWheel(a,t,n);else if(t.wheelDeltaPercentage){if((r=t._computeDeltaFromMouseWheelLegacyEvent(a,t.camera.radius))>0){for(var s=t.camera.radius,l=t.camera.inertialRadiusOffset+r,c=0;c<20&&Math.abs(l)>.001;c++)s-=l,l*=t.camera.inertia;s=h.Clamp(s,0,Number.MAX_VALUE),r=t._computeDeltaFromMouseWheelLegacyEvent(a,s)}}else r=a/(40*t.wheelPrecision);r&&(t.zoomToMouseLocation&&t._hitPlane?t._zoomToMouse(r):t.camera.inertialRadiusOffset+=r),n.preventDefault&&(e||n.preventDefault())}},this._observer=this.camera.getScene().onPointerObservable.add(this._wheel,Hi.POINTERWHEEL),this.zoomToMouseLocation&&this._inertialPanning.setAll(0)},e.prototype.detachControl=function(){this._observer&&(this.camera.getScene().onPointerObservable.remove(this._observer),this._observer=null,this._wheel=null)},e.prototype.checkInputs=function(){if(this.zoomToMouseLocation){var e=this.camera;0+e.inertialAlphaOffset+e.inertialBetaOffset+e.inertialRadiusOffset&&(this._updateHitPlane(),e.target.addInPlace(this._inertialPanning),this._inertialPanning.scaleInPlace(e.inertia),this._zeroIfClose(this._inertialPanning))}},e.prototype.getClassName=function(){return\"ArcRotateCameraMouseWheelInput\"},e.prototype.getSimpleName=function(){return\"mousewheel\"},e.prototype._updateHitPlane=function(){var e=this.camera,t=e.target.subtract(e.position);this._hitPlane=un.FromPositionAndNormal(e.target,t)},e.prototype._getPosition=function(){var e,t=this.camera,i=t.getScene(),n=i.createPickingRay(i.pointerX,i.pointerY,M.Identity(),t,!1),r=0;return this._hitPlane&&(r=null!==(e=n.intersectsPlane(this._hitPlane))&&void 0!==e?e:0),n.origin.addInPlace(n.direction.scaleInPlace(r))},e.prototype._zoomToMouse=function(e){var t,i,n=this.camera,r=1-n.inertia;if(n.lowerRadiusLimit){var o=null!==(t=n.lowerRadiusLimit)&&void 0!==t?t:0;n.radius-(n.inertialRadiusOffset+e)/ra&&(e=(n.radius-a)*r-n.inertialRadiusOffset)}var s=e/r/n.radius,l=this._getPosition(),c=O.Vector3[6];l.subtractToRef(n.target,c),c.scaleInPlace(s),c.scaleInPlace(r),this._inertialPanning.addInPlace(c),n.inertialRadiusOffset+=e},e.prototype._zeroIfClose=function(e){Math.abs(e.x)<_&&(e.x=0),Math.abs(e.y)<_&&(e.y=0),Math.abs(e.z)<_&&(e.z=0)},G([be()],e.prototype,\"wheelPrecision\",void 0),G([be()],e.prototype,\"zoomToMouseLocation\",void 0),G([be()],e.prototype,\"wheelDeltaPercentage\",void 0),e}();rs.ArcRotateCameraMouseWheelInput=hs;var ds=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.buttons=[0,1,2],t.angularSensibilityX=1e3,t.angularSensibilityY=1e3,t.pinchPrecision=12,t.pinchDeltaPercentage=0,t.useNaturalPinchZoom=!1,t.pinchZoom=!0,t.panningSensibility=1e3,t.multiTouchPanning=!0,t.multiTouchPanAndZoom=!0,t.pinchInwards=!0,t._isPanClick=!1,t._twoFingerActivityCount=0,t._isPinching=!1,t}return V(t,e),t.prototype.getClassName=function(){return\"ArcRotateCameraPointersInput\"},t.prototype._computeMultiTouchPanning=function(e,t){if(0!==this.panningSensibility&&e&&t){var i=t.x-e.x,n=t.y-e.y;this.camera.inertialPanningX+=-i/this.panningSensibility,this.camera.inertialPanningY+=n/this.panningSensibility}},t.prototype._computePinchZoom=function(e,i){var n=this.camera.radius||t.MinimumRadiusForPinch;this.useNaturalPinchZoom?this.camera.radius=n*Math.sqrt(e)/Math.sqrt(i):this.pinchDeltaPercentage?this.camera.inertialRadiusOffset+=.001*(i-e)*n*this.pinchDeltaPercentage:this.camera.inertialRadiusOffset+=(i-e)/(this.pinchPrecision*(this.pinchInwards?1:-1)*(this.angularSensibilityX+this.angularSensibilityY)/2)},t.prototype.onTouch=function(e,t,i){0!==this.panningSensibility&&(this._ctrlKey&&this.camera._useCtrlForPanning||this._isPanClick)?(this.camera.inertialPanningX+=-t/this.panningSensibility,this.camera.inertialPanningY+=i/this.panningSensibility):(this.camera.inertialAlphaOffset-=t/this.angularSensibilityX,this.camera.inertialBetaOffset-=i/this.angularSensibilityY)},t.prototype.onDoubleTap=function(){this.camera.useInputToRestoreState&&this.camera.restoreState()},t.prototype.onMultiTouch=function(e,t,i,n,r,o){0===i&&null===r||0===n&&null===o||(this.multiTouchPanAndZoom?(this._computePinchZoom(i,n),this._computeMultiTouchPanning(r,o)):this.multiTouchPanning&&this.pinchZoom?(this._twoFingerActivityCount++,this._isPinching||this._twoFingerActivityCount<20&&Math.abs(Math.sqrt(n)-Math.sqrt(i))>this.camera.pinchToPanMaxDistance?(this._computePinchZoom(i,n),this._isPinching=!0):this._computeMultiTouchPanning(r,o)):this.multiTouchPanning?this._computeMultiTouchPanning(r,o):this.pinchZoom&&this._computePinchZoom(i,n))},t.prototype.onButtonDown=function(e){this._isPanClick=e.button===this.camera._panningMouseButton},t.prototype.onButtonUp=function(){this._twoFingerActivityCount=0,this._isPinching=!1},t.prototype.onLostFocus=function(){this._isPanClick=!1,this._twoFingerActivityCount=0,this._isPinching=!1},t.MinimumRadiusForPinch=.001,G([be()],t.prototype,\"buttons\",void 0),G([be()],t.prototype,\"angularSensibilityX\",void 0),G([be()],t.prototype,\"angularSensibilityY\",void 0),G([be()],t.prototype,\"pinchPrecision\",void 0),G([be()],t.prototype,\"pinchDeltaPercentage\",void 0),G([be()],t.prototype,\"useNaturalPinchZoom\",void 0),G([be()],t.prototype,\"pinchZoom\",void 0),G([be()],t.prototype,\"panningSensibility\",void 0),G([be()],t.prototype,\"multiTouchPanning\",void 0),G([be()],t.prototype,\"multiTouchPanAndZoom\",void 0),t}(ns);rs.ArcRotateCameraPointersInput=ds;var ps=function(e){function t(t){return e.call(this,t)||this}return V(t,e),t.prototype.addMouseWheel=function(){return this.add(new hs),this},t.prototype.addPointers=function(){return this.add(new ds),this},t.prototype.addKeyboard=function(){return this.add(new us),this},t}(os);ps.prototype.addVRDeviceOrientation=function(){return this.add(new fs),this};var fs=function(){function e(){this.alphaCorrection=1,this.gammaCorrection=1,this._alpha=0,this._gamma=0,this._dirty=!1,this._deviceOrientationHandler=this._onOrientationEvent.bind(this)}return e.prototype.attachControl=function(e){var t=this;e=mi.BackCompatCameraNoPreventDefault(arguments),this.camera.attachControl(e);var i=this.camera.getScene().getEngine().getHostWindow();i&&(\"undefined\"!=typeof DeviceOrientationEvent&&\"function\"==typeof DeviceOrientationEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((function(e){\"granted\"===e?i.addEventListener(\"deviceorientation\",t._deviceOrientationHandler):mi.Warn(\"Permission not granted.\")})).catch((function(e){mi.Error(e)})):i.addEventListener(\"deviceorientation\",this._deviceOrientationHandler))},e.prototype._onOrientationEvent=function(e){null!==e.alpha&&(this._alpha=(0|+e.alpha)*this.alphaCorrection),null!==e.gamma&&(this._gamma=(0|+e.gamma)*this.gammaCorrection),this._dirty=!0},e.prototype.checkInputs=function(){this._dirty&&(this._dirty=!1,this._gamma<0&&(this._gamma=180+this._gamma),this.camera.alpha=-this._alpha/180*Math.PI%Math.PI*2,this.camera.beta=this._gamma/180*Math.PI)},e.prototype.detachControl=function(){window.removeEventListener(\"deviceorientation\",this._deviceOrientationHandler)},e.prototype.getClassName=function(){return\"ArcRotateCameraVRDeviceOrientationInput\"},e.prototype.getSimpleName=function(){return\"VRDeviceOrientation\"},e}();rs.ArcRotateCameraVRDeviceOrientationInput=fs;var _s=function(){function e(){this.keysForward=[87],this.keysBackward=[83],this.keysUp=[69],this.keysDown=[81],this.keysRight=[68],this.keysLeft=[65],this._keys=new Array}return e.prototype.attachControl=function(e){var t=this;e=mi.BackCompatCameraNoPreventDefault(arguments),this._onCanvasBlurObserver||(this._scene=this.camera.getScene(),this._engine=this._scene.getEngine(),this._onCanvasBlurObserver=this._engine.onCanvasBlurObservable.add((function(){t._keys.length=0})),this._onKeyboardObserver=this._scene.onKeyboardObservable.add((function(i){var n,r=i.event;i.type===Ki.KEYDOWN?-1===t.keysForward.indexOf(r.keyCode)&&-1===t.keysBackward.indexOf(r.keyCode)&&-1===t.keysUp.indexOf(r.keyCode)&&-1===t.keysDown.indexOf(r.keyCode)&&-1===t.keysLeft.indexOf(r.keyCode)&&-1===t.keysRight.indexOf(r.keyCode)||(-1===(n=t._keys.indexOf(r.keyCode))&&t._keys.push(r.keyCode),e||r.preventDefault()):-1===t.keysForward.indexOf(r.keyCode)&&-1===t.keysBackward.indexOf(r.keyCode)&&-1===t.keysUp.indexOf(r.keyCode)&&-1===t.keysDown.indexOf(r.keyCode)&&-1===t.keysLeft.indexOf(r.keyCode)&&-1===t.keysRight.indexOf(r.keyCode)||((n=t._keys.indexOf(r.keyCode))>=0&&t._keys.splice(n,1),e||r.preventDefault())})))},e.prototype.detachControl=function(){this._scene&&(this._onKeyboardObserver&&this._scene.onKeyboardObservable.remove(this._onKeyboardObserver),this._onCanvasBlurObserver&&this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver),this._onKeyboardObserver=null,this._onCanvasBlurObserver=null),this._keys.length=0},e.prototype.getClassName=function(){return\"FlyCameraKeyboardInput\"},e.prototype._onLostFocus=function(){this._keys.length=0},e.prototype.getSimpleName=function(){return\"keyboard\"},e.prototype.checkInputs=function(){if(this._onKeyboardObserver)for(var e=this.camera,t=0;t=0&&t._keys.splice(n,1),r.preventDefault&&(e||r.preventDefault())))})))},e.prototype.detachControl=function(){this._scene&&(this._onKeyboardObserver&&this._scene.onKeyboardObservable.remove(this._onKeyboardObserver),this._onCanvasBlurObserver&&this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver),this._onKeyboardObserver=null,this._onCanvasBlurObserver=null),this._keys.length=0},e.prototype.checkInputs=function(){var e=this;this._onKeyboardObserver&&this._keys.forEach((function(t){-1!==e.keysHeightOffsetIncr.indexOf(t)&&e._modifierHeightOffset()?e.camera.heightOffset+=e.heightSensibility:-1!==e.keysHeightOffsetDecr.indexOf(t)&&e._modifierHeightOffset()?e.camera.heightOffset-=e.heightSensibility:-1!==e.keysRotationOffsetIncr.indexOf(t)&&e._modifierRotationOffset()?(e.camera.rotationOffset+=e.rotationSensibility,e.camera.rotationOffset%=360):-1!==e.keysRotationOffsetDecr.indexOf(t)&&e._modifierRotationOffset()?(e.camera.rotationOffset-=e.rotationSensibility,e.camera.rotationOffset%=360):-1!==e.keysRadiusIncr.indexOf(t)&&e._modifierRadius()?e.camera.radius+=e.radiusSensibility:-1!==e.keysRadiusDecr.indexOf(t)&&e._modifierRadius()&&(e.camera.radius-=e.radiusSensibility)}))},e.prototype.getClassName=function(){return\"FollowCameraKeyboardMoveInput\"},e.prototype.getSimpleName=function(){return\"keyboard\"},e.prototype._modifierHeightOffset=function(){return this.keysHeightOffsetModifierAlt===this._altPressed&&this.keysHeightOffsetModifierCtrl===this._ctrlPressed&&this.keysHeightOffsetModifierShift===this._shiftPressed},e.prototype._modifierRotationOffset=function(){return this.keysRotationOffsetModifierAlt===this._altPressed&&this.keysRotationOffsetModifierCtrl===this._ctrlPressed&&this.keysRotationOffsetModifierShift===this._shiftPressed},e.prototype._modifierRadius=function(){return this.keysRadiusModifierAlt===this._altPressed&&this.keysRadiusModifierCtrl===this._ctrlPressed&&this.keysRadiusModifierShift===this._shiftPressed},G([be()],e.prototype,\"keysHeightOffsetIncr\",void 0),G([be()],e.prototype,\"keysHeightOffsetDecr\",void 0),G([be()],e.prototype,\"keysHeightOffsetModifierAlt\",void 0),G([be()],e.prototype,\"keysHeightOffsetModifierCtrl\",void 0),G([be()],e.prototype,\"keysHeightOffsetModifierShift\",void 0),G([be()],e.prototype,\"keysRotationOffsetIncr\",void 0),G([be()],e.prototype,\"keysRotationOffsetDecr\",void 0),G([be()],e.prototype,\"keysRotationOffsetModifierAlt\",void 0),G([be()],e.prototype,\"keysRotationOffsetModifierCtrl\",void 0),G([be()],e.prototype,\"keysRotationOffsetModifierShift\",void 0),G([be()],e.prototype,\"keysRadiusIncr\",void 0),G([be()],e.prototype,\"keysRadiusDecr\",void 0),G([be()],e.prototype,\"keysRadiusModifierAlt\",void 0),G([be()],e.prototype,\"keysRadiusModifierCtrl\",void 0),G([be()],e.prototype,\"keysRadiusModifierShift\",void 0),G([be()],e.prototype,\"heightSensibility\",void 0),G([be()],e.prototype,\"rotationSensibility\",void 0),G([be()],e.prototype,\"radiusSensibility\",void 0),e}();rs.FollowCameraKeyboardMoveInput=gs;var vs=function(){function e(){this.axisControlRadius=!0,this.axisControlHeight=!1,this.axisControlRotation=!1,this.wheelPrecision=3,this.wheelDeltaPercentage=0}return e.prototype.attachControl=function(e){var t=this;e=mi.BackCompatCameraNoPreventDefault(arguments),this._wheel=function(i){if(i.type===Hi.POINTERWHEEL){var n=i.event,r=0,o=Math.max(-1,Math.min(1,n.deltaY));t.wheelDeltaPercentage?(console.assert(t.axisControlRadius+t.axisControlHeight+t.axisControlRotation<=1,\"wheelDeltaPercentage only usable when mouse wheel controls ONE axis. Currently enabled: axisControlRadius: \"+t.axisControlRadius+\", axisControlHeightOffset: \"+t.axisControlHeight+\", axisControlRotationOffset: \"+t.axisControlRotation),t.axisControlRadius?r=.01*o*t.wheelDeltaPercentage*t.camera.radius:t.axisControlHeight?r=.01*o*t.wheelDeltaPercentage*t.camera.heightOffset:t.axisControlRotation&&(r=.01*o*t.wheelDeltaPercentage*t.camera.rotationOffset)):r=o*t.wheelPrecision,r&&(t.axisControlRadius?t.camera.radius+=r:t.axisControlHeight?t.camera.heightOffset-=r:t.axisControlRotation&&(t.camera.rotationOffset-=r)),n.preventDefault&&(e||n.preventDefault())}},this._observer=this.camera.getScene().onPointerObservable.add(this._wheel,Hi.POINTERWHEEL)},e.prototype.detachControl=function(){this._observer&&(this.camera.getScene().onPointerObservable.remove(this._observer),this._observer=null,this._wheel=null)},e.prototype.getClassName=function(){return\"ArcRotateCameraMouseWheelInput\"},e.prototype.getSimpleName=function(){return\"mousewheel\"},G([be()],e.prototype,\"axisControlRadius\",void 0),G([be()],e.prototype,\"axisControlHeight\",void 0),G([be()],e.prototype,\"axisControlRotation\",void 0),G([be()],e.prototype,\"wheelPrecision\",void 0),G([be()],e.prototype,\"wheelDeltaPercentage\",void 0),e}();rs.FollowCameraMouseWheelInput=vs;var ys=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.angularSensibilityX=1,t.angularSensibilityY=1,t.pinchPrecision=1e4,t.pinchDeltaPercentage=0,t.axisXControlRadius=!1,t.axisXControlHeight=!1,t.axisXControlRotation=!0,t.axisYControlRadius=!1,t.axisYControlHeight=!0,t.axisYControlRotation=!1,t.axisPinchControlRadius=!0,t.axisPinchControlHeight=!1,t.axisPinchControlRotation=!1,t.warningEnable=!0,t._warningCounter=0,t}return V(t,e),t.prototype.getClassName=function(){return\"FollowCameraPointersInput\"},t.prototype.onTouch=function(e,t,i){this._warning(),this.axisXControlRotation?this.camera.rotationOffset+=t/this.angularSensibilityX:this.axisYControlRotation&&(this.camera.rotationOffset+=i/this.angularSensibilityX),this.axisXControlHeight?this.camera.heightOffset+=t/this.angularSensibilityY:this.axisYControlHeight&&(this.camera.heightOffset+=i/this.angularSensibilityY),this.axisXControlRadius?this.camera.radius-=t/this.angularSensibilityY:this.axisYControlRadius&&(this.camera.radius-=i/this.angularSensibilityY)},t.prototype.onMultiTouch=function(e,t,i,n,r,o){if(!(0===i&&null===r||0===n&&null===o)){var a=(n-i)/(this.pinchPrecision*(this.angularSensibilityX+this.angularSensibilityY)/2);this.pinchDeltaPercentage?(a*=.01*this.pinchDeltaPercentage,this.axisPinchControlRotation&&(this.camera.rotationOffset+=a*this.camera.rotationOffset),this.axisPinchControlHeight&&(this.camera.heightOffset+=a*this.camera.heightOffset),this.axisPinchControlRadius&&(this.camera.radius-=a*this.camera.radius)):(this.axisPinchControlRotation&&(this.camera.rotationOffset+=a),this.axisPinchControlHeight&&(this.camera.heightOffset+=a),this.axisPinchControlRadius&&(this.camera.radius-=a))}},t.prototype._warning=function(){if(this.warningEnable&&this._warningCounter++%100==0){var e=\"It probably only makes sense to control ONE camera property with each pointer axis. Set 'warningEnable = false' if you are sure. Currently enabled: \";console.assert(this.axisXControlRotation+this.axisXControlHeight+this.axisXControlRadius<=1,e+\"axisXControlRotation: \"+this.axisXControlRotation+\", axisXControlHeight: \"+this.axisXControlHeight+\", axisXControlRadius: \"+this.axisXControlRadius),console.assert(this.axisYControlRotation+this.axisYControlHeight+this.axisYControlRadius<=1,e+\"axisYControlRotation: \"+this.axisYControlRotation+\", axisYControlHeight: \"+this.axisYControlHeight+\", axisYControlRadius: \"+this.axisYControlRadius),console.assert(this.axisPinchControlRotation+this.axisPinchControlHeight+this.axisPinchControlRadius<=1,e+\"axisPinchControlRotation: \"+this.axisPinchControlRotation+\", axisPinchControlHeight: \"+this.axisPinchControlHeight+\", axisPinchControlRadius: \"+this.axisPinchControlRadius)}},G([be()],t.prototype,\"angularSensibilityX\",void 0),G([be()],t.prototype,\"angularSensibilityY\",void 0),G([be()],t.prototype,\"pinchPrecision\",void 0),G([be()],t.prototype,\"pinchDeltaPercentage\",void 0),G([be()],t.prototype,\"axisXControlRadius\",void 0),G([be()],t.prototype,\"axisXControlHeight\",void 0),G([be()],t.prototype,\"axisXControlRotation\",void 0),G([be()],t.prototype,\"axisYControlRadius\",void 0),G([be()],t.prototype,\"axisYControlHeight\",void 0),G([be()],t.prototype,\"axisYControlRotation\",void 0),G([be()],t.prototype,\"axisPinchControlRadius\",void 0),G([be()],t.prototype,\"axisPinchControlHeight\",void 0),G([be()],t.prototype,\"axisPinchControlRotation\",void 0),t}(ns);rs.FollowCameraPointersInput=ys;var bs=function(){function e(){this.keysUp=[38],this.keysUpward=[33],this.keysDown=[40],this.keysDownward=[34],this.keysLeft=[37],this.keysRight=[39],this.rotationSpeed=.5,this.keysRotateLeft=[],this.keysRotateRight=[],this._keys=new Array}return e.prototype.attachControl=function(e){var t=this;e=mi.BackCompatCameraNoPreventDefault(arguments),this._onCanvasBlurObserver||(this._scene=this.camera.getScene(),this._engine=this._scene.getEngine(),this._onCanvasBlurObserver=this._engine.onCanvasBlurObservable.add((function(){t._keys.length=0})),this._onKeyboardObserver=this._scene.onKeyboardObservable.add((function(i){var n,r=i.event;r.metaKey||(i.type===Ki.KEYDOWN?-1===t.keysUp.indexOf(r.keyCode)&&-1===t.keysDown.indexOf(r.keyCode)&&-1===t.keysLeft.indexOf(r.keyCode)&&-1===t.keysRight.indexOf(r.keyCode)&&-1===t.keysUpward.indexOf(r.keyCode)&&-1===t.keysDownward.indexOf(r.keyCode)&&-1===t.keysRotateLeft.indexOf(r.keyCode)&&-1===t.keysRotateRight.indexOf(r.keyCode)||(-1===(n=t._keys.indexOf(r.keyCode))&&t._keys.push(r.keyCode),e||r.preventDefault()):-1===t.keysUp.indexOf(r.keyCode)&&-1===t.keysDown.indexOf(r.keyCode)&&-1===t.keysLeft.indexOf(r.keyCode)&&-1===t.keysRight.indexOf(r.keyCode)&&-1===t.keysUpward.indexOf(r.keyCode)&&-1===t.keysDownward.indexOf(r.keyCode)&&-1===t.keysRotateLeft.indexOf(r.keyCode)&&-1===t.keysRotateRight.indexOf(r.keyCode)||((n=t._keys.indexOf(r.keyCode))>=0&&t._keys.splice(n,1),e||r.preventDefault()))})))},e.prototype.detachControl=function(){this._scene&&(this._onKeyboardObserver&&this._scene.onKeyboardObservable.remove(this._onKeyboardObserver),this._onCanvasBlurObserver&&this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver),this._onKeyboardObserver=null,this._onCanvasBlurObserver=null),this._keys.length=0},e.prototype.checkInputs=function(){if(this._onKeyboardObserver)for(var e=this.camera,t=0;t1)e.cameraRotation.x=-this._offsetY/this.touchAngularSensibility;else{var t=e._computeLocalCameraSpeed(),i=new x(0,0,0!==this.touchMoveSensibility?t*this._offsetY/this.touchMoveSensibility:0);M.RotationYawPitchRollToRef(e.rotation.y,e.rotation.x,0,e._cameraRotationMatrix),e.cameraDirection.addInPlace(x.TransformCoordinates(i,e._cameraRotationMatrix))}}},e.prototype.getClassName=function(){return\"FreeCameraTouchInput\"},e.prototype.getSimpleName=function(){return\"touch\"},G([be()],e.prototype,\"touchAngularSensibility\",void 0),G([be()],e.prototype,\"touchMoveSensibility\",void 0),e}();rs.FreeCameraTouchInput=As;var Rs=function(e){function t(t){var i=e.call(this,t)||this;return i._mouseInput=null,i._mouseWheelInput=null,i}return V(t,e),t.prototype.addKeyboard=function(){return this.add(new bs),this},t.prototype.addMouse=function(e){return void 0===e&&(e=!0),this._mouseInput||(this._mouseInput=new Es(e),this.add(this._mouseInput)),this},t.prototype.removeMouse=function(){return this._mouseInput&&this.remove(this._mouseInput),this},t.prototype.addMouseWheel=function(){return this._mouseWheelInput||(this._mouseWheelInput=new Ss,this.add(this._mouseWheelInput)),this},t.prototype.removeMouseWheel=function(){return this._mouseWheelInput&&this.remove(this._mouseWheelInput),this},t.prototype.addTouch=function(){return this.add(new As),this},t.prototype.clear=function(){e.prototype.clear.call(this),this._mouseInput=null},t}(os);Rs.prototype.addDeviceOrientation=function(e){return this._deviceOrientationInput||(this._deviceOrientationInput=new xs,e&&(this._deviceOrientationInput.smoothFactor=e),this.add(this._deviceOrientationInput)),this};var xs=function(){function e(){var e=this;this._screenOrientationAngle=0,this._screenQuaternion=new P,this._alpha=0,this._beta=0,this._gamma=0,this.smoothFactor=0,this._onDeviceOrientationChangedObservable=new u,this._orientationChanged=function(){e._screenOrientationAngle=void 0!==window.orientation?+window.orientation:window.screen.orientation&&window.screen.orientation.angle?window.screen.orientation.angle:0,e._screenOrientationAngle=-mi.ToRadians(e._screenOrientationAngle/2),e._screenQuaternion.copyFromFloats(0,Math.sin(e._screenOrientationAngle),0,Math.cos(e._screenOrientationAngle))},this._deviceOrientation=function(t){e.smoothFactor?(e._alpha=null!==t.alpha?mi.SmoothAngleChange(e._alpha,t.alpha,e.smoothFactor):0,e._beta=null!==t.beta?mi.SmoothAngleChange(e._beta,t.beta,e.smoothFactor):0,e._gamma=null!==t.gamma?mi.SmoothAngleChange(e._gamma,t.gamma,e.smoothFactor):0):(e._alpha=null!==t.alpha?t.alpha:0,e._beta=null!==t.beta?t.beta:0,e._gamma=null!==t.gamma?t.gamma:0),null!==t.alpha&&e._onDeviceOrientationChangedObservable.notifyObservers()},this._constantTranform=new P(-Math.sqrt(.5),0,0,Math.sqrt(.5)),this._orientationChanged()}return e.WaitForOrientationChangeAsync=function(e){return new Promise((function(t,i){var n=!1,r=function(){window.removeEventListener(\"deviceorientation\",r),n=!0,t()};e&&setTimeout((function(){n||(window.removeEventListener(\"deviceorientation\",r),i(\"WaitForOrientationChangeAsync timed out\"))}),e),\"undefined\"!=typeof DeviceOrientationEvent&&\"function\"==typeof DeviceOrientationEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((function(e){\"granted\"==e?window.addEventListener(\"deviceorientation\",r):mi.Warn(\"Permission not granted.\")})).catch((function(e){mi.Error(e)})):window.addEventListener(\"deviceorientation\",r)}))},Object.defineProperty(e.prototype,\"camera\",{get:function(){return this._camera},set:function(e){var t=this;this._camera=e,null==this._camera||this._camera.rotationQuaternion||(this._camera.rotationQuaternion=new P),this._camera&&this._camera.onDisposeObservable.add((function(){t._onDeviceOrientationChangedObservable.clear()}))},enumerable:!1,configurable:!0}),e.prototype.attachControl=function(){var e=this,t=this.camera.getScene().getEngine().getHostWindow();if(t){var i=function(){t.addEventListener(\"orientationchange\",e._orientationChanged),t.addEventListener(\"deviceorientation\",e._deviceOrientation),e._orientationChanged()};\"undefined\"!=typeof DeviceOrientationEvent&&\"function\"==typeof DeviceOrientationEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((function(e){\"granted\"===e?i():mi.Warn(\"Permission not granted.\")})).catch((function(e){mi.Error(e)})):i()}},e.prototype.detachControl=function(){window.removeEventListener(\"orientationchange\",this._orientationChanged),window.removeEventListener(\"deviceorientation\",this._deviceOrientation),this._alpha=0},e.prototype.checkInputs=function(){this._alpha&&(P.RotationYawPitchRollToRef(mi.ToRadians(this._alpha),mi.ToRadians(this._beta),-mi.ToRadians(this._gamma),this.camera.rotationQuaternion),this._camera.rotationQuaternion.multiplyInPlace(this._screenQuaternion),this._camera.rotationQuaternion.multiplyInPlace(this._constantTranform),this._camera.rotationQuaternion.z*=-1,this._camera.rotationQuaternion.w*=-1)},e.prototype.getClassName=function(){return\"FreeCameraDeviceOrientationInput\"},e.prototype.getSimpleName=function(){return\"deviceOrientation\"},e}();rs.FreeCameraDeviceOrientationInput=xs;var Cs,Ps=function(){function e(){this.gamepadAngularSensibility=200,this.gamepadMoveSensibility=40,this.deadzoneDelta=.1,this._yAxisScale=1,this._cameraTransform=M.Identity(),this._deltaTransform=x.Zero(),this._vector3=x.Zero(),this._vector2=R.Zero()}return Object.defineProperty(e.prototype,\"invertYAxis\",{get:function(){return 1!==this._yAxisScale},set:function(e){this._yAxisScale=e?-1:1},enumerable:!1,configurable:!0}),e.prototype.attachControl=function(){var e=this,t=this.camera.getScene().gamepadManager;this._onGamepadConnectedObserver=t.onGamepadConnectedObservable.add((function(t){t.type!==ss.POSE_ENABLED&&(e.gamepad&&t.type!==ss.XBOX||(e.gamepad=t))})),this._onGamepadDisconnectedObserver=t.onGamepadDisconnectedObservable.add((function(t){e.gamepad===t&&(e.gamepad=null)})),this.gamepad=t.getGamepadByType(ss.XBOX),!this.gamepad&&t.gamepads.length&&(this.gamepad=t.gamepads[0])},e.prototype.detachControl=function(){this.camera.getScene().gamepadManager.onGamepadConnectedObservable.remove(this._onGamepadConnectedObserver),this.camera.getScene().gamepadManager.onGamepadDisconnectedObservable.remove(this._onGamepadDisconnectedObserver),this.gamepad=null},e.prototype.checkInputs=function(){if(this.gamepad&&this.gamepad.leftStick){var e=this.camera,t=this.gamepad.leftStick;0!==this.gamepadMoveSensibility&&(t.x=Math.abs(t.x)>this.deadzoneDelta?t.x/this.gamepadMoveSensibility:0,t.y=Math.abs(t.y)>this.deadzoneDelta?t.y/this.gamepadMoveSensibility:0);var i=this.gamepad.rightStick;i&&0!==this.gamepadAngularSensibility?(i.x=Math.abs(i.x)>this.deadzoneDelta?i.x/this.gamepadAngularSensibility:0,i.y=(Math.abs(i.y)>this.deadzoneDelta?i.y/this.gamepadAngularSensibility:0)*this._yAxisScale):i={x:0,y:0},e.rotationQuaternion?e.rotationQuaternion.toRotationMatrix(this._cameraTransform):M.RotationYawPitchRollToRef(e.rotation.y,e.rotation.x,0,this._cameraTransform);var n=50*e._computeLocalCameraSpeed();this._vector3.copyFromFloats(t.x*n,0,-t.y*n),x.TransformCoordinatesToRef(this._vector3,this._cameraTransform,this._deltaTransform),e.cameraDirection.addInPlace(this._deltaTransform),this._vector2.copyFromFloats(i.y,i.x),e.cameraRotation.addInPlace(this._vector2)}},e.prototype.getClassName=function(){return\"FreeCameraGamepadInput\"},e.prototype.getSimpleName=function(){return\"gamepad\"},G([be()],e.prototype,\"gamepadAngularSensibility\",void 0),G([be()],e.prototype,\"gamepadMoveSensibility\",void 0),e}();rs.FreeCameraGamepadInput=Ps,function(e){e[e.X=0]=\"X\",e[e.Y=1]=\"Y\",e[e.Z=2]=\"Z\"}(Cs||(Cs={}));var Ms=function(){function e(t,i){var n=this,r=k(k({},e._GetDefaultOptions()),i);if(this._leftJoystick=!!t,e._GlobalJoystickIndex++,this._axisTargetedByLeftAndRight=Cs.X,this._axisTargetedByUpAndDown=Cs.Y,this.reverseLeftRight=!1,this.reverseUpDown=!1,this._touches=new Ti,this.deltaPosition=x.Zero(),this._joystickSensibility=25,this._inversedSensibility=1/(this._joystickSensibility/1e3),this._onResize=function(){e._VJCanvasWidth=window.innerWidth,e._VJCanvasHeight=window.innerHeight,e.Canvas&&(e.Canvas.width=e._VJCanvasWidth,e.Canvas.height=e._VJCanvasHeight),e._HalfWidth=e._VJCanvasWidth/2},!e.Canvas){window.addEventListener(\"resize\",this._onResize,!1),e.Canvas=document.createElement(\"canvas\"),e._VJCanvasWidth=window.innerWidth,e._VJCanvasHeight=window.innerHeight,e.Canvas.width=window.innerWidth,e.Canvas.height=window.innerHeight,e.Canvas.style.width=\"100%\",e.Canvas.style.height=\"100%\",e.Canvas.style.position=\"absolute\",e.Canvas.style.backgroundColor=\"transparent\",e.Canvas.style.top=\"0px\",e.Canvas.style.left=\"0px\",e.Canvas.style.zIndex=\"5\",e.Canvas.style.touchAction=\"none\",e.Canvas.setAttribute(\"touch-action\",\"none\");var o=e.Canvas.getContext(\"2d\");if(!o)throw new Error(\"Unable to create canvas for virtual joystick\");e._VJCanvasContext=o,e._VJCanvasContext.strokeStyle=\"#ffffff\",e._VJCanvasContext.lineWidth=2,document.body.appendChild(e.Canvas)}e._HalfWidth=e.Canvas.width/2,this.pressed=!1,this.limitToContainer=r.limitToContainer,this._joystickColor=r.color,this.containerSize=r.containerSize,this.puckSize=r.puckSize,r.position&&this.setPosition(r.position.x,r.position.y),r.puckImage&&this.setPuckImage(r.puckImage),r.containerImage&&this.setContainerImage(r.containerImage),r.alwaysVisible&&e._AlwaysVisibleSticks++,this.alwaysVisible=r.alwaysVisible,this._joystickPointerId=-1,this._joystickPointerPos=new R(0,0),this._joystickPreviousPointerPos=new R(0,0),this._joystickPointerStartPos=new R(0,0),this._deltaJoystickVector=new R(0,0),this._onPointerDownHandlerRef=function(e){n._onPointerDown(e)},this._onPointerMoveHandlerRef=function(e){n._onPointerMove(e)},this._onPointerUpHandlerRef=function(e){n._onPointerUp(e)},e.Canvas.addEventListener(\"pointerdown\",this._onPointerDownHandlerRef,!1),e.Canvas.addEventListener(\"pointermove\",this._onPointerMoveHandlerRef,!1),e.Canvas.addEventListener(\"pointerup\",this._onPointerUpHandlerRef,!1),e.Canvas.addEventListener(\"pointerout\",this._onPointerUpHandlerRef,!1),e.Canvas.addEventListener(\"contextmenu\",(function(e){e.preventDefault()}),!1),requestAnimationFrame((function(){n._drawVirtualJoystick()}))}return e._GetDefaultOptions=function(){return{puckSize:40,containerSize:60,color:\"cyan\",puckImage:void 0,containerImage:void 0,position:void 0,alwaysVisible:!1,limitToContainer:!1}},e.prototype.setJoystickSensibility=function(e){this._joystickSensibility=e,this._inversedSensibility=1/(this._joystickSensibility/1e3)},e.prototype._onPointerDown=function(t){t.preventDefault(),(!0===this._leftJoystick?t.clientXe._HalfWidth)&&this._joystickPointerId<0?(this._joystickPointerId=t.pointerId,this._joystickPosition?(this._joystickPointerStartPos=this._joystickPosition.clone(),this._joystickPointerPos=this._joystickPosition.clone(),this._joystickPreviousPointerPos=this._joystickPosition.clone(),this._onPointerMove(t)):(this._joystickPointerStartPos.x=t.clientX,this._joystickPointerStartPos.y=t.clientY,this._joystickPointerPos=this._joystickPointerStartPos.clone(),this._joystickPreviousPointerPos=this._joystickPointerStartPos.clone()),this._deltaJoystickVector.x=0,this._deltaJoystickVector.y=0,this.pressed=!0,this._touches.add(t.pointerId.toString(),t)):e._GlobalJoystickIndex<2&&this._action&&(this._action(),this._touches.add(t.pointerId.toString(),{x:t.clientX,y:t.clientY,prevX:t.clientX,prevY:t.clientY}))},e.prototype._onPointerMove=function(t){if(this._joystickPointerId==t.pointerId){if(this.limitToContainer){var i=new R(t.clientX-this._joystickPointerStartPos.x,t.clientY-this._joystickPointerStartPos.y),n=i.length();n>this.containerSize&&i.scaleInPlace(this.containerSize/n),this._joystickPointerPos.x=this._joystickPointerStartPos.x+i.x,this._joystickPointerPos.y=this._joystickPointerStartPos.y+i.y}else this._joystickPointerPos.x=t.clientX,this._joystickPointerPos.y=t.clientY;this._deltaJoystickVector=this._joystickPointerPos.clone(),this._deltaJoystickVector=this._deltaJoystickVector.subtract(this._joystickPointerStartPos),0=0?this.rotation.y=-Math.atan(t.z/t.x)+Math.PI/2:this.rotation.y=-Math.atan(t.z/t.x)-Math.PI/2,this.rotation.z=0,isNaN(this.rotation.x)&&(this.rotation.x=0),isNaN(this.rotation.y)&&(this.rotation.y=0),isNaN(this.rotation.z)&&(this.rotation.z=0),this.rotationQuaternion&&P.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,this.rotationQuaternion)},Object.defineProperty(t.prototype,\"target\",{get:function(){return this.getTarget()},set:function(e){this.setTarget(e)},enumerable:!1,configurable:!0}),t.prototype.getTarget=function(){return this._currentTarget},t.prototype._decideIfNeedsToMove=function(){return Math.abs(this.cameraDirection.x)>0||Math.abs(this.cameraDirection.y)>0||Math.abs(this.cameraDirection.z)>0},t.prototype._updatePosition=function(){if(this.parent)return this.parent.getWorldMatrix().invertToRef(O.Matrix[0]),x.TransformNormalToRef(this.cameraDirection,O.Matrix[0],O.Vector3[0]),void this.position.addInPlace(O.Vector3[0]);this.position.addInPlace(this.cameraDirection)},t.prototype._checkInputs=function(){var t=this.invertRotation?-this.inverseRotationSpeed:1,i=this._decideIfNeedsToMove(),n=Math.abs(this.cameraRotation.x)>0||Math.abs(this.cameraRotation.y)>0;if(i&&this._updatePosition(),n){if(this.rotationQuaternion&&this.rotationQuaternion.toEulerAnglesToRef(this.rotation),this.rotation.x+=this.cameraRotation.x*t,this.rotation.y+=this.cameraRotation.y*t,!this.noRotationConstraint){var r=1.570796;this.rotation.x>r&&(this.rotation.x=r),this.rotation.x<-r&&(this.rotation.x=-r)}this.rotationQuaternion&&this.rotation.lengthSquared()&&P.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,this.rotationQuaternion)}i&&(Math.abs(this.cameraDirection.x)vr.CollisionsEpsilon&&(o.position.addInPlace(o._diffPosition),o.onCollide&&i&&o.onCollide(i))},o.inputs=new Rs(o),o.inputs.addKeyboard().addMouse(),o}return V(t,e),Object.defineProperty(t.prototype,\"angularSensibility\",{get:function(){var e=this.inputs.attached.mouse;return e?e.angularSensibility:0},set:function(e){var t=this.inputs.attached.mouse;t&&(t.angularSensibility=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"keysUp\",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysUp:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysUp=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"keysUpward\",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysUpward:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysUpward=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"keysDown\",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysDown:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysDown=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"keysDownward\",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysDownward:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysDownward=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"keysLeft\",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysLeft:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysLeft=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"keysRight\",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysRight:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysRight=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"keysRotateLeft\",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysRotateLeft:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysRotateLeft=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"keysRotateRight\",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysRotateRight:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysRotateRight=e)},enumerable:!1,configurable:!0}),t.prototype.attachControl=function(e,t){t=mi.BackCompatCameraNoPreventDefault(arguments),this.inputs.attachElement(t)},t.prototype.detachControl=function(){this.inputs.detachElement(),this.cameraDirection=new x(0,0,0),this.cameraRotation=new R(0,0)},Object.defineProperty(t.prototype,\"collisionMask\",{get:function(){return this._collisionMask},set:function(e){this._collisionMask=isNaN(e)?-1:e},enumerable:!1,configurable:!0}),t.prototype._collideWithWorld=function(e){(this.parent?x.TransformCoordinates(this.position,this.parent.getWorldMatrix()):this.position).subtractFromFloatsToRef(0,this.ellipsoid.y,0,this._oldPosition),this._oldPosition.addInPlace(this.ellipsoidOffset);var t=this.getScene().collisionCoordinator;this._collider||(this._collider=t.createCollider()),this._collider._radius=this.ellipsoid,this._collider.collisionMask=this._collisionMask;var i=e;this.applyGravity&&(i=e.add(this.getScene().gravity)),t.getNewPosition(this._oldPosition,i,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId)},t.prototype._checkInputs=function(){this._localDirection||(this._localDirection=x.Zero(),this._transformedDirection=x.Zero()),this.inputs.checkInputs(),e.prototype._checkInputs.call(this)},t.prototype._decideIfNeedsToMove=function(){return this._needMoveForGravity||Math.abs(this.cameraDirection.x)>0||Math.abs(this.cameraDirection.y)>0||Math.abs(this.cameraDirection.z)>0},t.prototype._updatePosition=function(){this.checkCollisions&&this.getScene().collisionsEnabled?this._collideWithWorld(this.cameraDirection):e.prototype._updatePosition.call(this)},t.prototype.dispose=function(){this.inputs.clear(),e.prototype.dispose.call(this)},t.prototype.getClassName=function(){return\"FreeCamera\"},G([Re()],t.prototype,\"ellipsoid\",void 0),G([Re()],t.prototype,\"ellipsoidOffset\",void 0),G([be()],t.prototype,\"checkCollisions\",void 0),G([be()],t.prototype,\"applyGravity\",void 0),t}(Os);Ue.AddNodeConstructor(\"TouchCamera\",(function(e,t){return function(){return new Ns(e,x.Zero(),t)}}));var Ns=function(e){function t(t,i,n){var r=e.call(this,t,i,n)||this;return r.inputs.addTouch(),r._setupInputs(),r}return V(t,e),Object.defineProperty(t.prototype,\"touchAngularSensibility\",{get:function(){var e=this.inputs.attached.touch;return e?e.touchAngularSensibility:0},set:function(e){var t=this.inputs.attached.touch;t&&(t.touchAngularSensibility=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"touchMoveSensibility\",{get:function(){var e=this.inputs.attached.touch;return e?e.touchMoveSensibility:0},set:function(e){var t=this.inputs.attached.touch;t&&(t.touchMoveSensibility=e)},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return\"TouchCamera\"},t.prototype._setupInputs=function(){var e=this.inputs.attached.touch,t=this.inputs.attached.mouse;t?t.touchEnabled=!1:e.allowMouse=!0},t}(Ds);Ue.AddNodeConstructor(\"ArcRotateCamera\",(function(e,t){return function(){return new Ls(e,0,0,1,x.Zero(),t)}}));var Ls=function(e){function t(t,i,n,r,o,a,s){void 0===s&&(s=!0);var l=e.call(this,t,x.Zero(),a,s)||this;return l.inertialAlphaOffset=0,l.inertialBetaOffset=0,l.inertialRadiusOffset=0,l.lowerAlphaLimit=null,l.upperAlphaLimit=null,l.lowerBetaLimit=.01,l.upperBetaLimit=Math.PI-.01,l.lowerRadiusLimit=null,l.upperRadiusLimit=null,l.inertialPanningX=0,l.inertialPanningY=0,l.pinchToPanMaxDistance=20,l.panningDistanceLimit=null,l.panningOriginTarget=x.Zero(),l.panningInertia=.9,l.zoomOnFactor=1,l.targetScreenOffset=R.Zero(),l.allowUpsideDown=!0,l.useInputToRestoreState=!0,l._viewMatrix=new M,l.panningAxis=new x(1,1,0),l._transformedDirection=new x,l.mapPanning=!1,l.onMeshTargetChangedObservable=new u,l.checkCollisions=!1,l.collisionRadius=new x(.5,.5,.5),l._previousPosition=x.Zero(),l._collisionVelocity=x.Zero(),l._newPosition=x.Zero(),l._computationVector=x.Zero(),l._onCollisionPositionChange=function(e,t,i){void 0===i&&(i=null),i?(l.setPosition(t),l.onCollide&&l.onCollide(i)):l._previousPosition.copyFrom(l._position);var n=Math.cos(l.alpha),r=Math.sin(l.alpha),o=Math.cos(l.beta),a=Math.sin(l.beta);0===a&&(a=1e-4);var s=l._getTargetPosition();l._computationVector.copyFromFloats(l.radius*n*a,l.radius*o,l.radius*r*a),s.addToRef(l._computationVector,l._newPosition),l._position.copyFrom(l._newPosition);var c=l.upVector;l.allowUpsideDown&&l.beta<0&&(c=(c=c.clone()).negate()),l._computeViewMatrix(l._position,s,c),l._viewMatrix.addAtIndex(12,l.targetScreenOffset.x),l._viewMatrix.addAtIndex(13,l.targetScreenOffset.y),l._collisionTriggered=!1},l._target=x.Zero(),o&&l.setTarget(o),l.alpha=i,l.beta=n,l.radius=r,l.getViewMatrix(),l.inputs=new ps(l),l.inputs.addKeyboard().addMouseWheel().addPointers(),l}return V(t,e),Object.defineProperty(t.prototype,\"target\",{get:function(){return this._target},set:function(e){this.setTarget(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"targetHost\",{get:function(){return this._targetHost},set:function(e){e&&this.setTarget(e)},enumerable:!1,configurable:!0}),t.prototype.getTarget=function(){return this.target},Object.defineProperty(t.prototype,\"position\",{get:function(){return this._position},set:function(e){this.setPosition(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"upVector\",{get:function(){return this._upVector},set:function(e){this._upToYMatrix||(this._yToUpMatrix=new M,this._upToYMatrix=new M,this._upVector=x.Zero()),e.normalize(),this._upVector.copyFrom(e),this.setMatUp()},enumerable:!1,configurable:!0}),t.prototype.setMatUp=function(){M.RotationAlignToRef(x.UpReadOnly,this._upVector,this._yToUpMatrix),M.RotationAlignToRef(this._upVector,x.UpReadOnly,this._upToYMatrix)},Object.defineProperty(t.prototype,\"angularSensibilityX\",{get:function(){var e=this.inputs.attached.pointers;return e?e.angularSensibilityX:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.angularSensibilityX=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"angularSensibilityY\",{get:function(){var e=this.inputs.attached.pointers;return e?e.angularSensibilityY:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.angularSensibilityY=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"pinchPrecision\",{get:function(){var e=this.inputs.attached.pointers;return e?e.pinchPrecision:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.pinchPrecision=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"pinchDeltaPercentage\",{get:function(){var e=this.inputs.attached.pointers;return e?e.pinchDeltaPercentage:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.pinchDeltaPercentage=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"useNaturalPinchZoom\",{get:function(){var e=this.inputs.attached.pointers;return!!e&&e.useNaturalPinchZoom},set:function(e){var t=this.inputs.attached.pointers;t&&(t.useNaturalPinchZoom=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"panningSensibility\",{get:function(){var e=this.inputs.attached.pointers;return e?e.panningSensibility:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.panningSensibility=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"keysUp\",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysUp:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysUp=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"keysDown\",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysDown:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysDown=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"keysLeft\",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysLeft:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysLeft=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"keysRight\",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysRight:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysRight=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"wheelPrecision\",{get:function(){var e=this.inputs.attached.mousewheel;return e?e.wheelPrecision:0},set:function(e){var t=this.inputs.attached.mousewheel;t&&(t.wheelPrecision=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"zoomToMouseLocation\",{get:function(){var e=this.inputs.attached.mousewheel;return!!e&&e.zoomToMouseLocation},set:function(e){var t=this.inputs.attached.mousewheel;t&&(t.zoomToMouseLocation=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"wheelDeltaPercentage\",{get:function(){var e=this.inputs.attached.mousewheel;return e?e.wheelDeltaPercentage:0},set:function(e){var t=this.inputs.attached.mousewheel;t&&(t.wheelDeltaPercentage=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"bouncingBehavior\",{get:function(){return this._bouncingBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"useBouncingBehavior\",{get:function(){return null!=this._bouncingBehavior},set:function(e){e!==this.useBouncingBehavior&&(e?(this._bouncingBehavior=new lo,this.addBehavior(this._bouncingBehavior)):this._bouncingBehavior&&(this.removeBehavior(this._bouncingBehavior),this._bouncingBehavior=null))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"framingBehavior\",{get:function(){return this._framingBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"useFramingBehavior\",{get:function(){return null!=this._framingBehavior},set:function(e){e!==this.useFramingBehavior&&(e?(this._framingBehavior=new co,this.addBehavior(this._framingBehavior)):this._framingBehavior&&(this.removeBehavior(this._framingBehavior),this._framingBehavior=null))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"autoRotationBehavior\",{get:function(){return this._autoRotationBehavior},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"useAutoRotationBehavior\",{get:function(){return null!=this._autoRotationBehavior},set:function(e){e!==this.useAutoRotationBehavior&&(e?(this._autoRotationBehavior=new so,this.addBehavior(this._autoRotationBehavior)):this._autoRotationBehavior&&(this.removeBehavior(this._autoRotationBehavior),this._autoRotationBehavior=null))},enumerable:!1,configurable:!0}),t.prototype._initCache=function(){e.prototype._initCache.call(this),this._cache._target=new x(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.alpha=void 0,this._cache.beta=void 0,this._cache.radius=void 0,this._cache.targetScreenOffset=R.Zero()},t.prototype._updateCache=function(t){t||e.prototype._updateCache.call(this),this._cache._target.copyFrom(this._getTargetPosition()),this._cache.alpha=this.alpha,this._cache.beta=this.beta,this._cache.radius=this.radius,this._cache.targetScreenOffset.copyFrom(this.targetScreenOffset)},t.prototype._getTargetPosition=function(){if(this._targetHost&&this._targetHost.getAbsolutePosition){var e=this._targetHost.getAbsolutePosition();this._targetBoundingCenter?e.addToRef(this._targetBoundingCenter,this._target):this._target.copyFrom(e)}return this._getLockedTargetPosition()||this._target},t.prototype.storeState=function(){return this._storedAlpha=this.alpha,this._storedBeta=this.beta,this._storedRadius=this.radius,this._storedTarget=this._getTargetPosition().clone(),this._storedTargetScreenOffset=this.targetScreenOffset.clone(),e.prototype.storeState.call(this)},t.prototype._restoreStateValues=function(){return!!e.prototype._restoreStateValues.call(this)&&(this.setTarget(this._storedTarget.clone()),this.alpha=this._storedAlpha,this.beta=this._storedBeta,this.radius=this._storedRadius,this.targetScreenOffset=this._storedTargetScreenOffset.clone(),this.inertialAlphaOffset=0,this.inertialBetaOffset=0,this.inertialRadiusOffset=0,this.inertialPanningX=0,this.inertialPanningY=0,!0)},t.prototype._isSynchronizedViewMatrix=function(){return!!e.prototype._isSynchronizedViewMatrix.call(this)&&this._cache._target.equals(this._getTargetPosition())&&this._cache.alpha===this.alpha&&this._cache.beta===this.beta&&this._cache.radius===this.radius&&this._cache.targetScreenOffset.equals(this.targetScreenOffset)},t.prototype.attachControl=function(e,t,i,n){var r=this;void 0===i&&(i=!0),void 0===n&&(n=2);var o=arguments;t=mi.BackCompatCameraNoPreventDefault(o),this._useCtrlForPanning=i,this._panningMouseButton=n,\"boolean\"==typeof o[0]&&(o.length>1&&(this._useCtrlForPanning=o[1]),o.length>2&&(this._panningMouseButton=o[2])),this.inputs.attachElement(t),this._reset=function(){r.inertialAlphaOffset=0,r.inertialBetaOffset=0,r.inertialRadiusOffset=0,r.inertialPanningX=0,r.inertialPanningY=0}},t.prototype.detachControl=function(){this.inputs.detachElement(),this._reset&&this._reset()},t.prototype._checkInputs=function(){if(!this._collisionTriggered){if(this.inputs.checkInputs(),0!==this.inertialAlphaOffset||0!==this.inertialBetaOffset||0!==this.inertialRadiusOffset){var t=this.invertRotation?-1:1,i=this.inertialAlphaOffset;this.beta<=0&&(i*=-1),this.getScene().useRightHandedSystem&&(i*=-1),this.parent&&this.parent._getWorldMatrixDeterminant()<0&&(i*=-1),this.alpha+=i*t,this.beta+=this.inertialBetaOffset*t,this.radius-=this.inertialRadiusOffset,this.inertialAlphaOffset*=this.inertia,this.inertialBetaOffset*=this.inertia,this.inertialRadiusOffset*=this.inertia,Math.abs(this.inertialAlphaOffset)<_&&(this.inertialAlphaOffset=0),Math.abs(this.inertialBetaOffset)<_&&(this.inertialBetaOffset=0),Math.abs(this.inertialRadiusOffset)Math.PI&&(this.beta=this.beta-2*Math.PI):this.betathis.upperBetaLimit&&(this.beta=this.upperBetaLimit),null!==this.lowerAlphaLimit&&this.alphathis.upperAlphaLimit&&(this.alpha=this.upperAlphaLimit),null!==this.lowerRadiusLimit&&this.radiusthis.upperRadiusLimit&&(this.radius=this.upperRadiusLimit,this.inertialRadiusOffset=0)},t.prototype.rebuildAnglesAndRadius=function(){this._position.subtractToRef(this._getTargetPosition(),this._computationVector),0===this._upVector.x&&1===this._upVector.y&&0===this._upVector.z||x.TransformCoordinatesToRef(this._computationVector,this._upToYMatrix,this._computationVector),this.radius=this._computationVector.length(),0===this.radius&&(this.radius=1e-4);var e=this.alpha;0===this._computationVector.x&&0===this._computationVector.z?this.alpha=Math.PI/2:this.alpha=Math.acos(this._computationVector.x/Math.sqrt(Math.pow(this._computationVector.x,2)+Math.pow(this._computationVector.z,2))),this._computationVector.z<0&&(this.alpha=2*Math.PI-this.alpha);var t=Math.round((e-this.alpha)/(2*Math.PI));this.alpha+=2*t*Math.PI,this.beta=Math.acos(this._computationVector.y/this.radius),this._checkLimits()},t.prototype.setPosition=function(e){this._position.equals(e)||(this._position.copyFrom(e),this.rebuildAnglesAndRadius())},t.prototype.setTarget=function(e,t,i,n){var r;if(void 0===t&&(t=!1),void 0===i&&(i=!1),void 0===n&&(n=!1),n=null!==(r=this.overrideCloneAlphaBetaRadius)&&void 0!==r?r:n,e.getBoundingInfo)this._targetBoundingCenter=t?e.getBoundingInfo().boundingBox.centerWorld.clone():null,e.computeWorldMatrix(),this._targetHost=e,this._target=this._getTargetPosition(),this.onMeshTargetChangedObservable.notifyObservers(this._targetHost);else{var o=e,a=this._getTargetPosition();if(a&&!i&&a.equals(o))return;this._targetHost=null,this._target=o,this._targetBoundingCenter=null,this.onMeshTargetChangedObservable.notifyObservers(null)}n||this.rebuildAnglesAndRadius()},t.prototype._getViewMatrix=function(){var e=Math.cos(this.alpha),t=Math.sin(this.alpha),i=Math.cos(this.beta),n=Math.sin(this.beta);0===n&&(n=1e-4),0===this.radius&&(this.radius=1e-4);var r=this._getTargetPosition();if(this._computationVector.copyFromFloats(this.radius*e*n,this.radius*i,this.radius*t*n),0===this._upVector.x&&1===this._upVector.y&&0===this._upVector.z||x.TransformCoordinatesToRef(this._computationVector,this._yToUpMatrix,this._computationVector),r.addToRef(this._computationVector,this._newPosition),this.getScene().collisionsEnabled&&this.checkCollisions){var o=this.getScene().collisionCoordinator;this._collider||(this._collider=o.createCollider()),this._collider._radius=this.collisionRadius,this._newPosition.subtractToRef(this._position,this._collisionVelocity),this._collisionTriggered=!0,o.getNewPosition(this._position,this._collisionVelocity,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId)}else{this._position.copyFrom(this._newPosition);var a=this.upVector;this.allowUpsideDown&&n<0&&(a=a.negate()),this._computeViewMatrix(this._position,r,a),this._viewMatrix.addAtIndex(12,this.targetScreenOffset.x),this._viewMatrix.addAtIndex(13,this.targetScreenOffset.y)}return this._currentTarget=r,this._viewMatrix},t.prototype.zoomOn=function(e,t){void 0===t&&(t=!1),e=e||this.getScene().meshes;var i=Ur.MinMax(e),n=x.Distance(i.min,i.max);this.radius=n*this.zoomOnFactor,this.focusOn({min:i.min,max:i.max,distance:n},t)},t.prototype.focusOn=function(e,t){var i,n;if(void 0===t&&(t=!1),void 0===e.min){var r=e||this.getScene().meshes;i=Ur.MinMax(r),n=x.Distance(i.min,i.max)}else i=e,n=e.distance;this._target=Ur.Center(i),t||(this.maxZ=2*n)},t.prototype.createRigCamera=function(e,i){var n=0;switch(this.cameraRigMode){case xr.RIG_MODE_STEREOSCOPIC_ANAGLYPH:case xr.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case xr.RIG_MODE_STEREOSCOPIC_OVERUNDER:case xr.RIG_MODE_STEREOSCOPIC_INTERLACED:case xr.RIG_MODE_VR:n=this._cameraRigParams.stereoHalfAngle*(0===i?1:-1);break;case xr.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:n=this._cameraRigParams.stereoHalfAngle*(0===i?-1:1)}var r=new t(e,this.alpha+n,this.beta,this.radius,this._target,this.getScene());return r._cameraRigParams={},r.isRigCamera=!0,r.rigParent=this,r.upVector=this.upVector,r.mode=this.mode,r.orthoLeft=this.orthoLeft,r.orthoRight=this.orthoRight,r.orthoBottom=this.orthoBottom,r.orthoTop=this.orthoTop,r},t.prototype._updateRigCameras=function(){var t=this._rigCameras[0],i=this._rigCameras[1];switch(t.beta=i.beta=this.beta,this.cameraRigMode){case xr.RIG_MODE_STEREOSCOPIC_ANAGLYPH:case xr.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case xr.RIG_MODE_STEREOSCOPIC_OVERUNDER:case xr.RIG_MODE_STEREOSCOPIC_INTERLACED:case xr.RIG_MODE_VR:t.alpha=this.alpha-this._cameraRigParams.stereoHalfAngle,i.alpha=this.alpha+this._cameraRigParams.stereoHalfAngle;break;case xr.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:t.alpha=this.alpha+this._cameraRigParams.stereoHalfAngle,i.alpha=this.alpha-this._cameraRigParams.stereoHalfAngle}e.prototype._updateRigCameras.call(this)},t.prototype.dispose=function(){this.inputs.clear(),e.prototype.dispose.call(this)},t.prototype.getClassName=function(){return\"ArcRotateCamera\"},G([be()],t.prototype,\"alpha\",void 0),G([be()],t.prototype,\"beta\",void 0),G([be()],t.prototype,\"radius\",void 0),G([be()],t.prototype,\"overrideCloneAlphaBetaRadius\",void 0),G([Re(\"target\")],t.prototype,\"_target\",void 0),G([xe(\"targetHost\")],t.prototype,\"_targetHost\",void 0),G([be()],t.prototype,\"inertialAlphaOffset\",void 0),G([be()],t.prototype,\"inertialBetaOffset\",void 0),G([be()],t.prototype,\"inertialRadiusOffset\",void 0),G([be()],t.prototype,\"lowerAlphaLimit\",void 0),G([be()],t.prototype,\"upperAlphaLimit\",void 0),G([be()],t.prototype,\"lowerBetaLimit\",void 0),G([be()],t.prototype,\"upperBetaLimit\",void 0),G([be()],t.prototype,\"lowerRadiusLimit\",void 0),G([be()],t.prototype,\"upperRadiusLimit\",void 0),G([be()],t.prototype,\"inertialPanningX\",void 0),G([be()],t.prototype,\"inertialPanningY\",void 0),G([be()],t.prototype,\"pinchToPanMaxDistance\",void 0),G([be()],t.prototype,\"panningDistanceLimit\",void 0),G([Re()],t.prototype,\"panningOriginTarget\",void 0),G([be()],t.prototype,\"panningInertia\",void 0),G([be()],t.prototype,\"zoomToMouseLocation\",null),G([be()],t.prototype,\"zoomOnFactor\",void 0),G([Ae()],t.prototype,\"targetScreenOffset\",void 0),G([be()],t.prototype,\"allowUpsideDown\",void 0),G([be()],t.prototype,\"useInputToRestoreState\",void 0),t}(Os);Ue.AddNodeConstructor(\"DeviceOrientationCamera\",(function(e,t){return function(){return new Fs(e,x.Zero(),t)}}));var Fs=function(e){function t(t,i,n){var r=e.call(this,t,i,n)||this;return r._tmpDragQuaternion=new P,r._disablePointerInputWhenUsingDeviceOrientation=!0,r._dragFactor=0,r._quaternionCache=new P,r.inputs.addDeviceOrientation(),r.inputs._deviceOrientationInput&&r.inputs._deviceOrientationInput._onDeviceOrientationChangedObservable.addOnce((function(){r._disablePointerInputWhenUsingDeviceOrientation&&r.inputs._mouseInput&&(r.inputs._mouseInput._allowCameraRotation=!1,r.inputs._mouseInput.onPointerMovedObservable.add((function(e){0!=r._dragFactor&&(r._initialQuaternion||(r._initialQuaternion=new P),P.FromEulerAnglesToRef(0,e.offsetX*r._dragFactor,0,r._tmpDragQuaternion),r._initialQuaternion.multiplyToRef(r._tmpDragQuaternion,r._initialQuaternion))})))})),r}return V(t,e),Object.defineProperty(t.prototype,\"disablePointerInputWhenUsingDeviceOrientation\",{get:function(){return this._disablePointerInputWhenUsingDeviceOrientation},set:function(e){this._disablePointerInputWhenUsingDeviceOrientation=e},enumerable:!1,configurable:!0}),t.prototype.enableHorizontalDragging=function(e){void 0===e&&(e=1/300),this._dragFactor=e},t.prototype.getClassName=function(){return\"DeviceOrientationCamera\"},t.prototype._checkInputs=function(){e.prototype._checkInputs.call(this),this._quaternionCache.copyFrom(this.rotationQuaternion),this._initialQuaternion&&this._initialQuaternion.multiplyToRef(this.rotationQuaternion,this.rotationQuaternion)},t.prototype.resetToCurrentRotation=function(e){var t=this;void 0===e&&(e=vn.Y),this.rotationQuaternion&&(this._initialQuaternion||(this._initialQuaternion=new P),this._initialQuaternion.copyFrom(this._quaternionCache||this.rotationQuaternion),[\"x\",\"y\",\"z\"].forEach((function(i){e[i]?t._initialQuaternion[i]*=-1:t._initialQuaternion[i]=0})),this._initialQuaternion.normalize(),this._initialQuaternion.multiplyToRef(this.rotationQuaternion,this.rotationQuaternion))},t}(Ds),ws=function(e){function t(t){return e.call(this,t)||this}return V(t,e),t.prototype.addKeyboard=function(){return this.add(new _s),this},t.prototype.addMouse=function(){return this.add(new ms),this},t}(os),Bs=function(e){function t(t,i,n,r){void 0===r&&(r=!0);var o=e.call(this,t,i,n,r)||this;return o.ellipsoid=new x(1,1,1),o.ellipsoidOffset=new x(0,0,0),o.checkCollisions=!1,o.applyGravity=!1,o.cameraDirection=x.Zero(),o._trackRoll=0,o.rollCorrect=100,o.bankedTurn=!1,o.bankedTurnLimit=Math.PI/2,o.bankedTurnMultiplier=1,o._needMoveForGravity=!1,o._oldPosition=x.Zero(),o._diffPosition=x.Zero(),o._newPosition=x.Zero(),o._collisionMask=-1,o._onCollisionPositionChange=function(e,t,i){var n;void 0===i&&(i=null),n=t,o._newPosition.copyFrom(n),o._newPosition.subtractToRef(o._oldPosition,o._diffPosition),o._diffPosition.length()>vr.CollisionsEpsilon&&(o.position.addInPlace(o._diffPosition),o.onCollide&&i&&o.onCollide(i))},o.inputs=new ws(o),o.inputs.addKeyboard().addMouse(),o}return V(t,e),Object.defineProperty(t.prototype,\"angularSensibility\",{get:function(){var e=this.inputs.attached.mouse;return e?e.angularSensibility:0},set:function(e){var t=this.inputs.attached.mouse;t&&(t.angularSensibility=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"keysForward\",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysForward:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysForward=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"keysBackward\",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysBackward:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysBackward=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"keysUp\",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysUp:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysUp=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"keysDown\",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysDown:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysDown=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"keysLeft\",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysLeft:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysLeft=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"keysRight\",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysRight:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysRight=e)},enumerable:!1,configurable:!0}),t.prototype.attachControl=function(e,t){t=mi.BackCompatCameraNoPreventDefault(arguments),this.inputs.attachElement(t)},t.prototype.detachControl=function(){this.inputs.detachElement(),this.cameraDirection=new x(0,0,0)},Object.defineProperty(t.prototype,\"collisionMask\",{get:function(){return this._collisionMask},set:function(e){this._collisionMask=isNaN(e)?-1:e},enumerable:!1,configurable:!0}),t.prototype._collideWithWorld=function(e){(this.parent?x.TransformCoordinates(this.position,this.parent.getWorldMatrix()):this.position).subtractFromFloatsToRef(0,this.ellipsoid.y,0,this._oldPosition),this._oldPosition.addInPlace(this.ellipsoidOffset);var t=this.getScene().collisionCoordinator;this._collider||(this._collider=t.createCollider()),this._collider._radius=this.ellipsoid,this._collider.collisionMask=this._collisionMask;var i=e;this.applyGravity&&(i=e.add(this.getScene().gravity)),t.getNewPosition(this._oldPosition,i,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId)},t.prototype._checkInputs=function(){this._localDirection||(this._localDirection=x.Zero(),this._transformedDirection=x.Zero()),this.inputs.checkInputs(),e.prototype._checkInputs.call(this)},t.prototype._decideIfNeedsToMove=function(){return this._needMoveForGravity||Math.abs(this.cameraDirection.x)>0||Math.abs(this.cameraDirection.y)>0||Math.abs(this.cameraDirection.z)>0},t.prototype._updatePosition=function(){this.checkCollisions&&this.getScene().collisionsEnabled?this._collideWithWorld(this.cameraDirection):e.prototype._updatePosition.call(this)},t.prototype.restoreRoll=function(e){var t=this._trackRoll,i=t-this.rotation.z;Math.abs(i)>=.001&&(this.rotation.z+=i/e,Math.abs(t-this.rotation.z)<=.001&&(this.rotation.z=t))},t.prototype.dispose=function(){this.inputs.clear(),e.prototype.dispose.call(this)},t.prototype.getClassName=function(){return\"FlyCamera\"},G([Re()],t.prototype,\"ellipsoid\",void 0),G([Re()],t.prototype,\"ellipsoidOffset\",void 0),G([be()],t.prototype,\"checkCollisions\",void 0),G([be()],t.prototype,\"applyGravity\",void 0),t}(Os),Us=function(e){function t(t){return e.call(this,t)||this}return V(t,e),t.prototype.addKeyboard=function(){return this.add(new gs),this},t.prototype.addMouseWheel=function(){return this.add(new vs),this},t.prototype.addPointers=function(){return this.add(new ys),this},t.prototype.addVRDeviceOrientation=function(){return console.warn(\"DeviceOrientation support not yet implemented for FollowCamera.\"),this},t}(os);Ue.AddNodeConstructor(\"FollowCamera\",(function(e,t){return function(){return new ks(e,x.Zero(),t)}})),Ue.AddNodeConstructor(\"ArcFollowCamera\",(function(e,t){return function(){return new Gs(e,0,0,1,null,t)}}));var Vs,ks=function(e){function t(t,i,n,r){void 0===r&&(r=null);var o=e.call(this,t,i,n)||this;return o.radius=12,o.lowerRadiusLimit=null,o.upperRadiusLimit=null,o.rotationOffset=0,o.lowerRotationOffsetLimit=null,o.upperRotationOffsetLimit=null,o.heightOffset=4,o.lowerHeightOffsetLimit=null,o.upperHeightOffsetLimit=null,o.cameraAcceleration=.05,o.maxCameraSpeed=20,o.lockedTarget=r,o.inputs=new Us(o),o.inputs.addKeyboard().addMouseWheel().addPointers(),o}return V(t,e),t.prototype._follow=function(e){if(e){var t=O.Matrix[0];e.absoluteRotationQuaternion.toRotationMatrix(t);var i=Math.atan2(t.m[8],t.m[10]),n=mi.ToRadians(this.rotationOffset)+i,r=e.getAbsolutePosition(),o=r.x+Math.sin(n)*this.radius,a=r.z+Math.cos(n)*this.radius,s=o-this.position.x,l=r.y+this.heightOffset-this.position.y,c=a-this.position.z,u=s*this.cameraAcceleration*2,h=l*this.cameraAcceleration,d=c*this.cameraAcceleration*2;(u>this.maxCameraSpeed||u<-this.maxCameraSpeed)&&(u=u<1?-this.maxCameraSpeed:this.maxCameraSpeed),(h>this.maxCameraSpeed||h<-this.maxCameraSpeed)&&(h=h<1?-this.maxCameraSpeed:this.maxCameraSpeed),(d>this.maxCameraSpeed||d<-this.maxCameraSpeed)&&(d=d<1?-this.maxCameraSpeed:this.maxCameraSpeed),this.position=new x(this.position.x+u,this.position.y+h,this.position.z+d),this.setTarget(r)}},t.prototype.attachControl=function(e,t){t=mi.BackCompatCameraNoPreventDefault(arguments),this.inputs.attachElement(t),this._reset=function(){}},t.prototype.detachControl=function(){this.inputs.detachElement(),this._reset&&this._reset()},t.prototype._checkInputs=function(){this.inputs.checkInputs(),this._checkLimits(),e.prototype._checkInputs.call(this),this.lockedTarget&&this._follow(this.lockedTarget)},t.prototype._checkLimits=function(){null!==this.lowerRadiusLimit&&this.radiusthis.upperRadiusLimit&&(this.radius=this.upperRadiusLimit),null!==this.lowerHeightOffsetLimit&&this.heightOffsetthis.upperHeightOffsetLimit&&(this.heightOffset=this.upperHeightOffsetLimit),null!==this.lowerRotationOffsetLimit&&this.rotationOffsetthis.upperRotationOffsetLimit&&(this.rotationOffset=this.upperRotationOffsetLimit)},t.prototype.getClassName=function(){return\"FollowCamera\"},G([be()],t.prototype,\"radius\",void 0),G([be()],t.prototype,\"lowerRadiusLimit\",void 0),G([be()],t.prototype,\"upperRadiusLimit\",void 0),G([be()],t.prototype,\"rotationOffset\",void 0),G([be()],t.prototype,\"lowerRotationOffsetLimit\",void 0),G([be()],t.prototype,\"upperRotationOffsetLimit\",void 0),G([be()],t.prototype,\"heightOffset\",void 0),G([be()],t.prototype,\"lowerHeightOffsetLimit\",void 0),G([be()],t.prototype,\"upperHeightOffsetLimit\",void 0),G([be()],t.prototype,\"cameraAcceleration\",void 0),G([be()],t.prototype,\"maxCameraSpeed\",void 0),G([xe(\"lockedTargetId\")],t.prototype,\"lockedTarget\",void 0),t}(Os),Gs=function(e){function t(t,i,n,r,o,a){var s=e.call(this,t,x.Zero(),a)||this;return s.alpha=i,s.beta=n,s.radius=r,s._cartesianCoordinates=x.Zero(),s.setMeshTarget(o),s}return V(t,e),t.prototype.setMeshTarget=function(e){this._meshTarget=e,this._follow()},t.prototype._follow=function(){if(this._meshTarget){this._cartesianCoordinates.x=this.radius*Math.cos(this.alpha)*Math.cos(this.beta),this._cartesianCoordinates.y=this.radius*Math.sin(this.beta),this._cartesianCoordinates.z=this.radius*Math.sin(this.alpha)*Math.cos(this.beta);var e=this._meshTarget.getAbsolutePosition();this.position=e.add(this._cartesianCoordinates),this.setTarget(e)}},t.prototype._checkInputs=function(){e.prototype._checkInputs.call(this),this._follow()},t.prototype.getClassName=function(){return\"ArcFollowCamera\"},t}(Os);!function(e){e[e.VIVE=0]=\"VIVE\",e[e.OCULUS=1]=\"OCULUS\",e[e.WINDOWS=2]=\"WINDOWS\",e[e.GEAR_VR=3]=\"GEAR_VR\",e[e.DAYDREAM=4]=\"DAYDREAM\",e[e.GENERIC=5]=\"GENERIC\"}(Vs||(Vs={}));var zs,Ws,Hs=function(){function e(){}return e.InitiateController=function(e){for(var t=0,i=this._ControllerFactories;tthis._maxRotationDistFromHeadset){var n=i-(i<0?-this._maxRotationDistFromHeadset:this._maxRotationDistFromHeadset);this._draggedRoomRotation+=n;var r=Math.sin(-n),o=Math.cos(-n);this._calculatedPosition.x=this._calculatedPosition.x*o-this._calculatedPosition.z*r,this._calculatedPosition.z=this._calculatedPosition.x*r+this._calculatedPosition.z*o}}}x.TransformCoordinatesToRef(this._calculatedPosition,this._deviceToWorld,this.devicePosition),this._deviceToWorld.getRotationMatrixToRef(this._workingMatrix),P.FromRotationMatrixToRef(this._workingMatrix,this.deviceRotationQuaternion),this.deviceRotationQuaternion.multiplyInPlace(this._calculatedRotation),this._mesh&&(this._mesh.position.copyFrom(this.devicePosition),this._mesh.rotationQuaternion&&this._mesh.rotationQuaternion.copyFrom(this.deviceRotationQuaternion))}},t.prototype.updateFromDevice=function(e){if(!this.isXR&&e){this.rawPose=e,e.position&&(this._deviceRoomPosition.copyFromFloats(e.position[0],e.position[1],-e.position[2]),this._mesh&&this._mesh.getScene().useRightHandedSystem&&(this._deviceRoomPosition.z*=-1),this._trackPosition&&this._deviceRoomPosition.scaleToRef(this.deviceScaleFactor,this._calculatedPosition),this._calculatedPosition.addInPlace(this.position));var t=this.rawPose;e.orientation&&t.orientation&&4===t.orientation.length&&(this._deviceRoomRotationQuaternion.copyFromFloats(t.orientation[0],t.orientation[1],-t.orientation[2],-t.orientation[3]),this._mesh&&(this._mesh.getScene().useRightHandedSystem?(this._deviceRoomRotationQuaternion.z*=-1,this._deviceRoomRotationQuaternion.w*=-1):this._deviceRoomRotationQuaternion.multiplyToRef(this._leftHandSystemQuaternion,this._deviceRoomRotationQuaternion)),this._deviceRoomRotationQuaternion.multiplyToRef(this.rotationQuaternion,this._calculatedRotation))}},t.prototype.attachToMesh=function(e){if(this._mesh&&(this._mesh.parent=null),this._mesh=e,this._poseControlledCamera&&(this._mesh.parent=this._poseControlledCamera),this._mesh.rotationQuaternion||(this._mesh.rotationQuaternion=new P),!this.isXR&&(this._updatePoseAndMesh(),this._pointingPoseNode)){for(var t=[],i=this._pointingPoseNode;i.parent;)t.push(i.parent),i=i.parent;t.reverse().forEach((function(e){e.computeWorldMatrix(!0)}))}this._meshAttachedObservable.notifyObservers(e)},t.prototype.attachToPoseControlledCamera=function(e){this._poseControlledCamera=e,this._mesh&&(this._mesh.parent=this._poseControlledCamera)},t.prototype.dispose=function(){this._mesh&&this._mesh.dispose(),this._mesh=null,e.prototype.dispose.call(this)},Object.defineProperty(t.prototype,\"mesh\",{get:function(){return this._mesh},enumerable:!1,configurable:!0}),t.prototype.getForwardRay=function(e){if(void 0===e&&(e=100),!this.mesh)return new fo(x.Zero(),new x(0,0,1),e);var t=this._pointingPoseNode?this._pointingPoseNode.getWorldMatrix():this.mesh.getWorldMatrix(),i=t.getTranslation(),n=new x(0,0,-1),r=x.TransformNormal(n,t),o=x.Normalize(r);return new fo(i,o,e)},t.POINTING_POSE=\"POINTING_POSE\",t}(ss);!function(e){e[e.A=0]=\"A\",e[e.B=1]=\"B\",e[e.X=2]=\"X\",e[e.Y=3]=\"Y\",e[e.LB=4]=\"LB\",e[e.RB=5]=\"RB\",e[e.Back=8]=\"Back\",e[e.Start=9]=\"Start\",e[e.LeftStick=10]=\"LeftStick\",e[e.RightStick=11]=\"RightStick\"}(zs||(zs={})),function(e){e[e.Up=12]=\"Up\",e[e.Down=13]=\"Down\",e[e.Left=14]=\"Left\",e[e.Right=15]=\"Right\"}(Ws||(Ws={}));var js,Ys,Ks=function(e){function t(t,i,n,r){void 0===r&&(r=!1);var o=e.call(this,t,i,n,0,1,2,3)||this;return o._leftTrigger=0,o._rightTrigger=0,o.onButtonDownObservable=new u,o.onButtonUpObservable=new u,o.onPadDownObservable=new u,o.onPadUpObservable=new u,o._buttonA=0,o._buttonB=0,o._buttonX=0,o._buttonY=0,o._buttonBack=0,o._buttonStart=0,o._buttonLB=0,o._buttonRB=0,o._buttonLeftStick=0,o._buttonRightStick=0,o._dPadUp=0,o._dPadDown=0,o._dPadLeft=0,o._dPadRight=0,o._isXboxOnePad=!1,o.type=ss.XBOX,o._isXboxOnePad=r,o}return V(t,e),t.prototype.onlefttriggerchanged=function(e){this._onlefttriggerchanged=e},t.prototype.onrighttriggerchanged=function(e){this._onrighttriggerchanged=e},Object.defineProperty(t.prototype,\"leftTrigger\",{get:function(){return this._leftTrigger},set:function(e){this._onlefttriggerchanged&&this._leftTrigger!==e&&this._onlefttriggerchanged(e),this._leftTrigger=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"rightTrigger\",{get:function(){return this._rightTrigger},set:function(e){this._onrighttriggerchanged&&this._rightTrigger!==e&&this._onrighttriggerchanged(e),this._rightTrigger=e},enumerable:!1,configurable:!0}),t.prototype.onbuttondown=function(e){this._onbuttondown=e},t.prototype.onbuttonup=function(e){this._onbuttonup=e},t.prototype.ondpaddown=function(e){this._ondpaddown=e},t.prototype.ondpadup=function(e){this._ondpadup=e},t.prototype._setButtonValue=function(e,t,i){return e!==t&&(1===e&&(this._onbuttondown&&this._onbuttondown(i),this.onButtonDownObservable.notifyObservers(i)),0===e&&(this._onbuttonup&&this._onbuttonup(i),this.onButtonUpObservable.notifyObservers(i))),e},t.prototype._setDPadValue=function(e,t,i){return e!==t&&(1===e&&(this._ondpaddown&&this._ondpaddown(i),this.onPadDownObservable.notifyObservers(i)),0===e&&(this._ondpadup&&this._ondpadup(i),this.onPadUpObservable.notifyObservers(i))),e},Object.defineProperty(t.prototype,\"buttonA\",{get:function(){return this._buttonA},set:function(e){this._buttonA=this._setButtonValue(e,this._buttonA,zs.A)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"buttonB\",{get:function(){return this._buttonB},set:function(e){this._buttonB=this._setButtonValue(e,this._buttonB,zs.B)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"buttonX\",{get:function(){return this._buttonX},set:function(e){this._buttonX=this._setButtonValue(e,this._buttonX,zs.X)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"buttonY\",{get:function(){return this._buttonY},set:function(e){this._buttonY=this._setButtonValue(e,this._buttonY,zs.Y)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"buttonStart\",{get:function(){return this._buttonStart},set:function(e){this._buttonStart=this._setButtonValue(e,this._buttonStart,zs.Start)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"buttonBack\",{get:function(){return this._buttonBack},set:function(e){this._buttonBack=this._setButtonValue(e,this._buttonBack,zs.Back)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"buttonLB\",{get:function(){return this._buttonLB},set:function(e){this._buttonLB=this._setButtonValue(e,this._buttonLB,zs.LB)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"buttonRB\",{get:function(){return this._buttonRB},set:function(e){this._buttonRB=this._setButtonValue(e,this._buttonRB,zs.RB)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"buttonLeftStick\",{get:function(){return this._buttonLeftStick},set:function(e){this._buttonLeftStick=this._setButtonValue(e,this._buttonLeftStick,zs.LeftStick)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"buttonRightStick\",{get:function(){return this._buttonRightStick},set:function(e){this._buttonRightStick=this._setButtonValue(e,this._buttonRightStick,zs.RightStick)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"dPadUp\",{get:function(){return this._dPadUp},set:function(e){this._dPadUp=this._setDPadValue(e,this._dPadUp,Ws.Up)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"dPadDown\",{get:function(){return this._dPadDown},set:function(e){this._dPadDown=this._setDPadValue(e,this._dPadDown,Ws.Down)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"dPadLeft\",{get:function(){return this._dPadLeft},set:function(e){this._dPadLeft=this._setDPadValue(e,this._dPadLeft,Ws.Left)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"dPadRight\",{get:function(){return this._dPadRight},set:function(e){this._dPadRight=this._setDPadValue(e,this._dPadRight,Ws.Right)},enumerable:!1,configurable:!0}),t.prototype.update=function(){e.prototype.update.call(this),this._isXboxOnePad,this.buttonA=this.browserGamepad.buttons[0].value,this.buttonB=this.browserGamepad.buttons[1].value,this.buttonX=this.browserGamepad.buttons[2].value,this.buttonY=this.browserGamepad.buttons[3].value,this.buttonLB=this.browserGamepad.buttons[4].value,this.buttonRB=this.browserGamepad.buttons[5].value,this.leftTrigger=this.browserGamepad.buttons[6].value,this.rightTrigger=this.browserGamepad.buttons[7].value,this.buttonBack=this.browserGamepad.buttons[8].value,this.buttonStart=this.browserGamepad.buttons[9].value,this.buttonLeftStick=this.browserGamepad.buttons[10].value,this.buttonRightStick=this.browserGamepad.buttons[11].value,this.dPadUp=this.browserGamepad.buttons[12].value,this.dPadDown=this.browserGamepad.buttons[13].value,this.dPadLeft=this.browserGamepad.buttons[14].value,this.dPadRight=this.browserGamepad.buttons[15].value},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.onButtonDownObservable.clear(),this.onButtonUpObservable.clear(),this.onPadDownObservable.clear(),this.onPadUpObservable.clear()},t}(ss);!function(e){e[e.Cross=0]=\"Cross\",e[e.Circle=1]=\"Circle\",e[e.Square=2]=\"Square\",e[e.Triangle=3]=\"Triangle\",e[e.L1=4]=\"L1\",e[e.R1=5]=\"R1\",e[e.Share=8]=\"Share\",e[e.Options=9]=\"Options\",e[e.LeftStick=10]=\"LeftStick\",e[e.RightStick=11]=\"RightStick\"}(js||(js={})),function(e){e[e.Up=12]=\"Up\",e[e.Down=13]=\"Down\",e[e.Left=14]=\"Left\",e[e.Right=15]=\"Right\"}(Ys||(Ys={}));var Qs=function(e){function t(t,i,n){var r=e.call(this,t.replace(\"STANDARD GAMEPAD\",\"SONY PLAYSTATION DUALSHOCK\"),i,n,0,1,2,3)||this;return r._leftTrigger=0,r._rightTrigger=0,r.onButtonDownObservable=new u,r.onButtonUpObservable=new u,r.onPadDownObservable=new u,r.onPadUpObservable=new u,r._buttonCross=0,r._buttonCircle=0,r._buttonSquare=0,r._buttonTriangle=0,r._buttonShare=0,r._buttonOptions=0,r._buttonL1=0,r._buttonR1=0,r._buttonLeftStick=0,r._buttonRightStick=0,r._dPadUp=0,r._dPadDown=0,r._dPadLeft=0,r._dPadRight=0,r.type=ss.DUALSHOCK,r}return V(t,e),t.prototype.onlefttriggerchanged=function(e){this._onlefttriggerchanged=e},t.prototype.onrighttriggerchanged=function(e){this._onrighttriggerchanged=e},Object.defineProperty(t.prototype,\"leftTrigger\",{get:function(){return this._leftTrigger},set:function(e){this._onlefttriggerchanged&&this._leftTrigger!==e&&this._onlefttriggerchanged(e),this._leftTrigger=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"rightTrigger\",{get:function(){return this._rightTrigger},set:function(e){this._onrighttriggerchanged&&this._rightTrigger!==e&&this._onrighttriggerchanged(e),this._rightTrigger=e},enumerable:!1,configurable:!0}),t.prototype.onbuttondown=function(e){this._onbuttondown=e},t.prototype.onbuttonup=function(e){this._onbuttonup=e},t.prototype.ondpaddown=function(e){this._ondpaddown=e},t.prototype.ondpadup=function(e){this._ondpadup=e},t.prototype._setButtonValue=function(e,t,i){return e!==t&&(1===e&&(this._onbuttondown&&this._onbuttondown(i),this.onButtonDownObservable.notifyObservers(i)),0===e&&(this._onbuttonup&&this._onbuttonup(i),this.onButtonUpObservable.notifyObservers(i))),e},t.prototype._setDPadValue=function(e,t,i){return e!==t&&(1===e&&(this._ondpaddown&&this._ondpaddown(i),this.onPadDownObservable.notifyObservers(i)),0===e&&(this._ondpadup&&this._ondpadup(i),this.onPadUpObservable.notifyObservers(i))),e},Object.defineProperty(t.prototype,\"buttonCross\",{get:function(){return this._buttonCross},set:function(e){this._buttonCross=this._setButtonValue(e,this._buttonCross,js.Cross)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"buttonCircle\",{get:function(){return this._buttonCircle},set:function(e){this._buttonCircle=this._setButtonValue(e,this._buttonCircle,js.Circle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"buttonSquare\",{get:function(){return this._buttonSquare},set:function(e){this._buttonSquare=this._setButtonValue(e,this._buttonSquare,js.Square)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"buttonTriangle\",{get:function(){return this._buttonTriangle},set:function(e){this._buttonTriangle=this._setButtonValue(e,this._buttonTriangle,js.Triangle)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"buttonOptions\",{get:function(){return this._buttonOptions},set:function(e){this._buttonOptions=this._setButtonValue(e,this._buttonOptions,js.Options)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"buttonShare\",{get:function(){return this._buttonShare},set:function(e){this._buttonShare=this._setButtonValue(e,this._buttonShare,js.Share)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"buttonL1\",{get:function(){return this._buttonL1},set:function(e){this._buttonL1=this._setButtonValue(e,this._buttonL1,js.L1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"buttonR1\",{get:function(){return this._buttonR1},set:function(e){this._buttonR1=this._setButtonValue(e,this._buttonR1,js.R1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"buttonLeftStick\",{get:function(){return this._buttonLeftStick},set:function(e){this._buttonLeftStick=this._setButtonValue(e,this._buttonLeftStick,js.LeftStick)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"buttonRightStick\",{get:function(){return this._buttonRightStick},set:function(e){this._buttonRightStick=this._setButtonValue(e,this._buttonRightStick,js.RightStick)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"dPadUp\",{get:function(){return this._dPadUp},set:function(e){this._dPadUp=this._setDPadValue(e,this._dPadUp,Ys.Up)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"dPadDown\",{get:function(){return this._dPadDown},set:function(e){this._dPadDown=this._setDPadValue(e,this._dPadDown,Ys.Down)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"dPadLeft\",{get:function(){return this._dPadLeft},set:function(e){this._dPadLeft=this._setDPadValue(e,this._dPadLeft,Ys.Left)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"dPadRight\",{get:function(){return this._dPadRight},set:function(e){this._dPadRight=this._setDPadValue(e,this._dPadRight,Ys.Right)},enumerable:!1,configurable:!0}),t.prototype.update=function(){e.prototype.update.call(this),this.buttonCross=this.browserGamepad.buttons[0].value,this.buttonCircle=this.browserGamepad.buttons[1].value,this.buttonSquare=this.browserGamepad.buttons[2].value,this.buttonTriangle=this.browserGamepad.buttons[3].value,this.buttonL1=this.browserGamepad.buttons[4].value,this.buttonR1=this.browserGamepad.buttons[5].value,this.leftTrigger=this.browserGamepad.buttons[6].value,this.rightTrigger=this.browserGamepad.buttons[7].value,this.buttonShare=this.browserGamepad.buttons[8].value,this.buttonOptions=this.browserGamepad.buttons[9].value,this.buttonLeftStick=this.browserGamepad.buttons[10].value,this.buttonRightStick=this.browserGamepad.buttons[11].value,this.dPadUp=this.browserGamepad.buttons[12].value,this.dPadDown=this.browserGamepad.buttons[13].value,this.dPadLeft=this.browserGamepad.buttons[14].value,this.dPadRight=this.browserGamepad.buttons[15].value},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.onButtonDownObservable.clear(),this.onButtonUpObservable.clear(),this.onPadDownObservable.clear(),this.onPadUpObservable.clear()},t}(ss),qs=function(){function e(e){var t=this;if(this._scene=e,this._babylonGamepads=[],this._oneGamepadConnected=!1,this._isMonitoring=!1,this.onGamepadDisconnectedObservable=new u,qe()?(this._gamepadEventSupported=\"GamepadEvent\"in window,this._gamepadSupport=navigator&&navigator.getGamepads):this._gamepadEventSupported=!1,this.onGamepadConnectedObservable=new u((function(e){for(var i in t._babylonGamepads){var n=t._babylonGamepads[i];n&&n._isConnected&&t.onGamepadConnectedObservable.notifyObserver(e,n)}})),this._onGamepadConnectedEvent=function(e){var i,n=e.gamepad;n.index in t._babylonGamepads&&t._babylonGamepads[n.index].isConnected||(t._babylonGamepads[n.index]?((i=t._babylonGamepads[n.index]).browserGamepad=n,i._isConnected=!0):i=t._addNewGamepad(n),t.onGamepadConnectedObservable.notifyObservers(i),t._startMonitoringGamepads())},this._onGamepadDisconnectedEvent=function(e){var i=e.gamepad;for(var n in t._babylonGamepads)if(t._babylonGamepads[n].index===i.index){var r=t._babylonGamepads[n];r._isConnected=!1,t.onGamepadDisconnectedObservable.notifyObservers(r),r.dispose&&r.dispose();break}},this._gamepadSupport)if(this._updateGamepadObjects(),this._babylonGamepads.length&&this._startMonitoringGamepads(),this._gamepadEventSupported){var i=this._scene?this._scene.getEngine().getHostWindow():window;i&&(i.addEventListener(\"gamepadconnected\",this._onGamepadConnectedEvent,!1),i.addEventListener(\"gamepaddisconnected\",this._onGamepadDisconnectedEvent,!1))}else this._startMonitoringGamepads()}return Object.defineProperty(e.prototype,\"gamepads\",{get:function(){return this._babylonGamepads},enumerable:!1,configurable:!0}),e.prototype.getGamepadByType=function(e){void 0===e&&(e=ss.XBOX);for(var t=0,i=this._babylonGamepads;t5))switch(this._face=e,this._face){case 0:this.updateEffect(\"#define POSITIVEX\");break;case 1:this.updateEffect(\"#define NEGATIVEX\");break;case 2:this.updateEffect(\"#define POSITIVEY\");break;case 3:this.updateEffect(\"#define NEGATIVEY\");break;case 4:this.updateEffect(\"#define POSITIVEZ\");break;case 5:this.updateEffect(\"#define NEGATIVEZ\")}},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return\"PassCubePostProcess\"},t._Parse=function(e,i,n,r){return Le.Parse((function(){return new t(e.name,e.options,i,e.renderTargetSamplingMode,e._engine,e.reusable)}),e,n,r)},t}(pa);vr._RescalePostProcessFactory=function(e){return new el(\"rescale\",1,null,a.TEXTURE_BILINEAR_SAMPLINGMODE,e,!1,a.TEXTURETYPE_UNSIGNED_INT)};It.ShadersStore.anaglyphPixelShader=\"varying vec2 vUV;\\nuniform sampler2D textureSampler;\\nuniform sampler2D leftSampler;\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void)\\n{\\nvec4 leftFrag=texture2D(leftSampler,vUV);\\nleftFrag=vec4(1.0,leftFrag.g,leftFrag.b,1.0);\\nvec4 rightFrag=texture2D(textureSampler,vUV);\\nrightFrag=vec4(rightFrag.r,1.0,1.0,1.0);\\ngl_FragColor=vec4(rightFrag.rgb*leftFrag.rgb,1.0);\\n}\";var il=function(e){function t(t,i,n,r,o,a){var s=e.call(this,t,\"anaglyph\",null,[\"leftSampler\"],i,n[1],r,o,a)||this;return s._passedProcess=n[0]._rigPostProcess,s.onApplyObservable.add((function(e){e.setTextureFromPostProcess(\"leftSampler\",s._passedProcess)})),s}return V(t,e),t.prototype.getClassName=function(){return\"AnaglyphPostProcess\"},t}(pa);function nl(e){e._rigCameras[0]._rigPostProcess=new el(e.name+\"_passthru\",1,e._rigCameras[0]),e._rigCameras[1]._rigPostProcess=new il(e.name+\"_anaglyph\",1,e._rigCameras)}b(\"BABYLON.AnaglyphPostProcess\",il),Ue.AddNodeConstructor(\"AnaglyphArcRotateCamera\",(function(e,t,i){return function(){return new rl(e,0,0,1,x.Zero(),i.interaxial_distance,t)}}));var rl=function(e){function t(t,i,n,r,o,a,s){var l=e.call(this,t,i,n,r,o,s)||this;return l._setRigMode=nl.bind(null,l),l.interaxialDistance=a,l.setCameraRigMode(xr.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:a}),l}return V(t,e),t.prototype.getClassName=function(){return\"AnaglyphArcRotateCamera\"},t}(Ls);Ue.AddNodeConstructor(\"AnaglyphFreeCamera\",(function(e,t,i){return function(){return new ol(e,x.Zero(),i.interaxial_distance,t)}}));var ol=function(e){function t(t,i,n,r){var o=e.call(this,t,i,r)||this;return o._setRigMode=nl.bind(null,o),o.interaxialDistance=n,o.setCameraRigMode(xr.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:n}),o}return V(t,e),t.prototype.getClassName=function(){return\"AnaglyphFreeCamera\"},t}(Ds);Ue.AddNodeConstructor(\"AnaglyphGamepadCamera\",(function(e,t,i){return function(){return new al(e,x.Zero(),i.interaxial_distance,t)}}));var al=function(e){function t(t,i,n,r){var o=e.call(this,t,i,r)||this;return o._setRigMode=nl.bind(null,o),o.interaxialDistance=n,o.setCameraRigMode(xr.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:n}),o}return V(t,e),t.prototype.getClassName=function(){return\"AnaglyphGamepadCamera\"},t}($s);Ue.AddNodeConstructor(\"AnaglyphUniversalCamera\",(function(e,t,i){return function(){return new sl(e,x.Zero(),i.interaxial_distance,t)}}));var sl=function(e){function t(t,i,n,r){var o=e.call(this,t,i,r)||this;return o._setRigMode=nl.bind(null,o),o.interaxialDistance=n,o.setCameraRigMode(xr.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:n}),o}return V(t,e),t.prototype.getClassName=function(){return\"AnaglyphUniversalCamera\"},t}(Js);It.ShadersStore.stereoscopicInterlacePixelShader=\"const vec3 TWO=vec3(2.0,2.0,2.0);\\nvarying vec2 vUV;\\nuniform sampler2D camASampler;\\nuniform sampler2D textureSampler;\\nuniform vec2 stepSize;\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void)\\n{\\nbool useCamA;\\nbool useCamB;\\nvec2 texCoord1;\\nvec2 texCoord2;\\nvec3 frag1;\\nvec3 frag2;\\n#ifdef IS_STEREOSCOPIC_HORIZ\\nuseCamB=vUV.x>0.5;\\nuseCamA=!useCamB;\\ntexCoord1=vec2(useCamB ? (vUV.x-0.5)*2.0 : vUV.x*2.0,vUV.y);\\ntexCoord2=vec2(texCoord1.x+stepSize.x,vUV.y);\\n#else\\n#ifdef IS_STEREOSCOPIC_INTERLACED\\nfloat rowNum=floor(vUV.y/stepSize.y);\\nuseCamA=mod(rowNum,2.0)==1.0;\\nuseCamB=mod(rowNum,2.0)==0.0;\\ntexCoord1=vec2(vUV.x,vUV.y);\\ntexCoord2=vec2(vUV.x,vUV.y);\\n#else\\nuseCamB=vUV.y>0.5;\\nuseCamA=!useCamB;\\ntexCoord1=vec2(vUV.x,useCamB ? (vUV.y-0.5)*2.0 : vUV.y*2.0);\\ntexCoord2=vec2(vUV.x,texCoord1.y+stepSize.y);\\n#endif\\n#endif\\nif (useCamB){\\nfrag1=texture2D(textureSampler,texCoord1).rgb;\\nfrag2=texture2D(textureSampler,texCoord2).rgb;\\n}else if (useCamA){\\nfrag1=texture2D(camASampler ,texCoord1).rgb;\\nfrag2=texture2D(camASampler ,texCoord2).rgb;\\n}else {\\ndiscard;\\n}\\ngl_FragColor=vec4((frag1+frag2)/TWO,1.0);\\n}\\n\";var ll=function(e){function t(t,i,n,r,o,a,s){var l=e.call(this,t,\"stereoscopicInterlace\",[\"stepSize\"],[\"camASampler\"],1,i[1],o,a,s,r?\"#define IS_STEREOSCOPIC_INTERLACED 1\":n?\"#define IS_STEREOSCOPIC_HORIZ 1\":void 0)||this;return l._passedProcess=i[0]._rigPostProcess,l._stepSize=new R(1/l.width,1/l.height),l.onSizeChangedObservable.add((function(){l._stepSize=new R(1/l.width,1/l.height)})),l.onApplyObservable.add((function(e){e.setTextureFromPostProcess(\"camASampler\",l._passedProcess),e.setFloat2(\"stepSize\",l._stepSize.x,l._stepSize.y)})),l}return V(t,e),t.prototype.getClassName=function(){return\"StereoscopicInterlacePostProcessI\"},t}(pa),cl=function(e){function t(t,i,n,r,o,a){var s=e.call(this,t,\"stereoscopicInterlace\",[\"stepSize\"],[\"camASampler\"],1,i[1],r,o,a,n?\"#define IS_STEREOSCOPIC_HORIZ 1\":void 0)||this;return s._passedProcess=i[0]._rigPostProcess,s._stepSize=new R(1/s.width,1/s.height),s.onSizeChangedObservable.add((function(){s._stepSize=new R(1/s.width,1/s.height)})),s.onApplyObservable.add((function(e){e.setTextureFromPostProcess(\"camASampler\",s._passedProcess),e.setFloat2(\"stepSize\",s._stepSize.x,s._stepSize.y)})),s}return V(t,e),t.prototype.getClassName=function(){return\"StereoscopicInterlacePostProcess\"},t}(pa);function ul(e){var t=e.cameraRigMode===xr.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL||e.cameraRigMode===xr.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED,i=e.cameraRigMode===xr.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED;e.cameraRigMode===xr.RIG_MODE_STEREOSCOPIC_INTERLACED?(e._rigCameras[0]._rigPostProcess=new el(e.name+\"_passthru\",1,e._rigCameras[0]),e._rigCameras[1]._rigPostProcess=new ll(e.name+\"_stereoInterlace\",e._rigCameras,!1,!0)):(e._rigCameras[i?1:0].viewport=new Rr(0,0,t?.5:1,t?1:.5),e._rigCameras[i?0:1].viewport=new Rr(t?.5:0,t?0:.5,t?.5:1,t?1:.5))}Ue.AddNodeConstructor(\"StereoscopicArcRotateCamera\",(function(e,t,i){return function(){return new hl(e,0,0,1,x.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)}}));var hl=function(e){function t(t,i,n,r,o,a,s,l){var c=e.call(this,t,i,n,r,o,l)||this;return c._setRigMode=ul.bind(null,c),c.interaxialDistance=a,c.isStereoscopicSideBySide=s,c.setCameraRigMode(s?xr.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:xr.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:a}),c}return V(t,e),t.prototype.getClassName=function(){return\"StereoscopicArcRotateCamera\"},t}(Ls);Ue.AddNodeConstructor(\"StereoscopicFreeCamera\",(function(e,t,i){return function(){return new dl(e,x.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)}}));var dl=function(e){function t(t,i,n,r,o){var a=e.call(this,t,i,o)||this;return a._setRigMode=ul.bind(null,a),a.interaxialDistance=n,a.isStereoscopicSideBySide=r,a.setCameraRigMode(r?xr.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:xr.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:n}),a}return V(t,e),t.prototype.getClassName=function(){return\"StereoscopicFreeCamera\"},t}(Ds);Ue.AddNodeConstructor(\"StereoscopicGamepadCamera\",(function(e,t,i){return function(){return new pl(e,x.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)}}));var pl=function(e){function t(t,i,n,r,o){var a=e.call(this,t,i,o)||this;return a._setRigMode=ul.bind(null,a),a.interaxialDistance=n,a.isStereoscopicSideBySide=r,a.setCameraRigMode(r?xr.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:xr.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:n}),a}return V(t,e),t.prototype.getClassName=function(){return\"StereoscopicGamepadCamera\"},t}($s);Ue.AddNodeConstructor(\"StereoscopicFreeCamera\",(function(e,t,i){return function(){return new fl(e,x.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)}}));var fl=function(e){function t(t,i,n,r,o){var a=e.call(this,t,i,o)||this;return a._setRigMode=ul.bind(null,a),a.interaxialDistance=n,a.isStereoscopicSideBySide=r,a.setCameraRigMode(r?xr.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:xr.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:n}),a}return V(t,e),t.prototype.getClassName=function(){return\"StereoscopicUniversalCamera\"},t}(Js),_l=function(e){function t(t,i,n,r,o){void 0===r&&(r=1),void 0===o&&(o=.065);var a=e.call(this,t,i,n)||this;return a._distanceBetweenEyes=o,a._distanceToProjectionPlane=r,a.setCameraRigMode(xr.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL,{stereoHalfAngle:0}),a._cameraRigParams.stereoHalfAngle=0,a._cameraRigParams.interaxialDistance=o,a}return V(t,e),Object.defineProperty(t.prototype,\"distanceBetweenEyes\",{get:function(){return this._distanceBetweenEyes},set:function(e){this._distanceBetweenEyes=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"distanceToProjectionPlane\",{get:function(){return this._distanceToProjectionPlane},set:function(e){this._distanceToProjectionPlane=e},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return\"StereoscopicUniversalCamera\"},t.prototype.createRigCamera=function(e){var t=new Os(e,x.Zero(),this.getScene()),i=new yr(\"tm_\"+e,this.getScene());return t.parent=i,i.setPivotMatrix(M.Identity(),!1),t.isRigCamera=!0,t.rigParent=this,t},t.prototype._updateRigCameras=function(){for(var e=0;e1.0 || tc.y<0.0 || tc.y>1.0)\\ngl_FragColor=vec4(0.0,0.0,0.0,0.0);\\nelse{\\ngl_FragColor=texture2D(textureSampler,tc);\\n}\\n}\";var vl=function(e){function t(t,i,n,r){var o=e.call(this,t,\"vrDistortionCorrection\",[\"LensCenter\",\"Scale\",\"ScaleIn\",\"HmdWarpParam\"],null,r.postProcessScaleFactor,i,to.BILINEAR_SAMPLINGMODE)||this;return o._isRightEye=n,o._distortionFactors=r.distortionK,o._postProcessScaleFactor=r.postProcessScaleFactor,o._lensCenterOffset=r.lensCenterOffset,o.adaptScaleToCurrentViewport=!0,o.onSizeChangedObservable.add((function(){o._scaleIn=new R(2,2/o.aspectRatio),o._scaleFactor=new R(1/o._postProcessScaleFactor*.5,1/o._postProcessScaleFactor*.5*o.aspectRatio),o._lensCenter=new R(o._isRightEye?.5-.5*o._lensCenterOffset:.5+.5*o._lensCenterOffset,.5)})),o.onApplyObservable.add((function(e){e.setFloat2(\"LensCenter\",o._lensCenter.x,o._lensCenter.y),e.setFloat2(\"Scale\",o._scaleFactor.x,o._scaleFactor.y),e.setFloat2(\"ScaleIn\",o._scaleIn.x,o._scaleIn.y),e.setFloat4(\"HmdWarpParam\",o._distortionFactors[0],o._distortionFactors[1],o._distortionFactors[2],o._distortionFactors[3])})),o}return V(t,e),t.prototype.getClassName=function(){return\"VRDistortionCorrectionPostProcess\"},t}(pa);It.ShadersStore.vrMultiviewToSingleviewPixelShader=\"precision mediump sampler2DArray;\\nvarying vec2 vUV;\\nuniform sampler2DArray multiviewSampler;\\nuniform int imageIndex;\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void)\\n{\\ngl_FragColor=texture2D(multiviewSampler,vec3(vUV,imageIndex));\\n}\";var yl=function(e){function t(t,i){void 0===i&&(i=512);var n=e.call(this,\"multiview rtt\",i,t,!1,!0,a.TEXTURETYPE_UNSIGNED_INT,!1,void 0,!1,!1,!0,void 0,!0)||this;return n._renderTarget=n.getScene().getEngine().createMultiviewRenderTargetTexture(n.getRenderWidth(),n.getRenderHeight()),n._texture=n._renderTarget.texture,n._texture.isMultiview=!0,n._texture.format=a.TEXTUREFORMAT_RGBA,n.samples=n._getEngine().getCaps().maxSamples||n.samples,n._texture.samples=n._samples,n}return V(t,e),Object.defineProperty(t.prototype,\"samples\",{set:function(e){this._samples=e},enumerable:!1,configurable:!0}),t.prototype._bindFrameBuffer=function(){this._renderTarget&&this.getScene().getEngine().bindMultiviewFramebuffer(this._renderTarget)},t.prototype.getViewCount=function(){return 2},t}(Ia);function bl(e,t){var i=new Li(e,void 0,!0,t);return i.addUniform(\"viewProjection\",16),i.addUniform(\"viewProjectionR\",16),i.addUniform(\"view\",16),i.addUniform(\"projection\",16),i.addUniform(\"vEyePosition\",4),i}vr.prototype.createMultiviewRenderTargetTexture=function(e,t){var i=this._gl;if(!this.getCaps().multiview)throw\"Multiview is not supported\";var n=this._createHardwareRenderTargetWrapper(!1,!1,{width:e,height:t});n._framebuffer=i.createFramebuffer();var r=new wt(this,Rt.Unknown,!0);return r.width=e,r.height=t,r.isMultiview=!0,n._colorTextureArray=i.createTexture(),i.bindTexture(i.TEXTURE_2D_ARRAY,n._colorTextureArray),i.texStorage3D(i.TEXTURE_2D_ARRAY,1,i.RGBA8,e,t,2),n._depthStencilTextureArray=i.createTexture(),i.bindTexture(i.TEXTURE_2D_ARRAY,n._depthStencilTextureArray),i.texStorage3D(i.TEXTURE_2D_ARRAY,1,i.DEPTH24_STENCIL8,e,t,2),r.isReady=!0,n.setTextures(r),n._depthStencilTexture=r,n},vr.prototype.bindMultiviewFramebuffer=function(e){var t=e,i=this._gl,n=this.getCaps().oculusMultiview||this.getCaps().multiview;if(this.bindFramebuffer(t,void 0,void 0,void 0,!0),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,t._framebuffer),!t._colorTextureArray||!t._depthStencilTextureArray)throw\"Invalid multiview frame buffer\";this.getCaps().oculusMultiview?(n.framebufferTextureMultisampleMultiviewOVR(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,t._colorTextureArray,0,t.samples,0,2),n.framebufferTextureMultisampleMultiviewOVR(i.DRAW_FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,t._depthStencilTextureArray,0,t.samples,0,2)):(n.framebufferTextureMultiviewOVR(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,t._colorTextureArray,0,0,2),n.framebufferTextureMultiviewOVR(i.DRAW_FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,t._depthStencilTextureArray,0,0,2))},xr.prototype._useMultiviewToSingleView=!1,xr.prototype._multiviewTexture=null,xr.prototype._resizeOrCreateMultiviewTexture=function(e,t){this._multiviewTexture?this._multiviewTexture.getRenderWidth()==e&&this._multiviewTexture.getRenderHeight()==t||(this._multiviewTexture.dispose(),this._multiviewTexture=new yl(this.getScene(),{width:e,height:t})):this._multiviewTexture=new yl(this.getScene(),{width:e,height:t})};var Tl=mn.prototype.createSceneUniformBuffer;mn.prototype._transformMatrixR=M.Zero(),mn.prototype._multiviewSceneUbo=null,mn.prototype._createMultiviewUbo=function(){this._multiviewSceneUbo=bl(this.getEngine(),\"scene_multiview\")},mn.prototype.createSceneUniformBuffer=function(e){return this._multiviewSceneUbo?bl(this.getEngine(),e):Tl.bind(this)(e)},mn.prototype._updateMultiviewUbo=function(e,t){e&&t&&e.multiplyToRef(t,this._transformMatrixR),e&&t&&(e.multiplyToRef(t,O.Matrix[0]),hn.GetRightPlaneToRef(O.Matrix[0],this._frustumPlanes[3])),this._multiviewSceneUbo&&(this._multiviewSceneUbo.updateMatrix(\"viewProjection\",this.getTransformMatrix()),this._multiviewSceneUbo.updateMatrix(\"viewProjectionR\",this._transformMatrixR),this._multiviewSceneUbo.updateMatrix(\"view\",this._viewMatrix),this._multiviewSceneUbo.updateMatrix(\"projection\",this._projectionMatrix))},mn.prototype._renderMultiviewToSingleView=function(e){e._resizeOrCreateMultiviewTexture(e._rigPostProcess&&e._rigPostProcess&&e._rigPostProcess.width>0?e._rigPostProcess.width:this.getEngine().getRenderWidth(!0),e._rigPostProcess&&e._rigPostProcess&&e._rigPostProcess.height>0?e._rigPostProcess.height:this.getEngine().getRenderHeight(!0)),this._multiviewSceneUbo||this._createMultiviewUbo(),e.outputRenderTarget=e._multiviewTexture,this._renderForCamera(e),e.outputRenderTarget=null;for(var t=0;t0&&-1===this.includedOnlyMeshes.indexOf(e)||this.excludedMeshes&&this.excludedMeshes.length>0&&-1!==this.excludedMeshes.indexOf(e)||0!==this.includeOnlyWithLayerMask&&0==(this.includeOnlyWithLayerMask&e.layerMask)||0!==this.excludeWithLayerMask&&this.excludeWithLayerMask&e.layerMask))},t.prototype.dispose=function(t,i){if(void 0===i&&(i=!1),this._shadowGenerator&&(this._shadowGenerator.dispose(),this._shadowGenerator=null),this.getScene().stopAnimation(this),this._parentContainer){var n=this._parentContainer.lights.indexOf(this);n>-1&&this._parentContainer.lights.splice(n,1),this._parentContainer=null}for(var r=0,o=this.getScene().meshes;r0&&(e.excludedMeshesIds=[],this.excludedMeshes.forEach((function(t){e.excludedMeshesIds.push(t.id)}))),this.includedOnlyMeshes.length>0&&(e.includedOnlyMeshesIds=[],this.includedOnlyMeshes.forEach((function(t){e.includedOnlyMeshesIds.push(t.id)}))),Le.AppendSerializedAnimations(this,e),e.ranges=this.serializeAnimationRanges(),e.isEnabled=this.isEnabled(),e},t.GetConstructorFromName=function(e,t,i){return Ue.Construct(\"Light_Type_\"+e,t,i)||null},t.Parse=function(e,i){var n=t.GetConstructorFromName(e.type,e.name,i);if(!n)return null;var r=Le.Parse(n,e,i);if(e.excludedMeshesIds&&(r._excludedMeshesIds=e.excludedMeshesIds),e.includedOnlyMeshesIds&&(r._includedOnlyMeshesIds=e.includedOnlyMeshesIds),void 0!==e.parentId&&(r._waitingParentId=e.parentId),void 0!==e.parentInstanceIndex&&(r._waitingParentInstanceIndex=e.parentInstanceIndex),void 0!==e.falloffType&&(r.falloffType=e.falloffType),void 0!==e.lightmapMode&&(r.lightmapMode=e.lightmapMode),e.animations){for(var o=0;o=2&&e.onControllersAttachedObservable.notifyObservers(e.controllers)}}}))},t}(Ds),Ol=function(e){function t(t){var i=e.call(this,t)||this;return i.onTriggerStateChangedObservable=new u,i.onMainButtonStateChangedObservable=new u,i.onSecondaryButtonStateChangedObservable=new u,i.onPadStateChangedObservable=new u,i.onPadValuesChangedObservable=new u,i.pad={x:0,y:0},i._changes={pressChanged:!1,touchChanged:!1,valueChanged:!1,changed:!1},i._buttons=new Array(t.buttons.length),i.hand=t.hand,i}return V(t,e),t.prototype.onButtonStateChange=function(e){this._onButtonStateChange=e},Object.defineProperty(t.prototype,\"defaultModel\",{get:function(){return this._defaultModel},enumerable:!1,configurable:!0}),t.prototype.update=function(){e.prototype.update.call(this);for(var t=0;t\\n#include\\n\";It.IncludesShadersStore.prePassDeclaration=\"#ifdef PREPASS\\n#extension GL_EXT_draw_buffers : require\\nlayout(location=0) out highp vec4 glFragData[{X}];highp vec4 gl_FragColor;\\n#ifdef PREPASS_DEPTH\\nvarying highp vec3 vViewPos;\\n#endif\\n#ifdef PREPASS_VELOCITY\\nvarying highp vec4 vCurrentPosition;varying highp vec4 vPreviousPosition;\\n#endif\\n#endif\\n\";It.IncludesShadersStore.oitDeclaration=\"#ifdef ORDER_INDEPENDENT_TRANSPARENCY\\n#extension GL_EXT_draw_buffers : require\\nlayout(location=0) out vec2 depth; \\nlayout(location=1) out vec4 frontColor;\\nlayout(location=2) out vec4 backColor;\\n#define MAX_DEPTH 99999.0\\nhighp vec4 gl_FragColor;\\nuniform sampler2D oitDepthSampler;\\nuniform sampler2D oitFrontColorSampler;\\n#endif\\n\";It.IncludesShadersStore.mainUVVaryingDeclaration=\"#ifdef MAINUV{X}\\nvarying vec2 vMainUV{X};\\n#endif\\n\";It.IncludesShadersStore.helperFunctions=\"const float PI=3.1415926535897932384626433832795;\\nconst float HALF_MIN=5.96046448e-08; \\nconst float LinearEncodePowerApprox=2.2;\\nconst float GammaEncodePowerApprox=1.0/LinearEncodePowerApprox;\\nconst vec3 LuminanceEncodeApprox=vec3(0.2126,0.7152,0.0722);\\nconst float Epsilon=0.0000001;\\n#define saturate(x) clamp(x,0.0,1.0)\\n#define absEps(x) abs(x)+Epsilon\\n#define maxEps(x) max(x,Epsilon)\\n#define saturateEps(x) clamp(x,Epsilon,1.0)\\nmat3 transposeMat3(mat3 inMatrix) {\\nvec3 i0=inMatrix[0];\\nvec3 i1=inMatrix[1];\\nvec3 i2=inMatrix[2];\\nmat3 outMatrix=mat3(\\nvec3(i0.x,i1.x,i2.x),\\nvec3(i0.y,i1.y,i2.y),\\nvec3(i0.z,i1.z,i2.z)\\n);\\nreturn outMatrix;\\n}\\nmat3 inverseMat3(mat3 inMatrix) {\\nfloat a00=inMatrix[0][0],a01=inMatrix[0][1],a02=inMatrix[0][2];\\nfloat a10=inMatrix[1][0],a11=inMatrix[1][1],a12=inMatrix[1][2];\\nfloat a20=inMatrix[2][0],a21=inMatrix[2][1],a22=inMatrix[2][2];\\nfloat b01=a22*a11-a12*a21;\\nfloat b11=-a22*a10+a12*a20;\\nfloat b21=a21*a10-a11*a20;\\nfloat det=a00*b01+a01*b11+a02*b21;\\nreturn mat3(b01,(-a22*a01+a02*a21),(a12*a01-a02*a11),\\nb11,(a22*a00-a02*a20),(-a12*a00+a02*a10),\\nb21,(-a21*a00+a01*a20),(a11*a00-a01*a10))/det;\\n}\\n#if USE_EXACT_SRGB_CONVERSIONS\\nvec3 toLinearSpaceExact(vec3 color)\\n{\\nvec3 nearZeroSection=0.0773993808*color;\\nvec3 remainingSection=pow(0.947867299*(color+vec3(0.055)),vec3(2.4));\\n#if defined(WEBGL2) || defined(WEBGPU)\\nreturn mix(remainingSection,nearZeroSection,lessThanEqual(color,vec3(0.04045)));\\n#else\\nreturn\\nvec3(\\ncolor.r<=0.04045 ? nearZeroSection.r : remainingSection.r,\\ncolor.g<=0.04045 ? nearZeroSection.g : remainingSection.g,\\ncolor.b<=0.04045 ? nearZeroSection.b : remainingSection.b);\\n#endif\\n}\\nvec3 toGammaSpaceExact(vec3 color)\\n{\\nvec3 nearZeroSection=12.92*color;\\nvec3 remainingSection=1.055*pow(color,vec3(0.41666))-vec3(0.055);\\n#if defined(WEBGL2) || defined(WEBGPU)\\nreturn mix(remainingSection,nearZeroSection,lessThanEqual(color,vec3(0.0031308)));\\n#else\\nreturn\\nvec3(\\ncolor.r<=0.0031308 ? nearZeroSection.r : remainingSection.r,\\ncolor.g<=0.0031308 ? nearZeroSection.g : remainingSection.g,\\ncolor.b<=0.0031308 ? nearZeroSection.b : remainingSection.b);\\n#endif\\n}\\n#endif\\nfloat toLinearSpace(float color)\\n{\\n#if USE_EXACT_SRGB_CONVERSIONS\\nfloat nearZeroSection=0.0773993808*color;\\nfloat remainingSection=pow(0.947867299*(color+0.055),2.4);\\nreturn color<=0.04045 ? nearZeroSection : remainingSection;\\n#else\\nreturn pow(color,LinearEncodePowerApprox);\\n#endif\\n}\\nvec3 toLinearSpace(vec3 color)\\n{\\n#if USE_EXACT_SRGB_CONVERSIONS\\nreturn toLinearSpaceExact(color);\\n#else\\nreturn pow(color,vec3(LinearEncodePowerApprox));\\n#endif\\n}\\nvec4 toLinearSpace(vec4 color)\\n{\\n#if USE_EXACT_SRGB_CONVERSIONS\\nreturn vec4(toLinearSpaceExact(color.rgb),color.a);\\n#else\\nreturn vec4(pow(color.rgb,vec3(LinearEncodePowerApprox)),color.a);\\n#endif\\n}\\nfloat toGammaSpace(float color)\\n{\\n#if USE_EXACT_SRGB_CONVERSIONS\\nfloat nearZeroSection=12.92*color;\\nfloat remainingSection=1.055*pow(color,0.41666)-0.055;\\nreturn color<=0.0031308 ? nearZeroSection : remainingSection;\\n#else\\nreturn pow(color,GammaEncodePowerApprox);\\n#endif\\n}\\nvec3 toGammaSpace(vec3 color)\\n{\\n#if USE_EXACT_SRGB_CONVERSIONS\\nreturn toGammaSpaceExact(color);\\n#else\\nreturn pow(color,vec3(GammaEncodePowerApprox));\\n#endif\\n}\\nvec4 toGammaSpace(vec4 color)\\n{\\n#if USE_EXACT_SRGB_CONVERSIONS\\nreturn vec4(toGammaSpaceExact(color.rgb),color.a);\\n#else\\nreturn vec4(pow(color.rgb,vec3(GammaEncodePowerApprox)),color.a);\\n#endif\\n}\\nfloat square(float value)\\n{\\nreturn value*value;\\n}\\nvec3 square(vec3 value)\\n{\\nreturn value*value;\\n}\\nfloat pow5(float value) {\\nfloat sq=value*value;\\nreturn sq*sq*value;\\n}\\nfloat getLuminance(vec3 color)\\n{\\nreturn clamp(dot(color,LuminanceEncodeApprox),0.,1.);\\n}\\nfloat getRand(vec2 seed) {\\nreturn fract(sin(dot(seed.xy ,vec2(12.9898,78.233)))*43758.5453);\\n}\\nfloat dither(vec2 seed,float varianceAmount) {\\nfloat rand=getRand(seed);\\nfloat normVariance=varianceAmount/255.0;\\nfloat dither=mix(-normVariance,normVariance,rand);\\nreturn dither;\\n}\\nconst float rgbdMaxRange=255.0;\\nvec4 toRGBD(vec3 color) {\\nfloat maxRGB=maxEps(max(color.r,max(color.g,color.b)));\\nfloat D =max(rgbdMaxRange/maxRGB,1.);\\nD =clamp(floor(D)/255.0,0.,1.);\\nvec3 rgb=color.rgb*D;\\nrgb=toGammaSpace(rgb);\\nreturn vec4(clamp(rgb,0.,1.),D); \\n}\\nvec3 fromRGBD(vec4 rgbd) {\\nrgbd.rgb=toLinearSpace(rgbd.rgb);\\nreturn rgbd.rgb/rgbd.a;\\n}\\nvec3 parallaxCorrectNormal( vec3 vertexPos,vec3 origVec,vec3 cubeSize,vec3 cubePos ) {\\nvec3 invOrigVec=vec3(1.0,1.0,1.0)/origVec;\\nvec3 halfSize=cubeSize*0.5;\\nvec3 intersecAtMaxPlane=(cubePos+halfSize-vertexPos)*invOrigVec;\\nvec3 intersecAtMinPlane=(cubePos-halfSize-vertexPos)*invOrigVec;\\nvec3 largestIntersec=max(intersecAtMaxPlane,intersecAtMinPlane);\\nfloat distance=min(min(largestIntersec.x,largestIntersec.y),largestIntersec.z);\\nvec3 intersectPositionWS=vertexPos+origVec*distance;\\nreturn intersectPositionWS-cubePos;\\n}\\n\";It.IncludesShadersStore.lightFragmentDeclaration=\"#ifdef LIGHT{X}\\nuniform vec4 vLightData{X};\\nuniform vec4 vLightDiffuse{X};\\n#ifdef SPECULARTERM\\nuniform vec4 vLightSpecular{X};\\n#else\\nvec4 vLightSpecular{X}=vec4(0.);\\n#endif\\n#ifdef SHADOW{X}\\n#ifdef SHADOWCSM{X}\\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];\\nuniform float viewFrustumZ{X}[SHADOWCSMNUM_CASCADES{X}];\\nuniform float frustumLengths{X}[SHADOWCSMNUM_CASCADES{X}];\\nuniform float cascadeBlendFactor{X};\\nvarying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];\\nvarying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];\\nvarying vec4 vPositionFromCamera{X};\\n#if defined(SHADOWPCSS{X})\\nuniform highp sampler2DArrayShadow shadowSampler{X};\\nuniform highp sampler2DArray depthSampler{X};\\nuniform vec2 lightSizeUVCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\\nuniform float depthCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\\nuniform float penumbraDarkness{X};\\n#elif defined(SHADOWPCF{X})\\nuniform highp sampler2DArrayShadow shadowSampler{X};\\n#else\\nuniform highp sampler2DArray shadowSampler{X};\\n#endif\\n#ifdef SHADOWCSMDEBUG{X}\\nconst vec3 vCascadeColorsMultiplier{X}[8]=vec3[8]\\n(\\nvec3 ( 1.5,0.0,0.0 ),\\nvec3 ( 0.0,1.5,0.0 ),\\nvec3 ( 0.0,0.0,5.5 ),\\nvec3 ( 1.5,0.0,5.5 ),\\nvec3 ( 1.5,1.5,0.0 ),\\nvec3 ( 1.0,1.0,1.0 ),\\nvec3 ( 0.0,1.0,5.5 ),\\nvec3 ( 0.5,3.5,0.75 )\\n);\\nvec3 shadowDebug{X};\\n#endif\\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\\nint index{X}=-1;\\n#else\\nint index{X}=SHADOWCSMNUM_CASCADES{X}-1;\\n#endif\\nfloat diff{X}=0.;\\n#elif defined(SHADOWCUBE{X})\\nuniform samplerCube shadowSampler{X};\\n#else\\nvarying vec4 vPositionFromLight{X};\\nvarying float vDepthMetric{X};\\n#if defined(SHADOWPCSS{X})\\nuniform highp sampler2DShadow shadowSampler{X};\\nuniform highp sampler2D depthSampler{X};\\n#elif defined(SHADOWPCF{X})\\nuniform highp sampler2DShadow shadowSampler{X};\\n#else\\nuniform sampler2D shadowSampler{X};\\n#endif\\nuniform mat4 lightMatrix{X};\\n#endif\\nuniform vec4 shadowsInfo{X};\\nuniform vec2 depthValues{X};\\n#endif\\n#ifdef SPOTLIGHT{X}\\nuniform vec4 vLightDirection{X};\\nuniform vec4 vLightFalloff{X};\\n#elif defined(POINTLIGHT{X})\\nuniform vec4 vLightFalloff{X};\\n#elif defined(HEMILIGHT{X})\\nuniform vec3 vLightGround{X};\\n#endif\\n#ifdef PROJECTEDLIGHTTEXTURE{X}\\nuniform mat4 textureProjectionMatrix{X};\\nuniform sampler2D projectionLightSampler{X};\\n#endif\\n#endif\\n\";It.IncludesShadersStore.lightUboDeclaration=\"#ifdef LIGHT{X}\\nuniform Light{X}\\n{\\nvec4 vLightData;\\nvec4 vLightDiffuse;\\nvec4 vLightSpecular;\\n#ifdef SPOTLIGHT{X}\\nvec4 vLightDirection;\\nvec4 vLightFalloff;\\n#elif defined(POINTLIGHT{X})\\nvec4 vLightFalloff;\\n#elif defined(HEMILIGHT{X})\\nvec3 vLightGround;\\n#endif\\nvec4 shadowsInfo;\\nvec2 depthValues;\\n} light{X};\\n#ifdef PROJECTEDLIGHTTEXTURE{X}\\nuniform mat4 textureProjectionMatrix{X};\\nuniform sampler2D projectionLightSampler{X};\\n#endif\\n#ifdef SHADOW{X}\\n#ifdef SHADOWCSM{X}\\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];\\nuniform float viewFrustumZ{X}[SHADOWCSMNUM_CASCADES{X}];\\nuniform float frustumLengths{X}[SHADOWCSMNUM_CASCADES{X}];\\nuniform float cascadeBlendFactor{X};\\nvarying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];\\nvarying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];\\nvarying vec4 vPositionFromCamera{X};\\n#if defined(SHADOWPCSS{X})\\nuniform highp sampler2DArrayShadow shadowSampler{X};\\nuniform highp sampler2DArray depthSampler{X};\\nuniform vec2 lightSizeUVCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\\nuniform float depthCorrection{X}[SHADOWCSMNUM_CASCADES{X}];\\nuniform float penumbraDarkness{X};\\n#elif defined(SHADOWPCF{X})\\nuniform highp sampler2DArrayShadow shadowSampler{X};\\n#else\\nuniform highp sampler2DArray shadowSampler{X};\\n#endif\\n#ifdef SHADOWCSMDEBUG{X}\\nconst vec3 vCascadeColorsMultiplier{X}[8]=vec3[8]\\n(\\nvec3 ( 1.5,0.0,0.0 ),\\nvec3 ( 0.0,1.5,0.0 ),\\nvec3 ( 0.0,0.0,5.5 ),\\nvec3 ( 1.5,0.0,5.5 ),\\nvec3 ( 1.5,1.5,0.0 ),\\nvec3 ( 1.0,1.0,1.0 ),\\nvec3 ( 0.0,1.0,5.5 ),\\nvec3 ( 0.5,3.5,0.75 )\\n);\\nvec3 shadowDebug{X};\\n#endif\\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\\nint index{X}=-1;\\n#else\\nint index{X}=SHADOWCSMNUM_CASCADES{X}-1;\\n#endif\\nfloat diff{X}=0.;\\n#elif defined(SHADOWCUBE{X})\\nuniform samplerCube shadowSampler{X}; \\n#else\\nvarying vec4 vPositionFromLight{X};\\nvarying float vDepthMetric{X};\\n#if defined(SHADOWPCSS{X})\\nuniform highp sampler2DShadow shadowSampler{X};\\nuniform highp sampler2D depthSampler{X};\\n#elif defined(SHADOWPCF{X})\\nuniform highp sampler2DShadow shadowSampler{X};\\n#else\\nuniform sampler2D shadowSampler{X};\\n#endif\\nuniform mat4 lightMatrix{X};\\n#endif\\n#endif\\n#endif\\n\";It.IncludesShadersStore.lightsFragmentFunctions=\"struct lightingInfo\\n{\\nvec3 diffuse;\\n#ifdef SPECULARTERM\\nvec3 specular;\\n#endif\\n#ifdef NDOTL\\nfloat ndl;\\n#endif\\n};\\nlightingInfo computeLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {\\nlightingInfo result;\\nvec3 lightVectorW;\\nfloat attenuation=1.0;\\nif (lightData.w==0.)\\n{\\nvec3 direction=lightData.xyz-vPositionW;\\nattenuation=max(0.,1.0-length(direction)/range);\\nlightVectorW=normalize(direction);\\n}\\nelse\\n{\\nlightVectorW=normalize(-lightData.xyz);\\n}\\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\\n#ifdef NDOTL\\nresult.ndl=ndl;\\n#endif\\nresult.diffuse=ndl*diffuseColor*attenuation;\\n#ifdef SPECULARTERM\\nvec3 angleW=normalize(viewDirectionW+lightVectorW);\\nfloat specComp=max(0.,dot(vNormal,angleW));\\nspecComp=pow(specComp,max(1.,glossiness));\\nresult.specular=specComp*specularColor*attenuation;\\n#endif\\nreturn result;\\n}\\nlightingInfo computeSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {\\nlightingInfo result;\\nvec3 direction=lightData.xyz-vPositionW;\\nvec3 lightVectorW=normalize(direction);\\nfloat attenuation=max(0.,1.0-length(direction)/range);\\nfloat cosAngle=max(0.,dot(lightDirection.xyz,-lightVectorW));\\nif (cosAngle>=lightDirection.w)\\n{\\ncosAngle=max(0.,pow(cosAngle,lightData.w));\\nattenuation*=cosAngle;\\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\\n#ifdef NDOTL\\nresult.ndl=ndl;\\n#endif\\nresult.diffuse=ndl*diffuseColor*attenuation;\\n#ifdef SPECULARTERM\\nvec3 angleW=normalize(viewDirectionW+lightVectorW);\\nfloat specComp=max(0.,dot(vNormal,angleW));\\nspecComp=pow(specComp,max(1.,glossiness));\\nresult.specular=specComp*specularColor*attenuation;\\n#endif\\nreturn result;\\n}\\nresult.diffuse=vec3(0.);\\n#ifdef SPECULARTERM\\nresult.specular=vec3(0.);\\n#endif\\n#ifdef NDOTL\\nresult.ndl=0.;\\n#endif\\nreturn result;\\n}\\nlightingInfo computeHemisphericLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,vec3 groundColor,float glossiness) {\\nlightingInfo result;\\nfloat ndl=dot(vNormal,lightData.xyz)*0.5+0.5;\\n#ifdef NDOTL\\nresult.ndl=ndl;\\n#endif\\nresult.diffuse=mix(groundColor,diffuseColor,ndl);\\n#ifdef SPECULARTERM\\nvec3 angleW=normalize(viewDirectionW+lightData.xyz);\\nfloat specComp=max(0.,dot(vNormal,angleW));\\nspecComp=pow(specComp,max(1.,glossiness));\\nresult.specular=specComp*specularColor;\\n#endif\\nreturn result;\\n}\\n#define inline\\nvec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix){\\nvec4 strq=textureProjectionMatrix*vec4(vPositionW,1.0);\\nstrq/=strq.w;\\nvec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;\\nreturn textureColor;\\n}\";It.IncludesShadersStore.shadowsFragmentFunctions=\"#ifdef SHADOWS\\n#ifndef SHADOWFLOAT\\nfloat unpack(vec4 color)\\n{\\nconst vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);\\nreturn dot(color,bit_shift);\\n}\\n#endif\\nfloat computeFallOff(float value,vec2 clipSpace,float frustumEdgeFalloff)\\n{\\nfloat mask=smoothstep(1.0-frustumEdgeFalloff,1.00000012,clamp(dot(clipSpace,clipSpace),0.,1.));\\nreturn mix(value,1.0,mask);\\n}\\n#define inline\\nfloat computeShadowCube(vec3 lightPosition,samplerCube shadowSampler,float darkness,vec2 depthValues)\\n{\\nvec3 directionToLight=vPositionW-lightPosition;\\nfloat depth=length(directionToLight);\\ndepth=(depth+depthValues.x)/(depthValues.y);\\ndepth=clamp(depth,0.,1.0);\\ndirectionToLight=normalize(directionToLight);\\ndirectionToLight.y=-directionToLight.y;\\n#ifndef SHADOWFLOAT\\nfloat shadow=unpack(textureCube(shadowSampler,directionToLight));\\n#else\\nfloat shadow=textureCube(shadowSampler,directionToLight).x;\\n#endif\\nreturn depth>shadow ? darkness : 1.0;\\n}\\n#define inline\\nfloat computeShadowWithPoissonSamplingCube(vec3 lightPosition,samplerCube shadowSampler,float mapSize,float darkness,vec2 depthValues)\\n{\\nvec3 directionToLight=vPositionW-lightPosition;\\nfloat depth=length(directionToLight);\\ndepth=(depth+depthValues.x)/(depthValues.y);\\ndepth=clamp(depth,0.,1.0);\\ndirectionToLight=normalize(directionToLight);\\ndirectionToLight.y=-directionToLight.y;\\nfloat visibility=1.;\\nvec3 poissonDisk[4];\\npoissonDisk[0]=vec3(-1.0,1.0,-1.0);\\npoissonDisk[1]=vec3(1.0,-1.0,-1.0);\\npoissonDisk[2]=vec3(-1.0,-1.0,-1.0);\\npoissonDisk[3]=vec3(1.0,-1.0,1.0);\\n#ifndef SHADOWFLOAT\\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize))shadow ? computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff) : 1.;\\n}\\n#endif\\n#define inline\\nfloat computeShadow(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float frustumEdgeFalloff)\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\\n{\\nreturn 1.0;\\n}\\nelse\\n{\\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\\n#ifndef SHADOWFLOAT\\nfloat shadow=unpack(texture2D(shadowSampler,uv));\\n#else\\nfloat shadow=texture2D(shadowSampler,uv).x;\\n#endif\\nreturn shadowPixelDepth>shadow ? computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff) : 1.;\\n}\\n}\\n#define inline\\nfloat computeShadowWithPoissonSampling(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float mapSize,float darkness,float frustumEdgeFalloff)\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\\n{\\nreturn 1.0;\\n}\\nelse\\n{\\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\\nfloat visibility=1.;\\nvec2 poissonDisk[4];\\npoissonDisk[0]=vec2(-0.94201624,-0.39906216);\\npoissonDisk[1]=vec2(0.94558609,-0.76890725);\\npoissonDisk[2]=vec2(-0.094184101,-0.92938870);\\npoissonDisk[3]=vec2(0.34495938,0.29387760);\\n#ifndef SHADOWFLOAT\\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[0]*mapSize))1.0 || uv.y<0. || uv.y>1.0)\\n{\\nreturn 1.0;\\n}\\nelse\\n{\\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\\n#ifndef SHADOWFLOAT\\nfloat shadowMapSample=unpack(texture2D(shadowSampler,uv));\\n#else\\nfloat shadowMapSample=texture2D(shadowSampler,uv).x;\\n#endif\\nfloat esm=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness);\\nreturn computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);\\n}\\n}\\n#define inline\\nfloat computeShadowWithCloseESM(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float depthScale,float frustumEdgeFalloff)\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\\n{\\nreturn 1.0;\\n}\\nelse\\n{\\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0); \\n#ifndef SHADOWFLOAT\\nfloat shadowMapSample=unpack(texture2D(shadowSampler,uv));\\n#else\\nfloat shadowMapSample=texture2D(shadowSampler,uv).x;\\n#endif\\nfloat esm=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);\\nreturn computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);\\n}\\n}\\n#ifdef IS_NDC_HALF_ZRANGE\\n#define ZINCLIP clipSpace.z\\n#else\\n#define ZINCLIP uvDepth.z\\n#endif\\n#if defined(WEBGL2) || defined(WEBGPU)\\n#define GREATEST_LESS_THAN_ONE 0.99999994\\n#define inline\\nfloat computeShadowWithCSMPCF1(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,float darkness,float frustumEdgeFalloff)\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nuvDepth.z=clamp(ZINCLIP,0.,GREATEST_LESS_THAN_ONE);\\nvec4 uvDepthLayer=vec4(uvDepth.x,uvDepth.y,layer,uvDepth.z);\\nfloat shadow=texture2D(shadowSampler,uvDepthLayer);\\nshadow=mix(darkness,1.,shadow);\\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\\n}\\n#define inline\\nfloat computeShadowWithCSMPCF3(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nuvDepth.z=clamp(ZINCLIP,0.,GREATEST_LESS_THAN_ONE);\\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x; \\nuv+=0.5; \\nvec2 st=fract(uv); \\nvec2 base_uv=floor(uv)-0.5; \\nbase_uv*=shadowMapSizeAndInverse.y; \\nvec2 uvw0=3.-2.*st;\\nvec2 uvw1=1.+2.*st;\\nvec2 u=vec2((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;\\nvec2 v=vec2((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;\\nfloat shadow=0.;\\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[0]),layer,uvDepth.z));\\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[0]),layer,uvDepth.z));\\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[1]),layer,uvDepth.z));\\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[1]),layer,uvDepth.z));\\nshadow=shadow/16.;\\nshadow=mix(darkness,1.,shadow);\\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\\n}\\n#define inline\\nfloat computeShadowWithCSMPCF5(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArrayShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nuvDepth.z=clamp(ZINCLIP,0.,GREATEST_LESS_THAN_ONE);\\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x; \\nuv+=0.5; \\nvec2 st=fract(uv); \\nvec2 base_uv=floor(uv)-0.5; \\nbase_uv*=shadowMapSizeAndInverse.y; \\nvec2 uvw0=4.-3.*st;\\nvec2 uvw1=vec2(7.);\\nvec2 uvw2=1.+3.*st;\\nvec3 u=vec3((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;\\nvec3 v=vec3((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;\\nfloat shadow=0.;\\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[0]),layer,uvDepth.z));\\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[0]),layer,uvDepth.z));\\nshadow+=uvw2.x*uvw0.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[0]),layer,uvDepth.z));\\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[1]),layer,uvDepth.z));\\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[1]),layer,uvDepth.z));\\nshadow+=uvw2.x*uvw1.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[1]),layer,uvDepth.z));\\nshadow+=uvw0.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[0],v[2]),layer,uvDepth.z));\\nshadow+=uvw1.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[1],v[2]),layer,uvDepth.z));\\nshadow+=uvw2.x*uvw2.y*texture2D(shadowSampler,vec4(base_uv.xy+vec2(u[2],v[2]),layer,uvDepth.z));\\nshadow=shadow/144.;\\nshadow=mix(darkness,1.,shadow);\\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\\n}\\n#define inline\\nfloat computeShadowWithPCF1(vec4 vPositionFromLight,float depthMetric,highp sampler2DShadow shadowSampler,float darkness,float frustumEdgeFalloff)\\n{\\nif (depthMetric>1.0 || depthMetric<0.0) {\\nreturn 1.0;\\n}\\nelse\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nuvDepth.z=ZINCLIP;\\nfloat shadow=texture2D(shadowSampler,uvDepth);\\nshadow=mix(darkness,1.,shadow);\\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\\n}\\n}\\n#define inline\\nfloat computeShadowWithPCF3(vec4 vPositionFromLight,float depthMetric,highp sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\\n{\\nif (depthMetric>1.0 || depthMetric<0.0) {\\nreturn 1.0;\\n}\\nelse\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nuvDepth.z=ZINCLIP;\\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x; \\nuv+=0.5; \\nvec2 st=fract(uv); \\nvec2 base_uv=floor(uv)-0.5; \\nbase_uv*=shadowMapSizeAndInverse.y; \\nvec2 uvw0=3.-2.*st;\\nvec2 uvw1=1.+2.*st;\\nvec2 u=vec2((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;\\nvec2 v=vec2((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;\\nfloat shadow=0.;\\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z));\\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z));\\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z));\\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z));\\nshadow=shadow/16.;\\nshadow=mix(darkness,1.,shadow);\\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\\n}\\n}\\n#define inline\\nfloat computeShadowWithPCF5(vec4 vPositionFromLight,float depthMetric,highp sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\\n{\\nif (depthMetric>1.0 || depthMetric<0.0) {\\nreturn 1.0;\\n}\\nelse\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nuvDepth.z=ZINCLIP;\\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x; \\nuv+=0.5; \\nvec2 st=fract(uv); \\nvec2 base_uv=floor(uv)-0.5; \\nbase_uv*=shadowMapSizeAndInverse.y; \\nvec2 uvw0=4.-3.*st;\\nvec2 uvw1=vec2(7.);\\nvec2 uvw2=1.+3.*st;\\nvec3 u=vec3((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;\\nvec3 v=vec3((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;\\nfloat shadow=0.;\\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z));\\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z));\\nshadow+=uvw2.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[0]),uvDepth.z));\\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z));\\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z));\\nshadow+=uvw2.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[1]),uvDepth.z));\\nshadow+=uvw0.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[2]),uvDepth.z));\\nshadow+=uvw1.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[2]),uvDepth.z));\\nshadow+=uvw2.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[2]),uvDepth.z));\\nshadow=shadow/144.;\\nshadow=mix(darkness,1.,shadow);\\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\\n}\\n}\\nconst vec3 PoissonSamplers32[64]=vec3[64](\\nvec3(0.06407013,0.05409927,0.),\\nvec3(0.7366577,0.5789394,0.),\\nvec3(-0.6270542,-0.5320278,0.),\\nvec3(-0.4096107,0.8411095,0.),\\nvec3(0.6849564,-0.4990818,0.),\\nvec3(-0.874181,-0.04579735,0.),\\nvec3(0.9989998,0.0009880066,0.),\\nvec3(-0.004920578,-0.9151649,0.),\\nvec3(0.1805763,0.9747483,0.),\\nvec3(-0.2138451,0.2635818,0.),\\nvec3(0.109845,0.3884785,0.),\\nvec3(0.06876755,-0.3581074,0.),\\nvec3(0.374073,-0.7661266,0.),\\nvec3(0.3079132,-0.1216763,0.),\\nvec3(-0.3794335,-0.8271583,0.),\\nvec3(-0.203878,-0.07715034,0.),\\nvec3(0.5912697,0.1469799,0.),\\nvec3(-0.88069,0.3031784,0.),\\nvec3(0.5040108,0.8283722,0.),\\nvec3(-0.5844124,0.5494877,0.),\\nvec3(0.6017799,-0.1726654,0.),\\nvec3(-0.5554981,0.1559997,0.),\\nvec3(-0.3016369,-0.3900928,0.),\\nvec3(-0.5550632,-0.1723762,0.),\\nvec3(0.925029,0.2995041,0.),\\nvec3(-0.2473137,0.5538505,0.),\\nvec3(0.9183037,-0.2862392,0.),\\nvec3(0.2469421,0.6718712,0.),\\nvec3(0.3916397,-0.4328209,0.),\\nvec3(-0.03576927,-0.6220032,0.),\\nvec3(-0.04661255,0.7995201,0.),\\nvec3(0.4402924,0.3640312,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.),\\nvec3(0.,0.,0.)\\n);\\nconst vec3 PoissonSamplers64[64]=vec3[64](\\nvec3(-0.613392,0.617481,0.),\\nvec3(0.170019,-0.040254,0.),\\nvec3(-0.299417,0.791925,0.),\\nvec3(0.645680,0.493210,0.),\\nvec3(-0.651784,0.717887,0.),\\nvec3(0.421003,0.027070,0.),\\nvec3(-0.817194,-0.271096,0.),\\nvec3(-0.705374,-0.668203,0.),\\nvec3(0.977050,-0.108615,0.),\\nvec3(0.063326,0.142369,0.),\\nvec3(0.203528,0.214331,0.),\\nvec3(-0.667531,0.326090,0.),\\nvec3(-0.098422,-0.295755,0.),\\nvec3(-0.885922,0.215369,0.),\\nvec3(0.566637,0.605213,0.),\\nvec3(0.039766,-0.396100,0.),\\nvec3(0.751946,0.453352,0.),\\nvec3(0.078707,-0.715323,0.),\\nvec3(-0.075838,-0.529344,0.),\\nvec3(0.724479,-0.580798,0.),\\nvec3(0.222999,-0.215125,0.),\\nvec3(-0.467574,-0.405438,0.),\\nvec3(-0.248268,-0.814753,0.),\\nvec3(0.354411,-0.887570,0.),\\nvec3(0.175817,0.382366,0.),\\nvec3(0.487472,-0.063082,0.),\\nvec3(-0.084078,0.898312,0.),\\nvec3(0.488876,-0.783441,0.),\\nvec3(0.470016,0.217933,0.),\\nvec3(-0.696890,-0.549791,0.),\\nvec3(-0.149693,0.605762,0.),\\nvec3(0.034211,0.979980,0.),\\nvec3(0.503098,-0.308878,0.),\\nvec3(-0.016205,-0.872921,0.),\\nvec3(0.385784,-0.393902,0.),\\nvec3(-0.146886,-0.859249,0.),\\nvec3(0.643361,0.164098,0.),\\nvec3(0.634388,-0.049471,0.),\\nvec3(-0.688894,0.007843,0.),\\nvec3(0.464034,-0.188818,0.),\\nvec3(-0.440840,0.137486,0.),\\nvec3(0.364483,0.511704,0.),\\nvec3(0.034028,0.325968,0.),\\nvec3(0.099094,-0.308023,0.),\\nvec3(0.693960,-0.366253,0.),\\nvec3(0.678884,-0.204688,0.),\\nvec3(0.001801,0.780328,0.),\\nvec3(0.145177,-0.898984,0.),\\nvec3(0.062655,-0.611866,0.),\\nvec3(0.315226,-0.604297,0.),\\nvec3(-0.780145,0.486251,0.),\\nvec3(-0.371868,0.882138,0.),\\nvec3(0.200476,0.494430,0.),\\nvec3(-0.494552,-0.711051,0.),\\nvec3(0.612476,0.705252,0.),\\nvec3(-0.578845,-0.768792,0.),\\nvec3(-0.772454,-0.090976,0.),\\nvec3(0.504440,0.372295,0.),\\nvec3(0.155736,0.065157,0.),\\nvec3(0.391522,0.849605,0.),\\nvec3(-0.620106,-0.328104,0.),\\nvec3(0.789239,-0.419965,0.),\\nvec3(-0.545396,0.538133,0.),\\nvec3(-0.178564,-0.596057,0.)\\n);\\n#define inline\\nfloat computeShadowWithCSMPCSS(float layer,vec4 vPositionFromLight,float depthMetric,highp sampler2DArray depthSampler,highp sampler2DArrayShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff,int searchTapCount,int pcfTapCount,vec3[64] poissonSamplers,vec2 lightSizeUVCorrection,float depthCorrection,float penumbraDarkness)\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nuvDepth.z=clamp(ZINCLIP,0.,GREATEST_LESS_THAN_ONE);\\nvec4 uvDepthLayer=vec4(uvDepth.x,uvDepth.y,layer,uvDepth.z);\\nfloat blockerDepth=0.0;\\nfloat sumBlockerDepth=0.0;\\nfloat numBlocker=0.0;\\nfor (int i=0; i1.0 || depthMetric<0.0) {\\nreturn 1.0;\\n}\\nelse\\n{\\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\\nuvDepth.z=ZINCLIP;\\nfloat blockerDepth=0.0;\\nfloat sumBlockerDepth=0.0;\\nfloat numBlocker=0.0;\\nfor (int i=0; i(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_SAMPLERNAME_,bump)\\n#endif\\n#if defined(DETAIL)\\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_SAMPLERNAME_,detail)\\n#endif\\n#if defined(BUMP) && defined(PARALLAX)\\nconst float minSamples=4.;\\nconst float maxSamples=15.;\\nconst int iMaxSamples=15;\\nvec2 parallaxOcclusion(vec3 vViewDirCoT,vec3 vNormalCoT,vec2 texCoord,float parallaxScale) {\\nfloat parallaxLimit=length(vViewDirCoT.xy)/vViewDirCoT.z;\\nparallaxLimit*=parallaxScale;\\nvec2 vOffsetDir=normalize(vViewDirCoT.xy);\\nvec2 vMaxOffset=vOffsetDir*parallaxLimit;\\nfloat numSamples=maxSamples+(dot(vViewDirCoT,vNormalCoT)*(minSamples-maxSamples));\\nfloat stepSize=1.0/numSamples;\\nfloat currRayHeight=1.0;\\nvec2 vCurrOffset=vec2(0,0);\\nvec2 vLastOffset=vec2(0,0);\\nfloat lastSampledHeight=1.0;\\nfloat currSampledHeight=1.0;\\nfor (int i=0; icurrRayHeight)\\n{\\nfloat delta1=currSampledHeight-currRayHeight;\\nfloat delta2=(currRayHeight+stepSize)-lastSampledHeight;\\nfloat ratio=delta1/(delta1+delta2);\\nvCurrOffset=(ratio)* vLastOffset+(1.0-ratio)*vCurrOffset;\\nbreak;\\n}\\nelse\\n{\\ncurrRayHeight-=stepSize;\\nvLastOffset=vCurrOffset;\\nvCurrOffset+=stepSize*vMaxOffset;\\nlastSampledHeight=currSampledHeight;\\n}\\n}\\nreturn vCurrOffset;\\n}\\nvec2 parallaxOffset(vec3 viewDir,float heightScale)\\n{\\nfloat height=texture2D(bumpSampler,vBumpUV).w;\\nvec2 texCoordOffset=heightScale*viewDir.xy*height;\\nreturn -texCoordOffset;\\n}\\n#endif\\n\";It.IncludesShadersStore.clipPlaneFragmentDeclaration=\"#ifdef CLIPPLANE\\nvarying float fClipDistance;\\n#endif\\n#ifdef CLIPPLANE2\\nvarying float fClipDistance2;\\n#endif\\n#ifdef CLIPPLANE3\\nvarying float fClipDistance3;\\n#endif\\n#ifdef CLIPPLANE4\\nvarying float fClipDistance4;\\n#endif\\n#ifdef CLIPPLANE5\\nvarying float fClipDistance5;\\n#endif\\n#ifdef CLIPPLANE6\\nvarying float fClipDistance6;\\n#endif\\n\";It.IncludesShadersStore.logDepthDeclaration=\"#ifdef LOGARITHMICDEPTH\\nuniform float logarithmicDepthConstant;\\nvarying float vFragmentDepth;\\n#endif\\n\";It.IncludesShadersStore.fogFragmentDeclaration=\"#ifdef FOG\\n#define FOGMODE_NONE 0.\\n#define FOGMODE_EXP 1.\\n#define FOGMODE_EXP2 2.\\n#define FOGMODE_LINEAR 3.\\n#define E 2.71828\\nuniform vec4 vFogInfos;\\nuniform vec3 vFogColor;\\nvarying vec3 vFogDistance;\\nfloat CalcFogFactor()\\n{\\nfloat fogCoeff=1.0;\\nfloat fogStart=vFogInfos.y;\\nfloat fogEnd=vFogInfos.z;\\nfloat fogDensity=vFogInfos.w;\\nfloat fogDistance=length(vFogDistance);\\nif (FOGMODE_LINEAR==vFogInfos.x)\\n{\\nfogCoeff=(fogEnd-fogDistance)/(fogEnd-fogStart);\\n}\\nelse if (FOGMODE_EXP==vFogInfos.x)\\n{\\nfogCoeff=1.0/pow(E,fogDistance*fogDensity);\\n}\\nelse if (FOGMODE_EXP2==vFogInfos.x)\\n{\\nfogCoeff=1.0/pow(E,fogDistance*fogDistance*fogDensity*fogDensity);\\n}\\nreturn clamp(fogCoeff,0.0,1.0);\\n}\\n#endif\\n\";It.IncludesShadersStore.clipPlaneFragment=\"#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6)\\nif (false) {}\\n#endif\\n#ifdef CLIPPLANE\\nelse if (fClipDistance>0.0)\\n{\\ndiscard;\\n}\\n#endif\\n#ifdef CLIPPLANE2\\nelse if (fClipDistance2>0.0)\\n{\\ndiscard;\\n}\\n#endif\\n#ifdef CLIPPLANE3\\nelse if (fClipDistance3>0.0)\\n{\\ndiscard;\\n}\\n#endif\\n#ifdef CLIPPLANE4\\nelse if (fClipDistance4>0.0)\\n{\\ndiscard;\\n}\\n#endif\\n#ifdef CLIPPLANE5\\nelse if (fClipDistance5>0.0)\\n{\\ndiscard;\\n}\\n#endif\\n#ifdef CLIPPLANE6\\nelse if (fClipDistance6>0.0)\\n{\\ndiscard;\\n}\\n#endif\\n\";It.IncludesShadersStore.bumpFragment=\"vec2 uvOffset=vec2(0.0,0.0);\\n#if defined(BUMP) || defined(PARALLAX) || defined(DETAIL)\\n#ifdef NORMALXYSCALE\\nfloat normalScale=1.0;\\n#elif defined(BUMP)\\nfloat normalScale=vBumpInfos.y;\\n#else\\nfloat normalScale=1.0;\\n#endif\\n#if defined(TANGENT) && defined(NORMAL)\\nmat3 TBN=vTBN;\\n#elif defined(BUMP)\\nvec2 TBNUV=gl_FrontFacing ? vBumpUV : -vBumpUV;\\nmat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,TBNUV,vTangentSpaceParams);\\n#else\\nvec2 TBNUV=gl_FrontFacing ? vDetailUV : -vDetailUV;\\nmat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,TBNUV,vec2(1.,1.));\\n#endif\\n#elif defined(ANISOTROPIC)\\n#if defined(TANGENT) && defined(NORMAL)\\nmat3 TBN=vTBN;\\n#else\\nvec2 TBNUV=gl_FrontFacing ? vMainUV1 : -vMainUV1;\\nmat3 TBN=cotangent_frame(normalW,vPositionW,TBNUV,vec2(1.,1.));\\n#endif\\n#endif\\n#ifdef PARALLAX\\nmat3 invTBN=transposeMat3(TBN);\\n#ifdef PARALLAXOCCLUSION\\nuvOffset=parallaxOcclusion(invTBN*-viewDirectionW,invTBN*normalW,vBumpUV,vBumpInfos.z);\\n#else\\nuvOffset=parallaxOffset(invTBN*viewDirectionW,vBumpInfos.z);\\n#endif\\n#endif\\n#ifdef DETAIL\\nvec4 detailColor=texture2D(detailSampler,vDetailUV+uvOffset);\\nvec2 detailNormalRG=detailColor.wy*2.0-1.0;\\nfloat detailNormalB=sqrt(1.-saturate(dot(detailNormalRG,detailNormalRG)));\\nvec3 detailNormal=vec3(detailNormalRG,detailNormalB);\\n#endif\\n#ifdef BUMP\\n#ifdef OBJECTSPACE_NORMALMAP\\nnormalW=normalize(texture2D(bumpSampler,vBumpUV).xyz *2.0-1.0);\\nnormalW=normalize(mat3(normalMatrix)*normalW);\\n#elif !defined(DETAIL)\\nnormalW=perturbNormal(TBN,texture2D(bumpSampler,vBumpUV+uvOffset).xyz,vBumpInfos.y);\\n#else\\nvec3 bumpNormal=texture2D(bumpSampler,vBumpUV+uvOffset).xyz*2.0-1.0;\\n#if DETAIL_NORMALBLENDMETHOD==0 \\ndetailNormal.xy*=vDetailInfos.z;\\nvec3 blendedNormal=normalize(vec3(bumpNormal.xy+detailNormal.xy,bumpNormal.z*detailNormal.z));\\n#elif DETAIL_NORMALBLENDMETHOD==1 \\ndetailNormal.xy*=vDetailInfos.z;\\nbumpNormal+=vec3(0.0,0.0,1.0);\\ndetailNormal*=vec3(-1.0,-1.0,1.0);\\nvec3 blendedNormal=bumpNormal*dot(bumpNormal,detailNormal)/bumpNormal.z-detailNormal;\\n#endif\\nnormalW=perturbNormalBase(TBN,blendedNormal,vBumpInfos.y);\\n#endif\\n#elif defined(DETAIL)\\ndetailNormal.xy*=vDetailInfos.z;\\nnormalW=perturbNormalBase(TBN,detailNormal,vDetailInfos.z);\\n#endif\\n\";It.IncludesShadersStore.depthPrePass=\"#ifdef DEPTHPREPASS\\ngl_FragColor=vec4(0.,0.,0.,1.0);\\nreturn;\\n#endif\\n\";It.IncludesShadersStore.lightFragment=\"#ifdef LIGHT{X}\\n#if defined(SHADOWONLY) || defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) && defined(LIGHTMAPNOSPECULAR{X})\\n#else\\n#ifdef PBR\\n#ifdef SPOTLIGHT{X}\\npreInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\\n#elif defined(POINTLIGHT{X})\\npreInfo=computePointAndSpotPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\\n#elif defined(HEMILIGHT{X})\\npreInfo=computeHemisphericPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\\n#elif defined(DIRLIGHT{X})\\npreInfo=computeDirectionalPreLightingInfo(light{X}.vLightData,viewDirectionW,normalW);\\n#endif\\npreInfo.NdotV=NdotV;\\n#ifdef SPOTLIGHT{X}\\n#ifdef LIGHT_FALLOFF_GLTF{X}\\npreInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y);\\npreInfo.attenuation*=computeDirectionalLightFalloff_GLTF(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);\\n#elif defined(LIGHT_FALLOFF_PHYSICAL{X})\\npreInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared);\\npreInfo.attenuation*=computeDirectionalLightFalloff_Physical(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w);\\n#elif defined(LIGHT_FALLOFF_STANDARD{X})\\npreInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x);\\npreInfo.attenuation*=computeDirectionalLightFalloff_Standard(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w);\\n#else\\npreInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);\\npreInfo.attenuation*=computeDirectionalLightFalloff(light{X}.vLightDirection.xyz,preInfo.L,light{X}.vLightDirection.w,light{X}.vLightData.w,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);\\n#endif\\n#elif defined(POINTLIGHT{X})\\n#ifdef LIGHT_FALLOFF_GLTF{X}\\npreInfo.attenuation=computeDistanceLightFalloff_GLTF(preInfo.lightDistanceSquared,light{X}.vLightFalloff.y);\\n#elif defined(LIGHT_FALLOFF_PHYSICAL{X})\\npreInfo.attenuation=computeDistanceLightFalloff_Physical(preInfo.lightDistanceSquared);\\n#elif defined(LIGHT_FALLOFF_STANDARD{X})\\npreInfo.attenuation=computeDistanceLightFalloff_Standard(preInfo.lightOffset,light{X}.vLightFalloff.x);\\n#else\\npreInfo.attenuation=computeDistanceLightFalloff(preInfo.lightOffset,preInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);\\n#endif\\n#else\\npreInfo.attenuation=1.0;\\n#endif\\n#ifdef HEMILIGHT{X}\\npreInfo.roughness=roughness;\\n#else\\npreInfo.roughness=adjustRoughnessFromLightProperties(roughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\\n#endif\\n#ifdef IRIDESCENCE\\npreInfo.iridescenceIntensity=iridescenceIntensity;\\n#endif\\n#ifdef HEMILIGHT{X}\\ninfo.diffuse=computeHemisphericDiffuseLighting(preInfo,light{X}.vLightDiffuse.rgb,light{X}.vLightGround);\\n#elif defined(SS_TRANSLUCENCY)\\ninfo.diffuse=computeDiffuseAndTransmittedLighting(preInfo,light{X}.vLightDiffuse.rgb,subSurfaceOut.transmittance);\\n#else\\ninfo.diffuse=computeDiffuseLighting(preInfo,light{X}.vLightDiffuse.rgb);\\n#endif\\n#ifdef SPECULARTERM\\n#ifdef ANISOTROPIC\\ninfo.specular=computeAnisotropicSpecularLighting(preInfo,viewDirectionW,normalW,anisotropicOut.anisotropicTangent,anisotropicOut.anisotropicBitangent,anisotropicOut.anisotropy,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactors.x,light{X}.vLightDiffuse.rgb);\\n#else\\ninfo.specular=computeSpecularLighting(preInfo,normalW,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,AARoughnessFactors.x,light{X}.vLightDiffuse.rgb);\\n#endif\\n#endif\\n#ifdef SHEEN\\n#ifdef SHEEN_LINKWITHALBEDO\\npreInfo.roughness=sheenOut.sheenIntensity;\\n#else\\n#ifdef HEMILIGHT{X}\\npreInfo.roughness=sheenOut.sheenRoughness;\\n#else\\npreInfo.roughness=adjustRoughnessFromLightProperties(sheenOut.sheenRoughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\\n#endif\\n#endif\\ninfo.sheen=computeSheenLighting(preInfo,normalW,sheenOut.sheenColor,specularEnvironmentR90,AARoughnessFactors.x,light{X}.vLightDiffuse.rgb);\\n#endif\\n#ifdef CLEARCOAT\\n#ifdef HEMILIGHT{X}\\npreInfo.roughness=clearcoatOut.clearCoatRoughness;\\n#else\\npreInfo.roughness=adjustRoughnessFromLightProperties(clearcoatOut.clearCoatRoughness,light{X}.vLightSpecular.a,preInfo.lightDistance);\\n#endif\\ninfo.clearCoat=computeClearCoatLighting(preInfo,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatAARoughnessFactors.x,clearcoatOut.clearCoatIntensity,light{X}.vLightDiffuse.rgb);\\n#ifdef CLEARCOAT_TINT\\nabsorption=computeClearCoatLightingAbsorption(clearcoatOut.clearCoatNdotVRefract,preInfo.L,clearcoatOut.clearCoatNormalW,clearcoatOut.clearCoatColor,clearcoatOut.clearCoatThickness,clearcoatOut.clearCoatIntensity);\\ninfo.diffuse*=absorption;\\n#ifdef SPECULARTERM\\ninfo.specular*=absorption;\\n#endif\\n#endif\\ninfo.diffuse*=info.clearCoat.w;\\n#ifdef SPECULARTERM\\ninfo.specular*=info.clearCoat.w;\\n#endif\\n#ifdef SHEEN\\ninfo.sheen*=info.clearCoat.w;\\n#endif\\n#endif\\n#else\\n#ifdef SPOTLIGHT{X}\\ninfo=computeSpotLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDirection,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightDiffuse.a,glossiness);\\n#elif defined(HEMILIGHT{X})\\ninfo=computeHemisphericLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightGround,glossiness);\\n#elif defined(POINTLIGHT{X}) || defined(DIRLIGHT{X})\\ninfo=computeLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular.rgb,light{X}.vLightDiffuse.a,glossiness);\\n#endif\\n#endif\\n#ifdef PROJECTEDLIGHTTEXTURE{X}\\ninfo.diffuse*=computeProjectionTextureDiffuseLighting(projectionLightSampler{X},textureProjectionMatrix{X});\\n#endif\\n#endif\\n#ifdef SHADOW{X}\\n#ifdef SHADOWCSM{X}\\nfor (int i=0; i=0.) {\\nindex{X}=i;\\nbreak;\\n}\\n}\\n#ifdef SHADOWCSMUSESHADOWMAXZ{X}\\nif (index{X}>=0)\\n#endif\\n{\\n#if defined(SHADOWPCF{X})\\n#if defined(SHADOWLOWQUALITY{X})\\nshadow=computeShadowWithCSMPCF1(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#elif defined(SHADOWMEDIUMQUALITY{X})\\nshadow=computeShadowWithCSMPCF3(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#else\\nshadow=computeShadowWithCSMPCF5(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\n#elif defined(SHADOWPCSS{X})\\n#if defined(SHADOWLOWQUALITY{X})\\nshadow=computeShadowWithCSMPCSS16(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\\n#elif defined(SHADOWMEDIUMQUALITY{X})\\nshadow=computeShadowWithCSMPCSS32(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\\n#else\\nshadow=computeShadowWithCSMPCSS64(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\\n#endif\\n#else\\nshadow=computeShadowCSM(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\n#ifdef SHADOWCSMDEBUG{X}\\nshadowDebug{X}=vec3(shadow)*vCascadeColorsMultiplier{X}[index{X}];\\n#endif\\n#ifndef SHADOWCSMNOBLEND{X}\\nfloat frustumLength=frustumLengths{X}[index{X}];\\nfloat diffRatio=clamp(diff{X}/frustumLength,0.,1.)*cascadeBlendFactor{X};\\nif (index{X}<(SHADOWCSMNUM_CASCADES{X}-1) && diffRatio<1.)\\n{\\nindex{X}+=1;\\nfloat nextShadow=0.;\\n#if defined(SHADOWPCF{X})\\n#if defined(SHADOWLOWQUALITY{X})\\nnextShadow=computeShadowWithCSMPCF1(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#elif defined(SHADOWMEDIUMQUALITY{X})\\nnextShadow=computeShadowWithCSMPCF3(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#else\\nnextShadow=computeShadowWithCSMPCF5(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\n#elif defined(SHADOWPCSS{X})\\n#if defined(SHADOWLOWQUALITY{X})\\nnextShadow=computeShadowWithCSMPCSS16(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\\n#elif defined(SHADOWMEDIUMQUALITY{X})\\nnextShadow=computeShadowWithCSMPCSS32(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\\n#else\\nnextShadow=computeShadowWithCSMPCSS64(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w,lightSizeUVCorrection{X}[index{X}],depthCorrection{X}[index{X}],penumbraDarkness{X});\\n#endif\\n#else\\nnextShadow=computeShadowCSM(float(index{X}),vPositionFromLight{X}[index{X}],vDepthMetric{X}[index{X}],shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\nshadow=mix(nextShadow,shadow,diffRatio);\\n#ifdef SHADOWCSMDEBUG{X}\\nshadowDebug{X}=mix(vec3(nextShadow)*vCascadeColorsMultiplier{X}[index{X}],shadowDebug{X},diffRatio);\\n#endif\\n}\\n#endif\\n}\\n#elif defined(SHADOWCLOSEESM{X})\\n#if defined(SHADOWCUBE{X})\\nshadow=computeShadowWithCloseESMCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\\n#else\\nshadow=computeShadowWithCloseESM(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\\n#endif\\n#elif defined(SHADOWESM{X})\\n#if defined(SHADOWCUBE{X})\\nshadow=computeShadowWithESMCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\\n#else\\nshadow=computeShadowWithESM(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\\n#endif\\n#elif defined(SHADOWPOISSON{X})\\n#if defined(SHADOWCUBE{X})\\nshadow=computeShadowWithPoissonSamplingCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.depthValues);\\n#else\\nshadow=computeShadowWithPoissonSampling(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\n#elif defined(SHADOWPCF{X})\\n#if defined(SHADOWLOWQUALITY{X})\\nshadow=computeShadowWithPCF1(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#elif defined(SHADOWMEDIUMQUALITY{X})\\nshadow=computeShadowWithPCF3(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#else\\nshadow=computeShadowWithPCF5(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\n#elif defined(SHADOWPCSS{X})\\n#if defined(SHADOWLOWQUALITY{X})\\nshadow=computeShadowWithPCSS16(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#elif defined(SHADOWMEDIUMQUALITY{X})\\nshadow=computeShadowWithPCSS32(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#else\\nshadow=computeShadowWithPCSS64(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\n#else\\n#if defined(SHADOWCUBE{X})\\nshadow=computeShadowCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.depthValues);\\n#else\\nshadow=computeShadow(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\\n#endif\\n#endif\\n#ifdef SHADOWONLY\\n#ifndef SHADOWINUSE\\n#define SHADOWINUSE\\n#endif\\nglobalShadow+=shadow;\\nshadowLightCount+=1.0;\\n#endif\\n#else\\nshadow=1.;\\n#endif\\n#ifndef SHADOWONLY\\n#ifdef CUSTOMUSERLIGHTING\\ndiffuseBase+=computeCustomDiffuseLighting(info,diffuseBase,shadow);\\n#ifdef SPECULARTERM\\nspecularBase+=computeCustomSpecularLighting(info,specularBase,shadow);\\n#endif\\n#elif defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X})\\ndiffuseBase+=lightmapColor.rgb*shadow;\\n#ifdef SPECULARTERM\\n#ifndef LIGHTMAPNOSPECULAR{X}\\nspecularBase+=info.specular*shadow*lightmapColor.rgb;\\n#endif\\n#endif\\n#ifdef CLEARCOAT\\n#ifndef LIGHTMAPNOSPECULAR{X}\\nclearCoatBase+=info.clearCoat.rgb*shadow*lightmapColor.rgb;\\n#endif\\n#endif\\n#ifdef SHEEN\\n#ifndef LIGHTMAPNOSPECULAR{X}\\nsheenBase+=info.sheen.rgb*shadow;\\n#endif\\n#endif\\n#else\\n#ifdef SHADOWCSMDEBUG{X}\\ndiffuseBase+=info.diffuse*shadowDebug{X};\\n#else \\ndiffuseBase+=info.diffuse*shadow;\\n#endif\\n#ifdef SPECULARTERM\\nspecularBase+=info.specular*shadow;\\n#endif\\n#ifdef CLEARCOAT\\nclearCoatBase+=info.clearCoat.rgb*shadow;\\n#endif\\n#ifdef SHEEN\\nsheenBase+=info.sheen.rgb*shadow;\\n#endif\\n#endif\\n#endif\\n#endif\\n\";It.IncludesShadersStore.logDepthFragment=\"#ifdef LOGARITHMICDEPTH\\ngl_FragDepthEXT=log2(vFragmentDepth)*logarithmicDepthConstant*0.5;\\n#endif\\n\";It.IncludesShadersStore.fogFragment=\"#ifdef FOG\\nfloat fog=CalcFogFactor();\\n#ifdef PBR\\nfog=toLinearSpace(fog);\\n#endif\\ncolor.rgb=mix(vFogColor,color.rgb,fog);\\n#endif\\n\";It.IncludesShadersStore.oitFragment=\"#ifdef ORDER_INDEPENDENT_TRANSPARENCY\\nfloat fragDepth=gl_FragCoord.z; \\n#ifdef ORDER_INDEPENDENT_TRANSPARENCY_16BITS\\nuint halfFloat=packHalf2x16(vec2(fragDepth));\\nvec2 full=unpackHalf2x16(halfFloat);\\nfragDepth=full.x;\\n#endif\\nivec2 fragCoord=ivec2(gl_FragCoord.xy);\\nvec2 lastDepth=texelFetch(oitDepthSampler,fragCoord,0).rg;\\nvec4 lastFrontColor=texelFetch(oitFrontColorSampler,fragCoord,0);\\ndepth.rg=vec2(-MAX_DEPTH);\\nfrontColor=lastFrontColor;\\nbackColor=vec4(0.0);\\n#ifdef USE_REVERSE_DEPTHBUFFER\\nfloat furthestDepth=-lastDepth.x;\\nfloat nearestDepth=lastDepth.y;\\n#else\\nfloat nearestDepth=-lastDepth.x;\\nfloat furthestDepth=lastDepth.y;\\n#endif\\nfloat alphaMultiplier=1.0-lastFrontColor.a;\\n#ifdef USE_REVERSE_DEPTHBUFFER\\nif (fragDepth>nearestDepth || fragDepthfurthestDepth) {\\n#endif\\nreturn;\\n}\\n#ifdef USE_REVERSE_DEPTHBUFFER\\nif (fragDepthfurthestDepth) {\\n#else\\nif (fragDepth>nearestDepth && fragDepth\\n#if defined(BUMP) || !defined(NORMAL)\\n#extension GL_OES_standard_derivatives : enable\\n#endif\\n#include[SCENE_MRT_COUNT]\\n#include\\n#define CUSTOM_FRAGMENT_BEGIN\\n#ifdef LOGARITHMICDEPTH\\n#extension GL_EXT_frag_depth : enable\\n#endif\\n#define RECIPROCAL_PI2 0.15915494\\nvarying vec3 vPositionW;\\n#ifdef NORMAL\\nvarying vec3 vNormalW;\\n#endif\\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\\nvarying vec4 vColor;\\n#endif\\n#include[1..7]\\n#include\\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\\n#include\\n#include\\n#include(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse,_SAMPLERNAME_,diffuse)\\n#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_SAMPLERNAME_,ambient)\\n#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_SAMPLERNAME_,opacity)\\n#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_SAMPLERNAME_,emissive)\\n#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_SAMPLERNAME_,lightmap)\\n#ifdef REFRACTION\\n#ifdef REFRACTIONMAP_3D\\nuniform samplerCube refractionCubeSampler;\\n#else\\nuniform sampler2D refraction2DSampler;\\n#endif\\n#endif\\n#if defined(SPECULARTERM)\\n#include(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular,_SAMPLERNAME_,specular)\\n#endif\\n#include\\n#ifdef REFLECTION\\n#ifdef REFLECTIONMAP_3D\\nuniform samplerCube reflectionCubeSampler;\\n#else\\nuniform sampler2D reflection2DSampler;\\n#endif\\n#ifdef REFLECTIONMAP_SKYBOX\\nvarying vec3 vPositionUVW;\\n#else\\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\\nvarying vec3 vDirectionW;\\n#endif\\n#endif\\n#include\\n#endif\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void) {\\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\\n#include\\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\\nvec4 baseColor=vec4(1.,1.,1.,1.);\\nvec3 diffuseColor=vDiffuseColor.rgb;\\nfloat alpha=vDiffuseColor.a;\\n#ifdef NORMAL\\nvec3 normalW=normalize(vNormalW);\\n#else\\nvec3 normalW=normalize(-cross(dFdx(vPositionW),dFdy(vPositionW)));\\n#endif\\n#include\\n#ifdef TWOSIDEDLIGHTING\\nnormalW=gl_FrontFacing ? normalW : -normalW;\\n#endif\\n#ifdef DIFFUSE\\nbaseColor=texture2D(diffuseSampler,vDiffuseUV+uvOffset);\\n#if defined(ALPHATEST) && !defined(ALPHATEST_AFTERALLALPHACOMPUTATIONS)\\nif (baseColor.a\\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\\nbaseColor.rgb*=vColor.rgb;\\n#endif\\n#ifdef DETAIL\\nbaseColor.rgb=baseColor.rgb*2.0*mix(0.5,detailColor.r,vDetailInfos.y);\\n#endif\\n#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE\\nvec3 baseAmbientColor=vec3(1.,1.,1.);\\n#ifdef AMBIENT\\nbaseAmbientColor=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;\\n#endif\\n#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\\n#ifdef SPECULARTERM\\nfloat glossiness=vSpecularColor.a;\\nvec3 specularColor=vSpecularColor.rgb;\\n#ifdef SPECULAR\\nvec4 specularMapColor=texture2D(specularSampler,vSpecularUV+uvOffset);\\nspecularColor=specularMapColor.rgb;\\n#ifdef GLOSSINESS\\nglossiness=glossiness*specularMapColor.a;\\n#endif\\n#endif\\n#else\\nfloat glossiness=0.;\\n#endif\\nvec3 diffuseBase=vec3(0.,0.,0.);\\nlightingInfo info;\\n#ifdef SPECULARTERM\\nvec3 specularBase=vec3(0.,0.,0.);\\n#endif\\nfloat shadow=1.;\\n#ifdef LIGHTMAP\\nvec4 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset);\\n#ifdef RGBDLIGHTMAP\\nlightmapColor.rgb=fromRGBD(lightmapColor);\\n#endif\\nlightmapColor.rgb*=vLightmapInfos.y;\\n#endif\\n#include[0..maxSimultaneousLights]\\nvec4 refractionColor=vec4(0.,0.,0.,1.);\\n#ifdef REFRACTION\\nvec3 refractionVector=normalize(refract(-viewDirectionW,normalW,vRefractionInfos.y));\\n#ifdef REFRACTIONMAP_3D\\n#ifdef USE_LOCAL_REFRACTIONMAP_CUBIC\\nrefractionVector=parallaxCorrectNormal(vPositionW,refractionVector,vRefractionSize,vRefractionPosition);\\n#endif\\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;\\nif (dot(refractionVector,viewDirectionW)<1.0) {\\nrefractionColor=textureCube(refractionCubeSampler,refractionVector);\\n}\\n#else\\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));\\nvec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;\\nrefractionCoords.y=1.0-refractionCoords.y;\\nrefractionColor=texture2D(refraction2DSampler,refractionCoords);\\n#endif\\n#ifdef RGBDREFRACTION\\nrefractionColor.rgb=fromRGBD(refractionColor);\\n#endif\\n#ifdef IS_REFRACTION_LINEAR\\nrefractionColor.rgb=toGammaSpace(refractionColor.rgb);\\n#endif\\nrefractionColor.rgb*=vRefractionInfos.x;\\n#endif\\nvec4 reflectionColor=vec4(0.,0.,0.,1.);\\n#ifdef REFLECTION\\nvec3 vReflectionUVW=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\\n#ifdef REFLECTIONMAP_OPPOSITEZ\\nvReflectionUVW.z*=-1.0;\\n#endif\\n#ifdef REFLECTIONMAP_3D\\n#ifdef ROUGHNESS\\nfloat bias=vReflectionInfos.y;\\n#ifdef SPECULARTERM\\n#ifdef SPECULAR\\n#ifdef GLOSSINESS\\nbias*=(1.0-specularMapColor.a);\\n#endif\\n#endif\\n#endif\\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW,bias);\\n#else\\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW);\\n#endif\\n#else\\nvec2 coords=vReflectionUVW.xy;\\n#ifdef REFLECTIONMAP_PROJECTION\\ncoords/=vReflectionUVW.z;\\n#endif\\ncoords.y=1.0-coords.y;\\nreflectionColor=texture2D(reflection2DSampler,coords);\\n#endif\\n#ifdef RGBDREFLECTION\\nreflectionColor.rgb=fromRGBD(reflectionColor);\\n#endif\\n#ifdef IS_REFLECTION_LINEAR\\nreflectionColor.rgb=toGammaSpace(reflectionColor.rgb);\\n#endif\\nreflectionColor.rgb*=vReflectionInfos.x;\\n#ifdef REFLECTIONFRESNEL\\nfloat reflectionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,reflectionRightColor.a,reflectionLeftColor.a);\\n#ifdef REFLECTIONFRESNELFROMSPECULAR\\n#ifdef SPECULARTERM\\nreflectionColor.rgb*=specularColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\\n#else\\nreflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\\n#endif\\n#else\\nreflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\\n#endif\\n#endif\\n#endif\\n#ifdef REFRACTIONFRESNEL\\nfloat refractionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,refractionRightColor.a,refractionLeftColor.a);\\nrefractionColor.rgb*=refractionLeftColor.rgb*(1.0-refractionFresnelTerm)+refractionFresnelTerm*refractionRightColor.rgb;\\n#endif\\n#ifdef OPACITY\\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);\\n#ifdef OPACITYRGB\\nopacityMap.rgb=opacityMap.rgb*vec3(0.3,0.59,0.11);\\nalpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* vOpacityInfos.y;\\n#else\\nalpha*=opacityMap.a*vOpacityInfos.y;\\n#endif\\n#endif\\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\\nalpha*=vColor.a;\\n#endif\\n#ifdef OPACITYFRESNEL\\nfloat opacityFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,opacityParts.z,opacityParts.w);\\nalpha+=opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*opacityParts.y;\\n#endif\\n#ifdef ALPHATEST\\n#ifdef ALPHATEST_AFTERALLALPHACOMPUTATIONS\\nif (alpha\\n#include\\n#ifdef IMAGEPROCESSINGPOSTPROCESS\\ncolor.rgb=toLinearSpace(color.rgb);\\n#else\\n#ifdef IMAGEPROCESSING\\ncolor.rgb=toLinearSpace(color.rgb);\\ncolor=applyImageProcessing(color);\\n#endif\\n#endif\\ncolor.a*=visibility;\\n#ifdef PREMULTIPLYALPHA\\ncolor.rgb*=color.a;\\n#endif\\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\\n#ifdef PREPASS\\nfloat writeGeometryInfo=color.a>0.4 ? 1.0 : 0.0;\\ngl_FragData[0]=color; \\n#ifdef PREPASS_POSITION\\ngl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,writeGeometryInfo);\\n#endif\\n#ifdef PREPASS_VELOCITY\\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;\\nvec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;\\nvec2 velocity=abs(a-b);\\nvelocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;\\ngl_FragData[PREPASS_VELOCITY_INDEX]=vec4(velocity,0.0,writeGeometryInfo);\\n#endif\\n#ifdef PREPASS_IRRADIANCE\\ngl_FragData[PREPASS_IRRADIANCE_INDEX]=vec4(0.0,0.0,0.0,writeGeometryInfo); \\n#endif\\n#ifdef PREPASS_DEPTH\\ngl_FragData[PREPASS_DEPTH_INDEX]=vec4(vViewPos.z,0.0,0.0,writeGeometryInfo); \\n#endif\\n#ifdef PREPASS_NORMAL\\ngl_FragData[PREPASS_NORMAL_INDEX]=vec4((view*vec4(normalW,0.0)).rgb,writeGeometryInfo); \\n#endif\\n#ifdef PREPASS_ALBEDO_SQRT\\ngl_FragData[PREPASS_ALBEDO_SQRT_INDEX]=vec4(0.0,0.0,0.0,writeGeometryInfo); \\n#endif\\n#ifdef PREPASS_REFLECTIVITY\\n#if defined(SPECULARTERM)\\n#if defined(SPECULAR)\\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(specularMapColor)*writeGeometryInfo; \\n#else\\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(specularColor,1.0)*writeGeometryInfo;\\n#endif\\n#else\\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(0.0,0.0,0.0,1.0)*writeGeometryInfo;\\n#endif\\n#endif\\n#endif\\n#if !defined(PREPASS) || defined(WEBGL2)\\ngl_FragColor=color;\\n#endif\\n#include\\n#if ORDER_INDEPENDENT_TRANSPARENCY\\nif (fragDepth==nearestDepth) {\\nfrontColor.rgb+=color.rgb*color.a*alphaMultiplier;\\nfrontColor.a=1.0-alphaMultiplier*(1.0-color.a);\\n} else {\\nbackColor+=color;\\n}\\n#endif\\n#define CUSTOM_FRAGMENT_MAIN_END\\n}\\n\";It.IncludesShadersStore.defaultVertexDeclaration=\"uniform mat4 viewProjection;\\nuniform mat4 view;\\n#ifdef DIFFUSE\\nuniform mat4 diffuseMatrix;\\nuniform vec2 vDiffuseInfos;\\n#endif\\n#ifdef AMBIENT\\nuniform mat4 ambientMatrix;\\nuniform vec2 vAmbientInfos;\\n#endif\\n#ifdef OPACITY\\nuniform mat4 opacityMatrix;\\nuniform vec2 vOpacityInfos;\\n#endif\\n#ifdef EMISSIVE\\nuniform vec2 vEmissiveInfos;\\nuniform mat4 emissiveMatrix;\\n#endif\\n#ifdef LIGHTMAP\\nuniform vec2 vLightmapInfos;\\nuniform mat4 lightmapMatrix;\\n#endif\\n#if defined(SPECULAR) && defined(SPECULARTERM)\\nuniform vec2 vSpecularInfos;\\nuniform mat4 specularMatrix;\\n#endif\\n#ifdef BUMP\\nuniform vec3 vBumpInfos;\\nuniform mat4 bumpMatrix;\\n#endif\\n#ifdef REFLECTION\\nuniform mat4 reflectionMatrix;\\n#endif\\n#ifdef POINTSIZE\\nuniform float pointSize;\\n#endif\\n#ifdef DETAIL\\nuniform vec4 vDetailInfos;\\nuniform mat4 detailMatrix;\\n#endif\\n#define ADDITIONAL_VERTEX_DECLARATION\\n\";It.IncludesShadersStore.uvAttributeDeclaration=\"#ifdef UV{X}\\nattribute vec2 uv{X};\\n#endif\\n\";It.IncludesShadersStore.bonesDeclaration=\"#if NUM_BONE_INFLUENCERS>0\\nattribute vec4 matricesIndices;\\nattribute vec4 matricesWeights;\\n#if NUM_BONE_INFLUENCERS>4\\nattribute vec4 matricesIndicesExtra;\\nattribute vec4 matricesWeightsExtra;\\n#endif\\n#ifndef BAKED_VERTEX_ANIMATION_TEXTURE\\n#ifdef BONETEXTURE\\nuniform sampler2D boneSampler;\\nuniform float boneTextureWidth;\\n#else\\nuniform mat4 mBones[BonesPerMesh];\\n#ifdef BONES_VELOCITY_ENABLED\\nuniform mat4 mPreviousBones[BonesPerMesh];\\n#endif\\n#endif\\n#ifdef BONETEXTURE\\n#define inline\\nmat4 readMatrixFromRawSampler(sampler2D smp,float index)\\n{\\nfloat offset=index *4.0;\\nfloat dx=1.0/boneTextureWidth;\\nvec4 m0=texture2D(smp,vec2(dx*(offset+0.5),0.));\\nvec4 m1=texture2D(smp,vec2(dx*(offset+1.5),0.));\\nvec4 m2=texture2D(smp,vec2(dx*(offset+2.5),0.));\\nvec4 m3=texture2D(smp,vec2(dx*(offset+3.5),0.));\\nreturn mat4(m0,m1,m2,m3);\\n}\\n#endif\\n#endif\\n#endif\\n\";It.IncludesShadersStore.bakedVertexAnimationDeclaration=\"#ifdef BAKED_VERTEX_ANIMATION_TEXTURE\\nuniform float bakedVertexAnimationTime;\\nuniform vec2 bakedVertexAnimationTextureSizeInverted;\\nuniform vec4 bakedVertexAnimationSettings;\\nuniform sampler2D bakedVertexAnimationTexture;\\n#ifdef INSTANCES\\nattribute vec4 bakedVertexAnimationSettingsInstanced;\\n#endif\\n#define inline\\nmat4 readMatrixFromRawSamplerVAT(sampler2D smp,float index,float frame)\\n{\\nfloat offset=index*4.0;\\nfloat frameUV=(frame+0.5)*bakedVertexAnimationTextureSizeInverted.y;\\nfloat dx=bakedVertexAnimationTextureSizeInverted.x;\\nvec4 m0=texture2D(smp,vec2(dx*(offset+0.5),frameUV));\\nvec4 m1=texture2D(smp,vec2(dx*(offset+1.5),frameUV));\\nvec4 m2=texture2D(smp,vec2(dx*(offset+2.5),frameUV));\\nvec4 m3=texture2D(smp,vec2(dx*(offset+3.5),frameUV));\\nreturn mat4(m0,m1,m2,m3);\\n}\\n#endif\\n\";It.IncludesShadersStore.instancesDeclaration=\"#ifdef INSTANCES\\nattribute vec4 world0;\\nattribute vec4 world1;\\nattribute vec4 world2;\\nattribute vec4 world3;\\n#ifdef INSTANCESCOLOR\\nattribute vec4 instanceColor;\\n#endif\\n#if defined(THIN_INSTANCES) && !defined(WORLD_UBO)\\nuniform mat4 world;\\n#endif\\n#if defined(VELOCITY) || defined(PREPASS_VELOCITY)\\nattribute vec4 previousWorld0;\\nattribute vec4 previousWorld1;\\nattribute vec4 previousWorld2;\\nattribute vec4 previousWorld3;\\n#ifdef THIN_INSTANCES\\nuniform mat4 previousWorld;\\n#endif\\n#endif\\n#else\\n#if !defined(WORLD_UBO)\\nuniform mat4 world;\\n#endif\\n#if defined(VELOCITY) || defined(PREPASS_VELOCITY)\\nuniform mat4 previousWorld;\\n#endif\\n#endif\\n\";It.IncludesShadersStore.prePassVertexDeclaration=\"#ifdef PREPASS\\n#ifdef PREPASS_DEPTH\\nvarying vec3 vViewPos;\\n#endif\\n#ifdef PREPASS_VELOCITY\\nuniform mat4 previousViewProjection;\\nvarying vec4 vCurrentPosition;\\nvarying vec4 vPreviousPosition;\\n#endif\\n#endif\\n\";It.IncludesShadersStore.samplerVertexDeclaration=\"#if defined(_DEFINENAME_) && _DEFINENAME_DIRECTUV==0\\nvarying vec2 v_VARYINGNAME_UV;\\n#endif\\n\";It.IncludesShadersStore.bumpVertexDeclaration=\"#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\\n#if defined(TANGENT) && defined(NORMAL) \\nvarying mat3 vTBN;\\n#endif\\n#endif\\n\";It.IncludesShadersStore.clipPlaneVertexDeclaration=\"#ifdef CLIPPLANE\\nuniform vec4 vClipPlane;\\nvarying float fClipDistance;\\n#endif\\n#ifdef CLIPPLANE2\\nuniform vec4 vClipPlane2;\\nvarying float fClipDistance2;\\n#endif\\n#ifdef CLIPPLANE3\\nuniform vec4 vClipPlane3;\\nvarying float fClipDistance3;\\n#endif\\n#ifdef CLIPPLANE4\\nuniform vec4 vClipPlane4;\\nvarying float fClipDistance4;\\n#endif\\n#ifdef CLIPPLANE5\\nuniform vec4 vClipPlane5;\\nvarying float fClipDistance5;\\n#endif\\n#ifdef CLIPPLANE6\\nuniform vec4 vClipPlane6;\\nvarying float fClipDistance6;\\n#endif\\n\";It.IncludesShadersStore.fogVertexDeclaration=\"#ifdef FOG\\nvarying vec3 vFogDistance;\\n#endif\\n\";It.IncludesShadersStore.lightVxFragmentDeclaration=\"#ifdef LIGHT{X}\\nuniform vec4 vLightData{X};\\nuniform vec4 vLightDiffuse{X};\\n#ifdef SPECULARTERM\\nuniform vec4 vLightSpecular{X};\\n#else\\nvec4 vLightSpecular{X}=vec4(0.);\\n#endif\\n#ifdef SHADOW{X}\\n#ifdef SHADOWCSM{X}\\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];\\nvarying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];\\nvarying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];\\nvarying vec4 vPositionFromCamera{X};\\n#elif defined(SHADOWCUBE{X})\\n#else\\nvarying vec4 vPositionFromLight{X};\\nvarying float vDepthMetric{X};\\nuniform mat4 lightMatrix{X};\\n#endif\\nuniform vec4 shadowsInfo{X};\\nuniform vec2 depthValues{X};\\n#endif\\n#ifdef SPOTLIGHT{X}\\nuniform vec4 vLightDirection{X};\\nuniform vec4 vLightFalloff{X};\\n#elif defined(POINTLIGHT{X})\\nuniform vec4 vLightFalloff{X};\\n#elif defined(HEMILIGHT{X})\\nuniform vec3 vLightGround{X};\\n#endif\\n#endif\\n\";It.IncludesShadersStore.lightVxUboDeclaration=\"#ifdef LIGHT{X}\\nuniform Light{X}\\n{\\nvec4 vLightData;\\nvec4 vLightDiffuse;\\nvec4 vLightSpecular;\\n#ifdef SPOTLIGHT{X}\\nvec4 vLightDirection;\\nvec4 vLightFalloff;\\n#elif defined(POINTLIGHT{X})\\nvec4 vLightFalloff;\\n#elif defined(HEMILIGHT{X})\\nvec3 vLightGround;\\n#endif\\nvec4 shadowsInfo;\\nvec2 depthValues;\\n} light{X};\\n#ifdef SHADOW{X}\\n#ifdef SHADOWCSM{X}\\nuniform mat4 lightMatrix{X}[SHADOWCSMNUM_CASCADES{X}];\\nvarying vec4 vPositionFromLight{X}[SHADOWCSMNUM_CASCADES{X}];\\nvarying float vDepthMetric{X}[SHADOWCSMNUM_CASCADES{X}];\\nvarying vec4 vPositionFromCamera{X};\\n#elif defined(SHADOWCUBE{X})\\n#else\\nvarying vec4 vPositionFromLight{X};\\nvarying float vDepthMetric{X};\\nuniform mat4 lightMatrix{X};\\n#endif\\n#endif\\n#endif\\n\";It.IncludesShadersStore.morphTargetsVertexGlobalDeclaration=\"#ifdef MORPHTARGETS\\nuniform float morphTargetInfluences[NUM_MORPH_INFLUENCERS];\\n#ifdef MORPHTARGETS_TEXTURE \\nprecision mediump sampler2DArray; \\nuniform float morphTargetTextureIndices[NUM_MORPH_INFLUENCERS];\\nuniform vec3 morphTargetTextureInfo;\\nuniform sampler2DArray morphTargets;\\nvec3 readVector3FromRawSampler(int targetIndex,float vertexIndex)\\n{ \\nfloat y=floor(vertexIndex/morphTargetTextureInfo.y);\\nfloat x=vertexIndex-y*morphTargetTextureInfo.y;\\nvec3 textureUV=vec3((x+0.5)/morphTargetTextureInfo.y,(y+0.5)/morphTargetTextureInfo.z,morphTargetTextureIndices[targetIndex]);\\nreturn texture(morphTargets,textureUV).xyz;\\n}\\n#endif\\n#endif\\n\";It.IncludesShadersStore.morphTargetsVertexDeclaration=\"#ifdef MORPHTARGETS\\n#ifndef MORPHTARGETS_TEXTURE\\nattribute vec3 position{X};\\n#ifdef MORPHTARGETS_NORMAL\\nattribute vec3 normal{X};\\n#endif\\n#ifdef MORPHTARGETS_TANGENT\\nattribute vec3 tangent{X};\\n#endif\\n#ifdef MORPHTARGETS_UV\\nattribute vec2 uv_{X};\\n#endif\\n#endif\\n#endif\\n\";It.IncludesShadersStore.morphTargetsVertexGlobal=\"#ifdef MORPHTARGETS\\n#ifdef MORPHTARGETS_TEXTURE\\nfloat vertexID;\\n#endif\\n#endif\\n\";It.IncludesShadersStore.morphTargetsVertex=\"#ifdef MORPHTARGETS\\n#ifdef MORPHTARGETS_TEXTURE \\nvertexID=float(gl_VertexID)*morphTargetTextureInfo.x;\\npositionUpdated+=(readVector3FromRawSampler({X},vertexID)-position)*morphTargetInfluences[{X}];\\nvertexID+=1.0;\\n#ifdef MORPHTARGETS_NORMAL\\nnormalUpdated+=(readVector3FromRawSampler({X},vertexID) -normal)*morphTargetInfluences[{X}];\\nvertexID+=1.0;\\n#endif\\n#ifdef MORPHTARGETS_UV\\nuvUpdated+=(readVector3FromRawSampler({X},vertexID).xy-uv)*morphTargetInfluences[{X}];\\nvertexID+=1.0;\\n#endif\\n#ifdef MORPHTARGETS_TANGENT\\ntangentUpdated.xyz+=(readVector3FromRawSampler({X},vertexID) -tangent.xyz)*morphTargetInfluences[{X}];\\n#endif\\n#else\\npositionUpdated+=(position{X}-position)*morphTargetInfluences[{X}];\\n#ifdef MORPHTARGETS_NORMAL\\nnormalUpdated+=(normal{X}-normal)*morphTargetInfluences[{X}];\\n#endif\\n#ifdef MORPHTARGETS_TANGENT\\ntangentUpdated.xyz+=(tangent{X}-tangent.xyz)*morphTargetInfluences[{X}];\\n#endif\\n#ifdef MORPHTARGETS_UV\\nuvUpdated+=(uv_{X}-uv)*morphTargetInfluences[{X}];\\n#endif\\n#endif\\n#endif\\n\";It.IncludesShadersStore.instancesVertex=\"#ifdef INSTANCES\\nmat4 finalWorld=mat4(world0,world1,world2,world3);\\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY)\\nmat4 finalPreviousWorld=mat4(previousWorld0,previousWorld1,previousWorld2,previousWorld3);\\n#endif\\n#ifdef THIN_INSTANCES\\nfinalWorld=world*finalWorld;\\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY)\\nfinalPreviousWorld=previousWorld*finalPreviousWorld;\\n#endif\\n#endif\\n#else\\nmat4 finalWorld=world;\\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY)\\nmat4 finalPreviousWorld=previousWorld;\\n#endif\\n#endif\\n\";It.IncludesShadersStore.bonesVertex=\"#ifndef BAKED_VERTEX_ANIMATION_TEXTURE\\n#if NUM_BONE_INFLUENCERS>0\\nmat4 influence;\\n#ifdef BONETEXTURE\\ninfluence=readMatrixFromRawSampler(boneSampler,matricesIndices[0])*matricesWeights[0];\\n#if NUM_BONE_INFLUENCERS>1\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[1])*matricesWeights[1];\\n#endif\\n#if NUM_BONE_INFLUENCERS>2\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[2])*matricesWeights[2];\\n#endif\\n#if NUM_BONE_INFLUENCERS>3\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndices[3])*matricesWeights[3];\\n#endif\\n#if NUM_BONE_INFLUENCERS>4\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[0])*matricesWeightsExtra[0];\\n#endif\\n#if NUM_BONE_INFLUENCERS>5\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[1])*matricesWeightsExtra[1];\\n#endif\\n#if NUM_BONE_INFLUENCERS>6\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[2])*matricesWeightsExtra[2];\\n#endif\\n#if NUM_BONE_INFLUENCERS>7\\ninfluence+=readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[3])*matricesWeightsExtra[3];\\n#endif\\n#else\\ninfluence=mBones[int(matricesIndices[0])]*matricesWeights[0];\\n#if NUM_BONE_INFLUENCERS>1\\ninfluence+=mBones[int(matricesIndices[1])]*matricesWeights[1];\\n#endif\\n#if NUM_BONE_INFLUENCERS>2\\ninfluence+=mBones[int(matricesIndices[2])]*matricesWeights[2];\\n#endif\\n#if NUM_BONE_INFLUENCERS>3\\ninfluence+=mBones[int(matricesIndices[3])]*matricesWeights[3];\\n#endif\\n#if NUM_BONE_INFLUENCERS>4\\ninfluence+=mBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\\n#endif\\n#if NUM_BONE_INFLUENCERS>5\\ninfluence+=mBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\\n#endif\\n#if NUM_BONE_INFLUENCERS>6\\ninfluence+=mBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\\n#endif\\n#if NUM_BONE_INFLUENCERS>7\\ninfluence+=mBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\\n#endif\\n#endif\\nfinalWorld=finalWorld*influence;\\n#endif\\n#endif\\n\";It.IncludesShadersStore.bakedVertexAnimation=\"#ifdef BAKED_VERTEX_ANIMATION_TEXTURE\\n{\\n#ifdef INSTANCES\\n#define BVASNAME bakedVertexAnimationSettingsInstanced\\n#else\\n#define BVASNAME bakedVertexAnimationSettings\\n#endif\\nfloat VATStartFrame=BVASNAME.x;\\nfloat VATEndFrame=BVASNAME.y;\\nfloat VATOffsetFrame=BVASNAME.z;\\nfloat VATSpeed=BVASNAME.w;\\nfloat totalFrames=VATEndFrame-VATStartFrame+1.0;\\nfloat time=bakedVertexAnimationTime*VATSpeed/totalFrames;\\nfloat frameCorrection=time<1.0 ? 0.0 : 1.0;\\nfloat numOfFrames=totalFrames-frameCorrection;\\nfloat VATFrameNum=fract(time)*numOfFrames;\\nVATFrameNum=mod(VATFrameNum+VATOffsetFrame,numOfFrames);\\nVATFrameNum=floor(VATFrameNum);\\nVATFrameNum+=VATStartFrame+frameCorrection;\\nmat4 VATInfluence;\\nVATInfluence=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[0],VATFrameNum)*matricesWeights[0];\\n#if NUM_BONE_INFLUENCERS>1\\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[1],VATFrameNum)*matricesWeights[1];\\n#endif\\n#if NUM_BONE_INFLUENCERS>2\\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[2],VATFrameNum)*matricesWeights[2];\\n#endif\\n#if NUM_BONE_INFLUENCERS>3\\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[3],VATFrameNum)*matricesWeights[3];\\n#endif\\n#if NUM_BONE_INFLUENCERS>4\\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[0],VATFrameNum)*matricesWeightsExtra[0];\\n#endif\\n#if NUM_BONE_INFLUENCERS>5\\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[1],VATFrameNum)*matricesWeightsExtra[1];\\n#endif\\n#if NUM_BONE_INFLUENCERS>6\\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[2],VATFrameNum)*matricesWeightsExtra[2];\\n#endif\\n#if NUM_BONE_INFLUENCERS>7\\nVATInfluence+=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[3],VATFrameNum)*matricesWeightsExtra[3];\\n#endif\\nfinalWorld=finalWorld*VATInfluence;\\n}\\n#endif\\n\";It.IncludesShadersStore.prePassVertex=\"#ifdef PREPASS_DEPTH\\nvViewPos=(view*worldPos).rgb;\\n#endif\\n#if defined(PREPASS_VELOCITY) && defined(BONES_VELOCITY_ENABLED)\\nvCurrentPosition=viewProjection*worldPos;\\n#if NUM_BONE_INFLUENCERS>0\\nmat4 previousInfluence;\\npreviousInfluence=mPreviousBones[int(matricesIndices[0])]*matricesWeights[0];\\n#if NUM_BONE_INFLUENCERS>1\\npreviousInfluence+=mPreviousBones[int(matricesIndices[1])]*matricesWeights[1];\\n#endif \\n#if NUM_BONE_INFLUENCERS>2\\npreviousInfluence+=mPreviousBones[int(matricesIndices[2])]*matricesWeights[2];\\n#endif \\n#if NUM_BONE_INFLUENCERS>3\\npreviousInfluence+=mPreviousBones[int(matricesIndices[3])]*matricesWeights[3];\\n#endif\\n#if NUM_BONE_INFLUENCERS>4\\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\\n#endif \\n#if NUM_BONE_INFLUENCERS>5\\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\\n#endif \\n#if NUM_BONE_INFLUENCERS>6\\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\\n#endif \\n#if NUM_BONE_INFLUENCERS>7\\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\\n#endif\\nvPreviousPosition=previousViewProjection*finalPreviousWorld*previousInfluence*vec4(positionUpdated,1.0);\\n#else\\nvPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0);\\n#endif\\n#endif\\n\";It.IncludesShadersStore.uvVariableDeclaration=\"#if !defined(UV{X}) && defined(MAINUV{X})\\nvec2 uv{X}=vec2(0.,0.);\\n#endif\\n#ifdef MAINUV{X}\\nvMainUV{X}=uv{X};\\n#endif\\n\";It.IncludesShadersStore.samplerVertexImplementation=\"#if defined(_DEFINENAME_) && _DEFINENAME_DIRECTUV==0\\nif (v_INFONAME_==0.)\\n{\\nv_VARYINGNAME_UV=vec2(_MATRIXNAME_Matrix*vec4(uvUpdated,1.0,0.0));\\n}\\n#ifdef UV2\\nelse if (v_INFONAME_==1.)\\n{\\nv_VARYINGNAME_UV=vec2(_MATRIXNAME_Matrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#ifdef UV3\\nelse if (v_INFONAME_==2.)\\n{\\nv_VARYINGNAME_UV=vec2(_MATRIXNAME_Matrix*vec4(uv3,1.0,0.0));\\n}\\n#endif\\n#ifdef UV4\\nelse if (v_INFONAME_==3.)\\n{\\nv_VARYINGNAME_UV=vec2(_MATRIXNAME_Matrix*vec4(uv4,1.0,0.0));\\n}\\n#endif\\n#ifdef UV5\\nelse if (v_INFONAME_==4.)\\n{\\nv_VARYINGNAME_UV=vec2(_MATRIXNAME_Matrix*vec4(uv5,1.0,0.0));\\n}\\n#endif\\n#ifdef UV6\\nelse if (v_INFONAME_==5.)\\n{\\nv_VARYINGNAME_UV=vec2(_MATRIXNAME_Matrix*vec4(uv6,1.0,0.0));\\n}\\n#endif\\n#endif\\n\";It.IncludesShadersStore.bumpVertex=\"#if defined(BUMP) || defined(PARALLAX) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\\n#if defined(TANGENT) && defined(NORMAL)\\nvec3 tbnNormal=normalize(normalUpdated);\\nvec3 tbnTangent=normalize(tangentUpdated.xyz);\\nvec3 tbnBitangent=cross(tbnNormal,tbnTangent)*tangentUpdated.w;\\nvTBN=mat3(finalWorld)*mat3(tbnTangent,tbnBitangent,tbnNormal);\\n#endif\\n#endif\\n\";It.IncludesShadersStore.clipPlaneVertex=\"#ifdef CLIPPLANE\\nfClipDistance=dot(worldPos,vClipPlane);\\n#endif\\n#ifdef CLIPPLANE2\\nfClipDistance2=dot(worldPos,vClipPlane2);\\n#endif\\n#ifdef CLIPPLANE3\\nfClipDistance3=dot(worldPos,vClipPlane3);\\n#endif\\n#ifdef CLIPPLANE4\\nfClipDistance4=dot(worldPos,vClipPlane4);\\n#endif\\n#ifdef CLIPPLANE5\\nfClipDistance5=dot(worldPos,vClipPlane5);\\n#endif\\n#ifdef CLIPPLANE6\\nfClipDistance6=dot(worldPos,vClipPlane6);\\n#endif\\n\";It.IncludesShadersStore.fogVertex=\"#ifdef FOG\\nvFogDistance=(view*worldPos).xyz;\\n#endif\\n\";It.IncludesShadersStore.shadowsVertex=\"#ifdef SHADOWS\\n#if defined(SHADOWCSM{X})\\nvPositionFromCamera{X}=view*worldPos;\\nfor (int i=0; i\\n#define CUSTOM_VERTEX_BEGIN\\nattribute vec3 position;\\n#ifdef NORMAL\\nattribute vec3 normal;\\n#endif\\n#ifdef TANGENT\\nattribute vec4 tangent;\\n#endif\\n#ifdef UV1\\nattribute vec2 uv;\\n#endif\\n#include[2..7]\\n#ifdef VERTEXCOLOR\\nattribute vec4 color;\\n#endif\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include[1..7]\\n#include(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse)\\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail)\\n#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient)\\n#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity)\\n#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive)\\n#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap)\\n#if defined(SPECULARTERM)\\n#include(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular)\\n#endif\\n#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump)\\nvarying vec3 vPositionW;\\n#ifdef NORMAL\\nvarying vec3 vNormalW;\\n#endif\\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\\nvarying vec4 vColor;\\n#endif\\n#include\\n#include\\n#include\\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\\n#include\\n#include[0..maxSimultaneousMorphTargets]\\n#ifdef REFLECTIONMAP_SKYBOX\\nvarying vec3 vPositionUVW;\\n#endif\\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\\nvarying vec3 vDirectionW;\\n#endif\\n#include\\n#define CUSTOM_VERTEX_DEFINITIONS\\nvoid main(void) {\\n#define CUSTOM_VERTEX_MAIN_BEGIN\\nvec3 positionUpdated=position;\\n#ifdef NORMAL\\nvec3 normalUpdated=normal;\\n#endif\\n#ifdef TANGENT\\nvec4 tangentUpdated=tangent;\\n#endif\\n#ifdef UV1\\nvec2 uvUpdated=uv;\\n#endif\\n#include\\n#include[0..maxSimultaneousMorphTargets]\\n#ifdef REFLECTIONMAP_SKYBOX\\nvPositionUVW=positionUpdated;\\n#endif\\n#define CUSTOM_VERTEX_UPDATE_POSITION\\n#define CUSTOM_VERTEX_UPDATE_NORMAL\\n#include\\n#if defined(PREPASS) && defined(PREPASS_VELOCITY) && !defined(BONES_VELOCITY_ENABLED)\\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\\nvPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0);\\n#endif\\n#include\\n#include\\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\\n#ifdef NORMAL\\nmat3 normalWorld=mat3(finalWorld);\\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\\nvNormalW=normalUpdated/vec3(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));\\nvNormalW=normalize(normalWorld*vNormalW);\\n#else\\n#ifdef NONUNIFORMSCALING\\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\\n#endif\\nvNormalW=normalize(normalWorld*normalUpdated);\\n#endif\\n#endif\\n#define CUSTOM_VERTEX_UPDATE_WORLDPOS\\n#ifdef MULTIVIEW\\nif (gl_ViewID_OVR==0u) {\\ngl_Position=viewProjection*worldPos;\\n} else {\\ngl_Position=viewProjectionR*worldPos;\\n}\\n#else\\ngl_Position=viewProjection*worldPos;\\n#endif\\nvPositionW=vec3(worldPos);\\n#include\\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\\nvDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));\\n#endif\\n#ifndef UV1\\nvec2 uvUpdated=vec2(0.,0.);\\n#endif\\n#ifdef MAINUV1\\nvMainUV1=uvUpdated;\\n#endif\\n#include[2..7]\\n#include(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse,_MATRIXNAME_,diffuse,_INFONAME_,DiffuseInfos.x)\\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_MATRIXNAME_,detail,_INFONAME_,DetailInfos.x)\\n#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_MATRIXNAME_,ambient,_INFONAME_,AmbientInfos.x)\\n#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_MATRIXNAME_,opacity,_INFONAME_,OpacityInfos.x)\\n#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_MATRIXNAME_,emissive,_INFONAME_,EmissiveInfos.x)\\n#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_MATRIXNAME_,lightmap,_INFONAME_,LightmapInfos.x)\\n#if defined(SPECULARTERM)\\n#include(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular,_MATRIXNAME_,specular,_INFONAME_,SpecularInfos.x)\\n#endif\\n#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_MATRIXNAME_,bump,_INFONAME_,BumpInfos.x)\\n#include\\n#include\\n#include\\n#include[0..maxSimultaneousLights]\\n#include\\n#include\\n#include\\n#define CUSTOM_VERTEX_MAIN_END\\n}\\n\";var Ll=function(){function e(e){this._plugins=[],this._activePlugins=[],this._activePluginsForExtraEvents=[],this._material=e,this._scene=e.getScene(),this._engine=this._scene.getEngine()}return e.prototype._addPlugin=function(t){for(var i=0;i0&&(i=o.uniforms).push.apply(i,this._uniformList),this._samplerList.length>0&&(n=o.samplers).push.apply(n,this._samplerList),this._uboList.length>0&&(r=o.uniformBuffersNames).push.apply(r,this._uboList),o.customCode=this._injectCustomCode(o.customCode);break;case Ar.PrepareUniformBuffer:o=t,this._uboDeclaration=\"\",this._vertexDeclaration=\"\",this._fragmentDeclaration=\"\",this._uniformList=[],this._samplerList=[],this._uboList=[];for(var v=0,y=this._plugins;v0)if(\"!\"===a.charAt(0))for(var h=new RegExp(a.substring(1),\"g\"),d=h.exec(n);null!==d;){for(var p=s,f=0;f0?i[0][1]=t:Fl.push([e,t])}function Ul(e){for(var t=0;t0&&e.push(this._texture)},t.prototype.dispose=function(e){var t;e&&(null===(t=this._texture)||void 0===t||t.dispose())},t.prototype.getClassName=function(){return\"DetailMapConfiguration\"},t.prototype.getSamplers=function(e){e.push(\"detailSampler\")},t.prototype.getUniforms=function(){return{ubo:[{name:\"vDetailInfos\",size:4,type:\"vec4\"},{name:\"detailMatrix\",size:16,type:\"mat4\"}]}},G([Te(\"detailTexture\"),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"texture\",void 0),G([be()],t.prototype,\"diffuseBlendLevel\",void 0),G([be()],t.prototype,\"roughnessBlendLevel\",void 0),G([be()],t.prototype,\"bumpLevel\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"normalBlendMethod\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"isEnabled\",void 0),t}(kl),Wl={effect:null,subMesh:null},Hl=function(e){function t(t){var i=e.call(this,t)||this;return i.MAINUV1=!1,i.MAINUV2=!1,i.MAINUV3=!1,i.MAINUV4=!1,i.MAINUV5=!1,i.MAINUV6=!1,i.DIFFUSE=!1,i.DIFFUSEDIRECTUV=0,i.BAKED_VERTEX_ANIMATION_TEXTURE=!1,i.AMBIENT=!1,i.AMBIENTDIRECTUV=0,i.OPACITY=!1,i.OPACITYDIRECTUV=0,i.OPACITYRGB=!1,i.REFLECTION=!1,i.EMISSIVE=!1,i.EMISSIVEDIRECTUV=0,i.SPECULAR=!1,i.SPECULARDIRECTUV=0,i.BUMP=!1,i.BUMPDIRECTUV=0,i.PARALLAX=!1,i.PARALLAXOCCLUSION=!1,i.SPECULAROVERALPHA=!1,i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.ALPHATEST=!1,i.DEPTHPREPASS=!1,i.ALPHAFROMDIFFUSE=!1,i.POINTSIZE=!1,i.FOG=!1,i.SPECULARTERM=!1,i.DIFFUSEFRESNEL=!1,i.OPACITYFRESNEL=!1,i.REFLECTIONFRESNEL=!1,i.REFRACTIONFRESNEL=!1,i.EMISSIVEFRESNEL=!1,i.FRESNEL=!1,i.NORMAL=!1,i.TANGENT=!1,i.UV1=!1,i.UV2=!1,i.UV3=!1,i.UV4=!1,i.UV5=!1,i.UV6=!1,i.VERTEXCOLOR=!1,i.VERTEXALPHA=!1,i.NUM_BONE_INFLUENCERS=0,i.BonesPerMesh=0,i.BONETEXTURE=!1,i.BONES_VELOCITY_ENABLED=!1,i.INSTANCES=!1,i.THIN_INSTANCES=!1,i.INSTANCESCOLOR=!1,i.GLOSSINESS=!1,i.ROUGHNESS=!1,i.EMISSIVEASILLUMINATION=!1,i.LINKEMISSIVEWITHDIFFUSE=!1,i.REFLECTIONFRESNELFROMSPECULAR=!1,i.LIGHTMAP=!1,i.LIGHTMAPDIRECTUV=0,i.OBJECTSPACE_NORMALMAP=!1,i.USELIGHTMAPASSHADOWMAP=!1,i.REFLECTIONMAP_3D=!1,i.REFLECTIONMAP_SPHERICAL=!1,i.REFLECTIONMAP_PLANAR=!1,i.REFLECTIONMAP_CUBIC=!1,i.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,i.USE_LOCAL_REFRACTIONMAP_CUBIC=!1,i.REFLECTIONMAP_PROJECTION=!1,i.REFLECTIONMAP_SKYBOX=!1,i.REFLECTIONMAP_EXPLICIT=!1,i.REFLECTIONMAP_EQUIRECTANGULAR=!1,i.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,i.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,i.REFLECTIONMAP_OPPOSITEZ=!1,i.INVERTCUBICMAP=!1,i.LOGARITHMICDEPTH=!1,i.REFRACTION=!1,i.REFRACTIONMAP_3D=!1,i.REFLECTIONOVERALPHA=!1,i.TWOSIDEDLIGHTING=!1,i.SHADOWFLOAT=!1,i.MORPHTARGETS=!1,i.MORPHTARGETS_NORMAL=!1,i.MORPHTARGETS_TANGENT=!1,i.MORPHTARGETS_UV=!1,i.NUM_MORPH_INFLUENCERS=0,i.MORPHTARGETS_TEXTURE=!1,i.NONUNIFORMSCALING=!1,i.PREMULTIPLYALPHA=!1,i.ALPHATEST_AFTERALLALPHACOMPUTATIONS=!1,i.ALPHABLEND=!0,i.PREPASS=!1,i.PREPASS_IRRADIANCE=!1,i.PREPASS_IRRADIANCE_INDEX=-1,i.PREPASS_ALBEDO_SQRT=!1,i.PREPASS_ALBEDO_SQRT_INDEX=-1,i.PREPASS_DEPTH=!1,i.PREPASS_DEPTH_INDEX=-1,i.PREPASS_NORMAL=!1,i.PREPASS_NORMAL_INDEX=-1,i.PREPASS_POSITION=!1,i.PREPASS_POSITION_INDEX=-1,i.PREPASS_VELOCITY=!1,i.PREPASS_VELOCITY_INDEX=-1,i.PREPASS_REFLECTIVITY=!1,i.PREPASS_REFLECTIVITY_INDEX=-1,i.SCENE_MRT_COUNT=0,i.RGBDLIGHTMAP=!1,i.RGBDREFLECTION=!1,i.RGBDREFRACTION=!1,i.IMAGEPROCESSING=!1,i.VIGNETTE=!1,i.VIGNETTEBLENDMODEMULTIPLY=!1,i.VIGNETTEBLENDMODEOPAQUE=!1,i.TONEMAPPING=!1,i.TONEMAPPING_ACES=!1,i.CONTRAST=!1,i.COLORCURVES=!1,i.COLORGRADING=!1,i.COLORGRADING3D=!1,i.SAMPLER3DGREENDEPTH=!1,i.SAMPLER3DBGRMAP=!1,i.DITHER=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.MULTIVIEW=!1,i.ORDER_INDEPENDENT_TRANSPARENCY=!1,i.ORDER_INDEPENDENT_TRANSPARENCY_16BITS=!1,i.IS_REFLECTION_LINEAR=!1,i.IS_REFRACTION_LINEAR=!1,i.EXPOSURE=!1,i.rebuild(),i}return V(t,e),t.prototype.setReflectionMode=function(e){for(var t=0,i=[\"REFLECTIONMAP_CUBIC\",\"REFLECTIONMAP_EXPLICIT\",\"REFLECTIONMAP_PLANAR\",\"REFLECTIONMAP_PROJECTION\",\"REFLECTIONMAP_PROJECTION\",\"REFLECTIONMAP_SKYBOX\",\"REFLECTIONMAP_SPHERICAL\",\"REFLECTIONMAP_EQUIRECTANGULAR\",\"REFLECTIONMAP_EQUIRECTANGULAR_FIXED\",\"REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED\"];t0,o.REFLECTIONOVERALPHA=this._useReflectionOverAlpha,o.INVERTCUBICMAP=this._reflectionTexture.coordinatesMode===to.INVCUBIC_MODE,o.REFLECTIONMAP_3D=this._reflectionTexture.isCube,o.REFLECTIONMAP_OPPOSITEZ=o.REFLECTIONMAP_3D&&this.getScene().useRightHandedSystem?!this._reflectionTexture.invertZ:this._reflectionTexture.invertZ,o.RGBDREFLECTION=this._reflectionTexture.isRGBD,this._reflectionTexture.coordinatesMode){case to.EXPLICIT_MODE:o.setReflectionMode(\"REFLECTIONMAP_EXPLICIT\");break;case to.PLANAR_MODE:o.setReflectionMode(\"REFLECTIONMAP_PLANAR\");break;case to.PROJECTION_MODE:o.setReflectionMode(\"REFLECTIONMAP_PROJECTION\");break;case to.SKYBOX_MODE:o.setReflectionMode(\"REFLECTIONMAP_SKYBOX\");break;case to.SPHERICAL_MODE:o.setReflectionMode(\"REFLECTIONMAP_SPHERICAL\");break;case to.EQUIRECTANGULAR_MODE:o.setReflectionMode(\"REFLECTIONMAP_EQUIRECTANGULAR\");break;case to.FIXED_EQUIRECTANGULAR_MODE:o.setReflectionMode(\"REFLECTIONMAP_EQUIRECTANGULAR_FIXED\");break;case to.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:o.setReflectionMode(\"REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED\");break;case to.CUBIC_MODE:case to.INVCUBIC_MODE:default:o.setReflectionMode(\"REFLECTIONMAP_CUBIC\")}o.USE_LOCAL_REFLECTIONMAP_CUBIC=!!this._reflectionTexture.boundingBoxSize}else o.REFLECTION=!1,o.REFLECTIONMAP_OPPOSITEZ=!1;if(this._emissiveTexture&&t.EmissiveTextureEnabled){if(!this._emissiveTexture.isReadyOrNotBlocking())return!1;Pr.PrepareDefinesForMergedUV(this._emissiveTexture,o,\"EMISSIVE\")}else o.EMISSIVE=!1;if(this._lightmapTexture&&t.LightmapTextureEnabled){if(!this._lightmapTexture.isReadyOrNotBlocking())return!1;Pr.PrepareDefinesForMergedUV(this._lightmapTexture,o,\"LIGHTMAP\"),o.USELIGHTMAPASSHADOWMAP=this._useLightmapAsShadowmap,o.RGBDLIGHTMAP=this._lightmapTexture.isRGBD}else o.LIGHTMAP=!1;if(this._specularTexture&&t.SpecularTextureEnabled){if(!this._specularTexture.isReadyOrNotBlocking())return!1;Pr.PrepareDefinesForMergedUV(this._specularTexture,o,\"SPECULAR\"),o.GLOSSINESS=this._useGlossinessFromSpecularMapAlpha}else o.SPECULAR=!1;if(r.getEngine().getCaps().standardDerivatives&&this._bumpTexture&&t.BumpTextureEnabled){if(!this._bumpTexture.isReady())return!1;Pr.PrepareDefinesForMergedUV(this._bumpTexture,o,\"BUMP\"),o.PARALLAX=this._useParallax,o.PARALLAXOCCLUSION=this._useParallaxOcclusion,o.OBJECTSPACE_NORMALMAP=this._useObjectSpaceNormalMap}else o.BUMP=!1,o.PARALLAX=!1,o.PARALLAXOCCLUSION=!1;if(this._refractionTexture&&t.RefractionTextureEnabled){if(!this._refractionTexture.isReadyOrNotBlocking())return!1;o._needUVs=!0,o.REFRACTION=!0,o.REFRACTIONMAP_3D=this._refractionTexture.isCube,o.RGBDREFRACTION=this._refractionTexture.isRGBD,o.USE_LOCAL_REFRACTIONMAP_CUBIC=!!this._refractionTexture.boundingBoxSize}else o.REFRACTION=!1;o.TWOSIDEDLIGHTING=!this._backFaceCulling&&this._twoSidedLighting}else o.DIFFUSE=!1,o.AMBIENT=!1,o.OPACITY=!1,o.REFLECTION=!1,o.EMISSIVE=!1,o.LIGHTMAP=!1,o.BUMP=!1,o.REFRACTION=!1;o.ALPHAFROMDIFFUSE=this._shouldUseAlphaFromDiffuseTexture(),o.EMISSIVEASILLUMINATION=this._useEmissiveAsIllumination,o.LINKEMISSIVEWITHDIFFUSE=this._linkEmissiveWithDiffuse,o.SPECULAROVERALPHA=this._useSpecularOverAlpha,o.PREMULTIPLYALPHA=this.alphaMode===a.ALPHA_PREMULTIPLIED||this.alphaMode===a.ALPHA_PREMULTIPLIED_PORTERDUFF,o.ALPHATEST_AFTERALLALPHACOMPUTATIONS=null!==this.transparencyMode,o.ALPHABLEND=null===this.transparencyMode||this.needAlphaBlendingForMesh(e)}if(this._eventInfo.isReadyForSubMesh=!0,this._eventInfo.defines=o,this._callbackPluginEventIsReadyForSubMesh(this._eventInfo),!this._eventInfo.isReadyForSubMesh)return!1;if(o._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(o),o.IS_REFLECTION_LINEAR=null!=this.reflectionTexture&&!this.reflectionTexture.gammaSpace,o.IS_REFRACTION_LINEAR=null!=this.refractionTexture&&!this.refractionTexture.gammaSpace}if(o._areFresnelDirty&&(t.FresnelEnabled?(this._diffuseFresnelParameters||this._opacityFresnelParameters||this._emissiveFresnelParameters||this._refractionFresnelParameters||this._reflectionFresnelParameters)&&(o.DIFFUSEFRESNEL=this._diffuseFresnelParameters&&this._diffuseFresnelParameters.isEnabled,o.OPACITYFRESNEL=this._opacityFresnelParameters&&this._opacityFresnelParameters.isEnabled,o.REFLECTIONFRESNEL=this._reflectionFresnelParameters&&this._reflectionFresnelParameters.isEnabled,o.REFLECTIONFRESNELFROMSPECULAR=this._useReflectionFresnelFromSpecular,o.REFRACTIONFRESNEL=this._refractionFresnelParameters&&this._refractionFresnelParameters.isEnabled,o.EMISSIVEFRESNEL=this._emissiveFresnelParameters&&this._emissiveFresnelParameters.isEnabled,o._needNormals=!0,o.FRESNEL=!0):o.FRESNEL=!1),Pr.PrepareDefinesForMisc(e,r,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e)||this._forceAlphaTest,o),Pr.PrepareDefinesForFrameBoundValues(r,s,o,n,null,i.getRenderingMesh().hasThinInstances),this._eventInfo.defines=o,this._eventInfo.mesh=e,this._callbackPluginEventPrepareDefinesBeforeAttributes(this._eventInfo),Pr.PrepareDefinesForAttributes(e,o,!0,!0,!0),this._callbackPluginEventPrepareDefines(this._eventInfo),o.isDirty){var u=o._areLightsDisposed;o.markAsProcessed();var h=new ua;o.REFLECTION&&h.addFallback(0,\"REFLECTION\"),o.SPECULAR&&h.addFallback(0,\"SPECULAR\"),o.BUMP&&h.addFallback(0,\"BUMP\"),o.PARALLAX&&h.addFallback(1,\"PARALLAX\"),o.PARALLAXOCCLUSION&&h.addFallback(0,\"PARALLAXOCCLUSION\"),o.SPECULAROVERALPHA&&h.addFallback(0,\"SPECULAROVERALPHA\"),o.FOG&&h.addFallback(1,\"FOG\"),o.POINTSIZE&&h.addFallback(0,\"POINTSIZE\"),o.LOGARITHMICDEPTH&&h.addFallback(0,\"LOGARITHMICDEPTH\"),Pr.HandleFallbacksForShadows(o,h,this._maxSimultaneousLights),o.SPECULARTERM&&h.addFallback(0,\"SPECULARTERM\"),o.DIFFUSEFRESNEL&&h.addFallback(1,\"DIFFUSEFRESNEL\"),o.OPACITYFRESNEL&&h.addFallback(2,\"OPACITYFRESNEL\"),o.REFLECTIONFRESNEL&&h.addFallback(3,\"REFLECTIONFRESNEL\"),o.EMISSIVEFRESNEL&&h.addFallback(4,\"EMISSIVEFRESNEL\"),o.FRESNEL&&h.addFallback(4,\"FRESNEL\"),o.MULTIVIEW&&h.addFallback(0,\"MULTIVIEW\");var d=[wi.PositionKind];for(o.NORMAL&&d.push(wi.NormalKind),o.TANGENT&&d.push(wi.TangentKind),c=1;c<=a.MAX_SUPPORTED_UV_SETS;++c)o[\"UV\"+c]&&d.push(\"uv\".concat(1===c?\"\":c));o.VERTEXCOLOR&&d.push(wi.ColorKind),Pr.PrepareAttributesForBones(d,e,o,h),Pr.PrepareAttributesForInstances(d,o),Pr.PrepareAttributesForMorphTargets(d,e,o),Pr.PrepareAttributesForBakedVertexAnimation(d,e,o);var p=\"default\",f=[\"world\",\"view\",\"viewProjection\",\"vEyePosition\",\"vLightsType\",\"vAmbientColor\",\"vDiffuseColor\",\"vSpecularColor\",\"vEmissiveColor\",\"visibility\",\"vFogInfos\",\"vFogColor\",\"pointSize\",\"vDiffuseInfos\",\"vAmbientInfos\",\"vOpacityInfos\",\"vReflectionInfos\",\"vEmissiveInfos\",\"vSpecularInfos\",\"vBumpInfos\",\"vLightmapInfos\",\"vRefractionInfos\",\"mBones\",\"vClipPlane\",\"vClipPlane2\",\"vClipPlane3\",\"vClipPlane4\",\"vClipPlane5\",\"vClipPlane6\",\"diffuseMatrix\",\"ambientMatrix\",\"opacityMatrix\",\"reflectionMatrix\",\"emissiveMatrix\",\"specularMatrix\",\"bumpMatrix\",\"normalMatrix\",\"lightmapMatrix\",\"refractionMatrix\",\"diffuseLeftColor\",\"diffuseRightColor\",\"opacityParts\",\"reflectionLeftColor\",\"reflectionRightColor\",\"emissiveLeftColor\",\"emissiveRightColor\",\"refractionLeftColor\",\"refractionRightColor\",\"vReflectionPosition\",\"vReflectionSize\",\"vRefractionPosition\",\"vRefractionSize\",\"logarithmicDepthConstant\",\"vTangentSpaceParams\",\"alphaCutOff\",\"boneTextureWidth\",\"morphTargetTextureInfo\",\"morphTargetTextureIndices\"],_=[\"diffuseSampler\",\"ambientSampler\",\"opacitySampler\",\"reflectionCubeSampler\",\"reflection2DSampler\",\"emissiveSampler\",\"specularSampler\",\"bumpSampler\",\"lightmapSampler\",\"refractionCubeSampler\",\"refraction2DSampler\",\"boneSampler\",\"morphTargets\",\"oitDepthSampler\",\"oitFrontColorSampler\"],m=[\"Material\",\"Scene\",\"Mesh\"];this._eventInfo.fallbacks=h,this._eventInfo.fallbackRank=0,this._eventInfo.defines=o,this._eventInfo.uniforms=f,this._eventInfo.attributes=d,this._eventInfo.samplers=_,this._eventInfo.uniformBuffersNames=m,this._eventInfo.customCode=void 0,this._eventInfo.mesh=e,this._callbackPluginEventGeneric(Ar.PrepareEffect,this._eventInfo),Dl.AddUniforms(f),Dl.AddSamplers(_),Ri&&(Ri.PrepareUniforms(f,o),Ri.PrepareSamplers(_,o)),Pr.PrepareUniformsAndSamplersList({uniformsNames:f,uniformBuffersNames:m,samplers:_,defines:o,maxSimultaneousLights:this._maxSimultaneousLights});var g={};this.customShaderNameResolve&&(p=this.customShaderNameResolve(p,f,m,_,o,d,g));var v=o.toString(),y=i.effect,b=r.getEngine().createEffect(p,{attributes:d,uniformsNames:f,uniformBuffersNames:m,samplers:_,defines:v,fallbacks:h,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights,maxSimultaneousMorphTargets:o.NUM_MORPH_INFLUENCERS},processFinalCode:g.processFinalCode,processCodeAfterIncludes:this._eventInfo.customCode,multiTarget:o.PREPASS},s);if(b)if(this._onEffectCreatedObservable&&(Wl.effect=b,Wl.subMesh=i,this._onEffectCreatedObservable.notifyObservers(Wl)),this.allowShaderHotSwapping&&y&&!b.isReady()){if(b=y,o.markAsUnprocessed(),u)return o._areLightsDisposed=!0,!1}else r.resetCachedMaterial(),i.setEffect(b,o,this._materialContext)}return!(!i.effect||!i.effect.isReady()||(o._renderId=r.getRenderId(),i.effect._wasPreviouslyReady=!0,i.effect._wasPreviouslyUsingInstances=n,r.performancePriority!==Zi.BackwardCompatible&&(this.checkReadyOnlyOnce=!0),0))},t.prototype.buildUniformLayout=function(){var t=this._uniformBuffer;t.addUniform(\"diffuseLeftColor\",4),t.addUniform(\"diffuseRightColor\",4),t.addUniform(\"opacityParts\",4),t.addUniform(\"reflectionLeftColor\",4),t.addUniform(\"reflectionRightColor\",4),t.addUniform(\"refractionLeftColor\",4),t.addUniform(\"refractionRightColor\",4),t.addUniform(\"emissiveLeftColor\",4),t.addUniform(\"emissiveRightColor\",4),t.addUniform(\"vDiffuseInfos\",2),t.addUniform(\"vAmbientInfos\",2),t.addUniform(\"vOpacityInfos\",2),t.addUniform(\"vReflectionInfos\",2),t.addUniform(\"vReflectionPosition\",3),t.addUniform(\"vReflectionSize\",3),t.addUniform(\"vEmissiveInfos\",2),t.addUniform(\"vLightmapInfos\",2),t.addUniform(\"vSpecularInfos\",2),t.addUniform(\"vBumpInfos\",3),t.addUniform(\"diffuseMatrix\",16),t.addUniform(\"ambientMatrix\",16),t.addUniform(\"opacityMatrix\",16),t.addUniform(\"reflectionMatrix\",16),t.addUniform(\"emissiveMatrix\",16),t.addUniform(\"lightmapMatrix\",16),t.addUniform(\"specularMatrix\",16),t.addUniform(\"bumpMatrix\",16),t.addUniform(\"vTangentSpaceParams\",2),t.addUniform(\"pointSize\",1),t.addUniform(\"alphaCutOff\",1),t.addUniform(\"refractionMatrix\",16),t.addUniform(\"vRefractionInfos\",4),t.addUniform(\"vRefractionPosition\",3),t.addUniform(\"vRefractionSize\",3),t.addUniform(\"vSpecularColor\",4),t.addUniform(\"vEmissiveColor\",3),t.addUniform(\"vDiffuseColor\",4),t.addUniform(\"vAmbientColor\",3),e.prototype.buildUniformLayout.call(this)},t.prototype.bindForSubMesh=function(e,i,n){var r,o=this.getScene(),a=n.materialDefines;if(a){var s=n.effect;if(s){this._activeEffect=s,i.getMeshUniformBuffer().bindToEffect(s,\"Mesh\"),i.transferToEffect(e),this._uniformBuffer.bindToEffect(s,\"Material\"),this.prePassConfiguration.bindForSubMesh(this._activeEffect,o,i,e,this.isFrozen),this._eventInfo.subMesh=n,this._callbackPluginEventHardBindForSubMesh(this._eventInfo),a.OBJECTSPACE_NORMALMAP&&(e.toNormalMatrix(this._normalMatrix),this.bindOnlyNormalMatrix(this._normalMatrix));var l=this._mustRebind(o,s,i.visibility);Pr.BindBonesParameters(i,s);var c=this._uniformBuffer;if(l){if(this.bindViewProjection(s),!c.useUbo||!this.isFrozen||!c.isSync){if(t.FresnelEnabled&&a.FRESNEL&&(this.diffuseFresnelParameters&&this.diffuseFresnelParameters.isEnabled&&(c.updateColor4(\"diffuseLeftColor\",this.diffuseFresnelParameters.leftColor,this.diffuseFresnelParameters.power),c.updateColor4(\"diffuseRightColor\",this.diffuseFresnelParameters.rightColor,this.diffuseFresnelParameters.bias)),this.opacityFresnelParameters&&this.opacityFresnelParameters.isEnabled&&c.updateColor4(\"opacityParts\",new N(this.opacityFresnelParameters.leftColor.toLuminance(),this.opacityFresnelParameters.rightColor.toLuminance(),this.opacityFresnelParameters.bias),this.opacityFresnelParameters.power),this.reflectionFresnelParameters&&this.reflectionFresnelParameters.isEnabled&&(c.updateColor4(\"reflectionLeftColor\",this.reflectionFresnelParameters.leftColor,this.reflectionFresnelParameters.power),c.updateColor4(\"reflectionRightColor\",this.reflectionFresnelParameters.rightColor,this.reflectionFresnelParameters.bias)),this.refractionFresnelParameters&&this.refractionFresnelParameters.isEnabled&&(c.updateColor4(\"refractionLeftColor\",this.refractionFresnelParameters.leftColor,this.refractionFresnelParameters.power),c.updateColor4(\"refractionRightColor\",this.refractionFresnelParameters.rightColor,this.refractionFresnelParameters.bias)),this.emissiveFresnelParameters&&this.emissiveFresnelParameters.isEnabled&&(c.updateColor4(\"emissiveLeftColor\",this.emissiveFresnelParameters.leftColor,this.emissiveFresnelParameters.power),c.updateColor4(\"emissiveRightColor\",this.emissiveFresnelParameters.rightColor,this.emissiveFresnelParameters.bias))),o.texturesEnabled){if(this._diffuseTexture&&t.DiffuseTextureEnabled&&(c.updateFloat2(\"vDiffuseInfos\",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),Pr.BindTextureMatrix(this._diffuseTexture,c,\"diffuse\")),this._ambientTexture&&t.AmbientTextureEnabled&&(c.updateFloat2(\"vAmbientInfos\",this._ambientTexture.coordinatesIndex,this._ambientTexture.level),Pr.BindTextureMatrix(this._ambientTexture,c,\"ambient\")),this._opacityTexture&&t.OpacityTextureEnabled&&(c.updateFloat2(\"vOpacityInfos\",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),Pr.BindTextureMatrix(this._opacityTexture,c,\"opacity\")),this._hasAlphaChannel()&&c.updateFloat(\"alphaCutOff\",this.alphaCutOff),this._reflectionTexture&&t.ReflectionTextureEnabled&&(c.updateFloat2(\"vReflectionInfos\",this._reflectionTexture.level,this.roughness),c.updateMatrix(\"reflectionMatrix\",this._reflectionTexture.getReflectionTextureMatrix()),this._reflectionTexture.boundingBoxSize)){var u=this._reflectionTexture;c.updateVector3(\"vReflectionPosition\",u.boundingBoxPosition),c.updateVector3(\"vReflectionSize\",u.boundingBoxSize)}if(this._emissiveTexture&&t.EmissiveTextureEnabled&&(c.updateFloat2(\"vEmissiveInfos\",this._emissiveTexture.coordinatesIndex,this._emissiveTexture.level),Pr.BindTextureMatrix(this._emissiveTexture,c,\"emissive\")),this._lightmapTexture&&t.LightmapTextureEnabled&&(c.updateFloat2(\"vLightmapInfos\",this._lightmapTexture.coordinatesIndex,this._lightmapTexture.level),Pr.BindTextureMatrix(this._lightmapTexture,c,\"lightmap\")),this._specularTexture&&t.SpecularTextureEnabled&&(c.updateFloat2(\"vSpecularInfos\",this._specularTexture.coordinatesIndex,this._specularTexture.level),Pr.BindTextureMatrix(this._specularTexture,c,\"specular\")),this._bumpTexture&&o.getEngine().getCaps().standardDerivatives&&t.BumpTextureEnabled&&(c.updateFloat3(\"vBumpInfos\",this._bumpTexture.coordinatesIndex,1/this._bumpTexture.level,this.parallaxScaleBias),Pr.BindTextureMatrix(this._bumpTexture,c,\"bump\"),o._mirroredCameraPosition?c.updateFloat2(\"vTangentSpaceParams\",this._invertNormalMapX?1:-1,this._invertNormalMapY?1:-1):c.updateFloat2(\"vTangentSpaceParams\",this._invertNormalMapX?-1:1,this._invertNormalMapY?-1:1)),this._refractionTexture&&t.RefractionTextureEnabled){var h=1;this._refractionTexture.isCube||(c.updateMatrix(\"refractionMatrix\",this._refractionTexture.getReflectionTextureMatrix()),this._refractionTexture.depth&&(h=this._refractionTexture.depth)),c.updateFloat4(\"vRefractionInfos\",this._refractionTexture.level,this.indexOfRefraction,h,this.invertRefractionY?-1:1),this._refractionTexture.boundingBoxSize&&(u=this._refractionTexture,c.updateVector3(\"vRefractionPosition\",u.boundingBoxPosition),c.updateVector3(\"vRefractionSize\",u.boundingBoxSize))}}this.pointsCloud&&c.updateFloat(\"pointSize\",this.pointSize),a.SPECULARTERM&&c.updateColor4(\"vSpecularColor\",this.specularColor,this.specularPower),c.updateColor3(\"vEmissiveColor\",t.EmissiveTextureEnabled?this.emissiveColor:N.BlackReadOnly),c.updateColor4(\"vDiffuseColor\",this.diffuseColor,this.alpha),o.ambientColor.multiplyToRef(this.ambientColor,this._globalAmbientColor),c.updateColor3(\"vAmbientColor\",this._globalAmbientColor)}o.texturesEnabled&&(this._diffuseTexture&&t.DiffuseTextureEnabled&&s.setTexture(\"diffuseSampler\",this._diffuseTexture),this._ambientTexture&&t.AmbientTextureEnabled&&s.setTexture(\"ambientSampler\",this._ambientTexture),this._opacityTexture&&t.OpacityTextureEnabled&&s.setTexture(\"opacitySampler\",this._opacityTexture),this._reflectionTexture&&t.ReflectionTextureEnabled&&(this._reflectionTexture.isCube?s.setTexture(\"reflectionCubeSampler\",this._reflectionTexture):s.setTexture(\"reflection2DSampler\",this._reflectionTexture)),this._emissiveTexture&&t.EmissiveTextureEnabled&&s.setTexture(\"emissiveSampler\",this._emissiveTexture),this._lightmapTexture&&t.LightmapTextureEnabled&&s.setTexture(\"lightmapSampler\",this._lightmapTexture),this._specularTexture&&t.SpecularTextureEnabled&&s.setTexture(\"specularSampler\",this._specularTexture),this._bumpTexture&&o.getEngine().getCaps().standardDerivatives&&t.BumpTextureEnabled&&s.setTexture(\"bumpSampler\",this._bumpTexture),this._refractionTexture&&t.RefractionTextureEnabled&&(this._refractionTexture.isCube?s.setTexture(\"refractionCubeSampler\",this._refractionTexture):s.setTexture(\"refraction2DSampler\",this._refractionTexture))),this.getScene().useOrderIndependentTransparency&&this.needAlphaBlendingForMesh(i)&&this.getScene().depthPeelingRenderer.bind(s),this._eventInfo.subMesh=n,this._callbackPluginEventBindForSubMesh(this._eventInfo),Pr.BindClipPlane(s,o),this.bindEyePosition(s)}else o.getEngine()._features.needToAlwaysBindUniformBuffers&&(this._needToBindSceneUbo=!0);!l&&this.isFrozen||(o.lightsEnabled&&!this._disableLighting&&Pr.BindLights(o,i,s,a,this._maxSimultaneousLights),(o.fogEnabled&&i.applyFog&&o.fogMode!==mn.FOGMODE_NONE||this._reflectionTexture||this._refractionTexture||i.receiveShadows||a.PREPASS)&&this.bindView(s),Pr.BindFogParameters(o,i,s),a.NUM_MORPH_INFLUENCERS&&Pr.BindMorphTargetParameters(i,s),a.BAKED_VERTEX_ANIMATION_TEXTURE&&(null===(r=i.bakedVertexAnimationManager)||void 0===r||r.bind(s,a.INSTANCES)),this.useLogarithmicDepth&&Pr.BindLogDepth(a,s,o),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._activeEffect)),this._afterBind(i,this._activeEffect),c.update()}}},t.prototype.getAnimatables=function(){var t=e.prototype.getAnimatables.call(this);return this._diffuseTexture&&this._diffuseTexture.animations&&this._diffuseTexture.animations.length>0&&t.push(this._diffuseTexture),this._ambientTexture&&this._ambientTexture.animations&&this._ambientTexture.animations.length>0&&t.push(this._ambientTexture),this._opacityTexture&&this._opacityTexture.animations&&this._opacityTexture.animations.length>0&&t.push(this._opacityTexture),this._reflectionTexture&&this._reflectionTexture.animations&&this._reflectionTexture.animations.length>0&&t.push(this._reflectionTexture),this._emissiveTexture&&this._emissiveTexture.animations&&this._emissiveTexture.animations.length>0&&t.push(this._emissiveTexture),this._specularTexture&&this._specularTexture.animations&&this._specularTexture.animations.length>0&&t.push(this._specularTexture),this._bumpTexture&&this._bumpTexture.animations&&this._bumpTexture.animations.length>0&&t.push(this._bumpTexture),this._lightmapTexture&&this._lightmapTexture.animations&&this._lightmapTexture.animations.length>0&&t.push(this._lightmapTexture),this._refractionTexture&&this._refractionTexture.animations&&this._refractionTexture.animations.length>0&&t.push(this._refractionTexture),t},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._diffuseTexture&&t.push(this._diffuseTexture),this._ambientTexture&&t.push(this._ambientTexture),this._opacityTexture&&t.push(this._opacityTexture),this._reflectionTexture&&t.push(this._reflectionTexture),this._emissiveTexture&&t.push(this._emissiveTexture),this._specularTexture&&t.push(this._specularTexture),this._bumpTexture&&t.push(this._bumpTexture),this._lightmapTexture&&t.push(this._lightmapTexture),this._refractionTexture&&t.push(this._refractionTexture),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||this._diffuseTexture===t||this._ambientTexture===t||this._opacityTexture===t||this._reflectionTexture===t||this._emissiveTexture===t||this._specularTexture===t||this._bumpTexture===t||this._lightmapTexture===t||this._refractionTexture===t},t.prototype.dispose=function(t,i){var n,r,o,a,s,l,c,u,h;i&&(null===(n=this._diffuseTexture)||void 0===n||n.dispose(),null===(r=this._ambientTexture)||void 0===r||r.dispose(),null===(o=this._opacityTexture)||void 0===o||o.dispose(),null===(a=this._reflectionTexture)||void 0===a||a.dispose(),null===(s=this._emissiveTexture)||void 0===s||s.dispose(),null===(l=this._specularTexture)||void 0===l||l.dispose(),null===(c=this._bumpTexture)||void 0===c||c.dispose(),null===(u=this._lightmapTexture)||void 0===u||u.dispose(),null===(h=this._refractionTexture)||void 0===h||h.dispose()),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),e.prototype.dispose.call(this,t,i)},t.prototype.clone=function(e){var i=this,n=Le.Clone((function(){return new t(e,i.getScene())}),this);return n.name=e,n.id=e,this.stencil.copyTo(n.stencil),n},t.Parse=function(e,i,n){var r=Le.Parse((function(){return new t(e.name,i)}),e,i,n);return e.stencil&&r.stencil.parse(e.stencil,i,n),r},Object.defineProperty(t,\"DiffuseTextureEnabled\",{get:function(){return Nl.DiffuseTextureEnabled},set:function(e){Nl.DiffuseTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,\"DetailTextureEnabled\",{get:function(){return Nl.DetailTextureEnabled},set:function(e){Nl.DetailTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,\"AmbientTextureEnabled\",{get:function(){return Nl.AmbientTextureEnabled},set:function(e){Nl.AmbientTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,\"OpacityTextureEnabled\",{get:function(){return Nl.OpacityTextureEnabled},set:function(e){Nl.OpacityTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,\"ReflectionTextureEnabled\",{get:function(){return Nl.ReflectionTextureEnabled},set:function(e){Nl.ReflectionTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,\"EmissiveTextureEnabled\",{get:function(){return Nl.EmissiveTextureEnabled},set:function(e){Nl.EmissiveTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,\"SpecularTextureEnabled\",{get:function(){return Nl.SpecularTextureEnabled},set:function(e){Nl.SpecularTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,\"BumpTextureEnabled\",{get:function(){return Nl.BumpTextureEnabled},set:function(e){Nl.BumpTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,\"LightmapTextureEnabled\",{get:function(){return Nl.LightmapTextureEnabled},set:function(e){Nl.LightmapTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,\"RefractionTextureEnabled\",{get:function(){return Nl.RefractionTextureEnabled},set:function(e){Nl.RefractionTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,\"ColorGradingTextureEnabled\",{get:function(){return Nl.ColorGradingTextureEnabled},set:function(e){Nl.ColorGradingTextureEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t,\"FresnelEnabled\",{get:function(){return Nl.FresnelEnabled},set:function(e){Nl.FresnelEnabled=e},enumerable:!1,configurable:!0}),G([Te(\"diffuseTexture\")],t.prototype,\"_diffuseTexture\",void 0),G([ye(\"_markAllSubMeshesAsTexturesAndMiscDirty\")],t.prototype,\"diffuseTexture\",void 0),G([Te(\"ambientTexture\")],t.prototype,\"_ambientTexture\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"ambientTexture\",void 0),G([Te(\"opacityTexture\")],t.prototype,\"_opacityTexture\",void 0),G([ye(\"_markAllSubMeshesAsTexturesAndMiscDirty\")],t.prototype,\"opacityTexture\",void 0),G([Te(\"reflectionTexture\")],t.prototype,\"_reflectionTexture\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"reflectionTexture\",void 0),G([Te(\"emissiveTexture\")],t.prototype,\"_emissiveTexture\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"emissiveTexture\",void 0),G([Te(\"specularTexture\")],t.prototype,\"_specularTexture\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"specularTexture\",void 0),G([Te(\"bumpTexture\")],t.prototype,\"_bumpTexture\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"bumpTexture\",void 0),G([Te(\"lightmapTexture\")],t.prototype,\"_lightmapTexture\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"lightmapTexture\",void 0),G([Te(\"refractionTexture\")],t.prototype,\"_refractionTexture\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"refractionTexture\",void 0),G([Ee(\"ambient\")],t.prototype,\"ambientColor\",void 0),G([Ee(\"diffuse\")],t.prototype,\"diffuseColor\",void 0),G([Ee(\"specular\")],t.prototype,\"specularColor\",void 0),G([Ee(\"emissive\")],t.prototype,\"emissiveColor\",void 0),G([be()],t.prototype,\"specularPower\",void 0),G([be(\"useAlphaFromDiffuseTexture\")],t.prototype,\"_useAlphaFromDiffuseTexture\",void 0),G([ye(\"_markAllSubMeshesAsTexturesAndMiscDirty\")],t.prototype,\"useAlphaFromDiffuseTexture\",void 0),G([be(\"useEmissiveAsIllumination\")],t.prototype,\"_useEmissiveAsIllumination\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useEmissiveAsIllumination\",void 0),G([be(\"linkEmissiveWithDiffuse\")],t.prototype,\"_linkEmissiveWithDiffuse\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"linkEmissiveWithDiffuse\",void 0),G([be(\"useSpecularOverAlpha\")],t.prototype,\"_useSpecularOverAlpha\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useSpecularOverAlpha\",void 0),G([be(\"useReflectionOverAlpha\")],t.prototype,\"_useReflectionOverAlpha\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useReflectionOverAlpha\",void 0),G([be(\"disableLighting\")],t.prototype,\"_disableLighting\",void 0),G([ye(\"_markAllSubMeshesAsLightsDirty\")],t.prototype,\"disableLighting\",void 0),G([be(\"useObjectSpaceNormalMap\")],t.prototype,\"_useObjectSpaceNormalMap\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useObjectSpaceNormalMap\",void 0),G([be(\"useParallax\")],t.prototype,\"_useParallax\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useParallax\",void 0),G([be(\"useParallaxOcclusion\")],t.prototype,\"_useParallaxOcclusion\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useParallaxOcclusion\",void 0),G([be()],t.prototype,\"parallaxScaleBias\",void 0),G([be(\"roughness\")],t.prototype,\"_roughness\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"roughness\",void 0),G([be()],t.prototype,\"indexOfRefraction\",void 0),G([be()],t.prototype,\"invertRefractionY\",void 0),G([be()],t.prototype,\"alphaCutOff\",void 0),G([be(\"useLightmapAsShadowmap\")],t.prototype,\"_useLightmapAsShadowmap\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useLightmapAsShadowmap\",void 0),G([Se(\"diffuseFresnelParameters\")],t.prototype,\"_diffuseFresnelParameters\",void 0),G([ye(\"_markAllSubMeshesAsFresnelDirty\")],t.prototype,\"diffuseFresnelParameters\",void 0),G([Se(\"opacityFresnelParameters\")],t.prototype,\"_opacityFresnelParameters\",void 0),G([ye(\"_markAllSubMeshesAsFresnelAndMiscDirty\")],t.prototype,\"opacityFresnelParameters\",void 0),G([Se(\"reflectionFresnelParameters\")],t.prototype,\"_reflectionFresnelParameters\",void 0),G([ye(\"_markAllSubMeshesAsFresnelDirty\")],t.prototype,\"reflectionFresnelParameters\",void 0),G([Se(\"refractionFresnelParameters\")],t.prototype,\"_refractionFresnelParameters\",void 0),G([ye(\"_markAllSubMeshesAsFresnelDirty\")],t.prototype,\"refractionFresnelParameters\",void 0),G([Se(\"emissiveFresnelParameters\")],t.prototype,\"_emissiveFresnelParameters\",void 0),G([ye(\"_markAllSubMeshesAsFresnelDirty\")],t.prototype,\"emissiveFresnelParameters\",void 0),G([be(\"useReflectionFresnelFromSpecular\")],t.prototype,\"_useReflectionFresnelFromSpecular\",void 0),G([ye(\"_markAllSubMeshesAsFresnelDirty\")],t.prototype,\"useReflectionFresnelFromSpecular\",void 0),G([be(\"useGlossinessFromSpecularMapAlpha\")],t.prototype,\"_useGlossinessFromSpecularMapAlpha\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useGlossinessFromSpecularMapAlpha\",void 0),G([be(\"maxSimultaneousLights\")],t.prototype,\"_maxSimultaneousLights\",void 0),G([ye(\"_markAllSubMeshesAsLightsDirty\")],t.prototype,\"maxSimultaneousLights\",void 0),G([be(\"invertNormalMapX\")],t.prototype,\"_invertNormalMapX\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"invertNormalMapX\",void 0),G([be(\"invertNormalMapY\")],t.prototype,\"_invertNormalMapY\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"invertNormalMapY\",void 0),G([be(\"twoSidedLighting\")],t.prototype,\"_twoSidedLighting\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"twoSidedLighting\",void 0),G([be()],t.prototype,\"useLogarithmicDepth\",null),t}(Vo);b(\"BABYLON.StandardMaterial\",Xl),mn.DefaultMaterialFactory=function(e){return new Xl(\"default material\",e)},Yt.prototype.createDynamicTexture=function(e,t,i,n){var r=new wt(this,Rt.Dynamic);return r.baseWidth=e,r.baseHeight=t,i&&(e=this.needPOTTextures?Yt.GetExponentOfTwo(e,this._caps.maxTextureSize):e,t=this.needPOTTextures?Yt.GetExponentOfTwo(t,this._caps.maxTextureSize):t),r.width=e,r.height=t,r.isReady=!1,r.generateMipMaps=i,r.samplingMode=n,this.updateTextureSamplingMode(n,r),this._internalTexturesCache.push(r),r},Yt.prototype.updateDynamicTexture=function(e,t,i,n,r,o,a){if(void 0===n&&(n=!1),void 0===o&&(o=!1),void 0===a&&(a=!1),e){var s=this._gl,l=s.TEXTURE_2D,c=this._bindTextureDirectly(l,e,!0,o);this._unpackFlipY(void 0===i?e.invertY:i),n&&s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1);var u=this._getWebGLTextureType(e.type),h=this._getInternalFormat(r||e.format),d=this._getRGBABufferInternalSizedFormat(e.type,h);s.texImage2D(l,0,d,h,u,t),e.generateMipMaps&&s.generateMipmap(l),c||this._bindTextureDirectly(l,null),n&&s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),e.isReady=!0}};var jl=function(e){function t(t,i,n,r,o,s,l){void 0===n&&(n=null),void 0===r&&(r=!1),void 0===o&&(o=a.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===s&&(s=a.TEXTUREFORMAT_RGBA);var c=e.call(this,null,n,!r,l,o,void 0,void 0,void 0,void 0,s)||this;c.name=t,c.wrapU=to.CLAMP_ADDRESSMODE,c.wrapV=to.CLAMP_ADDRESSMODE,c._generateMipMaps=r;var u=c._getEngine();if(!u)return c;i.getContext?(c._canvas=i,c._texture=u.createDynamicTexture(i.width,i.height,r,o)):(c._canvas=u.createCanvas(1,1),i.width||0===i.width?c._texture=u.createDynamicTexture(i.width,i.height,r,o):c._texture=u.createDynamicTexture(i,i,r,o));var h=c.getSize();return c._canvas.width!==h.width&&(c._canvas.width=h.width),c._canvas.height!==h.height&&(c._canvas.height=h.height),c._context=c._canvas.getContext(\"2d\"),c}return V(t,e),t.prototype.getClassName=function(){return\"DynamicTexture\"},Object.defineProperty(t.prototype,\"canRescale\",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype._recreate=function(e){this._canvas.width=e.width,this._canvas.height=e.height,this.releaseInternalTexture(),this._texture=this._getEngine().createDynamicTexture(e.width,e.height,this._generateMipMaps,this.samplingMode)},t.prototype.scale=function(e){var t=this.getSize();t.width*=e,t.height*=e,this._recreate(t)},t.prototype.scaleTo=function(e,t){var i=this.getSize();i.width=e,i.height=t,this._recreate(i)},t.prototype.getContext=function(){return this._context},t.prototype.clear=function(){var e=this.getSize();this._context.fillRect(0,0,e.width,e.height)},t.prototype.update=function(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=!1),this._getEngine().updateDynamicTexture(this._texture,this._canvas,void 0===e||e,t,this._format||void 0,void 0,i)},t.prototype.drawText=function(e,t,i,n,r,o,a,s){void 0===s&&(s=!0);var l=this.getSize();if(o&&(this._context.fillStyle=o,this._context.fillRect(0,0,l.width,l.height)),this._context.font=n,null==t){var c=this._context.measureText(e);t=(l.width-c.width)/2}if(null==i){var u=parseInt(n.replace(/\\D/g,\"\"));i=l.height/2+u/3.65}this._context.fillStyle=r||\"\",this._context.fillText(e,t,i),s&&this.update(a)},t.prototype.clone=function(){var e=this.getScene();if(!e)return this;var i=this.getSize(),n=new t(this.name,i,e,this._generateMipMaps);return n.hasAlpha=this.hasAlpha,n.level=this.level,n.wrapU=this.wrapU,n.wrapV=this.wrapV,n},t.prototype.serialize=function(){var i=this.getScene();i&&!i.isReady()&&Q.Warn(\"The scene must be ready before serializing the dynamic texture\");var n=e.prototype.serialize.call(this);return t._IsCanvasElement(this._canvas)&&(n.base64String=this._canvas.toDataURL()),n.invertY=this._invertY,n.samplingMode=this.samplingMode,n},t._IsCanvasElement=function(e){return void 0!==e.toDataURL},t.prototype._rebuild=function(){this.update()},t}(to);It.ShadersStore.imageProcessingPixelShader=\"varying vec2 vUV;\\nuniform sampler2D textureSampler;\\n#include\\n#include\\n#include\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void)\\n{\\nvec4 result=texture2D(textureSampler,vUV);\\n#ifdef IMAGEPROCESSING\\n#ifndef FROMLINEARSPACE\\nresult.rgb=toLinearSpace(result.rgb);\\n#endif\\nresult=applyImageProcessing(result);\\n#else\\n#ifdef FROMLINEARSPACE\\nresult=applyImageProcessing(result);\\n#endif\\n#endif\\ngl_FragColor=result;\\n}\";var Yl,Kl,Ql=function(e){function t(t,i,n,r,o,s,l,c){void 0===n&&(n=null),void 0===l&&(l=a.TEXTURETYPE_UNSIGNED_INT);var u=e.call(this,t,\"imageProcessing\",[],[],i,n,r,o,s,null,l,\"postprocess\",null,!0)||this;return u._fromLinearSpace=!0,u._defines={IMAGEPROCESSING:!1,VIGNETTE:!1,VIGNETTEBLENDMODEMULTIPLY:!1,VIGNETTEBLENDMODEOPAQUE:!1,TONEMAPPING:!1,TONEMAPPING_ACES:!1,CONTRAST:!1,COLORCURVES:!1,COLORGRADING:!1,COLORGRADING3D:!1,FROMLINEARSPACE:!1,SAMPLER3DGREENDEPTH:!1,SAMPLER3DBGRMAP:!1,DITHER:!1,IMAGEPROCESSINGPOSTPROCESS:!1,EXPOSURE:!1,SKIPFINALCOLORCLAMP:!1},c?(c.applyByPostProcess=!0,u._attachImageProcessingConfiguration(c,!0),u._updateParameters()):(u._attachImageProcessingConfiguration(null,!0),u.imageProcessingConfiguration.applyByPostProcess=!0),u.onApply=function(e){u.imageProcessingConfiguration.bind(e,u.aspectRatio)},u}return V(t,e),Object.defineProperty(t.prototype,\"imageProcessingConfiguration\",{get:function(){return this._imageProcessingConfiguration},set:function(e){e.applyByPostProcess=!0,this._attachImageProcessingConfiguration(e)},enumerable:!1,configurable:!0}),t.prototype._attachImageProcessingConfiguration=function(e,t){var i=this;if(void 0===t&&(t=!1),e!==this._imageProcessingConfiguration){if(this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),e)this._imageProcessingConfiguration=e;else{var n=null,r=this.getEngine(),o=this.getCamera();if(o)n=o.getScene();else if(r&&r.scenes){var a=r.scenes;n=a[a.length-1]}else n=S.LastCreatedScene;this._imageProcessingConfiguration=n?n.imageProcessingConfiguration:new Ri}this._imageProcessingConfiguration&&(this._imageProcessingObserver=this._imageProcessingConfiguration.onUpdateParameters.add((function(){i._updateParameters()}))),t||this._updateParameters()}},Object.defineProperty(t.prototype,\"isSupported\",{get:function(){var e=this.getEffect();return!e||e.isSupported},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"colorCurves\",{get:function(){return this.imageProcessingConfiguration.colorCurves},set:function(e){this.imageProcessingConfiguration.colorCurves=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"colorCurvesEnabled\",{get:function(){return this.imageProcessingConfiguration.colorCurvesEnabled},set:function(e){this.imageProcessingConfiguration.colorCurvesEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"colorGradingTexture\",{get:function(){return this.imageProcessingConfiguration.colorGradingTexture},set:function(e){this.imageProcessingConfiguration.colorGradingTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"colorGradingEnabled\",{get:function(){return this.imageProcessingConfiguration.colorGradingEnabled},set:function(e){this.imageProcessingConfiguration.colorGradingEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"exposure\",{get:function(){return this.imageProcessingConfiguration.exposure},set:function(e){this.imageProcessingConfiguration.exposure=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"toneMappingEnabled\",{get:function(){return this._imageProcessingConfiguration.toneMappingEnabled},set:function(e){this._imageProcessingConfiguration.toneMappingEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"toneMappingType\",{get:function(){return this._imageProcessingConfiguration.toneMappingType},set:function(e){this._imageProcessingConfiguration.toneMappingType=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"contrast\",{get:function(){return this.imageProcessingConfiguration.contrast},set:function(e){this.imageProcessingConfiguration.contrast=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"vignetteStretch\",{get:function(){return this.imageProcessingConfiguration.vignetteStretch},set:function(e){this.imageProcessingConfiguration.vignetteStretch=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"vignetteCentreX\",{get:function(){return this.imageProcessingConfiguration.vignetteCentreX},set:function(e){this.imageProcessingConfiguration.vignetteCentreX=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"vignetteCentreY\",{get:function(){return this.imageProcessingConfiguration.vignetteCentreY},set:function(e){this.imageProcessingConfiguration.vignetteCentreY=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"vignetteWeight\",{get:function(){return this.imageProcessingConfiguration.vignetteWeight},set:function(e){this.imageProcessingConfiguration.vignetteWeight=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"vignetteColor\",{get:function(){return this.imageProcessingConfiguration.vignetteColor},set:function(e){this.imageProcessingConfiguration.vignetteColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"vignetteCameraFov\",{get:function(){return this.imageProcessingConfiguration.vignetteCameraFov},set:function(e){this.imageProcessingConfiguration.vignetteCameraFov=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"vignetteBlendMode\",{get:function(){return this.imageProcessingConfiguration.vignetteBlendMode},set:function(e){this.imageProcessingConfiguration.vignetteBlendMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"vignetteEnabled\",{get:function(){return this.imageProcessingConfiguration.vignetteEnabled},set:function(e){this.imageProcessingConfiguration.vignetteEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"ditheringIntensity\",{get:function(){return this.imageProcessingConfiguration.ditheringIntensity},set:function(e){this.imageProcessingConfiguration.ditheringIntensity=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"ditheringEnabled\",{get:function(){return this.imageProcessingConfiguration.ditheringEnabled},set:function(e){this.imageProcessingConfiguration.ditheringEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"fromLinearSpace\",{get:function(){return this._fromLinearSpace},set:function(e){this._fromLinearSpace!==e&&(this._fromLinearSpace=e,this._updateParameters())},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return\"ImageProcessingPostProcess\"},t.prototype._updateParameters=function(){this._defines.FROMLINEARSPACE=this._fromLinearSpace,this.imageProcessingConfiguration.prepareDefines(this._defines,!0);var e=\"\";for(var t in this._defines)this._defines[t]&&(e+=\"#define \".concat(t,\";\\r\\n\"));var i=[\"textureSampler\"],n=[\"scale\"];Ri&&(Ri.PrepareSamplers(i,this._defines),Ri.PrepareUniforms(n,this._defines)),this.updateEffect(e,n,i)},t.prototype.dispose=function(t){e.prototype.dispose.call(this,t),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),this._imageProcessingConfiguration&&(this.imageProcessingConfiguration.applyByPostProcess=!1)},G([be()],t.prototype,\"_fromLinearSpace\",void 0),t}(pa),ql=function(){function e(e,t,i,n,r){this.getWidth=e,this.getHeight=t,this.layer=i,this.layerType=n,this.createRenderTargetTextureProvider=r}return Object.defineProperty(e.prototype,\"isFixedFoveationSupported\",{get:function(){return\"XRWebGLLayer\"==this.layerType&&\"number\"==typeof this.layer.fixedFoveation},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"fixedFoveation\",{get:function(){return this.isFixedFoveationSupported?this.layer.fixedFoveation:null},set:function(e){if(this.isFixedFoveationSupported){var t=Math.max(0,Math.min(1,e||0));this.layer.fixedFoveation=t}},enumerable:!1,configurable:!0}),e}(),Zl=function(){function e(e,t){this._scene=e,this.layerWrapper=t,this._renderTargetTextures=new Array,this._engine=e.getEngine()}return e.prototype._createInternalTexture=function(e,t){var i=new wt(this._engine,Rt.Unknown,!0);return i.width=e.width,i.height=e.height,i._hardwareTexture=new Wt(t,this._engine._gl),i.isReady=!0,i},e.prototype._createRenderTargetTexture=function(e,t,i,n,r,o){if(!this._engine)throw new Error(\"Engine is disposed\");var a={width:e,height:t},s=o?new yl(this._scene,a):new Ia(\"XR renderTargetTexture\",a,this._scene),l=s.renderTarget;if(!i&&n||(l._framebuffer=i),n)if(o)l._colorTextureArray=n;else{var c=this._createInternalTexture(a,n);l.setTexture(c,0),s._texture=c}return r&&(o?l._depthStencilTextureArray=r:l._depthStencilTexture=this._createInternalTexture(a,r)),s.disableRescaling(),\"undefined\"!=typeof XRWebGLBinding&&(s.skipInitialClear=!0),this._renderTargetTextures.push(s),s},e.prototype._destroyRenderTargetTexture=function(e){this._renderTargetTextures.splice(this._renderTargetTextures.indexOf(e),1),e.dispose()},e.prototype.getFramebufferDimensions=function(){return this._framebufferDimensions},e.prototype.dispose=function(){this._renderTargetTextures.forEach((function(e){return e.dispose()})),this._renderTargetTextures.length=0},e}(),Jl=function(e){function t(t){var i=e.call(this,(function(){return t.framebufferWidth}),(function(){return t.framebufferHeight}),t,\"XRWebGLLayer\",(function(e){return new $l(e.scene,i)}))||this;return i.layer=t,i}return V(t,e),t}(ql),$l=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.layerWrapper=i,n._layer=i.layer,n._framebufferDimensions={framebufferWidth:n._layer.framebufferWidth,framebufferHeight:n._layer.framebufferHeight},n}return V(t,e),t.prototype.trySetViewportForView=function(e,t){var i=this._layer.getViewport(t),n=this._framebufferDimensions.framebufferWidth,r=this._framebufferDimensions.framebufferHeight;return e.x=i.x/n,e.y=i.y/r,e.width=i.width/n,e.height=i.height/r,!0},t.prototype.getRenderTargetTextureForEye=function(e){var t=this._layer.framebufferWidth,i=this._layer.framebufferHeight,n=this._layer.framebuffer;return this._rtt&&t===this._framebufferDimensions.framebufferWidth&&i===this._framebufferDimensions.framebufferHeight&&n===this._framebuffer||(this._rtt=this._createRenderTargetTexture(t,i,n),this._framebufferDimensions.framebufferWidth=t,this._framebufferDimensions.framebufferHeight=i,this._framebuffer=n),this._rtt},t.prototype.getRenderTargetTextureForView=function(e){return this.getRenderTargetTextureForEye(e.eye)},t}(Zl),ec=function(){function e(){}return e.GetDefaults=function(t){var i=new e;return i.canvasOptions={antialias:!0,depth:!0,stencil:!t||t.isStencilEnable,alpha:!0,multiview:!1,framebufferScaleFactor:1},i.newCanvasCssStyle=\"position:absolute; bottom:0px;right:0px;z-index:10;width:90%;height:100%;background-color: #000000;\",i},e}(),tc=function(){function e(e,t){void 0===t&&(t=ec.GetDefaults());var i=this;if(this._options=t,this._canvas=null,this._engine=null,this.xrLayer=null,this._xrLayerWrapper=null,this.onXRLayerInitObservable=new u,this._engine=e.scene.getEngine(),this._engine.onDisposeObservable.addOnce((function(){i._engine=null})),t.canvasElement)this._setManagedOutputCanvas(t.canvasElement);else{var n=document.createElement(\"canvas\");n.style.cssText=this._options.newCanvasCssStyle||\"position:absolute; bottom:0px;right:0px;\",this._setManagedOutputCanvas(n)}e.onXRSessionInit.add((function(){i._addCanvas()})),e.onXRSessionEnded.add((function(){i._removeCanvas()}))}return e.prototype.dispose=function(){this._removeCanvas(),this._setManagedOutputCanvas(null)},e.prototype.initializeXRLayerAsync=function(e){return z(this,void 0,void 0,(function(){var t,i=this;return W(this,(function(n){return t=function(){return i.xrLayer=new XRWebGLLayer(e,i.canvasContext,i._options.canvasOptions),i._xrLayerWrapper=new Jl(i.xrLayer),i.onXRLayerInitObservable.notifyObservers(i.xrLayer),i.xrLayer},this.canvasContext.makeXRCompatible?[2,this.canvasContext.makeXRCompatible().then((function(){}),(function(){mi.Warn(\"Error executing makeXRCompatible. This does not mean that the session will work incorrectly.\")})).then((function(){return t()}))]:[2,Promise.resolve(t())]}))}))},e.prototype._addCanvas=function(){var e=this;this._canvas&&this._engine&&this._canvas!==this._engine.getRenderingCanvas()&&document.body.appendChild(this._canvas),this.xrLayer?this._setCanvasSize(!0):this.onXRLayerInitObservable.addOnce((function(){e._setCanvasSize(!0)}))},e.prototype._removeCanvas=function(){this._canvas&&this._engine&&document.body.contains(this._canvas)&&this._canvas!==this._engine.getRenderingCanvas()&&document.body.removeChild(this._canvas),this._setCanvasSize(!1)},e.prototype._setCanvasSize=function(e,t){void 0===e&&(e=!0),void 0===t&&(t=this._xrLayerWrapper),this._canvas&&this._engine&&(e?t&&(this._canvas!==this._engine.getRenderingCanvas()?(this._canvas.style.width=t.getWidth()+\"px\",this._canvas.style.height=t.getHeight()+\"px\"):this._engine.setSize(t.getWidth(),t.getHeight())):this._originalCanvasSize&&(this._canvas!==this._engine.getRenderingCanvas()?(this._canvas.style.width=this._originalCanvasSize.width+\"px\",this._canvas.style.height=this._originalCanvasSize.height+\"px\"):this._engine.setSize(this._originalCanvasSize.width,this._originalCanvasSize.height)))},e.prototype._setManagedOutputCanvas=function(e){this._removeCanvas(),e?(this._originalCanvasSize={width:e.offsetWidth,height:e.offsetHeight},this._canvas=e,this.canvasContext=this._canvas.getContext(\"webgl2\"),this.canvasContext||(this.canvasContext=this._canvas.getContext(\"webgl\"))):(this._canvas=null,this.canvasContext=null)},e}(),ic=function(e){function t(t){var i=e.call(this,(function(){return t.framebufferWidth}),(function(){return t.framebufferHeight}),t,\"XRWebGLLayer\",(function(e){return new nc(e,i)}))||this;return i.layer=t,i}return V(t,e),t}(ql),nc=function(e){function t(t,i){var n=e.call(this,t.scene,i)||this;return n.layerWrapper=i,n._nativeRTTProvider=navigator.xr.getNativeRenderTargetProvider(t.session,n._createRenderTargetTexture.bind(n),n._destroyRenderTargetTexture.bind(n)),n._nativeLayer=i.layer,n}return V(t,e),t.prototype.trySetViewportForView=function(e){return e.x=0,e.y=0,e.width=1,e.height=1,!0},t.prototype.getRenderTargetTextureForEye=function(e){return this._nativeRTTProvider.getRenderTargetForEye(e)},t.prototype.getRenderTargetTextureForView=function(e){return this._nativeRTTProvider.getRenderTargetForEye(e.eye)},t.prototype.getFramebufferDimensions=function(){return{framebufferWidth:this._nativeLayer.framebufferWidth,framebufferHeight:this._nativeLayer.framebufferHeight}},t}(Zl),rc=function(){function e(e){this._nativeRenderTarget=navigator.xr.getWebXRRenderTarget(e.scene.getEngine())}return e.prototype.initializeXRLayerAsync=function(e){return z(this,void 0,void 0,(function(){return W(this,(function(t){switch(t.label){case 0:return[4,this._nativeRenderTarget.initializeXRLayerAsync(e)];case 1:return t.sent(),this.xrLayer=this._nativeRenderTarget.xrLayer,[2,this.xrLayer]}}))}))},e.prototype.dispose=function(){},e}(),oc=function(){function e(e){var t=this;this.scene=e,this.currentTimestamp=-1,this.defaultHeightCompensation=1.7,this.onXRFrameObservable=new u,this.onXRReferenceSpaceChanged=new u,this.onXRSessionEnded=new u,this.onXRSessionInit=new u,this.inXRFrameLoop=!1,this.inXRSession=!1,this._engine=e.getEngine(),this._onEngineDisposedObserver=this._engine.onDisposeObservable.addOnce((function(){t._engine=null})),e.onDisposeObservable.addOnce((function(){t.dispose()}))}return Object.defineProperty(e.prototype,\"referenceSpace\",{get:function(){return this._referenceSpace},set:function(e){this._referenceSpace=e,this.onXRReferenceSpaceChanged.notifyObservers(this._referenceSpace)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"sessionMode\",{get:function(){return this._sessionMode},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){var e;this.inXRSession&&this.exitXRAsync(),this.onXRFrameObservable.clear(),this.onXRSessionEnded.clear(),this.onXRReferenceSpaceChanged.clear(),this.onXRSessionInit.clear(),null===(e=this._engine)||void 0===e||e.onDisposeObservable.remove(this._onEngineDisposedObserver),this._engine=null},e.prototype.exitXRAsync=function(){return this.session&&this.inXRSession?(this.inXRSession=!1,this.session.end().catch((function(){Q.Warn(\"Could not end XR session.\")}))):Promise.resolve()},e.prototype.trySetViewportForView=function(e,t){var i;return(null===(i=this._baseLayerRTTProvider)||void 0===i?void 0:i.trySetViewportForView(e,t))||!1},e.prototype.getRenderTargetTextureForEye=function(e){var t;return(null===(t=this._baseLayerRTTProvider)||void 0===t?void 0:t.getRenderTargetTextureForEye(e))||null},e.prototype.getRenderTargetTextureForView=function(e){var t;return(null===(t=this._baseLayerRTTProvider)||void 0===t?void 0:t.getRenderTargetTextureForView(e))||null},e.prototype.getWebXRRenderTarget=function(e){var t=this.scene.getEngine();return this._xrNavigator.xr.native?new rc(this):((e=e||ec.GetDefaults(t)).canvasElement=e.canvasElement||t.getRenderingCanvas()||void 0,new tc(this,e))},e.prototype.initializeAsync=function(){return this._xrNavigator=navigator,this._xrNavigator.xr?Promise.resolve():Promise.reject(\"WebXR not available\")},e.prototype.initializeSessionAsync=function(e,t){var i=this;return void 0===e&&(e=\"immersive-vr\"),void 0===t&&(t={}),this._xrNavigator.xr.requestSession(e,t).then((function(t){return i.session=t,i._sessionMode=e,i.onXRSessionInit.notifyObservers(t),i.inXRSession=!0,i.session.addEventListener(\"end\",(function(){var e;i.inXRSession=!1,i.onXRSessionEnded.notifyObservers(null),i._engine&&(i._engine.framebufferDimensionsObject=null,i._engine.restoreDefaultFramebuffer(),i._engine.customAnimationFrameRequester=null,i._engine._renderLoop()),i.isNative&&(null===(e=i._baseLayerRTTProvider)||void 0===e||e.dispose()),i._baseLayerRTTProvider=null,i._baseLayerWrapper=null}),{once:!0}),i.session}))},e.prototype.isSessionSupportedAsync=function(t){return e.IsSessionSupportedAsync(t)},e.prototype.resetReferenceSpace=function(){this.referenceSpace=this.baseReferenceSpace},e.prototype.runXRRenderLoop=function(){var e,t=this;this.inXRSession&&this._engine&&(this._engine.customAnimationFrameRequester={requestAnimationFrame:this.session.requestAnimationFrame.bind(this.session),renderFunction:function(e,i){var n;t.inXRSession&&t._engine&&(t.currentFrame=i,t.currentTimestamp=e,i&&(t.inXRFrameLoop=!0,t._engine.framebufferDimensionsObject=(null===(n=t._baseLayerRTTProvider)||void 0===n?void 0:n.getFramebufferDimensions())||null,t.onXRFrameObservable.notifyObservers(i),t._engine._renderLoop(),t._engine.framebufferDimensionsObject=null,t.inXRFrameLoop=!1))}},this._engine.framebufferDimensionsObject=(null===(e=this._baseLayerRTTProvider)||void 0===e?void 0:e.getFramebufferDimensions())||null,\"undefined\"!=typeof window&&window.cancelAnimationFrame&&window.cancelAnimationFrame(this._engine._frameHandler),this._engine._renderLoop())},e.prototype.setReferenceSpaceTypeAsync=function(e){var t=this;return void 0===e&&(e=\"local-floor\"),this.session.requestReferenceSpace(e).then((function(e){return e}),(function(e){return Q.Error(\"XR.requestReferenceSpace failed for the following reason: \"),Q.Error(e),Q.Log('Defaulting to universally-supported \"viewer\" reference space type.'),t.session.requestReferenceSpace(\"viewer\").then((function(e){var i=new XRRigidTransform({x:0,y:-t.defaultHeightCompensation,z:0});return e.getOffsetReferenceSpace(i)}),(function(e){throw Q.Error(e),'XR initialization failed: required \"viewer\" reference space type not supported.'}))})).then((function(e){return t.session.requestReferenceSpace(\"viewer\").then((function(i){return t.viewerReferenceSpace=i,e}))})).then((function(e){return t.referenceSpace=t.baseReferenceSpace=e,t.referenceSpace}))},e.prototype.updateRenderStateAsync=function(e){return Promise.resolve(this.session.updateRenderState(e))},e.prototype._setBaseLayerWrapper=function(e){var t,i;this.isNative&&(null===(t=this._baseLayerRTTProvider)||void 0===t||t.dispose()),this._baseLayerWrapper=e,this._baseLayerRTTProvider=(null===(i=this._baseLayerWrapper)||void 0===i?void 0:i.createRenderTargetTextureProvider(this))||null},e.prototype.updateRenderState=function(e){e.baseLayer&&this._setBaseLayerWrapper(this.isNative?new ic(e.baseLayer):new Jl(e.baseLayer)),this.session.updateRenderState(e)},e.IsSessionSupportedAsync=function(e){if(!navigator.xr)return Promise.resolve(!1);var t=navigator.xr.isSessionSupported||navigator.xr.supportsSession;return t?t.call(navigator.xr,e).then((function(e){var t=void 0===e||e;return Promise.resolve(t)})).catch((function(e){return Q.Warn(e),Promise.resolve(!1)})):Promise.resolve(!1)},Object.defineProperty(e.prototype,\"isNative\",{get:function(){var e;return null!==(e=this._xrNavigator.xr.native)&&void 0!==e&&e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"currentFrameRate\",{get:function(){var e;return null===(e=this.session)||void 0===e?void 0:e.frameRate},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"supportedFrameRates\",{get:function(){var e;return null===(e=this.session)||void 0===e?void 0:e.supportedFrameRates},enumerable:!1,configurable:!0}),e.prototype.updateTargetFrameRate=function(e){return this.session.updateTargetFrameRate(e)},e.prototype.runInXRFrame=function(e,t){void 0===t&&(t=!0),this.inXRFrameLoop?e():!this.inXRSession&&t||this.onXRFrameObservable.addOnce(e)},Object.defineProperty(e.prototype,\"isFixedFoveationSupported\",{get:function(){var e;return(null===(e=this._baseLayerWrapper)||void 0===e?void 0:e.isFixedFoveationSupported)||!1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"fixedFoveation\",{get:function(){var e;return(null===(e=this._baseLayerWrapper)||void 0===e?void 0:e.fixedFoveation)||null},set:function(e){var t=Math.max(0,Math.min(1,e||0));this._baseLayerWrapper&&(this._baseLayerWrapper.fixedFoveation=t)},enumerable:!1,configurable:!0}),e}();function ac(e){var t=e.height||2,i=0===e.diameterTop?0:e.diameterTop||e.diameter||1,n=0===e.diameterBottom?0:e.diameterBottom||e.diameter||1;i=i||1e-5,n=n||1e-5;var r,o=e.tessellation||24,a=e.subdivisions||1,s=!!e.hasRings,l=!!e.enclose,c=0===e.cap?0:e.cap||Ur.CAP_ALL,u=e.arc&&(e.arc<=0||e.arc>1)?1:e.arc||1,h=0===e.sideOrientation?0:e.sideOrientation||$n.DEFAULTSIDE,d=e.faceUV||new Array(3),p=e.faceColors,f=2+(1+(1!==u&&l?2:0))*(s?a:1);for(r=0;r=this._maxX||t<=this._minZ||t>this._maxZ)return this.position.y;this._heightQuads&&0!=this._heightQuads.length||(this._initHeightQuads(),this._computeHeightQuads());var o=this._getFacetAt(e,t),a=-(o.x*e+o.z*t+o.w)/o.y;return x.TransformCoordinatesFromFloatsToRef(0,a,0,i,r),r.y},t.prototype.getNormalAtCoordinates=function(e,t){var i=new x(0,1,0);return this.getNormalAtCoordinatesToRef(e,t,i),i},t.prototype.getNormalAtCoordinatesToRef=function(e,t,i){var n=this.getWorldMatrix(),r=O.Matrix[5];n.invertToRef(r);var o=O.Vector3[8];if(x.TransformCoordinatesFromFloatsToRef(e,0,t,r,o),e=o.x,t=o.z,ethis._maxX||tthis._maxZ)return this;this._heightQuads&&0!=this._heightQuads.length||(this._initHeightQuads(),this._computeHeightQuads());var a=this._getFacetAt(e,t);return x.TransformNormalFromFloatsToRef(a.x,a.y,a.z,n,i),this},t.prototype.updateCoordinateHeights=function(){return this._heightQuads&&0!=this._heightQuads.length||this._initHeightQuads(),this._computeHeightQuads(),this},t.prototype._getFacetAt=function(e,t){var i=Math.floor((e+this._maxX)*this._subdivisionsX/this._width),n=Math.floor(-(t+this._maxZ)*this._subdivisionsY/this._height+this._subdivisionsY),r=this._heightQuads[n*this._subdivisionsX+i];return te.maxHeight){c=!0;var u=e.maxHeight;e.maxHeight=e.minHeight,e.minHeight=u}for(t=0;t<=e.subdivisions;t++)for(i=0;i<=e.subdivisions;i++){var h=new x(i*e.width/e.subdivisions-e.width/2,0,(e.subdivisions-t)*e.height/e.subdivisions-e.height/2),d=4*(((h.x+e.width/2)/e.width*(e.bufferWidth-1)|0)+((1-(h.z+e.height/2)/e.height)*(e.bufferHeight-1)|0)*e.bufferWidth),p=e.buffer[d]/255,f=e.buffer[d+1]/255,m=e.buffer[d+2]/255,g=e.buffer[d+3]/255;c&&(p=1-p,f=1-f,m=1-m);var v=p*s.r+f*s.g+m*s.b;h.y=g>=l?e.minHeight+(e.maxHeight-e.minHeight)*v:e.minHeight-_,r.push(h.x,h.y,h.z),o.push(0,0,0),a.push(i/e.subdivisions,1-t/e.subdivisions)}for(t=0;t=e.minHeight,A=r[3*b+1]>=e.minHeight,R=r[3*T+1]>=e.minHeight;S&&A&&R&&(n.push(y),n.push(b),n.push(T)),r[3*E+1]>=e.minHeight&&S&&R&&(n.push(E),n.push(y),n.push(T))}$n.ComputeNormals(r,n,o);var C=new $n;return C.indices=n,C.positions=r,C.normals=o,C.uvs=a,C}function mc(e,t,i){void 0===t&&(t={});var n=new dc(e,i);return n._setReady(!1),n._subdivisionsX=t.subdivisionsX||t.subdivisions||1,n._subdivisionsY=t.subdivisionsY||t.subdivisions||1,n._width=t.width||1,n._height=t.height||1,n._maxX=n._width/2,n._maxZ=n._height/2,n._minX=-n._maxX,n._minZ=-n._maxZ,pc(t).applyToMesh(n,t.updatable),n._setReady(!0),n}function gc(e,t,i){void 0===i&&(i=null);var n=new Ur(e,i);return fc(t).applyToMesh(n,t.updatable),n}function vc(e,t,i,n){void 0===i&&(i={}),void 0===n&&(n=null);var r=i.width||10,o=i.height||10,a=i.subdivisions||1,s=i.minHeight||0,l=i.maxHeight||1,c=i.colorFilter||new N(.3,.59,.11),u=i.alphaFilter||0,h=i.updatable,d=i.onReady;n=n||S.LastCreatedScene;var p=new dc(e,n);return p._subdivisionsX=a,p._subdivisionsY=a,p._width=r,p._height=o,p._maxX=p._width/2,p._maxZ=p._height/2,p._minX=-p._maxX,p._minZ=-p._maxZ,p._setReady(!1),mi.LoadImage(t,(function(e){var t=e.width,i=e.height;if(!n.isDisposed){var f=null==n?void 0:n.getEngine().resizeImageBitmap(e,t,i);_c({width:r,height:o,subdivisions:a,minHeight:s,maxHeight:l,colorFilter:c,buffer:f,bufferWidth:t,bufferHeight:i,alphaFilter:u}).applyToMesh(p,h),d&&d(p),p._setReady(!0)}}),(function(){}),n.offlineProvider),p}var yc={CreateGround:mc,CreateGroundFromHeightMap:vc,CreateTiledGround:gc};$n.CreateGround=pc,$n.CreateTiledGround=fc,$n.CreateGroundFromHeightMap=_c,Ur.CreateGround=function(e,t,i,n,r,o){return mc(e,{width:t,height:i,subdivisions:n,updatable:o},r)},Ur.CreateTiledGround=function(e,t,i,n,r,o,a,s,l){return gc(e,{xmin:t,zmin:i,xmax:n,zmax:r,subdivisions:o,precision:a,updatable:l},s)},Ur.CreateGroundFromHeightMap=function(e,t,i,n,r,o,a,s,l,c,u){return vc(e,t,{width:i,height:n,subdivisions:r,minHeight:o,maxHeight:a,updatable:l,onReady:c,alphaFilter:u},s)};var bc,Tc=function(){function e(t,i){if(void 0===i&&(i=null),this.scene=t,this._pointerDownOnMeshAsked=!1,this._isActionableMesh=!1,this._teleportationRequestInitiated=!1,this._teleportationBackRequestInitiated=!1,this._rotationRightAsked=!1,this._rotationLeftAsked=!1,this._dpadPressed=!0,this._activePointer=!1,this._id=e._IdCounter++,i)this._gazeTracker=i.clone(\"gazeTracker\");else{this._gazeTracker=uc(\"gazeTracker\",{diameter:.0035,thickness:.0025,tessellation:20,updatable:!1},t),this._gazeTracker.bakeCurrentTransformIntoVertices(),this._gazeTracker.isPickable=!1,this._gazeTracker.isVisible=!1;var n=new Xl(\"targetMat\",t);n.specularColor=N.Black(),n.emissiveColor=new N(.7,.7,.7),n.backFaceCulling=!1,this._gazeTracker.material=n}}return e.prototype._getForwardRay=function(e){return new fo(x.Zero(),new x(0,0,e))},e.prototype._selectionPointerDown=function(){this._pointerDownOnMeshAsked=!0,this._currentHit&&this.scene.simulatePointerDown(this._currentHit,{pointerId:this._id})},e.prototype._selectionPointerUp=function(){this._currentHit&&this.scene.simulatePointerUp(this._currentHit,{pointerId:this._id}),this._pointerDownOnMeshAsked=!1},e.prototype._activatePointer=function(){this._activePointer=!0},e.prototype._deactivatePointer=function(){this._activePointer=!1},e.prototype._updatePointerDistance=function(e){void 0===e&&(e=100)},e.prototype.dispose=function(){this._interactionsEnabled=!1,this._teleportationEnabled=!1,this._gazeTracker&&this._gazeTracker.dispose()},e._IdCounter=0,e}(),Ec=function(e){function t(t,i,n){var r=e.call(this,i,n)||this;r.webVRController=t,r._laserPointer=sc(\"laserPointer\",{updatable:!1,height:1,diameterTop:.004,diameterBottom:2e-4,tessellation:20,subdivisions:1},i);var o=new Xl(\"laserPointerMat\",i);if(o.emissiveColor=new N(.7,.7,.7),o.alpha=.6,r._laserPointer.material=o,r._laserPointer.rotation.x=Math.PI/2,r._laserPointer.position.z=-.5,r._laserPointer.isVisible=!1,r._laserPointer.isPickable=!1,!t.mesh){var a=new Ur(\"preloadControllerMesh\",i),s=new Ur(Xs.POINTING_POSE,i);s.rotation.x=-.7,a.addChild(s),t.attachToMesh(a)}return r._setLaserPointerParent(t.mesh),r._meshAttachedObserver=t._meshAttachedObservable.add((function(e){r._setLaserPointerParent(e)})),r}return V(t,e),t.prototype._getForwardRay=function(e){return this.webVRController.getForwardRay(e)},t.prototype._activatePointer=function(){e.prototype._activatePointer.call(this),this._laserPointer.isVisible=!0},t.prototype._deactivatePointer=function(){e.prototype._deactivatePointer.call(this),this._laserPointer.isVisible=!1},t.prototype._setLaserPointerColor=function(e){this._laserPointer.material.emissiveColor=e},t.prototype._setLaserPointerLightingDisabled=function(e){this._laserPointer.material.disableLighting=e},t.prototype._setLaserPointerParent=function(e){var t=function(e){e.isPickable=!1,e.getChildMeshes().forEach((function(e){t(e)}))};t(e);var i=e.getChildren(void 0,!1),n=e;this.webVRController._pointingPoseNode=null;for(var r=0;r=0){n=i[r],this.webVRController._pointingPoseNode=n;break}this._laserPointer.parent=n},t.prototype._updatePointerDistance=function(e){void 0===e&&(e=100),this._laserPointer.scaling.y=e,this._laserPointer.position.z=-e/2},t.prototype.dispose=function(){e.prototype.dispose.call(this),this._laserPointer.dispose(),this._meshAttachedObserver&&this.webVRController._meshAttachedObservable.remove(this._meshAttachedObserver)},t}(Tc),Sc=function(e){function t(t,i){var n=e.call(this,i)||this;return n._getCamera=t,n}return V(t,e),t.prototype._getForwardRay=function(e){var t=this._getCamera();return t?t.getForwardRay(e):new fo(x.Zero(),x.Forward())},t}(Tc),Ac=function(){},Rc=function(){function e(t,i){void 0===i&&(i={});var n=this;if(this.webVROptions=i,this._webVRsupported=!1,this._webVRready=!1,this._webVRrequesting=!1,this._webVRpresenting=!1,this._fullscreenVRpresenting=!1,this.enableGazeEvenWhenNoPointerLock=!1,this.exitVROnDoubleTap=!0,this.onEnteringVRObservable=new u,this.onAfterEnteringVRObservable=new u,this.onExitingVRObservable=new u,this.onControllerMeshLoadedObservable=new u,this._useCustomVRButton=!1,this._teleportationRequested=!1,this._teleportActive=!1,this._floorMeshesCollection=[],this._teleportationMode=e.TELEPORTATIONMODE_CONSTANTTIME,this._teleportationTime=122,this._teleportationSpeed=20,this._rotationAllowed=!0,this._teleportBackwardsVector=new x(0,-1,-1),this._isDefaultTeleportationTarget=!0,this._teleportationFillColor=\"#444444\",this._teleportationBorderColor=\"#FFFFFF\",this._rotationAngle=0,this._haloCenter=new x(0,0,0),this._padSensibilityUp=.65,this._padSensibilityDown=.35,this._leftController=null,this._rightController=null,this._gazeColor=new N(.7,.7,.7),this._laserColor=new N(.7,.7,.7),this._pickedLaserColor=new N(.2,.2,1),this._pickedGazeColor=new N(0,0,1),this.onNewMeshSelected=new u,this.onMeshSelectedWithController=new u,this.onNewMeshPicked=new u,this.onBeforeCameraTeleport=new u,this.onAfterCameraTeleport=new u,this.onSelectedMeshUnselected=new u,this.teleportationEnabled=!0,this._teleportationInitialized=!1,this._interactionsEnabled=!1,this._interactionsRequested=!1,this._displayGaze=!0,this._displayLaserPointer=!0,this.updateGazeTrackerScale=!0,this.updateGazeTrackerColor=!0,this.updateControllerLaserColor=!0,this.requestPointerLockOnFullScreen=!0,this.xrTestDone=!1,this._onResize=function(){n._moveButtonToBottomRight(),n._fullscreenVRpresenting&&n._webVRready&&n.exitVR()},this._onFullscreenChange=function(){n._fullscreenVRpresenting=!!document.fullscreenElement,!n._fullscreenVRpresenting&&n._inputElement&&(n.exitVR(),!n._useCustomVRButton&&n._btnVR&&(n._btnVR.style.top=n._inputElement.offsetTop+n._inputElement.offsetHeight-70+\"px\",n._btnVR.style.left=n._inputElement.offsetLeft+n._inputElement.offsetWidth-100+\"px\",n._updateButtonVisibility()))},this._cachedAngularSensibility={angularSensibilityX:null,angularSensibilityY:null,angularSensibility:null},this._beforeRender=function(){n._leftController&&n._leftController._activePointer&&n._castRayAndSelectObject(n._leftController),n._rightController&&n._rightController._activePointer&&n._castRayAndSelectObject(n._rightController),n._noControllerIsActive&&(n._scene.getEngine().isPointerLock||n.enableGazeEvenWhenNoPointerLock)?n._castRayAndSelectObject(n._cameraGazer):n._cameraGazer._gazeTracker.isVisible=!1},this._onNewGamepadConnected=function(e){if(e.type!==ss.POSE_ENABLED)e.leftStick&&e.onleftstickchanged((function(e){n._teleportationInitialized&&n.teleportationEnabled&&(!n._leftController&&!n._rightController||n._leftController&&!n._leftController._activePointer&&n._rightController&&!n._rightController._activePointer)&&(n._checkTeleportWithRay(e,n._cameraGazer),n._checkTeleportBackwards(e,n._cameraGazer))})),e.rightStick&&e.onrightstickchanged((function(e){n._teleportationInitialized&&n._checkRotate(e,n._cameraGazer)})),e.type===ss.XBOX&&(e.onbuttondown((function(e){n._interactionsEnabled&&e===zs.A&&n._cameraGazer._selectionPointerDown()})),e.onbuttonup((function(e){n._interactionsEnabled&&e===zs.A&&n._cameraGazer._selectionPointerUp()})));else{var t=e,i=new Ec(t,n._scene,n._cameraGazer._gazeTracker);\"right\"===t.hand||n._leftController&&n._leftController.webVRController!=t?n._rightController=i:n._leftController=i,n._tryEnableInteractionOnController(i)}},this._tryEnableInteractionOnController=function(e){n._interactionsRequested&&!e._interactionsEnabled&&n._enableInteractionOnController(e),n._teleportationRequested&&!e._teleportationEnabled&&n._enableTeleportationOnController(e)},this._onNewGamepadDisconnected=function(e){e instanceof Ol&&(\"left\"===e.hand&&null!=n._leftController&&(n._leftController.dispose(),n._leftController=null),\"right\"===e.hand&&null!=n._rightController&&(n._rightController.dispose(),n._rightController=null))},this._workingVector=x.Zero(),this._workingQuaternion=P.Identity(),this._workingMatrix=M.Identity(),Q.Warn(\"WebVR is deprecated. Please avoid using this experience helper and use the WebXR experience helper instead\"),this._scene=t,this._inputElement=t.getEngine().getInputElement(),\"getVRDisplays\"in navigator||void 0!==i.useXR||(i.useXR=!0),void 0===i.createFallbackVRDeviceOrientationFreeCamera&&(i.createFallbackVRDeviceOrientationFreeCamera=!0),void 0===i.createDeviceOrientationCamera&&(i.createDeviceOrientationCamera=!0),void 0===i.laserToggle&&(i.laserToggle=!0),void 0===i.defaultHeight&&(i.defaultHeight=1.7),i.useCustomVRButton&&(this._useCustomVRButton=!0,i.customVRButton&&(this._btnVR=i.customVRButton)),i.rayLength&&(this._rayLength=i.rayLength),this._defaultHeight=i.defaultHeight,i.positionScale&&(this._rayLength*=i.positionScale,this._defaultHeight*=i.positionScale),this._hasEnteredVR=!1,this._scene.activeCamera?this._position=this._scene.activeCamera.position.clone():this._position=new x(0,this._defaultHeight,0),i.createDeviceOrientationCamera||!this._scene.activeCamera){if(this._deviceOrientationCamera=new Fs(\"deviceOrientationVRHelper\",this._position.clone(),t),this._scene.activeCamera&&(this._deviceOrientationCamera.minZ=this._scene.activeCamera.minZ,this._deviceOrientationCamera.maxZ=this._scene.activeCamera.maxZ,this._scene.activeCamera instanceof Os&&this._scene.activeCamera.rotation)){var r=this._scene.activeCamera;r.rotationQuaternion?this._deviceOrientationCamera.rotationQuaternion.copyFrom(r.rotationQuaternion):this._deviceOrientationCamera.rotationQuaternion.copyFrom(P.RotationYawPitchRoll(r.rotation.y,r.rotation.x,r.rotation.z)),this._deviceOrientationCamera.rotation=r.rotation.clone()}this._scene.activeCamera=this._deviceOrientationCamera,this._inputElement&&this._scene.activeCamera.attachControl()}else this._existingCamera=this._scene.activeCamera;this.webVROptions.useXR&&navigator.xr?oc.IsSessionSupportedAsync(\"immersive-vr\").then((function(e){e?(Q.Log(\"Using WebXR. It is recommended to use the WebXRDefaultExperience directly\"),t.createDefaultXRExperienceAsync({floorMeshes:i.floorMeshes||[]}).then((function(e){n.xr=e,n.xrTestDone=!0,n._cameraGazer=new Sc((function(){return n.xr.baseExperience.camera}),t),n.xr.baseExperience.onStateChangedObservable.add((function(e){switch(e){case Yl.ENTERING_XR:n.onEnteringVRObservable.notifyObservers(n),n._interactionsEnabled||n.xr.pointerSelection.detach(),n.xr.pointerSelection.displayLaserPointer=n._displayLaserPointer;break;case Yl.EXITING_XR:n.onExitingVRObservable.notifyObservers(n),n._scene.getEngine().resize();break;case Yl.IN_XR:n._hasEnteredVR=!0;break;case Yl.NOT_IN_XR:n._hasEnteredVR=!1}}))}))):n._completeVRInit(t,i)})):this._completeVRInit(t,i)}return Object.defineProperty(e.prototype,\"onEnteringVR\",{get:function(){return this.onEnteringVRObservable},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"onExitingVR\",{get:function(){return this.onExitingVRObservable},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"onControllerMeshLoaded\",{get:function(){return this.onControllerMeshLoadedObservable},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"teleportationTarget\",{get:function(){return this._teleportationTarget},set:function(e){e&&(e.name=\"teleportationTarget\",this._isDefaultTeleportationTarget=!1,this._teleportationTarget=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"gazeTrackerMesh\",{get:function(){return this._cameraGazer._gazeTracker},set:function(e){e&&(this._cameraGazer._gazeTracker&&this._cameraGazer._gazeTracker.dispose(),this._leftController&&this._leftController._gazeTracker&&this._leftController._gazeTracker.dispose(),this._rightController&&this._rightController._gazeTracker&&this._rightController._gazeTracker.dispose(),this._cameraGazer._gazeTracker=e,this._cameraGazer._gazeTracker.bakeCurrentTransformIntoVertices(),this._cameraGazer._gazeTracker.isPickable=!1,this._cameraGazer._gazeTracker.isVisible=!1,this._cameraGazer._gazeTracker.name=\"gazeTracker\",this._leftController&&(this._leftController._gazeTracker=this._cameraGazer._gazeTracker.clone(\"gazeTracker\")),this._rightController&&(this._rightController._gazeTracker=this._cameraGazer._gazeTracker.clone(\"gazeTracker\")))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"leftControllerGazeTrackerMesh\",{get:function(){return this._leftController?this._leftController._gazeTracker:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"rightControllerGazeTrackerMesh\",{get:function(){return this._rightController?this._rightController._gazeTracker:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"displayGaze\",{get:function(){return this._displayGaze},set:function(e){this._displayGaze=e,e||(this._cameraGazer._gazeTracker.isVisible=!1,this._leftController&&(this._leftController._gazeTracker.isVisible=!1),this._rightController&&(this._rightController._gazeTracker.isVisible=!1))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"displayLaserPointer\",{get:function(){return this._displayLaserPointer},set:function(e){this._displayLaserPointer=e,e?(this._rightController&&this._rightController._activatePointer(),this._leftController&&this._leftController._activatePointer()):(this._rightController&&(this._rightController._deactivatePointer(),this._rightController._gazeTracker.isVisible=!1),this._leftController&&(this._leftController._deactivatePointer(),this._leftController._gazeTracker.isVisible=!1))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"deviceOrientationCamera\",{get:function(){return this._deviceOrientationCamera},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"currentVRCamera\",{get:function(){return this._webVRready?this._webVRCamera:this._scene.activeCamera},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"webVRCamera\",{get:function(){return this._webVRCamera},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"vrDeviceOrientationCamera\",{get:function(){return this._vrDeviceOrientationCamera},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"vrButton\",{get:function(){return this._btnVR},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"_teleportationRequestInitiated\",{get:function(){return this._cameraGazer._teleportationRequestInitiated||null!==this._leftController&&this._leftController._teleportationRequestInitiated||null!==this._rightController&&this._rightController._teleportationRequestInitiated},enumerable:!1,configurable:!0}),e.prototype._completeVRInit=function(e,t){var i=this;if(this.xrTestDone=!0,t.createFallbackVRDeviceOrientationFreeCamera&&(t.useMultiview&&(t.vrDeviceOrientationCameraMetrics||(t.vrDeviceOrientationCameraMetrics=gl.GetDefault()),t.vrDeviceOrientationCameraMetrics.multiviewEnabled=!0),this._vrDeviceOrientationCamera=new Rl(\"VRDeviceOrientationVRHelper\",this._position,this._scene,!0,t.vrDeviceOrientationCameraMetrics),this._vrDeviceOrientationCamera.angularSensibility=Number.MAX_VALUE),this._webVRCamera=new Il(\"WebVRHelper\",this._position,this._scene,t),this._webVRCamera.useStandingMatrix(),this._cameraGazer=new Sc((function(){return i.currentVRCamera}),e),!this._useCustomVRButton){this._btnVR=document.createElement(\"BUTTON\"),this._btnVR.className=\"babylonVRicon\",this._btnVR.id=\"babylonVRiconbtn\",this._btnVR.title=\"Click to switch to VR\";var n=\".babylonVRicon { position: absolute; right: 20px; height: 50px; width: 80px; background-color: rgba(51,51,51,0.7); background-image: url(\"+(window.SVGSVGElement?\"data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%222048%22%20height%3D%221152%22%20viewBox%3D%220%200%202048%201152%22%20version%3D%221.1%22%3E%3Cpath%20transform%3D%22rotate%28180%201024%2C576.0000000000001%29%22%20d%3D%22m1109%2C896q17%2C0%2030%2C-12t13%2C-30t-12.5%2C-30.5t-30.5%2C-12.5l-170%2C0q-18%2C0%20-30.5%2C12.5t-12.5%2C30.5t13%2C30t30%2C12l170%2C0zm-85%2C256q59%2C0%20132.5%2C-1.5t154.5%2C-5.5t164.5%2C-11.5t163%2C-20t150%2C-30t124.5%2C-41.5q23%2C-11%2042%2C-24t38%2C-30q27%2C-25%2041%2C-61.5t14%2C-72.5l0%2C-257q0%2C-123%20-47%2C-232t-128%2C-190t-190%2C-128t-232%2C-47l-81%2C0q-37%2C0%20-68.5%2C14t-60.5%2C34.5t-55.5%2C45t-53%2C45t-53%2C34.5t-55.5%2C14t-55.5%2C-14t-53%2C-34.5t-53%2C-45t-55.5%2C-45t-60.5%2C-34.5t-68.5%2C-14l-81%2C0q-123%2C0%20-232%2C47t-190%2C128t-128%2C190t-47%2C232l0%2C257q0%2C68%2038%2C115t97%2C73q54%2C24%20124.5%2C41.5t150%2C30t163%2C20t164.5%2C11.5t154.5%2C5.5t132.5%2C1.5zm939%2C-298q0%2C39%20-24.5%2C67t-58.5%2C42q-54%2C23%20-122%2C39.5t-143.5%2C28t-155.5%2C19t-157%2C11t-148.5%2C5t-129.5%2C1.5q-59%2C0%20-130%2C-1.5t-148%2C-5t-157%2C-11t-155.5%2C-19t-143.5%2C-28t-122%2C-39.5q-34%2C-14%20-58.5%2C-42t-24.5%2C-67l0%2C-257q0%2C-106%2040.5%2C-199t110%2C-162.5t162.5%2C-109.5t199%2C-40l81%2C0q27%2C0%2052%2C14t50%2C34.5t51%2C44.5t55.5%2C44.5t63.5%2C34.5t74%2C14t74%2C-14t63.5%2C-34.5t55.5%2C-44.5t51%2C-44.5t50%2C-34.5t52%2C-14l14%2C0q37%2C0%2070%2C0.5t64.5%2C4.5t63.5%2C12t68%2C23q71%2C30%20128.5%2C78.5t98.5%2C110t63.5%2C133.5t22.5%2C149l0%2C257z%22%20fill%3D%22white%22%20/%3E%3C/svg%3E%0A\":\"https://cdn.babylonjs.com/Assets/vrButton.png\")+\"); background-size: 80%; background-repeat:no-repeat; background-position: center; border: none; outline: none; transition: transform 0.125s ease-out } .babylonVRicon:hover { transform: scale(1.05) } .babylonVRicon:active {background-color: rgba(51,51,51,1) } .babylonVRicon:focus {background-color: rgba(51,51,51,1) }\";n+=\".babylonVRicon.vrdisplaypresenting { display: none; }\";var r=document.createElement(\"style\");r.appendChild(document.createTextNode(n)),document.getElementsByTagName(\"head\")[0].appendChild(r),this._moveButtonToBottomRight()}this._btnVR&&this._btnVR.addEventListener(\"click\",(function(){i.isInVRMode?i._scene.getEngine().disableVR():i.enterVR()}));var o=this._scene.getEngine().getHostWindow();o&&(o.addEventListener(\"resize\",this._onResize),document.addEventListener(\"fullscreenchange\",this._onFullscreenChange,!1),t.createFallbackVRDeviceOrientationFreeCamera?this._displayVRButton():this._scene.getEngine().onVRDisplayChangedObservable.add((function(e){e.vrDisplay&&i._displayVRButton()})),this._onKeyDown=function(e){27===e.keyCode&&i.isInVRMode&&i.exitVR()},document.addEventListener(\"keydown\",this._onKeyDown),this._scene.onPrePointerObservable.add((function(){i._hasEnteredVR&&i.exitVROnDoubleTap&&(i.exitVR(),i._fullscreenVRpresenting&&i._scene.getEngine().exitFullscreen())}),Hi.POINTERDOUBLETAP,!1),this._onVRDisplayChangedBind=function(e){return i._onVRDisplayChanged(e)},this._onVrDisplayPresentChangeBind=function(){return i._onVrDisplayPresentChange()},this._onVRRequestPresentStart=function(){i._webVRrequesting=!0,i._updateButtonVisibility()},this._onVRRequestPresentComplete=function(){i._webVRrequesting=!1,i._updateButtonVisibility()},e.getEngine().onVRDisplayChangedObservable.add(this._onVRDisplayChangedBind),e.getEngine().onVRRequestPresentStart.add(this._onVRRequestPresentStart),e.getEngine().onVRRequestPresentComplete.add(this._onVRRequestPresentComplete),o.addEventListener(\"vrdisplaypresentchange\",this._onVrDisplayPresentChangeBind),e.onDisposeObservable.add((function(){i.dispose()})),this._webVRCamera.onControllerMeshLoadedObservable.add((function(e){return i._onDefaultMeshLoaded(e)})),this._scene.gamepadManager.onGamepadConnectedObservable.add(this._onNewGamepadConnected),this._scene.gamepadManager.onGamepadDisconnectedObservable.add(this._onNewGamepadDisconnected),this._updateButtonVisibility(),this._circleEase=new In,this._circleEase.setEasingMode(Mn.EASINGMODE_EASEINOUT),this._teleportationEasing=this._circleEase,e.onPointerObservable.add((function(t){i._interactionsEnabled&&e.activeCamera===i.vrDeviceOrientationCamera&&\"mouse\"===t.event.pointerType&&(t.type===Hi.POINTERDOWN?i._cameraGazer._selectionPointerDown():t.type===Hi.POINTERUP&&i._cameraGazer._selectionPointerUp())})),this.webVROptions.floorMeshes&&this.enableTeleportation({floorMeshes:this.webVROptions.floorMeshes}))},e.prototype._onDefaultMeshLoaded=function(e){this._leftController&&this._leftController.webVRController==e&&e.mesh&&this._leftController._setLaserPointerParent(e.mesh),this._rightController&&this._rightController.webVRController==e&&e.mesh&&this._rightController._setLaserPointerParent(e.mesh);try{this.onControllerMeshLoadedObservable.notifyObservers(e)}catch(e){Q.Warn(\"Error in your custom logic onControllerMeshLoaded: \"+e)}},Object.defineProperty(e.prototype,\"isInVRMode\",{get:function(){return this.xr&&this.webVROptions.useXR&&this.xr.baseExperience.state===Yl.IN_XR||this._webVRpresenting||this._fullscreenVRpresenting},enumerable:!1,configurable:!0}),e.prototype._onVrDisplayPresentChange=function(){var e=this._scene.getEngine().getVRDevice();if(e){var t=this._webVRpresenting;this._webVRpresenting=e.isPresenting,t&&!this._webVRpresenting&&this.exitVR()}else Q.Warn(\"Detected VRDisplayPresentChange on an unknown VRDisplay. Did you can enterVR on the vrExperienceHelper?\");this._updateButtonVisibility()},e.prototype._onVRDisplayChanged=function(e){this._webVRsupported=e.vrSupported,this._webVRready=!!e.vrDisplay,this._webVRpresenting=e.vrDisplay&&e.vrDisplay.isPresenting,this._updateButtonVisibility()},e.prototype._moveButtonToBottomRight=function(){if(this._inputElement&&!this._useCustomVRButton&&this._btnVR){var e=this._inputElement.getBoundingClientRect();this._btnVR.style.top=e.top+e.height-70+\"px\",this._btnVR.style.left=e.left+e.width-100+\"px\"}},e.prototype._displayVRButton=function(){this._useCustomVRButton||this._btnVRDisplayed||!this._btnVR||(document.body.appendChild(this._btnVR),this._btnVRDisplayed=!0)},e.prototype._updateButtonVisibility=function(){this._btnVR&&!this._useCustomVRButton&&(this._btnVR.className=\"babylonVRicon\",this.isInVRMode?this._btnVR.className+=\" vrdisplaypresenting\":(this._webVRready&&(this._btnVR.className+=\" vrdisplayready\"),this._webVRsupported&&(this._btnVR.className+=\" vrdisplaysupported\"),this._webVRrequesting&&(this._btnVR.className+=\" vrdisplayrequesting\")))},e.prototype.enterVR=function(){var e=this;if(this.xr)this.xr.baseExperience.enterXRAsync(\"immersive-vr\",\"local-floor\",this.xr.renderTarget);else{if(this.onEnteringVRObservable)try{this.onEnteringVRObservable.notifyObservers(this)}catch(e){Q.Warn(\"Error in your custom logic onEnteringVR: \"+e)}if(this._scene.activeCamera){if(this._position=this._scene.activeCamera.position.clone(),this.vrDeviceOrientationCamera&&(this.vrDeviceOrientationCamera.rotation=P.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles(),this.vrDeviceOrientationCamera.angularSensibility=2e3),this.webVRCamera){var t=this.webVRCamera.deviceRotationQuaternion.toEulerAngles().y,i=P.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles().y-t,n=this.webVRCamera.rotationQuaternion.toEulerAngles().y;this.webVRCamera.rotationQuaternion=P.FromEulerAngles(0,n+i,0)}this._existingCamera=this._scene.activeCamera,this._existingCamera.angularSensibilityX&&(this._cachedAngularSensibility.angularSensibilityX=this._existingCamera.angularSensibilityX,this._existingCamera.angularSensibilityX=Number.MAX_VALUE),this._existingCamera.angularSensibilityY&&(this._cachedAngularSensibility.angularSensibilityY=this._existingCamera.angularSensibilityY,this._existingCamera.angularSensibilityY=Number.MAX_VALUE),this._existingCamera.angularSensibility&&(this._cachedAngularSensibility.angularSensibility=this._existingCamera.angularSensibility,this._existingCamera.angularSensibility=Number.MAX_VALUE)}this._webVRrequesting||(this._webVRready?this._webVRpresenting||(this._scene.getEngine().onVRRequestPresentComplete.addOnce((function(t){e.onAfterEnteringVRObservable.notifyObservers({success:t})})),this._webVRCamera.position=this._position,this._scene.activeCamera=this._webVRCamera):this._vrDeviceOrientationCamera&&(this._vrDeviceOrientationCamera.position=this._position,this._scene.activeCamera&&(this._vrDeviceOrientationCamera.minZ=this._scene.activeCamera.minZ),this._scene.activeCamera=this._vrDeviceOrientationCamera,this._scene.getEngine().enterFullscreen(this.requestPointerLockOnFullScreen),this._updateButtonVisibility(),this._vrDeviceOrientationCamera.onViewMatrixChangedObservable.addOnce((function(){e.onAfterEnteringVRObservable.notifyObservers({success:!0})}))),this._scene.activeCamera&&this._inputElement&&this._scene.activeCamera.attachControl(),this._interactionsEnabled&&this._scene.registerBeforeRender(this._beforeRender),this._displayLaserPointer&&[this._leftController,this._rightController].forEach((function(e){e&&e._activatePointer()})),this._hasEnteredVR=!0)}},e.prototype.exitVR=function(){if(this.xr)this.xr.baseExperience.exitXRAsync();else if(this._hasEnteredVR){if(this.onExitingVRObservable)try{this.onExitingVRObservable.notifyObservers(this)}catch(e){Q.Warn(\"Error in your custom logic onExitingVR: \"+e)}this._webVRpresenting&&this._scene.getEngine().disableVR(),this._scene.activeCamera&&(this._position=this._scene.activeCamera.position.clone()),this.vrDeviceOrientationCamera&&(this.vrDeviceOrientationCamera.angularSensibility=Number.MAX_VALUE),this._deviceOrientationCamera?(this._deviceOrientationCamera.position=this._position,this._scene.activeCamera=this._deviceOrientationCamera,this._cachedAngularSensibility.angularSensibilityX&&(this._deviceOrientationCamera.angularSensibilityX=this._cachedAngularSensibility.angularSensibilityX,this._cachedAngularSensibility.angularSensibilityX=null),this._cachedAngularSensibility.angularSensibilityY&&(this._deviceOrientationCamera.angularSensibilityY=this._cachedAngularSensibility.angularSensibilityY,this._cachedAngularSensibility.angularSensibilityY=null),this._cachedAngularSensibility.angularSensibility&&(this._deviceOrientationCamera.angularSensibility=this._cachedAngularSensibility.angularSensibility,this._cachedAngularSensibility.angularSensibility=null)):this._existingCamera&&(this._existingCamera.position=this._position,this._scene.activeCamera=this._existingCamera,this._inputElement&&this._scene.activeCamera.attachControl(),this._cachedAngularSensibility.angularSensibilityX&&(this._existingCamera.angularSensibilityX=this._cachedAngularSensibility.angularSensibilityX,this._cachedAngularSensibility.angularSensibilityX=null),this._cachedAngularSensibility.angularSensibilityY&&(this._existingCamera.angularSensibilityY=this._cachedAngularSensibility.angularSensibilityY,this._cachedAngularSensibility.angularSensibilityY=null),this._cachedAngularSensibility.angularSensibility&&(this._existingCamera.angularSensibility=this._cachedAngularSensibility.angularSensibility,this._cachedAngularSensibility.angularSensibility=null)),this._updateButtonVisibility(),this._interactionsEnabled&&(this._scene.unregisterBeforeRender(this._beforeRender),this._cameraGazer._gazeTracker.isVisible=!1,this._leftController&&(this._leftController._gazeTracker.isVisible=!1),this._rightController&&(this._rightController._gazeTracker.isVisible=!1)),this._scene.getEngine().resize(),[this._leftController,this._rightController].forEach((function(e){e&&e._deactivatePointer()})),this._hasEnteredVR=!1;var e=this._scene.getEngine();e._onVrDisplayPresentChange&&e._onVrDisplayPresentChange()}},Object.defineProperty(e.prototype,\"position\",{get:function(){return this._position},set:function(e){this._position=e,this._scene.activeCamera&&(this._scene.activeCamera.position=e)},enumerable:!1,configurable:!0}),e.prototype.enableInteractions=function(){var e=this;if(!this._interactionsEnabled){if(this._interactionsRequested=!0,this.xr)return void(this.xr.baseExperience.state===Yl.IN_XR&&this.xr.pointerSelection.attach());this._leftController&&this._enableInteractionOnController(this._leftController),this._rightController&&this._enableInteractionOnController(this._rightController),this.raySelectionPredicate=function(t){return t.isVisible&&(t.isPickable||t.name===e._floorMeshName)},this.meshSelectionPredicate=function(){return!0},this._raySelectionPredicate=function(t){return!!(e._isTeleportationFloor(t)||-1===t.name.indexOf(\"gazeTracker\")&&-1===t.name.indexOf(\"teleportationTarget\")&&-1===t.name.indexOf(\"torusTeleportation\"))&&e.raySelectionPredicate(t)},this._interactionsEnabled=!0}},Object.defineProperty(e.prototype,\"_noControllerIsActive\",{get:function(){return!(this._leftController&&this._leftController._activePointer||this._rightController&&this._rightController._activePointer)},enumerable:!1,configurable:!0}),e.prototype._isTeleportationFloor=function(e){for(var t=0;t-1||this._floorMeshesCollection.push(e))},e.prototype.removeFloorMesh=function(e){if(this._floorMeshesCollection){var t=this._floorMeshesCollection.indexOf(e);-1!==t&&this._floorMeshesCollection.splice(t,1)}},e.prototype.enableTeleportation=function(e){var t=this;if(void 0===e&&(e={}),!this._teleportationInitialized){if(this._teleportationRequested=!0,this.enableInteractions(),this.webVROptions.useXR&&(e.floorMeshes||e.floorMeshName)){var i=e.floorMeshes||[];if(!i.length){var n=this._scene.getMeshByName(e.floorMeshName);n&&i.push(n)}if(this.xr)return i.forEach((function(e){t.xr.teleportation.addFloorMesh(e)})),void(this.xr.teleportation.attached||this.xr.teleportation.attach());if(!this.xrTestDone){var r=function(){t.xrTestDone&&(t._scene.unregisterBeforeRender(r),t.xr?t.xr.teleportation.attached||t.xr.teleportation.attach():t.enableTeleportation(e))};return void this._scene.registerBeforeRender(r)}}e.floorMeshName&&(this._floorMeshName=e.floorMeshName),e.floorMeshes&&(this._floorMeshesCollection=e.floorMeshes),e.teleportationMode&&(this._teleportationMode=e.teleportationMode),e.teleportationTime&&e.teleportationTime>0&&(this._teleportationTime=e.teleportationTime),e.teleportationSpeed&&e.teleportationSpeed>0&&(this._teleportationSpeed=e.teleportationSpeed),void 0!==e.easingFunction&&(this._teleportationEasing=e.easingFunction),null!=this._leftController&&this._enableTeleportationOnController(this._leftController),null!=this._rightController&&this._enableTeleportationOnController(this._rightController);var o=new Ri;o.vignetteColor=new L(0,0,0,0),o.vignetteEnabled=!0,this._postProcessMove=new Ql(\"postProcessMove\",1,this._webVRCamera,void 0,void 0,void 0,void 0,o),this._webVRCamera.detachPostProcess(this._postProcessMove),this._teleportationInitialized=!0,this._isDefaultTeleportationTarget&&(this._createTeleportationCircles(),this._teleportationTarget.scaling.scaleInPlace(this._webVRCamera.deviceScaleFactor))}},e.prototype._enableInteractionOnController=function(e){var t=this;e.webVRController.mesh&&(e._interactionsEnabled=!0,this.isInVRMode&&this._displayLaserPointer&&e._activatePointer(),this.webVROptions.laserToggle&&e.webVRController.onMainButtonStateChangedObservable.add((function(i){t._displayLaserPointer&&1===i.value&&(e._activePointer?e._deactivatePointer():e._activatePointer(),t.displayGaze&&(e._gazeTracker.isVisible=e._activePointer))})),e.webVRController.onTriggerStateChangedObservable.add((function(i){var n=e;t._noControllerIsActive&&(n=t._cameraGazer),n._pointerDownOnMeshAsked?i.valuet._padSensibilityUp&&n._selectionPointerDown()})))},e.prototype._checkTeleportWithRay=function(e,t){this._teleportationRequestInitiated&&!t._teleportationRequestInitiated||(t._teleportationRequestInitiated?Math.sqrt(e.y*e.y+e.x*e.x)-this._padSensibilityDown&&(t._rotationLeftAsked=!1):e.x<-this._padSensibilityUp&&t._dpadPressed&&(t._rotationLeftAsked=!0,this._rotationAllowed&&this._rotateCamera(!1)),t._rotationRightAsked?e.xthis._padSensibilityUp&&t._dpadPressed&&(t._rotationRightAsked=!0,this._rotationAllowed&&this._rotateCamera(!0)))},e.prototype._checkTeleportBackwards=function(e,t){if(!t._teleportationRequestInitiated)if(e.y>this._padSensibilityUp&&t._dpadPressed){if(!t._teleportationBackRequestInitiated){if(!this.currentVRCamera)return;var i=P.FromRotationMatrix(this.currentVRCamera.getWorldMatrix().getRotationMatrix()),n=this.currentVRCamera.position;this.currentVRCamera.devicePosition&&this.currentVRCamera.deviceRotationQuaternion&&(i=this.currentVRCamera.deviceRotationQuaternion,n=this.currentVRCamera.devicePosition),i.toEulerAnglesToRef(this._workingVector),this._workingVector.z=0,this._workingVector.x=0,P.RotationYawPitchRollToRef(this._workingVector.y,this._workingVector.x,this._workingVector.z,this._workingQuaternion),this._workingQuaternion.toRotationMatrix(this._workingMatrix),x.TransformCoordinatesToRef(this._teleportBackwardsVector,this._workingMatrix,this._workingVector);var r=new fo(n,this._workingVector),o=this._scene.pickWithRay(r,this._raySelectionPredicate);o&&o.pickedPoint&&o.pickedMesh&&this._isTeleportationFloor(o.pickedMesh)&&o.distance<5&&this.teleportCamera(o.pickedPoint),t._teleportationBackRequestInitiated=!0}}else t._teleportationBackRequestInitiated=!1},e.prototype._enableTeleportationOnController=function(e){var t=this;e.webVRController.mesh&&(e._interactionsEnabled||this._enableInteractionOnController(e),e._interactionsEnabled=!0,e._teleportationEnabled=!0,e.webVRController.controllerType===Vs.VIVE&&(e._dpadPressed=!1,e.webVRController.onPadStateChangedObservable.add((function(t){e._dpadPressed=t.pressed,e._dpadPressed||(e._rotationLeftAsked=!1,e._rotationRightAsked=!1,e._teleportationBackRequestInitiated=!1)}))),e.webVRController.onPadValuesChangedObservable.add((function(i){t.teleportationEnabled&&(t._checkTeleportBackwards(i,e),t._checkTeleportWithRay(i,e)),t._checkRotate(i,e)})))},e.prototype._createTeleportationCircles=function(){this._teleportationTarget=mc(\"teleportationTarget\",{width:2,height:2,subdivisions:2},this._scene),this._teleportationTarget.isPickable=!1;var e=new jl(\"DynamicTexture\",512,this._scene,!0);e.hasAlpha=!0;var t=e.getContext();t.beginPath(),t.arc(256,256,200,0,2*Math.PI,!1),t.fillStyle=this._teleportationFillColor,t.fill(),t.lineWidth=10,t.strokeStyle=this._teleportationBorderColor,t.stroke(),t.closePath(),e.update();var i=new Xl(\"TextPlaneMaterial\",this._scene);i.diffuseTexture=e,this._teleportationTarget.material=i;var n=uc(\"torusTeleportation\",{diameter:.75,thickness:.1,tessellation:25,updatable:!1},this._scene);n.isPickable=!1,n.parent=this._teleportationTarget;var r=new ze(\"animationInnerCircle\",\"position.y\",30,ze.ANIMATIONTYPE_FLOAT,ze.ANIMATIONLOOPMODE_CYCLE),o=[];o.push({frame:0,value:0}),o.push({frame:30,value:.4}),o.push({frame:60,value:0}),r.setKeys(o);var a=new kn;a.setEasingMode(Mn.EASINGMODE_EASEINOUT),r.setEasingFunction(a),n.animations=[],n.animations.push(r),this._scene.beginAnimation(n,0,60,!0),this._hideTeleportationTarget()},e.prototype._displayTeleportationTarget=function(){this._teleportActive=!0,this._teleportationInitialized&&(this._teleportationTarget.isVisible=!0,this._isDefaultTeleportationTarget&&(this._teleportationTarget.getChildren()[0].isVisible=!0))},e.prototype._hideTeleportationTarget=function(){this._teleportActive=!1,this._teleportationInitialized&&(this._teleportationTarget.isVisible=!1,this._isDefaultTeleportationTarget&&(this._teleportationTarget.getChildren()[0].isVisible=!1))},e.prototype._rotateCamera=function(e){var t=this;if(this.currentVRCamera instanceof Ds){e?this._rotationAngle++:this._rotationAngle--,this.currentVRCamera.animations=[];var i=P.FromRotationMatrix(M.RotationY(Math.PI/4*this._rotationAngle)),n=new ze(\"animationRotation\",\"rotationQuaternion\",90,ze.ANIMATIONTYPE_QUATERNION,ze.ANIMATIONLOOPMODE_CONSTANT),r=[];r.push({frame:0,value:this.currentVRCamera.rotationQuaternion}),r.push({frame:6,value:i}),n.setKeys(r),n.setEasingFunction(this._circleEase),this.currentVRCamera.animations.push(n),this._postProcessMove.animations=[];var o=new ze(\"animationPP\",\"vignetteWeight\",90,ze.ANIMATIONTYPE_FLOAT,ze.ANIMATIONLOOPMODE_CONSTANT),a=[];a.push({frame:0,value:0}),a.push({frame:3,value:4}),a.push({frame:6,value:0}),o.setKeys(a),o.setEasingFunction(this._circleEase),this._postProcessMove.animations.push(o);var s=new ze(\"animationPP2\",\"vignetteStretch\",90,ze.ANIMATIONTYPE_FLOAT,ze.ANIMATIONLOOPMODE_CONSTANT),l=[];l.push({frame:0,value:0}),l.push({frame:3,value:10}),l.push({frame:6,value:0}),s.setKeys(l),s.setEasingFunction(this._circleEase),this._postProcessMove.animations.push(s),this._postProcessMove.imageProcessingConfiguration.vignetteWeight=0,this._postProcessMove.imageProcessingConfiguration.vignetteStretch=0,this._postProcessMove.samples=4,this._webVRCamera.attachPostProcess(this._postProcessMove),this._scene.beginAnimation(this._postProcessMove,0,6,!1,1,(function(){t._webVRCamera.detachPostProcess(t._postProcessMove)})),this._scene.beginAnimation(this.currentVRCamera,0,6,!1,1)}},e.prototype._moveTeleportationSelectorTo=function(e,t,i){if(e.pickedPoint){t._teleportationRequestInitiated&&(this._displayTeleportationTarget(),this._haloCenter.copyFrom(e.pickedPoint),this._teleportationTarget.position.copyFrom(e.pickedPoint));var n=this._convertNormalToDirectionOfRay(e.getNormal(!0,!1),i);if(n){var r=x.Cross(vn.Y,n),o=x.Cross(n,r);x.RotationFromAxisToRef(o,n,r,this._teleportationTarget.rotation)}this._teleportationTarget.position.y+=.1}},e.prototype.teleportCamera=function(t){var i=this;if(this.currentVRCamera instanceof Ds){var n,r;if(this.webVRCamera.leftCamera?(this._workingVector.copyFrom(this.webVRCamera.leftCamera.globalPosition),this._workingVector.subtractInPlace(this.webVRCamera.position),t.subtractToRef(this._workingVector,this._workingVector)):this._workingVector.copyFrom(t),this.isInVRMode?this._workingVector.y+=this.webVRCamera.deviceDistanceToRoomGround()*this._webVRCamera.deviceScaleFactor:this._workingVector.y+=this._defaultHeight,this.onBeforeCameraTeleport.notifyObservers(this._workingVector),this._teleportationMode==e.TELEPORTATIONMODE_CONSTANTSPEED){r=90;var o=x.Distance(this.currentVRCamera.position,this._workingVector);n=this._teleportationSpeed/o}else r=Math.round(90*this._teleportationTime/1e3),n=1;this.currentVRCamera.animations=[];var a=new ze(\"animationCameraTeleportation\",\"position\",90,ze.ANIMATIONTYPE_VECTOR3,ze.ANIMATIONLOOPMODE_CONSTANT),s=[{frame:0,value:this.currentVRCamera.position},{frame:r,value:this._workingVector}];a.setKeys(s),a.setEasingFunction(this._teleportationEasing),this.currentVRCamera.animations.push(a),this._postProcessMove.animations=[];var l=Math.round(r/2),c=new ze(\"animationPP\",\"vignetteWeight\",90,ze.ANIMATIONTYPE_FLOAT,ze.ANIMATIONLOOPMODE_CONSTANT),u=[];u.push({frame:0,value:0}),u.push({frame:l,value:8}),u.push({frame:r,value:0}),c.setKeys(u),this._postProcessMove.animations.push(c);var h=new ze(\"animationPP2\",\"vignetteStretch\",90,ze.ANIMATIONTYPE_FLOAT,ze.ANIMATIONLOOPMODE_CONSTANT),d=[];d.push({frame:0,value:0}),d.push({frame:l,value:10}),d.push({frame:r,value:0}),h.setKeys(d),this._postProcessMove.animations.push(h),this._postProcessMove.imageProcessingConfiguration.vignetteWeight=0,this._postProcessMove.imageProcessingConfiguration.vignetteStretch=0,this._webVRCamera.attachPostProcess(this._postProcessMove),this._scene.beginAnimation(this._postProcessMove,0,r,!1,n,(function(){i._webVRCamera.detachPostProcess(i._postProcessMove)})),this._scene.beginAnimation(this.currentVRCamera,0,r,!1,n,(function(){i.onAfterCameraTeleport.notifyObservers(i._workingVector)})),this._hideTeleportationTarget()}},e.prototype._convertNormalToDirectionOfRay=function(e,t){return e&&Math.acos(x.Dot(e,t.direction))s){var l=s;s=a,a=l}return a>0&&a0&&s=0))},e.prototype._canDoCollision=function(e,t,i,n){var r=x.Distance(this._basePointWorld,e),o=Math.max(this._radius.x,this._radius.y,this._radius.z);return!(r>this._velocityWorldLength+o+t||!function(e,t,i,n){return!(e.x>i.x+n||i.x-n>t.x||e.y>i.y+n||i.y-n>t.y||e.z>i.z+n||i.z-n>t.z)}(i,n,this._basePointWorld,this._velocityWorldLength+o))},e.prototype._testTriangle=function(t,i,n,r,o,a,s){var l,c=!1;i||(i=[]),i[t]||(i[t]=new un(0,0,0,0),i[t].copyFromPoints(n,r,o));var u=i[t];if(a||u.isFrontFacingTo(this._normalizedVelocity,0)){var h=u.signedDistanceTo(this._basePoint),d=x.Dot(u.normal,this._velocity);if(!(e.DoubleSidedCheck&&d>1e-4)){if(0==d){if(Math.abs(h)>=1)return;c=!0,l=0}else{var p=(1-h)/d;if((l=(-1-h)/d)>p){var f=p;p=l,l=f}if(l>1||p<0)return;l<0&&(l=0),l>1&&(l=1)}this._collisionPoint.copyFromFloats(0,0,0);var _=!1,m=1;if(c||(this._basePoint.subtractToRef(u.normal,this._planeIntersectionPoint),this._velocity.scaleToRef(l,this._tempVector),this._planeIntersectionPoint.addInPlace(this._tempVector),this._checkPointInTriangle(this._planeIntersectionPoint,n,r,o,u.normal)&&(_=!0,m=l,this._collisionPoint.copyFrom(this._planeIntersectionPoint))),!_){var g=this._velocitySquaredLength;this._basePoint.subtractToRef(n,this._tempVector);var v=2*x.Dot(this._velocity,this._tempVector),y=this._tempVector.lengthSquared()-1,b=xc(g,v,y,m);b.found&&(m=b.root,_=!0,this._collisionPoint.copyFrom(n)),this._basePoint.subtractToRef(r,this._tempVector),v=2*x.Dot(this._velocity,this._tempVector),y=this._tempVector.lengthSquared()-1,(b=xc(g,v,y,m)).found&&(m=b.root,_=!0,this._collisionPoint.copyFrom(r)),this._basePoint.subtractToRef(o,this._tempVector),v=2*x.Dot(this._velocity,this._tempVector),y=this._tempVector.lengthSquared()-1,(b=xc(g,v,y,m)).found&&(m=b.root,_=!0,this._collisionPoint.copyFrom(o)),r.subtractToRef(n,this._edge),n.subtractToRef(this._basePoint,this._baseToVertex);var T,E=this._edge.lengthSquared(),S=x.Dot(this._edge,this._velocity),A=x.Dot(this._edge,this._baseToVertex);g=E*-this._velocitySquaredLength+S*S,v=2*(E*x.Dot(this._velocity,this._baseToVertex)-S*A),y=E*(1-this._baseToVertex.lengthSquared())+A*A,(b=xc(g,v,y,m)).found&&(T=(S*b.root-A)/E)>=0&&T<=1&&(m=b.root,_=!0,this._edge.scaleInPlace(T),n.addToRef(this._edge,this._collisionPoint)),o.subtractToRef(r,this._edge),r.subtractToRef(this._basePoint,this._baseToVertex),E=this._edge.lengthSquared(),S=x.Dot(this._edge,this._velocity),A=x.Dot(this._edge,this._baseToVertex),g=E*-this._velocitySquaredLength+S*S,v=2*(E*x.Dot(this._velocity,this._baseToVertex)-S*A),y=E*(1-this._baseToVertex.lengthSquared())+A*A,(b=xc(g,v,y,m)).found&&(T=(S*b.root-A)/E)>=0&&T<=1&&(m=b.root,_=!0,this._edge.scaleInPlace(T),r.addToRef(this._edge,this._collisionPoint)),n.subtractToRef(o,this._edge),o.subtractToRef(this._basePoint,this._baseToVertex),E=this._edge.lengthSquared(),S=x.Dot(this._edge,this._velocity),A=x.Dot(this._edge,this._baseToVertex),g=E*-this._velocitySquaredLength+S*S,v=2*(E*x.Dot(this._velocity,this._baseToVertex)-S*A),y=E*(1-this._baseToVertex.lengthSquared())+A*A,(b=xc(g,v,y,m)).found&&(T=(S*b.root-A)/E)>=0&&T<=1&&(m=b.root,_=!0,this._edge.scaleInPlace(T),o.addToRef(this._edge,this._collisionPoint))}if(_){var R=m*m*this._velocitySquaredLength;(!this.collisionFound||R=n)r.copyFrom(e);else{var s=o?o.collisionMask:i.collisionMask;i._initialize(e,t,a);for(var l=o&&o.surroundingMeshes||this._scene.meshes,c=0;c-1?e:this._shaderRepository+e,this._engine._loadFile(r+\".\"+t.toLowerCase()+\".fx\",n)):n(window.atob(e.substr(7))):n(e.substr(7))},Object.defineProperty(e.prototype,\"computeSourceCode\",{get:function(){var e,t;return this._computeSourceCodeOverride?this._computeSourceCodeOverride:null!==(t=null===(e=this._pipelineContext)||void 0===e?void 0:e._getComputeShaderCode())&&void 0!==t?t:this._computeSourceCode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"rawComputeSourceCode\",{get:function(){return this._rawComputeSourceCode},enumerable:!1,configurable:!0}),e.prototype._prepareEffect=function(){var e=this,t=this.defines,i=this._pipelineContext;this._isReady=!1;try{var n=this._engine;this._pipelineContext=n.createComputePipelineContext(),this._pipelineContext._name=this._key,n._prepareComputePipelineContext(this._pipelineContext,this._computeSourceCodeOverride?this._computeSourceCodeOverride:this._computeSourceCode,this._rawComputeSourceCode,this._computeSourceCodeOverride?null:t,this._entryPoint),n._executeWhenComputeStateIsCompiled(this._pipelineContext,(function(){e._compilationError=\"\",e._isReady=!0,e.onCompiled&&e.onCompiled(e),e.onCompileObservable.notifyObservers(e),e.onCompileObservable.clear(),i&&e.getEngine()._deleteComputePipelineContext(i)})),this._pipelineContext.isAsync&&this._checkIsReady(i)}catch(e){this._processCompilationErrors(e,i)}},e.prototype._getShaderCodeAndErrorLine=function(e,t){var i=null;if(t&&e){var n=t.match(/COMPUTE SHADER ERROR: 0:(\\d+?):/);if(n&&2===n.length){var r=parseInt(n[1]),o=e.split(\"\\n\",-1);o.length>=r&&(i=\"Offending line [\".concat(r,\"] in compute code: \").concat(o[r-1]))}}return[e,i]},e.prototype._processCompilationErrors=function(t,i){var n,r;if(void 0===i&&(i=null),this._compilationError=t.message,Q.Error(\"Unable to compile compute effect:\"),Q.Error(\"Defines:\\r\\n\"+this.defines),e.LogShaderCodeOnCompilationError){var o=null,a=null;(null===(r=this._pipelineContext)||void 0===r?void 0:r._getComputeShaderCode())&&(a=(n=this._getShaderCodeAndErrorLine(this._pipelineContext._getComputeShaderCode(),this._compilationError))[0],o=n[1],a&&(Q.Error(\"Compute code:\"),Q.Error(a))),o&&Q.Error(o)}Q.Error(\"Error: \"+this._compilationError),i&&(this._pipelineContext=i,this._isReady=!0,this.onError&&this.onError(this,this._compilationError),this.onErrorObservable.notifyObservers(this))},e.prototype.dispose=function(){this._pipelineContext&&this._pipelineContext.dispose(),this._engine._releaseComputeEffect(this)},e.RegisterShader=function(e,t){It.GetShadersStore(et.WGSL)[\"\".concat(e,\"ComputeShader\")]=t},e._UniqueIdSeed=0,e.LogShaderCodeOnCompilationError=!0,e}();!function(e){e[e.Texture=0]=\"Texture\",e[e.StorageTexture=1]=\"StorageTexture\",e[e.UniformBuffer=2]=\"UniformBuffer\",e[e.StorageBuffer=3]=\"StorageBuffer\",e[e.TextureWithoutSampler=4]=\"TextureWithoutSampler\",e[e.Sampler=5]=\"Sampler\"}(Mc||(Mc={})),Yt.prototype.createComputeEffect=function(e,t){throw new Error(\"createComputeEffect: This engine does not support compute shaders!\")},Yt.prototype.createComputePipelineContext=function(){throw new Error(\"createComputePipelineContext: This engine does not support compute shaders!\")},Yt.prototype.createComputeContext=function(){},Yt.prototype.computeDispatch=function(e,t,i,n,r,o,a){throw new Error(\"computeDispatch: This engine does not support compute shaders!\")},Yt.prototype.areAllComputeEffectsReady=function(){return!0},Yt.prototype.releaseComputeEffects=function(){},Yt.prototype._prepareComputePipelineContext=function(e,t,i,n,r){},Yt.prototype._rebuildComputeEffects=function(){},Yt.prototype._executeWhenComputeStateIsCompiled=function(e,t){t()},Yt.prototype._releaseComputeEffect=function(e){},Yt.prototype._deleteComputePipelineContext=function(e){};var Oc=function(){function e(e,t,i,n){void 0===n&&(n={}),this._bindings={},this._samplers={},this._contextIsDirty=!1,this.onCompiled=null,this.onError=null,this.name=e,this._engine=t,this.uniqueId=dn.UniqueId,this._engine.getCaps().supportComputeShaders?n.bindingsMapping?(this._context=t.createComputeContext(),this._shaderPath=i,this._options=k({bindingsMapping:{},defines:[]},n)):Q.Error(\"You must provide the binding mappings as browsers don't support reflection for wgsl shaders yet!\"):Q.Error(\"This engine does not support compute shaders!\")}return Object.defineProperty(e.prototype,\"options\",{get:function(){return this._options},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"shaderPath\",{get:function(){return this._shaderPath},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return\"ComputeShader\"},e.prototype.setTexture=function(e,t,i){void 0===i&&(i=!0);var n=this._bindings[e];this._bindings[e]={type:i?Mc.Texture:Mc.TextureWithoutSampler,object:t,indexInGroupEntries:null==n?void 0:n.indexInGroupEntries},this._contextIsDirty||(this._contextIsDirty=!n||n.object!==t||n.type!==this._bindings[e].type)},e.prototype.setStorageTexture=function(e,t){var i=this._bindings[e];this._contextIsDirty||(this._contextIsDirty=!i||i.object!==t),this._bindings[e]={type:Mc.StorageTexture,object:t,indexInGroupEntries:null==i?void 0:i.indexInGroupEntries}},e.prototype.setUniformBuffer=function(e,t){var i=this._bindings[e];this._contextIsDirty||(this._contextIsDirty=!i||i.object!==t),this._bindings[e]={type:Mc.UniformBuffer,object:t,indexInGroupEntries:null==i?void 0:i.indexInGroupEntries}},e.prototype.setStorageBuffer=function(e,t){var i=this._bindings[e];this._contextIsDirty||(this._contextIsDirty=!i||i.object!==t),this._bindings[e]={type:Mc.StorageBuffer,object:t,indexInGroupEntries:null==i?void 0:i.indexInGroupEntries}},e.prototype.setTextureSampler=function(e,t){var i=this._bindings[e];this._contextIsDirty||(this._contextIsDirty=!i||!t.compareSampler(i.object)),this._bindings[e]={type:Mc.Sampler,object:t,indexInGroupEntries:null==i?void 0:i.indexInGroupEntries}},e.prototype.isReady=function(){var e=this._effect;for(var t in this._bindings){var i=this._bindings[t],n=i.type,r=i.object;switch(n){case Mc.Texture:case Mc.TextureWithoutSampler:case Mc.StorageTexture:if(!r.isReady())return!1}}var o=[],a=this._shaderPath;if(this._options.defines)for(var s=0;sthis.capacity&&this._depth-1&&this.entries.splice(i,1)}},e.prototype.addEntries=function(e){for(var t=0;t0)):!i._pointerCaptures[s.pointerId]&&o.distance>=a.distance&&(i.mainSceneTrackerPredicate&&i.mainSceneTrackerPredicate(a.pickedMesh)?(i._notifyObservers(t,a,s),t.skipOnPointerObservable=!0):(t.type!==Hi.POINTERMOVE&&t.type!==Hi.POINTERUP||i._lastPointerEvents[s.pointerId]&&(i.onPointerOutObservable.notifyObservers(s.pointerId),delete i._lastPointerEvents[s.pointerId]),i._notifyObservers(t,o,s))),t.type===Hi.POINTERUP&&i._pointerCaptures[s.pointerId]&&(i._pointerCaptures[s.pointerId]=!1))}}}})),this._originalPointerObserver&&e.onPrePointerObservable.makeObserverTopPriority(this._originalPointerObserver)),this.utilityLayerScene.autoClear=!1,this._afterRenderObserver=this.originalScene.onAfterRenderCameraObservable.add((function(e){i.shouldRender&&e==i.getRenderCamera()&&i.render()})),this._sceneDisposeObserver=this.originalScene.onDisposeObservable.add((function(){i.dispose()})),this._updateCamera()}return e.prototype.getRenderCamera=function(e){if(this._renderCamera)return this._renderCamera;var t;return t=this.originalScene.activeCameras&&this.originalScene.activeCameras.length>1?this.originalScene.activeCameras[this.originalScene.activeCameras.length-1]:this.originalScene.activeCamera,e&&t&&t.isRigCamera?t.rigParent:t},e.prototype.setRenderCamera=function(e){this._renderCamera=e},e.prototype._getSharedGizmoLight=function(){return this._sharedGizmoLight||(this._sharedGizmoLight=new Pl(\"shared gizmo light\",new x(0,1,0),this.utilityLayerScene),this._sharedGizmoLight.intensity=2,this._sharedGizmoLight.groundColor=N.Gray()),this._sharedGizmoLight},Object.defineProperty(e,\"DefaultUtilityLayer\",{get:function(){return null==e._DefaultUtilityLayer?e._CreateDefaultUtilityLayerFromScene(S.LastCreatedScene):e._DefaultUtilityLayer},enumerable:!1,configurable:!0}),e._CreateDefaultUtilityLayerFromScene=function(t){return e._DefaultUtilityLayer=new e(t),e._DefaultUtilityLayer.originalScene.onDisposeObservable.addOnce((function(){e._DefaultUtilityLayer=null})),e._DefaultUtilityLayer},Object.defineProperty(e,\"DefaultKeepDepthUtilityLayer\",{get:function(){return null==e._DefaultKeepDepthUtilityLayer&&(e._DefaultKeepDepthUtilityLayer=new e(S.LastCreatedScene),e._DefaultKeepDepthUtilityLayer.utilityLayerScene.autoClearDepthAndStencil=!1,e._DefaultKeepDepthUtilityLayer.originalScene.onDisposeObservable.addOnce((function(){e._DefaultKeepDepthUtilityLayer=null}))),e._DefaultKeepDepthUtilityLayer},enumerable:!1,configurable:!0}),e.prototype._notifyObservers=function(e,t,i){e.skipOnPointerObservable||(this.utilityLayerScene.onPointerObservable.notifyObservers(new Yi(e.type,e.event,t),e.type),this._lastPointerEvents[i.pointerId]=!0)},e.prototype.render=function(){if(this._updateCamera(),this.utilityLayerScene.activeCamera){var e=this.utilityLayerScene.activeCamera.getScene(),t=this.utilityLayerScene.activeCamera;t._scene=this.utilityLayerScene,t.leftCamera&&(t.leftCamera._scene=this.utilityLayerScene),t.rightCamera&&(t.rightCamera._scene=this.utilityLayerScene),this.utilityLayerScene.render(!1),t._scene=e,t.leftCamera&&(t.leftCamera._scene=e),t.rightCamera&&(t.rightCamera._scene=e)}},e.prototype.dispose=function(){this.onPointerOutObservable.clear(),this._afterRenderObserver&&this.originalScene.onAfterCameraRenderObservable.remove(this._afterRenderObserver),this._sceneDisposeObserver&&this.originalScene.onDisposeObservable.remove(this._sceneDisposeObserver),this._originalPointerObserver&&this.originalScene.onPrePointerObservable.remove(this._originalPointerObserver),this.utilityLayerScene.dispose()},e.prototype._updateCamera=function(){this.utilityLayerScene.cameraToUseForPointers=this.getRenderCamera(),this.utilityLayerScene.activeCamera=this.getRenderCamera()},e._DefaultUtilityLayer=null,e._DefaultKeepDepthUtilityLayer=null,e}(),Bc=function(){function e(e){void 0===e&&(e=wc.DefaultUtilityLayer);var t=this;this.gizmoLayer=e,this._attachedMesh=null,this._attachedNode=null,this._customRotationQuaternion=null,this._scaleRatio=1,this._isHovered=!1,this._customMeshSet=!1,this._updateGizmoRotationToMatchAttachedMesh=!0,this.updateGizmoPositionToMatchAttachedMesh=!0,this.updateScale=!0,this._interactionsEnabled=!0,this._tempQuaternion=new P(0,0,0,1),this._tempVector=new x,this._tempVector2=new x,this._tempMatrix1=new M,this._tempMatrix2=new M,this._rightHandtoLeftHandMatrix=M.RotationY(Math.PI),this._rootMesh=new Ur(\"gizmoRootNode\",e.utilityLayerScene),this._rootMesh.rotationQuaternion=P.Identity(),this._beforeRenderObserver=this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.add((function(){t._update()}))}return Object.defineProperty(e.prototype,\"scaleRatio\",{get:function(){return this._scaleRatio},set:function(e){this._scaleRatio=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"isHovered\",{get:function(){return this._isHovered},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"attachedMesh\",{get:function(){return this._attachedMesh},set:function(e){this._attachedMesh=e,e&&(this._attachedNode=e),this._rootMesh.setEnabled(!!e),this._attachedNodeChanged(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"attachedNode\",{get:function(){return this._attachedNode},set:function(e){this._attachedNode=e,this._attachedMesh=null,this._rootMesh.setEnabled(!!e),this._attachedNodeChanged(e)},enumerable:!1,configurable:!0}),e.prototype.setCustomMesh=function(e){if(e.getScene()!=this.gizmoLayer.utilityLayerScene)throw\"When setting a custom mesh on a gizmo, the custom meshes scene must be the same as the gizmos (eg. gizmo.gizmoLayer.utilityLayerScene)\";this._rootMesh.getChildMeshes().forEach((function(e){e.dispose()})),e.parent=this._rootMesh,this._customMeshSet=!0},Object.defineProperty(e.prototype,\"updateGizmoRotationToMatchAttachedMesh\",{get:function(){return this._updateGizmoRotationToMatchAttachedMesh},set:function(e){this._updateGizmoRotationToMatchAttachedMesh=e},enumerable:!1,configurable:!0}),e.prototype._attachedNodeChanged=function(e){},Object.defineProperty(e.prototype,\"customRotationQuaternion\",{get:function(){return this._customRotationQuaternion},set:function(e){this._customRotationQuaternion=e},enumerable:!1,configurable:!0}),e.prototype._update=function(){if(this.attachedNode){var t=this.attachedNode;if(this.attachedMesh&&(t=this.attachedMesh||this.attachedNode),this.updateGizmoPositionToMatchAttachedMesh){var i=t.getWorldMatrix().getRow(3),n=i?i.toVector3():new x(0,0,0);this._rootMesh.position.copyFrom(n)}if(this.updateGizmoRotationToMatchAttachedMesh){var r=t._isMesh||\"AbstractMesh\"===t.getClassName()||\"TransformNode\"===t.getClassName()||\"InstancedMesh\"===t.getClassName()?t:void 0;t.getWorldMatrix().decompose(void 0,this._rootMesh.rotationQuaternion,void 0,e.PreserveScaling?r:void 0)}else this._customRotationQuaternion?this._rootMesh.rotationQuaternion.copyFrom(this._customRotationQuaternion):this._rootMesh.rotationQuaternion.set(0,0,0,1);if(this.updateScale){var o=this.gizmoLayer.utilityLayerScene.activeCamera,a=o.globalPosition;o.devicePosition&&(a=o.devicePosition),this._rootMesh.position.subtractToRef(a,this._tempVector);var s=this._tempVector.length()*this.scaleRatio;this._rootMesh.scaling.set(s,s,s),t._getWorldMatrixDeterminant()<0&&!e.PreserveScaling&&(this._rootMesh.scaling.y*=-1)}else this._rootMesh.scaling.setAll(this.scaleRatio)}},e.prototype._handlePivot=function(){var e=this._attachedNode;e.isUsingPivotMatrix&&e.isUsingPivotMatrix()&&e.position&&e.getWorldMatrix().setTranslation(e.position)},e.prototype._matrixChanged=function(){if(this._attachedNode)if(this._attachedNode._isCamera){var t=this._attachedNode,i=void 0,n=void 0;if(t.parent){var r=this._tempMatrix2;t.parent._worldMatrix.invertToRef(r),this._attachedNode._worldMatrix.multiplyToRef(r,this._tempMatrix1),i=this._tempMatrix1}else i=this._attachedNode._worldMatrix;if(t.getScene().useRightHandedSystem?(this._rightHandtoLeftHandMatrix.multiplyToRef(i,this._tempMatrix2),n=this._tempMatrix2):n=i,n.decompose(this._tempVector2,this._tempQuaternion,this._tempVector),\"FreeCamera\"===this._attachedNode.getClassName()||\"FlyCamera\"===this._attachedNode.getClassName()||\"ArcFollowCamera\"===this._attachedNode.getClassName()||\"TargetCamera\"===this._attachedNode.getClassName()||\"TouchCamera\"===this._attachedNode.getClassName()||\"UniversalCamera\"===this._attachedNode.getClassName()){var o=this._attachedNode;o.rotation=this._tempQuaternion.toEulerAngles(),o.rotationQuaternion&&(o.rotationQuaternion.copyFrom(this._tempQuaternion),o.rotationQuaternion.normalize())}t.position.copyFrom(this._tempVector)}else if(this._attachedNode._isMesh||\"AbstractMesh\"===this._attachedNode.getClassName()||\"TransformNode\"===this._attachedNode.getClassName()||\"InstancedMesh\"===this._attachedNode.getClassName()){var a=this._attachedNode;if(a.parent){r=this._tempMatrix1;var s=this._tempMatrix2;a.parent.getWorldMatrix().invertToRef(r),this._attachedNode.getWorldMatrix().multiplyToRef(r,s),s.decompose(this._tempVector,this._tempQuaternion,a.position,e.PreserveScaling?a:void 0)}else this._attachedNode._worldMatrix.decompose(this._tempVector,this._tempQuaternion,a.position,e.PreserveScaling?a:void 0);a.scaling.copyFrom(this._tempVector),a.billboardMode||(a.rotationQuaternion?(a.rotationQuaternion.copyFrom(this._tempQuaternion),a.rotationQuaternion.normalize()):a.rotation=this._tempQuaternion.toEulerAngles())}else if(\"Bone\"===this._attachedNode.getClassName()){var l=this._attachedNode,c=l.getParent();if(c){var u=this._tempMatrix1,h=this._tempMatrix2;c.getWorldMatrix().invertToRef(u),l.getWorldMatrix().multiplyToRef(u,h),l.getLocalMatrix().copyFrom(h)}else l.getLocalMatrix().copyFrom(l.getWorldMatrix());l.markAsDirty()}else{var d=this._attachedNode;if(d.getTypeID){var p=d.getTypeID();if(p===Cl.LIGHTTYPEID_DIRECTIONALLIGHT||p===Cl.LIGHTTYPEID_SPOTLIGHT||p===Cl.LIGHTTYPEID_POINTLIGHT){var f=d.parent;if(f){u=this._tempMatrix1;var _=this._tempMatrix2;f.getWorldMatrix().invertToRef(u),d.getWorldMatrix().multiplyToRef(u,_),_.decompose(void 0,this._tempQuaternion,this._tempVector)}else this._attachedNode._worldMatrix.decompose(void 0,this._tempQuaternion,this._tempVector);d.position=new x(this._tempVector.x,this._tempVector.y,this._tempVector.z),d.direction&&(d.direction=new x(d.direction.x,d.direction.y,d.direction.z))}}}},e.prototype._setGizmoMeshMaterial=function(e,t){e&&e.forEach((function(e){e.material=t,e.color&&(e.color=t.diffuseColor)}))},e.GizmoAxisPointerObserver=function(e,t){var i=!1,n=e.utilityLayerScene.onPointerObservable.add((function(e){var n,r;if(e.pickInfo){if(e.type===Hi.POINTERMOVE){if(i)return;t.forEach((function(t){var i,n;if(t.colliderMeshes&&t.gizmoMeshes){var r=-1!=(null===(i=t.colliderMeshes)||void 0===i?void 0:i.indexOf(null===(n=null==e?void 0:e.pickInfo)||void 0===n?void 0:n.pickedMesh)),o=t.dragBehavior.enabled?r||t.active?t.hoverMaterial:t.material:t.disableMaterial;t.gizmoMeshes.forEach((function(e){e.material=o,e.color&&(e.color=o.diffuseColor)}))}}))}e.type===Hi.POINTERDOWN&&t.has(null===(n=e.pickInfo.pickedMesh)||void 0===n?void 0:n.parent)&&(i=!0,t.get(null===(r=e.pickInfo.pickedMesh)||void 0===r?void 0:r.parent).active=!0,t.forEach((function(t){var i,n,r=(-1!=(null===(i=t.colliderMeshes)||void 0===i?void 0:i.indexOf(null===(n=null==e?void 0:e.pickInfo)||void 0===n?void 0:n.pickedMesh))||t.active)&&t.dragBehavior.enabled?t.hoverMaterial:t.disableMaterial;t.gizmoMeshes.forEach((function(e){e.material=r,e.color&&(e.color=r.diffuseColor)}))}))),e.type===Hi.POINTERUP&&t.forEach((function(e){e.active=!1,i=!1,e.gizmoMeshes.forEach((function(t){t.material=e.dragBehavior.enabled?e.material:e.disableMaterial,t.color&&(t.color=e.material.diffuseColor)}))}))}}));return n},e.prototype.dispose=function(){this._rootMesh.dispose(),this._beforeRenderObserver&&this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.remove(this._beforeRenderObserver)},e.PreserveScaling=!1,e}(),Uc=function(e){function t(i,n,r,o,a){void 0===n&&(n=N.Gray()),void 0===r&&(r=wc.DefaultUtilityLayer),void 0===o&&(o=null),void 0===a&&(a=1);var s,l=this;(l=e.call(this,r)||this)._pointerObserver=null,l.snapDistance=0,l.onSnapObservable=new u,l._isEnabled=!0,l._parent=null,l._dragging=!1,l._parent=o,l._coloredMaterial=new Xl(\"\",r.utilityLayerScene),l._coloredMaterial.diffuseColor=n,l._coloredMaterial.specularColor=n.subtract(new N(.1,.1,.1)),l._hoverMaterial=new Xl(\"\",r.utilityLayerScene),l._hoverMaterial.diffuseColor=N.Yellow(),l._disableMaterial=new Xl(\"\",r.utilityLayerScene),l._disableMaterial.diffuseColor=N.Gray(),l._disableMaterial.alpha=.4;var c=t._CreateArrow(r.utilityLayerScene,l._coloredMaterial,a),h=t._CreateArrow(r.utilityLayerScene,l._coloredMaterial,a+4,!0);l._gizmoMesh=new Ur(\"\",r.utilityLayerScene),l._gizmoMesh.addChild(c),l._gizmoMesh.addChild(h),l._gizmoMesh.lookAt(l._rootMesh.position.add(i)),l._gizmoMesh.scaling.scaleInPlace(1/3),l._gizmoMesh.parent=l._rootMesh;var d=0,p=new x,f=new x,_={snapDistance:0};l.dragBehavior=new bo({dragAxis:i}),l.dragBehavior.moveAttached=!1,l.dragBehavior.updateDragPlane=!1,l._rootMesh.addBehavior(l.dragBehavior),l.dragBehavior.onDragObservable.add((function(e){if(l.attachedNode){l._handlePivot();var t=!1;if(0==l.snapDistance)l.attachedNode.getWorldMatrix().getTranslationToRef(f),f.addInPlace(e.delta),l.dragBehavior.validateDrag(f)&&(l.attachedNode.position&&l.attachedNode.position.addInPlaceFromFloats(e.delta.x,e.delta.y,e.delta.z),l.attachedNode.getWorldMatrix().addTranslationFromFloats(e.delta.x,e.delta.y,e.delta.z),l.attachedNode.updateCache(),t=!0);else if(d+=e.dragDistance,Math.abs(d)>l.snapDistance){var i=Math.floor(Math.abs(d)/l.snapDistance);d%=l.snapDistance,e.delta.normalizeToRef(p),p.scaleInPlace(l.snapDistance*i),l.attachedNode.getWorldMatrix().getTranslationToRef(f),f.addInPlace(p),l.dragBehavior.validateDrag(f)&&(l.attachedNode.getWorldMatrix().addTranslationFromFloats(p.x,p.y,p.z),l.attachedNode.updateCache(),_.snapDistance=l.snapDistance*i,l.onSnapObservable.notifyObservers(_),t=!0)}t&&l._matrixChanged()}})),l.dragBehavior.onDragStartObservable.add((function(){l._dragging=!0})),l.dragBehavior.onDragEndObservable.add((function(){l._dragging=!1}));var m=r._getSharedGizmoLight();m.includedOnlyMeshes=m.includedOnlyMeshes.concat(l._rootMesh.getChildMeshes(!1));var g={gizmoMeshes:c.getChildMeshes(),colliderMeshes:h.getChildMeshes(),material:l._coloredMaterial,hoverMaterial:l._hoverMaterial,disableMaterial:l._disableMaterial,active:!1,dragBehavior:l.dragBehavior};return null===(s=l._parent)||void 0===s||s.addToAxisCache(h,g),l._pointerObserver=r.utilityLayerScene.onPointerObservable.add((function(e){var t;if(!l._customMeshSet&&(l._isHovered=!(-1==g.colliderMeshes.indexOf(null===(t=null==e?void 0:e.pickInfo)||void 0===t?void 0:t.pickedMesh)),!l._parent)){var i=l.dragBehavior.enabled?l._isHovered||l._dragging?l._hoverMaterial:l._coloredMaterial:l._disableMaterial;l._setGizmoMeshMaterial(g.gizmoMeshes,i)}})),l.dragBehavior.onEnabledObservable.add((function(e){l._setGizmoMeshMaterial(g.gizmoMeshes,e?g.material:g.disableMaterial)})),l}return V(t,e),t._CreateArrow=function(e,t,i,n){void 0===i&&(i=1),void 0===n&&(n=!1);var r=new yr(\"arrow\",e),o=sc(\"cylinder\",{diameterTop:0,height:.075,diameterBottom:.0375*(1+(i-1)/4),tessellation:96},e),a=sc(\"cylinder\",{diameterTop:.005*i,height:.275,diameterBottom:.005*i,tessellation:96},e);return o.parent=r,o.material=t,o.rotation.x=Math.PI/2,o.position.z+=.3,a.parent=r,a.material=t,a.position.z+=.1375,a.rotation.x=Math.PI/2,n&&(a.visibility=0,o.visibility=0),r},t._CreateArrowInstance=function(e,t){for(var i=new yr(\"arrow\",e),n=0,r=t.getChildMeshes();n0;)f.unshift(f.pop()),m.unshift(m.pop()),h--;for(;d>0;)_.unshift(_.pop()),g.unshift(g.pop()),d--;f=f.flat(),_=_.flat(),p=p.concat(f).concat(_),i.push(m[0],m[2],m[3],m[0],m[1],m[2]),i.push(g[0],g[2],g[3],g[0],g[1],g[2])}var v=[o/2,a/2,s/2];t=p.reduce((function(e,t,i){return e.concat(t*v[i%3])}),[]);for(var y=0===e.sideOrientation?0:e.sideOrientation||$n.DEFAULTSIDE,b=e.faceUV||new Array(6),T=e.faceColors,E=[],S=0;S<6;S++)void 0===b[S]&&(b[S]=new C(0,0,1,1)),T&&void 0===T[S]&&(T[S]=new L(1,1,1,1));for(var A=0;A<6;A++)if(r.push(b[A].z,pr.UseOpenGLOrientationForUV?1-b[A].w:b[A].w),r.push(b[A].x,pr.UseOpenGLOrientationForUV?1-b[A].w:b[A].w),r.push(b[A].x,pr.UseOpenGLOrientationForUV?1-b[A].y:b[A].y),r.push(b[A].z,pr.UseOpenGLOrientationForUV?1-b[A].y:b[A].y),T)for(var R=0;R<4;R++)E.push(T[A].r,T[A].g,T[A].b,T[A].a);$n._ComputeSides(y,t,i,n,r,e.frontUVs,e.backUVs);var x=new $n;if(x.indices=i,x.positions=t,x.normals=n,x.uvs=r,T){var P=y===$n.DOUBLESIDE?E.concat(E):E;x.colors=P}return x}function Wc(e,t,i){void 0===t&&(t={}),void 0===i&&(i=null);var n=new Ur(e,i);return t.sideOrientation=Ur._GetDefaultSideOrientation(t.sideOrientation),n._originalBuilderSideOrientation=t.sideOrientation,zc(t).applyToMesh(n,t.updatable),n}var Hc={CreateBox:Wc};function Xc(e){for(var t=e.segments||32,i=e.diameterX||e.diameter||1,n=e.diameterY||e.diameter||1,r=e.diameterZ||e.diameter||1,o=e.arc&&(e.arc<=0||e.arc>1)?1:e.arc||1,a=e.slice&&e.slice<=0?1:e.slice||1,s=0===e.sideOrientation?0:e.sideOrientation||$n.DEFAULTSIDE,l=!!e.dedupTopBottomIndices,c=new x(i/2,n/2,r/2),u=2+t,h=2*u,d=[],p=[],f=[],_=[],m=0;m<=u;m++){for(var g=m/u,v=g*Math.PI*a,y=0;y<=h;y++){var b=y/h,T=b*Math.PI*2*o,E=M.RotationZ(-v),S=M.RotationY(T),A=x.TransformCoordinates(x.Up(),E),R=x.TransformCoordinates(A,S),C=R.multiply(c),P=R.divide(c).normalize();p.push(C.x,C.y,C.z),f.push(P.x,P.y,P.z),_.push(b,pr.UseOpenGLOrientationForUV?1-g:g)}if(m>0)for(var I=p.length/3,O=I-2*(h+1);O+h+21&&(d.push(O),d.push(O+1),d.push(O+h+1)),(m-1&&this._debugMeshMeshes.splice(o,1),this._numMeshes--,this._numMeshes>0?(this._meshes[n]=this._meshes[this._numMeshes],this._impostors[n]=this._impostors[this._numMeshes],this._meshes[this._numMeshes]=null,this._impostors[this._numMeshes]=null):(this._meshes[0]=null,this._impostors[0]=null),t=!0;break}t&&0===this._numMeshes&&this._scene.unregisterBeforeRender(this._renderFunction)}},e.prototype._getDebugMaterial=function(e){return this._debugMaterial||(this._debugMaterial=new Xl(\"\",e),this._debugMaterial.wireframe=!0,this._debugMaterial.emissiveColor=N.White(),this._debugMaterial.disableLighting=!0),this._debugMaterial},e.prototype._getDebugBoxMesh=function(e){return this._debugBoxMesh||(this._debugBoxMesh=Wc(\"physicsBodyBoxViewMesh\",{size:1},e),this._debugBoxMesh.rotationQuaternion=P.Identity(),this._debugBoxMesh.material=this._getDebugMaterial(e),this._debugBoxMesh.setEnabled(!1)),this._debugBoxMesh.createInstance(\"physicsBodyBoxViewInstance\")},e.prototype._getDebugSphereMesh=function(e){return this._debugSphereMesh||(this._debugSphereMesh=jc(\"physicsBodySphereViewMesh\",{diameter:1},e),this._debugSphereMesh.rotationQuaternion=P.Identity(),this._debugSphereMesh.material=this._getDebugMaterial(e),this._debugSphereMesh.setEnabled(!1)),this._debugSphereMesh.createInstance(\"physicsBodySphereViewInstance\")},e.prototype._getDebugCapsuleMesh=function(e){return this._debugCapsuleMesh||(this._debugCapsuleMesh=Qc(\"physicsBodyCapsuleViewMesh\",{height:1},e),this._debugCapsuleMesh.rotationQuaternion=P.Identity(),this._debugCapsuleMesh.material=this._getDebugMaterial(e),this._debugCapsuleMesh.setEnabled(!1)),this._debugCapsuleMesh.createInstance(\"physicsBodyCapsuleViewInstance\")},e.prototype._getDebugCylinderMesh=function(e){return this._debugCylinderMesh||(this._debugCylinderMesh=sc(\"physicsBodyCylinderViewMesh\",{diameterTop:1,diameterBottom:1,height:1},e),this._debugCylinderMesh.rotationQuaternion=P.Identity(),this._debugCylinderMesh.material=this._getDebugMaterial(e),this._debugCylinderMesh.setEnabled(!1)),this._debugCylinderMesh.createInstance(\"physicsBodyCylinderViewInstance\")},e.prototype._getDebugMeshMesh=function(e,t){var i=new Ur(e.name,t,null,e);return i.setParent(e),i.position=x.Zero(),i.material=this._getDebugMaterial(t),this._debugMeshMeshes.push(i),i},e.prototype._getDebugMesh=function(e,t){var i=this;if(!this._utilityLayer)return null;if(t&&t.parent&&t.parent.physicsImpostor)return null;var n=null,r=this._utilityLayer.utilityLayerScene;if(!e.physicsBody)return Q.Warn(\"Unable to get physicsBody of impostor. It might be initialized later by its parent's impostor.\"),null;switch(e.type){case Fo.BoxImpostor:n=this._getDebugBoxMesh(r),e.getBoxSizeToRef(n.scaling);break;case Fo.SphereImpostor:n=this._getDebugSphereMesh(r);var o=e.getRadius();n.scaling.x=2*o,n.scaling.y=2*o,n.scaling.z=2*o;break;case Fo.CapsuleImpostor:n=this._getDebugCapsuleMesh(r);var a=e.object.getBoundingInfo();n.scaling.x=2*(a.boundingBox.maximum.x-a.boundingBox.minimum.x)*e.object.scaling.x,n.scaling.y=(a.boundingBox.maximum.y-a.boundingBox.minimum.y)*e.object.scaling.y,n.scaling.z=2*(a.boundingBox.maximum.z-a.boundingBox.minimum.z)*e.object.scaling.z;break;case Fo.MeshImpostor:t&&(n=this._getDebugMeshMesh(t,r));break;case Fo.NoImpostor:t?t.getChildMeshes().filter((function(e){return e.physicsImpostor?1:0})).forEach((function(e){if(e.physicsImpostor&&\"Mesh\"===e.getClassName()){var t=e.getBoundingInfo(),o=t.boundingBox.minimum,a=t.boundingBox.maximum;switch(e.physicsImpostor.type){case Fo.BoxImpostor:(n=i._getDebugBoxMesh(r)).position.copyFrom(o),n.position.addInPlace(a),n.position.scaleInPlace(.5);break;case Fo.SphereImpostor:n=i._getDebugSphereMesh(r);break;case Fo.CylinderImpostor:n=i._getDebugCylinderMesh(r);break;default:n=null}n&&(n.scaling.x=a.x-o.x,n.scaling.y=a.y-o.y,n.scaling.z=a.z-o.z,n.parent=e)}})):Q.Warn(\"No target mesh parameter provided for NoImpostor. Skipping.\"),n=null;break;case Fo.CylinderImpostor:n=this._getDebugCylinderMesh(r),a=e.object.getBoundingInfo(),n.scaling.x=(a.boundingBox.maximum.x-a.boundingBox.minimum.x)*e.object.scaling.x,n.scaling.y=(a.boundingBox.maximum.y-a.boundingBox.minimum.y)*e.object.scaling.y,n.scaling.z=(a.boundingBox.maximum.z-a.boundingBox.minimum.z)*e.object.scaling.z}return n},e.prototype.dispose=function(){for(var e=this._numMeshes,t=0;t=0!=this._getWorldMatrixDeterminant()>=0)return this._internalAbstractMeshDataInfo._actAsRegularMesh=!0,!0;if(this._internalAbstractMeshDataInfo._actAsRegularMesh=!1,this._currentLOD._registerInstanceForRenderId(this,t),i){if(!this._currentLOD._internalAbstractMeshDataInfo._isActiveIntermediate)return this._currentLOD._internalAbstractMeshDataInfo._onlyForInstancesIntermediate=!0,!0}else if(!this._currentLOD._internalAbstractMeshDataInfo._isActive)return this._currentLOD._internalAbstractMeshDataInfo._onlyForInstances=!0,!0}return!1},t.prototype._postActivate=function(){this._sourceMesh.edgesShareWithInstances&&this._sourceMesh._edgesRenderer&&this._sourceMesh._edgesRenderer.isEnabled&&this._sourceMesh._renderingGroup?(this._sourceMesh._renderingGroup._edgesRenderers.pushNoDuplicate(this._sourceMesh._edgesRenderer),this._sourceMesh._edgesRenderer.customInstances.push(this.getWorldMatrix())):this._edgesRenderer&&this._edgesRenderer.isEnabled&&this._sourceMesh._renderingGroup&&this._sourceMesh._renderingGroup._edgesRenderers.push(this._edgesRenderer)},t.prototype.getWorldMatrix=function(){if(this._currentLOD&&this._currentLOD.billboardMode!==yr.BILLBOARDMODE_NONE&&this._currentLOD._masterMesh!==this){this._billboardWorldMatrix||(this._billboardWorldMatrix=new M);var t=this._currentLOD._masterMesh;return this._currentLOD._masterMesh=this,O.Vector3[7].copyFrom(this._currentLOD.position),this._currentLOD.position.set(0,0,0),this._billboardWorldMatrix.copyFrom(this._currentLOD.computeWorldMatrix(!0)),this._currentLOD.position.copyFrom(O.Vector3[7]),this._currentLOD._masterMesh=t,this._billboardWorldMatrix}return e.prototype.getWorldMatrix.call(this)},Object.defineProperty(t.prototype,\"isAnInstance\",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.getLOD=function(e){if(!e)return this;var t=this.sourceMesh.getLODLevels();if(t&&0!==t.length){var i=this.getBoundingInfo();this._currentLOD=this.sourceMesh.getLOD(e,i.boundingSphere)}else this._currentLOD=this.sourceMesh;return this._currentLOD},t.prototype._preActivateForIntermediateRendering=function(e){return this.sourceMesh._preActivateForIntermediateRendering(e)},t.prototype._syncSubMeshes=function(){if(this.releaseSubMeshes(),this._sourceMesh.subMeshes)for(var e=0;e1&&(this._multiview=!0,h.push(\"#define MULTIVIEW\"),-1!==this._options.uniforms.indexOf(\"viewProjection\")&&-1===this._options.uniforms.indexOf(\"viewProjectionR\")&&this._options.uniforms.push(\"viewProjectionR\"));for(var v=0;v4&&(d.push(wi.MatricesIndicesExtraKind),d.push(wi.MatricesWeightsExtraKind));var b=e.skeleton;h.push(\"#define NUM_BONE_INFLUENCERS \"+e.numBoneInfluencers),p.addCPUSkinningFallback(0,e),b.isUsingTextureForMatrices?(h.push(\"#define BONETEXTURE\"),-1===this._options.uniforms.indexOf(\"boneTextureWidth\")&&this._options.uniforms.push(\"boneTextureWidth\"),-1===this._options.samplers.indexOf(\"boneSampler\")&&this._options.samplers.push(\"boneSampler\")):(h.push(\"#define BonesPerMesh \"+(b.bones.length+1)),-1===this._options.uniforms.indexOf(\"mBones\")&&this._options.uniforms.push(\"mBones\"))}else h.push(\"#define NUM_BONE_INFLUENCERS 0\");var T=0,E=e?e.morphTargetManager:null;if(E){var S=E.supportsUVs&&-1!==h.indexOf(\"#define UV1\"),A=E.supportsTangents&&-1!==h.indexOf(\"#define TANGENT\"),R=E.supportsNormals&&-1!==h.indexOf(\"#define NORMAL\");for(T=E.numInfluencers,S&&h.push(\"#define MORPHTARGETS_UV\"),A&&h.push(\"#define MORPHTARGETS_TANGENT\"),R&&h.push(\"#define MORPHTARGETS_NORMAL\"),T>0&&h.push(\"#define MORPHTARGETS\"),E.isUsingTextureForTargets&&(h.push(\"#define MORPHTARGETS_TEXTURE\"),-1===this._options.uniforms.indexOf(\"morphTargetTextureIndices\")&&this._options.uniforms.push(\"morphTargetTextureIndices\"),-1===this._options.samplers.indexOf(\"morphTargets\")&&this._options.samplers.push(\"morphTargets\")),h.push(\"#define NUM_MORPH_INFLUENCERS \"+T),v=0;v0&&((_=_.slice()).push(\"morphTargetInfluences\"),_.push(\"morphTargetTextureInfo\"),_.push(\"morphTargetTextureIndices\"))}else h.push(\"#define NUM_MORPH_INFLUENCERS 0\");if(e){var x=e.bakedVertexAnimationManager;x&&x.isEnabled&&(h.push(\"#define BAKED_VERTEX_ANIMATION_TEXTURE\"),-1===this._options.uniforms.indexOf(\"bakedVertexAnimationSettings\")&&this._options.uniforms.push(\"bakedVertexAnimationSettings\"),-1===this._options.uniforms.indexOf(\"bakedVertexAnimationTextureSizeInverted\")&&this._options.uniforms.push(\"bakedVertexAnimationTextureSizeInverted\"),-1===this._options.uniforms.indexOf(\"bakedVertexAnimationTime\")&&this._options.uniforms.push(\"bakedVertexAnimationTime\"),-1===this._options.samplers.indexOf(\"bakedVertexAnimationTexture\")&&this._options.samplers.push(\"bakedVertexAnimationTexture\")),Pr.PrepareAttributesForBakedVertexAnimation(d,e,h)}for(var C in this._textures)if(!this._textures[C].isReady())return!1;e&&this._shouldTurnAlphaTestOn(e)&&h.push(\"#define ALPHATEST\"),(null===this._options.useClipPlane&&c.clipPlane||this._options.useClipPlane)&&(h.push(\"#define CLIPPLANE\"),-1===_.indexOf(\"vClipPlane\")&&_.push(\"vClipPlane\")),(null===this._options.useClipPlane&&c.clipPlane2||this._options.useClipPlane)&&(h.push(\"#define CLIPPLANE2\"),-1===_.indexOf(\"vClipPlane2\")&&_.push(\"vClipPlane2\")),(null===this._options.useClipPlane&&c.clipPlane3||this._options.useClipPlane)&&(h.push(\"#define CLIPPLANE3\"),-1===_.indexOf(\"vClipPlane3\")&&_.push(\"vClipPlane3\")),(null===this._options.useClipPlane&&c.clipPlane4||this._options.useClipPlane)&&(h.push(\"#define CLIPPLANE4\"),-1===_.indexOf(\"vClipPlane4\")&&_.push(\"vClipPlane4\")),(null===this._options.useClipPlane&&c.clipPlane5||this._options.useClipPlane)&&(h.push(\"#define CLIPPLANE5\"),-1===_.indexOf(\"vClipPlane5\")&&_.push(\"vClipPlane5\")),(null===this._options.useClipPlane&&c.clipPlane6||this._options.useClipPlane)&&(h.push(\"#define CLIPPLANE6\"),-1===_.indexOf(\"vClipPlane6\")&&_.push(\"vClipPlane6\")),this.customShaderNameResolve&&(_=_.slice(),m=m.slice(),g=g.slice(),f=this.customShaderNameResolve(f,_,m,g,h,d));var P=s?i._getDrawWrapper():this._drawWrapper,M=null!==(n=null==P?void 0:P.effect)&&void 0!==n?n:null,I=null!==(r=null==P?void 0:P.defines)&&void 0!==r?r:null,O=h.join(\"\\n\"),D=M;return I!==O&&(D=u.createEffect(f,{attributes:d,uniformsNames:_,uniformBuffersNames:m,samplers:g,defines:O,fallbacks:p,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousMorphTargets:T},shaderLanguage:this._options.shaderLanguage},u),s?i.setEffect(D,O,this._materialContext):P&&P.setEffect(D,O),this._onEffectCreatedObservable&&($c.effect=D,$c.subMesh=null!==(o=null!=i?i:null==e?void 0:e.subMeshes[0])&&void 0!==o?o:null,this._onEffectCreatedObservable.notifyObservers($c))),D._wasPreviouslyUsingInstances=!!t,null!==(a=!(null==D?void 0:D.isReady()))&&void 0!==a&&!a&&(M!==D&&c.resetCachedMaterial(),D._wasPreviouslyReady=!0,!0)},t.prototype.bindOnlyWorldMatrix=function(e,t){var i=this.getScene(),n=null!=t?t:this.getEffect();n&&(-1!==this._options.uniforms.indexOf(\"world\")&&n.setMatrix(\"world\",e),-1!==this._options.uniforms.indexOf(\"worldView\")&&(e.multiplyToRef(i.getViewMatrix(),this._cachedWorldViewMatrix),n.setMatrix(\"worldView\",this._cachedWorldViewMatrix)),-1!==this._options.uniforms.indexOf(\"worldViewProjection\")&&(e.multiplyToRef(i.getTransformMatrix(),this._cachedWorldViewProjectionMatrix),n.setMatrix(\"worldViewProjection\",this._cachedWorldViewProjectionMatrix)))},t.prototype.bindForSubMesh=function(e,t,i){var n;this.bind(e,t,null===(n=i._drawWrapperOverride)||void 0===n?void 0:n.effect,i)},t.prototype.bind=function(e,t,i,n){var r,o=n&&this._storeEffectOnSubMeshes,a=null!=i?i:o?n.effect:this.getEffect();if(a){this._activeEffect=a,this.bindOnlyWorldMatrix(e,i);var s=this._options.uniformBuffers,l=!1;if(a&&s&&s.length>0&&this.getScene().getEngine().supportsUniformBuffers)for(var c=0;c0&&Pr.BindMorphTargetParameters(t,a);var _=t.bakedVertexAnimationManager;_&&_.isEnabled&&(null===(r=t.bakedVertexAnimationManager)||void 0===r||r.bind(a,!!a._wasPreviouslyUsingInstances))}this._afterBind(t,a)}},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);for(var i in this._textures)t.push(this._textures[i]);for(var n in this._textureArrays)for(var r=this._textureArrays[n],o=0;o\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void) {\\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\\n#include\\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\\ngl_FragColor=vColor;\\n#else\\ngl_FragColor=color;\\n#endif\\n#define CUSTOM_FRAGMENT_MAIN_END\\n}\";It.ShadersStore.colorVertexShader=\"attribute vec3 position;\\n#ifdef VERTEXCOLOR\\nattribute vec4 color;\\n#endif\\n#include\\n#include\\n#include\\n#include\\nuniform mat4 viewProjection;\\n#ifdef MULTIVIEW\\nuniform mat4 viewProjectionR;\\n#endif\\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\\nvarying vec4 vColor;\\n#endif\\n#define CUSTOM_VERTEX_DEFINITIONS\\nvoid main(void) {\\n#define CUSTOM_VERTEX_MAIN_BEGIN\\n#include\\n#include\\n#include\\nvec4 worldPos=finalWorld*vec4(position,1.0);\\n#ifdef MULTIVIEW\\nif (gl_ViewID_OVR==0u) {\\ngl_Position=viewProjection*worldPos;\\n} else {\\ngl_Position=viewProjectionR*worldPos;\\n}\\n#else\\ngl_Position=viewProjection*worldPos;\\n#endif\\n#include\\n#include\\n#define CUSTOM_VERTEX_MAIN_END\\n}\",Ur._LinesMeshParser=function(e,t){return tu.Parse(e,t)};var tu=function(e){function t(t,i,n,r,o,a,s,l){void 0===i&&(i=null),void 0===n&&(n=null),void 0===r&&(r=null);var c=e.call(this,t,i,n,r,o)||this;c.useVertexColor=a,c.useVertexAlpha=s,c.color=new N(1,1,1),c.alpha=1,r&&(c.color=r.color.clone(),c.alpha=r.alpha,c.useVertexColor=r.useVertexColor,c.useVertexAlpha=r.useVertexAlpha),c.intersectionThreshold=.1;var u={attributes:[wi.PositionKind],uniforms:[\"vClipPlane\",\"vClipPlane2\",\"vClipPlane3\",\"vClipPlane4\",\"vClipPlane5\",\"vClipPlane6\",\"world\",\"viewProjection\"],needAlphaBlending:!0,defines:[],useClipPlane:null};return!1===s?u.needAlphaBlending=!1:u.defines.push(\"#define VERTEXALPHA\"),a?(u.defines.push(\"#define VERTEXCOLOR\"),u.attributes.push(wi.ColorKind)):(u.uniforms.push(\"color\"),c._color4=new L),c.material=l||new eu(\"colorShader\",c.getScene(),\"color\",u,!1),c}return V(t,e),t.prototype._isShaderMaterial=function(e){return\"ShaderMaterial\"===e.getClassName()},t.prototype.isReady=function(){return!!this._lineMaterial.isReady(this,!!this._userInstancedBuffersStorage)&&e.prototype.isReady.call(this)},t.prototype.getClassName=function(){return\"LinesMesh\"},Object.defineProperty(t.prototype,\"material\",{get:function(){return this._lineMaterial},set:function(e){this._lineMaterial=e,this._lineMaterial.fillMode=Ir.LineListDrawMode},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"checkCollisions\",{get:function(){return!1},set:function(e){},enumerable:!1,configurable:!0}),t.prototype._bind=function(){if(!this._geometry)return this;var e=this._lineMaterial.getEffect(),t=this.isUnIndexed?null:this._geometry.getIndexBuffer();if(this._userInstancedBuffersStorage?this._geometry._bind(e,t,this._userInstancedBuffersStorage.vertexBuffers,this._userInstancedBuffersStorage.vertexArrayObjects):this._geometry._bind(e,t),!this.useVertexColor&&this._isShaderMaterial(this._lineMaterial)){var i=this.color,n=i.r,r=i.g,o=i.b;this._color4.set(n,r,o,this.alpha),this._lineMaterial.setColor4(\"color\",this._color4)}return this},t.prototype._draw=function(e,t,i){if(!this._geometry||!this._geometry.getVertexBuffers()||!this._unIndexed&&!this._geometry.getIndexBuffer())return this;var n=this.getScene().getEngine();return this._unIndexed?n.drawArraysType(Ir.LineListDrawMode,e.verticesStart,e.verticesCount,i):n.drawElementsType(Ir.LineListDrawMode,e.indexStart,e.indexCount,i),this},t.prototype.dispose=function(t){this._lineMaterial.dispose(!1,!1,!0),e.prototype.dispose.call(this,t)},t.prototype.clone=function(e,i,n){return void 0===i&&(i=null),new t(e,this.getScene(),i,this,n)},t.prototype.createInstance=function(e){var t=new iu(e,this);if(this.instancedBuffers)for(var i in t.instancedBuffers={},this.instancedBuffers)t.instancedBuffers[i]=this.instancedBuffers[i];return t},t.prototype.serialize=function(t){e.prototype.serialize.call(this,t),t.color=this.color.asArray(),t.alpha=this.alpha},t.Parse=function(e,i){var n=new t(e.name,i);return n.color=N.FromArray(e.color),n.alpha=e.alpha,n},t}(Ur),iu=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.intersectionThreshold=i.intersectionThreshold,n}return V(t,e),t.prototype.getClassName=function(){return\"InstancedLinesMesh\"},t}(Jc);function nu(e){for(var t=[],i=[],n=e.lines,r=e.colors,o=[],a=0,s=0;s0&&(t.push(a-1),t.push(a)),a++}var h=new $n;return h.indices=t,h.positions=i,r&&(h.colors=o),h}function ru(e){var t,i,n=e.dashSize||3,r=e.gapSize||1,o=e.dashNb||200,a=e.points,s=new Array,l=new Array,c=x.Zero(),u=0,h=0,d=0,p=0,f=0;for(f=0;fo?o:Math.floor(a);var s,l,c,u,h=0===e.sideOrientation?0:e.sideOrientation||$n.DEFAULTSIDE,d=e.uvs,p=e.colors,f=[],_=[],m=[],g=[],v=[],y=[],b=[],T=[],E=[],S=[];if(t.length<2){var A=[],R=[];for(c=0;c0&&(P=x[u].subtract(x[u-1]).length()+b[l],v[l].push(P),b[l]=P),u++;n&&(u--,f.push(x[0].x,x[0].y,x[0].z),P=x[u].subtract(x[0]).length()+b[l],v[l].push(P),b[l]=P),E[l]=C+D,S[l]=O,O+=C+D}var N,L,F=null,w=null;for(c=0;c0){var m=h[_-1];x.Dot(m,h[_])<0&&h[_].scaleInPlace(-1),m=d[_-1],x.Dot(m,d[_])<0&&d[_].scaleInPlace(-1),m=p[_-1],x.Dot(m,p[_])<0&&p[_].scaleInPlace(-1)}var g=0,v=c&&s?s:function(){return null!==o?o:0},y=c&&a?a:function(){return null!==r?r:1},b=l===Ur.NO_CAP||l===Ur.CAP_END?0:2,T=O.Matrix[0];for(_=0;_3?0:c;var A=hu(e,{pathArray:T=E(t,i,b=v?new Cn(i,v):new Cn(i),new Array,n,r,o,a,c,u,y),closeArray:s,closePath:l,updatable:d,sideOrientation:p,invertUV:_,frontUVs:m||void 0,backUVs:g||void 0},h);return A._creationDataStorage.pathArray=T,A._creationDataStorage.path3D=b,A._creationDataStorage.cap=c,A}$n.CreateRibbon=uu,Ur.CreateRibbon=function(e,t,i,n,r,o,a,s,l){return void 0===i&&(i=!1),void 0===a&&(a=!1),hu(e,{pathArray:t,closeArray:i,closePath:n,offset:r,updatable:a,sideOrientation:s,instance:l},o)};var mu={ExtrudeShape:pu,ExtrudeShapeCustom:fu};Ur.ExtrudeShape=function(e,t,i,n,r,o,a,s,l,c){return void 0===a&&(a=null),pu(e,{shape:t,path:i,scale:n,rotation:r,cap:0===o?0:o||Ur.NO_CAP,sideOrientation:l,instance:c,updatable:s},a)},Ur.ExtrudeShapeCustom=function(e,t,i,n,r,o,a,s,l,c,u,h){return fu(e,{shape:t,path:i,scaleFunction:n,rotationFunction:r,ribbonCloseArray:o,ribbonClosePath:a,cap:0===s?0:s||Ur.NO_CAP,sideOrientation:u,instance:h,updatable:c},l)};var gu=function(){function e(t,i,n,r,o,a){var s,l,c,u,h,d,p,f,_,m,g,v,y,b;void 0===r&&(r=!0),void 0===o&&(o=3),void 0===a&&(a={}),this.skeleton=t,this.mesh=i,this.autoUpdateBonesMatrices=r,this.renderingGroupId=o,this.options=a,this.color=N.White(),this._debugLines=new Array,this._localAxes=null,this._isEnabled=!0,this._obs=null,this._scene=n,this._ready=!1,a.pauseAnimations=null===(s=a.pauseAnimations)||void 0===s||s,a.returnToRest=null!==(l=a.returnToRest)&&void 0!==l&&l,a.displayMode=null!==(c=a.displayMode)&&void 0!==c?c:e.DISPLAY_LINES,a.displayOptions=null!==(u=a.displayOptions)&&void 0!==u?u:{},a.displayOptions.midStep=null!==(h=a.displayOptions.midStep)&&void 0!==h?h:.235,a.displayOptions.midStepFactor=null!==(d=a.displayOptions.midStepFactor)&&void 0!==d?d:.155,a.displayOptions.sphereBaseSize=null!==(p=a.displayOptions.sphereBaseSize)&&void 0!==p?p:.15,a.displayOptions.sphereScaleUnit=null!==(f=a.displayOptions.sphereScaleUnit)&&void 0!==f?f:2,a.displayOptions.sphereFactor=null!==(_=a.displayOptions.sphereFactor)&&void 0!==_?_:.865,a.displayOptions.spurFollowsChild=null!==(m=a.displayOptions.spurFollowsChild)&&void 0!==m&&m,a.displayOptions.showLocalAxes=null!==(g=a.displayOptions.showLocalAxes)&&void 0!==g&&g,a.displayOptions.localAxesSize=null!==(v=a.displayOptions.localAxesSize)&&void 0!==v?v:.075,a.computeBonesUsingShaders=null===(y=a.computeBonesUsingShaders)||void 0===y||y,a.useAllBones=null===(b=a.useAllBones)||void 0===b||b;var T=i.getVerticesData(wi.MatricesIndicesKind),E=i.getVerticesData(wi.MatricesWeightsKind);if(this._boneIndices=new Set,!a.useAllBones&&T&&E)for(var S=0;Se.DISPLAY_SPHERE_AND_SPURS&&(R=e.DISPLAY_LINES),this.displayMode=R,this.update(),this._bindObs()}return e.CreateBoneWeightShader=function(e,t){var i,n,r,o,a,s,l=e.skeleton,c=null!==(i=e.colorBase)&&void 0!==i?i:N.Black(),u=null!==(n=e.colorZero)&&void 0!==n?n:N.Blue(),h=null!==(r=e.colorQuarter)&&void 0!==r?r:N.Green(),d=null!==(o=e.colorHalf)&&void 0!==o?o:N.Yellow(),p=null!==(a=e.colorFull)&&void 0!==a?a:N.Red(),f=null!==(s=e.targetBoneIndex)&&void 0!==s?s:0;Ot.ShadersStore[\"boneWeights:\"+l.name+\"VertexShader\"]=\"precision highp float;\\n\\n attribute vec3 position;\\n attribute vec2 uv;\\n\\n uniform mat4 view;\\n uniform mat4 projection;\\n uniform mat4 worldViewProjection;\\n\\n #include\\n #if NUM_BONE_INFLUENCERS == 0\\n attribute vec4 matricesIndices;\\n attribute vec4 matricesWeights;\\n #endif\\n #include\\n\\n #include\\n\\n varying vec3 vColor;\\n\\n uniform vec3 colorBase;\\n uniform vec3 colorZero;\\n uniform vec3 colorQuarter;\\n uniform vec3 colorHalf;\\n uniform vec3 colorFull;\\n\\n uniform float targetBoneIndex;\\n\\n void main() {\\n vec3 positionUpdated = position;\\n\\n #include\\n #include\\n #include\\n\\n vec4 worldPos = finalWorld * vec4(positionUpdated, 1.0);\\n\\n vec3 color = colorBase;\\n float totalWeight = 0.;\\n if(matricesIndices[0] == targetBoneIndex && matricesWeights[0] > 0.){\\n totalWeight += matricesWeights[0];\\n }\\n if(matricesIndices[1] == targetBoneIndex && matricesWeights[1] > 0.){\\n totalWeight += matricesWeights[1];\\n }\\n if(matricesIndices[2] == targetBoneIndex && matricesWeights[2] > 0.){\\n totalWeight += matricesWeights[2];\\n }\\n if(matricesIndices[3] == targetBoneIndex && matricesWeights[3] > 0.){\\n totalWeight += matricesWeights[3];\\n }\\n\\n color = mix(color, colorZero, smoothstep(0., 0.25, totalWeight));\\n color = mix(color, colorQuarter, smoothstep(0.25, 0.5, totalWeight));\\n color = mix(color, colorHalf, smoothstep(0.5, 0.75, totalWeight));\\n color = mix(color, colorFull, smoothstep(0.75, 1.0, totalWeight));\\n vColor = color;\\n\\n gl_Position = projection * view * worldPos;\\n }\",Ot.ShadersStore[\"boneWeights:\"+l.name+\"FragmentShader\"]=\"\\n precision highp float;\\n varying vec3 vPosition;\\n\\n varying vec3 vColor;\\n\\n void main() {\\n vec4 color = vec4(vColor, 1.0);\\n gl_FragColor = color;\\n }\\n \";var _=new eu(\"boneWeight:\"+l.name,t,{vertex:\"boneWeights:\"+l.name,fragment:\"boneWeights:\"+l.name},{attributes:[\"position\",\"normal\",\"matricesIndices\",\"matricesWeights\"],uniforms:[\"world\",\"worldView\",\"worldViewProjection\",\"view\",\"projection\",\"viewProjection\",\"colorBase\",\"colorZero\",\"colorQuarter\",\"colorHalf\",\"colorFull\",\"targetBoneIndex\"]});return _.setColor3(\"colorBase\",c),_.setColor3(\"colorZero\",u),_.setColor3(\"colorQuarter\",h),_.setColor3(\"colorHalf\",d),_.setColor3(\"colorFull\",p),_.setFloat(\"targetBoneIndex\",f),_.getClassName=function(){return\"BoneWeightShader\"},_.transparencyMode=Ir.MATERIAL_OPAQUE,_},e.CreateSkeletonMapShader=function(t,i){var n,r=t.skeleton,o=null!==(n=t.colorMap)&&void 0!==n?n:[{color:new N(1,.38,.18),location:0},{color:new N(.59,.18,1),location:.2},{color:new N(.59,1,.18),location:.4},{color:new N(1,.87,.17),location:.6},{color:new N(1,.17,.42),location:.8},{color:new N(.17,.68,1),location:1}],a=r.bones.length+1,s=e._CreateBoneMapColorBuffer(a,o,i),l=new eu(\"boneWeights:\"+r.name,i,{vertexSource:\"precision highp float;\\n\\n attribute vec3 position;\\n attribute vec2 uv;\\n\\n uniform mat4 view;\\n uniform mat4 projection;\\n uniform mat4 worldViewProjection;\\n uniform float colorMap[\"+4*r.bones.length+\"];\\n\\n #include\\n #if NUM_BONE_INFLUENCERS == 0\\n attribute vec4 matricesIndices;\\n attribute vec4 matricesWeights;\\n #endif\\n #include\\n #include\\n\\n varying vec3 vColor;\\n\\n void main() {\\n vec3 positionUpdated = position;\\n\\n #include\\n #include\\n #include\\n\\n vec3 color = vec3(0.);\\n bool first = true;\\n\\n for (int i = 0; i < 4; i++) {\\n int boneIdx = int(matricesIndices[i]);\\n float boneWgt = matricesWeights[i];\\n\\n vec3 c = vec3(colorMap[boneIdx * 4 + 0], colorMap[boneIdx * 4 + 1], colorMap[boneIdx * 4 + 2]);\\n\\n if (boneWgt > 0.) {\\n if (first) {\\n first = false;\\n color = c;\\n } else {\\n color = mix(color, c, boneWgt);\\n }\\n }\\n }\\n\\n vColor = color;\\n\\n vec4 worldPos = finalWorld * vec4(positionUpdated, 1.0);\\n\\n gl_Position = projection * view * worldPos;\\n }\",fragmentSource:\"\\n precision highp float;\\n varying vec3 vColor;\\n\\n void main() {\\n vec4 color = vec4( vColor, 1.0 );\\n gl_FragColor = color;\\n }\\n \"},{attributes:[\"position\",\"normal\",\"matricesIndices\",\"matricesWeights\"],uniforms:[\"world\",\"worldView\",\"worldViewProjection\",\"view\",\"projection\",\"viewProjection\",\"colorMap\"]});return l.setFloats(\"colorMap\",s),l.getClassName=function(){return\"SkeletonMapShader\"},l.transparencyMode=Ir.MATERIAL_OPAQUE,l},e._CreateBoneMapColorBuffer=function(e,t,i){var n=new jl(\"temp\",{width:e,height:1},i,!1),r=n.getContext(),o=r.createLinearGradient(0,0,e,0);t.forEach((function(e){o.addColorStop(e.location,e.color.toHexString())})),r.fillStyle=o,r.fillRect(0,0,e,1),n.update();for(var a=[],s=r.getImageData(0,0,e,1).data,l=0;le.DISPLAY_SPHERE_AND_SPURS&&(t=e.DISPLAY_LINES),this.options.displayMode=t},enumerable:!1,configurable:!0}),e.prototype._bindObs=function(){var t=this;this.displayMode===e.DISPLAY_LINES&&(this._obs=this.scene.onBeforeRenderObservable.add((function(){t._displayLinesUpdate()})))},e.prototype.update=function(){switch(this.displayMode){case e.DISPLAY_LINES:this._displayLinesUpdate();break;case e.DISPLAY_SPHERES:this._buildSpheresAndSpurs(!0);break;case e.DISPLAY_SPHERE_AND_SPURS:this._buildSpheresAndSpurs(!1)}this._buildLocalAxes()},Object.defineProperty(e.prototype,\"isEnabled\",{get:function(){return this._isEnabled},set:function(e){this.isEnabled!==e&&(this._isEnabled=e,this.debugMesh&&this.debugMesh.setEnabled(e),e&&!this._obs?this._bindObs():!e&&this._obs&&(this.scene.onBeforeRenderObservable.remove(this._obs),this._obs=null))},enumerable:!1,configurable:!0}),e.prototype._getBonePosition=function(e,t,i,n,r,o){void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=0);var a=O.Matrix[0],s=t.getParent();if(a.copyFrom(t.getLocalMatrix()),0!==n||0!==r||0!==o){var l=O.Matrix[1];M.IdentityToRef(l),l.setTranslationFromFloats(n,r,o),l.multiplyToRef(a,a)}s&&a.multiplyToRef(s.getAbsoluteTransform(),a),a.multiplyToRef(i,a),e.x=a.m[12],e.y=a.m[13],e.z=a.m[14]},e.prototype._getLinesForBonesWithLength=function(e,t){for(var i=e.length,n=this.mesh.position,r=0,o=0;o=0;o--){var a=e[o],s=a.getParent();if(s&&(this._boneIndices.has(a.getIndex())||this.options.useAllBones)){var l=this._debugLines[i];l||(l=[x.Zero(),x.Zero()],this._debugLines[i]=l),a.getAbsolutePositionToRef(n,l[0]),s.getAbsolutePositionToRef(n,l[1]),l[0].subtractInPlace(r),l[1].subtractInPlace(r),i++}}},e.prototype._revert=function(e){this.options.pauseAnimations&&(this.scene.animationsEnabled=e,this.utilityLayer.utilityLayerScene.animationsEnabled=e)},e.prototype._getAbsoluteBindPoseToRef=function(e,t){null!==e&&-1!==e._index?(this._getAbsoluteBindPoseToRef(e.getParent(),t),e.getBaseMatrix().multiplyToRef(t,t)):t.copyFrom(M.Identity())},e.prototype._buildSpheresAndSpurs=function(e){var t,i;void 0===e&&(e=!0),this._debugMesh&&(this._debugMesh.dispose(),this._debugMesh=null,this.ready=!1),this._ready=!1;var n=null===(t=this.utilityLayer)||void 0===t?void 0:t.utilityLayerScene,r=this.skeleton.bones,o=[],a=[],s=this.scene.animationsEnabled;try{this.options.pauseAnimations&&(this.scene.animationsEnabled=!1,n.animationsEnabled=!1),this.options.returnToRest&&this.skeleton.returnToRest(),this.autoUpdateBonesMatrices&&this.skeleton.computeAbsoluteTransforms();for(var l=Number.NEGATIVE_INFINITY,c=this.options.displayOptions||{},u=function(t){var i=r[t];if(-1===i._index||!h._boneIndices.has(i.getIndex())&&!h.options.useAllBones)return\"continue\";var s=new M;h._getAbsoluteBindPoseToRef(i,s);var u=new x;s.decompose(void 0,void 0,u),i.children.forEach((function(t){var r=new M;t.getBaseMatrix().multiplyToRef(s,r);var o=new x;r.decompose(void 0,void 0,o);var h=x.Distance(u,o);if(h>l&&(l=h),!e){for(var d=o.clone().subtract(u.clone()),p=d.length(),f=d.normalize().scale(p),_=c.midStep||.165,m=c.midStepFactor||.215,g=f.scale(_),v=fu(\"skeletonViewer\",{shape:[new x(1,-1,0),new x(1,1,0),new x(-1,1,0),new x(-1,-1,0),new x(1,-1,0)],path:[x.Zero(),g,f],scaleFunction:function(e){switch(e){case 0:case 2:return 0;case 1:return p*m}return 0},sideOrientation:Ur.DEFAULTSIDE,updatable:!1},n),y=v.getTotalVertices(),b=[],T=[],E=0;E9?T.push(t.getIndex(),0,0,0):T.push(i.getIndex(),0,0,0);v.position=u.clone(),v.setVerticesData(wi.MatricesWeightsKind,b,!1),v.setVerticesData(wi.MatricesIndicesKind,T,!1),v.convertToFlatShadedMesh(),a.push(v)}}));for(var d=jc(\"skeletonViewer\",{segments:6,diameter:c.sphereBaseSize||.2,updatable:!0},n),p=d.getTotalVertices(),f=[],_=[],m=0;m=6&&e._showPlanes)})),this._oldPosition.set(Number.NaN,Number.NaN,Number.NaN),this._visible=!0},e.prototype.hide=function(){this._lightHelperFrustumMeshes.forEach((function(e){e.setEnabled(!1)})),this._visible=!1},e.prototype.update=function(){var e,t,i,n,r,o;if(this._visible&&(!this._oldPosition.equals(this._light.position)||!this._oldDirection.equals(this._light.direction)||this._oldAutoCalc!==this._light.autoCalcShadowZBounds||this._oldMinZ!==this._light.shadowMinZ||this._oldMaxZ!==this._light.shadowMaxZ)){this._oldPosition.copyFrom(this._light.position),this._oldDirection.copyFrom(this._light.direction),this._oldAutoCalc=this._light.autoCalcShadowZBounds,this._oldMinZ=this._light.shadowMinZ,this._oldMaxZ=this._light.shadowMaxZ,O.Vector3[0].set(this._light.orthoLeft,this._light.orthoBottom,void 0!==this._light.shadowMinZ?this._light.shadowMinZ:this._camera.minZ),O.Vector3[1].set(this._light.orthoRight,this._light.orthoTop,void 0!==this._light.shadowMaxZ?this._light.shadowMaxZ:this._camera.maxZ);var a=this._getInvertViewMatrix();O.Vector3[2].copyFromFloats(O.Vector3[1].x,O.Vector3[1].y,O.Vector3[0].z),O.Vector3[3].copyFromFloats(O.Vector3[1].x,O.Vector3[0].y,O.Vector3[0].z),O.Vector3[4].copyFromFloats(O.Vector3[0].x,O.Vector3[0].y,O.Vector3[0].z),O.Vector3[5].copyFromFloats(O.Vector3[0].x,O.Vector3[1].y,O.Vector3[0].z),x.TransformCoordinatesToRef(O.Vector3[2],a,O.Vector3[2]),x.TransformCoordinatesToRef(O.Vector3[3],a,O.Vector3[3]),x.TransformCoordinatesToRef(O.Vector3[4],a,O.Vector3[4]),x.TransformCoordinatesToRef(O.Vector3[5],a,O.Vector3[5]),O.Vector3[6].copyFromFloats(O.Vector3[1].x,O.Vector3[1].y,O.Vector3[1].z),O.Vector3[7].copyFromFloats(O.Vector3[1].x,O.Vector3[0].y,O.Vector3[1].z),O.Vector3[8].copyFromFloats(O.Vector3[0].x,O.Vector3[0].y,O.Vector3[1].z),O.Vector3[9].copyFromFloats(O.Vector3[0].x,O.Vector3[1].y,O.Vector3[1].z),x.TransformCoordinatesToRef(O.Vector3[6],a,O.Vector3[6]),x.TransformCoordinatesToRef(O.Vector3[7],a,O.Vector3[7]),x.TransformCoordinatesToRef(O.Vector3[8],a,O.Vector3[8]),x.TransformCoordinatesToRef(O.Vector3[9],a,O.Vector3[9]),au(\"nearlines\",{updatable:!0,points:this._nearLinesPoints,instance:this._lightHelperFrustumMeshes[0]},this._scene),au(\"farlines\",{updatable:!0,points:this._farLinesPoints,instance:this._lightHelperFrustumMeshes[1]},this._scene),au(\"trlines\",{updatable:!0,points:this._trLinesPoints,instance:this._lightHelperFrustumMeshes[2]},this._scene),au(\"brlines\",{updatable:!0,points:this._brLinesPoints,instance:this._lightHelperFrustumMeshes[3]},this._scene),au(\"tllines\",{updatable:!0,points:this._tlLinesPoints,instance:this._lightHelperFrustumMeshes[4]},this._scene),au(\"bllines\",{updatable:!0,points:this._blLinesPoints,instance:this._lightHelperFrustumMeshes[5]},this._scene),O.Vector3[2].toArray(this._nearPlaneVertices,0),O.Vector3[3].toArray(this._nearPlaneVertices,3),O.Vector3[4].toArray(this._nearPlaneVertices,6),O.Vector3[5].toArray(this._nearPlaneVertices,9),null===(e=this._lightHelperFrustumMeshes[6].geometry)||void 0===e||e.updateVerticesDataDirectly(\"position\",this._nearPlaneVertices,0),O.Vector3[6].toArray(this._farPlaneVertices,0),O.Vector3[7].toArray(this._farPlaneVertices,3),O.Vector3[8].toArray(this._farPlaneVertices,6),O.Vector3[9].toArray(this._farPlaneVertices,9),null===(t=this._lightHelperFrustumMeshes[7].geometry)||void 0===t||t.updateVerticesDataDirectly(\"position\",this._farPlaneVertices,0),O.Vector3[2].toArray(this._rightPlaneVertices,0),O.Vector3[6].toArray(this._rightPlaneVertices,3),O.Vector3[7].toArray(this._rightPlaneVertices,6),O.Vector3[3].toArray(this._rightPlaneVertices,9),null===(i=this._lightHelperFrustumMeshes[8].geometry)||void 0===i||i.updateVerticesDataDirectly(\"position\",this._rightPlaneVertices,0),O.Vector3[5].toArray(this._leftPlaneVertices,0),O.Vector3[9].toArray(this._leftPlaneVertices,3),O.Vector3[8].toArray(this._leftPlaneVertices,6),O.Vector3[4].toArray(this._leftPlaneVertices,9),null===(n=this._lightHelperFrustumMeshes[9].geometry)||void 0===n||n.updateVerticesDataDirectly(\"position\",this._leftPlaneVertices,0),O.Vector3[2].toArray(this._topPlaneVertices,0),O.Vector3[6].toArray(this._topPlaneVertices,3),O.Vector3[9].toArray(this._topPlaneVertices,6),O.Vector3[5].toArray(this._topPlaneVertices,9),null===(r=this._lightHelperFrustumMeshes[10].geometry)||void 0===r||r.updateVerticesDataDirectly(\"position\",this._topPlaneVertices,0),O.Vector3[3].toArray(this._bottomPlaneVertices,0),O.Vector3[7].toArray(this._bottomPlaneVertices,3),O.Vector3[8].toArray(this._bottomPlaneVertices,6),O.Vector3[4].toArray(this._bottomPlaneVertices,9),null===(o=this._lightHelperFrustumMeshes[11].geometry)||void 0===o||o.updateVerticesDataDirectly(\"position\",this._bottomPlaneVertices,0)}},e.prototype.dispose=function(){this._lightHelperFrustumMeshes.forEach((function(e){var t;null===(t=e.material)||void 0===t||t.dispose(),e.dispose()})),this._rootNode.dispose()},e.prototype._createGeometry=function(){var e=this;this._rootNode=new yr(\"directionalLightHelperRoot_\"+this._light.name,this._scene),this._rootNode.parent=this._light.parent,this._nearLinesPoints=[x.ZeroReadOnly,x.ZeroReadOnly,x.ZeroReadOnly,x.ZeroReadOnly,x.ZeroReadOnly];var t=au(\"nearlines\",{updatable:!0,points:this._nearLinesPoints},this._scene);t.parent=this._rootNode,t.alwaysSelectAsActiveMesh=!0,this._farLinesPoints=[x.ZeroReadOnly,x.ZeroReadOnly,x.ZeroReadOnly,x.ZeroReadOnly,x.ZeroReadOnly];var i=au(\"farlines\",{updatable:!0,points:this._farLinesPoints},this._scene);i.parent=this._rootNode,i.alwaysSelectAsActiveMesh=!0,this._trLinesPoints=[x.ZeroReadOnly,x.ZeroReadOnly];var n=au(\"trlines\",{updatable:!0,points:this._trLinesPoints},this._scene);n.parent=this._rootNode,n.alwaysSelectAsActiveMesh=!0,this._brLinesPoints=[x.ZeroReadOnly,x.ZeroReadOnly];var r=au(\"brlines\",{updatable:!0,points:this._brLinesPoints},this._scene);r.parent=this._rootNode,r.alwaysSelectAsActiveMesh=!0,this._tlLinesPoints=[x.ZeroReadOnly,x.ZeroReadOnly];var o=au(\"tllines\",{updatable:!0,points:this._tlLinesPoints},this._scene);o.parent=this._rootNode,o.alwaysSelectAsActiveMesh=!0,this._blLinesPoints=[x.ZeroReadOnly,x.ZeroReadOnly];var a=au(\"bllines\",{updatable:!0,points:this._blLinesPoints},this._scene);a.parent=this._rootNode,a.alwaysSelectAsActiveMesh=!0,this._lightHelperFrustumMeshes.push(t,i,n,r,o,a);var s=function(t,i,n){var r=new Ur(t+\"plane\",e._scene),o=new Xl(t+\"PlaneMat\",e._scene);r.material=o,r.parent=e._rootNode,r.alwaysSelectAsActiveMesh=!0,o.emissiveColor=i,o.alpha=e.transparency,o.backFaceCulling=!1,o.disableLighting=!0;var a=new $n;a.positions=n,a.indices=[0,1,2,0,2,3],a.applyToMesh(r,!0),e._lightHelperFrustumMeshes.push(r)};this._nearPlaneVertices=[0,0,0,0,0,0,0,0,0,0,0,0],this._farPlaneVertices=[0,0,0,0,0,0,0,0,0,0,0,0],this._rightPlaneVertices=[0,0,0,0,0,0,0,0,0,0,0,0],this._leftPlaneVertices=[0,0,0,0,0,0,0,0,0,0,0,0],this._topPlaneVertices=[0,0,0,0,0,0,0,0,0,0,0,0],this._bottomPlaneVertices=[0,0,0,0,0,0,0,0,0,0,0,0],s(\"near\",new N(1,0,0),this._nearPlaneVertices),s(\"far\",new N(.3,0,0),this._farPlaneVertices),s(\"right\",new N(0,1,0),this._rightPlaneVertices),s(\"left\",new N(0,.3,0),this._leftPlaneVertices),s(\"top\",new N(0,0,1),this._topPlaneVertices),s(\"bottom\",new N(0,0,.3),this._bottomPlaneVertices),this._nearLinesPoints[0]=O.Vector3[2],this._nearLinesPoints[1]=O.Vector3[3],this._nearLinesPoints[2]=O.Vector3[4],this._nearLinesPoints[3]=O.Vector3[5],this._nearLinesPoints[4]=O.Vector3[2],this._farLinesPoints[0]=O.Vector3[6],this._farLinesPoints[1]=O.Vector3[7],this._farLinesPoints[2]=O.Vector3[8],this._farLinesPoints[3]=O.Vector3[9],this._farLinesPoints[4]=O.Vector3[6],this._trLinesPoints[0]=O.Vector3[2],this._trLinesPoints[1]=O.Vector3[6],this._brLinesPoints[0]=O.Vector3[3],this._brLinesPoints[1]=O.Vector3[7],this._tlLinesPoints[0]=O.Vector3[4],this._tlLinesPoints[1]=O.Vector3[8],this._blLinesPoints[0]=O.Vector3[5],this._blLinesPoints[1]=O.Vector3[9]},e.prototype._getInvertViewMatrix=function(){return M.LookAtLHToRef(this._light.position,this._light.position.add(this._light.direction),x.UpReadOnly,this._inverseViewMatrix),this._inverseViewMatrix.invertToRef(this._inverseViewMatrix),this._inverseViewMatrix},e}(),yu=function(){this.renderWidth=512,this.renderHeight=256,this.textureSize=512,this.deterministicLockstep=!1,this.lockstepMaxSteps=4},bu=function(t){function i(i){void 0===i&&(i=new yu);var n=t.call(this,null)||this;vr.Instances.push(n),void 0===i.deterministicLockstep&&(i.deterministicLockstep=!1),void 0===i.lockstepMaxSteps&&(i.lockstepMaxSteps=4),n._options=i,E.SetMatrixPrecision(!!i.useHighPrecisionMatrix),n._caps={maxTexturesImageUnits:16,maxVertexTextureImageUnits:16,maxCombinedTexturesImageUnits:32,maxTextureSize:512,maxCubemapTextureSize:512,maxRenderTextureSize:512,maxVertexAttribs:16,maxVaryingVectors:16,maxFragmentUniformVectors:16,maxVertexUniformVectors:16,standardDerivatives:!1,astc:null,pvrtc:null,etc1:null,etc2:null,bptc:null,maxAnisotropy:0,uintIndices:!1,fragmentDepthSupported:!1,highPrecisionShaderSupported:!0,colorBufferFloat:!1,textureFloat:!1,textureFloatLinearFiltering:!1,textureFloatRender:!1,textureHalfFloat:!1,textureHalfFloatLinearFiltering:!1,textureHalfFloatRender:!1,textureLOD:!1,drawBuffersExtension:!1,depthTextureExtension:!1,vertexArrayObject:!1,instancedArrays:!1,supportOcclusionQuery:!1,canUseTimestampForTimerQuery:!1,maxMSAASamples:1,blendMinMax:!1,canUseGLInstanceID:!1,canUseGLVertexID:!1,supportComputeShaders:!1,supportSRGBBuffers:!1,supportTransformFeedbacks:!1,textureMaxLevel:!1,texture2DArrayMaxLayerCount:128},n._features={forceBitmapOverHTMLImageElement:!1,supportRenderAndCopyToLodForFloatTextures:!1,supportDepthStencilTexture:!1,supportShadowSamplers:!1,uniformBufferHardCheckMatrix:!1,allowTexturePrefiltering:!1,trackUbosInFrame:!1,checkUbosContentBeforeUpload:!1,supportCSM:!1,basisNeedsPOT:!1,support3DTextures:!1,needTypeSuffixInShaderConstants:!1,supportMSAA:!1,supportSSAO2:!1,supportExtendedTextureFormats:!1,supportSwitchCaseInShader:!1,supportSyncTextureRead:!1,needsInvertingBitmap:!1,useUBOBindingCache:!1,needShaderCodeInlining:!1,needToAlwaysBindUniformBuffers:!1,supportRenderPasses:!0,supportSpriteInstancing:!1,_collectUbosUpdatedInFrame:!1},Q.Log(\"Babylon.js v\".concat(vr.Version,\" - Null engine\"));var r=\"undefined\"!=typeof self?self:void 0!==e.g?e.g:window;return\"undefined\"==typeof URL&&(r.URL={createObjectURL:function(){},revokeObjectURL:function(){}}),\"undefined\"==typeof Blob&&(r.Blob=function(){}),n}return V(i,t),i.prototype.isDeterministicLockStep=function(){return this._options.deterministicLockstep},i.prototype.getLockstepMaxSteps=function(){return this._options.lockstepMaxSteps},i.prototype.getHardwareScalingLevel=function(){return 1},i.prototype.createVertexBuffer=function(e){var t=new Vt;return t.references=1,t},i.prototype.createIndexBuffer=function(e){var t=new Vt;return t.references=1,t},i.prototype.clear=function(e,t,i,n){void 0===n&&(n=!1)},i.prototype.getRenderWidth=function(e){return void 0===e&&(e=!1),!e&&this._currentRenderTarget?this._currentRenderTarget.width:this._options.renderWidth},i.prototype.getRenderHeight=function(e){return void 0===e&&(e=!1),!e&&this._currentRenderTarget?this._currentRenderTarget.height:this._options.renderHeight},i.prototype.setViewport=function(e,t,i){this._cachedViewport=e},i.prototype.createShaderProgram=function(e,t,i,n,r){return{__SPECTOR_rebuildProgram:null}},i.prototype.getUniforms=function(e,t){return[]},i.prototype.getAttributes=function(e,t){return[]},i.prototype.bindSamplers=function(e){this._currentEffect=null},i.prototype.enableEffect=function(e){e=null!==e&&Ht.IsWrapper(e)?e.effect:e,this._currentEffect=e,e&&(e.onBind&&e.onBind(e),e._onBindObservable&&e._onBindObservable.notifyObservers(e))},i.prototype.setState=function(e,t,i,n,r,o,a){void 0===t&&(t=0),void 0===n&&(n=!1),void 0===a&&(a=0)},i.prototype.setIntArray=function(e,t){return!0},i.prototype.setIntArray2=function(e,t){return!0},i.prototype.setIntArray3=function(e,t){return!0},i.prototype.setIntArray4=function(e,t){return!0},i.prototype.setFloatArray=function(e,t){return!0},i.prototype.setFloatArray2=function(e,t){return!0},i.prototype.setFloatArray3=function(e,t){return!0},i.prototype.setFloatArray4=function(e,t){return!0},i.prototype.setArray=function(e,t){return!0},i.prototype.setArray2=function(e,t){return!0},i.prototype.setArray3=function(e,t){return!0},i.prototype.setArray4=function(e,t){return!0},i.prototype.setMatrices=function(e,t){return!0},i.prototype.setMatrix3x3=function(e,t){return!0},i.prototype.setMatrix2x2=function(e,t){return!0},i.prototype.setFloat=function(e,t){return!0},i.prototype.setFloat2=function(e,t,i){return!0},i.prototype.setFloat3=function(e,t,i,n){return!0},i.prototype.setBool=function(e,t){return!0},i.prototype.setFloat4=function(e,t,i,n,r){return!0},i.prototype.setAlphaMode=function(e,t){void 0===t&&(t=!1),this._alphaMode!==e&&(this.alphaState.alphaBlend=e!==a.ALPHA_DISABLE,t||this.setDepthWrite(e===a.ALPHA_DISABLE),this._alphaMode=e)},i.prototype.bindBuffers=function(e,t,i){},i.prototype.wipeCaches=function(e){this.preventCacheWipeBetweenFrames||(this.resetTextureCache(),this._currentEffect=null,e&&(this._currentProgram=null,this._stencilStateComposer.reset(),this.depthCullingState.reset(),this.alphaState.reset()),this._cachedVertexBuffers=null,this._cachedIndexBuffer=null,this._cachedEffectForVertexBuffers=null)},i.prototype.draw=function(e,t,i,n){},i.prototype.drawElementsType=function(e,t,i,n){},i.prototype.drawArraysType=function(e,t,i,n){},i.prototype._createTexture=function(){return{}},i.prototype._releaseTexture=function(e){},i.prototype.createTexture=function(e,t,i,n,r,o,s,l,c,u,h,d){void 0===r&&(r=a.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===o&&(o=null),void 0===s&&(s=null),void 0===l&&(l=null),void 0===c&&(c=null),void 0===u&&(u=null),void 0===h&&(h=null);var p=new wt(this,Rt.Url),f=String(e);return p.url=f,p.generateMipMaps=!t,p.samplingMode=r,p.invertY=i,p.baseWidth=this._options.textureSize,p.baseHeight=this._options.textureSize,p.width=this._options.textureSize,p.height=this._options.textureSize,u&&(p.format=u),p.isReady=!0,o&&setTimeout((function(){o(p)})),this._internalTexturesCache.push(p),p},i.prototype._createHardwareRenderTargetWrapper=function(e,t,i){var n=new ha(e,t,i,this);return this._renderTargetWrapperCache.push(n),n},i.prototype.createRenderTargetTexture=function(e,t){var i=this._createHardwareRenderTargetWrapper(!1,!1,e),n={};void 0!==t&&\"object\"==typeof t?(n.generateMipMaps=t.generateMipMaps,n.generateDepthBuffer=void 0===t.generateDepthBuffer||t.generateDepthBuffer,n.generateStencilBuffer=n.generateDepthBuffer&&t.generateStencilBuffer,n.type=void 0===t.type?a.TEXTURETYPE_UNSIGNED_INT:t.type,n.samplingMode=void 0===t.samplingMode?a.TEXTURE_TRILINEAR_SAMPLINGMODE:t.samplingMode):(n.generateMipMaps=t,n.generateDepthBuffer=!0,n.generateStencilBuffer=!1,n.type=a.TEXTURETYPE_UNSIGNED_INT,n.samplingMode=a.TEXTURE_TRILINEAR_SAMPLINGMODE);var r=new wt(this,Rt.RenderTarget),o=e.width||e,s=e.height||e;return i._generateDepthBuffer=n.generateDepthBuffer,i._generateStencilBuffer=!!n.generateStencilBuffer,r.baseWidth=o,r.baseHeight=s,r.width=o,r.height=s,r.isReady=!0,r.samples=1,r.generateMipMaps=!!n.generateMipMaps,r.samplingMode=n.samplingMode,r.type=n.type,this._internalTexturesCache.push(r),i},i.prototype.updateTextureSamplingMode=function(e,t){t.samplingMode=e},i.prototype.createRawTexture=function(e,t,i,n,r,o,s,l,c,u,h){void 0===l&&(l=null),void 0===c&&(c=a.TEXTURETYPE_UNSIGNED_INT),void 0===u&&(u=0),void 0===h&&(h=!1);var d=new wt(this,Rt.Raw);return d.baseWidth=t,d.baseHeight=i,d.width=t,d.height=i,d.format=n,d.generateMipMaps=r,d.samplingMode=s,d.invertY=o,d._compression=l,d.type=c,d._useSRGBBuffer=h,this._doNotHandleContextLost||(d._bufferView=e),d},i.prototype.updateRawTexture=function(e,t,i,n,r,o,s){void 0===r&&(r=null),void 0===o&&(o=a.TEXTURETYPE_UNSIGNED_INT),void 0===s&&(s=!1),e&&(e._bufferView=t,e.format=i,e.invertY=n,e._compression=r,e.type=o,e._useSRGBBuffer=s)},i.prototype.bindFramebuffer=function(e,t,i,n,r){this._currentRenderTarget&&this.unBindFramebuffer(this._currentRenderTarget),this._currentRenderTarget=e,this._currentFramebuffer=null,this._cachedViewport&&!r&&this.setViewport(this._cachedViewport,i,n)},i.prototype.unBindFramebuffer=function(e,t,i){void 0===t&&(t=!1),this._currentRenderTarget=null,i&&i(),this._currentFramebuffer=null},i.prototype.createDynamicVertexBuffer=function(e){var t=new Vt;return t.references=1,t.capacity=1,t},i.prototype.updateDynamicTexture=function(e,t,i,n,r){void 0===n&&(n=!1)},i.prototype.areAllEffectsReady=function(){return!0},i.prototype.getError=function(){return 0},i.prototype._getUnpackAlignement=function(){return 1},i.prototype._unpackFlipY=function(e){},i.prototype.updateDynamicIndexBuffer=function(e,t,i){void 0===i&&(i=0)},i.prototype.updateDynamicVertexBuffer=function(e,t,i,n){},i.prototype._bindTextureDirectly=function(e,t){return this._boundTexturesCache[this._activeChannel]!==t&&(this._boundTexturesCache[this._activeChannel]=t,!0)},i.prototype._bindTexture=function(e,t){e<0||this._bindTextureDirectly(0,t)},i.prototype._deleteBuffer=function(e){},i.prototype.releaseEffects=function(){},i.prototype.displayLoadingUI=function(){},i.prototype.hideLoadingUI=function(){},Object.defineProperty(i.prototype,\"loadingUIText\",{set:function(e){},enumerable:!1,configurable:!0}),i.prototype._uploadCompressedDataToTextureDirectly=function(e,t,i,n,r,o,a){void 0===o&&(o=0),void 0===a&&(a=0)},i.prototype._uploadDataToTextureDirectly=function(e,t,i,n){void 0===i&&(i=0),void 0===n&&(n=0)},i.prototype._uploadArrayBufferViewToTexture=function(e,t,i,n){void 0===i&&(i=0),void 0===n&&(n=0)},i.prototype._uploadImageToTexture=function(e,t,i,n){void 0===i&&(i=0),void 0===n&&(n=0)},i}(vr);Yt.prototype._debugPushGroup=function(e,t){},Yt.prototype._debugPopGroup=function(e){},Yt.prototype._debugInsertMarker=function(e,t){},Yt.prototype._debugFlushPendingCommands=function(){};var Tu=function(){this._timeElapsedQueryEnded=!1},Eu=function(){this.occlusionInternalRetryCounter=0,this.isOcclusionQueryInProgress=!1,this.isOccluded=!1,this.occlusionRetryCount=-1,this.occlusionType=Sr.OCCLUSION_TYPE_NONE,this.occlusionQueryAlgorithmType=Sr.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE,this.forceRenderingWhenOccluded=!1};vr.prototype.createQuery=function(){var e=this._gl.createQuery();if(!e)throw new Error(\"Unable to create Occlusion Query\");return e},vr.prototype.deleteQuery=function(e){return this._gl.deleteQuery(e),this},vr.prototype.isQueryResultAvailable=function(e){return this._gl.getQueryParameter(e,this._gl.QUERY_RESULT_AVAILABLE)},vr.prototype.getQueryResult=function(e){return this._gl.getQueryParameter(e,this._gl.QUERY_RESULT)},vr.prototype.beginOcclusionQuery=function(e,t){var i=this._getGlAlgorithmType(e);return this._gl.beginQuery(i,t),!0},vr.prototype.endOcclusionQuery=function(e){var t=this._getGlAlgorithmType(e);return this._gl.endQuery(t),this},vr.prototype._createTimeQuery=function(){var e=this.getCaps().timerQuery;return e.createQueryEXT?e.createQueryEXT():this.createQuery()},vr.prototype._deleteTimeQuery=function(e){var t=this.getCaps().timerQuery;t.deleteQueryEXT?t.deleteQueryEXT(e):this.deleteQuery(e)},vr.prototype._getTimeQueryResult=function(e){var t=this.getCaps().timerQuery;return t.getQueryObjectEXT?t.getQueryObjectEXT(e,t.QUERY_RESULT_EXT):this.getQueryResult(e)},vr.prototype._getTimeQueryAvailability=function(e){var t=this.getCaps().timerQuery;return t.getQueryObjectEXT?t.getQueryObjectEXT(e,t.QUERY_RESULT_AVAILABLE_EXT):this.isQueryResultAvailable(e)},vr.prototype.startTimeQuery=function(){var e=this.getCaps(),t=e.timerQuery;if(!t)return null;var i=new Tu;if(this._gl.getParameter(t.GPU_DISJOINT_EXT),e.canUseTimestampForTimerQuery)i._startTimeQuery=this._createTimeQuery(),t.queryCounterEXT(i._startTimeQuery,t.TIMESTAMP_EXT);else{if(this._currentNonTimestampToken)return this._currentNonTimestampToken;i._timeElapsedQuery=this._createTimeQuery(),t.beginQueryEXT?t.beginQueryEXT(t.TIME_ELAPSED_EXT,i._timeElapsedQuery):this._gl.beginQuery(t.TIME_ELAPSED_EXT,i._timeElapsedQuery),this._currentNonTimestampToken=i}return i},vr.prototype.endTimeQuery=function(e){var t=this.getCaps(),i=t.timerQuery;if(!i||!e)return-1;if(t.canUseTimestampForTimerQuery){if(!e._startTimeQuery)return-1;e._endTimeQuery||(e._endTimeQuery=this._createTimeQuery(),i.queryCounterEXT(e._endTimeQuery,i.TIMESTAMP_EXT))}else if(!e._timeElapsedQueryEnded){if(!e._timeElapsedQuery)return-1;i.endQueryEXT?i.endQueryEXT(i.TIME_ELAPSED_EXT):(this._gl.endQuery(i.TIME_ELAPSED_EXT),this._currentNonTimestampToken=null),e._timeElapsedQueryEnded=!0}var n=this._gl.getParameter(i.GPU_DISJOINT_EXT),r=!1;if(e._endTimeQuery?r=this._getTimeQueryAvailability(e._endTimeQuery):e._timeElapsedQuery&&(r=this._getTimeQueryAvailability(e._timeElapsedQuery)),r&&!n){var o=0;if(t.canUseTimestampForTimerQuery){if(!e._startTimeQuery||!e._endTimeQuery)return-1;var a=this._getTimeQueryResult(e._startTimeQuery);o=this._getTimeQueryResult(e._endTimeQuery)-a,this._deleteTimeQuery(e._startTimeQuery),this._deleteTimeQuery(e._endTimeQuery),e._startTimeQuery=null,e._endTimeQuery=null}else{if(!e._timeElapsedQuery)return-1;o=this._getTimeQueryResult(e._timeElapsedQuery),this._deleteTimeQuery(e._timeElapsedQuery),e._timeElapsedQuery=null,e._timeElapsedQueryEnded=!1}return o}return-1},vr.prototype._captureGPUFrameTime=!1,vr.prototype._gpuFrameTime=new cn,vr.prototype.getGPUFrameTimeCounter=function(){return this._gpuFrameTime},vr.prototype.captureGPUFrameTime=function(e){var t=this;e!==this._captureGPUFrameTime&&(this._captureGPUFrameTime=e,e?(this._onBeginFrameObserver=this.onBeginFrameObservable.add((function(){t._gpuFrameTimeToken||(t._gpuFrameTimeToken=t.startTimeQuery())})),this._onEndFrameObserver=this.onEndFrameObservable.add((function(){if(t._gpuFrameTimeToken){var e=t.endTimeQuery(t._gpuFrameTimeToken);e>-1&&(t._gpuFrameTimeToken=null,t._gpuFrameTime.fetchNewFrame(),t._gpuFrameTime.addCount(e,!0))}}))):(this.onBeginFrameObservable.remove(this._onBeginFrameObserver),this._onBeginFrameObserver=null,this.onEndFrameObservable.remove(this._onEndFrameObserver),this._onEndFrameObserver=null))},vr.prototype._getGlAlgorithmType=function(e){return e===Sr.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE?this._gl.ANY_SAMPLES_PASSED_CONSERVATIVE:this._gl.ANY_SAMPLES_PASSED},Object.defineProperty(Sr.prototype,\"isOcclusionQueryInProgress\",{get:function(){return this._occlusionDataStorage.isOcclusionQueryInProgress},set:function(e){this._occlusionDataStorage.isOcclusionQueryInProgress=e},enumerable:!1,configurable:!0}),Object.defineProperty(Sr.prototype,\"_occlusionDataStorage\",{get:function(){return this.__occlusionDataStorage||(this.__occlusionDataStorage=new Eu),this.__occlusionDataStorage},enumerable:!1,configurable:!0}),Object.defineProperty(Sr.prototype,\"isOccluded\",{get:function(){return this._occlusionDataStorage.isOccluded},set:function(e){this._occlusionDataStorage.isOccluded=e},enumerable:!0,configurable:!0}),Object.defineProperty(Sr.prototype,\"occlusionQueryAlgorithmType\",{get:function(){return this._occlusionDataStorage.occlusionQueryAlgorithmType},set:function(e){this._occlusionDataStorage.occlusionQueryAlgorithmType=e},enumerable:!0,configurable:!0}),Object.defineProperty(Sr.prototype,\"occlusionType\",{get:function(){return this._occlusionDataStorage.occlusionType},set:function(e){this._occlusionDataStorage.occlusionType=e},enumerable:!0,configurable:!0}),Object.defineProperty(Sr.prototype,\"occlusionRetryCount\",{get:function(){return this._occlusionDataStorage.occlusionRetryCount},set:function(e){this._occlusionDataStorage.occlusionRetryCount=e},enumerable:!0,configurable:!0}),Object.defineProperty(Sr.prototype,\"forceRenderingWhenOccluded\",{get:function(){return this._occlusionDataStorage.forceRenderingWhenOccluded},set:function(e){this._occlusionDataStorage.forceRenderingWhenOccluded=e},enumerable:!0,configurable:!0}),Sr.prototype._checkOcclusionQuery=function(){var e=this._occlusionDataStorage;if(e.occlusionType===Sr.OCCLUSION_TYPE_NONE)return e.isOccluded=!1,!1;var t=this.getEngine();if(!t.getCaps().supportOcclusionQuery)return e.isOccluded=!1,!1;if(!t.isQueryResultAvailable)return e.isOccluded=!1,!1;if(this.isOcclusionQueryInProgress&&this._occlusionQuery)if(t.isQueryResultAvailable(this._occlusionQuery)){var i=t.getQueryResult(this._occlusionQuery);e.isOcclusionQueryInProgress=!1,e.occlusionInternalRetryCounter=0,e.isOccluded=!(i>0)}else{if(e.occlusionInternalRetryCounter++,!(-1!==e.occlusionRetryCount&&e.occlusionInternalRetryCounter>e.occlusionRetryCount))return e.occlusionType!==Sr.OCCLUSION_TYPE_OPTIMISTIC&&e.isOccluded;e.isOcclusionQueryInProgress=!1,e.occlusionInternalRetryCounter=0,e.isOccluded=e.occlusionType!==Sr.OCCLUSION_TYPE_OPTIMISTIC&&e.isOccluded}var n=this.getScene();if(n.getBoundingBoxRenderer){var r=n.getBoundingBoxRenderer();null===this._occlusionQuery&&(this._occlusionQuery=t.createQuery()),t.beginOcclusionQuery(e.occlusionQueryAlgorithmType,this._occlusionQuery)&&(r.renderOcclusionBoundingBox(this),t.endOcclusionQuery(e.occlusionQueryAlgorithmType),this._occlusionDataStorage.isOcclusionQueryInProgress=!0)}return e.isOccluded};var Su=!0;vr.prototype.createTransformFeedback=function(){var e=this._gl.createTransformFeedback();if(!e)throw new Error(\"Unable to create Transform Feedback\");return e},vr.prototype.deleteTransformFeedback=function(e){this._gl.deleteTransformFeedback(e)},vr.prototype.bindTransformFeedback=function(e){this._gl.bindTransformFeedback(this._gl.TRANSFORM_FEEDBACK,e)},vr.prototype.beginTransformFeedback=function(e){void 0===e&&(e=!0),this._gl.beginTransformFeedback(e?this._gl.POINTS:this._gl.TRIANGLES)},vr.prototype.endTransformFeedback=function(){this._gl.endTransformFeedback()},vr.prototype.setTranformFeedbackVaryings=function(e,t){this._gl.transformFeedbackVaryings(e,t,this._gl.INTERLEAVED_ATTRIBS)},vr.prototype.bindTransformFeedbackBuffer=function(e){this._gl.bindBufferBase(this._gl.TRANSFORM_FEEDBACK_BUFFER,0,e?e.underlyingResource:null)},Yt.prototype.createExternalTexture=function(e){return null},Yt.prototype.setExternalTexture=function(e,t){throw new Error(\"setExternalTexture: This engine does not support external textures!\")},Yt.prototype.updateVideoTexture=function(e,t,i){if(e&&!e._isDisabled){var n=this._bindTextureDirectly(this._gl.TEXTURE_2D,e,!0);this._unpackFlipY(!i);try{if(void 0===this._videoTextureSupported&&(this._gl.getError(),this._gl.texImage2D(this._gl.TEXTURE_2D,0,this._gl.RGBA,this._gl.RGBA,this._gl.UNSIGNED_BYTE,t),0!==this._gl.getError()?this._videoTextureSupported=!1:this._videoTextureSupported=!0),this._videoTextureSupported)this._gl.texImage2D(this._gl.TEXTURE_2D,0,this._gl.RGBA,this._gl.RGBA,this._gl.UNSIGNED_BYTE,t);else{if(!e._workingCanvas){e._workingCanvas=this.createCanvas(e.width,e.height);var r=e._workingCanvas.getContext(\"2d\");if(!r)throw new Error(\"Unable to get 2d context\");e._workingContext=r,e._workingCanvas.width=e.width,e._workingCanvas.height=e.height}e._workingContext.clearRect(0,0,e.width,e.height),e._workingContext.drawImage(t,0,0,t.videoWidth,t.videoHeight,0,0,e.width,e.height),this._gl.texImage2D(this._gl.TEXTURE_2D,0,this._gl.RGBA,this._gl.RGBA,this._gl.UNSIGNED_BYTE,e._workingCanvas)}e.generateMipMaps&&this._gl.generateMipmap(this._gl.TEXTURE_2D),n||this._bindTextureDirectly(this._gl.TEXTURE_2D,null),e.isReady=!0}catch(t){e._isDisabled=!0}}},Yt.prototype.restoreSingleAttachment=function(){var e=this._gl;this.bindAttachments([e.BACK])},Yt.prototype.restoreSingleAttachmentForRenderTarget=function(){var e=this._gl;this.bindAttachments([e.COLOR_ATTACHMENT0])},Yt.prototype.buildTextureLayout=function(e){for(var t=this._gl,i=[],n=0;n1?\"COLOR_ATTACHMENT\"+a:\"COLOR_ATTACHMENT\"+a+\"_WEBGL\"],n.readBuffer(r[a]),n.drawBuffers(r),n.blitFramebuffer(0,0,s.width,s.height,0,0,s.width,s.height,n.COLOR_BUFFER_BIT,n.NEAREST)}for(a=0;a1?\"COLOR_ATTACHMENT\"+a:\"COLOR_ATTACHMENT\"+a+\"_WEBGL\"];n.drawBuffers(r)}for(a=0;a1&&(t.depthTextureFormat===a.TEXTUREFORMAT_DEPTH24_STENCIL8||t.depthTextureFormat===a.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8||t.depthTextureFormat===a.TEXTUREFORMAT_DEPTH24||t.depthTextureFormat===a.TEXTUREFORMAT_DEPTH32_FLOAT||t.depthTextureFormat===a.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8)&&(l=t.depthTextureFormat));var m=this._gl,g=m.createFramebuffer();this._bindUnboundFramebuffer(g);var v=e.width||e,y=e.height||e,b=[],T=[],E=this.webGLVersion>1&&s&&(t.depthTextureFormat===a.TEXTUREFORMAT_DEPTH24_STENCIL8||t.depthTextureFormat===a.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8||t.depthTextureFormat===a.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8),S=this._setupFramebufferDepthAttachments(!E&&o,!s&&r,v,y);_._framebuffer=g,_._depthStencilBuffer=S,_._generateDepthBuffer=!s&&r,_._generateStencilBuffer=!E&&o,_._attachments=T;for(var A=0;A1||this.isWebGPU);var M=new wt(this,Rt.MultiRenderTarget),I=m[this.webGLVersion>1?\"COLOR_ATTACHMENT\"+A:\"COLOR_ATTACHMENT\"+A+\"_WEBGL\"];b.push(M),T.push(I),m.activeTexture(m[\"TEXTURE\"+A]),m.bindTexture(m.TEXTURE_2D,M._hardwareTexture.underlyingResource),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,P.mag),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,P.min),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE);var O=this._getRGBABufferInternalSizedFormat(x,a.TEXTUREFORMAT_RGBA,C);m.texImage2D(m.TEXTURE_2D,0,O,v,y,0,m.RGBA,this._getWebGLTextureType(x),null),m.framebufferTexture2D(m.DRAW_FRAMEBUFFER,I,m.TEXTURE_2D,M._hardwareTexture.underlyingResource,0),n&&this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(m.TEXTURE_2D,null),M.baseWidth=v,M.baseHeight=y,M.width=v,M.height=y,M.isReady=!0,M.samples=1,M.generateMipMaps=n,M.samplingMode=R,M.type=x,M._useSRGBBuffer=C,this._internalTexturesCache.push(M)}if(s&&this._caps.depthTextureExtension){var D=new wt(this,Rt.Depth),N=a.TEXTURETYPE_UNSIGNED_SHORT,L=m.DEPTH_COMPONENT16,F=m.DEPTH_COMPONENT,w=m.UNSIGNED_SHORT,B=m.DEPTH_ATTACHMENT;this.webGLVersion<2?L=m.DEPTH_COMPONENT:l===a.TEXTUREFORMAT_DEPTH32_FLOAT?(N=a.TEXTURETYPE_FLOAT,w=m.FLOAT,L=m.DEPTH_COMPONENT32F):l===a.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8?(N=a.TEXTURETYPE_UNSIGNED_INT,w=m.FLOAT_32_UNSIGNED_INT_24_8_REV,L=m.DEPTH32F_STENCIL8,F=m.DEPTH_STENCIL,B=m.DEPTH_STENCIL_ATTACHMENT):l===a.TEXTUREFORMAT_DEPTH24?(N=a.TEXTURETYPE_UNSIGNED_INT,w=m.UNSIGNED_INT,L=m.DEPTH_COMPONENT24,B=m.DEPTH_ATTACHMENT):l!==a.TEXTUREFORMAT_DEPTH24_STENCIL8&&l!==a.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8||(N=a.TEXTURETYPE_UNSIGNED_INT_24_8,w=m.UNSIGNED_INT_24_8,L=m.DEPTH24_STENCIL8,F=m.DEPTH_STENCIL,B=m.DEPTH_STENCIL_ATTACHMENT),m.activeTexture(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,D._hardwareTexture.underlyingResource),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,m.NEAREST),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,m.NEAREST),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texImage2D(m.TEXTURE_2D,0,L,v,y,0,F,w,null),m.framebufferTexture2D(m.FRAMEBUFFER,B,m.TEXTURE_2D,D._hardwareTexture.underlyingResource,0),D.baseWidth=v,D.baseHeight=y,D.width=v,D.height=y,D.isReady=!0,D.samples=1,D.generateMipMaps=n,D.samplingMode=a.TEXTURE_NEAREST_SAMPLINGMODE,D.format=l,D.type=N,b.push(D),this._internalTexturesCache.push(D)}return _.setTextures(b),i&&m.drawBuffers(T),this._bindUnboundFramebuffer(null),this.resetTextureCache(),_},Yt.prototype.updateMultipleRenderTargetTextureSampleCount=function(e,t,i){if(void 0===i&&(i=!0),this.webGLVersion<2||!e||!e.texture)return 1;if(e.samples===t)return t;var n=e._attachments.length;if(0===n)return 1;var r=this._gl;t=Math.min(t,this.getCaps().maxMSAASamples);var o=!!e._depthStencilBuffer;if(o&&(r.deleteRenderbuffer(e._depthStencilBuffer),e._depthStencilBuffer=null),e._MSAAFramebuffer&&(r.deleteFramebuffer(e._MSAAFramebuffer),e._MSAAFramebuffer=null),t>1&&r.renderbufferStorageMultisample){var a=r.createFramebuffer();if(!a)throw new Error(\"Unable to create multi sampled framebuffer\");e._MSAAFramebuffer=a,this._bindUnboundFramebuffer(a);for(var s=[],l=0;l1?\"COLOR_ATTACHMENT\"+l:\"COLOR_ATTACHMENT\"+l+\"_WEBGL\"],d=u._MSAARenderBuffer?this._updateRenderBuffer(u._MSAARenderBuffer,c.width,c.height,t,-1,this._getRGBAMultiSampleBufferFormat(c.type),h):this._createRenderBuffer(c.width,c.height,t,-1,this._getRGBAMultiSampleBufferFormat(c.type),h);if(!d)throw new Error(\"Unable to create multi sampled framebuffer\");u._MSAARenderBuffer=d,c.samples=t,s.push(h)}i&&r.drawBuffers(s)}else this._bindUnboundFramebuffer(e._framebuffer);return o&&(e._depthStencilBuffer=this._setupFramebufferDepthAttachments(e._generateStencilBuffer,e._generateDepthBuffer,e.texture.width,e.texture.height,t)),this._bindUnboundFramebuffer(null),t},Yt.prototype._createDepthStencilCubeTexture=function(e,t,i){var n=new wt(this,Rt.DepthStencil);if(n.isCube=!0,1===this.webGLVersion)return Q.Error(\"Depth cube texture is not supported by WebGL 1.\"),n;var r=k({bilinearFiltering:!1,comparisonFunction:0,generateStencil:!1},t),o=this._gl;this._bindTextureDirectly(o.TEXTURE_CUBE_MAP,n,!0),this._setupDepthStencilTexture(n,e,r.generateStencil,r.bilinearFiltering,r.comparisonFunction),i._depthStencilTexture=n,i._depthStencilTextureWithStencil=r.generateStencil;for(var a=0;a<6;a++)r.generateStencil?o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,o.DEPTH24_STENCIL8,e,e,0,o.DEPTH_STENCIL,o.UNSIGNED_INT_24_8,null):o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,o.DEPTH_COMPONENT24,e,e,0,o.DEPTH_COMPONENT,o.UNSIGNED_INT,null);return this._bindTextureDirectly(o.TEXTURE_CUBE_MAP,null),this._internalTexturesCache.push(n),n},Yt.prototype._partialLoadFile=function(e,t,i,n,r){void 0===r&&(r=null),this._loadFile(e,(function(e){i[t]=e,i._internalCount++,6===i._internalCount&&n(i)}),void 0,void 0,!0,(function(e,t){r&&e&&r(e.status+\" \"+e.statusText,t)}))},Yt.prototype._cascadeLoadFiles=function(e,t,i,n){void 0===n&&(n=null);var r=[];r._internalCount=0;for(var o=0;o<6;o++)this._partialLoadFile(i[o],o,r,t,n)},Yt.prototype._cascadeLoadImgs=function(e,t,i,n,r,o){void 0===r&&(r=null);var a=[];a._internalCount=0;for(var s=0;s<6;s++)this._partialLoadImg(n[s],s,a,e,t,i,r,o)},Yt.prototype._partialLoadImg=function(e,t,i,n,r,o,a,s){void 0===a&&(a=null);var l=fi();ii(e,(function(e){i[t]=e,i._internalCount++,n&&n.removePendingData(l),6===i._internalCount&&o&&o(r,i)}),(function(e,t){n&&n.removePendingData(l),a&&a(e,t)}),n?n.offlineProvider:null,s),n&&n.addPendingData(l)},Yt.prototype._setCubeMapTextureParams=function(e,t,i){var n=this._gl;n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_MIN_FILTER,t?n.LINEAR_MIPMAP_LINEAR:n.LINEAR),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),e.samplingMode=t?a.TEXTURE_TRILINEAR_SAMPLINGMODE:a.TEXTURE_LINEAR_LINEAR,t&&this.getCaps().textureMaxLevel&&void 0!==i&&i>0&&(n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_MAX_LEVEL,i),e._maxLodLevel=i),this._bindTextureDirectly(n.TEXTURE_CUBE_MAP,null)},Yt.prototype.createCubeTextureBase=function(e,t,i,n,r,o,a,s,l,c,u,h,d,p,f){var _=this;void 0===r&&(r=null),void 0===o&&(o=null),void 0===s&&(s=null),void 0===l&&(l=!1),void 0===c&&(c=0),void 0===u&&(u=0),void 0===h&&(h=null),void 0===d&&(d=null),void 0===p&&(p=null),void 0===f&&(f=!1);var m=h||new wt(this,Rt.Cube);m.isCube=!0,m.url=e,m.generateMipMaps=!n,m._lodGenerationScale=c,m._lodGenerationOffset=u,m._useSRGBBuffer=!!f&&this._caps.supportSRGBBuffers&&(this.webGLVersion>1||this.isWebGPU||!!n),this._doNotHandleContextLost||(m._extension=s,m._files=i);var g=e;this._transformTextureUrl&&!h&&(e=this._transformTextureUrl(e));for(var v=e.split(\"?\")[0],y=v.lastIndexOf(\".\"),b=s||(y>-1?v.substring(y).toLowerCase():\"\"),T=null,E=0,S=Yt._TextureLoaders;E-1?e.substring(i,e.length):\"\";return(t>-1?e.substring(0,t):e)+this._textureFormatInUse+n}Object.defineProperty(vr.prototype,\"onBeforeViewRenderObservable\",{get:function(){return Ru}}),Object.defineProperty(vr.prototype,\"onAfterViewRenderObservable\",{get:function(){return xu}}),Object.defineProperty(vr.prototype,\"inputElement\",{get:function(){return this._inputElement},set:function(e){var t;this._inputElement!==e&&(this._inputElement=e,null===(t=this._onEngineViewChanged)||void 0===t||t.call(this))}}),vr.prototype.getInputElement=function(){return this.inputElement||this.getRenderingCanvas()},vr.prototype.registerView=function(e,t,i){var n=this;this.views||(this.views=[]);for(var r=0,o=this.views;rthis._length&&this._flush()},e.prototype._flush=function(){this._nativeDataStream.writeBuffer(this._uint32s.buffer,this._position),this._position=0},e.DEFAULT_BUFFER_SIZE=65536,e}(),Ou=[Math.sqrt(1/(4*Math.PI)),-Math.sqrt(3/(4*Math.PI)),Math.sqrt(3/(4*Math.PI)),-Math.sqrt(3/(4*Math.PI)),Math.sqrt(15/(4*Math.PI)),-Math.sqrt(15/(4*Math.PI)),Math.sqrt(5/(16*Math.PI)),-Math.sqrt(15/(4*Math.PI)),Math.sqrt(15/(16*Math.PI))],Du=[function(){return 1},function(e){return e.y},function(e){return e.z},function(e){return e.x},function(e){return e.x*e.y},function(e){return e.y*e.z},function(e){return 3*e.z*e.z-1},function(e){return e.x*e.z},function(e){return e.x*e.x-e.y*e.y}],Nu=function(e,t){return Ou[e]*Du[e](t)},Lu=[Math.PI,2*Math.PI/3,2*Math.PI/3,2*Math.PI/3,Math.PI/4,Math.PI/4,Math.PI/4,Math.PI/4,Math.PI/4],Fu=function(){function e(){this.preScaled=!1,this.l00=x.Zero(),this.l1_1=x.Zero(),this.l10=x.Zero(),this.l11=x.Zero(),this.l2_2=x.Zero(),this.l2_1=x.Zero(),this.l20=x.Zero(),this.l21=x.Zero(),this.l22=x.Zero()}return e.prototype.addLight=function(e,t,i){O.Vector3[0].set(t.r,t.g,t.b);var n=O.Vector3[0],r=O.Vector3[1];n.scaleToRef(i,r),r.scaleToRef(Nu(0,e),O.Vector3[2]),this.l00.addInPlace(O.Vector3[2]),r.scaleToRef(Nu(1,e),O.Vector3[2]),this.l1_1.addInPlace(O.Vector3[2]),r.scaleToRef(Nu(2,e),O.Vector3[2]),this.l10.addInPlace(O.Vector3[2]),r.scaleToRef(Nu(3,e),O.Vector3[2]),this.l11.addInPlace(O.Vector3[2]),r.scaleToRef(Nu(4,e),O.Vector3[2]),this.l2_2.addInPlace(O.Vector3[2]),r.scaleToRef(Nu(5,e),O.Vector3[2]),this.l2_1.addInPlace(O.Vector3[2]),r.scaleToRef(Nu(6,e),O.Vector3[2]),this.l20.addInPlace(O.Vector3[2]),r.scaleToRef(Nu(7,e),O.Vector3[2]),this.l21.addInPlace(O.Vector3[2]),r.scaleToRef(Nu(8,e),O.Vector3[2]),this.l22.addInPlace(O.Vector3[2])},e.prototype.scaleInPlace=function(e){this.l00.scaleInPlace(e),this.l1_1.scaleInPlace(e),this.l10.scaleInPlace(e),this.l11.scaleInPlace(e),this.l2_2.scaleInPlace(e),this.l2_1.scaleInPlace(e),this.l20.scaleInPlace(e),this.l21.scaleInPlace(e),this.l22.scaleInPlace(e)},e.prototype.convertIncidentRadianceToIrradiance=function(){this.l00.scaleInPlace(Lu[0]),this.l1_1.scaleInPlace(Lu[1]),this.l10.scaleInPlace(Lu[2]),this.l11.scaleInPlace(Lu[3]),this.l2_2.scaleInPlace(Lu[4]),this.l2_1.scaleInPlace(Lu[5]),this.l20.scaleInPlace(Lu[6]),this.l21.scaleInPlace(Lu[7]),this.l22.scaleInPlace(Lu[8])},e.prototype.convertIrradianceToLambertianRadiance=function(){this.scaleInPlace(1/Math.PI)},e.prototype.preScaleForRendering=function(){this.preScaled=!0,this.l00.scaleInPlace(Ou[0]),this.l1_1.scaleInPlace(Ou[1]),this.l10.scaleInPlace(Ou[2]),this.l11.scaleInPlace(Ou[3]),this.l2_2.scaleInPlace(Ou[4]),this.l2_1.scaleInPlace(Ou[5]),this.l20.scaleInPlace(Ou[6]),this.l21.scaleInPlace(Ou[7]),this.l22.scaleInPlace(Ou[8])},e.prototype.updateFromArray=function(e){return x.FromArrayToRef(e[0],0,this.l00),x.FromArrayToRef(e[1],0,this.l1_1),x.FromArrayToRef(e[2],0,this.l10),x.FromArrayToRef(e[3],0,this.l11),x.FromArrayToRef(e[4],0,this.l2_2),x.FromArrayToRef(e[5],0,this.l2_1),x.FromArrayToRef(e[6],0,this.l20),x.FromArrayToRef(e[7],0,this.l21),x.FromArrayToRef(e[8],0,this.l22),this},e.prototype.updateFromFloatsArray=function(e){return x.FromFloatsToRef(e[0],e[1],e[2],this.l00),x.FromFloatsToRef(e[3],e[4],e[5],this.l1_1),x.FromFloatsToRef(e[6],e[7],e[8],this.l10),x.FromFloatsToRef(e[9],e[10],e[11],this.l11),x.FromFloatsToRef(e[12],e[13],e[14],this.l2_2),x.FromFloatsToRef(e[15],e[16],e[17],this.l2_1),x.FromFloatsToRef(e[18],e[19],e[20],this.l20),x.FromFloatsToRef(e[21],e[22],e[23],this.l21),x.FromFloatsToRef(e[24],e[25],e[26],this.l22),this},e.FromArray=function(t){return(new e).updateFromArray(t)},e.FromPolynomial=function(t){var i=new e;return i.l00=t.xx.scale(.376127).add(t.yy.scale(.376127)).add(t.zz.scale(.376126)),i.l1_1=t.y.scale(.977204),i.l10=t.z.scale(.977204),i.l11=t.x.scale(.977204),i.l2_2=t.xy.scale(1.16538),i.l2_1=t.yz.scale(1.16538),i.l20=t.zz.scale(1.34567).subtract(t.xx.scale(.672834)).subtract(t.yy.scale(.672834)),i.l21=t.zx.scale(1.16538),i.l22=t.xx.scale(1.16538).subtract(t.yy.scale(1.16538)),i.l1_1.scaleInPlace(-1),i.l11.scaleInPlace(-1),i.l2_1.scaleInPlace(-1),i.l21.scaleInPlace(-1),i.scaleInPlace(Math.PI),i},e}(),wu=function(){function e(){this.x=x.Zero(),this.y=x.Zero(),this.z=x.Zero(),this.xx=x.Zero(),this.yy=x.Zero(),this.zz=x.Zero(),this.xy=x.Zero(),this.yz=x.Zero(),this.zx=x.Zero()}return Object.defineProperty(e.prototype,\"preScaledHarmonics\",{get:function(){return this._harmonics||(this._harmonics=Fu.FromPolynomial(this)),this._harmonics.preScaled||this._harmonics.preScaleForRendering(),this._harmonics},enumerable:!1,configurable:!0}),e.prototype.addAmbient=function(e){O.Vector3[0].copyFromFloats(e.r,e.g,e.b);var t=O.Vector3[0];this.xx.addInPlace(t),this.yy.addInPlace(t),this.zz.addInPlace(t)},e.prototype.scaleInPlace=function(e){this.x.scaleInPlace(e),this.y.scaleInPlace(e),this.z.scaleInPlace(e),this.xx.scaleInPlace(e),this.yy.scaleInPlace(e),this.zz.scaleInPlace(e),this.yz.scaleInPlace(e),this.zx.scaleInPlace(e),this.xy.scaleInPlace(e)},e.prototype.updateFromHarmonics=function(e){return this._harmonics=e,this.x.copyFrom(e.l11),this.x.scaleInPlace(1.02333).scaleInPlace(-1),this.y.copyFrom(e.l1_1),this.y.scaleInPlace(1.02333).scaleInPlace(-1),this.z.copyFrom(e.l10),this.z.scaleInPlace(1.02333),this.xx.copyFrom(e.l00),O.Vector3[0].copyFrom(e.l20).scaleInPlace(.247708),O.Vector3[1].copyFrom(e.l22).scaleInPlace(.429043),this.xx.scaleInPlace(.886277).subtractInPlace(O.Vector3[0]).addInPlace(O.Vector3[1]),this.yy.copyFrom(e.l00),this.yy.scaleInPlace(.886277).subtractInPlace(O.Vector3[0]).subtractInPlace(O.Vector3[1]),this.zz.copyFrom(e.l00),O.Vector3[0].copyFrom(e.l20).scaleInPlace(.495417),this.zz.scaleInPlace(.886277).addInPlace(O.Vector3[0]),this.yz.copyFrom(e.l2_1),this.yz.scaleInPlace(.858086).scaleInPlace(-1),this.zx.copyFrom(e.l21),this.zx.scaleInPlace(.858086).scaleInPlace(-1),this.xy.copyFrom(e.l2_2),this.xy.scaleInPlace(.858086),this.scaleInPlace(1/Math.PI),this},e.FromHarmonics=function(t){return(new e).updateFromHarmonics(t)},e.FromArray=function(t){var i=new e;return x.FromArrayToRef(t[0],0,i.x),x.FromArrayToRef(t[1],0,i.y),x.FromArrayToRef(t[2],0,i.z),x.FromArrayToRef(t[3],0,i.xx),x.FromArrayToRef(t[4],0,i.yy),x.FromArrayToRef(t[5],0,i.zz),x.FromArrayToRef(t[6],0,i.yz),x.FromArrayToRef(t[7],0,i.zx),x.FromArrayToRef(t[8],0,i.xy),i},e}();function Bu(e,t,i,n){void 0===n&&(n=!0);var r=e.getScene(),o=r.getEngine(),s=new Ia(\"resized\"+e.name,{width:t,height:i},r,!e.noMipmap,!0,e._texture.type,!1,e.samplingMode,!1);s.wrapU=e.wrapU,s.wrapV=e.wrapV,s.uOffset=e.uOffset,s.vOffset=e.vOffset,s.uScale=e.uScale,s.vScale=e.vScale,s.uAng=e.uAng,s.vAng=e.vAng,s.wAng=e.wAng,s.coordinatesIndex=e.coordinatesIndex,s.level=e.level,s.anisotropicFilteringLevel=e.anisotropicFilteringLevel,s._texture.isReady=!1,e.wrapU=to.CLAMP_ADDRESSMODE,e.wrapV=to.CLAMP_ADDRESSMODE;var l=new el(\"pass\",1,null,n?to.BILINEAR_SAMPLINGMODE:to.NEAREST_SAMPLINGMODE,o,!1,a.TEXTURETYPE_UNSIGNED_INT);return l.externalTextureSamplerBinding=!0,l.getEffect().executeWhenCompiled((function(){l.onApply=function(t){t.setTexture(\"textureSampler\",e)};var t=s.renderTarget;t&&(r.postProcessManager.directRender([l],t),o.unBindFramebuffer(t),s.disposeFramebufferObjects(),l.dispose(),s.getInternalTexture().isReady=!0)})),s}function Uu(e,t,i,n,r,o){var s=t.getEngine();return t.isReady=!1,r=null!=r?r:t.samplingMode,n=null!=n?n:t.type,o=null!=o?o:t.format,-1===n&&(n=a.TEXTURETYPE_UNSIGNED_BYTE),new Promise((function(l){var c=new pa(\"postprocess\",e,null,null,1,null,r,s,!1,void 0,n,void 0,null,!1,o);c.externalTextureSamplerBinding=!0;var u=s.createRenderTargetTexture({width:t.width,height:t.height},{generateDepthBuffer:!1,generateMipMaps:!1,generateStencilBuffer:!1,samplingMode:r,type:n,format:o});c.getEffect().executeWhenCompiled((function(){c.onApply=function(e){e._bindTexture(\"textureSampler\",t),e.setFloat2(\"scale\",1,1)},i.postProcessManager.directRender([c],u,!0),s.restoreDefaultFramebuffer(),s._releaseTexture(t),c&&c.dispose(),u._swapAndDie(t),t.type=n,t.format=a.TEXTUREFORMAT_RGBA,t.isReady=!0,l(t)}))}))}function Vu(e){Pu||(Pu=new Float32Array(1),Mu=new Int32Array(Pu.buffer)),Pu[0]=e;var t=Mu[0],i=t>>16&32768,n=t>>12&2047,r=t>>23&255;return r<103?i:r>142?(i|=31744,i|=(255==r?0:1)&&8388607&t):r<113?i|=((n|=2048)>>114-r)+(n>>113-r&1):(i|=r-112<<10|n>>1,i+=1&n)}function ku(e){var t=(32768&e)>>15,i=(31744&e)>>10,n=1023&e;return 0===i?(t?-1:1)*Math.pow(2,-14)*(n/Math.pow(2,10)):31==i?n?NaN:1/0*(t?-1:1):(t?-1:1)*Math.pow(2,i-15)*(1+n/Math.pow(2,10))}It.ShadersStore.rgbdDecodePixelShader=\"varying vec2 vUV;\\nuniform sampler2D textureSampler;\\n#include\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void) \\n{\\ngl_FragColor=vec4(fromRGBD(texture2D(textureSampler,vUV)),1.0);\\n}\";var Gu={CreateResizedCopy:Bu,ApplyPostProcess:Uu,ToHalfFloat:Vu,FromHalfFloat:ku},zu=function(){function e(){}return e.ExpandRGBDTexture=function(e){var t=e._texture;if(t&&e.isRGBD){var i=t.getEngine(),n=i.getCaps(),r=t.isReady,o=!1;n.textureHalfFloatRender&&n.textureHalfFloatLinearFiltering?(o=!0,t.type=a.TEXTURETYPE_HALF_FLOAT):n.textureFloatRender&&n.textureFloatLinearFiltering&&(o=!0,t.type=a.TEXTURETYPE_FLOAT),o&&(t.isReady=!1,t._isRGBD=!1,t.invertY=!1);var s=function(){if(o){var n=new pa(\"rgbdDecode\",\"rgbdDecode\",null,null,1,null,a.TEXTURE_TRILINEAR_SAMPLINGMODE,i,!1,void 0,t.type,void 0,null,!1);n.externalTextureSamplerBinding=!0;var r=i.createRenderTargetTexture(t.width,{generateDepthBuffer:!1,generateMipMaps:!1,generateStencilBuffer:!1,samplingMode:t.samplingMode,type:t.type,format:a.TEXTUREFORMAT_RGBA});n.getEffect().executeWhenCompiled((function(){n.onApply=function(e){e._bindTexture(\"textureSampler\",t),e.setFloat2(\"scale\",1,1)},e.getScene().postProcessManager.directRender([n],r,!0),i.restoreDefaultFramebuffer(),i._releaseTexture(t),n&&n.dispose(),r._swapAndDie(t),t.isReady=!0}))}};r?s():e.onLoadObservable.addOnce(s)}},e.EncodeTextureToRGBD=function(e,t,i){return void 0===i&&(i=a.TEXTURETYPE_UNSIGNED_BYTE),Uu(\"rgbdEncode\",e,t,i,a.TEXTURE_NEAREST_SAMPLINGMODE,a.TEXTUREFORMAT_RGBA)},e}(),Wu=function(e,t,i,n){this.name=e,this.worldAxisForNormal=t,this.worldAxisForFileX=i,this.worldAxisForFileY=n},Hu=function(){function e(){}return e.ConvertCubeMapTextureToSphericalPolynomial=function(e){var t,i=this;if(!e.isCube)return null;null===(t=e.getScene())||void 0===t||t.getEngine().flushFramebuffer();var n,r,o=e.getSize().width,s=e.readPixels(0,void 0,void 0,!1),l=e.readPixels(1,void 0,void 0,!1);e.isRenderTarget?(n=e.readPixels(3,void 0,void 0,!1),r=e.readPixels(2,void 0,void 0,!1)):(n=e.readPixels(2,void 0,void 0,!1),r=e.readPixels(3,void 0,void 0,!1));var c=e.readPixels(4,void 0,void 0,!1),u=e.readPixels(5,void 0,void 0,!1),h=e.gammaSpace,d=a.TEXTUREFORMAT_RGBA,p=a.TEXTURETYPE_UNSIGNED_INT;return e.textureType!=a.TEXTURETYPE_FLOAT&&e.textureType!=a.TEXTURETYPE_HALF_FLOAT||(p=a.TEXTURETYPE_FLOAT),new Promise((function(e){Promise.all([l,s,n,r,c,u]).then((function(t){var n=t[0],r=t[1],a=t[2],s=t[3],l=t[4],c=t[5],u={size:o,right:r,left:n,up:a,down:s,front:l,back:c,format:d,type:p,gammaSpace:h};e(i.ConvertCubeMapToSphericalPolynomial(u))}))}))},e._AreaElement=function(e,t){return Math.atan2(e*t,Math.sqrt(e*e+t*t+1))},e.ConvertCubeMapToSphericalPolynomial=function(e){for(var t=new Fu,i=0,n=2/e.size,r=n,o=.5*n,s=o-1,l=0;l<6;l++)for(var c=this._FileFaces[l],u=e[c.name],d=s,f=e.format===a.TEXTUREFORMAT_RGBA?4:3,_=0;_\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void) \\n{\\ngl_FragColor=toRGBD(texture2D(textureSampler,vUV).rgb);\\n}\";var Xu=\"image/png\",ju=[134,22,135,150,246,214,150,54];function Yu(e){for(var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i=0,n=0;n2)throw new Error('Unsupported babylon environment map version \"'.concat(e.version,'\". Latest supported version is \"').concat(2,'\".'));return 2===e.version?e:e=k(k({},e),{version:2,imageType:Xu})}function Qu(e,t){var i;return void 0===t&&(t={}),z(this,void 0,void 0,(function(){var n,r,o,s,l,c,u,d,p,f,_,m,g,v,y,b,T,E,S,A,R,x,C,P,M,I,O,D,N,L;return W(this,(function(F){switch(F.label){case 0:if(!(n=e.getInternalTexture()))return[2,Promise.reject(\"The cube texture is invalid.\")];if(r=null!==(i=t.imageType)&&void 0!==i?i:Xu,o=n.getEngine(),e.textureType!==a.TEXTURETYPE_HALF_FLOAT&&e.textureType!==a.TEXTURETYPE_FLOAT&&e.textureType!==a.TEXTURETYPE_UNSIGNED_BYTE&&e.textureType!==a.TEXTURETYPE_UNSIGNED_INT&&e.textureType!==a.TEXTURETYPE_UNSIGNED_INTEGER&&-1!==e.textureType)return[2,Promise.reject(\"The cube texture should allow HDR (Full Float or Half Float).\")];if(s=a.TEXTURETYPE_FLOAT,!o.getCaps().textureFloatRender&&(s=a.TEXTURETYPE_HALF_FLOAT,!o.getCaps().textureHalfFloatRender))return[2,Promise.reject(\"Env texture can only be created when the browser supports half float or full float rendering.\")];l=n.width,c=new mn(o),u={},o.flushFramebuffer(),d=h.ILog2(n.width),D=0,F.label=1;case 1:if(!(D<=d))return[3,9];p=Math.pow(2,d-D),N=0,F.label=2;case 2:return N<6?[4,e.readPixels(N,D,void 0,!1)]:[3,8];case 3:if((f=F.sent())&&f.byteLength===f.length){for(_=new Float32Array(4*f.byteLength),m=0;m=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||95==t}function sh(e){for(var t=0,i=\"\",n=!1,r=[];t=0&&e.charAt(t)!==i;)t--;return t}var ch,uh=function(){function e(e,t){void 0===t&&(t=20),this.debug=!1,this._sourceCode=e,this._numMaxIterations=t,this._functionDescr=[],this.inlineToken=\"#define inline\"}return Object.defineProperty(e.prototype,\"code\",{get:function(){return this._sourceCode},enumerable:!1,configurable:!0}),e.prototype.processCode=function(){this.debug&&console.log(\"Start inlining process (code size=\".concat(this._sourceCode.length,\")...\")),this._collectFunctions(),this._processInlining(this._numMaxIterations),this.debug&&console.log(\"End of inlining process.\")},e.prototype._collectFunctions=function(){for(var t=0;t=0&&f.push(m.substring(g+1))}\"void\"!==a&&f.push(\"return\"),this._functionDescr.push({name:s,type:a,parameters:f,body:d,callIndex:0}),t=h+1;var v=i>0?this._sourceCode.substring(0,i):\"\",y=h+1=0&&this._replaceFunctionCallsByCode(););return this.debug&&console.log(\"numMaxIterations is \".concat(e,\" after inlining process\")),e>=0},e.prototype._replaceFunctionCallsByCode=function(){for(var e=!1,t=0,i=this._functionDescr;t0?this._sourceCode.substring(0,c):\"\",b=h+1=0){var l=o[a],c=null;if(r&&(c=r[l]),c||(c=t[l]),c){var u=c.getBuffer();u&&u.nativeVertexBuffer&&this._engine.recordVertexBuffer(e,u.nativeVertexBuffer,s,c.byteOffset,c.byteStride,c.getSize(),this._getNativeAttribType(c.type),c.normalized,c.getInstanceDivisor())}}}},t.prototype.bindBuffers=function(e,t,i){this._boundBuffersVertexArray&&this._deleteVertexArray(this._boundBuffersVertexArray),this._boundBuffersVertexArray=this._engine.createVertexArray(),this._recordVertexArrayObject(this._boundBuffersVertexArray,e,t,i),this.bindVertexArrayObject(this._boundBuffersVertexArray)},t.prototype.recordVertexArrayObject=function(e,t,i,n){var r=this._engine.createVertexArray();return this._recordVertexArrayObject(r,e,t,i,n),r},t.prototype._deleteVertexArray=function(e){this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_DELETEVERTEXARRAY),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.finishEncodingCommand()},t.prototype.bindVertexArrayObject=function(e){this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_BINDVERTEXARRAY),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.finishEncodingCommand()},t.prototype.releaseVertexArrayObject=function(e){this._deleteVertexArray(e)},t.prototype.getAttributes=function(e,t){var i=e;return this._engine.getAttributes(i.nativeProgram,t)},t.prototype.drawElementsType=function(e,t,i,n){this._drawCalls.addCount(1,!1),this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_DRAWINDEXED),this._commandBufferEncoder.encodeCommandArgAsUInt32(e),this._commandBufferEncoder.encodeCommandArgAsUInt32(t),this._commandBufferEncoder.encodeCommandArgAsUInt32(i),this._commandBufferEncoder.finishEncodingCommand()},t.prototype.drawArraysType=function(e,t,i,n){this._drawCalls.addCount(1,!1),this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_DRAW),this._commandBufferEncoder.encodeCommandArgAsUInt32(e),this._commandBufferEncoder.encodeCommandArgAsUInt32(t),this._commandBufferEncoder.encodeCommandArgAsUInt32(i),this._commandBufferEncoder.finishEncodingCommand()},t.prototype.createPipelineContext=function(){return new fh(this)},t.prototype.createMaterialContext=function(){},t.prototype.createDrawContext=function(){},t.prototype._preparePipelineContext=function(e,t,i,n,r,o,a,s,l){e.nativeProgram=n?this.createRawShaderProgram(e,t,i,void 0,l):this.createShaderProgram(e,t,i,s,void 0,l)},t.prototype._isRenderingStateCompiled=function(e){return!0},t.prototype._executeWhenRenderingStateIsCompiled=function(e,t){t()},t.prototype.createRawShaderProgram=function(e,t,i,n,r){throw void 0===r&&(r=null),new Error(\"Not Supported\")},t.prototype.createShaderProgram=function(e,t,i,n,r,o){void 0===o&&(o=null),this.onBeforeShaderCompilationObservable.notifyObservers(this);var a=new uh(t);a.processCode(),t=a.code;var s=new uh(i);s.processCode(),i=s.code,t=Yt._ConcatenateShader(t,n),i=Yt._ConcatenateShader(i,n);var l=this._engine.createProgram(t,i);return this.onAfterShaderCompilationObservable.notifyObservers(this),l},t.prototype.inlineShaderCode=function(e){var t=new uh(e);return t.debug=!1,t.processCode(),t.code},t.prototype._setProgram=function(e){this._currentProgram!==e&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETPROGRAM),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.finishEncodingCommand(),this._currentProgram=e)},t.prototype._deletePipelineContext=function(e){var t=e;t&&t.nativeProgram&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_DELETEPROGRAM),this._commandBufferEncoder.encodeCommandArgAsNativeData(t.nativeProgram),this._commandBufferEncoder.finishEncodingCommand())},t.prototype.getUniforms=function(e,t){var i=e;return this._engine.getUniforms(i.nativeProgram,t)},t.prototype.bindUniformBlock=function(e,t,i){throw new Error(\"Not Implemented\")},t.prototype.bindSamplers=function(e){var t=e.getPipelineContext();this._setProgram(t.nativeProgram);for(var i=e.getSamplers(),n=0;n-1?e.substring(T).toLowerCase():\"\"),A=null,R=0,x=vr._TextureLoaders;R-1?e.substring(g).toLowerCase():\"\"))){if(i&&6===i.length)throw new Error(\"Multi-file loading not allowed on env files.\");this._loadFile(e,(function(e){return function(e){var t=Yu(e);m.width=t.width,m.height=t.width,th(m,t);var i=t.specular;if(!i)throw new Error(\"Nothing else parsed so far\");m._lodGenerationScale=i.lodGenerationScale;var n=Zu(e,t);m.format=a.TEXTUREFORMAT_RGBA,m.type=a.TEXTURETYPE_UNSIGNED_INT,m.generateMipMaps=!0,m.getEngine().updateTextureSamplingMode(to.TRILINEAR_SAMPLINGMODE,m),m._isRGBD=!0,m.invertY=!0,_._engine.loadCubeTextureWithMips(m._hardwareTexture.underlyingResource,n,!1,f,(function(){m.isReady=!0,r&&r()}),(function(){throw new Error(\"Could not load a native cube texture.\")}))}(new Uint8Array(e))}),void 0,void 0,!0,(function(e,t){o&&e&&o(e.status+\" \"+e.statusText,t)}))}else{if(!i||6!==i.length)throw new Error(\"Cannot load cubemap because 6 files were not defined\");var v=[i[0],i[3],i[1],i[4],i[2],i[5]];Promise.all(v.map((function(e){return mi.LoadFileAsync(e).then((function(e){return new Uint8Array(e)}))}))).then((function(e){return new Promise((function(t,i){_._engine.loadCubeTexture(m._hardwareTexture.underlyingResource,e,!n,!0,f,t,i)}))})).then((function(){m.isReady=!0,r&&r()}),(function(e){o&&o(\"Failed to load cubemap: \".concat(e.message),e)}))}return this._internalTexturesCache.push(m),m},t.prototype._createHardwareRenderTargetWrapper=function(e,t,i){var n=new _h(e,t,i,this);return this._renderTargetWrapperCache.push(n),n},t.prototype.createRenderTargetTexture=function(e,t){var i=this._createHardwareRenderTargetWrapper(!1,!1,e),n={};void 0!==t&&\"object\"==typeof t?(n.generateMipMaps=t.generateMipMaps,n.generateDepthBuffer=void 0===t.generateDepthBuffer||t.generateDepthBuffer,n.generateStencilBuffer=n.generateDepthBuffer&&t.generateStencilBuffer,n.type=void 0===t.type?a.TEXTURETYPE_UNSIGNED_INT:t.type,n.samplingMode=void 0===t.samplingMode?a.TEXTURE_TRILINEAR_SAMPLINGMODE:t.samplingMode,n.format=void 0===t.format?a.TEXTUREFORMAT_RGBA:t.format):(n.generateMipMaps=t,n.generateDepthBuffer=!0,n.generateStencilBuffer=!1,n.type=a.TEXTURETYPE_UNSIGNED_INT,n.samplingMode=a.TEXTURE_TRILINEAR_SAMPLINGMODE,n.format=a.TEXTUREFORMAT_RGBA),(n.type!==a.TEXTURETYPE_FLOAT||this._caps.textureFloatLinearFiltering)&&(n.type!==a.TEXTURETYPE_HALF_FLOAT||this._caps.textureHalfFloatLinearFiltering)||(n.samplingMode=a.TEXTURE_NEAREST_SAMPLINGMODE);var r=new wt(this,Rt.RenderTarget),o=e.width||e,s=e.height||e;n.type!==a.TEXTURETYPE_FLOAT||this._caps.textureFloat||(n.type=a.TEXTURETYPE_UNSIGNED_INT,Q.Warn(\"Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type\"));var l=this._engine.createFrameBuffer(r._hardwareTexture.underlyingResource,o,s,this._getNativeTextureFormat(n.format,n.type),!!n.generateStencilBuffer,n.generateDepthBuffer,!!n.generateMipMaps);return i._framebuffer=l,i._generateDepthBuffer=n.generateDepthBuffer,i._generateStencilBuffer=!!n.generateStencilBuffer,r.baseWidth=o,r.baseHeight=s,r.width=o,r.height=s,r.isReady=!0,r.samples=1,r.generateMipMaps=!!n.generateMipMaps,r.samplingMode=n.samplingMode,r.type=n.type,r.format=n.format,this._internalTexturesCache.push(r),i.setTextures(r),i},t.prototype.updateTextureSamplingMode=function(e,t){if(t._hardwareTexture){var i=this._getNativeSamplingMode(e);this._setTextureSampling(t._hardwareTexture.underlyingResource,i)}t.samplingMode=e},t.prototype.bindFramebuffer=function(e,t,i,n,r){var o=e;if(t)throw new Error(\"Cuboid frame buffers are not yet supported in NativeEngine.\");if(i||n)throw new Error(\"Required width/height for frame buffers not yet supported in NativeEngine.\");o._framebufferDepthStencil?this._bindUnboundFramebuffer(o._framebufferDepthStencil):this._bindUnboundFramebuffer(o._framebuffer)},t.prototype.unBindFramebuffer=function(e,t,i){void 0===t&&(t=!1),i&&i(),this._bindUnboundFramebuffer(null)},t.prototype.createDynamicVertexBuffer=function(e){return this.createVertexBuffer(e,!0)},t.prototype.updateDynamicIndexBuffer=function(e,t,i){void 0===i&&(i=0);var n=e,r=this._normalizeIndexData(t);n.is32Bits=4===r.BYTES_PER_ELEMENT,this._engine.updateDynamicIndexBuffer(n.nativeIndexBuffer,r.buffer,r.byteOffset,r.byteLength,i)},t.prototype.updateDynamicVertexBuffer=function(e,t,i,n){var r=e,o=ArrayBuffer.isView(t)?t:new Float32Array(t);this._engine.updateDynamicVertexBuffer(r.nativeVertexBuffer,o.buffer,o.byteOffset+(null!=i?i:0),null!=n?n:o.byteLength)},t.prototype._setTexture=function(e,t,i,n){void 0===i&&(i=!1),void 0===n&&(n=!1);var r,o=this._boundUniforms[e];if(!o)return!1;if(!t)return null!=this._boundTexturesCache[e]&&(this._activeChannel=e,this._setTextureCore(o,null)),!1;if(t.video)this._activeChannel=e,t.update();else if(t.delayLoadState===a.DELAYLOADSTATE_NOTLOADED)return t.delayLoad(),!1;return r=n?t.depthStencilTexture:t.isReady()?t.getInternalTexture():t.isCube?this.emptyCubeTexture:t.is3D?this.emptyTexture3D:t.is2DArray?this.emptyTexture2DArray:this.emptyTexture,this._activeChannel=e,!(!r||!r._hardwareTexture||(this._setTextureWrapMode(r._hardwareTexture.underlyingResource,this._getAddressMode(t.wrapU),this._getAddressMode(t.wrapV),this._getAddressMode(t.wrapR)),this._updateAnisotropicLevel(t),this._setTextureCore(o,r._hardwareTexture.underlyingResource),0))},t.prototype._setTextureSampling=function(e,t){this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETTEXTURESAMPLING),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsUInt32(t),this._commandBufferEncoder.finishEncodingCommand()},t.prototype._setTextureWrapMode=function(e,t,i,n){this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETTEXTUREWRAPMODE),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsUInt32(t),this._commandBufferEncoder.encodeCommandArgAsUInt32(i),this._commandBufferEncoder.encodeCommandArgAsUInt32(n),this._commandBufferEncoder.finishEncodingCommand()},t.prototype._setTextureCore=function(e,t){this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETTEXTURE),this._commandBufferEncoder.encodeCommandArgAsNativeData(e),this._commandBufferEncoder.encodeCommandArgAsNativeData(t),this._commandBufferEncoder.finishEncodingCommand()},t.prototype._updateAnisotropicLevel=function(e){var t=e.getInternalTexture(),i=e.anisotropicFilteringLevel;t&&t._hardwareTexture&&t._cachedAnisotropicFilteringLevel!==i&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_SETTEXTUREANISOTROPICLEVEL),this._commandBufferEncoder.encodeCommandArgAsNativeData(t._hardwareTexture.underlyingResource),this._commandBufferEncoder.encodeCommandArgAsUInt32(i),this._commandBufferEncoder.finishEncodingCommand(),t._cachedAnisotropicFilteringLevel=i)},t.prototype._getAddressMode=function(e){switch(e){case a.TEXTURE_WRAP_ADDRESSMODE:return _native.Engine.ADDRESS_MODE_WRAP;case a.TEXTURE_CLAMP_ADDRESSMODE:return _native.Engine.ADDRESS_MODE_CLAMP;case a.TEXTURE_MIRROR_ADDRESSMODE:return _native.Engine.ADDRESS_MODE_MIRROR;default:throw new Error(\"Unexpected wrap mode: \"+e+\".\")}},t.prototype._bindTexture=function(e,t){var i=this._boundUniforms[e];if(i&&t&&t._hardwareTexture){var n=t._hardwareTexture.underlyingResource;this._setTextureCore(i,n)}},t.prototype._deleteBuffer=function(e){e.nativeIndexBuffer&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_DELETEINDEXBUFFER),this._commandBufferEncoder.encodeCommandArgAsNativeData(e.nativeIndexBuffer),this._commandBufferEncoder.finishEncodingCommand(),delete e.nativeIndexBuffer),e.nativeVertexBuffer&&(this._commandBufferEncoder.startEncodingCommand(_native.Engine.COMMAND_DELETEVERTEXBUFFER),this._commandBufferEncoder.encodeCommandArgAsNativeData(e.nativeVertexBuffer),this._commandBufferEncoder.finishEncodingCommand(),delete e.nativeVertexBuffer)},t.prototype.createCanvas=function(e,t){if(!_native.Canvas)throw new Error(\"Native Canvas plugin not available.\");var i=new _native.Canvas;return i.width=e,i.height=t,i},t.prototype.createCanvasImage=function(){if(!_native.Canvas)throw new Error(\"Native Canvas plugin not available.\");return new _native.Image},t.prototype.updateTextureData=function(e,t,i,n,r,o,a,s,l){throw void 0===a&&(a=0),void 0===s&&(s=0),void 0===l&&(l=!1),new Error(\"updateTextureData not implemented.\")},t.prototype._uploadCompressedDataToTextureDirectly=function(e,t,i,n,r,o,a){throw void 0===o&&(o=0),void 0===a&&(a=0),new Error(\"_uploadCompressedDataToTextureDirectly not implemented.\")},t.prototype._uploadDataToTextureDirectly=function(e,t,i,n){throw void 0===i&&(i=0),void 0===n&&(n=0),new Error(\"_uploadDataToTextureDirectly not implemented.\")},t.prototype._uploadArrayBufferViewToTexture=function(e,t,i,n){throw void 0===i&&(i=0),void 0===n&&(n=0),new Error(\"_uploadArrayBufferViewToTexture not implemented.\")},t.prototype._uploadImageToTexture=function(e,t,i,n){throw void 0===i&&(i=0),void 0===n&&(n=0),new Error(\"_uploadArrayBufferViewToTexture not implemented.\")},t.prototype._getNativeSamplingMode=function(e){switch(e){case a.TEXTURE_NEAREST_NEAREST:return _native.Engine.TEXTURE_NEAREST_NEAREST;case a.TEXTURE_LINEAR_LINEAR:return _native.Engine.TEXTURE_LINEAR_LINEAR;case a.TEXTURE_LINEAR_LINEAR_MIPLINEAR:return _native.Engine.TEXTURE_LINEAR_LINEAR_MIPLINEAR;case a.TEXTURE_NEAREST_NEAREST_MIPNEAREST:return _native.Engine.TEXTURE_NEAREST_NEAREST_MIPNEAREST;case a.TEXTURE_NEAREST_LINEAR_MIPNEAREST:return _native.Engine.TEXTURE_NEAREST_LINEAR_MIPNEAREST;case a.TEXTURE_NEAREST_LINEAR_MIPLINEAR:return _native.Engine.TEXTURE_NEAREST_LINEAR_MIPLINEAR;case a.TEXTURE_NEAREST_LINEAR:return _native.Engine.TEXTURE_NEAREST_LINEAR;case a.TEXTURE_NEAREST_NEAREST_MIPLINEAR:return _native.Engine.TEXTURE_NEAREST_NEAREST_MIPLINEAR;case a.TEXTURE_LINEAR_NEAREST_MIPNEAREST:return _native.Engine.TEXTURE_LINEAR_NEAREST_MIPNEAREST;case a.TEXTURE_LINEAR_NEAREST_MIPLINEAR:return _native.Engine.TEXTURE_LINEAR_NEAREST_MIPLINEAR;case a.TEXTURE_LINEAR_LINEAR_MIPNEAREST:return _native.Engine.TEXTURE_LINEAR_LINEAR_MIPNEAREST;case a.TEXTURE_LINEAR_NEAREST:return _native.Engine.TEXTURE_LINEAR_NEAREST;default:throw new Error(\"Unsupported sampling mode: \".concat(e,\".\"))}},t.prototype._getStencilFunc=function(e){switch(e){case a.LESS:return _native.Engine.STENCIL_TEST_LESS;case a.LEQUAL:return _native.Engine.STENCIL_TEST_LEQUAL;case a.EQUAL:return _native.Engine.STENCIL_TEST_EQUAL;case a.GEQUAL:return _native.Engine.STENCIL_TEST_GEQUAL;case a.GREATER:return _native.Engine.STENCIL_TEST_GREATER;case a.NOTEQUAL:return _native.Engine.STENCIL_TEST_NOTEQUAL;case a.NEVER:return _native.Engine.STENCIL_TEST_NEVER;case a.ALWAYS:return _native.Engine.STENCIL_TEST_ALWAYS;default:throw new Error(\"Unsupported stencil func mode: \".concat(e,\".\"))}},t.prototype._getStencilOpFail=function(e){switch(e){case a.KEEP:return _native.Engine.STENCIL_OP_FAIL_S_KEEP;case a.ZERO:return _native.Engine.STENCIL_OP_FAIL_S_ZERO;case a.REPLACE:return _native.Engine.STENCIL_OP_FAIL_S_REPLACE;case a.INCR:return _native.Engine.STENCIL_OP_FAIL_S_INCR;case a.DECR:return _native.Engine.STENCIL_OP_FAIL_S_DECR;case a.INVERT:return _native.Engine.STENCIL_OP_FAIL_S_INVERT;case a.INCR_WRAP:return _native.Engine.STENCIL_OP_FAIL_S_INCRSAT;case a.DECR_WRAP:return _native.Engine.STENCIL_OP_FAIL_S_DECRSAT;default:throw new Error(\"Unsupported stencil OpFail mode: \".concat(e,\".\"))}},t.prototype._getStencilDepthFail=function(e){switch(e){case a.KEEP:return _native.Engine.STENCIL_OP_FAIL_Z_KEEP;case a.ZERO:return _native.Engine.STENCIL_OP_FAIL_Z_ZERO;case a.REPLACE:return _native.Engine.STENCIL_OP_FAIL_Z_REPLACE;case a.INCR:return _native.Engine.STENCIL_OP_FAIL_Z_INCR;case a.DECR:return _native.Engine.STENCIL_OP_FAIL_Z_DECR;case a.INVERT:return _native.Engine.STENCIL_OP_FAIL_Z_INVERT;case a.INCR_WRAP:return _native.Engine.STENCIL_OP_FAIL_Z_INCRSAT;case a.DECR_WRAP:return _native.Engine.STENCIL_OP_FAIL_Z_DECRSAT;default:throw new Error(\"Unsupported stencil depthFail mode: \".concat(e,\".\"))}},t.prototype._getStencilDepthPass=function(e){switch(e){case a.KEEP:return _native.Engine.STENCIL_OP_PASS_Z_KEEP;case a.ZERO:return _native.Engine.STENCIL_OP_PASS_Z_ZERO;case a.REPLACE:return _native.Engine.STENCIL_OP_PASS_Z_REPLACE;case a.INCR:return _native.Engine.STENCIL_OP_PASS_Z_INCR;case a.DECR:return _native.Engine.STENCIL_OP_PASS_Z_DECR;case a.INVERT:return _native.Engine.STENCIL_OP_PASS_Z_INVERT;case a.INCR_WRAP:return _native.Engine.STENCIL_OP_PASS_Z_INCRSAT;case a.DECR_WRAP:return _native.Engine.STENCIL_OP_PASS_Z_DECRSAT;default:throw new Error(\"Unsupported stencil opPass mode: \".concat(e,\".\"))}},t.prototype._getNativeTextureFormat=function(e,t){if(e==a.TEXTUREFORMAT_RGB&&t==a.TEXTURETYPE_UNSIGNED_INT)return _native.Engine.TEXTURE_FORMAT_RGB8;if(e==a.TEXTUREFORMAT_RGBA&&t==a.TEXTURETYPE_UNSIGNED_INT)return _native.Engine.TEXTURE_FORMAT_RGBA8;if(e==a.TEXTUREFORMAT_RGBA&&t==a.TEXTURETYPE_FLOAT)return _native.Engine.TEXTURE_FORMAT_RGBA32F;throw new st(\"Unsupported texture format or type: format \".concat(e,\", type \").concat(t,\".\"),at.UnsupportedTextureError)},t.prototype._getNativeAlphaMode=function(e){switch(e){case a.ALPHA_DISABLE:return _native.Engine.ALPHA_DISABLE;case a.ALPHA_ADD:return _native.Engine.ALPHA_ADD;case a.ALPHA_COMBINE:return _native.Engine.ALPHA_COMBINE;case a.ALPHA_SUBTRACT:return _native.Engine.ALPHA_SUBTRACT;case a.ALPHA_MULTIPLY:return _native.Engine.ALPHA_MULTIPLY;case a.ALPHA_MAXIMIZED:return _native.Engine.ALPHA_MAXIMIZED;case a.ALPHA_ONEONE:return _native.Engine.ALPHA_ONEONE;case a.ALPHA_PREMULTIPLIED:return _native.Engine.ALPHA_PREMULTIPLIED;case a.ALPHA_PREMULTIPLIED_PORTERDUFF:return _native.Engine.ALPHA_PREMULTIPLIED_PORTERDUFF;case a.ALPHA_INTERPOLATE:return _native.Engine.ALPHA_INTERPOLATE;case a.ALPHA_SCREENMODE:return _native.Engine.ALPHA_SCREENMODE;default:throw new Error(\"Unsupported alpha mode: \".concat(e,\".\"))}},t.prototype._getNativeAttribType=function(e){switch(e){case wi.BYTE:return _native.Engine.ATTRIB_TYPE_INT8;case wi.UNSIGNED_BYTE:return _native.Engine.ATTRIB_TYPE_UINT8;case wi.SHORT:return _native.Engine.ATTRIB_TYPE_INT16;case wi.UNSIGNED_SHORT:return _native.Engine.ATTRIB_TYPE_UINT16;case wi.FLOAT:return _native.Engine.ATTRIB_TYPE_FLOAT;default:throw new Error(\"Unsupported attribute type: \".concat(e,\".\"))}},t.prototype.getFontOffset=function(e){return{ascent:0,height:0,descent:0}},t.prototype._readTexturePixels=function(e,t,i,n,r,o,a,s,l,c){var u,h,d,p;if(void 0!==n&&-1!==n)throw new Error(\"Reading cubemap faces is not supported, but faceIndex is \".concat(n,\".\"));return this._engine.readTexture(null===(u=e._hardwareTexture)||void 0===u?void 0:u.underlyingResource,null!=r?r:0,null!=l?l:0,null!=c?c:0,t,i,null!==(h=null==o?void 0:o.buffer)&&void 0!==h?h:null,null!==(d=null==o?void 0:o.byteOffset)&&void 0!==d?d:0,null!==(p=null==o?void 0:o.byteLength)&&void 0!==p?p:0).then((function(e){return o||(o=new Uint8Array(e)),o}))},t.PROTOCOL_VERSION=6,t}(vr);vh._createNativeDataStream=function(){return _native.NativeDataStream.VALIDATION_ENABLED?new nd:new Iu};var yh,bh,Th,Eh,Sh,Ah,Rh,xh,Ch,Ph,Mh,Ih,Oh,Dh,Nh,Lh,Fh,wh,Bh,Uh,Vh,kh,Gh,zh,Wh,Hh,Xh,jh,Yh,Kh,Qh,qh,Zh,Jh,$h,ed,td,id,nd=function(e){function t(){return e.call(this)||this}return V(t,e),t.prototype.writeUint32=function(t){e.prototype.writeUint32.call(this,_native.NativeDataStream.VALIDATION_UINT_32),e.prototype.writeUint32.call(this,t)},t.prototype.writeInt32=function(t){e.prototype.writeUint32.call(this,_native.NativeDataStream.VALIDATION_INT_32),e.prototype.writeInt32.call(this,t)},t.prototype.writeFloat32=function(t){e.prototype.writeUint32.call(this,_native.NativeDataStream.VALIDATION_FLOAT_32),e.prototype.writeFloat32.call(this,t)},t.prototype.writeUint32Array=function(t){e.prototype.writeUint32.call(this,_native.NativeDataStream.VALIDATION_UINT_32_ARRAY),e.prototype.writeUint32Array.call(this,t)},t.prototype.writeInt32Array=function(t){e.prototype.writeUint32.call(this,_native.NativeDataStream.VALIDATION_INT_32_ARRAY),e.prototype.writeInt32Array.call(this,t)},t.prototype.writeFloat32Array=function(t){e.prototype.writeUint32.call(this,_native.NativeDataStream.VALIDATION_FLOAT_32_ARRAY),e.prototype.writeFloat32Array.call(this,t)},t.prototype.writeNativeData=function(t){e.prototype.writeUint32.call(this,_native.NativeDataStream.VALIDATION_NATIVE_DATA),e.prototype.writeNativeData.call(this,t)},t.prototype.writeBoolean=function(t){e.prototype.writeUint32.call(this,_native.NativeDataStream.VALIDATION_BOOLEAN),e.prototype.writeBoolean.call(this,t)},t}(Iu);!function(e){e.SRGB=\"srgb\"}(yh||(yh={})),function(e){e.LowPower=\"low-power\",e.HighPerformance=\"high-performance\"}(bh||(bh={})),function(e){e.DepthClipControl=\"depth-clip-control\",e.Depth24UnormStencil8=\"depth24unorm-stencil8\",e.Depth32FloatStencil8=\"depth32float-stencil8\",e.TextureCompressionBC=\"texture-compression-bc\",e.TextureCompressionETC2=\"texture-compression-etc2\",e.TextureCompressionASTC=\"texture-compression-astc\",e.TimestampQuery=\"timestamp-query\",e.IndirectFirstInstance=\"indirect-first-instance\",e.ShaderF16=\"shader-f16\",e.BGRA8UnormStorage=\"bgra8unorm-storage\"}(Th||(Th={})),function(e){e[e.MapRead=1]=\"MapRead\",e[e.MapWrite=2]=\"MapWrite\",e[e.CopySrc=4]=\"CopySrc\",e[e.CopyDst=8]=\"CopyDst\",e[e.Index=16]=\"Index\",e[e.Vertex=32]=\"Vertex\",e[e.Uniform=64]=\"Uniform\",e[e.Storage=128]=\"Storage\",e[e.Indirect=256]=\"Indirect\",e[e.QueryResolve=512]=\"QueryResolve\"}(Eh||(Eh={})),function(e){e[e.Read=1]=\"Read\",e[e.Write=2]=\"Write\"}(Sh||(Sh={})),function(e){e.E1d=\"1d\",e.E2d=\"2d\",e.E3d=\"3d\"}(Ah||(Ah={})),function(e){e[e.CopySrc=1]=\"CopySrc\",e[e.CopyDst=2]=\"CopyDst\",e[e.TextureBinding=4]=\"TextureBinding\",e[e.StorageBinding=8]=\"StorageBinding\",e[e.RenderAttachment=16]=\"RenderAttachment\"}(Rh||(Rh={})),function(e){e.E1d=\"1d\",e.E2d=\"2d\",e.E2dArray=\"2d-array\",e.Cube=\"cube\",e.CubeArray=\"cube-array\",e.E3d=\"3d\"}(xh||(xh={})),function(e){e.All=\"all\",e.StencilOnly=\"stencil-only\",e.DepthOnly=\"depth-only\"}(Ch||(Ch={})),function(e){e.R8Unorm=\"r8unorm\",e.R8Snorm=\"r8snorm\",e.R8Uint=\"r8uint\",e.R8Sint=\"r8sint\",e.R16Uint=\"r16uint\",e.R16Sint=\"r16sint\",e.R16Float=\"r16float\",e.RG8Unorm=\"rg8unorm\",e.RG8Snorm=\"rg8snorm\",e.RG8Uint=\"rg8uint\",e.RG8Sint=\"rg8sint\",e.R32Uint=\"r32uint\",e.R32Sint=\"r32sint\",e.R32Float=\"r32float\",e.RG16Uint=\"rg16uint\",e.RG16Sint=\"rg16sint\",e.RG16Float=\"rg16float\",e.RGBA8Unorm=\"rgba8unorm\",e.RGBA8UnormSRGB=\"rgba8unorm-srgb\",e.RGBA8Snorm=\"rgba8snorm\",e.RGBA8Uint=\"rgba8uint\",e.RGBA8Sint=\"rgba8sint\",e.BGRA8Unorm=\"bgra8unorm\",e.BGRA8UnormSRGB=\"bgra8unorm-srgb\",e.RGB9E5UFloat=\"rgb9e5ufloat\",e.RGB10A2Unorm=\"rgb10a2unorm\",e.RG11B10UFloat=\"rg11b10ufloat\",e.RG32Uint=\"rg32uint\",e.RG32Sint=\"rg32sint\",e.RG32Float=\"rg32float\",e.RGBA16Uint=\"rgba16uint\",e.RGBA16Sint=\"rgba16sint\",e.RGBA16Float=\"rgba16float\",e.RGBA32Uint=\"rgba32uint\",e.RGBA32Sint=\"rgba32sint\",e.RGBA32Float=\"rgba32float\",e.Stencil8=\"stencil8\",e.Depth16Unorm=\"depth16unorm\",e.Depth24Plus=\"depth24plus\",e.Depth24PlusStencil8=\"depth24plus-stencil8\",e.Depth32Float=\"depth32float\",e.BC1RGBAUnorm=\"bc1-rgba-unorm\",e.BC1RGBAUnormSRGB=\"bc1-rgba-unorm-srgb\",e.BC2RGBAUnorm=\"bc2-rgba-unorm\",e.BC2RGBAUnormSRGB=\"bc2-rgba-unorm-srgb\",e.BC3RGBAUnorm=\"bc3-rgba-unorm\",e.BC3RGBAUnormSRGB=\"bc3-rgba-unorm-srgb\",e.BC4RUnorm=\"bc4-r-unorm\",e.BC4RSnorm=\"bc4-r-snorm\",e.BC5RGUnorm=\"bc5-rg-unorm\",e.BC5RGSnorm=\"bc5-rg-snorm\",e.BC6HRGBUFloat=\"bc6h-rgb-ufloat\",e.BC6HRGBFloat=\"bc6h-rgb-float\",e.BC7RGBAUnorm=\"bc7-rgba-unorm\",e.BC7RGBAUnormSRGB=\"bc7-rgba-unorm-srgb\",e.ETC2RGB8Unorm=\"etc2-rgb8unorm\",e.ETC2RGB8UnormSRGB=\"etc2-rgb8unorm-srgb\",e.ETC2RGB8A1Unorm=\"etc2-rgb8a1unorm\",e.ETC2RGB8A1UnormSRGB=\"etc2-rgb8a1unorm-srgb\",e.ETC2RGBA8Unorm=\"etc2-rgba8unorm\",e.ETC2RGBA8UnormSRGB=\"etc2-rgba8unorm-srgb\",e.EACR11Unorm=\"eac-r11unorm\",e.EACR11Snorm=\"eac-r11snorm\",e.EACRG11Unorm=\"eac-rg11unorm\",e.EACRG11Snorm=\"eac-rg11snorm\",e.ASTC4x4Unorm=\"astc-4x4-unorm\",e.ASTC4x4UnormSRGB=\"astc-4x4-unorm-srgb\",e.ASTC5x4Unorm=\"astc-5x4-unorm\",e.ASTC5x4UnormSRGB=\"astc-5x4-unorm-srgb\",e.ASTC5x5Unorm=\"astc-5x5-unorm\",e.ASTC5x5UnormSRGB=\"astc-5x5-unorm-srgb\",e.ASTC6x5Unorm=\"astc-6x5-unorm\",e.ASTC6x5UnormSRGB=\"astc-6x5-unorm-srgb\",e.ASTC6x6Unorm=\"astc-6x6-unorm\",e.ASTC6x6UnormSRGB=\"astc-6x6-unorm-srgb\",e.ASTC8x5Unorm=\"astc-8x5-unorm\",e.ASTC8x5UnormSRGB=\"astc-8x5-unorm-srgb\",e.ASTC8x6Unorm=\"astc-8x6-unorm\",e.ASTC8x6UnormSRGB=\"astc-8x6-unorm-srgb\",e.ASTC8x8Unorm=\"astc-8x8-unorm\",e.ASTC8x8UnormSRGB=\"astc-8x8-unorm-srgb\",e.ASTC10x5Unorm=\"astc-10x5-unorm\",e.ASTC10x5UnormSRGB=\"astc-10x5-unorm-srgb\",e.ASTC10x6Unorm=\"astc-10x6-unorm\",e.ASTC10x6UnormSRGB=\"astc-10x6-unorm-srgb\",e.ASTC10x8Unorm=\"astc-10x8-unorm\",e.ASTC10x8UnormSRGB=\"astc-10x8-unorm-srgb\",e.ASTC10x10Unorm=\"astc-10x10-unorm\",e.ASTC10x10UnormSRGB=\"astc-10x10-unorm-srgb\",e.ASTC12x10Unorm=\"astc-12x10-unorm\",e.ASTC12x10UnormSRGB=\"astc-12x10-unorm-srgb\",e.ASTC12x12Unorm=\"astc-12x12-unorm\",e.ASTC12x12UnormSRGB=\"astc-12x12-unorm-srgb\",e.Depth24UnormStencil8=\"depth24unorm-stencil8\",e.Depth32FloatStencil8=\"depth32float-stencil8\"}(Ph||(Ph={})),function(e){e.ClampToEdge=\"clamp-to-edge\",e.Repeat=\"repeat\",e.MirrorRepeat=\"mirror-repeat\"}(Mh||(Mh={})),function(e){e.Nearest=\"nearest\",e.Linear=\"linear\"}(Ih||(Ih={})),function(e){e.Never=\"never\",e.Less=\"less\",e.Equal=\"equal\",e.LessEqual=\"less-equal\",e.Greater=\"greater\",e.NotEqual=\"not-equal\",e.GreaterEqual=\"greater-equal\",e.Always=\"always\"}(Oh||(Oh={})),function(e){e[e.Vertex=1]=\"Vertex\",e[e.Fragment=2]=\"Fragment\",e[e.Compute=4]=\"Compute\"}(Dh||(Dh={})),function(e){e.Uniform=\"uniform\",e.Storage=\"storage\",e.ReadOnlyStorage=\"read-only-storage\"}(Nh||(Nh={})),function(e){e.Filtering=\"filtering\",e.NonFiltering=\"non-filtering\",e.Comparison=\"comparison\"}(Lh||(Lh={})),function(e){e.Float=\"float\",e.UnfilterableFloat=\"unfilterable-float\",e.Depth=\"depth\",e.Sint=\"sint\",e.Uint=\"uint\"}(Fh||(Fh={})),function(e){e.WriteOnly=\"write-only\"}(wh||(wh={})),function(e){e.Error=\"error\",e.Warning=\"warning\",e.Info=\"info\"}(Bh||(Bh={})),function(e){e.Auto=\"auto\"}(Uh||(Uh={})),function(e){e.PointList=\"point-list\",e.LineList=\"line-list\",e.LineStrip=\"line-strip\",e.TriangleList=\"triangle-list\",e.TriangleStrip=\"triangle-strip\"}(Vh||(Vh={})),function(e){e.CCW=\"ccw\",e.CW=\"cw\"}(kh||(kh={})),function(e){e.None=\"none\",e.Front=\"front\",e.Back=\"back\"}(Gh||(Gh={})),function(e){e[e.Red=1]=\"Red\",e[e.Green=2]=\"Green\",e[e.Blue=4]=\"Blue\",e[e.Alpha=8]=\"Alpha\",e[e.All=15]=\"All\"}(zh||(zh={})),function(e){e.Zero=\"zero\",e.One=\"one\",e.Src=\"src\",e.OneMinusSrc=\"one-minus-src\",e.SrcAlpha=\"src-alpha\",e.OneMinusSrcAlpha=\"one-minus-src-alpha\",e.Dst=\"dst\",e.OneMinusDst=\"one-minus-dst\",e.DstAlpha=\"dst-alpha\",e.OneMinusDstAlpha=\"one-minus-dst-alpha\",e.SrcAlphaSaturated=\"src-alpha-saturated\",e.Constant=\"constant\",e.OneMinusConstant=\"one-minus-constant\"}(Wh||(Wh={})),function(e){e.Add=\"add\",e.Subtract=\"subtract\",e.ReverseSubtract=\"reverse-subtract\",e.Min=\"min\",e.Max=\"max\"}(Hh||(Hh={})),function(e){e.Keep=\"keep\",e.Zero=\"zero\",e.Replace=\"replace\",e.Invert=\"invert\",e.IncrementClamp=\"increment-clamp\",e.DecrementClamp=\"decrement-clamp\",e.IncrementWrap=\"increment-wrap\",e.DecrementWrap=\"decrement-wrap\"}(Xh||(Xh={})),function(e){e.Uint16=\"uint16\",e.Uint32=\"uint32\"}(jh||(jh={})),function(e){e.Uint8x2=\"uint8x2\",e.Uint8x4=\"uint8x4\",e.Sint8x2=\"sint8x2\",e.Sint8x4=\"sint8x4\",e.Unorm8x2=\"unorm8x2\",e.Unorm8x4=\"unorm8x4\",e.Snorm8x2=\"snorm8x2\",e.Snorm8x4=\"snorm8x4\",e.Uint16x2=\"uint16x2\",e.Uint16x4=\"uint16x4\",e.Sint16x2=\"sint16x2\",e.Sint16x4=\"sint16x4\",e.Unorm16x2=\"unorm16x2\",e.Unorm16x4=\"unorm16x4\",e.Snorm16x2=\"snorm16x2\",e.Snorm16x4=\"snorm16x4\",e.Float16x2=\"float16x2\",e.Float16x4=\"float16x4\",e.Float32=\"float32\",e.Float32x2=\"float32x2\",e.Float32x3=\"float32x3\",e.Float32x4=\"float32x4\",e.Uint32=\"uint32\",e.Uint32x2=\"uint32x2\",e.Uint32x3=\"uint32x3\",e.Uint32x4=\"uint32x4\",e.Sint32=\"sint32\",e.Sint32x2=\"sint32x2\",e.Sint32x3=\"sint32x3\",e.Sint32x4=\"sint32x4\"}(Yh||(Yh={})),function(e){e.Vertex=\"vertex\",e.Instance=\"instance\"}(Kh||(Kh={})),function(e){e.Beginning=\"beginning\",e.End=\"end\"}(Qh||(Qh={})),function(e){e.Beginning=\"beginning\",e.End=\"end\"}(qh||(qh={})),function(e){e.Load=\"load\",e.Clear=\"clear\"}(Zh||(Zh={})),function(e){e.Store=\"store\",e.Discard=\"discard\"}(Jh||(Jh={})),function(e){e.Occlusion=\"occlusion\",e.Timestamp=\"timestamp\"}($h||($h={})),function(e){e.Opaque=\"opaque\",e.Premultiplied=\"premultiplied\"}(ed||(ed={})),function(e){e.Destroyed=\"destroyed\"}(td||(td={})),function(e){e.OutOfMemory=\"out-of-memory\",e.Validation=\"validation\"}(id||(id={}));var rd=function(){function e(){this.shaderLanguage=et.GLSL}return e.prototype._addUniformToLeftOverUBO=function(e,t,i){var n,r;e=(n=this._getArraySize(e,t,i))[0],t=n[1],r=n[2];for(var o=0;o=0){for(;r++=0&&(m.push(a[c]),g.push(v))}this.shaderProcessingContext.attributeNamesFromEffect=m,this.shaderProcessingContext.attributeLocationsFromEffect=g},e.prototype.buildUniformLayout=function(){if(this.shaderProcessingContext.leftOverUniforms.length){this.uniformBuffer=new Li(this.engine,void 0,void 0,\"leftOver-\"+this._name);for(var e=0,t=this.shaderProcessingContext.leftOverUniforms;e)?$/,\"$1\"),r=rd.UniformSizes[n];this.uniformBuffer.addUniform(i.name,r,i.length),this._leftOverUniformsByName[i.name]=i.type}this.uniformBuffer.create()}},e.prototype.dispose=function(){this.uniformBuffer&&this.uniformBuffer.dispose()},e.prototype.setInt=function(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateInt(e,t)},e.prototype.setInt2=function(e,t,i){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateInt2(e,t,i)},e.prototype.setInt3=function(e,t,i,n){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateInt3(e,t,i,n)},e.prototype.setInt4=function(e,t,i,n,r){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateInt4(e,t,i,n,r)},e.prototype.setIntArray=function(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateIntArray(e,t)},e.prototype.setIntArray2=function(e,t){this.setIntArray(e,t)},e.prototype.setIntArray3=function(e,t){this.setIntArray(e,t)},e.prototype.setIntArray4=function(e,t){this.setIntArray(e,t)},e.prototype.setArray=function(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateArray(e,t)},e.prototype.setArray2=function(e,t){this.setArray(e,t)},e.prototype.setArray3=function(e,t){this.setArray(e,t)},e.prototype.setArray4=function(e,t){this.setArray(e,t)},e.prototype.setMatrices=function(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateMatrices(e,t)},e.prototype.setMatrix=function(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateMatrix(e,t)},e.prototype.setMatrix3x3=function(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateMatrix3x3(e,t)},e.prototype.setMatrix2x2=function(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateMatrix2x2(e,t)},e.prototype.setFloat=function(e,t){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateFloat(e,t)},e.prototype.setVector2=function(e,t){this.setFloat2(e,t.x,t.y)},e.prototype.setFloat2=function(e,t,i){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateFloat2(e,t,i)},e.prototype.setVector3=function(e,t){this.setFloat3(e,t.x,t.y,t.z)},e.prototype.setFloat3=function(e,t,i,n){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateFloat3(e,t,i,n)},e.prototype.setVector4=function(e,t){this.setFloat4(e,t.x,t.y,t.z,t.w)},e.prototype.setQuaternion=function(e,t){this.setFloat4(e,t.x,t.y,t.z,t.w)},e.prototype.setFloat4=function(e,t,i,n,r){this.uniformBuffer&&this._leftOverUniformsByName[e]&&this.uniformBuffer.updateFloat4(e,t,i,n,r)},e.prototype.setColor3=function(e,t){this.setFloat3(e,t.r,t.g,t.b)},e.prototype.setColor4=function(e,t,i){this.setFloat4(e,t.r,t.g,t.b,i)},e.prototype.setDirectColor4=function(e,t){this.setFloat4(e,t.r,t.g,t.b,t.a)},e.prototype._getVertexShaderCode=function(){var e;return null===(e=this.sources)||void 0===e?void 0:e.vertex},e.prototype._getFragmentShaderCode=function(){var e;return null===(e=this.sources)||void 0===e?void 0:e.fragment},e}(),ad={mat2:2,mat3:3,mat4:4,mat2x2:2,mat3x3:3,mat4x4:4},sd=function(){function e(e){this.shaderLanguage=e,this._attributeNextLocation=0,this._varyingNextLocation=0,this.freeGroupIndex=0,this.freeBindingIndex=0,this.availableVaryings={},this.availableAttributes={},this.availableBuffers={},this.availableTextures={},this.availableSamplers={},this.orderedAttributes=[],this.bindGroupLayoutEntries=[],this.bindGroupLayoutEntryInfo=[],this.bindGroupEntries=[],this.bufferNames=[],this.textureNames=[],this.samplerNames=[],this.leftOverUniforms=[],this._findStartingGroupBinding()}return Object.defineProperty(e,\"KnownUBOs\",{get:function(){return e._SimplifiedKnownBindings?e._SimplifiedKnownUBOs:e._KnownUBOs},enumerable:!1,configurable:!0}),e.prototype._findStartingGroupBinding=function(){var t=e.KnownUBOs,i=[];for(var n in t){var r=t[n].binding;-1!==r.groupIndex&&(void 0===i[r.groupIndex]?i[r.groupIndex]=r.bindingIndex:i[r.groupIndex]=Math.max(i[r.groupIndex],r.bindingIndex))}this.freeGroupIndex=i.length-1,0===this.freeGroupIndex?(this.freeGroupIndex++,this.freeBindingIndex=0):this.freeBindingIndex=i[i.length-1]+1},e.prototype.getAttributeNextLocation=function(e,t){var i;void 0===t&&(t=0);var n=this._attributeNextLocation;return this._attributeNextLocation+=(null!==(i=ad[e])&&void 0!==i?i:1)*(t||1),n},e.prototype.getVaryingNextLocation=function(e,t){var i;void 0===t&&(t=0);var n=this._varyingNextLocation;return this._varyingNextLocation+=(null!==(i=ad[e])&&void 0!==i?i:1)*(t||1),n},e.prototype.getNextFreeUBOBinding=function(){return this._getNextFreeBinding(1)},e.prototype._getNextFreeBinding=function(e){if(this.freeBindingIndex>65536-e&&(this.freeGroupIndex++,this.freeBindingIndex=0),4===this.freeGroupIndex)throw\"Too many textures or UBOs have been declared and it is not supported in WebGPU.\";var t={groupIndex:this.freeGroupIndex,bindingIndex:this.freeBindingIndex};return this.freeBindingIndex+=e,t},e._SimplifiedKnownBindings=!0,e._SimplifiedKnownUBOs={Scene:{binding:{groupIndex:0,bindingIndex:0}},Light0:{binding:{groupIndex:-1,bindingIndex:-1}},Light1:{binding:{groupIndex:-1,bindingIndex:-1}},Light2:{binding:{groupIndex:-1,bindingIndex:-1}},Light3:{binding:{groupIndex:-1,bindingIndex:-1}},Light4:{binding:{groupIndex:-1,bindingIndex:-1}},Light5:{binding:{groupIndex:-1,bindingIndex:-1}},Light6:{binding:{groupIndex:-1,bindingIndex:-1}},Light7:{binding:{groupIndex:-1,bindingIndex:-1}},Light8:{binding:{groupIndex:-1,bindingIndex:-1}},Light9:{binding:{groupIndex:-1,bindingIndex:-1}},Light10:{binding:{groupIndex:-1,bindingIndex:-1}},Light11:{binding:{groupIndex:-1,bindingIndex:-1}},Light12:{binding:{groupIndex:-1,bindingIndex:-1}},Light13:{binding:{groupIndex:-1,bindingIndex:-1}},Light14:{binding:{groupIndex:-1,bindingIndex:-1}},Light15:{binding:{groupIndex:-1,bindingIndex:-1}},Light16:{binding:{groupIndex:-1,bindingIndex:-1}},Light17:{binding:{groupIndex:-1,bindingIndex:-1}},Light18:{binding:{groupIndex:-1,bindingIndex:-1}},Light19:{binding:{groupIndex:-1,bindingIndex:-1}},Light20:{binding:{groupIndex:-1,bindingIndex:-1}},Light21:{binding:{groupIndex:-1,bindingIndex:-1}},Light22:{binding:{groupIndex:-1,bindingIndex:-1}},Light23:{binding:{groupIndex:-1,bindingIndex:-1}},Light24:{binding:{groupIndex:-1,bindingIndex:-1}},Light25:{binding:{groupIndex:-1,bindingIndex:-1}},Light26:{binding:{groupIndex:-1,bindingIndex:-1}},Light27:{binding:{groupIndex:-1,bindingIndex:-1}},Light28:{binding:{groupIndex:-1,bindingIndex:-1}},Light29:{binding:{groupIndex:-1,bindingIndex:-1}},Light30:{binding:{groupIndex:-1,bindingIndex:-1}},Light31:{binding:{groupIndex:-1,bindingIndex:-1}},Material:{binding:{groupIndex:-1,bindingIndex:-1}},Mesh:{binding:{groupIndex:-1,bindingIndex:-1}},Internals:{binding:{groupIndex:-1,bindingIndex:-1}}},e._KnownUBOs={Scene:{binding:{groupIndex:0,bindingIndex:0}},Light0:{binding:{groupIndex:1,bindingIndex:0}},Light1:{binding:{groupIndex:1,bindingIndex:1}},Light2:{binding:{groupIndex:1,bindingIndex:2}},Light3:{binding:{groupIndex:1,bindingIndex:3}},Light4:{binding:{groupIndex:1,bindingIndex:4}},Light5:{binding:{groupIndex:1,bindingIndex:5}},Light6:{binding:{groupIndex:1,bindingIndex:6}},Light7:{binding:{groupIndex:1,bindingIndex:7}},Light8:{binding:{groupIndex:1,bindingIndex:8}},Light9:{binding:{groupIndex:1,bindingIndex:9}},Light10:{binding:{groupIndex:1,bindingIndex:10}},Light11:{binding:{groupIndex:1,bindingIndex:11}},Light12:{binding:{groupIndex:1,bindingIndex:12}},Light13:{binding:{groupIndex:1,bindingIndex:13}},Light14:{binding:{groupIndex:1,bindingIndex:14}},Light15:{binding:{groupIndex:1,bindingIndex:15}},Light16:{binding:{groupIndex:1,bindingIndex:16}},Light17:{binding:{groupIndex:1,bindingIndex:17}},Light18:{binding:{groupIndex:1,bindingIndex:18}},Light19:{binding:{groupIndex:1,bindingIndex:19}},Light20:{binding:{groupIndex:1,bindingIndex:20}},Light21:{binding:{groupIndex:1,bindingIndex:21}},Light22:{binding:{groupIndex:1,bindingIndex:22}},Light23:{binding:{groupIndex:1,bindingIndex:23}},Light24:{binding:{groupIndex:1,bindingIndex:24}},Light25:{binding:{groupIndex:1,bindingIndex:25}},Light26:{binding:{groupIndex:1,bindingIndex:26}},Light27:{binding:{groupIndex:1,bindingIndex:27}},Light28:{binding:{groupIndex:1,bindingIndex:28}},Light29:{binding:{groupIndex:1,bindingIndex:29}},Light30:{binding:{groupIndex:1,bindingIndex:30}},Light31:{binding:{groupIndex:1,bindingIndex:31}},Material:{binding:{groupIndex:2,bindingIndex:0}},Mesh:{binding:{groupIndex:2,bindingIndex:1}},Internals:{binding:{groupIndex:2,bindingIndex:2}}},e}(),ld=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._missingVaryings=[],t._textureArrayProcessing=[],t.shaderLanguage=et.GLSL,t}return V(t,e),t.prototype._getArraySize=function(e,t,i){var n=0,r=e.indexOf(\"[\"),o=e.indexOf(\"]\");if(r>0&&o>0){var a=e.substring(r+1,o);n=+a,isNaN(n)&&(n=+i[a.trim()]),e=e.substr(0,r)}return[e,t,n]},t.prototype.initializeShaders=function(e){this._webgpuProcessingContext=e,this._missingVaryings.length=0,this._textureArrayProcessing.length=0},t.prototype.preProcessShaderCode=function(e,t){var i=\"uniform \".concat(rd.InternalsUBOName,\" {\\nfloat yFactor_;\\nfloat textureOutputHeight_;\\n};\\n\");return t?i+\"##INJECTCODE##\\n\"+e:i+e},t.prototype.varyingProcessor=function(e,t,i){this._preProcessors=i;var n=/\\s*varying\\s+(?:(?:highp)?|(?:lowp)?)\\s*(\\S+)\\s+(\\S+)\\s*;/gm.exec(e);if(null!=n){var r,o=n[1],a=n[2];t?(r=this._webgpuProcessingContext.availableVaryings[a],this._missingVaryings[r]=\"\",void 0===r&&Q.Warn('Invalid fragment shader: The varying named \"'.concat(a,'\" is not declared in the vertex shader! This declaration will be ignored.'))):(r=this._webgpuProcessingContext.getVaryingNextLocation(o,this._getArraySize(a,o,i)[2]),this._webgpuProcessingContext.availableVaryings[a]=r,this._missingVaryings[r]=\"layout(location = \".concat(r,\") in \").concat(o,\" \").concat(a,\";\")),e=e.replace(n[0],void 0===r?\"\":\"layout(location = \".concat(r,\") \").concat(t?\"in\":\"out\",\" \").concat(o,\" \").concat(a,\";\"))}return e},t.prototype.attributeProcessor=function(e,t){this._preProcessors=t;var i=/\\s*attribute\\s+(\\S+)\\s+(\\S+)\\s*;/gm.exec(e);if(null!=i){var n=i[1],r=i[2],o=this._webgpuProcessingContext.getAttributeNextLocation(n,this._getArraySize(r,n,t)[2]);this._webgpuProcessingContext.availableAttributes[r]=o,this._webgpuProcessingContext.orderedAttributes[o]=r,e=e.replace(i[0],\"layout(location = \".concat(o,\") in \").concat(n,\" \").concat(r,\";\"))}return e},t.prototype.uniformProcessor=function(e,t,i){var n,r;this._preProcessors=i;var o=/\\s*uniform\\s+(?:(?:highp)?|(?:lowp)?)\\s*(\\S+)\\s+(\\S+)\\s*;/gm.exec(e);if(null!=o){var a=o[1],s=o[2];if(0===a.indexOf(\"sampler\")||1===a.indexOf(\"sampler\")){var l=0;s=(n=this._getArraySize(s,a,i))[0],a=n[1],l=n[2];var c=this._webgpuProcessingContext.availableTextures[s];if(!c){c={autoBindSampler:!0,isTextureArray:l>0,isStorageTexture:!1,textures:[],sampleType:Fh.Float};for(var u=0;u<(l||1);++u)c.textures.push(this._webgpuProcessingContext.getNextFreeUBOBinding())}var h=null!==(r=rd._SamplerTypeByWebGLSamplerType[a])&&void 0!==r?r:\"sampler\",d=!!rd._IsComparisonSamplerByWebGPUSamplerType[h],p=d?Lh.Comparison:Lh.Filtering,f=s+rd.AutoSamplerSuffix,_=this._webgpuProcessingContext.availableSamplers[f];_||(_={binding:this._webgpuProcessingContext.getNextFreeUBOBinding(),type:p});var m=\"u\"===a.charAt(0)?\"u\":\"i\"===a.charAt(0)?\"i\":\"\";m&&(a=a.substr(1));var g=d?Fh.Depth:\"u\"===m?Fh.Uint:\"i\"===m?Fh.Sint:Fh.Float;c.sampleType=g;var v=l>0,y=_.binding.groupIndex,b=_.binding.bindingIndex,T=rd._SamplerFunctionByWebGLSamplerType[a],E=rd._TextureTypeByWebGLSamplerType[a],S=rd._GpuTextureViewDimensionByWebGPUTextureType[E];if(v){var A=[];for(A.push(\"layout(set = \".concat(y,\", binding = \").concat(b,\") uniform \").concat(m).concat(h,\" \").concat(f,\";\")),e=\"\\r\\n\",u=0;u0?\"\\r\\n\":\"\",\"#define \").concat(s).concat(u,\" \").concat(m).concat(T,\"(\").concat(s,\"Texture\").concat(u,\", \").concat(f,\")\")}e=A.join(\"\\r\\n\")+e,this._textureArrayProcessing.push(s)}else l=1,e=\"layout(set = \".concat(y,\", binding = \").concat(b,\") uniform \").concat(m).concat(h,\" \").concat(f,\";\\n layout(set = \").concat(c.textures[0].groupIndex,\", binding = \").concat(c.textures[0].bindingIndex,\") uniform \").concat(E,\" \").concat(s,\"Texture;\\n #define \").concat(s,\" \").concat(m).concat(T,\"(\").concat(s,\"Texture, \").concat(f,\")\");for(this._webgpuProcessingContext.availableTextures[s]=c,this._webgpuProcessingContext.availableSamplers[f]=_,this._addSamplerBindingDescription(f,_,!t),u=0;u=0,s=a?\"vec4 glFragCoord_;\\n\":\"\";e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/texture2DLodEXT\\s*\\(/g,\"textureLod(\")).replace(/textureCubeLodEXT\\s*\\(/g,\"textureLod(\")).replace(/textureCube\\s*\\(/g,\"texture(\")).replace(/gl_FragDepthEXT/g,\"gl_FragDepth\")).replace(/gl_FragColor/g,\"glFragColor\")).replace(/gl_FragData/g,\"glFragData\")).replace(/gl_FragCoord/g,\"glFragCoord_\")).replace(/void\\s+?main\\s*\\(/g,(o?\"\":\"layout(location = 0) out vec4 glFragColor;\\n\")+\"void main(\")).replace(/dFdy/g,\"(-yFactor_)*dFdy\")).replace(\"##INJECTCODE##\",s),a&&(e=this._injectStartingAndEndingCode(e,\"void main\",\"\\n glFragCoord_ = gl_FragCoord;\\n if (yFactor_ == 1.) {\\n glFragCoord_.y = textureOutputHeight_ - glFragCoord_.y;\\n }\\n \"))}else if(e=(e=e.replace(/gl_InstanceID/g,\"gl_InstanceIndex\")).replace(/gl_VertexID/g,\"gl_VertexIndex\"),-1!==t.indexOf(\"#define MULTIVIEW\"))return\"#extension GL_OVR_multiview2 : require\\nlayout (num_views = 2) in;\\n\"+e;if(!i){var l=e.lastIndexOf(\"}\");e=e.substring(0,l),e+=\"gl_Position.y *= yFactor_;\\n\",r.isNDCHalfZRange||(e+=\"gl_Position.z = (gl_Position.z + gl_Position.w) / 2.0;\\n\"),e+=\"}\"}return e},t.prototype._applyTextureArrayProcessing=function(e,t){for(var i=new RegExp(t+\"\\\\s*\\\\[(.+)?\\\\]\",\"gm\"),n=i.exec(e);null!=n;){var r=n[1],o=+r;this._preProcessors&&isNaN(o)&&(o=+this._preProcessors[r.trim()]),e=e.replace(n[0],t+o),n=i.exec(e)}return e},t.prototype._generateLeftOverUBOCode=function(e,t){for(var i=\"layout(set = \".concat(t.binding.groupIndex,\", binding = \").concat(t.binding.bindingIndex,\") uniform \").concat(e,\" {\\n \"),n=0,r=this._webgpuProcessingContext.leftOverUniforms;n0?i+=\" \".concat(o.type,\" \").concat(o.name,\"[\").concat(o.length,\"];\\n\"):i+=\" \".concat(o.type,\" \").concat(o.name,\";\\n\")}return i+\"};\\n\\n\"},t.prototype.finalizeShaders=function(e,t){for(var i=0;i0&&(t=r+\"\\n\"+t)}var o=this._buildLeftOverUBO();return e=o+e,t=o+t,this._collectBindingNames(),this._preCreateBindGroupEntries(),this._preProcessors=null,{vertexCode:e,fragmentCode:t}},t}(rd);It.IncludesShadersStoreWGSL.bonesDeclaration=\"#if NUM_BONE_INFLUENCERS>0\\nattribute matricesIndices : vec4;\\nattribute matricesWeights : vec4;\\n#if NUM_BONE_INFLUENCERS>4\\nattribute matricesIndicesExtra : vec4;\\nattribute matricesWeightsExtra : vec4;\\n#endif\\n#ifndef BAKED_VERTEX_ANIMATION_TEXTURE\\n#ifdef BONETEXTURE\\nvar boneSampler : texture_2d;\\nuniform boneTextureWidth : f32;\\n#else\\nuniform mBones : array;\\n#ifdef BONES_VELOCITY_ENABLED\\nuniform mPreviousBones : array;\\n#endif\\n#endif\\n#ifdef BONETEXTURE\\nfn readMatrixFromRawSampler(smp : texture_2d,index : f32)->mat4x4\\n{\\nlet offset=i32(index) *4; \\nlet m0=textureLoad(smp,vec2(offset+0,0),0);\\nlet m1=textureLoad(smp,vec2(offset+1,0),0);\\nlet m2=textureLoad(smp,vec2(offset+2,0),0);\\nlet m3=textureLoad(smp,vec2(offset+3,0),0);\\nreturn mat4x4(m0,m1,m2,m3);\\n}\\n#endif\\n#endif\\n#endif\\n\";It.IncludesShadersStoreWGSL.bonesVertex=\"#ifndef BAKED_VERTEX_ANIMATION_TEXTURE\\n#if NUM_BONE_INFLUENCERS>0\\nvar influence : mat4x4;\\n#ifdef BONETEXTURE\\ninfluence=readMatrixFromRawSampler(boneSampler,matricesIndices[0])*matricesWeights[0];\\n#if NUM_BONE_INFLUENCERS>1\\ninfluence=influence+readMatrixFromRawSampler(boneSampler,matricesIndices[1])*matricesWeights[1];\\n#endif \\n#if NUM_BONE_INFLUENCERS>2\\ninfluence=influence+readMatrixFromRawSampler(boneSampler,matricesIndices[2])*matricesWeights[2];\\n#endif \\n#if NUM_BONE_INFLUENCERS>3\\ninfluence=influence+readMatrixFromRawSampler(boneSampler,matricesIndices[3])*matricesWeights[3];\\n#endif \\n#if NUM_BONE_INFLUENCERS>4\\ninfluence=influence+readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[0])*matricesWeightsExtra[0];\\n#endif \\n#if NUM_BONE_INFLUENCERS>5\\ninfluence=influence+readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[1])*matricesWeightsExtra[1];\\n#endif \\n#if NUM_BONE_INFLUENCERS>6\\ninfluence=influence+readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[2])*matricesWeightsExtra[2];\\n#endif \\n#if NUM_BONE_INFLUENCERS>7\\ninfluence=influence+readMatrixFromRawSampler(boneSampler,matricesIndicesExtra[3])*matricesWeightsExtra[3];\\n#endif \\n#else \\ninfluence=uniforms.mBones[int(matricesIndices[0])]*matricesWeights[0];\\n#if NUM_BONE_INFLUENCERS>1\\ninfluence=influence+uniforms.mBones[int(matricesIndices[1])]*matricesWeights[1];\\n#endif \\n#if NUM_BONE_INFLUENCERS>2\\ninfluence=influence+uniforms.mBones[int(matricesIndices[2])]*matricesWeights[2];\\n#endif \\n#if NUM_BONE_INFLUENCERS>3\\ninfluence=influence+uniforms.mBones[int(matricesIndices[3])]*matricesWeights[3];\\n#endif \\n#if NUM_BONE_INFLUENCERS>4\\ninfluence=influence+uniforms.mBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\\n#endif \\n#if NUM_BONE_INFLUENCERS>5\\ninfluence=influence+uniforms.mBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\\n#endif \\n#if NUM_BONE_INFLUENCERS>6\\ninfluence=influence+uniforms.mBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\\n#endif \\n#if NUM_BONE_INFLUENCERS>7\\ninfluence=influence+uniforms.mBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\\n#endif \\n#endif\\nfinalWorld=finalWorld*influence;\\n#endif\\n#endif\\n\";It.IncludesShadersStoreWGSL.bakedVertexAnimationDeclaration=\"#ifdef BAKED_VERTEX_ANIMATION_TEXTURE\\nuniform bakedVertexAnimationTime: f32;\\nuniform bakedVertexAnimationTextureSizeInverted: vec2;\\nuniform bakedVertexAnimationSettings: vec4;\\nvar bakedVertexAnimationTexture : texture_2d;\\n#ifdef INSTANCES\\nattribute bakedVertexAnimationSettingsInstanced : vec4;\\n#endif\\nfn readMatrixFromRawSamplerVAT(smp : texture_2d,index : f32,frame : f32)->mat4x4\\n{\\nlet offset=i32(index)*4;\\nlet frameUV=i32(frame);\\nlet m0=textureLoad(smp,vec2(offset+0,frameUV),0);\\nlet m1=textureLoad(smp,vec2(offset+1,frameUV),0);\\nlet m2=textureLoad(smp,vec2(offset+2,frameUV),0);\\nlet m3=textureLoad(smp,vec2(offset+3,frameUV),0);\\nreturn mat4x4(m0,m1,m2,m3);\\n}\\n#endif\\n\";It.IncludesShadersStoreWGSL.bakedVertexAnimation=\"#ifdef BAKED_VERTEX_ANIMATION_TEXTURE\\n{\\n#ifdef INSTANCES\\nlet VATStartFrame: f32=bakedVertexAnimationSettingsInstanced.x;\\nlet VATEndFrame: f32=bakedVertexAnimationSettingsInstanced.y;\\nlet VATOffsetFrame: f32=bakedVertexAnimationSettingsInstanced.z;\\nlet VATSpeed: f32=bakedVertexAnimationSettingsInstanced.w;\\n#else\\nlet VATStartFrame: f32=uniforms.bakedVertexAnimationSettings.x;\\nlet VATEndFrame: f32=uniforms.bakedVertexAnimationSettings.y;\\nlet VATOffsetFrame: f32=uniforms.bakedVertexAnimationSettings.z;\\nlet VATSpeed: f32=uniforms.bakedVertexAnimationSettings.w;\\n#endif\\nlet totalFrames: f32=VATEndFrame-VATStartFrame+1.0;\\nlet time: f32=uniforms.bakedVertexAnimationTime*VATSpeed/totalFrames;\\nlet frameCorrection: f32=select(1.0,0.0,time<1.0);\\nlet numOfFrames: f32=totalFrames-frameCorrection;\\nvar VATFrameNum: f32=fract(time)*numOfFrames;\\nVATFrameNum=(VATFrameNum+VATOffsetFrame) % numOfFrames;\\nVATFrameNum=floor(VATFrameNum);\\nVATFrameNum=VATFrameNum+VATStartFrame+frameCorrection;\\nvar VATInfluence : mat4x4;\\nVATInfluence=readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[0],VATFrameNum)*matricesWeights[0];\\n#if NUM_BONE_INFLUENCERS>1\\nVATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[1],VATFrameNum)*matricesWeights[1];\\n#endif\\n#if NUM_BONE_INFLUENCERS>2\\nVATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[2],VATFrameNum)*matricesWeights[2];\\n#endif\\n#if NUM_BONE_INFLUENCERS>3\\nVATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndices[3],VATFrameNum)*matricesWeights[3];\\n#endif\\n#if NUM_BONE_INFLUENCERS>4\\nVATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[0],VATFrameNum)*matricesWeightsExtra[0];\\n#endif\\n#if NUM_BONE_INFLUENCERS>5\\nVATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[1],VATFrameNum)*matricesWeightsExtra[1];\\n#endif\\n#if NUM_BONE_INFLUENCERS>6\\nVATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[2],VATFrameNum)*matricesWeightsExtra[2];\\n#endif\\n#if NUM_BONE_INFLUENCERS>7\\nVATInfluence=VATInfluence+readMatrixFromRawSamplerVAT(bakedVertexAnimationTexture,matricesIndicesExtra[3],VATFrameNum)*matricesWeightsExtra[3];\\n#endif\\nfinalWorld=finalWorld*VATInfluence;\\n}\\n#endif\\n\";It.IncludesShadersStoreWGSL.clipPlaneFragment=\"#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6)\\nif (false) {}\\n#endif\\n#ifdef CLIPPLANE\\nelse if (fClipDistance>0.0)\\n{\\ndiscard;\\n}\\n#endif\\n#ifdef CLIPPLANE2\\nelse if (fClipDistance2>0.0)\\n{\\ndiscard;\\n}\\n#endif\\n#ifdef CLIPPLANE3\\nelse if (fClipDistance3>0.0)\\n{\\ndiscard;\\n}\\n#endif\\n#ifdef CLIPPLANE4\\nelse if (fClipDistance4>0.0)\\n{\\ndiscard;\\n}\\n#endif\\n#ifdef CLIPPLANE5\\nelse if (fClipDistance5>0.0)\\n{\\ndiscard;\\n}\\n#endif\\n#ifdef CLIPPLANE6\\nelse if (fClipDistance6>0.0)\\n{\\ndiscard;\\n}\\n#endif\\n\";It.IncludesShadersStoreWGSL.clipPlaneFragmentDeclaration=\"#ifdef CLIPPLANE\\nvarying fClipDistance: f32;\\n#endif\\n#ifdef CLIPPLANE2\\nvarying fClipDistance2: f32;\\n#endif\\n#ifdef CLIPPLANE3\\nvarying fClipDistance3: f32;\\n#endif\\n#ifdef CLIPPLANE4\\nvarying fClipDistance4: f32;\\n#endif\\n#ifdef CLIPPLANE5\\nvarying fClipDistance5: f32;\\n#endif\\n#ifdef CLIPPLANE6\\nvarying fClipDistance6: f32;\\n#endif\\n\";It.IncludesShadersStoreWGSL.clipPlaneVertex=\"#ifdef CLIPPLANE\\nfClipDistance=dot(worldPos,uniforms.vClipPlane);\\n#endif\\n#ifdef CLIPPLANE2\\nfClipDistance2=dot(worldPos,uniforms.vClipPlane2);\\n#endif\\n#ifdef CLIPPLANE3\\nfClipDistance3=dot(worldPos,uniforms.vClipPlane3);\\n#endif\\n#ifdef CLIPPLANE4\\nfClipDistance4=dot(worldPos,uniforms.vClipPlane4);\\n#endif\\n#ifdef CLIPPLANE5\\nfClipDistance5=dot(worldPos,uniforms.vClipPlane5);\\n#endif\\n#ifdef CLIPPLANE6\\nfClipDistance6=dot(worldPos,uniforms.vClipPlane6);\\n#endif\\n\";It.IncludesShadersStoreWGSL.clipPlaneVertexDeclaration=\"#ifdef CLIPPLANE\\nuniform vClipPlane: vec4;\\nvarying fClipDistance: f32;\\n#endif\\n#ifdef CLIPPLANE2\\nuniform vClipPlane2: vec4;\\nvarying fClipDistance2: f32;\\n#endif\\n#ifdef CLIPPLANE3\\nuniform vClipPlane3: vec4;\\nvarying fClipDistance3: f32;\\n#endif\\n#ifdef CLIPPLANE4\\nuniform vClipPlane4: vec4;\\nvarying fClipDistance4: f32;\\n#endif\\n#ifdef CLIPPLANE5\\nuniform vClipPlane5: vec4;\\nvarying fClipDistance5: f32;\\n#endif\\n#ifdef CLIPPLANE6\\nuniform vClipPlane6: vec4;\\nvarying fClipDistance6: f32;\\n#endif\\n\";It.IncludesShadersStoreWGSL.instancesDeclaration=\"#ifdef INSTANCES\\nattribute world0 : vec4;\\nattribute world1 : vec4;\\nattribute world2 : vec4;\\nattribute world3 : vec4;\\n#ifdef INSTANCESCOLOR\\nattribute instanceColor : vec4;\\n#endif\\n#if defined(THIN_INSTANCES) && !defined(WORLD_UBO)\\nuniform world : mat4x4;\\n#endif\\n#if defined(VELOCITY) || defined(PREPASS_VELOCITY)\\nattribute previousWorld0 : vec4;\\nattribute previousWorld1 : vec4;\\nattribute previousWorld2 : vec4;\\nattribute previousWorld3 : vec4;\\n#ifdef THIN_INSTANCES\\nuniform previousWorld : mat4x4;\\n#endif\\n#endif\\n#else\\n#if !defined(WORLD_UBO)\\nuniform world : mat4x4;\\n#endif\\n#if defined(VELOCITY) || defined(PREPASS_VELOCITY)\\nuniform previousWorld : mat4x4;\\n#endif\\n#endif\\n\";It.IncludesShadersStoreWGSL.instancesVertex=\"#ifdef INSTANCES\\nvar finalWorld=mat4x4(world0,world1,world2,world3);\\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY)\\nvar finalPreviousWorld=mat4x4(previousWorld0,previousWorld1,previousWorld2,previousWorld3);\\n#endif\\n#ifdef THIN_INSTANCES\\n#if !defined(WORLD_UBO)\\nfinalWorld=uniforms.world*finalWorld;\\n#else\\nfinalWorld=mesh.world*finalWorld;\\n#endif\\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY)\\nfinalPreviousWorld=previousWorld*finalPreviousWorld;\\n#endif\\n#endif\\n#else\\n#if !defined(WORLD_UBO)\\nvar finalWorld=uniforms.world;\\n#else\\nvar finalWorld=mesh.world;\\n#endif\\n#if defined(PREPASS_VELOCITY) || defined(VELOCITY)\\nvar finalPreviousWorld=previousWorld;\\n#endif\\n#endif\\n\";It.IncludesShadersStoreWGSL.meshUboDeclaration=\"struct Mesh {\\nworld : mat4x4,\\nvisibility : f32,\\n};\\nvar mesh : Mesh;\\n#define WORLD_UBO\\n\";It.IncludesShadersStoreWGSL.morphTargetsVertex=\"#ifdef MORPHTARGETS\\n#ifdef MORPHTARGETS_TEXTURE \\nvertexID=f32(gl_VertexID)*uniforms.morphTargetTextureInfo.x;\\npositionUpdated=positionUpdated+(readVector3FromRawSampler({X},vertexID)-position)*uniforms.morphTargetInfluences[{X}];\\nvertexID=vertexID+1.0;\\n#ifdef MORPHTARGETS_NORMAL\\nnormalUpdated=normalUpdated+(readVector3FromRawSampler({X},vertexID) -normal)*uniforms.morphTargetInfluences[{X}];\\nvertexID=vertexID+1.0;\\n#endif\\n#ifdef MORPHTARGETS_UV\\nuvUpdated=uvUpdated+(readVector3FromRawSampler({X},vertexID).xy-uv)*uniforms.morphTargetInfluences[{X}];\\nvertexID=vertexID+1.0;\\n#endif\\n#ifdef MORPHTARGETS_TANGENT\\ntangentUpdated.xyz=tangentUpdated.xyz+(readVector3FromRawSampler({X},vertexID) -tangent.xyz)*uniforms.morphTargetInfluences[{X}];\\n#endif\\n#else\\npositionUpdated=positionUpdated+(position{X}-position)*uniforms.morphTargetInfluences[{X}];\\n#ifdef MORPHTARGETS_NORMAL\\nnormalUpdated+=(normal{X}-normal)*uniforms.morphTargetInfluences[{X}];\\n#endif\\n#ifdef MORPHTARGETS_TANGENT\\ntangentUpdated.xyz=tangentUpdated.xyz+(tangent{X}-tangent.xyz)*uniforms.morphTargetInfluences[{X}];\\n#endif\\n#ifdef MORPHTARGETS_UV\\nuvUpdated=uvUpdated+(uv_{X}-uv)*uniforms.morphTargetInfluences[{X}];\\n#endif\\n#endif\\n#endif\\n\";It.IncludesShadersStoreWGSL.morphTargetsVertexDeclaration=\"#ifdef MORPHTARGETS\\n#ifndef MORPHTARGETS_TEXTURE\\nattribute position{X} : vec3;\\n#ifdef MORPHTARGETS_NORMAL\\nattribute normal{X} : vec3;\\n#endif\\n#ifdef MORPHTARGETS_TANGENT\\nattribute tangent{X} : vec3;\\n#endif\\n#ifdef MORPHTARGETS_UV\\nattribute uv_{X} : vec2;\\n#endif\\n#endif\\n#endif\\n\";It.IncludesShadersStoreWGSL.morphTargetsVertexGlobal=\"#ifdef MORPHTARGETS\\n#ifdef MORPHTARGETS_TEXTURE\\nvar vertexID : f32;\\n#endif\\n#endif\\n\";It.IncludesShadersStoreWGSL.morphTargetsVertexGlobalDeclaration=\"#ifdef MORPHTARGETS\\nuniform morphTargetInfluences : array;\\n#ifdef MORPHTARGETS_TEXTURE \\nuniform morphTargetTextureIndices : array;\\nuniform morphTargetTextureInfo : vec3;\\nvar morphTargets : texture_2d_array;\\nvar morphTargetsSampler : sampler;\\nfn readVector3FromRawSampler(targetIndex : i32,vertexIndex : f32)->vec3\\n{ \\nlet y=floor(vertexIndex/uniforms.morphTargetTextureInfo.y);\\nlet x=vertexIndex-y*uniforms.morphTargetTextureInfo.y;\\nlet textureUV=vec2((x+0.5)/uniforms.morphTargetTextureInfo.y,(y+0.5)/uniforms.morphTargetTextureInfo.z);\\nreturn textureSampleLevel(morphTargets,morphTargetsSampler,textureUV,i32(uniforms.morphTargetTextureIndices[targetIndex]),0.0).xyz;\\n}\\n#endif\\n#endif\\n\";It.IncludesShadersStoreWGSL.sceneUboDeclaration=\"struct Scene {\\nviewProjection : mat4x4,\\n#ifdef MULTIVIEW\\nviewProjectionR : mat4x4,\\n#endif \\nview : mat4x4,\\nprojection : mat4x4,\\nvEyePosition : vec4,\\n};\\nvar scene : Scene;\\n\";var cd,ud=\"gl_VertexID\",hd=\"gl_InstanceID\",dd=\"gl_Position\",pd=\"gl_FragCoord\",fd=\"gl_FrontFacing\",_d=\"gl_FragDepth\",md=\"gl_FragColor\",gd={texture_1d:xh.E1d,texture_2d:xh.E2d,texture_2d_array:xh.E2dArray,texture_3d:xh.E3d,texture_cube:xh.Cube,texture_cube_array:xh.CubeArray,texture_multisampled_2d:xh.E2d,texture_depth_2d:xh.E2d,texture_depth_2d_array:xh.E2dArray,texture_depth_cube:xh.Cube,texture_depth_cube_array:xh.CubeArray,texture_depth_multisampled_2d:xh.E2d,texture_storage_1d:xh.E1d,texture_storage_2d:xh.E2d,texture_storage_2d_array:xh.E2dArray,texture_storage_3d:xh.E3d,texture_external:null},vd=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.shaderLanguage=et.WGSL,t.uniformRegexp=/uniform\\s+(\\w+)\\s*:\\s*(.+)\\s*;/,t.textureRegexp=/var\\s+(\\w+)\\s*:\\s*((array<\\s*)?(texture_\\w+)\\s*(<\\s*(.+)\\s*>)?\\s*(,\\s*\\w+\\s*>\\s*)?);/,t.noPrecision=!0,t}return V(t,e),t.prototype._getArraySize=function(e,t,i){var n=0,r=t.lastIndexOf(\">\");if(t.indexOf(\"array\")>=0&&r>0){for(var o=r;o>0&&\" \"!==t.charAt(o)&&\",\"!==t.charAt(o);)o--;var a=t.substring(o+1,r);for(n=+a,isNaN(n)&&(n=+i[a.trim()]);o>0&&(\" \"===t.charAt(o)||\",\"===t.charAt(o));)o--;t=t.substring(t.indexOf(\"<\")+1,o+1)}return[e,t,n]},t.prototype.initializeShaders=function(e){this._webgpuProcessingContext=e,this._attributesWGSL=[],this._attributesDeclWGSL=[],this._attributeNamesWGSL=[],this._varyingsWGSL=[],this._varyingsDeclWGSL=[],this._varyingNamesWGSL=[],this._stridedUniformArrays=[]},t.prototype.preProcessShaderCode=function(e){return\"struct \".concat(rd.InternalsUBOName,\" {\\nyFactor_: f32,\\ntextureOutputHeight_: f32,\\n};\\nvar \").concat(\"internals\",\" : \").concat(rd.InternalsUBOName,\";\\n\")+sh(e)},t.prototype.varyingProcessor=function(e,t,i){var n=/\\s*varying\\s+(?:(?:highp)?|(?:lowp)?)\\s*(\\S+)\\s*:\\s*(.+)\\s*;/gm.exec(e);if(null!==n){var r,o=n[2],a=n[1];t?void 0===(r=this._webgpuProcessingContext.availableVaryings[a])&&Q.Warn('Invalid fragment shader: The varying named \"'.concat(a,'\" is not declared in the vertex shader! This declaration will be ignored.')):(r=this._webgpuProcessingContext.getVaryingNextLocation(o,this._getArraySize(a,o,i)[2]),this._webgpuProcessingContext.availableVaryings[a]=r,this._varyingsWGSL.push(\"@location(\".concat(r,\") \").concat(a,\" : \").concat(o,\",\")),this._varyingsDeclWGSL.push(\"var \".concat(a,\" : \").concat(o,\";\")),this._varyingNamesWGSL.push(a)),e=\"\"}return e},t.prototype.attributeProcessor=function(e,t){var i=/\\s*attribute\\s+(\\S+)\\s*:\\s*(.+)\\s*;/gm.exec(e);if(null!==i){var n=i[2],r=i[1],o=this._webgpuProcessingContext.getAttributeNextLocation(n,this._getArraySize(r,n,t)[2]);this._webgpuProcessingContext.availableAttributes[r]=o,this._webgpuProcessingContext.orderedAttributes[o]=r,this._attributesWGSL.push(\"@location(\".concat(o,\") \").concat(r,\" : \").concat(n,\",\")),this._attributesDeclWGSL.push(\"var \".concat(r,\" : \").concat(n,\";\")),this._attributeNamesWGSL.push(r),e=\"\"}return e},t.prototype.uniformProcessor=function(e,t,i){var n=this.uniformRegexp.exec(e);if(null!==n){var r=n[2],o=n[1];this._addUniformToLeftOverUBO(o,r,i),e=\"\"}return e},t.prototype.textureProcessor=function(e,t,i){var n=this.textureRegexp.exec(e);if(null!==n){var r=n[1],o=n[2],a=!!n[3],s=n[4],l=s.indexOf(\"storage\")>0,c=n[6],u=l?c.substring(0,c.indexOf(\",\")).trim():null,h=a?this._getArraySize(r,o,i)[2]:0,d=this._webgpuProcessingContext.availableTextures[r];if(d)h=d.textures.length;else{d={isTextureArray:h>0,isStorageTexture:l,textures:[],sampleType:Fh.Float},h=h||1;for(var p=0;p0,_=gd[s],m=f?Fh.Depth:\"u32\"===c?Fh.Uint:\"i32\"===c?Fh.Sint:Fh.Float;if(d.sampleType=m,void 0===_)throw\"Can't get the texture dimension corresponding to the texture function \\\"\".concat(s,'\"!');for(p=0;p=0?\"\\n if (internals.yFactor_ == 1.) {\\n gl_FragCoord.y = internals.textureOutputHeight_ - gl_FragCoord.y;\\n }\\n \":\"\";e=this._processSamplers(e,!0),t=this._processSamplers(t,!1),e=this._processCustomBuffers(e,!0),t=this._processCustomBuffers(t,!1);var n=this._buildLeftOverUBO();t=n+t,e=(e=n+e).replace(/#define /g,\"//#define \"),e=this._processStridedUniformArrays(e);var r=this._varyingsDeclWGSL.join(\"\\n\")+\"\\n\",o=\"var \".concat(ud,\" : u32;\\nvar \").concat(hd,\" : u32;\\nvar \").concat(dd,\" : vec4;\\n\"),a=this._attributesDeclWGSL.join(\"\\n\")+\"\\n\",s=\"struct VertexInputs {\\n @builtin(vertex_index) vertexIndex : u32,\\n @builtin(instance_index) instanceIndex : u32,\\n\";this._attributesWGSL.length>0&&(s+=this._attributesWGSL.join(\"\\n\")),s+=\"\\n};\\n\";var l=\"struct FragmentInputs {\\n @builtin(position) position : vec4,\\n\";this._varyingsWGSL.length>0&&(l+=this._varyingsWGSL.join(\"\\n\")),e=o+s+a+(l+=\"\\n};\\n\")+r+e;for(var c=\" var output : FragmentInputs;\\n \".concat(ud,\" = input.vertexIndex;\\n \").concat(hd,\" = input.instanceIndex;\\n\"),u=0;u \".concat(pd,\" : vec4;\\nvar \").concat(fd,\" : bool;\\nvar \").concat(md,\" : vec4;\\nvar \").concat(_d,\" : f32;\\n\"),_=\"struct FragmentInputs {\\n @builtin(position) position : vec4,\\n @builtin(front_facing) frontFacing : bool,\\n\";this._varyingsWGSL.length>0&&(_+=this._varyingsWGSL.join(\"\\n\")),_+=\"\\n};\\n\";for(var m=\"struct FragmentOutputs {\\n @location(0) color : vec4,\\n\",g=!1,v=0;!(g||(v=t.indexOf(_d,v))<0);){var y=v;for(g=!0;v>1&&\"\\n\"!==t.charAt(v);){if(\"/\"===t.charAt(v)&&\"/\"===t.charAt(v-1)){g=!1;break}v--}v=y+_d.length}g&&(m+=\" @builtin(frag_depth) fragDepth: f32,\\n\"),t=f+_+r+(m+=\"};\\n\")+t;var b=\" var output : FragmentOutputs;\\n \".concat(pd,\" = input.position;\\n \").concat(fd,\" = input.frontFacing;\\n\")+i;for(u=0;u)?$/,\"$1\"),l=rd.UniformSizes[s];if(a.length>0)if(l<=2){var c=\"\".concat(e,\"_\").concat(this._stridedUniformArrays.length,\"_strided_arr\");i+=\"struct \".concat(c,\" {\\n @size(16)\\n el: \").concat(s,\",\\n }\"),this._stridedUniformArrays.push(a.name),n+=\" @align(16) \".concat(a.name,\" : array<\").concat(c,\", \").concat(a.length,\">,\\n\")}else n+=\" \".concat(a.name,\" : array<\").concat(a.type,\", \").concat(a.length,\">,\\n\");else n+=\" \".concat(a.name,\" : \").concat(a.type,\",\\n\")}return n+=\"};\\n\",(n=\"\".concat(i,\"\\n\").concat(n))+\"@group(\".concat(t.binding.groupIndex,\") @binding(\").concat(t.binding.bindingIndex,\") var \").concat(\"uniforms\",\" : \").concat(e,\";\\n\")},t.prototype._processSamplers=function(e,t){for(var i=/var\\s+(\\w+Sampler)\\s*:\\s*(sampler|sampler_comparison)\\s*;/gm;;){var n=i.exec(e);if(null===n)break;var r=n[1],o=n[2],a=r.indexOf(rd.AutoSamplerSuffix)===r.length-rd.AutoSamplerSuffix.length?r.substring(0,r.indexOf(rd.AutoSamplerSuffix)):null,s=\"sampler_comparison\"===o?Lh.Comparison:Lh.Filtering;if(a){var l=this._webgpuProcessingContext.availableTextures[a];l&&(l.autoBindSampler=!0)}var c=this._webgpuProcessingContext.availableSamplers[r];c||(c={binding:this._webgpuProcessingContext.getNextFreeUBOBinding(),type:s},this._webgpuProcessingContext.availableSamplers[r]=c),this._addSamplerBindingDescription(r,c,t);var u=e.substring(0,n.index),h=\"@group(\".concat(c.binding.groupIndex,\") @binding(\").concat(c.binding.bindingIndex,\") \"),d=e.substring(n.index);e=u+h+d,i.lastIndex+=h.length}return e},t.prototype._processCustomBuffers=function(e,t){for(var i=/var<\\s*(uniform|storage)\\s*(,\\s*(read|read_write)\\s*)?>\\s+(\\S+)\\s*:\\s*(\\S+)\\s*;/gm;;){var n=i.exec(e);if(null===n)break;var r=n[1],o=n[3],a=n[4],s=n[5],l=this._webgpuProcessingContext.availableBuffers[a];if(!l){var c=\"uniform\"===r?sd.KnownUBOs[s]:null,u=void 0;c?(a=s,-1===(u=c.binding).groupIndex&&(u=this._webgpuProcessingContext.getNextFreeUBOBinding())):u=this._webgpuProcessingContext.getNextFreeUBOBinding(),l={binding:u},this._webgpuProcessingContext.availableBuffers[a]=l}this._addBufferBindingDescription(a,this._webgpuProcessingContext.availableBuffers[a],\"read_write\"===o?Nh.Storage:\"storage\"===r?Nh.ReadOnlyStorage:Nh.Uniform,t);var h=l.binding.groupIndex,d=l.binding.bindingIndex,p=e.substring(0,n.index),f=\"@group(\".concat(h,\") @binding(\").concat(d,\") \"),_=e.substring(n.index);e=p+f+_,i.lastIndex+=f.length}return e},t.prototype._processStridedUniformArrays=function(e){for(var t=0,i=this._stridedUniformArrays;t= ofstX + width) {\\n discard;\\n }\\n if (gl_FragCoord.y < ofstY || gl_FragCoord.y >= ofstY + height) {\\n discard;\\n }\\n #ifdef INVERTY\\n vec4 color = texelFetch(img, ivec2(gl_FragCoord.x, ofstY + height - (gl_FragCoord.y - ofstY)), 0);\\n #else\\n vec4 color = texelFetch(img, ivec2(gl_FragCoord.xy), 0);\\n #endif\\n #ifdef PREMULTIPLYALPHA\\n color.rgb *= color.a;\\n #endif\\n outColor = color;\\n }\\n \"}],Ed={\"\":0,r8unorm:1,r8uint:2,r8sint:3,r16uint:4,r16sint:5,r16float:6,rg8unorm:7,rg8uint:8,rg8sint:9,r32uint:10,r32sint:11,r32float:12,rg16uint:13,rg16sint:14,rg16float:15,rgba8unorm:16,\"rgba8unorm-srgb\":17,rgba8uint:18,rgba8sint:19,bgra8unorm:20,\"bgra8unorm-srgb\":21,rgb10a2unorm:22,rg32uint:23,rg32sint:24,rg32float:25,rgba16uint:26,rgba16sint:27,rgba16float:28,rgba32uint:29,rgba32sint:30,rgba32float:31,stencil8:32,depth16unorm:33,depth24plus:34,\"depth24plus-stencil8\":35,depth32float:36,\"depth24unorm-stencil8\":37,\"depth32float-stencil8\":38},Sd=function(){function e(e,t,i,n){this._pipelines={},this._compiledShaders=[],this._deferredReleaseTextures=[],this._device=e,this._glslang=t,this._tintWASM=i,this._bufferManager=n,this._mipmapSampler=e.createSampler({minFilter:Ih.Linear}),this._ubCopyWithOfst=this._bufferManager.createBuffer(16,Eh.Uniform|Eh.CopyDst).underlyingResource,this._getPipeline(Ph.RGBA8Unorm)}return e.ComputeNumMipmapLevels=function(e,t){return h.ILog2(Math.max(e,t))+1},e.prototype._getPipeline=function(e,t,i){void 0===t&&(t=cd.MipMap);var n=t===cd.MipMap?1:t===cd.InvertYPremultiplyAlpha?((i.invertY?1:0)<<1)+((i.premultiplyAlpha?1:0)<<2):t===cd.Clear?8:t===cd.InvertYPremultiplyAlphaWithOfst?((i.invertY?1:0)<<4)+((i.premultiplyAlpha?1:0)<<5):0;this._pipelines[e]||(this._pipelines[e]=[]);var r=this._pipelines[e][n];if(!r){var o=\"#version 450\\r\\n\";t!==cd.InvertYPremultiplyAlpha&&t!==cd.InvertYPremultiplyAlphaWithOfst||(i.invertY&&(o+=\"#define INVERTY\\r\\n\"),i.premultiplyAlpha&&(o+=\"#define PREMULTIPLYALPHA\\r\\n\"));var a=this._compiledShaders[n];if(!a){var s=this._glslang.compileGLSL(o+Td[t].vertex,\"vertex\"),l=this._glslang.compileGLSL(o+Td[t].fragment,\"fragment\");this._tintWASM&&(s=this._tintWASM.convertSpirV2WGSL(s),l=this._tintWASM.convertSpirV2WGSL(l));var c=this._device.createShaderModule({code:s}),u=this._device.createShaderModule({code:l});a=this._compiledShaders[n]=[c,u]}var h=this._device.createRenderPipeline({layout:Uh.Auto,vertex:{module:a[0],entryPoint:\"main\"},fragment:{module:a[1],entryPoint:\"main\",targets:[{format:e}]},primitive:{topology:Vh.TriangleStrip,stripIndexFormat:jh.Uint16}});r=this._pipelines[e][n]=[h,h.getBindGroupLayout(0)]}return r},e._GetTextureTypeFromFormat=function(e){switch(e){case Ph.R8Unorm:case Ph.R8Snorm:case Ph.R8Uint:case Ph.R8Sint:case Ph.RG8Unorm:case Ph.RG8Snorm:case Ph.RG8Uint:case Ph.RG8Sint:case Ph.RGBA8Unorm:case Ph.RGBA8UnormSRGB:case Ph.RGBA8Snorm:case Ph.RGBA8Uint:case Ph.RGBA8Sint:case Ph.BGRA8Unorm:case Ph.BGRA8UnormSRGB:case Ph.RGB10A2Unorm:case Ph.RGB9E5UFloat:case Ph.RG11B10UFloat:case Ph.Depth24UnormStencil8:case Ph.Depth32FloatStencil8:case Ph.BC7RGBAUnorm:case Ph.BC7RGBAUnormSRGB:case Ph.BC6HRGBUFloat:case Ph.BC6HRGBFloat:case Ph.BC5RGUnorm:case Ph.BC5RGSnorm:case Ph.BC3RGBAUnorm:case Ph.BC3RGBAUnormSRGB:case Ph.BC2RGBAUnorm:case Ph.BC2RGBAUnormSRGB:case Ph.BC4RUnorm:case Ph.BC4RSnorm:case Ph.BC1RGBAUnorm:case Ph.BC1RGBAUnormSRGB:case Ph.ETC2RGB8Unorm:case Ph.ETC2RGB8UnormSRGB:case Ph.ETC2RGB8A1Unorm:case Ph.ETC2RGB8A1UnormSRGB:case Ph.ETC2RGBA8Unorm:case Ph.ETC2RGBA8UnormSRGB:case Ph.EACR11Unorm:case Ph.EACR11Snorm:case Ph.EACRG11Unorm:case Ph.EACRG11Snorm:case Ph.ASTC4x4Unorm:case Ph.ASTC4x4UnormSRGB:case Ph.ASTC5x4Unorm:case Ph.ASTC5x4UnormSRGB:case Ph.ASTC5x5Unorm:case Ph.ASTC5x5UnormSRGB:case Ph.ASTC6x5Unorm:case Ph.ASTC6x5UnormSRGB:case Ph.ASTC6x6Unorm:case Ph.ASTC6x6UnormSRGB:case Ph.ASTC8x5Unorm:case Ph.ASTC8x5UnormSRGB:case Ph.ASTC8x6Unorm:case Ph.ASTC8x6UnormSRGB:case Ph.ASTC8x8Unorm:case Ph.ASTC8x8UnormSRGB:case Ph.ASTC10x5Unorm:case Ph.ASTC10x5UnormSRGB:case Ph.ASTC10x6Unorm:case Ph.ASTC10x6UnormSRGB:case Ph.ASTC10x8Unorm:case Ph.ASTC10x8UnormSRGB:case Ph.ASTC10x10Unorm:case Ph.ASTC10x10UnormSRGB:case Ph.ASTC12x10Unorm:case Ph.ASTC12x10UnormSRGB:case Ph.ASTC12x12Unorm:case Ph.ASTC12x12UnormSRGB:return a.TEXTURETYPE_UNSIGNED_BYTE;case Ph.R16Uint:case Ph.R16Sint:case Ph.RG16Uint:case Ph.RG16Sint:case Ph.RGBA16Uint:case Ph.RGBA16Sint:case Ph.Depth16Unorm:return a.TEXTURETYPE_UNSIGNED_SHORT;case Ph.R16Float:case Ph.RG16Float:case Ph.RGBA16Float:return a.TEXTURETYPE_HALF_FLOAT;case Ph.R32Uint:case Ph.R32Sint:case Ph.RG32Uint:case Ph.RG32Sint:case Ph.RGBA32Uint:case Ph.RGBA32Sint:return a.TEXTURETYPE_UNSIGNED_INTEGER;case Ph.R32Float:case Ph.RG32Float:case Ph.RGBA32Float:case Ph.Depth32Float:return a.TEXTURETYPE_FLOAT;case Ph.Stencil8:throw\"No fixed size for Stencil8 format!\";case Ph.Depth24Plus:throw\"No fixed size for Depth24Plus format!\";case Ph.Depth24PlusStencil8:throw\"No fixed size for Depth24PlusStencil8 format!\"}return a.TEXTURETYPE_UNSIGNED_BYTE},e._GetBlockInformationFromFormat=function(e){switch(e){case Ph.R8Unorm:case Ph.R8Snorm:case Ph.R8Uint:case Ph.R8Sint:return{width:1,height:1,length:1};case Ph.R16Uint:case Ph.R16Sint:case Ph.R16Float:case Ph.RG8Unorm:case Ph.RG8Snorm:case Ph.RG8Uint:case Ph.RG8Sint:return{width:1,height:1,length:2};case Ph.R32Uint:case Ph.R32Sint:case Ph.R32Float:case Ph.RG16Uint:case Ph.RG16Sint:case Ph.RG16Float:case Ph.RGBA8Unorm:case Ph.RGBA8UnormSRGB:case Ph.RGBA8Snorm:case Ph.RGBA8Uint:case Ph.RGBA8Sint:case Ph.BGRA8Unorm:case Ph.BGRA8UnormSRGB:case Ph.RGB9E5UFloat:case Ph.RGB10A2Unorm:case Ph.RG11B10UFloat:return{width:1,height:1,length:4};case Ph.RG32Uint:case Ph.RG32Sint:case Ph.RG32Float:case Ph.RGBA16Uint:case Ph.RGBA16Sint:case Ph.RGBA16Float:return{width:1,height:1,length:8};case Ph.RGBA32Uint:case Ph.RGBA32Sint:case Ph.RGBA32Float:return{width:1,height:1,length:16};case Ph.Stencil8:throw\"No fixed size for Stencil8 format!\";case Ph.Depth16Unorm:return{width:1,height:1,length:2};case Ph.Depth24Plus:throw\"No fixed size for Depth24Plus format!\";case Ph.Depth24PlusStencil8:throw\"No fixed size for Depth24PlusStencil8 format!\";case Ph.Depth32Float:case Ph.Depth24UnormStencil8:return{width:1,height:1,length:4};case Ph.Depth32FloatStencil8:return{width:1,height:1,length:5};case Ph.BC7RGBAUnorm:case Ph.BC7RGBAUnormSRGB:case Ph.BC6HRGBUFloat:case Ph.BC6HRGBFloat:case Ph.BC5RGUnorm:case Ph.BC5RGSnorm:case Ph.BC3RGBAUnorm:case Ph.BC3RGBAUnormSRGB:case Ph.BC2RGBAUnorm:case Ph.BC2RGBAUnormSRGB:return{width:4,height:4,length:16};case Ph.BC4RUnorm:case Ph.BC4RSnorm:case Ph.BC1RGBAUnorm:case Ph.BC1RGBAUnormSRGB:case Ph.ETC2RGB8Unorm:case Ph.ETC2RGB8UnormSRGB:case Ph.ETC2RGB8A1Unorm:case Ph.ETC2RGB8A1UnormSRGB:case Ph.EACR11Unorm:case Ph.EACR11Snorm:return{width:4,height:4,length:8};case Ph.ETC2RGBA8Unorm:case Ph.ETC2RGBA8UnormSRGB:case Ph.EACRG11Unorm:case Ph.EACRG11Snorm:case Ph.ASTC4x4Unorm:case Ph.ASTC4x4UnormSRGB:return{width:4,height:4,length:16};case Ph.ASTC5x4Unorm:case Ph.ASTC5x4UnormSRGB:return{width:5,height:4,length:16};case Ph.ASTC5x5Unorm:case Ph.ASTC5x5UnormSRGB:return{width:5,height:5,length:16};case Ph.ASTC6x5Unorm:case Ph.ASTC6x5UnormSRGB:return{width:6,height:5,length:16};case Ph.ASTC6x6Unorm:case Ph.ASTC6x6UnormSRGB:return{width:6,height:6,length:16};case Ph.ASTC8x5Unorm:case Ph.ASTC8x5UnormSRGB:return{width:8,height:5,length:16};case Ph.ASTC8x6Unorm:case Ph.ASTC8x6UnormSRGB:return{width:8,height:6,length:16};case Ph.ASTC8x8Unorm:case Ph.ASTC8x8UnormSRGB:return{width:8,height:8,length:16};case Ph.ASTC10x5Unorm:case Ph.ASTC10x5UnormSRGB:return{width:10,height:5,length:16};case Ph.ASTC10x6Unorm:case Ph.ASTC10x6UnormSRGB:return{width:10,height:6,length:16};case Ph.ASTC10x8Unorm:case Ph.ASTC10x8UnormSRGB:return{width:10,height:8,length:16};case Ph.ASTC10x10Unorm:case Ph.ASTC10x10UnormSRGB:return{width:10,height:10,length:16};case Ph.ASTC12x10Unorm:case Ph.ASTC12x10UnormSRGB:return{width:12,height:10,length:16};case Ph.ASTC12x12Unorm:case Ph.ASTC12x12UnormSRGB:return{width:12,height:12,length:16}}return{width:1,height:1,length:4}},e._IsHardwareTexture=function(e){return!!e.release},e._IsInternalTexture=function(e){return!!e.dispose},e.IsImageBitmap=function(e){return void 0!==e.close},e.IsImageBitmapArray=function(e){return Array.isArray(e)&&void 0!==e[0].close},e.prototype.setCommandEncoder=function(e){this._commandEncoderForCreation=e},e.IsCompressedFormat=function(e){switch(e){case Ph.BC7RGBAUnormSRGB:case Ph.BC7RGBAUnorm:case Ph.BC6HRGBFloat:case Ph.BC6HRGBUFloat:case Ph.BC5RGSnorm:case Ph.BC5RGUnorm:case Ph.BC4RSnorm:case Ph.BC4RUnorm:case Ph.BC3RGBAUnormSRGB:case Ph.BC3RGBAUnorm:case Ph.BC2RGBAUnormSRGB:case Ph.BC2RGBAUnorm:case Ph.BC1RGBAUnormSRGB:case Ph.BC1RGBAUnorm:case Ph.ETC2RGB8Unorm:case Ph.ETC2RGB8UnormSRGB:case Ph.ETC2RGB8A1Unorm:case Ph.ETC2RGB8A1UnormSRGB:case Ph.ETC2RGBA8Unorm:case Ph.ETC2RGBA8UnormSRGB:case Ph.EACR11Unorm:case Ph.EACR11Snorm:case Ph.EACRG11Unorm:case Ph.EACRG11Snorm:case Ph.ASTC4x4Unorm:case Ph.ASTC4x4UnormSRGB:case Ph.ASTC5x4Unorm:case Ph.ASTC5x4UnormSRGB:case Ph.ASTC5x5Unorm:case Ph.ASTC5x5UnormSRGB:case Ph.ASTC6x5Unorm:case Ph.ASTC6x5UnormSRGB:case Ph.ASTC6x6Unorm:case Ph.ASTC6x6UnormSRGB:case Ph.ASTC8x5Unorm:case Ph.ASTC8x5UnormSRGB:case Ph.ASTC8x6Unorm:case Ph.ASTC8x6UnormSRGB:case Ph.ASTC8x8Unorm:case Ph.ASTC8x8UnormSRGB:case Ph.ASTC10x5Unorm:case Ph.ASTC10x5UnormSRGB:case Ph.ASTC10x6Unorm:case Ph.ASTC10x6UnormSRGB:case Ph.ASTC10x8Unorm:case Ph.ASTC10x8UnormSRGB:case Ph.ASTC10x10Unorm:case Ph.ASTC10x10UnormSRGB:case Ph.ASTC12x10Unorm:case Ph.ASTC12x10UnormSRGB:case Ph.ASTC12x12Unorm:case Ph.ASTC12x12UnormSRGB:return!0}return!1},e.GetWebGPUTextureFormat=function(e,t,i){switch(void 0===i&&(i=!1),t){case a.TEXTUREFORMAT_DEPTH16:return Ph.Depth16Unorm;case a.TEXTUREFORMAT_DEPTH24:return Ph.Depth24Plus;case a.TEXTUREFORMAT_DEPTH24_STENCIL8:return Ph.Depth24PlusStencil8;case a.TEXTUREFORMAT_DEPTH32_FLOAT:return Ph.Depth32Float;case a.TEXTUREFORMAT_DEPTH24UNORM_STENCIL8:return Ph.Depth24UnormStencil8;case a.TEXTUREFORMAT_DEPTH32FLOAT_STENCIL8:return Ph.Depth32FloatStencil8;case a.TEXTUREFORMAT_COMPRESSED_RGBA_BPTC_UNORM:return i?Ph.BC7RGBAUnormSRGB:Ph.BC7RGBAUnorm;case a.TEXTUREFORMAT_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT:return Ph.BC6HRGBUFloat;case a.TEXTUREFORMAT_COMPRESSED_RGB_BPTC_SIGNED_FLOAT:return Ph.BC6HRGBFloat;case a.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT5:return i?Ph.BC3RGBAUnormSRGB:Ph.BC3RGBAUnorm;case a.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT3:return i?Ph.BC2RGBAUnormSRGB:Ph.BC2RGBAUnorm;case a.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT1:case a.TEXTUREFORMAT_COMPRESSED_RGB_S3TC_DXT1:return i?Ph.BC1RGBAUnormSRGB:Ph.BC1RGBAUnorm;case a.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_4x4:return i?Ph.ASTC4x4UnormSRGB:Ph.ASTC4x4Unorm;case a.TEXTUREFORMAT_COMPRESSED_RGB_ETC1_WEBGL:case a.TEXTUREFORMAT_COMPRESSED_RGB8_ETC2:return i?Ph.ETC2RGB8UnormSRGB:Ph.ETC2RGB8Unorm;case a.TEXTUREFORMAT_COMPRESSED_RGBA8_ETC2_EAC:return i?Ph.ETC2RGBA8UnormSRGB:Ph.ETC2RGBA8Unorm}switch(e){case a.TEXTURETYPE_BYTE:switch(t){case a.TEXTUREFORMAT_RED:return Ph.R8Snorm;case a.TEXTUREFORMAT_RG:return Ph.RG8Snorm;case a.TEXTUREFORMAT_RGB:throw\"RGB format not supported in WebGPU\";case a.TEXTUREFORMAT_RED_INTEGER:return Ph.R8Sint;case a.TEXTUREFORMAT_RG_INTEGER:return Ph.RG8Sint;case a.TEXTUREFORMAT_RGB_INTEGER:throw\"RGB_INTEGER format not supported in WebGPU\";case a.TEXTUREFORMAT_RGBA_INTEGER:return Ph.RGBA8Sint;default:return Ph.RGBA8Snorm}case a.TEXTURETYPE_UNSIGNED_BYTE:switch(t){case a.TEXTUREFORMAT_RED:return Ph.R8Unorm;case a.TEXTUREFORMAT_RG:return Ph.RG8Unorm;case a.TEXTUREFORMAT_RGB:throw\"TEXTUREFORMAT_RGB format not supported in WebGPU\";case a.TEXTUREFORMAT_RGBA:return i?Ph.RGBA8UnormSRGB:Ph.RGBA8Unorm;case a.TEXTUREFORMAT_BGRA:return i?Ph.BGRA8UnormSRGB:Ph.BGRA8Unorm;case a.TEXTUREFORMAT_RED_INTEGER:return Ph.R8Uint;case a.TEXTUREFORMAT_RG_INTEGER:return Ph.RG8Uint;case a.TEXTUREFORMAT_RGB_INTEGER:throw\"RGB_INTEGER format not supported in WebGPU\";case a.TEXTUREFORMAT_RGBA_INTEGER:return Ph.RGBA8Uint;case a.TEXTUREFORMAT_ALPHA:throw\"TEXTUREFORMAT_ALPHA format not supported in WebGPU\";case a.TEXTUREFORMAT_LUMINANCE:throw\"TEXTUREFORMAT_LUMINANCE format not supported in WebGPU\";case a.TEXTUREFORMAT_LUMINANCE_ALPHA:throw\"TEXTUREFORMAT_LUMINANCE_ALPHA format not supported in WebGPU\";default:return Ph.RGBA8Unorm}case a.TEXTURETYPE_SHORT:switch(t){case a.TEXTUREFORMAT_RED_INTEGER:return Ph.R16Sint;case a.TEXTUREFORMAT_RG_INTEGER:return Ph.RG16Sint;case a.TEXTUREFORMAT_RGB_INTEGER:throw\"TEXTUREFORMAT_RGB_INTEGER format not supported in WebGPU\";case a.TEXTUREFORMAT_RGBA_INTEGER:default:return Ph.RGBA16Sint}case a.TEXTURETYPE_UNSIGNED_SHORT:switch(t){case a.TEXTUREFORMAT_RED_INTEGER:return Ph.R16Uint;case a.TEXTUREFORMAT_RG_INTEGER:return Ph.RG16Uint;case a.TEXTUREFORMAT_RGB_INTEGER:throw\"TEXTUREFORMAT_RGB_INTEGER format not supported in WebGPU\";case a.TEXTUREFORMAT_RGBA_INTEGER:default:return Ph.RGBA16Uint}case a.TEXTURETYPE_INT:switch(t){case a.TEXTUREFORMAT_RED_INTEGER:return Ph.R32Sint;case a.TEXTUREFORMAT_RG_INTEGER:return Ph.RG32Sint;case a.TEXTUREFORMAT_RGB_INTEGER:throw\"TEXTUREFORMAT_RGB_INTEGER format not supported in WebGPU\";case a.TEXTUREFORMAT_RGBA_INTEGER:default:return Ph.RGBA32Sint}case a.TEXTURETYPE_UNSIGNED_INTEGER:switch(t){case a.TEXTUREFORMAT_RED_INTEGER:return Ph.R32Uint;case a.TEXTUREFORMAT_RG_INTEGER:return Ph.RG32Uint;case a.TEXTUREFORMAT_RGB_INTEGER:throw\"TEXTUREFORMAT_RGB_INTEGER format not supported in WebGPU\";case a.TEXTUREFORMAT_RGBA_INTEGER:default:return Ph.RGBA32Uint}case a.TEXTURETYPE_FLOAT:switch(t){case a.TEXTUREFORMAT_RED:return Ph.R32Float;case a.TEXTUREFORMAT_RG:return Ph.RG32Float;case a.TEXTUREFORMAT_RGB:throw\"TEXTUREFORMAT_RGB format not supported in WebGPU\";case a.TEXTUREFORMAT_RGBA:default:return Ph.RGBA32Float}case a.TEXTURETYPE_HALF_FLOAT:switch(t){case a.TEXTUREFORMAT_RED:return Ph.R16Float;case a.TEXTUREFORMAT_RG:return Ph.RG16Float;case a.TEXTUREFORMAT_RGB:throw\"TEXTUREFORMAT_RGB format not supported in WebGPU\";case a.TEXTUREFORMAT_RGBA:default:return Ph.RGBA16Float}case a.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:throw\"TEXTURETYPE_UNSIGNED_SHORT_5_6_5 format not supported in WebGPU\";case a.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV:throw\"TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV format not supported in WebGPU\";case a.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV:throw\"TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV format not supported in WebGPU\";case a.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:throw\"TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4 format not supported in WebGPU\";case a.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:throw\"TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1 format not supported in WebGPU\";case a.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV:switch(t){case a.TEXTUREFORMAT_RGBA:return Ph.RGB10A2Unorm;case a.TEXTUREFORMAT_RGBA_INTEGER:throw\"TEXTUREFORMAT_RGBA_INTEGER format not supported in WebGPU when type is TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV\";default:return Ph.RGB10A2Unorm}}return i?Ph.RGBA8UnormSRGB:Ph.RGBA8Unorm},e.GetNumChannelsFromWebGPUTextureFormat=function(e){switch(e){case Ph.R8Unorm:case Ph.R8Snorm:case Ph.R8Uint:case Ph.R8Sint:case Ph.BC4RUnorm:case Ph.BC4RSnorm:case Ph.R16Uint:case Ph.R16Sint:case Ph.Depth16Unorm:case Ph.R16Float:case Ph.R32Uint:case Ph.R32Sint:case Ph.R32Float:case Ph.Depth32Float:case Ph.Stencil8:case Ph.Depth24Plus:case Ph.EACR11Unorm:case Ph.EACR11Snorm:return 1;case Ph.RG8Unorm:case Ph.RG8Snorm:case Ph.RG8Uint:case Ph.RG8Sint:case Ph.Depth24UnormStencil8:case Ph.Depth32FloatStencil8:case Ph.BC5RGUnorm:case Ph.BC5RGSnorm:case Ph.RG16Uint:case Ph.RG16Sint:case Ph.RG16Float:case Ph.RG32Uint:case Ph.RG32Sint:case Ph.RG32Float:case Ph.Depth24PlusStencil8:case Ph.EACRG11Unorm:case Ph.EACRG11Snorm:return 2;case Ph.RGB9E5UFloat:case Ph.RG11B10UFloat:case Ph.BC6HRGBUFloat:case Ph.BC6HRGBFloat:case Ph.ETC2RGB8Unorm:case Ph.ETC2RGB8UnormSRGB:return 3;case Ph.RGBA8Unorm:case Ph.RGBA8UnormSRGB:case Ph.RGBA8Snorm:case Ph.RGBA8Uint:case Ph.RGBA8Sint:case Ph.BGRA8Unorm:case Ph.BGRA8UnormSRGB:case Ph.RGB10A2Unorm:case Ph.BC7RGBAUnorm:case Ph.BC7RGBAUnormSRGB:case Ph.BC3RGBAUnorm:case Ph.BC3RGBAUnormSRGB:case Ph.BC2RGBAUnorm:case Ph.BC2RGBAUnormSRGB:case Ph.BC1RGBAUnorm:case Ph.BC1RGBAUnormSRGB:case Ph.RGBA16Uint:case Ph.RGBA16Sint:case Ph.RGBA16Float:case Ph.RGBA32Uint:case Ph.RGBA32Sint:case Ph.RGBA32Float:case Ph.ETC2RGB8A1Unorm:case Ph.ETC2RGB8A1UnormSRGB:case Ph.ETC2RGBA8Unorm:case Ph.ETC2RGBA8UnormSRGB:case Ph.ASTC4x4Unorm:case Ph.ASTC4x4UnormSRGB:case Ph.ASTC5x4Unorm:case Ph.ASTC5x4UnormSRGB:case Ph.ASTC5x5Unorm:case Ph.ASTC5x5UnormSRGB:case Ph.ASTC6x5Unorm:case Ph.ASTC6x5UnormSRGB:case Ph.ASTC6x6Unorm:case Ph.ASTC6x6UnormSRGB:case Ph.ASTC8x5Unorm:case Ph.ASTC8x5UnormSRGB:case Ph.ASTC8x6Unorm:case Ph.ASTC8x6UnormSRGB:case Ph.ASTC8x8Unorm:case Ph.ASTC8x8UnormSRGB:case Ph.ASTC10x5Unorm:case Ph.ASTC10x5UnormSRGB:case Ph.ASTC10x6Unorm:case Ph.ASTC10x6UnormSRGB:case Ph.ASTC10x8Unorm:case Ph.ASTC10x8UnormSRGB:case Ph.ASTC10x10Unorm:case Ph.ASTC10x10UnormSRGB:case Ph.ASTC12x10Unorm:case Ph.ASTC12x10UnormSRGB:case Ph.ASTC12x12Unorm:case Ph.ASTC12x12UnormSRGB:return 4}throw\"Unknown format \".concat(e,\"!\")},e.HasStencilAspect=function(e){switch(e){case Ph.Stencil8:case Ph.Depth24UnormStencil8:case Ph.Depth32FloatStencil8:case Ph.Depth24PlusStencil8:return!0}return!1},e.HasDepthAndStencilAspects=function(e){switch(e){case Ph.Depth24UnormStencil8:case Ph.Depth32FloatStencil8:case Ph.Depth24PlusStencil8:return!0}return!1},e.prototype.invertYPreMultiplyAlpha=function(t,i,n,r,o,a,s,l,c,u,h,d,p,f,_){var m,g,v,y,b,T;void 0===o&&(o=!1),void 0===a&&(a=!1),void 0===s&&(s=0),void 0===l&&(l=0),void 0===c&&(c=1),void 0===u&&(u=0),void 0===h&&(h=0),void 0===d&&(d=0),void 0===p&&(p=0);var E,S=0!==d,A=void 0===f,R=this._getPipeline(r,S?cd.InvertYPremultiplyAlphaWithOfst:cd.InvertYPremultiplyAlpha,{invertY:o,premultiplyAlpha:a}),x=R[0],C=R[1];if(s=Math.max(s,0),A&&(f=this._device.createCommandEncoder({})),null===(g=(m=f).pushDebugGroup)||void 0===g||g.call(m,\"internal process texture - invertY=\".concat(o,\" premultiplyAlpha=\").concat(a)),e._IsHardwareTexture(t)?(E=t.underlyingResource,o&&!a&&1===c&&0===s||(t=void 0)):(E=t,t=void 0),E){S&&this._bufferManager.setRawData(this._ubCopyWithOfst,0,new Float32Array([u,h,d,p]),0,16);var P=t,M=null!==(v=null==P?void 0:P._copyInvertYTempTexture)&&void 0!==v?v:this.createTexture({width:i,height:n,layers:1},!1,!1,!1,!1,!1,r,1,f,Rh.CopySrc|Rh.RenderAttachment|Rh.TextureBinding),I=null!==(y=null==P?void 0:P._copyInvertYRenderPassDescr)&&void 0!==y?y:{colorAttachments:[{view:M.createView({format:r,dimension:xh.E2d,baseMipLevel:0,mipLevelCount:1,arrayLayerCount:1,baseArrayLayer:0}),loadOp:Zh.Load,storeOp:Jh.Store}]},O=f.beginRenderPass(I),D=S?null==P?void 0:P._copyInvertYBindGroupWithOfst:null==P?void 0:P._copyInvertYBindGroup;if(!D){var N={layout:C,entries:[{binding:0,resource:E.createView({format:r,dimension:xh.E2d,baseMipLevel:l,mipLevelCount:1,arrayLayerCount:c,baseArrayLayer:s})}]};S&&N.entries.push({binding:1,resource:{buffer:this._ubCopyWithOfst}}),D=this._device.createBindGroup(N)}O.setPipeline(x),O.setBindGroup(0,D),O.draw(4,1,0,0),O.end(),f.copyTextureToTexture({texture:M},{texture:E,mipLevel:l,origin:{x:0,y:0,z:s}},{width:i,height:n,depthOrArrayLayers:1}),P?(P._copyInvertYTempTexture=M,P._copyInvertYRenderPassDescr=I,S?P._copyInvertYBindGroupWithOfst=D:P._copyInvertYBindGroup=D):this._deferredReleaseTextures.push([M,null]),null===(T=(b=f).popDebugGroup)||void 0===T||T.call(b),A&&(this._device.queue.submit([f.finish()]),f=null)}},e.prototype.copyWithInvertY=function(e,t,i,n){var r,o,a,s,l=void 0===n,c=this._getPipeline(t,cd.InvertYPremultiplyAlpha,{invertY:!0,premultiplyAlpha:!1}),u=c[0],h=c[1];l&&(n=this._device.createCommandEncoder({})),null===(o=(r=n).pushDebugGroup)||void 0===o||o.call(r,\"internal copy texture with invertY\");var d=n.beginRenderPass(i),p=this._device.createBindGroup({layout:h,entries:[{binding:0,resource:e}]});d.setPipeline(u),d.setBindGroup(0,p),d.draw(4,1,0,0),d.end(),null===(s=(a=n).popDebugGroup)||void 0===s||s.call(a),l&&(this._device.queue.submit([n.finish()]),n=null)},e.prototype.createTexture=function(t,i,n,r,o,a,s,l,c,u,h){void 0===i&&(i=!1),void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===o&&(o=!1),void 0===a&&(a=!1),void 0===s&&(s=Ph.RGBA8Unorm),void 0===l&&(l=1),void 0===u&&(u=-1),void 0===h&&(h=0),l>1&&(l=4);var d=t.layers||1,p={width:t.width,height:t.height,depthOrArrayLayers:d},f=e.IsCompressedFormat(s),_=i?e.ComputeNumMipmapLevels(t.width,t.height):1,m=u>=0?u:Rh.CopySrc|Rh.CopyDst|Rh.TextureBinding;h|=i&&!f?Rh.CopySrc|Rh.RenderAttachment:0,f||a||(h|=Rh.RenderAttachment|Rh.CopyDst);var g=this._device.createTexture({size:p,dimension:a?Ah.E3d:Ah.E2d,format:s,usage:m|h,sampleCount:l,mipLevelCount:_});return e.IsImageBitmap(t)&&(this.updateTexture(t,g,t.width,t.height,d,s,0,0,r,o,0,0),i&&n&&this.generateMipmaps(g,s,_,0,c)),g},e.prototype.createCubeTexture=function(t,i,n,r,o,a,s,l,c,u){void 0===i&&(i=!1),void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===o&&(o=!1),void 0===a&&(a=Ph.RGBA8Unorm),void 0===s&&(s=1),void 0===c&&(c=-1),void 0===u&&(u=0),s>1&&(s=4);var h=e.IsImageBitmapArray(t)?t[0].width:t.width,d=e.IsImageBitmapArray(t)?t[0].height:t.height,p=e.IsCompressedFormat(a),f=i?e.ComputeNumMipmapLevels(h,d):1,_=c>=0?c:Rh.CopySrc|Rh.CopyDst|Rh.TextureBinding;u|=i&&!p?Rh.CopySrc|Rh.RenderAttachment:0,p||(u|=Rh.RenderAttachment|Rh.CopyDst);var m=this._device.createTexture({size:{width:h,height:d,depthOrArrayLayers:6},dimension:Ah.E2d,format:a,usage:_|u,sampleCount:s,mipLevelCount:f});return e.IsImageBitmapArray(t)&&(this.updateCubeTextures(t,m,h,d,a,r,o,0,0),i&&n&&this.generateCubeMipmaps(m,a,f,l)),m},e.prototype.generateCubeMipmaps=function(e,t,i,n){var r,o,a,s,l=void 0===n;l&&(n=this._device.createCommandEncoder({})),null===(o=(r=n).pushDebugGroup)||void 0===o||o.call(r,\"create cube mipmaps - \".concat(i,\" levels\"));for(var c=0;c<6;++c)this.generateMipmaps(e,t,i,c,n);null===(s=(a=n).popDebugGroup)||void 0===s||s.call(a),l&&(this._device.queue.submit([n.finish()]),n=null)},e.prototype.generateMipmaps=function(t,i,n,r,o){var a,s,l,c,u,h,d,p;void 0===r&&(r=0);var f,_=void 0===o,m=this._getPipeline(i),g=m[0],v=m[1];if(r=Math.max(r,0),_&&(o=this._device.createCommandEncoder({})),null===(s=(a=o).pushDebugGroup)||void 0===s||s.call(a,\"create mipmaps for face #\".concat(r,\" - \").concat(n,\" levels\")),e._IsHardwareTexture(t)?(f=t.underlyingResource,t._mipmapGenRenderPassDescr=t._mipmapGenRenderPassDescr||[],t._mipmapGenBindGroup=t._mipmapGenBindGroup||[]):(f=t,t=void 0),f){for(var y=t,b=1;bu;)this._device.queue.writeBuffer(o,t+h,i.buffer,a+h,u),h+=u;this._device.queue.writeBuffer(o,t+h,i.buffer,a+h,r-h)},e.prototype._getHalfFloatAsFloatRGBAArrayBuffer=function(e,t,i){i||(i=new Float32Array(e));for(var n=new Uint16Array(t);e--;)i[e]=ku(n[e]);return i},e.prototype.readDataFromBuffer=function(e,t,i,n,r,o,s,l,c,u,h){var d=this;void 0===s&&(s=a.TEXTURETYPE_UNSIGNED_BYTE),void 0===l&&(l=0),void 0===c&&(c=null),void 0===u&&(u=!0),void 0===h&&(h=!1);var p=s===a.TEXTURETYPE_FLOAT?2:s===a.TEXTURETYPE_HALF_FLOAT?1:0;return new Promise((function(i,a){e.mapAsync(Sh.Read,l,t).then((function(){var a=e.getMappedRange(l,t),f=c;if(h)f=null===f?gr(s,t,!0,a):gr(s,f.buffer,void 0,a);else if(null===f)switch(p){case 0:(f=new Uint8Array(t)).set(new Uint8Array(a));break;case 1:f=d._getHalfFloatAsFloatRGBAArrayBuffer(t/2,a);break;case 2:(f=new Float32Array(t/4)).set(new Float32Array(a))}else switch(p){case 0:(f=new Uint8Array(f.buffer)).set(new Uint8Array(a));break;case 1:f=d._getHalfFloatAsFloatRGBAArrayBuffer(t/2,a,c);break;case 2:(f=new Float32Array(f.buffer)).set(new Float32Array(a))}if(r!==o){1!==p||h||(r*=2,o*=2);for(var _=new Uint8Array(f.buffer),m=r,g=0,v=1;v1?4:1;return Cd[e.samplingMode]+Pd[(e._comparisonFunction||514)-512+1]+Md[e.samplingMode]+((null!==(t=e._cachedWrapU)&&void 0!==t?t:1)<<8)+((null!==(i=e._cachedWrapV)&&void 0!==i?i:1)<<10)+((null!==(n=e._cachedWrapR)&&void 0!==n?n:1)<<12)+((e.useMipMaps?1:0)<<14)+(r<<15)},e._GetSamplerFilterDescriptor=function(e,t){var i,n,r,o,s,l=e.useMipMaps;switch(e.samplingMode){case a.TEXTURE_LINEAR_LINEAR_MIPNEAREST:i=Ih.Linear,n=Ih.Linear,r=Ih.Nearest,l||(o=s=0);break;case a.TEXTURE_LINEAR_LINEAR_MIPLINEAR:case a.TEXTURE_TRILINEAR_SAMPLINGMODE:i=Ih.Linear,n=Ih.Linear,l?r=Ih.Linear:(r=Ih.Nearest,o=s=0);break;case a.TEXTURE_NEAREST_NEAREST_MIPLINEAR:i=Ih.Nearest,n=Ih.Nearest,l?r=Ih.Linear:(r=Ih.Nearest,o=s=0);break;case a.TEXTURE_NEAREST_NEAREST_MIPNEAREST:i=Ih.Nearest,n=Ih.Nearest,r=Ih.Nearest,l||(o=s=0);break;case a.TEXTURE_NEAREST_LINEAR_MIPNEAREST:i=Ih.Nearest,n=Ih.Linear,r=Ih.Nearest,l||(o=s=0);break;case a.TEXTURE_NEAREST_LINEAR_MIPLINEAR:i=Ih.Nearest,n=Ih.Linear,l?r=Ih.Linear:(r=Ih.Nearest,o=s=0);break;case a.TEXTURE_NEAREST_LINEAR:i=Ih.Nearest,n=Ih.Linear,r=Ih.Nearest,o=s=0;break;case a.TEXTURE_NEAREST_NEAREST:case a.TEXTURE_NEAREST_SAMPLINGMODE:i=Ih.Nearest,n=Ih.Nearest,r=Ih.Nearest,o=s=0;break;case a.TEXTURE_LINEAR_NEAREST_MIPNEAREST:i=Ih.Linear,n=Ih.Nearest,r=Ih.Nearest,l||(o=s=0);break;case a.TEXTURE_LINEAR_NEAREST_MIPLINEAR:i=Ih.Linear,n=Ih.Nearest,l?r=Ih.Linear:(r=Ih.Nearest,o=s=0);break;case a.TEXTURE_LINEAR_LINEAR:case a.TEXTURE_BILINEAR_SAMPLINGMODE:i=Ih.Linear,n=Ih.Linear,r=Ih.Nearest,o=s=0;break;case a.TEXTURE_LINEAR_NEAREST:i=Ih.Linear,n=Ih.Nearest,r=Ih.Nearest,o=s=0;break;default:i=Ih.Nearest,n=Ih.Nearest,r=Ih.Nearest,o=s=0}return t>1&&(0!==o||0!==s)?{magFilter:Ih.Linear,minFilter:Ih.Linear,mipmapFilter:Ih.Linear,anisotropyEnabled:!0}:{magFilter:i,minFilter:n,mipmapFilter:r,lodMinClamp:o,lodMaxClamp:s}},e._GetWrappingMode=function(e){switch(e){case a.TEXTURE_WRAP_ADDRESSMODE:return Mh.Repeat;case a.TEXTURE_CLAMP_ADDRESSMODE:return Mh.ClampToEdge;case a.TEXTURE_MIRROR_ADDRESSMODE:return Mh.MirrorRepeat}return Mh.Repeat},e._GetSamplerWrappingDescriptor=function(e){return{addressModeU:this._GetWrappingMode(e._cachedWrapU),addressModeV:this._GetWrappingMode(e._cachedWrapV),addressModeW:this._GetWrappingMode(e._cachedWrapR)}},e._GetSamplerDescriptor=function(t){var i=t.useMipMaps&&t._cachedAnisotropicFilteringLevel&&t._cachedAnisotropicFilteringLevel>1?4:1,n=this._GetSamplerFilterDescriptor(t,i);return k(k(k({},n),this._GetSamplerWrappingDescriptor(t)),{compare:t._comparisonFunction?e.GetCompareFunction(t._comparisonFunction):void 0,maxAnisotropy:n.anisotropyEnabled?i:1})},e.GetCompareFunction=function(e){switch(e){case a.ALWAYS:return Oh.Always;case a.EQUAL:return Oh.Equal;case a.GREATER:return Oh.Greater;case a.GEQUAL:return Oh.GreaterEqual;case a.LESS:return Oh.Less;case a.LEQUAL:return Oh.LessEqual;case a.NEVER:return Oh.Never;case a.NOTEQUAL:return Oh.NotEqual;default:return Oh.Less}},e.prototype.getSampler=function(t,i,n){if(void 0===i&&(i=!1),void 0===n&&(n=0),this.disabled)return this._device.createSampler(e._GetSamplerDescriptor(t));i?n=0:0===n&&(n=e.GetSamplerHashCode(t));var r=i?void 0:this._samplers[n];return r||(r=this._device.createSampler(e._GetSamplerDescriptor(t)),i||(this._samplers[n]=r)),r},e}();!function(e){e[e.StencilReadMask=0]=\"StencilReadMask\",e[e.StencilWriteMask=1]=\"StencilWriteMask\",e[e.DepthBias=2]=\"DepthBias\",e[e.DepthBiasSlopeScale=3]=\"DepthBiasSlopeScale\",e[e.DepthStencilState=4]=\"DepthStencilState\",e[e.MRTAttachments1=5]=\"MRTAttachments1\",e[e.MRTAttachments2=6]=\"MRTAttachments2\",e[e.RasterizationState=7]=\"RasterizationState\",e[e.ColorStates=8]=\"ColorStates\",e[e.ShaderStage=9]=\"ShaderStage\",e[e.TextureStage=10]=\"TextureStage\",e[e.VertexState=11]=\"VertexState\",e[e.NumStates=12]=\"NumStates\"}(bd||(bd={}));var Od={0:1,1:2,768:3,769:4,770:5,771:6,772:7,773:8,774:9,775:10,776:11,32769:12,32770:13,32771:12,32772:13},Dd={0:0,7680:1,7681:2,7682:3,7683:4,5386:5,34055:6,34056:7},Nd=function(){function e(e,t,i){this.mrtTextureCount=0,this._device=e,this._useTextureStage=i,this._states=new Array(30),this._statesLength=0,this._stateDirtyLowestIndex=0,this._emptyVertexBuffer=t,this._mrtFormats=[],this._parameter={token:void 0,pipeline:null},this.disabled=!1,this.vertexBuffers=[],this._kMaxVertexBufferStride=e.limits.maxVertexBufferArrayStride||2048,this.reset()}return e.prototype.reset=function(){this._isDirty=!0,this.vertexBuffers.length=0,this.setAlphaToCoverage(!1),this.resetDepthCullingState(),this.setClampDepth(!1),this.setDepthBias(0),this._webgpuColorFormat=[Ph.BGRA8Unorm],this.setColorFormat(Ph.BGRA8Unorm),this.setMRT([]),this.setAlphaBlendEnabled(!1),this.setAlphaBlendFactors([null,null,null,null],[null,null]),this.setWriteMask(15),this.setDepthStencilFormat(Ph.Depth24PlusStencil8),this.setStencilEnabled(!1),this.resetStencilState(),this.setBuffers(null,null,null),this._setTextureState(0)},Object.defineProperty(e.prototype,\"colorFormats\",{get:function(){return this._mrtAttachments1>0?this._mrtFormats:this._webgpuColorFormat},enumerable:!1,configurable:!0}),e.prototype.getRenderPipeline=function(t,i,n,r){if(void 0===r&&(r=0),n>1&&(n=4),this.disabled){var o=e._GetTopology(t);return this._setVertexState(i),this._parameter.pipeline=this._createRenderPipeline(i,o,n),e.NumCacheMiss++,e._NumPipelineCreationCurrentFrame++,this._parameter.pipeline}if(this._setShaderStage(i.uniqueId),this._setRasterizationState(t,n),this._setColorStates(),this._setDepthStencilState(),this._setVertexState(i),this._setTextureState(r),this.lastStateDirtyLowestIndex=this._stateDirtyLowestIndex,!this._isDirty&&this._parameter.pipeline)return this._stateDirtyLowestIndex=this._statesLength,e.NumCacheHitWithoutHash++,this._parameter.pipeline;if(this._getRenderPipeline(this._parameter),this._isDirty=!1,this._stateDirtyLowestIndex=this._statesLength,this._parameter.pipeline)return e.NumCacheHitWithHash++,this._parameter.pipeline;var a=e._GetTopology(t);return this._parameter.pipeline=this._createRenderPipeline(i,a,n),this._setRenderPipeline(this._parameter),e.NumCacheMiss++,e._NumPipelineCreationCurrentFrame++,this._parameter.pipeline},e.prototype.endFrame=function(){e.NumPipelineCreationLastFrame=e._NumPipelineCreationCurrentFrame,e._NumPipelineCreationCurrentFrame=0},e.prototype.setAlphaToCoverage=function(e){this._alphaToCoverageEnabled=e},e.prototype.setFrontFace=function(e){this._frontFace=e},e.prototype.setCullEnabled=function(e){this._cullEnabled=e},e.prototype.setCullFace=function(e){this._cullFace=e},e.prototype.setClampDepth=function(e){this._clampDepth=e},e.prototype.resetDepthCullingState=function(){this.setDepthCullingState(!1,2,1,0,0,!0,!0,a.ALWAYS)},e.prototype.setDepthCullingState=function(e,t,i,n,r,o,s,l){this._depthWriteEnabled=s,this._depthTestEnabled=o,this._depthCompare=(null!=l?l:a.ALWAYS)-512,this._cullFace=i,this._cullEnabled=e,this._frontFace=t,this.setDepthBiasSlopeScale(n),this.setDepthBias(r)},e.prototype.setDepthBias=function(e){this._depthBias!==e&&(this._depthBias=e,this._states[bd.DepthBias]=e,this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,bd.DepthBias))},e.prototype.setDepthBiasSlopeScale=function(e){this._depthBiasSlopeScale!==e&&(this._depthBiasSlopeScale=e,this._states[bd.DepthBiasSlopeScale]=e,this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,bd.DepthBiasSlopeScale))},e.prototype.setColorFormat=function(e){this._webgpuColorFormat[0]=e,this._colorFormat=Ed[null!=e?e:\"\"]},e.prototype.setMRTAttachments=function(e){this.mrtAttachments=e;for(var t=0,i=0;i10)throw\"Can't handle more than 10 attachments for a MRT in cache render pipeline!\";this.mrtTextureArray=e,this.mrtTextureCount=t,this._mrtEnabledMask=65535;for(var r=[0,0],o=0,a=0,s=0,l=0;l=32&&(a=0,o++)}this._mrtFormats.length=s,this._mrtAttachments1===r[0]&&this._mrtAttachments2===r[1]||(this._mrtAttachments1=r[0],this._mrtAttachments2=r[1],this._states[bd.MRTAttachments1]=r[0],this._states[bd.MRTAttachments2]=r[1],this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,bd.MRTAttachments1))},e.prototype.setAlphaBlendEnabled=function(e){this._alphaBlendEnabled=e},e.prototype.setAlphaBlendFactors=function(e,t){this._alphaBlendFuncParams=e,this._alphaBlendEqParams=t},e.prototype.setWriteMask=function(e){this._writeMask=e},e.prototype.setDepthStencilFormat=function(e){this._webgpuDepthStencilFormat=e,this._depthStencilFormat=void 0===e?0:Ed[e]},e.prototype.setDepthTestEnabled=function(e){this._depthTestEnabled=e},e.prototype.setDepthWriteEnabled=function(e){this._depthWriteEnabled=e},e.prototype.setDepthCompare=function(e){this._depthCompare=(null!=e?e:a.ALWAYS)-512},e.prototype.setStencilEnabled=function(e){this._stencilEnabled=e},e.prototype.setStencilCompare=function(e){this._stencilFrontCompare=(null!=e?e:a.ALWAYS)-512},e.prototype.setStencilDepthFailOp=function(e){this._stencilFrontDepthFailOp=null===e?1:Dd[e]},e.prototype.setStencilPassOp=function(e){this._stencilFrontPassOp=null===e?2:Dd[e]},e.prototype.setStencilFailOp=function(e){this._stencilFrontFailOp=null===e?1:Dd[e]},e.prototype.setStencilReadMask=function(e){this._stencilReadMask!==e&&(this._stencilReadMask=e,this._states[bd.StencilReadMask]=e,this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,bd.StencilReadMask))},e.prototype.setStencilWriteMask=function(e){this._stencilWriteMask!==e&&(this._stencilWriteMask=e,this._states[bd.StencilWriteMask]=e,this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,bd.StencilWriteMask))},e.prototype.resetStencilState=function(){this.setStencilState(!1,a.ALWAYS,a.KEEP,a.REPLACE,a.KEEP,255,255)},e.prototype.setStencilState=function(e,t,i,n,r,o,s){this._stencilEnabled=e,this._stencilFrontCompare=(null!=t?t:a.ALWAYS)-512,this._stencilFrontDepthFailOp=null===i?1:Dd[i],this._stencilFrontPassOp=null===n?2:Dd[n],this._stencilFrontFailOp=null===r?1:Dd[r],this.setStencilReadMask(o),this.setStencilWriteMask(s)},e.prototype.setBuffers=function(e,t,i){this._vertexBuffers=e,this._overrideVertexBuffers=i,this._indexBuffer=t},e._GetTopology=function(e){switch(e){case a.MATERIAL_TriangleFillMode:return Vh.TriangleList;case a.MATERIAL_PointFillMode:return Vh.PointList;case a.MATERIAL_WireFrameFillMode:return Vh.LineList;case a.MATERIAL_PointListDrawMode:return Vh.PointList;case a.MATERIAL_LineListDrawMode:return Vh.LineList;case a.MATERIAL_LineLoopDrawMode:throw\"LineLoop is an unsupported fillmode in WebGPU\";case a.MATERIAL_LineStripDrawMode:return Vh.LineStrip;case a.MATERIAL_TriangleStripDrawMode:return Vh.TriangleStrip;case a.MATERIAL_TriangleFanDrawMode:throw\"TriangleFan is an unsupported fillmode in WebGPU\";default:return Vh.TriangleList}},e._GetAphaBlendOperation=function(e){switch(e){case a.GL_ALPHA_EQUATION_ADD:return Hh.Add;case a.GL_ALPHA_EQUATION_SUBTRACT:return Hh.Subtract;case a.GL_ALPHA_EQUATION_REVERSE_SUBTRACT:return Hh.ReverseSubtract;case a.GL_ALPHA_EQUATION_MIN:return Hh.Min;case a.GL_ALPHA_EQUATION_MAX:return Hh.Max;default:return Hh.Add}},e._GetAphaBlendFactor=function(e){switch(e){case 0:return Wh.Zero;case 1:return Wh.One;case a.GL_ALPHA_FUNCTION_SRC:return Wh.Src;case a.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_COLOR:return Wh.OneMinusSrc;case a.GL_ALPHA_FUNCTION_SRC_ALPHA:return Wh.SrcAlpha;case a.GL_ALPHA_FUNCTION_ONE_MINUS_SRC_ALPHA:return Wh.OneMinusSrcAlpha;case a.GL_ALPHA_FUNCTION_DST_ALPHA:return Wh.DstAlpha;case a.GL_ALPHA_FUNCTION_ONE_MINUS_DST_ALPHA:return Wh.OneMinusDstAlpha;case a.GL_ALPHA_FUNCTION_DST_COLOR:return Wh.Dst;case a.GL_ALPHA_FUNCTION_ONE_MINUS_DST_COLOR:return Wh.OneMinusDst;case a.GL_ALPHA_FUNCTION_SRC_ALPHA_SATURATED:return Wh.SrcAlphaSaturated;case a.GL_ALPHA_FUNCTION_CONSTANT_COLOR:return Wh.Constant;case a.GL_ALPHA_FUNCTION_ONE_MINUS_CONSTANT_COLOR:return Wh.OneMinusConstant;case a.GL_ALPHA_FUNCTION_CONSTANT_ALPHA:return Wh.Constant;case a.GL_ALPHA_FUNCTION_ONE_MINUS_CONSTANT_ALPHA:return Wh.OneMinusConstant;default:return Wh.One}},e._GetCompareFunction=function(e){switch(e){case 0:return Oh.Never;case 1:return Oh.Less;case 2:return Oh.Equal;case 3:return Oh.LessEqual;case 4:return Oh.Greater;case 5:return Oh.NotEqual;case 6:return Oh.GreaterEqual;case 7:return Oh.Always}return Oh.Never},e._GetStencilOpFunction=function(e){switch(e){case 0:return Xh.Zero;case 1:return Xh.Keep;case 2:return Xh.Replace;case 3:return Xh.IncrementClamp;case 4:return Xh.DecrementClamp;case 5:return Xh.Invert;case 6:return Xh.IncrementWrap;case 7:return Xh.DecrementWrap}return Xh.Keep},e._GetVertexInputDescriptorFormat=function(e){var t=e.type,i=e.normalized,n=e.getSize();switch(t){case wi.BYTE:switch(n){case 1:case 2:return i?Yh.Snorm8x2:Yh.Sint8x2;case 3:case 4:return i?Yh.Snorm8x4:Yh.Sint8x4}break;case wi.UNSIGNED_BYTE:switch(n){case 1:case 2:return i?Yh.Unorm8x2:Yh.Uint8x2;case 3:case 4:return i?Yh.Unorm8x4:Yh.Uint8x4}break;case wi.SHORT:switch(n){case 1:case 2:return i?Yh.Snorm16x2:Yh.Sint16x2;case 3:case 4:return i?Yh.Snorm16x4:Yh.Sint16x4}break;case wi.UNSIGNED_SHORT:switch(n){case 1:case 2:return i?Yh.Unorm16x2:Yh.Uint16x2;case 3:case 4:return i?Yh.Unorm16x4:Yh.Uint16x4}break;case wi.INT:switch(n){case 1:return Yh.Sint32;case 2:return Yh.Sint32x2;case 3:return Yh.Sint32x3;case 4:return Yh.Sint32x4}break;case wi.UNSIGNED_INT:switch(n){case 1:return Yh.Uint32;case 2:return Yh.Uint32x2;case 3:return Yh.Uint32x3;case 4:return Yh.Uint32x4}break;case wi.FLOAT:switch(n){case 1:return Yh.Float32;case 2:return Yh.Float32x2;case 3:return Yh.Float32x3;case 4:return Yh.Float32x4}}throw new Error(\"Invalid Format '\".concat(e.getKind(),\"' - type=\").concat(t,\", normalized=\").concat(i,\", size=\").concat(n))},e.prototype._getAphaBlendState=function(){return this._alphaBlendEnabled?{srcFactor:e._GetAphaBlendFactor(this._alphaBlendFuncParams[2]),dstFactor:e._GetAphaBlendFactor(this._alphaBlendFuncParams[3]),operation:e._GetAphaBlendOperation(this._alphaBlendEqParams[1])}:null},e.prototype._getColorBlendState=function(){return this._alphaBlendEnabled?{srcFactor:e._GetAphaBlendFactor(this._alphaBlendFuncParams[0]),dstFactor:e._GetAphaBlendFactor(this._alphaBlendFuncParams[1]),operation:e._GetAphaBlendOperation(this._alphaBlendEqParams[0])}:null},e.prototype._setShaderStage=function(e){this._shaderId!==e&&(this._shaderId=e,this._states[bd.ShaderStage]=e,this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,bd.ShaderStage))},e.prototype._setRasterizationState=function(e,t){var i=this._frontFace-1+((this._cullEnabled?this._cullFace:0)<<1)+((this._clampDepth?1:0)<<3)+((this._alphaToCoverageEnabled?1:0)<<4)+(e<<5)+(t<<8);this._rasterizationState!==i&&(this._rasterizationState=i,this._states[bd.RasterizationState]=this._rasterizationState,this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,bd.RasterizationState))},e.prototype._setColorStates=function(){var e=((this._writeMask?1:0)<<22)+(this._colorFormat<<23)+((this._depthWriteEnabled?1:0)<<29);this._alphaBlendEnabled&&(e+=((null===this._alphaBlendFuncParams[0]?2:Od[this._alphaBlendFuncParams[0]])<<0)+((null===this._alphaBlendFuncParams[1]?2:Od[this._alphaBlendFuncParams[1]])<<4)+((null===this._alphaBlendFuncParams[2]?2:Od[this._alphaBlendFuncParams[2]])<<8)+((null===this._alphaBlendFuncParams[3]?2:Od[this._alphaBlendFuncParams[3]])<<12)+((null===this._alphaBlendEqParams[0]?1:this._alphaBlendEqParams[0]-32773)<<16)+((null===this._alphaBlendEqParams[1]?1:this._alphaBlendEqParams[1]-32773)<<19)),e!==this._colorStates&&(this._colorStates=e,this._states[bd.ColorStates]=this._colorStates,this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,bd.ColorStates))},e.prototype._setDepthStencilState=function(){var e=this._stencilEnabled?this._stencilFrontCompare+(this._stencilFrontDepthFailOp<<3)+(this._stencilFrontPassOp<<6)+(this._stencilFrontFailOp<<9):591,t=this._depthStencilFormat+((this._depthTestEnabled?this._depthCompare:7)<<6)+(e<<10);this._depthStencilState!==t&&(this._depthStencilState=t,this._states[bd.DepthStencilState]=this._depthStencilState,this._isDirty=!0,this._stateDirtyLowestIndex=Math.min(this._stateDirtyLowestIndex,bd.DepthStencilState))},e.prototype._setVertexState=function(e){for(var t,i,n,r=this._statesLength,o=bd.VertexState,a=e._pipelineContext,s=a.shaderProcessingContext.attributeNamesFromEffect,l=a.shaderProcessingContext.attributeLocationsFromEffect,c=0,u=0;u0)for(var u=0;u=this._video.HAVE_CURRENT_DATA},e.prototype.dispose=function(){},e}(),Vd=function(){function e(){this.uniqueId=e._Counter++,this.updateId=0,this.reset()}return Object.defineProperty(e.prototype,\"forceBindGroupCreation\",{get:function(){return this._numExternalTextures>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"hasFloatTextures\",{get:function(){return this._numFloatTextures>0},enumerable:!1,configurable:!0}),e.prototype.reset=function(){this.samplers={},this.textures={},this.isDirty=!0,this._numFloatTextures=0,this._numExternalTextures=0},e.prototype.setSampler=function(e,t){var i=this.samplers[e],n=-1;i?n=i.hashCode:this.samplers[e]=i={sampler:t,hashCode:0},i.sampler=t,i.hashCode=t?Id.GetSamplerHashCode(t):0;var r=n!==i.hashCode;r&&this.updateId++,this.isDirty||(this.isDirty=r)},e.prototype.setTexture=function(e,t){var i,n,r,o=this.textures[e],s=-1;o?s=null!==(n=null===(i=o.texture)||void 0===i?void 0:i.uniqueId)&&void 0!==n?n:-1:this.textures[e]=o={texture:t,isFloatTexture:!1,isExternalTexture:!1},o.isExternalTexture&&this._numExternalTextures--,o.isFloatTexture&&this._numFloatTextures--,t?(o.isFloatTexture=t.type===a.TEXTURETYPE_FLOAT,o.isExternalTexture=Ud.IsExternalTexture(t),o.isFloatTexture&&this._numFloatTextures++,o.isExternalTexture&&this._numExternalTextures++):(o.isFloatTexture=!1,o.isExternalTexture=!1),o.texture=t;var l=s!==(null!==(r=null==t?void 0:t.uniqueId)&&void 0!==r?r:-1);l&&this.updateId++,this.isDirty||(this.isDirty=l)},e._Counter=0,e}(),kd=function(){function e(t){this._bufferManager=t,this.uniqueId=e._Counter++,this._useInstancing=!1,this._currentInstanceCount=0,this.reset()}return e.prototype.isDirty=function(e){return this._isDirty||this._materialContextUpdateId!==e},e.prototype.resetIsDirty=function(e){this._isDirty=!1,this._materialContextUpdateId=e},Object.defineProperty(e.prototype,\"useInstancing\",{get:function(){return this._useInstancing},set:function(e){this._useInstancing!==e&&(e?(this.indirectDrawBuffer=this._bufferManager.createRawBuffer(40,Eh.CopyDst|Eh.Indirect),this._indirectDrawData=new Uint32Array(5),this._indirectDrawData[3]=0,this._indirectDrawData[4]=0):(this.indirectDrawBuffer&&this._bufferManager.releaseBuffer(this.indirectDrawBuffer),this.indirectDrawBuffer=void 0,this._indirectDrawData=void 0),this._useInstancing=e,this._currentInstanceCount=-1)},enumerable:!1,configurable:!0}),e.prototype.reset=function(){this.buffers={},this._isDirty=!0,this._materialContextUpdateId=0,this.fastBundle=void 0,this.bindGroups=void 0},e.prototype.setBuffer=function(e,t){var i;this._isDirty||(this._isDirty=(null==t?void 0:t.uniqueId)!==(null===(i=this.buffers[e])||void 0===i?void 0:i.uniqueId)),this.buffers[e]=t},e.prototype.setIndirectData=function(e,t,i){t!==this._currentInstanceCount&&this.indirectDrawBuffer&&this._indirectDrawData&&(this._currentInstanceCount=t,this._indirectDrawData[0]=e,this._indirectDrawData[1]=t,this._indirectDrawData[2]=i,this._bufferManager.setRawData(this.indirectDrawBuffer,0,this._indirectDrawData,0,20))},e.prototype.dispose=function(){this.indirectDrawBuffer&&(this._bufferManager.releaseBuffer(this.indirectDrawBuffer),this.indirectDrawBuffer=void 0,this._indirectDrawData=void 0),this.fastBundle=void 0,this.bindGroups=void 0,this.buffers=void 0},e._Counter=0,e}(),Gd=function(){this.values={}},zd=function(){function e(e,t,i){this.disabled=!1,this._device=e,this._cacheSampler=t,this._engine=i}return Object.defineProperty(e,\"Statistics\",{get:function(){return{totalCreated:e.NumBindGroupsCreatedTotal,lastFrameCreated:e.NumBindGroupsCreatedLastFrame,lookupLastFrame:e.NumBindGroupsLookupLastFrame,noLookupLastFrame:e.NumBindGroupsNoLookupLastFrame}},enumerable:!1,configurable:!0}),e.prototype.endFrame=function(){e.NumBindGroupsCreatedLastFrame=e._NumBindGroupsCreatedCurrentFrame,e.NumBindGroupsLookupLastFrame=e._NumBindGroupsLookupCurrentFrame,e.NumBindGroupsNoLookupLastFrame=e._NumBindGroupsNoLookupCurrentFrame,e._NumBindGroupsCreatedCurrentFrame=0,e._NumBindGroupsLookupCurrentFrame=0,e._NumBindGroupsNoLookupCurrentFrame=0},e.prototype.getBindGroups=function(t,i,n){var r,o,a,s,l,c,u,h,d,p,f=void 0,_=e._Cache,m=this.disabled||n.forceBindGroupCreation;if(!m){if(!i.isDirty(n.updateId)&&!n.isDirty)return e._NumBindGroupsNoLookupCurrentFrame++,i.bindGroups;for(var g=0,v=t.shaderProcessingContext.bufferNames;g\":t})),\", materialContext.uniqueId=\").concat(n.uniqueId),50);continue}N[L].resource=this._cacheSampler.getSampler(U,!1,k.hashCode)}else Q.Error('Sampler \"'.concat(B,'\" could not be bound. entry=').concat(JSON.stringify(F),\", materialContext=\").concat(JSON.stringify(n,(function(e,t){return\"texture\"===e||\"sampler\"===e?\"\":t}))),50);else if(F.texture||F.storageTexture)if(k=n.textures[B]){if(this._engine.dbgSanityChecks&&null===k.texture){Q.Error(\"Trying to bind a null texture! entry=\".concat(JSON.stringify(F),\", bindingInfo=\").concat(JSON.stringify(k,(function(e,t){return\"texture\"===e?\"\":t})),\", materialContext.uniqueId=\").concat(n.uniqueId),50);continue}var V=k.texture._hardwareTexture;if(this._engine.dbgSanityChecks&&(!V||F.texture&&!V.view||F.storageTexture&&!V.viewForWriting)){Q.Error(\"Trying to bind a null gpu texture or view! entry=\".concat(JSON.stringify(F),\", name=\").concat(B,\", bindingInfo=\").concat(JSON.stringify(k,(function(e,t){return\"texture\"===e?\"\":t})),\", isReady=\").concat(null===(d=k.texture)||void 0===d?void 0:d.isReady,\", materialContext.uniqueId=\").concat(n.uniqueId),50);continue}N[L].resource=F.storageTexture?V.viewForWriting:V.view}else Q.Error('Texture \"'.concat(B,'\" could not be bound. entry=').concat(JSON.stringify(F),\", materialContext=\").concat(JSON.stringify(n,(function(e,t){return\"texture\"===e||\"sampler\"===e?\"\":t}))),50);else if(F.externalTexture){var k;if(k=n.textures[B]){if(this._engine.dbgSanityChecks&&null===k.texture){Q.Error(\"Trying to bind a null external texture! entry=\".concat(JSON.stringify(F),\", name=\").concat(B,\", bindingInfo=\").concat(JSON.stringify(k,(function(e,t){return\"texture\"===e?\"\":t})),\", materialContext.uniqueId=\").concat(n.uniqueId),50);continue}var G=k.texture.underlyingResource;if(this._engine.dbgSanityChecks&&!G){Q.Error(\"Trying to bind a null gpu external texture! entry=\".concat(JSON.stringify(F),\", name=\").concat(B,\", bindingInfo=\").concat(JSON.stringify(k,(function(e,t){return\"texture\"===e?\"\":t})),\", isReady=\").concat(null===(p=k.texture)||void 0===p?void 0:p.isReady,\", materialContext.uniqueId=\").concat(n.uniqueId),50);continue}N[L].resource=this._device.importExternalTexture({source:G})}else Q.Error('Texture \"'.concat(B,'\" could not be bound. entry=').concat(JSON.stringify(F),\", materialContext=\").concat(JSON.stringify(n,(function(e,t){return\"texture\"===e||\"sampler\"===e?\"\":t}))),50)}else if(F.buffer){var z=i.buffers[B];if(z){var W=z.underlyingResource;N[L].resource.buffer=W,N[L].resource.size=z.capacity}else Q.Error(\"Can't find buffer \\\"\".concat(B,'\". entry=').concat(JSON.stringify(F),\", buffers=\").concat(JSON.stringify(i.buffers),\", drawContext.uniqueId=\").concat(i.uniqueId),50)}}var H=I[O];f[O]=this._device.createBindGroup({layout:H,entries:N})}return f},e.NumBindGroupsCreatedTotal=0,e.NumBindGroupsCreatedLastFrame=0,e.NumBindGroupsLookupLastFrame=0,e.NumBindGroupsNoLookupLastFrame=0,e._Cache=new Gd,e._NumBindGroupsCreatedCurrentFrame=0,e._NumBindGroupsLookupCurrentFrame=0,e._NumBindGroupsNoLookupCurrentFrame=0,e}();It.ShadersStore.clearQuadVertexShader=\"uniform float depthValue;\\nconst vec2 pos[4]={\\nvec2(-1.0,1.0),\\nvec2(1.0,1.0),\\nvec2(-1.0,-1.0),\\nvec2(1.0,-1.0)\\n};\\n#define CUSTOM_VERTEX_DEFINITIONS\\nvoid main(void) {\\n#define CUSTOM_VERTEX_MAIN_BEGIN\\ngl_Position=vec4(pos[gl_VertexID],depthValue,1.0);\\n#define CUSTOM_VERTEX_MAIN_END\\n}\\n\";It.ShadersStore.clearQuadPixelShader=\"uniform vec4 color;\\nvoid main() {\\ngl_FragColor=color;\\n}\\n\";var Wd=function(){function e(e,t,i){this._bindGroups={},this._bundleCache={},this._keyTemp=[],this._device=e,this._engine=t,this._cacheRenderPipeline=new Fd(this._device,i,!t._caps.textureFloatLinearFiltering),this._cacheRenderPipeline.setDepthTestEnabled(!1),this._cacheRenderPipeline.setStencilReadMask(255),this._effect=t.createEffect(\"clearQuad\",[],[\"color\",\"depthValue\"])}return e.prototype.setDepthStencilFormat=function(e){this._depthTextureFormat=e,this._cacheRenderPipeline.setDepthStencilFormat(e)},e.prototype.setColorFormat=function(e){this._cacheRenderPipeline.setColorFormat(e)},e.prototype.setMRTAttachments=function(e,t,i){this._cacheRenderPipeline.setMRT(t,i),this._cacheRenderPipeline.setMRTAttachments(e)},e.prototype.clear=function(e,t,i,n,r){var o,s,l;void 0===r&&(r=1);var c,u=null,h=!!this._engine._currentRenderTarget;if(e)l=e;else{var d=0;this._keyTemp.length=0;for(var p=0;p1?Math.pow(2,36):0)+f*Math.pow(2,37),c=this._keyTemp.join(\"_\"),u=this._bundleCache[c])return u;l=this._device.createRenderBundleEncoder({colorFormats:this._cacheRenderPipeline.colorFormats,depthStencilFormat:this._depthTextureFormat,sampleCount:r})}this._cacheRenderPipeline.setDepthWriteEnabled(!!i),this._cacheRenderPipeline.setStencilEnabled(!!n&&!!this._depthTextureFormat&&Sd.HasStencilAspect(this._depthTextureFormat)),this._cacheRenderPipeline.setStencilWriteMask(n?255:0),this._cacheRenderPipeline.setStencilCompare(n?a.ALWAYS:a.NEVER),this._cacheRenderPipeline.setStencilPassOp(n?a.REPLACE:a.KEEP),this._cacheRenderPipeline.setWriteMask(t?15:0);var _=this._cacheRenderPipeline.getRenderPipeline(a.MATERIAL_TriangleStripDrawMode,this._effect,r),m=this._effect._pipelineContext;t&&this._effect.setDirectColor4(\"color\",t),this._effect.setFloat(\"depthValue\",this._engine.useReverseDepthBuffer?this._engine._clearReverseDepthValue:this._engine._clearDepthValue),m.uniformBuffer.update();var g=h?this._engine._ubInvertY:this._engine._ubDontInvertY,v=m.uniformBuffer.getBuffer(),y=v.uniqueId+\"-\"+g.uniqueId,b=this._bindGroups[y];if(!b){var T=m.bindGroupLayouts;(b=this._bindGroups[y]=[]).push(this._device.createBindGroup({layout:T[0],entries:[]})),sd._SimplifiedKnownBindings||b.push(this._device.createBindGroup({layout:T[1],entries:[]})),b.push(this._device.createBindGroup({layout:T[sd._SimplifiedKnownBindings?1:2],entries:[{binding:0,resource:{buffer:g.underlyingResource,size:g.capacity}},{binding:1,resource:{buffer:v.underlyingResource,size:v.capacity}}]}))}for(l.setPipeline(_),p=0;p=0&&(t._gpuFrameTimeCounter.fetchNewFrame(),t._gpuFrameTimeCounter.addCount(e,!0)),t._measureDurationState=0})))},e}(),ep=function(){function e(e,t){this._querySet=new Jd(2,$h.Timestamp,e,t)}return e.prototype.start=function(e){e.writeTimestamp(this._querySet.querySet,0)},e.prototype.stop=function(e){return z(this,void 0,void 0,(function(){return W(this,(function(t){return e.writeTimestamp(this._querySet.querySet,1),[2,this._querySet.readTwoValuesAndSubtract(0)]}))}))},e.prototype.dispose=function(){this._querySet.dispose()},e}(),tp=function(){function e(e,t,i,n,r){void 0===n&&(n=50),void 0===r&&(r=100),this._availableIndices=[],this._engine=e,this._device=t,this._bufferManager=i,this._frameLastBuffer=-1,this._currentTotalIndices=0,this._countIncrement=r,this._allocateNewIndices(n)}return Object.defineProperty(e.prototype,\"querySet\",{get:function(){return this._querySet.querySet},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"hasQueries\",{get:function(){return this._currentTotalIndices!==this._availableIndices.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"canBeginQuery\",{get:function(){switch(this._engine._getCurrentRenderPassIndex()){case 0:return void 0!==this._engine._mainRenderPassWrapper.renderPassDescriptor.occlusionQuerySet;case 1:return void 0!==this._engine._rttRenderPassWrapper.renderPassDescriptor.occlusionQuerySet}return!1},enumerable:!1,configurable:!0}),e.prototype.createQuery=function(){0===this._availableIndices.length&&this._allocateNewIndices();var e=this._availableIndices[this._availableIndices.length-1];return this._availableIndices.length--,e},e.prototype.deleteQuery=function(e){this._availableIndices[this._availableIndices.length-1]=e},e.prototype.isQueryResultAvailable=function(e){return this._retrieveQueryBuffer(),!!this._lastBuffer&&e=0||void 0,s3tc:this._deviceEnabledExtensions.indexOf(Th.TextureCompressionBC)>=0||void 0,pvrtc:null,etc1:null,etc2:this._deviceEnabledExtensions.indexOf(Th.TextureCompressionETC2)>=0||void 0,bptc:this._deviceEnabledExtensions.indexOf(Th.TextureCompressionBC)>=0||void 0,maxAnisotropy:4,uintIndices:!0,fragmentDepthSupported:!0,highPrecisionShaderSupported:!0,colorBufferFloat:!0,textureFloat:!0,textureFloatLinearFiltering:!1,textureFloatRender:!0,textureHalfFloat:!0,textureHalfFloatLinearFiltering:!0,textureHalfFloatRender:!0,textureLOD:!0,drawBuffersExtension:!0,depthTextureExtension:!0,vertexArrayObject:!1,instancedArrays:!0,timerQuery:\"undefined\"!=typeof BigUint64Array&&-1!==this.enabledExtensions.indexOf(Th.TimestampQuery)||void 0,supportOcclusionQuery:\"undefined\"!=typeof BigUint64Array,canUseTimestampForTimerQuery:!0,multiview:!1,oculusMultiview:!1,parallelShaderCompile:void 0,blendMinMax:!0,maxMSAASamples:4,canUseGLInstanceID:!0,canUseGLVertexID:!0,supportComputeShaders:!0,supportSRGBBuffers:!0,supportTransformFeedbacks:!1,textureMaxLevel:!0,texture2DArrayMaxLayerCount:2048},this._caps.parallelShaderCompile=null,this._features={forceBitmapOverHTMLImageElement:!0,supportRenderAndCopyToLodForFloatTextures:!0,supportDepthStencilTexture:!0,supportShadowSamplers:!0,uniformBufferHardCheckMatrix:!1,allowTexturePrefiltering:!0,trackUbosInFrame:!0,checkUbosContentBeforeUpload:!0,supportCSM:!0,basisNeedsPOT:!1,support3DTextures:!0,needTypeSuffixInShaderConstants:!0,supportMSAA:!0,supportSSAO2:!0,supportExtendedTextureFormats:!0,supportSwitchCaseInShader:!0,supportSyncTextureRead:!1,needsInvertingBitmap:!1,useUBOBindingCache:!1,needShaderCodeInlining:!0,needToAlwaysBindUniformBuffers:!0,supportRenderPasses:!0,supportSpriteInstancing:!0,_collectUbosUpdatedInFrame:!1}},t.prototype._initializeContextAndSwapChain=function(){this._context=this._canvas.getContext(\"webgpu\"),this._configureContext(),this._colorFormat=this._options.swapChainFormat,this._mainRenderPassWrapper.colorAttachmentGPUTextures=[new yd],this._mainRenderPassWrapper.colorAttachmentGPUTextures[0].format=this._colorFormat},t.prototype._initializeMainAttachments=function(){var e;if(this._bufferManager){this._mainTextureExtends={width:this.getRenderWidth(),height:this.getRenderHeight(),depthOrArrayLayers:1};var t,i=new Float32Array([this.getRenderHeight()]);if(this._bufferManager.setSubData(this._ubInvertY,4,i),this._bufferManager.setSubData(this._ubDontInvertY,4,i),this._options.antialiasing){var n={size:this._mainTextureExtends,mipLevelCount:1,sampleCount:this._mainPassSampleCount,dimension:Ah.E2d,format:this._options.swapChainFormat,usage:Rh.RenderAttachment};null===(e=this._mainTexture)||void 0===e||e.destroy(),this._mainTexture=this._device.createTexture(n),t=[{view:this._mainTexture.createView(),clearValue:new L(0,0,0,1),loadOp:Zh.Clear,storeOp:Jh.Store}]}else t=[{view:void 0,clearValue:new L(0,0,0,1),loadOp:Zh.Clear,storeOp:Jh.Store}];this._mainRenderPassWrapper.depthTextureFormat=this.isStencilEnable?Ph.Depth24PlusStencil8:Ph.Depth32Float,this._setDepthTextureFormat(this._mainRenderPassWrapper);var r={size:this._mainTextureExtends,mipLevelCount:1,sampleCount:this._mainPassSampleCount,dimension:Ah.E2d,format:this._mainRenderPassWrapper.depthTextureFormat,usage:Rh.RenderAttachment};this._depthTexture&&this._depthTexture.destroy(),this._depthTexture=this._device.createTexture(r);var o={view:this._depthTexture.createView(),depthClearValue:this._clearDepthValue,depthLoadOp:Zh.Clear,depthStoreOp:Jh.Store,stencilClearValue:this._clearStencilValue,stencilLoadOp:this.isStencilEnable?Zh.Clear:void 0,stencilStoreOp:this.isStencilEnable?Jh.Store:void 0};this._mainRenderPassWrapper.renderPassDescriptor={colorAttachments:t,depthStencilAttachment:o},null!==this._mainRenderPassWrapper.renderPass&&this._endMainRenderPass()}},t.prototype._configureContext=function(){this._context.configure({device:this._device,format:this._options.swapChainFormat,usage:Rh.RenderAttachment|Rh.CopySrc,alphaMode:this.premultipliedAlpha?ed.Premultiplied:ed.Opaque})},t.prototype.setSize=function(t,i,n){return void 0===n&&(n=!1),!!e.prototype.setSize.call(this,t,i,n)&&(this.dbgVerboseLogsForFirstFrames&&(void 0===this._count&&(this._count=0),(!this._count||this._count65535?t=new Uint32Array(e):(t=new Uint16Array(e),i=!1);var n=this._bufferManager.createBuffer(t,Eh.Index|Eh.CopyDst);return n.is32Bits=i,n},t.prototype._createBuffer=function(e,t){var i;i=e instanceof Array?new Float32Array(e):e instanceof ArrayBuffer?new Uint8Array(e):e;var n=0;return t&a.BUFFER_CREATIONFLAG_READ&&(n|=Eh.CopySrc),t&a.BUFFER_CREATIONFLAG_WRITE&&(n|=Eh.CopyDst),t&a.BUFFER_CREATIONFLAG_UNIFORM&&(n|=Eh.Uniform),t&a.BUFFER_CREATIONFLAG_VERTEX&&(n|=Eh.Vertex),t&a.BUFFER_CREATIONFLAG_INDEX&&(n|=Eh.Index),t&a.BUFFER_CREATIONFLAG_STORAGE&&(n|=Eh.Storage),this._bufferManager.createBuffer(i,n)},t.prototype.bindBuffersDirectly=function(){throw\"Not implemented on WebGPU\"},t.prototype.updateAndBindInstancesBuffer=function(){throw\"Not implemented on WebGPU\"},t.prototype.bindBuffers=function(e,t,i,n){this._currentIndexBuffer=t,this._currentOverrideVertexBuffers=null!=n?n:null,this._cacheRenderPipeline.setBuffers(e,t,this._currentOverrideVertexBuffers)},t.prototype._releaseBuffer=function(e){return this._bufferManager.releaseBuffer(e)},t.prototype.createEffect=function(e,t,i,n,r,o,a,s,l,c){var u;void 0===c&&(c=et.GLSL);var h=e.vertexElement||e.vertex||e.vertexToken||e.vertexSource||e,d=e.fragmentElement||e.fragment||e.fragmentToken||e.fragmentSource||e,p=this._getGlobalDefines(),f=null!==(u=null!=r?r:t.defines)&&void 0!==u?u:\"\";p&&(f+=\"\\n\"+p);var _=h+\"+\"+d+\"@\"+f;if(this._compiledEffects[_]){var m=this._compiledEffects[_];return a&&m.isReady()&&a(m),m}var g=new Ot(e,t,i,n,this,r,o,a,s,l,_,c);return this._compiledEffects[_]=g,g},t.prototype._compileRawShaderToSpirV=function(e,t){return this._glslang.compileGLSL(e,t)},t.prototype._compileShaderToSpirV=function(e,t,i,n){return this._compileRawShaderToSpirV(n+(i?i+\"\\n\":\"\")+e,t)},t.prototype._getWGSLShader=function(e,t,i){return(i=i?\"//\"+i.split(\"\\n\").join(\"\\n//\")+\"\\n\":\"\")+e},t.prototype._createPipelineStageDescriptor=function(e,t,i){return this._tintWASM&&i===et.GLSL&&(e=this._tintWASM.convertSpirV2WGSL(e),t=this._tintWASM.convertSpirV2WGSL(t)),{vertexStage:{module:this._device.createShaderModule({code:e}),entryPoint:\"main\"},fragmentStage:{module:this._device.createShaderModule({code:t}),entryPoint:\"main\"}}},t.prototype._compileRawPipelineStageDescriptor=function(e,t,i){var n=i===et.GLSL?this._compileRawShaderToSpirV(e,\"vertex\"):e,r=i===et.GLSL?this._compileRawShaderToSpirV(t,\"fragment\"):t;return this._createPipelineStageDescriptor(n,r,i)},t.prototype._compilePipelineStageDescriptor=function(e,t,i,n){this.onBeforeShaderCompilationObservable.notifyObservers(this);var r=\"#version 450\\n\",o=n===et.GLSL?this._compileShaderToSpirV(e,\"vertex\",i,r):this._getWGSLShader(e,\"vertex\",i),a=n===et.GLSL?this._compileShaderToSpirV(t,\"fragment\",i,r):this._getWGSLShader(t,\"fragment\",i),s=this._createPipelineStageDescriptor(o,a,n);return this.onAfterShaderCompilationObservable.notifyObservers(this),s},t.prototype.createRawShaderProgram=function(){throw\"Not available on WebGPU\"},t.prototype.createShaderProgram=function(){throw\"Not available on WebGPU\"},t.prototype.inlineShaderCode=function(e){var t=new uh(e);return t.debug=!1,t.processCode(),t.code},t.prototype.createPipelineContext=function(e){return new od(e,this)},t.prototype.createMaterialContext=function(){return new Vd},t.prototype.createDrawContext=function(){return new kd(this._bufferManager)},t.prototype._preparePipelineContext=function(e,t,i,n,r,o,a,s){var l=e,c=l.shaderProcessingContext.shaderLanguage;this.dbgShowShaderCode&&(console.log(s),console.log(t),console.log(i)),l.sources={fragment:i,vertex:t,rawVertex:r,rawFragment:o},l.stages=n?this._compileRawPipelineStageDescriptor(t,i,c):this._compilePipelineStageDescriptor(t,i,s,c)},t.prototype.getAttributes=function(e,t){for(var i=new Array(t.length),n=e,r=0;r0,c._cachedWrapU=a.TEXTURE_CLAMP_ADDRESSMODE,c._cachedWrapV=a.TEXTURE_CLAMP_ADDRESSMODE,c._useSRGBBuffer=l.useSRGBBuffer,this._internalTexturesCache.push(c),i||this._textureHelper.createGPUTextureForInternalTexture(c,u,h,d||1,l.creationFlags),c},t.prototype.createTexture=function(e,t,i,n,r,o,s,l,c,u,h,d,p,f,_){var m=this;return void 0===r&&(r=a.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===o&&(o=null),void 0===s&&(s=null),void 0===l&&(l=null),void 0===c&&(c=null),void 0===u&&(u=null),void 0===h&&(h=null),this._createTextureBase(e,t,i,n,r,o,s,(function(e,t,i,n,r,o,a,s){var l,c=n;if(e.baseWidth=c.width,e.baseHeight=c.height,e.width=c.width,e.height=c.height,e.format=null!=u?u:-1,s(e.width,e.height,c,t,e,(function(){})),null===(l=e._hardwareTexture)||void 0===l?void 0:l.underlyingResource)o||a||m._generateMipmaps(e,m._uploadEncoder);else{var h=m._textureHelper.createGPUTextureForInternalTexture(e,c.width,c.height,void 0,f);Sd.IsImageBitmap(c)&&(m._textureHelper.updateTexture(c,e,c.width,c.height,e.depth,h.format,0,0,r,!1,0,0),o||a||m._generateMipmaps(e,m._uploadEncoder))}i&&i.removePendingData(e),e.isReady=!0,e.onLoadedObservable.notifyObservers(e),e.onLoadedObservable.clear()}),(function(){return!1}),l,c,u,h,d,p,_)},t.prototype.wrapWebGPUTexture=function(e){var t=new yd(e),i=new wt(this,Rt.Unknown,!0);return i._hardwareTexture=t,i.isReady=!0,i},t.prototype.wrapWebGLTexture=function(){throw new Error(\"wrapWebGLTexture is not supported, use wrapWebGPUTexture instead.\")},t.prototype.generateMipMapsForCubemap=function(e){var t;e.generateMipMaps&&((null===(t=e._hardwareTexture)||void 0===t?void 0:t.underlyingResource)||this._textureHelper.createGPUTextureForInternalTexture(e),this._generateMipmaps(e,e.source===Rt.RenderTarget||e.source===Rt.MultiRenderTarget?this._renderTargetEncoder:void 0))},t.prototype.updateTextureSamplingMode=function(e,t,i){void 0===i&&(i=!1),i&&(t.generateMipMaps=!0,this._generateMipmaps(t)),t.samplingMode=e},t.prototype.updateTextureWrappingMode=function(e,t,i,n){void 0===i&&(i=null),void 0===n&&(n=null),null!==t&&(e._cachedWrapU=t),null!==i&&(e._cachedWrapV=i),(e.is2DArray||e.is3D)&&null!==n&&(e._cachedWrapR=n)},t.prototype.updateTextureDimensions=function(e,t,i,n){if(void 0===n&&(n=1),e._hardwareTexture&&(e.width!==t||e.height!==i||e.depth!==n)){var r=e._hardwareTexture.textureAdditionalUsages;e._hardwareTexture.release(),this._textureHelper.createGPUTextureForInternalTexture(e,t,i,n,r)}},t.prototype._setInternalTexture=function(e,t,i){if(i=null!=i?i:e,this._currentEffect){var n=this._currentEffect._pipelineContext.shaderProcessingContext.availableTextures[i];if(this._currentMaterialContext.setTexture(e,t),n&&n.autoBindSampler){var r=i+rd.AutoSamplerSuffix;this._currentMaterialContext.setSampler(r,t)}}},t.prototype.setTexture=function(e,t,i,n){this._setTexture(e,i,!1,!1,n,n)},t.prototype.setTextureArray=function(e,t,i,n){for(var r=0;r0;for(var r in e){var o=e[r],a=i[r],s=a.group,l=a.binding,c=o.type,u=o.object,h=o.indexInGroupEntries;switch((v=this._bindGroupEntries[s])||(v=this._bindGroupEntries[s]=[]),c){case Mc.Sampler:var d=u;void 0!==h&&n?v[h].resource=this._cacheSampler.getSampler(d):(o.indexInGroupEntries=v.length,v.push({binding:l,resource:this._cacheSampler.getSampler(d)}));break;case Mc.Texture:case Mc.TextureWithoutSampler:var p=(f=u)._texture._hardwareTexture;void 0!==h&&n?(c===Mc.Texture&&(v[h++].resource=this._cacheSampler.getSampler(f._texture)),v[h].resource=p.view):(o.indexInGroupEntries=v.length,c===Mc.Texture&&v.push({binding:l-1,resource:this._cacheSampler.getSampler(f._texture)}),v.push({binding:l,resource:p.view}));break;case Mc.StorageTexture:var f;0==((p=(f=u)._texture._hardwareTexture).textureAdditionalUsages&Rh.StorageBinding)&&Q.Error(\"computeDispatch: The texture (name=\".concat(f.name,\", uniqueId=\").concat(f.uniqueId,\") is not a storage texture!\"),50),void 0!==h&&n?v[h].resource=p.viewForWriting:(o.indexInGroupEntries=v.length,v.push({binding:l,resource:p.viewForWriting}));break;case Mc.UniformBuffer:case Mc.StorageBuffer:var _=(Mc.UniformBuffer,u).getBuffer(),m=_.underlyingResource;void 0!==h&&n?(v[h].resource.buffer=m,v[h].resource.size=_.capacity):(o.indexInGroupEntries=v.length,v.push({binding:l,resource:{buffer:m,offset:0,size:_.capacity}}))}}for(var g=0;g>v,b=[],T=0;T<6;T++){var E=_[v][g[T]];h&&(E=lp(E,y,y,r)),b.push(new Uint8Array(E.buffer,E.byteOffset,E.byteLength))}p._textureHelper.updateCubeTextures(b,m.underlyingResource,y,y,m.format,d,!1,0,0)}else{for(b=[],T=0;T<6;T++)b.push(o[u[T]]);p.updateRawCubeTexture(f,b,n,r,d)}f.isReady=!0,null==t||t.removePendingData(f),c&&c()}}(e)}),void 0,null==t?void 0:t.offlineProvider,!0,(function(e,i){null==t||t.removePendingData(f),u&&e&&u(e.status+\" \"+e.statusText,i)})),f},rp.prototype.createRawTexture3D=function(e,t,i,n,r,o,s,l,c,u,h){void 0===c&&(c=null),void 0===u&&(u=a.TEXTURETYPE_UNSIGNED_INT),void 0===h&&(h=0);var d=Rt.Raw3D,p=new wt(this,d);return p.baseWidth=t,p.baseHeight=i,p.baseDepth=n,p.width=t,p.height=i,p.depth=n,p.format=r,p.type=u,p.generateMipMaps=o,p.samplingMode=l,p.is3D=!0,this._doNotHandleContextLost||(p._bufferView=e),this._textureHelper.createGPUTextureForInternalTexture(p,t,i,void 0,h),this.updateRawTexture3D(p,e,r,s,c,u),this._internalTexturesCache.push(p),p},rp.prototype.updateRawTexture3D=function(e,t,i,n,r,o){if(void 0===r&&(r=null),void 0===o&&(o=a.TEXTURETYPE_UNSIGNED_INT),this._doNotHandleContextLost||(e._bufferView=t,e.format=i,e.invertY=n,e._compression=r),t){var s=e._hardwareTexture;i===a.TEXTUREFORMAT_RGB&&(t=lp(t,e.width,e.height,o));var l=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);this._textureHelper.updateTexture(l,e,e.width,e.height,e.depth,s.format,0,0,n,!1,0,0),e.generateMipMaps&&this._generateMipmaps(e,this._uploadEncoder)}e.isReady=!0},rp.prototype.createRawTexture2DArray=function(e,t,i,n,r,o,s,l,c,u,h){void 0===c&&(c=null),void 0===u&&(u=a.TEXTURETYPE_UNSIGNED_INT),void 0===h&&(h=0);var d=Rt.Raw2DArray,p=new wt(this,d);return p.baseWidth=t,p.baseHeight=i,p.baseDepth=n,p.width=t,p.height=i,p.depth=n,p.format=r,p.type=u,p.generateMipMaps=o,p.samplingMode=l,p.is2DArray=!0,this._doNotHandleContextLost||(p._bufferView=e),this._textureHelper.createGPUTextureForInternalTexture(p,t,i,n,h),this.updateRawTexture2DArray(p,e,r,s,c,u),this._internalTexturesCache.push(p),p},rp.prototype.updateRawTexture2DArray=function(e,t,i,n,r,o){if(void 0===r&&(r=null),void 0===o&&(o=a.TEXTURETYPE_UNSIGNED_INT),this._doNotHandleContextLost||(e._bufferView=t,e.format=i,e.invertY=n,e._compression=r),t){var s=e._hardwareTexture;i===a.TEXTUREFORMAT_RGB&&(t=lp(t,e.width,e.height,o));var l=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);this._textureHelper.updateTexture(l,e,e.width,e.height,e.depth,s.format,0,0,n,!1,0,0),e.generateMipMaps&&this._generateMipmaps(e,this._uploadEncoder)}e.isReady=!0},rp.prototype._readTexturePixels=function(e,t,i,n,r,o,a,s,l,c){void 0===n&&(n=-1),void 0===r&&(r=0),void 0===o&&(o=null),void 0===a&&(a=!0),void 0===s&&(s=!1),void 0===l&&(l=0),void 0===c&&(c=0);var u=e._hardwareTexture;return a&&this.flushFramebuffer(),this._textureHelper.readPixels(u.underlyingResource,l,c,t,i,u.format,n,r,o,s)},rp.prototype._readTexturePixelsSync=function(){throw\"_readTexturePixelsSync is unsupported in WebGPU!\"};var cp=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return V(t,e),t}(ha);rp.prototype._createHardwareRenderTargetWrapper=function(e,t,i){var n=new cp(e,t,i,this);return this._renderTargetWrapperCache.push(n),n},rp.prototype.createRenderTargetTexture=function(e,t){var i,n=this._createHardwareRenderTargetWrapper(!1,!1,e),r={};void 0!==t&&\"object\"==typeof t?(r.generateMipMaps=t.generateMipMaps,r.generateDepthBuffer=void 0===t.generateDepthBuffer||t.generateDepthBuffer,r.generateStencilBuffer=r.generateDepthBuffer&&t.generateStencilBuffer,r.samplingMode=void 0===t.samplingMode?a.TEXTURE_TRILINEAR_SAMPLINGMODE:t.samplingMode,r.creationFlags=null!==(i=t.creationFlags)&&void 0!==i?i:0,r.noColorTarget=!!t.noColorTarget):(r.generateMipMaps=t,r.generateDepthBuffer=!0,r.generateStencilBuffer=!1,r.samplingMode=a.TEXTURE_TRILINEAR_SAMPLINGMODE,r.creationFlags=0,r.noColorTarget=!1);var o=r.noColorTarget?null:this._createInternalTexture(e,t,!0,Rt.RenderTarget);return n._generateDepthBuffer=r.generateDepthBuffer,n._generateStencilBuffer=!!r.generateStencilBuffer,n.setTextures(o),(n._generateDepthBuffer||n._generateStencilBuffer)&&n.createDepthStencilTexture(0,void 0===r.samplingMode||r.samplingMode===a.TEXTURE_BILINEAR_SAMPLINGMODE||r.samplingMode===a.TEXTURE_LINEAR_LINEAR||r.samplingMode===a.TEXTURE_TRILINEAR_SAMPLINGMODE||r.samplingMode===a.TEXTURE_LINEAR_LINEAR_MIPLINEAR||r.samplingMode===a.TEXTURE_NEAREST_LINEAR_MIPNEAREST||r.samplingMode===a.TEXTURE_NEAREST_LINEAR_MIPLINEAR||r.samplingMode===a.TEXTURE_NEAREST_LINEAR||r.samplingMode===a.TEXTURE_LINEAR_LINEAR_MIPNEAREST,n._generateStencilBuffer,n.samples),o&&(void 0!==t&&\"object\"==typeof t&&t.createMipMaps&&!r.generateMipMaps&&(o.generateMipMaps=!0),this._textureHelper.createGPUTextureForInternalTexture(o,void 0,void 0,void 0,r.creationFlags),void 0!==t&&\"object\"==typeof t&&t.createMipMaps&&!r.generateMipMaps&&(o.generateMipMaps=!1)),n},rp.prototype._createDepthStencilTexture=function(e,t){var i=new wt(this,Rt.DepthStencil),n=k({bilinearFiltering:!1,comparisonFunction:0,generateStencil:!1,samples:1,depthTextureFormat:t.generateStencil?a.TEXTUREFORMAT_DEPTH24_STENCIL8:a.TEXTUREFORMAT_DEPTH32_FLOAT},t);return i.format=n.depthTextureFormat,this._setupDepthStencilTexture(i,e,n.generateStencil,n.bilinearFiltering,n.comparisonFunction,n.samples),this._textureHelper.createGPUTextureForInternalTexture(i),this._internalTexturesCache.push(i),i},rp.prototype._setupDepthStencilTexture=function(e,t,i,n,r,o){void 0===o&&(o=1);var s=t.width||t,l=t.height||t,c=t.layers||0;e.baseWidth=s,e.baseHeight=l,e.width=s,e.height=l,e.is2DArray=c>0,e.depth=c,e.isReady=!0,e.samples=o,e.generateMipMaps=!1,e.samplingMode=n?a.TEXTURE_BILINEAR_SAMPLINGMODE:a.TEXTURE_NEAREST_SAMPLINGMODE,e.type=a.TEXTURETYPE_FLOAT,e._comparisonFunction=r,e._cachedWrapU=a.TEXTURE_CLAMP_ADDRESSMODE,e._cachedWrapV=a.TEXTURE_CLAMP_ADDRESSMODE},rp.prototype.updateRenderTargetTextureSampleCount=function(e,t){return e&&e.texture&&e.samples!==t?(t=Math.min(t,this.getCaps().maxMSAASamples),this._textureHelper.createMSAATexture(e.texture,t),e._depthStencilTexture&&(this._textureHelper.createMSAATexture(e._depthStencilTexture,t),e._depthStencilTexture.samples=t),e.texture.samples=t,t):t},rp.prototype.createRenderTargetCubeTexture=function(e,t){var i=this._createHardwareRenderTargetWrapper(!1,!0,e),n=k({generateMipMaps:!0,generateDepthBuffer:!0,generateStencilBuffer:!1,type:a.TEXTURETYPE_UNSIGNED_INT,samplingMode:a.TEXTURE_TRILINEAR_SAMPLINGMODE,format:a.TEXTUREFORMAT_RGBA,samples:1},t);n.generateStencilBuffer=n.generateDepthBuffer&&n.generateStencilBuffer,i._generateDepthBuffer=n.generateDepthBuffer,i._generateStencilBuffer=n.generateStencilBuffer;var r=new wt(this,Rt.RenderTarget);return r.width=e,r.height=e,r.depth=0,r.isReady=!0,r.isCube=!0,r.samples=n.samples,r.generateMipMaps=n.generateMipMaps,r.samplingMode=n.samplingMode,r.type=n.type,r.format=n.format,this._internalTexturesCache.push(r),i.setTextures(r),(i._generateDepthBuffer||i._generateStencilBuffer)&&i.createDepthStencilTexture(0,void 0===n.samplingMode||n.samplingMode===a.TEXTURE_BILINEAR_SAMPLINGMODE||n.samplingMode===a.TEXTURE_LINEAR_LINEAR||n.samplingMode===a.TEXTURE_TRILINEAR_SAMPLINGMODE||n.samplingMode===a.TEXTURE_LINEAR_LINEAR_MIPLINEAR||n.samplingMode===a.TEXTURE_NEAREST_LINEAR_MIPNEAREST||n.samplingMode===a.TEXTURE_NEAREST_LINEAR_MIPLINEAR||n.samplingMode===a.TEXTURE_NEAREST_LINEAR||n.samplingMode===a.TEXTURE_LINEAR_LINEAR_MIPNEAREST,i._generateStencilBuffer,i.samples),t&&t.createMipMaps&&!n.generateMipMaps&&(r.generateMipMaps=!0),this._textureHelper.createGPUTextureForInternalTexture(r),t&&t.createMipMaps&&!n.generateMipMaps&&(r.generateMipMaps=!1),i},Ot.prototype.setTextureSampler=function(e,t){this._engine.setTextureSampler(e,t)},rp.prototype.setTextureSampler=function(e,t){var i;null===(i=this._currentMaterialContext)||void 0===i||i.setSampler(e,t)},Ot.prototype.setStorageBuffer=function(e,t){this._engine.setStorageBuffer(e,t)},rp.prototype.createStorageBuffer=function(e,t){return this._createBuffer(e,t|a.BUFFER_CREATIONFLAG_STORAGE)},rp.prototype.updateStorageBuffer=function(e,t,i,n){var r,o=e;void 0===i&&(i=0),void 0===n?n=(r=t instanceof Array?new Float32Array(t):t instanceof ArrayBuffer?new Uint8Array(t):t).byteLength:r=t instanceof Array?new Float32Array(t):t instanceof ArrayBuffer?new Uint8Array(t):t,this._bufferManager.setSubData(o,i,r,0,n)},rp.prototype.readFromStorageBuffer=function(e,t,i,n){var r=this;i=i||e.capacity;var o=this._bufferManager.createRawBuffer(i,Eh.MapRead|Eh.CopyDst);return this._renderTargetEncoder.copyBufferToBuffer(e.underlyingResource,null!=t?t:0,o,0,i),new Promise((function(e,t){r.onEndFrameObservable.addOnce((function(){o.mapAsync(Sh.Read,0,i).then((function(){var t=o.getMappedRange(0,i),a=n;if(void 0===a)(a=new Uint8Array(i)).set(new Uint8Array(t));else{var s=a.constructor;(a=new s(a.buffer)).set(new s(t))}o.unmap(),r._bufferManager.releaseBuffer(o),e(a)}),(function(e){return t(e)}))}))}))},rp.prototype.setStorageBuffer=function(e,t){var i,n;null===(i=this._currentDrawContext)||void 0===i||i.setBuffer(e,null!==(n=null==t?void 0:t.getBuffer())&&void 0!==n?n:null)},rp.prototype.createUniformBuffer=function(e){var t;return t=e instanceof Array?new Float32Array(e):e,this._bufferManager.createBuffer(t,Eh.Uniform|Eh.CopyDst)},rp.prototype.createDynamicUniformBuffer=function(e){return this.createUniformBuffer(e)},rp.prototype.updateUniformBuffer=function(e,t,i,n){void 0===i&&(i=0);var r,o=e;void 0===n?n=(r=t instanceof Float32Array?t:new Float32Array(t)).byteLength:r=t instanceof Float32Array?t:new Float32Array(t),this._bufferManager.setSubData(o,i,r,0,n)},rp.prototype.bindUniformBufferBase=function(e,t,i){this._currentDrawContext.setBuffer(i,e)},rp.prototype.bindUniformBlock=function(){},rp.prototype.updateVideoTexture=function(e,t,i){var n,r=this;if(e&&!e._isDisabled){void 0===this._videoTextureSupported&&(this._videoTextureSupported=!0);var o=e._hardwareTexture;(null===(n=e._hardwareTexture)||void 0===n?void 0:n.underlyingResource)||(o=this._textureHelper.createGPUTextureForInternalTexture(e)),this.createImageBitmap(t).then((function(t){r._textureHelper.updateTexture(t,e,e.width,e.height,e.depth,o.format,0,0,!i,!1,0,0),e.generateMipMaps&&r._generateMipmaps(e,r._uploadEncoder),e.isReady=!0})).catch((function(){e.isReady=!0}))}};var up=function(){function e(){}return e.CreateAsync=function(e,t){return rp.IsSupportedAsync.then((function(i){return i?rp.CreateAsync(e,t):vr.IsSupported?new Promise((function(i){i(new vr(e,void 0,t))})):new Promise((function(e){e(new bu(t))}))}))},e}(),hp=function(){function e(){}return e.COPY=1,e.CUT=2,e.PASTE=3,e}(),dp=function(){function e(e,t){this.type=e,this.event=t}return e.GetTypeFromCharacter=function(e){switch(e){case 67:return hp.COPY;case 86:return hp.PASTE;case 88:return hp.CUT;default:return-1}},e}(),pp=function(e){function t(t){var i=e.call(this,t)||this;return i.controllerType=Vs.DAYDREAM,i}return V(t,e),t.prototype.initControllerMesh=function(e,i){var n=this;Uo.ImportMesh(\"\",t.MODEL_BASE_URL,t.MODEL_FILENAME,e,(function(e){n._defaultModel=e[1],n.attachToMesh(n._defaultModel),i&&i(n._defaultModel)}))},t.prototype._handleButtonChange=function(e,t){if(0===e){var i=this.onTriggerStateChangedObservable;i&&i.notifyObservers(t)}else Q.Warn(\"Unrecognized Daydream button index: \".concat(e))},t.MODEL_BASE_URL=\"https://controllers.babylonjs.com/generic/\",t.MODEL_FILENAME=\"generic.babylon\",t.GAMEPAD_ID_PREFIX=\"Daydream\",t}(Ol);Hs._ControllerFactories.push({canCreate:function(e){return 0===e.id.indexOf(pp.GAMEPAD_ID_PREFIX)},create:function(e){return new pp(e)}});var fp=function(e){function t(t){var i=e.call(this,t)||this;return i._buttonIndexToObservableNameMap=[\"onPadStateChangedObservable\",\"onTriggerStateChangedObservable\"],i.controllerType=Vs.GEAR_VR,i._calculatedPosition=new x(\"left\"==i.hand?-.15:.15,-.5,.25),i._disableTrackPosition(i._calculatedPosition),i}return V(t,e),t.prototype.initControllerMesh=function(e,i){var n=this;Uo.ImportMesh(\"\",t.MODEL_BASE_URL,t.MODEL_FILENAME,e,(function(t){var r=new Ur(\"\",e);t[1].parent=r,t[1].position.z=-.15,n._defaultModel=r,n.attachToMesh(n._defaultModel),i&&i(n._defaultModel)}))},t.prototype._handleButtonChange=function(e,t){if(ef.snapDistance?(r=Math.floor(Math.abs(A)/f.snapDistance),A<0&&(r*=-1),A%=f.snapDistance,R.scaleToRef(f.snapDistance*r,R),n=!0):R.scaleInPlace(0)),M.ScalingToRef(1+R.x,1+R.y,1+R.z,f._tmpMatrix2),f._tmpMatrix2.multiplyToRef(f.attachedNode.getWorldMatrix(),f._tmpMatrix);var o=f.attachedNode._isMesh?f.attachedNode:void 0;f._tmpMatrix.decompose(f._tmpVector,void 0,void 0,Bc.PreserveScaling?o:void 0);var a=1e5;Math.abs(f._tmpVector.x)=8?P.RotationYawPitchRollToRef(0,0,c,n._tmpQuaternion):e>=4?P.RotationYawPitchRollToRef(c,0,0,n._tmpQuaternion):P.RotationYawPitchRollToRef(0,c,0,n._tmpQuaternion),n._anchorMesh.addChild(n.attachedMesh,Bc.PreserveScaling),n._anchorMesh.getScene().useRightHandedSystem&&n._tmpQuaternion.conjugateInPlace(),n._anchorMesh.rotationQuaternion.multiplyToRef(n._tmpQuaternion,n._anchorMesh.rotationQuaternion),n._anchorMesh.removeChild(n.attachedMesh,Bc.PreserveScaling),n.attachedMesh.setParent(i,Bc.PreserveScaling)),n.updateBoundingBox(),_o._RestorePivotPoint(n.attachedMesh)}n._updateDummy()})),r.onDragStartObservable.add((function(){n.onDragStartObservable.notifyObservers({}),n._selectNode(t)})),r.onDragEndObservable.add((function(){n.onRotationSphereDragEndObservable.notifyObservers({}),n._selectNode(null),n._updateDummy()})),a._rotateSpheresParent.addChild(t)},a=this,s=0;s<12;s++)o(s);for(n._rootMesh.addChild(n._rotateSpheresParent),n._scaleBoxesParent=new Sr(\"\",i.utilityLayerScene),n._scaleBoxesParent.rotationQuaternion=new P,s=0;s<3;s++)for(var l=0;l<3;l++)for(var c=function(e){var t=(1===s?1:0)+(1===l?1:0)+(1===e?1:0);if(1===t||3===t)return\"continue\";var r=Wc(\"\",{size:1},i.utilityLayerScene);r.material=h._coloredMaterial,r.metadata=2===t,r.isNearGrabbable=!0;var o=new x(s-1,l-1,e-1).normalize(),a=new bo({dragAxis:o});a.updateDragPlane=!1,a.moveAttached=!1,r.addBehavior(a),a.onDragObservable.add((function(e){if(n.onScaleBoxDragObservable.notifyObservers({}),n.attachedMesh){var i=n.attachedMesh.parent;if(i&&i.scaling&&i.scaling.isNonUniformWithinEpsilon(.001))return void Q.Warn(\"BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling\");_o._RemoveAndStorePivotPoint(n.attachedMesh);var a=e.dragDistance/n._boundingDimensions.length()*n._anchorMesh.scaling.length(),s=new x(a,a,a);2===t&&(s.x*=Math.abs(o.x),s.y*=Math.abs(o.y),s.z*=Math.abs(o.z)),s.scaleInPlace(n._scaleDragSpeed),s.multiplyInPlace(n._axisFactor),n.updateBoundingBox(),n.scalePivot?(n.attachedMesh.getWorldMatrix().getRotationMatrixToRef(n._tmpRotationMatrix),n._boundingDimensions.scaleToRef(.5,n._tmpVector),x.TransformCoordinatesToRef(n._tmpVector,n._tmpRotationMatrix,n._tmpVector),n._anchorMesh.position.subtractInPlace(n._tmpVector),n._boundingDimensions.multiplyToRef(n.scalePivot,n._tmpVector),x.TransformCoordinatesToRef(n._tmpVector,n._tmpRotationMatrix,n._tmpVector),n._anchorMesh.position.addInPlace(n._tmpVector)):(r.absolutePosition.subtractToRef(n._anchorMesh.position,n._tmpVector),n._anchorMesh.position.subtractInPlace(n._tmpVector)),n._anchorMesh.addChild(n.attachedMesh,Bc.PreserveScaling),n._anchorMesh.scaling.addInPlace(s),(n._anchorMesh.scaling.x<0||n._anchorMesh.scaling.y<0||n._anchorMesh.scaling.z<0)&&n._anchorMesh.scaling.subtractInPlace(s),n._anchorMesh.removeChild(n.attachedMesh,Bc.PreserveScaling),n.attachedMesh.setParent(i,Bc.PreserveScaling),_o._RestorePivotPoint(n.attachedMesh)}n._updateDummy()})),a.onDragStartObservable.add((function(){n.onDragStartObservable.notifyObservers({}),n._selectNode(r)})),a.onDragEndObservable.add((function(){n.onScaleBoxDragEndObservable.notifyObservers({}),n._selectNode(null),n._updateDummy()})),h._scaleBoxesParent.addChild(r)},h=this,d=0;d<3;d++)c(d);n._rootMesh.addChild(n._scaleBoxesParent);var p=new Array;return n._pointerObserver=i.utilityLayerScene.onPointerObservable.add((function(e){p[e.event.pointerId]?e.pickInfo&&e.pickInfo.pickedMesh!=p[e.event.pointerId]&&(p[e.event.pointerId].material=n._coloredMaterial,delete p[e.event.pointerId]):n._rotateSpheresParent.getChildMeshes().concat(n._scaleBoxesParent.getChildMeshes()).forEach((function(t){e.pickInfo&&e.pickInfo.pickedMesh==t&&(p[e.event.pointerId]=t,t.material=n._hoverColoredMaterial)}))})),n._renderObserver=n.gizmoLayer.originalScene.onBeforeRenderObservable.add((function(){n.attachedMesh&&!n._existingMeshScale.equals(n.attachedMesh.scaling)?n.updateBoundingBox():(n.fixedDragMeshScreenSize||n.fixedDragMeshBoundsSize)&&(n._updateRotationSpheres(),n._updateScaleBoxes()),n._dragMesh&&n.attachedMesh&&n._pointerDragBehavior.dragging&&(n._lineBoundingBox.position.rotateByQuaternionToRef(n._rootMesh.rotationQuaternion,n._tmpVector),n.attachedMesh.setAbsolutePosition(n._dragMesh.position.add(n._tmpVector.scale(-1))))})),n.updateBoundingBox(),n}return V(t,e),Object.defineProperty(t.prototype,\"axisFactor\",{get:function(){return this._axisFactor},set:function(e){this._axisFactor=e;for(var t=this._scaleBoxesParent.getChildMeshes(),i=0,n=0;n<3;n++)for(var r=0;r<3;r++)for(var o=0;o<3;o++){var a=(1===n?1:0)+(1===r?1:0)+(1===o?1:0);if(1!==a&&3!==a){if(t[i]){var s=new x(n-1,r-1,o-1);s.multiplyInPlace(this._axisFactor),t[i].setEnabled(s.lengthSquared()>_)}i++}}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"scaleDragSpeed\",{get:function(){return this._scaleDragSpeed},set:function(e){this._scaleDragSpeed=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"pointerDragBehavior\",{get:function(){return this._pointerDragBehavior},enumerable:!1,configurable:!0}),t.prototype.setColor=function(e){this._coloredMaterial.emissiveColor=e,this._hoverColoredMaterial.emissiveColor=e.clone().add(new N(.3,.3,.3)),this._lineBoundingBox.getChildren().forEach((function(t){t.color&&(t.color=e)}))},t.prototype._attachedNodeChanged=function(e){var t=this;if(e){this._anchorMesh.scaling.setAll(1),_o._RemoveAndStorePivotPoint(e);var i=e.parent;this._anchorMesh.addChild(e,Bc.PreserveScaling),this._anchorMesh.removeChild(e,Bc.PreserveScaling),e.setParent(i,Bc.PreserveScaling),_o._RestorePivotPoint(e),this.updateBoundingBox(),e.getChildMeshes(!1).forEach((function(e){e.markAsDirty(\"scaling\")})),this.gizmoLayer.utilityLayerScene.onAfterRenderObservable.addOnce((function(){t._updateDummy()}))}},t.prototype._selectNode=function(e){this._rotateSpheresParent.getChildMeshes().concat(this._scaleBoxesParent.getChildMeshes()).forEach((function(t){t.isVisible=!e||t==e}))},t.prototype.getScaleBoxes=function(){return this._scaleBoxesParent.getChildMeshes()},t.prototype.updateBoundingBox=function(){if(this.attachedMesh){_o._RemoveAndStorePivotPoint(this.attachedMesh);var e=this.attachedMesh.parent;this.attachedMesh.setParent(null,Bc.PreserveScaling),this._update(),this.attachedMesh.rotationQuaternion||(this.attachedMesh.rotationQuaternion=P.RotationYawPitchRoll(this.attachedMesh.rotation.y,this.attachedMesh.rotation.x,this.attachedMesh.rotation.z)),this._anchorMesh.rotationQuaternion||(this._anchorMesh.rotationQuaternion=P.RotationYawPitchRoll(this._anchorMesh.rotation.y,this._anchorMesh.rotation.x,this._anchorMesh.rotation.z)),this._anchorMesh.rotationQuaternion.copyFrom(this.attachedMesh.rotationQuaternion),this._tmpQuaternion.copyFrom(this.attachedMesh.rotationQuaternion),this._tmpVector.copyFrom(this.attachedMesh.position),this.attachedMesh.rotationQuaternion.set(0,0,0,1),this.attachedMesh.position.set(0,0,0);var t=this.attachedMesh.getHierarchyBoundingVectors(!this.ignoreChildren,this.includeChildPredicate);t.max.subtractToRef(t.min,this._boundingDimensions),this._lineBoundingBox.scaling.copyFrom(this._boundingDimensions),this._lineBoundingBox.position.set((t.max.x+t.min.x)/2,(t.max.y+t.min.y)/2,(t.max.z+t.min.z)/2),this._rotateSpheresParent.position.copyFrom(this._lineBoundingBox.position),this._scaleBoxesParent.position.copyFrom(this._lineBoundingBox.position),this._lineBoundingBox.computeWorldMatrix(),this._anchorMesh.position.copyFrom(this._lineBoundingBox.absolutePosition),this.attachedMesh.rotationQuaternion.copyFrom(this._tmpQuaternion),this.attachedMesh.position.copyFrom(this._tmpVector),this.attachedMesh.setParent(e,Bc.PreserveScaling)}this._updateRotationSpheres(),this._updateScaleBoxes(),this.attachedMesh&&(this._existingMeshScale.copyFrom(this.attachedMesh.scaling),_o._RestorePivotPoint(this.attachedMesh))},t.prototype._updateRotationSpheres=function(){for(var e=this._rotateSpheresParent.getChildMeshes(),t=0;t<3;t++)for(var i=0;i<2;i++)for(var n=0;n<2;n++){var r=4*t+2*i+n;if(0==t&&(e[r].position.set(this._boundingDimensions.x/2,this._boundingDimensions.y*i,this._boundingDimensions.z*n),e[r].position.addInPlace(new x(-this._boundingDimensions.x/2,-this._boundingDimensions.y/2,-this._boundingDimensions.z/2)),e[r].lookAt(x.Cross(e[r].position.normalizeToNew(),x.Right()).normalizeToNew().add(e[r].position))),1==t&&(e[r].position.set(this._boundingDimensions.x*i,this._boundingDimensions.y/2,this._boundingDimensions.z*n),e[r].position.addInPlace(new x(-this._boundingDimensions.x/2,-this._boundingDimensions.y/2,-this._boundingDimensions.z/2)),e[r].lookAt(x.Cross(e[r].position.normalizeToNew(),x.Up()).normalizeToNew().add(e[r].position))),2==t&&(e[r].position.set(this._boundingDimensions.x*i,this._boundingDimensions.y*n,this._boundingDimensions.z/2),e[r].position.addInPlace(new x(-this._boundingDimensions.x/2,-this._boundingDimensions.y/2,-this._boundingDimensions.z/2)),e[r].lookAt(x.Cross(e[r].position.normalizeToNew(),x.Forward()).normalizeToNew().add(e[r].position))),this.fixedDragMeshScreenSize&&this.gizmoLayer.utilityLayerScene.activeCamera){e[r].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position,this._tmpVector);var o=this.rotationSphereSize*this._tmpVector.length()/this.fixedDragMeshScreenSizeDistanceFactor;e[r].scaling.set(o,o,o)}else this.fixedDragMeshBoundsSize?e[r].scaling.set(this.rotationSphereSize*this._boundingDimensions.x,this.rotationSphereSize*this._boundingDimensions.y,this.rotationSphereSize*this._boundingDimensions.z):e[r].scaling.set(this.rotationSphereSize,this.rotationSphereSize,this.rotationSphereSize)}},t.prototype._updateScaleBoxes=function(){for(var e=this._scaleBoxesParent.getChildMeshes(),t=0,i=0;i<3;i++)for(var n=0;n<3;n++)for(var r=0;r<3;r++){var o=(1===i?1:0)+(1===n?1:0)+(1===r?1:0);if(1!==o&&3!==o){if(e[t])if(e[t].position.set(this._boundingDimensions.x*(i/2),this._boundingDimensions.y*(n/2),this._boundingDimensions.z*(r/2)),e[t].position.addInPlace(new x(-this._boundingDimensions.x/2,-this._boundingDimensions.y/2,-this._boundingDimensions.z/2)),this.fixedDragMeshScreenSize&&this.gizmoLayer.utilityLayerScene.activeCamera){e[t].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position,this._tmpVector);var a=this.scaleBoxSize*this._tmpVector.length()/this.fixedDragMeshScreenSizeDistanceFactor;e[t].scaling.set(a,a,a)}else this.fixedDragMeshBoundsSize?e[t].scaling.set(this.scaleBoxSize*this._boundingDimensions.x,this.scaleBoxSize*this._boundingDimensions.y,this.scaleBoxSize*this._boundingDimensions.z):e[t].scaling.set(this.scaleBoxSize,this.scaleBoxSize,this.scaleBoxSize);t++}}},t.prototype.setEnabledRotationAxis=function(e){this._rotateSpheresParent.getChildMeshes().forEach((function(t,i){i<4?t.setEnabled(-1!=e.indexOf(\"x\")):i<8?t.setEnabled(-1!=e.indexOf(\"y\")):t.setEnabled(-1!=e.indexOf(\"z\"))}))},t.prototype.setEnabledScaling=function(e,t){void 0===t&&(t=!1),this._scaleBoxesParent.getChildMeshes().forEach((function(i){var n=e;t&&!0===i.metadata&&(n=!1),i.setEnabled(n)}))},t.prototype._updateDummy=function(){this._dragMesh&&(this._dragMesh.position.copyFrom(this._lineBoundingBox.getAbsolutePosition()),this._dragMesh.scaling.copyFrom(this._lineBoundingBox.scaling),this._dragMesh.rotationQuaternion.copyFrom(this._rootMesh.rotationQuaternion))},t.prototype.enableDragBehavior=function(){this._dragMesh=Wc(\"dummy\",{size:1},this.gizmoLayer.utilityLayerScene),this._dragMesh.visibility=0,this._dragMesh.rotationQuaternion=new P,this._pointerDragBehavior.useObjectOrientationForDragging=!1,this._dragMesh.addBehavior(this._pointerDragBehavior)},t.prototype.dispose=function(){this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this.gizmoLayer.originalScene.onBeforeRenderObservable.remove(this._renderObserver),this._lineBoundingBox.dispose(),this._rotateSpheresParent.dispose(),this._scaleBoxesParent.dispose(),this._dragMesh&&this._dragMesh.dispose(),e.prototype.dispose.call(this)},t.MakeNotPickableAndWrapInBoundingBox=function(e){var t=function(e){e.isPickable=!1,e.getChildMeshes().forEach((function(e){t(e)}))};t(e),e.rotationQuaternion||(e.rotationQuaternion=P.RotationYawPitchRoll(e.rotation.y,e.rotation.x,e.rotation.z));var i=e.position.clone(),n=e.rotationQuaternion.clone();e.rotationQuaternion.set(0,0,0,1),e.position.set(0,0,0);var r=Wc(\"box\",{size:1},e.getScene()),o=e.getHierarchyBoundingVectors();return o.max.subtractToRef(o.min,r.scaling),0===r.scaling.y&&(r.scaling.y=_),0===r.scaling.x&&(r.scaling.x=_),0===r.scaling.z&&(r.scaling.z=_),r.position.set((o.max.x+o.min.x)/2,(o.max.y+o.min.y)/2,(o.max.z+o.min.z)/2),e.addChild(r),e.rotationQuaternion.copyFrom(n),e.position.copyFrom(i),e.removeChild(r),r.addChild(e),r.visibility=0,r},t.prototype.setCustomMesh=function(){Q.Error(\"Custom meshes are not supported on this gizmo\")},t}(Bc),Sp=function(e){function t(i,n,r,o,a,s,l){void 0===n&&(n=N.Gray()),void 0===r&&(r=wc.DefaultUtilityLayer),void 0===o&&(o=32),void 0===a&&(a=null),void 0===s&&(s=!1),void 0===l&&(l=1);var c,h=this;(h=e.call(this,r)||this)._pointerObserver=null,h.snapDistance=0,h.onSnapObservable=new u,h.angle=0,h._isEnabled=!0,h._parent=null,h._dragging=!1,h._angles=new x,h._parent=a,h._coloredMaterial=new Xl(\"\",r.utilityLayerScene),h._coloredMaterial.diffuseColor=n,h._coloredMaterial.specularColor=n.subtract(new N(.1,.1,.1)),h._hoverMaterial=new Xl(\"\",r.utilityLayerScene),h._hoverMaterial.diffuseColor=N.Yellow(),h._disableMaterial=new Xl(\"\",r.utilityLayerScene),h._disableMaterial.diffuseColor=N.Gray(),h._disableMaterial.alpha=.4,h._gizmoMesh=new Ur(\"\",r.utilityLayerScene);var d=h._createGizmoMesh(h._gizmoMesh,l,o),p=d.rotationMesh,f=d.collider;h._rotationDisplayPlane=go(\"rotationDisplay\",{size:.6,updatable:!1},h.gizmoLayer.utilityLayerScene),h._rotationDisplayPlane.rotation.z=.5*Math.PI,h._rotationDisplayPlane.parent=h._gizmoMesh,h._rotationDisplayPlane.setEnabled(!1),Ot.ShadersStore.rotationGizmoVertexShader=t._RotationGizmoVertexShader,Ot.ShadersStore.rotationGizmoFragmentShader=t._RotationGizmoFragmentShader,h._rotationShaderMaterial=new eu(\"shader\",h.gizmoLayer.utilityLayerScene,{vertex:\"rotationGizmo\",fragment:\"rotationGizmo\"},{attributes:[\"position\",\"uv\"],uniforms:[\"worldViewProjection\",\"angles\"]}),h._rotationShaderMaterial.backFaceCulling=!1,h._rotationDisplayPlane.material=h._rotationShaderMaterial,h._rotationDisplayPlane.visibility=.999,h._gizmoMesh.lookAt(h._rootMesh.position.add(i)),h._rootMesh.addChild(h._gizmoMesh,Bc.PreserveScaling),h._gizmoMesh.scaling.scaleInPlace(1/3),h.dragBehavior=new bo({dragPlaneNormal:i}),h.dragBehavior.moveAttached=!1,h.dragBehavior.maxDragAngle=t.MaxDragAngle,h.dragBehavior._useAlternatePickedPointAboveMaxDragAngle=!0,h._rootMesh.addBehavior(h.dragBehavior);var _=new x,m=new M,g=new x,v=new x;h.dragBehavior.onDragStartObservable.add((function(e){h.attachedNode&&(_.copyFrom(e.dragPlanePoint),h._rotationDisplayPlane.setEnabled(!0),h._rotationDisplayPlane.getWorldMatrix().invertToRef(m),x.TransformCoordinatesToRef(e.dragPlanePoint,m,_),h._angles.x=Math.atan2(_.y,_.x)+Math.PI,h._angles.y=0,h._angles.z=h.updateGizmoRotationToMatchAttachedMesh?1:0,h._dragging=!0,_.copyFrom(e.dragPlanePoint),h._rotationShaderMaterial.setVector3(\"angles\",h._angles),h.angle=0)})),h.dragBehavior.onDragEndObservable.add((function(){h._dragging=!1,h._rotationDisplayPlane.setEnabled(!1)}));var y={snapDistance:0},b=0,T=new M,E=new P;h.dragBehavior.onDragObservable.add((function(e){if(h.attachedNode){var t=new x(1,1,1),n=new P(0,0,0,1),o=new x(0,0,0);h._handlePivot(),h.attachedNode.getWorldMatrix().decompose(t,n,o);var a=e.dragPlanePoint.subtract(o).normalize(),s=_.subtract(o).normalize(),l=x.Cross(a,s),c=x.Dot(a,s),u=Math.atan2(l.length(),c);g.copyFrom(i),v.copyFrom(i),h.updateGizmoRotationToMatchAttachedMesh&&(n.toRotationMatrix(m),v=x.TransformCoordinates(g,m));var d=!1;if(r.utilityLayerScene.activeCamera){var p=r.utilityLayerScene.activeCamera.position.subtract(o).normalize();x.Dot(p,v)>0&&(g.scaleInPlace(-1),v.scaleInPlace(-1),d=!0)}x.Dot(v,l)>0&&(u=-u);var f=!1;if(0!=h.snapDistance)if(b+=u,Math.abs(b)>h.snapDistance){var S=Math.floor(Math.abs(b)/h.snapDistance);b<0&&(S*=-1),b%=h.snapDistance,u=h.snapDistance*S,f=!0}else u=0;var A=Math.sin(u/2);if(E.set(g.x*A,g.y*A,g.z*A,Math.cos(u/2)),T.determinant()>0){var R=new x;E.toEulerAnglesToRef(R),P.RotationYawPitchRollToRef(R.y,-R.x,-R.z,E)}h.updateGizmoRotationToMatchAttachedMesh?n.multiplyToRef(E,n):E.multiplyToRef(n,n),h.attachedNode.getWorldMatrix().copyFrom(M.Compose(t,n,o)),_.copyFrom(e.dragPlanePoint),f&&(y.snapDistance=u,h.onSnapObservable.notifyObservers(y)),h._angles.y+=u,h.angle+=d?-u:u,h._rotationShaderMaterial.setVector3(\"angles\",h._angles),h._matrixChanged()}}));var S=r._getSharedGizmoLight();S.includedOnlyMeshes=S.includedOnlyMeshes.concat(h._rootMesh.getChildMeshes(!1));var A={colliderMeshes:[f],gizmoMeshes:[p],material:h._coloredMaterial,hoverMaterial:h._hoverMaterial,disableMaterial:h._disableMaterial,active:!1,dragBehavior:h.dragBehavior};return null===(c=h._parent)||void 0===c||c.addToAxisCache(h._gizmoMesh,A),h._pointerObserver=r.utilityLayerScene.onPointerObservable.add((function(e){var i;if(!h._customMeshSet&&(h.dragBehavior.maxDragAngle=t.MaxDragAngle,h._isHovered=!(-1==A.colliderMeshes.indexOf(null===(i=null==e?void 0:e.pickInfo)||void 0===i?void 0:i.pickedMesh)),!h._parent)){var n=A.dragBehavior.enabled?h._isHovered||h._dragging?h._hoverMaterial:h._coloredMaterial:h._disableMaterial;h._setGizmoMeshMaterial(A.gizmoMeshes,n)}})),h.dragBehavior.onEnabledObservable.add((function(e){h._setGizmoMeshMaterial(A.gizmoMeshes,e?h._coloredMaterial:h._disableMaterial)})),h}return V(t,e),t.prototype._createGizmoMesh=function(e,t,i){var n=uc(\"ignore\",{diameter:.6,thickness:.03*t,tessellation:i},this.gizmoLayer.utilityLayerScene);n.visibility=0;var r=uc(\"\",{diameter:.6,thickness:.005*t,tessellation:i},this.gizmoLayer.utilityLayerScene);return r.material=this._coloredMaterial,r.rotation.x=Math.PI/2,n.rotation.x=Math.PI/2,e.addChild(r,Bc.PreserveScaling),e.addChild(n,Bc.PreserveScaling),{rotationMesh:r,collider:n}},t.prototype._attachedNodeChanged=function(e){this.dragBehavior&&(this.dragBehavior.enabled=!!e)},Object.defineProperty(t.prototype,\"isEnabled\",{get:function(){return this._isEnabled},set:function(e){this._isEnabled=e,e?this._parent&&(this.attachedMesh=this._parent.attachedMesh):this.attachedMesh=null},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this.onSnapObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this.dragBehavior.detach(),this._gizmoMesh&&this._gizmoMesh.dispose(),this._rotationDisplayPlane&&this._rotationDisplayPlane.dispose(),this._rotationShaderMaterial&&this._rotationShaderMaterial.dispose(),[this._coloredMaterial,this._hoverMaterial,this._disableMaterial].forEach((function(e){e&&e.dispose()})),e.prototype.dispose.call(this)},t.MaxDragAngle=9*Math.PI/20,t._RotationGizmoVertexShader=\"\\n precision highp float;\\n attribute vec3 position;\\n attribute vec2 uv;\\n uniform mat4 worldViewProjection;\\n varying vec3 vPosition;\\n varying vec2 vUV;\\n void main(void) {\\n gl_Position = worldViewProjection * vec4(position, 1.0);\\n vUV = uv;\\n }\",t._RotationGizmoFragmentShader=\"\\n precision highp float;\\n varying vec2 vUV;\\n varying vec3 vPosition;\\n uniform vec3 angles;\\n #define twopi 6.283185307\\n void main(void) {\\n vec2 uv = vUV - vec2(0.5);\\n float angle = atan(uv.y, uv.x) + 3.141592;\\n float delta = gl_FrontFacing ? angles.y : -angles.y;\\n float begin = angles.x - delta * angles.z;\\n float start = (begin < (begin + delta)) ? begin : (begin + delta);\\n float end = (begin > (begin + delta)) ? begin : (begin + delta);\\n float len = sqrt(dot(uv,uv));\\n float opacity = 1. - step(0.5, len);\\n\\n float base = abs(floor(start / twopi)) * twopi;\\n start += base;\\n end += base;\\n\\n float intensity = 0.;\\n for (int i = 0; i < 5; i++)\\n {\\n intensity += max(step(start, angle) - step(end, angle), 0.);\\n angle += twopi;\\n }\\n gl_FragColor = vec4(1.,1.,0., min(intensity * 0.25, 0.8)) * opacity;\\n }\",t}(Bc),Ap=function(e){function t(t,i,n,r,o,a){void 0===t&&(t=wc.DefaultUtilityLayer),void 0===i&&(i=32),void 0===n&&(n=!1),void 0===r&&(r=1);var s=e.call(this,t)||this;s.onDragStartObservable=new u,s.onDragEndObservable=new u,s._observables=[],s._gizmoAxisCache=new Map;var l=a&&a.xOptions&&a.xOptions.color?a.xOptions.color:N.Red().scale(.5),c=a&&a.yOptions&&a.yOptions.color?a.yOptions.color:N.Green().scale(.5),h=a&&a.zOptions&&a.zOptions.color?a.zOptions.color:N.Blue().scale(.5);return s.xGizmo=new Sp(new x(1,0,0),l,t,i,s,n,r),s.yGizmo=new Sp(new x(0,1,0),c,t,i,s,n,r),s.zGizmo=new Sp(new x(0,0,1),h,t,i,s,n,r),[s.xGizmo,s.yGizmo,s.zGizmo].forEach((function(e){a&&null!=a.updateScale&&(e.updateScale=a.updateScale),e.dragBehavior.onDragStartObservable.add((function(){s.onDragStartObservable.notifyObservers({})})),e.dragBehavior.onDragEndObservable.add((function(){s.onDragEndObservable.notifyObservers({})}))})),s.attachedMesh=null,s.attachedNode=null,o?o.addToAxisCache(s._gizmoAxisCache):Bc.GizmoAxisPointerObserver(t,s._gizmoAxisCache),s}return V(t,e),Object.defineProperty(t.prototype,\"attachedMesh\",{get:function(){return this._meshAttached},set:function(e){this._meshAttached=e,this._nodeAttached=e,this._checkBillboardTransform(),[this.xGizmo,this.yGizmo,this.zGizmo].forEach((function(t){t.isEnabled?t.attachedMesh=e:t.attachedMesh=null}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"attachedNode\",{get:function(){return this._nodeAttached},set:function(e){this._meshAttached=null,this._nodeAttached=e,this._checkBillboardTransform(),[this.xGizmo,this.yGizmo,this.zGizmo].forEach((function(t){t.isEnabled?t.attachedNode=e:t.attachedNode=null}))},enumerable:!1,configurable:!0}),t.prototype._checkBillboardTransform=function(){this._nodeAttached&&this._nodeAttached.billboardMode&&console.log(\"Rotation Gizmo will not work with transforms in billboard mode.\")},Object.defineProperty(t.prototype,\"isHovered\",{get:function(){var e=!1;return[this.xGizmo,this.yGizmo,this.zGizmo].forEach((function(t){e=e||t.isHovered})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"updateGizmoRotationToMatchAttachedMesh\",{get:function(){return this.xGizmo.updateGizmoRotationToMatchAttachedMesh},set:function(e){this.xGizmo&&(this.xGizmo.updateGizmoRotationToMatchAttachedMesh=e,this.yGizmo.updateGizmoRotationToMatchAttachedMesh=e,this.zGizmo.updateGizmoRotationToMatchAttachedMesh=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"snapDistance\",{get:function(){return this.xGizmo.snapDistance},set:function(e){this.xGizmo&&(this.xGizmo.snapDistance=e,this.yGizmo.snapDistance=e,this.zGizmo.snapDistance=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"scaleRatio\",{get:function(){return this.xGizmo.scaleRatio},set:function(e){this.xGizmo&&(this.xGizmo.scaleRatio=e,this.yGizmo.scaleRatio=e,this.zGizmo.scaleRatio=e)},enumerable:!1,configurable:!0}),t.prototype.addToAxisCache=function(e,t){this._gizmoAxisCache.set(e,t)},t.prototype.dispose=function(){var e=this;this.xGizmo.dispose(),this.yGizmo.dispose(),this.zGizmo.dispose(),this.onDragStartObservable.clear(),this.onDragEndObservable.clear(),this._observables.forEach((function(t){e.gizmoLayer.utilityLayerScene.onPointerObservable.remove(t)}))},t.prototype.setCustomMesh=function(){Q.Error(\"Custom meshes are not supported on this gizmo, please set the custom meshes on the gizmos contained within this one (gizmo.xGizmo, gizmo.yGizmo, gizmo.zGizmo)\")},t}(Bc),Rp=function(e){function t(i,n,r,o){void 0===n&&(n=N.Gray()),void 0===r&&(r=wc.DefaultUtilityLayer),void 0===o&&(o=null);var a,s=this;(s=e.call(this,r)||this)._pointerObserver=null,s.snapDistance=0,s.onSnapObservable=new u,s._isEnabled=!1,s._parent=null,s._dragging=!1,s._parent=o,s._coloredMaterial=new Xl(\"\",r.utilityLayerScene),s._coloredMaterial.diffuseColor=n,s._coloredMaterial.specularColor=n.subtract(new N(.1,.1,.1)),s._hoverMaterial=new Xl(\"\",r.utilityLayerScene),s._hoverMaterial.diffuseColor=N.Yellow(),s._disableMaterial=new Xl(\"\",r.utilityLayerScene),s._disableMaterial.diffuseColor=N.Gray(),s._disableMaterial.alpha=.4,s._gizmoMesh=t._CreatePlane(r.utilityLayerScene,s._coloredMaterial),s._gizmoMesh.lookAt(s._rootMesh.position.add(i)),s._gizmoMesh.scaling.scaleInPlace(1/3),s._gizmoMesh.parent=s._rootMesh;var l=0,c=new x,h={snapDistance:0};s.dragBehavior=new bo({dragPlaneNormal:i}),s.dragBehavior.moveAttached=!1,s._rootMesh.addBehavior(s.dragBehavior),s.dragBehavior.onDragObservable.add((function(e){if(s.attachedNode){if(s._handlePivot(),0==s.snapDistance)s.attachedNode.getWorldMatrix().addTranslationFromFloats(e.delta.x,e.delta.y,e.delta.z);else if(l+=e.dragDistance,Math.abs(l)>s.snapDistance){var t=Math.floor(Math.abs(l)/s.snapDistance);l%=s.snapDistance,e.delta.normalizeToRef(c),c.scaleInPlace(s.snapDistance*t),s.attachedNode.getWorldMatrix().addTranslationFromFloats(c.x,c.y,c.z),h.snapDistance=s.snapDistance*t,s.onSnapObservable.notifyObservers(h)}s._matrixChanged()}})),s.dragBehavior.onDragStartObservable.add((function(){s._dragging=!0})),s.dragBehavior.onDragEndObservable.add((function(){s._dragging=!1}));var d=r._getSharedGizmoLight();d.includedOnlyMeshes=d.includedOnlyMeshes.concat(s._rootMesh.getChildMeshes(!1));var p={gizmoMeshes:s._gizmoMesh.getChildMeshes(),colliderMeshes:s._gizmoMesh.getChildMeshes(),material:s._coloredMaterial,hoverMaterial:s._hoverMaterial,disableMaterial:s._disableMaterial,active:!1,dragBehavior:s.dragBehavior};return null===(a=s._parent)||void 0===a||a.addToAxisCache(s._gizmoMesh,p),s._pointerObserver=r.utilityLayerScene.onPointerObservable.add((function(e){var t;if(!s._customMeshSet&&(s._isHovered=!(-1==p.colliderMeshes.indexOf(null===(t=null==e?void 0:e.pickInfo)||void 0===t?void 0:t.pickedMesh)),!s._parent)){var i=p.dragBehavior.enabled?s._isHovered||s._dragging?s._hoverMaterial:s._coloredMaterial:s._disableMaterial;s._setGizmoMeshMaterial(p.gizmoMeshes,i)}})),s.dragBehavior.onEnabledObservable.add((function(e){s._setGizmoMeshMaterial(p.gizmoMeshes,e?s._coloredMaterial:s._disableMaterial)})),s}return V(t,e),t._CreatePlane=function(e,t){var i=new yr(\"plane\",e),n=go(\"dragPlane\",{width:.1375,height:.1375,sideOrientation:2},e);return n.material=t,n.parent=i,i},t.prototype._attachedNodeChanged=function(e){this.dragBehavior&&(this.dragBehavior.enabled=!!e)},Object.defineProperty(t.prototype,\"isEnabled\",{get:function(){return this._isEnabled},set:function(e){this._isEnabled=e,e?this._parent&&(this.attachedNode=this._parent.attachedNode):this.attachedNode=null},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this.onSnapObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this.dragBehavior.detach(),e.prototype.dispose.call(this),this._gizmoMesh&&this._gizmoMesh.dispose(),[this._coloredMaterial,this._hoverMaterial,this._disableMaterial].forEach((function(e){e&&e.dispose()}))},t}(Bc),xp=function(e){function t(t,i,n){void 0===t&&(t=wc.DefaultUtilityLayer),void 0===i&&(i=1);var r=e.call(this,t)||this;return r._meshAttached=null,r._nodeAttached=null,r._observables=[],r._gizmoAxisCache=new Map,r.onDragStartObservable=new u,r.onDragEndObservable=new u,r._planarGizmoEnabled=!1,r.xGizmo=new Uc(new x(1,0,0),N.Red().scale(.5),t,r,i),r.yGizmo=new Uc(new x(0,1,0),N.Green().scale(.5),t,r,i),r.zGizmo=new Uc(new x(0,0,1),N.Blue().scale(.5),t,r,i),r.xPlaneGizmo=new Rp(new x(1,0,0),N.Red().scale(.5),r.gizmoLayer,r),r.yPlaneGizmo=new Rp(new x(0,1,0),N.Green().scale(.5),r.gizmoLayer,r),r.zPlaneGizmo=new Rp(new x(0,0,1),N.Blue().scale(.5),r.gizmoLayer,r),[r.xGizmo,r.yGizmo,r.zGizmo,r.xPlaneGizmo,r.yPlaneGizmo,r.zPlaneGizmo].forEach((function(e){e.dragBehavior.onDragStartObservable.add((function(){r.onDragStartObservable.notifyObservers({})})),e.dragBehavior.onDragEndObservable.add((function(){r.onDragEndObservable.notifyObservers({})}))})),r.attachedMesh=null,n?n.addToAxisCache(r._gizmoAxisCache):Bc.GizmoAxisPointerObserver(t,r._gizmoAxisCache),r}return V(t,e),Object.defineProperty(t.prototype,\"attachedMesh\",{get:function(){return this._meshAttached},set:function(e){this._meshAttached=e,this._nodeAttached=e,[this.xGizmo,this.yGizmo,this.zGizmo,this.xPlaneGizmo,this.yPlaneGizmo,this.zPlaneGizmo].forEach((function(t){t.isEnabled?t.attachedMesh=e:t.attachedMesh=null}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"attachedNode\",{get:function(){return this._nodeAttached},set:function(e){this._meshAttached=null,this._nodeAttached=e,[this.xGizmo,this.yGizmo,this.zGizmo,this.xPlaneGizmo,this.yPlaneGizmo,this.zPlaneGizmo].forEach((function(t){t.isEnabled?t.attachedNode=e:t.attachedNode=null}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"isHovered\",{get:function(){var e=!1;return[this.xGizmo,this.yGizmo,this.zGizmo,this.xPlaneGizmo,this.yPlaneGizmo,this.zPlaneGizmo].forEach((function(t){e=e||t.isHovered})),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"planarGizmoEnabled\",{get:function(){return this._planarGizmoEnabled},set:function(e){var t=this;this._planarGizmoEnabled=e,[this.xPlaneGizmo,this.yPlaneGizmo,this.zPlaneGizmo].forEach((function(i){i&&(i.isEnabled=e,e&&(i.attachedMesh?i.attachedMesh=t.attachedMesh:i.attachedNode=t.attachedNode))}),this)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"updateGizmoRotationToMatchAttachedMesh\",{get:function(){return this._updateGizmoRotationToMatchAttachedMesh},set:function(e){this._updateGizmoRotationToMatchAttachedMesh=e,[this.xGizmo,this.yGizmo,this.zGizmo,this.xPlaneGizmo,this.yPlaneGizmo,this.zPlaneGizmo].forEach((function(t){t&&(t.updateGizmoRotationToMatchAttachedMesh=e)}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"snapDistance\",{get:function(){return this._snapDistance},set:function(e){this._snapDistance=e,[this.xGizmo,this.yGizmo,this.zGizmo,this.xPlaneGizmo,this.yPlaneGizmo,this.zPlaneGizmo].forEach((function(t){t&&(t.snapDistance=e)}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"scaleRatio\",{get:function(){return this._scaleRatio},set:function(e){this._scaleRatio=e,[this.xGizmo,this.yGizmo,this.zGizmo,this.xPlaneGizmo,this.yPlaneGizmo,this.zPlaneGizmo].forEach((function(t){t&&(t.scaleRatio=e)}))},enumerable:!1,configurable:!0}),t.prototype.addToAxisCache=function(e,t){this._gizmoAxisCache.set(e,t)},t.prototype.dispose=function(){var e=this;[this.xGizmo,this.yGizmo,this.zGizmo,this.xPlaneGizmo,this.yPlaneGizmo,this.zPlaneGizmo].forEach((function(e){e&&e.dispose()})),this._observables.forEach((function(t){e.gizmoLayer.utilityLayerScene.onPointerObservable.remove(t)})),this.onDragStartObservable.clear(),this.onDragEndObservable.clear()},t.prototype.setCustomMesh=function(){Q.Error(\"Custom meshes are not supported on this gizmo, please set the custom meshes on the gizmos contained within this one (gizmo.xGizmo, gizmo.yGizmo, gizmo.zGizmo,gizmo.xPlaneGizmo, gizmo.yPlaneGizmo, gizmo.zPlaneGizmo)\")},t}(Bc);function Cp(e){var t=[];t[0]={vertex:[[0,0,1.732051],[1.632993,0,-.5773503],[-.8164966,1.414214,-.5773503],[-.8164966,-1.414214,-.5773503]],face:[[0,1,2],[0,2,3],[0,3,1],[1,3,2]]},t[1]={vertex:[[0,0,1.414214],[1.414214,0,0],[0,1.414214,0],[-1.414214,0,0],[0,-1.414214,0],[0,0,-1.414214]],face:[[0,1,2],[0,2,3],[0,3,4],[0,4,1],[1,4,5],[1,5,2],[2,5,3],[3,5,4]]},t[2]={vertex:[[0,0,1.070466],[.7136442,0,.7978784],[-.3568221,.618034,.7978784],[-.3568221,-.618034,.7978784],[.7978784,.618034,.3568221],[.7978784,-.618034,.3568221],[-.9341724,.381966,.3568221],[.1362939,1,.3568221],[.1362939,-1,.3568221],[-.9341724,-.381966,.3568221],[.9341724,.381966,-.3568221],[.9341724,-.381966,-.3568221],[-.7978784,.618034,-.3568221],[-.1362939,1,-.3568221],[-.1362939,-1,-.3568221],[-.7978784,-.618034,-.3568221],[.3568221,.618034,-.7978784],[.3568221,-.618034,-.7978784],[-.7136442,0,-.7978784],[0,0,-1.070466]],face:[[0,1,4,7,2],[0,2,6,9,3],[0,3,8,5,1],[1,5,11,10,4],[2,7,13,12,6],[3,9,15,14,8],[4,10,16,13,7],[5,8,14,17,11],[6,12,18,15,9],[10,11,17,19,16],[12,13,16,19,18],[14,15,18,19,17]]},t[3]={vertex:[[0,0,1.175571],[1.051462,0,.5257311],[.3249197,1,.5257311],[-.8506508,.618034,.5257311],[-.8506508,-.618034,.5257311],[.3249197,-1,.5257311],[.8506508,.618034,-.5257311],[.8506508,-.618034,-.5257311],[-.3249197,1,-.5257311],[-1.051462,0,-.5257311],[-.3249197,-1,-.5257311],[0,0,-1.175571]],face:[[0,1,2],[0,2,3],[0,3,4],[0,4,5],[0,5,1],[1,5,7],[1,7,6],[1,6,2],[2,6,8],[2,8,3],[3,8,9],[3,9,4],[4,9,10],[4,10,5],[5,10,7],[6,7,11],[6,11,8],[7,10,11],[8,11,9],[9,11,10]]},t[4]={vertex:[[0,0,1.070722],[.7148135,0,.7971752],[-.104682,.7071068,.7971752],[-.6841528,.2071068,.7971752],[-.104682,-.7071068,.7971752],[.6101315,.7071068,.5236279],[1.04156,.2071068,.1367736],[.6101315,-.7071068,.5236279],[-.3574067,1,.1367736],[-.7888348,-.5,.5236279],[-.9368776,.5,.1367736],[-.3574067,-1,.1367736],[.3574067,1,-.1367736],[.9368776,-.5,-.1367736],[.7888348,.5,-.5236279],[.3574067,-1,-.1367736],[-.6101315,.7071068,-.5236279],[-1.04156,-.2071068,-.1367736],[-.6101315,-.7071068,-.5236279],[.104682,.7071068,-.7971752],[.6841528,-.2071068,-.7971752],[.104682,-.7071068,-.7971752],[-.7148135,0,-.7971752],[0,0,-1.070722]],face:[[0,2,3],[1,6,5],[4,9,11],[7,15,13],[8,16,10],[12,14,19],[17,22,18],[20,21,23],[0,1,5,2],[0,3,9,4],[0,4,7,1],[1,7,13,6],[2,5,12,8],[2,8,10,3],[3,10,17,9],[4,11,15,7],[5,6,14,12],[6,13,20,14],[8,12,19,16],[9,17,18,11],[10,16,22,17],[11,18,21,15],[13,15,21,20],[14,20,23,19],[16,19,23,22],[18,22,23,21]]},t[5]={vertex:[[0,0,1.322876],[1.309307,0,.1889822],[-.9819805,.8660254,.1889822],[.1636634,-1.299038,.1889822],[.3273268,.8660254,-.9449112],[-.8183171,-.4330127,-.9449112]],face:[[0,3,1],[2,4,5],[0,1,4,2],[0,2,5,3],[1,3,5,4]]},t[6]={vertex:[[0,0,1.159953],[1.013464,0,.5642542],[-.3501431,.9510565,.5642542],[-.7715208,-.6571639,.5642542],[.6633206,.9510565,-.03144481],[.8682979,-.6571639,-.3996071],[-1.121664,.2938926,-.03144481],[-.2348831,-1.063314,-.3996071],[.5181548,.2938926,-.9953061],[-.5850262,-.112257,-.9953061]],face:[[0,1,4,2],[0,2,6,3],[1,5,8,4],[3,6,9,7],[5,7,9,8],[0,3,7,5,1],[2,4,8,9,6]]},t[7]={vertex:[[0,0,1.118034],[.8944272,0,.6708204],[-.2236068,.8660254,.6708204],[-.7826238,-.4330127,.6708204],[.6708204,.8660254,.2236068],[1.006231,-.4330127,-.2236068],[-1.006231,.4330127,.2236068],[-.6708204,-.8660254,-.2236068],[.7826238,.4330127,-.6708204],[.2236068,-.8660254,-.6708204],[-.8944272,0,-.6708204],[0,0,-1.118034]],face:[[0,1,4,2],[0,2,6,3],[1,5,8,4],[3,6,10,7],[5,9,11,8],[7,10,11,9],[0,3,7,9,5,1],[2,4,8,11,10,6]]},t[8]={vertex:[[-.729665,.670121,.319155],[-.655235,-.29213,-.754096],[-.093922,-.607123,.537818],[.702196,.595691,.485187],[.776626,-.36656,-.588064]],face:[[1,4,2],[0,1,2],[3,0,2],[4,3,2],[4,1,0,3]]},t[9]={vertex:[[-.868849,-.100041,.61257],[-.329458,.976099,.28078],[-.26629,-.013796,-.477654],[-.13392,-1.034115,.229829],[.738834,.707117,-.307018],[.859683,-.535264,-.338508]],face:[[3,0,2],[5,3,2],[4,5,2],[1,4,2],[0,1,2],[0,3,5,4,1]]},t[10]={vertex:[[-.610389,.243975,.531213],[-.187812,-.48795,-.664016],[-.187812,.9759,-.664016],[.187812,-.9759,.664016],[.798201,.243975,.132803]],face:[[1,3,0],[3,4,0],[3,1,4],[0,2,1],[0,4,2],[2,4,1]]},t[11]={vertex:[[-1.028778,.392027,-.048786],[-.640503,-.646161,.621837],[-.125162,-.395663,-.540059],[.004683,.888447,-.651988],[.125161,.395663,.540059],[.632925,-.791376,.433102],[1.031672,.157063,-.354165]],face:[[3,2,0],[2,1,0],[2,5,1],[0,4,3],[0,1,4],[4,1,5],[2,3,6],[3,4,6],[5,2,6],[4,5,6]]},t[12]={vertex:[[-.669867,.334933,-.529576],[-.669867,.334933,.529577],[-.4043,1.212901,0],[-.334933,-.669867,-.529576],[-.334933,-.669867,.529577],[.334933,.669867,-.529576],[.334933,.669867,.529577],[.4043,-1.212901,0],[.669867,-.334933,-.529576],[.669867,-.334933,.529577]],face:[[8,9,7],[6,5,2],[3,8,7],[5,0,2],[4,3,7],[0,1,2],[9,4,7],[1,6,2],[9,8,5,6],[8,3,0,5],[3,4,1,0],[4,9,6,1]]},t[13]={vertex:[[-.931836,.219976,-.264632],[-.636706,.318353,.692816],[-.613483,-.735083,-.264632],[-.326545,.979634,0],[-.318353,-.636706,.692816],[-.159176,.477529,-.856368],[.159176,-.477529,-.856368],[.318353,.636706,.692816],[.326545,-.979634,0],[.613482,.735082,-.264632],[.636706,-.318353,.692816],[.931835,-.219977,-.264632]],face:[[11,10,8],[7,9,3],[6,11,8],[9,5,3],[2,6,8],[5,0,3],[4,2,8],[0,1,3],[10,4,8],[1,7,3],[10,11,9,7],[11,6,5,9],[6,2,0,5],[2,4,1,0],[4,10,7,1]]},t[14]={vertex:[[-.93465,.300459,-.271185],[-.838689,-.260219,-.516017],[-.711319,.717591,.128359],[-.710334,-.156922,.080946],[-.599799,.556003,-.725148],[-.503838,-.004675,-.969981],[-.487004,.26021,.48049],[-.460089,-.750282,-.512622],[-.376468,.973135,-.325605],[-.331735,-.646985,.084342],[-.254001,.831847,.530001],[-.125239,-.494738,-.966586],[.029622,.027949,.730817],[.056536,-.982543,-.262295],[.08085,1.087391,.076037],[.125583,-.532729,.485984],[.262625,.599586,.780328],[.391387,-.726999,-.716259],[.513854,-.868287,.139347],[.597475,.85513,.326364],[.641224,.109523,.783723],[.737185,-.451155,.538891],[.848705,-.612742,-.314616],[.976075,.365067,.32976],[1.072036,-.19561,.084927]],face:[[15,18,21],[12,20,16],[6,10,2],[3,0,1],[9,7,13],[2,8,4,0],[0,4,5,1],[1,5,11,7],[7,11,17,13],[13,17,22,18],[18,22,24,21],[21,24,23,20],[20,23,19,16],[16,19,14,10],[10,14,8,2],[15,9,13,18],[12,15,21,20],[6,12,16,10],[3,6,2,0],[9,3,1,7],[9,15,12,6,3],[22,17,11,5,4,8,14,19,23,24]]};var i,n,r,o,a,s,l=e.type&&(e.type<0||e.type>=t.length)?0:e.type||0,c=e.size,u=e.sizeX||c||1,h=e.sizeY||c||1,d=e.sizeZ||c||1,p=e.custom||t[l],f=p.face.length,_=e.faceUV||new Array(f),m=e.faceColors,g=void 0===e.flat||e.flat,v=0===e.sideOrientation?0:e.sideOrientation||$n.DEFAULTSIDE,y=new Array,b=new Array,T=new Array,E=new Array,S=new Array,A=0,R=0,x=new Array,P=0,M=0;if(g)for(M=0;M0&&e.forEach((function(e,i){t._gizmoAxisCache.set(i,e)}))},e.prototype.dispose=function(){var e,t,i=this;for(var n in this._pointerObservers.forEach((function(e){i._scene.onPointerObservable.remove(e)})),this.gizmos){var r=this.gizmos[n];r&&r.dispose()}this._defaultKeepDepthUtilityLayer!==wc._DefaultKeepDepthUtilityLayer&&(null===(e=this._defaultKeepDepthUtilityLayer)||void 0===e||e.dispose()),this._defaultUtilityLayer!==wc._DefaultUtilityLayer&&(null===(t=this._defaultUtilityLayer)||void 0===t||t.dispose()),this.boundingBoxDragBehavior.detach(),this.onAttachedToMeshObservable.clear()},e}(),Dp=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._needProjectionMatrixCompute=!0,t}return V(t,e),t.prototype._setPosition=function(e){this._position=e},Object.defineProperty(t.prototype,\"position\",{get:function(){return this._position},set:function(e){this._setPosition(e)},enumerable:!1,configurable:!0}),t.prototype._setDirection=function(e){this._direction=e},Object.defineProperty(t.prototype,\"direction\",{get:function(){return this._direction},set:function(e){this._setDirection(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"shadowMinZ\",{get:function(){return this._shadowMinZ},set:function(e){this._shadowMinZ=e,this.forceProjectionMatrixCompute()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"shadowMaxZ\",{get:function(){return this._shadowMaxZ},set:function(e){this._shadowMaxZ=e,this.forceProjectionMatrixCompute()},enumerable:!1,configurable:!0}),t.prototype.computeTransformedInformation=function(){return!(!this.parent||!this.parent.getWorldMatrix||(this.transformedPosition||(this.transformedPosition=x.Zero()),x.TransformCoordinatesToRef(this.position,this.parent.getWorldMatrix(),this.transformedPosition),this.direction&&(this.transformedDirection||(this.transformedDirection=x.Zero()),x.TransformNormalToRef(this.direction,this.parent.getWorldMatrix(),this.transformedDirection)),0))},t.prototype.getDepthScale=function(){return 50},t.prototype.getShadowDirection=function(e){return this.transformedDirection?this.transformedDirection:this.direction},t.prototype.getAbsolutePosition=function(){return this.transformedPosition?this.transformedPosition:this.position},t.prototype.setDirectionToTarget=function(e){return this.direction=x.Normalize(e.subtract(this.position)),this.direction},t.prototype.getRotation=function(){this.direction.normalize();var e=x.Cross(this.direction,vn.Y),t=x.Cross(e,this.direction);return x.RotationFromAxis(e,t,this.direction)},t.prototype.needCube=function(){return!1},t.prototype.needProjectionMatrixCompute=function(){return this._needProjectionMatrixCompute},t.prototype.forceProjectionMatrixCompute=function(){this._needProjectionMatrixCompute=!0},t.prototype._initCache=function(){e.prototype._initCache.call(this),this._cache.position=x.Zero()},t.prototype._isSynchronized=function(){return!!this._cache.position.equals(this.position)},t.prototype.computeWorldMatrix=function(e){return!e&&this.isSynchronized()?(this._currentRenderId=this.getScene().getRenderId(),this._worldMatrix):(this._updateCache(),this._cache.position.copyFrom(this.position),this._worldMatrix||(this._worldMatrix=M.Identity()),M.TranslationToRef(this.position.x,this.position.y,this.position.z,this._worldMatrix),this.parent&&this.parent.getWorldMatrix&&(this._worldMatrix.multiplyToRef(this.parent.getWorldMatrix(),this._worldMatrix),this._markSyncedWithParent()),this._worldMatrixDeterminantIsDirty=!0,this._worldMatrix)},t.prototype.getDepthMinZ=function(e){return void 0!==this.shadowMinZ?this.shadowMinZ:e.minZ},t.prototype.getDepthMaxZ=function(e){return void 0!==this.shadowMaxZ?this.shadowMaxZ:e.maxZ},t.prototype.setShadowProjectionMatrix=function(e,t,i){return this.customProjectionMatrixBuilder?this.customProjectionMatrixBuilder(t,i,e):this._setDefaultShadowProjectionMatrix(e,t,i),this},t.prototype._syncParentEnabledState=function(){e.prototype._syncParentEnabledState.call(this),this.parent&&this.parent.getWorldMatrix||(this.transformedPosition=null,this.transformedDirection=null)},G([Re()],t.prototype,\"position\",null),G([Re()],t.prototype,\"direction\",null),G([be()],t.prototype,\"shadowMinZ\",null),G([be()],t.prototype,\"shadowMaxZ\",null),t}(Cl);Ue.AddNodeConstructor(\"Light_Type_1\",(function(e,t){return function(){return new Np(e,x.Zero(),t)}}));var Np=function(e){function t(t,i,n){var r=e.call(this,t,n)||this;return r._shadowFrustumSize=0,r._shadowOrthoScale=.1,r.autoUpdateExtends=!0,r.autoCalcShadowZBounds=!1,r._orthoLeft=Number.MAX_VALUE,r._orthoRight=Number.MIN_VALUE,r._orthoTop=Number.MIN_VALUE,r._orthoBottom=Number.MAX_VALUE,r.position=i.scale(-1),r.direction=i,r}return V(t,e),Object.defineProperty(t.prototype,\"shadowFrustumSize\",{get:function(){return this._shadowFrustumSize},set:function(e){this._shadowFrustumSize=e,this.forceProjectionMatrixCompute()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"shadowOrthoScale\",{get:function(){return this._shadowOrthoScale},set:function(e){this._shadowOrthoScale=e,this.forceProjectionMatrixCompute()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"orthoLeft\",{get:function(){return this._orthoLeft},set:function(e){this._orthoLeft=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"orthoRight\",{get:function(){return this._orthoRight},set:function(e){this._orthoRight=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"orthoTop\",{get:function(){return this._orthoTop},set:function(e){this._orthoTop=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"orthoBottom\",{get:function(){return this._orthoBottom},set:function(e){this._orthoBottom=e},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return\"DirectionalLight\"},t.prototype.getTypeID=function(){return Cl.LIGHTTYPEID_DIRECTIONALLIGHT},t.prototype._setDefaultShadowProjectionMatrix=function(e,t,i){this.shadowFrustumSize>0?this._setDefaultFixedFrustumShadowProjectionMatrix(e):this._setDefaultAutoExtendShadowProjectionMatrix(e,t,i)},t.prototype._setDefaultFixedFrustumShadowProjectionMatrix=function(e){var t=this.getScene().activeCamera;t&&M.OrthoLHToRef(this.shadowFrustumSize,this.shadowFrustumSize,void 0!==this.shadowMinZ?this.shadowMinZ:t.minZ,void 0!==this.shadowMaxZ?this.shadowMaxZ:t.maxZ,e,this.getScene().getEngine().isNDCHalfZRange)},t.prototype._setDefaultAutoExtendShadowProjectionMatrix=function(e,t,i){var n=this.getScene().activeCamera;if(n){if(this.autoUpdateExtends||this._orthoLeft===Number.MAX_VALUE){var r=x.Zero();this._orthoLeft=Number.MAX_VALUE,this._orthoRight=Number.MIN_VALUE,this._orthoTop=Number.MIN_VALUE,this._orthoBottom=Number.MAX_VALUE;for(var o=Number.MAX_VALUE,a=Number.MIN_VALUE,s=0;sthis._orthoRight&&(this._orthoRight=r.x),r.y>this._orthoTop&&(this._orthoTop=r.y),this.autoCalcShadowZBounds&&(r.za&&(a=r.z))}this.autoCalcShadowZBounds&&(this._shadowMinZ=o,this._shadowMaxZ=a)}var h=this._orthoRight-this._orthoLeft,d=this._orthoTop-this._orthoBottom,p=void 0!==this.shadowMinZ?this.shadowMinZ:n.minZ,f=void 0!==this.shadowMaxZ?this.shadowMaxZ:n.maxZ,_=this.getScene().getEngine().useReverseDepthBuffer;M.OrthoOffCenterLHToRef(this._orthoLeft-h*this.shadowOrthoScale,this._orthoRight+h*this.shadowOrthoScale,this._orthoBottom-d*this.shadowOrthoScale,this._orthoTop+d*this.shadowOrthoScale,_?f:p,_?p:f,e,this.getScene().getEngine().isNDCHalfZRange)}},t.prototype._buildUniformLayout=function(){this._uniformBuffer.addUniform(\"vLightData\",4),this._uniformBuffer.addUniform(\"vLightDiffuse\",4),this._uniformBuffer.addUniform(\"vLightSpecular\",4),this._uniformBuffer.addUniform(\"shadowsInfo\",3),this._uniformBuffer.addUniform(\"depthValues\",2),this._uniformBuffer.create()},t.prototype.transferToEffect=function(e,t){return this.computeTransformedInformation()?(this._uniformBuffer.updateFloat4(\"vLightData\",this.transformedDirection.x,this.transformedDirection.y,this.transformedDirection.z,1,t),this):(this._uniformBuffer.updateFloat4(\"vLightData\",this.direction.x,this.direction.y,this.direction.z,1,t),this)},t.prototype.transferToNodeMaterialEffect=function(e,t){return this.computeTransformedInformation()?(e.setFloat3(t,this.transformedDirection.x,this.transformedDirection.y,this.transformedDirection.z),this):(e.setFloat3(t,this.direction.x,this.direction.y,this.direction.z),this)},t.prototype.getDepthMinZ=function(e){var t=this._scene.getEngine();return!t.useReverseDepthBuffer&&t.isNDCHalfZRange?0:1},t.prototype.getDepthMaxZ=function(e){var t=this._scene.getEngine();return t.useReverseDepthBuffer&&t.isNDCHalfZRange?0:1},t.prototype.prepareLightSpecificDefines=function(e,t){e[\"DIRLIGHT\"+t]=!0},G([be()],t.prototype,\"shadowFrustumSize\",null),G([be()],t.prototype,\"shadowOrthoScale\",null),G([be()],t.prototype,\"autoUpdateExtends\",void 0),G([be()],t.prototype,\"autoCalcShadowZBounds\",void 0),G([be(\"orthoLeft\")],t.prototype,\"_orthoLeft\",void 0),G([be(\"orthoRight\")],t.prototype,\"_orthoRight\",void 0),G([be(\"orthoTop\")],t.prototype,\"_orthoTop\",void 0),G([be(\"orthoBottom\")],t.prototype,\"_orthoBottom\",void 0),t}(Dp);function Lp(e){var t=new Array,i=new Array,n=new Array,r=new Array,o=e.radius||.5,a=e.tessellation||64,s=e.arc&&(e.arc<=0||e.arc>1)?1:e.arc||1,l=0===e.sideOrientation?0:e.sideOrientation||$n.DEFAULTSIDE;t.push(0,0,0),r.push(.5,.5);for(var c=2*Math.PI*s,u=1===s?c/a:c/(a-1),h=0,d=0;d1e-4){var i=this.attachedMesh.forward;this._light.direction=new x(i.x,i.y,i.z),this._cachedForward.copyFrom(this.attachedMesh.forward)}else x.DistanceSquared(this.attachedMesh.forward,this._light.direction)>1e-4&&(this.attachedMesh.setDirection(this._light.direction),this.attachedMesh.computeWorldMatrix(!0),this._cachedForward.copyFrom(this.attachedMesh.forward))}},t.prototype.dispose=function(){this.onClickedObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this._material.dispose(),e.prototype.dispose.call(this),this._attachedMeshParent.dispose()},t._CreateHemisphericLightMesh=function(e){var i=new Ur(\"hemisphereLight\",e),n=Bp(i.name,{segments:10,diameter:1},e);return n.position.z=-.15,n.rotation.x=Math.PI/2,n.parent=i,this._CreateLightLines(3,e).parent=i,i.scaling.scaleInPlace(t._Scale),i.rotation.x=Math.PI/2,i},t._CreatePointLightMesh=function(e){var i=new Ur(\"pointLight\",e),n=jc(i.name,{segments:10,diameter:1},e);return n.rotation.x=Math.PI/2,n.parent=i,this._CreateLightLines(5,e).parent=i,i.scaling.scaleInPlace(t._Scale),i.rotation.x=Math.PI/2,i},t._CreateSpotLightMesh=function(e){var i=new Ur(\"spotLight\",e);jc(i.name,{segments:10,diameter:1},e).parent=i;var n=Bp(i.name,{segments:10,diameter:2},e);return n.parent=i,n.rotation.x=-Math.PI/2,this._CreateLightLines(2,e).parent=i,i.scaling.scaleInPlace(t._Scale),i.rotation.x=Math.PI/2,i},t._CreateDirectionalLightMesh=function(e){var i=new Ur(\"directionalLight\",e),n=new Ur(i.name,e);n.parent=i,jc(i.name,{diameter:1.2,segments:10},e).parent=n;var r=sc(i.name,{updatable:!1,height:6,diameterTop:.3,diameterBottom:.3,tessellation:6,subdivisions:1},e);r.parent=n;var o=r.clone(i.name);o.scaling.y=.5,o.position.x+=1.25;var a=r.clone(i.name);a.scaling.y=.5,a.position.x+=-1.25;var s=sc(i.name,{updatable:!1,height:1,diameterTop:0,diameterBottom:.6,tessellation:6,subdivisions:1},e);return s.position.y+=3,s.parent=n,(o=s.clone(i.name)).position.y=1.5,o.position.x+=1.25,(a=s.clone(i.name)).position.y=1.5,a.position.x+=-1.25,n.scaling.scaleInPlace(t._Scale),n.rotation.z=Math.PI/2,n.rotation.y=Math.PI/2,i},t._Scale=.007,t._CreateLightLines=function(e,t){var i=new Ur(\"root\",t);i.rotation.x=Math.PI/2;var n=new Ur(\"linePivot\",t);n.parent=i;var r=sc(\"line\",{updatable:!1,height:2,diameterTop:.2,diameterBottom:.3,tessellation:6,subdivisions:1},t);if(r.position.y=r.scaling.y/2+1.2,r.parent=n,e<2)return n;for(var o=0;o<4;o++){var a=n.clone(\"lineParentClone\");a.rotation.z=Math.PI/4,a.rotation.y=Math.PI/2+Math.PI/2*o,a.getChildMeshes()[0].scaling.y=.5,a.getChildMeshes()[0].scaling.x=a.getChildMeshes()[0].scaling.z=.8,a.getChildMeshes()[0].position.y=a.getChildMeshes()[0].scaling.y/2+1.2}if(e<3)return i;for(o=0;o<4;o++){var s=n.clone(\"linePivotClone\");s.rotation.z=Math.PI/2,s.rotation.y=Math.PI/2*o}if(e<4)return i;for(o=0;o<4;o++){var l=n.clone(\"linePivotClone\");l.rotation.z=Math.PI+Math.PI/4,l.rotation.y=Math.PI/2+Math.PI/2*o,l.getChildMeshes()[0].scaling.y=.5,l.getChildMeshes()[0].scaling.x=l.getChildMeshes()[0].scaling.z=.8,l.getChildMeshes()[0].position.y=l.getChildMeshes()[0].scaling.y/2+1.2}return e<5||(n.clone(\"linePivotClone\").rotation.z=Math.PI),i},t}(Bc),Gp=function(e){function t(t){void 0===t&&(t=wc.DefaultUtilityLayer);var i=e.call(this,t)||this;return i._pointerObserver=null,i.onClickedObservable=new u,i._camera=null,i._invProjection=new M,i._material=new Xl(\"cameraGizmoMaterial\",i.gizmoLayer.utilityLayerScene),i._material.diffuseColor=new N(.5,.5,.5),i._material.specularColor=new N(.1,.1,.1),i._pointerObserver=t.utilityLayerScene.onPointerObservable.add((function(e){i._camera&&(i._isHovered=!(!e.pickInfo||-1==i._rootMesh.getChildMeshes().indexOf(e.pickInfo.pickedMesh)),i._isHovered&&0===e.event.button&&i.onClickedObservable.notifyObservers(i._camera))}),Hi.POINTERDOWN),i}return V(t,e),Object.defineProperty(t.prototype,\"displayFrustum\",{get:function(){return this._cameraLinesMesh.isEnabled()},set:function(e){this._cameraLinesMesh.setEnabled(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"camera\",{get:function(){return this._camera},set:function(e){var i=this;if(this._camera=e,this.attachedNode=e,e){this._cameraMesh&&this._cameraMesh.dispose(),this._cameraLinesMesh&&this._cameraLinesMesh.dispose(),this._cameraMesh=t._CreateCameraMesh(this.gizmoLayer.utilityLayerScene),this._cameraLinesMesh=t._CreateCameraFrustum(this.gizmoLayer.utilityLayerScene),this._cameraMesh.getChildMeshes(!1).forEach((function(e){e.material=i._material})),this._cameraMesh.parent=this._rootMesh,this._cameraLinesMesh.parent=this._rootMesh,this.gizmoLayer.utilityLayerScene.activeCamera&&this.gizmoLayer.utilityLayerScene.activeCamera.maxZ<1.5*e.maxZ&&(this.gizmoLayer.utilityLayerScene.activeCamera.maxZ=1.5*e.maxZ),this.attachedNode.reservedDataStore||(this.attachedNode.reservedDataStore={}),this.attachedNode.reservedDataStore.cameraGizmo=this;var n=this.gizmoLayer._getSharedGizmoLight();n.includedOnlyMeshes=n.includedOnlyMeshes.concat(this._cameraMesh.getChildMeshes(!1)),this._update()}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"material\",{get:function(){return this._material},enumerable:!1,configurable:!0}),t.prototype._update=function(){e.prototype._update.call(this),this._camera&&(this._camera.getProjectionMatrix().invertToRef(this._invProjection),this._cameraLinesMesh.setPivotMatrix(this._invProjection,!1),this._cameraLinesMesh.scaling.x=1/this._rootMesh.scaling.x,this._cameraLinesMesh.scaling.y=1/this._rootMesh.scaling.y,this._cameraLinesMesh.scaling.z=1/this._rootMesh.scaling.z,this._cameraMesh.parent=null,this._cameraMesh.rotation.y=.5*Math.PI*(this._camera.getScene().useRightHandedSystem?1:-1),this._cameraMesh.parent=this._rootMesh)},t.prototype.dispose=function(){this.onClickedObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this._cameraMesh&&this._cameraMesh.dispose(),this._cameraLinesMesh&&this._cameraLinesMesh.dispose(),this._material.dispose(),e.prototype.dispose.call(this)},t._CreateCameraMesh=function(e){var i=new Ur(\"rootCameraGizmo\",e),n=new Ur(i.name,e);n.parent=i,Wc(i.name,{width:1,height:.8,depth:.5},e).parent=n;var r=sc(i.name,{height:.5,diameterTop:.8,diameterBottom:.8},e);r.parent=n,r.position.y=.3,r.position.x=-.6,r.rotation.x=.5*Math.PI;var o=sc(i.name,{height:.5,diameterTop:.6,diameterBottom:.6},e);o.parent=n,o.position.y=.5,o.position.x=.4,o.rotation.x=.5*Math.PI;var a=sc(i.name,{height:.5,diameterTop:.5,diameterBottom:.5},e);return a.parent=n,a.position.y=0,a.position.x=.6,a.rotation.z=.5*Math.PI,i.scaling.scaleInPlace(t._Scale),n.position.x=-.9,i},t._CreateCameraFrustum=function(e){var t=new Ur(\"rootCameraGizmo\",e),i=new Ur(t.name,e);i.parent=t;for(var n=0;n<4;n+=2)for(var r=0;r<4;r+=2){var o=au(\"lines\",{points:[new x(-1+r,-1+n,-1),new x(-1+r,-1+n,1)]},e);o.parent=i,o.alwaysSelectAsActiveMesh=!0,o.isPickable=!1,(o=au(\"lines\",{points:[new x(-1,-1+r,-1+n),new x(1,-1+r,-1+n)]},e)).parent=i,o.alwaysSelectAsActiveMesh=!0,o.isPickable=!1,(o=au(\"lines\",{points:[new x(-1+r,-1,-1+n),new x(-1+r,1,-1+n)]},e)).parent=i,o.alwaysSelectAsActiveMesh=!0,o.isPickable=!1}return t},t._Scale=.05,t}(Bc);It.IncludesShadersStore.kernelBlurVaryingDeclaration=\"varying vec2 sampleCoord{X};\";It.IncludesShadersStore.packingFunctions=\"vec4 pack(float depth)\\n{\\nconst vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);\\nconst vec4 bit_mask=vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);\\nvec4 res=fract(depth*bit_shift);\\nres-=res.xxyz*bit_mask;\\nreturn res;\\n}\\nfloat unpack(vec4 color)\\n{\\nconst vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);\\nreturn dot(color,bit_shift);\\n}\";It.IncludesShadersStore.kernelBlurFragment=\"#ifdef DOF\\nfactor=sampleCoC(sampleCoord{X}); \\ncomputedWeight=KERNEL_WEIGHT{X}*factor;\\nsumOfWeights+=computedWeight;\\n#else\\ncomputedWeight=KERNEL_WEIGHT{X};\\n#endif\\n#ifdef PACKEDFLOAT\\nblend+=unpack(texture2D(textureSampler,sampleCoord{X}))*computedWeight;\\n#else\\nblend+=texture2D(textureSampler,sampleCoord{X})*computedWeight;\\n#endif\\n\";It.IncludesShadersStore.kernelBlurFragment2=\"#ifdef DOF\\nfactor=sampleCoC(sampleCenter+delta*KERNEL_DEP_OFFSET{X});\\ncomputedWeight=KERNEL_DEP_WEIGHT{X}*factor;\\nsumOfWeights+=computedWeight;\\n#else\\ncomputedWeight=KERNEL_DEP_WEIGHT{X};\\n#endif\\n#ifdef PACKEDFLOAT\\nblend+=unpack(texture2D(textureSampler,sampleCenter+delta*KERNEL_DEP_OFFSET{X}))*computedWeight;\\n#else\\nblend+=texture2D(textureSampler,sampleCenter+delta*KERNEL_DEP_OFFSET{X})*computedWeight;\\n#endif\\n\";It.ShadersStore.kernelBlurPixelShader=\"uniform sampler2D textureSampler;\\nuniform vec2 delta;\\nvarying vec2 sampleCenter;\\n#ifdef DOF\\nuniform sampler2D circleOfConfusionSampler;\\nuniform vec2 cameraMinMaxZ;\\nfloat sampleDistance(in vec2 offset) {\\nfloat depth=texture2D(circleOfConfusionSampler,offset).g; \\nreturn cameraMinMaxZ.x+(cameraMinMaxZ.y-cameraMinMaxZ.x)*depth; \\n}\\nfloat sampleCoC(in vec2 offset) {\\nfloat coc=texture2D(circleOfConfusionSampler,offset).r; \\nreturn coc; \\n}\\n#endif\\n#include[0..varyingCount]\\n#ifdef PACKEDFLOAT\\n#include\\n#endif\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void)\\n{\\nfloat computedWeight=0.0;\\n#ifdef PACKEDFLOAT \\nfloat blend=0.;\\n#else\\nvec4 blend=vec4(0.);\\n#endif\\n#ifdef DOF\\nfloat sumOfWeights=CENTER_WEIGHT; \\nfloat factor=0.0;\\n#ifdef PACKEDFLOAT\\nblend+=unpack(texture2D(textureSampler,sampleCenter))*CENTER_WEIGHT;\\n#else\\nblend+=texture2D(textureSampler,sampleCenter)*CENTER_WEIGHT;\\n#endif\\n#endif\\n#include[0..varyingCount]\\n#include[0..depCount]\\n#ifdef PACKEDFLOAT\\ngl_FragColor=pack(blend);\\n#else\\ngl_FragColor=blend;\\n#endif\\n#ifdef DOF\\ngl_FragColor/=sumOfWeights;\\n#endif\\n}\";It.IncludesShadersStore.kernelBlurVertex=\"sampleCoord{X}=sampleCenter+delta*KERNEL_OFFSET{X};\";It.ShadersStore.kernelBlurVertexShader=\"attribute vec2 position;\\nuniform vec2 delta;\\nvarying vec2 sampleCenter;\\n#include[0..varyingCount]\\nconst vec2 madd=vec2(0.5,0.5);\\n#define CUSTOM_VERTEX_DEFINITIONS\\nvoid main(void) {\\n#define CUSTOM_VERTEX_MAIN_BEGIN\\nsampleCenter=(position*madd+madd);\\n#include[0..varyingCount]\\ngl_Position=vec4(position,0.0,1.0);\\n#define CUSTOM_VERTEX_MAIN_END\\n}\";var zp=function(e){function t(t,i,n,r,o,s,l,c,u,h,d){void 0===s&&(s=to.BILINEAR_SAMPLINGMODE),void 0===u&&(u=a.TEXTURETYPE_UNSIGNED_INT),void 0===h&&(h=\"\"),void 0===d&&(d=!1);var p=e.call(this,t,\"kernelBlur\",[\"delta\",\"direction\",\"cameraMinMaxZ\"],[\"circleOfConfusionSampler\"],r,o,s,l,c,null,u,\"kernelBlur\",{varyingCount:0,depCount:0},!0)||this;return p._blockCompilation=d,p._packedFloat=!1,p._staticDefines=\"\",p._staticDefines=h,p.direction=i,p.onApplyObservable.add((function(e){p._outputTexture?e.setFloat2(\"delta\",1/p._outputTexture.width*p.direction.x,1/p._outputTexture.height*p.direction.y):e.setFloat2(\"delta\",1/p.width*p.direction.x,1/p.height*p.direction.y)})),p.kernel=n,p}return V(t,e),Object.defineProperty(t.prototype,\"kernel\",{get:function(){return this._idealKernel},set:function(e){this._idealKernel!==e&&(e=Math.max(e,1),this._idealKernel=e,this._kernel=this._nearestBestKernel(e),this._blockCompilation||this._updateParameters())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"packedFloat\",{get:function(){return this._packedFloat},set:function(e){this._packedFloat!==e&&(this._packedFloat=e,this._blockCompilation||this._updateParameters())},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return\"BlurPostProcess\"},t.prototype.updateEffect=function(e,t,i,n,r,o){void 0===e&&(e=null),void 0===t&&(t=null),void 0===i&&(i=null),this._updateParameters(r,o)},t.prototype._updateParameters=function(t,i){for(var n=this._kernel,r=(n-1)/2,o=[],a=[],s=0,l=0;l0)return Math.max(r,3)}return Math.max(t,3)},t.prototype._gaussianWeight=function(e){var t=1/3,i=-e*e/(2*t*t);return 1/(Math.sqrt(2*Math.PI)*t)*Math.exp(i)},t.prototype._glslFloat=function(e,t){return void 0===t&&(t=8),e.toFixed(t).replace(/0+$/,\"\")},t._Parse=function(e,i,n,r){return Le.Parse((function(){return new t(e.name,e.direction,e.kernel,e.options,i,e.renderTargetSamplingMode,n.getEngine(),e.reusable,e.textureType,void 0,!1)}),e,n,r)},G([be(\"kernel\")],t.prototype,\"_kernel\",void 0),G([be(\"packedFloat\")],t.prototype,\"_packedFloat\",void 0),G([Ae()],t.prototype,\"direction\",void 0),t}(pa);b(\"BABYLON.BlurPostProcess\",zp);var Wp=function(e){function t(t,i,n,r,o,s,l){void 0===o&&(o=a.TEXTURETYPE_UNSIGNED_INT),void 0===s&&(s=to.BILINEAR_SAMPLINGMODE),void 0===l&&(l=!0);var c=e.call(this,t,i,n,r,!0,o,!1,s,l)||this;if(c.mirrorPlane=new un(0,1,0,1),c._transformMatrix=M.Zero(),c._mirrorMatrix=M.Zero(),c._adaptiveBlurKernel=0,c._blurKernelX=0,c._blurKernelY=0,c._blurRatio=1,!(n=c.getScene()))return c;c.ignoreCameraViewport=!0,c._updateGammaSpace(),c._imageProcessingConfigChangeObserver=n.imageProcessingConfiguration.onUpdateParameters.add((function(){c._updateGammaSpace()}));var u,h=n.getEngine();return h.supportsUniformBuffers&&(c._sceneUBO=n.createSceneUniformBuffer('Scene for Mirror Texture (name \"'.concat(t,'\")'))),c.onBeforeBindObservable.add((function(){var e;null===(e=h._debugPushGroup)||void 0===e||e.call(h,\"mirror generation for \".concat(t),1)})),c.onAfterUnbindObservable.add((function(){var e;null===(e=h._debugPopGroup)||void 0===e||e.call(h,1)})),c.onBeforeRenderObservable.add((function(){c._sceneUBO&&(c._currentSceneUBO=n.getSceneUniformBuffer(),n.setSceneUniformBuffer(c._sceneUBO),n.getSceneUniformBuffer().unbindEffect()),M.ReflectionToRef(c.mirrorPlane,c._mirrorMatrix),c._mirrorMatrix.multiplyToRef(n.getViewMatrix(),c._transformMatrix),n.setTransformMatrix(c._transformMatrix,n.getProjectionMatrix()),u=n.clipPlane,n.clipPlane=c.mirrorPlane,n.getEngine().cullBackFaces=!1,n._mirroredCameraPosition=x.TransformCoordinates(n.activeCamera.globalPosition,c._mirrorMatrix)})),c.onAfterRenderObservable.add((function(){c._sceneUBO&&n.setSceneUniformBuffer(c._currentSceneUBO),n.updateTransformMatrix(),n.getEngine().cullBackFaces=null,n._mirroredCameraPosition=null,n.clipPlane=u})),c}return V(t,e),Object.defineProperty(t.prototype,\"blurRatio\",{get:function(){return this._blurRatio},set:function(e){this._blurRatio!==e&&(this._blurRatio=e,this._preparePostProcesses())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"adaptiveBlurKernel\",{set:function(e){this._adaptiveBlurKernel=e,this._autoComputeBlurKernel()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"blurKernel\",{set:function(e){this.blurKernelX=e,this.blurKernelY=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"blurKernelX\",{get:function(){return this._blurKernelX},set:function(e){this._blurKernelX!==e&&(this._blurKernelX=e,this._preparePostProcesses())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"blurKernelY\",{get:function(){return this._blurKernelY},set:function(e){this._blurKernelY!==e&&(this._blurKernelY=e,this._preparePostProcesses())},enumerable:!1,configurable:!0}),t.prototype._autoComputeBlurKernel=function(){var e=this.getScene().getEngine(),t=this.getRenderWidth()/e.getRenderWidth(),i=this.getRenderHeight()/e.getRenderHeight();this.blurKernelX=this._adaptiveBlurKernel*t,this.blurKernelY=this._adaptiveBlurKernel*i},t.prototype._onRatioRescale=function(){this._sizeRatio&&(this.resize(this._initialSizeParameter),this._adaptiveBlurKernel||this._preparePostProcesses()),this._adaptiveBlurKernel&&this._autoComputeBlurKernel()},t.prototype._updateGammaSpace=function(){var e=this.getScene();e&&(this.gammaSpace=!e.imageProcessingConfiguration.isEnabled||!e.imageProcessingConfiguration.applyByPostProcess)},t.prototype._preparePostProcesses=function(){if(this.clearPostProcesses(!0),this._blurKernelX&&this._blurKernelY){var e=this.getScene().getEngine(),t=e.getCaps().textureFloatRender&&e.getCaps().textureFloatLinearFiltering?a.TEXTURETYPE_FLOAT:a.TEXTURETYPE_HALF_FLOAT;this._blurX=new zp(\"horizontal blur\",new R(1,0),this._blurKernelX,this._blurRatio,null,to.BILINEAR_SAMPLINGMODE,e,!1,t),this._blurX.autoClear=!1,1===this._blurRatio&&this.samples<2&&this._texture?this._blurX.inputTexture=this._renderTarget:this._blurX.alwaysForcePOT=!0,this._blurY=new zp(\"vertical blur\",new R(0,1),this._blurKernelY,this._blurRatio,null,to.BILINEAR_SAMPLINGMODE,e,!1,t),this._blurY.autoClear=!1,this._blurY.alwaysForcePOT=1!==this._blurRatio,this.addPostProcess(this._blurX),this.addPostProcess(this._blurY)}else this._blurY&&(this.removePostProcess(this._blurY),this._blurY.dispose(),this._blurY=null),this._blurX&&(this.removePostProcess(this._blurX),this._blurX.dispose(),this._blurX=null)},t.prototype.clone=function(){var e=this.getScene();if(!e)return this;var i=this.getSize(),n=new t(this.name,i.width,e,this._renderTargetOptions.generateMipMaps,this._renderTargetOptions.type,this._renderTargetOptions.samplingMode,this._renderTargetOptions.generateDepthBuffer);return n.hasAlpha=this.hasAlpha,n.level=this.level,n.mirrorPlane=this.mirrorPlane.clone(),this.renderList&&(n.renderList=this.renderList.slice(0)),n},t.prototype.serialize=function(){if(!this.name)return null;var t=e.prototype.serialize.call(this);return t.mirrorPlane=this.mirrorPlane.asArray(),t},t.prototype.dispose=function(){var t;e.prototype.dispose.call(this);var i=this.getScene();i&&i.imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingConfigChangeObserver),null===(t=this._sceneUBO)||void 0===t||t.dispose()},t}(Ia);to._CreateMirror=function(e,t,i,n){return new Wp(e,t,i,n)};var Hp=function(e){function t(t,i,n,r,o,s,l,c,h,d,p,f,_,m,g){void 0===n&&(n=null),void 0===r&&(r=!1),void 0===o&&(o=null),void 0===s&&(s=null),void 0===l&&(l=null),void 0===c&&(c=a.TEXTUREFORMAT_RGBA),void 0===h&&(h=!1),void 0===d&&(d=null),void 0===p&&(p=!1),void 0===f&&(f=.8),void 0===_&&(_=0);var v,y=this;return(y=e.call(this,i)||this)._lodScale=.8,y._lodOffset=0,y.onLoadObservable=new u,y.boundingBoxPosition=x.Zero(),y._rotationY=0,y._files=null,y._forcedExtension=null,y._extensions=null,y.name=t,y.url=t,y._noMipmap=r,y.hasAlpha=!1,y._format=c,y.isCube=!0,y._textureMatrix=M.Identity(),y._createPolynomials=p,y.coordinatesMode=to.CUBIC_MODE,y._extensions=n,y._files=o,y._forcedExtension=d,y._loaderOptions=m,y._useSRGBBuffer=g,y._lodScale=f,y._lodOffset=_,t||o?(y.updateURL(t,d,s,h,l,n,null===(v=y.getScene())||void 0===v?void 0:v.useDelayedTextureLoading,o),y):y}return V(t,e),Object.defineProperty(t.prototype,\"boundingBoxSize\",{get:function(){return this._boundingBoxSize},set:function(e){if(!this._boundingBoxSize||!this._boundingBoxSize.equals(e)){this._boundingBoxSize=e;var t=this.getScene();t&&t.markAllMaterialsAsDirty(a.MATERIAL_TextureDirtyFlag)}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"rotationY\",{get:function(){return this._rotationY},set:function(e){this._rotationY=e,this.setReflectionTextureMatrix(M.RotationY(this._rotationY))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"noMipmap\",{get:function(){return this._noMipmap},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"forcedExtension\",{get:function(){return this._forcedExtension},enumerable:!1,configurable:!0}),t.CreateFromImages=function(e,i,n){var r=\"\";return e.forEach((function(e){return r+=e})),new t(r,i,null,n,e)},t.CreateFromPrefilteredData=function(e,i,n,r){void 0===n&&(n=null),void 0===r&&(r=!0);var o=i.useDelayedTextureLoading;i.useDelayedTextureLoading=!1;var a=new t(e,i,null,!1,null,null,null,void 0,!0,n,r);return i.useDelayedTextureLoading=o,a},t.prototype.getClassName=function(){return\"CubeTexture\"},t.prototype.updateURL=function(e,t,i,n,r,o,s,l){void 0===i&&(i=null),void 0===n&&(n=!1),void 0===r&&(r=null),void 0===o&&(o=null),void 0===s&&(s=!1),void 0===l&&(l=null),this.name&&!this.name.startsWith(\"data:\")||(this.name=e),this.url=e,t&&(this._forcedExtension=t);var c=e.lastIndexOf(\".\"),u=t||(c>-1?e.substring(c).toLowerCase():\"\"),h=0===u.indexOf(\".dds\"),d=0===u.indexOf(\".env\"),p=0===u.indexOf(\".basis\");if(d?(this.gammaSpace=!1,this._prefiltered=!1,this.anisotropicFilteringLevel=1):(this._prefiltered=n,n&&(this.gammaSpace=!1,this.anisotropicFilteringLevel=1)),l)this._files=l;else if(p||d||h||o||(o=[\"_px.jpg\",\"_py.jpg\",\"_pz.jpg\",\"_nx.jpg\",\"_ny.jpg\",\"_nz.jpg\"]),this._files=this._files||[],this._files.length=0,o){for(var f=0;f\\n\";It.ShadersStore.backgroundPixelShader=\"#ifdef TEXTURELODSUPPORT\\n#extension GL_EXT_shader_texture_lod : enable\\n#endif\\nprecision highp float;\\n#include<__decl__backgroundFragment>\\n#include\\n#define RECIPROCAL_PI2 0.15915494\\nvarying vec3 vPositionW;\\n#ifdef MAINUV1\\nvarying vec2 vMainUV1;\\n#endif \\n#ifdef MAINUV2 \\nvarying vec2 vMainUV2; \\n#endif \\n#ifdef NORMAL\\nvarying vec3 vNormalW;\\n#endif\\n#ifdef DIFFUSE\\n#if DIFFUSEDIRECTUV==1\\n#define vDiffuseUV vMainUV1\\n#elif DIFFUSEDIRECTUV==2\\n#define vDiffuseUV vMainUV2\\n#else\\nvarying vec2 vDiffuseUV;\\n#endif\\nuniform sampler2D diffuseSampler;\\n#endif\\n#ifdef REFLECTION\\n#ifdef REFLECTIONMAP_3D\\n#define sampleReflection(s,c) textureCube(s,c)\\nuniform samplerCube reflectionSampler;\\n#ifdef TEXTURELODSUPPORT\\n#define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l)\\n#else\\nuniform samplerCube reflectionSamplerLow;\\nuniform samplerCube reflectionSamplerHigh;\\n#endif\\n#else\\n#define sampleReflection(s,c) texture2D(s,c)\\nuniform sampler2D reflectionSampler;\\n#ifdef TEXTURELODSUPPORT\\n#define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l)\\n#else\\nuniform samplerCube reflectionSamplerLow;\\nuniform samplerCube reflectionSamplerHigh;\\n#endif\\n#endif\\n#ifdef REFLECTIONMAP_SKYBOX\\nvarying vec3 vPositionUVW;\\n#else\\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\\nvarying vec3 vDirectionW;\\n#endif\\n#endif\\n#include\\n#endif\\n#ifndef FROMLINEARSPACE\\n#define FROMLINEARSPACE;\\n#endif\\n#ifndef SHADOWONLY\\n#define SHADOWONLY;\\n#endif\\n#include\\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\\n#include\\n#include\\n#include\\n#include\\n#include\\n#ifdef REFLECTIONFRESNEL\\n#define FRESNEL_MAXIMUM_ON_ROUGH 0.25\\nvec3 fresnelSchlickEnvironmentGGX(float VdotN,vec3 reflectance0,vec3 reflectance90,float smoothness)\\n{\\nfloat weight=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);\\nreturn reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));\\n}\\n#endif\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void) {\\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\\n#include\\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\\n#ifdef NORMAL\\nvec3 normalW=normalize(vNormalW);\\n#else\\nvec3 normalW=vec3(0.0,1.0,0.0);\\n#endif\\nfloat shadow=1.;\\nfloat globalShadow=0.;\\nfloat shadowLightCount=0.;\\n#include[0..maxSimultaneousLights]\\n#ifdef SHADOWINUSE\\nglobalShadow/=shadowLightCount;\\n#else\\nglobalShadow=1.0;\\n#endif\\n#ifndef BACKMAT_SHADOWONLY\\nvec4 reflectionColor=vec4(1.,1.,1.,1.);\\n#ifdef REFLECTION\\nvec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\\n#ifdef REFLECTIONMAP_OPPOSITEZ\\nreflectionVector.z*=-1.0;\\n#endif\\n#ifdef REFLECTIONMAP_3D\\nvec3 reflectionCoords=reflectionVector;\\n#else\\nvec2 reflectionCoords=reflectionVector.xy;\\n#ifdef REFLECTIONMAP_PROJECTION\\nreflectionCoords/=reflectionVector.z;\\n#endif\\nreflectionCoords.y=1.0-reflectionCoords.y;\\n#endif\\n#ifdef REFLECTIONBLUR\\nfloat reflectionLOD=vReflectionInfos.y;\\n#ifdef TEXTURELODSUPPORT\\nreflectionLOD=reflectionLOD*log2(vReflectionMicrosurfaceInfos.x)*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;\\nreflectionColor=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD);\\n#else\\nfloat lodReflectionNormalized=saturate(reflectionLOD);\\nfloat lodReflectionNormalizedDoubled=lodReflectionNormalized*2.0;\\nvec4 reflectionSpecularMid=sampleReflection(reflectionSampler,reflectionCoords);\\nif(lodReflectionNormalizedDoubled<1.0){\\nreflectionColor=mix(\\nsampleReflection(reflectionSamplerHigh,reflectionCoords),\\nreflectionSpecularMid,\\nlodReflectionNormalizedDoubled\\n);\\n} else {\\nreflectionColor=mix(\\nreflectionSpecularMid,\\nsampleReflection(reflectionSamplerLow,reflectionCoords),\\nlodReflectionNormalizedDoubled-1.0\\n);\\n}\\n#endif\\n#else\\nvec4 reflectionSample=sampleReflection(reflectionSampler,reflectionCoords);\\nreflectionColor=reflectionSample;\\n#endif\\n#ifdef RGBDREFLECTION\\nreflectionColor.rgb=fromRGBD(reflectionColor);\\n#endif\\n#ifdef GAMMAREFLECTION\\nreflectionColor.rgb=toLinearSpace(reflectionColor.rgb);\\n#endif\\n#ifdef REFLECTIONBGR\\nreflectionColor.rgb=reflectionColor.bgr;\\n#endif\\nreflectionColor.rgb*=vReflectionInfos.x;\\n#endif\\nvec3 diffuseColor=vec3(1.,1.,1.);\\nfloat finalAlpha=alpha;\\n#ifdef DIFFUSE\\nvec4 diffuseMap=texture2D(diffuseSampler,vDiffuseUV);\\n#ifdef GAMMADIFFUSE\\ndiffuseMap.rgb=toLinearSpace(diffuseMap.rgb);\\n#endif\\ndiffuseMap.rgb*=vDiffuseInfos.y;\\n#ifdef DIFFUSEHASALPHA\\nfinalAlpha*=diffuseMap.a;\\n#endif\\ndiffuseColor=diffuseMap.rgb;\\n#endif\\n#ifdef REFLECTIONFRESNEL\\nvec3 colorBase=diffuseColor;\\n#else\\nvec3 colorBase=reflectionColor.rgb*diffuseColor;\\n#endif\\ncolorBase=max(colorBase,0.0);\\n#ifdef USERGBCOLOR\\nvec3 finalColor=colorBase;\\n#else\\n#ifdef USEHIGHLIGHTANDSHADOWCOLORS\\nvec3 mainColor=mix(vPrimaryColorShadow.rgb,vPrimaryColor.rgb,colorBase);\\n#else\\nvec3 mainColor=vPrimaryColor.rgb;\\n#endif\\nvec3 finalColor=colorBase*mainColor;\\n#endif\\n#ifdef REFLECTIONFRESNEL\\nvec3 reflectionAmount=vReflectionControl.xxx;\\nvec3 reflectionReflectance0=vReflectionControl.yyy;\\nvec3 reflectionReflectance90=vReflectionControl.zzz;\\nfloat VdotN=dot(normalize(vEyePosition.xyz),normalW);\\nvec3 planarReflectionFresnel=fresnelSchlickEnvironmentGGX(saturate(VdotN),reflectionReflectance0,reflectionReflectance90,1.0);\\nreflectionAmount*=planarReflectionFresnel;\\n#ifdef REFLECTIONFALLOFF\\nfloat reflectionDistanceFalloff=1.0-saturate(length(vPositionW.xyz-vBackgroundCenter)*vReflectionControl.w);\\nreflectionDistanceFalloff*=reflectionDistanceFalloff;\\nreflectionAmount*=reflectionDistanceFalloff;\\n#endif\\nfinalColor=mix(finalColor,reflectionColor.rgb,saturate(reflectionAmount));\\n#endif\\n#ifdef OPACITYFRESNEL\\nfloat viewAngleToFloor=dot(normalW,normalize(vEyePosition.xyz-vBackgroundCenter));\\nconst float startAngle=0.1;\\nfloat fadeFactor=saturate(viewAngleToFloor/startAngle);\\nfinalAlpha*=fadeFactor*fadeFactor;\\n#endif\\n#ifdef SHADOWINUSE\\nfinalColor=mix(finalColor*shadowLevel,finalColor,globalShadow);\\n#endif\\nvec4 color=vec4(finalColor,finalAlpha);\\n#else\\nvec4 color=vec4(vPrimaryColor.rgb,(1.0-clamp(globalShadow,0.,1.))*alpha);\\n#endif\\n#include\\n#ifdef IMAGEPROCESSINGPOSTPROCESS\\n#if !defined(SKIPFINALCOLORCLAMP)\\ncolor.rgb=clamp(color.rgb,0.,30.0);\\n#endif\\n#else\\ncolor=applyImageProcessing(color);\\n#endif\\n#ifdef PREMULTIPLYALPHA\\ncolor.rgb*=color.a;\\n#endif\\n#ifdef NOISE\\ncolor.rgb+=dither(vPositionW.xy,0.5);\\ncolor=max(color,0.0);\\n#endif\\ngl_FragColor=color;\\n#define CUSTOM_FRAGMENT_MAIN_END\\n}\\n\";It.IncludesShadersStore.backgroundVertexDeclaration=\"uniform mat4 view;\\nuniform mat4 viewProjection;\\nuniform float shadowLevel;\\n#ifdef DIFFUSE\\nuniform mat4 diffuseMatrix;\\nuniform vec2 vDiffuseInfos;\\n#endif\\n#ifdef REFLECTION\\nuniform vec2 vReflectionInfos;\\nuniform mat4 reflectionMatrix;\\nuniform vec3 vReflectionMicrosurfaceInfos;\\nuniform float fFovMultiplier;\\n#endif\\n#ifdef POINTSIZE\\nuniform float pointSize;\\n#endif\\n\";It.ShadersStore.backgroundVertexShader=\"precision highp float;\\n#include<__decl__backgroundVertex>\\n#include\\nattribute vec3 position;\\n#ifdef NORMAL\\nattribute vec3 normal;\\n#endif\\n#include\\n#include\\n#include\\nvarying vec3 vPositionW;\\n#ifdef NORMAL\\nvarying vec3 vNormalW;\\n#endif\\n#ifdef UV1\\nattribute vec2 uv;\\n#endif\\n#ifdef UV2\\nattribute vec2 uv2;\\n#endif\\n#ifdef MAINUV1\\nvarying vec2 vMainUV1;\\n#endif\\n#ifdef MAINUV2\\nvarying vec2 vMainUV2;\\n#endif\\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV==0\\nvarying vec2 vDiffuseUV;\\n#endif\\n#include\\n#include\\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\\n#ifdef REFLECTIONMAP_SKYBOX\\nvarying vec3 vPositionUVW;\\n#endif\\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\\nvarying vec3 vDirectionW;\\n#endif\\n#define CUSTOM_VERTEX_DEFINITIONS\\nvoid main(void) {\\n#define CUSTOM_VERTEX_MAIN_BEGIN\\n#ifdef REFLECTIONMAP_SKYBOX\\nvPositionUVW=position;\\n#endif\\n#include\\n#include\\n#include\\n#ifdef MULTIVIEW\\nif (gl_ViewID_OVR==0u) {\\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\\n} else {\\ngl_Position=viewProjectionR*finalWorld*vec4(position,1.0);\\n}\\n#else\\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\\n#endif\\nvec4 worldPos=finalWorld*vec4(position,1.0);\\nvPositionW=vec3(worldPos);\\n#ifdef NORMAL\\nmat3 normalWorld=mat3(finalWorld);\\n#ifdef NONUNIFORMSCALING\\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\\n#endif\\nvNormalW=normalize(normalWorld*normal);\\n#endif\\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\\nvDirectionW=normalize(vec3(finalWorld*vec4(position,0.0)));\\n#ifdef EQUIRECTANGULAR_RELFECTION_FOV\\nmat3 screenToWorld=inverseMat3(mat3(finalWorld*viewProjection));\\nvec3 segment=mix(vDirectionW,screenToWorld*vec3(0.0,0.0,1.0),abs(fFovMultiplier-1.0));\\nif (fFovMultiplier<=1.0) {\\nvDirectionW=normalize(segment);\\n} else {\\nvDirectionW=normalize(vDirectionW+(vDirectionW-segment));\\n}\\n#endif\\n#endif\\n#ifndef UV1\\nvec2 uv=vec2(0.,0.);\\n#endif\\n#ifndef UV2\\nvec2 uv2=vec2(0.,0.);\\n#endif\\n#ifdef MAINUV1\\nvMainUV1=uv;\\n#endif\\n#ifdef MAINUV2\\nvMainUV2=uv2;\\n#endif\\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV==0\\nif (vDiffuseInfos.x==0.)\\n{\\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\\n}\\nelse\\n{\\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\\n}\\n#endif\\n#include\\n#include\\n#include[0..maxSimultaneousLights]\\n#ifdef VERTEXCOLOR\\nvColor=color;\\n#endif\\n#if defined(POINTSIZE) && !defined(WEBGPU)\\ngl_PointSize=pointSize;\\n#endif\\n#define CUSTOM_VERTEX_MAIN_END\\n}\\n\";var Xp=function(e){function t(){var t=e.call(this)||this;return t.DIFFUSE=!1,t.DIFFUSEDIRECTUV=0,t.GAMMADIFFUSE=!1,t.DIFFUSEHASALPHA=!1,t.OPACITYFRESNEL=!1,t.REFLECTIONBLUR=!1,t.REFLECTIONFRESNEL=!1,t.REFLECTIONFALLOFF=!1,t.TEXTURELODSUPPORT=!1,t.PREMULTIPLYALPHA=!1,t.USERGBCOLOR=!1,t.USEHIGHLIGHTANDSHADOWCOLORS=!1,t.BACKMAT_SHADOWONLY=!1,t.NOISE=!1,t.REFLECTIONBGR=!1,t.IMAGEPROCESSING=!1,t.VIGNETTE=!1,t.VIGNETTEBLENDMODEMULTIPLY=!1,t.VIGNETTEBLENDMODEOPAQUE=!1,t.TONEMAPPING=!1,t.TONEMAPPING_ACES=!1,t.CONTRAST=!1,t.COLORCURVES=!1,t.COLORGRADING=!1,t.COLORGRADING3D=!1,t.SAMPLER3DGREENDEPTH=!1,t.SAMPLER3DBGRMAP=!1,t.DITHER=!1,t.IMAGEPROCESSINGPOSTPROCESS=!1,t.SKIPFINALCOLORCLAMP=!1,t.EXPOSURE=!1,t.MULTIVIEW=!1,t.REFLECTION=!1,t.REFLECTIONMAP_3D=!1,t.REFLECTIONMAP_SPHERICAL=!1,t.REFLECTIONMAP_PLANAR=!1,t.REFLECTIONMAP_CUBIC=!1,t.REFLECTIONMAP_PROJECTION=!1,t.REFLECTIONMAP_SKYBOX=!1,t.REFLECTIONMAP_EXPLICIT=!1,t.REFLECTIONMAP_EQUIRECTANGULAR=!1,t.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,t.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,t.INVERTCUBICMAP=!1,t.REFLECTIONMAP_OPPOSITEZ=!1,t.LODINREFLECTIONALPHA=!1,t.GAMMAREFLECTION=!1,t.RGBDREFLECTION=!1,t.EQUIRECTANGULAR_RELFECTION_FOV=!1,t.MAINUV1=!1,t.MAINUV2=!1,t.UV1=!1,t.UV2=!1,t.CLIPPLANE=!1,t.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!1,t.CLIPPLANE5=!1,t.CLIPPLANE6=!1,t.POINTSIZE=!1,t.FOG=!1,t.NORMAL=!1,t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,t.INSTANCES=!1,t.SHADOWFLOAT=!1,t.LOGARITHMICDEPTH=!1,t.NONUNIFORMSCALING=!1,t.ALPHATEST=!1,t.rebuild(),t}return V(t,e),t}(Ei),jp=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.primaryColor=N.White(),n._primaryColorShadowLevel=0,n._primaryColorHighlightLevel=0,n.reflectionTexture=null,n.reflectionBlur=0,n.diffuseTexture=null,n._shadowLights=null,n.shadowLights=null,n.shadowLevel=0,n.sceneCenter=x.Zero(),n.opacityFresnel=!0,n.reflectionFresnel=!1,n.reflectionFalloffDistance=0,n.reflectionAmount=1,n.reflectionReflectance0=.05,n.reflectionReflectance90=.5,n.useRGBColor=!0,n.enableNoise=!1,n._fovMultiplier=1,n.useEquirectangularFOV=!1,n._maxSimultaneousLights=4,n.maxSimultaneousLights=4,n._shadowOnly=!1,n.shadowOnly=!1,n._imageProcessingObserver=null,n.switchToBGR=!1,n._renderTargets=new yi(16),n._reflectionControls=C.Zero(),n._white=N.White(),n._primaryShadowColor=N.Black(),n._primaryHighlightColor=N.Black(),n._attachImageProcessingConfiguration(null),n.getRenderTargetTextures=function(){return n._renderTargets.reset(),n._diffuseTexture&&n._diffuseTexture.isRenderTarget&&n._renderTargets.push(n._diffuseTexture),n._reflectionTexture&&n._reflectionTexture.isRenderTarget&&n._renderTargets.push(n._reflectionTexture),n._renderTargets},n}return V(t,e),Object.defineProperty(t.prototype,\"_perceptualColor\",{get:function(){return this.__perceptualColor},set:function(e){this.__perceptualColor=e,this._computePrimaryColorFromPerceptualColor(),this._markAllSubMeshesAsLightsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"primaryColorShadowLevel\",{get:function(){return this._primaryColorShadowLevel},set:function(e){this._primaryColorShadowLevel=e,this._computePrimaryColors(),this._markAllSubMeshesAsLightsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"primaryColorHighlightLevel\",{get:function(){return this._primaryColorHighlightLevel},set:function(e){this._primaryColorHighlightLevel=e,this._computePrimaryColors(),this._markAllSubMeshesAsLightsDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"reflectionStandardFresnelWeight\",{set:function(e){var i=e;i<.5?(i*=2,this.reflectionReflectance0=t.StandardReflectance0*i,this.reflectionReflectance90=t.StandardReflectance90*i):(i=2*i-1,this.reflectionReflectance0=t.StandardReflectance0+(1-t.StandardReflectance0)*i,this.reflectionReflectance90=t.StandardReflectance90+(1-t.StandardReflectance90)*i)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"fovMultiplier\",{get:function(){return this._fovMultiplier},set:function(e){isNaN(e)&&(e=1),this._fovMultiplier=Math.max(0,Math.min(2,e))},enumerable:!1,configurable:!0}),t.prototype._attachImageProcessingConfiguration=function(e){var t=this;e!==this._imageProcessingConfiguration&&(this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),this._imageProcessingConfiguration=e||this.getScene().imageProcessingConfiguration,this._imageProcessingConfiguration&&(this._imageProcessingObserver=this._imageProcessingConfiguration.onUpdateParameters.add((function(){t._computePrimaryColorFromPerceptualColor(),t._markAllSubMeshesAsImageProcessingDirty()}))))},Object.defineProperty(t.prototype,\"imageProcessingConfiguration\",{get:function(){return this._imageProcessingConfiguration},set:function(e){this._attachImageProcessingConfiguration(e),this._markAllSubMeshesAsTexturesDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"cameraColorCurvesEnabled\",{get:function(){return this.imageProcessingConfiguration.colorCurvesEnabled},set:function(e){this.imageProcessingConfiguration.colorCurvesEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"cameraColorGradingEnabled\",{get:function(){return this.imageProcessingConfiguration.colorGradingEnabled},set:function(e){this.imageProcessingConfiguration.colorGradingEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"cameraToneMappingEnabled\",{get:function(){return this._imageProcessingConfiguration.toneMappingEnabled},set:function(e){this._imageProcessingConfiguration.toneMappingEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"cameraExposure\",{get:function(){return this._imageProcessingConfiguration.exposure},set:function(e){this._imageProcessingConfiguration.exposure=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"cameraContrast\",{get:function(){return this._imageProcessingConfiguration.contrast},set:function(e){this._imageProcessingConfiguration.contrast=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"cameraColorGradingTexture\",{get:function(){return this._imageProcessingConfiguration.colorGradingTexture},set:function(e){this.imageProcessingConfiguration.colorGradingTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"cameraColorCurves\",{get:function(){return this.imageProcessingConfiguration.colorCurves},set:function(e){this.imageProcessingConfiguration.colorCurves=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"hasRenderTargetTextures\",{get:function(){return!(!this._diffuseTexture||!this._diffuseTexture.isRenderTarget)||!(!this._reflectionTexture||!this._reflectionTexture.isRenderTarget)},enumerable:!1,configurable:!0}),t.prototype.needAlphaTesting=function(){return!0},t.prototype.needAlphaBlending=function(){return this.alpha<1||null!=this._diffuseTexture&&this._diffuseTexture.hasAlpha||this._shadowOnly},t.prototype.isReadyForSubMesh=function(e,t,i){if(void 0===i&&(i=!1),t.effect&&this.isFrozen&&t.effect._wasPreviouslyReady&&t.effect._wasPreviouslyUsingInstances===i)return!0;t.materialDefines||(t.materialDefines=new Xp);var n=this.getScene(),r=t.materialDefines;if(this._isReadyForSubMesh(t))return!0;var o=n.getEngine();if(Pr.PrepareDefinesForLights(n,e,r,!1,this._maxSimultaneousLights),r._needNormals=!0,Pr.PrepareDefinesForMultiview(n,r),r._areTexturesDirty){if(r._needUVs=!1,n.texturesEnabled){if(n.getEngine().getCaps().textureLOD&&(r.TEXTURELODSUPPORT=!0),this._diffuseTexture&&Nl.DiffuseTextureEnabled){if(!this._diffuseTexture.isReadyOrNotBlocking())return!1;Pr.PrepareDefinesForMergedUV(this._diffuseTexture,r,\"DIFFUSE\"),r.DIFFUSEHASALPHA=this._diffuseTexture.hasAlpha,r.GAMMADIFFUSE=this._diffuseTexture.gammaSpace,r.OPACITYFRESNEL=this._opacityFresnel}else r.DIFFUSE=!1,r.DIFFUSEDIRECTUV=0,r.DIFFUSEHASALPHA=!1,r.GAMMADIFFUSE=!1,r.OPACITYFRESNEL=!1;var s=this._reflectionTexture;if(s&&Nl.ReflectionTextureEnabled){if(!s.isReadyOrNotBlocking())return!1;switch(r.REFLECTION=!0,r.GAMMAREFLECTION=s.gammaSpace,r.RGBDREFLECTION=s.isRGBD,r.REFLECTIONBLUR=this._reflectionBlur>0,r.LODINREFLECTIONALPHA=s.lodLevelInAlpha,r.EQUIRECTANGULAR_RELFECTION_FOV=this.useEquirectangularFOV,r.REFLECTIONBGR=this.switchToBGR,s.coordinatesMode===to.INVCUBIC_MODE&&(r.INVERTCUBICMAP=!0),r.REFLECTIONMAP_3D=s.isCube,r.REFLECTIONMAP_OPPOSITEZ=r.REFLECTIONMAP_3D&&this.getScene().useRightHandedSystem?!s.invertZ:s.invertZ,s.coordinatesMode){case to.EXPLICIT_MODE:r.REFLECTIONMAP_EXPLICIT=!0;break;case to.PLANAR_MODE:r.REFLECTIONMAP_PLANAR=!0;break;case to.PROJECTION_MODE:r.REFLECTIONMAP_PROJECTION=!0;break;case to.SKYBOX_MODE:r.REFLECTIONMAP_SKYBOX=!0;break;case to.SPHERICAL_MODE:r.REFLECTIONMAP_SPHERICAL=!0;break;case to.EQUIRECTANGULAR_MODE:r.REFLECTIONMAP_EQUIRECTANGULAR=!0;break;case to.FIXED_EQUIRECTANGULAR_MODE:r.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!0;break;case to.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:r.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!0;break;case to.CUBIC_MODE:case to.INVCUBIC_MODE:default:r.REFLECTIONMAP_CUBIC=!0}this.reflectionFresnel?(r.REFLECTIONFRESNEL=!0,r.REFLECTIONFALLOFF=this.reflectionFalloffDistance>0,this._reflectionControls.x=this.reflectionAmount,this._reflectionControls.y=this.reflectionReflectance0,this._reflectionControls.z=this.reflectionReflectance90,this._reflectionControls.w=1/this.reflectionFalloffDistance):(r.REFLECTIONFRESNEL=!1,r.REFLECTIONFALLOFF=!1)}else r.REFLECTION=!1,r.REFLECTIONFRESNEL=!1,r.REFLECTIONFALLOFF=!1,r.REFLECTIONBLUR=!1,r.REFLECTIONMAP_3D=!1,r.REFLECTIONMAP_SPHERICAL=!1,r.REFLECTIONMAP_PLANAR=!1,r.REFLECTIONMAP_CUBIC=!1,r.REFLECTIONMAP_PROJECTION=!1,r.REFLECTIONMAP_SKYBOX=!1,r.REFLECTIONMAP_EXPLICIT=!1,r.REFLECTIONMAP_EQUIRECTANGULAR=!1,r.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,r.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,r.INVERTCUBICMAP=!1,r.REFLECTIONMAP_OPPOSITEZ=!1,r.LODINREFLECTIONALPHA=!1,r.GAMMAREFLECTION=!1,r.RGBDREFLECTION=!1}r.PREMULTIPLYALPHA=this.alphaMode===a.ALPHA_PREMULTIPLIED||this.alphaMode===a.ALPHA_PREMULTIPLIED_PORTERDUFF,r.USERGBCOLOR=this._useRGBColor,r.NOISE=this._enableNoise}if(r._areLightsDirty&&(r.USEHIGHLIGHTANDSHADOWCOLORS=!this._useRGBColor&&(0!==this._primaryColorShadowLevel||0!==this._primaryColorHighlightLevel),r.BACKMAT_SHADOWONLY=this._shadowOnly),r._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(r)}if(Pr.PrepareDefinesForMisc(e,n,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),r),Pr.PrepareDefinesForFrameBoundValues(n,o,r,i,null,t.getRenderingMesh().hasThinInstances),Pr.PrepareDefinesForAttributes(e,r,!1,!0,!1)&&e&&(n.getEngine().getCaps().standardDerivatives||e.isVerticesDataPresent(wi.NormalKind)||(e.createNormals(!0),Q.Warn(\"BackgroundMaterial: Normals have been created for the mesh: \"+e.name))),r.isDirty){r.markAsProcessed(),n.resetCachedMaterial();var l=new ua;r.FOG&&l.addFallback(0,\"FOG\"),r.POINTSIZE&&l.addFallback(1,\"POINTSIZE\"),r.MULTIVIEW&&l.addFallback(0,\"MULTIVIEW\"),Pr.HandleFallbacksForShadows(r,l,this._maxSimultaneousLights);var c=[wi.PositionKind];r.NORMAL&&c.push(wi.NormalKind),r.UV1&&c.push(wi.UVKind),r.UV2&&c.push(wi.UV2Kind),Pr.PrepareAttributesForBones(c,e,r,l),Pr.PrepareAttributesForInstances(c,r);var u=[\"world\",\"view\",\"viewProjection\",\"vEyePosition\",\"vLightsType\",\"vFogInfos\",\"vFogColor\",\"pointSize\",\"vClipPlane\",\"vClipPlane2\",\"vClipPlane3\",\"vClipPlane4\",\"vClipPlane5\",\"vClipPlane6\",\"mBones\",\"vPrimaryColor\",\"vPrimaryColorShadow\",\"vReflectionInfos\",\"reflectionMatrix\",\"vReflectionMicrosurfaceInfos\",\"fFovMultiplier\",\"shadowLevel\",\"alpha\",\"vBackgroundCenter\",\"vReflectionControl\",\"vDiffuseInfos\",\"diffuseMatrix\"],h=[\"diffuseSampler\",\"reflectionSampler\",\"reflectionSamplerLow\",\"reflectionSamplerHigh\"],d=[\"Material\",\"Scene\"];Ri&&(Ri.PrepareUniforms(u,r),Ri.PrepareSamplers(h,r)),Pr.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:d,samplers:h,defines:r,maxSimultaneousLights:this._maxSimultaneousLights});var p=r.toString(),f=n.getEngine().createEffect(\"background\",{attributes:c,uniformsNames:u,uniformBuffersNames:d,samplers:h,defines:p,fallbacks:l,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights}},o);t.setEffect(f,r,this._materialContext),this.buildUniformLayout()}return!(!t.effect||!t.effect.isReady()||(r._renderId=n.getRenderId(),t.effect._wasPreviouslyReady=!0,t.effect._wasPreviouslyUsingInstances=i,n.performancePriority!==Zi.BackwardCompatible&&(this.checkReadyOnlyOnce=!0),0))},t.prototype._computePrimaryColorFromPerceptualColor=function(){this.__perceptualColor&&(this._primaryColor.copyFrom(this.__perceptualColor),this._primaryColor.toLinearSpaceToRef(this._primaryColor),this._imageProcessingConfiguration&&this._primaryColor.scaleToRef(1/this._imageProcessingConfiguration.exposure,this._primaryColor),this._computePrimaryColors())},t.prototype._computePrimaryColors=function(){0===this._primaryColorShadowLevel&&0===this._primaryColorHighlightLevel||(this._primaryColor.scaleToRef(this._primaryColorShadowLevel,this._primaryShadowColor),this._primaryColor.subtractToRef(this._primaryShadowColor,this._primaryShadowColor),this._white.subtractToRef(this._primaryColor,this._primaryHighlightColor),this._primaryHighlightColor.scaleToRef(this._primaryColorHighlightLevel,this._primaryHighlightColor),this._primaryColor.addToRef(this._primaryHighlightColor,this._primaryHighlightColor))},t.prototype.buildUniformLayout=function(){this._uniformBuffer.addUniform(\"vPrimaryColor\",4),this._uniformBuffer.addUniform(\"vPrimaryColorShadow\",4),this._uniformBuffer.addUniform(\"vDiffuseInfos\",2),this._uniformBuffer.addUniform(\"vReflectionInfos\",2),this._uniformBuffer.addUniform(\"diffuseMatrix\",16),this._uniformBuffer.addUniform(\"reflectionMatrix\",16),this._uniformBuffer.addUniform(\"vReflectionMicrosurfaceInfos\",3),this._uniformBuffer.addUniform(\"fFovMultiplier\",1),this._uniformBuffer.addUniform(\"pointSize\",1),this._uniformBuffer.addUniform(\"shadowLevel\",1),this._uniformBuffer.addUniform(\"alpha\",1),this._uniformBuffer.addUniform(\"vBackgroundCenter\",3),this._uniformBuffer.addUniform(\"vReflectionControl\",4),this._uniformBuffer.create()},t.prototype.unbind=function(){this._diffuseTexture&&this._diffuseTexture.isRenderTarget&&this._uniformBuffer.setTexture(\"diffuseSampler\",null),this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&this._uniformBuffer.setTexture(\"reflectionSampler\",null),e.prototype.unbind.call(this)},t.prototype.bindOnlyWorldMatrix=function(e){this._activeEffect.setMatrix(\"world\",e)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),r=i.materialDefines;if(r){var o=i.effect;if(o){this._activeEffect=o,this.bindOnlyWorldMatrix(e),Pr.BindBonesParameters(t,this._activeEffect);var a=this._mustRebind(n,o,t.visibility);if(a){this._uniformBuffer.bindToEffect(o,\"Material\"),this.bindViewProjection(o);var s=this._reflectionTexture;this._uniformBuffer.useUbo&&this.isFrozen&&this._uniformBuffer.isSync||(n.texturesEnabled&&(this._diffuseTexture&&Nl.DiffuseTextureEnabled&&(this._uniformBuffer.updateFloat2(\"vDiffuseInfos\",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),Pr.BindTextureMatrix(this._diffuseTexture,this._uniformBuffer,\"diffuse\")),s&&Nl.ReflectionTextureEnabled&&(this._uniformBuffer.updateMatrix(\"reflectionMatrix\",s.getReflectionTextureMatrix()),this._uniformBuffer.updateFloat2(\"vReflectionInfos\",s.level,this._reflectionBlur),this._uniformBuffer.updateFloat3(\"vReflectionMicrosurfaceInfos\",s.getSize().width,s.lodGenerationScale,s.lodGenerationOffset))),this.shadowLevel>0&&this._uniformBuffer.updateFloat(\"shadowLevel\",this.shadowLevel),this._uniformBuffer.updateFloat(\"alpha\",this.alpha),this.pointsCloud&&this._uniformBuffer.updateFloat(\"pointSize\",this.pointSize),r.USEHIGHLIGHTANDSHADOWCOLORS?(this._uniformBuffer.updateColor4(\"vPrimaryColor\",this._primaryHighlightColor,1),this._uniformBuffer.updateColor4(\"vPrimaryColorShadow\",this._primaryShadowColor,1)):this._uniformBuffer.updateColor4(\"vPrimaryColor\",this._primaryColor,1)),this._uniformBuffer.updateFloat(\"fFovMultiplier\",this._fovMultiplier),n.texturesEnabled&&(this._diffuseTexture&&Nl.DiffuseTextureEnabled&&this._uniformBuffer.setTexture(\"diffuseSampler\",this._diffuseTexture),s&&Nl.ReflectionTextureEnabled&&(r.REFLECTIONBLUR&&r.TEXTURELODSUPPORT?this._uniformBuffer.setTexture(\"reflectionSampler\",s):r.REFLECTIONBLUR?(this._uniformBuffer.setTexture(\"reflectionSampler\",s._lodTextureMid||s),this._uniformBuffer.setTexture(\"reflectionSamplerLow\",s._lodTextureLow||s),this._uniformBuffer.setTexture(\"reflectionSamplerHigh\",s._lodTextureHigh||s)):this._uniformBuffer.setTexture(\"reflectionSampler\",s),r.REFLECTIONFRESNEL&&(this._uniformBuffer.updateFloat3(\"vBackgroundCenter\",this.sceneCenter.x,this.sceneCenter.y,this.sceneCenter.z),this._uniformBuffer.updateFloat4(\"vReflectionControl\",this._reflectionControls.x,this._reflectionControls.y,this._reflectionControls.z,this._reflectionControls.w)))),Pr.BindClipPlane(this._activeEffect,n),n.bindEyePosition(o)}else n.getEngine()._features.needToAlwaysBindUniformBuffers&&(this._uniformBuffer.bindToEffect(o,\"Material\"),this._needToBindSceneUbo=!0);!a&&this.isFrozen||(n.lightsEnabled&&Pr.BindLights(n,t,this._activeEffect,r,this._maxSimultaneousLights),this.bindView(o),Pr.BindFogParameters(n,t,this._activeEffect,!0),this._imageProcessingConfiguration&&this._imageProcessingConfiguration.bind(this._activeEffect)),this._afterBind(t,this._activeEffect),this._uniformBuffer.update()}}},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||this._reflectionTexture===t||this._diffuseTexture===t},t.prototype.dispose=function(t,i){void 0===t&&(t=!1),void 0===i&&(i=!1),i&&(this.diffuseTexture&&this.diffuseTexture.dispose(),this.reflectionTexture&&this.reflectionTexture.dispose()),this._renderTargets.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),e.prototype.dispose.call(this,t)},t.prototype.clone=function(e){var i=this;return Le.Clone((function(){return new t(e,i.getScene())}),this)},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.customType=\"BABYLON.BackgroundMaterial\",t},t.prototype.getClassName=function(){return\"BackgroundMaterial\"},t.Parse=function(e,i,n){return Le.Parse((function(){return new t(e.name,i)}),e,i,n)},t.StandardReflectance0=.05,t.StandardReflectance90=.5,G([Ee()],t.prototype,\"_primaryColor\",void 0),G([ye(\"_markAllSubMeshesAsLightsDirty\")],t.prototype,\"primaryColor\",void 0),G([Ee()],t.prototype,\"__perceptualColor\",void 0),G([be()],t.prototype,\"_primaryColorShadowLevel\",void 0),G([be()],t.prototype,\"_primaryColorHighlightLevel\",void 0),G([ye(\"_markAllSubMeshesAsLightsDirty\")],t.prototype,\"primaryColorHighlightLevel\",null),G([Te()],t.prototype,\"_reflectionTexture\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"reflectionTexture\",void 0),G([be()],t.prototype,\"_reflectionBlur\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"reflectionBlur\",void 0),G([Te()],t.prototype,\"_diffuseTexture\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"diffuseTexture\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"shadowLights\",void 0),G([be()],t.prototype,\"_shadowLevel\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"shadowLevel\",void 0),G([Re()],t.prototype,\"_sceneCenter\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"sceneCenter\",void 0),G([be()],t.prototype,\"_opacityFresnel\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"opacityFresnel\",void 0),G([be()],t.prototype,\"_reflectionFresnel\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"reflectionFresnel\",void 0),G([be()],t.prototype,\"_reflectionFalloffDistance\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"reflectionFalloffDistance\",void 0),G([be()],t.prototype,\"_reflectionAmount\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"reflectionAmount\",void 0),G([be()],t.prototype,\"_reflectionReflectance0\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"reflectionReflectance0\",void 0),G([be()],t.prototype,\"_reflectionReflectance90\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"reflectionReflectance90\",void 0),G([be()],t.prototype,\"_useRGBColor\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useRGBColor\",void 0),G([be()],t.prototype,\"_enableNoise\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"enableNoise\",void 0),G([be()],t.prototype,\"_maxSimultaneousLights\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"maxSimultaneousLights\",void 0),G([be()],t.prototype,\"_shadowOnly\",void 0),G([ye(\"_markAllSubMeshesAsLightsDirty\")],t.prototype,\"shadowOnly\",void 0),G([Me()],t.prototype,\"_imageProcessingConfiguration\",void 0),t}(Vo);b(\"BABYLON.BackgroundMaterial\",jp);var Yp=function(){function e(t,i){var n=this;this._errorHandler=function(e,t){n.onErrorObservable.notifyObservers({message:e,exception:t})},this._options=k(k({},e._GetDefaultOptions()),t),this._scene=i,this.onErrorObservable=new u,this._setupBackground(),this._setupImageProcessing()}return e._GetDefaultOptions=function(){return{createGround:!0,groundSize:15,groundTexture:this._GroundTextureCDNUrl,groundColor:new N(.2,.2,.3).toLinearSpace().scale(3),groundOpacity:.9,enableGroundShadow:!0,groundShadowLevel:.5,enableGroundMirror:!1,groundMirrorSizeRatio:.3,groundMirrorBlurKernel:64,groundMirrorAmount:1,groundMirrorFresnelWeight:1,groundMirrorFallOffDistance:0,groundMirrorTextureType:a.TEXTURETYPE_UNSIGNED_INT,groundYBias:1e-5,createSkybox:!0,skyboxSize:20,skyboxTexture:this._SkyboxTextureCDNUrl,skyboxColor:new N(.2,.2,.3).toLinearSpace().scale(3),backgroundYRotation:0,sizeAuto:!0,rootPosition:x.Zero(),setupImageProcessing:!0,environmentTexture:this._EnvironmentTextureCDNUrl,cameraExposure:.8,cameraContrast:1.2,toneMappingEnabled:!0}},Object.defineProperty(e.prototype,\"rootMesh\",{get:function(){return this._rootMesh},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"skybox\",{get:function(){return this._skybox},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"skyboxTexture\",{get:function(){return this._skyboxTexture},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"skyboxMaterial\",{get:function(){return this._skyboxMaterial},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"ground\",{get:function(){return this._ground},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"groundTexture\",{get:function(){return this._groundTexture},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"groundMirror\",{get:function(){return this._groundMirror},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"groundMirrorRenderList\",{get:function(){return this._groundMirror?this._groundMirror.renderList:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"groundMaterial\",{get:function(){return this._groundMaterial},enumerable:!1,configurable:!0}),e.prototype.updateOptions=function(e){var t=k(k({},this._options),e);this._ground&&!t.createGround&&(this._ground.dispose(),this._ground=null),this._groundMaterial&&!t.createGround&&(this._groundMaterial.dispose(),this._groundMaterial=null),this._groundTexture&&this._options.groundTexture!=t.groundTexture&&(this._groundTexture.dispose(),this._groundTexture=null),this._skybox&&!t.createSkybox&&(this._skybox.dispose(),this._skybox=null),this._skyboxMaterial&&!t.createSkybox&&(this._skyboxMaterial.dispose(),this._skyboxMaterial=null),this._skyboxTexture&&this._options.skyboxTexture!=t.skyboxTexture&&(this._skyboxTexture.dispose(),this._skyboxTexture=null),this._groundMirror&&!t.enableGroundMirror&&(this._groundMirror.dispose(),this._groundMirror=null),this._scene.environmentTexture&&this._options.environmentTexture!=t.environmentTexture&&this._scene.environmentTexture.dispose(),this._options=t,this._setupBackground(),this._setupImageProcessing()},e.prototype.setMainColor=function(e){this.groundMaterial&&(this.groundMaterial.primaryColor=e),this.skyboxMaterial&&(this.skyboxMaterial.primaryColor=e),this.groundMirror&&(this.groundMirror.clearColor=new L(e.r,e.g,e.b,1))},e.prototype._setupImageProcessing=function(){this._options.setupImageProcessing&&(this._scene.imageProcessingConfiguration.contrast=this._options.cameraContrast,this._scene.imageProcessingConfiguration.exposure=this._options.cameraExposure,this._scene.imageProcessingConfiguration.toneMappingEnabled=this._options.toneMappingEnabled,this._setupEnvironmentTexture())},e.prototype._setupEnvironmentTexture=function(){if(!this._scene.environmentTexture)if(this._options.environmentTexture instanceof qr)this._scene.environmentTexture=this._options.environmentTexture;else{var e=Hp.CreateFromPrefilteredData(this._options.environmentTexture,this._scene);this._scene.environmentTexture=e}},e.prototype._setupBackground=function(){this._rootMesh||(this._rootMesh=new Ur(\"BackgroundHelper\",this._scene)),this._rootMesh.rotation.y=this._options.backgroundYRotation;var e=this._getSceneSize();this._options.createGround&&(this._setupGround(e),this._setupGroundMaterial(),this._setupGroundDiffuseTexture(),this._options.enableGroundMirror&&this._setupGroundMirrorTexture(e),this._setupMirrorInGroundMaterial()),this._options.createSkybox&&(this._setupSkybox(e),this._setupSkyboxMaterial(),this._setupSkyboxReflectionTexture()),this._rootMesh.position.x=e.rootPosition.x,this._rootMesh.position.z=e.rootPosition.z,this._rootMesh.position.y=e.rootPosition.y},e.prototype._getSceneSize=function(){var e=this,t=this._options.groundSize,i=this._options.skyboxSize,n=this._options.rootPosition;if(!this._scene.meshes||1===this._scene.meshes.length)return{groundSize:t,skyboxSize:i,rootPosition:n};var r=this._scene.getWorldExtends((function(t){return t!==e._ground&&t!==e._rootMesh&&t!==e._skybox})),o=r.max.subtract(r.min);if(this._options.sizeAuto){this._scene.activeCamera instanceof Ls&&this._scene.activeCamera.upperRadiusLimit&&(i=t=2*this._scene.activeCamera.upperRadiusLimit);var a=o.length();a>t&&(i=t=2*a),t*=1.1,i*=1.5,(n=r.min.add(o.scale(.5))).y=r.min.y-this._options.groundYBias}return{groundSize:t,skyboxSize:i,rootPosition:n}},e.prototype._setupGround=function(e){var t=this;this._ground&&!this._ground.isDisposed()||(this._ground=go(\"BackgroundPlane\",{size:e.groundSize},this._scene),this._ground.rotation.x=Math.PI/2,this._ground.parent=this._rootMesh,this._ground.onDisposeObservable.add((function(){t._ground=null}))),this._ground.receiveShadows=this._options.enableGroundShadow},e.prototype._setupGroundMaterial=function(){this._groundMaterial||(this._groundMaterial=new jp(\"BackgroundPlaneMaterial\",this._scene)),this._groundMaterial.alpha=this._options.groundOpacity,this._groundMaterial.alphaMode=a.ALPHA_PREMULTIPLIED_PORTERDUFF,this._groundMaterial.shadowLevel=this._options.groundShadowLevel,this._groundMaterial.primaryColor=this._options.groundColor,this._groundMaterial.useRGBColor=!1,this._groundMaterial.enableNoise=!0,this._ground&&(this._ground.material=this._groundMaterial)},e.prototype._setupGroundDiffuseTexture=function(){this._groundMaterial&&(this._groundTexture||(this._options.groundTexture instanceof qr?this._groundMaterial.diffuseTexture=this._options.groundTexture:(this._groundTexture=new to(this._options.groundTexture,this._scene,void 0,void 0,void 0,void 0,this._errorHandler),this._groundTexture.gammaSpace=!1,this._groundTexture.hasAlpha=!0,this._groundMaterial.diffuseTexture=this._groundTexture)))},e.prototype._setupGroundMirrorTexture=function(e){var t=to.CLAMP_ADDRESSMODE;if(!this._groundMirror&&(this._groundMirror=new Wp(\"BackgroundPlaneMirrorTexture\",{ratio:this._options.groundMirrorSizeRatio},this._scene,!1,this._options.groundMirrorTextureType,to.BILINEAR_SAMPLINGMODE,!0),this._groundMirror.mirrorPlane=new un(0,-1,0,e.rootPosition.y),this._groundMirror.anisotropicFilteringLevel=1,this._groundMirror.wrapU=t,this._groundMirror.wrapV=t,this._groundMirror.renderList))for(var i=0;i0\\nuniform vec2 vDebugMode;\\n#endif\\n#ifdef DETAIL\\nuniform vec4 vDetailInfos;\\n#endif\\n#ifdef USESPHERICALFROMREFLECTIONMAP\\n#ifdef SPHERICAL_HARMONICS\\nuniform vec3 vSphericalL00;\\nuniform vec3 vSphericalL1_1;\\nuniform vec3 vSphericalL10;\\nuniform vec3 vSphericalL11;\\nuniform vec3 vSphericalL2_2;\\nuniform vec3 vSphericalL2_1;\\nuniform vec3 vSphericalL20;\\nuniform vec3 vSphericalL21;\\nuniform vec3 vSphericalL22;\\n#else\\nuniform vec3 vSphericalX;\\nuniform vec3 vSphericalY;\\nuniform vec3 vSphericalZ;\\nuniform vec3 vSphericalXX_ZZ;\\nuniform vec3 vSphericalYY_ZZ;\\nuniform vec3 vSphericalZZ;\\nuniform vec3 vSphericalXY;\\nuniform vec3 vSphericalYZ;\\nuniform vec3 vSphericalZX;\\n#endif\\n#endif\\n#define ADDITIONAL_FRAGMENT_DECLARATION\\n\";It.IncludesShadersStore.pbrUboDeclaration=\"layout(std140,column_major) uniform;\\nuniform Material {\\nvec2 vAlbedoInfos;\\nvec4 vAmbientInfos;\\nvec2 vOpacityInfos;\\nvec2 vEmissiveInfos;\\nvec2 vLightmapInfos;\\nvec3 vReflectivityInfos;\\nvec2 vMicroSurfaceSamplerInfos;\\nvec2 vReflectionInfos;\\nvec2 vReflectionFilteringInfo;\\nvec3 vReflectionPosition;\\nvec3 vReflectionSize;\\nvec3 vBumpInfos;\\nmat4 albedoMatrix;\\nmat4 ambientMatrix;\\nmat4 opacityMatrix;\\nmat4 emissiveMatrix;\\nmat4 lightmapMatrix;\\nmat4 reflectivityMatrix;\\nmat4 microSurfaceSamplerMatrix;\\nmat4 bumpMatrix;\\nvec2 vTangentSpaceParams;\\nmat4 reflectionMatrix;\\nvec3 vReflectionColor;\\nvec4 vAlbedoColor;\\nvec4 vLightingIntensity;\\nvec3 vReflectionMicrosurfaceInfos;\\nfloat pointSize;\\nvec4 vReflectivityColor;\\nvec3 vEmissiveColor;\\nvec3 vAmbientColor;\\nvec2 vDebugMode;\\nvec4 vMetallicReflectanceFactors;\\nvec2 vMetallicReflectanceInfos;\\nmat4 metallicReflectanceMatrix;\\nvec2 vReflectanceInfos;\\nmat4 reflectanceMatrix;\\nvec3 vSphericalL00;\\nvec3 vSphericalL1_1;\\nvec3 vSphericalL10;\\nvec3 vSphericalL11;\\nvec3 vSphericalL2_2;\\nvec3 vSphericalL2_1;\\nvec3 vSphericalL20;\\nvec3 vSphericalL21;\\nvec3 vSphericalL22;\\nvec3 vSphericalX;\\nvec3 vSphericalY;\\nvec3 vSphericalZ;\\nvec3 vSphericalXX_ZZ;\\nvec3 vSphericalYY_ZZ;\\nvec3 vSphericalZZ;\\nvec3 vSphericalXY;\\nvec3 vSphericalYZ;\\nvec3 vSphericalZX;\\n#define ADDITIONAL_UBO_DECLARATION\\n};\\n#include\\n#include\\n\";It.IncludesShadersStore.pbrFragmentExtraDeclaration=\"varying vec3 vPositionW;\\n#if DEBUGMODE>0\\nvarying vec4 vClipSpacePosition;\\n#endif\\n#include[1..7]\\n#ifdef NORMAL\\nvarying vec3 vNormalW;\\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\\nvarying vec3 vEnvironmentIrradiance;\\n#endif\\n#endif\\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\\nvarying vec4 vColor;\\n#endif\\n\";It.IncludesShadersStore.samplerFragmentAlternateDeclaration=\"#ifdef _DEFINENAME_\\n#if _DEFINENAME_DIRECTUV==1\\n#define v_VARYINGNAME_UV vMainUV1\\n#elif _DEFINENAME_DIRECTUV==2\\n#define v_VARYINGNAME_UV vMainUV2\\n#elif _DEFINENAME_DIRECTUV==3\\n#define v_VARYINGNAME_UV vMainUV3\\n#elif _DEFINENAME_DIRECTUV==4\\n#define v_VARYINGNAME_UV vMainUV4\\n#elif _DEFINENAME_DIRECTUV==5\\n#define v_VARYINGNAME_UV vMainUV5\\n#elif _DEFINENAME_DIRECTUV==6\\n#define v_VARYINGNAME_UV vMainUV6\\n#else\\nvarying vec2 v_VARYINGNAME_UV;\\n#endif\\n#endif\\n\";It.IncludesShadersStore.pbrFragmentSamplersDeclaration=\"#include(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo,_SAMPLERNAME_,albedo)\\n#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_SAMPLERNAME_,ambient)\\n#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_SAMPLERNAME_,opacity)\\n#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_SAMPLERNAME_,emissive)\\n#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_SAMPLERNAME_,lightmap)\\n#include(_DEFINENAME_,REFLECTIVITY,_VARYINGNAME_,Reflectivity,_SAMPLERNAME_,reflectivity)\\n#include(_DEFINENAME_,MICROSURFACEMAP,_VARYINGNAME_,MicroSurfaceSampler,_SAMPLERNAME_,microSurface)\\n#include(_DEFINENAME_,METALLIC_REFLECTANCE,_VARYINGNAME_,MetallicReflectance,_SAMPLERNAME_,metallicReflectance)\\n#include(_DEFINENAME_,REFLECTANCE,_VARYINGNAME_,Reflectance,_SAMPLERNAME_,reflectance)\\n#ifdef CLEARCOAT\\n#include(_DEFINENAME_,CLEARCOAT_TEXTURE,_VARYINGNAME_,ClearCoat,_SAMPLERNAME_,clearCoat)\\n#include(_DEFINENAME_,CLEARCOAT_TEXTURE_ROUGHNESS,_VARYINGNAME_,ClearCoatRoughness)\\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL)\\nuniform sampler2D clearCoatRoughnessSampler;\\n#endif\\n#include(_DEFINENAME_,CLEARCOAT_BUMP,_VARYINGNAME_,ClearCoatBump,_SAMPLERNAME_,clearCoatBump)\\n#include(_DEFINENAME_,CLEARCOAT_TINT_TEXTURE,_VARYINGNAME_,ClearCoatTint,_SAMPLERNAME_,clearCoatTint)\\n#endif\\n#ifdef IRIDESCENCE\\n#include(_DEFINENAME_,IRIDESCENCE_TEXTURE,_VARYINGNAME_,Iridescence,_SAMPLERNAME_,iridescence)\\n#include(_DEFINENAME_,IRIDESCENCE_THICKNESS_TEXTURE,_VARYINGNAME_,IridescenceThickness,_SAMPLERNAME_,iridescenceThickness)\\n#endif\\n#ifdef SHEEN\\n#include(_DEFINENAME_,SHEEN_TEXTURE,_VARYINGNAME_,Sheen,_SAMPLERNAME_,sheen)\\n#include(_DEFINENAME_,SHEEN_TEXTURE_ROUGHNESS,_VARYINGNAME_,SheenRoughness)\\n#if defined(SHEEN_ROUGHNESS) && defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_TEXTURE_ROUGHNESS_IDENTICAL)\\nuniform sampler2D sheenRoughnessSampler;\\n#endif\\n#endif\\n#ifdef ANISOTROPIC\\n#include(_DEFINENAME_,ANISOTROPIC_TEXTURE,_VARYINGNAME_,Anisotropy,_SAMPLERNAME_,anisotropy)\\n#endif\\n#ifdef REFLECTION\\n#ifdef REFLECTIONMAP_3D\\n#define sampleReflection(s,c) textureCube(s,c)\\nuniform samplerCube reflectionSampler;\\n#ifdef LODBASEDMICROSFURACE\\n#define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l)\\n#else\\nuniform samplerCube reflectionSamplerLow;\\nuniform samplerCube reflectionSamplerHigh;\\n#endif\\n#ifdef USEIRRADIANCEMAP\\nuniform samplerCube irradianceSampler;\\n#endif\\n#else\\n#define sampleReflection(s,c) texture2D(s,c)\\nuniform sampler2D reflectionSampler;\\n#ifdef LODBASEDMICROSFURACE\\n#define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l)\\n#else\\nuniform sampler2D reflectionSamplerLow;\\nuniform sampler2D reflectionSamplerHigh;\\n#endif\\n#ifdef USEIRRADIANCEMAP\\nuniform sampler2D irradianceSampler;\\n#endif\\n#endif\\n#ifdef REFLECTIONMAP_SKYBOX\\nvarying vec3 vPositionUVW;\\n#else\\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\\nvarying vec3 vDirectionW;\\n#endif\\n#endif\\n#endif\\n#ifdef ENVIRONMENTBRDF\\nuniform sampler2D environmentBrdfSampler;\\n#endif\\n#ifdef SUBSURFACE\\n#ifdef SS_REFRACTION\\n#ifdef SS_REFRACTIONMAP_3D\\n#define sampleRefraction(s,c) textureCube(s,c)\\nuniform samplerCube refractionSampler;\\n#ifdef LODBASEDMICROSFURACE\\n#define sampleRefractionLod(s,c,l) textureCubeLodEXT(s,c,l)\\n#else\\nuniform samplerCube refractionSamplerLow;\\nuniform samplerCube refractionSamplerHigh;\\n#endif\\n#else\\n#define sampleRefraction(s,c) texture2D(s,c)\\nuniform sampler2D refractionSampler;\\n#ifdef LODBASEDMICROSFURACE\\n#define sampleRefractionLod(s,c,l) texture2DLodEXT(s,c,l)\\n#else\\nuniform sampler2D refractionSamplerLow;\\nuniform sampler2D refractionSamplerHigh;\\n#endif\\n#endif\\n#endif\\n#include(_DEFINENAME_,SS_THICKNESSANDMASK_TEXTURE,_VARYINGNAME_,Thickness,_SAMPLERNAME_,thickness)\\n#include(_DEFINENAME_,SS_REFRACTIONINTENSITY_TEXTURE,_VARYINGNAME_,RefractionIntensity,_SAMPLERNAME_,refractionIntensity)\\n#include(_DEFINENAME_,SS_TRANSLUCENCYINTENSITY_TEXTURE,_VARYINGNAME_,TranslucencyIntensity,_SAMPLERNAME_,translucencyIntensity)\\n#endif\\n\";It.IncludesShadersStore.subSurfaceScatteringFunctions=\"bool testLightingForSSS(float diffusionProfile)\\n{\\nreturn diffusionProfile<1.;\\n}\";It.IncludesShadersStore.importanceSampling=\"vec3 hemisphereCosSample(vec2 u) {\\nfloat phi=2.*PI*u.x;\\nfloat cosTheta2=1.-u.y;\\nfloat cosTheta=sqrt(cosTheta2);\\nfloat sinTheta=sqrt(1.-cosTheta2);\\nreturn vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);\\n}\\nvec3 hemisphereImportanceSampleDggx(vec2 u,float a) {\\nfloat phi=2.*PI*u.x;\\nfloat cosTheta2=(1.-u.y)/(1.+(a+1.)*((a-1.)*u.y));\\nfloat cosTheta=sqrt(cosTheta2);\\nfloat sinTheta=sqrt(1.-cosTheta2);\\nreturn vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);\\n}\\nvec3 hemisphereImportanceSampleDCharlie(vec2 u,float a) { \\nfloat phi=2.*PI*u.x;\\nfloat sinTheta=pow(u.y,a/(2.*a+1.));\\nfloat cosTheta=sqrt(1.-sinTheta*sinTheta);\\nreturn vec3(sinTheta*cos(phi),sinTheta*sin(phi),cosTheta);\\n}\";It.IncludesShadersStore.pbrHelperFunctions=\"#define RECIPROCAL_PI2 0.15915494\\n#define RECIPROCAL_PI 0.31830988618\\n#define MINIMUMVARIANCE 0.0005\\nfloat convertRoughnessToAverageSlope(float roughness)\\n{\\nreturn square(roughness)+MINIMUMVARIANCE;\\n}\\nfloat fresnelGrazingReflectance(float reflectance0) {\\nfloat reflectance90=saturate(reflectance0*25.0);\\nreturn reflectance90;\\n}\\nvec2 getAARoughnessFactors(vec3 normalVector) {\\n#ifdef SPECULARAA\\nvec3 nDfdx=dFdx(normalVector.xyz);\\nvec3 nDfdy=dFdy(normalVector.xyz);\\nfloat slopeSquare=max(dot(nDfdx,nDfdx),dot(nDfdy,nDfdy));\\nfloat geometricRoughnessFactor=pow(saturate(slopeSquare),0.333);\\nfloat geometricAlphaGFactor=sqrt(slopeSquare);\\ngeometricAlphaGFactor*=0.75;\\nreturn vec2(geometricRoughnessFactor,geometricAlphaGFactor);\\n#else\\nreturn vec2(0.);\\n#endif\\n}\\n#ifdef ANISOTROPIC\\nvec2 getAnisotropicRoughness(float alphaG,float anisotropy) {\\nfloat alphaT=max(alphaG*(1.0+anisotropy),MINIMUMVARIANCE);\\nfloat alphaB=max(alphaG*(1.0-anisotropy),MINIMUMVARIANCE);\\nreturn vec2(alphaT,alphaB);\\n}\\nvec3 getAnisotropicBentNormals(const vec3 T,const vec3 B,const vec3 N,const vec3 V,float anisotropy) {\\nvec3 anisotropicFrameDirection=anisotropy>=0.0 ? B : T;\\nvec3 anisotropicFrameTangent=cross(normalize(anisotropicFrameDirection),V);\\nvec3 anisotropicFrameNormal=cross(anisotropicFrameTangent,anisotropicFrameDirection);\\nvec3 anisotropicNormal=normalize(mix(N,anisotropicFrameNormal,abs(anisotropy)));\\nreturn anisotropicNormal;\\n}\\n#endif\\n#if defined(CLEARCOAT) || defined(SS_REFRACTION)\\nvec3 cocaLambert(vec3 alpha,float distance) {\\nreturn exp(-alpha*distance);\\n}\\nvec3 cocaLambert(float NdotVRefract,float NdotLRefract,vec3 alpha,float thickness) {\\nreturn cocaLambert(alpha,(thickness*((NdotLRefract+NdotVRefract)/(NdotLRefract*NdotVRefract))));\\n}\\nvec3 computeColorAtDistanceInMedia(vec3 color,float distance) {\\nreturn -log(color)/distance;\\n}\\nvec3 computeClearCoatAbsorption(float NdotVRefract,float NdotLRefract,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {\\nvec3 clearCoatAbsorption=mix(vec3(1.0),\\ncocaLambert(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness),\\nclearCoatIntensity);\\nreturn clearCoatAbsorption;\\n}\\n#endif\\n#ifdef MICROSURFACEAUTOMATIC\\nfloat computeDefaultMicroSurface(float microSurface,vec3 reflectivityColor)\\n{\\nconst float kReflectivityNoAlphaWorkflow_SmoothnessMax=0.95;\\nfloat reflectivityLuminance=getLuminance(reflectivityColor);\\nfloat reflectivityLuma=sqrt(reflectivityLuminance);\\nmicroSurface=reflectivityLuma*kReflectivityNoAlphaWorkflow_SmoothnessMax;\\nreturn microSurface;\\n}\\n#endif\\n\";It.IncludesShadersStore.harmonicsFunctions=\"#ifdef USESPHERICALFROMREFLECTIONMAP\\n#ifdef SPHERICAL_HARMONICS\\nvec3 computeEnvironmentIrradiance(vec3 normal) {\\nreturn vSphericalL00\\n+ vSphericalL1_1*(normal.y)\\n+ vSphericalL10*(normal.z)\\n+ vSphericalL11*(normal.x)\\n+ vSphericalL2_2*(normal.y*normal.x)\\n+ vSphericalL2_1*(normal.y*normal.z)\\n+ vSphericalL20*((3.0*normal.z*normal.z)-1.0)\\n+ vSphericalL21*(normal.z*normal.x)\\n+ vSphericalL22*(normal.x*normal.x-(normal.y*normal.y));\\n}\\n#else\\nvec3 computeEnvironmentIrradiance(vec3 normal) {\\nfloat Nx=normal.x;\\nfloat Ny=normal.y;\\nfloat Nz=normal.z;\\nvec3 C1=vSphericalZZ.rgb;\\nvec3 Cx=vSphericalX.rgb;\\nvec3 Cy=vSphericalY.rgb;\\nvec3 Cz=vSphericalZ.rgb;\\nvec3 Cxx_zz=vSphericalXX_ZZ.rgb;\\nvec3 Cyy_zz=vSphericalYY_ZZ.rgb;\\nvec3 Cxy=vSphericalXY.rgb;\\nvec3 Cyz=vSphericalYZ.rgb;\\nvec3 Czx=vSphericalZX.rgb;\\nvec3 a1=Cyy_zz*Ny+Cy;\\nvec3 a2=Cyz*Nz+a1;\\nvec3 b1=Czx*Nz+Cx;\\nvec3 b2=Cxy*Ny+b1;\\nvec3 b3=Cxx_zz*Nx+b2;\\nvec3 t1=Cz *Nz+C1;\\nvec3 t2=a2 *Ny+t1;\\nvec3 t3=b3 *Nx+t2;\\nreturn t3;\\n}\\n#endif\\n#endif\\n\";It.IncludesShadersStore.pbrDirectLightingSetupFunctions=\"struct preLightingInfo\\n{\\nvec3 lightOffset;\\nfloat lightDistanceSquared;\\nfloat lightDistance;\\nfloat attenuation;\\nvec3 L;\\nvec3 H;\\nfloat NdotV;\\nfloat NdotLUnclamped;\\nfloat NdotL;\\nfloat VdotH;\\nfloat roughness;\\n#ifdef IRIDESCENCE\\nfloat iridescenceIntensity;\\n#endif\\n};\\npreLightingInfo computePointAndSpotPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {\\npreLightingInfo result;\\nresult.lightOffset=lightData.xyz-vPositionW;\\nresult.lightDistanceSquared=dot(result.lightOffset,result.lightOffset);\\nresult.lightDistance=sqrt(result.lightDistanceSquared);\\nresult.L=normalize(result.lightOffset);\\nresult.H=normalize(V+result.L);\\nresult.VdotH=saturate(dot(V,result.H));\\nresult.NdotLUnclamped=dot(N,result.L);\\nresult.NdotL=saturateEps(result.NdotLUnclamped);\\nreturn result;\\n}\\npreLightingInfo computeDirectionalPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {\\npreLightingInfo result;\\nresult.lightDistance=length(-lightData.xyz);\\nresult.L=normalize(-lightData.xyz);\\nresult.H=normalize(V+result.L);\\nresult.VdotH=saturate(dot(V,result.H));\\nresult.NdotLUnclamped=dot(N,result.L);\\nresult.NdotL=saturateEps(result.NdotLUnclamped);\\nreturn result;\\n}\\npreLightingInfo computeHemisphericPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {\\npreLightingInfo result;\\nresult.NdotL=dot(N,lightData.xyz)*0.5+0.5;\\nresult.NdotL=saturateEps(result.NdotL);\\nresult.NdotLUnclamped=result.NdotL;\\n#ifdef SPECULARTERM\\nresult.L=normalize(lightData.xyz);\\nresult.H=normalize(V+result.L);\\nresult.VdotH=saturate(dot(V,result.H));\\n#endif\\nreturn result;\\n}\";It.IncludesShadersStore.pbrDirectLightingFalloffFunctions=\"float computeDistanceLightFalloff_Standard(vec3 lightOffset,float range)\\n{\\nreturn max(0.,1.0-length(lightOffset)/range);\\n}\\nfloat computeDistanceLightFalloff_Physical(float lightDistanceSquared)\\n{\\nreturn 1.0/maxEps(lightDistanceSquared);\\n}\\nfloat computeDistanceLightFalloff_GLTF(float lightDistanceSquared,float inverseSquaredRange)\\n{\\nfloat lightDistanceFalloff=1.0/maxEps(lightDistanceSquared);\\nfloat factor=lightDistanceSquared*inverseSquaredRange;\\nfloat attenuation=saturate(1.0-factor*factor);\\nattenuation*=attenuation;\\nlightDistanceFalloff*=attenuation;\\nreturn lightDistanceFalloff;\\n}\\nfloat computeDistanceLightFalloff(vec3 lightOffset,float lightDistanceSquared,float range,float inverseSquaredRange)\\n{\\n#ifdef USEPHYSICALLIGHTFALLOFF\\nreturn computeDistanceLightFalloff_Physical(lightDistanceSquared);\\n#elif defined(USEGLTFLIGHTFALLOFF)\\nreturn computeDistanceLightFalloff_GLTF(lightDistanceSquared,inverseSquaredRange);\\n#else\\nreturn computeDistanceLightFalloff_Standard(lightOffset,range);\\n#endif\\n}\\nfloat computeDirectionalLightFalloff_Standard(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent)\\n{\\nfloat falloff=0.0;\\nfloat cosAngle=maxEps(dot(-lightDirection,directionToLightCenterW));\\nif (cosAngle>=cosHalfAngle)\\n{\\nfalloff=max(0.,pow(cosAngle,exponent));\\n}\\nreturn falloff;\\n}\\nfloat computeDirectionalLightFalloff_Physical(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle)\\n{\\nconst float kMinusLog2ConeAngleIntensityRatio=6.64385618977; \\nfloat concentrationKappa=kMinusLog2ConeAngleIntensityRatio/(1.0-cosHalfAngle);\\nvec4 lightDirectionSpreadSG=vec4(-lightDirection*concentrationKappa,-concentrationKappa);\\nfloat falloff=exp2(dot(vec4(directionToLightCenterW,1.0),lightDirectionSpreadSG));\\nreturn falloff;\\n}\\nfloat computeDirectionalLightFalloff_GLTF(vec3 lightDirection,vec3 directionToLightCenterW,float lightAngleScale,float lightAngleOffset)\\n{\\nfloat cd=dot(-lightDirection,directionToLightCenterW);\\nfloat falloff=saturate(cd*lightAngleScale+lightAngleOffset);\\nfalloff*=falloff;\\nreturn falloff;\\n}\\nfloat computeDirectionalLightFalloff(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent,float lightAngleScale,float lightAngleOffset)\\n{\\n#ifdef USEPHYSICALLIGHTFALLOFF\\nreturn computeDirectionalLightFalloff_Physical(lightDirection,directionToLightCenterW,cosHalfAngle);\\n#elif defined(USEGLTFLIGHTFALLOFF)\\nreturn computeDirectionalLightFalloff_GLTF(lightDirection,directionToLightCenterW,lightAngleScale,lightAngleOffset);\\n#else\\nreturn computeDirectionalLightFalloff_Standard(lightDirection,directionToLightCenterW,cosHalfAngle,exponent);\\n#endif\\n}\";It.IncludesShadersStore.pbrBRDFFunctions=\"#define FRESNEL_MAXIMUM_ON_ROUGH 0.25\\n#ifdef MS_BRDF_ENERGY_CONSERVATION\\nvec3 getEnergyConservationFactor(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {\\nreturn 1.0+specularEnvironmentR0*(1.0/environmentBrdf.y-1.0);\\n}\\n#endif\\n#ifdef ENVIRONMENTBRDF\\nvec3 getBRDFLookup(float NdotV,float perceptualRoughness) {\\nvec2 UV=vec2(NdotV,perceptualRoughness);\\nvec4 brdfLookup=texture2D(environmentBrdfSampler,UV);\\n#ifdef ENVIRONMENTBRDF_RGBD\\nbrdfLookup.rgb=fromRGBD(brdfLookup.rgba);\\n#endif\\nreturn brdfLookup.rgb;\\n}\\nvec3 getReflectanceFromBRDFLookup(const vec3 specularEnvironmentR0,const vec3 specularEnvironmentR90,const vec3 environmentBrdf) {\\n#ifdef BRDF_V_HEIGHT_CORRELATED\\nvec3 reflectance=(specularEnvironmentR90-specularEnvironmentR0)*environmentBrdf.x+specularEnvironmentR0*environmentBrdf.y;\\n#else\\nvec3 reflectance=specularEnvironmentR0*environmentBrdf.x+specularEnvironmentR90*environmentBrdf.y;\\n#endif\\nreturn reflectance;\\n}\\nvec3 getReflectanceFromBRDFLookup(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {\\n#ifdef BRDF_V_HEIGHT_CORRELATED\\nvec3 reflectance=mix(environmentBrdf.xxx,environmentBrdf.yyy,specularEnvironmentR0);\\n#else\\nvec3 reflectance=specularEnvironmentR0*environmentBrdf.x+environmentBrdf.y;\\n#endif\\nreturn reflectance;\\n}\\n#endif\\n/* NOT USED\\n#if defined(SHEEN) && defined(SHEEN_SOFTER)\\nfloat getBRDFLookupCharlieSheen(float NdotV,float perceptualRoughness)\\n{\\nfloat c=1.0-NdotV;\\nfloat c3=c*c*c;\\nreturn 0.65584461*c3+1.0/(4.16526551+exp(-7.97291361*perceptualRoughness+6.33516894));\\n}\\n#endif\\n*/\\n#if !defined(ENVIRONMENTBRDF) || defined(REFLECTIONMAP_SKYBOX) || defined(ALPHAFRESNEL)\\nvec3 getReflectanceFromAnalyticalBRDFLookup_Jones(float VdotN,vec3 reflectance0,vec3 reflectance90,float smoothness)\\n{\\nfloat weight=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);\\nreturn reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));\\n}\\n#endif\\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF)\\n/**\\n* The sheen BRDF not containing F can be easily stored in the blue channel of the BRDF texture.\\n* The blue channel contains DCharlie*VAshikhmin*NdotL as a lokkup table\\n*/\\nvec3 getSheenReflectanceFromBRDFLookup(const vec3 reflectance0,const vec3 environmentBrdf) {\\nvec3 sheenEnvironmentReflectance=reflectance0*environmentBrdf.b;\\nreturn sheenEnvironmentReflectance;\\n}\\n#endif\\nvec3 fresnelSchlickGGX(float VdotH,vec3 reflectance0,vec3 reflectance90)\\n{\\nreturn reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);\\n}\\nfloat fresnelSchlickGGX(float VdotH,float reflectance0,float reflectance90)\\n{\\nreturn reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);\\n}\\n#ifdef CLEARCOAT\\nvec3 getR0RemappedForClearCoat(vec3 f0) {\\n#ifdef CLEARCOAT_DEFAULTIOR\\n#ifdef MOBILE\\nreturn saturate(f0*(f0*0.526868+0.529324)-0.0482256);\\n#else\\nreturn saturate(f0*(f0*(0.941892-0.263008*f0)+0.346479)-0.0285998);\\n#endif\\n#else\\nvec3 s=sqrt(f0);\\nvec3 t=(vClearCoatRefractionParams.z+vClearCoatRefractionParams.w*s)/(vClearCoatRefractionParams.w+vClearCoatRefractionParams.z*s);\\nreturn square(t);\\n#endif\\n}\\n#endif\\n#ifdef IRIDESCENCE\\nconst mat3 XYZ_TO_REC709=mat3(\\n3.2404542,-0.9692660, 0.0556434,\\n-1.5371385, 1.8760108,-0.2040259,\\n-0.4985314, 0.0415560, 1.0572252\\n);\\nvec3 getIORTfromAirToSurfaceR0(vec3 f0) {\\nvec3 sqrtF0=sqrt(f0);\\nreturn (1.+sqrtF0)/(1.-sqrtF0);\\n}\\nvec3 getR0fromIORs(vec3 iorT,float iorI) {\\nreturn square((iorT-vec3(iorI))/(iorT+vec3(iorI)));\\n}\\nfloat getR0fromIORs(float iorT,float iorI) {\\nreturn square((iorT-iorI)/(iorT+iorI));\\n}\\nvec3 evalSensitivity(float opd,vec3 shift) {\\nfloat phase=2.0*PI*opd*1.0e-9;\\nconst vec3 val=vec3(5.4856e-13,4.4201e-13,5.2481e-13);\\nconst vec3 pos=vec3(1.6810e+06,1.7953e+06,2.2084e+06);\\nconst vec3 var=vec3(4.3278e+09,9.3046e+09,6.6121e+09);\\nvec3 xyz=val*sqrt(2.0*PI*var)*cos(pos*phase+shift)*exp(-square(phase)*var);\\nxyz.x+=9.7470e-14*sqrt(2.0*PI*4.5282e+09)*cos(2.2399e+06*phase+shift[0])*exp(-4.5282e+09*square(phase));\\nxyz/=1.0685e-7;\\nvec3 srgb=XYZ_TO_REC709*xyz;\\nreturn srgb;\\n}\\nvec3 evalIridescence(float outsideIOR,float eta2,float cosTheta1,float thinFilmThickness,vec3 baseF0) {\\nvec3 I=vec3(1.0);\\nfloat iridescenceIOR=mix(outsideIOR,eta2,smoothstep(0.0,0.03,thinFilmThickness));\\nfloat sinTheta2Sq=square(outsideIOR/iridescenceIOR)*(1.0-square(cosTheta1));\\nfloat cosTheta2Sq=1.0-sinTheta2Sq;\\nif (cosTheta2Sq<0.0) {\\nreturn I;\\n}\\nfloat cosTheta2=sqrt(cosTheta2Sq);\\nfloat R0=getR0fromIORs(iridescenceIOR,outsideIOR);\\nfloat R12=fresnelSchlickGGX(cosTheta1,R0,1.);\\nfloat R21=R12;\\nfloat T121=1.0-R12;\\nfloat phi12=0.0;\\nif (iridescenceIOR0\\n#if defined(WEBGL2) || defined(WEBGPU)\\nfloat radicalInverse_VdC(uint bits) \\n{\\nbits=(bits<<16u) | (bits>>16u);\\nbits=((bits & 0x55555555u)<<1u) | ((bits & 0xAAAAAAAAu)>>1u);\\nbits=((bits & 0x33333333u)<<2u) | ((bits & 0xCCCCCCCCu)>>2u);\\nbits=((bits & 0x0F0F0F0Fu)<<4u) | ((bits & 0xF0F0F0F0u)>>4u);\\nbits=((bits & 0x00FF00FFu)<<8u) | ((bits & 0xFF00FF00u)>>8u);\\nreturn float(bits)*2.3283064365386963e-10; \\n}\\nvec2 hammersley(uint i,uint N)\\n{\\nreturn vec2(float(i)/float(N),radicalInverse_VdC(i));\\n}\\n#else\\nfloat vanDerCorpus(int n,int base)\\n{\\nfloat invBase=1.0/float(base);\\nfloat denom =1.0;\\nfloat result =0.0;\\nfor(int i=0; i<32; ++i)\\n{\\nif(n>0)\\n{\\ndenom =mod(float(n),2.0);\\nresult+=denom*invBase;\\ninvBase=invBase/2.0;\\nn =int(float(n)/2.0);\\n}\\n}\\nreturn result;\\n}\\nvec2 hammersley(int i,int N)\\n{\\nreturn vec2(float(i)/float(N),vanDerCorpus(i,2));\\n}\\n#endif\\nfloat log4(float x) {\\nreturn log2(x)/2.;\\n}\\nconst float NUM_SAMPLES_FLOAT=float(NUM_SAMPLES);\\nconst float NUM_SAMPLES_FLOAT_INVERSED=1./NUM_SAMPLES_FLOAT;\\nconst float K=4.;\\n#define inline\\nvec3 irradiance(samplerCube inputTexture,vec3 inputN,vec2 filteringInfo)\\n{\\nvec3 n=normalize(inputN);\\nvec3 result=vec3(0.0);\\nvec3 tangent=abs(n.z)<0.999 ? vec3(0.,0.,1.) : vec3(1.,0.,0.);\\ntangent=normalize(cross(tangent,n));\\nvec3 bitangent=cross(n,tangent);\\nmat3 tbn=mat3(tangent,bitangent,n);\\nfloat maxLevel=filteringInfo.y;\\nfloat dim0=filteringInfo.x;\\nfloat omegaP=(4.*PI)/(6.*dim0*dim0);\\n#if defined(WEBGL2) || defined(WEBGPU)\\nfor(uint i=0u; i0.) {\\nfloat pdf_inversed=PI/NoL;\\nfloat omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;\\nfloat l=log4(omegaS)-log4(omegaP)+log4(K);\\nfloat mipLevel=clamp(l,0.0,maxLevel);\\nvec3 c=textureCubeLodEXT(inputTexture,tbn*Ls,mipLevel).rgb;\\n#ifdef GAMMA_INPUT\\nc=toLinearSpace(c);\\n#endif\\nresult+=c;\\n}\\n}\\nresult=result*NUM_SAMPLES_FLOAT_INVERSED;\\nreturn result;\\n}\\n#define inline\\nvec3 radiance(float alphaG,samplerCube inputTexture,vec3 inputN,vec2 filteringInfo)\\n{\\nvec3 n=normalize(inputN);\\nif (alphaG==0.) {\\nvec3 c=textureCube(inputTexture,n).rgb;\\n#ifdef GAMMA_INPUT\\nc=toLinearSpace(c);\\n#endif\\nreturn c;\\n} else {\\nvec3 result=vec3(0.);\\nvec3 tangent=abs(n.z)<0.999 ? vec3(0.,0.,1.) : vec3(1.,0.,0.);\\ntangent=normalize(cross(tangent,n));\\nvec3 bitangent=cross(n,tangent);\\nmat3 tbn=mat3(tangent,bitangent,n);\\nfloat maxLevel=filteringInfo.y;\\nfloat dim0=filteringInfo.x;\\nfloat omegaP=(4.*PI)/(6.*dim0*dim0);\\nfloat weight=0.;\\n#if defined(WEBGL2) || defined(WEBGPU)\\nfor(uint i=0u; i0.) {\\nfloat pdf_inversed=4./normalDistributionFunction_TrowbridgeReitzGGX(NoH,alphaG);\\nfloat omegaS=NUM_SAMPLES_FLOAT_INVERSED*pdf_inversed;\\nfloat l=log4(omegaS)-log4(omegaP)+log4(K);\\nfloat mipLevel=clamp(float(l),0.0,maxLevel);\\nweight+=NoL;\\nvec3 c=textureCubeLodEXT(inputTexture,tbn*L,mipLevel).rgb;\\n#ifdef GAMMA_INPUT\\nc=toLinearSpace(c);\\n#endif\\nresult+=c*NoL;\\n}\\n}\\nresult=result/weight;\\nreturn result;\\n}\\n}\\n#endif\\n#endif\\n\";It.IncludesShadersStore.pbrDirectLightingFunctions=\"#define CLEARCOATREFLECTANCE90 1.0\\nstruct lightingInfo\\n{\\nvec3 diffuse;\\n#ifdef SPECULARTERM\\nvec3 specular;\\n#endif\\n#ifdef CLEARCOAT\\nvec4 clearCoat;\\n#endif\\n#ifdef SHEEN\\nvec3 sheen;\\n#endif\\n};\\nfloat adjustRoughnessFromLightProperties(float roughness,float lightRadius,float lightDistance) {\\n#if defined(USEPHYSICALLIGHTFALLOFF) || defined(USEGLTFLIGHTFALLOFF)\\nfloat lightRoughness=lightRadius/lightDistance;\\nfloat totalRoughness=saturate(lightRoughness+roughness);\\nreturn totalRoughness;\\n#else\\nreturn roughness;\\n#endif\\n}\\nvec3 computeHemisphericDiffuseLighting(preLightingInfo info,vec3 lightColor,vec3 groundColor) {\\nreturn mix(groundColor,lightColor,info.NdotL);\\n}\\nvec3 computeDiffuseLighting(preLightingInfo info,vec3 lightColor) {\\nfloat diffuseTerm=diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.roughness);\\nreturn diffuseTerm*info.attenuation*info.NdotL*lightColor;\\n}\\n#define inline\\nvec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix){\\nvec4 strq=textureProjectionMatrix*vec4(vPositionW,1.0);\\nstrq/=strq.w;\\nvec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;\\nreturn toLinearSpace(textureColor);\\n}\\n#ifdef SS_TRANSLUCENCY\\nvec3 computeDiffuseAndTransmittedLighting(preLightingInfo info,vec3 lightColor,vec3 transmittance) {\\nfloat NdotL=absEps(info.NdotLUnclamped);\\nfloat wrapNdotL=computeWrappedDiffuseNdotL(NdotL,0.02);\\nfloat trAdapt=step(0.,info.NdotLUnclamped);\\nvec3 transmittanceNdotL=mix(transmittance*wrapNdotL,vec3(wrapNdotL),trAdapt);\\nfloat diffuseTerm=diffuseBRDF_Burley(NdotL,info.NdotV,info.VdotH,info.roughness);\\nreturn diffuseTerm*transmittanceNdotL*info.attenuation*lightColor;\\n}\\n#endif\\n#ifdef SPECULARTERM\\nvec3 computeSpecularLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {\\nfloat NdotH=saturateEps(dot(N,info.H));\\nfloat roughness=max(info.roughness,geometricRoughnessFactor);\\nfloat alphaG=convertRoughnessToAverageSlope(roughness);\\nvec3 fresnel=fresnelSchlickGGX(info.VdotH,reflectance0,reflectance90);\\n#ifdef IRIDESCENCE\\nfresnel=mix(fresnel,reflectance0,info.iridescenceIntensity);\\n#endif\\nfloat distribution=normalDistributionFunction_TrowbridgeReitzGGX(NdotH,alphaG);\\n#ifdef BRDF_V_HEIGHT_CORRELATED\\nfloat smithVisibility=smithVisibility_GGXCorrelated(info.NdotL,info.NdotV,alphaG);\\n#else\\nfloat smithVisibility=smithVisibility_TrowbridgeReitzGGXFast(info.NdotL,info.NdotV,alphaG);\\n#endif\\nvec3 specTerm=fresnel*distribution*smithVisibility;\\nreturn specTerm*info.attenuation*info.NdotL*lightColor;\\n}\\n#endif\\n#ifdef ANISOTROPIC\\nvec3 computeAnisotropicSpecularLighting(preLightingInfo info,vec3 V,vec3 N,vec3 T,vec3 B,float anisotropy,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {\\nfloat NdotH=saturateEps(dot(N,info.H));\\nfloat TdotH=dot(T,info.H);\\nfloat BdotH=dot(B,info.H);\\nfloat TdotV=dot(T,V);\\nfloat BdotV=dot(B,V);\\nfloat TdotL=dot(T,info.L);\\nfloat BdotL=dot(B,info.L);\\nfloat alphaG=convertRoughnessToAverageSlope(info.roughness);\\nvec2 alphaTB=getAnisotropicRoughness(alphaG,anisotropy);\\nalphaTB=max(alphaTB,square(geometricRoughnessFactor));\\nvec3 fresnel=fresnelSchlickGGX(info.VdotH,reflectance0,reflectance90);\\n#ifdef IRIDESCENCE\\nfresnel=mix(fresnel,reflectance0,info.iridescenceIntensity);\\n#endif\\nfloat distribution=normalDistributionFunction_BurleyGGX_Anisotropic(NdotH,TdotH,BdotH,alphaTB);\\nfloat smithVisibility=smithVisibility_GGXCorrelated_Anisotropic(info.NdotL,info.NdotV,TdotV,BdotV,TdotL,BdotL,alphaTB);\\nvec3 specTerm=fresnel*distribution*smithVisibility;\\nreturn specTerm*info.attenuation*info.NdotL*lightColor;\\n}\\n#endif\\n#ifdef CLEARCOAT\\nvec4 computeClearCoatLighting(preLightingInfo info,vec3 Ncc,float geometricRoughnessFactor,float clearCoatIntensity,vec3 lightColor) {\\nfloat NccdotL=saturateEps(dot(Ncc,info.L));\\nfloat NccdotH=saturateEps(dot(Ncc,info.H));\\nfloat clearCoatRoughness=max(info.roughness,geometricRoughnessFactor);\\nfloat alphaG=convertRoughnessToAverageSlope(clearCoatRoughness);\\nfloat fresnel=fresnelSchlickGGX(info.VdotH,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);\\nfresnel*=clearCoatIntensity;\\nfloat distribution=normalDistributionFunction_TrowbridgeReitzGGX(NccdotH,alphaG);\\nfloat kelemenVisibility=visibility_Kelemen(info.VdotH);\\nfloat clearCoatTerm=fresnel*distribution*kelemenVisibility;\\nreturn vec4(\\nclearCoatTerm*info.attenuation*NccdotL*lightColor,\\n1.0-fresnel\\n);\\n}\\nvec3 computeClearCoatLightingAbsorption(float NdotVRefract,vec3 L,vec3 Ncc,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {\\nvec3 LRefract=-refract(L,Ncc,vClearCoatRefractionParams.y);\\nfloat NdotLRefract=saturateEps(dot(Ncc,LRefract));\\nvec3 absorption=computeClearCoatAbsorption(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness,clearCoatIntensity);\\nreturn absorption;\\n}\\n#endif\\n#ifdef SHEEN\\nvec3 computeSheenLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {\\nfloat NdotH=saturateEps(dot(N,info.H));\\nfloat roughness=max(info.roughness,geometricRoughnessFactor);\\nfloat alphaG=convertRoughnessToAverageSlope(roughness);\\nfloat fresnel=1.;\\nfloat distribution=normalDistributionFunction_CharlieSheen(NdotH,alphaG);\\n/*#ifdef SHEEN_SOFTER\\nfloat visibility=visibility_CharlieSheen(info.NdotL,info.NdotV,alphaG);\\n#else */\\nfloat visibility=visibility_Ashikhmin(info.NdotL,info.NdotV);\\n/* #endif */\\nfloat sheenTerm=fresnel*distribution*visibility;\\nreturn sheenTerm*info.attenuation*info.NdotL*lightColor;\\n}\\n#endif\\n\";It.IncludesShadersStore.pbrIBLFunctions=\"#if defined(REFLECTION) || defined(SS_REFRACTION)\\nfloat getLodFromAlphaG(float cubeMapDimensionPixels,float microsurfaceAverageSlope) {\\nfloat microsurfaceAverageSlopeTexels=cubeMapDimensionPixels*microsurfaceAverageSlope;\\nfloat lod=log2(microsurfaceAverageSlopeTexels);\\nreturn lod;\\n}\\nfloat getLinearLodFromRoughness(float cubeMapDimensionPixels,float roughness) {\\nfloat lod=log2(cubeMapDimensionPixels)*roughness;\\nreturn lod;\\n}\\n#endif\\n#if defined(ENVIRONMENTBRDF) && defined(RADIANCEOCCLUSION)\\nfloat environmentRadianceOcclusion(float ambientOcclusion,float NdotVUnclamped) {\\nfloat temp=NdotVUnclamped+ambientOcclusion;\\nreturn saturate(square(temp)-1.0+ambientOcclusion);\\n}\\n#endif\\n#if defined(ENVIRONMENTBRDF) && defined(HORIZONOCCLUSION)\\nfloat environmentHorizonOcclusion(vec3 view,vec3 normal,vec3 geometricNormal) {\\nvec3 reflection=reflect(view,normal);\\nfloat temp=saturate(1.0+1.1*dot(reflection,geometricNormal));\\nreturn square(temp);\\n}\\n#endif\\n#if defined(LODINREFLECTIONALPHA) || defined(SS_LODINREFRACTIONALPHA)\\n#define UNPACK_LOD(x) (1.0-x)*255.0\\nfloat getLodFromAlphaG(float cubeMapDimensionPixels,float alphaG,float NdotV) {\\nfloat microsurfaceAverageSlope=alphaG;\\nmicrosurfaceAverageSlope*=sqrt(abs(NdotV));\\nreturn getLodFromAlphaG(cubeMapDimensionPixels,microsurfaceAverageSlope);\\n}\\n#endif\\n\";It.IncludesShadersStore.pbrBlockAlbedoOpacity=\"struct albedoOpacityOutParams\\n{\\nvec3 surfaceAlbedo;\\nfloat alpha;\\n};\\n#define pbr_inline\\nvoid albedoOpacityBlock(\\nin vec4 vAlbedoColor,\\n#ifdef ALBEDO\\nin vec4 albedoTexture,\\nin vec2 albedoInfos,\\n#endif\\n#ifdef OPACITY\\nin vec4 opacityMap,\\nin vec2 vOpacityInfos,\\n#endif\\n#ifdef DETAIL\\nin vec4 detailColor,\\nin vec4 vDetailInfos,\\n#endif\\nout albedoOpacityOutParams outParams\\n)\\n{\\nvec3 surfaceAlbedo=vAlbedoColor.rgb;\\nfloat alpha=vAlbedoColor.a;\\n#ifdef ALBEDO\\n#if defined(ALPHAFROMALBEDO) || defined(ALPHATEST)\\nalpha*=albedoTexture.a;\\n#endif\\n#ifdef GAMMAALBEDO\\nsurfaceAlbedo*=toLinearSpace(albedoTexture.rgb);\\n#else\\nsurfaceAlbedo*=albedoTexture.rgb;\\n#endif\\nsurfaceAlbedo*=albedoInfos.y;\\n#endif\\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\\nsurfaceAlbedo*=vColor.rgb;\\n#endif\\n#ifdef DETAIL\\nfloat detailAlbedo=2.0*mix(0.5,detailColor.r,vDetailInfos.y);\\nsurfaceAlbedo.rgb=surfaceAlbedo.rgb*detailAlbedo*detailAlbedo; \\n#endif\\n#define CUSTOM_FRAGMENT_UPDATE_ALBEDO\\n#ifdef OPACITY\\n#ifdef OPACITYRGB\\nalpha=getLuminance(opacityMap.rgb);\\n#else\\nalpha*=opacityMap.a;\\n#endif\\nalpha*=vOpacityInfos.y;\\n#endif\\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\\nalpha*=vColor.a;\\n#endif\\n#if !defined(SS_LINKREFRACTIONTOTRANSPARENCY) && !defined(ALPHAFRESNEL)\\n#ifdef ALPHATEST\\nif (alpha0\\nvec4 surfaceMetallicColorMap;\\nvec4 surfaceReflectivityColorMap;\\nvec2 metallicRoughness;\\nvec3 metallicF0;\\n#endif\\n};\\n#define pbr_inline\\nvoid reflectivityBlock(\\nin vec4 vReflectivityColor,\\n#ifdef METALLICWORKFLOW\\nin vec3 surfaceAlbedo,\\nin vec4 metallicReflectanceFactors,\\n#endif\\n#ifdef REFLECTIVITY\\nin vec3 reflectivityInfos,\\nin vec4 surfaceMetallicOrReflectivityColorMap,\\n#endif\\n#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\\nin vec3 ambientOcclusionColorIn,\\n#endif\\n#ifdef MICROSURFACEMAP\\nin vec4 microSurfaceTexel,\\n#endif\\n#ifdef DETAIL\\nin vec4 detailColor,\\nin vec4 vDetailInfos,\\n#endif\\nout reflectivityOutParams outParams\\n)\\n{\\nfloat microSurface=vReflectivityColor.a;\\nvec3 surfaceReflectivityColor=vReflectivityColor.rgb;\\n#ifdef METALLICWORKFLOW\\nvec2 metallicRoughness=surfaceReflectivityColor.rg;\\n#ifdef REFLECTIVITY\\n#if DEBUGMODE>0\\noutParams.surfaceMetallicColorMap=surfaceMetallicOrReflectivityColorMap;\\n#endif\\n#ifdef AOSTOREINMETALMAPRED\\nvec3 aoStoreInMetalMap=vec3(surfaceMetallicOrReflectivityColorMap.r,surfaceMetallicOrReflectivityColorMap.r,surfaceMetallicOrReflectivityColorMap.r);\\noutParams.ambientOcclusionColor=mix(ambientOcclusionColorIn,aoStoreInMetalMap,reflectivityInfos.z);\\n#endif\\n#ifdef METALLNESSSTOREINMETALMAPBLUE\\nmetallicRoughness.r*=surfaceMetallicOrReflectivityColorMap.b;\\n#else\\nmetallicRoughness.r*=surfaceMetallicOrReflectivityColorMap.r;\\n#endif\\n#ifdef ROUGHNESSSTOREINMETALMAPALPHA\\nmetallicRoughness.g*=surfaceMetallicOrReflectivityColorMap.a;\\n#else\\n#ifdef ROUGHNESSSTOREINMETALMAPGREEN\\nmetallicRoughness.g*=surfaceMetallicOrReflectivityColorMap.g;\\n#endif\\n#endif\\n#endif\\n#ifdef DETAIL\\nfloat detailRoughness=mix(0.5,detailColor.b,vDetailInfos.w);\\nfloat loLerp=mix(0.,metallicRoughness.g,detailRoughness*2.);\\nfloat hiLerp=mix(metallicRoughness.g,1.,(detailRoughness-0.5)*2.);\\nmetallicRoughness.g=mix(loLerp,hiLerp,step(detailRoughness,0.5));\\n#endif\\n#ifdef MICROSURFACEMAP\\nmetallicRoughness.g*=microSurfaceTexel.r;\\n#endif\\n#if DEBUGMODE>0\\noutParams.metallicRoughness=metallicRoughness;\\n#endif\\n#define CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS\\nmicroSurface=1.0-metallicRoughness.g;\\nvec3 baseColor=surfaceAlbedo;\\n#ifdef FROSTBITE_REFLECTANCE\\noutParams.surfaceAlbedo=baseColor.rgb*(1.0-metallicRoughness.r);\\nsurfaceReflectivityColor=mix(0.16*reflectance*reflectance,baseColor,metallicRoughness.r);\\n#else\\nvec3 metallicF0=metallicReflectanceFactors.rgb;\\n#if DEBUGMODE>0\\noutParams.metallicF0=metallicF0;\\n#endif\\noutParams.surfaceAlbedo=mix(baseColor.rgb*(1.0-metallicF0),vec3(0.,0.,0.),metallicRoughness.r);\\nsurfaceReflectivityColor=mix(metallicF0,baseColor,metallicRoughness.r);\\n#endif\\n#else\\n#ifdef REFLECTIVITY\\nsurfaceReflectivityColor*=surfaceMetallicOrReflectivityColorMap.rgb;\\n#if DEBUGMODE>0\\noutParams.surfaceReflectivityColorMap=surfaceMetallicOrReflectivityColorMap;\\n#endif\\n#ifdef MICROSURFACEFROMREFLECTIVITYMAP\\nmicroSurface*=surfaceMetallicOrReflectivityColorMap.a;\\nmicroSurface*=reflectivityInfos.z;\\n#else\\n#ifdef MICROSURFACEAUTOMATIC\\nmicroSurface*=computeDefaultMicroSurface(microSurface,surfaceReflectivityColor);\\n#endif\\n#ifdef MICROSURFACEMAP\\nmicroSurface*=microSurfaceTexel.r;\\n#endif\\n#define CUSTOM_FRAGMENT_UPDATE_MICROSURFACE\\n#endif\\n#endif\\n#endif\\nmicroSurface=saturate(microSurface);\\nfloat roughness=1.-microSurface;\\noutParams.microSurface=microSurface;\\noutParams.roughness=roughness;\\noutParams.surfaceReflectivityColor=surfaceReflectivityColor;\\n}\\n\";It.IncludesShadersStore.pbrBlockAmbientOcclusion=\"struct ambientOcclusionOutParams\\n{\\nvec3 ambientOcclusionColor;\\n#if DEBUGMODE>0\\nvec3 ambientOcclusionColorMap;\\n#endif\\n};\\n#define pbr_inline\\nvoid ambientOcclusionBlock(\\n#ifdef AMBIENT\\nin vec3 ambientOcclusionColorMap_,\\nin vec4 vAmbientInfos,\\n#endif\\nout ambientOcclusionOutParams outParams\\n)\\n{\\nvec3 ambientOcclusionColor=vec3(1.,1.,1.);\\n#ifdef AMBIENT\\nvec3 ambientOcclusionColorMap=ambientOcclusionColorMap_*vAmbientInfos.y;\\n#ifdef AMBIENTINGRAYSCALE\\nambientOcclusionColorMap=vec3(ambientOcclusionColorMap.r,ambientOcclusionColorMap.r,ambientOcclusionColorMap.r);\\n#endif\\nambientOcclusionColor=mix(ambientOcclusionColor,ambientOcclusionColorMap,vAmbientInfos.z);\\n#if DEBUGMODE>0\\noutParams.ambientOcclusionColorMap=ambientOcclusionColorMap;\\n#endif\\n#endif\\noutParams.ambientOcclusionColor=ambientOcclusionColor;\\n}\\n\";It.IncludesShadersStore.pbrBlockAlphaFresnel=\"#ifdef ALPHAFRESNEL\\n#if defined(ALPHATEST) || defined(ALPHABLEND)\\nstruct alphaFresnelOutParams\\n{\\nfloat alpha;\\n};\\n#define pbr_inline\\nvoid alphaFresnelBlock(\\nin vec3 normalW,\\nin vec3 viewDirectionW,\\nin float alpha,\\nin float microSurface,\\nout alphaFresnelOutParams outParams\\n)\\n{\\nfloat opacityPerceptual=alpha;\\n#ifdef LINEARALPHAFRESNEL\\nfloat opacity0=opacityPerceptual;\\n#else\\nfloat opacity0=opacityPerceptual*opacityPerceptual;\\n#endif\\nfloat opacity90=fresnelGrazingReflectance(opacity0);\\nvec3 normalForward=faceforward(normalW,-viewDirectionW,normalW);\\noutParams.alpha=getReflectanceFromAnalyticalBRDFLookup_Jones(saturate(dot(viewDirectionW,normalForward)),vec3(opacity0),vec3(opacity90),sqrt(microSurface)).x;\\n#ifdef ALPHATEST\\nif (outParams.alpha0\\nvec3 anisotropyMapData;\\n#endif\\n};\\n#define pbr_inline\\nvoid anisotropicBlock(\\nin vec3 vAnisotropy,\\n#ifdef ANISOTROPIC_TEXTURE\\nin vec3 anisotropyMapData,\\n#endif\\nin mat3 TBN,\\nin vec3 normalW,\\nin vec3 viewDirectionW,\\nout anisotropicOutParams outParams\\n)\\n{\\nfloat anisotropy=vAnisotropy.b;\\nvec3 anisotropyDirection=vec3(vAnisotropy.xy,0.);\\n#ifdef ANISOTROPIC_TEXTURE\\nanisotropy*=anisotropyMapData.b;\\nanisotropyDirection.rg*=anisotropyMapData.rg*2.0-1.0;\\n#if DEBUGMODE>0\\noutParams.anisotropyMapData=anisotropyMapData;\\n#endif\\n#endif\\nmat3 anisoTBN=mat3(normalize(TBN[0]),normalize(TBN[1]),normalize(TBN[2]));\\nvec3 anisotropicTangent=normalize(anisoTBN*anisotropyDirection);\\nvec3 anisotropicBitangent=normalize(cross(anisoTBN[2],anisotropicTangent));\\noutParams.anisotropy=anisotropy;\\noutParams.anisotropicTangent=anisotropicTangent;\\noutParams.anisotropicBitangent=anisotropicBitangent;\\noutParams.anisotropicNormal=getAnisotropicBentNormals(anisotropicTangent,anisotropicBitangent,normalW,viewDirectionW,anisotropy);\\n}\\n#endif\\n\";It.IncludesShadersStore.pbrBlockReflection=\"#ifdef REFLECTION\\nstruct reflectionOutParams\\n{\\nvec4 environmentRadiance;\\nvec3 environmentIrradiance;\\n#ifdef REFLECTIONMAP_3D\\nvec3 reflectionCoords;\\n#else\\nvec2 reflectionCoords;\\n#endif\\n#ifdef SS_TRANSLUCENCY\\n#ifdef USESPHERICALFROMREFLECTIONMAP\\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\\nvec3 irradianceVector;\\n#endif\\n#endif\\n#endif\\n};\\n#define pbr_inline\\nvoid createReflectionCoords(\\nin vec3 vPositionW,\\nin vec3 normalW,\\n#ifdef ANISOTROPIC\\nin anisotropicOutParams anisotropicOut,\\n#endif\\n#ifdef REFLECTIONMAP_3D\\nout vec3 reflectionCoords\\n#else\\nout vec2 reflectionCoords\\n#endif\\n)\\n{\\n#ifdef ANISOTROPIC\\nvec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),anisotropicOut.anisotropicNormal);\\n#else\\nvec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\\n#endif\\n#ifdef REFLECTIONMAP_OPPOSITEZ\\nreflectionVector.z*=-1.0;\\n#endif\\n#ifdef REFLECTIONMAP_3D\\nreflectionCoords=reflectionVector;\\n#else\\nreflectionCoords=reflectionVector.xy;\\n#ifdef REFLECTIONMAP_PROJECTION\\nreflectionCoords/=reflectionVector.z;\\n#endif\\nreflectionCoords.y=1.0-reflectionCoords.y;\\n#endif\\n}\\n#define pbr_inline\\n#define inline\\nvoid sampleReflectionTexture(\\nin float alphaG,\\nin vec3 vReflectionMicrosurfaceInfos,\\nin vec2 vReflectionInfos,\\nin vec3 vReflectionColor,\\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\\nin float NdotVUnclamped,\\n#endif\\n#ifdef LINEARSPECULARREFLECTION\\nin float roughness,\\n#endif\\n#ifdef REFLECTIONMAP_3D\\nin samplerCube reflectionSampler,\\nconst vec3 reflectionCoords,\\n#else\\nin sampler2D reflectionSampler,\\nconst vec2 reflectionCoords,\\n#endif\\n#ifndef LODBASEDMICROSFURACE\\n#ifdef REFLECTIONMAP_3D\\nin samplerCube reflectionSamplerLow,\\nin samplerCube reflectionSamplerHigh,\\n#else\\nin sampler2D reflectionSamplerLow,\\nin sampler2D reflectionSamplerHigh,\\n#endif\\n#endif\\n#ifdef REALTIME_FILTERING\\nin vec2 vReflectionFilteringInfo,\\n#endif\\nout vec4 environmentRadiance\\n)\\n{\\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\\nfloat reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG,NdotVUnclamped);\\n#elif defined(LINEARSPECULARREFLECTION)\\nfloat reflectionLOD=getLinearLodFromRoughness(vReflectionMicrosurfaceInfos.x,roughness);\\n#else\\nfloat reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG);\\n#endif\\n#ifdef LODBASEDMICROSFURACE\\nreflectionLOD=reflectionLOD*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;\\n#ifdef LODINREFLECTIONALPHA\\nfloat automaticReflectionLOD=UNPACK_LOD(sampleReflection(reflectionSampler,reflectionCoords).a);\\nfloat requestedReflectionLOD=max(automaticReflectionLOD,reflectionLOD);\\n#else\\nfloat requestedReflectionLOD=reflectionLOD;\\n#endif\\n#ifdef REALTIME_FILTERING\\nenvironmentRadiance=vec4(radiance(alphaG,reflectionSampler,reflectionCoords,vReflectionFilteringInfo),1.0);\\n#else\\nenvironmentRadiance=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD);\\n#endif\\n#else\\nfloat lodReflectionNormalized=saturate(reflectionLOD/log2(vReflectionMicrosurfaceInfos.x));\\nfloat lodReflectionNormalizedDoubled=lodReflectionNormalized*2.0;\\nvec4 environmentMid=sampleReflection(reflectionSampler,reflectionCoords);\\nif (lodReflectionNormalizedDoubled<1.0){\\nenvironmentRadiance=mix(\\nsampleReflection(reflectionSamplerHigh,reflectionCoords),\\nenvironmentMid,\\nlodReflectionNormalizedDoubled\\n);\\n} else {\\nenvironmentRadiance=mix(\\nenvironmentMid,\\nsampleReflection(reflectionSamplerLow,reflectionCoords),\\nlodReflectionNormalizedDoubled-1.0\\n);\\n}\\n#endif\\n#ifdef RGBDREFLECTION\\nenvironmentRadiance.rgb=fromRGBD(environmentRadiance);\\n#endif\\n#ifdef GAMMAREFLECTION\\nenvironmentRadiance.rgb=toLinearSpace(environmentRadiance.rgb);\\n#endif\\nenvironmentRadiance.rgb*=vReflectionInfos.x;\\nenvironmentRadiance.rgb*=vReflectionColor.rgb;\\n}\\n#define pbr_inline\\n#define inline\\nvoid reflectionBlock(\\nin vec3 vPositionW,\\nin vec3 normalW,\\nin float alphaG,\\nin vec3 vReflectionMicrosurfaceInfos,\\nin vec2 vReflectionInfos,\\nin vec3 vReflectionColor,\\n#ifdef ANISOTROPIC\\nin anisotropicOutParams anisotropicOut,\\n#endif\\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\\nin float NdotVUnclamped,\\n#endif\\n#ifdef LINEARSPECULARREFLECTION\\nin float roughness,\\n#endif\\n#ifdef REFLECTIONMAP_3D\\nin samplerCube reflectionSampler,\\n#else\\nin sampler2D reflectionSampler,\\n#endif\\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX)\\nin vec3 vEnvironmentIrradiance,\\n#endif\\n#ifdef USESPHERICALFROMREFLECTIONMAP\\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\\nin mat4 reflectionMatrix,\\n#endif\\n#endif\\n#ifdef USEIRRADIANCEMAP\\n#ifdef REFLECTIONMAP_3D\\nin samplerCube irradianceSampler,\\n#else\\nin sampler2D irradianceSampler,\\n#endif\\n#endif\\n#ifndef LODBASEDMICROSFURACE\\n#ifdef REFLECTIONMAP_3D\\nin samplerCube reflectionSamplerLow,\\nin samplerCube reflectionSamplerHigh,\\n#else\\nin sampler2D reflectionSamplerLow,\\nin sampler2D reflectionSamplerHigh,\\n#endif\\n#endif\\n#ifdef REALTIME_FILTERING\\nin vec2 vReflectionFilteringInfo,\\n#endif\\nout reflectionOutParams outParams\\n)\\n{\\nvec4 environmentRadiance=vec4(0.,0.,0.,0.);\\n#ifdef REFLECTIONMAP_3D\\nvec3 reflectionCoords=vec3(0.);\\n#else\\nvec2 reflectionCoords=vec2(0.);\\n#endif\\ncreateReflectionCoords(\\nvPositionW,\\nnormalW,\\n#ifdef ANISOTROPIC\\nanisotropicOut,\\n#endif\\nreflectionCoords\\n);\\nsampleReflectionTexture(\\nalphaG,\\nvReflectionMicrosurfaceInfos,\\nvReflectionInfos,\\nvReflectionColor,\\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\\nNdotVUnclamped,\\n#endif\\n#ifdef LINEARSPECULARREFLECTION\\nroughness,\\n#endif\\n#ifdef REFLECTIONMAP_3D\\nreflectionSampler,\\nreflectionCoords,\\n#else\\nreflectionSampler,\\nreflectionCoords,\\n#endif\\n#ifndef LODBASEDMICROSFURACE\\nreflectionSamplerLow,\\nreflectionSamplerHigh,\\n#endif\\n#ifdef REALTIME_FILTERING\\nvReflectionFilteringInfo,\\n#endif\\nenvironmentRadiance\\n);\\nvec3 environmentIrradiance=vec3(0.,0.,0.);\\n#ifdef USESPHERICALFROMREFLECTIONMAP\\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX)\\nenvironmentIrradiance=vEnvironmentIrradiance;\\n#else\\n#ifdef ANISOTROPIC\\nvec3 irradianceVector=vec3(reflectionMatrix*vec4(anisotropicOut.anisotropicNormal,0)).xyz;\\n#else\\nvec3 irradianceVector=vec3(reflectionMatrix*vec4(normalW,0)).xyz;\\n#endif\\n#ifdef REFLECTIONMAP_OPPOSITEZ\\nirradianceVector.z*=-1.0;\\n#endif\\n#ifdef INVERTCUBICMAP\\nirradianceVector.y*=-1.0;\\n#endif\\n#if defined(REALTIME_FILTERING)\\nenvironmentIrradiance=irradiance(reflectionSampler,irradianceVector,vReflectionFilteringInfo);\\n#else\\nenvironmentIrradiance=computeEnvironmentIrradiance(irradianceVector);\\n#endif\\n#ifdef SS_TRANSLUCENCY\\noutParams.irradianceVector=irradianceVector;\\n#endif\\n#endif\\n#elif defined(USEIRRADIANCEMAP)\\nvec4 environmentIrradiance4=sampleReflection(irradianceSampler,reflectionCoords);\\nenvironmentIrradiance=environmentIrradiance4.rgb;\\n#ifdef RGBDREFLECTION\\nenvironmentIrradiance.rgb=fromRGBD(environmentIrradiance4);\\n#endif\\n#ifdef GAMMAREFLECTION\\nenvironmentIrradiance.rgb=toLinearSpace(environmentIrradiance.rgb);\\n#endif\\n#endif\\nenvironmentIrradiance*=vReflectionColor.rgb;\\noutParams.environmentRadiance=environmentRadiance;\\noutParams.environmentIrradiance=environmentIrradiance;\\noutParams.reflectionCoords=reflectionCoords;\\n}\\n#endif\\n\";It.IncludesShadersStore.pbrBlockSheen=\"#ifdef SHEEN\\nstruct sheenOutParams\\n{\\nfloat sheenIntensity;\\nvec3 sheenColor;\\nfloat sheenRoughness;\\n#ifdef SHEEN_LINKWITHALBEDO\\nvec3 surfaceAlbedo;\\n#endif\\n#if defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\\nfloat sheenAlbedoScaling;\\n#endif\\n#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\\nvec3 finalSheenRadianceScaled;\\n#endif\\n#if DEBUGMODE>0\\nvec4 sheenMapData;\\nvec3 sheenEnvironmentReflectance;\\n#endif\\n};\\n#define pbr_inline\\n#define inline\\nvoid sheenBlock(\\nin vec4 vSheenColor,\\n#ifdef SHEEN_ROUGHNESS\\nin float vSheenRoughness,\\n#if defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE)\\nin vec4 sheenMapRoughnessData,\\n#endif\\n#endif\\nin float roughness,\\n#ifdef SHEEN_TEXTURE\\nin vec4 sheenMapData,\\nin float sheenMapLevel,\\n#endif\\nin float reflectance,\\n#ifdef SHEEN_LINKWITHALBEDO\\nin vec3 baseColor,\\nin vec3 surfaceAlbedo,\\n#endif\\n#ifdef ENVIRONMENTBRDF\\nin float NdotV,\\nin vec3 environmentBrdf,\\n#endif\\n#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\\nin vec2 AARoughnessFactors,\\nin vec3 vReflectionMicrosurfaceInfos,\\nin vec2 vReflectionInfos,\\nin vec3 vReflectionColor,\\nin vec4 vLightingIntensity,\\n#ifdef REFLECTIONMAP_3D\\nin samplerCube reflectionSampler,\\nin vec3 reflectionCoords,\\n#else\\nin sampler2D reflectionSampler,\\nin vec2 reflectionCoords,\\n#endif\\nin float NdotVUnclamped,\\n#ifndef LODBASEDMICROSFURACE\\n#ifdef REFLECTIONMAP_3D\\nin samplerCube reflectionSamplerLow,\\nin samplerCube reflectionSamplerHigh,\\n#else\\nin sampler2D reflectionSamplerLow,\\nin sampler2D reflectionSamplerHigh,\\n#endif\\n#endif\\n#ifdef REALTIME_FILTERING\\nin vec2 vReflectionFilteringInfo,\\n#endif\\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)\\nin float seo,\\n#endif\\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)\\nin float eho,\\n#endif\\n#endif\\nout sheenOutParams outParams\\n)\\n{\\nfloat sheenIntensity=vSheenColor.a;\\n#ifdef SHEEN_TEXTURE\\n#if DEBUGMODE>0\\noutParams.sheenMapData=sheenMapData;\\n#endif\\n#endif\\n#ifdef SHEEN_LINKWITHALBEDO\\nfloat sheenFactor=pow5(1.0-sheenIntensity);\\nvec3 sheenColor=baseColor.rgb*(1.0-sheenFactor);\\nfloat sheenRoughness=sheenIntensity;\\noutParams.surfaceAlbedo=surfaceAlbedo*sheenFactor;\\n#ifdef SHEEN_TEXTURE\\nsheenIntensity*=sheenMapData.a;\\n#endif\\n#else\\nvec3 sheenColor=vSheenColor.rgb;\\n#ifdef SHEEN_TEXTURE\\n#ifdef SHEEN_GAMMATEXTURE\\nsheenColor.rgb*=toLinearSpace(sheenMapData.rgb);\\n#else\\nsheenColor.rgb*=sheenMapData.rgb;\\n#endif\\nsheenColor.rgb*=sheenMapLevel;\\n#endif\\n#ifdef SHEEN_ROUGHNESS\\nfloat sheenRoughness=vSheenRoughness;\\n#ifdef SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE\\n#if defined(SHEEN_TEXTURE)\\nsheenRoughness*=sheenMapData.a;\\n#endif\\n#elif defined(SHEEN_TEXTURE_ROUGHNESS)\\n#ifdef SHEEN_TEXTURE_ROUGHNESS_IDENTICAL\\nsheenRoughness*=sheenMapData.a;\\n#else\\nsheenRoughness*=sheenMapRoughnessData.a;\\n#endif\\n#endif\\n#else\\nfloat sheenRoughness=roughness;\\n#ifdef SHEEN_TEXTURE\\nsheenIntensity*=sheenMapData.a;\\n#endif\\n#endif\\n#if !defined(SHEEN_ALBEDOSCALING)\\nsheenIntensity*=(1.-reflectance);\\n#endif\\nsheenColor*=sheenIntensity;\\n#endif\\n#ifdef ENVIRONMENTBRDF\\n/*#ifdef SHEEN_SOFTER\\nvec3 environmentSheenBrdf=vec3(0.,0.,getBRDFLookupCharlieSheen(NdotV,sheenRoughness));\\n#else*/\\n#ifdef SHEEN_ROUGHNESS\\nvec3 environmentSheenBrdf=getBRDFLookup(NdotV,sheenRoughness);\\n#else\\nvec3 environmentSheenBrdf=environmentBrdf;\\n#endif\\n/*#endif*/\\n#endif\\n#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\\nfloat sheenAlphaG=convertRoughnessToAverageSlope(sheenRoughness);\\n#ifdef SPECULARAA\\nsheenAlphaG+=AARoughnessFactors.y;\\n#endif\\nvec4 environmentSheenRadiance=vec4(0.,0.,0.,0.);\\nsampleReflectionTexture(\\nsheenAlphaG,\\nvReflectionMicrosurfaceInfos,\\nvReflectionInfos,\\nvReflectionColor,\\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\\nNdotVUnclamped,\\n#endif\\n#ifdef LINEARSPECULARREFLECTION\\nsheenRoughness,\\n#endif\\nreflectionSampler,\\nreflectionCoords,\\n#ifndef LODBASEDMICROSFURACE\\nreflectionSamplerLow,\\nreflectionSamplerHigh,\\n#endif\\n#ifdef REALTIME_FILTERING\\nvReflectionFilteringInfo,\\n#endif\\nenvironmentSheenRadiance\\n);\\nvec3 sheenEnvironmentReflectance=getSheenReflectanceFromBRDFLookup(sheenColor,environmentSheenBrdf);\\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)\\nsheenEnvironmentReflectance*=seo;\\n#endif\\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)\\nsheenEnvironmentReflectance*=eho;\\n#endif\\n#if DEBUGMODE>0\\noutParams.sheenEnvironmentReflectance=sheenEnvironmentReflectance;\\n#endif\\noutParams.finalSheenRadianceScaled=\\nenvironmentSheenRadiance.rgb *\\nsheenEnvironmentReflectance *\\nvLightingIntensity.z;\\n#endif\\n#if defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\\noutParams.sheenAlbedoScaling=1.0-sheenIntensity*max(max(sheenColor.r,sheenColor.g),sheenColor.b)*environmentSheenBrdf.b;\\n#endif\\noutParams.sheenIntensity=sheenIntensity;\\noutParams.sheenColor=sheenColor;\\noutParams.sheenRoughness=sheenRoughness;\\n}\\n#endif\\n\";It.IncludesShadersStore.pbrBlockClearcoat=\"struct clearcoatOutParams\\n{\\nvec3 specularEnvironmentR0;\\nfloat conservationFactor;\\nvec3 clearCoatNormalW;\\nvec2 clearCoatAARoughnessFactors;\\nfloat clearCoatIntensity;\\nfloat clearCoatRoughness;\\n#ifdef REFLECTION\\nvec3 finalClearCoatRadianceScaled;\\n#endif\\n#ifdef CLEARCOAT_TINT\\nvec3 absorption;\\nfloat clearCoatNdotVRefract;\\nvec3 clearCoatColor;\\nfloat clearCoatThickness;\\n#endif\\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\\nvec3 energyConservationFactorClearCoat;\\n#endif\\n#if DEBUGMODE>0\\nmat3 TBNClearCoat;\\nvec2 clearCoatMapData;\\nvec4 clearCoatTintMapData;\\nvec4 environmentClearCoatRadiance;\\nfloat clearCoatNdotV;\\nvec3 clearCoatEnvironmentReflectance;\\n#endif\\n};\\n#ifdef CLEARCOAT\\n#define pbr_inline\\n#define inline\\nvoid clearcoatBlock(\\nin vec3 vPositionW,\\nin vec3 geometricNormalW,\\nin vec3 viewDirectionW,\\nin vec2 vClearCoatParams,\\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)\\nin vec4 clearCoatMapRoughnessData,\\n#endif\\nin vec3 specularEnvironmentR0,\\n#ifdef CLEARCOAT_TEXTURE\\nin vec2 clearCoatMapData,\\n#endif\\n#ifdef CLEARCOAT_TINT\\nin vec4 vClearCoatTintParams,\\nin float clearCoatColorAtDistance,\\nin vec4 vClearCoatRefractionParams,\\n#ifdef CLEARCOAT_TINT_TEXTURE\\nin vec4 clearCoatTintMapData,\\n#endif\\n#endif\\n#ifdef CLEARCOAT_BUMP\\nin vec2 vClearCoatBumpInfos,\\nin vec4 clearCoatBumpMapData,\\nin vec2 vClearCoatBumpUV,\\n#if defined(TANGENT) && defined(NORMAL)\\nin mat3 vTBN,\\n#else\\nin vec2 vClearCoatTangentSpaceParams,\\n#endif\\n#ifdef OBJECTSPACE_NORMALMAP\\nin mat4 normalMatrix,\\n#endif\\n#endif\\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\\nin vec3 faceNormal,\\n#endif\\n#ifdef REFLECTION\\nin vec3 vReflectionMicrosurfaceInfos,\\nin vec2 vReflectionInfos,\\nin vec3 vReflectionColor,\\nin vec4 vLightingIntensity,\\n#ifdef REFLECTIONMAP_3D\\nin samplerCube reflectionSampler,\\n#else\\nin sampler2D reflectionSampler,\\n#endif\\n#ifndef LODBASEDMICROSFURACE\\n#ifdef REFLECTIONMAP_3D\\nin samplerCube reflectionSamplerLow,\\nin samplerCube reflectionSamplerHigh,\\n#else\\nin sampler2D reflectionSamplerLow,\\nin sampler2D reflectionSamplerHigh,\\n#endif\\n#endif\\n#ifdef REALTIME_FILTERING\\nin vec2 vReflectionFilteringInfo,\\n#endif\\n#endif\\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\\n#ifdef RADIANCEOCCLUSION\\nin float ambientMonochrome,\\n#endif\\n#endif\\n#if defined(CLEARCOAT_BUMP) || defined(TWOSIDEDLIGHTING)\\nin float frontFacingMultiplier,\\n#endif\\nout clearcoatOutParams outParams\\n)\\n{\\nfloat clearCoatIntensity=vClearCoatParams.x;\\nfloat clearCoatRoughness=vClearCoatParams.y;\\n#ifdef CLEARCOAT_TEXTURE\\nclearCoatIntensity*=clearCoatMapData.x;\\n#ifdef CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE\\nclearCoatRoughness*=clearCoatMapData.y;\\n#endif\\n#if DEBUGMODE>0\\noutParams.clearCoatMapData=clearCoatMapData;\\n#endif\\n#endif\\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)\\n#ifdef CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL\\nclearCoatRoughness*=clearCoatMapData.y;\\n#else\\nclearCoatRoughness*=clearCoatMapRoughnessData.y;\\n#endif\\n#endif\\noutParams.clearCoatIntensity=clearCoatIntensity;\\noutParams.clearCoatRoughness=clearCoatRoughness;\\n#ifdef CLEARCOAT_TINT\\nvec3 clearCoatColor=vClearCoatTintParams.rgb;\\nfloat clearCoatThickness=vClearCoatTintParams.a;\\n#ifdef CLEARCOAT_TINT_TEXTURE\\n#ifdef CLEARCOAT_TINT_GAMMATEXTURE\\nclearCoatColor*=toLinearSpace(clearCoatTintMapData.rgb);\\n#else\\nclearCoatColor*=clearCoatTintMapData.rgb;\\n#endif\\nclearCoatThickness*=clearCoatTintMapData.a;\\n#if DEBUGMODE>0\\noutParams.clearCoatTintMapData=clearCoatTintMapData;\\n#endif\\n#endif\\noutParams.clearCoatColor=computeColorAtDistanceInMedia(clearCoatColor,clearCoatColorAtDistance);\\noutParams.clearCoatThickness=clearCoatThickness;\\n#endif\\n#ifdef CLEARCOAT_REMAP_F0\\nvec3 specularEnvironmentR0Updated=getR0RemappedForClearCoat(specularEnvironmentR0);\\n#else\\nvec3 specularEnvironmentR0Updated=specularEnvironmentR0;\\n#endif\\noutParams.specularEnvironmentR0=mix(specularEnvironmentR0,specularEnvironmentR0Updated,clearCoatIntensity);\\nvec3 clearCoatNormalW=geometricNormalW;\\n#ifdef CLEARCOAT_BUMP\\n#ifdef NORMALXYSCALE\\nfloat clearCoatNormalScale=1.0;\\n#else\\nfloat clearCoatNormalScale=vClearCoatBumpInfos.y;\\n#endif\\n#if defined(TANGENT) && defined(NORMAL)\\nmat3 TBNClearCoat=vTBN;\\n#else\\nvec2 TBNClearCoatUV=vClearCoatBumpUV*frontFacingMultiplier;\\nmat3 TBNClearCoat=cotangent_frame(clearCoatNormalW*clearCoatNormalScale,vPositionW,TBNClearCoatUV,vClearCoatTangentSpaceParams);\\n#endif\\n#if DEBUGMODE>0\\noutParams.TBNClearCoat=TBNClearCoat;\\n#endif\\n#ifdef OBJECTSPACE_NORMALMAP\\nclearCoatNormalW=normalize(clearCoatBumpMapData.xyz *2.0-1.0);\\nclearCoatNormalW=normalize(mat3(normalMatrix)*clearCoatNormalW);\\n#else\\nclearCoatNormalW=perturbNormal(TBNClearCoat,clearCoatBumpMapData.xyz,vClearCoatBumpInfos.y);\\n#endif\\n#endif\\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\\nclearCoatNormalW*=sign(dot(clearCoatNormalW,faceNormal));\\n#endif\\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\\nclearCoatNormalW=clearCoatNormalW*frontFacingMultiplier;\\n#endif\\noutParams.clearCoatNormalW=clearCoatNormalW;\\noutParams.clearCoatAARoughnessFactors=getAARoughnessFactors(clearCoatNormalW.xyz);\\nfloat clearCoatNdotVUnclamped=dot(clearCoatNormalW,viewDirectionW);\\nfloat clearCoatNdotV=absEps(clearCoatNdotVUnclamped);\\n#if DEBUGMODE>0\\noutParams.clearCoatNdotV=clearCoatNdotV;\\n#endif\\n#ifdef CLEARCOAT_TINT\\nvec3 clearCoatVRefract=refract(-viewDirectionW,clearCoatNormalW,vClearCoatRefractionParams.y);\\noutParams.clearCoatNdotVRefract=absEps(dot(clearCoatNormalW,clearCoatVRefract));\\n#endif\\n#if defined(ENVIRONMENTBRDF) && (!defined(REFLECTIONMAP_SKYBOX) || defined(MS_BRDF_ENERGY_CONSERVATION))\\nvec3 environmentClearCoatBrdf=getBRDFLookup(clearCoatNdotV,clearCoatRoughness);\\n#endif\\n#if defined(REFLECTION)\\nfloat clearCoatAlphaG=convertRoughnessToAverageSlope(clearCoatRoughness);\\n#ifdef SPECULARAA\\nclearCoatAlphaG+=outParams.clearCoatAARoughnessFactors.y;\\n#endif\\nvec4 environmentClearCoatRadiance=vec4(0.,0.,0.,0.);\\nvec3 clearCoatReflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),clearCoatNormalW);\\n#ifdef REFLECTIONMAP_OPPOSITEZ\\nclearCoatReflectionVector.z*=-1.0;\\n#endif\\n#ifdef REFLECTIONMAP_3D\\nvec3 clearCoatReflectionCoords=clearCoatReflectionVector;\\n#else\\nvec2 clearCoatReflectionCoords=clearCoatReflectionVector.xy;\\n#ifdef REFLECTIONMAP_PROJECTION\\nclearCoatReflectionCoords/=clearCoatReflectionVector.z;\\n#endif\\nclearCoatReflectionCoords.y=1.0-clearCoatReflectionCoords.y;\\n#endif\\nsampleReflectionTexture(\\nclearCoatAlphaG,\\nvReflectionMicrosurfaceInfos,\\nvReflectionInfos,\\nvReflectionColor,\\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\\nclearCoatNdotVUnclamped,\\n#endif\\n#ifdef LINEARSPECULARREFLECTION\\nclearCoatRoughness,\\n#endif\\nreflectionSampler,\\nclearCoatReflectionCoords,\\n#ifndef LODBASEDMICROSFURACE\\nreflectionSamplerLow,\\nreflectionSamplerHigh,\\n#endif\\n#ifdef REALTIME_FILTERING\\nvReflectionFilteringInfo,\\n#endif\\nenvironmentClearCoatRadiance\\n);\\n#if DEBUGMODE>0\\noutParams.environmentClearCoatRadiance=environmentClearCoatRadiance;\\n#endif\\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\\nvec3 clearCoatEnvironmentReflectance=getReflectanceFromBRDFLookup(vec3(vClearCoatRefractionParams.x),environmentClearCoatBrdf);\\n#ifdef RADIANCEOCCLUSION\\nfloat clearCoatSeo=environmentRadianceOcclusion(ambientMonochrome,clearCoatNdotVUnclamped);\\nclearCoatEnvironmentReflectance*=clearCoatSeo;\\n#endif\\n#ifdef HORIZONOCCLUSION\\n#ifdef BUMP\\n#ifdef REFLECTIONMAP_3D\\nfloat clearCoatEho=environmentHorizonOcclusion(-viewDirectionW,clearCoatNormalW,geometricNormalW);\\nclearCoatEnvironmentReflectance*=clearCoatEho;\\n#endif\\n#endif\\n#endif\\n#else\\nvec3 clearCoatEnvironmentReflectance=getReflectanceFromAnalyticalBRDFLookup_Jones(clearCoatNdotV,vec3(1.),vec3(1.),sqrt(1.-clearCoatRoughness));\\n#endif\\nclearCoatEnvironmentReflectance*=clearCoatIntensity;\\n#if DEBUGMODE>0\\noutParams.clearCoatEnvironmentReflectance=clearCoatEnvironmentReflectance;\\n#endif\\noutParams.finalClearCoatRadianceScaled=\\nenvironmentClearCoatRadiance.rgb *\\nclearCoatEnvironmentReflectance *\\nvLightingIntensity.z;\\n#endif\\n#if defined(CLEARCOAT_TINT)\\noutParams.absorption=computeClearCoatAbsorption(outParams.clearCoatNdotVRefract,outParams.clearCoatNdotVRefract,outParams.clearCoatColor,clearCoatThickness,clearCoatIntensity);\\n#endif\\nfloat fresnelIBLClearCoat=fresnelSchlickGGX(clearCoatNdotV,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);\\nfresnelIBLClearCoat*=clearCoatIntensity;\\noutParams.conservationFactor=(1.-fresnelIBLClearCoat);\\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\\noutParams.energyConservationFactorClearCoat=getEnergyConservationFactor(outParams.specularEnvironmentR0,environmentClearCoatBrdf);\\n#endif\\n}\\n#endif\\n\";It.IncludesShadersStore.pbrBlockIridescence=\"struct iridescenceOutParams\\n{\\nfloat iridescenceIntensity;\\nfloat iridescenceIOR;\\nfloat iridescenceThickness;\\nvec3 specularEnvironmentR0;\\n};\\n#ifdef IRIDESCENCE\\n#define pbr_inline\\n#define inline\\nvoid iridescenceBlock(\\nin vec4 vIridescenceParams,\\nin float viewAngle,\\nin vec3 specularEnvironmentR0,\\n#ifdef IRIDESCENCE_TEXTURE\\nin vec2 iridescenceMapData,\\n#endif\\n#ifdef IRIDESCENCE_THICKNESS_TEXTURE\\nin vec2 iridescenceThicknessMapData,\\n#endif\\n#ifdef CLEARCOAT\\nin float NdotVUnclamped,\\n#ifdef CLEARCOAT_TEXTURE\\nin vec2 clearCoatMapData,\\n#endif\\n#endif\\nout iridescenceOutParams outParams\\n)\\n{\\nfloat iridescenceIntensity=vIridescenceParams.x;\\nfloat iridescenceIOR=vIridescenceParams.y;\\nfloat iridescenceThicknessMin=vIridescenceParams.z;\\nfloat iridescenceThicknessMax=vIridescenceParams.w;\\nfloat iridescenceThicknessWeight=1.;\\n#ifdef IRIDESCENCE_TEXTURE\\niridescenceIntensity*=iridescenceMapData.x;\\n#ifdef IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE\\niridescenceThicknessWeight=iridescenceMapData.g;\\n#endif\\n#endif\\n#if defined(IRIDESCENCE_THICKNESS_TEXTURE)\\niridescenceThicknessWeight=iridescenceThicknessMapData.g;\\n#endif\\nfloat iridescenceThickness=mix(iridescenceThicknessMin,iridescenceThicknessMax,iridescenceThicknessWeight);\\nfloat topIor=1.; \\n#ifdef CLEARCOAT\\nfloat clearCoatIntensity=vClearCoatParams.x;\\n#ifdef CLEARCOAT_TEXTURE\\nclearCoatIntensity*=clearCoatMapData.x;\\n#endif\\ntopIor=mix(1.0,vClearCoatRefractionParams.w-1.,clearCoatIntensity);\\nviewAngle=sqrt(1.0+square(1.0/topIor)*(square(NdotVUnclamped)-1.0));\\n#endif\\nvec3 iridescenceFresnel=evalIridescence(topIor,iridescenceIOR,viewAngle,iridescenceThickness,specularEnvironmentR0);\\noutParams.specularEnvironmentR0=mix(specularEnvironmentR0,iridescenceFresnel,iridescenceIntensity);\\noutParams.iridescenceIntensity=iridescenceIntensity;\\noutParams.iridescenceThickness=iridescenceThickness;\\noutParams.iridescenceIOR=iridescenceIOR;\\n}\\n#endif\\n\";It.IncludesShadersStore.pbrBlockSubSurface=\"struct subSurfaceOutParams\\n{\\nvec3 specularEnvironmentReflectance;\\n#ifdef SS_REFRACTION\\nvec3 finalRefraction;\\nvec3 surfaceAlbedo;\\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\\nfloat alpha;\\n#endif\\n#ifdef REFLECTION\\nfloat refractionFactorForIrradiance;\\n#endif\\n#endif\\n#ifdef SS_TRANSLUCENCY\\nvec3 transmittance;\\nfloat translucencyIntensity;\\n#ifdef REFLECTION\\nvec3 refractionIrradiance;\\n#endif\\n#endif\\n#if DEBUGMODE>0\\nvec4 thicknessMap;\\nvec4 environmentRefraction;\\nvec3 refractionTransmittance;\\n#endif\\n};\\n#ifdef SUBSURFACE\\n#define pbr_inline\\n#define inline\\nvoid subSurfaceBlock(\\nin vec3 vSubSurfaceIntensity,\\nin vec2 vThicknessParam,\\nin vec4 vTintColor,\\nin vec3 normalW,\\nin vec3 specularEnvironmentReflectance,\\n#ifdef SS_THICKNESSANDMASK_TEXTURE\\nin vec4 thicknessMap,\\n#endif\\n#ifdef SS_REFRACTIONINTENSITY_TEXTURE\\nin vec4 refractionIntensityMap,\\n#endif\\n#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE\\nin vec4 translucencyIntensityMap,\\n#endif\\n#ifdef REFLECTION\\n#ifdef SS_TRANSLUCENCY\\nin mat4 reflectionMatrix,\\n#ifdef USESPHERICALFROMREFLECTIONMAP\\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\\nin vec3 irradianceVector_,\\n#endif\\n#if defined(REALTIME_FILTERING)\\nin samplerCube reflectionSampler,\\nin vec2 vReflectionFilteringInfo,\\n#endif\\n#endif\\n#ifdef USEIRRADIANCEMAP\\n#ifdef REFLECTIONMAP_3D\\nin samplerCube irradianceSampler,\\n#else\\nin sampler2D irradianceSampler,\\n#endif\\n#endif\\n#endif\\n#endif\\n#if defined(SS_REFRACTION) || defined(SS_TRANSLUCENCY)\\nin vec3 surfaceAlbedo,\\n#endif\\n#ifdef SS_REFRACTION\\nin vec3 vPositionW,\\nin vec3 viewDirectionW,\\nin mat4 view,\\nin vec4 vRefractionInfos,\\nin mat4 refractionMatrix,\\nin vec4 vRefractionMicrosurfaceInfos,\\nin vec4 vLightingIntensity,\\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\\nin float alpha,\\n#endif\\n#ifdef SS_LODINREFRACTIONALPHA\\nin float NdotVUnclamped,\\n#endif\\n#ifdef SS_LINEARSPECULARREFRACTION\\nin float roughness,\\n#endif\\nin float alphaG,\\n#ifdef SS_REFRACTIONMAP_3D\\nin samplerCube refractionSampler,\\n#ifndef LODBASEDMICROSFURACE\\nin samplerCube refractionSamplerLow,\\nin samplerCube refractionSamplerHigh,\\n#endif\\n#else\\nin sampler2D refractionSampler,\\n#ifndef LODBASEDMICROSFURACE\\nin sampler2D refractionSamplerLow,\\nin sampler2D refractionSamplerHigh,\\n#endif\\n#endif\\n#ifdef ANISOTROPIC\\nin anisotropicOutParams anisotropicOut,\\n#endif\\n#ifdef REALTIME_FILTERING\\nin vec2 vRefractionFilteringInfo,\\n#endif\\n#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC\\nin vec3 refractionPosition,\\nin vec3 refractionSize,\\n#endif\\n#endif\\n#ifdef SS_TRANSLUCENCY\\nin vec3 vDiffusionDistance,\\n#endif\\nout subSurfaceOutParams outParams\\n)\\n{\\noutParams.specularEnvironmentReflectance=specularEnvironmentReflectance;\\n#ifdef SS_REFRACTION\\nfloat refractionIntensity=vSubSurfaceIntensity.x;\\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\\nrefractionIntensity*=(1.0-alpha);\\noutParams.alpha=1.0;\\n#endif\\n#endif\\n#ifdef SS_TRANSLUCENCY\\nfloat translucencyIntensity=vSubSurfaceIntensity.y;\\n#endif\\n#ifdef SS_THICKNESSANDMASK_TEXTURE\\n#if defined(SS_USE_GLTF_TEXTURES)\\nfloat thickness=thicknessMap.g*vThicknessParam.y+vThicknessParam.x;\\n#else\\nfloat thickness=thicknessMap.r*vThicknessParam.y+vThicknessParam.x;\\n#endif\\n#if DEBUGMODE>0\\noutParams.thicknessMap=thicknessMap;\\n#endif\\n#ifdef SS_MASK_FROM_THICKNESS_TEXTURE\\n#if defined(SS_REFRACTION) && defined(SS_REFRACTION_USE_INTENSITY_FROM_TEXTURE)\\n#if defined(SS_USE_GLTF_TEXTURES)\\nrefractionIntensity*=thicknessMap.r;\\n#else\\nrefractionIntensity*=thicknessMap.g;\\n#endif\\n#endif\\n#if defined(SS_TRANSLUCENCY) && defined(SS_TRANSLUCENCY_USE_INTENSITY_FROM_TEXTURE)\\ntranslucencyIntensity*=thicknessMap.b;\\n#endif\\n#endif\\n#else\\nfloat thickness=vThicknessParam.y;\\n#endif\\n#ifdef SS_REFRACTIONINTENSITY_TEXTURE\\n#ifdef SS_USE_GLTF_TEXTURES\\nrefractionIntensity*=refractionIntensityMap.r;\\n#else\\nrefractionIntensity*=refractionIntensityMap.g;\\n#endif\\n#endif\\n#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE\\ntranslucencyIntensity*=translucencyIntensityMap.b;\\n#endif\\n#ifdef SS_TRANSLUCENCY\\nthickness=maxEps(thickness);\\nvec3 transmittance=transmittanceBRDF_Burley(vTintColor.rgb,vDiffusionDistance,thickness);\\ntransmittance*=translucencyIntensity;\\noutParams.transmittance=transmittance;\\noutParams.translucencyIntensity=translucencyIntensity;\\n#endif\\n#ifdef SS_REFRACTION\\nvec4 environmentRefraction=vec4(0.,0.,0.,0.);\\n#ifdef ANISOTROPIC\\nvec3 refractionVector=refract(-viewDirectionW,anisotropicOut.anisotropicNormal,vRefractionInfos.y);\\n#else\\nvec3 refractionVector=refract(-viewDirectionW,normalW,vRefractionInfos.y);\\n#endif\\n#ifdef SS_REFRACTIONMAP_OPPOSITEZ\\nrefractionVector.z*=-1.0;\\n#endif\\n#ifdef SS_REFRACTIONMAP_3D\\n#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC\\nrefractionVector=parallaxCorrectNormal(vPositionW,refractionVector,refractionSize,refractionPosition);\\n#endif\\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;\\nvec3 refractionCoords=refractionVector;\\nrefractionCoords=vec3(refractionMatrix*vec4(refractionCoords,0));\\n#else\\n#ifdef SS_USE_THICKNESS_AS_DEPTH\\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*thickness,1.0)));\\n#else\\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));\\n#endif\\nvec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;\\nrefractionCoords.y=1.0-refractionCoords.y;\\n#endif\\n#ifdef SS_HAS_THICKNESS\\nfloat ior=vRefractionInfos.y;\\n#else\\nfloat ior=vRefractionMicrosurfaceInfos.w;\\n#endif\\n#ifdef SS_LODINREFRACTIONALPHA\\nfloat refractionAlphaG=alphaG;\\nrefractionAlphaG=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));\\nfloat refractionLOD=getLodFromAlphaG(vRefractionMicrosurfaceInfos.x,refractionAlphaG,NdotVUnclamped);\\n#elif defined(SS_LINEARSPECULARREFRACTION)\\nfloat refractionRoughness=alphaG;\\nrefractionRoughness=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));\\nfloat refractionLOD=getLinearLodFromRoughness(vRefractionMicrosurfaceInfos.x,refractionRoughness);\\n#else\\nfloat refractionAlphaG=alphaG;\\nrefractionAlphaG=mix(alphaG,0.0,clamp(ior*3.0-2.0,0.0,1.0));\\nfloat refractionLOD=getLodFromAlphaG(vRefractionMicrosurfaceInfos.x,refractionAlphaG);\\n#endif\\n#ifdef LODBASEDMICROSFURACE\\nrefractionLOD=refractionLOD*vRefractionMicrosurfaceInfos.y+vRefractionMicrosurfaceInfos.z;\\n#ifdef SS_LODINREFRACTIONALPHA\\nfloat automaticRefractionLOD=UNPACK_LOD(sampleRefraction(refractionSampler,refractionCoords).a);\\nfloat requestedRefractionLOD=max(automaticRefractionLOD,refractionLOD);\\n#else\\nfloat requestedRefractionLOD=refractionLOD;\\n#endif\\n#ifdef REALTIME_FILTERING\\nenvironmentRefraction=vec4(radiance(alphaG,refractionSampler,refractionCoords,vRefractionFilteringInfo),1.0);\\n#else\\nenvironmentRefraction=sampleRefractionLod(refractionSampler,refractionCoords,requestedRefractionLOD);\\n#endif\\n#else\\nfloat lodRefractionNormalized=saturate(refractionLOD/log2(vRefractionMicrosurfaceInfos.x));\\nfloat lodRefractionNormalizedDoubled=lodRefractionNormalized*2.0;\\nvec4 environmentRefractionMid=sampleRefraction(refractionSampler,refractionCoords);\\nif (lodRefractionNormalizedDoubled<1.0){\\nenvironmentRefraction=mix(\\nsampleRefraction(refractionSamplerHigh,refractionCoords),\\nenvironmentRefractionMid,\\nlodRefractionNormalizedDoubled\\n);\\n} else {\\nenvironmentRefraction=mix(\\nenvironmentRefractionMid,\\nsampleRefraction(refractionSamplerLow,refractionCoords),\\nlodRefractionNormalizedDoubled-1.0\\n);\\n}\\n#endif\\n#ifdef SS_RGBDREFRACTION\\nenvironmentRefraction.rgb=fromRGBD(environmentRefraction);\\n#endif\\n#ifdef SS_GAMMAREFRACTION\\nenvironmentRefraction.rgb=toLinearSpace(environmentRefraction.rgb);\\n#endif\\nenvironmentRefraction.rgb*=vRefractionInfos.x;\\n#endif\\n#ifdef SS_REFRACTION\\nvec3 refractionTransmittance=vec3(refractionIntensity);\\n#ifdef SS_THICKNESSANDMASK_TEXTURE\\nvec3 volumeAlbedo=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);\\nrefractionTransmittance*=cocaLambert(volumeAlbedo,thickness);\\n#elif defined(SS_LINKREFRACTIONTOTRANSPARENCY)\\nfloat maxChannel=max(max(surfaceAlbedo.r,surfaceAlbedo.g),surfaceAlbedo.b);\\nvec3 volumeAlbedo=saturate(maxChannel*surfaceAlbedo);\\nenvironmentRefraction.rgb*=volumeAlbedo;\\n#else\\nvec3 volumeAlbedo=computeColorAtDistanceInMedia(vTintColor.rgb,vTintColor.w);\\nrefractionTransmittance*=cocaLambert(volumeAlbedo,vThicknessParam.y);\\n#endif\\n#ifdef SS_ALBEDOFORREFRACTIONTINT\\nenvironmentRefraction.rgb*=surfaceAlbedo.rgb;\\n#endif\\noutParams.surfaceAlbedo=surfaceAlbedo*(1.-refractionIntensity);\\n#ifdef REFLECTION\\noutParams.refractionFactorForIrradiance=(1.-refractionIntensity);\\n#endif\\n#ifdef UNUSED_MULTIPLEBOUNCES\\nvec3 bounceSpecularEnvironmentReflectance=(2.0*specularEnvironmentReflectance)/(1.0+specularEnvironmentReflectance);\\noutParams.specularEnvironmentReflectance=mix(bounceSpecularEnvironmentReflectance,specularEnvironmentReflectance,refractionIntensity);\\n#endif\\nrefractionTransmittance*=1.0-outParams.specularEnvironmentReflectance;\\n#if DEBUGMODE>0\\noutParams.refractionTransmittance=refractionTransmittance;\\n#endif\\noutParams.finalRefraction=environmentRefraction.rgb*refractionTransmittance*vLightingIntensity.z;\\n#if DEBUGMODE>0\\noutParams.environmentRefraction=environmentRefraction;\\n#endif\\n#endif\\n#if defined(REFLECTION) && defined(SS_TRANSLUCENCY)\\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX) || !defined(USESPHERICALFROMREFLECTIONMAP)\\nvec3 irradianceVector=vec3(reflectionMatrix*vec4(normalW,0)).xyz;\\n#ifdef REFLECTIONMAP_OPPOSITEZ\\nirradianceVector.z*=-1.0;\\n#endif\\n#ifdef INVERTCUBICMAP\\nirradianceVector.y*=-1.0;\\n#endif\\n#else\\nvec3 irradianceVector=irradianceVector_;\\n#endif\\n#if defined(USESPHERICALFROMREFLECTIONMAP)\\n#if defined(REALTIME_FILTERING)\\nvec3 refractionIrradiance=irradiance(reflectionSampler,-irradianceVector,vReflectionFilteringInfo);\\n#else\\nvec3 refractionIrradiance=computeEnvironmentIrradiance(-irradianceVector);\\n#endif\\n#elif defined(USEIRRADIANCEMAP)\\n#ifdef REFLECTIONMAP_3D\\nvec3 irradianceCoords=irradianceVector;\\n#else\\nvec2 irradianceCoords=irradianceVector.xy;\\n#ifdef REFLECTIONMAP_PROJECTION\\nirradianceCoords/=irradianceVector.z;\\n#endif\\nirradianceCoords.y=1.0-irradianceCoords.y;\\n#endif\\nvec4 refractionIrradiance=sampleReflection(irradianceSampler,-irradianceCoords);\\n#ifdef RGBDREFLECTION\\nrefractionIrradiance.rgb=fromRGBD(refractionIrradiance);\\n#endif\\n#ifdef GAMMAREFLECTION\\nrefractionIrradiance.rgb=toLinearSpace(refractionIrradiance.rgb);\\n#endif\\n#else\\nvec4 refractionIrradiance=vec4(0.);\\n#endif\\nrefractionIrradiance.rgb*=transmittance;\\n#ifdef SS_ALBEDOFORTRANSLUCENCYTINT\\nrefractionIrradiance.rgb*=surfaceAlbedo.rgb;\\n#endif\\noutParams.refractionIrradiance=refractionIrradiance.rgb;\\n#endif\\n}\\n#endif\\n\";It.IncludesShadersStore.pbrBlockNormalGeometric=\"vec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\\n#ifdef NORMAL\\nvec3 normalW=normalize(vNormalW);\\n#else\\nvec3 normalW=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;\\n#endif\\nvec3 geometricNormalW=normalW;\\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\\ngeometricNormalW=gl_FrontFacing ? geometricNormalW : -geometricNormalW;\\n#endif\\n\";It.IncludesShadersStore.pbrBlockNormalFinal=\"#if defined(FORCENORMALFORWARD) && defined(NORMAL)\\nvec3 faceNormal=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;\\n#if defined(TWOSIDEDLIGHTING)\\nfaceNormal=gl_FrontFacing ? faceNormal : -faceNormal;\\n#endif\\nnormalW*=sign(dot(normalW,faceNormal));\\n#endif\\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\\nnormalW=gl_FrontFacing ? normalW : -normalW;\\n#endif\\n\";It.IncludesShadersStore.pbrBlockLightmapInit=\"#ifdef LIGHTMAP\\nvec4 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset);\\n#ifdef RGBDLIGHTMAP\\nlightmapColor.rgb=fromRGBD(lightmapColor);\\n#endif\\n#ifdef GAMMALIGHTMAP\\nlightmapColor.rgb=toLinearSpace(lightmapColor.rgb);\\n#endif\\nlightmapColor.rgb*=vLightmapInfos.y;\\n#endif\\n\";It.IncludesShadersStore.pbrBlockGeometryInfo=\"float NdotVUnclamped=dot(normalW,viewDirectionW);\\nfloat NdotV=absEps(NdotVUnclamped);\\nfloat alphaG=convertRoughnessToAverageSlope(roughness);\\nvec2 AARoughnessFactors=getAARoughnessFactors(normalW.xyz);\\n#ifdef SPECULARAA\\nalphaG+=AARoughnessFactors.y;\\n#endif\\n#if defined(ENVIRONMENTBRDF)\\nvec3 environmentBrdf=getBRDFLookup(NdotV,roughness);\\n#endif\\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\\n#ifdef RADIANCEOCCLUSION\\n#ifdef AMBIENTINGRAYSCALE\\nfloat ambientMonochrome=aoOut.ambientOcclusionColor.r;\\n#else\\nfloat ambientMonochrome=getLuminance(aoOut.ambientOcclusionColor);\\n#endif\\nfloat seo=environmentRadianceOcclusion(ambientMonochrome,NdotVUnclamped);\\n#endif\\n#ifdef HORIZONOCCLUSION\\n#ifdef BUMP\\n#ifdef REFLECTIONMAP_3D\\nfloat eho=environmentHorizonOcclusion(-viewDirectionW,normalW,geometricNormalW);\\n#endif\\n#endif\\n#endif\\n#endif\\n\";It.IncludesShadersStore.pbrBlockReflectance0=\"float reflectance=max(max(reflectivityOut.surfaceReflectivityColor.r,reflectivityOut.surfaceReflectivityColor.g),reflectivityOut.surfaceReflectivityColor.b);\\nvec3 specularEnvironmentR0=reflectivityOut.surfaceReflectivityColor.rgb;\\n#ifdef METALLICWORKFLOW\\nvec3 specularEnvironmentR90=vec3(metallicReflectanceFactors.a);\\n#else \\nvec3 specularEnvironmentR90=vec3(1.0,1.0,1.0);\\n#endif\\n#ifdef ALPHAFRESNEL\\nfloat reflectance90=fresnelGrazingReflectance(reflectance);\\nspecularEnvironmentR90=specularEnvironmentR90*reflectance90;\\n#endif\\n\";It.IncludesShadersStore.pbrBlockReflectance=\"#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\\nvec3 specularEnvironmentReflectance=getReflectanceFromBRDFLookup(clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,environmentBrdf);\\n#ifdef RADIANCEOCCLUSION\\nspecularEnvironmentReflectance*=seo;\\n#endif\\n#ifdef HORIZONOCCLUSION\\n#ifdef BUMP\\n#ifdef REFLECTIONMAP_3D\\nspecularEnvironmentReflectance*=eho;\\n#endif\\n#endif\\n#endif\\n#else\\nvec3 specularEnvironmentReflectance=getReflectanceFromAnalyticalBRDFLookup_Jones(NdotV,clearcoatOut.specularEnvironmentR0,specularEnvironmentR90,sqrt(microSurface));\\n#endif\\n#ifdef CLEARCOAT\\nspecularEnvironmentReflectance*=clearcoatOut.conservationFactor;\\n#if defined(CLEARCOAT_TINT)\\nspecularEnvironmentReflectance*=clearcoatOut.absorption;\\n#endif\\n#endif\\n\";It.IncludesShadersStore.pbrBlockDirectLighting=\"vec3 diffuseBase=vec3(0.,0.,0.);\\n#ifdef SPECULARTERM\\nvec3 specularBase=vec3(0.,0.,0.);\\n#endif\\n#ifdef CLEARCOAT\\nvec3 clearCoatBase=vec3(0.,0.,0.);\\n#endif\\n#ifdef SHEEN\\nvec3 sheenBase=vec3(0.,0.,0.);\\n#endif\\npreLightingInfo preInfo;\\nlightingInfo info;\\nfloat shadow=1.; \\n#if defined(CLEARCOAT) && defined(CLEARCOAT_TINT)\\nvec3 absorption=vec3(0.);\\n#endif\\n\";It.IncludesShadersStore.pbrBlockFinalLitComponents=\"#if defined(ENVIRONMENTBRDF)\\n#ifdef MS_BRDF_ENERGY_CONSERVATION\\nvec3 energyConservationFactor=getEnergyConservationFactor(clearcoatOut.specularEnvironmentR0,environmentBrdf);\\n#endif\\n#endif\\n#ifndef METALLICWORKFLOW\\n#ifdef SPECULAR_GLOSSINESS_ENERGY_CONSERVATION\\nsurfaceAlbedo.rgb=(1.-reflectance)*surfaceAlbedo.rgb;\\n#endif\\n#endif\\n#if defined(SHEEN) && defined(SHEEN_ALBEDOSCALING) && defined(ENVIRONMENTBRDF)\\nsurfaceAlbedo.rgb=sheenOut.sheenAlbedoScaling*surfaceAlbedo.rgb;\\n#endif\\n#ifdef REFLECTION\\nvec3 finalIrradiance=reflectionOut.environmentIrradiance;\\n#if defined(CLEARCOAT)\\nfinalIrradiance*=clearcoatOut.conservationFactor;\\n#if defined(CLEARCOAT_TINT)\\nfinalIrradiance*=clearcoatOut.absorption;\\n#endif\\n#endif\\n#if defined(SS_REFRACTION)\\nfinalIrradiance*=subSurfaceOut.refractionFactorForIrradiance;\\n#endif\\n#if defined(SS_TRANSLUCENCY)\\nfinalIrradiance*=(1.0-subSurfaceOut.translucencyIntensity);\\nfinalIrradiance+=subSurfaceOut.refractionIrradiance;\\n#endif\\nfinalIrradiance*=surfaceAlbedo.rgb;\\nfinalIrradiance*=vLightingIntensity.z;\\nfinalIrradiance*=aoOut.ambientOcclusionColor;\\n#endif\\n#ifdef SPECULARTERM\\nvec3 finalSpecular=specularBase;\\nfinalSpecular=max(finalSpecular,0.0);\\nvec3 finalSpecularScaled=finalSpecular*vLightingIntensity.x*vLightingIntensity.w;\\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\\nfinalSpecularScaled*=energyConservationFactor;\\n#endif\\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\\nfinalSpecularScaled*=sheenOut.sheenAlbedoScaling;\\n#endif\\n#endif\\n#ifdef REFLECTION\\nvec3 finalRadiance=reflectionOut.environmentRadiance.rgb;\\nfinalRadiance*=subSurfaceOut.specularEnvironmentReflectance;\\nvec3 finalRadianceScaled=finalRadiance*vLightingIntensity.z;\\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\\nfinalRadianceScaled*=energyConservationFactor;\\n#endif\\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF) && defined(SHEEN_ALBEDOSCALING)\\nfinalRadianceScaled*=sheenOut.sheenAlbedoScaling;\\n#endif\\n#endif\\n#ifdef SHEEN\\nvec3 finalSheen=sheenBase*sheenOut.sheenColor;\\nfinalSheen=max(finalSheen,0.0);\\nvec3 finalSheenScaled=finalSheen*vLightingIntensity.x*vLightingIntensity.w;\\n#if defined(CLEARCOAT) && defined(REFLECTION) && defined(ENVIRONMENTBRDF)\\nsheenOut.finalSheenRadianceScaled*=clearcoatOut.conservationFactor;\\n#if defined(CLEARCOAT_TINT)\\nsheenOut.finalSheenRadianceScaled*=clearcoatOut.absorption;\\n#endif\\n#endif\\n#endif\\n#ifdef CLEARCOAT\\nvec3 finalClearCoat=clearCoatBase;\\nfinalClearCoat=max(finalClearCoat,0.0);\\nvec3 finalClearCoatScaled=finalClearCoat*vLightingIntensity.x*vLightingIntensity.w;\\n#if defined(ENVIRONMENTBRDF) && defined(MS_BRDF_ENERGY_CONSERVATION)\\nfinalClearCoatScaled*=clearcoatOut.energyConservationFactorClearCoat;\\n#endif\\n#ifdef SS_REFRACTION\\nsubSurfaceOut.finalRefraction*=clearcoatOut.conservationFactor;\\n#ifdef CLEARCOAT_TINT\\nsubSurfaceOut.finalRefraction*=clearcoatOut.absorption;\\n#endif\\n#endif\\n#endif\\n#ifdef ALPHABLEND\\nfloat luminanceOverAlpha=0.0;\\n#if defined(REFLECTION) && defined(RADIANCEOVERALPHA)\\nluminanceOverAlpha+=getLuminance(finalRadianceScaled);\\n#if defined(CLEARCOAT)\\nluminanceOverAlpha+=getLuminance(clearcoatOut.finalClearCoatRadianceScaled);\\n#endif\\n#endif\\n#if defined(SPECULARTERM) && defined(SPECULAROVERALPHA)\\nluminanceOverAlpha+=getLuminance(finalSpecularScaled);\\n#endif\\n#if defined(CLEARCOAT) && defined(CLEARCOATOVERALPHA)\\nluminanceOverAlpha+=getLuminance(finalClearCoatScaled);\\n#endif\\n#if defined(RADIANCEOVERALPHA) || defined(SPECULAROVERALPHA) || defined(CLEARCOATOVERALPHA)\\nalpha=saturate(alpha+luminanceOverAlpha*luminanceOverAlpha);\\n#endif\\n#endif\\n\";It.IncludesShadersStore.pbrBlockFinalUnlitComponents=\"vec3 finalDiffuse=diffuseBase;\\nfinalDiffuse*=surfaceAlbedo.rgb;\\nfinalDiffuse=max(finalDiffuse,0.0);\\nfinalDiffuse*=vLightingIntensity.x;\\nvec3 finalAmbient=vAmbientColor;\\nfinalAmbient*=surfaceAlbedo.rgb;\\nvec3 finalEmissive=vEmissiveColor;\\n#ifdef EMISSIVE\\nvec3 emissiveColorTex=texture2D(emissiveSampler,vEmissiveUV+uvOffset).rgb;\\n#ifdef GAMMAEMISSIVE\\nfinalEmissive*=toLinearSpace(emissiveColorTex.rgb);\\n#else\\nfinalEmissive*=emissiveColorTex.rgb;\\n#endif\\nfinalEmissive*= vEmissiveInfos.y;\\n#endif\\nfinalEmissive*=vLightingIntensity.y;\\n#ifdef AMBIENT\\nvec3 ambientOcclusionForDirectDiffuse=mix(vec3(1.),aoOut.ambientOcclusionColor,vAmbientInfos.w);\\n#else\\nvec3 ambientOcclusionForDirectDiffuse=aoOut.ambientOcclusionColor;\\n#endif\\nfinalAmbient*=aoOut.ambientOcclusionColor;\\nfinalDiffuse*=ambientOcclusionForDirectDiffuse;\\n\";It.IncludesShadersStore.pbrBlockFinalColorComposition=\"vec4 finalColor=vec4(\\nfinalAmbient +\\nfinalDiffuse +\\n#ifndef UNLIT\\n#ifdef REFLECTION\\nfinalIrradiance +\\n#endif\\n#ifdef SPECULARTERM\\nfinalSpecularScaled +\\n#endif\\n#ifdef SHEEN\\nfinalSheenScaled +\\n#endif\\n#ifdef CLEARCOAT\\nfinalClearCoatScaled +\\n#endif\\n#ifdef REFLECTION\\nfinalRadianceScaled +\\n#if defined(SHEEN) && defined(ENVIRONMENTBRDF)\\nsheenOut.finalSheenRadianceScaled +\\n#endif\\n#ifdef CLEARCOAT\\nclearcoatOut.finalClearCoatRadianceScaled +\\n#endif\\n#endif\\n#ifdef SS_REFRACTION\\nsubSurfaceOut.finalRefraction +\\n#endif\\n#endif\\nfinalEmissive,\\nalpha);\\n#ifdef LIGHTMAP\\n#ifndef LIGHTMAPEXCLUDED\\n#ifdef USELIGHTMAPASSHADOWMAP\\nfinalColor.rgb*=lightmapColor.rgb;\\n#else\\nfinalColor.rgb+=lightmapColor.rgb;\\n#endif\\n#endif\\n#endif\\n#define CUSTOM_FRAGMENT_BEFORE_FOG\\nfinalColor=max(finalColor,0.0);\\n\";It.IncludesShadersStore.pbrBlockImageProcessing=\"#if defined(IMAGEPROCESSINGPOSTPROCESS) || defined(SS_SCATTERING)\\n#if !defined(SKIPFINALCOLORCLAMP)\\nfinalColor.rgb=clamp(finalColor.rgb,0.,30.0);\\n#endif\\n#else\\nfinalColor=applyImageProcessing(finalColor);\\n#endif\\nfinalColor.a*=visibility;\\n#ifdef PREMULTIPLYALPHA\\nfinalColor.rgb*=finalColor.a;\\n#endif\\n\";It.IncludesShadersStore.pbrDebug=\"#if DEBUGMODE>0\\nif (vClipSpacePosition.x/vClipSpacePosition.w>=vDebugMode.x) {\\n#if DEBUGMODE==1\\ngl_FragColor.rgb=vPositionW.rgb;\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE==2 && defined(NORMAL)\\ngl_FragColor.rgb=vNormalW.rgb;\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE==3 && defined(BUMP) || DEBUGMODE==3 && defined(PARALLAX) || DEBUGMODE==3 && defined(ANISOTROPIC)\\ngl_FragColor.rgb=TBN[0];\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE==4 && defined(BUMP) || DEBUGMODE==4 && defined(PARALLAX) || DEBUGMODE==4 && defined(ANISOTROPIC)\\ngl_FragColor.rgb=TBN[1];\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE==5\\ngl_FragColor.rgb=normalW;\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE==6 && defined(MAINUV1)\\ngl_FragColor.rgb=vec3(vMainUV1,0.0);\\n#elif DEBUGMODE==7 && defined(MAINUV2)\\ngl_FragColor.rgb=vec3(vMainUV2,0.0);\\n#elif DEBUGMODE==8 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)\\ngl_FragColor.rgb=clearcoatOut.TBNClearCoat[0];\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE==9 && defined(CLEARCOAT) && defined(CLEARCOAT_BUMP)\\ngl_FragColor.rgb=clearcoatOut.TBNClearCoat[1];\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE==10 && defined(CLEARCOAT)\\ngl_FragColor.rgb=clearcoatOut.clearCoatNormalW;\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE==11 && defined(ANISOTROPIC)\\ngl_FragColor.rgb=anisotropicOut.anisotropicNormal;\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE==12 && defined(ANISOTROPIC)\\ngl_FragColor.rgb=anisotropicOut.anisotropicTangent;\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE==13 && defined(ANISOTROPIC)\\ngl_FragColor.rgb=anisotropicOut.anisotropicBitangent;\\n#define DEBUGMODE_NORMALIZE\\n#elif DEBUGMODE==20 && defined(ALBEDO)\\ngl_FragColor.rgb=albedoTexture.rgb;\\n#elif DEBUGMODE==21 && defined(AMBIENT)\\ngl_FragColor.rgb=aoOut.ambientOcclusionColorMap.rgb;\\n#elif DEBUGMODE==22 && defined(OPACITY)\\ngl_FragColor.rgb=opacityMap.rgb;\\n#elif DEBUGMODE==23 && defined(EMISSIVE)\\ngl_FragColor.rgb=emissiveColorTex.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE==24 && defined(LIGHTMAP)\\ngl_FragColor.rgb=lightmapColor.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE==25 && defined(REFLECTIVITY) && defined(METALLICWORKFLOW)\\ngl_FragColor.rgb=reflectivityOut.surfaceMetallicColorMap.rgb;\\n#elif DEBUGMODE==26 && defined(REFLECTIVITY) && !defined(METALLICWORKFLOW)\\ngl_FragColor.rgb=reflectivityOut.surfaceReflectivityColorMap.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE==27 && defined(CLEARCOAT) && defined(CLEARCOAT_TEXTURE)\\ngl_FragColor.rgb=vec3(clearcoatOut.clearCoatMapData.rg,0.0);\\n#elif DEBUGMODE==28 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)\\ngl_FragColor.rgb=clearcoatOut.clearCoatTintMapData.rgb;\\n#elif DEBUGMODE==29 && defined(SHEEN) && defined(SHEEN_TEXTURE)\\ngl_FragColor.rgb=sheenOut.sheenMapData.rgb;\\n#elif DEBUGMODE==30 && defined(ANISOTROPIC) && defined(ANISOTROPIC_TEXTURE)\\ngl_FragColor.rgb=anisotropicOut.anisotropyMapData.rgb;\\n#elif DEBUGMODE==31 && defined(SUBSURFACE) && defined(SS_THICKNESSANDMASK_TEXTURE)\\ngl_FragColor.rgb=subSurfaceOut.thicknessMap.rgb;\\n#elif DEBUGMODE==40 && defined(SS_REFRACTION)\\ngl_FragColor.rgb=subSurfaceOut.environmentRefraction.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE==41 && defined(REFLECTION)\\ngl_FragColor.rgb=reflectionOut.environmentRadiance.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE==42 && defined(CLEARCOAT) && defined(REFLECTION)\\ngl_FragColor.rgb=clearcoatOut.environmentClearCoatRadiance.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE==50\\ngl_FragColor.rgb=diffuseBase.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE==51 && defined(SPECULARTERM)\\ngl_FragColor.rgb=specularBase.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE==52 && defined(CLEARCOAT)\\ngl_FragColor.rgb=clearCoatBase.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE==53 && defined(SHEEN)\\ngl_FragColor.rgb=sheenBase.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE==54 && defined(REFLECTION)\\ngl_FragColor.rgb=reflectionOut.environmentIrradiance.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE==60\\ngl_FragColor.rgb=surfaceAlbedo.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE==61\\ngl_FragColor.rgb=clearcoatOut.specularEnvironmentR0;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE==62 && defined(METALLICWORKFLOW)\\ngl_FragColor.rgb=vec3(reflectivityOut.metallicRoughness.r);\\n#elif DEBUGMODE==71 && defined(METALLICWORKFLOW)\\ngl_FragColor.rgb=reflectivityOut.metallicF0;\\n#elif DEBUGMODE==63\\ngl_FragColor.rgb=vec3(roughness);\\n#elif DEBUGMODE==64\\ngl_FragColor.rgb=vec3(alphaG);\\n#elif DEBUGMODE==65\\ngl_FragColor.rgb=vec3(NdotV);\\n#elif DEBUGMODE==66 && defined(CLEARCOAT) && defined(CLEARCOAT_TINT)\\ngl_FragColor.rgb=clearcoatOut.clearCoatColor.rgb;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE==67 && defined(CLEARCOAT)\\ngl_FragColor.rgb=vec3(clearcoatOut.clearCoatRoughness);\\n#elif DEBUGMODE==68 && defined(CLEARCOAT)\\ngl_FragColor.rgb=vec3(clearcoatOut.clearCoatNdotV);\\n#elif DEBUGMODE==69 && defined(SUBSURFACE) && defined(SS_TRANSLUCENCY)\\ngl_FragColor.rgb=subSurfaceOut.transmittance;\\n#elif DEBUGMODE==70 && defined(SUBSURFACE) && defined(SS_REFRACTION)\\ngl_FragColor.rgb=subSurfaceOut.refractionTransmittance;\\n#elif DEBUGMODE==80 && defined(RADIANCEOCCLUSION)\\ngl_FragColor.rgb=vec3(seo);\\n#elif DEBUGMODE==81 && defined(HORIZONOCCLUSION)\\ngl_FragColor.rgb=vec3(eho);\\n#elif DEBUGMODE==82 && defined(MS_BRDF_ENERGY_CONSERVATION)\\ngl_FragColor.rgb=vec3(energyConservationFactor);\\n#elif DEBUGMODE==83 && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\\ngl_FragColor.rgb=specularEnvironmentReflectance;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE==84 && defined(CLEARCOAT) && defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\\ngl_FragColor.rgb=clearcoatOut.clearCoatEnvironmentReflectance;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE==85 && defined(SHEEN) && defined(REFLECTION)\\ngl_FragColor.rgb=sheenOut.sheenEnvironmentReflectance;\\n#define DEBUGMODE_GAMMA\\n#elif DEBUGMODE==86 && defined(ALPHABLEND)\\ngl_FragColor.rgb=vec3(luminanceOverAlpha);\\n#elif DEBUGMODE==87\\ngl_FragColor.rgb=vec3(alpha);\\n#endif\\ngl_FragColor.rgb*=vDebugMode.y;\\n#ifdef DEBUGMODE_NORMALIZE\\ngl_FragColor.rgb=normalize(gl_FragColor.rgb)*0.5+0.5;\\n#endif\\n#ifdef DEBUGMODE_GAMMA\\ngl_FragColor.rgb=toGammaSpace(gl_FragColor.rgb);\\n#endif\\ngl_FragColor.a=1.0;\\n#ifdef PREPASS\\ngl_FragData[0]=toLinearSpace(gl_FragColor); \\ngl_FragData[1]=vec4(0.,0.,0.,0.); \\n#endif\\nreturn;\\n}\\n#endif\\n\";It.ShadersStore.pbrPixelShader=\"#if defined(BUMP) || !defined(NORMAL) || defined(FORCENORMALFORWARD) || defined(SPECULARAA) || defined(CLEARCOAT_BUMP) || defined(ANISOTROPIC)\\n#extension GL_OES_standard_derivatives : enable\\n#endif\\n#ifdef LODBASEDMICROSFURACE\\n#extension GL_EXT_shader_texture_lod : enable\\n#endif\\n#define CUSTOM_FRAGMENT_BEGIN\\n#ifdef LOGARITHMICDEPTH\\n#extension GL_EXT_frag_depth : enable\\n#endif\\n#include[SCENE_MRT_COUNT]\\nprecision highp float;\\n#include\\n#ifndef FROMLINEARSPACE\\n#define FROMLINEARSPACE\\n#endif\\n#include<__decl__pbrFragment>\\n#include\\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\\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#ifdef REFLECTION\\n#include\\n#endif\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include\\nvoid main(void) {\\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\\n#include\\n#include\\n#include\\n#include\\nalbedoOpacityOutParams albedoOpacityOut;\\n#ifdef ALBEDO\\nvec4 albedoTexture=texture2D(albedoSampler,vAlbedoUV+uvOffset);\\n#endif\\n#ifdef OPACITY\\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);\\n#endif\\nalbedoOpacityBlock(\\nvAlbedoColor,\\n#ifdef ALBEDO\\nalbedoTexture,\\nvAlbedoInfos,\\n#endif\\n#ifdef OPACITY\\nopacityMap,\\nvOpacityInfos,\\n#endif\\n#ifdef DETAIL\\ndetailColor,\\nvDetailInfos,\\n#endif\\nalbedoOpacityOut\\n);\\nvec3 surfaceAlbedo=albedoOpacityOut.surfaceAlbedo;\\nfloat alpha=albedoOpacityOut.alpha;\\n#define CUSTOM_FRAGMENT_UPDATE_ALPHA\\n#include\\n#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\\nambientOcclusionOutParams aoOut;\\n#ifdef AMBIENT\\nvec3 ambientOcclusionColorMap=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb;\\n#endif\\nambientOcclusionBlock(\\n#ifdef AMBIENT\\nambientOcclusionColorMap,\\nvAmbientInfos,\\n#endif\\naoOut\\n);\\n#include\\n#ifdef UNLIT\\nvec3 diffuseBase=vec3(1.,1.,1.);\\n#else\\nvec3 baseColor=surfaceAlbedo;\\nreflectivityOutParams reflectivityOut;\\n#if defined(REFLECTIVITY)\\nvec4 surfaceMetallicOrReflectivityColorMap=texture2D(reflectivitySampler,vReflectivityUV+uvOffset);\\nvec4 baseReflectivity=surfaceMetallicOrReflectivityColorMap;\\n#ifndef METALLICWORKFLOW\\n#ifdef REFLECTIVITY_GAMMA\\nsurfaceMetallicOrReflectivityColorMap=toLinearSpace(surfaceMetallicOrReflectivityColorMap);\\n#endif\\nsurfaceMetallicOrReflectivityColorMap.rgb*=vReflectivityInfos.y;\\n#endif\\n#endif\\n#if defined(MICROSURFACEMAP)\\nvec4 microSurfaceTexel=texture2D(microSurfaceSampler,vMicroSurfaceSamplerUV+uvOffset)*vMicroSurfaceSamplerInfos.y;\\n#endif\\n#ifdef METALLICWORKFLOW\\nvec4 metallicReflectanceFactors=vMetallicReflectanceFactors;\\n#ifdef REFLECTANCE\\nvec4 reflectanceFactorsMap=texture2D(reflectanceSampler,vReflectanceUV+uvOffset);\\n#ifdef REFLECTANCE_GAMMA\\nreflectanceFactorsMap=toLinearSpace(reflectanceFactorsMap);\\n#endif\\nmetallicReflectanceFactors.rgb*=reflectanceFactorsMap.rgb;\\n#endif\\n#ifdef METALLIC_REFLECTANCE\\nvec4 metallicReflectanceFactorsMap=texture2D(metallicReflectanceSampler,vMetallicReflectanceUV+uvOffset);\\n#ifdef METALLIC_REFLECTANCE_GAMMA\\nmetallicReflectanceFactorsMap=toLinearSpace(metallicReflectanceFactorsMap);\\n#endif\\n#ifndef METALLIC_REFLECTANCE_USE_ALPHA_ONLY\\nmetallicReflectanceFactors.rgb*=metallicReflectanceFactorsMap.rgb;\\n#endif\\nmetallicReflectanceFactors*=metallicReflectanceFactorsMap.a;\\n#endif\\n#endif\\nreflectivityBlock(\\nvReflectivityColor,\\n#ifdef METALLICWORKFLOW\\nsurfaceAlbedo,\\nmetallicReflectanceFactors,\\n#endif\\n#ifdef REFLECTIVITY\\nvReflectivityInfos,\\nsurfaceMetallicOrReflectivityColorMap,\\n#endif\\n#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\\naoOut.ambientOcclusionColor,\\n#endif\\n#ifdef MICROSURFACEMAP\\nmicroSurfaceTexel,\\n#endif\\n#ifdef DETAIL\\ndetailColor,\\nvDetailInfos,\\n#endif\\nreflectivityOut\\n);\\nfloat microSurface=reflectivityOut.microSurface;\\nfloat roughness=reflectivityOut.roughness;\\n#ifdef METALLICWORKFLOW\\nsurfaceAlbedo=reflectivityOut.surfaceAlbedo;\\n#endif\\n#if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\\naoOut.ambientOcclusionColor=reflectivityOut.ambientOcclusionColor;\\n#endif\\n#ifdef ALPHAFRESNEL\\n#if defined(ALPHATEST) || defined(ALPHABLEND)\\nalphaFresnelOutParams alphaFresnelOut;\\nalphaFresnelBlock(\\nnormalW,\\nviewDirectionW,\\nalpha,\\nmicroSurface,\\nalphaFresnelOut\\n);\\nalpha=alphaFresnelOut.alpha;\\n#endif\\n#endif\\n#include\\n#ifdef ANISOTROPIC\\nanisotropicOutParams anisotropicOut;\\n#ifdef ANISOTROPIC_TEXTURE\\nvec3 anisotropyMapData=texture2D(anisotropySampler,vAnisotropyUV+uvOffset).rgb*vAnisotropyInfos.y;\\n#endif\\nanisotropicBlock(\\nvAnisotropy,\\n#ifdef ANISOTROPIC_TEXTURE\\nanisotropyMapData,\\n#endif\\nTBN,\\nnormalW,\\nviewDirectionW,\\nanisotropicOut\\n);\\n#endif\\n#ifdef REFLECTION\\nreflectionOutParams reflectionOut;\\n#ifndef USE_CUSTOM_REFLECTION\\nreflectionBlock(\\nvPositionW,\\nnormalW,\\nalphaG,\\nvReflectionMicrosurfaceInfos,\\nvReflectionInfos,\\nvReflectionColor,\\n#ifdef ANISOTROPIC\\nanisotropicOut,\\n#endif\\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\\nNdotVUnclamped,\\n#endif\\n#ifdef LINEARSPECULARREFLECTION\\nroughness,\\n#endif\\nreflectionSampler,\\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX)\\nvEnvironmentIrradiance,\\n#endif\\n#ifdef USESPHERICALFROMREFLECTIONMAP\\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\\nreflectionMatrix,\\n#endif\\n#endif\\n#ifdef USEIRRADIANCEMAP\\nirradianceSampler,\\n#endif\\n#ifndef LODBASEDMICROSFURACE\\nreflectionSamplerLow,\\nreflectionSamplerHigh,\\n#endif\\n#ifdef REALTIME_FILTERING\\nvReflectionFilteringInfo,\\n#endif\\nreflectionOut\\n);\\n#else\\n#define CUSTOM_REFLECTION\\n#endif\\n#endif\\n#include\\n#ifdef SHEEN\\nsheenOutParams sheenOut;\\n#ifdef SHEEN_TEXTURE\\nvec4 sheenMapData=texture2D(sheenSampler,vSheenUV+uvOffset);\\n#endif\\n#if defined(SHEEN_ROUGHNESS) && defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE)\\nvec4 sheenMapRoughnessData=texture2D(sheenRoughnessSampler,vSheenRoughnessUV+uvOffset)*vSheenInfos.w;\\n#endif\\nsheenBlock(\\nvSheenColor,\\n#ifdef SHEEN_ROUGHNESS\\nvSheenRoughness,\\n#if defined(SHEEN_TEXTURE_ROUGHNESS) && !defined(SHEEN_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE)\\nsheenMapRoughnessData,\\n#endif\\n#endif\\nroughness,\\n#ifdef SHEEN_TEXTURE\\nsheenMapData,\\nvSheenInfos.y,\\n#endif\\nreflectance,\\n#ifdef SHEEN_LINKWITHALBEDO\\nbaseColor,\\nsurfaceAlbedo,\\n#endif\\n#ifdef ENVIRONMENTBRDF\\nNdotV,\\nenvironmentBrdf,\\n#endif\\n#if defined(REFLECTION) && defined(ENVIRONMENTBRDF)\\nAARoughnessFactors,\\nvReflectionMicrosurfaceInfos,\\nvReflectionInfos,\\nvReflectionColor,\\nvLightingIntensity,\\nreflectionSampler,\\nreflectionOut.reflectionCoords,\\nNdotVUnclamped,\\n#ifndef LODBASEDMICROSFURACE\\nreflectionSamplerLow,\\nreflectionSamplerHigh,\\n#endif\\n#ifdef REALTIME_FILTERING\\nvReflectionFilteringInfo,\\n#endif\\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(RADIANCEOCCLUSION)\\nseo,\\n#endif\\n#if !defined(REFLECTIONMAP_SKYBOX) && defined(HORIZONOCCLUSION) && defined(BUMP) && defined(REFLECTIONMAP_3D)\\neho,\\n#endif\\n#endif\\nsheenOut\\n);\\n#ifdef SHEEN_LINKWITHALBEDO\\nsurfaceAlbedo=sheenOut.surfaceAlbedo;\\n#endif\\n#endif\\n#ifdef CLEARCOAT\\n#ifdef CLEARCOAT_TEXTURE\\nvec2 clearCoatMapData=texture2D(clearCoatSampler,vClearCoatUV+uvOffset).rg*vClearCoatInfos.y;\\n#endif\\n#endif\\n#ifdef IRIDESCENCE\\niridescenceOutParams iridescenceOut;\\n#ifdef IRIDESCENCE_TEXTURE\\nvec2 iridescenceMapData=texture2D(iridescenceSampler,vIridescenceUV+uvOffset).rg*vIridescenceInfos.y;\\n#endif\\n#ifdef IRIDESCENCE_THICKNESS_TEXTURE\\nvec2 iridescenceThicknessMapData=texture2D(iridescenceThicknessSampler,vIridescenceThicknessUV+uvOffset).rg*vIridescenceInfos.w;\\n#endif\\niridescenceBlock(\\nvIridescenceParams,\\nNdotV,\\nspecularEnvironmentR0,\\n#ifdef IRIDESCENCE_TEXTURE\\niridescenceMapData,\\n#endif\\n#ifdef IRIDESCENCE_THICKNESS_TEXTURE\\niridescenceThicknessMapData,\\n#endif\\n#ifdef CLEARCOAT\\nNdotVUnclamped,\\n#ifdef CLEARCOAT_TEXTURE\\nclearCoatMapData,\\n#endif\\n#endif\\niridescenceOut\\n);\\nfloat iridescenceIntensity=iridescenceOut.iridescenceIntensity;\\nspecularEnvironmentR0=iridescenceOut.specularEnvironmentR0;\\n#endif\\nclearcoatOutParams clearcoatOut;\\n#ifdef CLEARCOAT\\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)\\nvec4 clearCoatMapRoughnessData=texture2D(clearCoatRoughnessSampler,vClearCoatRoughnessUV+uvOffset)*vClearCoatInfos.w;\\n#endif\\n#if defined(CLEARCOAT_TINT) && defined(CLEARCOAT_TINT_TEXTURE)\\nvec4 clearCoatTintMapData=texture2D(clearCoatTintSampler,vClearCoatTintUV+uvOffset);\\n#endif\\n#ifdef CLEARCOAT_BUMP\\nvec4 clearCoatBumpMapData=texture2D(clearCoatBumpSampler,vClearCoatBumpUV+uvOffset);\\n#endif\\nclearcoatBlock(\\nvPositionW,\\ngeometricNormalW,\\nviewDirectionW,\\nvClearCoatParams,\\n#if defined(CLEARCOAT_TEXTURE_ROUGHNESS) && !defined(CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL) && !defined(CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE)\\nclearCoatMapRoughnessData,\\n#endif\\nspecularEnvironmentR0,\\n#ifdef CLEARCOAT_TEXTURE\\nclearCoatMapData,\\n#endif\\n#ifdef CLEARCOAT_TINT\\nvClearCoatTintParams,\\nclearCoatColorAtDistance,\\nvClearCoatRefractionParams,\\n#ifdef CLEARCOAT_TINT_TEXTURE\\nclearCoatTintMapData,\\n#endif\\n#endif\\n#ifdef CLEARCOAT_BUMP\\nvClearCoatBumpInfos,\\nclearCoatBumpMapData,\\nvClearCoatBumpUV,\\n#if defined(TANGENT) && defined(NORMAL)\\nvTBN,\\n#else\\nvClearCoatTangentSpaceParams,\\n#endif\\n#ifdef OBJECTSPACE_NORMALMAP\\nnormalMatrix,\\n#endif\\n#endif\\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\\nfaceNormal,\\n#endif\\n#ifdef REFLECTION\\nvReflectionMicrosurfaceInfos,\\nvReflectionInfos,\\nvReflectionColor,\\nvLightingIntensity,\\nreflectionSampler,\\n#ifndef LODBASEDMICROSFURACE\\nreflectionSamplerLow,\\nreflectionSamplerHigh,\\n#endif\\n#ifdef REALTIME_FILTERING\\nvReflectionFilteringInfo,\\n#endif\\n#endif\\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\\n#ifdef RADIANCEOCCLUSION\\nambientMonochrome,\\n#endif\\n#endif\\n#if defined(CLEARCOAT_BUMP) || defined(TWOSIDEDLIGHTING)\\n(gl_FrontFacing ? 1. : -1.),\\n#endif\\nclearcoatOut\\n);\\n#else\\nclearcoatOut.specularEnvironmentR0=specularEnvironmentR0;\\n#endif\\n#include\\nsubSurfaceOutParams subSurfaceOut;\\n#ifdef SUBSURFACE\\n#ifdef SS_THICKNESSANDMASK_TEXTURE\\nvec4 thicknessMap=texture2D(thicknessSampler,vThicknessUV+uvOffset);\\n#endif\\n#ifdef SS_REFRACTIONINTENSITY_TEXTURE\\nvec4 refractionIntensityMap=texture2D(refractionIntensitySampler,vRefractionIntensityUV+uvOffset);\\n#endif\\n#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE\\nvec4 translucencyIntensityMap=texture2D(translucencyIntensitySampler,vTranslucencyIntensityUV+uvOffset);\\n#endif\\nsubSurfaceBlock(\\nvSubSurfaceIntensity,\\nvThicknessParam,\\nvTintColor,\\nnormalW,\\nspecularEnvironmentReflectance,\\n#ifdef SS_THICKNESSANDMASK_TEXTURE\\nthicknessMap,\\n#endif\\n#ifdef SS_REFRACTIONINTENSITY_TEXTURE\\nrefractionIntensityMap,\\n#endif\\n#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE\\ntranslucencyIntensityMap,\\n#endif\\n#ifdef REFLECTION\\n#ifdef SS_TRANSLUCENCY\\nreflectionMatrix,\\n#ifdef USESPHERICALFROMREFLECTIONMAP\\n#if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\\nreflectionOut.irradianceVector,\\n#endif\\n#if defined(REALTIME_FILTERING)\\nreflectionSampler,\\nvReflectionFilteringInfo,\\n#endif\\n#endif\\n#ifdef USEIRRADIANCEMAP\\nirradianceSampler,\\n#endif\\n#endif\\n#endif\\n#if defined(SS_REFRACTION) || defined(SS_TRANSLUCENCY)\\nsurfaceAlbedo,\\n#endif\\n#ifdef SS_REFRACTION\\nvPositionW,\\nviewDirectionW,\\nview,\\nvRefractionInfos,\\nrefractionMatrix,\\nvRefractionMicrosurfaceInfos,\\nvLightingIntensity,\\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\\nalpha,\\n#endif\\n#ifdef SS_LODINREFRACTIONALPHA\\nNdotVUnclamped,\\n#endif\\n#ifdef SS_LINEARSPECULARREFRACTION\\nroughness,\\n#endif\\nalphaG,\\nrefractionSampler,\\n#ifndef LODBASEDMICROSFURACE\\nrefractionSamplerLow,\\nrefractionSamplerHigh,\\n#endif\\n#ifdef ANISOTROPIC\\nanisotropicOut,\\n#endif\\n#ifdef REALTIME_FILTERING\\nvRefractionFilteringInfo,\\n#endif\\n#ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC\\nvRefractionPosition,\\nvRefractionSize,\\n#endif\\n#endif\\n#ifdef SS_TRANSLUCENCY\\nvDiffusionDistance,\\n#endif\\nsubSurfaceOut\\n);\\n#ifdef SS_REFRACTION\\nsurfaceAlbedo=subSurfaceOut.surfaceAlbedo;\\n#ifdef SS_LINKREFRACTIONTOTRANSPARENCY\\nalpha=subSurfaceOut.alpha;\\n#endif\\n#endif\\n#else\\nsubSurfaceOut.specularEnvironmentReflectance=specularEnvironmentReflectance;\\n#endif\\n#include\\n#include[0..maxSimultaneousLights]\\n#include\\n#endif \\n#include\\n#define CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION\\n#include\\n#include\\n#include(color,finalColor)\\n#include\\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\\n#ifdef PREPASS\\nfloat writeGeometryInfo=finalColor.a>0.4 ? 1.0 : 0.0;\\n#ifdef PREPASS_POSITION\\ngl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,writeGeometryInfo);\\n#endif\\n#ifdef PREPASS_VELOCITY\\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;\\nvec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;\\nvec2 velocity=abs(a-b);\\nvelocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;\\ngl_FragData[PREPASS_VELOCITY_INDEX]=vec4(velocity,0.0,writeGeometryInfo);\\n#endif\\n#ifdef PREPASS_ALBEDO_SQRT\\nvec3 sqAlbedo=sqrt(surfaceAlbedo); \\n#endif\\n#ifdef PREPASS_IRRADIANCE\\nvec3 irradiance=finalDiffuse;\\n#ifndef UNLIT\\n#ifdef REFLECTION\\nirradiance+=finalIrradiance;\\n#endif\\n#endif\\n#ifdef SS_SCATTERING\\ngl_FragData[0]=vec4(finalColor.rgb-irradiance,finalColor.a); \\nirradiance/=sqAlbedo;\\n#else\\ngl_FragData[0]=finalColor; \\nfloat scatteringDiffusionProfile=255.;\\n#endif\\ngl_FragData[PREPASS_IRRADIANCE_INDEX]=vec4(clamp(irradiance,vec3(0.),vec3(1.)),writeGeometryInfo*scatteringDiffusionProfile/255.); \\n#else\\ngl_FragData[0]=vec4(finalColor.rgb,finalColor.a);\\n#endif\\n#ifdef PREPASS_DEPTH\\ngl_FragData[PREPASS_DEPTH_INDEX]=vec4(vViewPos.z,0.0,0.0,writeGeometryInfo); \\n#endif\\n#ifdef PREPASS_NORMAL\\ngl_FragData[PREPASS_NORMAL_INDEX]=vec4((view*vec4(normalW,0.0)).rgb,writeGeometryInfo); \\n#endif\\n#ifdef PREPASS_ALBEDO_SQRT\\ngl_FragData[PREPASS_ALBEDO_SQRT_INDEX]=vec4(sqAlbedo,writeGeometryInfo); \\n#endif\\n#ifdef PREPASS_REFLECTIVITY\\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(toGammaSpace(specularEnvironmentR0),microSurface)*writeGeometryInfo;\\n#endif\\n#endif\\n#if !defined(PREPASS) || defined(WEBGL2)\\ngl_FragColor=finalColor;\\n#endif\\n#include\\n#if ORDER_INDEPENDENT_TRANSPARENCY\\nif (fragDepth==nearestDepth) {\\nfrontColor.rgb+=finalColor.rgb*finalColor.a*alphaMultiplier;\\nfrontColor.a=1.0-alphaMultiplier*(1.0-finalColor.a);\\n} else {\\nbackColor+=finalColor;\\n}\\n#endif\\n#include\\n#define CUSTOM_FRAGMENT_MAIN_END\\n}\\n\";It.IncludesShadersStore.pbrVertexDeclaration=\"uniform mat4 view;\\nuniform mat4 viewProjection;\\n#ifdef ALBEDO\\nuniform mat4 albedoMatrix;\\nuniform vec2 vAlbedoInfos;\\n#endif\\n#ifdef AMBIENT\\nuniform mat4 ambientMatrix;\\nuniform vec4 vAmbientInfos;\\n#endif\\n#ifdef OPACITY\\nuniform mat4 opacityMatrix;\\nuniform vec2 vOpacityInfos;\\n#endif\\n#ifdef EMISSIVE\\nuniform vec2 vEmissiveInfos;\\nuniform mat4 emissiveMatrix;\\n#endif\\n#ifdef LIGHTMAP\\nuniform vec2 vLightmapInfos;\\nuniform mat4 lightmapMatrix;\\n#endif\\n#ifdef REFLECTIVITY \\nuniform vec3 vReflectivityInfos;\\nuniform mat4 reflectivityMatrix;\\n#endif\\n#ifdef METALLIC_REFLECTANCE\\nuniform vec2 vMetallicReflectanceInfos;\\nuniform mat4 metallicReflectanceMatrix;\\n#endif\\n#ifdef REFLECTANCE\\nuniform vec2 vReflectanceInfos;\\nuniform mat4 reflectanceMatrix;\\n#endif\\n#ifdef MICROSURFACEMAP\\nuniform vec2 vMicroSurfaceSamplerInfos;\\nuniform mat4 microSurfaceSamplerMatrix;\\n#endif\\n#ifdef BUMP\\nuniform vec3 vBumpInfos;\\nuniform mat4 bumpMatrix;\\n#endif\\n#ifdef POINTSIZE\\nuniform float pointSize;\\n#endif\\n#ifdef REFLECTION\\nuniform vec2 vReflectionInfos;\\nuniform mat4 reflectionMatrix;\\n#endif\\n#ifdef CLEARCOAT\\n#if defined(CLEARCOAT_TEXTURE) || defined(CLEARCOAT_TEXTURE_ROUGHNESS)\\nuniform vec4 vClearCoatInfos;\\n#endif\\n#ifdef CLEARCOAT_TEXTURE\\nuniform mat4 clearCoatMatrix;\\n#endif\\n#ifdef CLEARCOAT_TEXTURE_ROUGHNESS\\nuniform mat4 clearCoatRoughnessMatrix;\\n#endif\\n#ifdef CLEARCOAT_BUMP\\nuniform vec2 vClearCoatBumpInfos;\\nuniform mat4 clearCoatBumpMatrix;\\n#endif\\n#ifdef CLEARCOAT_TINT_TEXTURE\\nuniform vec2 vClearCoatTintInfos;\\nuniform mat4 clearCoatTintMatrix;\\n#endif\\n#endif\\n#ifdef IRIDESCENCE\\n#if defined(IRIDESCENCE_TEXTURE) || defined(IRIDESCENCE_THICKNESS_TEXTURE)\\nuniform vec4 vIridescenceInfos;\\n#endif\\n#ifdef IRIDESCENCE_TEXTURE\\nuniform mat4 iridescenceMatrix;\\n#endif\\n#ifdef IRIDESCENCE_THICKNESS_TEXTURE\\nuniform mat4 iridescenceThicknessMatrix;\\n#endif\\n#endif\\n#ifdef ANISOTROPIC\\n#ifdef ANISOTROPIC_TEXTURE\\nuniform vec2 vAnisotropyInfos;\\nuniform mat4 anisotropyMatrix;\\n#endif\\n#endif\\n#ifdef SHEEN\\n#if defined(SHEEN_TEXTURE) || defined(SHEEN_TEXTURE_ROUGHNESS)\\nuniform vec4 vSheenInfos;\\n#endif\\n#ifdef SHEEN_TEXTURE\\nuniform mat4 sheenMatrix;\\n#endif\\n#ifdef SHEEN_TEXTURE_ROUGHNESS\\nuniform mat4 sheenRoughnessMatrix;\\n#endif\\n#endif\\n#ifdef SUBSURFACE\\n#ifdef SS_REFRACTION\\nuniform vec4 vRefractionInfos;\\nuniform mat4 refractionMatrix;\\n#endif\\n#ifdef SS_THICKNESSANDMASK_TEXTURE\\nuniform vec2 vThicknessInfos;\\nuniform mat4 thicknessMatrix;\\n#endif\\n#ifdef SS_REFRACTIONINTENSITY_TEXTURE\\nuniform vec2 vRefractionIntensityInfos;\\nuniform mat4 refractionIntensityMatrix;\\n#endif\\n#ifdef SS_TRANSLUCENCYINTENSITY_TEXTURE\\nuniform vec2 vTranslucencyIntensityInfos;\\nuniform mat4 translucencyIntensityMatrix;\\n#endif\\n#endif\\n#ifdef NORMAL\\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\\n#ifdef USESPHERICALFROMREFLECTIONMAP\\n#ifdef SPHERICAL_HARMONICS\\nuniform vec3 vSphericalL00;\\nuniform vec3 vSphericalL1_1;\\nuniform vec3 vSphericalL10;\\nuniform vec3 vSphericalL11;\\nuniform vec3 vSphericalL2_2;\\nuniform vec3 vSphericalL2_1;\\nuniform vec3 vSphericalL20;\\nuniform vec3 vSphericalL21;\\nuniform vec3 vSphericalL22;\\n#else\\nuniform vec3 vSphericalX;\\nuniform vec3 vSphericalY;\\nuniform vec3 vSphericalZ;\\nuniform vec3 vSphericalXX_ZZ;\\nuniform vec3 vSphericalYY_ZZ;\\nuniform vec3 vSphericalZZ;\\nuniform vec3 vSphericalXY;\\nuniform vec3 vSphericalYZ;\\nuniform vec3 vSphericalZX;\\n#endif\\n#endif\\n#endif\\n#endif\\n#ifdef DETAIL\\nuniform vec4 vDetailInfos;\\nuniform mat4 detailMatrix;\\n#endif\\n#define ADDITIONAL_VERTEX_DECLARATION\\n\";It.ShadersStore.pbrVertexShader=\"precision highp float;\\n#include<__decl__pbrVertex>\\n#define CUSTOM_VERTEX_BEGIN\\nattribute vec3 position;\\n#ifdef NORMAL\\nattribute vec3 normal;\\n#endif\\n#ifdef TANGENT\\nattribute vec4 tangent;\\n#endif\\n#ifdef UV1\\nattribute vec2 uv;\\n#endif\\n#include[2..7]\\n#include[1..7]\\n#ifdef VERTEXCOLOR\\nattribute vec4 color;\\n#endif\\n#include\\n#include\\n#include\\n#include\\n#include\\n#include(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo)\\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail)\\n#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient)\\n#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity)\\n#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive)\\n#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap)\\n#include(_DEFINENAME_,REFLECTIVITY,_VARYINGNAME_,Reflectivity)\\n#include(_DEFINENAME_,MICROSURFACEMAP,_VARYINGNAME_,MicroSurfaceSampler)\\n#include(_DEFINENAME_,METALLIC_REFLECTANCE,_VARYINGNAME_,MetallicReflectance)\\n#include(_DEFINENAME_,REFLECTANCE,_VARYINGNAME_,Reflectance)\\n#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump)\\n#ifdef CLEARCOAT\\n#include(_DEFINENAME_,CLEARCOAT_TEXTURE,_VARYINGNAME_,ClearCoat)\\n#include(_DEFINENAME_,CLEARCOAT_TEXTURE_ROUGHNESS,_VARYINGNAME_,ClearCoatRoughness)\\n#include(_DEFINENAME_,CLEARCOAT_BUMP,_VARYINGNAME_,ClearCoatBump)\\n#include(_DEFINENAME_,CLEARCOAT_TINT_TEXTURE,_VARYINGNAME_,ClearCoatTint)\\n#endif\\n#ifdef IRIDESCENCE\\n#include(_DEFINENAME_,IRIDESCENCE_TEXTURE,_VARYINGNAME_,Iridescence)\\n#include(_DEFINENAME_,IRIDESCENCE_THICKNESS_TEXTURE,_VARYINGNAME_,IridescenceThickness)\\n#endif\\n#ifdef SHEEN\\n#include(_DEFINENAME_,SHEEN_TEXTURE,_VARYINGNAME_,Sheen)\\n#include(_DEFINENAME_,SHEEN_TEXTURE_ROUGHNESS,_VARYINGNAME_,SheenRoughness)\\n#endif\\n#ifdef ANISOTROPIC\\n#include(_DEFINENAME_,ANISOTROPIC_TEXTURE,_VARYINGNAME_,Anisotropy)\\n#endif\\n#ifdef SUBSURFACE\\n#include(_DEFINENAME_,SS_THICKNESSANDMASK_TEXTURE,_VARYINGNAME_,Thickness)\\n#include(_DEFINENAME_,SS_REFRACTIONINTENSITY_TEXTURE,_VARYINGNAME_,RefractionIntensity)\\n#include(_DEFINENAME_,SS_TRANSLUCENCYINTENSITY_TEXTURE,_VARYINGNAME_,TranslucencyIntensity)\\n#endif\\nvarying vec3 vPositionW;\\n#if DEBUGMODE>0\\nvarying vec4 vClipSpacePosition;\\n#endif\\n#ifdef NORMAL\\nvarying vec3 vNormalW;\\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\\nvarying vec3 vEnvironmentIrradiance;\\n#include\\n#endif\\n#endif\\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\\nvarying vec4 vColor;\\n#endif\\n#include\\n#include\\n#include\\n#include<__decl__lightVxFragment>[0..maxSimultaneousLights]\\n#include\\n#include[0..maxSimultaneousMorphTargets]\\n#ifdef REFLECTIONMAP_SKYBOX\\nvarying vec3 vPositionUVW;\\n#endif\\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\\nvarying vec3 vDirectionW;\\n#endif\\n#include\\n#define CUSTOM_VERTEX_DEFINITIONS\\nvoid main(void) {\\n#define CUSTOM_VERTEX_MAIN_BEGIN\\nvec3 positionUpdated=position;\\n#ifdef NORMAL\\nvec3 normalUpdated=normal;\\n#endif\\n#ifdef TANGENT\\nvec4 tangentUpdated=tangent;\\n#endif\\n#ifdef UV1\\nvec2 uvUpdated=uv;\\n#endif\\n#include\\n#include[0..maxSimultaneousMorphTargets]\\n#ifdef REFLECTIONMAP_SKYBOX\\nvPositionUVW=positionUpdated;\\n#endif\\n#define CUSTOM_VERTEX_UPDATE_POSITION\\n#define CUSTOM_VERTEX_UPDATE_NORMAL\\n#include\\n#if defined(PREPASS) && defined(PREPASS_VELOCITY) && !defined(BONES_VELOCITY_ENABLED)\\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\\nvPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0);\\n#endif\\n#include\\n#include\\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\\nvPositionW=vec3(worldPos);\\n#include\\n#ifdef NORMAL\\nmat3 normalWorld=mat3(finalWorld);\\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\\nvNormalW=normalUpdated/vec3(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));\\nvNormalW=normalize(normalWorld*vNormalW);\\n#else\\n#ifdef NONUNIFORMSCALING\\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\\n#endif\\nvNormalW=normalize(normalWorld*normalUpdated);\\n#endif\\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\\nvec3 reflectionVector=vec3(reflectionMatrix*vec4(vNormalW,0)).xyz;\\n#ifdef REFLECTIONMAP_OPPOSITEZ\\nreflectionVector.z*=-1.0;\\n#endif\\nvEnvironmentIrradiance=computeEnvironmentIrradiance(reflectionVector);\\n#endif\\n#endif\\n#define CUSTOM_VERTEX_UPDATE_WORLDPOS\\n#ifdef MULTIVIEW\\nif (gl_ViewID_OVR==0u) {\\ngl_Position=viewProjection*worldPos;\\n} else {\\ngl_Position=viewProjectionR*worldPos;\\n}\\n#else\\ngl_Position=viewProjection*worldPos;\\n#endif\\n#if DEBUGMODE>0\\nvClipSpacePosition=gl_Position;\\n#endif\\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\\nvDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));\\n#endif\\n#ifndef UV1\\nvec2 uvUpdated=vec2(0.,0.);\\n#endif\\n#ifdef MAINUV1\\nvMainUV1=uvUpdated;\\n#endif\\n#include[2..7]\\n#include(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo,_MATRIXNAME_,albedo,_INFONAME_,AlbedoInfos.x)\\n#include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_MATRIXNAME_,detail,_INFONAME_,DetailInfos.x)\\n#include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_MATRIXNAME_,ambient,_INFONAME_,AmbientInfos.x)\\n#include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_MATRIXNAME_,opacity,_INFONAME_,OpacityInfos.x)\\n#include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_MATRIXNAME_,emissive,_INFONAME_,EmissiveInfos.x)\\n#include(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_MATRIXNAME_,lightmap,_INFONAME_,LightmapInfos.x)\\n#include(_DEFINENAME_,REFLECTIVITY,_VARYINGNAME_,Reflectivity,_MATRIXNAME_,reflectivity,_INFONAME_,ReflectivityInfos.x)\\n#include(_DEFINENAME_,MICROSURFACEMAP,_VARYINGNAME_,MicroSurfaceSampler,_MATRIXNAME_,microSurfaceSampler,_INFONAME_,MicroSurfaceSamplerInfos.x)\\n#include(_DEFINENAME_,METALLIC_REFLECTANCE,_VARYINGNAME_,MetallicReflectance,_MATRIXNAME_,metallicReflectance,_INFONAME_,MetallicReflectanceInfos.x)\\n#include(_DEFINENAME_,REFLECTANCE,_VARYINGNAME_,Reflectance,_MATRIXNAME_,reflectance,_INFONAME_,ReflectanceInfos.x)\\n#include(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_MATRIXNAME_,bump,_INFONAME_,BumpInfos.x)\\n#ifdef CLEARCOAT\\n#include(_DEFINENAME_,CLEARCOAT_TEXTURE,_VARYINGNAME_,ClearCoat,_MATRIXNAME_,clearCoat,_INFONAME_,ClearCoatInfos.x)\\n#include(_DEFINENAME_,CLEARCOAT_TEXTURE_ROUGHNESS,_VARYINGNAME_,ClearCoatRoughness,_MATRIXNAME_,clearCoatRoughness,_INFONAME_,ClearCoatInfos.z)\\n#include(_DEFINENAME_,CLEARCOAT_BUMP,_VARYINGNAME_,ClearCoatBump,_MATRIXNAME_,clearCoatBump,_INFONAME_,ClearCoatBumpInfos.x)\\n#include(_DEFINENAME_,CLEARCOAT_TINT_TEXTURE,_VARYINGNAME_,ClearCoatTint,_MATRIXNAME_,clearCoatTint,_INFONAME_,ClearCoatTintInfos.x)\\n#endif\\n#ifdef IRIDESCENCE\\n#include(_DEFINENAME_,IRIDESCENCE_TEXTURE,_VARYINGNAME_,Iridescence,_MATRIXNAME_,iridescence,_INFONAME_,IridescenceInfos.x)\\n#include(_DEFINENAME_,IRIDESCENCE_THICKNESS_TEXTURE,_VARYINGNAME_,IridescenceThickness,_MATRIXNAME_,iridescenceThickness,_INFONAME_,IridescenceInfos.z)\\n#endif\\n#ifdef SHEEN\\n#include(_DEFINENAME_,SHEEN_TEXTURE,_VARYINGNAME_,Sheen,_MATRIXNAME_,sheen,_INFONAME_,SheenInfos.x)\\n#include(_DEFINENAME_,SHEEN_TEXTURE_ROUGHNESS,_VARYINGNAME_,SheenRoughness,_MATRIXNAME_,sheen,_INFONAME_,SheenInfos.z)\\n#endif\\n#ifdef ANISOTROPIC\\n#include(_DEFINENAME_,ANISOTROPIC_TEXTURE,_VARYINGNAME_,Anisotropy,_MATRIXNAME_,anisotropy,_INFONAME_,AnisotropyInfos.x)\\n#endif\\n#ifdef SUBSURFACE\\n#include(_DEFINENAME_,SS_THICKNESSANDMASK_TEXTURE,_VARYINGNAME_,Thickness,_MATRIXNAME_,thickness,_INFONAME_,ThicknessInfos.x)\\n#include(_DEFINENAME_,SS_REFRACTIONINTENSITY_TEXTURE,_VARYINGNAME_,RefractionIntensity,_MATRIXNAME_,refractionIntensity,_INFONAME_,RefractionIntensityInfos.x)\\n#include(_DEFINENAME_,SS_TRANSLUCENCYINTENSITY_TEXTURE,_VARYINGNAME_,TranslucencyIntensity,_MATRIXNAME_,translucencyIntensity,_INFONAME_,TranslucencyIntensityInfos.x)\\n#endif\\n#include\\n#include\\n#include\\n#include[0..maxSimultaneousLights]\\n#include\\n#if defined(POINTSIZE) && !defined(WEBGPU)\\ngl_PointSize=pointSize;\\n#endif\\n#include\\n#define CUSTOM_VERTEX_MAIN_END\\n}\";var tf=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.CLEARCOAT=!1,t.CLEARCOAT_DEFAULTIOR=!1,t.CLEARCOAT_TEXTURE=!1,t.CLEARCOAT_TEXTURE_ROUGHNESS=!1,t.CLEARCOAT_TEXTUREDIRECTUV=0,t.CLEARCOAT_TEXTURE_ROUGHNESSDIRECTUV=0,t.CLEARCOAT_BUMP=!1,t.CLEARCOAT_BUMPDIRECTUV=0,t.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE=!1,t.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL=!1,t.CLEARCOAT_REMAP_F0=!1,t.CLEARCOAT_TINT=!1,t.CLEARCOAT_TINT_TEXTURE=!1,t.CLEARCOAT_TINT_TEXTUREDIRECTUV=0,t.CLEARCOAT_TINT_GAMMATEXTURE=!1,t}return V(t,e),t}(Ei),nf=function(e){function t(i,n){void 0===n&&(n=!0);var r=e.call(this,i,\"PBRClearCoat\",100,new tf,n)||this;return r._isEnabled=!1,r.isEnabled=!1,r.intensity=1,r.roughness=0,r._indexOfRefraction=t._DefaultIndexOfRefraction,r.indexOfRefraction=t._DefaultIndexOfRefraction,r._texture=null,r.texture=null,r._useRoughnessFromMainTexture=!0,r.useRoughnessFromMainTexture=!0,r._textureRoughness=null,r.textureRoughness=null,r._remapF0OnInterfaceChange=!0,r.remapF0OnInterfaceChange=!0,r._bumpTexture=null,r.bumpTexture=null,r._isTintEnabled=!1,r.isTintEnabled=!1,r.tintColor=N.White(),r.tintColorAtDistance=1,r.tintThickness=1,r._tintTexture=null,r.tintTexture=null,r._internalMarkAllSubMeshesAsTexturesDirty=i._dirtyCallbacks[a.MATERIAL_TextureDirtyFlag],r}return V(t,e),t.prototype._markAllSubMeshesAsTexturesDirty=function(){this._enable(this._isEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()},t.prototype.isReadyForSubMesh=function(e,t,i){if(!this._isEnabled)return!0;var n=this._material._disableBumpMap;if(e._areTexturesDirty&&t.texturesEnabled){if(this._texture&&Nl.ClearCoatTextureEnabled&&!this._texture.isReadyOrNotBlocking())return!1;if(this._textureRoughness&&Nl.ClearCoatTextureEnabled&&!this._textureRoughness.isReadyOrNotBlocking())return!1;if(i.getCaps().standardDerivatives&&this._bumpTexture&&Nl.ClearCoatBumpTextureEnabled&&!n&&!this._bumpTexture.isReady())return!1;if(this._isTintEnabled&&this._tintTexture&&Nl.ClearCoatTintTextureEnabled&&!this._tintTexture.isReadyOrNotBlocking())return!1}return!0},t.prototype.prepareDefinesBeforeAttributes=function(e,i){var n;this._isEnabled?(e.CLEARCOAT=!0,e.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE=this._useRoughnessFromMainTexture,e.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL=null!==this._texture&&this._texture._texture===(null===(n=this._textureRoughness)||void 0===n?void 0:n._texture)&&this._texture.checkTransformsAreIdentical(this._textureRoughness),e.CLEARCOAT_REMAP_F0=this._remapF0OnInterfaceChange,e._areTexturesDirty&&i.texturesEnabled&&(this._texture&&Nl.ClearCoatTextureEnabled?Pr.PrepareDefinesForMergedUV(this._texture,e,\"CLEARCOAT_TEXTURE\"):e.CLEARCOAT_TEXTURE=!1,this._textureRoughness&&Nl.ClearCoatTextureEnabled?Pr.PrepareDefinesForMergedUV(this._textureRoughness,e,\"CLEARCOAT_TEXTURE_ROUGHNESS\"):e.CLEARCOAT_TEXTURE_ROUGHNESS=!1,this._bumpTexture&&Nl.ClearCoatBumpTextureEnabled?Pr.PrepareDefinesForMergedUV(this._bumpTexture,e,\"CLEARCOAT_BUMP\"):e.CLEARCOAT_BUMP=!1,e.CLEARCOAT_DEFAULTIOR=this._indexOfRefraction===t._DefaultIndexOfRefraction,this._isTintEnabled?(e.CLEARCOAT_TINT=!0,this._tintTexture&&Nl.ClearCoatTintTextureEnabled?(Pr.PrepareDefinesForMergedUV(this._tintTexture,e,\"CLEARCOAT_TINT_TEXTURE\"),e.CLEARCOAT_TINT_GAMMATEXTURE=this._tintTexture.gammaSpace):e.CLEARCOAT_TINT_TEXTURE=!1):(e.CLEARCOAT_TINT=!1,e.CLEARCOAT_TINT_TEXTURE=!1))):(e.CLEARCOAT=!1,e.CLEARCOAT_TEXTURE=!1,e.CLEARCOAT_TEXTURE_ROUGHNESS=!1,e.CLEARCOAT_BUMP=!1,e.CLEARCOAT_TINT=!1,e.CLEARCOAT_TINT_TEXTURE=!1,e.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE=!1,e.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL=!1)},t.prototype.bindForSubMesh=function(e,t,i,n){var r,o,a,s,l,c,u,h;if(this._isEnabled){var d=n.materialDefines,p=this._material.isFrozen,f=this._material._disableBumpMap,_=this._material._invertNormalMapX,m=this._material._invertNormalMapY,g=d.CLEARCOAT_TEXTURE_ROUGHNESS_IDENTICAL;if(!e.useUbo||!p||!e.isSync){g&&Nl.ClearCoatTextureEnabled?(e.updateFloat4(\"vClearCoatInfos\",this._texture.coordinatesIndex,this._texture.level,-1,-1),Pr.BindTextureMatrix(this._texture,e,\"clearCoat\")):(this._texture||this._textureRoughness)&&Nl.ClearCoatTextureEnabled&&(e.updateFloat4(\"vClearCoatInfos\",null!==(o=null===(r=this._texture)||void 0===r?void 0:r.coordinatesIndex)&&void 0!==o?o:0,null!==(s=null===(a=this._texture)||void 0===a?void 0:a.level)&&void 0!==s?s:0,null!==(c=null===(l=this._textureRoughness)||void 0===l?void 0:l.coordinatesIndex)&&void 0!==c?c:0,null!==(h=null===(u=this._textureRoughness)||void 0===u?void 0:u.level)&&void 0!==h?h:0),this._texture&&Pr.BindTextureMatrix(this._texture,e,\"clearCoat\"),!this._textureRoughness||g||d.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE||Pr.BindTextureMatrix(this._textureRoughness,e,\"clearCoatRoughness\")),this._bumpTexture&&i.getCaps().standardDerivatives&&Nl.ClearCoatTextureEnabled&&!f&&(e.updateFloat2(\"vClearCoatBumpInfos\",this._bumpTexture.coordinatesIndex,this._bumpTexture.level),Pr.BindTextureMatrix(this._bumpTexture,e,\"clearCoatBump\"),t._mirroredCameraPosition?e.updateFloat2(\"vClearCoatTangentSpaceParams\",_?1:-1,m?1:-1):e.updateFloat2(\"vClearCoatTangentSpaceParams\",_?-1:1,m?-1:1)),this._tintTexture&&Nl.ClearCoatTintTextureEnabled&&(e.updateFloat2(\"vClearCoatTintInfos\",this._tintTexture.coordinatesIndex,this._tintTexture.level),Pr.BindTextureMatrix(this._tintTexture,e,\"clearCoatTint\")),e.updateFloat2(\"vClearCoatParams\",this.intensity,this.roughness);var v=1-this._indexOfRefraction,y=1+this._indexOfRefraction,b=Math.pow(-v/y,2),T=1/this._indexOfRefraction;e.updateFloat4(\"vClearCoatRefractionParams\",b,T,v,y),this._isTintEnabled&&(e.updateFloat4(\"vClearCoatTintParams\",this.tintColor.r,this.tintColor.g,this.tintColor.b,Math.max(1e-5,this.tintThickness)),e.updateFloat(\"clearCoatColorAtDistance\",Math.max(1e-5,this.tintColorAtDistance)))}t.texturesEnabled&&(this._texture&&Nl.ClearCoatTextureEnabled&&e.setTexture(\"clearCoatSampler\",this._texture),this._textureRoughness&&!g&&!d.CLEARCOAT_USE_ROUGHNESS_FROM_MAINTEXTURE&&Nl.ClearCoatTextureEnabled&&e.setTexture(\"clearCoatRoughnessSampler\",this._textureRoughness),this._bumpTexture&&i.getCaps().standardDerivatives&&Nl.ClearCoatBumpTextureEnabled&&!f&&e.setTexture(\"clearCoatBumpSampler\",this._bumpTexture),this._isTintEnabled&&this._tintTexture&&Nl.ClearCoatTintTextureEnabled&&e.setTexture(\"clearCoatTintSampler\",this._tintTexture))}},t.prototype.hasTexture=function(e){return this._texture===e||this._textureRoughness===e||this._bumpTexture===e||this._tintTexture===e},t.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture),this._textureRoughness&&e.push(this._textureRoughness),this._bumpTexture&&e.push(this._bumpTexture),this._tintTexture&&e.push(this._tintTexture)},t.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture),this._textureRoughness&&this._textureRoughness.animations&&this._textureRoughness.animations.length>0&&e.push(this._textureRoughness),this._bumpTexture&&this._bumpTexture.animations&&this._bumpTexture.animations.length>0&&e.push(this._bumpTexture),this._tintTexture&&this._tintTexture.animations&&this._tintTexture.animations.length>0&&e.push(this._tintTexture)},t.prototype.dispose=function(e){var t,i,n,r;e&&(null===(t=this._texture)||void 0===t||t.dispose(),null===(i=this._textureRoughness)||void 0===i||i.dispose(),null===(n=this._bumpTexture)||void 0===n||n.dispose(),null===(r=this._tintTexture)||void 0===r||r.dispose())},t.prototype.getClassName=function(){return\"PBRClearCoatConfiguration\"},t.prototype.addFallbacks=function(e,t,i){return e.CLEARCOAT_BUMP&&t.addFallback(i++,\"CLEARCOAT_BUMP\"),e.CLEARCOAT_TINT&&t.addFallback(i++,\"CLEARCOAT_TINT\"),e.CLEARCOAT&&t.addFallback(i++,\"CLEARCOAT\"),i},t.prototype.getSamplers=function(e){e.push(\"clearCoatSampler\",\"clearCoatRoughnessSampler\",\"clearCoatBumpSampler\",\"clearCoatTintSampler\")},t.prototype.getUniforms=function(){return{ubo:[{name:\"vClearCoatParams\",size:2,type:\"vec2\"},{name:\"vClearCoatRefractionParams\",size:4,type:\"vec4\"},{name:\"vClearCoatInfos\",size:4,type:\"vec4\"},{name:\"clearCoatMatrix\",size:16,type:\"mat4\"},{name:\"clearCoatRoughnessMatrix\",size:16,type:\"mat4\"},{name:\"vClearCoatBumpInfos\",size:2,type:\"vec2\"},{name:\"vClearCoatTangentSpaceParams\",size:2,type:\"vec2\"},{name:\"clearCoatBumpMatrix\",size:16,type:\"mat4\"},{name:\"vClearCoatTintParams\",size:4,type:\"vec4\"},{name:\"clearCoatColorAtDistance\",size:1,type:\"float\"},{name:\"vClearCoatTintInfos\",size:2,type:\"vec2\"},{name:\"clearCoatTintMatrix\",size:16,type:\"mat4\"}]}},t._DefaultIndexOfRefraction=1.5,G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"isEnabled\",void 0),G([be()],t.prototype,\"intensity\",void 0),G([be()],t.prototype,\"roughness\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"indexOfRefraction\",void 0),G([Te(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"texture\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useRoughnessFromMainTexture\",void 0),G([Te(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"textureRoughness\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"remapF0OnInterfaceChange\",void 0),G([Te(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"bumpTexture\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"isTintEnabled\",void 0),G([Ee()],t.prototype,\"tintColor\",void 0),G([be()],t.prototype,\"tintColorAtDistance\",void 0),G([be()],t.prototype,\"tintThickness\",void 0),G([Te(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"tintTexture\",void 0),t}(kl),rf=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.IRIDESCENCE=!1,t.IRIDESCENCE_TEXTURE=!1,t.IRIDESCENCE_TEXTUREDIRECTUV=0,t.IRIDESCENCE_THICKNESS_TEXTURE=!1,t.IRIDESCENCE_THICKNESS_TEXTUREDIRECTUV=0,t.IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE=!1,t}return V(t,e),t}(Ei),of=function(e){function t(i,n){void 0===n&&(n=!0);var r=e.call(this,i,\"PBRIridescence\",110,new rf,n)||this;return r._isEnabled=!1,r.isEnabled=!1,r.intensity=1,r.minimumThickness=t._DefaultMinimumThickness,r.maximumThickness=t._DefaultMaximumThickness,r.indexOfRefraction=t._DefaultIndexOfRefraction,r._texture=null,r.texture=null,r._thicknessTexture=null,r.thicknessTexture=null,r._internalMarkAllSubMeshesAsTexturesDirty=i._dirtyCallbacks[a.MATERIAL_TextureDirtyFlag],r}return V(t,e),t.prototype._markAllSubMeshesAsTexturesDirty=function(){this._enable(this._isEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()},t.prototype.isReadyForSubMesh=function(e,t){if(!this._isEnabled)return!0;if(e._areTexturesDirty&&t.texturesEnabled){if(this._texture&&Nl.IridescenceTextureEnabled&&!this._texture.isReadyOrNotBlocking())return!1;if(this._thicknessTexture&&Nl.IridescenceTextureEnabled&&!this._thicknessTexture.isReadyOrNotBlocking())return!1}return!0},t.prototype.prepareDefinesBeforeAttributes=function(e,t){var i;this._isEnabled?(e.IRIDESCENCE=!0,e.IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE=null!==this._texture&&this._texture._texture===(null===(i=this._thicknessTexture)||void 0===i?void 0:i._texture)&&this._texture.checkTransformsAreIdentical(this._thicknessTexture),e._areTexturesDirty&&t.texturesEnabled&&(this._texture&&Nl.IridescenceTextureEnabled?Pr.PrepareDefinesForMergedUV(this._texture,e,\"IRIDESCENCE_TEXTURE\"):e.IRIDESCENCE_TEXTURE=!1,!e.IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE&&this._thicknessTexture&&Nl.IridescenceTextureEnabled?Pr.PrepareDefinesForMergedUV(this._thicknessTexture,e,\"IRIDESCENCE_THICKNESS_TEXTURE\"):e.IRIDESCENCE_THICKNESS_TEXTURE=!1)):(e.IRIDESCENCE=!1,e.IRIDESCENCE_TEXTURE=!1,e.IRIDESCENCE_THICKNESS_TEXTURE=!1,e.IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE=!1)},t.prototype.bindForSubMesh=function(e,t,i,n){var r,o,a,s,l,c,u,h;if(this._isEnabled){var d=n.materialDefines,p=this._material.isFrozen,f=d.IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE;e.useUbo&&p&&e.isSync||(f&&Nl.IridescenceTextureEnabled?(e.updateFloat4(\"vIridescenceInfos\",this._texture.coordinatesIndex,this._texture.level,-1,-1),Pr.BindTextureMatrix(this._texture,e,\"iridescence\")):(this._texture||this._thicknessTexture)&&Nl.IridescenceTextureEnabled&&(e.updateFloat4(\"vIridescenceInfos\",null!==(o=null===(r=this._texture)||void 0===r?void 0:r.coordinatesIndex)&&void 0!==o?o:0,null!==(s=null===(a=this._texture)||void 0===a?void 0:a.level)&&void 0!==s?s:0,null!==(c=null===(l=this._thicknessTexture)||void 0===l?void 0:l.coordinatesIndex)&&void 0!==c?c:0,null!==(h=null===(u=this._thicknessTexture)||void 0===u?void 0:u.level)&&void 0!==h?h:0),this._texture&&Pr.BindTextureMatrix(this._texture,e,\"iridescence\"),!this._thicknessTexture||f||d.IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE||Pr.BindTextureMatrix(this._thicknessTexture,e,\"iridescenceThickness\")),e.updateFloat4(\"vIridescenceParams\",this.intensity,this.indexOfRefraction,this.minimumThickness,this.maximumThickness)),t.texturesEnabled&&(this._texture&&Nl.IridescenceTextureEnabled&&e.setTexture(\"iridescenceSampler\",this._texture),this._thicknessTexture&&!f&&!d.IRIDESCENCE_USE_THICKNESS_FROM_MAINTEXTURE&&Nl.IridescenceTextureEnabled&&e.setTexture(\"iridescenceThicknessSampler\",this._thicknessTexture))}},t.prototype.hasTexture=function(e){return this._texture===e||this._thicknessTexture===e},t.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture),this._thicknessTexture&&e.push(this._thicknessTexture)},t.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture),this._thicknessTexture&&this._thicknessTexture.animations&&this._thicknessTexture.animations.length>0&&e.push(this._thicknessTexture)},t.prototype.dispose=function(e){var t,i;e&&(null===(t=this._texture)||void 0===t||t.dispose(),null===(i=this._thicknessTexture)||void 0===i||i.dispose())},t.prototype.getClassName=function(){return\"PBRIridescenceConfiguration\"},t.prototype.addFallbacks=function(e,t,i){return e.IRIDESCENCE&&t.addFallback(i++,\"IRIDESCENCE\"),i},t.prototype.getSamplers=function(e){e.push(\"iridescenceSampler\",\"iridescenceThicknessSampler\")},t.prototype.getUniforms=function(){return{ubo:[{name:\"vIridescenceParams\",size:4,type:\"vec4\"},{name:\"vIridescenceInfos\",size:4,type:\"vec4\"},{name:\"iridescenceMatrix\",size:16,type:\"mat4\"},{name:\"iridescenceThicknessMatrix\",size:16,type:\"mat4\"}]}},t._DefaultMinimumThickness=100,t._DefaultMaximumThickness=400,t._DefaultIndexOfRefraction=1.3,G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"isEnabled\",void 0),G([be()],t.prototype,\"intensity\",void 0),G([be()],t.prototype,\"minimumThickness\",void 0),G([be()],t.prototype,\"maximumThickness\",void 0),G([be()],t.prototype,\"indexOfRefraction\",void 0),G([Te(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"texture\",void 0),G([Te(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"thicknessTexture\",void 0),t}(kl),af=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.ANISOTROPIC=!1,t.ANISOTROPIC_TEXTURE=!1,t.ANISOTROPIC_TEXTUREDIRECTUV=0,t.MAINUV1=!1,t}return V(t,e),t}(Ei),sf=function(e){function t(t,i){void 0===i&&(i=!0);var n=e.call(this,t,\"PBRAnisotropic\",110,new af,i)||this;return n._isEnabled=!1,n.isEnabled=!1,n.intensity=1,n.direction=new R(1,0),n._texture=null,n.texture=null,n._internalMarkAllSubMeshesAsTexturesDirty=t._dirtyCallbacks[a.MATERIAL_TextureDirtyFlag],n}return V(t,e),t.prototype._markAllSubMeshesAsTexturesDirty=function(){this._enable(this._isEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()},t.prototype.isReadyForSubMesh=function(e,t){return!this._isEnabled||!(e._areTexturesDirty&&t.texturesEnabled&&this._texture&&Nl.AnisotropicTextureEnabled&&!this._texture.isReadyOrNotBlocking())},t.prototype.prepareDefinesBeforeAttributes=function(e,t,i){this._isEnabled?(e.ANISOTROPIC=this._isEnabled,this._isEnabled&&!i.isVerticesDataPresent(wi.TangentKind)&&(e._needUVs=!0,e.MAINUV1=!0),e._areTexturesDirty&&t.texturesEnabled&&(this._texture&&Nl.AnisotropicTextureEnabled?Pr.PrepareDefinesForMergedUV(this._texture,e,\"ANISOTROPIC_TEXTURE\"):e.ANISOTROPIC_TEXTURE=!1)):(e.ANISOTROPIC=!1,e.ANISOTROPIC_TEXTURE=!1)},t.prototype.bindForSubMesh=function(e,t){if(this._isEnabled){var i=this._material.isFrozen;e.useUbo&&i&&e.isSync||(this._texture&&Nl.AnisotropicTextureEnabled&&(e.updateFloat2(\"vAnisotropyInfos\",this._texture.coordinatesIndex,this._texture.level),Pr.BindTextureMatrix(this._texture,e,\"anisotropy\")),e.updateFloat3(\"vAnisotropy\",this.direction.x,this.direction.y,this.intensity)),t.texturesEnabled&&this._texture&&Nl.AnisotropicTextureEnabled&&e.setTexture(\"anisotropySampler\",this._texture)}},t.prototype.hasTexture=function(e){return this._texture===e},t.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture)},t.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture)},t.prototype.dispose=function(e){e&&this._texture&&this._texture.dispose()},t.prototype.getClassName=function(){return\"PBRAnisotropicConfiguration\"},t.prototype.addFallbacks=function(e,t,i){return e.ANISOTROPIC&&t.addFallback(i++,\"ANISOTROPIC\"),i},t.prototype.getSamplers=function(e){e.push(\"anisotropySampler\")},t.prototype.getUniforms=function(){return{ubo:[{name:\"vAnisotropy\",size:3,type:\"vec3\"},{name:\"vAnisotropyInfos\",size:2,type:\"vec2\"},{name:\"anisotropyMatrix\",size:16,type:\"mat4\"}]}},G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"isEnabled\",void 0),G([be()],t.prototype,\"intensity\",void 0),G([Ae()],t.prototype,\"direction\",void 0),G([Te(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"texture\",void 0),t}(kl),lf=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.SHEEN=!1,t.SHEEN_TEXTURE=!1,t.SHEEN_GAMMATEXTURE=!1,t.SHEEN_TEXTURE_ROUGHNESS=!1,t.SHEEN_TEXTUREDIRECTUV=0,t.SHEEN_TEXTURE_ROUGHNESSDIRECTUV=0,t.SHEEN_LINKWITHALBEDO=!1,t.SHEEN_ROUGHNESS=!1,t.SHEEN_ALBEDOSCALING=!1,t.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE=!1,t.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL=!1,t}return V(t,e),t}(Ei),cf=function(e){function t(t,i){void 0===i&&(i=!0);var n=e.call(this,t,\"Sheen\",120,new lf,i)||this;return n._isEnabled=!1,n.isEnabled=!1,n._linkSheenWithAlbedo=!1,n.linkSheenWithAlbedo=!1,n.intensity=1,n.color=N.White(),n._texture=null,n.texture=null,n._useRoughnessFromMainTexture=!0,n.useRoughnessFromMainTexture=!0,n._roughness=null,n.roughness=null,n._textureRoughness=null,n.textureRoughness=null,n._albedoScaling=!1,n.albedoScaling=!1,n._internalMarkAllSubMeshesAsTexturesDirty=t._dirtyCallbacks[a.MATERIAL_TextureDirtyFlag],n}return V(t,e),t.prototype._markAllSubMeshesAsTexturesDirty=function(){this._enable(this._isEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()},t.prototype.isReadyForSubMesh=function(e,t){if(!this._isEnabled)return!0;if(e._areTexturesDirty&&t.texturesEnabled){if(this._texture&&Nl.SheenTextureEnabled&&!this._texture.isReadyOrNotBlocking())return!1;if(this._textureRoughness&&Nl.SheenTextureEnabled&&!this._textureRoughness.isReadyOrNotBlocking())return!1}return!0},t.prototype.prepareDefinesBeforeAttributes=function(e,t){var i;this._isEnabled?(e.SHEEN=!0,e.SHEEN_LINKWITHALBEDO=this._linkSheenWithAlbedo,e.SHEEN_ROUGHNESS=null!==this._roughness,e.SHEEN_ALBEDOSCALING=this._albedoScaling,e.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE=this._useRoughnessFromMainTexture,e.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL=null!==this._texture&&this._texture._texture===(null===(i=this._textureRoughness)||void 0===i?void 0:i._texture)&&this._texture.checkTransformsAreIdentical(this._textureRoughness),e._areTexturesDirty&&t.texturesEnabled&&(this._texture&&Nl.SheenTextureEnabled?(Pr.PrepareDefinesForMergedUV(this._texture,e,\"SHEEN_TEXTURE\"),e.SHEEN_GAMMATEXTURE=this._texture.gammaSpace):e.SHEEN_TEXTURE=!1,this._textureRoughness&&Nl.SheenTextureEnabled?Pr.PrepareDefinesForMergedUV(this._textureRoughness,e,\"SHEEN_TEXTURE_ROUGHNESS\"):e.SHEEN_TEXTURE_ROUGHNESS=!1)):(e.SHEEN=!1,e.SHEEN_TEXTURE=!1,e.SHEEN_TEXTURE_ROUGHNESS=!1,e.SHEEN_LINKWITHALBEDO=!1,e.SHEEN_ROUGHNESS=!1,e.SHEEN_ALBEDOSCALING=!1,e.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE=!1,e.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL=!1)},t.prototype.bindForSubMesh=function(e,t,i,n){var r,o,a,s,l,c,u,h;if(this._isEnabled){var d=n.materialDefines,p=this._material.isFrozen,f=d.SHEEN_TEXTURE_ROUGHNESS_IDENTICAL;e.useUbo&&p&&e.isSync||(f&&Nl.SheenTextureEnabled?(e.updateFloat4(\"vSheenInfos\",this._texture.coordinatesIndex,this._texture.level,-1,-1),Pr.BindTextureMatrix(this._texture,e,\"sheen\")):(this._texture||this._textureRoughness)&&Nl.SheenTextureEnabled&&(e.updateFloat4(\"vSheenInfos\",null!==(o=null===(r=this._texture)||void 0===r?void 0:r.coordinatesIndex)&&void 0!==o?o:0,null!==(s=null===(a=this._texture)||void 0===a?void 0:a.level)&&void 0!==s?s:0,null!==(c=null===(l=this._textureRoughness)||void 0===l?void 0:l.coordinatesIndex)&&void 0!==c?c:0,null!==(h=null===(u=this._textureRoughness)||void 0===u?void 0:u.level)&&void 0!==h?h:0),this._texture&&Pr.BindTextureMatrix(this._texture,e,\"sheen\"),!this._textureRoughness||f||d.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE||Pr.BindTextureMatrix(this._textureRoughness,e,\"sheenRoughness\")),e.updateFloat4(\"vSheenColor\",this.color.r,this.color.g,this.color.b,this.intensity),null!==this._roughness&&e.updateFloat(\"vSheenRoughness\",this._roughness)),t.texturesEnabled&&(this._texture&&Nl.SheenTextureEnabled&&e.setTexture(\"sheenSampler\",this._texture),this._textureRoughness&&!f&&!d.SHEEN_USE_ROUGHNESS_FROM_MAINTEXTURE&&Nl.SheenTextureEnabled&&e.setTexture(\"sheenRoughnessSampler\",this._textureRoughness))}},t.prototype.hasTexture=function(e){return this._texture===e||this._textureRoughness===e},t.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture),this._textureRoughness&&e.push(this._textureRoughness)},t.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture),this._textureRoughness&&this._textureRoughness.animations&&this._textureRoughness.animations.length>0&&e.push(this._textureRoughness)},t.prototype.dispose=function(e){var t,i;e&&(null===(t=this._texture)||void 0===t||t.dispose(),null===(i=this._textureRoughness)||void 0===i||i.dispose())},t.prototype.getClassName=function(){return\"PBRSheenConfiguration\"},t.prototype.addFallbacks=function(e,t,i){return e.SHEEN&&t.addFallback(i++,\"SHEEN\"),i},t.prototype.getSamplers=function(e){e.push(\"sheenSampler\",\"sheenRoughnessSampler\")},t.prototype.getUniforms=function(){return{ubo:[{name:\"vSheenColor\",size:4,type:\"vec4\"},{name:\"vSheenRoughness\",size:1,type:\"float\"},{name:\"vSheenInfos\",size:4,type:\"vec4\"},{name:\"sheenMatrix\",size:16,type:\"mat4\"},{name:\"sheenRoughnessMatrix\",size:16,type:\"mat4\"}]}},G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"isEnabled\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"linkSheenWithAlbedo\",void 0),G([be()],t.prototype,\"intensity\",void 0),G([Ee()],t.prototype,\"color\",void 0),G([Te(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"texture\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useRoughnessFromMainTexture\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"roughness\",void 0),G([Te(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"textureRoughness\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"albedoScaling\",void 0),t}(kl),uf=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.SUBSURFACE=!1,t.SS_REFRACTION=!1,t.SS_REFRACTION_USE_INTENSITY_FROM_TEXTURE=!1,t.SS_TRANSLUCENCY=!1,t.SS_TRANSLUCENCY_USE_INTENSITY_FROM_TEXTURE=!1,t.SS_SCATTERING=!1,t.SS_THICKNESSANDMASK_TEXTURE=!1,t.SS_THICKNESSANDMASK_TEXTUREDIRECTUV=0,t.SS_HAS_THICKNESS=!1,t.SS_REFRACTIONINTENSITY_TEXTURE=!1,t.SS_REFRACTIONINTENSITY_TEXTUREDIRECTUV=0,t.SS_TRANSLUCENCYINTENSITY_TEXTURE=!1,t.SS_TRANSLUCENCYINTENSITY_TEXTUREDIRECTUV=0,t.SS_REFRACTIONMAP_3D=!1,t.SS_REFRACTIONMAP_OPPOSITEZ=!1,t.SS_LODINREFRACTIONALPHA=!1,t.SS_GAMMAREFRACTION=!1,t.SS_RGBDREFRACTION=!1,t.SS_LINEARSPECULARREFRACTION=!1,t.SS_LINKREFRACTIONTOTRANSPARENCY=!1,t.SS_ALBEDOFORREFRACTIONTINT=!1,t.SS_ALBEDOFORTRANSLUCENCYTINT=!1,t.SS_USE_LOCAL_REFRACTIONMAP_CUBIC=!1,t.SS_USE_THICKNESS_AS_DEPTH=!1,t.SS_MASK_FROM_THICKNESS_TEXTURE=!1,t.SS_USE_GLTF_TEXTURES=!1,t}return V(t,e),t}(Ei),hf=function(e){function t(t,i){void 0===i&&(i=!0);var n=e.call(this,t,\"PBRSubSurface\",130,new uf,i)||this;return n._isRefractionEnabled=!1,n.isRefractionEnabled=!1,n._isTranslucencyEnabled=!1,n.isTranslucencyEnabled=!1,n._isScatteringEnabled=!1,n.isScatteringEnabled=!1,n._scatteringDiffusionProfileIndex=0,n.refractionIntensity=1,n.translucencyIntensity=1,n.useAlbedoToTintRefraction=!1,n.useAlbedoToTintTranslucency=!1,n._thicknessTexture=null,n.thicknessTexture=null,n._refractionTexture=null,n.refractionTexture=null,n._indexOfRefraction=1.5,n.indexOfRefraction=1.5,n._volumeIndexOfRefraction=-1,n._invertRefractionY=!1,n.invertRefractionY=!1,n._linkRefractionWithTransparency=!1,n.linkRefractionWithTransparency=!1,n.minimumThickness=0,n.maximumThickness=1,n.useThicknessAsDepth=!1,n.tintColor=N.White(),n.tintColorAtDistance=1,n.diffusionDistance=N.White(),n._useMaskFromThicknessTexture=!1,n.useMaskFromThicknessTexture=!1,n._refractionIntensityTexture=null,n.refractionIntensityTexture=null,n._translucencyIntensityTexture=null,n.translucencyIntensityTexture=null,n._useGltfStyleTextures=!1,n.useGltfStyleTextures=!1,n._scene=t.getScene(),n.registerForExtraEvents=!0,n._internalMarkAllSubMeshesAsTexturesDirty=t._dirtyCallbacks[a.MATERIAL_TextureDirtyFlag],n._internalMarkScenePrePassDirty=t._dirtyCallbacks[a.MATERIAL_PrePassDirtyFlag],n}return V(t,e),Object.defineProperty(t.prototype,\"scatteringDiffusionProfile\",{get:function(){return this._scene.subSurfaceConfiguration?this._scene.subSurfaceConfiguration.ssDiffusionProfileColors[this._scatteringDiffusionProfileIndex]:null},set:function(e){this._scene.enableSubSurfaceForPrePass()&&e&&(this._scatteringDiffusionProfileIndex=this._scene.subSurfaceConfiguration.addDiffusionProfile(e))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"volumeIndexOfRefraction\",{get:function(){return this._volumeIndexOfRefraction>=1?this._volumeIndexOfRefraction:this._indexOfRefraction},set:function(e){this._volumeIndexOfRefraction=e>=1?e:-1},enumerable:!1,configurable:!0}),t.prototype._markAllSubMeshesAsTexturesDirty=function(){this._enable(this._isRefractionEnabled||this._isTranslucencyEnabled||this._isScatteringEnabled),this._internalMarkAllSubMeshesAsTexturesDirty()},t.prototype._markScenePrePassDirty=function(){this._internalMarkAllSubMeshesAsTexturesDirty(),this._internalMarkScenePrePassDirty()},t.prototype.isReadyForSubMesh=function(e,t){if(!this._isRefractionEnabled&&!this._isTranslucencyEnabled&&!this._isScatteringEnabled)return!0;if(e._areTexturesDirty&&t.texturesEnabled){if(this._thicknessTexture&&Nl.ThicknessTextureEnabled&&!this._thicknessTexture.isReadyOrNotBlocking())return!1;var i=this._getRefractionTexture(t);if(i&&Nl.RefractionTextureEnabled&&!i.isReadyOrNotBlocking())return!1}return!0},t.prototype.prepareDefinesBeforeAttributes=function(e,t){if(!this._isRefractionEnabled&&!this._isTranslucencyEnabled&&!this._isScatteringEnabled)return e.SUBSURFACE=!1,e.SS_TRANSLUCENCY=!1,e.SS_SCATTERING=!1,void(e.SS_REFRACTION=!1);if(e._areTexturesDirty){e.SUBSURFACE=!0,e.SS_TRANSLUCENCY=this._isTranslucencyEnabled,e.SS_TRANSLUCENCY_USE_INTENSITY_FROM_TEXTURE=!1,e.SS_SCATTERING=this._isScatteringEnabled,e.SS_THICKNESSANDMASK_TEXTURE=!1,e.SS_REFRACTIONINTENSITY_TEXTURE=!1,e.SS_TRANSLUCENCYINTENSITY_TEXTURE=!1,e.SS_HAS_THICKNESS=!1,e.SS_MASK_FROM_THICKNESS_TEXTURE=!1,e.SS_USE_GLTF_TEXTURES=!1,e.SS_REFRACTION=!1,e.SS_REFRACTION_USE_INTENSITY_FROM_TEXTURE=!1,e.SS_REFRACTIONMAP_3D=!1,e.SS_GAMMAREFRACTION=!1,e.SS_RGBDREFRACTION=!1,e.SS_LINEARSPECULARREFRACTION=!1,e.SS_REFRACTIONMAP_OPPOSITEZ=!1,e.SS_LODINREFRACTIONALPHA=!1,e.SS_LINKREFRACTIONTOTRANSPARENCY=!1,e.SS_ALBEDOFORREFRACTIONTINT=!1,e.SS_ALBEDOFORTRANSLUCENCYTINT=!1,e.SS_USE_LOCAL_REFRACTIONMAP_CUBIC=!1,e.SS_USE_THICKNESS_AS_DEPTH=!1;var i=!!this._thicknessTexture&&!!this._refractionIntensityTexture&&this._refractionIntensityTexture.checkTransformsAreIdentical(this._thicknessTexture)&&this._refractionIntensityTexture._texture===this._thicknessTexture._texture,n=!!this._thicknessTexture&&!!this._translucencyIntensityTexture&&this._translucencyIntensityTexture.checkTransformsAreIdentical(this._thicknessTexture)&&this._translucencyIntensityTexture._texture===this._thicknessTexture._texture,r=(i||!this._refractionIntensityTexture)&&(n||!this._translucencyIntensityTexture);if(e._areTexturesDirty&&t.texturesEnabled&&(this._thicknessTexture&&Nl.ThicknessTextureEnabled&&Pr.PrepareDefinesForMergedUV(this._thicknessTexture,e,\"SS_THICKNESSANDMASK_TEXTURE\"),this._refractionIntensityTexture&&Nl.RefractionIntensityTextureEnabled&&!r&&Pr.PrepareDefinesForMergedUV(this._refractionIntensityTexture,e,\"SS_REFRACTIONINTENSITY_TEXTURE\"),this._translucencyIntensityTexture&&Nl.TranslucencyIntensityTextureEnabled&&!r&&Pr.PrepareDefinesForMergedUV(this._translucencyIntensityTexture,e,\"SS_TRANSLUCENCYINTENSITY_TEXTURE\")),e.SS_HAS_THICKNESS=this.maximumThickness-this.minimumThickness!=0,e.SS_MASK_FROM_THICKNESS_TEXTURE=(this._useMaskFromThicknessTexture||!!this._refractionIntensityTexture||!!this._translucencyIntensityTexture)&&r,e.SS_USE_GLTF_TEXTURES=this._useGltfStyleTextures,e.SS_REFRACTION_USE_INTENSITY_FROM_TEXTURE=(this._useMaskFromThicknessTexture||!!this._refractionIntensityTexture)&&r,e.SS_TRANSLUCENCY_USE_INTENSITY_FROM_TEXTURE=(this._useMaskFromThicknessTexture||!!this._translucencyIntensityTexture)&&r,this._isRefractionEnabled&&t.texturesEnabled){var o=this._getRefractionTexture(t);o&&Nl.RefractionTextureEnabled&&(e.SS_REFRACTION=!0,e.SS_REFRACTIONMAP_3D=o.isCube,e.SS_GAMMAREFRACTION=o.gammaSpace,e.SS_RGBDREFRACTION=o.isRGBD,e.SS_LINEARSPECULARREFRACTION=o.linearSpecularLOD,e.SS_REFRACTIONMAP_OPPOSITEZ=o.invertZ,e.SS_LODINREFRACTIONALPHA=o.lodLevelInAlpha,e.SS_LINKREFRACTIONTOTRANSPARENCY=this._linkRefractionWithTransparency,e.SS_ALBEDOFORREFRACTIONTINT=this.useAlbedoToTintRefraction,e.SS_USE_LOCAL_REFRACTIONMAP_CUBIC=o.isCube&&o.boundingBoxSize,e.SS_USE_THICKNESS_AS_DEPTH=this.useThicknessAsDepth)}this._isTranslucencyEnabled&&(e.SS_ALBEDOFORTRANSLUCENCYTINT=this.useAlbedoToTintTranslucency)}},t.prototype.hardBindForSubMesh=function(e,t,i,n){if(this._isRefractionEnabled||this._isTranslucencyEnabled||this._isScatteringEnabled){n.getRenderingMesh().getWorldMatrix().decompose(O.Vector3[0]);var r=Math.max(Math.abs(O.Vector3[0].x),Math.abs(O.Vector3[0].y),Math.abs(O.Vector3[0].z));e.updateFloat2(\"vThicknessParam\",this.minimumThickness*r,(this.maximumThickness-this.minimumThickness)*r)}},t.prototype.bindForSubMesh=function(e,t,i,n){if(this._isRefractionEnabled||this._isTranslucencyEnabled||this._isScatteringEnabled){var r=n.materialDefines,o=this._material.isFrozen,a=this._material.realTimeFiltering,s=r.LODBASEDMICROSFURACE,l=this._getRefractionTexture(t);if(!e.useUbo||!o||!e.isSync){if(this._thicknessTexture&&Nl.ThicknessTextureEnabled&&(e.updateFloat2(\"vThicknessInfos\",this._thicknessTexture.coordinatesIndex,this._thicknessTexture.level),Pr.BindTextureMatrix(this._thicknessTexture,e,\"thickness\")),this._refractionIntensityTexture&&Nl.RefractionIntensityTextureEnabled&&r.SS_REFRACTIONINTENSITY_TEXTURE&&(e.updateFloat2(\"vRefractionIntensityInfos\",this._refractionIntensityTexture.coordinatesIndex,this._refractionIntensityTexture.level),Pr.BindTextureMatrix(this._refractionIntensityTexture,e,\"refractionIntensity\")),this._translucencyIntensityTexture&&Nl.TranslucencyIntensityTextureEnabled&&r.SS_TRANSLUCENCYINTENSITY_TEXTURE&&(e.updateFloat2(\"vTranslucencyIntensityInfos\",this._translucencyIntensityTexture.coordinatesIndex,this._translucencyIntensityTexture.level),Pr.BindTextureMatrix(this._translucencyIntensityTexture,e,\"translucencyIntensity\")),l&&Nl.RefractionTextureEnabled){e.updateMatrix(\"refractionMatrix\",l.getReflectionTextureMatrix());var c=1;l.isCube||l.depth&&(c=l.depth);var u=l.getSize().width,d=this.volumeIndexOfRefraction;if(e.updateFloat4(\"vRefractionInfos\",l.level,1/d,c,this._invertRefractionY?-1:1),e.updateFloat4(\"vRefractionMicrosurfaceInfos\",u,l.lodGenerationScale,l.lodGenerationOffset,1/this.indexOfRefraction),a&&e.updateFloat2(\"vRefractionFilteringInfo\",u,h.Log2(u)),l.boundingBoxSize){var p=l;e.updateVector3(\"vRefractionPosition\",p.boundingBoxPosition),e.updateVector3(\"vRefractionSize\",p.boundingBoxSize)}}this._isScatteringEnabled&&e.updateFloat(\"scatteringDiffusionProfile\",this._scatteringDiffusionProfileIndex),e.updateColor3(\"vDiffusionDistance\",this.diffusionDistance),e.updateFloat4(\"vTintColor\",this.tintColor.r,this.tintColor.g,this.tintColor.b,Math.max(1e-5,this.tintColorAtDistance)),e.updateFloat3(\"vSubSurfaceIntensity\",this.refractionIntensity,this.translucencyIntensity,0)}t.texturesEnabled&&(this._thicknessTexture&&Nl.ThicknessTextureEnabled&&e.setTexture(\"thicknessSampler\",this._thicknessTexture),this._refractionIntensityTexture&&Nl.RefractionIntensityTextureEnabled&&r.SS_REFRACTIONINTENSITY_TEXTURE&&e.setTexture(\"refractionIntensitySampler\",this._refractionIntensityTexture),this._translucencyIntensityTexture&&Nl.TranslucencyIntensityTextureEnabled&&r.SS_TRANSLUCENCYINTENSITY_TEXTURE&&e.setTexture(\"translucencyIntensitySampler\",this._translucencyIntensityTexture),l&&Nl.RefractionTextureEnabled&&(s?e.setTexture(\"refractionSampler\",l):(e.setTexture(\"refractionSampler\",l._lodTextureMid||l),e.setTexture(\"refractionSamplerLow\",l._lodTextureLow||l),e.setTexture(\"refractionSamplerHigh\",l._lodTextureHigh||l))))}},t.prototype._getRefractionTexture=function(e){return this._refractionTexture?this._refractionTexture:this._isRefractionEnabled?e.environmentTexture:null},Object.defineProperty(t.prototype,\"disableAlphaBlending\",{get:function(){return this._isRefractionEnabled&&this._linkRefractionWithTransparency},enumerable:!1,configurable:!0}),t.prototype.fillRenderTargetTextures=function(e){Nl.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget&&e.push(this._refractionTexture)},t.prototype.hasTexture=function(e){return this._thicknessTexture===e||this._refractionTexture===e},t.prototype.hasRenderTargetTextures=function(){return!!(Nl.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget)},t.prototype.getActiveTextures=function(e){this._thicknessTexture&&e.push(this._thicknessTexture),this._refractionTexture&&e.push(this._refractionTexture)},t.prototype.getAnimatables=function(e){this._thicknessTexture&&this._thicknessTexture.animations&&this._thicknessTexture.animations.length>0&&e.push(this._thicknessTexture),this._refractionTexture&&this._refractionTexture.animations&&this._refractionTexture.animations.length>0&&e.push(this._refractionTexture)},t.prototype.dispose=function(e){e&&(this._thicknessTexture&&this._thicknessTexture.dispose(),this._refractionTexture&&this._refractionTexture.dispose())},t.prototype.getClassName=function(){return\"PBRSubSurfaceConfiguration\"},t.prototype.addFallbacks=function(e,t,i){return e.SS_SCATTERING&&t.addFallback(i++,\"SS_SCATTERING\"),e.SS_TRANSLUCENCY&&t.addFallback(i++,\"SS_TRANSLUCENCY\"),i},t.prototype.getSamplers=function(e){e.push(\"thicknessSampler\",\"refractionIntensitySampler\",\"translucencyIntensitySampler\",\"refractionSampler\",\"refractionSamplerLow\",\"refractionSamplerHigh\")},t.prototype.getUniforms=function(){return{ubo:[{name:\"vRefractionMicrosurfaceInfos\",size:4,type:\"vec4\"},{name:\"vRefractionFilteringInfo\",size:2,type:\"vec2\"},{name:\"vTranslucencyIntensityInfos\",size:2,type:\"vec2\"},{name:\"vRefractionInfos\",size:4,type:\"vec4\"},{name:\"refractionMatrix\",size:16,type:\"mat4\"},{name:\"vThicknessInfos\",size:2,type:\"vec2\"},{name:\"vRefractionIntensityInfos\",size:2,type:\"vec2\"},{name:\"thicknessMatrix\",size:16,type:\"mat4\"},{name:\"refractionIntensityMatrix\",size:16,type:\"mat4\"},{name:\"translucencyIntensityMatrix\",size:16,type:\"mat4\"},{name:\"vThicknessParam\",size:2,type:\"vec2\"},{name:\"vDiffusionDistance\",size:3,type:\"vec3\"},{name:\"vTintColor\",size:4,type:\"vec4\"},{name:\"vSubSurfaceIntensity\",size:3,type:\"vec3\"},{name:\"vRefractionPosition\",size:3,type:\"vec3\"},{name:\"vRefractionSize\",size:3,type:\"vec3\"},{name:\"scatteringDiffusionProfile\",size:1,type:\"float\"}]}},G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"isRefractionEnabled\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"isTranslucencyEnabled\",void 0),G([be(),ye(\"_markScenePrePassDirty\")],t.prototype,\"isScatteringEnabled\",void 0),G([be()],t.prototype,\"_scatteringDiffusionProfileIndex\",void 0),G([be()],t.prototype,\"refractionIntensity\",void 0),G([be()],t.prototype,\"translucencyIntensity\",void 0),G([be()],t.prototype,\"useAlbedoToTintRefraction\",void 0),G([be()],t.prototype,\"useAlbedoToTintTranslucency\",void 0),G([Te(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"thicknessTexture\",void 0),G([Te(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"refractionTexture\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"indexOfRefraction\",void 0),G([be()],t.prototype,\"_volumeIndexOfRefraction\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"volumeIndexOfRefraction\",null),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"invertRefractionY\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"linkRefractionWithTransparency\",void 0),G([be()],t.prototype,\"minimumThickness\",void 0),G([be()],t.prototype,\"maximumThickness\",void 0),G([be()],t.prototype,\"useThicknessAsDepth\",void 0),G([Ee()],t.prototype,\"tintColor\",void 0),G([be()],t.prototype,\"tintColorAtDistance\",void 0),G([Ee()],t.prototype,\"diffusionDistance\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useMaskFromThicknessTexture\",void 0),G([Te(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"refractionIntensityTexture\",void 0),G([Te(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"translucencyIntensityTexture\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useGltfStyleTextures\",void 0),t}(kl),df={effect:null,subMesh:null},pf=function(e){function t(t){var i=e.call(this,t)||this;return i.PBR=!0,i.NUM_SAMPLES=\"0\",i.REALTIME_FILTERING=!1,i.MAINUV1=!1,i.MAINUV2=!1,i.MAINUV3=!1,i.MAINUV4=!1,i.MAINUV5=!1,i.MAINUV6=!1,i.UV1=!1,i.UV2=!1,i.UV3=!1,i.UV4=!1,i.UV5=!1,i.UV6=!1,i.ALBEDO=!1,i.GAMMAALBEDO=!1,i.ALBEDODIRECTUV=0,i.VERTEXCOLOR=!1,i.BAKED_VERTEX_ANIMATION_TEXTURE=!1,i.AMBIENT=!1,i.AMBIENTDIRECTUV=0,i.AMBIENTINGRAYSCALE=!1,i.OPACITY=!1,i.VERTEXALPHA=!1,i.OPACITYDIRECTUV=0,i.OPACITYRGB=!1,i.ALPHATEST=!1,i.DEPTHPREPASS=!1,i.ALPHABLEND=!1,i.ALPHAFROMALBEDO=!1,i.ALPHATESTVALUE=\"0.5\",i.SPECULAROVERALPHA=!1,i.RADIANCEOVERALPHA=!1,i.ALPHAFRESNEL=!1,i.LINEARALPHAFRESNEL=!1,i.PREMULTIPLYALPHA=!1,i.EMISSIVE=!1,i.EMISSIVEDIRECTUV=0,i.GAMMAEMISSIVE=!1,i.REFLECTIVITY=!1,i.REFLECTIVITY_GAMMA=!1,i.REFLECTIVITYDIRECTUV=0,i.SPECULARTERM=!1,i.MICROSURFACEFROMREFLECTIVITYMAP=!1,i.MICROSURFACEAUTOMATIC=!1,i.LODBASEDMICROSFURACE=!1,i.MICROSURFACEMAP=!1,i.MICROSURFACEMAPDIRECTUV=0,i.METALLICWORKFLOW=!1,i.ROUGHNESSSTOREINMETALMAPALPHA=!1,i.ROUGHNESSSTOREINMETALMAPGREEN=!1,i.METALLNESSSTOREINMETALMAPBLUE=!1,i.AOSTOREINMETALMAPRED=!1,i.METALLIC_REFLECTANCE=!1,i.METALLIC_REFLECTANCE_GAMMA=!1,i.METALLIC_REFLECTANCEDIRECTUV=0,i.METALLIC_REFLECTANCE_USE_ALPHA_ONLY=!1,i.REFLECTANCE=!1,i.REFLECTANCE_GAMMA=!1,i.REFLECTANCEDIRECTUV=0,i.ENVIRONMENTBRDF=!1,i.ENVIRONMENTBRDF_RGBD=!1,i.NORMAL=!1,i.TANGENT=!1,i.BUMP=!1,i.BUMPDIRECTUV=0,i.OBJECTSPACE_NORMALMAP=!1,i.PARALLAX=!1,i.PARALLAXOCCLUSION=!1,i.NORMALXYSCALE=!0,i.LIGHTMAP=!1,i.LIGHTMAPDIRECTUV=0,i.USELIGHTMAPASSHADOWMAP=!1,i.GAMMALIGHTMAP=!1,i.RGBDLIGHTMAP=!1,i.REFLECTION=!1,i.REFLECTIONMAP_3D=!1,i.REFLECTIONMAP_SPHERICAL=!1,i.REFLECTIONMAP_PLANAR=!1,i.REFLECTIONMAP_CUBIC=!1,i.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,i.REFLECTIONMAP_PROJECTION=!1,i.REFLECTIONMAP_SKYBOX=!1,i.REFLECTIONMAP_EXPLICIT=!1,i.REFLECTIONMAP_EQUIRECTANGULAR=!1,i.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,i.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,i.INVERTCUBICMAP=!1,i.USESPHERICALFROMREFLECTIONMAP=!1,i.USEIRRADIANCEMAP=!1,i.USESPHERICALINVERTEX=!1,i.REFLECTIONMAP_OPPOSITEZ=!1,i.LODINREFLECTIONALPHA=!1,i.GAMMAREFLECTION=!1,i.RGBDREFLECTION=!1,i.LINEARSPECULARREFLECTION=!1,i.RADIANCEOCCLUSION=!1,i.HORIZONOCCLUSION=!1,i.INSTANCES=!1,i.THIN_INSTANCES=!1,i.INSTANCESCOLOR=!1,i.PREPASS=!1,i.PREPASS_IRRADIANCE=!1,i.PREPASS_IRRADIANCE_INDEX=-1,i.PREPASS_ALBEDO_SQRT=!1,i.PREPASS_ALBEDO_SQRT_INDEX=-1,i.PREPASS_DEPTH=!1,i.PREPASS_DEPTH_INDEX=-1,i.PREPASS_NORMAL=!1,i.PREPASS_NORMAL_INDEX=-1,i.PREPASS_POSITION=!1,i.PREPASS_POSITION_INDEX=-1,i.PREPASS_VELOCITY=!1,i.PREPASS_VELOCITY_INDEX=-1,i.PREPASS_REFLECTIVITY=!1,i.PREPASS_REFLECTIVITY_INDEX=-1,i.SCENE_MRT_COUNT=0,i.NUM_BONE_INFLUENCERS=0,i.BonesPerMesh=0,i.BONETEXTURE=!1,i.BONES_VELOCITY_ENABLED=!1,i.NONUNIFORMSCALING=!1,i.MORPHTARGETS=!1,i.MORPHTARGETS_NORMAL=!1,i.MORPHTARGETS_TANGENT=!1,i.MORPHTARGETS_UV=!1,i.NUM_MORPH_INFLUENCERS=0,i.MORPHTARGETS_TEXTURE=!1,i.IMAGEPROCESSING=!1,i.VIGNETTE=!1,i.VIGNETTEBLENDMODEMULTIPLY=!1,i.VIGNETTEBLENDMODEOPAQUE=!1,i.TONEMAPPING=!1,i.TONEMAPPING_ACES=!1,i.CONTRAST=!1,i.COLORCURVES=!1,i.COLORGRADING=!1,i.COLORGRADING3D=!1,i.SAMPLER3DGREENDEPTH=!1,i.SAMPLER3DBGRMAP=!1,i.DITHER=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.EXPOSURE=!1,i.MULTIVIEW=!1,i.ORDER_INDEPENDENT_TRANSPARENCY=!1,i.ORDER_INDEPENDENT_TRANSPARENCY_16BITS=!1,i.USEPHYSICALLIGHTFALLOFF=!1,i.USEGLTFLIGHTFALLOFF=!1,i.TWOSIDEDLIGHTING=!1,i.SHADOWFLOAT=!1,i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.POINTSIZE=!1,i.FOG=!1,i.LOGARITHMICDEPTH=!1,i.FORCENORMALFORWARD=!1,i.SPECULARAA=!1,i.UNLIT=!1,i.DEBUGMODE=0,i.rebuild(),i}return V(t,e),t.prototype.reset=function(){e.prototype.reset.call(this),this.ALPHATESTVALUE=\"0.5\",this.PBR=!0,this.NORMALXYSCALE=!0},t}(Ei),ff=function(e){function t(i,n){var r=e.call(this,i,n)||this;return r._directIntensity=1,r._emissiveIntensity=1,r._environmentIntensity=1,r._specularIntensity=1,r._lightingInfos=new C(r._directIntensity,r._emissiveIntensity,r._environmentIntensity,r._specularIntensity),r._disableBumpMap=!1,r._albedoTexture=null,r._ambientTexture=null,r._ambientTextureStrength=1,r._ambientTextureImpactOnAnalyticalLights=t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS,r._opacityTexture=null,r._reflectionTexture=null,r._emissiveTexture=null,r._reflectivityTexture=null,r._metallicTexture=null,r._metallic=null,r._roughness=null,r._metallicF0Factor=1,r._metallicReflectanceColor=N.White(),r._useOnlyMetallicFromMetallicReflectanceTexture=!1,r._metallicReflectanceTexture=null,r._reflectanceTexture=null,r._microSurfaceTexture=null,r._bumpTexture=null,r._lightmapTexture=null,r._ambientColor=new N(0,0,0),r._albedoColor=new N(1,1,1),r._reflectivityColor=new N(1,1,1),r._reflectionColor=new N(1,1,1),r._emissiveColor=new N(0,0,0),r._microSurface=.9,r._useLightmapAsShadowmap=!1,r._useHorizonOcclusion=!0,r._useRadianceOcclusion=!0,r._useAlphaFromAlbedoTexture=!1,r._useSpecularOverAlpha=!0,r._useMicroSurfaceFromReflectivityMapAlpha=!1,r._useRoughnessFromMetallicTextureAlpha=!0,r._useRoughnessFromMetallicTextureGreen=!1,r._useMetallnessFromMetallicTextureBlue=!1,r._useAmbientOcclusionFromMetallicTextureRed=!1,r._useAmbientInGrayScale=!1,r._useAutoMicroSurfaceFromReflectivityMap=!1,r._lightFalloff=t.LIGHTFALLOFF_PHYSICAL,r._useRadianceOverAlpha=!0,r._useObjectSpaceNormalMap=!1,r._useParallax=!1,r._useParallaxOcclusion=!1,r._parallaxScaleBias=.05,r._disableLighting=!1,r._maxSimultaneousLights=4,r._invertNormalMapX=!1,r._invertNormalMapY=!1,r._twoSidedLighting=!1,r._alphaCutOff=.4,r._forceAlphaTest=!1,r._useAlphaFresnel=!1,r._useLinearAlphaFresnel=!1,r._environmentBRDFTexture=null,r._forceIrradianceInFragment=!1,r._realTimeFiltering=!1,r._realTimeFilteringQuality=a.TEXTURE_FILTERING_QUALITY_LOW,r._forceNormalForward=!1,r._enableSpecularAntiAliasing=!1,r._imageProcessingObserver=null,r._renderTargets=new yi(16),r._globalAmbientColor=new N(0,0,0),r._useLogarithmicDepth=!1,r._unlit=!1,r._debugMode=0,r.debugMode=0,r._debugLimit=-1,r._debugFactor=1,r._cacheHasRenderTargetTextures=!1,r.brdf=new ef(r),r.clearCoat=new nf(r),r.iridescence=new of(r),r.anisotropy=new sf(r),r.sheen=new cf(r),r.subSurface=new hf(r),r.detailMap=new zl(r),r._attachImageProcessingConfiguration(null),r.getRenderTargetTextures=function(){return r._renderTargets.reset(),Nl.ReflectionTextureEnabled&&r._reflectionTexture&&r._reflectionTexture.isRenderTarget&&r._renderTargets.push(r._reflectionTexture),r._eventInfo.renderTargets=r._renderTargets,r._callbackPluginEventFillRenderTargetTextures(r._eventInfo),r._renderTargets},r._environmentBRDFTexture=Zp(r.getScene()),r.prePassConfiguration=new Dl,r}return V(t,e),Object.defineProperty(t.prototype,\"realTimeFiltering\",{get:function(){return this._realTimeFiltering},set:function(e){this._realTimeFiltering=e,this.markAsDirty(a.MATERIAL_TextureDirtyFlag)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"realTimeFilteringQuality\",{get:function(){return this._realTimeFilteringQuality},set:function(e){this._realTimeFilteringQuality=e,this.markAsDirty(a.MATERIAL_TextureDirtyFlag)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"canRenderToMRT\",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype._attachImageProcessingConfiguration=function(e){var t=this;e!==this._imageProcessingConfiguration&&(this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),this._imageProcessingConfiguration=e||this.getScene().imageProcessingConfiguration,this._imageProcessingConfiguration&&(this._imageProcessingObserver=this._imageProcessingConfiguration.onUpdateParameters.add((function(){t._markAllSubMeshesAsImageProcessingDirty()}))))},Object.defineProperty(t.prototype,\"hasRenderTargetTextures\",{get:function(){return!!(Nl.ReflectionTextureEnabled&&this._reflectionTexture&&this._reflectionTexture.isRenderTarget)||this._cacheHasRenderTargetTextures},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"isPrePassCapable\",{get:function(){return!this.disableDepthWrite},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return\"PBRBaseMaterial\"},Object.defineProperty(t.prototype,\"useLogarithmicDepth\",{get:function(){return this._useLogarithmicDepth},set:function(e){this._useLogarithmicDepth=e&&this.getScene().getEngine().getCaps().fragmentDepthSupported},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"_disableAlphaBlending\",{get:function(){var e;return this._transparencyMode===t.PBRMATERIAL_OPAQUE||this._transparencyMode===t.PBRMATERIAL_ALPHATEST||(null===(e=this.subSurface)||void 0===e?void 0:e.disableAlphaBlending)},enumerable:!1,configurable:!0}),t.prototype.needAlphaBlending=function(){return!this._disableAlphaBlending&&(this.alpha<1||null!=this._opacityTexture||this._shouldUseAlphaFromAlbedoTexture())},t.prototype.needAlphaTesting=function(){var e;return!!this._forceAlphaTest||!(null===(e=this.subSurface)||void 0===e?void 0:e.disableAlphaBlending)&&this._hasAlphaChannel()&&(null==this._transparencyMode||this._transparencyMode===t.PBRMATERIAL_ALPHATEST)},t.prototype._shouldUseAlphaFromAlbedoTexture=function(){return null!=this._albedoTexture&&this._albedoTexture.hasAlpha&&this._useAlphaFromAlbedoTexture&&this._transparencyMode!==t.PBRMATERIAL_OPAQUE},t.prototype._hasAlphaChannel=function(){return null!=this._albedoTexture&&this._albedoTexture.hasAlpha||null!=this._opacityTexture},t.prototype.getAlphaTestTexture=function(){return this._albedoTexture},t.prototype.isReadyForSubMesh=function(e,t,i){if(this._uniformBufferLayoutBuilt||this.buildUniformLayout(),t.effect&&this.isFrozen&&t.effect._wasPreviouslyReady&&t.effect._wasPreviouslyUsingInstances===i)return!0;t.materialDefines||(this._callbackPluginEventGeneric(Ar.GetDefineNames,this._eventInfo),t.materialDefines=new pf(this._eventInfo.defineNames));var n=t.materialDefines;if(this._isReadyForSubMesh(t))return!0;var r=this.getScene(),o=r.getEngine();if(n._areTexturesDirty&&(this._eventInfo.hasRenderTargetTextures=!1,this._callbackPluginEventHasRenderTargetTextures(this._eventInfo),this._cacheHasRenderTargetTextures=this._eventInfo.hasRenderTargetTextures,r.texturesEnabled)){if(this._albedoTexture&&Nl.DiffuseTextureEnabled&&!this._albedoTexture.isReadyOrNotBlocking())return!1;if(this._ambientTexture&&Nl.AmbientTextureEnabled&&!this._ambientTexture.isReadyOrNotBlocking())return!1;if(this._opacityTexture&&Nl.OpacityTextureEnabled&&!this._opacityTexture.isReadyOrNotBlocking())return!1;var a=this._getReflectionTexture();if(a&&Nl.ReflectionTextureEnabled){if(!a.isReadyOrNotBlocking())return!1;if(a.irradianceTexture&&!a.irradianceTexture.isReadyOrNotBlocking())return!1}if(this._lightmapTexture&&Nl.LightmapTextureEnabled&&!this._lightmapTexture.isReadyOrNotBlocking())return!1;if(this._emissiveTexture&&Nl.EmissiveTextureEnabled&&!this._emissiveTexture.isReadyOrNotBlocking())return!1;if(Nl.SpecularTextureEnabled){if(this._metallicTexture){if(!this._metallicTexture.isReadyOrNotBlocking())return!1}else if(this._reflectivityTexture&&!this._reflectivityTexture.isReadyOrNotBlocking())return!1;if(this._metallicReflectanceTexture&&!this._metallicReflectanceTexture.isReadyOrNotBlocking())return!1;if(this._reflectanceTexture&&!this._reflectanceTexture.isReadyOrNotBlocking())return!1;if(this._microSurfaceTexture&&!this._microSurfaceTexture.isReadyOrNotBlocking())return!1}if(o.getCaps().standardDerivatives&&this._bumpTexture&&Nl.BumpTextureEnabled&&!this._disableBumpMap&&!this._bumpTexture.isReady())return!1;if(this._environmentBRDFTexture&&Nl.ReflectionTextureEnabled&&!this._environmentBRDFTexture.isReady())return!1}if(this._eventInfo.isReadyForSubMesh=!0,this._eventInfo.defines=n,this._callbackPluginEventIsReadyForSubMesh(this._eventInfo),!this._eventInfo.isReadyForSubMesh)return!1;if(n._areImageProcessingDirty&&this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.isReady())return!1;o.getCaps().standardDerivatives||e.isVerticesDataPresent(wi.NormalKind)||(e.createNormals(!0),Q.Warn(\"PBRMaterial: Normals have been created for the mesh: \"+e.name));var s=t.effect,l=n._areLightsDisposed,c=this._prepareEffect(e,n,this.onCompiled,this.onError,i,null,t.getRenderingMesh().hasThinInstances);if(c)if(this._onEffectCreatedObservable&&(df.effect=c,df.subMesh=t,this._onEffectCreatedObservable.notifyObservers(df)),this.allowShaderHotSwapping&&s&&!c.isReady()){if(c=s,n.markAsUnprocessed(),l)return n._areLightsDisposed=!0,!1}else r.resetCachedMaterial(),t.setEffect(c,n,this._materialContext);return!(!t.effect||!t.effect.isReady()||(n._renderId=r.getRenderId(),t.effect._wasPreviouslyReady=!0,t.effect._wasPreviouslyUsingInstances=!!i,r.performancePriority!==Zi.BackwardCompatible&&(this.checkReadyOnlyOnce=!0),0))},t.prototype.isMetallicWorkflow=function(){return!(null==this._metallic&&null==this._roughness&&!this._metallicTexture)},t.prototype._prepareEffect=function(e,t,i,n,r,o,s){if(void 0===i&&(i=null),void 0===n&&(n=null),void 0===r&&(r=null),void 0===o&&(o=null),this._prepareDefines(e,t,r,o,s),!t.isDirty)return null;t.markAsProcessed();var l=this.getScene().getEngine(),c=new ua,u=0;t.USESPHERICALINVERTEX&&c.addFallback(u++,\"USESPHERICALINVERTEX\"),t.FOG&&c.addFallback(u,\"FOG\"),t.SPECULARAA&&c.addFallback(u,\"SPECULARAA\"),t.POINTSIZE&&c.addFallback(u,\"POINTSIZE\"),t.LOGARITHMICDEPTH&&c.addFallback(u,\"LOGARITHMICDEPTH\"),t.PARALLAX&&c.addFallback(u,\"PARALLAX\"),t.PARALLAXOCCLUSION&&c.addFallback(u++,\"PARALLAXOCCLUSION\"),t.ENVIRONMENTBRDF&&c.addFallback(u++,\"ENVIRONMENTBRDF\"),t.TANGENT&&c.addFallback(u++,\"TANGENT\"),t.BUMP&&c.addFallback(u++,\"BUMP\"),u=Pr.HandleFallbacksForShadows(t,c,this._maxSimultaneousLights,u++),t.SPECULARTERM&&c.addFallback(u++,\"SPECULARTERM\"),t.USESPHERICALFROMREFLECTIONMAP&&c.addFallback(u++,\"USESPHERICALFROMREFLECTIONMAP\"),t.USEIRRADIANCEMAP&&c.addFallback(u++,\"USEIRRADIANCEMAP\"),t.LIGHTMAP&&c.addFallback(u++,\"LIGHTMAP\"),t.NORMAL&&c.addFallback(u++,\"NORMAL\"),t.AMBIENT&&c.addFallback(u++,\"AMBIENT\"),t.EMISSIVE&&c.addFallback(u++,\"EMISSIVE\"),t.VERTEXCOLOR&&c.addFallback(u++,\"VERTEXCOLOR\"),t.MORPHTARGETS&&c.addFallback(u++,\"MORPHTARGETS\"),t.MULTIVIEW&&c.addFallback(0,\"MULTIVIEW\");var h=[wi.PositionKind];t.NORMAL&&h.push(wi.NormalKind),t.TANGENT&&h.push(wi.TangentKind);for(var d=1;d<=a.MAX_SUPPORTED_UV_SETS;++d)t[\"UV\"+d]&&h.push(\"uv\".concat(1===d?\"\":d));t.VERTEXCOLOR&&h.push(wi.ColorKind),t.INSTANCESCOLOR&&h.push(wi.ColorInstanceKind),Pr.PrepareAttributesForBones(h,e,t,c),Pr.PrepareAttributesForInstances(h,t),Pr.PrepareAttributesForMorphTargets(h,e,t),Pr.PrepareAttributesForBakedVertexAnimation(h,e,t);var p=\"pbr\",f=[\"world\",\"view\",\"viewProjection\",\"vEyePosition\",\"vLightsType\",\"vAmbientColor\",\"vAlbedoColor\",\"vReflectivityColor\",\"vMetallicReflectanceFactors\",\"vEmissiveColor\",\"visibility\",\"vReflectionColor\",\"vFogInfos\",\"vFogColor\",\"pointSize\",\"vAlbedoInfos\",\"vAmbientInfos\",\"vOpacityInfos\",\"vReflectionInfos\",\"vReflectionPosition\",\"vReflectionSize\",\"vEmissiveInfos\",\"vReflectivityInfos\",\"vReflectionFilteringInfo\",\"vMetallicReflectanceInfos\",\"vReflectanceInfos\",\"vMicroSurfaceSamplerInfos\",\"vBumpInfos\",\"vLightmapInfos\",\"mBones\",\"vClipPlane\",\"vClipPlane2\",\"vClipPlane3\",\"vClipPlane4\",\"vClipPlane5\",\"vClipPlane6\",\"albedoMatrix\",\"ambientMatrix\",\"opacityMatrix\",\"reflectionMatrix\",\"emissiveMatrix\",\"reflectivityMatrix\",\"normalMatrix\",\"microSurfaceSamplerMatrix\",\"bumpMatrix\",\"lightmapMatrix\",\"metallicReflectanceMatrix\",\"reflectanceMatrix\",\"vLightingIntensity\",\"logarithmicDepthConstant\",\"vSphericalX\",\"vSphericalY\",\"vSphericalZ\",\"vSphericalXX_ZZ\",\"vSphericalYY_ZZ\",\"vSphericalZZ\",\"vSphericalXY\",\"vSphericalYZ\",\"vSphericalZX\",\"vSphericalL00\",\"vSphericalL1_1\",\"vSphericalL10\",\"vSphericalL11\",\"vSphericalL2_2\",\"vSphericalL2_1\",\"vSphericalL20\",\"vSphericalL21\",\"vSphericalL22\",\"vReflectionMicrosurfaceInfos\",\"vTangentSpaceParams\",\"boneTextureWidth\",\"vDebugMode\",\"morphTargetTextureInfo\",\"morphTargetTextureIndices\"],_=[\"albedoSampler\",\"reflectivitySampler\",\"ambientSampler\",\"emissiveSampler\",\"bumpSampler\",\"lightmapSampler\",\"opacitySampler\",\"reflectionSampler\",\"reflectionSamplerLow\",\"reflectionSamplerHigh\",\"irradianceSampler\",\"microSurfaceSampler\",\"environmentBrdfSampler\",\"boneSampler\",\"metallicReflectanceSampler\",\"reflectanceSampler\",\"morphTargets\",\"oitDepthSampler\",\"oitFrontColorSampler\"],m=[\"Material\",\"Scene\",\"Mesh\"];this._eventInfo.fallbacks=c,this._eventInfo.fallbackRank=u,this._eventInfo.defines=t,this._eventInfo.uniforms=f,this._eventInfo.attributes=h,this._eventInfo.samplers=_,this._eventInfo.uniformBuffersNames=m,this._eventInfo.customCode=void 0,this._eventInfo.mesh=e,this._callbackPluginEventGeneric(Ar.PrepareEffect,this._eventInfo),Dl.AddUniforms(f),Dl.AddSamplers(_),Ri&&(Ri.PrepareUniforms(f,t),Ri.PrepareSamplers(_,t)),Pr.PrepareUniformsAndSamplersList({uniformsNames:f,uniformBuffersNames:m,samplers:_,defines:t,maxSimultaneousLights:this._maxSimultaneousLights});var g={};this.customShaderNameResolve&&(p=this.customShaderNameResolve(p,f,m,_,t,h,g));var v=t.toString();return l.createEffect(p,{attributes:h,uniformsNames:f,uniformBuffersNames:m,samplers:_,defines:v,fallbacks:c,onCompiled:i,onError:n,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights,maxSimultaneousMorphTargets:t.NUM_MORPH_INFLUENCERS},processFinalCode:g.processFinalCode,processCodeAfterIncludes:this._eventInfo.customCode,multiTarget:t.PREPASS},l)},t.prototype._prepareDefines=function(e,i,n,r,o){var s;void 0===n&&(n=null),void 0===r&&(r=null),void 0===o&&(o=!1);var l=this.getScene(),c=l.getEngine();Pr.PrepareDefinesForLights(l,e,i,!0,this._maxSimultaneousLights,this._disableLighting),i._needNormals=!0,Pr.PrepareDefinesForMultiview(l,i);var u=this.needAlphaBlendingForMesh(e)&&this.getScene().useOrderIndependentTransparency;if(Pr.PrepareDefinesForPrePass(l,i,this.canRenderToMRT&&!u),Pr.PrepareDefinesForOIT(l,i,u),i.METALLICWORKFLOW=this.isMetallicWorkflow(),i._areTexturesDirty){if(i._needUVs=!1,l.texturesEnabled){i.ALBEDODIRECTUV=0,i.AMBIENTDIRECTUV=0,i.OPACITYDIRECTUV=0,i.EMISSIVEDIRECTUV=0,i.REFLECTIVITYDIRECTUV=0,i.MICROSURFACEMAPDIRECTUV=0,i.METALLIC_REFLECTANCEDIRECTUV=0,i.REFLECTANCEDIRECTUV=0,i.BUMPDIRECTUV=0,i.LIGHTMAPDIRECTUV=0,c.getCaps().textureLOD&&(i.LODBASEDMICROSFURACE=!0),this._albedoTexture&&Nl.DiffuseTextureEnabled?(Pr.PrepareDefinesForMergedUV(this._albedoTexture,i,\"ALBEDO\"),i.GAMMAALBEDO=this._albedoTexture.gammaSpace):i.ALBEDO=!1,this._ambientTexture&&Nl.AmbientTextureEnabled?(Pr.PrepareDefinesForMergedUV(this._ambientTexture,i,\"AMBIENT\"),i.AMBIENTINGRAYSCALE=this._useAmbientInGrayScale):i.AMBIENT=!1,this._opacityTexture&&Nl.OpacityTextureEnabled?(Pr.PrepareDefinesForMergedUV(this._opacityTexture,i,\"OPACITY\"),i.OPACITYRGB=this._opacityTexture.getAlphaFromRGB):i.OPACITY=!1;var h=this._getReflectionTexture();if(h&&Nl.ReflectionTextureEnabled){switch(i.REFLECTION=!0,i.GAMMAREFLECTION=h.gammaSpace,i.RGBDREFLECTION=h.isRGBD,i.LODINREFLECTIONALPHA=h.lodLevelInAlpha,i.LINEARSPECULARREFLECTION=h.linearSpecularLOD,this.realTimeFiltering&&this.realTimeFilteringQuality>0?(i.NUM_SAMPLES=\"\"+this.realTimeFilteringQuality,c._features.needTypeSuffixInShaderConstants&&(i.NUM_SAMPLES=i.NUM_SAMPLES+\"u\"),i.REALTIME_FILTERING=!0):i.REALTIME_FILTERING=!1,h.coordinatesMode===to.INVCUBIC_MODE&&(i.INVERTCUBICMAP=!0),i.REFLECTIONMAP_3D=h.isCube,i.REFLECTIONMAP_OPPOSITEZ=i.REFLECTIONMAP_3D&&this.getScene().useRightHandedSystem?!h.invertZ:h.invertZ,i.REFLECTIONMAP_CUBIC=!1,i.REFLECTIONMAP_EXPLICIT=!1,i.REFLECTIONMAP_PLANAR=!1,i.REFLECTIONMAP_PROJECTION=!1,i.REFLECTIONMAP_SKYBOX=!1,i.REFLECTIONMAP_SPHERICAL=!1,i.REFLECTIONMAP_EQUIRECTANGULAR=!1,i.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,i.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,h.coordinatesMode){case to.EXPLICIT_MODE:i.REFLECTIONMAP_EXPLICIT=!0;break;case to.PLANAR_MODE:i.REFLECTIONMAP_PLANAR=!0;break;case to.PROJECTION_MODE:i.REFLECTIONMAP_PROJECTION=!0;break;case to.SKYBOX_MODE:i.REFLECTIONMAP_SKYBOX=!0;break;case to.SPHERICAL_MODE:i.REFLECTIONMAP_SPHERICAL=!0;break;case to.EQUIRECTANGULAR_MODE:i.REFLECTIONMAP_EQUIRECTANGULAR=!0;break;case to.FIXED_EQUIRECTANGULAR_MODE:i.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!0;break;case to.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:i.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!0;break;case to.CUBIC_MODE:case to.INVCUBIC_MODE:default:i.REFLECTIONMAP_CUBIC=!0,i.USE_LOCAL_REFLECTIONMAP_CUBIC=!!h.boundingBoxSize}h.coordinatesMode!==to.SKYBOX_MODE&&(h.irradianceTexture?(i.USEIRRADIANCEMAP=!0,i.USESPHERICALFROMREFLECTIONMAP=!1):h.isCube&&(i.USESPHERICALFROMREFLECTIONMAP=!0,i.USEIRRADIANCEMAP=!1,this._forceIrradianceInFragment||this.realTimeFiltering||c.getCaps().maxVaryingVectors<=8?i.USESPHERICALINVERTEX=!1:i.USESPHERICALINVERTEX=!0))}else i.REFLECTION=!1,i.REFLECTIONMAP_3D=!1,i.REFLECTIONMAP_SPHERICAL=!1,i.REFLECTIONMAP_PLANAR=!1,i.REFLECTIONMAP_CUBIC=!1,i.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,i.REFLECTIONMAP_PROJECTION=!1,i.REFLECTIONMAP_SKYBOX=!1,i.REFLECTIONMAP_EXPLICIT=!1,i.REFLECTIONMAP_EQUIRECTANGULAR=!1,i.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,i.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,i.INVERTCUBICMAP=!1,i.USESPHERICALFROMREFLECTIONMAP=!1,i.USEIRRADIANCEMAP=!1,i.USESPHERICALINVERTEX=!1,i.REFLECTIONMAP_OPPOSITEZ=!1,i.LODINREFLECTIONALPHA=!1,i.GAMMAREFLECTION=!1,i.RGBDREFLECTION=!1,i.LINEARSPECULARREFLECTION=!1;if(this._lightmapTexture&&Nl.LightmapTextureEnabled?(Pr.PrepareDefinesForMergedUV(this._lightmapTexture,i,\"LIGHTMAP\"),i.USELIGHTMAPASSHADOWMAP=this._useLightmapAsShadowmap,i.GAMMALIGHTMAP=this._lightmapTexture.gammaSpace,i.RGBDLIGHTMAP=this._lightmapTexture.isRGBD):i.LIGHTMAP=!1,this._emissiveTexture&&Nl.EmissiveTextureEnabled?(Pr.PrepareDefinesForMergedUV(this._emissiveTexture,i,\"EMISSIVE\"),i.GAMMAEMISSIVE=this._emissiveTexture.gammaSpace):i.EMISSIVE=!1,Nl.SpecularTextureEnabled){if(this._metallicTexture?(Pr.PrepareDefinesForMergedUV(this._metallicTexture,i,\"REFLECTIVITY\"),i.ROUGHNESSSTOREINMETALMAPALPHA=this._useRoughnessFromMetallicTextureAlpha,i.ROUGHNESSSTOREINMETALMAPGREEN=!this._useRoughnessFromMetallicTextureAlpha&&this._useRoughnessFromMetallicTextureGreen,i.METALLNESSSTOREINMETALMAPBLUE=this._useMetallnessFromMetallicTextureBlue,i.AOSTOREINMETALMAPRED=this._useAmbientOcclusionFromMetallicTextureRed,i.REFLECTIVITY_GAMMA=!1):this._reflectivityTexture?(Pr.PrepareDefinesForMergedUV(this._reflectivityTexture,i,\"REFLECTIVITY\"),i.MICROSURFACEFROMREFLECTIVITYMAP=this._useMicroSurfaceFromReflectivityMapAlpha,i.MICROSURFACEAUTOMATIC=this._useAutoMicroSurfaceFromReflectivityMap,i.REFLECTIVITY_GAMMA=this._reflectivityTexture.gammaSpace):i.REFLECTIVITY=!1,this._metallicReflectanceTexture||this._reflectanceTexture){var d=null!==this._metallicReflectanceTexture&&this._metallicReflectanceTexture._texture===(null===(s=this._reflectanceTexture)||void 0===s?void 0:s._texture)&&this._metallicReflectanceTexture.checkTransformsAreIdentical(this._reflectanceTexture);i.METALLIC_REFLECTANCE_USE_ALPHA_ONLY=this._useOnlyMetallicFromMetallicReflectanceTexture&&!d,this._metallicReflectanceTexture?(Pr.PrepareDefinesForMergedUV(this._metallicReflectanceTexture,i,\"METALLIC_REFLECTANCE\"),i.METALLIC_REFLECTANCE_GAMMA=this._metallicReflectanceTexture.gammaSpace):i.METALLIC_REFLECTANCE=!1,this._reflectanceTexture&&!d&&(!this._metallicReflectanceTexture||this._metallicReflectanceTexture&&this._useOnlyMetallicFromMetallicReflectanceTexture)?(Pr.PrepareDefinesForMergedUV(this._reflectanceTexture,i,\"REFLECTANCE\"),i.REFLECTANCE_GAMMA=this._reflectanceTexture.gammaSpace):i.REFLECTANCE=!1}else i.METALLIC_REFLECTANCE=!1,i.REFLECTANCE=!1;this._microSurfaceTexture?Pr.PrepareDefinesForMergedUV(this._microSurfaceTexture,i,\"MICROSURFACEMAP\"):i.MICROSURFACEMAP=!1}else i.REFLECTIVITY=!1,i.MICROSURFACEMAP=!1;c.getCaps().standardDerivatives&&this._bumpTexture&&Nl.BumpTextureEnabled&&!this._disableBumpMap?(Pr.PrepareDefinesForMergedUV(this._bumpTexture,i,\"BUMP\"),this._useParallax&&this._albedoTexture&&Nl.DiffuseTextureEnabled?(i.PARALLAX=!0,i.PARALLAXOCCLUSION=!!this._useParallaxOcclusion):i.PARALLAX=!1,i.OBJECTSPACE_NORMALMAP=this._useObjectSpaceNormalMap):(i.BUMP=!1,i.PARALLAX=!1,i.PARALLAXOCCLUSION=!1,i.PARALLAOBJECTSPACE_NORMALMAP=!1),this._environmentBRDFTexture&&Nl.ReflectionTextureEnabled?(i.ENVIRONMENTBRDF=!0,i.ENVIRONMENTBRDF_RGBD=this._environmentBRDFTexture.isRGBD):(i.ENVIRONMENTBRDF=!1,i.ENVIRONMENTBRDF_RGBD=!1),this._shouldUseAlphaFromAlbedoTexture()?i.ALPHAFROMALBEDO=!0:i.ALPHAFROMALBEDO=!1}i.SPECULAROVERALPHA=this._useSpecularOverAlpha,this._lightFalloff===t.LIGHTFALLOFF_STANDARD?(i.USEPHYSICALLIGHTFALLOFF=!1,i.USEGLTFLIGHTFALLOFF=!1):this._lightFalloff===t.LIGHTFALLOFF_GLTF?(i.USEPHYSICALLIGHTFALLOFF=!1,i.USEGLTFLIGHTFALLOFF=!0):(i.USEPHYSICALLIGHTFALLOFF=!0,i.USEGLTFLIGHTFALLOFF=!1),i.RADIANCEOVERALPHA=this._useRadianceOverAlpha,!this.backFaceCulling&&this._twoSidedLighting?i.TWOSIDEDLIGHTING=!0:i.TWOSIDEDLIGHTING=!1,i.SPECULARAA=c.getCaps().standardDerivatives&&this._enableSpecularAntiAliasing}(i._areTexturesDirty||i._areMiscDirty)&&(i.ALPHATESTVALUE=\"\".concat(this._alphaCutOff).concat(this._alphaCutOff%1==0?\".\":\"\"),i.PREMULTIPLYALPHA=this.alphaMode===a.ALPHA_PREMULTIPLIED||this.alphaMode===a.ALPHA_PREMULTIPLIED_PORTERDUFF,i.ALPHABLEND=this.needAlphaBlendingForMesh(e),i.ALPHAFRESNEL=this._useAlphaFresnel||this._useLinearAlphaFresnel,i.LINEARALPHAFRESNEL=this._useLinearAlphaFresnel),i._areImageProcessingDirty&&this._imageProcessingConfiguration&&this._imageProcessingConfiguration.prepareDefines(i),i.FORCENORMALFORWARD=this._forceNormalForward,i.RADIANCEOCCLUSION=this._useRadianceOcclusion,i.HORIZONOCCLUSION=this._useHorizonOcclusion,i._areMiscDirty&&(Pr.PrepareDefinesForMisc(e,l,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e)||this._forceAlphaTest,i),i.UNLIT=this._unlit||(this.pointsCloud||this.wireframe)&&!e.isVerticesDataPresent(wi.NormalKind),i.DEBUGMODE=this._debugMode),Pr.PrepareDefinesForFrameBoundValues(l,c,i,!!n,r,o),this._eventInfo.defines=i,this._eventInfo.mesh=e,this._callbackPluginEventPrepareDefinesBeforeAttributes(this._eventInfo),Pr.PrepareDefinesForAttributes(e,i,!0,!0,!0,this._transparencyMode!==t.PBRMATERIAL_OPAQUE),this._callbackPluginEventPrepareDefines(this._eventInfo)},t.prototype.forceCompilation=function(e,t,i){var n=this,r=k({clipPlane:!1,useInstances:!1},i);this._uniformBufferLayoutBuilt||this.buildUniformLayout(),this._callbackPluginEventGeneric(Ar.GetDefineNames,this._eventInfo);var o=new pf(this._eventInfo.defineNames),a=this._prepareEffect(e,o,void 0,void 0,r.useInstances,r.clipPlane,e.hasThinInstances);this._onEffectCreatedObservable&&(df.effect=a,df.subMesh=null,this._onEffectCreatedObservable.notifyObservers(df)),a.isReady()?t&&t(this):a.onCompileObservable.add((function(){t&&t(n)}))},t.prototype.buildUniformLayout=function(){var t=this._uniformBuffer;t.addUniform(\"vAlbedoInfos\",2),t.addUniform(\"vAmbientInfos\",4),t.addUniform(\"vOpacityInfos\",2),t.addUniform(\"vEmissiveInfos\",2),t.addUniform(\"vLightmapInfos\",2),t.addUniform(\"vReflectivityInfos\",3),t.addUniform(\"vMicroSurfaceSamplerInfos\",2),t.addUniform(\"vReflectionInfos\",2),t.addUniform(\"vReflectionFilteringInfo\",2),t.addUniform(\"vReflectionPosition\",3),t.addUniform(\"vReflectionSize\",3),t.addUniform(\"vBumpInfos\",3),t.addUniform(\"albedoMatrix\",16),t.addUniform(\"ambientMatrix\",16),t.addUniform(\"opacityMatrix\",16),t.addUniform(\"emissiveMatrix\",16),t.addUniform(\"lightmapMatrix\",16),t.addUniform(\"reflectivityMatrix\",16),t.addUniform(\"microSurfaceSamplerMatrix\",16),t.addUniform(\"bumpMatrix\",16),t.addUniform(\"vTangentSpaceParams\",2),t.addUniform(\"reflectionMatrix\",16),t.addUniform(\"vReflectionColor\",3),t.addUniform(\"vAlbedoColor\",4),t.addUniform(\"vLightingIntensity\",4),t.addUniform(\"vReflectionMicrosurfaceInfos\",3),t.addUniform(\"pointSize\",1),t.addUniform(\"vReflectivityColor\",4),t.addUniform(\"vEmissiveColor\",3),t.addUniform(\"vAmbientColor\",3),t.addUniform(\"vDebugMode\",2),t.addUniform(\"vMetallicReflectanceFactors\",4),t.addUniform(\"vMetallicReflectanceInfos\",2),t.addUniform(\"metallicReflectanceMatrix\",16),t.addUniform(\"vReflectanceInfos\",2),t.addUniform(\"reflectanceMatrix\",16),t.addUniform(\"vSphericalL00\",3),t.addUniform(\"vSphericalL1_1\",3),t.addUniform(\"vSphericalL10\",3),t.addUniform(\"vSphericalL11\",3),t.addUniform(\"vSphericalL2_2\",3),t.addUniform(\"vSphericalL2_1\",3),t.addUniform(\"vSphericalL20\",3),t.addUniform(\"vSphericalL21\",3),t.addUniform(\"vSphericalL22\",3),t.addUniform(\"vSphericalX\",3),t.addUniform(\"vSphericalY\",3),t.addUniform(\"vSphericalZ\",3),t.addUniform(\"vSphericalXX_ZZ\",3),t.addUniform(\"vSphericalYY_ZZ\",3),t.addUniform(\"vSphericalZZ\",3),t.addUniform(\"vSphericalXY\",3),t.addUniform(\"vSphericalYZ\",3),t.addUniform(\"vSphericalZX\",3),e.prototype.buildUniformLayout.call(this)},t.prototype.bindForSubMesh=function(e,t,i){var n,r,o,a,s=this.getScene(),l=i.materialDefines;if(l){var c=i.effect;if(c){this._activeEffect=c,t.getMeshUniformBuffer().bindToEffect(c,\"Mesh\"),t.transferToEffect(e);var u=s.getEngine();this._uniformBuffer.bindToEffect(c,\"Material\"),this.prePassConfiguration.bindForSubMesh(this._activeEffect,s,t,e,this.isFrozen),this._eventInfo.subMesh=i,this._callbackPluginEventHardBindForSubMesh(this._eventInfo),l.OBJECTSPACE_NORMALMAP&&(e.toNormalMatrix(this._normalMatrix),this.bindOnlyNormalMatrix(this._normalMatrix));var d=this._mustRebind(s,c,t.visibility);Pr.BindBonesParameters(t,this._activeEffect,this.prePassConfiguration);var p=null,f=this._uniformBuffer;if(d){if(this.bindViewProjection(c),p=this._getReflectionTexture(),!f.useUbo||!this.isFrozen||!f.isSync){if(s.texturesEnabled){if(this._albedoTexture&&Nl.DiffuseTextureEnabled&&(f.updateFloat2(\"vAlbedoInfos\",this._albedoTexture.coordinatesIndex,this._albedoTexture.level),Pr.BindTextureMatrix(this._albedoTexture,f,\"albedo\")),this._ambientTexture&&Nl.AmbientTextureEnabled&&(f.updateFloat4(\"vAmbientInfos\",this._ambientTexture.coordinatesIndex,this._ambientTexture.level,this._ambientTextureStrength,this._ambientTextureImpactOnAnalyticalLights),Pr.BindTextureMatrix(this._ambientTexture,f,\"ambient\")),this._opacityTexture&&Nl.OpacityTextureEnabled&&(f.updateFloat2(\"vOpacityInfos\",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),Pr.BindTextureMatrix(this._opacityTexture,f,\"opacity\")),p&&Nl.ReflectionTextureEnabled){if(f.updateMatrix(\"reflectionMatrix\",p.getReflectionTextureMatrix()),f.updateFloat2(\"vReflectionInfos\",p.level,0),p.boundingBoxSize){var _=p;f.updateVector3(\"vReflectionPosition\",_.boundingBoxPosition),f.updateVector3(\"vReflectionSize\",_.boundingBoxSize)}if(this.realTimeFiltering){var m=p.getSize().width;f.updateFloat2(\"vReflectionFilteringInfo\",m,h.Log2(m))}if(!l.USEIRRADIANCEMAP){var g=p.sphericalPolynomial;if(l.USESPHERICALFROMREFLECTIONMAP&&g)if(l.SPHERICAL_HARMONICS){var v=g.preScaledHarmonics;f.updateVector3(\"vSphericalL00\",v.l00),f.updateVector3(\"vSphericalL1_1\",v.l1_1),f.updateVector3(\"vSphericalL10\",v.l10),f.updateVector3(\"vSphericalL11\",v.l11),f.updateVector3(\"vSphericalL2_2\",v.l2_2),f.updateVector3(\"vSphericalL2_1\",v.l2_1),f.updateVector3(\"vSphericalL20\",v.l20),f.updateVector3(\"vSphericalL21\",v.l21),f.updateVector3(\"vSphericalL22\",v.l22)}else f.updateFloat3(\"vSphericalX\",g.x.x,g.x.y,g.x.z),f.updateFloat3(\"vSphericalY\",g.y.x,g.y.y,g.y.z),f.updateFloat3(\"vSphericalZ\",g.z.x,g.z.y,g.z.z),f.updateFloat3(\"vSphericalXX_ZZ\",g.xx.x-g.zz.x,g.xx.y-g.zz.y,g.xx.z-g.zz.z),f.updateFloat3(\"vSphericalYY_ZZ\",g.yy.x-g.zz.x,g.yy.y-g.zz.y,g.yy.z-g.zz.z),f.updateFloat3(\"vSphericalZZ\",g.zz.x,g.zz.y,g.zz.z),f.updateFloat3(\"vSphericalXY\",g.xy.x,g.xy.y,g.xy.z),f.updateFloat3(\"vSphericalYZ\",g.yz.x,g.yz.y,g.yz.z),f.updateFloat3(\"vSphericalZX\",g.zx.x,g.zx.y,g.zx.z)}f.updateFloat3(\"vReflectionMicrosurfaceInfos\",p.getSize().width,p.lodGenerationScale,p.lodGenerationOffset)}this._emissiveTexture&&Nl.EmissiveTextureEnabled&&(f.updateFloat2(\"vEmissiveInfos\",this._emissiveTexture.coordinatesIndex,this._emissiveTexture.level),Pr.BindTextureMatrix(this._emissiveTexture,f,\"emissive\")),this._lightmapTexture&&Nl.LightmapTextureEnabled&&(f.updateFloat2(\"vLightmapInfos\",this._lightmapTexture.coordinatesIndex,this._lightmapTexture.level),Pr.BindTextureMatrix(this._lightmapTexture,f,\"lightmap\")),Nl.SpecularTextureEnabled&&(this._metallicTexture?(f.updateFloat3(\"vReflectivityInfos\",this._metallicTexture.coordinatesIndex,this._metallicTexture.level,this._ambientTextureStrength),Pr.BindTextureMatrix(this._metallicTexture,f,\"reflectivity\")):this._reflectivityTexture&&(f.updateFloat3(\"vReflectivityInfos\",this._reflectivityTexture.coordinatesIndex,this._reflectivityTexture.level,1),Pr.BindTextureMatrix(this._reflectivityTexture,f,\"reflectivity\")),this._metallicReflectanceTexture&&(f.updateFloat2(\"vMetallicReflectanceInfos\",this._metallicReflectanceTexture.coordinatesIndex,this._metallicReflectanceTexture.level),Pr.BindTextureMatrix(this._metallicReflectanceTexture,f,\"metallicReflectance\")),this._reflectanceTexture&&l.REFLECTANCE&&(f.updateFloat2(\"vReflectanceInfos\",this._reflectanceTexture.coordinatesIndex,this._reflectanceTexture.level),Pr.BindTextureMatrix(this._reflectanceTexture,f,\"reflectance\")),this._microSurfaceTexture&&(f.updateFloat2(\"vMicroSurfaceSamplerInfos\",this._microSurfaceTexture.coordinatesIndex,this._microSurfaceTexture.level),Pr.BindTextureMatrix(this._microSurfaceTexture,f,\"microSurfaceSampler\"))),this._bumpTexture&&u.getCaps().standardDerivatives&&Nl.BumpTextureEnabled&&!this._disableBumpMap&&(f.updateFloat3(\"vBumpInfos\",this._bumpTexture.coordinatesIndex,this._bumpTexture.level,this._parallaxScaleBias),Pr.BindTextureMatrix(this._bumpTexture,f,\"bump\"),s._mirroredCameraPosition?f.updateFloat2(\"vTangentSpaceParams\",this._invertNormalMapX?1:-1,this._invertNormalMapY?1:-1):f.updateFloat2(\"vTangentSpaceParams\",this._invertNormalMapX?-1:1,this._invertNormalMapY?-1:1))}if(this.pointsCloud&&f.updateFloat(\"pointSize\",this.pointSize),l.METALLICWORKFLOW){F.Color3[0].r=void 0===this._metallic||null===this._metallic?1:this._metallic,F.Color3[0].g=void 0===this._roughness||null===this._roughness?1:this._roughness,f.updateColor4(\"vReflectivityColor\",F.Color3[0],1);var y=null!==(r=null===(n=this.subSurface)||void 0===n?void 0:n._indexOfRefraction)&&void 0!==r?r:1.5,b=Math.pow((y-1)/(y+1),2);this._metallicReflectanceColor.scaleToRef(b*this._metallicF0Factor,F.Color3[0]);var T=this._metallicF0Factor;f.updateColor4(\"vMetallicReflectanceFactors\",F.Color3[0],T)}else f.updateColor4(\"vReflectivityColor\",this._reflectivityColor,this._microSurface);f.updateColor3(\"vEmissiveColor\",Nl.EmissiveTextureEnabled?this._emissiveColor:N.BlackReadOnly),f.updateColor3(\"vReflectionColor\",this._reflectionColor),!l.SS_REFRACTION&&(null===(o=this.subSurface)||void 0===o?void 0:o._linkRefractionWithTransparency)?f.updateColor4(\"vAlbedoColor\",this._albedoColor,1):f.updateColor4(\"vAlbedoColor\",this._albedoColor,this.alpha),this._lightingInfos.x=this._directIntensity,this._lightingInfos.y=this._emissiveIntensity,this._lightingInfos.z=this._environmentIntensity*s.environmentIntensity,this._lightingInfos.w=this._specularIntensity,f.updateVector4(\"vLightingIntensity\",this._lightingInfos),s.ambientColor.multiplyToRef(this._ambientColor,this._globalAmbientColor),f.updateColor3(\"vAmbientColor\",this._globalAmbientColor),f.updateFloat2(\"vDebugMode\",this._debugLimit,this._debugFactor)}s.texturesEnabled&&(this._albedoTexture&&Nl.DiffuseTextureEnabled&&f.setTexture(\"albedoSampler\",this._albedoTexture),this._ambientTexture&&Nl.AmbientTextureEnabled&&f.setTexture(\"ambientSampler\",this._ambientTexture),this._opacityTexture&&Nl.OpacityTextureEnabled&&f.setTexture(\"opacitySampler\",this._opacityTexture),p&&Nl.ReflectionTextureEnabled&&(l.LODBASEDMICROSFURACE?f.setTexture(\"reflectionSampler\",p):(f.setTexture(\"reflectionSampler\",p._lodTextureMid||p),f.setTexture(\"reflectionSamplerLow\",p._lodTextureLow||p),f.setTexture(\"reflectionSamplerHigh\",p._lodTextureHigh||p)),l.USEIRRADIANCEMAP&&f.setTexture(\"irradianceSampler\",p.irradianceTexture)),l.ENVIRONMENTBRDF&&f.setTexture(\"environmentBrdfSampler\",this._environmentBRDFTexture),this._emissiveTexture&&Nl.EmissiveTextureEnabled&&f.setTexture(\"emissiveSampler\",this._emissiveTexture),this._lightmapTexture&&Nl.LightmapTextureEnabled&&f.setTexture(\"lightmapSampler\",this._lightmapTexture),Nl.SpecularTextureEnabled&&(this._metallicTexture?f.setTexture(\"reflectivitySampler\",this._metallicTexture):this._reflectivityTexture&&f.setTexture(\"reflectivitySampler\",this._reflectivityTexture),this._metallicReflectanceTexture&&f.setTexture(\"metallicReflectanceSampler\",this._metallicReflectanceTexture),this._reflectanceTexture&&l.REFLECTANCE&&f.setTexture(\"reflectanceSampler\",this._reflectanceTexture),this._microSurfaceTexture&&f.setTexture(\"microSurfaceSampler\",this._microSurfaceTexture)),this._bumpTexture&&u.getCaps().standardDerivatives&&Nl.BumpTextureEnabled&&!this._disableBumpMap&&f.setTexture(\"bumpSampler\",this._bumpTexture)),this.getScene().useOrderIndependentTransparency&&this.needAlphaBlendingForMesh(t)&&this.getScene().depthPeelingRenderer.bind(c),this._eventInfo.subMesh=i,this._callbackPluginEventBindForSubMesh(this._eventInfo),Pr.BindClipPlane(this._activeEffect,s),this.bindEyePosition(c)}else s.getEngine()._features.needToAlwaysBindUniformBuffers&&(this._needToBindSceneUbo=!0);!d&&this.isFrozen||(s.lightsEnabled&&!this._disableLighting&&Pr.BindLights(s,t,this._activeEffect,l,this._maxSimultaneousLights),(s.fogEnabled&&t.applyFog&&s.fogMode!==mn.FOGMODE_NONE||p||t.receiveShadows||l.PREPASS)&&this.bindView(c),Pr.BindFogParameters(s,t,this._activeEffect,!0),l.NUM_MORPH_INFLUENCERS&&Pr.BindMorphTargetParameters(t,this._activeEffect),l.BAKED_VERTEX_ANIMATION_TEXTURE&&(null===(a=t.bakedVertexAnimationManager)||void 0===a||a.bind(c,l.INSTANCES)),this._imageProcessingConfiguration.bind(this._activeEffect),Pr.BindLogDepth(l,this._activeEffect,s)),this._afterBind(t,this._activeEffect),f.update()}}},t.prototype.getAnimatables=function(){var t=e.prototype.getAnimatables.call(this);return this._albedoTexture&&this._albedoTexture.animations&&this._albedoTexture.animations.length>0&&t.push(this._albedoTexture),this._ambientTexture&&this._ambientTexture.animations&&this._ambientTexture.animations.length>0&&t.push(this._ambientTexture),this._opacityTexture&&this._opacityTexture.animations&&this._opacityTexture.animations.length>0&&t.push(this._opacityTexture),this._reflectionTexture&&this._reflectionTexture.animations&&this._reflectionTexture.animations.length>0&&t.push(this._reflectionTexture),this._emissiveTexture&&this._emissiveTexture.animations&&this._emissiveTexture.animations.length>0&&t.push(this._emissiveTexture),this._metallicTexture&&this._metallicTexture.animations&&this._metallicTexture.animations.length>0?t.push(this._metallicTexture):this._reflectivityTexture&&this._reflectivityTexture.animations&&this._reflectivityTexture.animations.length>0&&t.push(this._reflectivityTexture),this._bumpTexture&&this._bumpTexture.animations&&this._bumpTexture.animations.length>0&&t.push(this._bumpTexture),this._lightmapTexture&&this._lightmapTexture.animations&&this._lightmapTexture.animations.length>0&&t.push(this._lightmapTexture),t},t.prototype._getReflectionTexture=function(){return this._reflectionTexture?this._reflectionTexture:this.getScene().environmentTexture},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._albedoTexture&&t.push(this._albedoTexture),this._ambientTexture&&t.push(this._ambientTexture),this._opacityTexture&&t.push(this._opacityTexture),this._reflectionTexture&&t.push(this._reflectionTexture),this._emissiveTexture&&t.push(this._emissiveTexture),this._reflectivityTexture&&t.push(this._reflectivityTexture),this._metallicTexture&&t.push(this._metallicTexture),this._metallicReflectanceTexture&&t.push(this._metallicReflectanceTexture),this._reflectanceTexture&&t.push(this._reflectanceTexture),this._microSurfaceTexture&&t.push(this._microSurfaceTexture),this._bumpTexture&&t.push(this._bumpTexture),this._lightmapTexture&&t.push(this._lightmapTexture),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||this._albedoTexture===t||this._ambientTexture===t||this._opacityTexture===t||this._reflectionTexture===t||this._reflectivityTexture===t||this._metallicTexture===t||this._metallicReflectanceTexture===t||this._reflectanceTexture===t||this._microSurfaceTexture===t||this._bumpTexture===t||this._lightmapTexture===t},t.prototype.setPrePassRenderer=function(){var e;if(null===(e=this.subSurface)||void 0===e?void 0:e.isScatteringEnabled){var t=this.getScene().enableSubSurfaceForPrePass();return t&&(t.enabled=!0),!0}return!1},t.prototype.dispose=function(t,i){var n,r,o,a,s,l,c,u,h,d,p,f;i&&(this._environmentBRDFTexture&&this.getScene().environmentBRDFTexture!==this._environmentBRDFTexture&&this._environmentBRDFTexture.dispose(),null===(n=this._albedoTexture)||void 0===n||n.dispose(),null===(r=this._ambientTexture)||void 0===r||r.dispose(),null===(o=this._opacityTexture)||void 0===o||o.dispose(),null===(a=this._reflectionTexture)||void 0===a||a.dispose(),null===(s=this._emissiveTexture)||void 0===s||s.dispose(),null===(l=this._metallicTexture)||void 0===l||l.dispose(),null===(c=this._reflectivityTexture)||void 0===c||c.dispose(),null===(u=this._bumpTexture)||void 0===u||u.dispose(),null===(h=this._lightmapTexture)||void 0===h||h.dispose(),null===(d=this._metallicReflectanceTexture)||void 0===d||d.dispose(),null===(p=this._reflectanceTexture)||void 0===p||p.dispose(),null===(f=this._microSurfaceTexture)||void 0===f||f.dispose()),this._renderTargets.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),e.prototype.dispose.call(this,t,i)},t.PBRMATERIAL_OPAQUE=Ir.MATERIAL_OPAQUE,t.PBRMATERIAL_ALPHATEST=Ir.MATERIAL_ALPHATEST,t.PBRMATERIAL_ALPHABLEND=Ir.MATERIAL_ALPHABLEND,t.PBRMATERIAL_ALPHATESTANDBLEND=Ir.MATERIAL_ALPHATESTANDBLEND,t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS=0,t.LIGHTFALLOFF_PHYSICAL=0,t.LIGHTFALLOFF_GLTF=1,t.LIGHTFALLOFF_STANDARD=2,G([Me()],t.prototype,\"_imageProcessingConfiguration\",void 0),G([ye(\"_markAllSubMeshesAsMiscDirty\")],t.prototype,\"debugMode\",void 0),G([be()],t.prototype,\"useLogarithmicDepth\",null),t}(Vo),_f=function(e){function t(i,n){var r=e.call(this,i,n)||this;return r.directIntensity=1,r.emissiveIntensity=1,r.environmentIntensity=1,r.specularIntensity=1,r.disableBumpMap=!1,r.ambientTextureStrength=1,r.ambientTextureImpactOnAnalyticalLights=t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS,r.metallicF0Factor=1,r.metallicReflectanceColor=N.White(),r.useOnlyMetallicFromMetallicReflectanceTexture=!1,r.ambientColor=new N(0,0,0),r.albedoColor=new N(1,1,1),r.reflectivityColor=new N(1,1,1),r.reflectionColor=new N(1,1,1),r.emissiveColor=new N(0,0,0),r.microSurface=1,r.useLightmapAsShadowmap=!1,r.useAlphaFromAlbedoTexture=!1,r.forceAlphaTest=!1,r.alphaCutOff=.4,r.useSpecularOverAlpha=!0,r.useMicroSurfaceFromReflectivityMapAlpha=!1,r.useRoughnessFromMetallicTextureAlpha=!0,r.useRoughnessFromMetallicTextureGreen=!1,r.useMetallnessFromMetallicTextureBlue=!1,r.useAmbientOcclusionFromMetallicTextureRed=!1,r.useAmbientInGrayScale=!1,r.useAutoMicroSurfaceFromReflectivityMap=!1,r.useRadianceOverAlpha=!0,r.useObjectSpaceNormalMap=!1,r.useParallax=!1,r.useParallaxOcclusion=!1,r.parallaxScaleBias=.05,r.disableLighting=!1,r.forceIrradianceInFragment=!1,r.maxSimultaneousLights=4,r.invertNormalMapX=!1,r.invertNormalMapY=!1,r.twoSidedLighting=!1,r.useAlphaFresnel=!1,r.useLinearAlphaFresnel=!1,r.environmentBRDFTexture=null,r.forceNormalForward=!1,r.enableSpecularAntiAliasing=!1,r.useHorizonOcclusion=!0,r.useRadianceOcclusion=!0,r.unlit=!1,r._environmentBRDFTexture=Zp(r.getScene()),r}return V(t,e),Object.defineProperty(t.prototype,\"refractionTexture\",{get:function(){return this.subSurface.refractionTexture},set:function(e){this.subSurface.refractionTexture=e,e?this.subSurface.isRefractionEnabled=!0:this.subSurface.linkRefractionWithTransparency||(this.subSurface.isRefractionEnabled=!1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"indexOfRefraction\",{get:function(){return this.subSurface.indexOfRefraction},set:function(e){this.subSurface.indexOfRefraction=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"invertRefractionY\",{get:function(){return this.subSurface.invertRefractionY},set:function(e){this.subSurface.invertRefractionY=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"linkRefractionWithTransparency\",{get:function(){return this.subSurface.linkRefractionWithTransparency},set:function(e){this.subSurface.linkRefractionWithTransparency=e,e&&(this.subSurface.isRefractionEnabled=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"usePhysicalLightFalloff\",{get:function(){return this._lightFalloff===ff.LIGHTFALLOFF_PHYSICAL},set:function(e){e!==this.usePhysicalLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),this._lightFalloff=e?ff.LIGHTFALLOFF_PHYSICAL:ff.LIGHTFALLOFF_STANDARD)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"useGLTFLightFalloff\",{get:function(){return this._lightFalloff===ff.LIGHTFALLOFF_GLTF},set:function(e){e!==this.useGLTFLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),this._lightFalloff=e?ff.LIGHTFALLOFF_GLTF:ff.LIGHTFALLOFF_STANDARD)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"imageProcessingConfiguration\",{get:function(){return this._imageProcessingConfiguration},set:function(e){this._attachImageProcessingConfiguration(e),this._markAllSubMeshesAsTexturesDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"cameraColorCurvesEnabled\",{get:function(){return this.imageProcessingConfiguration.colorCurvesEnabled},set:function(e){this.imageProcessingConfiguration.colorCurvesEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"cameraColorGradingEnabled\",{get:function(){return this.imageProcessingConfiguration.colorGradingEnabled},set:function(e){this.imageProcessingConfiguration.colorGradingEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"cameraToneMappingEnabled\",{get:function(){return this._imageProcessingConfiguration.toneMappingEnabled},set:function(e){this._imageProcessingConfiguration.toneMappingEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"cameraExposure\",{get:function(){return this._imageProcessingConfiguration.exposure},set:function(e){this._imageProcessingConfiguration.exposure=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"cameraContrast\",{get:function(){return this._imageProcessingConfiguration.contrast},set:function(e){this._imageProcessingConfiguration.contrast=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"cameraColorGradingTexture\",{get:function(){return this._imageProcessingConfiguration.colorGradingTexture},set:function(e){this._imageProcessingConfiguration.colorGradingTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"cameraColorCurves\",{get:function(){return this._imageProcessingConfiguration.colorCurves},set:function(e){this._imageProcessingConfiguration.colorCurves=e},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return\"PBRMaterial\"},t.prototype.clone=function(e){var i=this,n=Le.Clone((function(){return new t(e,i.getScene())}),this);return n.id=e,n.name=e,this.stencil.copyTo(n.stencil),this.clearCoat.copyTo(n.clearCoat),this.anisotropy.copyTo(n.anisotropy),this.brdf.copyTo(n.brdf),this.sheen.copyTo(n.sheen),this.subSurface.copyTo(n.subSurface),n},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.customType=\"BABYLON.PBRMaterial\",t.clearCoat=this.clearCoat.serialize(),t.anisotropy=this.anisotropy.serialize(),t.brdf=this.brdf.serialize(),t.sheen=this.sheen.serialize(),t.subSurface=this.subSurface.serialize(),t.iridescence=this.iridescence.serialize(),t},t.Parse=function(e,i,n){var r=Le.Parse((function(){return new t(e.name,i)}),e,i,n);return e.stencil&&r.stencil.parse(e.stencil,i,n),e.clearCoat&&r.clearCoat.parse(e.clearCoat,i,n),e.anisotropy&&r.anisotropy.parse(e.anisotropy,i,n),e.brdf&&r.brdf.parse(e.brdf,i,n),e.sheen&&r.sheen.parse(e.sheen,i,n),e.subSurface&&r.subSurface.parse(e.subSurface,i,n),e.iridescence&&r.iridescence.parse(e.iridescence,i,n),r},t.PBRMATERIAL_OPAQUE=ff.PBRMATERIAL_OPAQUE,t.PBRMATERIAL_ALPHATEST=ff.PBRMATERIAL_ALPHATEST,t.PBRMATERIAL_ALPHABLEND=ff.PBRMATERIAL_ALPHABLEND,t.PBRMATERIAL_ALPHATESTANDBLEND=ff.PBRMATERIAL_ALPHATESTANDBLEND,t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS=ff.DEFAULT_AO_ON_ANALYTICAL_LIGHTS,G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"directIntensity\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"emissiveIntensity\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"environmentIntensity\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"specularIntensity\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"disableBumpMap\",void 0),G([Te(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"albedoTexture\",void 0),G([Te(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"ambientTexture\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"ambientTextureStrength\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"ambientTextureImpactOnAnalyticalLights\",void 0),G([Te(),ye(\"_markAllSubMeshesAsTexturesAndMiscDirty\")],t.prototype,\"opacityTexture\",void 0),G([Te(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"reflectionTexture\",void 0),G([Te(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"emissiveTexture\",void 0),G([Te(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"reflectivityTexture\",void 0),G([Te(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"metallicTexture\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"metallic\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"roughness\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"metallicF0Factor\",void 0),G([Ee(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"metallicReflectanceColor\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useOnlyMetallicFromMetallicReflectanceTexture\",void 0),G([Te(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"metallicReflectanceTexture\",void 0),G([Te(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"reflectanceTexture\",void 0),G([Te(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"microSurfaceTexture\",void 0),G([Te(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"bumpTexture\",void 0),G([Te(),ye(\"_markAllSubMeshesAsTexturesDirty\",null)],t.prototype,\"lightmapTexture\",void 0),G([Ee(\"ambient\"),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"ambientColor\",void 0),G([Ee(\"albedo\"),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"albedoColor\",void 0),G([Ee(\"reflectivity\"),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"reflectivityColor\",void 0),G([Ee(\"reflection\"),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"reflectionColor\",void 0),G([Ee(\"emissive\"),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"emissiveColor\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"microSurface\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useLightmapAsShadowmap\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesAndMiscDirty\")],t.prototype,\"useAlphaFromAlbedoTexture\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesAndMiscDirty\")],t.prototype,\"forceAlphaTest\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesAndMiscDirty\")],t.prototype,\"alphaCutOff\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useSpecularOverAlpha\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useMicroSurfaceFromReflectivityMapAlpha\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useRoughnessFromMetallicTextureAlpha\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useRoughnessFromMetallicTextureGreen\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useMetallnessFromMetallicTextureBlue\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useAmbientOcclusionFromMetallicTextureRed\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useAmbientInGrayScale\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useAutoMicroSurfaceFromReflectivityMap\",void 0),G([be()],t.prototype,\"usePhysicalLightFalloff\",null),G([be()],t.prototype,\"useGLTFLightFalloff\",null),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useRadianceOverAlpha\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useObjectSpaceNormalMap\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useParallax\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useParallaxOcclusion\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"parallaxScaleBias\",void 0),G([be(),ye(\"_markAllSubMeshesAsLightsDirty\")],t.prototype,\"disableLighting\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"forceIrradianceInFragment\",void 0),G([be(),ye(\"_markAllSubMeshesAsLightsDirty\")],t.prototype,\"maxSimultaneousLights\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"invertNormalMapX\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"invertNormalMapY\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"twoSidedLighting\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useAlphaFresnel\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useLinearAlphaFresnel\",void 0),G([ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"environmentBRDFTexture\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"forceNormalForward\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"enableSpecularAntiAliasing\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useHorizonOcclusion\",void 0),G([be(),ye(\"_markAllSubMeshesAsTexturesDirty\")],t.prototype,\"useRadianceOcclusion\",void 0),G([be(),ye(\"_markAllSubMeshesAsMiscDirty\")],t.prototype,\"unlit\",void 0),t}(ff);b(\"BABYLON.PBRMaterial\",_f);var mf=131072,gf=131072;function vf(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}var yf=vf(\"DXT1\"),bf=vf(\"DXT3\"),Tf=vf(\"DXT5\"),Ef=vf(\"DX10\"),Sf=function(){function e(){}return e.GetDDSInfo=function(e){var t=new Int32Array(e.buffer,e.byteOffset,31),i=new Int32Array(e.buffer,e.byteOffset,35),n=1;t[2]&mf&&(n=Math.max(1,t[7]));var r=t[21],o=r===Ef?i[32]:0,s=a.TEXTURETYPE_UNSIGNED_INT;switch(r){case 113:s=a.TEXTURETYPE_HALF_FLOAT;break;case 116:s=a.TEXTURETYPE_FLOAT;break;case Ef:if(10===o){s=a.TEXTURETYPE_HALF_FLOAT;break}if(2===o){s=a.TEXTURETYPE_FLOAT;break}}return{width:t[4],height:t[3],mipmapCount:n,isFourCC:4==(4&t[20]),isRGB:64==(64&t[20]),isLuminance:(t[20]&gf)===gf,isCube:512==(512&t[28]),isCompressed:r===yf||r===bf||r===Tf,dxgiFormat:o,textureType:s}},e._GetHalfFloatAsFloatRGBAArrayBuffer=function(t,i,n,r,o,a){for(var s=new Float32Array(r),l=new Uint16Array(o,n),c=0,u=0;u>8)},e._GetRGBArrayBuffer=function(e,t,i,n,r,o,a,s){for(var l=new Uint8Array(n),c=new Uint8Array(r,i),u=0,h=0;h>8&255,R>>16&255,R>>24&255)))}var P=e._ExtractLongWordOrder(b[23]),M=e._ExtractLongWordOrder(b[24]),I=e._ExtractLongWordOrder(b[25]),O=e._ExtractLongWordOrder(b[26]);x&&(E=t._getRGBABufferInternalSizedFormat(r.textureType)),v=1,b[2]&mf&&!1!==o&&(v=Math.max(1,b[7]));for(var D=c||0,N=t.getCaps(),L=D;L0?r.sphericalPolynomial=Hu.ConvertCubeMapToSphericalPolynomial({size:b[4],right:h[0],left:h[1],up:h[2],down:h[3],front:h[4],back:h[5],format:a.TEXTUREFORMAT_RGBA,type:a.TEXTURETYPE_FLOAT,gammaSpace:!1}):r.sphericalPolynomial=void 0}else Q.Error(\"Compressed textures are not supported on this platform.\");else Q.Error(\"Unsupported format, must contain a FourCC, RGB or LUMINANCE code\");else Q.Error(\"Invalid magic number in DDS header\")},e.StoreLODInAlphaChannel=!1,e}();Yt.prototype.createPrefilteredCubeTexture=function(e,t,i,n,r,o,s,l,c){var u=this;return void 0===r&&(r=null),void 0===o&&(o=null),void 0===l&&(l=null),void 0===c&&(c=!0),this.createCubeTexture(e,t,null,!1,(function(e){if(e){var o=e.texture;if(c?e.info.sphericalPolynomial&&(o._sphericalPolynomial=e.info.sphericalPolynomial):o._sphericalPolynomial=new wu,o._source=Rt.CubePrefiltered,u.getCaps().textureLOD)r&&r(o);else{var s=u._gl,l=e.width;if(l){for(var d=[],p=0;p<3;p++){var f=1-p/2,_=n,m=h.Log2(l)*i+n,g=_+(m-_)*f,v=Math.round(Math.min(Math.max(g,0),m)),y=new wt(u,Rt.Temp);if(y.type=o.type,y.format=o.format,y.width=Math.pow(2,Math.max(h.Log2(l)-v,0)),y.height=y.width,y.isCube=!0,y._cachedWrapU=a.TEXTURE_CLAMP_ADDRESSMODE,y._cachedWrapV=a.TEXTURE_CLAMP_ADDRESSMODE,u._bindTextureDirectly(s.TEXTURE_CUBE_MAP,y,!0),y.samplingMode=a.TEXTURE_LINEAR_LINEAR,s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),e.isDDS){var b=e.info,T=e.data;u._unpackFlipY(b.isCompressed),Sf.UploadDDSLevels(u,y,T,b,!0,6,v)}else Q.Warn(\"DDS is the only prefiltered cube map supported so far.\");u._bindTextureDirectly(s.TEXTURE_CUBE_MAP,null);var E=new qr(t);E.isCube=!0,E._texture=y,y.isReady=!0,d.push(E)}o._lodTextureHigh=d[2],o._lodTextureMid=d[1],o._lodTextureLow=d[0],r&&r(o)}}}else r&&r(null)}),o,s,l,c,i,n)};var Af=function(){function e(){this.supportCascades=!0}return e.prototype.canLoad=function(e){return e.endsWith(\".dds\")},e.prototype.loadCubeData=function(e,t,i,n){var r,o=t.getEngine(),a=!1,s=1e3;if(Array.isArray(e))for(var l=0;l1)&&t.generateMipMaps,o._unpackFlipY(r.isCompressed),Sf.UploadDDSLevels(o,t,c,r,a,6,-1,l),r.isFourCC||1!==r.mipmapCount?s=r.mipmapCount-1:o.generateMipMapsForCubemap(t)}else c=e,r=Sf.GetDDSInfo(c),t.width=r.width,t.height=r.height,i&&(r.sphericalPolynomial=new wu),a=(r.isRGB||r.isLuminance||r.mipmapCount>1)&&t.generateMipMaps,o._unpackFlipY(r.isCompressed),Sf.UploadDDSLevels(o,t,c,r,a,6),r.isFourCC||1!==r.mipmapCount?s=r.mipmapCount-1:o.generateMipMapsForCubemap(t,!1);o._setCubeMapTextureParams(t,a,s),t.isReady=!0,t.onLoadedObservable.notifyObservers(t),t.onLoadedObservable.clear(),n&&n({isDDS:!0,width:t.width,info:r,data:e,texture:t})},e.prototype.loadData=function(e,t,i){var n=Sf.GetDDSInfo(e),r=(n.isRGB||n.isLuminance||n.mipmapCount>1)&&t.generateMipMaps&&n.width>>n.mipmapCount-1==1;i(n.width,n.height,r,n.isFourCC,(function(){Sf.UploadDDSLevels(t.getEngine(),t,e,n,r,1)}))},e}();vr._TextureLoaders.push(new Af);var Rf=function(){function e(){this.supportCascades=!1}return e.prototype.canLoad=function(e){return e.endsWith(\".env\")},e.prototype.loadCubeData=function(e,t,i,n,r){if(!Array.isArray(e)){var o=Yu(e);if(o){t.width=o.width,t.height=o.width;try{th(t,o),Ju(t,e,o).then((function(){t.isReady=!0,t.onLoadedObservable.notifyObservers(t),t.onLoadedObservable.clear(),n&&n()}),(function(e){null==r||r(\"Can not upload environment levels\",e)}))}catch(e){null==r||r(\"Can not upload environment file\",e)}}else r&&r(\"Can not parse the environment file\",null)}},e.prototype.loadData=function(){throw\".env not supported in 2d.\"},e}();vr._TextureLoaders.push(new Rf);var xf=function(){function e(t,i){if(this.data=t,this.isInvalid=!1,!e.IsValid(t))return this.isInvalid=!0,void Q.Error(\"texture missing KTX identifier\");var n=Uint32Array.BYTES_PER_ELEMENT,r=new DataView(this.data.buffer,this.data.byteOffset+12,13*n),o=67305985===r.getUint32(0,!0);this.glType=r.getUint32(1*n,o),this.glTypeSize=r.getUint32(2*n,o),this.glFormat=r.getUint32(3*n,o),this.glInternalFormat=r.getUint32(4*n,o),this.glBaseInternalFormat=r.getUint32(5*n,o),this.pixelWidth=r.getUint32(6*n,o),this.pixelHeight=r.getUint32(7*n,o),this.pixelDepth=r.getUint32(8*n,o),this.numberOfArrayElements=r.getUint32(9*n,o),this.numberOfFaces=r.getUint32(10*n,o),this.numberOfMipmapLevels=r.getUint32(11*n,o),this.bytesOfKeyValueData=r.getUint32(12*n,o),0===this.glType?(this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0!==this.pixelHeight&&0===this.pixelDepth?0===this.numberOfArrayElements?this.numberOfFaces===i?this.loadType=e.COMPRESSED_2D:Q.Error(\"number of faces expected\"+i+\", but found \"+this.numberOfFaces):Q.Error(\"texture arrays not currently supported\"):Q.Error(\"only 2D textures currently supported\")):Q.Error(\"only compressed formats currently supported\")}return e.prototype.uploadLevels=function(t,i){switch(this.loadType){case e.COMPRESSED_2D:this._upload2DCompressedLevels(t,i);case e.TEX_2D:case e.COMPRESSED_3D:case e.TEX_3D:}},e.prototype._upload2DCompressedLevels=function(t,i){for(var n=e.HEADER_LEN+this.bytesOfKeyValueData,r=this.pixelWidth,o=this.pixelHeight,a=i?this.numberOfMipmapLevels:1,s=0;s=12){var t=new Uint8Array(e.buffer,e.byteOffset,12);if(171===t[0]&&75===t[1]&&84===t[2]&&88===t[3]&&32===t[4]&&49===t[5]&&49===t[6]&&187===t[7]&&13===t[8]&&10===t[9]&&26===t[10]&&10===t[11])return!0}return!1},e.HEADER_LEN=64,e.COMPRESSED_2D=0,e.COMPRESSED_3D=1,e.TEX_2D=2,e.TEX_3D=3,e}(),Cf=function(){function e(e){this._pendingActions=new Array,this._workerInfos=e.map((function(e){return{workerPromise:Promise.resolve(e),idle:!0}}))}return e.prototype.dispose=function(){for(var e=0,t=this._workerInfos;e1,e.errors)throw new Error(\"KTX2 container - could not transcode the data. \"+e.errors);for(var n=0;n=12){var t=new Uint8Array(e.buffer,e.byteOffset,12);if(171===t[0]&&75===t[1]&&84===t[2]&&88===t[3]&&32===t[4]&&50===t[5]&&48===t[6]&&187===t[7]&&13===t[8]&&10===t[9]&&26===t[10]&&10===t[11])return!0}return!1},e.URLConfig={jsDecoderModule:\"https://preview.babylonjs.com/babylon.ktx2Decoder.js\",wasmUASTCToASTC:null,wasmUASTCToBC7:null,wasmUASTCToRGBA_UNORM:null,wasmUASTCToRGBA_SRGB:null,jsMSCTranscoder:null,wasmMSCTranscoder:null,wasmZSTDDecoder:null},e.DefaultNumWorkers=e.GetDefaultNumWorkers(),e}();function If(){var e;onmessage=function(t){if(t.data)switch(t.data.action){case\"init\":var i=t.data.urls;importScripts(i.jsDecoderModule),null!==i.wasmUASTCToASTC&&(KTX2DECODER.LiteTranscoder_UASTC_ASTC.WasmModuleURL=i.wasmUASTCToASTC),null!==i.wasmUASTCToBC7&&(KTX2DECODER.LiteTranscoder_UASTC_BC7.WasmModuleURL=i.wasmUASTCToBC7),null!==i.wasmUASTCToRGBA_UNORM&&(KTX2DECODER.LiteTranscoder_UASTC_RGBA_UNORM.WasmModuleURL=i.wasmUASTCToRGBA_UNORM),null!==i.wasmUASTCToRGBA_SRGB&&(KTX2DECODER.LiteTranscoder_UASTC_RGBA_SRGB.WasmModuleURL=i.wasmUASTCToRGBA_SRGB),null!==i.jsMSCTranscoder&&(KTX2DECODER.MSCTranscoder.JSModuleURL=i.jsMSCTranscoder),null!==i.wasmMSCTranscoder&&(KTX2DECODER.MSCTranscoder.WasmModuleURL=i.wasmMSCTranscoder),null!==i.wasmZSTDDecoder&&(KTX2DECODER.ZSTDDecoder.WasmModuleURL=i.wasmZSTDDecoder),e=new KTX2DECODER.KTX2Decoder,postMessage({action:\"init\"});break;case\"decode\":e.decode(t.data.data,t.data.caps,t.data.options).then((function(e){for(var t=[],i=0;i1&&t.generateMipMaps;r._unpackFlipY(!0),o.uploadLevels(t,t.generateMipMaps),t.width=o.pixelWidth,t.height=o.pixelHeight,r._setCubeMapTextureParams(t,a,o.numberOfMipmapLevels-1),t.isReady=!0,t.onLoadedObservable.notifyObservers(t),t.onLoadedObservable.clear(),n&&n()}},e.prototype.loadData=function(e,t,i,n){if(xf.IsValid(e)){t._invertVScale=!t.invertY;var r=new xf(e,1),o=function(e){switch(e){case a.TEXTUREFORMAT_COMPRESSED_SRGB_S3TC_DXT1_EXT:return a.TEXTUREFORMAT_COMPRESSED_RGB_S3TC_DXT1;case a.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:return a.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT3;case a.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:return a.TEXTUREFORMAT_COMPRESSED_RGBA_S3TC_DXT5;case a.TEXTUREFORMAT_COMPRESSED_SRGB8_ETC2:return a.TEXTUREFORMAT_COMPRESSED_RGB8_ETC2;case a.TEXTUREFORMAT_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:return a.TEXTUREFORMAT_COMPRESSED_RGBA8_ETC2_EAC;case a.TEXTUREFORMAT_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:return a.TEXTUREFORMAT_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;case a.TEXTUREFORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:return a.TEXTUREFORMAT_COMPRESSED_RGBA_ASTC_4x4;case a.TEXTUREFORMAT_COMPRESSED_SRGB_ALPHA_BPTC_UNORM:return a.TEXTUREFORMAT_COMPRESSED_RGBA_BPTC_UNORM}return null}(r.glInternalFormat);o?(t.format=o,t._useSRGBBuffer=t.getEngine()._getUseSRGBBuffer(!0,t.generateMipMaps),t._gammaSpace=!0):t.format=r.glInternalFormat,i(r.pixelWidth,r.pixelHeight,t.generateMipMaps,!0,(function(){r.uploadLevels(t,t.generateMipMaps)}),r.isInvalid)}else Mf.IsValid(e)?new Mf(t.getEngine()).uploadAsync(e,t,n).then((function(){i(t.width,t.height,t.generateMipMaps,!0,(function(){}),!1)}),(function(e){Q.Warn(\"Failed to load KTX2 texture data: \".concat(e.message)),i(0,0,!1,!1,(function(){}),!0)})):(Q.Error(\"texture missing KTX identifier\"),i(0,0,!1,!1,(function(){}),!0))},e}();vr._TextureLoaders.unshift(new Of);var Df=function(e){function t(t,i,n){var r=e.call(this,t,x.Zero(),i)||this;return r._xrSessionManager=n,r._firstFrame=!1,r._referenceQuaternion=P.Identity(),r._referencedPosition=new x,r._trackingState=Kl.NOT_TRACKING,r.onBeforeCameraTeleport=new u,r.onAfterCameraTeleport=new u,r.onTrackingStateChanged=new u,r.compensateOnFirstFrame=!0,r._rotate180=new P(0,1,0,0),r.minZ=.1,r.rotationQuaternion=new P,r.cameraRigMode=xr.RIG_MODE_CUSTOM,r.updateUpVectorFromRotation=!0,r._updateNumberOfRigCameras(1),r.freezeProjectionMatrix(),r._xrSessionManager.onXRSessionInit.add((function(){r._referencedPosition.copyFromFloats(0,0,0),r._referenceQuaternion.copyFromFloats(0,0,0,1),r._firstFrame=r.compensateOnFirstFrame})),r._xrSessionManager.onXRFrameObservable.add((function(){r._firstFrame&&r._updateFromXRSession(),r._updateReferenceSpace(),r._updateFromXRSession()}),void 0,!0),r}return V(t,e),Object.defineProperty(t.prototype,\"trackingState\",{get:function(){return this._trackingState},enumerable:!1,configurable:!0}),t.prototype._setTrackingState=function(e){this._trackingState!==e&&(this._trackingState=e,this.onTrackingStateChanged.notifyObservers(e))},Object.defineProperty(t.prototype,\"realWorldHeight\",{get:function(){var e=this._xrSessionManager.currentFrame&&this._xrSessionManager.currentFrame.getViewerPose(this._xrSessionManager.baseReferenceSpace);return e&&e.transform?e.transform.position.y:0},enumerable:!1,configurable:!0}),t.prototype._updateForDualEyeDebugging=function(){this._updateNumberOfRigCameras(2),this.rigCameras[0].viewport=new Rr(0,0,.5,1),this.rigCameras[0].outputRenderTarget=null,this.rigCameras[1].viewport=new Rr(.5,0,.5,1),this.rigCameras[1].outputRenderTarget=null},t.prototype.setTransformationFromNonVRCamera=function(e,t){void 0===e&&(e=this.getScene().activeCamera),void 0===t&&(t=!0),e&&e!==this&&(e.computeWorldMatrix().decompose(void 0,this.rotationQuaternion,this.position),this.position.y=0,P.FromEulerAnglesToRef(0,this.rotationQuaternion.toEulerAngles().y,0,this.rotationQuaternion),this._firstFrame=!0,t&&this._xrSessionManager.resetReferenceSpace())},t.prototype.getClassName=function(){return\"WebXRCamera\"},t.prototype.dispose=function(){e.prototype.dispose.call(this),this._lastXRViewerPose=void 0},t.prototype._updateFromXRSession=function(){var e=this,t=this._xrSessionManager.currentFrame&&this._xrSessionManager.currentFrame.getViewerPose(this._xrSessionManager.referenceSpace);if(this._lastXRViewerPose=t||void 0,t){var i=t.emulatedPosition?Kl.TRACKING_LOST:Kl.TRACKING;if(this._setTrackingState(i),this.minZ!==this._cache.minZ||this.maxZ!==this._cache.maxZ){var n={depthFar:this.maxZ||1e4,depthNear:this.minZ};this._xrSessionManager.updateRenderState(n),this._cache.minZ=this.minZ,this._cache.maxZ=this.maxZ}if(t.transform){var r=t.transform.orientation;if(void 0===t.transform.orientation.x)return;var o=t.transform.position;this._referencedPosition.set(o.x,o.y,o.z),this._referenceQuaternion.set(r.x,r.y,r.z,r.w),this._scene.useRightHandedSystem||(this._referencedPosition.z*=-1,this._referenceQuaternion.z*=-1,this._referenceQuaternion.w*=-1),this._firstFrame?(this._firstFrame=!1,this.position.y+=this._referencedPosition.y,this._referenceQuaternion.copyFromFloats(0,0,0,1)):(this.rotationQuaternion.copyFrom(this._referenceQuaternion),this.position.copyFrom(this._referencedPosition))}this.rigCameras.length!==t.views.length&&this._updateNumberOfRigCameras(t.views.length),t.views.forEach((function(t,i){var n,r=e.rigCameras[i];r.isLeftCamera||r.isRightCamera||(\"right\"===t.eye?r._isRightCamera=!0:\"left\"===t.eye&&(r._isLeftCamera=!0));var o=t.transform.position,a=t.transform.orientation;r.parent=e.parent,r.position.set(o.x,o.y,o.z),r.rotationQuaternion.set(a.x,a.y,a.z,a.w),e._scene.useRightHandedSystem?r.rotationQuaternion.multiplyInPlace(e._rotate180):(r.position.z*=-1,r.rotationQuaternion.z*=-1,r.rotationQuaternion.w*=-1),M.FromFloat32ArrayToRefScaled(t.projectionMatrix,0,1,r._projectionMatrix),e._scene.useRightHandedSystem||r._projectionMatrix.toggleProjectionMatrixHandInPlace(),0===i&&e._projectionMatrix.copyFrom(r._projectionMatrix);var s=e._xrSessionManager.getRenderTargetTextureForView(t);e._renderingMultiview=(null===(n=null==s?void 0:s._texture)||void 0===n?void 0:n.isMultiview)||!1,e._renderingMultiview?0==i&&(e._xrSessionManager.trySetViewportForView(e.viewport,t),e.outputRenderTarget=s):(e._xrSessionManager.trySetViewportForView(r.viewport,t),r.outputRenderTarget=s||e._xrSessionManager.getRenderTargetTextureForView(t))}))}else this._setTrackingState(Kl.NOT_TRACKING)},t.prototype._updateNumberOfRigCameras=function(e){for(void 0===e&&(e=1);this.rigCameras.lengthe;){var i=this.rigCameras.pop();i&&i.dispose()}},t.prototype._updateReferenceSpace=function(){if(!this.position.equals(this._referencedPosition)||!this.rotationQuaternion.equals(this._referenceQuaternion)){var e=O.Matrix[0],i=O.Matrix[1],n=O.Matrix[2];M.ComposeToRef(t._ScaleReadOnly,this._referenceQuaternion,this._referencedPosition,e),M.ComposeToRef(t._ScaleReadOnly,this.rotationQuaternion,this.position,i),e.invert().multiplyToRef(i,n),n.invert(),this._scene.useRightHandedSystem||n.toggleModelMatrixHandInPlace(),n.decompose(void 0,this._referenceQuaternion,this._referencedPosition);var r=new XRRigidTransform({x:this._referencedPosition.x,y:this._referencedPosition.y,z:this._referencedPosition.z},{x:this._referenceQuaternion.x,y:this._referenceQuaternion.y,z:this._referenceQuaternion.z,w:this._referenceQuaternion.w});this._xrSessionManager.referenceSpace=this._xrSessionManager.referenceSpace.getOffsetReferenceSpace(r)}},t._ScaleReadOnly=x.One(),t}(Ds),Nf=function(){function e(e){var t=this;this._scene=e,this._nonVRCamera=null,this._attachedToElement=!1,this._spectatorCamera=null,this._originalSceneAutoClear=!0,this._supported=!1,this._spectatorMode=!1,this._lastTimestamp=0,this.onInitialXRPoseSetObservable=new u,this.onStateChangedObservable=new u,this.state=Yl.NOT_IN_XR,this.sessionManager=new oc(e),this.camera=new Df(\"webxr\",e,this.sessionManager),this.featuresManager=new Co(this.sessionManager),e.onDisposeObservable.addOnce((function(){t.dispose()}))}return e.CreateAsync=function(t){var i=new e(t);return i.sessionManager.initializeAsync().then((function(){return i._supported=!0,i})).catch((function(e){throw i._setState(Yl.NOT_IN_XR),i.dispose(),e}))},e.prototype.dispose=function(){var e;this.exitXRAsync(),this.camera.dispose(),this.onStateChangedObservable.clear(),this.onInitialXRPoseSetObservable.clear(),this.sessionManager.dispose(),null===(e=this._spectatorCamera)||void 0===e||e.dispose(),this._nonVRCamera&&(this._scene.activeCamera=this._nonVRCamera)},e.prototype.enterXRAsync=function(e,t,i,n){var r,o,a;return void 0===i&&(i=this.sessionManager.getWebXRRenderTarget()),void 0===n&&(n={}),z(this,void 0,void 0,(function(){var s,l,c,u=this;return W(this,(function(h){switch(h.label){case 0:if(!this._supported)throw\"WebXR not supported in this browser or environment\";return this._setState(Yl.ENTERING_XR),\"viewer\"!==t&&\"local\"!==t&&(n.optionalFeatures=n.optionalFeatures||[],n.optionalFeatures.push(t)),[4,this.featuresManager._extendXRSessionInitObject(n)];case 1:n=h.sent(),\"immersive-ar\"===e&&\"unbounded\"!==t&&Q.Warn(\"We recommend using 'unbounded' reference space type when using 'immersive-ar' session mode\"),h.label=2;case 2:return h.trys.push([2,6,,7]),[4,this.sessionManager.initializeSessionAsync(e,n)];case 3:return h.sent(),[4,this.sessionManager.setReferenceSpaceTypeAsync(t)];case 4:return h.sent(),[4,i.initializeXRLayerAsync(this.sessionManager.session)];case 5:return s=h.sent(),l={depthFar:this.camera.maxZ||1e4,depthNear:this.camera.minZ},this.featuresManager.getEnabledFeature(xo.LAYERS)||(l.baseLayer=s),this.sessionManager.updateRenderState(l),this.sessionManager.runXRRenderLoop(),this._originalSceneAutoClear=this._scene.autoClear,this._nonVRCamera=this._scene.activeCamera,this._attachedToElement=!!(null===(o=null===(r=this._nonVRCamera)||void 0===r?void 0:r.inputs)||void 0===o?void 0:o.attachedToElement),null===(a=this._nonVRCamera)||void 0===a||a.detachControl(),this._scene.activeCamera=this.camera,\"immersive-ar\"!==e?this._nonXRToXRCamera():(this._scene.autoClear=!1,this.camera.compensateOnFirstFrame=!1,this.camera.position.set(0,0,0),this.camera.rotationQuaternion.set(0,0,0,1)),this.sessionManager.onXRSessionEnded.addOnce((function(){u.state!==Yl.EXITING_XR&&u._setState(Yl.EXITING_XR),u.camera.rigCameras.forEach((function(e){e.outputRenderTarget=null})),u._scene.autoClear=u._originalSceneAutoClear,u._scene.activeCamera=u._nonVRCamera,u._attachedToElement&&u._nonVRCamera&&u._nonVRCamera.attachControl(!!u._nonVRCamera.inputs.noPreventDefault),\"immersive-ar\"!==e&&u.camera.compensateOnFirstFrame&&(u._nonVRCamera.setPosition?u._nonVRCamera.setPosition(u.camera.position):u._nonVRCamera.position.copyFrom(u.camera.position)),u._setState(Yl.NOT_IN_XR)})),this.sessionManager.onXRFrameObservable.addOnce((function(){u._setState(Yl.IN_XR)})),[2,this.sessionManager];case 6:throw c=h.sent(),console.log(c),console.log(c.message),this._setState(Yl.NOT_IN_XR),c;case 7:return[2]}}))}))},e.prototype.exitXRAsync=function(){return this.state!==Yl.IN_XR?Promise.resolve():(this._setState(Yl.EXITING_XR),this.sessionManager.exitXRAsync())},e.prototype.enableSpectatorMode=function(e){this._spectatorMode||(this._spectatorMode=!0,this._switchSpectatorMode(e))},e.prototype.disableSpecatatorMode=function(){this._spectatorMode&&(this._spectatorMode=!1,this._switchSpectatorMode())},e.prototype._switchSpectatorMode=function(e){var t=this,i=1/((null==e?void 0:e.fps)?e.fps:1e3)*1e3,n=(null==e?void 0:e.preferredCameraIndex)?null==e?void 0:e.preferredCameraIndex:0,r=function(){t._spectatorCamera&&t.sessionManager.currentTimestamp-t._lastTimestamp>=i&&(t._lastTimestamp=t.sessionManager.currentTimestamp,t._spectatorCamera.position.copyFrom(t.camera.rigCameras[n].globalPosition),t._spectatorCamera.rotationQuaternion.copyFrom(t.camera.rigCameras[n].absoluteRotation))};if(this._spectatorMode){if(n>=this.camera.rigCameras.length)throw new Error(\"the preferred camera index is beyond the length of rig camera array.\");var o=function(){t.state===Yl.IN_XR?(t._spectatorCamera=new Js(\"webxr-spectator\",x.Zero(),t._scene),t._spectatorCamera.rotationQuaternion=new P,t._scene.activeCameras=[t.camera,t._spectatorCamera],t.sessionManager.onXRFrameObservable.add(r),t._scene.onAfterRenderCameraObservable.add((function(e){e===t.camera&&(t._scene.getEngine().framebufferDimensionsObject=null)}))):t.state===Yl.EXITING_XR&&(t.sessionManager.onXRFrameObservable.removeCallback(r),t._scene.activeCameras=null)};this.onStateChangedObservable.add(o),o()}else this.sessionManager.onXRFrameObservable.removeCallback(r),this._scene.activeCameras=[this.camera]},e.prototype._nonXRToXRCamera=function(){this.camera.setTransformationFromNonVRCamera(this._nonVRCamera),this.onInitialXRPoseSetObservable.notifyObservers(this.camera)},e.prototype._setState=function(e){this.state!==e&&(this.state=e,this.onStateChangedObservable.notifyObservers(this.state))},e}(),Lf=function(){function e(e,t,i,n){void 0===i&&(i=-1),void 0===n&&(n=[]),this.id=e,this.type=t,this._buttonIndex=i,this._axesIndices=n,this._axes={x:0,y:0},this._changes={},this._currentValue=0,this._hasChanges=!1,this._pressed=!1,this._touched=!1,this.onAxisValueChangedObservable=new u,this.onButtonStateChangedObservable=new u}return Object.defineProperty(e.prototype,\"axes\",{get:function(){return this._axes},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"changes\",{get:function(){return this._changes},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"hasChanges\",{get:function(){return this._hasChanges},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"pressed\",{get:function(){return this._pressed},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"touched\",{get:function(){return this._touched},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"value\",{get:function(){return this._currentValue},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){this.onAxisValueChangedObservable.clear(),this.onButtonStateChangedObservable.clear()},e.prototype.isAxes=function(){return 0!==this._axesIndices.length},e.prototype.isButton=function(){return-1!==this._buttonIndex},e.prototype.update=function(e){var t=!1,i=!1;if(this._hasChanges=!1,this._changes={},this.isButton()){var n=e.buttons[this._buttonIndex];if(!n)return;this._currentValue!==n.value&&(this.changes.value={current:n.value,previous:this._currentValue},t=!0,this._currentValue=n.value),this._touched!==n.touched&&(this.changes.touched={current:n.touched,previous:this._touched},t=!0,this._touched=n.touched),this._pressed!==n.pressed&&(this.changes.pressed={current:n.pressed,previous:this._pressed},t=!0,this._pressed=n.pressed)}this.isAxes()&&(this._axes.x!==e.axes[this._axesIndices[0]]&&(this.changes.axes={current:{x:e.axes[this._axesIndices[0]],y:this._axes.y},previous:{x:this._axes.x,y:this._axes.y}},this._axes.x=e.axes[this._axesIndices[0]],i=!0),this._axes.y!==e.axes[this._axesIndices[1]]&&(this.changes.axes?this.changes.axes.current.y=e.axes[this._axesIndices[1]]:this.changes.axes={current:{x:this._axes.x,y:e.axes[this._axesIndices[1]]},previous:{x:this._axes.x,y:this._axes.y}},this._axes.y=e.axes[this._axesIndices[1]],i=!0)),t&&(this._hasChanges=!0,this.onButtonStateChangedObservable.notifyObservers(this)),i&&(this._hasChanges=!0,this.onAxisValueChangedObservable.notifyObservers(this._axes))},e.BUTTON_TYPE=\"button\",e.SQUEEZE_TYPE=\"squeeze\",e.THUMBSTICK_TYPE=\"thumbstick\",e.TOUCHPAD_TYPE=\"touchpad\",e.TRIGGER_TYPE=\"trigger\",e}(),Ff=function(){function e(e,t,i,n,r,o){void 0===r&&(r=!1);var a=this;this.scene=e,this.layout=t,this.gamepadObject=i,this.handedness=n,this._doNotLoadControllerMesh=r,this._controllerCache=o,this._initComponent=function(e){if(e){var t=a.layout.components[e],i=t.type,n=t.gamepadIndices.button,r=[];void 0!==t.gamepadIndices.xAxis&&void 0!==t.gamepadIndices.yAxis&&r.push(t.gamepadIndices.xAxis,t.gamepadIndices.yAxis),a.components[e]=new Lf(e,i,n,r)}},this._modelReady=!1,this.components={},this.disableAnimation=!1,this.onModelLoadedObservable=new u,t.components&&Object.keys(t.components).forEach(this._initComponent)}return e.prototype.dispose=function(){var e=this;this.getComponentIds().forEach((function(t){return e.getComponent(t).dispose()})),this.rootMesh&&(this.rootMesh.getChildren(void 0,!0).forEach((function(e){e.setEnabled(!1)})),this.rootMesh.dispose(!!this._controllerCache,!this._controllerCache))},e.prototype.getAllComponentsOfType=function(e){var t=this;return this.getComponentIds().map((function(e){return t.components[e]})).filter((function(t){return t.type===e}))},e.prototype.getComponent=function(e){return this.components[e]},e.prototype.getComponentIds=function(){return Object.keys(this.components)},e.prototype.getComponentOfType=function(e){return this.getAllComponentsOfType(e)[0]||null},e.prototype.getMainComponent=function(){return this.getComponent(this.layout.selectComponentId)},e.prototype.loadModel=function(){return z(this,void 0,void 0,(function(){var e,t,i=this;return W(this,(function(n){return e=!this._getModelLoadingConstraints(),t=this._getGenericFilenameAndPath(),e?Q.Warn(\"Falling back to generic models\"):t=this._getFilenameAndPath(),[2,new Promise((function(n,r){var o=function(t){e?i._getGenericParentMesh(t):i._setRootMesh(t),i._processLoadedModel(t),i._modelReady=!0,i.onModelLoadedObservable.notifyObservers(i),n(!0)};if(i._controllerCache){var a=i._controllerCache.filter((function(e){return e.filename===t.filename&&e.path===t.path}));if(a[0])return a[0].meshes.forEach((function(e){return e.setEnabled(!0)})),void o(a[0].meshes)}Uo.ImportMesh(\"\",t.path,t.filename,i.scene,(function(e){i._controllerCache&&i._controllerCache.push(k(k({},t),{meshes:e})),o(e)}),null,(function(e,n){Q.Log(n),Q.Warn(\"Failed to retrieve controller model of type \".concat(i.profileId,\" from the remote server: \").concat(t.path).concat(t.filename)),r(n)}))}))]}))}))},e.prototype.updateFromXRFrame=function(e){var t=this;this.getComponentIds().forEach((function(e){return t.getComponent(e).update(t.gamepadObject)})),this.updateModel(e)},Object.defineProperty(e.prototype,\"handness\",{get:function(){return this.handedness},enumerable:!1,configurable:!0}),e.prototype.pulse=function(e,t,i){return void 0===i&&(i=0),this.gamepadObject.hapticActuators&&this.gamepadObject.hapticActuators[i]?this.gamepadObject.hapticActuators[i].pulse(e,t):Promise.resolve(!1)},e.prototype._getChildByName=function(e,t){return e.getChildren((function(e){return e.name===t}),!1)[0]},e.prototype._getImmediateChildByName=function(e,t){return e.getChildren((function(e){return e.name==t}),!0)[0]},e.prototype._lerpTransform=function(e,t,i){if(e.minMesh&&e.maxMesh&&e.valueMesh&&e.minMesh.rotationQuaternion&&e.maxMesh.rotationQuaternion&&e.valueMesh.rotationQuaternion){var n=i?.5*t+.5:t;P.SlerpToRef(e.minMesh.rotationQuaternion,e.maxMesh.rotationQuaternion,n,e.valueMesh.rotationQuaternion),x.LerpToRef(e.minMesh.position,e.maxMesh.position,n,e.valueMesh.position)}},e.prototype.updateModel=function(e){this._modelReady&&this._updateModel(e)},e.prototype._getGenericFilenameAndPath=function(){return{filename:\"generic.babylon\",path:\"https://controllers.babylonjs.com/generic/\"}},e.prototype._getGenericParentMesh=function(e){var t=this;this.rootMesh=new Ur(this.profileId+\" \"+this.handedness,this.scene),e.forEach((function(e){e.parent||(e.isPickable=!1,e.setParent(t.rootMesh))})),this.rootMesh.rotationQuaternion=P.FromEulerAngles(0,Math.PI,0)},e}(),wf=function(e){function t(i,n,r){var o=e.call(this,i,Bf[r],n,r)||this;return o.profileId=t.ProfileId,o}return V(t,e),t.prototype._getFilenameAndPath=function(){return{filename:\"generic.babylon\",path:\"https://controllers.babylonjs.com/generic/\"}},t.prototype._getModelLoadingConstraints=function(){return!0},t.prototype._processLoadedModel=function(e){},t.prototype._setRootMesh=function(e){var t=this;this.rootMesh=new Ur(this.profileId+\" \"+this.handedness,this.scene),e.forEach((function(e){e.isPickable=!1,e.parent||e.setParent(t.rootMesh)})),this.rootMesh.rotationQuaternion=P.FromEulerAngles(0,Math.PI,0)},t.prototype._updateModel=function(){},t.ProfileId=\"generic-trigger\",t}(Ff),Bf={left:{selectComponentId:\"xr-standard-trigger\",components:{\"xr-standard-trigger\":{type:\"trigger\",gamepadIndices:{button:0},rootNodeName:\"xr_standard_trigger\",visualResponses:{}}},gamepadMapping:\"xr-standard\",rootNodeName:\"generic-trigger-left\",assetPath:\"left.glb\"},right:{selectComponentId:\"xr-standard-trigger\",components:{\"xr-standard-trigger\":{type:\"trigger\",gamepadIndices:{button:0},rootNodeName:\"xr_standard_trigger\",visualResponses:{}}},gamepadMapping:\"xr-standard\",rootNodeName:\"generic-trigger-right\",assetPath:\"right.glb\"},none:{selectComponentId:\"xr-standard-trigger\",components:{\"xr-standard-trigger\":{type:\"trigger\",gamepadIndices:{button:0},rootNodeName:\"xr_standard_trigger\",visualResponses:{}}},gamepadMapping:\"xr-standard\",rootNodeName:\"generic-trigger-none\",assetPath:\"none.glb\"}},Uf=function(e){function t(t,i,n,r,o){var a=e.call(this,t,n.layouts[i.handedness||\"none\"],i.gamepad,i.handedness,void 0,o)||this;return a._repositoryUrl=r,a.controllerCache=o,a._buttonMeshMapping={},a._touchDots={},a.profileId=n.profileId,a}return V(t,e),t.prototype.dispose=function(){var t=this;e.prototype.dispose.call(this),this.controllerCache||Object.keys(this._touchDots).forEach((function(e){t._touchDots[e].dispose()}))},t.prototype._getFilenameAndPath=function(){return{filename:this.layout.assetPath,path:\"\".concat(this._repositoryUrl,\"/profiles/\").concat(this.profileId,\"/\")}},t.prototype._getModelLoadingConstraints=function(){var e=Uo.IsPluginForExtensionAvailable(\".glb\");return e||Q.Warn(\"glTF / glb loader was not registered, using generic controller instead\"),e},t.prototype._processLoadedModel=function(e){var t=this;this.getComponentIds().forEach((function(e){var i=t.layout.components[e];t._buttonMeshMapping[e]={mainMesh:t._getChildByName(t.rootMesh,i.rootNodeName),states:{}},Object.keys(i.visualResponses).forEach((function(n){var r=i.visualResponses[n];if(\"transform\"===r.valueNodeProperty)t._buttonMeshMapping[e].states[n]={valueMesh:t._getChildByName(t.rootMesh,r.valueNodeName),minMesh:t._getChildByName(t.rootMesh,r.minNodeName),maxMesh:t._getChildByName(t.rootMesh,r.maxNodeName)};else{var o=i.type===Lf.TOUCHPAD_TYPE&&i.touchPointNodeName?i.touchPointNodeName:r.valueNodeName;if(t._buttonMeshMapping[e].states[n]={valueMesh:t._getChildByName(t.rootMesh,o)},i.type===Lf.TOUCHPAD_TYPE&&!t._touchDots[n]){var a=jc(n+\"dot\",{diameter:.0015,segments:8},t.scene);a.material=new Xl(n+\"mat\",t.scene),a.material.diffuseColor=N.Red(),a.parent=t._buttonMeshMapping[e].states[n].valueMesh||null,a.isVisible=!1,t._touchDots[n]=a}}}))}))},t.prototype._setRootMesh=function(e){var t;this.rootMesh=new Ur(this.profileId+\"-\"+this.handedness,this.scene),this.rootMesh.isPickable=!1;for(var i=0;in/10&&(a.isVisible=!0),(s+=t._scene.getEngine().getDeltaTime())>=n)t._scene.simulatePointerDown(i.pick,c),l=!0,t._options.disablePointerUpOnTouchOut&&t._scene.simulatePointerUp(i.pick,c),a.isVisible=!1;else{var e=1-s/n;a.scaling.set(e,e,e)}else l=!1,s=0;t._scene.simulatePointerMove(i.pick,c),o=i.pick}})),void 0!==this._options.renderingGroupId&&(a.renderingGroupId=this._options.renderingGroupId),e&&e.onDisposeObservable.addOnce((function(){i.pick&&!t._options.disablePointerUpOnTouchOut&&l&&(t._scene.simulatePointerUp(i.pick,c),i.finalPointerUpTriggered=!0),a.dispose()}))},t.prototype._attachScreenRayMode=function(e){var t=this,i=this._controllers[e.uniqueId],n=!1,r={pointerId:i.id,pointerType:\"xr\"};i.onFrameObserver=this._xrSessionManager.onXRFrameObservable.add((function(){t._augmentPointerInit(r,i.id,i.screenCoordinates),!i.pick||t._options.disablePointerUpOnTouchOut&&n||(n?t._scene.simulatePointerMove(i.pick,r):(t._scene.simulatePointerDown(i.pick,r),i.pointerDownTriggered=!0,n=!0,t._options.disablePointerUpOnTouchOut&&t._scene.simulatePointerUp(i.pick,r)))})),e.onDisposeObservable.addOnce((function(){t._augmentPointerInit(r,i.id,i.screenCoordinates),t._xrSessionManager.runInXRFrame((function(){i.pick&&!i.finalPointerUpTriggered&&n&&!t._options.disablePointerUpOnTouchOut&&(t._scene.simulatePointerUp(i.pick,r),i.finalPointerUpTriggered=!0)}))}))},t.prototype._attachTrackedPointerRayMode=function(e){var t=this,i=this._controllers[e.uniqueId];if(this._options.forceGazeMode)return this._attachGazeMode(e);var n={pointerId:i.id,pointerType:\"xr\"};if(i.onFrameObserver=this._xrSessionManager.onXRFrameObservable.add((function(){i.laserPointer.material.disableLighting=t.disablePointerLighting,i.selectionMesh.material.disableLighting=t.disableSelectionMeshLighting,i.pick&&(t._augmentPointerInit(n,i.id,i.screenCoordinates),t._scene.simulatePointerMove(i.pick,n))})),e.inputSource.gamepad){var r=function(r){t._options.overrideButtonId&&(i.selectionComponent=r.getComponent(t._options.overrideButtonId)),i.selectionComponent||(i.selectionComponent=r.getMainComponent()),i.onButtonChangedObserver=i.selectionComponent.onButtonStateChangedObservable.add((function(r){if(r.changes.pressed){var o=r.changes.pressed.current;i.pick?(t._options.enablePointerSelectionOnAllControllers||e.uniqueId===t._attachedController)&&(t._augmentPointerInit(n,i.id,i.screenCoordinates),o?(t._scene.simulatePointerDown(i.pick,n),i.pointerDownTriggered=!0,i.selectionMesh.material.emissiveColor=t.selectionMeshPickedColor,i.laserPointer.material.emissiveColor=t.laserPointerPickedColor):(t._scene.simulatePointerUp(i.pick,n),i.selectionMesh.material.emissiveColor=t.selectionMeshDefaultColor,i.laserPointer.material.emissiveColor=t.laserPointerDefaultColor)):!o||t._options.enablePointerSelectionOnAllControllers||t._options.disableSwitchOnClick||(t._attachedController=e.uniqueId)}}))};e.motionController?r(e.motionController):e.onMotionControllerInitObservable.add(r)}else{var o=function(e){t._augmentPointerInit(n,i.id,i.screenCoordinates),i.xrController&&e.inputSource===i.xrController.inputSource&&i.pick&&(t._scene.simulatePointerDown(i.pick,n),i.pointerDownTriggered=!0,i.selectionMesh.material.emissiveColor=t.selectionMeshPickedColor,i.laserPointer.material.emissiveColor=t.laserPointerPickedColor)},a=function(e){t._augmentPointerInit(n,i.id,i.screenCoordinates),i.xrController&&e.inputSource===i.xrController.inputSource&&i.pick&&(t._scene.simulatePointerUp(i.pick,n),i.selectionMesh.material.emissiveColor=t.selectionMeshDefaultColor,i.laserPointer.material.emissiveColor=t.laserPointerDefaultColor)};i.eventListeners={selectend:a,selectstart:o},this._xrSessionManager.session.addEventListener(\"selectstart\",o),this._xrSessionManager.session.addEventListener(\"selectend\",a)}},t.prototype._convertNormalToDirectionOfRay=function(e,t){return e&&Math.acos(x.Dot(e,t.direction))n},t.prototype._updatePointerDistance=function(e,t){void 0===t&&(t=100),e.scaling.y=t,this._scene.useRightHandedSystem&&(t*=-1),e.position.z=t/2+.05},t.prototype._augmentPointerInit=function(e,t,i){e.pointerId=t,e.pointerType=\"xr\",i&&(e.screenX=i.x,e.screenY=i.y)},Object.defineProperty(t.prototype,\"lasterPointerDefaultColor\",{get:function(){return this.laserPointerDefaultColor},enumerable:!1,configurable:!0}),t._IdCounter=200,t.Name=xo.POINTER_SELECTION,t.Version=1,t}(Po);Co.AddWebXRFeature(jf.Name,(function(e,t){return function(){return new jf(e,t)}}),jf.Version,!0),hr.prototype._projectOnTrianglesToRef=function(e,t,i,n,r,o){for(var a=O.Vector3[0],s=O.Vector3[1],l=1/0,c=this.indexStart;ce.currentAnimationState)switch(e.currentAnimationState){case Gf.DEHYDRATED:if(e.hydrateCollisionMeshFunction(!0),t===Gf.HOVER)break;case Gf.HOVER:if(e.touchCollisionMeshFunction(!0),t===Gf.TOUCH)break}else switch(e.currentAnimationState){case Gf.TOUCH:if(e.touchCollisionMeshFunction(!1),t===Gf.HOVER)break;case Gf.HOVER:if(e.hydrateCollisionMeshFunction(!1),t===Gf.DEHYDRATED)break}e.currentAnimationState=t}},t.prototype._processTouchPoint=function(e,t,i){var n,r=this._controllers[e];r.grabRay.origin.copyFrom(t),i.toEulerAnglesToRef(O.Vector3[0]),r.grabRay.direction.copyFrom(O.Vector3[0]),this._options.nearInteractionControllerMode!==zf.CENTERED_IN_FRONT||(null===(n=r.xrController)||void 0===n?void 0:n.inputSource.hand)||(r.xrController.getWorldPointerRayToRef(this._tmpRay),r.grabRay.origin.addInPlace(this._tmpRay.direction.scale(.05))),r.grabRay.length=this._nearGrabLengthScale*this._hoverRadius,r.touchCollisionMesh.position.copyFrom(r.grabRay.origin)},t.prototype._onXRFrame=function(e){var t=this;Object.keys(this._controllers).forEach((function(i){var n,r=t._controllers[i],o=null===(n=r.xrController)||void 0===n?void 0:n.inputSource.hand;if((t._options.enableNearInteractionOnAllControllers||i===t._attachedController)&&r.xrController&&(o||t._options.nearInteractionControllerMode&&r.xrController.inputSource.gamepad)){if(r.hoverInteraction=!1,r.nearInteraction=!1,r.xrController){if(o){var a=o.get(\"index-finger-tip\");if(a){var s=e.getJointPose(a,t._xrSessionManager.referenceSpace);if(s&&s.transform){var l=t._scene.useRightHandedSystem?1:-1;O.Vector3[0].set(s.transform.position.x,s.transform.position.y,s.transform.position.z*l),O.Quaternion[0].set(s.transform.orientation.x,s.transform.orientation.y,s.transform.orientation.z*l,s.transform.orientation.w*l),t._processTouchPoint(i,O.Vector3[0],O.Quaternion[0])}}}else if(r.xrController.inputSource.gamepad&&t._options.nearInteractionControllerMode!==zf.DISABLED){var c=r.xrController.pointer;r.xrController.grip&&t._options.nearInteractionControllerMode===zf.CENTERED_ON_CONTROLLER&&(c=r.xrController.grip),t._processTouchPoint(i,c.position,c.rotationQuaternion)}var u=function(e,t){return t&&t.hit?e&&e.hit?t.distances&&(a=0,u.copyFrom(t.center)),-1!==a&&a=e.timeout&&(e.contextObservable.remove(r),e.onEnded&&e.onEnded(a))}),e.observableParameters.mask,e.observableParameters.insertFirst,e.observableParameters.scope);return r}!function(e){e[e.INIT=0]=\"INIT\",e[e.STARTED=1]=\"STARTED\",e[e.ENDED=2]=\"ENDED\"}(Kf||(Kf={}));var $f=function(){function e(e){var t,i,n=this;this.onEachCountObservable=new u,this.onTimerAbortedObservable=new u,this.onTimerEndedObservable=new u,this.onStateChangedObservable=new u,this._observer=null,this._breakOnNextTick=!1,this._tick=function(e){var t=Date.now();n._timer=t-n._startTime;var i={startTime:n._startTime,currentTime:t,deltaTime:n._timer,completeRate:n._timer/n._timeToEnd,payload:e},r=n._breakOnNextTick||n._breakCondition(i);r||n._timer>=n._timeToEnd?n._stop(i,r):n.onEachCountObservable.notifyObservers(i)},this._setState(Kf.INIT),this._contextObservable=e.contextObservable,this._observableParameters=null!==(t=e.observableParameters)&&void 0!==t?t:{},this._breakCondition=null!==(i=e.breakCondition)&&void 0!==i?i:function(){return!1},this._timeToEnd=e.timeout,e.onEnded&&this.onTimerEndedObservable.add(e.onEnded),e.onTick&&this.onEachCountObservable.add(e.onTick),e.onAborted&&this.onTimerAbortedObservable.add(e.onAborted)}return Object.defineProperty(e.prototype,\"breakCondition\",{set:function(e){this._breakCondition=e},enumerable:!1,configurable:!0}),e.prototype.clearObservables=function(){this.onEachCountObservable.clear(),this.onTimerAbortedObservable.clear(),this.onTimerEndedObservable.clear(),this.onStateChangedObservable.clear()},e.prototype.start=function(e){if(void 0===e&&(e=this._timeToEnd),this._state===Kf.STARTED)throw new Error(\"Timer already started. Please stop it before starting again\");this._timeToEnd=e,this._startTime=Date.now(),this._timer=0,this._observer=this._contextObservable.add(this._tick,this._observableParameters.mask,this._observableParameters.insertFirst,this._observableParameters.scope),this._setState(Kf.STARTED)},e.prototype.stop=function(){this._state===Kf.STARTED&&(this._breakOnNextTick=!0)},e.prototype.dispose=function(){this._observer&&this._contextObservable.remove(this._observer),this.clearObservables()},e.prototype._setState=function(e){this._state=e,this.onStateChangedObservable.notifyObservers(this._state)},e.prototype._stop=function(e,t){void 0===t&&(t=!1),this._contextObservable.remove(this._observer),this._setState(Kf.ENDED),t?this.onTimerAbortedObservable.notifyObservers(e):this.onTimerEndedObservable.notifyObservers(e)},e}(),e_=function(e){function t(t,i){var n=e.call(this,t)||this;return n._options=i,n._controllers={},n._snappedToPoint=!1,n._tmpRay=new fo(new x,new x),n._tmpVector=new x,n._tmpQuaternion=new P,n.skipNextTeleportation=!1,n.backwardsMovementEnabled=!0,n.backwardsTeleportationDistance=.7,n.parabolicCheckRadius=5,n.parabolicRayEnabled=!0,n.straightRayEnabled=!0,n.rotationAngle=Math.PI/8,n.onTargetMeshPositionUpdatedObservable=new u,n.teleportationEnabled=!0,n._rotationEnabled=!0,n._attachController=function(e){if(!(n._controllers[e.uniqueId]||n._options.forceHandedness&&e.inputSource.handedness!==n._options.forceHandedness)){n._controllers[e.uniqueId]={xrController:e,teleportationState:{forward:!1,backwards:!1,rotating:!1,currentRotation:0,baseRotation:0}};var t=n._controllers[e.uniqueId];if(\"tracked-pointer\"===t.xrController.inputSource.targetRayMode&&t.xrController.inputSource.gamepad){var i=function(){if(e.motionController){var i=e.motionController.getComponentOfType(Lf.THUMBSTICK_TYPE)||e.motionController.getComponentOfType(Lf.TOUCHPAD_TYPE);if(!i||n._options.useMainComponentOnly){var r=e.motionController.getMainComponent();if(!r)return;t.teleportationComponent=r,t.onButtonChangedObserver=r.onButtonStateChangedObservable.add((function(){n.teleportationEnabled&&r.changes.pressed&&(r.changes.pressed.current?(t.teleportationState.forward=!0,n._currentTeleportationControllerId=t.xrController.uniqueId,t.teleportationState.baseRotation=n._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y,t.teleportationState.currentRotation=0,Jf({timeout:n._options.timeToTeleport||3e3,contextObservable:n._xrSessionManager.onXRFrameObservable,breakCondition:function(){return!r.pressed},onEnded:function(){n._currentTeleportationControllerId===t.xrController.uniqueId&&t.teleportationState.forward&&n._teleportForward(e.uniqueId)}})):(t.teleportationState.forward=!1,n._currentTeleportationControllerId=\"\"))}))}else t.teleportationComponent=i,t.onAxisChangedObserver=i.onAxisValueChangedObservable.add((function(i){if(i.y<=.7&&t.teleportationState.backwards&&(t.teleportationState.backwards=!1),i.y>.7&&!t.teleportationState.forward&&n.backwardsMovementEnabled&&!n.snapPointsOnly&&!t.teleportationState.backwards){t.teleportationState.backwards=!0,n._tmpQuaternion.copyFrom(n._options.xrInput.xrCamera.rotationQuaternion),n._tmpQuaternion.toEulerAnglesToRef(n._tmpVector),n._tmpVector.x=0,n._tmpVector.z=0,P.FromEulerVectorToRef(n._tmpVector,n._tmpQuaternion),n._tmpVector.set(0,0,n.backwardsTeleportationDistance*(n._xrSessionManager.scene.useRightHandedSystem?1:-1)),n._tmpVector.rotateByQuaternionToRef(n._tmpQuaternion,n._tmpVector),n._tmpVector.addInPlace(n._options.xrInput.xrCamera.position),n._tmpRay.origin.copyFrom(n._tmpVector),n._tmpRay.length=n._options.xrInput.xrCamera.realWorldHeight+.1,n._tmpRay.direction.set(0,-1,0);var r=n._xrSessionManager.scene.pickWithRay(n._tmpRay,(function(e){return-1!==n._floorMeshes.indexOf(e)}));r&&r.pickedPoint&&(n._options.xrInput.xrCamera.position.x=r.pickedPoint.x,n._options.xrInput.xrCamera.position.z=r.pickedPoint.z)}if(i.y<-.7&&!n._currentTeleportationControllerId&&!t.teleportationState.rotating&&n.teleportationEnabled&&(t.teleportationState.forward=!0,n._currentTeleportationControllerId=t.xrController.uniqueId,t.teleportationState.baseRotation=n._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y),i.x){if(t.teleportationState.forward)n._currentTeleportationControllerId===t.xrController.uniqueId&&(n.rotationEnabled?setTimeout((function(){t.teleportationState.currentRotation=Math.atan2(i.x,i.y*(n._xrSessionManager.scene.useRightHandedSystem?1:-1))})):t.teleportationState.currentRotation=0);else if(!t.teleportationState.rotating&&Math.abs(i.x)>.7){t.teleportationState.rotating=!0;var o=n.rotationAngle*(i.x>0?1:-1)*(n._xrSessionManager.scene.useRightHandedSystem?-1:1);P.FromEulerAngles(0,o,0).multiplyToRef(n._options.xrInput.xrCamera.rotationQuaternion,n._options.xrInput.xrCamera.rotationQuaternion)}}else t.teleportationState.rotating=!1;0===i.x&&0===i.y&&t.teleportationState.forward&&n._teleportForward(e.uniqueId)}))}};e.motionController?i():e.onMotionControllerInitObservable.addOnce((function(){i()}))}else n._xrSessionManager.scene.onPointerObservable.add((function(i){i.type===Hi.POINTERDOWN?(t.teleportationState.forward=!0,n._currentTeleportationControllerId=t.xrController.uniqueId,t.teleportationState.baseRotation=n._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y,t.teleportationState.currentRotation=0,Jf({timeout:n._options.timeToTeleport||3e3,contextObservable:n._xrSessionManager.onXRFrameObservable,onEnded:function(){n._currentTeleportationControllerId===t.xrController.uniqueId&&t.teleportationState.forward&&n._teleportForward(e.uniqueId)}})):i.type===Hi.POINTERUP&&(t.teleportationState.forward=!1,n._currentTeleportationControllerId=\"\")}))}},n._options.teleportationTargetMesh||n._createDefaultTargetMesh(),n._floorMeshes=n._options.floorMeshes||[],n._snapToPositions=n._options.snapPositions||[],n._setTargetMeshVisibility(!1),n}return V(t,e),Object.defineProperty(t.prototype,\"rotationEnabled\",{get:function(){return this._rotationEnabled},set:function(e){if(this._rotationEnabled=e,this._options.teleportationTargetMesh){var t=this._options.teleportationTargetMesh.getChildMeshes(!1,(function(e){return\"rotationCone\"===e.name}));t[0]&&t[0].setEnabled(e)}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"teleportationTargetMesh\",{get:function(){return this._options.teleportationTargetMesh||null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"snapPointsOnly\",{get:function(){return!!this._options.snapPointsOnly},set:function(e){this._options.snapPointsOnly=e},enumerable:!1,configurable:!0}),t.prototype.addFloorMesh=function(e){this._floorMeshes.push(e)},t.prototype.addBlockerMesh=function(e){this._options.pickBlockerMeshes=this._options.pickBlockerMeshes||[],this._options.pickBlockerMeshes.push(e)},t.prototype.addSnapPoint=function(e){this._snapToPositions.push(e)},t.prototype.attach=function(){var t=this;return!!e.prototype.attach.call(this)&&(this._currentTeleportationControllerId=\"\",this._options.xrInput.controllers.forEach(this._attachController),this._addNewAttachObserver(this._options.xrInput.onControllerAddedObservable,this._attachController),this._addNewAttachObserver(this._options.xrInput.onControllerRemovedObservable,(function(e){t._detachController(e.uniqueId)})),!0)},t.prototype.detach=function(){var t=this;return!!e.prototype.detach.call(this)&&(Object.keys(this._controllers).forEach((function(e){t._detachController(e)})),this._setTargetMeshVisibility(!1),this._currentTeleportationControllerId=\"\",this._controllers={},!0)},t.prototype.dispose=function(){e.prototype.dispose.call(this),this._options.teleportationTargetMesh&&this._options.teleportationTargetMesh.dispose(!1,!0)},t.prototype.removeFloorMesh=function(e){var t=this._floorMeshes.indexOf(e);-1!==t&&this._floorMeshes.splice(t,1)},t.prototype.removeBlockerMesh=function(e){this._options.pickBlockerMeshes=this._options.pickBlockerMeshes||[];var t=this._options.pickBlockerMeshes.indexOf(e);-1!==t&&this._options.pickBlockerMeshes.splice(t,1)},t.prototype.removeFloorMeshByName=function(e){var t=this._xrSessionManager.scene.getMeshByName(e);t&&this.removeFloorMesh(t)},t.prototype.removeSnapPoint=function(e){var t=this._snapToPositions.indexOf(e);if(-1===t)for(var i=0;i=c.video.HAVE_CURRENT_DATA;return!c._settings.poster||c._settings.autoPlay&&u?u&&c._createInternalTexture():(c._texture=c._getEngine().createTexture(c._settings.poster,!1,!c.invertY,n),c._displayingPosterTexture=!0),c}return V(t,e),Object.defineProperty(t.prototype,\"onUserActionRequestedObservable\",{get:function(){return this._onUserActionRequestedObservable||(this._onUserActionRequestedObservable=new u),this._onUserActionRequestedObservable},enumerable:!1,configurable:!0}),t.prototype._processError=function(e){this._errorFound=!0,this._onError?this._onError(null==e?void 0:e.message):Q.Error(null==e?void 0:e.message)},t.prototype._handlePlay=function(){var e=this;this._errorFound=!1,this.video.play().catch((function(t){if(\"NotAllowedError\"===(null==t?void 0:t.name)){if(e._onUserActionRequestedObservable&&e._onUserActionRequestedObservable.hasObservers())return void e._onUserActionRequestedObservable.notifyObservers(e);if(!e.video.muted)return Q.Warn(\"Unable to autoplay a video with sound. Trying again with muted turned true\"),e.video.muted=!0,e._errorFound=!1,void e.video.play().catch((function(t){e._processError(t)}))}e._processError(t)}))},t.prototype.getClassName=function(){return\"VideoTexture\"},t.prototype._getName=function(e){return e instanceof HTMLVideoElement?e.currentSrc:\"object\"==typeof e?e.toString():e},t.prototype._getVideo=function(e){if(e.isNative)return e;if(e instanceof HTMLVideoElement)return mi.SetCorsBehavior(e.currentSrc,e),e;var t=document.createElement(\"video\");return\"string\"==typeof e?(mi.SetCorsBehavior(e,t),t.src=e):(mi.SetCorsBehavior(e[0],t),e.forEach((function(e){var i=document.createElement(\"source\");i.src=e,t.appendChild(i)}))),this.onDisposeObservable.addOnce((function(){r_(t)})),t},t.prototype._rebuild=function(){this.update()},t.prototype.update=function(){this.autoUpdateTexture&&this.updateTexture(!0)},t.prototype.updateTexture=function(e){e&&(this.video.paused&&this._stillImageCaptured||(this._stillImageCaptured=!0,this._updateInternalTexture()))},t.prototype.updateURL=function(e){this.video.src=e,this._currentSrc=e},t.prototype.clone=function(){return new t(this.name,this._currentSrc,this.getScene(),this._generateMipMaps,this.invertY,this.samplingMode,this._settings)},t.prototype.dispose=function(){e.prototype.dispose.call(this),this._currentSrc=null,this._onUserActionRequestedObservable&&(this._onUserActionRequestedObservable.clear(),this._onUserActionRequestedObservable=null),this.video.removeEventListener(this._createInternalTextureOnEvent,this._createInternalTexture),this.video.removeEventListener(\"paused\",this._updateInternalTexture),this.video.removeEventListener(\"seeked\",this._updateInternalTexture),this.video.removeEventListener(\"emptied\",this._reset),this.video.pause()},t.CreateFromStreamAsync=function(e,i,n,r){void 0===r&&(r=!0);var o=e.getEngine().createVideoElement(n);return e.getEngine()._badOS&&(document.body.appendChild(o),o.style.transform=\"scale(0.0001, 0.0001)\",o.style.opacity=\"0\",o.style.position=\"fixed\",o.style.bottom=\"0px\",o.style.right=\"0px\"),o.setAttribute(\"autoplay\",\"\"),o.setAttribute(\"muted\",\"true\"),o.setAttribute(\"playsinline\",\"\"),o.muted=!0,o.isNative||(void 0!==o.mozSrcObject?o.mozSrcObject=i:\"object\"==typeof o.srcObject?o.srcObject=i:o.src=window.URL&&window.URL.createObjectURL(i)),new Promise((function(i){var n=function(){var a=new t(\"video\",o,e,!0,r);e.getEngine()._badOS&&a.onDisposeObservable.addOnce((function(){o.remove()})),a.onDisposeObservable.addOnce((function(){r_(o)})),i(a),o.removeEventListener(\"playing\",n)};o.addEventListener(\"playing\",n),o.play()}))},t.CreateFromWebCamAsync=function(e,t,i,n){var r,o=this;if(void 0===i&&(i=!1),void 0===n&&(n=!0),t&&t.deviceId&&(r={exact:t.deviceId}),navigator.mediaDevices)return navigator.mediaDevices.getUserMedia({video:t,audio:i}).then((function(i){return o.CreateFromStreamAsync(e,i,t,n)}));var a=navigator.getUserMedia||navigator.mozGetUserMedia;return a&&a({video:{deviceId:r,width:{min:t&&t.minWidth||256,max:t&&t.maxWidth||640},height:{min:t&&t.minHeight||256,max:t&&t.maxHeight||480}},audio:i},(function(i){return o.CreateFromStreamAsync(e,i,t,n)}),(function(e){Q.Error(e.name)})),Promise.reject(\"No support for userMedia on this device\")},t.CreateFromWebCam=function(e,t,i,n,r){void 0===n&&(n=!1),void 0===r&&(r=!0),this.CreateFromWebCamAsync(e,i,n,r).then((function(e){t&&t(e)})).catch((function(e){Q.Error(e.name)}))},t}(to),a_=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return V(t,e),Object.defineProperty(t.prototype,\"videoTexture\",{get:function(){return this._texture},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"videoMode\",{get:function(){return this.textureMode},set:function(e){this.textureMode=e},enumerable:!1,configurable:!0}),t.prototype._initTexture=function(e,t,i){var n=this,r={loop:i.loop,autoPlay:i.autoPlay,autoUpdateTexture:!0,poster:i.poster},o=new o_((this.name||\"videoDome\")+\"_texture\",e,t,i.generateMipMaps,this._useDirectMapping,to.TRILINEAR_SAMPLINGMODE,r);return i.clickToPlay&&(this._pointerObserver=t.onPointerObservable.add((function(e){var t;(null===(t=e.pickInfo)||void 0===t?void 0:t.pickedMesh)===n.mesh&&n._texture.video.play()}),Hi.POINTERDOWN)),this._textureObserver=o.onLoadObservable.add((function(){n.onLoadObservable.notifyObservers()})),o},t.prototype.dispose=function(t,i){void 0===i&&(i=!1),this._texture.onLoadObservable.remove(this._textureObserver),this._scene.onPointerObservable.remove(this._pointerObserver),e.prototype.dispose.call(this,t,i)},t.MODE_MONOSCOPIC=Kp.MODE_MONOSCOPIC,t.MODE_TOPBOTTOM=Kp.MODE_TOPBOTTOM,t.MODE_SIDEBYSIDE=Kp.MODE_SIDEBYSIDE,t}(Kp),s_=function(){function e(e){this.engine=e,this._captureGPUFrameTime=!1,this._captureShaderCompilationTime=!1,this._shaderCompilationTime=new cn,this._onBeginFrameObserver=null,this._onEndFrameObserver=null,this._onBeforeShaderCompilationObserver=null,this._onAfterShaderCompilationObserver=null}return Object.defineProperty(e.prototype,\"gpuFrameTimeCounter\",{get:function(){return this.engine.getGPUFrameTimeCounter()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"captureGPUFrameTime\",{get:function(){return this._captureGPUFrameTime},set:function(e){e!==this._captureGPUFrameTime&&(this._captureGPUFrameTime=e,this.engine.captureGPUFrameTime(e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"shaderCompilationTimeCounter\",{get:function(){return this._shaderCompilationTime},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"captureShaderCompilationTime\",{get:function(){return this._captureShaderCompilationTime},set:function(e){var t=this;e!==this._captureShaderCompilationTime&&(this._captureShaderCompilationTime=e,e?(this._onBeforeShaderCompilationObserver=this.engine.onBeforeShaderCompilationObservable.add((function(){t._shaderCompilationTime.fetchNewFrame(),t._shaderCompilationTime.beginMonitoring()})),this._onAfterShaderCompilationObserver=this.engine.onAfterShaderCompilationObservable.add((function(){t._shaderCompilationTime.endMonitoring()}))):(this.engine.onBeforeShaderCompilationObservable.remove(this._onBeforeShaderCompilationObserver),this._onBeforeShaderCompilationObserver=null,this.engine.onAfterShaderCompilationObservable.remove(this._onAfterShaderCompilationObserver),this._onAfterShaderCompilationObserver=null))},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){this.engine.onBeginFrameObservable.remove(this._onBeginFrameObserver),this._onBeginFrameObserver=null,this.engine.onEndFrameObservable.remove(this._onEndFrameObserver),this._onEndFrameObserver=null,this.engine.onBeforeShaderCompilationObservable.remove(this._onBeforeShaderCompilationObserver),this._onBeforeShaderCompilationObserver=null,this.engine.onAfterShaderCompilationObservable.remove(this._onAfterShaderCompilationObserver),this._onAfterShaderCompilationObserver=null,this.engine=null},e}(),l_=function(){function e(e){var t=this;this.scene=e,this._captureActiveMeshesEvaluationTime=!1,this._activeMeshesEvaluationTime=new cn,this._captureRenderTargetsRenderTime=!1,this._renderTargetsRenderTime=new cn,this._captureFrameTime=!1,this._frameTime=new cn,this._captureRenderTime=!1,this._renderTime=new cn,this._captureInterFrameTime=!1,this._interFrameTime=new cn,this._captureParticlesRenderTime=!1,this._particlesRenderTime=new cn,this._captureSpritesRenderTime=!1,this._spritesRenderTime=new cn,this._capturePhysicsTime=!1,this._physicsTime=new cn,this._captureAnimationsTime=!1,this._animationsTime=new cn,this._captureCameraRenderTime=!1,this._cameraRenderTime=new cn,this._onBeforeActiveMeshesEvaluationObserver=null,this._onAfterActiveMeshesEvaluationObserver=null,this._onBeforeRenderTargetsRenderObserver=null,this._onAfterRenderTargetsRenderObserver=null,this._onAfterRenderObserver=null,this._onBeforeDrawPhaseObserver=null,this._onAfterDrawPhaseObserver=null,this._onBeforeAnimationsObserver=null,this._onBeforeParticlesRenderingObserver=null,this._onAfterParticlesRenderingObserver=null,this._onBeforeSpritesRenderingObserver=null,this._onAfterSpritesRenderingObserver=null,this._onBeforePhysicsObserver=null,this._onAfterPhysicsObserver=null,this._onAfterAnimationsObserver=null,this._onBeforeCameraRenderObserver=null,this._onAfterCameraRenderObserver=null,this._onBeforeAnimationsObserver=e.onBeforeAnimationsObservable.add((function(){t._captureActiveMeshesEvaluationTime&&t._activeMeshesEvaluationTime.fetchNewFrame(),t._captureRenderTargetsRenderTime&&t._renderTargetsRenderTime.fetchNewFrame(),t._captureFrameTime&&(mi.StartPerformanceCounter(\"Scene rendering\"),t._frameTime.beginMonitoring()),t._captureInterFrameTime&&t._interFrameTime.endMonitoring(),t._captureParticlesRenderTime&&t._particlesRenderTime.fetchNewFrame(),t._captureSpritesRenderTime&&t._spritesRenderTime.fetchNewFrame(),t._captureAnimationsTime&&t._animationsTime.beginMonitoring(),t.scene.getEngine()._drawCalls.fetchNewFrame()})),this._onAfterRenderObserver=e.onAfterRenderObservable.add((function(){t._captureFrameTime&&(mi.EndPerformanceCounter(\"Scene rendering\"),t._frameTime.endMonitoring()),t._captureRenderTime&&t._renderTime.endMonitoring(!1),t._captureInterFrameTime&&t._interFrameTime.beginMonitoring()}))}return Object.defineProperty(e.prototype,\"activeMeshesEvaluationTimeCounter\",{get:function(){return this._activeMeshesEvaluationTime},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"captureActiveMeshesEvaluationTime\",{get:function(){return this._captureActiveMeshesEvaluationTime},set:function(e){var t=this;e!==this._captureActiveMeshesEvaluationTime&&(this._captureActiveMeshesEvaluationTime=e,e?(this._onBeforeActiveMeshesEvaluationObserver=this.scene.onBeforeActiveMeshesEvaluationObservable.add((function(){mi.StartPerformanceCounter(\"Active meshes evaluation\"),t._activeMeshesEvaluationTime.beginMonitoring()})),this._onAfterActiveMeshesEvaluationObserver=this.scene.onAfterActiveMeshesEvaluationObservable.add((function(){mi.EndPerformanceCounter(\"Active meshes evaluation\"),t._activeMeshesEvaluationTime.endMonitoring()}))):(this.scene.onBeforeActiveMeshesEvaluationObservable.remove(this._onBeforeActiveMeshesEvaluationObserver),this._onBeforeActiveMeshesEvaluationObserver=null,this.scene.onAfterActiveMeshesEvaluationObservable.remove(this._onAfterActiveMeshesEvaluationObserver),this._onAfterActiveMeshesEvaluationObserver=null))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"renderTargetsRenderTimeCounter\",{get:function(){return this._renderTargetsRenderTime},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"captureRenderTargetsRenderTime\",{get:function(){return this._captureRenderTargetsRenderTime},set:function(e){var t=this;e!==this._captureRenderTargetsRenderTime&&(this._captureRenderTargetsRenderTime=e,e?(this._onBeforeRenderTargetsRenderObserver=this.scene.onBeforeRenderTargetsRenderObservable.add((function(){mi.StartPerformanceCounter(\"Render targets rendering\"),t._renderTargetsRenderTime.beginMonitoring()})),this._onAfterRenderTargetsRenderObserver=this.scene.onAfterRenderTargetsRenderObservable.add((function(){mi.EndPerformanceCounter(\"Render targets rendering\"),t._renderTargetsRenderTime.endMonitoring(!1)}))):(this.scene.onBeforeRenderTargetsRenderObservable.remove(this._onBeforeRenderTargetsRenderObserver),this._onBeforeRenderTargetsRenderObserver=null,this.scene.onAfterRenderTargetsRenderObservable.remove(this._onAfterRenderTargetsRenderObserver),this._onAfterRenderTargetsRenderObserver=null))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"particlesRenderTimeCounter\",{get:function(){return this._particlesRenderTime},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"captureParticlesRenderTime\",{get:function(){return this._captureParticlesRenderTime},set:function(e){var t=this;e!==this._captureParticlesRenderTime&&(this._captureParticlesRenderTime=e,e?(this._onBeforeParticlesRenderingObserver=this.scene.onBeforeParticlesRenderingObservable.add((function(){mi.StartPerformanceCounter(\"Particles\"),t._particlesRenderTime.beginMonitoring()})),this._onAfterParticlesRenderingObserver=this.scene.onAfterParticlesRenderingObservable.add((function(){mi.EndPerformanceCounter(\"Particles\"),t._particlesRenderTime.endMonitoring(!1)}))):(this.scene.onBeforeParticlesRenderingObservable.remove(this._onBeforeParticlesRenderingObserver),this._onBeforeParticlesRenderingObserver=null,this.scene.onAfterParticlesRenderingObservable.remove(this._onAfterParticlesRenderingObserver),this._onAfterParticlesRenderingObserver=null))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"spritesRenderTimeCounter\",{get:function(){return this._spritesRenderTime},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"captureSpritesRenderTime\",{get:function(){return this._captureSpritesRenderTime},set:function(e){var t=this;e!==this._captureSpritesRenderTime&&(this._captureSpritesRenderTime=e,this.scene.spriteManagers&&(e?(this._onBeforeSpritesRenderingObserver=this.scene.onBeforeSpritesRenderingObservable.add((function(){mi.StartPerformanceCounter(\"Sprites\"),t._spritesRenderTime.beginMonitoring()})),this._onAfterSpritesRenderingObserver=this.scene.onAfterSpritesRenderingObservable.add((function(){mi.EndPerformanceCounter(\"Sprites\"),t._spritesRenderTime.endMonitoring(!1)}))):(this.scene.onBeforeSpritesRenderingObservable.remove(this._onBeforeSpritesRenderingObserver),this._onBeforeSpritesRenderingObserver=null,this.scene.onAfterSpritesRenderingObservable.remove(this._onAfterSpritesRenderingObserver),this._onAfterSpritesRenderingObserver=null)))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"physicsTimeCounter\",{get:function(){return this._physicsTime},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"capturePhysicsTime\",{get:function(){return this._capturePhysicsTime},set:function(e){var t=this;e!==this._capturePhysicsTime&&this.scene.onBeforePhysicsObservable&&(this._capturePhysicsTime=e,e?(this._onBeforePhysicsObserver=this.scene.onBeforePhysicsObservable.add((function(){mi.StartPerformanceCounter(\"Physics\"),t._physicsTime.beginMonitoring()})),this._onAfterPhysicsObserver=this.scene.onAfterPhysicsObservable.add((function(){mi.EndPerformanceCounter(\"Physics\"),t._physicsTime.endMonitoring()}))):(this.scene.onBeforePhysicsObservable.remove(this._onBeforePhysicsObserver),this._onBeforePhysicsObserver=null,this.scene.onAfterPhysicsObservable.remove(this._onAfterPhysicsObserver),this._onAfterPhysicsObserver=null))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"animationsTimeCounter\",{get:function(){return this._animationsTime},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"captureAnimationsTime\",{get:function(){return this._captureAnimationsTime},set:function(e){var t=this;e!==this._captureAnimationsTime&&(this._captureAnimationsTime=e,e?this._onAfterAnimationsObserver=this.scene.onAfterAnimationsObservable.add((function(){t._animationsTime.endMonitoring()})):(this.scene.onAfterAnimationsObservable.remove(this._onAfterAnimationsObserver),this._onAfterAnimationsObserver=null))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"frameTimeCounter\",{get:function(){return this._frameTime},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"captureFrameTime\",{get:function(){return this._captureFrameTime},set:function(e){this._captureFrameTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"interFrameTimeCounter\",{get:function(){return this._interFrameTime},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"captureInterFrameTime\",{get:function(){return this._captureInterFrameTime},set:function(e){this._captureInterFrameTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"renderTimeCounter\",{get:function(){return this._renderTime},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"captureRenderTime\",{get:function(){return this._captureRenderTime},set:function(e){var t=this;e!==this._captureRenderTime&&(this._captureRenderTime=e,e?(this._onBeforeDrawPhaseObserver=this.scene.onBeforeDrawPhaseObservable.add((function(){t._renderTime.beginMonitoring(),mi.StartPerformanceCounter(\"Main render\")})),this._onAfterDrawPhaseObserver=this.scene.onAfterDrawPhaseObservable.add((function(){t._renderTime.endMonitoring(!1),mi.EndPerformanceCounter(\"Main render\")}))):(this.scene.onBeforeDrawPhaseObservable.remove(this._onBeforeDrawPhaseObserver),this._onBeforeDrawPhaseObserver=null,this.scene.onAfterDrawPhaseObservable.remove(this._onAfterDrawPhaseObserver),this._onAfterDrawPhaseObserver=null))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"cameraRenderTimeCounter\",{get:function(){return this._cameraRenderTime},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"captureCameraRenderTime\",{get:function(){return this._captureCameraRenderTime},set:function(e){var t=this;e!==this._captureCameraRenderTime&&(this._captureCameraRenderTime=e,e?(this._onBeforeCameraRenderObserver=this.scene.onBeforeCameraRenderObservable.add((function(e){t._cameraRenderTime.beginMonitoring(),mi.StartPerformanceCounter(\"Rendering camera \".concat(e.name))})),this._onAfterCameraRenderObserver=this.scene.onAfterCameraRenderObservable.add((function(e){t._cameraRenderTime.endMonitoring(!1),mi.EndPerformanceCounter(\"Rendering camera \".concat(e.name))}))):(this.scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),this._onBeforeCameraRenderObserver=null,this.scene.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver),this._onAfterCameraRenderObserver=null))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"drawCallsCounter\",{get:function(){return this.scene.getEngine()._drawCalls},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){this.scene.onAfterRenderObservable.remove(this._onAfterRenderObserver),this._onAfterRenderObserver=null,this.scene.onBeforeActiveMeshesEvaluationObservable.remove(this._onBeforeActiveMeshesEvaluationObserver),this._onBeforeActiveMeshesEvaluationObserver=null,this.scene.onAfterActiveMeshesEvaluationObservable.remove(this._onAfterActiveMeshesEvaluationObserver),this._onAfterActiveMeshesEvaluationObserver=null,this.scene.onBeforeRenderTargetsRenderObservable.remove(this._onBeforeRenderTargetsRenderObserver),this._onBeforeRenderTargetsRenderObserver=null,this.scene.onAfterRenderTargetsRenderObservable.remove(this._onAfterRenderTargetsRenderObserver),this._onAfterRenderTargetsRenderObserver=null,this.scene.onBeforeAnimationsObservable.remove(this._onBeforeAnimationsObserver),this._onBeforeAnimationsObserver=null,this.scene.onBeforeParticlesRenderingObservable.remove(this._onBeforeParticlesRenderingObserver),this._onBeforeParticlesRenderingObserver=null,this.scene.onAfterParticlesRenderingObservable.remove(this._onAfterParticlesRenderingObserver),this._onAfterParticlesRenderingObserver=null,this._onBeforeSpritesRenderingObserver&&(this.scene.onBeforeSpritesRenderingObservable.remove(this._onBeforeSpritesRenderingObserver),this._onBeforeSpritesRenderingObserver=null),this._onAfterSpritesRenderingObserver&&(this.scene.onAfterSpritesRenderingObservable.remove(this._onAfterSpritesRenderingObserver),this._onAfterSpritesRenderingObserver=null),this.scene.onBeforeDrawPhaseObservable.remove(this._onBeforeDrawPhaseObserver),this._onBeforeDrawPhaseObserver=null,this.scene.onAfterDrawPhaseObservable.remove(this._onAfterDrawPhaseObserver),this._onAfterDrawPhaseObserver=null,this._onBeforePhysicsObserver&&(this.scene.onBeforePhysicsObservable.remove(this._onBeforePhysicsObserver),this._onBeforePhysicsObserver=null),this._onAfterPhysicsObserver&&(this.scene.onAfterPhysicsObservable.remove(this._onAfterPhysicsObserver),this._onAfterPhysicsObserver=null),this.scene.onAfterAnimationsObservable.remove(this._onAfterAnimationsObserver),this._onAfterAnimationsObserver=null,this.scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),this._onBeforeCameraRenderObserver=null,this.scene.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver),this._onAfterCameraRenderObserver=null,this.scene=null},e}();It.ShadersStore.glowMapGenerationPixelShader=\"#if defined(DIFFUSE_ISLINEAR) || defined(EMISSIVE_ISLINEAR)\\n#include\\n#endif\\n#ifdef DIFFUSE\\nvarying vec2 vUVDiffuse;\\nuniform sampler2D diffuseSampler;\\n#endif\\n#ifdef OPACITY\\nvarying vec2 vUVOpacity;\\nuniform sampler2D opacitySampler;\\nuniform float opacityIntensity;\\n#endif\\n#ifdef EMISSIVE\\nvarying vec2 vUVEmissive;\\nuniform sampler2D emissiveSampler;\\n#endif\\n#ifdef VERTEXALPHA\\nvarying vec4 vColor;\\n#endif\\nuniform vec4 glowColor;\\n#include\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void)\\n{\\n#include\\nvec4 finalColor=glowColor;\\n#ifdef DIFFUSE\\nvec4 albedoTexture=texture2D(diffuseSampler,vUVDiffuse);\\n#ifdef DIFFUSE_ISLINEAR\\nalbedoTexture=toGammaSpace(albedoTexture);\\n#endif\\n#ifdef GLOW\\nfinalColor.a*=albedoTexture.a;\\n#endif\\n#ifdef HIGHLIGHT\\nfinalColor.a=albedoTexture.a;\\n#endif\\n#endif\\n#ifdef OPACITY\\nvec4 opacityMap=texture2D(opacitySampler,vUVOpacity);\\n#ifdef OPACITYRGB\\nfinalColor.a*=getLuminance(opacityMap.rgb);\\n#else\\nfinalColor.a*=opacityMap.a;\\n#endif\\nfinalColor.a*=opacityIntensity;\\n#endif\\n#ifdef VERTEXALPHA\\nfinalColor.a*=vColor.a;\\n#endif\\n#ifdef ALPHATEST\\nif (finalColor.a\\n#include\\n#include\\n#include[0..maxSimultaneousMorphTargets]\\n#include\\n#include\\nuniform mat4 viewProjection;\\nvarying vec4 vPosition;\\n#ifdef UV1\\nattribute vec2 uv;\\n#endif\\n#ifdef UV2\\nattribute vec2 uv2;\\n#endif\\n#ifdef DIFFUSE\\nvarying vec2 vUVDiffuse;\\nuniform mat4 diffuseMatrix;\\n#endif\\n#ifdef OPACITY\\nvarying vec2 vUVOpacity;\\nuniform mat4 opacityMatrix;\\n#endif\\n#ifdef EMISSIVE\\nvarying vec2 vUVEmissive;\\nuniform mat4 emissiveMatrix;\\n#endif\\n#ifdef VERTEXALPHA\\nattribute vec4 color;\\nvarying vec4 vColor;\\n#endif\\n#define CUSTOM_VERTEX_DEFINITIONS\\nvoid main(void)\\n{\\nvec3 positionUpdated=position;\\n#ifdef UV1\\nvec2 uvUpdated=uv;\\n#endif\\n#include\\n#include[0..maxSimultaneousMorphTargets]\\n#include\\n#include\\n#include\\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\\n#ifdef CUBEMAP\\nvPosition=worldPos;\\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\\n#else\\nvPosition=viewProjection*worldPos;\\ngl_Position=vPosition;\\n#endif\\n#ifdef DIFFUSE\\n#ifdef DIFFUSEUV1\\nvUVDiffuse=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\\n#endif\\n#ifdef DIFFUSEUV2\\nvUVDiffuse=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\\n#endif\\n#endif\\n#ifdef OPACITY\\n#ifdef OPACITYUV1\\nvUVOpacity=vec2(opacityMatrix*vec4(uvUpdated,1.0,0.0));\\n#endif\\n#ifdef OPACITYUV2\\nvUVOpacity=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\\n#endif\\n#endif\\n#ifdef EMISSIVE\\n#ifdef EMISSIVEUV1\\nvUVEmissive=vec2(emissiveMatrix*vec4(uvUpdated,1.0,0.0));\\n#endif\\n#ifdef EMISSIVEUV2\\nvUVEmissive=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));\\n#endif\\n#endif\\n#ifdef VERTEXALPHA\\nvColor=color;\\n#endif\\n#include\\n}\";var c_=function(){function e(t,i){this._vertexBuffers={},this._maxSize=0,this._mainTextureDesiredSize={width:0,height:0},this._shouldRender=!0,this._postProcesses=[],this._textures=[],this._emissiveTextureAndColor={texture:null,color:new L},this.neutralColor=new L,this.isEnabled=!0,this.disableBoundingBoxesFromEffectLayer=!1,this.onDisposeObservable=new u,this.onBeforeRenderMainTextureObservable=new u,this.onBeforeComposeObservable=new u,this.onBeforeRenderMeshToEffect=new u,this.onAfterRenderMeshToEffect=new u,this.onAfterComposeObservable=new u,this.onSizeChangedObservable=new u,this._materialForRendering={},this.name=t,this._scene=i||S.LastCreatedScene,e._SceneComponentInitialization(this._scene),this._engine=this._scene.getEngine(),this._maxSize=this._engine.getCaps().maxTextureSize,this._scene.effectLayers.push(this),this._mergeDrawWrapper=[],this._generateIndexBuffer(),this._generateVertexBuffer()}return Object.defineProperty(e.prototype,\"camera\",{get:function(){return this._effectLayerOptions.camera},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"renderingGroupId\",{get:function(){return this._effectLayerOptions.renderingGroupId},set:function(e){this._effectLayerOptions.renderingGroupId=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"mainTexture\",{get:function(){return this._mainTexture},enumerable:!1,configurable:!0}),e.prototype.setMaterialForRendering=function(e,t){if(this._mainTexture.setMaterialForRendering(e,t),Array.isArray(e))for(var i=0;i4&&(c.push(wi.MatricesIndicesExtraKind),c.push(wi.MatricesWeightsExtraKind)),l.push(\"#define NUM_BONE_INFLUENCERS \"+o.numBoneInfluencers);var g=o.skeleton;g&&g.isUsingTextureForMatrices?l.push(\"#define BONETEXTURE\"):l.push(\"#define BonesPerMesh \"+(g?g.bones.length+1:0)),o.numBoneInfluencers>0&&m.addCPUSkinningFallback(0,o)}else l.push(\"#define NUM_BONE_INFLUENCERS 0\");var v=o.morphTargetManager,y=0;v&&v.numInfluencers>0&&(l.push(\"#define MORPHTARGETS\"),y=v.numInfluencers,l.push(\"#define NUM_MORPH_INFLUENCERS \"+y),v.isUsingTextureForTargets&&l.push(\"#define MORPHTARGETS_TEXTURE\"),Pr.PrepareAttributesForMorphTargetsInfluencers(c,o,y)),t&&(l.push(\"#define INSTANCES\"),Pr.PushAttributesForInstances(c),e.getRenderingMesh().hasThinInstances&&l.push(\"#define THIN_INSTANCES\"));var b=this._scene;b.clipPlane&&l.push(\"#define CLIPPLANE\"),b.clipPlane2&&l.push(\"#define CLIPPLANE2\"),b.clipPlane3&&l.push(\"#define CLIPPLANE3\"),b.clipPlane4&&l.push(\"#define CLIPPLANE4\"),b.clipPlane5&&l.push(\"#define CLIPPLANE5\"),b.clipPlane6&&l.push(\"#define CLIPPLANE6\"),this._addCustomEffectDefines(l);var T=e._getDrawWrapper(void 0,!0),E=T.defines,S=l.join(\"\\n\");return E!==S&&T.setEffect(this._engine.createEffect(\"glowMapGeneration\",c,[\"world\",\"mBones\",\"viewProjection\",\"glowColor\",\"morphTargetInfluences\",\"boneTextureWidth\",\"diffuseMatrix\",\"emissiveMatrix\",\"opacityMatrix\",\"opacityIntensity\",\"morphTargetTextureInfo\",\"morphTargetTextureIndices\",\"vClipPlane\",\"vClipPlane2\",\"vClipPlane3\",\"vClipPlane4\",\"vClipPlane5\",\"vClipPlane6\"],[\"diffuseSampler\",\"emissiveSampler\",\"opacitySampler\",\"boneSampler\",\"morphTargets\"],S,m,void 0,void 0,{maxSimultaneousMorphTargets:y}),S),T.effect.isReady()},e.prototype.render=function(){for(var e=0;e-1&&this._scene.effectLayers.splice(n,1),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.onBeforeRenderMainTextureObservable.clear(),this.onBeforeComposeObservable.clear(),this.onBeforeRenderMeshToEffect.clear(),this.onAfterRenderMeshToEffect.clear(),this.onAfterComposeObservable.clear(),this.onSizeChangedObservable.clear()},e.prototype.getClassName=function(){return\"EffectLayer\"},e.Parse=function(e,t,i){return mi.Instantiate(e.customType).Parse(e,t,i)},e._SceneComponentInitialization=function(e){throw pe(\"EffectLayerSceneComponent\")},G([be()],e.prototype,\"name\",void 0),G([Pe()],e.prototype,\"neutralColor\",void 0),G([be()],e.prototype,\"isEnabled\",void 0),G([De()],e.prototype,\"camera\",null),G([be()],e.prototype,\"renderingGroupId\",null),G([be()],e.prototype,\"disableBoundingBoxesFromEffectLayer\",void 0),e}();o.AddParser(zi.NAME_EFFECTLAYER,(function(e,t,i,n){if(e.effectLayers){i.effectLayers||(i.effectLayers=new Array);for(var r=0;r0){this._previousStencilState=this._engine.getStencilBuffer();for(var n=0,r=i;n-1)){this._renderEffects=!0,this._needStencil=this._needStencil||o.needStencil();var a=o._mainTexture;a._shouldRender()&&(this.scene.incrementRenderId(),a.render(!1,!1),t=!0)}}this.scene.incrementRenderId()}return t},e.prototype._setStencil=function(){this._needStencil&&this._engine.setStencilBuffer(!0)},e.prototype._setStencilBack=function(){this._needStencil&&this._engine.setStencilBuffer(this._previousStencilState)},e.prototype._draw=function(e){if(this._renderEffects){this._engine.setDepthBuffer(!1);for(var t=this.scene.effectLayers,i=0;i-1},t.prototype.referenceMeshToUseItsOwnMaterial=function(e){var t=this;e.resetDrawCache(this._mainTexture.renderPassId),this._meshesUsingTheirOwnMaterials.push(e.uniqueId),e.onDisposeObservable.add((function(){t._disposeMesh(e)}))},t.prototype.unReferenceMeshFromUsingItsOwnMaterial=function(e){for(var t=this._meshesUsingTheirOwnMaterials.indexOf(e.uniqueId);t>=0;)this._meshesUsingTheirOwnMaterials.splice(t,1),t=this._meshesUsingTheirOwnMaterials.indexOf(e.uniqueId);e.resetDrawCache(this._mainTexture.renderPassId)},t.prototype._disposeMesh=function(e){this.removeIncludedOnlyMesh(e),this.removeExcludedMesh(e)},t.prototype.getClassName=function(){return\"GlowLayer\"},t.prototype.serialize=function(){var e,t=Le.Serialize(this);if(t.customType=\"BABYLON.GlowLayer\",t.includedMeshes=[],this._includedOnlyMeshes.length)for(e=0;e0&&e.isBackground===t&&e.applyPostProcess===i&&e.renderTargetTextures.indexOf(r)>-1&&0!=(e.layerMask&n)},e.prototype._drawRenderTargetBackground=function(e){var t=this;this._draw((function(i){return t._drawRenderTargetPredicate(i,!0,!0,t.scene.activeCamera.layerMask,e)}))},e.prototype._drawRenderTargetForegroundWithPostProcessing=function(e){var t=this;this._draw((function(i){return t._drawRenderTargetPredicate(i,!1,!0,t.scene.activeCamera.layerMask,e)}))},e.prototype._drawRenderTargetForegroundWithoutPostProcessing=function(e){var t=this;this._draw((function(i){return t._drawRenderTargetPredicate(i,!1,!1,t.scene.activeCamera.layerMask,e)}))},e.prototype.addFromContainer=function(e){var t=this;e.layers&&e.layers.forEach((function(e){t.scene.layers.push(e)}))},e.prototype.removeFromContainer=function(e,t){var i=this;void 0===t&&(t=!1),e.layers&&e.layers.forEach((function(e){var n=i.scene.layers.indexOf(e);-1!==n&&i.scene.layers.splice(n,1),t&&e.dispose()}))},e}();It.ShadersStore.layerPixelShader=\"varying vec2 vUV;\\nuniform sampler2D textureSampler;\\nuniform vec4 color;\\n#include\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void) {\\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\\nvec4 baseColor=texture2D(textureSampler,vUV);\\n#ifdef LINEAR\\nbaseColor.rgb=toGammaSpace(baseColor.rgb);\\n#endif\\n#ifdef ALPHATEST\\nif (baseColor.a<0.4)\\ndiscard;\\n#endif\\ngl_FragColor=baseColor*color;\\n#define CUSTOM_FRAGMENT_MAIN_END\\n}\";It.ShadersStore.layerVertexShader=\"attribute vec2 position;\\nuniform vec2 scale;\\nuniform vec2 offset;\\nuniform mat4 textureMatrix;\\nvarying vec2 vUV;\\nconst vec2 madd=vec2(0.5,0.5);\\n#define CUSTOM_VERTEX_DEFINITIONS\\nvoid main(void) {\\n#define CUSTOM_VERTEX_MAIN_BEGIN\\nvec2 shiftedPosition=position*scale+offset;\\nvUV=vec2(textureMatrix*vec4(shiftedPosition*madd+madd,1.0,0.0));\\ngl_Position=vec4(shiftedPosition,0.0,1.0);\\n#define CUSTOM_VERTEX_MAIN_END\\n}\";var __=function(){function e(e,t,i,n,r){this.name=e,this._applyPostProcess=!0,this.scale=new R(1,1),this.offset=new R(0,0),this.alphaBlendingMode=a.ALPHA_COMBINE,this.layerMask=268435455,this.renderTargetTextures=[],this.renderOnlyInRenderTargetTextures=!1,this.isEnabled=!0,this._vertexBuffers={},this.onDisposeObservable=new u,this.onBeforeRenderObservable=new u,this.onAfterRenderObservable=new u,this.texture=t?new to(t,i,!0):null,this.isBackground=void 0===n||n,this.color=void 0===r?new L(1,1,1,1):r,this._scene=i||S.LastCreatedScene;var o=this._scene._getComponent(zi.NAME_LAYER);o||(o=new f_(this._scene),this._scene._addComponent(o)),this._scene.layers.push(this);var s=this._scene.getEngine();this._drawWrapper=new Ht(s);var l=[];l.push(1,1),l.push(-1,1),l.push(-1,-1),l.push(1,-1);var c=new wi(s,l,wi.PositionKind,!1,!1,2);this._vertexBuffers[wi.PositionKind]=c,this._createIndexBuffer()}return Object.defineProperty(e.prototype,\"applyPostProcess\",{get:function(){return this.isBackground||this._applyPostProcess},set:function(e){this._applyPostProcess=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"onDispose\",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"onBeforeRender\",{set:function(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"onAfterRender\",{set:function(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),this._onAfterRenderObserver=this.onAfterRenderObservable.add(e)},enumerable:!1,configurable:!0}),e.prototype._createIndexBuffer=function(){var e=this._scene.getEngine(),t=[];t.push(0),t.push(1),t.push(2),t.push(0),t.push(2),t.push(3),this._indexBuffer=e.createIndexBuffer(t)},e.prototype._rebuild=function(){var e=this._vertexBuffers[wi.PositionKind];e&&e._rebuild(),this._createIndexBuffer()},e.prototype.render=function(){if(this.isEnabled){var e=this._scene.getEngine(),t=\"\";this.alphaTest&&(t=\"#define ALPHATEST\"),this.texture&&!this.texture.gammaSpace&&(t+=\"\\r\\n#define LINEAR\"),this._previousDefines!==t&&(this._previousDefines=t,this._drawWrapper.effect=e.createEffect(\"layer\",[wi.PositionKind],[\"textureMatrix\",\"color\",\"scale\",\"offset\"],[\"textureSampler\"],t));var i=this._drawWrapper.effect;i&&i.isReady()&&this.texture&&this.texture.isReady()&&(this.onBeforeRenderObservable.notifyObservers(this),e.enableEffect(this._drawWrapper),e.setState(!1),i.setTexture(\"textureSampler\",this.texture),i.setMatrix(\"textureMatrix\",this.texture.getTextureMatrix()),i.setFloat4(\"color\",this.color.r,this.color.g,this.color.b,this.color.a),i.setVector2(\"offset\",this.offset),i.setVector2(\"scale\",this.scale),e.bindBuffers(this._vertexBuffers,this._indexBuffer,i),this.alphaTest?e.drawElementsType(Ir.TriangleFillMode,0,6):(e.setAlphaMode(this.alphaBlendingMode),e.drawElementsType(Ir.TriangleFillMode,0,6),e.setAlphaMode(a.ALPHA_DISABLE)),this.onAfterRenderObservable.notifyObservers(this))}},e.prototype.dispose=function(){var e=this._vertexBuffers[wi.PositionKind];e&&(e.dispose(),this._vertexBuffers[wi.PositionKind]=null),this._indexBuffer&&(this._scene.getEngine()._releaseBuffer(this._indexBuffer),this._indexBuffer=null),this.texture&&(this.texture.dispose(),this.texture=null),this.renderTargetTextures=[];var t=this._scene.layers.indexOf(this);this._scene.layers.splice(t,1),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.onAfterRenderObservable.clear(),this.onBeforeRenderObservable.clear()},e}(),m_=function(){function e(e,t,i,n,r){this.size=e,this.position=t,this.alphaMode=a.ALPHA_ONEONE,this.color=i||new N(1,1,1),this.texture=n?new to(n,r.getScene(),!0):null,this._system=r;var o=r.scene.getEngine();this._drawWrapper=new Ht(o),this._drawWrapper.effect=o.createEffect(\"lensFlare\",[wi.PositionKind],[\"color\",\"viewportMatrix\"],[\"textureSampler\"],\"\"),r.lensFlares.push(this)}return e.AddFlare=function(t,i,n,r,o){return new e(t,i,n,r,o)},e.prototype.dispose=function(){this.texture&&this.texture.dispose();var e=this._system.lensFlares.indexOf(this);this._system.lensFlares.splice(e,1)},e}();It.ShadersStore.lensFlarePixelShader=\"varying vec2 vUV;\\nuniform sampler2D textureSampler;\\nuniform vec4 color;\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void) {\\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\\nvec4 baseColor=texture2D(textureSampler,vUV);\\ngl_FragColor=baseColor*color;\\n#define CUSTOM_FRAGMENT_MAIN_END\\n}\";It.ShadersStore.lensFlareVertexShader=\"attribute vec2 position;\\nuniform mat4 viewportMatrix;\\nvarying vec2 vUV;\\nconst vec2 madd=vec2(0.5,0.5);\\n#define CUSTOM_VERTEX_DEFINITIONS\\nvoid main(void) {\\n#define CUSTOM_VERTEX_MAIN_BEGIN\\nvUV=position*madd+madd;\\ngl_Position=viewportMatrix*vec4(position,0.0,1.0);\\n#define CUSTOM_VERTEX_MAIN_END\\n}\";var g_=function(){function e(t,i,n){this.name=t,this.lensFlares=new Array,this.borderLimit=300,this.viewportBorder=0,this.layerMask=268435455,this._vertexBuffers={},this._isEnabled=!0,this._scene=n||S.LastCreatedScene,e._SceneComponentInitialization(this._scene),this._emitter=i,this.id=t,n.lensFlareSystems.push(this),this.meshesSelectionPredicate=function(e){return n.activeCamera&&e.material&&e.isVisible&&e.isEnabled()&&e.isBlocker&&0!=(e.layerMask&n.activeCamera.layerMask)};var r=n.getEngine(),o=[];o.push(1,1),o.push(-1,1),o.push(-1,-1),o.push(1,-1),this._vertexBuffers[wi.PositionKind]=new wi(r,o,wi.PositionKind,!1,!1,2),this._createIndexBuffer()}return Object.defineProperty(e.prototype,\"scene\",{get:function(){return this._scene},enumerable:!1,configurable:!0}),e.prototype._createIndexBuffer=function(){var e=[];e.push(0),e.push(1),e.push(2),e.push(0),e.push(2),e.push(3),this._indexBuffer=this._scene.getEngine().createIndexBuffer(e)},Object.defineProperty(e.prototype,\"isEnabled\",{get:function(){return this._isEnabled},set:function(e){this._isEnabled=e},enumerable:!1,configurable:!0}),e.prototype.getScene=function(){return this._scene},e.prototype.getEmitter=function(){return this._emitter},e.prototype.setEmitter=function(e){this._emitter=e},e.prototype.getEmitterPosition=function(){return this._emitter.getAbsolutePosition?this._emitter.getAbsolutePosition():this._emitter.position},e.prototype.computeEffectivePosition=function(e){var t=this.getEmitterPosition();t=x.Project(t,M.Identity(),this._scene.getTransformMatrix(),e),this._positionX=t.x,this._positionY=t.y,t=x.TransformCoordinates(this.getEmitterPosition(),this._scene.getViewMatrix()),this.viewportBorder>0&&(e.x-=this.viewportBorder,e.y-=this.viewportBorder,e.width+=2*this.viewportBorder,e.height+=2*this.viewportBorder,t.x+=this.viewportBorder,t.y+=this.viewportBorder,this._positionX+=this.viewportBorder,this._positionY+=this.viewportBorder);var i=this._scene.useRightHandedSystem;return!!(t.z>0&&!i||t.z<0&&i)&&(this._positionX>e.x&&this._positionXe.y&&(this._positionY,e.y,e.height),!0)},e.prototype._isVisible=function(){if(!this._isEnabled||!this._scene.activeCamera)return!1;var e=this.getEmitterPosition().subtract(this._scene.activeCamera.globalPosition),t=e.length();e.normalize();var i=new fo(this._scene.activeCamera.globalPosition,e),n=this._scene.pickWithRay(i,this.meshesSelectionPredicate,!0);return!n||!n.hit||n.distance>t},e.prototype.render=function(){if(!this._scene.activeCamera)return!1;var e,t,i=this._scene.getEngine(),n=this._scene.activeCamera.viewport.toGlobal(i.getRenderWidth(!0),i.getRenderHeight(!0));if(!this.computeEffectivePosition(n))return!1;if(!this._isVisible())return!1;var r=(e=this._positionXn.x+n.width-this.borderLimit?this._positionX-n.x-n.width+this.borderLimit:0)>(t=this._positionYn.y+n.height-this.borderLimit?this._positionY-n.y-n.height+this.borderLimit:0)?e:t;(r-=this.viewportBorder)>this.borderLimit&&(r=this.borderLimit);var o=1-h.Clamp(r/this.borderLimit,0,1);if(o<0)return!1;o>1&&(o=1),this.viewportBorder>0&&(n.x+=this.viewportBorder,n.y+=this.viewportBorder,n.width-=2*this.viewportBorder,n.height-=2*this.viewportBorder,this._positionX-=this.viewportBorder,this._positionY-=this.viewportBorder);var s=n.x+n.width/2,l=n.y+n.height/2,c=s-this._positionX,u=l-this._positionY;i.setState(!1),i.setDepthBuffer(!1);for(var d=0;d0);for(var i=0,n=t;i0)}},e}();g_._SceneComponentInitialization=function(e){var t=e._getComponent(zi.NAME_LENSFLARESYSTEM);t||(t=new v_(e),e._addComponent(t))};It.IncludesShadersStore.bayerDitherFunctions=\"float bayerDither2(vec2 _P) {\\nreturn mod(2.0*_P.y+_P.x+1.0,4.0);\\n}\\nfloat bayerDither4(vec2 _P) {\\nvec2 P1=mod(_P,2.0); \\nvec2 P2=floor(0.5*mod(_P,4.0)); \\nreturn 4.0*bayerDither2(P1)+bayerDither2(P2);\\n}\\nfloat bayerDither8(vec2 _P) {\\nvec2 P1=mod(_P,2.0); \\nvec2 P2=floor(0.5 *mod(_P,4.0)); \\nvec2 P4=floor(0.25*mod(_P,8.0)); \\nreturn 4.0*(4.0*bayerDither2(P1)+bayerDither2(P2))+bayerDither2(P4);\\n}\\n\";It.IncludesShadersStore.shadowMapFragmentExtraDeclaration=\"#if SM_FLOAT==0\\n#include\\n#endif\\n#if SM_SOFTTRANSPARENTSHADOW==1\\n#include\\nuniform float softTransparentShadowSM;\\n#endif\\nvarying float vDepthMetricSM;\\n#if SM_USEDISTANCE==1\\nuniform vec3 lightDataSM;\\nvarying vec3 vPositionWSM;\\n#endif\\nuniform vec3 biasAndScaleSM;\\nuniform vec2 depthValuesSM;\\n#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP==1\\nvarying float zSM;\\n#endif\\n\";It.IncludesShadersStore.shadowMapFragment=\"float depthSM=vDepthMetricSM;\\n#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP==1\\n#if SM_USEDISTANCE==1\\ndepthSM=(length(vPositionWSM-lightDataSM)+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x;\\n#else\\n#ifdef USE_REVERSE_DEPTHBUFFER\\ndepthSM=(-zSM+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x;\\n#else\\ndepthSM=(zSM+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x;\\n#endif\\n#endif\\n#ifdef USE_REVERSE_DEPTHBUFFER\\ngl_FragDepth=clamp(1.0-depthSM,0.0,1.0);\\n#else\\ngl_FragDepth=clamp(depthSM,0.0,1.0); \\n#endif\\n#elif SM_USEDISTANCE==1\\ndepthSM=(length(vPositionWSM-lightDataSM)+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x;\\n#endif\\n#if SM_ESM==1\\ndepthSM=clamp(exp(-min(87.,biasAndScaleSM.z*depthSM)),0.,1.);\\n#endif\\n#if SM_FLOAT==1\\ngl_FragColor=vec4(depthSM,1.0,1.0,1.0);\\n#else\\ngl_FragColor=pack(depthSM);\\n#endif\\nreturn;\";It.ShadersStore.shadowMapPixelShader=\"#include\\n#ifdef ALPHATEST\\nvarying vec2 vUV;\\nuniform sampler2D diffuseSampler;\\n#endif\\n#include\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void)\\n{\\n#include\\n#ifdef ALPHATEST\\nfloat alphaFromAlphaTexture=texture2D(diffuseSampler,vUV).a;\\nif (alphaFromAlphaTexture=softTransparentShadowSM*alphaFromAlphaTexture) discard;\\n#else\\nif ((bayerDither8(floor(mod(gl_FragCoord.xy,8.0))))/64.0>=softTransparentShadowSM) discard;\\n#endif\\n#endif\\n#include\\n}\";It.IncludesShadersStore.sceneVertexDeclaration=\"uniform mat4 viewProjection;\\n#ifdef MULTIVIEW\\nuniform mat4 viewProjectionR;\\n#endif\\nuniform mat4 view;\\nuniform mat4 projection;\\nuniform vec4 vEyePosition;\\n\";It.IncludesShadersStore.meshVertexDeclaration=\"uniform mat4 world;\\nuniform float visibility;\\n\";It.IncludesShadersStore.shadowMapVertexDeclaration=\"#include\\n#include\\n\";It.IncludesShadersStore.shadowMapUboDeclaration=\"layout(std140,column_major) uniform;\\n#include\\n#include\\n\";It.IncludesShadersStore.shadowMapVertexExtraDeclaration=\"#if SM_NORMALBIAS==1\\nuniform vec3 lightDataSM;\\n#endif\\nuniform vec3 biasAndScaleSM;\\nuniform vec2 depthValuesSM;\\nvarying float vDepthMetricSM;\\n#if SM_USEDISTANCE==1\\nvarying vec3 vPositionWSM;\\n#endif\\n#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP==1\\nvarying float zSM;\\n#endif\\n\";It.IncludesShadersStore.shadowMapVertexNormalBias=\"#if SM_NORMALBIAS==1\\n#if SM_DIRECTIONINLIGHTDATA==1\\nvec3 worldLightDirSM=normalize(-lightDataSM.xyz);\\n#else\\nvec3 directionToLightSM=lightDataSM.xyz-worldPos.xyz;\\nvec3 worldLightDirSM=normalize(directionToLightSM);\\n#endif\\nfloat ndlSM=dot(vNormalW,worldLightDirSM);\\nfloat sinNLSM=sqrt(1.0-ndlSM*ndlSM);\\nfloat normalBiasSM=biasAndScaleSM.y*sinNLSM;\\nworldPos.xyz-=vNormalW*normalBiasSM;\\n#endif\\n\";It.IncludesShadersStore.shadowMapVertexMetric=\"#if SM_USEDISTANCE==1\\nvPositionWSM=worldPos.xyz;\\n#endif\\n#if SM_DEPTHTEXTURE==1\\n#ifdef IS_NDC_HALF_ZRANGE\\n#define BIASFACTOR 0.5\\n#else\\n#define BIASFACTOR 1.0\\n#endif\\n#ifdef USE_REVERSE_DEPTHBUFFER\\ngl_Position.z-=biasAndScaleSM.x*gl_Position.w*BIASFACTOR;\\n#else\\ngl_Position.z+=biasAndScaleSM.x*gl_Position.w*BIASFACTOR;\\n#endif\\n#endif\\n#if defined(SM_DEPTHCLAMP) && SM_DEPTHCLAMP==1\\nzSM=gl_Position.z;\\ngl_Position.z=0.0;\\n#elif SM_USEDISTANCE==0\\n#ifdef USE_REVERSE_DEPTHBUFFER\\nvDepthMetricSM=(-gl_Position.z+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x;\\n#else\\nvDepthMetricSM=(gl_Position.z+depthValuesSM.x)/depthValuesSM.y+biasAndScaleSM.x;\\n#endif\\n#endif\\n\";It.ShadersStore.shadowMapVertexShader=\"attribute vec3 position;\\n#ifdef NORMAL\\nattribute vec3 normal;\\n#endif\\n#include\\n#include\\n#include\\n#include[0..maxSimultaneousMorphTargets]\\n#ifdef INSTANCES\\nattribute vec4 world0;\\nattribute vec4 world1;\\nattribute vec4 world2;\\nattribute vec4 world3;\\n#endif\\n#include\\n#include<__decl__shadowMapVertex>\\n#ifdef ALPHATEST\\nvarying vec2 vUV;\\nuniform mat4 diffuseMatrix;\\n#ifdef UV1\\nattribute vec2 uv;\\n#endif\\n#ifdef UV2\\nattribute vec2 uv2;\\n#endif\\n#endif\\n#include\\n#include\\n#define CUSTOM_VERTEX_DEFINITIONS\\nvoid main(void)\\n{\\nvec3 positionUpdated=position;\\n#ifdef UV1\\nvec2 uvUpdated=uv;\\n#endif\\n#ifdef NORMAL\\nvec3 normalUpdated=normal;\\n#endif\\n#include\\n#include[0..maxSimultaneousMorphTargets]\\n#include\\n#include\\n#include\\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\\n#ifdef NORMAL\\nmat3 normWorldSM=mat3(finalWorld);\\n#if defined(INSTANCES) && defined(THIN_INSTANCES)\\nvec3 vNormalW=normalUpdated/vec3(dot(normWorldSM[0],normWorldSM[0]),dot(normWorldSM[1],normWorldSM[1]),dot(normWorldSM[2],normWorldSM[2]));\\nvNormalW=normalize(normWorldSM*vNormalW);\\n#else\\n#ifdef NONUNIFORMSCALING\\nnormWorldSM=transposeMat3(inverseMat3(normWorldSM));\\n#endif\\nvec3 vNormalW=normalize(normWorldSM*normalUpdated);\\n#endif\\n#endif\\n#include\\ngl_Position=viewProjection*worldPos;\\n#include\\n#ifdef ALPHATEST\\n#ifdef UV1\\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\\n#endif\\n#ifdef UV2\\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\\n#endif\\n#endif\\n#include\\n}\";It.ShadersStore.depthBoxBlurPixelShader=\"varying vec2 vUV;\\nuniform sampler2D textureSampler;\\nuniform vec2 screenSize;\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void)\\n{\\nvec4 colorDepth=vec4(0.0);\\nfor (int x=-OFFSET; x<=OFFSET; x++)\\nfor (int y=-OFFSET; y<=OFFSET; y++)\\ncolorDepth+=texture2D(textureSampler,vUV+vec2(x,y)/screenSize);\\ngl_FragColor=(colorDepth/float((OFFSET*2+1)*(OFFSET*2+1)));\\n}\";It.IncludesShadersStore.shadowMapFragmentSoftTransparentShadow=\"#if SM_SOFTTRANSPARENTSHADOW==1\\nif ((bayerDither8(floor(mod(gl_FragCoord.xy,8.0))))/64.0>=softTransparentShadowSM*alpha) discard;\\n#endif\\n\";var y_=function(){function e(t,i,n){this.onBeforeShadowMapRenderObservable=new u,this.onAfterShadowMapRenderObservable=new u,this.onBeforeShadowMapRenderMeshObservable=new u,this.onAfterShadowMapRenderMeshObservable=new u,this._bias=5e-5,this._normalBias=0,this._blurBoxOffset=1,this._blurScale=2,this._blurKernel=1,this._useKernelBlur=!1,this._filter=e.FILTER_NONE,this._filteringQuality=e.QUALITY_HIGH,this._contactHardeningLightSizeUVRatio=.1,this._darkness=0,this._transparencyShadow=!1,this.enableSoftTransparentShadow=!1,this.useOpacityTextureForTransparentShadow=!1,this.frustumEdgeFalloff=0,this.forceBackFacesOnly=!1,this._lightDirection=x.Zero(),this._viewMatrix=M.Zero(),this._projectionMatrix=M.Zero(),this._transformMatrix=M.Zero(),this._cachedPosition=new x(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cachedDirection=new x(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._currentFaceIndex=0,this._currentFaceIndexCache=0,this._defaultTextureMatrix=M.Identity(),this._mapSize=t,this._light=i,this._scene=i.getScene(),i._shadowGenerator=this,this.id=i.id,this._useUBO=this._scene.getEngine().supportsUniformBuffers,this._useUBO&&(this._sceneUBOs=[],this._sceneUBOs.push(this._scene.createSceneUniformBuffer('Scene for Shadow Generator (light \"'.concat(this._light.name,'\")')))),e._SceneComponentInitialization(this._scene);var r=this._scene.getEngine().getCaps();n?r.textureFloatRender&&r.textureFloatLinearFiltering?this._textureType=a.TEXTURETYPE_FLOAT:r.textureHalfFloatRender&&r.textureHalfFloatLinearFiltering?this._textureType=a.TEXTURETYPE_HALF_FLOAT:this._textureType=a.TEXTURETYPE_UNSIGNED_INT:r.textureHalfFloatRender&&r.textureHalfFloatLinearFiltering?this._textureType=a.TEXTURETYPE_HALF_FLOAT:r.textureFloatRender&&r.textureFloatLinearFiltering?this._textureType=a.TEXTURETYPE_FLOAT:this._textureType=a.TEXTURETYPE_UNSIGNED_INT,this._initializeGenerator(),this._applyFilterValues()}return Object.defineProperty(e.prototype,\"bias\",{get:function(){return this._bias},set:function(e){this._bias=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"normalBias\",{get:function(){return this._normalBias},set:function(e){this._normalBias=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"blurBoxOffset\",{get:function(){return this._blurBoxOffset},set:function(e){this._blurBoxOffset!==e&&(this._blurBoxOffset=e,this._disposeBlurPostProcesses())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"blurScale\",{get:function(){return this._blurScale},set:function(e){this._blurScale!==e&&(this._blurScale=e,this._disposeBlurPostProcesses())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"blurKernel\",{get:function(){return this._blurKernel},set:function(e){this._blurKernel!==e&&(this._blurKernel=e,this._disposeBlurPostProcesses())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"useKernelBlur\",{get:function(){return this._useKernelBlur},set:function(e){this._useKernelBlur!==e&&(this._useKernelBlur=e,this._disposeBlurPostProcesses())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"depthScale\",{get:function(){return void 0!==this._depthScale?this._depthScale:this._light.getDepthScale()},set:function(e){this._depthScale=e},enumerable:!1,configurable:!0}),e.prototype._validateFilter=function(e){return e},Object.defineProperty(e.prototype,\"filter\",{get:function(){return this._filter},set:function(t){if(t=this._validateFilter(t),this._light.needCube()){if(t===e.FILTER_BLUREXPONENTIALSHADOWMAP)return void(this.useExponentialShadowMap=!0);if(t===e.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP)return void(this.useCloseExponentialShadowMap=!0);if(t===e.FILTER_PCF||t===e.FILTER_PCSS)return void(this.usePoissonSampling=!0)}t!==e.FILTER_PCF&&t!==e.FILTER_PCSS||this._scene.getEngine()._features.supportShadowSamplers?this._filter!==t&&(this._filter=t,this._disposeBlurPostProcesses(),this._applyFilterValues(),this._light._markMeshesAsLightDirty()):this.usePoissonSampling=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"usePoissonSampling\",{get:function(){return this.filter===e.FILTER_POISSONSAMPLING},set:function(t){var i=this._validateFilter(e.FILTER_POISSONSAMPLING);(t||this.filter===e.FILTER_POISSONSAMPLING)&&(this.filter=t?i:e.FILTER_NONE)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"useExponentialShadowMap\",{get:function(){return this.filter===e.FILTER_EXPONENTIALSHADOWMAP},set:function(t){var i=this._validateFilter(e.FILTER_EXPONENTIALSHADOWMAP);(t||this.filter===e.FILTER_EXPONENTIALSHADOWMAP)&&(this.filter=t?i:e.FILTER_NONE)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"useBlurExponentialShadowMap\",{get:function(){return this.filter===e.FILTER_BLUREXPONENTIALSHADOWMAP},set:function(t){var i=this._validateFilter(e.FILTER_BLUREXPONENTIALSHADOWMAP);(t||this.filter===e.FILTER_BLUREXPONENTIALSHADOWMAP)&&(this.filter=t?i:e.FILTER_NONE)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"useCloseExponentialShadowMap\",{get:function(){return this.filter===e.FILTER_CLOSEEXPONENTIALSHADOWMAP},set:function(t){var i=this._validateFilter(e.FILTER_CLOSEEXPONENTIALSHADOWMAP);(t||this.filter===e.FILTER_CLOSEEXPONENTIALSHADOWMAP)&&(this.filter=t?i:e.FILTER_NONE)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"useBlurCloseExponentialShadowMap\",{get:function(){return this.filter===e.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP},set:function(t){var i=this._validateFilter(e.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP);(t||this.filter===e.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP)&&(this.filter=t?i:e.FILTER_NONE)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"usePercentageCloserFiltering\",{get:function(){return this.filter===e.FILTER_PCF},set:function(t){var i=this._validateFilter(e.FILTER_PCF);(t||this.filter===e.FILTER_PCF)&&(this.filter=t?i:e.FILTER_NONE)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"filteringQuality\",{get:function(){return this._filteringQuality},set:function(e){this._filteringQuality!==e&&(this._filteringQuality=e,this._disposeBlurPostProcesses(),this._applyFilterValues(),this._light._markMeshesAsLightDirty())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"useContactHardeningShadow\",{get:function(){return this.filter===e.FILTER_PCSS},set:function(t){var i=this._validateFilter(e.FILTER_PCSS);(t||this.filter===e.FILTER_PCSS)&&(this.filter=t?i:e.FILTER_NONE)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"contactHardeningLightSizeUVRatio\",{get:function(){return this._contactHardeningLightSizeUVRatio},set:function(e){this._contactHardeningLightSizeUVRatio=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"darkness\",{get:function(){return this._darkness},set:function(e){this.setDarkness(e)},enumerable:!1,configurable:!0}),e.prototype.getDarkness=function(){return this._darkness},e.prototype.setDarkness=function(e){return this._darkness=e>=1?1:e<=0?0:e,this},Object.defineProperty(e.prototype,\"transparencyShadow\",{get:function(){return this._transparencyShadow},set:function(e){this.setTransparencyShadow(e)},enumerable:!1,configurable:!0}),e.prototype.setTransparencyShadow=function(e){return this._transparencyShadow=e,this},e.prototype.getShadowMap=function(){return this._shadowMap},e.prototype.getShadowMapForRendering=function(){return this._shadowMap2?this._shadowMap2:this._shadowMap},e.prototype.getClassName=function(){return e.CLASSNAME},e.prototype.addShadowCaster=function(e,t){if(void 0===t&&(t=!0),!this._shadowMap)return this;if(this._shadowMap.renderList||(this._shadowMap.renderList=[]),-1===this._shadowMap.renderList.indexOf(e)&&this._shadowMap.renderList.push(e),t)for(var i=0,n=e.getChildMeshes();i=a.length)return void(e&&e(i));setTimeout(h,16)}};h()}else e&&e(this)}else e&&e(this)}else e&&e(this)},e.prototype.forceCompilationAsync=function(e){var t=this;return new Promise((function(i){t.forceCompilation((function(){i()}),e)}))},e.prototype._isReadyCustomDefines=function(e,t,i){},e.prototype._prepareShadowDefines=function(e,t,i,n){i.push(\"#define SM_FLOAT \"+(this._textureType!==a.TEXTURETYPE_UNSIGNED_INT?\"1\":\"0\")),i.push(\"#define SM_ESM \"+(this.useExponentialShadowMap||this.useBlurExponentialShadowMap?\"1\":\"0\")),i.push(\"#define SM_DEPTHTEXTURE \"+(this.usePercentageCloserFiltering||this.useContactHardeningShadow?\"1\":\"0\"));var r=e.getMesh();return i.push(\"#define SM_NORMALBIAS \"+(this.normalBias&&r.isVerticesDataPresent(wi.NormalKind)?\"1\":\"0\")),i.push(\"#define SM_DIRECTIONINLIGHTDATA \"+(this.getLight().getTypeID()===Cl.LIGHTTYPEID_DIRECTIONALLIGHT?\"1\":\"0\")),i.push(\"#define SM_USEDISTANCE \"+(this._light.needCube()?\"1\":\"0\")),i.push(\"#define SM_SOFTTRANSPARENTSHADOW \"+(this.enableSoftTransparentShadow&&n?\"1\":\"0\")),this._isReadyCustomDefines(i,e,t),i},e.prototype.isReady=function(t,i,n){var r,o=t.getMaterial(),a=null==o?void 0:o.shadowDepthWrapper,s=[];if(this._prepareShadowDefines(t,i,s,n),a){if(!a.isReadyForSubMesh(t,s,this,i,this._scene.getEngine().currentRenderPassId))return!1}else{var l=t._getDrawWrapper(void 0,!0),c=l.effect,u=l.defines,h=[wi.PositionKind],d=t.getMesh();if(this.normalBias&&d.isVerticesDataPresent(wi.NormalKind)&&(h.push(wi.NormalKind),s.push(\"#define NORMAL\"),d.nonUniformScaling&&s.push(\"#define NONUNIFORMSCALING\")),o&&o.needAlphaTesting()){var p=null;if(p=this.useOpacityTextureForTransparentShadow?o.opacityTexture:o.getAlphaTestTexture()){if(!p.isReady())return!1;var f=null!==(r=o.alphaCutOff)&&void 0!==r?r:e.DEFAULT_ALPHA_CUTOFF;s.push(\"#define ALPHATEST\"),s.push(\"#define ALPHATESTVALUE \".concat(f).concat(f%1==0?\".\":\"\")),d.isVerticesDataPresent(wi.UVKind)&&(h.push(wi.UVKind),s.push(\"#define UV1\")),d.isVerticesDataPresent(wi.UV2Kind)&&1===p.coordinatesIndex&&(h.push(wi.UV2Kind),s.push(\"#define UV2\"))}}var _=new ua;if(d.useBones&&d.computeBonesUsingShaders&&d.skeleton){h.push(wi.MatricesIndicesKind),h.push(wi.MatricesWeightsKind),d.numBoneInfluencers>4&&(h.push(wi.MatricesIndicesExtraKind),h.push(wi.MatricesWeightsExtraKind));var m=d.skeleton;s.push(\"#define NUM_BONE_INFLUENCERS \"+d.numBoneInfluencers),d.numBoneInfluencers>0&&_.addCPUSkinningFallback(0,d),m.isUsingTextureForMatrices?s.push(\"#define BONETEXTURE\"):s.push(\"#define BonesPerMesh \"+(m.bones.length+1))}else s.push(\"#define NUM_BONE_INFLUENCERS 0\");var g=d.morphTargetManager,v=0;g&&g.numInfluencers>0&&(s.push(\"#define MORPHTARGETS\"),v=g.numInfluencers,s.push(\"#define NUM_MORPH_INFLUENCERS \"+v),g.isUsingTextureForTargets&&s.push(\"#define MORPHTARGETS_TEXTURE\"),Pr.PrepareAttributesForMorphTargetsInfluencers(h,d,v));var y=this._scene;if(y.clipPlane&&s.push(\"#define CLIPPLANE\"),y.clipPlane2&&s.push(\"#define CLIPPLANE2\"),y.clipPlane3&&s.push(\"#define CLIPPLANE3\"),y.clipPlane4&&s.push(\"#define CLIPPLANE4\"),y.clipPlane5&&s.push(\"#define CLIPPLANE5\"),y.clipPlane6&&s.push(\"#define CLIPPLANE6\"),i&&(s.push(\"#define INSTANCES\"),Pr.PushAttributesForInstances(h),t.getRenderingMesh().hasThinInstances&&s.push(\"#define THIN_INSTANCES\")),this.customShaderOptions&&this.customShaderOptions.defines)for(var b=0,T=this.customShaderOptions.defines;b\\nvarying float vDepthMetric;\\n#ifdef PACKED\\n#include\\n#endif\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void)\\n{\\n#include\\n#ifdef ALPHATEST\\nif (texture2D(diffuseSampler,vUV).a<0.4)\\ndiscard;\\n#endif\\n#ifdef NONLINEARDEPTH\\n#ifdef PACKED\\ngl_FragColor=pack(gl_FragCoord.z);\\n#else\\ngl_FragColor=vec4(gl_FragCoord.z,0.0,0.0,0.0);\\n#endif\\n#else\\n#ifdef PACKED\\ngl_FragColor=pack(vDepthMetric);\\n#else\\ngl_FragColor=vec4(vDepthMetric,0.0,0.0,1.0);\\n#endif\\n#endif\\n}\";It.ShadersStore.depthVertexShader=\"attribute vec3 position;\\n#include\\n#include\\n#include\\n#include[0..maxSimultaneousMorphTargets]\\n#include\\n#include\\nuniform mat4 viewProjection;\\nuniform vec2 depthValues;\\n#if defined(ALPHATEST) || defined(NEED_UV)\\nvarying vec2 vUV;\\nuniform mat4 diffuseMatrix;\\n#ifdef UV1\\nattribute vec2 uv;\\n#endif\\n#ifdef UV2\\nattribute vec2 uv2;\\n#endif\\n#endif\\nvarying float vDepthMetric;\\n#define CUSTOM_VERTEX_DEFINITIONS\\nvoid main(void)\\n{\\nvec3 positionUpdated=position;\\n#ifdef UV1\\nvec2 uvUpdated=uv;\\n#endif\\n#include\\n#include[0..maxSimultaneousMorphTargets]\\n#include\\n#include\\n#include\\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\\n#include\\ngl_Position=viewProjection*worldPos;\\n#ifdef USE_REVERSE_DEPTHBUFFER\\nvDepthMetric=((-gl_Position.z+depthValues.x)/(depthValues.y));\\n#else\\nvDepthMetric=((gl_Position.z+depthValues.x)/(depthValues.y));\\n#endif\\n#if defined(ALPHATEST) || defined(BASIC_RENDER)\\n#ifdef UV1\\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\\n#endif\\n#ifdef UV2\\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\\n#endif\\n#endif\\n}\\n\";var b_=function(){function e(t,i,n,r,o){void 0===i&&(i=a.TEXTURETYPE_FLOAT),void 0===n&&(n=null),void 0===r&&(r=!1),void 0===o&&(o=to.TRILINEAR_SAMPLINGMODE);var s=this;this.enabled=!0,this.forceDepthWriteTransparentMeshes=!1,this.useOnlyInActiveCamera=!1,this._scene=t,this._storeNonLinearDepth=r,this.isPacked=i===a.TEXTURETYPE_UNSIGNED_BYTE,this.isPacked?this._clearColor=new L(1,1,1,1):this._clearColor=new L(1,0,0,1),e._SceneComponentInitialization(this._scene);var l=t.getEngine();this._camera=n,o!==to.NEAREST_SAMPLINGMODE&&(i!==a.TEXTURETYPE_FLOAT||l._caps.textureFloatLinearFiltering||(o=to.NEAREST_SAMPLINGMODE),i!==a.TEXTURETYPE_HALF_FLOAT||l._caps.textureHalfFloatLinearFiltering||(o=to.NEAREST_SAMPLINGMODE));var c=this.isPacked||!l._features.supportExtendedTextureFormats?a.TEXTUREFORMAT_RGBA:a.TEXTUREFORMAT_R;this._depthMap=new Ia(\"DepthRenderer\",{width:l.getRenderWidth(),height:l.getRenderHeight()},this._scene,!1,!0,i,!1,o,void 0,void 0,void 0,c),this._depthMap.wrapU=to.CLAMP_ADDRESSMODE,this._depthMap.wrapV=to.CLAMP_ADDRESSMODE,this._depthMap.refreshRate=1,this._depthMap.renderParticles=!1,this._depthMap.renderList=null,this._depthMap.activeCamera=this._camera,this._depthMap.ignoreCameraViewport=!0,this._depthMap.useCameraPostProcesses=!1,this._depthMap.onClearObservable.add((function(e){e.clear(s._clearColor,!0,!0,!0)})),this._depthMap.onBeforeBindObservable.add((function(){var e;null===(e=l._debugPushGroup)||void 0===e||e.call(l,\"depth renderer\",1)})),this._depthMap.onAfterUnbindObservable.add((function(){var e;null===(e=l._debugPopGroup)||void 0===e||e.call(l,1)})),this._depthMap.customIsReadyFunction=function(e,t){if(!e.isReady(!1))return!1;if(0===t&&e.subMeshes)for(var i=0;i4&&(c.push(wi.MatricesIndicesExtraKind),c.push(wi.MatricesWeightsExtraKind)),l.push(\"#define NUM_BONE_INFLUENCERS \"+r.numBoneInfluencers),l.push(\"#define BonesPerMesh \"+(r.skeleton?r.skeleton.bones.length+1:0));var u=e.getRenderingMesh().skeleton;(null==u?void 0:u.isUsingTextureForMatrices)&&l.push(\"#define BONETEXTURE\")}else l.push(\"#define NUM_BONE_INFLUENCERS 0\");var h=r.morphTargetManager,d=0;h&&h.numInfluencers>0&&(d=h.numInfluencers,l.push(\"#define MORPHTARGETS\"),l.push(\"#define NUM_MORPH_INFLUENCERS \"+d),h.isUsingTextureForTargets&&l.push(\"#define MORPHTARGETS_TEXTURE\"),Pr.PrepareAttributesForMorphTargetsInfluencers(c,r,d)),t&&(l.push(\"#define INSTANCES\"),Pr.PushAttributesForInstances(c),e.getRenderingMesh().hasThinInstances&&l.push(\"#define THIN_INSTANCES\")),this._storeNonLinearDepth&&l.push(\"#define NONLINEARDEPTH\"),this.isPacked&&l.push(\"#define PACKED\"),o.clipPlane&&l.push(\"#define CLIPPLANE\"),o.clipPlane2&&l.push(\"#define CLIPPLANE2\"),o.clipPlane3&&l.push(\"#define CLIPPLANE3\"),o.clipPlane4&&l.push(\"#define CLIPPLANE4\"),o.clipPlane5&&l.push(\"#define CLIPPLANE5\"),o.clipPlane6&&l.push(\"#define CLIPPLANE6\");var p=e._getDrawWrapper(void 0,!0),f=p.defines,_=l.join(\"\\n\");return f!==_&&p.setEffect(n.createEffect(\"depth\",c,[\"world\",\"mBones\",\"boneTextureWidth\",\"viewProjection\",\"diffuseMatrix\",\"depthValues\",\"morphTargetInfluences\",\"morphTargetTextureInfo\",\"morphTargetTextureIndices\",\"vClipPlane\",\"vClipPlane2\",\"vClipPlane3\",\"vClipPlane4\",\"vClipPlane5\",\"vClipPlane6\"],[\"diffuseSampler\",\"morphTargets\",\"boneSampler\"],_,void 0,void 0,void 0,{maxSimultaneousMorphTargets:d}),_),p.effect.isReady()},e.prototype.getDepthMap=function(){return this._depthMap},e.prototype.dispose=function(){var e=[];for(var t in this._scene._depthRenderer)this._scene._depthRenderer[t]===this&&e.push(t);if(e.length>0){this._depthMap.dispose();for(var i=0,n=e;i1||c>1;){l=Math.max(Math.round(l/2),1),c=Math.max(Math.round(c/2),1);var h=new pa(\"Reduction phase \"+u,\"minmaxRedux\",[\"texSize\"],null,{width:l,height:c},null,a.TEXTURE_NEAREST_NEAREST,o.getEngine(),!1,\"#define \"+(1==l&&1==c?\"LAST\":1==l||1==c?\"ONEBEFORELAST\":\"MAIN\"),i,void 0,void 0,void 0,a.TEXTUREFORMAT_RG);h.autoClear=!1,h.forceFullscreenViewport=n,h.onApply=function(e,t){return function(i){1==e||1==t?i.setInt2(\"texSize\",e,t):i.setFloat2(\"texSize\",e,t)}}(l,c),this._reductionSteps.push(h),u++,1==l&&1==c&&h.onAfterRenderObservable.add(function(e,t,i){var n=new Float32Array(4*e*t),a={min:0,max:0};return function(){o.getEngine()._readTexturePixels(i.inputTexture.texture,e,t,-1,0,n,!1),a.min=n[0],a.max=n[1],r.onAfterReductionPerformed.notifyObservers(a)}}(l,c,h))}}},Object.defineProperty(e.prototype,\"refreshRate\",{get:function(){return this._sourceTexture?this._sourceTexture.refreshRate:-1},set:function(e){this._sourceTexture&&(this._sourceTexture.refreshRate=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"activated\",{get:function(){return this._activated},enumerable:!1,configurable:!0}),e.prototype.activate=function(){var e=this;!this._onAfterUnbindObserver&&this._sourceTexture&&(this._onAfterUnbindObserver=this._sourceTexture.onAfterUnbindObservable.add((function(){var t,i,n=e._camera.getScene().getEngine();null===(t=n._debugPushGroup)||void 0===t||t.call(n,\"min max reduction\",1),e._reductionSteps[0].activate(e._camera),e._postProcessManager.directRender(e._reductionSteps,e._reductionSteps[0].inputTexture,e._forceFullscreenViewport),n.unBindFramebuffer(e._reductionSteps[0].inputTexture,!1),null===(i=n._debugPopGroup)||void 0===i||i.call(n,1)})),this._activated=!0)},e.prototype.deactivate=function(){this._onAfterUnbindObserver&&this._sourceTexture&&(this._sourceTexture.onAfterUnbindObservable.remove(this._onAfterUnbindObserver),this._onAfterUnbindObserver=null,this._activated=!1)},e.prototype.dispose=function(e){if(void 0===e&&(e=!0),e&&(this.onAfterReductionPerformed.clear(),this._onContextRestoredObserver&&(this._camera.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver),this._onContextRestoredObserver=null)),this.deactivate(),this._reductionSteps){for(var t=0;tt&&(e=0,t=1),e<0&&(e=0),t>1&&(t=1),this._minDistance=e,this._maxDistance=t,this._breaksAreDirty=!0)},Object.defineProperty(t.prototype,\"minDistance\",{get:function(){return this._minDistance},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"maxDistance\",{get:function(){return this._maxDistance},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return t.CLASSNAME},t.prototype.getCascadeMinExtents=function(e){return e>=0&&e=0&&ethis._scene.activeCamera.maxZ||(this._shadowMaxZ=e,this._light._markMeshesAsLightDirty(),this._breaksAreDirty=!0):this._shadowMaxZ=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"debug\",{get:function(){return this._debug},set:function(e){this._debug=e,this._light._markMeshesAsLightDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"depthClamp\",{get:function(){return this._depthClamp},set:function(e){this._depthClamp=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"cascadeBlendPercentage\",{get:function(){return this._cascadeBlendPercentage},set:function(e){this._cascadeBlendPercentage=e,this._light._markMeshesAsLightDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"lambda\",{get:function(){return this._lambda},set:function(e){var t=Math.min(Math.max(e,0),1);this._lambda!=t&&(this._lambda=t,this._breaksAreDirty=!0)},enumerable:!1,configurable:!0}),t.prototype.getCascadeViewMatrix=function(e){return e>=0&&e=0&&e=0&&e=n&&(i=0,n=1),i==t._minDistance&&n==t._maxDistance||t.setMinMaxDistance(i,n)})),this._depthReducer.setDepthRenderer(this._depthRenderer)),this._depthReducer.activate()}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"autoCalcDepthBoundsRefreshRate\",{get:function(){var e,t,i;return null!==(i=null===(t=null===(e=this._depthReducer)||void 0===e?void 0:e.depthRenderer)||void 0===t?void 0:t.getDepthMap().refreshRate)&&void 0!==i?i:-1},set:function(e){var t;(null===(t=this._depthReducer)||void 0===t?void 0:t.depthRenderer)&&(this._depthReducer.depthRenderer.getDepthMap().refreshRate=e)},enumerable:!1,configurable:!0}),t.prototype.splitFrustum=function(){this._breaksAreDirty=!0},t.prototype._splitFrustum=function(){var e=this._scene.activeCamera;if(e){for(var t=e.minZ,i=e.maxZ,n=i-t,r=this._minDistance,o=t+r*n,a=t+(this._shadowMaxZ=t?Math.min((this._shadowMaxZ-t)/(i-t),this._maxDistance):this._maxDistance)*n,s=a-o,l=a/o,c=0;cMath.PI;)r-=2*Math.PI;var a=r/Math.PI,s=o/Math.PI;a=.5*a+.5;var l=Math.round(a*i);l<0?l=0:l>=i&&(l=i-1);var c=Math.round(s*n);c<0?c=0:c>=n&&(c=n-1);var u=n-c-1;return{r:t[u*i*3+3*l+0],g:t[u*i*3+3*l+1],b:t[u*i*3+3*l+2]}},e.FACE_LEFT=[new x(-1,-1,-1),new x(1,-1,-1),new x(-1,1,-1),new x(1,1,-1)],e.FACE_RIGHT=[new x(1,-1,1),new x(-1,-1,1),new x(1,1,1),new x(-1,1,1)],e.FACE_FRONT=[new x(1,-1,-1),new x(1,-1,1),new x(1,1,-1),new x(1,1,1)],e.FACE_BACK=[new x(-1,-1,1),new x(-1,-1,-1),new x(-1,1,1),new x(-1,1,-1)],e.FACE_DOWN=[new x(1,1,-1),new x(1,1,1),new x(-1,1,-1),new x(-1,1,1)],e.FACE_UP=[new x(-1,-1,-1),new x(-1,-1,1),new x(1,-1,-1),new x(1,-1,1)],e}(),N_=function(){function e(){}return e._Ldexp=function(e,t){return t>1023?e*Math.pow(2,1023)*Math.pow(2,t-1023):t<-1074?e*Math.pow(2,-1074)*Math.pow(2,t+1074):e*Math.pow(2,t)},e._Rgbe2float=function(e,t,i,n,r,o){r>0?(r=this._Ldexp(1,r-136),e[o+0]=t*r,e[o+1]=i*r,e[o+2]=n*r):(e[o+0]=0,e[o+1]=0,e[o+2]=0)},e._ReadStringLine=function(e,t){for(var i=\"\",n=\"\",r=t;r32767)throw\"HDR Bad header format, unsupported size\";return{height:t,width:i,dataPosition:a+=n.length+1}},e.GetCubeMapTextureData=function(e,t){var i=new Uint8Array(e),n=this.RGBE_ReadHeader(i),r=this.RGBE_ReadPixels(i,n);return D_.ConvertPanoramaToCubemap(r,n.width,n.height,t)},e.RGBE_ReadPixels=function(e,t){return this._RGBEReadPixelsRLE(e,t)},e._RGBEReadPixelsRLE=function(e,t){for(var i,n,r,o,a,s=t.height,l=t.width,c=t.dataPosition,u=0,h=0,d=0,p=new ArrayBuffer(4*l),f=new Uint8Array(p),_=new ArrayBuffer(t.width*t.height*4*3),m=new Float32Array(_);s>0;){if(i=e[c++],n=e[c++],r=e[c++],o=e[c++],2!=i||2!=n||128&r||t.width<8||t.width>32767)return this._RGBEReadPixelsNOTRLE(e,t);if((r<<8|o)!=l)throw\"HDR Bad header format, wrong scan line width\";for(u=0,d=0;d<4;d++)for(h=(d+1)*l;u128){if(0==(a=i-128)||a>h-u)throw\"HDR Bad Format, bad scanline data (run)\";for(;a-- >0;)f[u++]=n}else{if(0==(a=i)||a>h-u)throw\"HDR Bad Format, bad scanline data (non-run)\";if(f[u++]=n,--a>0)for(var g=0;g0;){for(a=0;a\\n#include\\n#include\\n#include\\nuniform float alphaG;\\nuniform samplerCube inputTexture;\\nuniform vec2 vFilteringInfo;\\nuniform float hdrScale;\\nvarying vec3 direction;\\nvoid main() {\\nvec3 color=radiance(alphaG,inputTexture,direction,vFilteringInfo);\\ngl_FragColor=vec4(color*hdrScale,1.0);\\n}\";var w_=function(){function e(e,t){void 0===t&&(t={}),this._lodGenerationOffset=0,this._lodGenerationScale=.8,this.quality=a.TEXTURE_FILTERING_QUALITY_OFFLINE,this.hdrScale=1,this._engine=e,this.hdrScale=t.hdrScale||this.hdrScale,this.quality=t.quality||this.quality}return e.prototype._createRenderTarget=function(e){var t=a.TEXTURETYPE_UNSIGNED_BYTE;this._engine.getCaps().textureHalfFloatRender?t=a.TEXTURETYPE_HALF_FLOAT:this._engine.getCaps().textureFloatRender&&(t=a.TEXTURETYPE_FLOAT);var i=this._engine.createRenderTargetCubeTexture(e,{format:a.TEXTUREFORMAT_RGBA,type:t,createMipMaps:!0,generateMipMaps:!1,generateDepthBuffer:!1,generateStencilBuffer:!1,samplingMode:a.TEXTURE_NEAREST_SAMPLINGMODE});return this._engine.updateTextureWrappingMode(i.texture,a.TEXTURE_CLAMP_ADDRESSMODE,a.TEXTURE_CLAMP_ADDRESSMODE,a.TEXTURE_CLAMP_ADDRESSMODE),this._engine.updateTextureSamplingMode(a.TEXTURE_TRILINEAR_SAMPLINGMODE,i.texture,!0),i},e.prototype._prefilterInternal=function(e){var t=e.getSize().width,i=h.ILog2(t)+1,n=this._effectWrapper.effect,r=this._createRenderTarget(t);this._effectRenderer.setViewport();var o=e.getInternalTexture();o&&this._engine.updateTextureSamplingMode(a.TEXTURE_TRILINEAR_SAMPLINGMODE,o,!0),this._effectRenderer.applyEffectWrapper(this._effectWrapper);var s=[[new x(0,0,-1),new x(0,-1,0),new x(1,0,0)],[new x(0,0,1),new x(0,-1,0),new x(-1,0,0)],[new x(1,0,0),new x(0,0,1),new x(0,1,0)],[new x(1,0,0),new x(0,0,-1),new x(0,-1,0)],[new x(1,0,0),new x(0,-1,0),new x(0,0,1)],[new x(-1,0,0),new x(0,-1,0),new x(0,0,-1)]];n.setFloat(\"hdrScale\",this.hdrScale),n.setFloat2(\"vFilteringInfo\",e.getSize().width,i),n.setTexture(\"inputTexture\",e);for(var l=0;l<6;l++){n.setVector3(\"up\",s[l][0]),n.setVector3(\"right\",s[l][1]),n.setVector3(\"front\",s[l][2]);for(var c=0;c255){var v=255/g;f*=v,_*=v,m*=v}l[3*p+0]=f,l[3*p+1]=_,l[3*p+2]=m}c?s.push(c):l?s.push(l):s.push(h)}return s}),null,this._onLoad,this._onError)},t.prototype.clone=function(){var e=new t(this.url,this.getScene()||this._getEngine(),this._size,this._noMipmap,this._generateHarmonics,this.gammaSpace);return e.level=this.level,e.wrapU=this.wrapU,e.wrapV=this.wrapV,e.coordinatesIndex=this.coordinatesIndex,e.coordinatesMode=this.coordinatesMode,e},t.prototype.delayLoad=function(){this.delayLoadState===a.DELAYLOADSTATE_NOTLOADED&&(this.delayLoadState=a.DELAYLOADSTATE_LOADED,this._texture=this._getFromCache(this.url,this._noMipmap),this._texture||this._loadTexture())},t.prototype.getReflectionTextureMatrix=function(){return this._textureMatrix},t.prototype.setReflectionTextureMatrix=function(e){var t,i=this;this._textureMatrix=e,e.updateFlag!==this._textureMatrix.updateFlag&&e.isIdentity()!==this._textureMatrix.isIdentity()&&(null===(t=this.getScene())||void 0===t||t.markAllMaterialsAsDirty(a.MATERIAL_TextureDirtyFlag,(function(e){return-1!==e.getActiveTextures().indexOf(i)})))},t.prototype.dispose=function(){this.onLoadObservable.clear(),e.prototype.dispose.call(this)},t.Parse=function(e,i,n){var r=null;return e.name&&!e.isRenderTarget&&((r=new t(n+e.name,i,e.size,e.noMipmap,e.generateHarmonics,e.useInGammaSpace)).name=e.name,r.hasAlpha=e.hasAlpha,r.level=e.level,r.coordinatesMode=e.coordinatesMode,r.isBlocking=e.isBlocking),r&&(e.boundingBoxPosition&&(r.boundingBoxPosition=x.FromArray(e.boundingBoxPosition)),e.boundingBoxSize&&(r.boundingBoxSize=x.FromArray(e.boundingBoxSize)),e.rotationY&&(r.rotationY=e.rotationY)),r},t.prototype.serialize=function(){if(!this.name)return null;var e={};return e.name=this.name,e.hasAlpha=this.hasAlpha,e.isCube=!0,e.level=this.level,e.size=this._size,e.coordinatesMode=this.coordinatesMode,e.useInGammaSpace=this.gammaSpace,e.generateHarmonics=this._generateHarmonics,e.customType=\"BABYLON.HDRCubeTexture\",e.noMipmap=this._noMipmap,e.isBlocking=this._isBlocking,e.rotationY=this._rotationY,e},t._FacesMapping=[\"right\",\"left\",\"up\",\"down\",\"front\",\"back\"],t}(qr);b(\"BABYLON.HDRCubeTexture\",B_);var U_=function(){function e(e,t,i){void 0===t&&(t=0),void 0===i&&(i=null),this.name=e,this.animations=new Array,this._positions=null,this._normals=null,this._tangents=null,this._uvs=null,this._uniqueId=0,this.onInfluenceChanged=new u,this._onDataLayoutChanged=new u,this._animationPropertiesOverride=null,this._scene=i||S.LastCreatedScene,this.influence=t,this._scene&&(this._uniqueId=this._scene.getUniqueId())}return Object.defineProperty(e.prototype,\"influence\",{get:function(){return this._influence},set:function(e){if(this._influence!==e){var t=this._influence;this._influence=e,this.onInfluenceChanged.hasObservers()&&this.onInfluenceChanged.notifyObservers(0===t||0===e)}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"animationPropertiesOverride\",{get:function(){return!this._animationPropertiesOverride&&this._scene?this._scene.animationPropertiesOverride:this._animationPropertiesOverride},set:function(e){this._animationPropertiesOverride=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"uniqueId\",{get:function(){return this._uniqueId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"hasPositions\",{get:function(){return!!this._positions},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"hasNormals\",{get:function(){return!!this._normals},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"hasTangents\",{get:function(){return!!this._tangents},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"hasUVs\",{get:function(){return!!this._uvs},enumerable:!1,configurable:!0}),e.prototype.setPositions=function(e){var t=this.hasPositions;this._positions=e,t!==this.hasPositions&&this._onDataLayoutChanged.notifyObservers(void 0)},e.prototype.getPositions=function(){return this._positions},e.prototype.setNormals=function(e){var t=this.hasNormals;this._normals=e,t!==this.hasNormals&&this._onDataLayoutChanged.notifyObservers(void 0)},e.prototype.getNormals=function(){return this._normals},e.prototype.setTangents=function(e){var t=this.hasTangents;this._tangents=e,t!==this.hasTangents&&this._onDataLayoutChanged.notifyObservers(void 0)},e.prototype.getTangents=function(){return this._tangents},e.prototype.setUVs=function(e){var t=this.hasUVs;this._uvs=e,t!==this.hasUVs&&this._onDataLayoutChanged.notifyObservers(void 0)},e.prototype.getUVs=function(){return this._uvs},e.prototype.clone=function(){var t=this,i=Le.Clone((function(){return new e(t.name,t.influence,t._scene)}),this);return i._positions=this._positions,i._normals=this._normals,i._tangents=this._tangents,i._uvs=this._uvs,i},e.prototype.serialize=function(){var e={};return e.name=this.name,e.influence=this.influence,e.positions=Array.prototype.slice.call(this.getPositions()),null!=this.id&&(e.id=this.id),this.hasNormals&&(e.normals=Array.prototype.slice.call(this.getNormals())),this.hasTangents&&(e.tangents=Array.prototype.slice.call(this.getTangents())),this.hasUVs&&(e.uvs=Array.prototype.slice.call(this.getUVs())),Le.AppendSerializedAnimations(this,e),e},e.prototype.getClassName=function(){return\"MorphTarget\"},e.Parse=function(t,i){var n=new e(t.name,t.influence);if(n.setPositions(t.positions),null!=t.id&&(n.id=t.id),t.normals&&n.setNormals(t.normals),t.tangents&&n.setTangents(t.tangents),t.uvs&&n.setUVs(t.uvs),t.animations){for(var r=0;r0&&t.texture2DArrayMaxLayerCount>1}}return Object.defineProperty(e.prototype,\"areUpdatesFrozen\",{get:function(){return this._blockCounter>0},set:function(e){e?this._blockCounter++:(this._blockCounter--,this._blockCounter<=0&&(this._blockCounter=0,this._syncActiveTargets(!0)))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"uniqueId\",{get:function(){return this._uniqueId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"vertexCount\",{get:function(){return this._vertexCount},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"supportsNormals\",{get:function(){return this._supportsNormals&&this.enableNormalMorphing},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"supportsTangents\",{get:function(){return this._supportsTangents&&this.enableTangentMorphing},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"supportsUVs\",{get:function(){return this._supportsUVs&&this.enableUVMorphing},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"numTargets\",{get:function(){return this._targets.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"numInfluencers\",{get:function(){return this._activeTargets.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"influences\",{get:function(){return this._influences},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"useTextureToStoreTargets\",{get:function(){return this._useTextureToStoreTargets},set:function(e){this._useTextureToStoreTargets=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"isUsingTextureForTargets\",{get:function(){return e.EnableTextureStorage&&this.useTextureToStoreTargets&&this._canUseTextureForTargets},enumerable:!1,configurable:!0}),e.prototype.getActiveTarget=function(e){return this._activeTargets.data[e]},e.prototype.getTarget=function(e){return this._targets[e]},e.prototype.addTarget=function(e){var t=this;this._targets.push(e),this._targetInfluenceChangedObservers.push(e.onInfluenceChanged.add((function(e){t._syncActiveTargets(e)}))),this._targetDataLayoutChangedObservers.push(e._onDataLayoutChanged.add((function(){t._syncActiveTargets(!0)}))),this._syncActiveTargets(!0)},e.prototype.removeTarget=function(e){var t=this._targets.indexOf(e);t>=0&&(this._targets.splice(t,1),e.onInfluenceChanged.remove(this._targetInfluenceChangedObservers.splice(t,1)[0]),e._onDataLayoutChanged.remove(this._targetDataLayoutChangedObservers.splice(t,1)[0]),this._syncActiveTargets(!0))},e.prototype._bind=function(e){e.setFloat3(\"morphTargetTextureInfo\",this._textureVertexStride,this._textureWidth,this._textureHeight),e.setFloatArray(\"morphTargetTextureIndices\",this._morphTargetTextureIndices),e.setTexture(\"morphTargets\",this._targetStoreTexture)},e.prototype.clone=function(){for(var t=new e(this._scene),i=0,n=this._targets;ie&&(this._textureHeight=Math.ceil(this._textureWidth/e),this._textureWidth=e);var t=!0;if(this._targetStoreTexture){var i=this._targetStoreTexture.getSize();i.width===this._textureWidth&&i.height===this._textureHeight&&this._targetStoreTexture.depth===this._targets.length&&(t=!1)}if(t){this._targetStoreTexture&&this._targetStoreTexture.dispose();for(var n=this._targets.length,r=new Float32Array(n*this._textureWidth*this._textureHeight*4),o=0,s=0;s-1&&this._parentContainer.morphTargetManagers.splice(e,1),this._parentContainer=null}},e.Parse=function(t,i){var n=new e(i);n._uniqueId=t.id;for(var r=0,o=t.targets;r-1&&this._impostors.splice(t,1).length&&this.getPhysicsPlugin().removePhysicsBody(e)},e.prototype.addJoint=function(e,t,i){var n={mainImpostor:e,connectedImpostor:t,joint:i};i.physicsPlugin=this._physicsPlugin,this._joints.push(n),this._physicsPlugin.generateJoint(n)},e.prototype.removeJoint=function(e,t,i){var n=this._joints.filter((function(n){return n.connectedImpostor===t&&n.joint===i&&n.mainImpostor===e}));n.length&&this._physicsPlugin.removeJoint(n[0])},e.prototype._step=function(e){var t=this;this._impostors.forEach((function(e){e.isBodyInitRequired()&&t._physicsPlugin.generatePhysicsBody(e)})),e>.1?e=.1:e<=0&&(e=1/60),this._physicsPlugin.executeStep(e,this._impostors)},e.prototype.getPhysicsPlugin=function(){return this._physicsPlugin},e.prototype.getImpostors=function(){return this._impostors},e.prototype.getImpostorForPhysicsObject=function(e){for(var t=0;t0&&(this._physicsBodiesToRemoveAfterStep.forEach((function(t){\"function\"==typeof e.world.removeBody?e.world.removeBody(t):e.world.remove(t)})),this._physicsBodiesToRemoveAfterStep.length=0)},e.prototype.applyImpulse=function(e,t,i){var n=new this.BJSCANNON.Vec3(i.x,i.y,i.z),r=new this.BJSCANNON.Vec3(t.x,t.y,t.z);e.physicsBody.applyImpulse(r,n)},e.prototype.applyForce=function(e,t,i){var n=new this.BJSCANNON.Vec3(i.x,i.y,i.z),r=new this.BJSCANNON.Vec3(t.x,t.y,t.z);e.physicsBody.applyForce(r,n)},e.prototype.generatePhysicsBody=function(e){if(this._removeMarkedPhysicsBodiesFromWorld(),e.parent)e.physicsBody&&(this.removePhysicsBody(e),e.forceUpdate());else{if(e.isBodyInitRequired()){var t=this._createShape(e);if(!t)return void Q.Warn(\"It was not possible to create a physics body for this object.\");var i=e.physicsBody;i&&this.removePhysicsBody(e);var n=this._addMaterial(\"mat-\"+e.uniqueId,e.getParam(\"friction\"),e.getParam(\"restitution\")),r={mass:e.getParam(\"mass\"),material:n},o=e.getParam(\"nativeOptions\");for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(r[a]=o[a]);e.physicsBody=new this.BJSCANNON.Body(r),e.physicsBody.addEventListener(\"collide\",e.onCollide),this.world.addEventListener(\"preStep\",e.beforeStep),this.world.addEventListener(\"postStep\",e.afterStep),e.physicsBody.addShape(t),\"function\"==typeof this.world.addBody?this.world.addBody(e.physicsBody):this.world.add(e.physicsBody),i&&[\"force\",\"torque\",\"velocity\",\"angularVelocity\"].forEach((function(t){var n=i[t];e.physicsBody[t].set(n.x,n.y,n.z)})),this._processChildMeshes(e)}this._updatePhysicsBodyTransformation(e)}},e.prototype._processChildMeshes=function(e){var t=this,i=e.object.getChildMeshes?e.object.getChildMeshes(!0):[],n=e.object.rotationQuaternion;if(n?n.conjugateToRef(this._tmpQuaternion):this._tmpQuaternion.set(0,0,0,1),i.length){var r=function(i){if(i.rotationQuaternion){var n=i.getPhysicsImpostor();if(n&&n.parent!==e&&i.parent){var o=i.getAbsolutePosition().subtract(i.parent.getAbsolutePosition()),a=i.rotationQuaternion.multiply(t._tmpQuaternion);n.physicsBody&&(t.removePhysicsBody(n),n.physicsBody=null),n.parent=e,n.resetUpdateFlags(),e.physicsBody.addShape(t._createShape(n),new t.BJSCANNON.Vec3(o.x,o.y,o.z),new t.BJSCANNON.Quaternion(a.x,a.y,a.z,a.w)),e.physicsBody.mass+=n.getParam(\"mass\")}i.getChildMeshes(!0).filter((function(e){return!!e.physicsImpostor})).forEach(r)}};i.filter((function(e){return!!e.physicsImpostor})).forEach(r)}},e.prototype.removePhysicsBody=function(e){e.physicsBody.removeEventListener(\"collide\",e.onCollide),this.world.removeEventListener(\"preStep\",e.beforeStep),this.world.removeEventListener(\"postStep\",e.afterStep),-1===this._physicsBodiesToRemoveAfterStep.indexOf(e.physicsBody)&&this._physicsBodiesToRemoveAfterStep.push(e.physicsBody)},e.prototype.generateJoint=function(e){var t=e.mainImpostor.physicsBody,i=e.connectedImpostor.physicsBody;if(t&&i){var n,r=e.joint.jointData,o={pivotA:r.mainPivot?(new this.BJSCANNON.Vec3).set(r.mainPivot.x,r.mainPivot.y,r.mainPivot.z):null,pivotB:r.connectedPivot?(new this.BJSCANNON.Vec3).set(r.connectedPivot.x,r.connectedPivot.y,r.connectedPivot.z):null,axisA:r.mainAxis?(new this.BJSCANNON.Vec3).set(r.mainAxis.x,r.mainAxis.y,r.mainAxis.z):null,axisB:r.connectedAxis?(new this.BJSCANNON.Vec3).set(r.connectedAxis.x,r.connectedAxis.y,r.connectedAxis.z):null,maxForce:r.nativeParams.maxForce,collideConnected:!!r.collision};switch(e.joint.type){case Mo.HingeJoint:case Mo.Hinge2Joint:n=new this.BJSCANNON.HingeConstraint(t,i,o);break;case Mo.DistanceJoint:n=new this.BJSCANNON.DistanceConstraint(t,i,r.maxDistance||2);break;case Mo.SpringJoint:var a=r;n=new this.BJSCANNON.Spring(t,i,{restLength:a.length,stiffness:a.stiffness,damping:a.damping,localAnchorA:o.pivotA,localAnchorB:o.pivotB});break;case Mo.LockJoint:n=new this.BJSCANNON.LockConstraint(t,i,o);break;case Mo.PointToPointJoint:case Mo.BallAndSocketJoint:default:n=new this.BJSCANNON.PointToPointConstraint(t,o.pivotA,i,o.pivotB,o.maxForce)}n.collideConnected=!!r.collision,e.joint.physicsJoint=n,e.joint.type!==Mo.SpringJoint?this.world.addConstraint(n):(e.joint.jointData.forceApplicationCallback=e.joint.jointData.forceApplicationCallback||function(){n.applyForce()},e.mainImpostor.registerAfterPhysicsStep(e.joint.jointData.forceApplicationCallback))}},e.prototype.removeJoint=function(e){e.joint.type!==Mo.SpringJoint?this.world.removeConstraint(e.joint.physicsJoint):e.mainImpostor.unregisterAfterPhysicsStep(e.joint.jointData.forceApplicationCallback)},e.prototype._addMaterial=function(e,t,i){var n,r;for(n=0;n1e3*i));s++);this.time+=n;for(var l=this.time%i/i,c=e,u=this.bodies,h=0;h!==u.length;h++){var d=u[h];d.type!==t.Body.STATIC&&d.sleepState!==t.Body.SLEEPING?(d.position.vsub(d.previousPosition,c),c.scale(l,c),d.position.vadd(c,d.interpolatedPosition)):(d.interpolatedPosition.set(d.position.x,d.position.y,d.position.z),d.interpolatedQuaternion.set(d.quaternion.x,d.quaternion.y,d.quaternion.z,d.quaternion.w))}}}},e.prototype.raycast=function(e,t){return this._cannonRaycastResult.reset(),this.world.raycastClosest(e,t,{},this._cannonRaycastResult),this._raycastResult.reset(e,t),this._cannonRaycastResult.hasHit&&(this._raycastResult.setHitData({x:this._cannonRaycastResult.hitNormalWorld.x,y:this._cannonRaycastResult.hitNormalWorld.y,z:this._cannonRaycastResult.hitNormalWorld.z},{x:this._cannonRaycastResult.hitPointWorld.x,y:this._cannonRaycastResult.hitPointWorld.y,z:this._cannonRaycastResult.hitPointWorld.z}),this._raycastResult.setHitDistance(this._cannonRaycastResult.distance)),this._raycastResult},e}();G_.DefaultPluginFactory=function(){return new W_};var H_=function(){function e(e,t,i){void 0===e&&(e=!0),void 0===i&&(i=OIMO),this._useDeltaForWorldStep=e,this.name=\"OimoJSPlugin\",this._fixedTimeStep=1/60,this._tmpImpostorsArray=[],this._tmpPositionVector=x.Zero(),this.BJSOIMO=i,this.world=new this.BJSOIMO.World({iterations:t}),this.world.clear(),this._raycastResult=new z_}return e.prototype.setGravity=function(e){this.world.gravity.set(e.x,e.y,e.z)},e.prototype.setTimeStep=function(e){this.world.timeStep=e},e.prototype.getTimeStep=function(){return this.world.timeStep},e.prototype.executeStep=function(e,t){var i=this;t.forEach((function(e){e.beforeStep()})),this.world.timeStep=this._useDeltaForWorldStep?e:this._fixedTimeStep,this.world.step(),t.forEach((function(e){e.afterStep(),i._tmpImpostorsArray[e.uniqueId]=e}));for(var n=this.world.contacts;null!==n;)if(!n.touching||n.body1.sleeping||n.body2.sleeping){var r=this._tmpImpostorsArray[+n.body1.name],o=this._tmpImpostorsArray[+n.body2.name];r&&o?(r.onCollide({body:o.physicsBody,point:null,distance:0,impulse:0,normal:null}),o.onCollide({body:r.physicsBody,point:null,distance:0,impulse:0,normal:null}),n=n.next):n=n.next}else n=n.next},e.prototype.applyImpulse=function(e,t,i){var n=e.physicsBody.mass;e.physicsBody.applyImpulse(i.scale(this.world.invScale),t.scale(this.world.invScale*n))},e.prototype.applyForce=function(e,t,i){Q.Warn(\"Oimo doesn't support applying force. Using impulse instead.\"),this.applyImpulse(e,t,i)},e.prototype.generatePhysicsBody=function(e){var t=this;if(e.parent)e.physicsBody&&(this.removePhysicsBody(e),e.forceUpdate());else{if(e.isBodyInitRequired()){var i={name:e.uniqueId,config:[e.getParam(\"mass\")||.001,e.getParam(\"friction\"),e.getParam(\"restitution\")],size:[],type:[],pos:[],posShape:[],rot:[],rotShape:[],move:0!==e.getParam(\"mass\"),density:e.getParam(\"mass\"),friction:e.getParam(\"friction\"),restitution:e.getParam(\"restitution\"),world:this.world},n=[e];(a=e.object).getChildMeshes&&a.getChildMeshes().forEach((function(e){e.physicsImpostor&&n.push(e.physicsImpostor)}));var r=function(e){return Math.max(e,G_.Epsilon)},o=new P;n.forEach((function(n){if(n.object.rotationQuaternion){var a=n.object.rotationQuaternion;o.copyFrom(a),n.object.rotationQuaternion.set(0,0,0,1),n.object.computeWorldMatrix(!0);var s=o.toEulerAngles(),l=n.getObjectExtents(),c=57.29577951308232;if(n===e){var u=e.getObjectCenter();e.object.getAbsolutePivotPoint().subtractToRef(u,t._tmpPositionVector),t._tmpPositionVector.divideInPlace(e.object.scaling),i.pos.push(u.x),i.pos.push(u.y),i.pos.push(u.z),i.posShape.push(0,0,0),i.rotShape.push(0,0,0)}else{var h=n.object.position.clone();i.posShape.push(h.x),i.posShape.push(h.y),i.posShape.push(h.z),i.rotShape.push(s.x*c,s.y*c,s.z*c)}switch(n.object.rotationQuaternion.copyFrom(o),n.type){case Fo.ParticleImpostor:Q.Warn(\"No Particle support in OIMO.js. using SphereImpostor instead\");case Fo.SphereImpostor:var d=l.x,p=l.y,f=l.z,_=Math.max(r(d),r(p),r(f))/2;i.type.push(\"sphere\"),i.size.push(_),i.size.push(_),i.size.push(_);break;case Fo.CylinderImpostor:var m=r(l.x)/2,g=r(l.y);i.type.push(\"cylinder\"),i.size.push(m),i.size.push(g),i.size.push(g);break;case Fo.PlaneImpostor:case Fo.BoxImpostor:default:m=r(l.x),g=r(l.y);var v=r(l.z);i.type.push(\"box\"),i.size.push(m),i.size.push(g),i.size.push(v)}n.object.rotationQuaternion=a}})),e.physicsBody=this.world.add(i),e.physicsBody.resetQuaternion(o),e.physicsBody.updatePosition(0)}else this._tmpPositionVector.copyFromFloats(0,0,0);var a;e.setDeltaPosition(this._tmpPositionVector)}},e.prototype.removePhysicsBody=function(e){this.world.removeRigidBody(e.physicsBody)},e.prototype.generateJoint=function(e){var t=e.mainImpostor.physicsBody,i=e.connectedImpostor.physicsBody;if(t&&i){var n,r=e.joint.jointData,o=r.nativeParams||{},a={body1:t,body2:i,axe1:o.axe1||(r.mainAxis?r.mainAxis.asArray():null),axe2:o.axe2||(r.connectedAxis?r.connectedAxis.asArray():null),pos1:o.pos1||(r.mainPivot?r.mainPivot.asArray():null),pos2:o.pos2||(r.connectedPivot?r.connectedPivot.asArray():null),min:o.min,max:o.max,collision:o.collision||r.collision,spring:o.spring,world:this.world};switch(e.joint.type){case Mo.BallAndSocketJoint:n=\"jointBall\";break;case Mo.SpringJoint:Q.Warn(\"OIMO.js doesn't support Spring Constraint. Simulating using DistanceJoint instead\");var s=r;a.min=s.length||a.min,a.max=Math.max(a.min,a.max);case Mo.DistanceJoint:n=\"jointDistance\",a.max=r.maxDistance;break;case Mo.PrismaticJoint:n=\"jointPrisme\";break;case Mo.SliderJoint:n=\"jointSlide\";break;case Mo.WheelJoint:n=\"jointWheel\";break;case Mo.HingeJoint:default:n=\"jointHinge\"}a.type=n,e.joint.physicsJoint=this.world.add(a)}},e.prototype.removeJoint=function(e){try{this.world.removeJoint(e.joint.physicsJoint)}catch(e){Q.Warn(e)}},e.prototype.isSupported=function(){return void 0!==this.BJSOIMO},e.prototype.setTransformationFromPhysicsBody=function(e){if(!e.physicsBody.sleeping){if(e.physicsBody.shapes.next){for(var t=e.physicsBody.shapes;t.next;)t=t.next;e.object.position.set(t.position.x,t.position.y,t.position.z)}else{var i=e.physicsBody.getPosition();e.object.position.set(i.x,i.y,i.z)}if(e.object.rotationQuaternion){var n=e.physicsBody.getQuaternion();e.object.rotationQuaternion.set(n.x,n.y,n.z,n.w)}}},e.prototype.setPhysicsBodyTransformation=function(e,t,i){var n=e.physicsBody;e.physicsBody.shapes.next||(n.position.set(t.x,t.y,t.z),n.orientation.set(i.x,i.y,i.z,i.w),n.syncShapes(),n.awake())},e.prototype.setLinearVelocity=function(e,t){e.physicsBody.linearVelocity.set(t.x,t.y,t.z)},e.prototype.setAngularVelocity=function(e,t){e.physicsBody.angularVelocity.set(t.x,t.y,t.z)},e.prototype.getLinearVelocity=function(e){var t=e.physicsBody.linearVelocity;return t?new x(t.x,t.y,t.z):null},e.prototype.getAngularVelocity=function(e){var t=e.physicsBody.angularVelocity;return t?new x(t.x,t.y,t.z):null},e.prototype.setBodyMass=function(e,t){var i=0===t;e.physicsBody.shapes.density=i?1:t,e.physicsBody.setupMass(i?2:1)},e.prototype.getBodyMass=function(e){return e.physicsBody.shapes.density},e.prototype.getBodyFriction=function(e){return e.physicsBody.shapes.friction},e.prototype.setBodyFriction=function(e,t){e.physicsBody.shapes.friction=t},e.prototype.getBodyRestitution=function(e){return e.physicsBody.shapes.restitution},e.prototype.setBodyRestitution=function(e,t){e.physicsBody.shapes.restitution=t},e.prototype.sleepBody=function(e){e.physicsBody.sleep()},e.prototype.wakeUpBody=function(e){e.physicsBody.awake()},e.prototype.updateDistanceJoint=function(e,t,i){e.physicsJoint.limitMotor.upperLimit=t,void 0!==i&&(e.physicsJoint.limitMotor.lowerLimit=i)},e.prototype.setMotor=function(e,t,i,n){void 0!==i?Q.Warn(\"OimoJS plugin currently has unexpected behavior when using setMotor with force parameter\"):i=1e6,t*=-1;var r=n?e.physicsJoint.rotationalLimitMotor2:e.physicsJoint.rotationalLimitMotor1||e.physicsJoint.rotationalLimitMotor||e.physicsJoint.limitMotor;r&&r.setMotor(t,i)},e.prototype.setLimit=function(e,t,i,n){var r=n?e.physicsJoint.rotationalLimitMotor2:e.physicsJoint.rotationalLimitMotor1||e.physicsJoint.rotationalLimitMotor||e.physicsJoint.limitMotor;r&&r.setLimit(t,void 0===i?-t:i)},e.prototype.syncMeshWithImpostor=function(e,t){var i=t.physicsBody;e.position.x=i.position.x,e.position.y=i.position.y,e.position.z=i.position.z,e.rotationQuaternion&&(e.rotationQuaternion.x=i.orientation.x,e.rotationQuaternion.y=i.orientation.y,e.rotationQuaternion.z=i.orientation.z,e.rotationQuaternion.w=i.orientation.w)},e.prototype.getRadius=function(e){return e.physicsBody.shapes.radius},e.prototype.getBoxSizeToRef=function(e,t){var i=e.physicsBody.shapes;t.x=2*i.halfWidth,t.y=2*i.halfHeight,t.z=2*i.halfDepth},e.prototype.dispose=function(){this.world.clear()},e.prototype.raycast=function(e,t){return Q.Warn(\"raycast is not currently supported by the Oimo physics plugin\"),this._raycastResult.reset(e,t),this._raycastResult},e}(),X_=function(){function e(e,t,i){void 0===e&&(e=!0),void 0===t&&(t=Ammo),void 0===i&&(i=null);var n=this;this._useDeltaForWorldStep=e,this.bjsAMMO={},this.name=\"AmmoJSPlugin\",this._timeStep=1/60,this._fixedTimeStep=1/60,this._maxSteps=5,this._tmpQuaternion=new P,this._tmpContactCallbackResult=!1,this._tmpContactPoint=new x,this._tmpContactNormal=new x,this._tmpVec3=new x,this._tmpMatrix=new M,\"function\"!=typeof t?(this.bjsAMMO=t,this.isSupported()?(this._collisionConfiguration=new this.bjsAMMO.btSoftBodyRigidBodyCollisionConfiguration,this._dispatcher=new this.bjsAMMO.btCollisionDispatcher(this._collisionConfiguration),this._overlappingPairCache=i||new this.bjsAMMO.btDbvtBroadphase,this._solver=new this.bjsAMMO.btSequentialImpulseConstraintSolver,this._softBodySolver=new this.bjsAMMO.btDefaultSoftBodySolver,this.world=new this.bjsAMMO.btSoftRigidDynamicsWorld(this._dispatcher,this._overlappingPairCache,this._solver,this._collisionConfiguration,this._softBodySolver),this._tmpAmmoConcreteContactResultCallback=new this.bjsAMMO.ConcreteContactResultCallback,this._tmpAmmoConcreteContactResultCallback.addSingleResult=function(e){var t=(e=n.bjsAMMO.wrapPointer(e,n.bjsAMMO.btManifoldPoint)).getPositionWorldOnA(),i=e.m_normalWorldOnB;n._tmpContactPoint.x=t.x(),n._tmpContactPoint.y=t.y(),n._tmpContactPoint.z=t.z(),n._tmpContactNormal.x=i.x(),n._tmpContactNormal.y=i.y(),n._tmpContactNormal.z=i.z(),n._tmpContactImpulse=e.getAppliedImpulse(),n._tmpContactDistance=e.getDistance(),n._tmpContactCallbackResult=!0},this._raycastResult=new z_,this._tmpAmmoTransform=new this.bjsAMMO.btTransform,this._tmpAmmoTransform.setIdentity(),this._tmpAmmoQuaternion=new this.bjsAMMO.btQuaternion(0,0,0,1),this._tmpAmmoVectorA=new this.bjsAMMO.btVector3(0,0,0),this._tmpAmmoVectorB=new this.bjsAMMO.btVector3(0,0,0),this._tmpAmmoVectorC=new this.bjsAMMO.btVector3(0,0,0),this._tmpAmmoVectorD=new this.bjsAMMO.btVector3(0,0,0)):Q.Error(\"AmmoJS is not available. Please make sure you included the js file.\")):Q.Error(\"AmmoJS is not ready. Please make sure you await Ammo() before using the plugin.\")}return e.prototype.setGravity=function(e){this._tmpAmmoVectorA.setValue(e.x,e.y,e.z),this.world.setGravity(this._tmpAmmoVectorA),this.world.getWorldInfo().set_m_gravity(this._tmpAmmoVectorA)},e.prototype.setTimeStep=function(e){this._timeStep=e},e.prototype.setFixedTimeStep=function(e){this._fixedTimeStep=e},e.prototype.setMaxSteps=function(e){this._maxSteps=e},e.prototype.getTimeStep=function(){return this._timeStep},e.prototype._isImpostorInContact=function(e){return this._tmpContactCallbackResult=!1,this.world.contactTest(e.physicsBody,this._tmpAmmoConcreteContactResultCallback),this._tmpContactCallbackResult},e.prototype._isImpostorPairInContact=function(e,t){return this._tmpContactCallbackResult=!1,this.world.contactPairTest(e.physicsBody,t.physicsBody,this._tmpAmmoConcreteContactResultCallback),this._tmpContactCallbackResult},e.prototype._stepSimulation=function(e,t,i){if(void 0===e&&(e=1/60),void 0===t&&(t=10),void 0===i&&(i=1/60),0==t)this.world.stepSimulation(e,0);else for(;t>0&&e>0;)e-i0&&this._isImpostorInContact(s))for(var l=0,c=s._onPhysicsCollideCallbacks;l3?3:s;var l=(new this.bjsAMMO.btSoftBodyHelpers).CreateRope(this.world.getWorldInfo(),this._tmpAmmoVectorA,this._tmpAmmoVectorB,i-1,s);return l.get_m_cfg().set_collisions(17),l},e.prototype._createCustom=function(e){var t=null;return this.onCreateCustomShape&&(t=this.onCreateCustomShape(e)),null==t&&(t=new this.bjsAMMO.btCompoundShape),t},e.prototype._addHullVerts=function(e,t,i){var n=this,r=0;if(i&&i.getIndices&&i.getWorldMatrix&&i.getChildMeshes){var o=i.getIndices();o||(o=[]);var a=i.getVerticesData(wi.PositionKind);a||(a=[]),i.computeWorldMatrix(!1);for(var s=o.length/3,l=0;l0){if(e.type!=Fo.NoImpostor){var l=this._createShape(e,!0);l&&(this._tmpAmmoTransform.getOrigin().setValue(0,0,0),this._tmpAmmoQuaternion.setValue(0,0,0,1),this._tmpAmmoTransform.setRotation(this._tmpAmmoQuaternion),n.addChildShape(this._tmpAmmoTransform,l))}return n}this.bjsAMMO.destroy(n),n=null}switch(e.type){case Fo.SphereImpostor:if(h.WithinEpsilon(o.x,o.y,1e-4)&&h.WithinEpsilon(o.x,o.z,1e-4))n=new this.bjsAMMO.btSphereShape(o.x/2);else{var c=[new this.bjsAMMO.btVector3(0,0,0)];(n=new this.bjsAMMO.btMultiSphereShape(c,[1],1)).setLocalScaling(new this.bjsAMMO.btVector3(o.x/2,o.y/2,o.z/2))}break;case Fo.CapsuleImpostor:var u=o.x/2;n=new this.bjsAMMO.btCapsuleShape(u,o.y-2*u);break;case Fo.CylinderImpostor:this._tmpAmmoVectorA.setValue(o.x/2,o.y/2,o.z/2),n=new this.bjsAMMO.btCylinderShape(this._tmpAmmoVectorA);break;case Fo.PlaneImpostor:case Fo.BoxImpostor:this._tmpAmmoVectorA.setValue(o.x/2,o.y/2,o.z/2),n=new this.bjsAMMO.btBoxShape(this._tmpAmmoVectorA);break;case Fo.MeshImpostor:if(0==e.getParam(\"mass\")){if(this.onCreateCustomMeshImpostor)n=this.onCreateCustomMeshImpostor(e);else{var d=new this.bjsAMMO.btTriangleMesh;e._pluginData.toDispose.push(d);var p=this._addMeshVerts(d,r,r);n=0==p?new this.bjsAMMO.btCompoundShape:new this.bjsAMMO.btBvhTriangleMeshShape(d)}break}case Fo.ConvexHullImpostor:if(this.onCreateCustomConvexHullImpostor)n=this.onCreateCustomConvexHullImpostor(e);else{var f=new this.bjsAMMO.btConvexHullShape;0==(p=this._addHullVerts(f,r,r))?(e._pluginData.toDispose.push(f),n=new this.bjsAMMO.btCompoundShape):n=f}break;case Fo.NoImpostor:n=new this.bjsAMMO.btSphereShape(o.x/2);break;case Fo.CustomImpostor:n=this._createCustom(e);break;case Fo.SoftbodyImpostor:n=this._createSoftbody(e);break;case Fo.ClothImpostor:n=this._createCloth(e);break;case Fo.RopeImpostor:n=this._createRope(e);break;default:Q.Warn(\"The impostor type is not currently supported by the ammo plugin.\")}return n},e.prototype.setTransformationFromPhysicsBody=function(e){e.physicsBody.getMotionState().getWorldTransform(this._tmpAmmoTransform),e.object.position.set(this._tmpAmmoTransform.getOrigin().x(),this._tmpAmmoTransform.getOrigin().y(),this._tmpAmmoTransform.getOrigin().z()),e.object.rotationQuaternion?e.object.rotationQuaternion.set(this._tmpAmmoTransform.getRotation().x(),this._tmpAmmoTransform.getRotation().y(),this._tmpAmmoTransform.getRotation().z(),this._tmpAmmoTransform.getRotation().w()):e.object.rotation&&(this._tmpQuaternion.set(this._tmpAmmoTransform.getRotation().x(),this._tmpAmmoTransform.getRotation().y(),this._tmpAmmoTransform.getRotation().z(),this._tmpAmmoTransform.getRotation().w()),this._tmpQuaternion.toEulerAnglesToRef(e.object.rotation))},e.prototype.setPhysicsBodyTransformation=function(e,t,i){var n=e.physicsBody.getWorldTransform();if(Math.abs(n.getOrigin().x()-t.x)>_||Math.abs(n.getOrigin().y()-t.y)>_||Math.abs(n.getOrigin().z()-t.z)>_||Math.abs(n.getRotation().x()-i.x)>_||Math.abs(n.getRotation().y()-i.y)>_||Math.abs(n.getRotation().z()-i.z)>_||Math.abs(n.getRotation().w()-i.w)>_)if(this._tmpAmmoVectorA.setValue(t.x,t.y,t.z),n.setOrigin(this._tmpAmmoVectorA),this._tmpAmmoQuaternion.setValue(i.x,i.y,i.z,i.w),n.setRotation(this._tmpAmmoQuaternion),e.physicsBody.setWorldTransform(n),0==e.mass){var r=e.physicsBody.getMotionState();r&&r.setWorldTransform(n)}else e.physicsBody.activate()},e.prototype.isSupported=function(){return void 0!==this.bjsAMMO},e.prototype.setLinearVelocity=function(e,t){this._tmpAmmoVectorA.setValue(t.x,t.y,t.z),e.soft?e.physicsBody.linearVelocity(this._tmpAmmoVectorA):e.physicsBody.setLinearVelocity(this._tmpAmmoVectorA)},e.prototype.setAngularVelocity=function(e,t){this._tmpAmmoVectorA.setValue(t.x,t.y,t.z),e.soft?e.physicsBody.angularVelocity(this._tmpAmmoVectorA):e.physicsBody.setAngularVelocity(this._tmpAmmoVectorA)},e.prototype.getLinearVelocity=function(e){var t;if(!(t=e.soft?e.physicsBody.linearVelocity():e.physicsBody.getLinearVelocity()))return null;var i=new x(t.x(),t.y(),t.z());return this.bjsAMMO.destroy(t),i},e.prototype.getAngularVelocity=function(e){var t;if(!(t=e.soft?e.physicsBody.angularVelocity():e.physicsBody.getAngularVelocity()))return null;var i=new x(t.x(),t.y(),t.z());return this.bjsAMMO.destroy(t),i},e.prototype.setBodyMass=function(e,t){e.soft?e.physicsBody.setTotalMass(t,!1):e.physicsBody.setMassProps(t),e._pluginData.mass=t},e.prototype.getBodyMass=function(e){return e._pluginData.mass||0},e.prototype.getBodyFriction=function(e){return e._pluginData.friction||0},e.prototype.setBodyFriction=function(e,t){e.soft?e.physicsBody.get_m_cfg().set_kDF(t):e.physicsBody.setFriction(t),e._pluginData.friction=t},e.prototype.getBodyRestitution=function(e){return e._pluginData.restitution||0},e.prototype.setBodyRestitution=function(e,t){e.physicsBody.setRestitution(t),e._pluginData.restitution=t},e.prototype.getBodyPressure=function(e){return e.soft?e._pluginData.pressure||0:(Q.Warn(\"Pressure is not a property of a rigid body\"),0)},e.prototype.setBodyPressure=function(e,t){e.soft?e.type===Fo.SoftbodyImpostor?(e.physicsBody.get_m_cfg().set_kPR(t),e._pluginData.pressure=t):(e.physicsBody.get_m_cfg().set_kPR(0),e._pluginData.pressure=0):Q.Warn(\"Pressure can only be applied to a softbody\")},e.prototype.getBodyStiffness=function(e){return e.soft?e._pluginData.stiffness||0:(Q.Warn(\"Stiffness is not a property of a rigid body\"),0)},e.prototype.setBodyStiffness=function(e,t){e.soft?(t=(t=t<0?0:t)>1?1:t,e.physicsBody.get_m_materials().at(0).set_m_kLST(t),e._pluginData.stiffness=t):Q.Warn(\"Stiffness cannot be applied to a rigid body\")},e.prototype.getBodyVelocityIterations=function(e){return e.soft?e._pluginData.velocityIterations||0:(Q.Warn(\"Velocity iterations is not a property of a rigid body\"),0)},e.prototype.setBodyVelocityIterations=function(e,t){e.soft?(t=t<0?0:t,e.physicsBody.get_m_cfg().set_viterations(t),e._pluginData.velocityIterations=t):Q.Warn(\"Velocity iterations cannot be applied to a rigid body\")},e.prototype.getBodyPositionIterations=function(e){return e.soft?e._pluginData.positionIterations||0:(Q.Warn(\"Position iterations is not a property of a rigid body\"),0)},e.prototype.setBodyPositionIterations=function(e,t){e.soft?(t=t<0?0:t,e.physicsBody.get_m_cfg().set_piterations(t),e._pluginData.positionIterations=t):Q.Warn(\"Position iterations cannot be applied to a rigid body\")},e.prototype.appendAnchor=function(e,t,i,n,r,o){void 0===r&&(r=1),void 0===o&&(o=!1);var a=e.segments,s=Math.round((a-1)*i)+a*(a-1-Math.round((a-1)*n));e.physicsBody.appendAnchor(s,t.physicsBody,o,r)},e.prototype.appendHook=function(e,t,i,n,r){void 0===n&&(n=1),void 0===r&&(r=!1);var o=Math.round(e.segments*i);e.physicsBody.appendAnchor(o,t.physicsBody,r,n)},e.prototype.sleepBody=function(e){e.physicsBody.forceActivationState(0)},e.prototype.wakeUpBody=function(e){e.physicsBody.activate()},e.prototype.updateDistanceJoint=function(){Q.Warn(\"updateDistanceJoint is not currently supported by the Ammo physics plugin\")},e.prototype.setMotor=function(e,t,i){e.physicsJoint.enableAngularMotor(!0,t,i)},e.prototype.setLimit=function(){Q.Warn(\"setLimit is not currently supported by the Ammo physics plugin\")},e.prototype.syncMeshWithImpostor=function(e,t){t.physicsBody.getMotionState().getWorldTransform(this._tmpAmmoTransform),e.position.x=this._tmpAmmoTransform.getOrigin().x(),e.position.y=this._tmpAmmoTransform.getOrigin().y(),e.position.z=this._tmpAmmoTransform.getOrigin().z(),e.rotationQuaternion&&(e.rotationQuaternion.x=this._tmpAmmoTransform.getRotation().x(),e.rotationQuaternion.y=this._tmpAmmoTransform.getRotation().y(),e.rotationQuaternion.z=this._tmpAmmoTransform.getRotation().z(),e.rotationQuaternion.w=this._tmpAmmoTransform.getRotation().w())},e.prototype.getRadius=function(e){return e.getObjectExtents().x/2},e.prototype.getBoxSizeToRef=function(e,t){var i=e.getObjectExtents();t.x=i.x,t.y=i.y,t.z=i.z},e.prototype.dispose=function(){this.bjsAMMO.destroy(this.world),this.bjsAMMO.destroy(this._solver),this.bjsAMMO.destroy(this._overlappingPairCache),this.bjsAMMO.destroy(this._dispatcher),this.bjsAMMO.destroy(this._collisionConfiguration),this.bjsAMMO.destroy(this._tmpAmmoVectorA),this.bjsAMMO.destroy(this._tmpAmmoVectorB),this.bjsAMMO.destroy(this._tmpAmmoVectorC),this.bjsAMMO.destroy(this._tmpAmmoTransform),this.bjsAMMO.destroy(this._tmpAmmoQuaternion),this.bjsAMMO.destroy(this._tmpAmmoConcreteContactResultCallback),this.world=null},e.prototype.raycast=function(e,t){this._tmpAmmoVectorRCA=new this.bjsAMMO.btVector3(e.x,e.y,e.z),this._tmpAmmoVectorRCB=new this.bjsAMMO.btVector3(t.x,t.y,t.z);var i=new this.bjsAMMO.ClosestRayResultCallback(this._tmpAmmoVectorRCA,this._tmpAmmoVectorRCB);return this.world.rayTest(this._tmpAmmoVectorRCA,this._tmpAmmoVectorRCB,i),this._raycastResult.reset(e,t),i.hasHit()&&(this._raycastResult.setHitData({x:i.get_m_hitNormalWorld().x(),y:i.get_m_hitNormalWorld().y(),z:i.get_m_hitNormalWorld().z()},{x:i.get_m_hitPointWorld().x(),y:i.get_m_hitPointWorld().y(),z:i.get_m_hitPointWorld().z()}),this._raycastResult.calculateHitDistance()),this.bjsAMMO.destroy(i),this.bjsAMMO.destroy(this._tmpAmmoVectorRCA),this.bjsAMMO.destroy(this._tmpAmmoVectorRCB),this._raycastResult},e._DISABLE_COLLISION_FLAG=4,e._KINEMATIC_FLAG=2,e._DISABLE_DEACTIVATION_FLAG=4,e}();o.prototype.removeReflectionProbe=function(e){if(!this.reflectionProbes)return-1;var t=this.reflectionProbes.indexOf(e);return-1!==t&&this.reflectionProbes.splice(t,1),t},o.prototype.addReflectionProbe=function(e){this.reflectionProbes||(this.reflectionProbes=[]),this.reflectionProbes.push(e)};var j_=function(){function e(e,t,i,n,r,o){void 0===n&&(n=!0),void 0===r&&(r=!1),void 0===o&&(o=!1);var s=this;if(this.name=e,this._viewMatrix=M.Identity(),this._target=x.Zero(),this._add=x.Zero(),this._invertYAxis=!1,this.position=x.Zero(),this.metadata=null,this._parentContainer=null,this._scene=i,i.getEngine().supportsUniformBuffers){this._sceneUBOs=[];for(var l=0;l<6;++l)this._sceneUBOs.push(i.createSceneUniformBuffer('Scene for Reflection Probe (name \"'.concat(e,'\") face #').concat(l)))}this._scene.reflectionProbes||(this._scene.reflectionProbes=new Array),this._scene.reflectionProbes.push(this);var c=a.TEXTURETYPE_UNSIGNED_BYTE;if(r){var u=this._scene.getEngine().getCaps();u.textureHalfFloatRender?c=a.TEXTURETYPE_HALF_FLOAT:u.textureFloatRender&&(c=a.TEXTURETYPE_FLOAT)}this._renderTargetTexture=new Ia(e,t,i,n,!0,c,!0),this._renderTargetTexture.gammaSpace=!o;var h,d=i.getEngine().useReverseDepthBuffer;this._renderTargetTexture.onBeforeRenderObservable.add((function(e){switch(s._sceneUBOs&&(i.setSceneUniformBuffer(s._sceneUBOs[e]),i.getSceneUniformBuffer().unbindEffect()),e){case 0:s._add.copyFromFloats(1,0,0);break;case 1:s._add.copyFromFloats(-1,0,0);break;case 2:s._add.copyFromFloats(0,s._invertYAxis?1:-1,0);break;case 3:s._add.copyFromFloats(0,s._invertYAxis?-1:1,0);break;case 4:s._add.copyFromFloats(0,0,i.useRightHandedSystem?-1:1);break;case 5:s._add.copyFromFloats(0,0,i.useRightHandedSystem?1:-1)}s._attachedMesh&&s.position.copyFrom(s._attachedMesh.getAbsolutePosition()),s.position.addToRef(s._add,s._target);var t=i.useRightHandedSystem?M.LookAtRHToRef:M.LookAtLHToRef,n=i.useRightHandedSystem?M.PerspectiveFovRH:M.PerspectiveFovLH;t(s.position,s._target,x.Up(),s._viewMatrix),i.activeCamera&&(s._projectionMatrix=n(Math.PI/2,1,d?i.activeCamera.maxZ:i.activeCamera.minZ,d?i.activeCamera.minZ:i.activeCamera.maxZ,s._scene.getEngine().isNDCHalfZRange),i.setTransformMatrix(s._viewMatrix,s._projectionMatrix),i.activeCamera.isRigCamera&&!s._renderTargetTexture.activeCamera&&(s._renderTargetTexture.activeCamera=i.activeCamera.rigParent||null)),i._forcedViewPosition=s.position})),this._renderTargetTexture.onBeforeBindObservable.add((function(){var t,n;s._currentSceneUBO=i.getSceneUniformBuffer(),null===(n=(t=i.getEngine())._debugPushGroup)||void 0===n||n.call(t,\"reflection probe generation for \".concat(e),1),h=s._scene.imageProcessingConfiguration.applyByPostProcess,o&&(i.imageProcessingConfiguration.applyByPostProcess=!0)})),this._renderTargetTexture.onAfterUnbindObservable.add((function(){var e,t;i.imageProcessingConfiguration.applyByPostProcess=h,i._forcedViewPosition=null,s._sceneUBOs&&i.setSceneUniformBuffer(s._currentSceneUBO),i.updateTransformMatrix(!0),null===(t=(e=i.getEngine())._debugPopGroup)||void 0===t||t.call(e,1)}))}return Object.defineProperty(e.prototype,\"samples\",{get:function(){return this._renderTargetTexture.samples},set:function(e){this._renderTargetTexture.samples=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"refreshRate\",{get:function(){return this._renderTargetTexture.refreshRate},set:function(e){this._renderTargetTexture.refreshRate=e},enumerable:!1,configurable:!0}),e.prototype.getScene=function(){return this._scene},Object.defineProperty(e.prototype,\"cubeTexture\",{get:function(){return this._renderTargetTexture},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"renderList\",{get:function(){return this._renderTargetTexture.renderList},enumerable:!1,configurable:!0}),e.prototype.attachToMesh=function(e){this._attachedMesh=e},e.prototype.setRenderingAutoClearDepthStencil=function(e,t){this._renderTargetTexture.setRenderingAutoClearDepthStencil(e,t)},e.prototype.dispose=function(){var e=this._scene.reflectionProbes.indexOf(this);if(-1!==e&&this._scene.reflectionProbes.splice(e,1),this._parentContainer){var t=this._parentContainer.reflectionProbes.indexOf(this);t>-1&&this._parentContainer.reflectionProbes.splice(t,1),this._parentContainer=null}if(this._renderTargetTexture&&(this._renderTargetTexture.dispose(),this._renderTargetTexture=null),this._sceneUBOs){for(var i=0,n=this._sceneUBOs;i0){var n=t._waitingData.lods.ids,r=i.isEnabled(!1);if(t._waitingData.lods.distances){var o=t._waitingData.lods.distances;if(o.length>=n.length){var a=o.length>n.length?o[o.length-1]:0;i.setEnabled(!1);for(var s=0;s0&&i.addLODLevel(a,null),!0===r&&i.setEnabled(!0)}else mi.Warn(\"Invalid level of detail distances for \"+t.name)}}t._waitingData.lods=null}},em=function(e,t,i){if(\"number\"!=typeof e){var n=i.getLastEntryById(e);return n&&null!=t?n.instances[parseInt(t)]:n}var r=Q_[e];return r&&null!=t?r.instances[parseInt(t)]:r},tm=function(e,t){return\"number\"!=typeof e?t.getLastMaterialById(e,!0):q_[e]},im=function(e,t,i,n,r){void 0===r&&(r=!1);var a=new Gr(e),s=\"importScene has failed JSON parse\";try{var l=JSON.parse(t);s=\"\";var c=Uo.loggingLevel===Uo.DETAILED_LOGGING,u=void 0,h=void 0;if(void 0!==l.environmentTexture&&null!==l.environmentTexture){var d=void 0===l.isPBR||l.isPBR;if(l.environmentTextureType&&\"BABYLON.HDRCubeTexture\"===l.environmentTextureType){var p=l.environmentTextureSize?l.environmentTextureSize:128,f=new B_((l.environmentTexture.match(/https?:\\/\\//g)?\"\":i)+l.environmentTexture,e,p,!0,!d,void 0,l.environmentTexturePrefilterOnLoad);l.environmentTextureRotationY&&(f.rotationY=l.environmentTextureRotationY),e.environmentTexture=f}else if(\"object\"==typeof l.environmentTexture){var _=Hp.Parse(l.environmentTexture,e,i);e.environmentTexture=_}else if(l.environmentTexture.endsWith(\".env\")){var m=new Hp((l.environmentTexture.match(/https?:\\/\\//g)?\"\":i)+l.environmentTexture,e,l.environmentTextureForcedExtension);l.environmentTextureRotationY&&(m.rotationY=l.environmentTextureRotationY),e.environmentTexture=m}else{var g=Hp.CreateFromPrefilteredData((l.environmentTexture.match(/https?:\\/\\//g)?\"\":i)+l.environmentTexture,e,l.environmentTextureForcedExtension);l.environmentTextureRotationY&&(g.rotationY=l.environmentTextureRotationY),e.environmentTexture=g}if(!0===l.createDefaultSkybox){var v=void 0!==e.activeCamera&&null!==e.activeCamera?(e.activeCamera.maxZ-e.activeCamera.minZ)/2:1e3,y=l.skyboxBlurLevel||0;e.createDefaultSkybox(e.environmentTexture,d,v,y)}a.environmentTexture=e.environmentTexture}if(void 0!==l.environmentIntensity&&null!==l.environmentIntensity&&(e.environmentIntensity=l.environmentIntensity),void 0!==l.lights&&null!==l.lights)for(u=0,h=l.lights.length;u0){for(var re=0;re0){for(var ae=0;ae-1&&void 0!==h.skeletons&&null!==h.skeletons&&!(b.indexOf(a.skeletonId)>-1))for(var x=0,C=h.skeletons.length;x-1&&void 0!==h.morphTargetManagers&&null!==h.morphTargetManagers&&!(S.indexOf(a.morphTargetManagerId)>-1))for(var I=0,O=h.morphTargetManagers.length;I-1&&_.splice(M,1)}C._waitingParentId=null}C._waitingData.lods&&$_(t,C)}for(var I=0,O=_;I0&&(_+1)%4==0)s[_]=255;else{var T=l[_];s[_]=T/f*255}e.is3D?(e.updateSize(u,u,u),n.updateRawTexture3D(e,s,a.TEXTUREFORMAT_RGBA,!1)):(e.updateSize(u*u,u),n.updateRawTexture(e,s,a.TEXTUREFORMAT_RGBA,!1)),e.isReady=!0,i._triggerOnLoad()}},o=this.getScene();return o?o._loadFile(this.url,r):n._loadFile(this.url,r),this._texture},t.prototype._loadTexture=function(){this.url&&this.url.toLocaleLowerCase().indexOf(\".3dl\")==this.url.length-4&&this._load3dlTexture()},t.prototype.clone=function(){var e=new t(this.url,this.getScene()||this._getEngine());return e.level=this.level,e},t.prototype.delayLoad=function(){this.delayLoadState===a.DELAYLOADSTATE_NOTLOADED&&(this.delayLoadState=a.DELAYLOADSTATE_LOADED,this._texture=this._getFromCache(this.url,!0),this._texture||this._loadTexture())},t.Parse=function(e,i){var n=null;return e.name&&!e.isRenderTarget&&((n=new t(e.name,i)).name=e.name,n.level=e.level),n},t.prototype.serialize=function(){if(!this.name)return null;var e={};return e.name=this.name,e.level=this.level,e.customType=\"BABYLON.ColorGradingTexture\",e},t._NoneEmptyLineRegex=/\\S+/,t}(qr);b(\"BABYLON.ColorGradingTexture\",lm);var cm=function(e){function t(t,i,n,r,o,s,l){void 0===r&&(r=!1),void 0===o&&(o=!0),void 0===s&&(s=null),void 0===l&&(l=null);var c=e.call(this,i)||this;if(c._onLoad=null,c._onError=null,!t)throw new Error(\"Image url is not set\");return c._coordinatesMode=to.CUBIC_MODE,c.name=t,c.url=t,c._size=n,c._noMipmap=r,c.gammaSpace=o,c._onLoad=s,c._onError=l,c.hasAlpha=!1,c.isCube=!0,c._texture=c._getFromCache(t,c._noMipmap,void 0,void 0,void 0,c.isCube),c._texture?s&&(c._texture.isReady?mi.SetImmediate((function(){return s()})):c._texture.onLoadedObservable.add(s)):i.useDelayedTextureLoading?c.delayLoadState=a.DELAYLOADSTATE_NOTLOADED:c._loadImage(c._loadTexture.bind(c),c._onError),c}return V(t,e),t.prototype._loadImage=function(e,t){var i=this,n=document.createElement(\"canvas\");ii(this.url,(function(t){i._width=t.width,i._height=t.height,n.width=i._width,n.height=i._height;var r=n.getContext(\"2d\");r.drawImage(t,0,0);var o=r.getImageData(0,0,t.width,t.height);i._buffer=o.data.buffer,n.remove(),e()}),(function(e,n){t&&t(\"\".concat(i.getClassName(),\" could not be loaded\"),n)}),null)},t.prototype._loadTexture=function(){var e=this,i=this.getScene();i&&(this._texture=i.getEngine().createRawCubeTextureFromUrl(this.url,i,this._size,a.TEXTUREFORMAT_RGB,i.getEngine().getCaps().textureFloat?a.TEXTURETYPE_FLOAT:a.TEXTURETYPE_UNSIGNED_INTEGER,this._noMipmap,(function(){for(var i=e._getFloat32ArrayFromArrayBuffer(e._buffer),n=D_.ConvertPanoramaToCubemap(i,e._width,e._height,e._size),r=[],o=0;o<6;o++){var a=n[t._FacesMapping[o]];r.push(a)}return r}),null,this._onLoad,this._onError))},t.prototype._getFloat32ArrayFromArrayBuffer=function(e){for(var t=new DataView(e),i=new Float32Array(3*e.byteLength/4),n=0,r=0;rt.length)Q.Error(\"Unable to load TGA file - Not enough data\");else{i+=n.id_length;var r,o=!1,a=!1,s=!1;switch(n.image_type){case 9:o=!0;case 1:a=!0;break;case 10:o=!0;case 2:break;case 11:o=!0;case 3:s=!0}var l,c,u,h,d,p,f,_=n.pixel_size>>3,m=n.width*n.height*_;if(a&&(l=t.subarray(i,i+=n.colormap_length*(n.colormap_size>>3))),o){r=new Uint8Array(m);for(var g=void 0,v=void 0,y=void 0,b=0,T=new Uint8Array(_);i>4){default:case 2:c=0,h=1,f=n.width,u=0,d=1,p=n.height;break;case 0:c=0,h=1,f=n.width,u=n.height-1,d=-1,p=-1;break;case 3:c=n.width-1,h=-1,f=-1,u=0,d=1,p=n.height;break;case 1:c=n.width-1,h=-1,f=-1,u=n.height-1,d=-1,p=-1}var E=\"_getImageData\"+(s?\"Grey\":\"\")+n.pixel_size+\"bits\",S=pm[E](n,l,r,u,d,p,c,h,f);e.getEngine()._uploadDataToTextureDirectly(e,S)}}}var pm={GetTGAHeader:hm,UploadContent:dm,_getImageData8bits:function(e,t,i,n,r,o,a,s,l){var c,u,h,d=i,p=t,f=e.width,_=e.height,m=0,g=new Uint8Array(f*_*4);for(h=n;h!==o;h+=r)for(u=a;u!==l;u+=s,m++)c=d[m],g[4*(u+f*h)+3]=255,g[4*(u+f*h)+2]=p[3*c+0],g[4*(u+f*h)+1]=p[3*c+1],g[4*(u+f*h)+0]=p[3*c+2];return g},_getImageData16bits:function(e,t,i,n,r,o,a,s,l){var c,u,h,d=i,p=e.width,f=e.height,_=0,m=new Uint8Array(p*f*4);for(h=n;h!==o;h+=r)for(u=a;u!==l;u+=s,_+=2){var g=255*((31744&(c=d[_+0]+(d[_+1]<<8)))>>10)/31|0,v=255*((992&c)>>5)/31|0,y=255*(31&c)/31|0;m[4*(u+p*h)+0]=g,m[4*(u+p*h)+1]=v,m[4*(u+p*h)+2]=y,m[4*(u+p*h)+3]=32768&c?0:255}return m},_getImageData24bits:function(e,t,i,n,r,o,a,s,l){var c,u,h=i,d=e.width,p=e.height,f=0,_=new Uint8Array(d*p*4);for(u=n;u!==o;u+=r)for(c=a;c!==l;c+=s,f+=3)_[4*(c+d*u)+3]=255,_[4*(c+d*u)+2]=h[f+0],_[4*(c+d*u)+1]=h[f+1],_[4*(c+d*u)+0]=h[f+2];return _},_getImageData32bits:function(e,t,i,n,r,o,a,s,l){var c,u,h=i,d=e.width,p=e.height,f=0,_=new Uint8Array(d*p*4);for(u=n;u!==o;u+=r)for(c=a;c!==l;c+=s,f+=4)_[4*(c+d*u)+2]=h[f+0],_[4*(c+d*u)+1]=h[f+1],_[4*(c+d*u)+0]=h[f+2],_[4*(c+d*u)+3]=h[f+3];return _},_getImageDataGrey8bits:function(e,t,i,n,r,o,a,s,l){var c,u,h,d=i,p=e.width,f=e.height,_=0,m=new Uint8Array(p*f*4);for(h=n;h!==o;h+=r)for(u=a;u!==l;u+=s,_++)c=d[_],m[4*(u+p*h)+0]=c,m[4*(u+p*h)+1]=c,m[4*(u+p*h)+2]=c,m[4*(u+p*h)+3]=255;return m},_getImageDataGrey16bits:function(e,t,i,n,r,o,a,s,l){var c,u,h=i,d=e.width,p=e.height,f=0,_=new Uint8Array(d*p*4);for(u=n;u!==o;u+=r)for(c=a;c!==l;c+=s,f+=2)_[4*(c+d*u)+0]=h[f+0],_[4*(c+d*u)+1]=h[f+0],_[4*(c+d*u)+2]=h[f+0],_[4*(c+d*u)+3]=h[f+1];return _}},fm=function(){function e(){this.supportCascades=!1}return e.prototype.canLoad=function(e){return e.endsWith(\".tga\")},e.prototype.loadCubeData=function(){throw\".env not supported in Cube.\"},e.prototype.loadData=function(e,t,i){var n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=hm(n);i(r.width,r.height,t.generateMipMaps,!1,(function(){dm(t,n)}))},e}();vr._TextureLoaders.push(new fm);var _m=function(){function e(){this.supportCascades=!1}return e.prototype.canLoad=function(e){return e.endsWith(\".hdr\")},e.prototype.loadCubeData=function(){throw\".env not supported in Cube.\"},e.prototype.loadData=function(e,t,i){for(var n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=N_.RGBE_ReadHeader(n),o=N_.RGBE_ReadPixels(n,r),s=r.width*r.height,l=new Float32Array(4*s),c=0;c1;var s=xm.GetInternalFormatFromBasisFormat(t.format,i);e.format=s,Am(e,i),t.fileInfo.images[n].levels.forEach((function(t,r){i._uploadCompressedDataToTextureDirectly(e,s,t.width,t.height,t.transcodedPixels,n,r)})),!i._features.basisNeedsPOT||h.Log2(e.width)%1==0&&h.Log2(e.height)%1==0||(mi.Warn(\"Loaded .basis texture width and height are not a power of two. Texture wrapping will be set to Texture.CLAMP_ADDRESSMODE as other modes are not supported with non power of two dimensions in webGL 1.\"),e._cachedWrapU=to.CLAMP_ADDRESSMODE,e._cachedWrapV=to.CLAMP_ADDRESSMODE)}},r=0;r>2&3],o[p++]=r[d>>4&3],o[p++]=r[d>>6&3]}}return o}(a,0,e.getImageWidth(t,i)+3&-4,e.getImageHeight(t,i)+3&-4)),a):null}onmessage=function(i){if(\"init\"===i.data.action){if(!e){try{importScripts(i.data.url)}catch(e){postMessage({action:\"error\",error:e})}e=BASIS({wasmBinary:i.data.wasmBinary})}null!==e&&e.then((function(e){BASIS=e,e.initializeBasis(),postMessage({action:\"init\"})}))}else if(\"transcode\"===i.data.action){var n=i.data.config,r=i.data.imageData,o=new BASIS.BasisFile(r),a=function(e){for(var t=e.getHasAlpha(),i=e.getNumImages(),n=[],r=0;r1&&t.generateMipMaps;Rm(t,e),t.getEngine()._setCubeMapTextureParams(t,i),t.isReady=!0,t.onLoadedObservable.notifyObservers(t),t.onLoadedObservable.clear(),n&&n()})).catch((function(e){mi.Warn(\"Failed to transcode Basis file, transcoding may not be supported on this device\"),t.isReady=!0,r&&r(e)}))}},e.prototype.loadData=function(e,t,i){var n=t.getEngine().getCaps(),r={supportedCompressionFormats:{etc1:!!n.etc1,s3tc:!!n.s3tc,pvrtc:!!n.pvrtc,etc2:!!n.etc2,astc:!!n.astc,bc7:!!n.bptc}};Sm(e,r).then((function(e){var n=e.fileInfo.images[0].levels[0],r=e.fileInfo.images[0].levels.length>1&&t.generateMipMaps;i(n.width,n.height,r,-1!==e.format,(function(){Rm(t,e)}))})).catch((function(e){mi.Warn(\"Failed to transcode Basis file, transcoding may not be supported on this device\"),mi.Warn(\"Failed to transcode Basis file: \".concat(e)),i(0,0,!1,!1,(function(){}),!0)}))},e}();vr._TextureLoaders.push(new Pm);var Mm=function(e){function t(t,i,n,r,o,s){var l=this,c=!(!o||!o.generateMipMaps)&&o.generateMipMaps,u=!(!o||!o.generateDepthTexture)&&o.generateDepthTexture,h=o&&o.depthTextureFormat?o.depthTextureFormat:a.TEXTUREFORMAT_DEPTH16,d=!o||void 0===o.doNotChangeAspectRatio||o.doNotChangeAspectRatio,p=!(!o||!o.drawOnlyOnFirstAttachmentByDefault)&&o.drawOnlyOnFirstAttachmentByDefault;if(!(l=e.call(this,t,i,r,c,d,void 0,void 0,void 0,void 0,void 0,void 0,void 0,!0)||this).isSupported)return l.dispose(),l;var f=[],_=[],m=[];l._initTypes(n,f,_,m,o);var g=!o||void 0===o.generateDepthBuffer||o.generateDepthBuffer,v=!(!o||void 0===o.generateStencilBuffer)&&o.generateStencilBuffer;return l._size=i,l._multiRenderTargetOptions={samplingModes:_,generateMipMaps:c,generateDepthBuffer:g,generateStencilBuffer:v,generateDepthTexture:u,depthTextureFormat:h,types:f,textureCount:n,useSRGBBuffers:m},l._count=n,l._drawOnlyOnFirstAttachmentByDefault=p,n>0&&(l._createInternalTextures(),l._createTextures(s)),l}return V(t,e),Object.defineProperty(t.prototype,\"isSupported\",{get:function(){var e,t;return null!==(t=null===(e=this._engine)||void 0===e?void 0:e.getCaps().drawBuffersExtension)&&void 0!==t&&t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"textures\",{get:function(){return this._textures},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"count\",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"depthTexture\",{get:function(){return this._textures[this._textures.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"wrapU\",{set:function(e){if(this._textures)for(var t=0;t=0;n--)this._textures[n]._texture=null;null===(t=this._renderTarget)||void 0===t||t.dispose(),this._renderTarget=null}},t}(Ia),Im=function(e,t,i){this.id=e,this.scale=t,this.offset=i},Om=function(){function e(t,i,n,r){var o,a,s,l,c,u,h,d,p,f,_,m,g;return this.name=t,this.meshes=i,this.scene=r,this.options=n,this.options.map=null!==(o=this.options.map)&&void 0!==o?o:[\"ambientTexture\",\"bumpTexture\",\"diffuseTexture\",\"emissiveTexture\",\"lightmapTexture\",\"opacityTexture\",\"reflectionTexture\",\"refractionTexture\",\"specularTexture\"],this.options.uvsIn=null!==(a=this.options.uvsIn)&&void 0!==a?a:wi.UVKind,this.options.uvsOut=null!==(s=this.options.uvsOut)&&void 0!==s?s:wi.UVKind,this.options.layout=null!==(l=this.options.layout)&&void 0!==l?l:e.LAYOUT_STRIP,this.options.layout===e.LAYOUT_COLNUM&&(this.options.colnum=null!==(c=this.options.colnum)&&void 0!==c?c:8),this.options.updateInputMeshes=null===(u=this.options.updateInputMeshes)||void 0===u||u,this.options.disposeSources=null===(h=this.options.disposeSources)||void 0===h||h,this._expecting=0,this.options.fillBlanks=null===(d=this.options.fillBlanks)||void 0===d||d,!0===this.options.fillBlanks&&(this.options.customFillColor=null!==(p=this.options.customFillColor)&&void 0!==p?p:\"black\"),this.options.frameSize=null!==(f=this.options.frameSize)&&void 0!==f?f:256,this.options.paddingRatio=null!==(_=this.options.paddingRatio)&&void 0!==_?_:.0115,this._paddingValue=Math.ceil(this.options.frameSize*this.options.paddingRatio),this._paddingValue%2!=0&&this._paddingValue++,this.options.paddingMode=null!==(m=this.options.paddingMode)&&void 0!==m?m:e.SUBUV_WRAP,this.options.paddingMode===e.SUBUV_COLOR&&(this.options.paddingColor=null!==(g=this.options.paddingColor)&&void 0!==g?g:new L(0,0,0,1)),this.sets={},this.frames=[],this}return e.prototype._createFrames=function(e){for(var t=this,i=this._calculateSize(),n=new R(1,1).divide(i),r=0,o=this._expecting,a=this.meshes.length,s=Object.keys(this.sets),l=0;l0)try{t._config=JSON.parse(r.response),t.updateShaderUniforms(),t.updateTextures(),t.setFragment(t._texturePath+\"/custom\"),t._animate=t._config.animate,t.refreshRate=t._config.refreshrate}catch(e){i()}else i()}),!1),r.addEventListener(\"error\",(function(){i()}),!1);try{r.send()}catch(e){Q.Error(\"CustomProceduralTexture: Error on XHR send request.\")}},t.prototype.isReady=function(){if(!e.prototype.isReady.call(this))return!1;for(var t in this._textures)if(!this._textures[t].isReady())return!1;return!0},t.prototype.render=function(t){var i=this.getScene();this._animate&&i&&(this._time+=.03*i.getAnimationRatio(),this.updateShaderUniforms()),e.prototype.render.call(this,t)},t.prototype.updateTextures=function(){for(var e=0;e0\\r\\n\",t.compilationString+=this._declareOutput(r,t)+\" = \".concat(o.associatedVariableName,\" * \").concat(n,\";\\r\\n\"),t.compilationString+=\"#else\\r\\n\",t.compilationString+=this._declareOutput(r,t)+\" = \".concat(o.associatedVariableName,\";\\r\\n\"),t.compilationString+=\"#endif\\r\\n\",this},t}(Xo);b(\"BABYLON.BonesBlock\",Vm);var km=function(e){function t(t){var i=e.call(this,t,Bo.Vertex)||this;return i.registerInput(\"world0\",wo.Vector4),i.registerInput(\"world1\",wo.Vector4),i.registerInput(\"world2\",wo.Vector4),i.registerInput(\"world3\",wo.Vector4),i.registerInput(\"world\",wo.Matrix,!0),i.registerOutput(\"output\",wo.Matrix),i.registerOutput(\"instanceID\",wo.Float),i}return V(t,e),t.prototype.getClassName=function(){return\"InstancesBlock\"},Object.defineProperty(t.prototype,\"world0\",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"world1\",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"world2\",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"world3\",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"world\",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"output\",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"instanceID\",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),t.prototype.autoConfigure=function(e){if(!this.world0.connectedPoint){var t=e.getInputBlockByPredicate((function(e){return e.isAttribute&&\"world0\"===e.name}));t||(t=new oa(\"world0\")).setAsAttribute(\"world0\"),t.output.connectTo(this.world0)}if(!this.world1.connectedPoint){var i=e.getInputBlockByPredicate((function(e){return e.isAttribute&&\"world1\"===e.name}));i||(i=new oa(\"world1\")).setAsAttribute(\"world1\"),i.output.connectTo(this.world1)}if(!this.world2.connectedPoint){var n=e.getInputBlockByPredicate((function(e){return e.isAttribute&&\"world2\"===e.name}));n||(n=new oa(\"world2\")).setAsAttribute(\"world2\"),n.output.connectTo(this.world2)}if(!this.world3.connectedPoint){var r=e.getInputBlockByPredicate((function(e){return e.isAttribute&&\"world3\"===e.name}));r||(r=new oa(\"world3\")).setAsAttribute(\"world3\"),r.output.connectTo(this.world3)}if(!this.world.connectedPoint){var o=e.getInputBlockByPredicate((function(e){return e.isAttribute&&\"world\"===e.name}));o||(o=new oa(\"world\")).setAsSystemValue(Zo.World),o.output.connectTo(this.world)}this.world.define=\"!INSTANCES || THIN_INSTANCES\"},t.prototype.prepareDefines=function(e,t,i,n,r){void 0===n&&(n=!1);var o=!1;i.INSTANCES!==n&&(i.setValue(\"INSTANCES\",n),o=!0),r&&i.THIN_INSTANCES!==!!(null==r?void 0:r.getRenderingMesh().hasThinInstances)&&(i.setValue(\"THIN_INSTANCES\",!!(null==r?void 0:r.getRenderingMesh().hasThinInstances)),o=!0),o&&i.markAsUnprocessed()},t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t);var i=t.sharedData.scene.getEngine();t.sharedData.blocksWithDefines.push(this);var n=this._outputs[0],r=this._outputs[1],o=this.world0,a=this.world1,s=this.world2,l=this.world3;return t.compilationString+=\"#ifdef INSTANCES\\r\\n\",t.compilationString+=this._declareOutput(n,t)+\" = mat4(\".concat(o.associatedVariableName,\", \").concat(a.associatedVariableName,\", \").concat(s.associatedVariableName,\", \").concat(l.associatedVariableName,\");\\r\\n\"),t.compilationString+=\"#ifdef THIN_INSTANCES\\r\\n\",t.compilationString+=\"\".concat(n.associatedVariableName,\" = \").concat(this.world.associatedVariableName,\" * \").concat(n.associatedVariableName,\";\\r\\n\"),t.compilationString+=\"#endif\\r\\n\",i._caps.canUseGLInstanceID?t.compilationString+=this._declareOutput(r,t)+\" = float(gl_InstanceID);\\r\\n\":t.compilationString+=this._declareOutput(r,t)+\" = 0.0;\\r\\n\",t.compilationString+=\"#else\\r\\n\",t.compilationString+=this._declareOutput(n,t)+\" = \".concat(this.world.associatedVariableName,\";\\r\\n\"),t.compilationString+=this._declareOutput(r,t)+\" = 0.0;\\r\\n\",t.compilationString+=\"#endif\\r\\n\",this},t}(Xo);b(\"BABYLON.InstancesBlock\",km);var Gm=function(e){function t(t){var i=e.call(this,t,Bo.Vertex)||this;return i.registerInput(\"position\",wo.Vector3),i.registerInput(\"normal\",wo.Vector3),i.registerInput(\"tangent\",wo.Vector4),i.tangent.acceptedConnectionPointTypes.push(wo.Vector3),i.registerInput(\"uv\",wo.Vector2),i.registerOutput(\"positionOutput\",wo.Vector3),i.registerOutput(\"normalOutput\",wo.Vector3),i.registerOutput(\"tangentOutput\",wo.Vector4),i.registerOutput(\"uvOutput\",wo.Vector2),i}return V(t,e),t.prototype.getClassName=function(){return\"MorphTargetsBlock\"},Object.defineProperty(t.prototype,\"position\",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"normal\",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"tangent\",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"uv\",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"positionOutput\",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"normalOutput\",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"tangentOutput\",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"uvOutput\",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),t.prototype.initialize=function(e){e._excludeVariableName(\"morphTargetInfluences\")},t.prototype.autoConfigure=function(e){if(!this.position.isConnected){var t=e.getInputBlockByPredicate((function(e){return e.isAttribute&&\"position\"===e.name}));t||(t=new oa(\"position\")).setAsAttribute(),t.output.connectTo(this.position)}if(!this.normal.isConnected){var i=e.getInputBlockByPredicate((function(e){return e.isAttribute&&\"normal\"===e.name}));i||(i=new oa(\"normal\")).setAsAttribute(\"normal\"),i.output.connectTo(this.normal)}if(!this.tangent.isConnected){var n=e.getInputBlockByPredicate((function(e){return e.isAttribute&&\"tangent\"===e.name}));n||(n=new oa(\"tangent\")).setAsAttribute(\"tangent\"),n.output.connectTo(this.tangent)}if(!this.uv.isConnected){var r=e.getInputBlockByPredicate((function(e){return e.isAttribute&&\"uv\"===e.name}));r||(r=new oa(\"uv\")).setAsAttribute(\"uv\"),r.output.connectTo(this.uv)}},t.prototype.prepareDefines=function(e,t,i){if(e.morphTargetManager){var n=e.morphTargetManager;(null==n?void 0:n.isUsingTextureForTargets)&&n.numInfluencers!==i.NUM_MORPH_INFLUENCERS&&i.markAsAttributesDirty()}i._areAttributesDirty&&Pr.PrepareDefinesForMorphTargets(e,i)},t.prototype.bind=function(e,t,i){i&&i.morphTargetManager&&i.morphTargetManager.numInfluencers>0&&(Pr.BindMorphTargetParameters(i,e),i.morphTargetManager.isUsingTextureForTargets&&i.morphTargetManager._bind(e))},t.prototype.replaceRepeatableContent=function(e,t,i,n){var r=this.position,o=this.normal,a=this.tangent,s=this.uv,l=this.positionOutput,c=this.normalOutput,u=this.tangentOutput,h=this.uvOutput,d=e,p=n.NUM_MORPH_INFLUENCERS,f=i.morphTargetManager,_=f&&f.supportsNormals&&n.NORMAL,m=f&&f.supportsTangents&&n.TANGENT,g=f&&f.supportsUVs&&n.UV1,v=\"\";(null==f?void 0:f.isUsingTextureForTargets)&&p>0&&(v+=\"float vertexID;\\r\\n\");for(var y=0;y0)for(y=0;y\\(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_SAMPLERNAME_,bump\\)/g,replace:\"\"},{search:/uniform sampler2D bumpSampler;/g,replace:\"\"},{search:/vec2 parallaxOcclusion\\(vec3 vViewDirCoT,vec3 vNormalCoT,vec2 texCoord,float parallaxScale\\)/g,replace:\"#define inline\\r\\nvec2 parallaxOcclusion(vec3 vViewDirCoT, vec3 vNormalCoT, vec2 texCoord, float parallaxScale, sampler2D bumpSampler)\"},{search:/vec2 parallaxOffset\\(vec3 viewDir,float heightScale\\)/g,replace:\"vec2 parallaxOffset(vec3 viewDir, float heightScale, float height_)\"},{search:/texture2D\\(bumpSampler,vBumpUV\\)\\.w/g,replace:\"height_\"}]});var p=l&&s?\"texture2D(\".concat(s,\", \").concat(n.associatedVariableName,\" + uvOffset).xyz\"):this.normalMapColor.associatedVariableName;return t.compilationString+=this._declareOutput(this.output,t)+\" = vec4(0.);\\r\\n\",t.compilationString+=t._emitCodeFromInclude(\"bumpFragment\",i,{replaceStrings:[{search:/perturbNormal\\(TBN,texture2D\\(bumpSampler,vBumpUV\\+uvOffset\\).xyz,vBumpInfos.y\\)/g,replace:\"perturbNormal(TBN, \".concat(p,\", vBumpInfos.y)\")},{search:/parallaxOcclusion\\(invTBN\\*-viewDirectionW,invTBN\\*normalW,vBumpUV,vBumpInfos.z\\)/g,replace:\"parallaxOcclusion((invTBN * -viewDirectionW), (invTBN * normalW), vBumpUV, vBumpInfos.z, \".concat(l&&this.useParallaxOcclusion?s:\"bumpSampler\",\")\")},{search:/parallaxOffset\\(invTBN\\*viewDirectionW,vBumpInfos\\.z\\)/g,replace:\"parallaxOffset(invTBN * viewDirectionW, vBumpInfos.z, \".concat(l?this.parallaxHeight.associatedVariableName:\"0.\",\")\")},{search:/vTangentSpaceParams/g,replace:this._tangentSpaceParameterName},{search:/vBumpInfos.y/g,replace:u},{search:/vBumpInfos.z/g,replace:c},{search:/vBumpUV/g,replace:n.associatedVariableName},{search:/vPositionW/g,replace:r.associatedVariableName+\".xyz\"},{search:/normalW=/g,replace:this.output.associatedVariableName+\".xyz = \"},{search:/mat3\\(normalMatrix\\)\\*normalW/g,replace:\"mat3(normalMatrix) * \"+this.output.associatedVariableName+\".xyz\"},{search:/normalW/g,replace:o.associatedVariableName+\".xyz\"},{search:/viewDirectionW/g,replace:l?this.viewDirection.associatedVariableName:\"vec3(0.)\"},h]}),this},t.prototype._dumpPropertiesCode=function(){var t=e.prototype._dumpPropertiesCode.call(this)+\"\".concat(this._codeVariableName,\".invertX = \").concat(this.invertX,\";\\r\\n\");return(t+=\"\".concat(this._codeVariableName,\".invertY = \").concat(this.invertY,\";\\r\\n\"))+\"\".concat(this._codeVariableName,\".useParallaxOcclusion = \").concat(this.useParallaxOcclusion,\";\\r\\n\")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.invertX=this.invertX,t.invertY=this.invertY,t.useParallaxOcclusion=this.useParallaxOcclusion,t},t.prototype._deserialize=function(t,i,n){e.prototype._deserialize.call(this,t,i,n),this.invertX=t.invertX,this.invertY=t.invertY,this.useParallaxOcclusion=!!t.useParallaxOcclusion},G([Qo(\"Invert X axis\",Yo.Boolean,\"PROPERTIES\",{notifiers:{update:!1}})],t.prototype,\"invertX\",void 0),G([Qo(\"Invert Y axis\",Yo.Boolean,\"PROPERTIES\",{notifiers:{update:!1}})],t.prototype,\"invertY\",void 0),G([Qo(\"Use parallax occlusion\",Yo.Boolean)],t.prototype,\"useParallaxOcclusion\",void 0),t}(Xo);b(\"BABYLON.PerturbNormalBlock\",Xm);var jm=function(e){function t(t){var i=e.call(this,t,Bo.Fragment,!0)||this;return i.registerInput(\"value\",wo.Float,!0),i.registerInput(\"cutoff\",wo.Float,!0),i}return V(t,e),t.prototype.getClassName=function(){return\"DiscardBlock\"},Object.defineProperty(t.prototype,\"value\",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"cutoff\",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){if(e.prototype._buildBlock.call(this,t),t.sharedData.hints.needAlphaTesting=!0,this.cutoff.isConnected&&this.value.isConnected)return t.compilationString+=\"if (\".concat(this.value.associatedVariableName,\" < \").concat(this.cutoff.associatedVariableName,\") discard;\\r\\n\"),this},t}(Xo);b(\"BABYLON.DiscardBlock\",jm);var Ym=function(e){function t(t){var i=e.call(this,t,Bo.Fragment)||this;return i.registerOutput(\"output\",wo.Float,Bo.Fragment),i}return V(t,e),t.prototype.getClassName=function(){return\"FrontFacingBlock\"},Object.defineProperty(t.prototype,\"output\",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){if(e.prototype._buildBlock.call(this,t),t.target===Bo.Vertex)throw\"FrontFacingBlock must only be used in a fragment shader\";var i=this._outputs[0];return t.compilationString+=this._declareOutput(i,t)+\" = gl_FrontFacing ? 1.0 : 0.0;\\r\\n\",this},t}(Xo);b(\"BABYLON.FrontFacingBlock\",Ym);var Km=function(e){function t(t){var i=e.call(this,t,Bo.Fragment)||this;return i.registerInput(\"input\",wo.AutoDetect,!1),i.registerOutput(\"dx\",wo.BasedOnInput),i.registerOutput(\"dy\",wo.BasedOnInput),i._outputs[0]._typeConnectionSource=i._inputs[0],i._outputs[1]._typeConnectionSource=i._inputs[0],i}return V(t,e),t.prototype.getClassName=function(){return\"DerivativeBlock\"},Object.defineProperty(t.prototype,\"input\",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"dx\",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"dy\",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t);var i=this._outputs[0],n=this._outputs[1];return t._emitExtension(\"derivatives\",\"#extension GL_OES_standard_derivatives : enable\"),i.hasEndpoints&&(t.compilationString+=this._declareOutput(i,t)+\" = dFdx(\".concat(this.input.associatedVariableName,\");\\r\\n\")),n.hasEndpoints&&(t.compilationString+=this._declareOutput(n,t)+\" = dFdy(\".concat(this.input.associatedVariableName,\");\\r\\n\")),this},t}(Xo);b(\"BABYLON.DerivativeBlock\",Km);var Qm=function(e){function t(t){var i=e.call(this,t,Bo.Fragment)||this;return i.registerOutput(\"xy\",wo.Vector2,Bo.Fragment),i.registerOutput(\"xyz\",wo.Vector3,Bo.Fragment),i.registerOutput(\"xyzw\",wo.Vector4,Bo.Fragment),i.registerOutput(\"x\",wo.Float,Bo.Fragment),i.registerOutput(\"y\",wo.Float,Bo.Fragment),i.registerOutput(\"z\",wo.Float,Bo.Fragment),i.registerOutput(\"w\",wo.Float,Bo.Fragment),i}return V(t,e),t.prototype.getClassName=function(){return\"FragCoordBlock\"},Object.defineProperty(t.prototype,\"xy\",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"xyz\",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"xyzw\",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"x\",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"y\",{get:function(){return this._outputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"z\",{get:function(){return this._outputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"output\",{get:function(){return this._outputs[6]},enumerable:!1,configurable:!0}),t.prototype.writeOutputs=function(e){for(var t=\"\",i=0,n=this._outputs;i=0;Pr.PrepareUniformsAndSamplersForLight(r,e.uniforms,e.samplers,i[\"PROJECTEDLIGHTTEXTURE\"+r],n,o)}},t.prototype.bind=function(e,t,i){if(i){var n=i.getScene();this.light?Pr.BindLight(this.light,this._lightId,n,e,!0):Pr.BindLights(n,i,e,!0,t.maxSimultaneousLights)}},t.prototype._injectVertexCode=function(e){var t=this.worldPosition,i=\"//\".concat(this.name);this.light?(this._lightId=(void 0!==e.counters.lightCounter?e.counters.lightCounter:-1)+1,e.counters.lightCounter=this._lightId,e._emitFunctionFromInclude(e.supportUniformBuffers?\"lightVxUboDeclaration\":\"lightVxFragmentDeclaration\",i,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()}]},this._lightId.toString())):(e._emitFunctionFromInclude(e.supportUniformBuffers?\"lightVxUboDeclaration\":\"lightVxFragmentDeclaration\",i,{repeatKey:\"maxSimultaneousLights\"}),this._lightId=0,e.sharedData.dynamicUniformBlocks.push(this));var n=\"v_\"+t.associatedVariableName;e._emitVaryingFromString(n,\"vec4\")&&(e.compilationString+=\"\".concat(n,\" = \").concat(t.associatedVariableName,\";\\r\\n\")),this.light?e.compilationString+=e._emitCodeFromInclude(\"shadowsVertex\",i,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()},{search:/worldPos/g,replace:t.associatedVariableName}]}):(e.compilationString+=\"vec4 worldPos = \".concat(t.associatedVariableName,\";\\r\\n\"),this.view.isConnected&&(e.compilationString+=\"mat4 view = \".concat(this.view.associatedVariableName,\";\\r\\n\")),e.compilationString+=e._emitCodeFromInclude(\"shadowsVertex\",i,{repeatKey:\"maxSimultaneousLights\"}))},t.prototype._buildBlock=function(t){if(e.prototype._buildBlock.call(this,t),t.target===Bo.Fragment){t.sharedData.forcedBindableBlocks.push(this),t.sharedData.blocksWithDefines.push(this);var i=\"//\".concat(this.name),n=this.worldPosition;t._emitFunctionFromInclude(\"helperFunctions\",i),t._emitFunctionFromInclude(\"lightsFragmentFunctions\",i,{replaceStrings:[{search:/vPositionW/g,replace:\"v_\"+n.associatedVariableName+\".xyz\"}]}),t._emitFunctionFromInclude(\"shadowsFragmentFunctions\",i,{replaceStrings:[{search:/vPositionW/g,replace:\"v_\"+n.associatedVariableName+\".xyz\"}]}),this.light?t._emitFunctionFromInclude(t.supportUniformBuffers?\"lightUboDeclaration\":\"lightFragmentDeclaration\",i,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()}]},this._lightId.toString()):t._emitFunctionFromInclude(t.supportUniformBuffers?\"lightUboDeclaration\":\"lightFragmentDeclaration\",i,{repeatKey:\"maxSimultaneousLights\"}),0===this._lightId&&(t._registerTempVariable(\"viewDirectionW\")&&(t.compilationString+=\"vec3 viewDirectionW = normalize(\".concat(this.cameraPosition.associatedVariableName,\" - \").concat(\"v_\"+n.associatedVariableName,\".xyz);\\r\\n\")),t.compilationString+=\"lightingInfo info;\\r\\n\",t.compilationString+=\"float shadow = 1.;\\r\\n\",t.compilationString+=\"float glossiness = \".concat(this.glossiness.isConnected?this.glossiness.associatedVariableName:\"1.0\",\" * \").concat(this.glossPower.isConnected?this.glossPower.associatedVariableName:\"1024.0\",\";\\r\\n\"),t.compilationString+=\"vec3 diffuseBase = vec3(0., 0., 0.);\\r\\n\",t.compilationString+=\"vec3 specularBase = vec3(0., 0., 0.);\\r\\n\",t.compilationString+=\"vec3 normalW = \".concat(this.worldNormal.associatedVariableName,\".xyz;\\r\\n\")),this.light?t.compilationString+=t._emitCodeFromInclude(\"lightFragment\",i,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()}]}):t.compilationString+=t._emitCodeFromInclude(\"lightFragment\",i,{repeatKey:\"maxSimultaneousLights\"});var r=this.diffuseOutput,o=this.specularOutput;return t.compilationString+=this._declareOutput(r,t)+\" = diffuseBase\".concat(this.diffuseColor.isConnected?\" * \"+this.diffuseColor.associatedVariableName:\"\",\";\\r\\n\"),o.hasEndpoints&&(t.compilationString+=this._declareOutput(o,t)+\" = specularBase\".concat(this.specularColor.isConnected?\" * \"+this.specularColor.associatedVariableName:\"\",\";\\r\\n\")),this.shadow.hasEndpoints&&(t.compilationString+=this._declareOutput(this.shadow,t)+\" = shadow;\\r\\n\"),this}this._injectVertexCode(t)},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return this.light&&(t.lightId=this.light.id),t},t.prototype._deserialize=function(t,i,n){e.prototype._deserialize.call(this,t,i,n),t.lightId&&(this.light=i.getLightById(t.lightId))},t}(Xo);b(\"BABYLON.LightBlock\",tg);var ig=function(e){function t(i){var n=e.call(this,i,Bo.VertexAndFragment)||this;return n.registerOutput(\"source\",wo.Object,Bo.VertexAndFragment,new Um(\"source\",n,Go.Output,t,\"ImageSourceBlock\")),n}return V(t,e),Object.defineProperty(t.prototype,\"texture\",{get:function(){return this._texture},set:function(e){var t,i=this;if(this._texture!==e){var n=null!==(t=null==e?void 0:e.getScene())&&void 0!==t?t:S.LastCreatedScene;!e&&n&&n.markAllMaterialsAsDirty(a.MATERIAL_TextureDirtyFlag,(function(e){return e.hasTexture(i._texture)})),this._texture=e,e&&n&&n.markAllMaterialsAsDirty(a.MATERIAL_TextureDirtyFlag,(function(t){return t.hasTexture(e)}))}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"samplerName\",{get:function(){return this._samplerName},enumerable:!1,configurable:!0}),t.prototype.bind=function(e){this.texture&&e.setTexture(this._samplerName,this.texture)},t.prototype.isReady=function(){return!(this.texture&&!this.texture.isReadyOrNotBlocking())},t.prototype.getClassName=function(){return\"ImageSourceBlock\"},Object.defineProperty(t.prototype,\"source\",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){return e.prototype._buildBlock.call(this,t),t.target===Bo.Vertex&&(this._samplerName=t._getFreeVariableName(this.name+\"Sampler\"),t.sharedData.blockingBlocks.push(this),t.sharedData.textureBlocks.push(this),t.sharedData.bindableBlocks.push(this)),t._emit2DSampler(this._samplerName),this},t.prototype._dumpPropertiesCode=function(){var t=e.prototype._dumpPropertiesCode.call(this);return this.texture?(t+=\"\".concat(this._codeVariableName,'.texture = new BABYLON.Texture(\"').concat(this.texture.name,'\", null, ').concat(this.texture.noMipmap,\", \").concat(this.texture.invertY,\", \").concat(this.texture.samplingMode,\");\\r\\n\"),t+=\"\".concat(this._codeVariableName,\".texture.wrapU = \").concat(this.texture.wrapU,\";\\r\\n\"),t+=\"\".concat(this._codeVariableName,\".texture.wrapV = \").concat(this.texture.wrapV,\";\\r\\n\"),t+=\"\".concat(this._codeVariableName,\".texture.uAng = \").concat(this.texture.uAng,\";\\r\\n\"),t+=\"\".concat(this._codeVariableName,\".texture.vAng = \").concat(this.texture.vAng,\";\\r\\n\"),t+=\"\".concat(this._codeVariableName,\".texture.wAng = \").concat(this.texture.wAng,\";\\r\\n\"),t+=\"\".concat(this._codeVariableName,\".texture.uOffset = \").concat(this.texture.uOffset,\";\\r\\n\"),t+=\"\".concat(this._codeVariableName,\".texture.vOffset = \").concat(this.texture.vOffset,\";\\r\\n\"),t+=\"\".concat(this._codeVariableName,\".texture.uScale = \").concat(this.texture.uScale,\";\\r\\n\"),t+=\"\".concat(this._codeVariableName,\".texture.vScale = \").concat(this.texture.vScale,\";\\r\\n\"),t+=\"\".concat(this._codeVariableName,\".texture.coordinatesMode = \").concat(this.texture.coordinatesMode,\";\\r\\n\")):t},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return this.texture&&!this.texture.isRenderTarget&&\"VideoTexture\"!==this.texture.getClassName()&&(t.texture=this.texture.serialize()),t},t.prototype._deserialize=function(t,i,n){e.prototype._deserialize.call(this,t,i,n),t.texture&&!Ba.IgnoreTexturesAtLoadTime&&void 0!==t.texture.url&&(n=0===t.texture.url.indexOf(\"data:\")?\"\":n,this.texture=to.Parse(t.texture,i,n))},t}(Xo);b(\"BABYLON.ImageSourceBlock\",ig);var ng=function(e){function t(t,i){void 0===i&&(i=!1);var n=e.call(this,t,i?Bo.Fragment:Bo.VertexAndFragment)||this;return n._convertToGammaSpace=!1,n._convertToLinearSpace=!1,n.disableLevelMultiplication=!1,n._fragmentOnly=i,n.registerInput(\"uv\",wo.Vector2,!1,Bo.VertexAndFragment),n.registerInput(\"source\",wo.Object,!0,Bo.VertexAndFragment,new Um(\"source\",n,Go.Input,ig,\"ImageSourceBlock\")),n.registerOutput(\"rgba\",wo.Color4,Bo.Neutral),n.registerOutput(\"rgb\",wo.Color3,Bo.Neutral),n.registerOutput(\"r\",wo.Float,Bo.Neutral),n.registerOutput(\"g\",wo.Float,Bo.Neutral),n.registerOutput(\"b\",wo.Float,Bo.Neutral),n.registerOutput(\"a\",wo.Float,Bo.Neutral),n.registerOutput(\"level\",wo.Float,Bo.Neutral),n._inputs[0].acceptedConnectionPointTypes.push(wo.Vector3),n._inputs[0].acceptedConnectionPointTypes.push(wo.Vector4),n._inputs[0]._prioritizeVertex=!i,n}return V(t,e),Object.defineProperty(t.prototype,\"texture\",{get:function(){var e;return this.source.isConnected?(null===(e=this.source.connectedPoint)||void 0===e?void 0:e.ownerBlock).texture:this._texture},set:function(e){var t,i=this;if(this._texture!==e){var n=null!==(t=null==e?void 0:e.getScene())&&void 0!==t?t:S.LastCreatedScene;!e&&n&&n.markAllMaterialsAsDirty(a.MATERIAL_TextureDirtyFlag,(function(e){return e.hasTexture(i._texture)})),this._texture=e,e&&n&&n.markAllMaterialsAsDirty(a.MATERIAL_TextureDirtyFlag,(function(t){return t.hasTexture(e)}))}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"samplerName\",{get:function(){return this._imageSource?this._imageSource.samplerName:this._samplerName},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"hasImageSource\",{get:function(){return!!this._imageSource},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"convertToGammaSpace\",{get:function(){return this._convertToGammaSpace},set:function(e){var t,i=this;if(e!==this._convertToGammaSpace&&(this._convertToGammaSpace=e,this.texture)){var n=null!==(t=this.texture.getScene())&&void 0!==t?t:S.LastCreatedScene;null==n||n.markAllMaterialsAsDirty(a.MATERIAL_TextureDirtyFlag,(function(e){return e.hasTexture(i.texture)}))}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"convertToLinearSpace\",{get:function(){return this._convertToLinearSpace},set:function(e){var t,i=this;if(e!==this._convertToLinearSpace&&(this._convertToLinearSpace=e,this.texture)){var n=null!==(t=this.texture.getScene())&&void 0!==t?t:S.LastCreatedScene;null==n||n.markAllMaterialsAsDirty(a.MATERIAL_TextureDirtyFlag,(function(e){return e.hasTexture(i.texture)}))}},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return\"TextureBlock\"},Object.defineProperty(t.prototype,\"uv\",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"source\",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"rgba\",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"rgb\",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"r\",{get:function(){return this._outputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"g\",{get:function(){return this._outputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"b\",{get:function(){return this._outputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"a\",{get:function(){return this._outputs[5]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"level\",{get:function(){return this._outputs[6]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"target\",{get:function(){if(this._fragmentOnly)return Bo.Fragment;if(!this.uv.isConnected)return Bo.VertexAndFragment;if(this.uv.sourceBlock.isInput)return Bo.VertexAndFragment;for(var e=this.uv.connectedPoint;e;){if(e.target===Bo.Fragment)return Bo.Fragment;if(e.target===Bo.Vertex)return Bo.VertexAndFragment;if(e.target===Bo.Neutral||e.target===Bo.VertexAndFragment){var t=e.ownerBlock;if(t.target===Bo.Fragment)return Bo.Fragment;e=null;for(var i=0,n=t.inputs;i0&&(t.compilationString+=\", \"),t.compilationString+=e.associatedVariableName,o=!0})),this._outputs.forEach((function(e,i){(i>0||o)&&(t.compilationString+=\", \"),t.compilationString+=e.associatedVariableName})),t.compilationString+=\");\\r\\n\",this},t.prototype._dumpPropertiesCode=function(){return e.prototype._dumpPropertiesCode.call(this)+\"\".concat(this._codeVariableName,\".options = \").concat(JSON.stringify(this._options),\";\\r\\n\")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.options=this._options,t},t.prototype._deserialize=function(t,i,n){this._deserializeOptions(t.options),e.prototype._deserialize.call(this,t,i,n)},t.prototype._deserializeOptions=function(e){var t,i,n,r=this;this._options=e,this._code=e.code.join(\"\\r\\n\")+\"\\r\\n\",this.name=this.name||e.name,this.target=Bo[e.target],null===(t=e.inParameters)||void 0===t||t.forEach((function(e,t){var i=wo[e.type];r.registerInput(e.name,i),Object.defineProperty(r,e.name,{get:function(){return this._inputs[t]},enumerable:!0,configurable:!0})})),null===(i=e.outParameters)||void 0===i||i.forEach((function(e,t){r.registerOutput(e.name,wo[e.type]),Object.defineProperty(r,e.name,{get:function(){return this._outputs[t]},enumerable:!0,configurable:!0}),\"BasedOnInput\"===e.type&&(r._outputs[t]._typeConnectionSource=r._findInputByName(e.typeFromInput)[0])})),null===(n=e.inLinkedConnectionTypes)||void 0===n||n.forEach((function(e){r._linkConnectionTypes(r._findInputByName(e.input1)[1],r._findInputByName(e.input2)[1])}))},t.prototype._findInputByName=function(e){if(!e)return null;for(var t=0;t=0;Pr.PrepareUniformsAndSamplersForLight(r,e.uniforms,e.samplers,i[\"PROJECTEDLIGHTTEXTURE\"+r],n,o)}},t.prototype.isReady=function(e,t,i){return!(this._environmentBRDFTexture&&!this._environmentBRDFTexture.isReady()||i._areImageProcessingDirty&&t.imageProcessingConfiguration&&!t.imageProcessingConfiguration.isReady())},t.prototype.bind=function(e,t,i){var n,r;if(i){var o=i.getScene();this.light?Pr.BindLight(this.light,this._lightId,o,e,!0):Pr.BindLights(o,i,e,!0,t.maxSimultaneousLights),e.setTexture(this._environmentBrdfSamplerName,this._environmentBRDFTexture),e.setFloat2(\"vDebugMode\",this.debugLimit,this.debugFactor);var a=this._scene.ambientColor;a&&e.setColor3(\"ambientFromScene\",a);var s=o.useRightHandedSystem===(null!=o._mirroredCameraPosition);e.setFloat(this._invertNormalName,s?-1:1),e.setFloat4(\"vLightingIntensity\",this.directIntensity,1,this.environmentIntensity*this._scene.environmentIntensity,this.specularIntensity);var l=null!==(r=null===(n=this.indexOfRefraction.connectInputBlock)||void 0===n?void 0:n.value)&&void 0!==r?r:1.5,c=Math.pow((l-1)/(l+1),2);this._metallicReflectanceColor.scaleToRef(c*this._metallicF0Factor,F.Color3[0]);var u=this._metallicF0Factor;e.setColor4(this._vMetallicReflectanceFactorsName,F.Color3[0],u),t.imageProcessingConfiguration&&t.imageProcessingConfiguration.bind(e)}},t.prototype._injectVertexCode=function(e){var t,i,n=this.worldPosition,r=\"//\".concat(this.name);this.light?(this._lightId=(void 0!==e.counters.lightCounter?e.counters.lightCounter:-1)+1,e.counters.lightCounter=this._lightId,e._emitFunctionFromInclude(e.supportUniformBuffers?\"lightVxUboDeclaration\":\"lightVxFragmentDeclaration\",r,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()}]},this._lightId.toString())):(e._emitFunctionFromInclude(e.supportUniformBuffers?\"lightVxUboDeclaration\":\"lightVxFragmentDeclaration\",r,{repeatKey:\"maxSimultaneousLights\"}),this._lightId=0,e.sharedData.dynamicUniformBlocks.push(this));var o=\"v_\"+n.associatedVariableName;e._emitVaryingFromString(o,\"vec4\")&&(e.compilationString+=\"\".concat(o,\" = \").concat(n.associatedVariableName,\";\\r\\n\"));var a=this.reflection.isConnected?null===(t=this.reflection.connectedPoint)||void 0===t?void 0:t.ownerBlock:null;a&&(a.viewConnectionPoint=this.view),e.compilationString+=null!==(i=null==a?void 0:a.handleVertexSide(e))&&void 0!==i?i:\"\",e._emitUniformFromString(\"vDebugMode\",\"vec2\",\"defined(IGNORE) || DEBUGMODE > 0\"),e._emitUniformFromString(\"ambientFromScene\",\"vec3\"),e._emitVaryingFromString(\"vClipSpacePosition\",\"vec4\",\"defined(IGNORE) || DEBUGMODE > 0\")&&(e._injectAtEnd+=\"#if DEBUGMODE > 0\\r\\n\",e._injectAtEnd+=\"vClipSpacePosition = gl_Position;\\r\\n\",e._injectAtEnd+=\"#endif\\r\\n\"),this.light?e.compilationString+=e._emitCodeFromInclude(\"shadowsVertex\",r,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()},{search:/worldPos/g,replace:n.associatedVariableName}]}):(e.compilationString+=\"vec4 worldPos = \".concat(n.associatedVariableName,\";\\r\\n\"),this.view.isConnected&&(e.compilationString+=\"mat4 view = \".concat(this.view.associatedVariableName,\";\\r\\n\")),e.compilationString+=e._emitCodeFromInclude(\"shadowsVertex\",r,{repeatKey:\"maxSimultaneousLights\"}))},t.prototype._getAlbedoOpacityCode=function(){var e=\"albedoOpacityOutParams albedoOpacityOut;\\r\\n\",t=this.baseColor.isConnected?this.baseColor.associatedVariableName:\"vec3(1.)\",i=this.opacity.isConnected?this.opacity.associatedVariableName:\"1.\";return e+\"albedoOpacityBlock(\\n vec4(\".concat(t,\", 1.),\\n #ifdef ALBEDO\\n vec4(1.),\\n vec2(1., 1.),\\n #endif\\n #ifdef OPACITY\\n vec4(\").concat(i,\"),\\n vec2(1., 1.),\\n #endif\\n albedoOpacityOut\\n );\\n\\n vec3 surfaceAlbedo = albedoOpacityOut.surfaceAlbedo;\\n float alpha = albedoOpacityOut.alpha;\\r\\n\")},t.prototype._getAmbientOcclusionCode=function(){var e=\"ambientOcclusionOutParams aoOut;\\r\\n\",t=this.ambientOcc.isConnected?this.ambientOcc.associatedVariableName:\"1.\";return e+\"ambientOcclusionBlock(\\n #ifdef AMBIENT\\n vec3(\".concat(t,\"),\\n vec4(0., 1.0, 1.0, 0.),\\n #endif\\n aoOut\\n );\\r\\n\")},t.prototype._getReflectivityCode=function(e){var t=\"reflectivityOutParams reflectivityOut;\\r\\n\";return this._vMetallicReflectanceFactorsName=e._getFreeVariableName(\"vMetallicReflectanceFactors\"),e._emitUniformFromString(this._vMetallicReflectanceFactorsName,\"vec4\"),t+\"vec3 baseColor = surfaceAlbedo;\\n\\n reflectivityBlock(\\n vec4(\".concat(this.metallic.associatedVariableName,\", \").concat(this.roughness.associatedVariableName,\", 0., 0.),\\n #ifdef METALLICWORKFLOW\\n surfaceAlbedo,\\n \").concat(this._vMetallicReflectanceFactorsName,\",\\n #endif\\n #ifdef REFLECTIVITY\\n vec3(0., 0., \").concat(\"1.\",\"),\\n vec4(1.),\\n #endif\\n #if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\\n aoOut.ambientOcclusionColor,\\n #endif\\n #ifdef MICROSURFACEMAP\\n microSurfaceTexel, <== not handled!\\n #endif\\n reflectivityOut\\n );\\n\\n float microSurface = reflectivityOut.microSurface;\\n float roughness = reflectivityOut.roughness;\\n\\n #ifdef METALLICWORKFLOW\\n surfaceAlbedo = reflectivityOut.surfaceAlbedo;\\n #endif\\n #if defined(METALLICWORKFLOW) && defined(REFLECTIVITY) && defined(AOSTOREINMETALMAPRED)\\n aoOut.ambientOcclusionColor = reflectivityOut.ambientOcclusionColor;\\n #endif\\r\\n\")},t.prototype._buildBlock=function(t){var i,n,r,o,a,s,l,c,u,h,d,p,f,_,m,g,v,y,b,T,E,S,A,R,x,C,P,M,I,O,D,N,L,F,w,B,U,V,k,G,z;e.prototype._buildBlock.call(this,t),this._scene=t.sharedData.scene,this._environmentBRDFTexture||(this._environmentBRDFTexture=Zp(this._scene));var W=this.reflection.isConnected?null===(i=this.reflection.connectedPoint)||void 0===i?void 0:i.ownerBlock:null;if(W&&(W.worldPositionConnectionPoint=this.worldPosition,W.cameraPositionConnectionPoint=this.cameraPosition,W.worldNormalConnectionPoint=this.worldNormal),t.target!==Bo.Fragment)return this._injectVertexCode(t),this;t.sharedData.forcedBindableBlocks.push(this),t.sharedData.blocksWithDefines.push(this),t.sharedData.blockingBlocks.push(this);var H=\"//\".concat(this.name),X=\"v_\"+this.worldPosition.associatedVariableName,j=this.perturbedNormal;this._environmentBrdfSamplerName=t._getFreeVariableName(\"environmentBrdfSampler\"),t._emit2DSampler(this._environmentBrdfSamplerName),t.sharedData.hints.needAlphaBlending=t.sharedData.hints.needAlphaBlending||this.useAlphaBlending,t.sharedData.hints.needAlphaTesting=t.sharedData.hints.needAlphaTesting||this.useAlphaTest,t._emitExtension(\"lod\",\"#extension GL_EXT_shader_texture_lod : enable\",\"defined(LODBASEDMICROSFURACE)\"),t._emitExtension(\"derivatives\",\"#extension GL_OES_standard_derivatives : enable\"),t.uniforms.push(\"exposureLinear\"),t.uniforms.push(\"contrast\"),t.uniforms.push(\"vInverseScreenSize\"),t.uniforms.push(\"vignetteSettings1\"),t.uniforms.push(\"vignetteSettings2\"),t.uniforms.push(\"vCameraColorCurveNegative\"),t.uniforms.push(\"vCameraColorCurveNeutral\"),t.uniforms.push(\"vCameraColorCurvePositive\"),t.uniforms.push(\"txColorTransform\"),t.uniforms.push(\"colorTransformSettings\"),t.uniforms.push(\"ditherIntensity\"),this.light?t._emitFunctionFromInclude(t.supportUniformBuffers?\"lightUboDeclaration\":\"lightFragmentDeclaration\",H,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()}]},this._lightId.toString()):t._emitFunctionFromInclude(t.supportUniformBuffers?\"lightUboDeclaration\":\"lightFragmentDeclaration\",H,{repeatKey:\"maxSimultaneousLights\"}),t._emitFunctionFromInclude(\"helperFunctions\",H),t._emitFunctionFromInclude(\"importanceSampling\",H),t._emitFunctionFromInclude(\"pbrHelperFunctions\",H),t._emitFunctionFromInclude(\"imageProcessingDeclaration\",H),t._emitFunctionFromInclude(\"imageProcessingFunctions\",H),t._emitFunctionFromInclude(\"shadowsFragmentFunctions\",H,{replaceStrings:[{search:/vPositionW/g,replace:X+\".xyz\"}]}),t._emitFunctionFromInclude(\"pbrDirectLightingSetupFunctions\",H,{replaceStrings:[{search:/vPositionW/g,replace:X+\".xyz\"}]}),t._emitFunctionFromInclude(\"pbrDirectLightingFalloffFunctions\",H),t._emitFunctionFromInclude(\"pbrBRDFFunctions\",H,{replaceStrings:[{search:/REFLECTIONMAP_SKYBOX/g,replace:null!==(n=null==W?void 0:W._defineSkyboxName)&&void 0!==n?n:\"REFLECTIONMAP_SKYBOX\"}]}),t._emitFunctionFromInclude(\"hdrFilteringFunctions\",H),t._emitFunctionFromInclude(\"pbrDirectLightingFunctions\",H,{replaceStrings:[{search:/vPositionW/g,replace:X+\".xyz\"}]}),t._emitFunctionFromInclude(\"pbrIBLFunctions\",H),t._emitFunctionFromInclude(\"pbrBlockAlbedoOpacity\",H),t._emitFunctionFromInclude(\"pbrBlockReflectivity\",H),t._emitFunctionFromInclude(\"pbrBlockAmbientOcclusion\",H),t._emitFunctionFromInclude(\"pbrBlockAlphaFresnel\",H),t._emitFunctionFromInclude(\"pbrBlockAnisotropic\",H),t._emitUniformFromString(\"vLightingIntensity\",\"vec4\"),this._vNormalWName=t._getFreeVariableName(\"vNormalW\"),t.compilationString+=\"vec4 \".concat(this._vNormalWName,\" = normalize(\").concat(this.worldNormal.associatedVariableName,\");\\r\\n\"),t._registerTempVariable(\"viewDirectionW\")&&(t.compilationString+=\"vec3 viewDirectionW = normalize(\".concat(this.cameraPosition.associatedVariableName,\" - \").concat(X,\".xyz);\\r\\n\")),t.compilationString+=\"vec3 geometricNormalW = \".concat(this._vNormalWName,\".xyz;\\r\\n\"),t.compilationString+=\"vec3 normalW = \".concat(j.isConnected?\"normalize(\"+j.associatedVariableName+\".xyz)\":\"geometricNormalW\",\";\\r\\n\"),this._invertNormalName=t._getFreeVariableName(\"invertNormal\"),t._emitUniformFromString(this._invertNormalName,\"float\"),t.compilationString+=t._emitCodeFromInclude(\"pbrBlockNormalFinal\",H,{replaceStrings:[{search:/vPositionW/g,replace:X+\".xyz\"},{search:/vEyePosition.w/g,replace:this._invertNormalName}]}),t.compilationString+=this._getAlbedoOpacityCode(),t.compilationString+=t._emitCodeFromInclude(\"depthPrePass\",H),t.compilationString+=this._getAmbientOcclusionCode(),t.compilationString+=t._emitCodeFromInclude(\"pbrBlockLightmapInit\",H),t.compilationString+=\"#ifdef UNLIT\\n vec3 diffuseBase = vec3(1., 1., 1.);\\n #else\\r\\n\",t.compilationString+=this._getReflectivityCode(t),t.compilationString+=t._emitCodeFromInclude(\"pbrBlockGeometryInfo\",H,{replaceStrings:[{search:/REFLECTIONMAP_SKYBOX/g,replace:null!==(r=null==W?void 0:W._defineSkyboxName)&&void 0!==r?r:\"REFLECTIONMAP_SKYBOX\"},{search:/REFLECTIONMAP_3D/g,replace:null!==(o=null==W?void 0:W._define3DName)&&void 0!==o?o:\"REFLECTIONMAP_3D\"}]});var Y=this.anisotropy.isConnected?null===(a=this.anisotropy.connectedPoint)||void 0===a?void 0:a.ownerBlock:null;Y&&(Y.worldPositionConnectionPoint=this.worldPosition,Y.worldNormalConnectionPoint=this.worldNormal,t.compilationString+=Y.getCode(t,!this.perturbedNormal.isConnected)),W&&W.hasTexture&&(t.compilationString+=W.getCode(t,Y?\"anisotropicOut.anisotropicNormal\":\"normalW\")),t._emitFunctionFromInclude(\"pbrBlockReflection\",H,{replaceStrings:[{search:/computeReflectionCoords/g,replace:\"computeReflectionCoordsPBR\"},{search:/REFLECTIONMAP_3D/g,replace:null!==(s=null==W?void 0:W._define3DName)&&void 0!==s?s:\"REFLECTIONMAP_3D\"},{search:/REFLECTIONMAP_OPPOSITEZ/g,replace:null!==(l=null==W?void 0:W._defineOppositeZ)&&void 0!==l?l:\"REFLECTIONMAP_OPPOSITEZ\"},{search:/REFLECTIONMAP_PROJECTION/g,replace:null!==(c=null==W?void 0:W._defineProjectionName)&&void 0!==c?c:\"REFLECTIONMAP_PROJECTION\"},{search:/REFLECTIONMAP_SKYBOX/g,replace:null!==(u=null==W?void 0:W._defineSkyboxName)&&void 0!==u?u:\"REFLECTIONMAP_SKYBOX\"},{search:/LODINREFLECTIONALPHA/g,replace:null!==(h=null==W?void 0:W._defineLODReflectionAlpha)&&void 0!==h?h:\"LODINREFLECTIONALPHA\"},{search:/LINEARSPECULARREFLECTION/g,replace:null!==(d=null==W?void 0:W._defineLinearSpecularReflection)&&void 0!==d?d:\"LINEARSPECULARREFLECTION\"},{search:/vReflectionFilteringInfo/g,replace:null!==(p=null==W?void 0:W._vReflectionFilteringInfoName)&&void 0!==p?p:\"vReflectionFilteringInfo\"}]}),t.compilationString+=t._emitCodeFromInclude(\"pbrBlockReflectance0\",H,{replaceStrings:[{search:/metallicReflectanceFactors/g,replace:this._vMetallicReflectanceFactorsName}]});var K=this.sheen.isConnected?null===(f=this.sheen.connectedPoint)||void 0===f?void 0:f.ownerBlock:null;K&&(t.compilationString+=K.getCode(W)),t._emitFunctionFromInclude(\"pbrBlockSheen\",H,{replaceStrings:[{search:/REFLECTIONMAP_3D/g,replace:null!==(_=null==W?void 0:W._define3DName)&&void 0!==_?_:\"REFLECTIONMAP_3D\"},{search:/REFLECTIONMAP_SKYBOX/g,replace:null!==(m=null==W?void 0:W._defineSkyboxName)&&void 0!==m?m:\"REFLECTIONMAP_SKYBOX\"},{search:/LODINREFLECTIONALPHA/g,replace:null!==(g=null==W?void 0:W._defineLODReflectionAlpha)&&void 0!==g?g:\"LODINREFLECTIONALPHA\"},{search:/LINEARSPECULARREFLECTION/g,replace:null!==(v=null==W?void 0:W._defineLinearSpecularReflection)&&void 0!==v?v:\"LINEARSPECULARREFLECTION\"}]});var Q=this.iridescence.isConnected?null===(y=this.iridescence.connectedPoint)||void 0===y?void 0:y.ownerBlock:null;t.compilationString+=Jg.GetCode(Q),t._emitFunctionFromInclude(\"pbrBlockIridescence\",H,{replaceStrings:[]});var q=this.clearcoat.isConnected?null===(b=this.clearcoat.connectedPoint)||void 0===b?void 0:b.ownerBlock:null,Z=!this.perturbedNormal.isConnected&&!this.anisotropy.isConnected,J=this.perturbedNormal.isConnected&&(null===(E=(null===(T=this.perturbedNormal.connectedPoint)||void 0===T?void 0:T.ownerBlock).worldTangent)||void 0===E?void 0:E.isConnected),$=this.anisotropy.isConnected&&(null===(S=this.anisotropy.connectedPoint)||void 0===S?void 0:S.ownerBlock).worldTangent.isConnected,ee=J||!this.perturbedNormal.isConnected&&$;t.compilationString+=Zg.GetCode(t,q,W,X,Z,ee,this.worldNormal.associatedVariableName),Z&&(ee=null!==(A=null==q?void 0:q.worldTangent.isConnected)&&void 0!==A&&A),t._emitFunctionFromInclude(\"pbrBlockClearcoat\",H,{replaceStrings:[{search:/computeReflectionCoords/g,replace:\"computeReflectionCoordsPBR\"},{search:/REFLECTIONMAP_3D/g,replace:null!==(R=null==W?void 0:W._define3DName)&&void 0!==R?R:\"REFLECTIONMAP_3D\"},{search:/REFLECTIONMAP_OPPOSITEZ/g,replace:null!==(x=null==W?void 0:W._defineOppositeZ)&&void 0!==x?x:\"REFLECTIONMAP_OPPOSITEZ\"},{search:/REFLECTIONMAP_PROJECTION/g,replace:null!==(C=null==W?void 0:W._defineProjectionName)&&void 0!==C?C:\"REFLECTIONMAP_PROJECTION\"},{search:/REFLECTIONMAP_SKYBOX/g,replace:null!==(P=null==W?void 0:W._defineSkyboxName)&&void 0!==P?P:\"REFLECTIONMAP_SKYBOX\"},{search:/LODINREFLECTIONALPHA/g,replace:null!==(M=null==W?void 0:W._defineLODReflectionAlpha)&&void 0!==M?M:\"LODINREFLECTIONALPHA\"},{search:/LINEARSPECULARREFLECTION/g,replace:null!==(I=null==W?void 0:W._defineLinearSpecularReflection)&&void 0!==I?I:\"LINEARSPECULARREFLECTION\"},{search:/defined\\(TANGENT\\)/g,replace:ee?\"defined(TANGENT)\":\"defined(IGNORE)\"}]}),t.compilationString+=t._emitCodeFromInclude(\"pbrBlockReflectance\",H,{replaceStrings:[{search:/REFLECTIONMAP_SKYBOX/g,replace:null!==(O=null==W?void 0:W._defineSkyboxName)&&void 0!==O?O:\"REFLECTIONMAP_SKYBOX\"},{search:/REFLECTIONMAP_3D/g,replace:null!==(D=null==W?void 0:W._define3DName)&&void 0!==D?D:\"REFLECTIONMAP_3D\"}]});var te=this.subsurface.isConnected?null===(N=this.subsurface.connectedPoint)||void 0===N?void 0:N.ownerBlock:null,ie=this.subsurface.isConnected?null===(F=(null===(L=this.subsurface.connectedPoint)||void 0===L?void 0:L.ownerBlock).refraction.connectedPoint)||void 0===F?void 0:F.ownerBlock:null;ie&&(ie.viewConnectionPoint=this.view,ie.indexOfRefractionConnectionPoint=this.indexOfRefraction),t.compilationString+=ev.GetCode(t,te,W,X),t._emitFunctionFromInclude(\"pbrBlockSubSurface\",H,{replaceStrings:[{search:/REFLECTIONMAP_3D/g,replace:null!==(w=null==W?void 0:W._define3DName)&&void 0!==w?w:\"REFLECTIONMAP_3D\"},{search:/REFLECTIONMAP_OPPOSITEZ/g,replace:null!==(B=null==W?void 0:W._defineOppositeZ)&&void 0!==B?B:\"REFLECTIONMAP_OPPOSITEZ\"},{search:/REFLECTIONMAP_PROJECTION/g,replace:null!==(U=null==W?void 0:W._defineProjectionName)&&void 0!==U?U:\"REFLECTIONMAP_PROJECTION\"},{search:/SS_REFRACTIONMAP_3D/g,replace:null!==(V=null==ie?void 0:ie._define3DName)&&void 0!==V?V:\"SS_REFRACTIONMAP_3D\"},{search:/SS_LODINREFRACTIONALPHA/g,replace:null!==(k=null==ie?void 0:ie._defineLODRefractionAlpha)&&void 0!==k?k:\"SS_LODINREFRACTIONALPHA\"},{search:/SS_LINEARSPECULARREFRACTION/g,replace:null!==(G=null==ie?void 0:ie._defineLinearSpecularRefraction)&&void 0!==G?G:\"SS_LINEARSPECULARREFRACTION\"},{search:/SS_REFRACTIONMAP_OPPOSITEZ/g,replace:null!==(z=null==ie?void 0:ie._defineOppositeZ)&&void 0!==z?z:\"SS_REFRACTIONMAP_OPPOSITEZ\"}]}),t.compilationString+=t._emitCodeFromInclude(\"pbrBlockDirectLighting\",H),this.light?t.compilationString+=t._emitCodeFromInclude(\"lightFragment\",H,{replaceStrings:[{search:/{X}/g,replace:this._lightId.toString()}]}):t.compilationString+=t._emitCodeFromInclude(\"lightFragment\",H,{repeatKey:\"maxSimultaneousLights\"}),t.compilationString+=t._emitCodeFromInclude(\"pbrBlockFinalLitComponents\",H),t.compilationString+=\"#endif\\r\\n\";var ne=this.ambientColor.isConnected?this.ambientColor.associatedVariableName:\"vec3(0., 0., 0.)\",re=ff.DEFAULT_AO_ON_ANALYTICAL_LIGHTS.toString();-1===re.indexOf(\".\")&&(re+=\".\"),t.compilationString+=t._emitCodeFromInclude(\"pbrBlockFinalUnlitComponents\",H,{replaceStrings:[{search:/vec3 finalEmissive[\\s\\S]*?finalEmissive\\*=vLightingIntensity\\.y;/g,replace:\"\"},{search:/vAmbientColor/g,replace:ne+\" * ambientFromScene\"},{search:/vAmbientInfos\\.w/g,replace:re}]}),t.compilationString+=t._emitCodeFromInclude(\"pbrBlockFinalColorComposition\",H,{replaceStrings:[{search:/finalEmissive/g,replace:\"vec3(0.)\"}]}),t.compilationString+=t._emitCodeFromInclude(\"pbrBlockImageProcessing\",H,{replaceStrings:[{search:/visibility/g,replace:\"1.\"}]}),t.compilationString+=t._emitCodeFromInclude(\"pbrDebug\",H,{replaceStrings:[{search:/vNormalW/g,replace:this._vNormalWName},{search:/vPositionW/g,replace:X},{search:/albedoTexture\\.rgb;/g,replace:\"vec3(1.);\\r\\ngl_FragColor.rgb = toGammaSpace(gl_FragColor.rgb);\\r\\n\"}]});for(var oe=0,ae=this._outputs;oe \").concat(this.b.associatedVariableName,\" ? \").concat(n,\" : \").concat(r,\";\\r\\n\");break;case rv.GreaterOrEqual:t.compilationString+=this._declareOutput(i,t)+\" = \".concat(this.a.associatedVariableName,\" >= \").concat(this.b.associatedVariableName,\" ? \").concat(n,\" : \").concat(r,\";\\r\\n\");break;case rv.Xor:t.compilationString+=this._declareOutput(i,t)+\" = (mod(\".concat(this.a.associatedVariableName,\" + \").concat(this.b.associatedVariableName,\", 2.0) > 0.0) ? \").concat(n,\" : \").concat(r,\";\\r\\n\");break;case rv.Or:t.compilationString+=this._declareOutput(i,t)+\" = (min(\".concat(this.a.associatedVariableName,\" + \").concat(this.b.associatedVariableName,\", 1.0) > 0.0) ? \").concat(n,\" : \").concat(r,\";\\r\\n\");break;case rv.And:t.compilationString+=this._declareOutput(i,t)+\" = (\".concat(this.a.associatedVariableName,\" * \").concat(this.b.associatedVariableName,\" > 0.0) ? \").concat(n,\" : \").concat(r,\";\\r\\n\")}return this},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.condition=this.condition,t},t.prototype._deserialize=function(t,i,n){e.prototype._deserialize.call(this,t,i,n),this.condition=t.condition},t.prototype._dumpPropertiesCode=function(){return e.prototype._dumpPropertiesCode.call(this)+\"\".concat(this._codeVariableName,\".condition = BABYLON.ConditionalBlockConditions.\").concat(rv[this.condition],\";\\r\\n\")},t}(Xo);b(\"BABYLON.ConditionalBlock\",av);var sv=function(e){function t(t){var i=e.call(this,t,Bo.Neutral)||this;return i.octaves=6,i.registerInput(\"seed\",wo.AutoDetect),i.registerInput(\"chaos\",wo.AutoDetect,!0),i.registerInput(\"offsetX\",wo.Float,!0),i.registerInput(\"offsetY\",wo.Float,!0),i.registerInput(\"offsetZ\",wo.Float,!0),i.registerOutput(\"output\",wo.Float),i._inputs[0].acceptedConnectionPointTypes.push(wo.Vector2),i._inputs[0].acceptedConnectionPointTypes.push(wo.Vector3),i._linkConnectionTypes(0,1),i}return V(t,e),t.prototype.getClassName=function(){return\"CloudBlock\"},Object.defineProperty(t.prototype,\"seed\",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"chaos\",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"offsetX\",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"offsetY\",{get:function(){return this._inputs[3]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"offsetZ\",{get:function(){return this._inputs[4]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"output\",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){var i,n;if(e.prototype._buildBlock.call(this,t),this.seed.isConnected&&this._outputs[0].hasEndpoints){var r=\"fbm\".concat(this.octaves);t._emitFunction(\"CloudBlockCode\",\"\\n\\n float cloudRandom(in float p) { p = fract(p * 0.011); p *= p + 7.5; p *= p + p; return fract(p); }\\n\\n // Based on Morgan McGuire @morgan3d\\n // https://www.shadertoy.com/view/4dS3Wd\\n float cloudNoise(in vec2 x, in vec2 chaos) {\\n vec2 step = chaos * vec2(75., 120.) + vec2(75., 120.);\\n\\n vec2 i = floor(x);\\n vec2 f = fract(x);\\n\\n float n = dot(i, step);\\n\\n vec2 u = f * f * (3.0 - 2.0 * f);\\n return mix(\\n mix(cloudRandom(n + dot(step, vec2(0, 0))), cloudRandom(n + dot(step, vec2(1, 0))), u.x),\\n mix(cloudRandom(n + dot(step, vec2(0, 1))), cloudRandom(n + dot(step, vec2(1, 1))), u.x),\\n u.y\\n );\\n }\\n\\n float cloudNoise(in vec3 x, in vec3 chaos) {\\n vec3 step = chaos * vec3(60., 120., 75.) + vec3(60., 120., 75.);\\n\\n vec3 i = floor(x);\\n vec3 f = fract(x);\\n\\n float n = dot(i, step);\\n\\n vec3 u = f * f * (3.0 - 2.0 * f);\\n return mix(mix(mix( cloudRandom(n + dot(step, vec3(0, 0, 0))), cloudRandom(n + dot(step, vec3(1, 0, 0))), u.x),\\n mix( cloudRandom(n + dot(step, vec3(0, 1, 0))), cloudRandom(n + dot(step, vec3(1, 1, 0))), u.x), u.y),\\n mix(mix( cloudRandom(n + dot(step, vec3(0, 0, 1))), cloudRandom(n + dot(step, vec3(1, 0, 1))), u.x),\\n mix( cloudRandom(n + dot(step, vec3(0, 1, 1))), cloudRandom(n + dot(step, vec3(1, 1, 1))), u.x), u.y), u.z);\\n }\",\"// CloudBlockCode\"),t._emitFunction(\"CloudBlockCodeFBM\"+this.octaves,\"\\n float fbm(in vec2 st, in vec2 chaos) {\\n // Initial values\\n float value = 0.0;\\n float amplitude = .5;\\n float frequency = 0.;\\n\\n // Loop of octaves\\n for (int i = 0; i < OCTAVES; i++) {\\n value += amplitude * cloudNoise(st, chaos);\\n st *= 2.0;\\n amplitude *= 0.5;\\n }\\n return value;\\n }\\n\\n float fbm(in vec3 x, in vec3 chaos) {\\n // Initial values\\n float value = 0.0;\\n float amplitude = 0.5;\\n for (int i = 0; i < OCTAVES; ++i) {\\n value += amplitude * cloudNoise(x, chaos);\\n x = x * 2.0;\\n amplitude *= 0.5;\\n }\\n return value;\\n }\".replace(/fbm/gi,r).replace(/OCTAVES/gi,(0|this.octaves).toString()),\"// CloudBlockCode FBM\");var o=t._getFreeVariableName(\"st\"),a=(null===(i=this.seed.connectedPoint)||void 0===i?void 0:i.type)===wo.Vector2?\"vec2\":\"vec3\";t.compilationString+=\"\".concat(a,\" \").concat(o,\" = \").concat(this.seed.associatedVariableName,\";\\r\\n\"),this.offsetX.isConnected&&(t.compilationString+=\"\".concat(o,\".x += 0.1 * \").concat(this.offsetX.associatedVariableName,\";\\r\\n\")),this.offsetY.isConnected&&(t.compilationString+=\"\".concat(o,\".y += 0.1 * \").concat(this.offsetY.associatedVariableName,\";\\r\\n\")),this.offsetZ.isConnected&&\"vec3\"===a&&(t.compilationString+=\"\".concat(o,\".z += 0.1 * \").concat(this.offsetZ.associatedVariableName,\";\\r\\n\"));var s;return s=this.chaos.isConnected?this.chaos.associatedVariableName:(null===(n=this.seed.connectedPoint)||void 0===n?void 0:n.type)===wo.Vector2?\"vec2(0., 0.)\":\"vec3(0., 0., 0.)\",t.compilationString+=this._declareOutput(this._outputs[0],t)+\" = \".concat(r,\"(\").concat(o,\", \").concat(s,\");\\r\\n\"),this}},t.prototype._dumpPropertiesCode=function(){return e.prototype._dumpPropertiesCode.call(this)+\"\".concat(this._codeVariableName,\".octaves = \").concat(this.octaves,\";\\r\\n\")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.octaves=this.octaves,t},t.prototype._deserialize=function(t,i,n){e.prototype._deserialize.call(this,t,i,n),this.octaves=t.octaves},G([Qo(\"Octaves\",Yo.Int)],t.prototype,\"octaves\",void 0),t}(Xo);b(\"BABYLON.CloudBlock\",sv);var lv=function(e){function t(t){var i=e.call(this,t,Bo.Neutral)||this;return i.registerInput(\"seed\",wo.Vector2),i.registerInput(\"offset\",wo.Float),i.registerInput(\"density\",wo.Float),i.registerOutput(\"output\",wo.Float),i.registerOutput(\"cells\",wo.Float),i}return V(t,e),t.prototype.getClassName=function(){return\"VoronoiNoiseBlock\"},Object.defineProperty(t.prototype,\"seed\",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"offset\",{get:function(){return this._inputs[1]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"density\",{get:function(){return this._inputs[2]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"output\",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"cells\",{get:function(){return this._outputs[1]},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){if(e.prototype._buildBlock.call(this,t),this.seed.isConnected){var i=\"vec2 voronoiRandom(vec2 seed, float offset){\\n mat2 m = mat2(15.27, 47.63, 99.41, 89.98);\\n vec2 uv = fract(sin(m * seed) * 46839.32);\\n return vec2(sin(uv.y * offset) * 0.5 + 0.5, cos(uv.x * offset) * 0.5 + 0.5);\\n }\\n \";t._emitFunction(\"voronoiRandom\",i,\"// Voronoi random generator\"),i=\"void voronoi(vec2 seed, float offset, float density, out float outValue, out float cells){\\n vec2 g = floor(seed * density);\\n vec2 f = fract(seed * density);\\n float t = 8.0;\\n vec3 res = vec3(8.0, 0.0, 0.0);\\n\\n for(int y=-1; y<=1; y++)\\n {\\n for(int x=-1; x<=1; x++)\\n {\\n vec2 lattice = vec2(x,y);\\n vec2 randomOffset = voronoiRandom(lattice + g, offset);\\n float d = distance(lattice + randomOffset, f);\\n if(d < res.x)\\n {\\n res = vec3(d, randomOffset.x, randomOffset.y);\\n outValue = res.x;\\n cells = res.y;\\n }\\n }\\n }\\n }\\n \",t._emitFunction(\"voronoi\",i,\"// Voronoi\");var n=t._getFreeVariableName(\"tempOutput\"),r=t._getFreeVariableName(\"tempCells\");return t.compilationString+=\"float \".concat(n,\" = 0.0;\\r\\n\"),t.compilationString+=\"float \".concat(r,\" = 0.0;\\r\\n\"),t.compilationString+=\"voronoi(\".concat(this.seed.associatedVariableName,\", \").concat(this.offset.associatedVariableName,\", \").concat(this.density.associatedVariableName,\", \").concat(n,\", \").concat(r,\");\\r\\n\"),this.output.hasEndpoints&&(t.compilationString+=this._declareOutput(this.output,t)+\" = \".concat(n,\";\\r\\n\")),this.cells.hasEndpoints&&(t.compilationString+=this._declareOutput(this.cells,t)+\" = \".concat(r,\";\\r\\n\")),this}},t}(Xo);b(\"BABYLON.VoronoiNoiseBlock\",lv);var cv=function(e){function t(t){var i=e.call(this,t,Bo.Neutral)||this;return i.registerInput(\"input\",wo.AutoDetect),i.registerOutput(\"output\",wo.BasedOnInput),i._outputs[0]._typeConnectionSource=i._inputs[0],i}return V(t,e),t.prototype.getClassName=function(){return\"ElbowBlock\"},Object.defineProperty(t.prototype,\"input\",{get:function(){return this._inputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"output\",{get:function(){return this._outputs[0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"target\",{get:function(){var e=this._inputs[0];if(e.isConnected){var t=e.connectedPoint.ownerBlock;if(t.target!==Bo.VertexAndFragment)return t.target;if(e.connectedPoint.target!==Bo.VertexAndFragment)return e.connectedPoint.target}return this._target},set:function(e){0==(this._target&e)&&(this._target=e)},enumerable:!1,configurable:!0}),t.prototype._buildBlock=function(t){e.prototype._buildBlock.call(this,t);var i=this._outputs[0],n=this._inputs[0];return t.compilationString+=this._declareOutput(i,t)+\" = \".concat(n.associatedVariableName,\";\\r\\n\"),this},t}(Xo);b(\"BABYLON.ElbowBlock\",cv);var uv=function(){function e(){}return e.prototype.optimize=function(e,t){},e}(),hv=function(){function e(){this.mm=new Map}return e.prototype.get=function(e,t){var i=this.mm.get(e);if(void 0!==i)return i.get(t)},e.prototype.set=function(e,t,i){var n=this.mm.get(e);void 0===n&&this.mm.set(e,n=new Map),n.set(t,i)},e}(),dv=function(){function e(e,t,i){var n=this;this._baseMaterial=e,this._scene=null!=t?t:S.LastCreatedScene,this._options=i,this._subMeshToEffect=new Map,this._subMeshToDepthWrapper=new hv,this._meshes=new Map,this._onEffectCreatedObserver=this._baseMaterial.onEffectCreatedObservable.add((function(e){var t,i=null===(t=e.subMesh)||void 0===t?void 0:t.getMesh();i&&!n._meshes.has(i)&&n._meshes.set(i,i.onDisposeObservable.add((function(e){for(var t=n._subMeshToEffect.keys(),i=t.next();!0!==i.done;i=t.next()){var r=i.value;(null==r?void 0:r.getMesh())===e&&(n._subMeshToEffect.delete(r),n._subMeshToDepthWrapper.mm.delete(r))}}))),n._subMeshToEffect.set(e.subMesh,[e.effect,n._scene.getEngine().currentRenderPassId]),n._subMeshToDepthWrapper.mm.delete(e.subMesh)}))}return Object.defineProperty(e.prototype,\"standalone\",{get:function(){var e,t;return null!==(t=null===(e=this._options)||void 0===e?void 0:e.standalone)&&void 0!==t&&t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"baseMaterial\",{get:function(){return this._baseMaterial},enumerable:!1,configurable:!0}),e.prototype.getEffect=function(e,t,i){var n,r=null===(n=this._subMeshToDepthWrapper.mm.get(e))||void 0===n?void 0:n.get(t);if(!r)return null;var o=r.drawWrapper[i];return o||(o=r.drawWrapper[i]=new Ht(this._scene.getEngine())).setEffect(r.mainDrawWrapper.effect,r.mainDrawWrapper.defines),o},e.prototype.isReadyForSubMesh=function(e,t,i,n,r){var o,a;return!(this.standalone&&!this._baseMaterial.isReadyForSubMesh(e.getMesh(),e,n))&&null!==(a=null===(o=this._makeEffect(e,t,i,r))||void 0===o?void 0:o.isReady())&&void 0!==a&&a},e.prototype.dispose=function(){this._baseMaterial.onEffectCreatedObservable.remove(this._onEffectCreatedObserver),this._onEffectCreatedObserver=null;for(var e=this._meshes.entries(),t=e.next();!0!==t.done;t=e.next()){var i=t.value,n=i[0],r=i[1];n.onDisposeObservable.remove(r)}},e.prototype._makeEffect=function(e,t,i,n){var r,o,a,s=this._scene.getEngine(),l=this._subMeshToEffect.get(e);if(!l)return null;var c=l[0],u=l[1],h=this._subMeshToDepthWrapper.get(e,i);if(!h){var d=new Ht(s);d.defines=null!==(o=null===(r=e._getDrawWrapper(u))||void 0===r?void 0:r.defines)&&void 0!==o?o:null,(h={drawWrapper:[],mainDrawWrapper:d,depthDefines:\"\",token:fi()}).drawWrapper[n]=d,this._subMeshToDepthWrapper.set(e,i,h)}var p=t.join(\"\\n\");if(h.mainDrawWrapper.effect&&p===h.depthDefines)return h.mainDrawWrapper.effect;h.depthDefines=p;var f=c.rawVertexSourceCode,_=c.rawFragmentSourceCode,m=this._options&&this._options.remappedVariables?\"#include(\".concat(this._options.remappedVariables.join(\",\"),\")\"):Ot.IncludesShadersStore.shadowMapVertexNormalBias,g=this._options&&this._options.remappedVariables?\"#include(\".concat(this._options.remappedVariables.join(\",\"),\")\"):Ot.IncludesShadersStore.shadowMapVertexMetric,v=this._options&&this._options.remappedVariables?\"#include(\".concat(this._options.remappedVariables.join(\",\"),\")\"):Ot.IncludesShadersStore.shadowMapFragmentSoftTransparentShadow,y=Ot.IncludesShadersStore.shadowMapFragment;f=(f=-1!==(f=(f=f.replace(/void\\s+?main/g,Ot.IncludesShadersStore.shadowMapVertexExtraDeclaration+\"\\r\\nvoid main\")).replace(/#define SHADOWDEPTH_NORMALBIAS|#define CUSTOM_VERTEX_UPDATE_WORLDPOS/g,m)).indexOf(\"#define SHADOWDEPTH_METRIC\")?f.replace(/#define SHADOWDEPTH_METRIC/g,g):f.replace(/}\\s*$/g,g+\"\\r\\n}\")).replace(/#define SHADER_NAME.*?\\n|out vec4 glFragColor;\\n/g,\"\");var b=_.indexOf(\"#define SHADOWDEPTH_SOFTTRANSPARENTSHADOW\")>=0||_.indexOf(\"#define CUSTOM_FRAGMENT_BEFORE_FOG\")>=0,T=-1!==_.indexOf(\"#define SHADOWDEPTH_FRAGMENT\"),E=\"\";b?_=_.replace(/#define SHADOWDEPTH_SOFTTRANSPARENTSHADOW|#define CUSTOM_FRAGMENT_BEFORE_FOG/g,v):E=v+\"\\r\\n\",_=_.replace(/void\\s+?main/g,Ot.IncludesShadersStore.shadowMapFragmentExtraDeclaration+\"\\r\\nvoid main\"),T?_=_.replace(/#define SHADOWDEPTH_FRAGMENT/g,y):E+=y+\"\\r\\n\",E&&(_=_.replace(/}\\s*$/g,E+\"}\")),_=_.replace(/#define SHADER_NAME.*?\\n|out vec4 glFragColor;\\n/g,\"\");var S=c.getUniformNames().slice();S.push(\"biasAndScaleSM\",\"depthValuesSM\",\"lightDataSM\",\"softTransparentShadowSM\"),h.mainDrawWrapper.effect=s.createEffect({vertexSource:f,fragmentSource:_,vertexToken:h.token,fragmentToken:h.token},{attributes:c.getAttributesNames(),uniformsNames:S,uniformBuffersNames:c.getUniformBuffersNames(),samplers:c.getSamplers(),defines:p+\"\\n\"+c.defines.replace(\"#define SHADOWS\",\"\").replace(/#define SHADOW\\d/g,\"\"),indexParameters:c.getIndexParameters()},s);for(var A=0;Ae.EPSILON?1:0;l|=u,c.push(u)}switch(l){case 0:(x.Dot(this.normal,t.plane.normal)>0?i:n).push(t);break;case 1:r.push(t);break;case 2:o.push(t);break;case 3:var h=[],d=[];for(a=0;a=3&&(y=new Mv(h,t.shared)).plane&&r.push(y),d.length>=3&&(y=new Mv(d,t.shared)).plane&&o.push(y)}},e.EPSILON=1e-5,e}(),Mv=function(){function e(e,t){this.vertices=e,this.shared=t,this.plane=Pv.FromPoints(e[0].pos,e[1].pos,e[2].pos)}return e.prototype.clone=function(){return new e(this.vertices.map((function(e){return e.clone()})),this.shared)},e.prototype.flip=function(){this.vertices.reverse().map((function(e){e.flip()})),this.plane.flip()},e}(),Iv=function(){function e(e){this._plane=null,this._front=null,this._back=null,this._polygons=new Array,e&&this.build(e)}return e.prototype.clone=function(){var t=new e;return t._plane=this._plane&&this._plane.clone(),t._front=this._front&&this._front.clone(),t._back=this._back&&this._back.clone(),t._polygons=this._polygons.map((function(e){return e.clone()})),t},e.prototype.invert=function(){for(var e=0;ethis.goldbergData.nbUnsharedFaces-1&&(Q.Warn(\"Maximum number of unshared faces used\"),e=this.goldbergData.nbUnsharedFaces-1),this.goldbergData.nbUnsharedFaces+e):(e>11&&(Q.Warn(\"Last pole used\"),e=11),t>this.goldbergData.nbFacesAtPole-1&&(Q.Warn(\"Maximum number of faces at a pole used\"),t=this.goldbergData.nbFacesAtPole-1),12+e*this.goldbergData.nbFacesAtPole+t)},t.prototype._changeGoldbergFaceColors=function(e){for(var t=0;t1&&(u=1),l.push(u,h);for(d=0;d<6;d++)u=o.x+a*Math.cos(s+d*Math.PI/3),h=o.y+a*Math.sin(s+d*Math.PI/3),u<0&&(u=0),u>1&&(u=1),c.push(u,h);for(var p=n;p0||h>0){switch(m=-d,g=-p,v=d,y=p,r){case Ur.CENTER:m-=l/=2,v+=l;break;case Ur.LEFT:v+=l,f=-l/2;break;case Ur.RIGHT:m-=l,f=l/2}switch(o){case Ur.CENTER:g-=h/=2,y+=h;break;case Ur.BOTTOM:y+=h,_=-h/2;break;case Ur.TOP:g-=h,_=h/2}}var b=[],T=[],E=[];E[0]=[0,0,1,0,1,1,0,1],E[1]=[0,0,1,0,1,1,0,1],t!==Ur.ROTATE_TILE&&t!==Ur.ROTATE_ROW||(E[1]=[1,1,0,1,0,0,1,0]),t!==Ur.FLIP_TILE&&t!==Ur.FLIP_ROW||(E[1]=[1,0,0,0,0,1,1,1]),t!==Ur.FLIP_N_ROTATE_TILE&&t!==Ur.FLIP_N_ROTATE_ROW||(E[1]=[0,1,1,1,1,0,0,0]);for(var S=[],A=[],R=[],x=0,C=0;C0||h>0){var M=h>0&&(o===Ur.CENTER||o===Ur.TOP),I=h>0&&(o===Ur.CENTER||o===Ur.BOTTOM),O=l>0&&(r===Ur.CENTER||r===Ur.RIGHT),D=l>0&&(r===Ur.CENTER||r===Ur.LEFT),N=[],L=void 0,F=void 0,w=void 0,B=void 0;if(M&&O&&(b.push(m+f,g+_,0),b.push(-d+f,g+_,0),b.push(-d+f,g+h+_,0),b.push(m+f,g+h+_,0),R.push(x,x+1,x+3,x+1,x+2,x+3),x+=4,N=[L=1-l/i,F=1-h/n,w=1,F,w,B=1,L,B],t===Ur.ROTATE_ROW&&(N=[1-L,1-F,1-w,1-F,1-w,1-B,1-L,1-B]),t===Ur.FLIP_ROW&&(N=[1-L,F,1-w,F,1-w,B,1-L,B]),t===Ur.FLIP_N_ROTATE_ROW&&(N=[L,1-F,w,1-F,w,1-B,L,1-B]),S=S.concat(N),A.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),T.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),M&&D&&(b.push(d+f,g+_,0),b.push(v+f,g+_,0),b.push(v+f,g+h+_,0),b.push(d+f,g+h+_,0),R.push(x,x+1,x+3,x+1,x+2,x+3),x+=4,N=[L=0,F=1-h/n,w=l/i,F,w,B=1,L,B],(t===Ur.ROTATE_ROW||t===Ur.ROTATE_TILE&&s%2==0)&&(N=[1-L,1-F,1-w,1-F,1-w,1-B,1-L,1-B]),(t===Ur.FLIP_ROW||t===Ur.FLIP_TILE&&s%2==0)&&(N=[1-L,F,1-w,F,1-w,B,1-L,B]),(t===Ur.FLIP_N_ROTATE_ROW||t===Ur.FLIP_N_ROTATE_TILE&&s%2==0)&&(N=[L,1-F,w,1-F,w,1-B,L,1-B]),S=S.concat(N),A.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),T.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),I&&O&&(b.push(m+f,p+_,0),b.push(-d+f,p+_,0),b.push(-d+f,y+_,0),b.push(m+f,y+_,0),R.push(x,x+1,x+3,x+1,x+2,x+3),x+=4,N=[L=1-l/i,F=0,w=1,F,w,B=h/n,L,B],(t===Ur.ROTATE_ROW&&u%2==1||t===Ur.ROTATE_TILE&&u%1==0)&&(N=[1-L,1-F,1-w,1-F,1-w,1-B,1-L,1-B]),(t===Ur.FLIP_ROW&&u%2==1||t===Ur.FLIP_TILE&&u%2==0)&&(N=[1-L,F,1-w,F,1-w,B,1-L,B]),(t===Ur.FLIP_N_ROTATE_ROW&&u%2==1||t===Ur.FLIP_N_ROTATE_TILE&&u%2==0)&&(N=[L,1-F,w,1-F,w,1-B,L,1-B]),S=S.concat(N),A.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),T.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),I&&D&&(b.push(d+f,p+_,0),b.push(v+f,p+_,0),b.push(v+f,y+_,0),b.push(d+f,y+_,0),R.push(x,x+1,x+3,x+1,x+2,x+3),x+=4,N=[L=0,F=0,w=l/i,F,w,B=h/n,L,B],(t===Ur.ROTATE_ROW&&u%2==1||t===Ur.ROTATE_TILE&&(u+s)%2==1)&&(N=[1-L,1-F,1-w,1-F,1-w,1-B,1-L,1-B]),(t===Ur.FLIP_ROW&&u%2==1||t===Ur.FLIP_TILE&&(u+s)%2==1)&&(N=[1-L,F,1-w,F,1-w,B,1-L,B]),(t===Ur.FLIP_N_ROTATE_ROW&&u%2==1||t===Ur.FLIP_N_ROTATE_TILE&&(u+s)%2==1)&&(N=[L,1-F,w,1-F,w,1-B,L,1-B]),S=S.concat(N),A.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),T.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),M){var U=[];for(L=0,F=1-h/n,w=1,B=1,U[0]=[L,F,w,F,w,B,L,B],U[1]=[L,F,w,F,w,B,L,B],t!==Ur.ROTATE_TILE&&t!==Ur.ROTATE_ROW||(U[1]=[1-L,1-F,1-w,1-F,1-w,1-B,1-L,1-B]),t!==Ur.FLIP_TILE&&t!==Ur.FLIP_ROW||(U[1]=[1-L,F,1-w,F,1-w,B,1-L,B]),t!==Ur.FLIP_N_ROTATE_TILE&&t!==Ur.FLIP_N_ROTATE_ROW||(U[1]=[L,1-F,w,1-F,w,1-B,L,1-B]),P=0;Pt.x&&(t.x=i.x),i.yt.y&&(t.y=i.y)})),{min:e,max:t,width:t.x-e.x,height:t.y-e.y}},e}(),Xv=function(){function e(){}return e.Rectangle=function(e,t,i,n){return[new R(e,t),new R(i,t),new R(i,n),new R(e,n)]},e.Circle=function(e,t,i,n){void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=32);for(var r=new Array,o=0,a=2*Math.PI/n,s=0;s0){var h=o.length/3;this._points.elements.forEach((function(t){r.push(0,-1,0),o.push(t.x,-e,t.y),a.push(1-(t.x-s.min.x)/s.width,1-(t.y-s.min.y)/s.height)}));var d=l.length;for(u=0;ul?S<_-1?new x(d.x,0,d.y).subtract(new x(p.x,0,p.y)).normalize():v.add(g).normalize():b;var A=x.Dot(y,g);E=A>l?A<_-1?new x(p.x,0,p.y).subtract(new x(d.x,0,d.y)).normalize():y.add(g).normalize():b,i.push(u/r.width,0),i.push(u/r.width,1),u+=g.length(),i.push(u/r.width,0),i.push(u/r.width,1),t.push(T.x,T.y,T.z),t.push(T.x,T.y,T.z),t.push(E.x,E.y,E.z),t.push(E.x,E.y,E.z),s?(n.push(c),n.push(c+2),n.push(c+1),n.push(c+1),n.push(c+2),n.push(c+3)):(n.push(c),n.push(c+1),n.push(c+2),n.push(c+1),n.push(c+3),n.push(c+2)),c+=4}},e}();function Yv(e,t,i,n,r,o,a){for(var s=i||new Array(3),l=n,c=[],u=a||!1,h=0;h<3;h++)void 0===s[h]&&(s[h]=new C(0,0,1,1)),l&&void 0===l[h]&&(l[h]=new L(1,1,1,1));var d=e.getVerticesData(wi.PositionKind),p=e.getVerticesData(wi.NormalKind),f=e.getVerticesData(wi.UVKind),_=e.getIndices(),m=d.length/9,g=0,v=0,y=0,b=0,T=[0];if(u)for(var E=m;E1?1:t.arc:1,a=void 0===t.closed||t.closed,s=t.shape,l=t.radius||1,c=t.tessellation||64,u=t.clip||0,h=t.updatable,d=Ur._GetDefaultSideOrientation(t.sideOrientation),p=t.cap||Ur.NO_CAP,f=2*Math.PI,_=new Array,m=t.invertUV||!1,g=0,v=0,y=f/c*o;for(g=0;g<=c-u;g++){for(r=[],p!=Ur.CAP_START&&p!=Ur.CAP_ALL||(r.push(new x(0,s[0].y,0)),r.push(new x(Math.cos(g*y)*s[0].x*l,s[0].y,Math.sin(g*y)*s[0].x*l))),v=0;v1)?1:t.arc||1;var d,p,f=function(e,t,i,n,r,o,a,s){for(var l,c,u,h,d=t.getTangents(),p=t.getNormals(),f=t.getDistances(),_=2*Math.PI/r*s,m=o||function(){return n},g=O.Matrix[0],v=a===Ur.NO_CAP||a===Ur.CAP_END?0:2,y=0;y3?0:l;var g=hu(e,{pathArray:p=f(n,d=new Cn(n),new Array,o,a,s,l,t.arc),closePath:!0,closeArray:!1,updatable:u,sideOrientation:h,invertUV:c,frontUVs:t.frontUVs,backUVs:t.backUVs},i);return g._creationDataStorage.pathArray=p,g._creationDataStorage.path3D=d,g._creationDataStorage.tessellation=a,g._creationDataStorage.cap=l,g._creationDataStorage.arc=t.arc,g._creationDataStorage.radius=o,g}Ur.CreateLathe=function(e,t,i,n,r,o,a){return Zv(e,{shape:t,radius:i,tessellation:n,sideOrientation:a,updatable:o},r)};var ey={CreateTube:$v};function ty(e,t,i){var n=t.getIndices(),r=t.getVerticesData(wi.PositionKind),o=t.getVerticesData(wi.NormalKind),a=t.getVerticesData(wi.UVKind),s=i.position||x.Zero(),l=i.normal||x.Up(),c=i.size||x.One(),u=i.angle||0;if(!l){var h=new x(0,0,1),d=t.getScene().activeCamera,p=x.TransformCoordinates(h,d.getWorldMatrix());l=d.globalPosition.subtract(p)}var f=-Math.atan2(l.z,l.x)-Math.PI/2,_=Math.sqrt(l.x*l.x+l.z*l.z),m=Math.atan2(l.y,_),g=M.RotationYawPitchRoll(f,m,u).multiply(M.Translation(s.x,s.y,s.z)),v=M.Invert(g),y=t.getWorldMatrix().multiply(v),b=new $n;b.indices=[],b.positions=[],b.normals=[],b.uvs=[];for(var T=0,E=function(e){var t=new ta;if(!n||!r||!o)return t;var s=n[e];if(t.position=new x(r[3*s],r[3*s+1],r[3*s+2]),t.position=x.TransformCoordinates(t.position,y),t.normal=new x(o[3*s],o[3*s+1],o[3*s+2]),t.normal=x.TransformNormal(t.normal,y),i.captureUVS&&a){var l=a[2*s+1];t.uv=new R(a[2*s],pr.UseOpenGLOrientationForUV?1-l:l)}return t},S=function(e,t){if(0===e.length)return e;for(var i=.5*Math.abs(x.Dot(c,t)),n=function(e,n){var r=x.GetClipFactor(e.position,n.position,t,i);return new ta(x.Lerp(e.position,n.position,r),x.Lerp(e.normal,n.normal,r))},r=new Array,o=0;o0,d=x.Dot(e[o+1].position,t)-i>0,p=x.Dot(e[o+2].position,t)-i>0;switch((h?1:0)+(d?1:0)+(p?1:0)){case 0:r.push(e[o]),r.push(e[o+1]),r.push(e[o+2]);break;case 1:if(h&&(a=e[o+1],s=e[o+2],l=n(e[o],a),u=n(e[o],s)),d){a=e[o],s=e[o+2],l=n(e[o+1],a),u=n(e[o+1],s),r.push(l),r.push(s.clone()),r.push(a.clone()),r.push(s.clone()),r.push(l.clone()),r.push(u);break}p&&(a=e[o],s=e[o+1],l=n(e[o+2],a),u=n(e[o+2],s)),a&&s&&l&&u&&(r.push(a.clone()),r.push(s.clone()),r.push(l),r.push(u),r.push(l.clone()),r.push(s.clone()));break;case 2:h||(s=n(a=e[o].clone(),e[o+1]),l=n(a,e[o+2]),r.push(a),r.push(s),r.push(l)),d||(s=n(a=e[o+1].clone(),e[o+2]),l=n(a,e[o]),r.push(a),r.push(s),r.push(l)),p||(s=n(a=e[o+2].clone(),e[o]),l=n(a,e[o+1]),r.push(a),r.push(s),r.push(l))}}return r},A=0;A2?S[l[p]]=[-A[i][0],A[i][1],l[p]]:S[l[p]]=[E[A[i][0]],A[i][1],l[p]]};this.IDATA.edgematch=[[1,\"B\"],[2,\"B\"],[3,\"B\"],[4,\"B\"],[0,\"B\"],[10,\"O\",14,\"A\"],[11,\"O\",10,\"A\"],[12,\"O\",11,\"A\"],[13,\"O\",12,\"A\"],[14,\"O\",13,\"A\"],[0,\"O\"],[1,\"O\"],[2,\"O\"],[3,\"O\"],[4,\"O\"],[19,\"B\",5,\"A\"],[15,\"B\",6,\"A\"],[16,\"B\",7,\"A\"],[17,\"B\",8,\"A\"],[18,\"B\",9,\"A\"]];for(var x=0;x<20;x++){if(r=(E=this.IDATA.face[x])[2],o=E[1],a=E[0],_=m.x+\"|\"+m.y,(p=x+\"|\"+_)in l||(l[p]=r,S[r]=[E[A[_][0]],A[_][1]]),_=g.x+\"|\"+g.y,(p=x+\"|\"+_)in l||(l[p]=o,S[o]=[E[A[_][0]],A[_][1]]),_=v.x+\"|\"+v.y,(p=x+\"|\"+_)in l||(l[p]=a,S[a]=[E[A[_][0]],A[_][1]]),i=this.IDATA.edgematch[x][0],\"B\"===(n=this.IDATA.edgematch[x][1]))for(var C=1;C2?S[l[p]]=[-A[_][0],A[_][1],l[p]]:S[l[p]]=[E[A[_][0]],A[_][1],l[p]])}this.closestTo=S,this.vecToidx=l},e.prototype.calcCoeffs=function(){var e=this.m,t=this.n,i=Math.sqrt(3)/3,n=e*e+t*t+e*t;this.coau=(e+t)/n,this.cobu=-t/n,this.coav=-i*(e-t)/n,this.cobv=i*(2*e+t)/n},e.prototype.createInnerFacets=function(){for(var e=this.m,t=this.n,i=0;i0&&n0){for(var l=h.HCF(e,t),c=e/l,u=t/l,d=1;d-1?n[i][1]>0&&t[n[i][0]].push([i,n[i][1]]):t[12].push([i,n[i][0]]);var r=[];for(i=0;i<12;i++)r[i]=i;var o=12;for(i=0;i<12;i++){t[i].sort((function(e,t){return e[1]-t[1]}));for(var a=0;a0;)r=t[s],this.face[r].indexOf(a)>-1?(o=(this.face[r].indexOf(a)+1)%3,a=this.face[r][o],i.push(a),n.push(r),t.splice(s,1),s=0):s++;return this.adjacentFaces.push(i),n},t.prototype.toGoldbergPolyhedronData=function(){var e=this,t=new oy(\"GeoDual\",\"Goldberg\",[],[]);t.name=\"GD dual\";for(var i=this.vertex.length,n=new Array(i),r=0;rn){var o=r;r=n,n=o,Q.Warn(\"n > m therefore m and n swapped\")}var a=new ry;return a.build(n,r),Pp(e,{custom:ay.BuildGeodesicData(a),size:t.size,sizeX:t.sizeX,sizeY:t.sizeY,sizeZ:t.sizeZ,faceUV:t.faceUV,faceColors:t.faceColors,flat:t.flat,updatable:t.updatable,sideOrientation:t.sideOrientation,frontUVs:t.frontUVs,backUVs:t.backUVs},i)}function ly(e,t){for(var i=e.size,n=e.sizeX||i||1,r=e.sizeY||i||1,o=e.sizeZ||i||1,a=0===e.sideOrientation?0:e.sideOrientation||$n.DEFAULTSIDE,s=new Array,l=new Array,c=new Array,u=new Array,h=1/0,d=-1/0,p=1/0,f=-1/0,_=0;_s){var c=l;l=s,s=c,Q.Warn(\"n > m therefore m and n swapped\")}var u=new ry;u.build(s,l);var h=ay.BuildGeodesicData(u),d=h.toGoldbergPolyhedronData(),p=new Dv(e,i);t.sideOrientation=Ur._GetDefaultSideOrientation(t.sideOrientation),p._originalBuilderSideOrientation=t.sideOrientation,ly(t,d).applyToMesh(p,t.updatable),p.goldbergData.nbSharedFaces=h.sharedNodes,p.goldbergData.nbUnsharedFaces=h.poleNodes,p.goldbergData.adjacentFaces=h.adjacentFaces,p.goldbergData.nbFaces=p.goldbergData.nbSharedFaces+p.goldbergData.nbUnsharedFaces,p.goldbergData.nbFacesAtPole=(p.goldbergData.nbUnsharedFaces-12)/12;for(var f=0;fs||i.deleted||i.isDirty))for(var r=function(e){if(i.error[e]>0,(function(e){if(r){var t=e+a.verticesStart,o=x.FromArray(r,3*t),l=function(e){if(i)for(var t=0;t0&&this._reconstructedMesh.setVerticesData(wi.NormalKind,a),s.length>0&&this._reconstructedMesh.setVerticesData(wi.UVKind,s),l.length>0&&this._reconstructedMesh.setVerticesData(wi.ColorKind,l);var b=this._mesh.subMeshes[e];e>0&&(this._reconstructedMesh.subMeshes=[],g.forEach((function(e){hr.AddToMesh(e.materialIndex,e.verticesStart,e.verticesCount,e.indexStart,e.indexCount,e.getMesh())})),hr.AddToMesh(b.materialIndex,m,d,_,3*r.length,this._reconstructedMesh))},e.prototype._initDecimatedMesh=function(){this._reconstructedMesh=new Ur(this._mesh.name+\"Decimated\",this._mesh.getScene()),this._reconstructedMesh.material=this._mesh.material,this._reconstructedMesh.parent=this._mesh.parent,this._reconstructedMesh.isVisible=!1,this._reconstructedMesh.renderingGroupId=this._mesh.renderingGroupId},e.prototype._isFlipped=function(e,t,i,n,r){for(var o=0;o.999)return!0;var d=x.Cross(u,h).normalize();if(n[o]=!1,x.Dot(d,a.normal)<.2)return!0}else n[o]=!0,r.push(a)}}return!1},e.prototype._updateTriangles=function(e,t,i,n){for(var r=n,o=0;o=this._thinInstanceDataStorage.instancesCount)return!1;var n=this._thinInstanceDataStorage.matrixData;return t.copyToArray(n,16*e),this._thinInstanceDataStorage.worldMatrices&&(this._thinInstanceDataStorage.worldMatrices[e]=t),i&&(this.thinInstanceBufferUpdated(\"matrix\"),this.doNotSyncBoundingInfo||this.thinInstanceRefreshBoundingInfo(!1)),!0},Ur.prototype.thinInstanceSetAttributeAt=function(e,t,i,n){return void 0===n&&(n=!0),e===wi.ColorKind&&(e=wi.ColorInstanceKind),!(!this._userThinInstanceBuffersStorage||!this._userThinInstanceBuffersStorage.data[e]||t>=this._thinInstanceDataStorage.instancesCount||(this._thinInstanceUpdateBufferSize(e,0),this._userThinInstanceBuffersStorage.data[e].set(i,t*this._userThinInstanceBuffersStorage.strides[e]),n&&this.thinInstanceBufferUpdated(e),0))},Object.defineProperty(Ur.prototype,\"thinInstanceCount\",{get:function(){return this._thinInstanceDataStorage.instancesCount},set:function(e){var t,i,n=null!==(t=this._thinInstanceDataStorage.matrixData)&&void 0!==t?t:null===(i=this.source)||void 0===i?void 0:i._thinInstanceDataStorage.matrixData;e<=(n?n.length/16:0)&&(this._thinInstanceDataStorage.instancesCount=e)},enumerable:!0,configurable:!0}),Ur.prototype._thinInstanceCreateMatrixBuffer=function(e,t,i){void 0===i&&(i=!1),e===wi.ColorKind&&(e=wi.ColorInstanceKind);for(var n=new Fi(this.getEngine(),t,!i,16,!1,!0),r=0;r<4;r++)this.setVerticesBuffer(n.createVertexBuffer(e+r,4*r,4));return n},Ur.prototype.thinInstanceSetBuffer=function(e,t,i,n){var r,o,a;void 0===i&&(i=0),void 0===n&&(n=!1),i=i||16,\"matrix\"===e?(null===(r=this._thinInstanceDataStorage.matrixBuffer)||void 0===r||r.dispose(),this._thinInstanceDataStorage.matrixBuffer=null,this._thinInstanceDataStorage.matrixBufferSize=t?t.length:32*i,this._thinInstanceDataStorage.matrixData=t,this._thinInstanceDataStorage.worldMatrices=null,null!==t?(this._thinInstanceDataStorage.instancesCount=t.length/i,this._thinInstanceDataStorage.matrixBuffer=this._thinInstanceCreateMatrixBuffer(\"world\",t,n),this.doNotSyncBoundingInfo||this.thinInstanceRefreshBoundingInfo(!1)):(this._thinInstanceDataStorage.instancesCount=0,this.doNotSyncBoundingInfo||this.refreshBoundingInfo())):\"previousMatrix\"===e?(null===(o=this._thinInstanceDataStorage.previousMatrixBuffer)||void 0===o||o.dispose(),this._thinInstanceDataStorage.previousMatrixBuffer=null,this._thinInstanceDataStorage.previousMatrixData=t,null!==t&&(this._thinInstanceDataStorage.previousMatrixBuffer=this._thinInstanceCreateMatrixBuffer(\"previousWorld\",t,n))):(e===wi.ColorKind&&(e=wi.ColorInstanceKind),null===t?(null===(a=this._userThinInstanceBuffersStorage)||void 0===a?void 0:a.data[e])&&(this.removeVerticesData(e),delete this._userThinInstanceBuffersStorage.data[e],delete this._userThinInstanceBuffersStorage.strides[e],delete this._userThinInstanceBuffersStorage.sizes[e],delete this._userThinInstanceBuffersStorage.vertexBuffers[e]):(this._thinInstanceInitializeUserStorage(),this._userThinInstanceBuffersStorage.data[e]=t,this._userThinInstanceBuffersStorage.strides[e]=i,this._userThinInstanceBuffersStorage.sizes[e]=t.length,this._userThinInstanceBuffersStorage.vertexBuffers[e]=new wi(this.getEngine(),t,e,!n,!1,i,!0),this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[e])))},Ur.prototype.thinInstanceBufferUpdated=function(e){var t,i,n;\"matrix\"===e?null===(t=this._thinInstanceDataStorage.matrixBuffer)||void 0===t||t.updateDirectly(this._thinInstanceDataStorage.matrixData,0,this._thinInstanceDataStorage.instancesCount):\"previousMatrix\"===e?null===(i=this._thinInstanceDataStorage.previousMatrixBuffer)||void 0===i||i.updateDirectly(this._thinInstanceDataStorage.previousMatrixData,0,this._thinInstanceDataStorage.instancesCount):(e===wi.ColorKind&&(e=wi.ColorInstanceKind),(null===(n=this._userThinInstanceBuffersStorage)||void 0===n?void 0:n.vertexBuffers[e])&&this._userThinInstanceBuffersStorage.vertexBuffers[e].updateDirectly(this._userThinInstanceBuffersStorage.data[e],0))},Ur.prototype.thinInstancePartialBufferUpdate=function(e,t,i){var n;\"matrix\"===e?this._thinInstanceDataStorage.matrixBuffer&&this._thinInstanceDataStorage.matrixBuffer.updateDirectly(t,i):(e===wi.ColorKind&&(e=wi.ColorInstanceKind),(null===(n=this._userThinInstanceBuffersStorage)||void 0===n?void 0:n.vertexBuffers[e])&&this._userThinInstanceBuffersStorage.vertexBuffers[e].updateDirectly(t,i))},Ur.prototype.thinInstanceGetWorldMatrices=function(){if(!this._thinInstanceDataStorage.matrixData||!this._thinInstanceDataStorage.matrixBuffer)return[];var e=this._thinInstanceDataStorage.matrixData;if(!this._thinInstanceDataStorage.worldMatrices){this._thinInstanceDataStorage.worldMatrices=new Array;for(var t=0;t-1&&(this._agentDestinationArmed[i]=!0,this._agentDestination[i].set(t.x,t.y,t.z))},e.prototype.agentTeleport=function(e,t){this.recastCrowd.agentTeleport(e,new this.bjsRECASTPlugin.bjsRECAST.Vec3(t.x,t.y,t.z))},e.prototype.updateAgentParameters=function(e,t){var i=this.recastCrowd.getAgentParameters(e);void 0!==t.radius&&(i.radius=t.radius),void 0!==t.height&&(i.height=t.height),void 0!==t.maxAcceleration&&(i.maxAcceleration=t.maxAcceleration),void 0!==t.maxSpeed&&(i.maxSpeed=t.maxSpeed),void 0!==t.collisionQueryRange&&(i.collisionQueryRange=t.collisionQueryRange),void 0!==t.pathOptimizationRange&&(i.pathOptimizationRange=t.pathOptimizationRange),void 0!==t.separationWeight&&(i.separationWeight=t.separationWeight),this.recastCrowd.setAgentParameters(e,i)},e.prototype.removeAgent=function(e){this.recastCrowd.removeAgent(e);var t=this.agents.indexOf(e);t>-1&&(this.agents.splice(t,1),this.transforms.splice(t,1),this.reachRadii.splice(t,1),this._agentDestinationArmed.splice(t,1),this._agentDestination.splice(t,1))},e.prototype.getAgents=function(){return this.agents},e.prototype.update=function(e){if(this.bjsRECASTPlugin.navMesh.update(),!(e<=_)){var t=this.bjsRECASTPlugin.getTimeStep(),i=this.bjsRECASTPlugin.getMaximumSubStepCount();if(t<=_)this.recastCrowd.update(e);else{var n=Math.floor(e/t);i&&n>i&&(n=i),n<1&&(n=1);for(var r=e/n,o=0;od&&l.y=400&&o?o(c):i()}),!1),c.addEventListener(\"error\",(function(){Q.Error(\"error on XHR request.\"),o&&o()}),!1),c.send()}else Q.Error(\"Error: IndexedDB not supported by your browser or Babylon.js database is not open.\"),o&&o()},e._ValidateXHRData=function(e,t){void 0===t&&(t=7);try{if(1&t){if(e.responseText&&e.responseText.length>0)return!0;if(1===t)return!1}if(2&t){var i=hm(e.response);if(i.width&&i.height&&i.width>0&&i.height>0)return!0;if(2===t)return!1}if(4&t){var n=new Uint8Array(e.response,0,3);return 68===n[0]&&68===n[1]&&83===n[2]}}catch(e){}return!1},e._IsUASupportingBlobStorage=!0,e.IDBStorageEnabled=!1,e._ParseURL=function(e){document.createElement(\"a\").href=e;var t=e.substring(0,e.lastIndexOf(\"#\")),i=e.substring(t.lastIndexOf(\"/\")+1,e.length);return e.substring(0,e.indexOf(i,0))},e._ReturnFullUrlLocation=function(t){return-1===t.indexOf(\"http:/\")&&-1===t.indexOf(\"https:/\")&&\"undefined\"!=typeof window?e._ParseURL(window.location.href)+t:t},e}(),Sy=function(){function e(e){this._isUbo(e)?(this.setMatrix3x3=e.updateMatrix3x3.bind(e),this.setMatrix2x2=e.updateMatrix2x2.bind(e),this.setFloat=e.updateFloat.bind(e),this.setFloat2=e.updateFloat2.bind(e),this.setFloat3=e.updateFloat3.bind(e),this.setFloat4=e.updateFloat4.bind(e),this.setFloatArray=e.updateFloatArray.bind(e),this.setArray=e.updateArray.bind(e),this.setIntArray=e.updateIntArray.bind(e),this.setMatrix=e.updateMatrix.bind(e),this.setMatrices=e.updateMatrices.bind(e),this.setVector3=e.updateVector3.bind(e),this.setVector4=e.updateVector4.bind(e),this.setColor3=e.updateColor3.bind(e),this.setColor4=e.updateColor4.bind(e),this.setDirectColor4=e.updateDirectColor4.bind(e),this.setInt=e.updateInt.bind(e),this.setInt2=e.updateInt2.bind(e),this.setInt3=e.updateInt3.bind(e),this.setInt4=e.updateInt4.bind(e)):(this.setMatrix3x3=e.setMatrix3x3.bind(e),this.setMatrix2x2=e.setMatrix2x2.bind(e),this.setFloat=e.setFloat.bind(e),this.setFloat2=e.setFloat2.bind(e),this.setFloat3=e.setFloat3.bind(e),this.setFloat4=e.setFloat4.bind(e),this.setFloatArray=e.setFloatArray.bind(e),this.setArray=e.setArray.bind(e),this.setIntArray=e.setIntArray.bind(e),this.setMatrix=e.setMatrix.bind(e),this.setMatrices=e.setMatrices.bind(e),this.setVector3=e.setVector3.bind(e),this.setVector4=e.setVector4.bind(e),this.setColor3=e.setColor3.bind(e),this.setColor4=e.setColor4.bind(e),this.setDirectColor4=e.setDirectColor4.bind(e),this.setInt=e.setInt.bind(e),this.setInt2=e.setInt2.bind(e),this.setInt3=e.setInt3.bind(e),this.setInt4=e.setInt4.bind(e))}return e.prototype._isUbo=function(e){return void 0!==e.addUniform},e}();It.ShadersStore.gpuUpdateParticlesPixelShader=\"#version 300 es\\nvoid main() {\\ndiscard;\\n}\\n\";It.ShadersStore.gpuUpdateParticlesVertexShader=\"#version 300 es\\n#define PI 3.14159\\nuniform float currentCount;\\nuniform float timeDelta;\\nuniform float stopFactor;\\n#ifndef LOCAL\\nuniform mat4 emitterWM;\\n#endif\\nuniform vec2 lifeTime;\\nuniform vec2 emitPower;\\nuniform vec2 sizeRange;\\nuniform vec4 scaleRange;\\n#ifndef COLORGRADIENTS\\nuniform vec4 color1;\\nuniform vec4 color2;\\n#endif\\nuniform vec3 gravity;\\nuniform sampler2D randomSampler;\\nuniform sampler2D randomSampler2;\\nuniform vec4 angleRange;\\n#ifdef BOXEMITTER\\nuniform vec3 direction1;\\nuniform vec3 direction2;\\nuniform vec3 minEmitBox;\\nuniform vec3 maxEmitBox;\\n#endif\\n#ifdef POINTEMITTER\\nuniform vec3 direction1;\\nuniform vec3 direction2;\\n#endif\\n#ifdef HEMISPHERICEMITTER\\nuniform float radius;\\nuniform float radiusRange;\\nuniform float directionRandomizer;\\n#endif\\n#ifdef SPHEREEMITTER\\nuniform float radius;\\nuniform float radiusRange;\\n#ifdef DIRECTEDSPHEREEMITTER\\nuniform vec3 direction1;\\nuniform vec3 direction2;\\n#else\\nuniform float directionRandomizer;\\n#endif\\n#endif\\n#ifdef CYLINDEREMITTER\\nuniform float radius;\\nuniform float height;\\nuniform float radiusRange;\\n#ifdef DIRECTEDCYLINDEREMITTER\\nuniform vec3 direction1;\\nuniform vec3 direction2;\\n#else\\nuniform float directionRandomizer;\\n#endif\\n#endif\\n#ifdef CONEEMITTER\\nuniform vec2 radius;\\nuniform float coneAngle;\\nuniform vec2 height;\\nuniform float directionRandomizer;\\n#endif\\nin vec3 position;\\n#ifdef CUSTOMEMITTER\\nin vec3 initialPosition;\\n#endif\\nin float age;\\nin float life;\\nin vec4 seed;\\nin vec3 size;\\n#ifndef COLORGRADIENTS\\nin vec4 color;\\n#endif\\nin vec3 direction;\\n#ifndef BILLBOARD\\nin vec3 initialDirection;\\n#endif\\n#ifdef ANGULARSPEEDGRADIENTS\\nin float angle;\\n#else\\nin vec2 angle;\\n#endif\\n#ifdef ANIMATESHEET\\nin float cellIndex;\\n#ifdef ANIMATESHEETRANDOMSTART\\nin float cellStartOffset;\\n#endif\\n#endif\\n#ifdef NOISE\\nin vec3 noiseCoordinates1;\\nin vec3 noiseCoordinates2;\\n#endif\\nout vec3 outPosition;\\n#ifdef CUSTOMEMITTER\\nout vec3 outInitialPosition;\\n#endif\\nout float outAge;\\nout float outLife;\\nout vec4 outSeed;\\nout vec3 outSize;\\n#ifndef COLORGRADIENTS\\nout vec4 outColor;\\n#endif\\nout vec3 outDirection;\\n#ifndef BILLBOARD\\nout vec3 outInitialDirection;\\n#endif\\n#ifdef ANGULARSPEEDGRADIENTS\\nout float outAngle;\\n#else\\nout vec2 outAngle;\\n#endif\\n#ifdef ANIMATESHEET\\nout float outCellIndex;\\n#ifdef ANIMATESHEETRANDOMSTART\\nout float outCellStartOffset;\\n#endif\\n#endif\\n#ifdef NOISE\\nout vec3 outNoiseCoordinates1;\\nout vec3 outNoiseCoordinates2;\\n#endif\\n#ifdef SIZEGRADIENTS\\nuniform sampler2D sizeGradientSampler;\\n#endif \\n#ifdef ANGULARSPEEDGRADIENTS\\nuniform sampler2D angularSpeedGradientSampler;\\n#endif \\n#ifdef VELOCITYGRADIENTS\\nuniform sampler2D velocityGradientSampler;\\n#endif\\n#ifdef LIMITVELOCITYGRADIENTS\\nuniform sampler2D limitVelocityGradientSampler;\\nuniform float limitVelocityDamping;\\n#endif\\n#ifdef DRAGGRADIENTS\\nuniform sampler2D dragGradientSampler;\\n#endif\\n#ifdef NOISE\\nuniform vec3 noiseStrength;\\nuniform sampler2D noiseSampler;\\n#endif\\n#ifdef ANIMATESHEET\\nuniform vec4 cellInfos;\\n#endif\\nvec3 getRandomVec3(float offset) {\\nreturn texture(randomSampler2,vec2(float(gl_VertexID)*offset/currentCount,0)).rgb;\\n}\\nvec4 getRandomVec4(float offset) {\\nreturn texture(randomSampler,vec2(float(gl_VertexID)*offset/currentCount,0));\\n}\\nvoid main() {\\nfloat newAge=age+timeDelta; \\nif (newAge>=life && stopFactor != 0.) {\\nvec3 newPosition;\\nvec3 newDirection;\\nvec4 randoms=getRandomVec4(seed.x);\\noutLife=lifeTime.x+(lifeTime.y-lifeTime.x)*randoms.r;\\noutAge=newAge-life;\\noutSeed=seed;\\n#ifdef SIZEGRADIENTS \\noutSize.x=texture(sizeGradientSampler,vec2(0,0)).r;\\n#else\\noutSize.x=sizeRange.x+(sizeRange.y-sizeRange.x)*randoms.g;\\n#endif\\noutSize.y=scaleRange.x+(scaleRange.y-scaleRange.x)*randoms.b;\\noutSize.z=scaleRange.z+(scaleRange.w-scaleRange.z)*randoms.a; \\n#ifndef COLORGRADIENTS\\noutColor=color1+(color2-color1)*randoms.b;\\n#endif\\n#ifndef ANGULARSPEEDGRADIENTS \\noutAngle.y=angleRange.x+(angleRange.y-angleRange.x)*randoms.a;\\noutAngle.x=angleRange.z+(angleRange.w-angleRange.z)*randoms.r;\\n#else\\noutAngle=angleRange.z+(angleRange.w-angleRange.z)*randoms.r;\\n#endif \\n#ifdef POINTEMITTER\\nvec3 randoms2=getRandomVec3(seed.y);\\nvec3 randoms3=getRandomVec3(seed.z);\\nnewPosition=vec3(0,0,0);\\nnewDirection=direction1+(direction2-direction1)*randoms3;\\n#elif defined(BOXEMITTER)\\nvec3 randoms2=getRandomVec3(seed.y);\\nvec3 randoms3=getRandomVec3(seed.z);\\nnewPosition=minEmitBox+(maxEmitBox-minEmitBox)*randoms2;\\nnewDirection=direction1+(direction2-direction1)*randoms3; \\n#elif defined(HEMISPHERICEMITTER)\\nvec3 randoms2=getRandomVec3(seed.y);\\nvec3 randoms3=getRandomVec3(seed.z);\\nfloat phi=2.0*PI*randoms2.x;\\nfloat theta=acos(2.0*randoms2.y-1.0);\\nfloat randX=cos(phi)*sin(theta);\\nfloat randY=cos(theta);\\nfloat randZ=sin(phi)*sin(theta);\\nnewPosition=(radius-(radius*radiusRange*randoms2.z))*vec3(randX,abs(randY),randZ);\\nnewDirection=newPosition+directionRandomizer*randoms3; \\n#elif defined(SPHEREEMITTER)\\nvec3 randoms2=getRandomVec3(seed.y);\\nvec3 randoms3=getRandomVec3(seed.z);\\nfloat phi=2.0*PI*randoms2.x;\\nfloat theta=acos(2.0*randoms2.y-1.0);\\nfloat randX=cos(phi)*sin(theta);\\nfloat randY=cos(theta);\\nfloat randZ=sin(phi)*sin(theta);\\nnewPosition=(radius-(radius*radiusRange*randoms2.z))*vec3(randX,randY,randZ);\\n#ifdef DIRECTEDSPHEREEMITTER\\nnewDirection=normalize(direction1+(direction2-direction1)*randoms3);\\n#else\\nnewDirection=normalize(newPosition+directionRandomizer*randoms3);\\n#endif\\n#elif defined(CYLINDEREMITTER)\\nvec3 randoms2=getRandomVec3(seed.y);\\nvec3 randoms3=getRandomVec3(seed.z);\\nfloat yPos=(randoms2.x-0.5)*height;\\nfloat angle=randoms2.y*PI*2.;\\nfloat inverseRadiusRangeSquared=((1.-radiusRange)*(1.-radiusRange));\\nfloat positionRadius=radius*sqrt(inverseRadiusRangeSquared+(randoms2.z*(1.-inverseRadiusRangeSquared)));\\nfloat xPos=positionRadius*cos(angle);\\nfloat zPos=positionRadius*sin(angle);\\nnewPosition=vec3(xPos,yPos,zPos);\\n#ifdef DIRECTEDCYLINDEREMITTER\\nnewDirection=direction1+(direction2-direction1)*randoms3;\\n#else\\nangle=angle+((randoms3.x-0.5)*PI)*directionRandomizer;\\nnewDirection=vec3(cos(angle),(randoms3.y-0.5)*directionRandomizer,sin(angle));\\nnewDirection=normalize(newDirection);\\n#endif\\n#elif defined(CONEEMITTER)\\nvec3 randoms2=getRandomVec3(seed.y);\\nfloat s=2.0*PI*randoms2.x;\\n#ifdef CONEEMITTERSPAWNPOINT\\nfloat h=0.0001;\\n#else\\nfloat h=randoms2.y*height.y;\\nh=1.-h*h; \\n#endif\\nfloat lRadius=radius.x-radius.x*randoms2.z*radius.y;\\nlRadius=lRadius*h;\\nfloat randX=lRadius*sin(s);\\nfloat randZ=lRadius*cos(s);\\nfloat randY=h *height.x;\\nnewPosition=vec3(randX,randY,randZ); \\nif (abs(cos(coneAngle))==1.0) {\\nnewDirection=vec3(0.,1.0,0.);\\n} else {\\nvec3 randoms3=getRandomVec3(seed.z);\\nnewDirection=normalize(newPosition+directionRandomizer*randoms3); \\n}\\n#elif defined(CUSTOMEMITTER)\\nnewPosition=initialPosition;\\noutInitialPosition=initialPosition;\\n#else \\nnewPosition=vec3(0.,0.,0.);\\nnewDirection=2.0*(getRandomVec3(seed.w)-vec3(0.5,0.5,0.5));\\n#endif\\nfloat power=emitPower.x+(emitPower.y-emitPower.x)*randoms.a;\\n#ifdef LOCAL\\noutPosition=newPosition;\\n#else\\noutPosition=(emitterWM*vec4(newPosition,1.)).xyz;\\n#endif\\n#ifdef CUSTOMEMITTER\\noutDirection=direction;\\n#ifndef BILLBOARD \\noutInitialDirection=direction;\\n#endif\\n#else\\n#ifdef LOCAL\\nvec3 initial=newDirection;\\n#else \\nvec3 initial=(emitterWM*vec4(newDirection,0.)).xyz;\\n#endif\\noutDirection=initial*power;\\n#ifndef BILLBOARD \\noutInitialDirection=initial;\\n#endif\\n#endif\\n#ifdef ANIMATESHEET \\noutCellIndex=cellInfos.x;\\n#ifdef ANIMATESHEETRANDOMSTART\\noutCellStartOffset=randoms.a*outLife;\\n#endif \\n#endif\\n#ifdef NOISE\\noutNoiseCoordinates1=noiseCoordinates1;\\noutNoiseCoordinates2=noiseCoordinates2;\\n#endif\\n} else {\\nfloat directionScale=timeDelta;\\noutAge=newAge;\\nfloat ageGradient=newAge/life;\\n#ifdef VELOCITYGRADIENTS\\ndirectionScale*=texture(velocityGradientSampler,vec2(ageGradient,0)).r;\\n#endif\\n#ifdef DRAGGRADIENTS\\ndirectionScale*=1.0-texture(dragGradientSampler,vec2(ageGradient,0)).r;\\n#endif\\n#if defined(CUSTOMEMITTER)\\noutPosition=position+(direction-position)*ageGradient; \\noutInitialPosition=initialPosition;\\n#else\\noutPosition=position+direction*directionScale;\\n#endif\\noutLife=life;\\noutSeed=seed;\\n#ifndef COLORGRADIENTS \\noutColor=color;\\n#endif\\n#ifdef SIZEGRADIENTS\\noutSize.x=texture(sizeGradientSampler,vec2(ageGradient,0)).r;\\noutSize.yz=size.yz;\\n#else\\noutSize=size;\\n#endif \\n#ifndef BILLBOARD \\noutInitialDirection=initialDirection;\\n#endif\\n#ifdef CUSTOMEMITTER\\noutDirection=direction;\\n#else\\nvec3 updatedDirection=direction+gravity*timeDelta;\\n#ifdef LIMITVELOCITYGRADIENTS\\nfloat limitVelocity=texture(limitVelocityGradientSampler,vec2(ageGradient,0)).r;\\nfloat currentVelocity=length(updatedDirection);\\nif (currentVelocity>limitVelocity) {\\nupdatedDirection=updatedDirection*limitVelocityDamping;\\n}\\n#endif\\noutDirection=updatedDirection;\\n#ifdef NOISE\\nfloat fetchedR=texture(noiseSampler,vec2(noiseCoordinates1.x,noiseCoordinates1.y)*vec2(0.5)+vec2(0.5)).r;\\nfloat fetchedG=texture(noiseSampler,vec2(noiseCoordinates1.z,noiseCoordinates2.x)*vec2(0.5)+vec2(0.5)).r;\\nfloat fetchedB=texture(noiseSampler,vec2(noiseCoordinates2.y,noiseCoordinates2.z)*vec2(0.5)+vec2(0.5)).r;\\nvec3 force=vec3(2.*fetchedR-1.,2.*fetchedG-1.,2.*fetchedB-1.)*noiseStrength;\\noutDirection=outDirection+force*timeDelta;\\noutNoiseCoordinates1=noiseCoordinates1;\\noutNoiseCoordinates2=noiseCoordinates2;\\n#endif \\n#endif \\n#ifdef ANGULARSPEEDGRADIENTS\\nfloat angularSpeed=texture(angularSpeedGradientSampler,vec2(ageGradient,0)).r;\\noutAngle=angle+angularSpeed*timeDelta;\\n#else\\noutAngle=vec2(angle.x+angle.y*timeDelta,angle.y);\\n#endif\\n#ifdef ANIMATESHEET \\nfloat offsetAge=outAge;\\nfloat dist=cellInfos.y-cellInfos.x;\\n#ifdef ANIMATESHEETRANDOMSTART\\noutCellStartOffset=cellStartOffset;\\noffsetAge+=cellStartOffset;\\n#else\\nfloat cellStartOffset=0.;\\n#endif \\nfloat ratio=0.;\\nif (cellInfos.w==1.0) {\\nratio=clamp(mod(cellStartOffset+cellInfos.z*offsetAge,life)/life,0.,1.0);\\n}\\nelse {\\nratio=clamp(cellStartOffset+cellInfos.z*offsetAge/life,0.,1.0);\\n}\\noutCellIndex=float(int(cellInfos.x+ratio*dist));\\n#endif\\n}\\n}\";var Ay=function(){function e(e,t){this._renderVAO=[],this._updateVAO=[],this.alignDataInBuffer=!1,this._parent=e,this._engine=t,this._updateEffectOptions={attributes:[\"position\",\"initialPosition\",\"age\",\"life\",\"seed\",\"size\",\"color\",\"direction\",\"initialDirection\",\"angle\",\"cellIndex\",\"cellStartOffset\",\"noiseCoordinates1\",\"noiseCoordinates2\"],uniformsNames:[\"currentCount\",\"timeDelta\",\"emitterWM\",\"lifeTime\",\"color1\",\"color2\",\"sizeRange\",\"scaleRange\",\"gravity\",\"emitPower\",\"direction1\",\"direction2\",\"minEmitBox\",\"maxEmitBox\",\"radius\",\"directionRandomizer\",\"height\",\"coneAngle\",\"stopFactor\",\"angleRange\",\"radiusRange\",\"cellInfos\",\"noiseStrength\",\"limitVelocityDamping\"],uniformBuffersNames:[],samplers:[\"randomSampler\",\"randomSampler2\",\"sizeGradientSampler\",\"angularSpeedGradientSampler\",\"velocityGradientSampler\",\"limitVelocityGradientSampler\",\"noiseSampler\",\"dragGradientSampler\"],defines:\"\",fallbacks:null,onCompiled:null,onError:null,indexParameters:null,maxSimultaneousLights:0,transformFeedbackVaryings:[]}}return e.prototype.isUpdateBufferCreated=function(){return!!this._updateEffect},e.prototype.isUpdateBufferReady=function(){var e,t;return null!==(t=null===(e=this._updateEffect)||void 0===e?void 0:e.isReady())&&void 0!==t&&t},e.prototype.createUpdateBuffer=function(e){return this._updateEffectOptions.transformFeedbackVaryings=[\"outPosition\"],this._updateEffectOptions.transformFeedbackVaryings.push(\"outAge\"),this._updateEffectOptions.transformFeedbackVaryings.push(\"outSize\"),this._updateEffectOptions.transformFeedbackVaryings.push(\"outLife\"),this._updateEffectOptions.transformFeedbackVaryings.push(\"outSeed\"),this._updateEffectOptions.transformFeedbackVaryings.push(\"outDirection\"),this._parent.particleEmitterType instanceof xa&&this._updateEffectOptions.transformFeedbackVaryings.push(\"outInitialPosition\"),this._parent._colorGradientsTexture||this._updateEffectOptions.transformFeedbackVaryings.push(\"outColor\"),this._parent._isBillboardBased||this._updateEffectOptions.transformFeedbackVaryings.push(\"outInitialDirection\"),this._parent.noiseTexture&&(this._updateEffectOptions.transformFeedbackVaryings.push(\"outNoiseCoordinates1\"),this._updateEffectOptions.transformFeedbackVaryings.push(\"outNoiseCoordinates2\")),this._updateEffectOptions.transformFeedbackVaryings.push(\"outAngle\"),this._parent.isAnimationSheetEnabled&&(this._updateEffectOptions.transformFeedbackVaryings.push(\"outCellIndex\"),this._parent.spriteRandomStartCell&&this._updateEffectOptions.transformFeedbackVaryings.push(\"outCellStartOffset\")),this._updateEffectOptions.defines=e,this._updateEffect=new Ot(\"gpuUpdateParticles\",this._updateEffectOptions,this._engine),new Sy(this._updateEffect)},e.prototype.createVertexBuffers=function(e,t){this._updateVAO.push(this._createUpdateVAO(e)),this._renderVAO.push(this._engine.recordVertexArrayObject(t,null,this._parent._getWrapper(this._parent.blendMode).effect)),this._engine.bindArrayBuffer(null)},e.prototype.createParticleBuffer=function(e){return e},e.prototype.bindDrawBuffers=function(e){this._engine.bindVertexArrayObject(this._renderVAO[e],null)},e.prototype.preUpdateParticleBuffer=function(){var e=this._engine;if(this._engine.enableEffect(this._updateEffect),!e.setState)throw new Error(\"GPU particles cannot work without a full Engine. ThinEngine is not supported\")},e.prototype.updateParticleBuffer=function(e,t,i){this._updateEffect.setTexture(\"randomSampler\",this._parent._randomTexture),this._updateEffect.setTexture(\"randomSampler2\",this._parent._randomTexture2),this._parent._sizeGradientsTexture&&this._updateEffect.setTexture(\"sizeGradientSampler\",this._parent._sizeGradientsTexture),this._parent._angularSpeedGradientsTexture&&this._updateEffect.setTexture(\"angularSpeedGradientSampler\",this._parent._angularSpeedGradientsTexture),this._parent._velocityGradientsTexture&&this._updateEffect.setTexture(\"velocityGradientSampler\",this._parent._velocityGradientsTexture),this._parent._limitVelocityGradientsTexture&&this._updateEffect.setTexture(\"limitVelocityGradientSampler\",this._parent._limitVelocityGradientsTexture),this._parent._dragGradientsTexture&&this._updateEffect.setTexture(\"dragGradientSampler\",this._parent._dragGradientsTexture),this._parent.noiseTexture&&this._updateEffect.setTexture(\"noiseSampler\",this._parent.noiseTexture),this._engine.bindVertexArrayObject(this._updateVAO[e],null);var n=this._engine;n.bindTransformFeedbackBuffer(t.getBuffer()),n.setRasterizerState(!1),n.beginTransformFeedback(!0),n.drawArraysType(a.MATERIAL_PointListDrawMode,0,i),n.endTransformFeedback(),n.setRasterizerState(!0),n.bindTransformFeedbackBuffer(null)},e.prototype.releaseBuffers=function(){},e.prototype.releaseVertexBuffers=function(){for(var e=0;e,\\nage : f32,\\nsize : vec3,\\nlife : f32,\\nseed : vec4,\\ndirection : vec3,\\ndummy0: f32,\\n#ifdef CUSTOMEMITTER\\ninitialPosition : vec3,\\ndummy1: f32,\\n#endif\\n#ifndef COLORGRADIENTS\\ncolor : vec4,\\n#endif\\n#ifndef BILLBOARD\\ninitialDirection : vec3,\\ndummy2: f32,\\n#endif\\n#ifdef NOISE\\nnoiseCoordinates1 : vec3,\\ndummy3: f32,\\nnoiseCoordinates2 : vec3,\\ndummy4: f32,\\n#endif\\n#ifdef ANGULARSPEEDGRADIENTS\\nangle : f32,\\n#else\\nangle : vec2,\\n#endif\\n#ifdef ANIMATESHEET\\ncellIndex : f32,\\n#ifdef ANIMATESHEETRANDOMSTART\\ncellStartOffset : f32,\\n#endif\\n#endif\\n};\\nstruct Particles {\\nparticles : array,\\n};\\nstruct SimParams {\\ncurrentCount : f32,\\ntimeDelta : f32,\\nstopFactor : f32,\\nrandomTextureSize: i32,\\nlifeTime : vec2,\\nemitPower : vec2,\\n#ifndef COLORGRADIENTS\\ncolor1 : vec4,\\ncolor2 : vec4,\\n#endif\\nsizeRange : vec2,\\nscaleRange : vec4,\\nangleRange : vec4,\\ngravity : vec3,\\n#ifdef LIMITVELOCITYGRADIENTS\\nlimitVelocityDamping : f32,\\n#endif\\n#ifdef ANIMATESHEET\\ncellInfos : vec4,\\n#endif\\n#ifdef NOISE\\nnoiseStrength : vec3,\\n#endif\\n#ifndef LOCAL\\nemitterWM : mat4x4,\\n#endif\\n#ifdef BOXEMITTER\\ndirection1 : vec3,\\ndirection2 : vec3,\\nminEmitBox : vec3,\\nmaxEmitBox : vec3,\\n#endif\\n#ifdef CONEEMITTER\\nradius : vec2,\\nconeAngle : f32,\\nheight : vec2,\\ndirectionRandomizer : f32,\\n#endif\\n#ifdef CYLINDEREMITTER\\nradius : f32,\\nheight : f32,\\nradiusRange : f32,\\n#ifdef DIRECTEDCYLINDEREMITTER\\ndirection1 : vec3,\\ndirection2 : vec3,\\n#else\\ndirectionRandomizer : f32,\\n#endif\\n#endif\\n#ifdef HEMISPHERICEMITTER\\nradius : f32,\\nradiusRange : f32,\\ndirectionRandomizer : f32,\\n#endif\\n#ifdef POINTEMITTER\\ndirection1 : vec3,\\ndirection2 : vec3,\\n#endif\\n#ifdef SPHEREEMITTER\\nradius : f32,\\nradiusRange : f32,\\n#ifdef DIRECTEDSPHEREEMITTER\\ndirection1 : vec3,\\ndirection2 : vec3,\\n#else\\ndirectionRandomizer : f32,\\n#endif\\n#endif\\n};\\n@binding(0) @group(0) var params : SimParams;\\n@binding(1) @group(0) var particlesIn : Particles;\\n@binding(2) @group(0) var particlesOut : Particles;\\n@binding(3) @group(0) var randomTexture : texture_2d;\\n@binding(4) @group(0) var randomTexture2 : texture_2d;\\n#ifdef SIZEGRADIENTS\\n@binding(0) @group(1) var sizeGradientSampler : sampler;\\n@binding(1) @group(1) var sizeGradientTexture : texture_2d;\\n#endif \\n#ifdef ANGULARSPEEDGRADIENTS\\n@binding(2) @group(1) var angularSpeedGradientSampler : sampler;\\n@binding(3) @group(1) var angularSpeedGradientTexture : texture_2d;\\n#endif \\n#ifdef VELOCITYGRADIENTS\\n@binding(4) @group(1) var velocityGradientSampler : sampler;\\n@binding(5) @group(1) var velocityGradientTexture : texture_2d;\\n#endif\\n#ifdef LIMITVELOCITYGRADIENTS\\n@binding(6) @group(1) var limitVelocityGradientSampler : sampler;\\n@binding(7) @group(1) var limitVelocityGradientTexture : texture_2d;\\n#endif\\n#ifdef DRAGGRADIENTS\\n@binding(8) @group(1) var dragGradientSampler : sampler;\\n@binding(9) @group(1) var dragGradientTexture : texture_2d;\\n#endif\\n#ifdef NOISE\\n@binding(10) @group(1) var noiseSampler : sampler;\\n@binding(11) @group(1) var noiseTexture : texture_2d;\\n#endif\\nfn getRandomVec3(offset : f32,vertexID : f32)->vec3 {\\nreturn textureLoad(randomTexture2,vec2(i32(vertexID*offset/params.currentCount*f32(params.randomTextureSize)) % params.randomTextureSize,0),0).rgb;\\n}\\nfn getRandomVec4(offset : f32,vertexID : f32)->vec4 {\\nreturn textureLoad(randomTexture,vec2(i32(vertexID*offset/params.currentCount*f32(params.randomTextureSize)) % params.randomTextureSize,0),0);\\n}\\n@stage(compute) @workgroup_size(64)\\nfn main(@builtin(global_invocation_id) GlobalInvocationID : vec3) {\\nlet index : u32=GlobalInvocationID.x;\\nlet vertexID : f32=f32(index);\\nif (index>=u32(params.currentCount)) {\\nreturn;\\n}\\nlet PI : f32=3.14159;\\nlet timeDelta : f32=params.timeDelta;\\nlet newAge : f32=particlesIn.particles[index].age+timeDelta;\\nlet life : f32=particlesIn.particles[index].life;\\nlet seed : vec4=particlesIn.particles[index].seed;\\nlet direction : vec3=particlesIn.particles[index].direction;\\nif (newAge>=life && params.stopFactor != 0.) {\\nvar newPosition : vec3;\\nvar newDirection : vec3;\\nlet randoms : vec4=getRandomVec4(seed.x,vertexID);\\nlet outLife : f32=params.lifeTime.x+(params.lifeTime.y-params.lifeTime.x)*randoms.r;\\nparticlesOut.particles[index].life=outLife;\\nparticlesOut.particles[index].age=newAge-life;\\nparticlesOut.particles[index].seed=seed;\\nvar sizex : f32;\\n#ifdef SIZEGRADIENTS \\nsizex=textureSampleLevel(sizeGradientTexture,sizeGradientSampler,vec2(0.,0.),0.).r;\\n#else\\nsizex=params.sizeRange.x+(params.sizeRange.y-params.sizeRange.x)*randoms.g;\\n#endif\\nparticlesOut.particles[index].size=vec3(\\nsizex,\\nparams.scaleRange.x+(params.scaleRange.y-params.scaleRange.x)*randoms.b,\\nparams.scaleRange.z+(params.scaleRange.w-params.scaleRange.z)*randoms.a);\\n#ifndef COLORGRADIENTS\\nparticlesOut.particles[index].color=params.color1+(params.color2-params.color1)*randoms.b;\\n#endif\\n#ifndef ANGULARSPEEDGRADIENTS \\nparticlesOut.particles[index].angle=vec2(\\nparams.angleRange.z+(params.angleRange.w-params.angleRange.z)*randoms.r,\\nparams.angleRange.x+(params.angleRange.y-params.angleRange.x)*randoms.a);\\n#else\\nparticlesOut.particles[index].angle=params.angleRange.z+(params.angleRange.w-params.angleRange.z)*randoms.r;\\n#endif \\n#if defined(POINTEMITTER)\\nlet randoms2 : vec3=getRandomVec3(seed.y,vertexID);\\nlet randoms3 : vec3=getRandomVec3(seed.z,vertexID);\\nnewPosition=vec3(0.,0.,0.);\\nnewDirection=params.direction1+(params.direction2-params.direction1)*randoms3;\\n#elif defined(BOXEMITTER)\\nlet randoms2 : vec3=getRandomVec3(seed.y,vertexID);\\nlet randoms3 : vec3=getRandomVec3(seed.z,vertexID);\\nnewPosition=params.minEmitBox+(params.maxEmitBox-params.minEmitBox)*randoms2;\\nnewDirection=params.direction1+(params.direction2-params.direction1)*randoms3; \\n#elif defined(HEMISPHERICEMITTER)\\nlet randoms2 : vec3=getRandomVec3(seed.y,vertexID);\\nlet randoms3 : vec3=getRandomVec3(seed.z,vertexID);\\nlet phi : f32=2.0*PI*randoms2.x;\\nlet theta : f32=acos(-1.0+2.0*randoms2.y);\\nlet randX : f32=cos(phi)*sin(theta);\\nlet randY : f32=cos(theta);\\nlet randZ : f32=sin(phi)*sin(theta);\\nnewPosition=(params.radius-(params.radius*params.radiusRange*randoms2.z))*vec3(randX,abs(randY),randZ);\\nnewDirection=normalize(newPosition+params.directionRandomizer*randoms3);\\n#elif defined(SPHEREEMITTER)\\nlet randoms2 : vec3=getRandomVec3(seed.y,vertexID);\\nlet randoms3 : vec3=getRandomVec3(seed.z,vertexID);\\nlet phi : f32=2.0*PI*randoms2.x;\\nlet theta : f32=acos(-1.0+2.0*randoms2.y);\\nlet randX : f32=cos(phi)*sin(theta);\\nlet randY : f32=cos(theta);\\nlet randZ : f32=sin(phi)*sin(theta);\\nnewPosition=(params.radius-(params.radius*params.radiusRange*randoms2.z))*vec3(randX,randY,randZ);\\n#ifdef DIRECTEDSPHEREEMITTER\\nnewDirection=normalize(params.direction1+(params.direction2-params.direction1)*randoms3);\\n#else\\nnewDirection=normalize(newPosition+params.directionRandomizer*randoms3);\\n#endif\\n#elif defined(CYLINDEREMITTER)\\nlet randoms2 : vec3=getRandomVec3(seed.y,vertexID);\\nlet randoms3 : vec3=getRandomVec3(seed.z,vertexID);\\nlet yPos : f32=(-0.5+randoms2.x)*params.height;\\nvar angle : f32=randoms2.y*PI*2.;\\nlet inverseRadiusRangeSquared : f32=(1.-params.radiusRange)*(1.-params.radiusRange);\\nlet positionRadius : f32=params.radius*sqrt(inverseRadiusRangeSquared+randoms2.z*(1.-inverseRadiusRangeSquared));\\nlet xPos : f32=positionRadius*cos(angle);\\nlet zPos : f32=positionRadius*sin(angle);\\nnewPosition=vec3(xPos,yPos,zPos);\\n#ifdef DIRECTEDCYLINDEREMITTER\\nnewDirection=params.direction1+(params.direction2-params.direction1)*randoms3;\\n#else\\nangle=angle+(-0.5+randoms3.x)*PI*params.directionRandomizer;\\nnewDirection=vec3(cos(angle),(-0.5+randoms3.y)*params.directionRandomizer,sin(angle));\\nnewDirection=normalize(newDirection);\\n#endif\\n#elif defined(CONEEMITTER)\\nlet randoms2 : vec3=getRandomVec3(seed.y,vertexID);\\nlet s : f32=2.0*PI*randoms2.x;\\n#ifdef CONEEMITTERSPAWNPOINT\\nlet h : f32=0.0001;\\n#else\\nvar h : f32=randoms2.y*params.height.y;\\nh=1.-h*h; \\n#endif\\nvar lRadius : f32=params.radius.x-params.radius.x*randoms2.z*params.radius.y;\\nlRadius=lRadius*h;\\nlet randX : f32=lRadius*sin(s);\\nlet randZ : f32=lRadius*cos(s);\\nlet randY : f32=h *params.height.x;\\nnewPosition=vec3(randX,randY,randZ); \\nif (abs(cos(params.coneAngle))==1.0) {\\nnewDirection=vec3(0.,1.0,0.);\\n} else {\\nlet randoms3 : vec3=getRandomVec3(seed.z,vertexID);\\nnewDirection=normalize(newPosition+params.directionRandomizer*randoms3); \\n}\\n#elif defined(CUSTOMEMITTER)\\nnewPosition=particlesIn.particles[index].initialPosition;\\nparticlesOut.particles[index].initialPosition=newPosition;\\n#else \\nnewPosition=vec3(0.,0.,0.);\\nnewDirection=2.0*(getRandomVec3(seed.w,vertexID)-vec3(0.5,0.5,0.5));\\n#endif\\nlet power : f32=params.emitPower.x+(params.emitPower.y-params.emitPower.x)*randoms.a;\\n#ifdef LOCAL\\nparticlesOut.particles[index].position=newPosition;\\n#else\\nparticlesOut.particles[index].position=(params.emitterWM*vec4(newPosition,1.)).xyz;\\n#endif\\n#ifdef CUSTOMEMITTER\\nparticlesOut.particles[index].direction=direction;\\n#ifndef BILLBOARD \\nparticlesOut.particles[index].initialDirection=direction;\\n#endif\\n#else\\n#ifdef LOCAL\\nlet initial : vec3=newDirection;\\n#else \\nlet initial : vec3=(params.emitterWM*vec4(newDirection,0.)).xyz;\\n#endif\\nparticlesOut.particles[index].direction=initial*power;\\n#ifndef BILLBOARD \\nparticlesOut.particles[index].initialDirection=initial;\\n#endif\\n#endif\\n#ifdef ANIMATESHEET \\nparticlesOut.particles[index].cellIndex=params.cellInfos.x;\\n#ifdef ANIMATESHEETRANDOMSTART\\nparticlesOut.particles[index].cellStartOffset=randoms.a*outLife;\\n#endif \\n#endif\\n#ifdef NOISE\\nparticlesOut.particles[index].noiseCoordinates1=particlesIn.particles[index].noiseCoordinates1;\\nparticlesOut.particles[index].noiseCoordinates2=particlesIn.particles[index].noiseCoordinates2;\\n#endif\\n} else {\\nvar directionScale : f32=timeDelta;\\nparticlesOut.particles[index].age=newAge;\\nlet ageGradient : f32=newAge/life;\\n#ifdef VELOCITYGRADIENTS\\ndirectionScale=directionScale*textureSampleLevel(velocityGradientTexture,velocityGradientSampler,vec2(ageGradient,0.),0.).r;\\n#endif\\n#ifdef DRAGGRADIENTS\\ndirectionScale=directionScale*(1.0-textureSampleLevel(dragGradientTexture,dragGradientSampler,vec2(ageGradient,0.),0.).r);\\n#endif\\nlet position : vec3=particlesIn.particles[index].position;\\n#if defined(CUSTOMEMITTER)\\nparticlesOut.particles[index].position=position+(direction-position)*ageGradient; \\nparticlesOut.particles[index].initialPosition=particlesIn.particles[index].initialPosition;\\n#else\\nparticlesOut.particles[index].position=position+direction*directionScale;\\n#endif\\nparticlesOut.particles[index].life=life;\\nparticlesOut.particles[index].seed=seed;\\n#ifndef COLORGRADIENTS \\nparticlesOut.particles[index].color=particlesIn.particles[index].color;\\n#endif\\n#ifdef SIZEGRADIENTS\\nparticlesOut.particles[index].size=vec3(\\ntextureSampleLevel(sizeGradientTexture,sizeGradientSampler,vec2(ageGradient,0.),0.).r,\\nparticlesIn.particles[index].size.yz);\\n#else\\nparticlesOut.particles[index].size=particlesIn.particles[index].size;\\n#endif \\n#ifndef BILLBOARD \\nparticlesOut.particles[index].initialDirection=particlesIn.particles[index].initialDirection;\\n#endif\\n#ifdef CUSTOMEMITTER\\nparticlesOut.particles[index].direction=direction;\\n#else\\nvar updatedDirection : vec3=direction+params.gravity*timeDelta;\\n#ifdef LIMITVELOCITYGRADIENTS\\nlet limitVelocity : f32=textureSampleLevel(limitVelocityGradientTexture,limitVelocityGradientSampler,vec2(ageGradient,0.),0.).r;\\nlet currentVelocity : f32=length(updatedDirection);\\nif (currentVelocity>limitVelocity) {\\nupdatedDirection=updatedDirection*params.limitVelocityDamping;\\n}\\n#endif\\nparticlesOut.particles[index].direction=updatedDirection;\\n#ifdef NOISE\\nlet noiseCoordinates1 : vec3=particlesIn.particles[index].noiseCoordinates1;\\nlet noiseCoordinates2 : vec3=particlesIn.particles[index].noiseCoordinates2;\\nlet fetchedR : f32=textureSampleLevel(noiseTexture,noiseSampler,vec2(noiseCoordinates1.x,noiseCoordinates1.y)*vec2(0.5,0.5)+vec2(0.5,0.5),0.).r;\\nlet fetchedG : f32=textureSampleLevel(noiseTexture,noiseSampler,vec2(noiseCoordinates1.z,noiseCoordinates2.x)*vec2(0.5,0.5)+vec2(0.5,0.5),0.).r;\\nlet fetchedB : f32=textureSampleLevel(noiseTexture,noiseSampler,vec2(noiseCoordinates2.y,noiseCoordinates2.z)*vec2(0.5,0.5)+vec2(0.5,0.5),0.).r;\\nlet force : vec3=vec3(-1.+2.*fetchedR,-1.+2.*fetchedG,-1.+2.*fetchedB)*params.noiseStrength;\\nparticlesOut.particles[index].direction=particlesOut.particles[index].direction+force*timeDelta;\\nparticlesOut.particles[index].noiseCoordinates1=noiseCoordinates1;\\nparticlesOut.particles[index].noiseCoordinates2=noiseCoordinates2;\\n#endif \\n#endif \\n#ifdef ANGULARSPEEDGRADIENTS\\nlet angularSpeed : f32=textureSampleLevel(angularSpeedGradientTexture,angularSpeedGradientSampler,vec2(ageGradient,0.),0.).r;\\nparticlesOut.particles[index].angle=particlesIn.particles[index].angle+angularSpeed*timeDelta;\\n#else\\nlet angle : vec2=particlesIn.particles[index].angle;\\nparticlesOut.particles[index].angle=vec2(angle.x+angle.y*timeDelta,angle.y);\\n#endif\\n#ifdef ANIMATESHEET \\nvar offsetAge : f32=particlesOut.particles[index].age;\\nlet dist : f32=params.cellInfos.y-params.cellInfos.x;\\n#ifdef ANIMATESHEETRANDOMSTART\\nlet cellStartOffset : f32=particlesIn.particles[index].cellStartOffset;\\nparticlesOut.particles[index].cellStartOffset=cellStartOffset;\\noffsetAge=offsetAge+cellStartOffset;\\n#else\\nlet cellStartOffset : f32=0.;\\n#endif \\nvar ratio : f32;\\nif (params.cellInfos.w==1.0) {\\nratio=clamp(((cellStartOffset+params.cellInfos.z*offsetAge) % life)/life,0.,1.0);\\n}\\nelse {\\nratio=clamp((cellStartOffset+params.cellInfos.z*offsetAge)/life,0.,1.0);\\n}\\nparticlesOut.particles[index].cellIndex=f32(i32(params.cellInfos.x+ratio*dist));\\n#endif\\n}\\n}\\n\";var Ry=function(){function e(e,t){this._bufferComputeShader=[],this._renderVertexBuffers=[],this.alignDataInBuffer=!0,this._parent=e,this._engine=t}return e.prototype.isUpdateBufferCreated=function(){return!!this._updateComputeShader},e.prototype.isUpdateBufferReady=function(){var e,t;return null!==(t=null===(e=this._updateComputeShader)||void 0===e?void 0:e.isReady())&&void 0!==t&&t},e.prototype.createUpdateBuffer=function(e){var t,i={params:{group:0,binding:0},particlesIn:{group:0,binding:1},particlesOut:{group:0,binding:2},randomTexture:{group:0,binding:3},randomTexture2:{group:0,binding:4}};return this._parent._sizeGradientsTexture&&(i.sizeGradientTexture={group:1,binding:1}),this._parent._angularSpeedGradientsTexture&&(i.angularSpeedGradientTexture={group:1,binding:3}),this._parent._velocityGradientsTexture&&(i.velocityGradientTexture={group:1,binding:5}),this._parent._limitVelocityGradientsTexture&&(i.limitVelocityGradientTexture={group:1,binding:7}),this._parent._dragGradientsTexture&&(i.dragGradientTexture={group:1,binding:9}),this._parent.noiseTexture&&(i.noiseTexture={group:1,binding:11}),this._updateComputeShader=new Oc(\"updateParticles\",this._engine,\"gpuUpdateParticles\",{bindingsMapping:i,defines:e.split(\"\\n\")}),null===(t=this._simParamsComputeShader)||void 0===t||t.dispose(),this._simParamsComputeShader=new Li(this._engine),this._simParamsComputeShader.addUniform(\"currentCount\",1),this._simParamsComputeShader.addUniform(\"timeDelta\",1),this._simParamsComputeShader.addUniform(\"stopFactor\",1),this._simParamsComputeShader.addUniform(\"randomTextureSize\",1),this._simParamsComputeShader.addUniform(\"lifeTime\",2),this._simParamsComputeShader.addUniform(\"emitPower\",2),this._parent._colorGradientsTexture||(this._simParamsComputeShader.addUniform(\"color1\",4),this._simParamsComputeShader.addUniform(\"color2\",4)),this._simParamsComputeShader.addUniform(\"sizeRange\",2),this._simParamsComputeShader.addUniform(\"scaleRange\",4),this._simParamsComputeShader.addUniform(\"angleRange\",4),this._simParamsComputeShader.addUniform(\"gravity\",3),this._parent._limitVelocityGradientsTexture&&this._simParamsComputeShader.addUniform(\"limitVelocityDamping\",1),this._parent.isAnimationSheetEnabled&&this._simParamsComputeShader.addUniform(\"cellInfos\",4),this._parent.noiseTexture&&this._simParamsComputeShader.addUniform(\"noiseStrength\",3),this._parent.isLocal||this._simParamsComputeShader.addUniform(\"emitterWM\",16),this._parent.particleEmitterType&&this._parent.particleEmitterType.buildUniformLayout(this._simParamsComputeShader),this._updateComputeShader.setUniformBuffer(\"params\",this._simParamsComputeShader),new Sy(this._simParamsComputeShader)},e.prototype.createVertexBuffers=function(e,t){this._renderVertexBuffers.push(t)},e.prototype.createParticleBuffer=function(e){var t=new ts(this._engine,4*e.length,a.BUFFER_CREATIONFLAG_READWRITE|a.BUFFER_CREATIONFLAG_VERTEX);return t.update(e),this._bufferComputeShader.push(t),t.getBuffer()},e.prototype.bindDrawBuffers=function(e,t){this._engine.bindBuffers(this._renderVertexBuffers[e],null,t)},e.prototype.preUpdateParticleBuffer=function(){},e.prototype.updateParticleBuffer=function(e,t,i){this._simParamsComputeShader.update(),this._updateComputeShader.setTexture(\"randomTexture\",this._parent._randomTexture,!1),this._updateComputeShader.setTexture(\"randomTexture2\",this._parent._randomTexture2,!1),this._parent._sizeGradientsTexture&&this._updateComputeShader.setTexture(\"sizeGradientTexture\",this._parent._sizeGradientsTexture),this._parent._angularSpeedGradientsTexture&&this._updateComputeShader.setTexture(\"angularSpeedGradientTexture\",this._parent._angularSpeedGradientsTexture),this._parent._velocityGradientsTexture&&this._updateComputeShader.setTexture(\"velocityGradientTexture\",this._parent._velocityGradientsTexture),this._parent._limitVelocityGradientsTexture&&this._updateComputeShader.setTexture(\"limitVelocityGradientTexture\",this._parent._limitVelocityGradientsTexture),this._parent._dragGradientsTexture&&this._updateComputeShader.setTexture(\"dragGradientTexture\",this._parent._dragGradientsTexture),this._parent.noiseTexture&&this._updateComputeShader.setTexture(\"noiseTexture\",this._parent.noiseTexture),this._updateComputeShader.setStorageBuffer(\"particlesIn\",this._bufferComputeShader[e]),this._updateComputeShader.setStorageBuffer(\"particlesOut\",this._bufferComputeShader[1^e]),this._updateComputeShader.dispatch(Math.ceil(i/64))},e.prototype.releaseBuffers=function(){for(var e,t=0;te)i(t[0],t[0],1);else{for(var n=0;n=r.gradient&&e<=o.gradient)return void i(r,o,(e-r.gradient)/(o.gradient-r.gradient))}var a=t.length-1;i(t[a],t[a],1)}},e}(),Oy=function(){function e(t){this.particleSystem=t,this.position=x.Zero(),this.direction=x.Zero(),this.color=new L(0,0,0,0),this.colorStep=new L(0,0,0,0),this.lifeTime=1,this.age=0,this.size=0,this.scale=new R(1,1),this.angle=0,this.angularSpeed=0,this.cellIndex=0,this._attachedSubEmitters=null,this._currentColor1=new L(0,0,0,0),this._currentColor2=new L(0,0,0,0),this._currentSize1=0,this._currentSize2=0,this._currentAngularSpeed1=0,this._currentAngularSpeed2=0,this._currentVelocity1=0,this._currentVelocity2=0,this._currentLimitVelocity1=0,this._currentLimitVelocity2=0,this._currentDrag1=0,this._currentDrag2=0,this.id=e._Count++,this.particleSystem.isAnimationSheetEnabled&&this._updateCellInfoFromSystem()}return e.prototype._updateCellInfoFromSystem=function(){this.cellIndex=this.particleSystem.startSpriteCellID},e.prototype.updateCellIndex=function(){var e=this.age,t=this.particleSystem.spriteCellChangeSpeed;this.particleSystem.spriteRandomStartCell&&(void 0===this._randomCellOffset&&(this._randomCellOffset=Math.random()*this.lifeTime),0===t?(t=1,e=this._randomCellOffset):e+=this._randomCellOffset);var i,n=this._initialEndSpriteCellID-this._initialStartSpriteCellID;i=this._initialSpriteCellLoop?h.Clamp(e*t%this.lifeTime/this.lifeTime):h.Clamp(e*t/this.lifeTime),this.cellIndex=this._initialStartSpriteCellID+i*n|0},e.prototype._inheritParticleInfoToSubEmitter=function(e){if(e.particleSystem.emitter.position){var t=e.particleSystem.emitter;if(t.position.copyFrom(this.position),e.inheritDirection){var i=O.Vector3[0];this.direction.normalizeToRef(i),t.setDirection(i,0,Math.PI/2)}}else e.particleSystem.emitter.copyFrom(this.position);this.direction.scaleToRef(e.inheritedVelocityAmount/2,O.Vector3[0]),e.particleSystem._inheritedVelocityOffset.copyFrom(O.Vector3[0])},e.prototype._inheritParticleInfoToSubEmitters=function(){var e=this;this._attachedSubEmitters&&this._attachedSubEmitters.length>0&&this._attachedSubEmitters.forEach((function(t){e._inheritParticleInfoToSubEmitter(t)}))},e.prototype._reset=function(){this.age=0,this.id=e._Count++,this._currentColorGradient=null,this._currentSizeGradient=null,this._currentAngularSpeedGradient=null,this._currentVelocityGradient=null,this._currentLimitVelocityGradient=null,this._currentDragGradient=null,this.cellIndex=this.particleSystem.startSpriteCellID,this._randomCellOffset=void 0},e.prototype.copyTo=function(e){e.position.copyFrom(this.position),this._initialDirection?e._initialDirection?e._initialDirection.copyFrom(this._initialDirection):e._initialDirection=this._initialDirection.clone():e._initialDirection=null,e.direction.copyFrom(this.direction),this._localPosition&&(e._localPosition?e._localPosition.copyFrom(this._localPosition):e._localPosition=this._localPosition.clone()),e.color.copyFrom(this.color),e.colorStep.copyFrom(this.colorStep),e.lifeTime=this.lifeTime,e.age=this.age,e._randomCellOffset=this._randomCellOffset,e.size=this.size,e.scale.copyFrom(this.scale),e.angle=this.angle,e.angularSpeed=this.angularSpeed,e.particleSystem=this.particleSystem,e.cellIndex=this.cellIndex,e.id=this.id,e._attachedSubEmitters=this._attachedSubEmitters,this._currentColorGradient&&(e._currentColorGradient=this._currentColorGradient,e._currentColor1.copyFrom(this._currentColor1),e._currentColor2.copyFrom(this._currentColor2)),this._currentSizeGradient&&(e._currentSizeGradient=this._currentSizeGradient,e._currentSize1=this._currentSize1,e._currentSize2=this._currentSize2),this._currentAngularSpeedGradient&&(e._currentAngularSpeedGradient=this._currentAngularSpeedGradient,e._currentAngularSpeed1=this._currentAngularSpeed1,e._currentAngularSpeed2=this._currentAngularSpeed2),this._currentVelocityGradient&&(e._currentVelocityGradient=this._currentVelocityGradient,e._currentVelocity1=this._currentVelocity1,e._currentVelocity2=this._currentVelocity2),this._currentLimitVelocityGradient&&(e._currentLimitVelocityGradient=this._currentLimitVelocityGradient,e._currentLimitVelocity1=this._currentLimitVelocity1,e._currentLimitVelocity2=this._currentLimitVelocity2),this._currentDragGradient&&(e._currentDragGradient=this._currentDragGradient,e._currentDrag1=this._currentDrag1,e._currentDrag2=this._currentDrag2),this.particleSystem.isAnimationSheetEnabled&&(e._initialStartSpriteCellID=this._initialStartSpriteCellID,e._initialEndSpriteCellID=this._initialEndSpriteCellID,e._initialSpriteCellLoop=this._initialSpriteCellLoop),this.particleSystem.useRampGradients&&(e.remapData&&this.remapData?e.remapData.copyFrom(this.remapData):e.remapData=new C(0,0,0,0)),this._randomNoiseCoordinates1&&(e._randomNoiseCoordinates1?(e._randomNoiseCoordinates1.copyFrom(this._randomNoiseCoordinates1),e._randomNoiseCoordinates2.copyFrom(this._randomNoiseCoordinates2)):(e._randomNoiseCoordinates1=this._randomNoiseCoordinates1.clone(),e._randomNoiseCoordinates2=this._randomNoiseCoordinates2.clone()))},e._Count=0,e}();!function(e){e[e.ATTACHED=0]=\"ATTACHED\",e[e.END=1]=\"END\"}(xy||(xy={}));var Dy=function(){function e(e){if(this.particleSystem=e,this.type=xy.END,this.inheritDirection=!1,this.inheritedVelocityAmount=0,!e.emitter||!e.emitter.dispose){var t=T(\"BABYLON.AbstractMesh\");e.emitter=new t(\"SubemitterSystemEmitter\",e.getScene()),e._disposeEmitterOnDispose=!0}}return e.prototype.clone=function(){var t=this.particleSystem.emitter;t?t instanceof x?t=t.clone():-1!==t.getClassName().indexOf(\"Mesh\")&&((t=new(T(\"BABYLON.Mesh\"))(\"\",t.getScene())).isVisible=!1):t=new x;var i=new e(this.particleSystem.clone(this.particleSystem.name,t));return i.particleSystem.name+=\"Clone\",i.type=this.type,i.inheritDirection=this.inheritDirection,i.inheritedVelocityAmount=this.inheritedVelocityAmount,i.particleSystem._disposeEmitterOnDispose=!0,i.particleSystem.disposeOnStop=!0,i},e.prototype.serialize=function(e){void 0===e&&(e=!1);var t={};return t.type=this.type,t.inheritDirection=this.inheritDirection,t.inheritedVelocityAmount=this.inheritedVelocityAmount,t.particleSystem=this.particleSystem.serialize(e),t},e._ParseParticleSystem=function(e,t,i,n){throw void 0===n&&(n=!1),pe(\"ParseParticle\")},e.Parse=function(t,i,n){var r=t.particleSystem,o=new e(e._ParseParticleSystem(r,i,n,!0));return o.type=t.type,o.inheritDirection=t.inheritDirection,o.inheritedVelocityAmount=t.inheritedVelocityAmount,o.particleSystem._isSubEmitter=!0,o},e.prototype.dispose=function(){this.particleSystem.dispose()},e}();It.ShadersStore.particlesPixelShader=\"#ifdef LOGARITHMICDEPTH\\n#extension GL_EXT_frag_depth : enable\\n#endif\\nvarying vec2 vUV;\\nvarying vec4 vColor;\\nuniform vec4 textureMask;\\nuniform sampler2D diffuseSampler;\\n#include\\n#include\\n#include\\n#include\\n#include\\n#ifdef RAMPGRADIENT\\nvarying vec4 remapRanges;\\nuniform sampler2D rampSampler;\\n#endif\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void) {\\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\\n#include\\nvec4 textureColor=texture2D(diffuseSampler,vUV);\\nvec4 baseColor=(textureColor*textureMask+(vec4(1.,1.,1.,1.)-textureMask))*vColor;\\n#ifdef RAMPGRADIENT\\nfloat alpha=baseColor.a;\\nfloat remappedColorIndex=clamp((alpha-remapRanges.x)/remapRanges.y,0.0,1.0);\\nvec4 rampColor=texture2D(rampSampler,vec2(1.0-remappedColorIndex,0.));\\nbaseColor.rgb*=rampColor.rgb;\\nfloat finalAlpha=baseColor.a;\\nbaseColor.a=clamp((alpha*rampColor.a-remapRanges.z)/remapRanges.w,0.0,1.0);\\n#endif\\n#ifdef BLENDMULTIPLYMODE\\nfloat sourceAlpha=vColor.a*textureColor.a;\\nbaseColor.rgb=baseColor.rgb*sourceAlpha+vec3(1.0)*(1.0-sourceAlpha);\\n#endif\\n#include\\n#ifdef IMAGEPROCESSINGPOSTPROCESS\\nbaseColor.rgb=toLinearSpace(baseColor.rgb);\\n#else\\n#ifdef IMAGEPROCESSING\\nbaseColor.rgb=toLinearSpace(baseColor.rgb);\\nbaseColor=applyImageProcessing(baseColor);\\n#endif\\n#endif\\ngl_FragColor=baseColor;\\n#define CUSTOM_FRAGMENT_MAIN_END\\n}\";It.ShadersStore.particlesVertexShader=\"attribute vec3 position;\\nattribute vec4 color;\\nattribute float angle;\\nattribute vec2 size;\\n#ifdef ANIMATESHEET\\nattribute float cellIndex;\\n#endif\\n#ifndef BILLBOARD\\nattribute vec3 direction;\\n#endif\\n#ifdef BILLBOARDSTRETCHED\\nattribute vec3 direction;\\n#endif\\n#ifdef RAMPGRADIENT\\nattribute vec4 remapData;\\n#endif\\nattribute vec2 offset;\\nuniform mat4 view;\\nuniform mat4 projection;\\nuniform vec2 translationPivot;\\n#ifdef ANIMATESHEET\\nuniform vec3 particlesInfos; \\n#endif\\nvarying vec2 vUV;\\nvarying vec4 vColor;\\nvarying vec3 vPositionW;\\n#ifdef RAMPGRADIENT\\nvarying vec4 remapRanges;\\n#endif\\n#if defined(BILLBOARD) && !defined(BILLBOARDY) && !defined(BILLBOARDSTRETCHED)\\nuniform mat4 invView;\\n#endif\\n#include\\n#include\\n#ifdef BILLBOARD\\nuniform vec3 eyePosition;\\n#endif\\nvec3 rotate(vec3 yaxis,vec3 rotatedCorner) {\\nvec3 xaxis=normalize(cross(vec3(0.,1.0,0.),yaxis));\\nvec3 zaxis=normalize(cross(yaxis,xaxis));\\nvec3 row0=vec3(xaxis.x,xaxis.y,xaxis.z);\\nvec3 row1=vec3(yaxis.x,yaxis.y,yaxis.z);\\nvec3 row2=vec3(zaxis.x,zaxis.y,zaxis.z);\\nmat3 rotMatrix= mat3(row0,row1,row2);\\nvec3 alignedCorner=rotMatrix*rotatedCorner;\\nreturn position+alignedCorner;\\n}\\n#ifdef BILLBOARDSTRETCHED\\nvec3 rotateAlign(vec3 toCamera,vec3 rotatedCorner) {\\nvec3 normalizedToCamera=normalize(toCamera);\\nvec3 normalizedCrossDirToCamera=normalize(cross(normalize(direction),normalizedToCamera));\\nvec3 crossProduct=normalize(cross(normalizedToCamera,normalizedCrossDirToCamera));\\nvec3 row0=vec3(normalizedCrossDirToCamera.x,normalizedCrossDirToCamera.y,normalizedCrossDirToCamera.z);\\nvec3 row1=vec3(crossProduct.x,crossProduct.y,crossProduct.z);\\nvec3 row2=vec3(normalizedToCamera.x,normalizedToCamera.y,normalizedToCamera.z);\\nmat3 rotMatrix= mat3(row0,row1,row2);\\nvec3 alignedCorner=rotMatrix*rotatedCorner;\\nreturn position+alignedCorner;\\n}\\n#endif\\n#define CUSTOM_VERTEX_DEFINITIONS\\nvoid main(void) {\\n#define CUSTOM_VERTEX_MAIN_BEGIN\\nvec2 cornerPos;\\ncornerPos=(vec2(offset.x-0.5,offset.y -0.5)-translationPivot)*size+translationPivot;\\n#ifdef BILLBOARD\\nvec3 rotatedCorner;\\n#ifdef BILLBOARDY\\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\\nrotatedCorner.y=0.;\\nvec3 yaxis=position-eyePosition;\\nyaxis.y=0.;\\nvPositionW=rotate(normalize(yaxis),rotatedCorner);\\nvec3 viewPos=(view*vec4(vPositionW,1.0)).xyz;\\n#elif defined(BILLBOARDSTRETCHED)\\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\\nrotatedCorner.z=0.;\\nvec3 toCamera=position-eyePosition;\\nvPositionW=rotateAlign(toCamera,rotatedCorner);\\nvec3 viewPos=(view*vec4(vPositionW,1.0)).xyz;\\n#else\\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\\nrotatedCorner.z=0.;\\nvec3 viewPos=(view*vec4(position,1.0)).xyz+rotatedCorner;\\nvPositionW=(invView*vec4(viewPos,1)).xyz;\\n#endif\\n#ifdef RAMPGRADIENT\\nremapRanges=remapData;\\n#endif\\ngl_Position=projection*vec4(viewPos,1.0);\\n#else\\nvec3 rotatedCorner;\\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\\nrotatedCorner.y=0.;\\nvec3 yaxis=normalize(direction);\\nvPositionW=rotate(yaxis,rotatedCorner);\\ngl_Position=projection*view*vec4(vPositionW,1.0);\\n#endif\\nvColor=color;\\n#ifdef ANIMATESHEET\\nfloat rowOffset=floor(cellIndex*particlesInfos.z);\\nfloat columnOffset=cellIndex-rowOffset/particlesInfos.z;\\nvec2 uvScale=particlesInfos.xy;\\nvec2 uvOffset=vec2(offset.x ,1.0-offset.y);\\nvUV=(uvOffset+vec2(columnOffset,rowOffset))*uvScale;\\n#else\\nvUV=offset;\\n#endif\\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6)\\nvec4 worldPos=vec4(vPositionW,1.0);\\n#endif\\n#include\\n#include\\n#define CUSTOM_VERTEX_MAIN_END\\n}\";var Ny=function(e){function t(t,i,n,r,o,a){void 0===r&&(r=null),void 0===o&&(o=!1),void 0===a&&(a=.01);var s=e.call(this,t)||this;s._emitterInverseWorldMatrix=M.Identity(),s._inheritedVelocityOffset=new x,s.onDisposeObservable=new u,s.onStoppedObservable=new u,s._particles=new Array,s._stockParticles=new Array,s._newPartsExcess=0,s._vertexBuffers={},s._scaledColorStep=new L(0,0,0,0),s._colorDiff=new L(0,0,0,0),s._scaledDirection=x.Zero(),s._scaledGravity=x.Zero(),s._currentRenderId=-1,s._useInstancing=!1,s._started=!1,s._stopped=!1,s._actualFrame=0,s._currentEmitRate1=0,s._currentEmitRate2=0,s._currentStartSize1=0,s._currentStartSize2=0,s._rawTextureWidth=256,s._useRampGradients=!1,s._disposeEmitterOnDispose=!1,s.isLocal=!1,s._onBeforeDrawParticlesObservable=null,s.recycleParticle=function(e){var t=s._particles.pop();t!==e&&t.copyTo(e),s._stockParticles.push(t)},s._createParticle=function(){var e;if(0!==s._stockParticles.length?(e=s._stockParticles.pop())._reset():e=new Oy(s),s._subEmitters&&s._subEmitters.length>0){var t=s._subEmitters[Math.floor(Math.random()*s._subEmitters.length)];e._attachedSubEmitters=[],t.forEach((function(t){if(t.type===xy.ATTACHED){var i=t.clone();e._attachedSubEmitters.push(i),i.particleSystem.start()}}))}return e},s._emitFromParticle=function(e){if(s._subEmitters&&0!==s._subEmitters.length){var t=Math.floor(Math.random()*s._subEmitters.length);s._subEmitters[t].forEach((function(t){if(t.type===xy.END){var i=t.clone();e._inheritParticleInfoToSubEmitter(i),i.particleSystem._rootParticleSystem=s,s.activeSubSystems.push(i.particleSystem),i.particleSystem.start()}}))}},s._capacity=i,s._epsilon=a,s._isAnimationSheetEnabled=o,n&&\"Scene\"!==n.getClassName()?(s._engine=n,s.defaultProjectionMatrix=M.PerspectiveFovLH(.8,1,.1,100,s._engine.isNDCHalfZRange)):(s._scene=n||S.LastCreatedScene,s._engine=s._scene.getEngine(),s.uniqueId=s._scene.getUniqueId(),s._scene.particleSystems.push(s)),s._engine.getCaps().vertexArrayObject&&(s._vertexArrayObject=null),s._attachImageProcessingConfiguration(null),s._customWrappers={0:new Ht(s._engine)},s._customWrappers[0].effect=r,s._drawWrappers=[],s._useInstancing=s._engine.getCaps().instancedArrays,s._createIndexBuffer(),s._createVertexBuffers(),s.particleEmitterType=new va;var l=null;return s.updateFunction=function(e){var t,i=null;s.noiseTexture&&(i=s.noiseTexture.getSize(),null===(t=s.noiseTexture.getContent())||void 0===t||t.then((function(e){l=e})));for(var n,r=function(t){var r=e[t],o=s._scaledUpdateSpeed,a=r.age;if(r.age+=o,r.age>r.lifeTime){var c=r.age-a;o=(r.lifeTime-a)*o/c,r.age=r.lifeTime}var u=r.age/r.lifeTime;s._colorGradients&&s._colorGradients.length>0?Iy.GetCurrentGradient(u,s._colorGradients,(function(e,t,i){e!==r._currentColorGradient&&(r._currentColor1.copyFrom(r._currentColor2),t.getColorToRef(r._currentColor2),r._currentColorGradient=e),L.LerpToRef(r._currentColor1,r._currentColor2,i,r.color)})):(r.colorStep.scaleToRef(o,s._scaledColorStep),r.color.addInPlace(s._scaledColorStep),r.color.a<0&&(r.color.a=0)),s._angularSpeedGradients&&s._angularSpeedGradients.length>0&&Iy.GetCurrentGradient(u,s._angularSpeedGradients,(function(e,t,i){e!==r._currentAngularSpeedGradient&&(r._currentAngularSpeed1=r._currentAngularSpeed2,r._currentAngularSpeed2=t.getFactor(),r._currentAngularSpeedGradient=e),r.angularSpeed=h.Lerp(r._currentAngularSpeed1,r._currentAngularSpeed2,i)})),r.angle+=r.angularSpeed*o;var d=o;if(s._velocityGradients&&s._velocityGradients.length>0&&Iy.GetCurrentGradient(u,s._velocityGradients,(function(e,t,i){e!==r._currentVelocityGradient&&(r._currentVelocity1=r._currentVelocity2,r._currentVelocity2=t.getFactor(),r._currentVelocityGradient=e),d*=h.Lerp(r._currentVelocity1,r._currentVelocity2,i)})),r.direction.scaleToRef(d,s._scaledDirection),s._limitVelocityGradients&&s._limitVelocityGradients.length>0&&Iy.GetCurrentGradient(u,s._limitVelocityGradients,(function(e,t,i){e!==r._currentLimitVelocityGradient&&(r._currentLimitVelocity1=r._currentLimitVelocity2,r._currentLimitVelocity2=t.getFactor(),r._currentLimitVelocityGradient=e);var n=h.Lerp(r._currentLimitVelocity1,r._currentLimitVelocity2,i);r.direction.length()>n&&r.direction.scaleInPlace(s.limitVelocityDamping)})),s._dragGradients&&s._dragGradients.length>0&&Iy.GetCurrentGradient(u,s._dragGradients,(function(e,t,i){e!==r._currentDragGradient&&(r._currentDrag1=r._currentDrag2,r._currentDrag2=t.getFactor(),r._currentDragGradient=e);var n=h.Lerp(r._currentDrag1,r._currentDrag2,i);s._scaledDirection.scaleInPlace(1-n)})),s.isLocal&&r._localPosition?(r._localPosition.addInPlace(s._scaledDirection),x.TransformCoordinatesToRef(r._localPosition,s._emitterWorldMatrix,r.position)):r.position.addInPlace(s._scaledDirection),l&&i&&r._randomNoiseCoordinates1){var p=s._fetchR(r._randomNoiseCoordinates1.x,r._randomNoiseCoordinates1.y,i.width,i.height,l),f=s._fetchR(r._randomNoiseCoordinates1.z,r._randomNoiseCoordinates2.x,i.width,i.height,l),_=s._fetchR(r._randomNoiseCoordinates2.y,r._randomNoiseCoordinates2.z,i.width,i.height,l),m=O.Vector3[0],g=O.Vector3[1];m.copyFromFloats((2*p-1)*s.noiseStrength.x,(2*f-1)*s.noiseStrength.y,(2*_-1)*s.noiseStrength.z),m.scaleToRef(o,g),r.direction.addInPlace(g)}if(s.gravity.scaleToRef(o,s._scaledGravity),r.direction.addInPlace(s._scaledGravity),s._sizeGradients&&s._sizeGradients.length>0&&Iy.GetCurrentGradient(u,s._sizeGradients,(function(e,t,i){e!==r._currentSizeGradient&&(r._currentSize1=r._currentSize2,r._currentSize2=t.getFactor(),r._currentSizeGradient=e),r.size=h.Lerp(r._currentSize1,r._currentSize2,i)})),s._useRampGradients&&(s._colorRemapGradients&&s._colorRemapGradients.length>0&&Iy.GetCurrentGradient(u,s._colorRemapGradients,(function(e,t,i){var n=h.Lerp(e.factor1,t.factor1,i),o=h.Lerp(e.factor2,t.factor2,i);r.remapData.x=n,r.remapData.y=o-n})),s._alphaRemapGradients&&s._alphaRemapGradients.length>0&&Iy.GetCurrentGradient(u,s._alphaRemapGradients,(function(e,t,i){var n=h.Lerp(e.factor1,t.factor1,i),o=h.Lerp(e.factor2,t.factor2,i);r.remapData.z=n,r.remapData.w=o-n}))),s._isAnimationSheetEnabled&&r.updateCellIndex(),r._inheritParticleInfoToSubEmitters(),r.age>=r.lifeTime)return s._emitFromParticle(r),r._attachedSubEmitters&&(r._attachedSubEmitters.forEach((function(e){e.particleSystem.disposeOnStop=!0,e.particleSystem.stop()})),r._attachedSubEmitters=null),s.recycleParticle(r),t--,n=t,\"continue\";n=t},o=0;ot.gradient?1:0}))},t.prototype._removeFactorGradient=function(e,t){if(e)for(var i=0,n=0,r=e;nt.gradient?1:0})),this._rampGradientsTexture&&(this._rampGradientsTexture.dispose(),this._rampGradientsTexture=null),this._createRampGradientTexture())},t.prototype.addRampGradient=function(e,t){this._rampGradients||(this._rampGradients=[]);var i=new Py(e,t);return this._rampGradients.push(i),this._syncRampGradientTexture(),this},t.prototype.removeRampGradient=function(e){return this._removeGradientAndTexture(e,this._rampGradients,this._rampGradientsTexture),this._rampGradientsTexture=null,this._rampGradients&&this._rampGradients.length>0&&this._createRampGradientTexture(),this},t.prototype.addColorGradient=function(e,t,i){this._colorGradients||(this._colorGradients=[]);var n=new Cy(e,t,i);return this._colorGradients.push(n),this._colorGradients.sort((function(e,t){return e.gradientt.gradient?1:0})),this},t.prototype.removeColorGradient=function(e){if(!this._colorGradients)return this;for(var t=0,i=0,n=this._colorGradients;i0&&(this._currentEmitRateGradient=this._emitRateGradients[0],this._currentEmitRate1=this._currentEmitRateGradient.getFactor(),this._currentEmitRate2=this._currentEmitRate1),this._emitRateGradients.length>1&&(this._currentEmitRate2=this._emitRateGradients[1].getFactor())),this._startSizeGradients&&(this._startSizeGradients.length>0&&(this._currentStartSizeGradient=this._startSizeGradients[0],this._currentStartSize1=this._currentStartSizeGradient.getFactor(),this._currentStartSize2=this._currentStartSize1),this._startSizeGradients.length>1&&(this._currentStartSize2=this._startSizeGradients[1].getFactor())),this.preWarmCycles){-1!==(null===(t=this.emitter)||void 0===t?void 0:t.getClassName().indexOf(\"Mesh\"))&&this.emitter.computeWorldMatrix(!0);var n=this.noiseTexture;if(n&&n.onGeneratedObservable)n.onGeneratedObservable.addOnce((function(){setTimeout((function(){for(var e=0;e0&&this._scene&&this._scene.beginAnimation(this,this.beginAnimationFrom,this.beginAnimationTo,this.beginAnimationLoop)}},t.prototype.stop=function(e){void 0===e&&(e=!0),this._stopped||(this.onStoppedObservable.notifyObservers(this),this._stopped=!0,e&&this._stopSubEmitters())},t.prototype.reset=function(){this._stockParticles.length=0,this._particles.length=0},t.prototype._appendParticleVertex=function(e,i,n,r){var o=e*this._vertexBufferSize;if(this._vertexData[o++]=i.position.x+this.worldOffset.x,this._vertexData[o++]=i.position.y+this.worldOffset.y,this._vertexData[o++]=i.position.z+this.worldOffset.z,this._vertexData[o++]=i.color.r,this._vertexData[o++]=i.color.g,this._vertexData[o++]=i.color.b,this._vertexData[o++]=i.color.a,this._vertexData[o++]=i.angle,this._vertexData[o++]=i.scale.x*i.size,this._vertexData[o++]=i.scale.y*i.size,this._isAnimationSheetEnabled&&(this._vertexData[o++]=i.cellIndex),this._isBillboardBased)this.billboardMode===t.BILLBOARDMODE_STRETCHED&&(this._vertexData[o++]=i.direction.x,this._vertexData[o++]=i.direction.y,this._vertexData[o++]=i.direction.z);else if(i._initialDirection){var a=i._initialDirection;this.isLocal&&(x.TransformNormalToRef(a,this._emitterWorldMatrix,O.Vector3[0]),a=O.Vector3[0]),0===a.x&&0===a.z&&(a.x=.001),this._vertexData[o++]=a.x,this._vertexData[o++]=a.y,this._vertexData[o++]=a.z}else{var s=i.direction;this.isLocal&&(x.TransformNormalToRef(s,this._emitterWorldMatrix,O.Vector3[0]),s=O.Vector3[0]),0===s.x&&0===s.z&&(s.x=.001),this._vertexData[o++]=s.x,this._vertexData[o++]=s.y,this._vertexData[o++]=s.z}this._useRampGradients&&i.remapData&&(this._vertexData[o++]=i.remapData.x,this._vertexData[o++]=i.remapData.y,this._vertexData[o++]=i.remapData.z,this._vertexData[o++]=i.remapData.w),this._useInstancing||(this._isAnimationSheetEnabled&&(0===n?n=this._epsilon:1===n&&(n=1-this._epsilon),0===r?r=this._epsilon:1===r&&(r=1-this._epsilon)),this._vertexData[o++]=n,this._vertexData[o++]=r)},t.prototype._stopSubEmitters=function(){this.activeSubSystems&&(this.activeSubSystems.forEach((function(e){e.stop(!0)})),this.activeSubSystems=new Array)},t.prototype._removeFromRoot=function(){if(this._rootParticleSystem){var e=this._rootParticleSystem.activeSubSystems.indexOf(this);-1!==e&&this._rootParticleSystem.activeSubSystems.splice(e,1),this._rootParticleSystem=null}},t.prototype._update=function(e){var t,i=this;if(this._alive=this._particles.length>0,this.emitter.position){var n=this.emitter;this._emitterWorldMatrix=n.getWorldMatrix()}else{var r=this.emitter;this._emitterWorldMatrix=M.Translation(r.x,r.y,r.z)}this._emitterWorldMatrix.invertToRef(this._emitterInverseWorldMatrix),this.updateFunction(this._particles);for(var o=function(e){if(a._particles.length===a._capacity)return\"break\";if(t=a._createParticle(),a._particles.push(t),a.targetStopDuration&&a._lifeTimeGradients&&a._lifeTimeGradients.length>0){var n=h.Clamp(a._actualFrame/a.targetStopDuration);Iy.GetCurrentGradient(n,a._lifeTimeGradients,(function(e,i){var r=e,o=i,a=r.getFactor(),s=o.getFactor(),l=(n-r.gradient)/(o.gradient-r.gradient);t.lifeTime=h.Lerp(a,s,l)}))}else t.lifeTime=h.RandomRange(a.minLifeTime,a.maxLifeTime);var r=h.RandomRange(a.minEmitPower,a.maxEmitPower);if(a.startPositionFunction?a.startPositionFunction(a._emitterWorldMatrix,t.position,t,a.isLocal):a.particleEmitterType.startPositionFunction(a._emitterWorldMatrix,t.position,t,a.isLocal),a.isLocal&&(t._localPosition?t._localPosition.copyFrom(t.position):t._localPosition=t.position.clone(),x.TransformCoordinatesToRef(t._localPosition,a._emitterWorldMatrix,t.position)),a.startDirectionFunction?a.startDirectionFunction(a._emitterWorldMatrix,t.direction,t,a.isLocal):a.particleEmitterType.startDirectionFunction(a._emitterWorldMatrix,t.direction,t,a.isLocal,a._emitterInverseWorldMatrix),0===r?t._initialDirection?t._initialDirection.copyFrom(t.direction):t._initialDirection=t.direction.clone():t._initialDirection=null,t.direction.scaleInPlace(r),a._sizeGradients&&0!==a._sizeGradients.length?(t._currentSizeGradient=a._sizeGradients[0],t._currentSize1=t._currentSizeGradient.getFactor(),t.size=t._currentSize1,a._sizeGradients.length>1?t._currentSize2=a._sizeGradients[1].getFactor():t._currentSize2=t._currentSize1):t.size=h.RandomRange(a.minSize,a.maxSize),t.scale.copyFromFloats(h.RandomRange(a.minScaleX,a.maxScaleX),h.RandomRange(a.minScaleY,a.maxScaleY)),a._startSizeGradients&&a._startSizeGradients[0]&&a.targetStopDuration){var o=a._actualFrame/a.targetStopDuration;Iy.GetCurrentGradient(o,a._startSizeGradients,(function(e,n,r){e!==i._currentStartSizeGradient&&(i._currentStartSize1=i._currentStartSize2,i._currentStartSize2=n.getFactor(),i._currentStartSizeGradient=e);var o=h.Lerp(i._currentStartSize1,i._currentStartSize2,r);t.scale.scaleInPlace(o)}))}if(a._angularSpeedGradients&&0!==a._angularSpeedGradients.length?(t._currentAngularSpeedGradient=a._angularSpeedGradients[0],t.angularSpeed=t._currentAngularSpeedGradient.getFactor(),t._currentAngularSpeed1=t.angularSpeed,a._angularSpeedGradients.length>1?t._currentAngularSpeed2=a._angularSpeedGradients[1].getFactor():t._currentAngularSpeed2=t._currentAngularSpeed1):t.angularSpeed=h.RandomRange(a.minAngularSpeed,a.maxAngularSpeed),t.angle=h.RandomRange(a.minInitialRotation,a.maxInitialRotation),a._velocityGradients&&a._velocityGradients.length>0&&(t._currentVelocityGradient=a._velocityGradients[0],t._currentVelocity1=t._currentVelocityGradient.getFactor(),a._velocityGradients.length>1?t._currentVelocity2=a._velocityGradients[1].getFactor():t._currentVelocity2=t._currentVelocity1),a._limitVelocityGradients&&a._limitVelocityGradients.length>0&&(t._currentLimitVelocityGradient=a._limitVelocityGradients[0],t._currentLimitVelocity1=t._currentLimitVelocityGradient.getFactor(),a._limitVelocityGradients.length>1?t._currentLimitVelocity2=a._limitVelocityGradients[1].getFactor():t._currentLimitVelocity2=t._currentLimitVelocity1),a._dragGradients&&a._dragGradients.length>0&&(t._currentDragGradient=a._dragGradients[0],t._currentDrag1=t._currentDragGradient.getFactor(),a._dragGradients.length>1?t._currentDrag2=a._dragGradients[1].getFactor():t._currentDrag2=t._currentDrag1),a._colorGradients&&0!==a._colorGradients.length)t._currentColorGradient=a._colorGradients[0],t._currentColorGradient.getColorToRef(t.color),t._currentColor1.copyFrom(t.color),a._colorGradients.length>1?a._colorGradients[1].getColorToRef(t._currentColor2):t._currentColor2.copyFrom(t.color);else{var s=h.RandomRange(0,1);L.LerpToRef(a.color1,a.color2,s,t.color),a.colorDead.subtractToRef(t.color,a._colorDiff),a._colorDiff.scaleToRef(1/t.lifeTime,t.colorStep)}a._isAnimationSheetEnabled&&(t._initialStartSpriteCellID=a.startSpriteCellID,t._initialEndSpriteCellID=a.endSpriteCellID,t._initialSpriteCellLoop=a.spriteCellLoop),t.direction.addInPlace(a._inheritedVelocityOffset),a._useRampGradients&&(t.remapData=new C(0,1,0,1)),a.noiseTexture&&(t._randomNoiseCoordinates1?(t._randomNoiseCoordinates1.copyFromFloats(Math.random(),Math.random(),Math.random()),t._randomNoiseCoordinates2.copyFromFloats(Math.random(),Math.random(),Math.random())):(t._randomNoiseCoordinates1=new x(Math.random(),Math.random(),Math.random()),t._randomNoiseCoordinates2=new x(Math.random(),Math.random(),Math.random()))),t._inheritParticleInfoToSubEmitters()},a=this,s=0;s-1)n=this.manualEmitCount,this._newPartsExcess=0,this.manualEmitCount=0;else{var r=this.emitRate;if(this._emitRateGradients&&this._emitRateGradients.length>0&&this.targetStopDuration){var o=this._actualFrame/this.targetStopDuration;Iy.GetCurrentGradient(o,this._emitRateGradients,(function(e,t,n){e!==i._currentEmitRateGradient&&(i._currentEmitRate1=i._currentEmitRate2,i._currentEmitRate2=t.getFactor(),i._currentEmitRateGradient=e),r=h.Lerp(i._currentEmitRate1,i._currentEmitRate2,n)}))}n=r*this._scaledUpdateSpeed>>0,this._newPartsExcess+=r*this._scaledUpdateSpeed-n}if(this._newPartsExcess>1&&(n+=this._newPartsExcess>>0,this._newPartsExcess-=this._newPartsExcess>>0),this._alive=!1,this._stopped?n=0:(this._actualFrame+=this._scaledUpdateSpeed,this.targetStopDuration&&this._actualFrame>=this.targetStopDuration&&this.stop()),this._update(n),this._stopped&&(this._alive||(this._started=!1,this.onAnimationEnd&&this.onAnimationEnd(),this.disposeOnStop&&this._scene&&this._scene._toBeDisposed.push(this))),!e){for(var a=0,s=0;s=0&&(l.invertToRef(O.Matrix[0]),o.setMatrix(\"invView\",O.Matrix[0])),void 0!==this._vertexArrayObject?(this._vertexArrayObject||(this._vertexArrayObject=this._engine.recordVertexArrayObject(this._vertexBuffers,this._indexBuffer,o)),this._engine.bindVertexArrayObject(this._vertexArrayObject,this._indexBuffer)):s.bindBuffers(this._vertexBuffers,this._indexBuffer,o),this.useLogarithmicDepth&&this._scene&&Pr.BindLogDepth(h,o,this._scene),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(o),e){case t.BLENDMODE_ADD:s.setAlphaMode(a.ALPHA_ADD);break;case t.BLENDMODE_ONEONE:s.setAlphaMode(a.ALPHA_ONEONE);break;case t.BLENDMODE_STANDARD:s.setAlphaMode(a.ALPHA_COMBINE);break;case t.BLENDMODE_MULTIPLY:s.setAlphaMode(a.ALPHA_MULTIPLY)}return this._onBeforeDrawParticlesObservable&&this._onBeforeDrawParticlesObservable.notifyObservers(o),this._useInstancing?s.drawArraysType(a.MATERIAL_TriangleStripDrawMode,0,4,this._particles.length):s.drawElementsType(a.MATERIAL_TriangleFillMode,0,6*this._particles.length),this._particles.length},t.prototype.render=function(){if(!this.isReady()||!this._particles.length)return 0;var e=this._engine;e.setState&&(e.setState(!1),this.forceDepthWrite&&e.setDepthWrite(!0));var i;return i=this.blendMode===t.BLENDMODE_MULTIPLYADD?this._render(t.BLENDMODE_MULTIPLY)+this._render(t.BLENDMODE_ADD):this._render(this.blendMode),this._engine.unbindInstanceAttributes(),this._engine.setAlphaMode(a.ALPHA_DISABLE),i},t.prototype.dispose=function(e){if(void 0===e&&(e=!0),this.resetDrawCache(),this._vertexBuffer&&(this._vertexBuffer.dispose(),this._vertexBuffer=null),this._spriteBuffer&&(this._spriteBuffer.dispose(),this._spriteBuffer=null),this._indexBuffer&&(this._engine._releaseBuffer(this._indexBuffer),this._indexBuffer=null),this._vertexArrayObject&&(this._engine.releaseVertexArrayObject(this._vertexArrayObject),this._vertexArrayObject=null),e&&this.particleTexture&&(this.particleTexture.dispose(),this.particleTexture=null),e&&this.noiseTexture&&(this.noiseTexture.dispose(),this.noiseTexture=null),this._rampGradientsTexture&&(this._rampGradientsTexture.dispose(),this._rampGradientsTexture=null),this._removeFromRoot(),this.subEmitters&&!this._subEmitters&&this._prepareSubEmitterInternalArray(),this._subEmitters&&this._subEmitters.length){for(var t=0;t-1&&this._scene.particleSystems.splice(t,1),this._scene._activeParticleSystems.dispose()),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.onStoppedObservable.clear(),this.reset()},t.prototype.clone=function(e,i){var n=k({},this._customWrappers),r=null,o=this._engine;if(o.createEffectForParticles&&null!=this.customShader){var a=(r=this.customShader).shaderOptions.defines.length>0?r.shaderOptions.defines.join(\"\\n\"):\"\",s=o.createEffectForParticles(r.shaderPath.fragmentElement,r.shaderOptions.uniforms,r.shaderOptions.samplers,a);n[0]?n[0].effect=s:this.setCustomEffect(s,0)}var l=this.serialize(),c=t.Parse(l,this._scene||this._engine,this._rootUrl);return c.name=e,c.customShader=r,c._customWrappers=n,void 0===i&&(i=this.emitter),this.noiseTexture&&(c.noiseTexture=this.noiseTexture.clone()),c.emitter=i,this.preventAutoStart||c.start(),c},t.prototype.serialize=function(e){void 0===e&&(e=!1);var i={};if(t._Serialize(i,this,e),i.textureMask=this.textureMask.asArray(),i.customShader=this.customShader,i.preventAutoStart=this.preventAutoStart,this.subEmitters){i.subEmitters=[],this._subEmitters||this._prepareSubEmitterInternalArray();for(var n=0,r=this._subEmitters;n0?c.shaderOptions.defines.join(\"\\n\"):\"\";l=a.createEffectForParticles(c.shaderPath.fragmentElement,c.shaderOptions.uniforms,c.shaderOptions.samplers,u)}var h=new t(s,o||e.capacity,i,l,e.isAnimationSheetEnabled);if(h.customShader=c,h._rootUrl=n,e.id&&(h.id=e.id),e.subEmitters){h.subEmitters=[];for(var d=0,p=e.subEmitters;d \\n#include\\n#include\\n#include\\n#include\\nvoid main() {\\n#include \\nvec4 textureColor=texture2D(diffuseSampler,vUV);\\ngl_FragColor=textureColor*vColor;\\n#ifdef BLENDMULTIPLYMODE\\nfloat alpha=vColor.a*textureColor.a;\\ngl_FragColor.rgb=gl_FragColor.rgb*alpha+vec3(1.0)*(1.0-alpha);\\n#endif \\n#include\\n#ifdef IMAGEPROCESSINGPOSTPROCESS\\ngl_FragColor.rgb=toLinearSpace(gl_FragColor.rgb);\\n#else\\n#ifdef IMAGEPROCESSING\\ngl_FragColor.rgb=toLinearSpace(gl_FragColor.rgb);\\ngl_FragColor=applyImageProcessing(gl_FragColor);\\n#endif\\n#endif\\n}\\n\";It.IncludesShadersStore.clipPlaneVertexDeclaration2=\"#ifdef CLIPPLANE\\nuniform vec4 vClipPlane;\\nout float fClipDistance;\\n#endif\\n#ifdef CLIPPLANE2\\nuniform vec4 vClipPlane2;\\nout float fClipDistance2;\\n#endif\\n#ifdef CLIPPLANE3\\nuniform vec4 vClipPlane3;\\nout float fClipDistance3;\\n#endif\\n#ifdef CLIPPLANE4\\nuniform vec4 vClipPlane4;\\nout float fClipDistance4;\\n#endif\\n#ifdef CLIPPLANE5\\nuniform vec4 vClipPlane5;\\nout float fClipDistance5;\\n#endif\\n#ifdef CLIPPLANE6\\nuniform vec4 vClipPlane6;\\nout float fClipDistance6;\\n#endif\\n\";It.ShadersStore.gpuRenderParticlesVertexShader=\"precision highp float;\\nuniform mat4 view;\\nuniform mat4 projection;\\nuniform vec2 translationPivot;\\nuniform vec3 worldOffset;\\n#ifdef LOCAL\\nuniform mat4 emitterWM;\\n#endif\\nattribute vec3 position;\\nattribute float age;\\nattribute float life;\\nattribute vec3 size;\\n#ifndef BILLBOARD\\nattribute vec3 initialDirection;\\n#endif\\n#ifdef BILLBOARDSTRETCHED\\nattribute vec3 direction;\\n#endif\\nattribute float angle;\\n#ifdef ANIMATESHEET\\nattribute float cellIndex;\\n#endif\\nattribute vec2 offset;\\nattribute vec2 uv;\\nvarying vec2 vUV;\\nvarying vec4 vColor;\\nvarying vec3 vPositionW;\\n#if defined(BILLBOARD) && !defined(BILLBOARDY) && !defined(BILLBOARDSTRETCHED)\\nuniform mat4 invView;\\n#endif\\n#include\\n#include\\n#ifdef COLORGRADIENTS\\nuniform sampler2D colorGradientSampler;\\n#else\\nuniform vec4 colorDead;\\nattribute vec4 color;\\n#endif\\n#ifdef ANIMATESHEET\\nuniform vec3 sheetInfos;\\n#endif\\n#ifdef BILLBOARD\\nuniform vec3 eyePosition;\\n#endif\\nvec3 rotate(vec3 yaxis,vec3 rotatedCorner) {\\nvec3 xaxis=normalize(cross(vec3(0.,1.0,0.),yaxis));\\nvec3 zaxis=normalize(cross(yaxis,xaxis));\\nvec3 row0=vec3(xaxis.x,xaxis.y,xaxis.z);\\nvec3 row1=vec3(yaxis.x,yaxis.y,yaxis.z);\\nvec3 row2=vec3(zaxis.x,zaxis.y,zaxis.z);\\nmat3 rotMatrix= mat3(row0,row1,row2);\\nvec3 alignedCorner=rotMatrix*rotatedCorner;\\n#ifdef LOCAL\\nreturn ((emitterWM*vec4(position,1.0)).xyz+worldOffset)+alignedCorner;\\n#else\\nreturn (position+worldOffset)+alignedCorner;\\n#endif\\n}\\n#ifdef BILLBOARDSTRETCHED\\nvec3 rotateAlign(vec3 toCamera,vec3 rotatedCorner) {\\nvec3 normalizedToCamera=normalize(toCamera);\\nvec3 normalizedCrossDirToCamera=normalize(cross(normalize(direction),normalizedToCamera));\\nvec3 crossProduct=normalize(cross(normalizedToCamera,normalizedCrossDirToCamera));\\nvec3 row0=vec3(normalizedCrossDirToCamera.x,normalizedCrossDirToCamera.y,normalizedCrossDirToCamera.z);\\nvec3 row1=vec3(crossProduct.x,crossProduct.y,crossProduct.z);\\nvec3 row2=vec3(normalizedToCamera.x,normalizedToCamera.y,normalizedToCamera.z);\\nmat3 rotMatrix= mat3(row0,row1,row2);\\nvec3 alignedCorner=rotMatrix*rotatedCorner;\\n#ifdef LOCAL\\nreturn ((emitterWM*vec4(position,1.0)).xyz+worldOffset)+alignedCorner;\\n#else\\nreturn (position+worldOffset)+alignedCorner;\\n#endif\\n}\\n#endif\\nvoid main() {\\n#ifdef ANIMATESHEET\\nfloat rowOffset=floor(cellIndex/sheetInfos.z);\\nfloat columnOffset=cellIndex-rowOffset*sheetInfos.z;\\nvec2 uvScale=sheetInfos.xy;\\nvec2 uvOffset=vec2(uv.x ,1.0-uv.y);\\nvUV=(uvOffset+vec2(columnOffset,rowOffset))*uvScale;\\n#else\\nvUV=uv;\\n#endif\\nfloat ratio=age/life;\\n#ifdef COLORGRADIENTS\\nvColor=texture2D(colorGradientSampler,vec2(ratio,0));\\n#else\\nvColor=color*vec4(1.0-ratio)+colorDead*vec4(ratio);\\n#endif\\nvec2 cornerPos=(offset-translationPivot)*size.yz*size.x+translationPivot;\\n#ifdef BILLBOARD\\nvec4 rotatedCorner;\\nrotatedCorner.w=0.;\\n#ifdef BILLBOARDY\\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\\nrotatedCorner.y=0.;\\nvec3 yaxis=(position+worldOffset)-eyePosition;\\nyaxis.y=0.;\\nvPositionW=rotate(normalize(yaxis),rotatedCorner.xyz);\\nvec4 viewPosition=(view*vec4(vPositionW,1.0));\\n#elif defined(BILLBOARDSTRETCHED)\\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\\nrotatedCorner.z=0.;\\nvec3 toCamera=(position+worldOffset)-eyePosition;\\nvPositionW=rotateAlign(toCamera,rotatedCorner.xyz);\\nvec4 viewPosition=(view*vec4(vPositionW,1.0));\\n#else\\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\\nrotatedCorner.z=0.;\\n#ifdef LOCAL\\nvec4 viewPosition=view*vec4(((emitterWM*vec4(position,1.0)).xyz+worldOffset),1.0)+rotatedCorner;\\n#else\\nvec4 viewPosition=view*vec4((position+worldOffset),1.0)+rotatedCorner;\\n#endif\\nvPositionW=(invView*viewPosition).xyz;\\n#endif\\n#else\\nvec3 rotatedCorner;\\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\\nrotatedCorner.y=0.;\\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\\nvec3 yaxis=normalize(initialDirection);\\nvPositionW=rotate(yaxis,rotatedCorner);\\nvec4 viewPosition=view*vec4(vPositionW,1.0);\\n#endif\\ngl_Position=projection*viewPosition;\\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6)\\nvec4 worldPos=vec4(vPositionW,1.0);\\n#endif\\n#include\\n#include\\n}\";var Ly=function(e){function t(t,i,n,r,o){void 0===r&&(r=null),void 0===o&&(o=!1);var s=e.call(this,t)||this;if(s.layerMask=268435455,s._accumulatedCount=0,s._targetIndex=0,s._currentRenderId=-1,s._currentRenderingCameraUniqueId=-1,s._started=!1,s._stopped=!1,s._timeDelta=0,s._actualFrame=0,s._rawTextureWidth=256,s.onDisposeObservable=new u,s.onStoppedObservable=new u,s.forceDepthWrite=!1,s._preWarmDone=!1,s.isLocal=!1,s._onBeforeDrawParticlesObservable=null,n&&\"Scene\"!==n.getClassName()?(s._engine=n,s.defaultProjectionMatrix=M.PerspectiveFovLH(.8,1,.1,100,s._engine.isNDCHalfZRange)):(s._scene=n||S.LastCreatedScene,s._engine=s._scene.getEngine(),s.uniqueId=s._scene.getUniqueId(),s._scene.particleSystems.push(s)),s._engine.getCaps().supportComputeShaders){if(!T(\"BABYLON.ComputeShaderParticleSystem\"))throw new Error(\"The ComputeShaderParticleSystem class is not available! Make sure you have imported it.\");s._platform=new(T(\"BABYLON.ComputeShaderParticleSystem\"))(s,s._engine)}else{if(!T(\"BABYLON.WebGL2ParticleSystem\"))throw new Error(\"The WebGL2ParticleSystem class is not available! Make sure you have imported it.\");s._platform=new(T(\"BABYLON.WebGL2ParticleSystem\"))(s,s._engine)}s._customWrappers={0:new Ht(s._engine)},s._customWrappers[0].effect=r,s._drawWrappers={0:new Ht(s._engine)},s._drawWrappers[0].drawContext&&(s._drawWrappers[0].drawContext.useInstancing=!0),s._attachImageProcessingConfiguration(null),(i=null!=i?i:{}).randomTextureSize||delete i.randomTextureSize;var l=k({capacity:5e4,randomTextureSize:s._engine.getCaps().maxTextureSize},i),c=i;isFinite(c)&&(l.capacity=c),s._capacity=l.capacity,s._activeCount=l.capacity,s._currentActiveCount=0,s._isAnimationSheetEnabled=o,s.particleEmitterType=new va;for(var h=Math.min(s._engine.getCaps().maxTextureSize,l.randomTextureSize),d=[],p=0;p0&&this._scene&&this._scene.beginAnimation(this,this.beginAnimationFrom,this.beginAnimationTo,this.beginAnimationLoop))},t.prototype.stop=function(){this._stopped||(this._stopped=!0)},t.prototype.reset=function(){this._releaseBuffers(),this._platform.releaseVertexBuffers(),this._currentActiveCount=0,this._targetIndex=0},t.prototype.getClassName=function(){return\"GPUParticleSystem\"},t.prototype.getCustomEffect=function(e){var t,i;return void 0===e&&(e=0),null!==(i=null===(t=this._customWrappers[e])||void 0===t?void 0:t.effect)&&void 0!==i?i:this._customWrappers[0].effect},t.prototype._getCustomDrawWrapper=function(e){var t;return void 0===e&&(e=0),null!==(t=this._customWrappers[e])&&void 0!==t?t:this._customWrappers[0]},t.prototype.setCustomEffect=function(e,t){void 0===t&&(t=0),this._customWrappers[t]=new Ht(this._engine),this._customWrappers[t].effect=e},Object.defineProperty(t.prototype,\"onBeforeDrawParticlesObservable\",{get:function(){return this._onBeforeDrawParticlesObservable||(this._onBeforeDrawParticlesObservable=new u),this._onBeforeDrawParticlesObservable},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"vertexShaderName\",{get:function(){return\"gpuRenderParticles\"},enumerable:!1,configurable:!0}),t.prototype._removeGradientAndTexture=function(t,i,n){return e.prototype._removeGradientAndTexture.call(this,t,i,n),this._releaseBuffers(),this},t.prototype.addColorGradient=function(e,t){this._colorGradients||(this._colorGradients=[]);var i=new Cy(e,t);return this._colorGradients.push(i),this._refreshColorGradient(!0),this._releaseBuffers(),this},t.prototype._refreshColorGradient=function(e){void 0===e&&(e=!1),this._colorGradients&&(e&&this._colorGradients.sort((function(e,t){return e.gradientt.gradient?1:0})),this._colorGradientsTexture&&(this._colorGradientsTexture.dispose(),this._colorGradientsTexture=null))},t.prototype.forceRefreshGradients=function(){this._refreshColorGradient(),this._refreshFactorGradient(this._sizeGradients,\"_sizeGradientsTexture\"),this._refreshFactorGradient(this._angularSpeedGradients,\"_angularSpeedGradientsTexture\"),this._refreshFactorGradient(this._velocityGradients,\"_velocityGradientsTexture\"),this._refreshFactorGradient(this._limitVelocityGradients,\"_limitVelocityGradientsTexture\"),this._refreshFactorGradient(this._dragGradients,\"_dragGradientsTexture\"),this.reset()},t.prototype.removeColorGradient=function(e){return this._removeGradientAndTexture(e,this._colorGradients,this._colorGradientsTexture),this._colorGradientsTexture=null,this},t.prototype.resetDrawCache=function(){var e;for(var t in this._drawWrappers)null===(e=this._drawWrappers[t].drawContext)||void 0===e||e.reset()},t.prototype._addFactorGradient=function(e,t,i){var n=new My(t,i);e.push(n),this._releaseBuffers()},t.prototype.addSizeGradient=function(e,t){return this._sizeGradients||(this._sizeGradients=[]),this._addFactorGradient(this._sizeGradients,e,t),this._refreshFactorGradient(this._sizeGradients,\"_sizeGradientsTexture\",!0),this._releaseBuffers(),this},t.prototype.removeSizeGradient=function(e){return this._removeGradientAndTexture(e,this._sizeGradients,this._sizeGradientsTexture),this._sizeGradientsTexture=null,this},t.prototype._refreshFactorGradient=function(e,t,i){if(void 0===i&&(i=!1),e){i&&e.sort((function(e,t){return e.gradientt.gradient?1:0}));var n=this;n[t]&&(n[t].dispose(),n[t]=null)}},t.prototype.addAngularSpeedGradient=function(e,t){return this._angularSpeedGradients||(this._angularSpeedGradients=[]),this._addFactorGradient(this._angularSpeedGradients,e,t),this._refreshFactorGradient(this._angularSpeedGradients,\"_angularSpeedGradientsTexture\",!0),this._releaseBuffers(),this},t.prototype.removeAngularSpeedGradient=function(e){return this._removeGradientAndTexture(e,this._angularSpeedGradients,this._angularSpeedGradientsTexture),this._angularSpeedGradientsTexture=null,this},t.prototype.addVelocityGradient=function(e,t){return this._velocityGradients||(this._velocityGradients=[]),this._addFactorGradient(this._velocityGradients,e,t),this._refreshFactorGradient(this._velocityGradients,\"_velocityGradientsTexture\",!0),this._releaseBuffers(),this},t.prototype.removeVelocityGradient=function(e){return this._removeGradientAndTexture(e,this._velocityGradients,this._velocityGradientsTexture),this._velocityGradientsTexture=null,this},t.prototype.addLimitVelocityGradient=function(e,t){return this._limitVelocityGradients||(this._limitVelocityGradients=[]),this._addFactorGradient(this._limitVelocityGradients,e,t),this._refreshFactorGradient(this._limitVelocityGradients,\"_limitVelocityGradientsTexture\",!0),this._releaseBuffers(),this},t.prototype.removeLimitVelocityGradient=function(e){return this._removeGradientAndTexture(e,this._limitVelocityGradients,this._limitVelocityGradientsTexture),this._limitVelocityGradientsTexture=null,this},t.prototype.addDragGradient=function(e,t){return this._dragGradients||(this._dragGradients=[]),this._addFactorGradient(this._dragGradients,e,t),this._refreshFactorGradient(this._dragGradients,\"_dragGradientsTexture\",!0),this._releaseBuffers(),this},t.prototype.removeDragGradient=function(e){return this._removeGradientAndTexture(e,this._dragGradients,this._dragGradientsTexture),this._dragGradientsTexture=null,this},t.prototype.addEmitRateGradient=function(){return this},t.prototype.removeEmitRateGradient=function(){return this},t.prototype.addStartSizeGradient=function(){return this},t.prototype.removeStartSizeGradient=function(){return this},t.prototype.addColorRemapGradient=function(){return this},t.prototype.removeColorRemapGradient=function(){return this},t.prototype.addAlphaRemapGradient=function(){return this},t.prototype.removeAlphaRemapGradient=function(){return this},t.prototype.addRampGradient=function(){return this},t.prototype.removeRampGradient=function(){return this},t.prototype.getRampGradients=function(){return null},Object.defineProperty(t.prototype,\"useRampGradients\",{get:function(){return!1},set:function(e){},enumerable:!1,configurable:!0}),t.prototype.addLifeTimeGradient=function(){return this},t.prototype.removeLifeTimeGradient=function(){return this},t.prototype._reset=function(){this._releaseBuffers()},t.prototype._createVertexBuffers=function(e,t,i){var n={};n.position=t.createVertexBuffer(\"position\",0,3,this._attributesStrideSize,!0);var r=3;n.age=t.createVertexBuffer(\"age\",r,1,this._attributesStrideSize,!0),r+=1,n.size=t.createVertexBuffer(\"size\",r,3,this._attributesStrideSize,!0),r+=3,n.life=t.createVertexBuffer(\"life\",r,1,this._attributesStrideSize,!0),r+=1,r+=4,this.billboardMode===Ny.BILLBOARDMODE_STRETCHED&&(n.direction=t.createVertexBuffer(\"direction\",r,3,this._attributesStrideSize,!0)),r+=3,this._platform.alignDataInBuffer&&(r+=1),this.particleEmitterType instanceof xa&&(r+=3,this._platform.alignDataInBuffer&&(r+=1)),this._colorGradientsTexture||(n.color=t.createVertexBuffer(\"color\",r,4,this._attributesStrideSize,!0),r+=4),this._isBillboardBased||(n.initialDirection=t.createVertexBuffer(\"initialDirection\",r,3,this._attributesStrideSize,!0),r+=3,this._platform.alignDataInBuffer&&(r+=1)),this.noiseTexture&&(n.noiseCoordinates1=t.createVertexBuffer(\"noiseCoordinates1\",r,3,this._attributesStrideSize,!0),r+=3,this._platform.alignDataInBuffer&&(r+=1),n.noiseCoordinates2=t.createVertexBuffer(\"noiseCoordinates2\",r,3,this._attributesStrideSize,!0),r+=3,this._platform.alignDataInBuffer&&(r+=1)),n.angle=t.createVertexBuffer(\"angle\",r,1,this._attributesStrideSize,!0),this._angularSpeedGradientsTexture?r++:r+=2,this._isAnimationSheetEnabled&&(n.cellIndex=t.createVertexBuffer(\"cellIndex\",r,1,this._attributesStrideSize,!0),r+=1,this.spriteRandomStartCell&&(n.cellStartOffset=t.createVertexBuffer(\"cellStartOffset\",r,1,this._attributesStrideSize,!0),r+=1)),n.offset=i.createVertexBuffer(\"offset\",0,2),n.uv=i.createVertexBuffer(\"uv\",2,2),this._platform.createVertexBuffers(e,n),this.resetDrawCache()},t.prototype._initialize=function(e){if(void 0===e&&(e=!1),!this._buffer0||e){var t=this._engine,i=new Array;this._attributesStrideSize=21,this._targetIndex=0,this._platform.alignDataInBuffer&&(this._attributesStrideSize+=1),this.particleEmitterType instanceof xa&&(this._attributesStrideSize+=3,this._platform.alignDataInBuffer&&(this._attributesStrideSize+=1)),this.isBillboardBased||(this._attributesStrideSize+=3,this._platform.alignDataInBuffer&&(this._attributesStrideSize+=1)),this._colorGradientsTexture&&(this._attributesStrideSize-=4),this._angularSpeedGradientsTexture&&(this._attributesStrideSize-=1),this._isAnimationSheetEnabled&&(this._attributesStrideSize+=1,this.spriteRandomStartCell&&(this._attributesStrideSize+=1)),this.noiseTexture&&(this._attributesStrideSize+=6,this._platform.alignDataInBuffer&&(this._attributesStrideSize+=2)),this._platform.alignDataInBuffer&&(this._attributesStrideSize+=3-(this._attributesStrideSize+3&3));for(var n=this.particleEmitterType instanceof xa,r=O.Vector3[0],o=0,a=0;a0;)i.push(0)}var l=new Float32Array([.5,.5,1,1,-.5,.5,0,1,.5,-.5,1,0,-.5,-.5,0,0]),c=this._platform.createParticleBuffer(i),u=this._platform.createParticleBuffer(i);this._buffer0=new Fi(t,c,!1,this._attributesStrideSize),this._buffer1=new Fi(t,u,!1,this._attributesStrideSize),this._spriteBuffer=new Fi(t,l,!1,4),this._createVertexBuffers(this._buffer0,this._buffer1,this._spriteBuffer),this._createVertexBuffers(this._buffer1,this._buffer0,this._spriteBuffer),this._sourceBuffer=this._buffer0,this._targetBuffer=this._buffer1}},t.prototype._recreateUpdateEffect=function(){var e=this.particleEmitterType?this.particleEmitterType.getEffectDefines():\"\";this._isBillboardBased&&(e+=\"\\n#define BILLBOARD\"),this._colorGradientsTexture&&(e+=\"\\n#define COLORGRADIENTS\"),this._sizeGradientsTexture&&(e+=\"\\n#define SIZEGRADIENTS\"),this._angularSpeedGradientsTexture&&(e+=\"\\n#define ANGULARSPEEDGRADIENTS\"),this._velocityGradientsTexture&&(e+=\"\\n#define VELOCITYGRADIENTS\"),this._limitVelocityGradientsTexture&&(e+=\"\\n#define LIMITVELOCITYGRADIENTS\"),this._dragGradientsTexture&&(e+=\"\\n#define DRAGGRADIENTS\"),this.isAnimationSheetEnabled&&(e+=\"\\n#define ANIMATESHEET\",this.spriteRandomStartCell&&(e+=\"\\n#define ANIMATESHEETRANDOMSTART\")),this.noiseTexture&&(e+=\"\\n#define NOISE\"),this.isLocal&&(e+=\"\\n#define LOCAL\"),this._platform.isUpdateBufferCreated()&&this._cachedUpdateDefines===e||(this._cachedUpdateDefines=e,this._updateBuffer=this._platform.createUpdateBuffer(e))},t.prototype._getWrapper=function(e){var t=this._getCustomDrawWrapper(e);if(null==t?void 0:t.effect)return t;var i=[];this.fillDefines(i,e);var n=this._drawWrappers[e];n||((n=new Ht(this._engine)).drawContext&&(n.drawContext.useInstancing=!0),this._drawWrappers[e]=n);var r=i.join(\"\\n\");if(n.defines!==r){var o=[],a=[],s=[];this.fillUniformsAttributesAndSamplerNames(a,o,s),n.setEffect(this._engine.createEffect(\"gpuRenderParticles\",o,a,s,r),r)}return n},t._GetAttributeNamesOrOptions=function(e,t,i,n){void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===i&&(i=!1),void 0===n&&(n=!1);var r=[wi.PositionKind,\"age\",\"life\",\"size\",\"angle\"];return e||r.push(wi.ColorKind),t&&r.push(\"cellIndex\"),i||r.push(\"initialDirection\"),n||r.push(\"direction\"),r.push(\"offset\",wi.UVKind),r},t._GetEffectCreationOptions=function(e,t){void 0===e&&(e=!1),void 0===t&&(t=!1);var i=[\"emitterWM\",\"worldOffset\",\"view\",\"projection\",\"colorDead\",\"invView\",\"vClipPlane\",\"vClipPlane2\",\"vClipPlane3\",\"vClipPlane4\",\"vClipPlane5\",\"vClipPlane6\",\"translationPivot\",\"eyePosition\"];return e&&i.push(\"sheetInfos\"),t&&i.push(\"logarithmicDepthConstant\"),i},t.prototype.fillDefines=function(e,t){if(void 0===t&&(t=0),this._scene&&(this._scene.clipPlane&&e.push(\"#define CLIPPLANE\"),this._scene.clipPlane2&&e.push(\"#define CLIPPLANE2\"),this._scene.clipPlane3&&e.push(\"#define CLIPPLANE3\"),this._scene.clipPlane4&&e.push(\"#define CLIPPLANE4\"),this._scene.clipPlane5&&e.push(\"#define CLIPPLANE5\"),this._scene.clipPlane6&&e.push(\"#define CLIPPLANE6\")),t===Ny.BLENDMODE_MULTIPLY&&e.push(\"#define BLENDMULTIPLYMODE\"),this.isLocal&&e.push(\"#define LOCAL\"),this.useLogarithmicDepth&&e.push(\"#define LOGARITHMICDEPTH\"),this._isBillboardBased)switch(e.push(\"#define BILLBOARD\"),this.billboardMode){case Ny.BILLBOARDMODE_Y:e.push(\"#define BILLBOARDY\");break;case Ny.BILLBOARDMODE_STRETCHED:e.push(\"#define BILLBOARDSTRETCHED\");break;case Ny.BILLBOARDMODE_ALL:e.push(\"#define BILLBOARDMODE_ALL\")}this._colorGradientsTexture&&e.push(\"#define COLORGRADIENTS\"),this.isAnimationSheetEnabled&&e.push(\"#define ANIMATESHEET\"),this._imageProcessingConfiguration&&(this._imageProcessingConfiguration.prepareDefines(this._imageProcessingConfigurationDefines),e.push(\"\"+this._imageProcessingConfigurationDefines.toString()))},t.prototype.fillUniformsAttributesAndSamplerNames=function(e,i,n){i.push.apply(i,t._GetAttributeNamesOrOptions(!!this._colorGradientsTexture,this._isAnimationSheetEnabled,this._isBillboardBased,this._isBillboardBased&&this.billboardMode===Ny.BILLBOARDMODE_STRETCHED)),e.push.apply(e,t._GetEffectCreationOptions(this._isAnimationSheetEnabled,this.useLogarithmicDepth)),n.push(\"diffuseSampler\",\"colorGradientSampler\"),this._imageProcessingConfiguration&&(Ri.PrepareUniforms(e,this._imageProcessingConfigurationDefines),Ri.PrepareSamplers(n,this._imageProcessingConfigurationDefines))},t.prototype.animate=function(e){var t;void 0===e&&(e=!1),this._timeDelta=this.updateSpeed*(e?this.preWarmStepOffset:(null===(t=this._scene)||void 0===t?void 0:t.getAnimationRatio())||1),this._actualFrame+=this._timeDelta,this._stopped||this.targetStopDuration&&this._actualFrame>=this.targetStopDuration&&this.stop()},t.prototype._createFactorGradientTexture=function(e,t){var i=this[t];if(e&&e.length&&!i){for(var n=new Float32Array(this._rawTextureWidth),r=function(t){var i=t/o._rawTextureWidth;Iy.GetCurrentGradient(i,e,(function(e,i,r){n[t]=h.Lerp(e.factor1,i.factor1,r)}))},o=this,s=0;s=0){var h=s.clone();h.invert(),o.setMatrix(\"invView\",h)}switch(this.useLogarithmicDepth&&this._scene&&Pr.BindLogDepth(u,o,this._scene),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(o),e){case Ny.BLENDMODE_ADD:this._engine.setAlphaMode(a.ALPHA_ADD);break;case Ny.BLENDMODE_ONEONE:this._engine.setAlphaMode(a.ALPHA_ONEONE);break;case Ny.BLENDMODE_STANDARD:this._engine.setAlphaMode(a.ALPHA_COMBINE);break;case Ny.BLENDMODE_MULTIPLY:this._engine.setAlphaMode(a.ALPHA_MULTIPLY)}return this._platform.bindDrawBuffers(this._targetIndex,o),this._onBeforeDrawParticlesObservable&&this._onBeforeDrawParticlesObservable.notifyObservers(o),this._engine.drawArraysType(a.MATERIAL_TriangleStripDrawMode,0,4,this._currentActiveCount),this._engine.setAlphaMode(a.ALPHA_DISABLE),this._currentActiveCount},t.prototype.render=function(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=!1),!this._started)return 0;if(this._createColorGradientTexture(),this._createSizeGradientTexture(),this._createAngularSpeedGradientTexture(),this._createVelocityGradientTexture(),this._createLimitVelocityGradientTexture(),this._createDragGradientTexture(),this._recreateUpdateEffect(),!this.isReady())return 0;if(!e&&this._scene){if(!this._preWarmDone&&this.preWarmCycles){for(var i=0;i1){var n=0|this._accumulatedCount;this._accumulatedCount-=n,this._currentActiveCount=Math.min(this._activeCount,this._currentActiveCount+n)}if(!this._currentActiveCount)return 0;var r;if(this.emitter.position)r=this.emitter.getWorldMatrix();else{var o=this.emitter;r=M.Translation(o.x,o.y,o.z)}var s=this._engine;this._platform.preUpdateParticleBuffer(),this._updateBuffer.setFloat(\"currentCount\",this._currentActiveCount),this._updateBuffer.setFloat(\"timeDelta\",this._timeDelta),this._updateBuffer.setFloat(\"stopFactor\",this._stopped?0:1),this._updateBuffer.setInt(\"randomTextureSize\",this._randomTextureSize),this._updateBuffer.setFloat2(\"lifeTime\",this.minLifeTime,this.maxLifeTime),this._updateBuffer.setFloat2(\"emitPower\",this.minEmitPower,this.maxEmitPower),this._colorGradientsTexture||(this._updateBuffer.setDirectColor4(\"color1\",this.color1),this._updateBuffer.setDirectColor4(\"color2\",this.color2)),this._updateBuffer.setFloat2(\"sizeRange\",this.minSize,this.maxSize),this._updateBuffer.setFloat4(\"scaleRange\",this.minScaleX,this.maxScaleX,this.minScaleY,this.maxScaleY),this._updateBuffer.setFloat4(\"angleRange\",this.minAngularSpeed,this.maxAngularSpeed,this.minInitialRotation,this.maxInitialRotation),this._updateBuffer.setVector3(\"gravity\",this.gravity),this._limitVelocityGradientsTexture&&this._updateBuffer.setFloat(\"limitVelocityDamping\",this.limitVelocityDamping),this.particleEmitterType&&this.particleEmitterType.applyToShader(this._updateBuffer),this._isAnimationSheetEnabled&&this._updateBuffer.setFloat4(\"cellInfos\",this.startSpriteCellID,this.endSpriteCellID,this.spriteCellChangeSpeed,this.spriteCellLoop?1:0),this.noiseTexture&&this._updateBuffer.setVector3(\"noiseStrength\",this.noiseStrength),this.isLocal||this._updateBuffer.setMatrix(\"emitterWM\",r),this._platform.updateParticleBuffer(this._targetIndex,this._targetBuffer,this._currentActiveCount);var l=0;e||t||(s.setState(!1),this.forceDepthWrite&&s.setDepthWrite(!0),l=this.blendMode===Ny.BLENDMODE_MULTIPLYADD?this._render(Ny.BLENDMODE_MULTIPLY,r)+this._render(Ny.BLENDMODE_ADD,r):this._render(this.blendMode,r),this._engine.setAlphaMode(a.ALPHA_DISABLE)),this._targetIndex++,2===this._targetIndex&&(this._targetIndex=0);var c=this._sourceBuffer;return this._sourceBuffer=this._targetBuffer,this._targetBuffer=c,l},t.prototype.rebuild=function(){this._initialize(!0)},t.prototype._releaseBuffers=function(){this._buffer0&&(this._buffer0.dispose(),this._buffer0=null),this._buffer1&&(this._buffer1.dispose(),this._buffer1=null),this._spriteBuffer&&(this._spriteBuffer.dispose(),this._spriteBuffer=null),this._platform.releaseBuffers()},t.prototype.dispose=function(e){for(var t in void 0===e&&(e=!0),this._drawWrappers)this._drawWrappers[t].dispose();if(this._drawWrappers={},this._scene){var i=this._scene.particleSystems.indexOf(this);i>-1&&this._scene.particleSystems.splice(i,1)}this._releaseBuffers(),this._platform.releaseVertexBuffers(),this._colorGradientsTexture&&(this._colorGradientsTexture.dispose(),this._colorGradientsTexture=null),this._sizeGradientsTexture&&(this._sizeGradientsTexture.dispose(),this._sizeGradientsTexture=null),this._angularSpeedGradientsTexture&&(this._angularSpeedGradientsTexture.dispose(),this._angularSpeedGradientsTexture=null),this._velocityGradientsTexture&&(this._velocityGradientsTexture.dispose(),this._velocityGradientsTexture=null),this._limitVelocityGradientsTexture&&(this._limitVelocityGradientsTexture.dispose(),this._limitVelocityGradientsTexture=null),this._dragGradientsTexture&&(this._dragGradientsTexture.dispose(),this._dragGradientsTexture=null),this._randomTexture&&(this._randomTexture.dispose(),this._randomTexture=null),this._randomTexture2&&(this._randomTexture2.dispose(),this._randomTexture2=null),e&&this.particleTexture&&(this.particleTexture.dispose(),this.particleTexture=null),e&&this.noiseTexture&&(this.noiseTexture.dispose(),this.noiseTexture=null),this.onStoppedObservable.clear(),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear()},t.prototype.clone=function(e,i){var n=k({},this._customWrappers),r=null,o=this._engine;if(o.createEffectForParticles&&null!=this.customShader){var a=(r=this.customShader).shaderOptions.defines.length>0?r.shaderOptions.defines.join(\"\\n\"):\"\";n[0]=o.createEffectForParticles(r.shaderPath.fragmentElement,r.shaderOptions.uniforms,r.shaderOptions.samplers,a,void 0,void 0,void 0,this)}var s=this.serialize(),l=t.Parse(s,this._scene||this._engine,this._rootUrl);return l.name=e,l.customShader=r,l._customWrappers=n,void 0===i&&(i=this.emitter),this.noiseTexture&&(l.noiseTexture=this.noiseTexture.clone()),l.emitter=i,l},t.prototype.serialize=function(e){void 0===e&&(e=!1);var t={};return Ny._Serialize(t,this,e),t.activeParticleCount=this.activeParticleCount,t.randomTextureSize=this._randomTextureSize,t.customShader=this.customShader,t},t.Parse=function(e,i,n,r,o){void 0===r&&(r=!1);var a,s=e.name;a=i instanceof Yt?i:i.getEngine();var l=new t(s,{capacity:o||e.capacity,randomTextureSize:e.randomTextureSize},i,null,e.isAnimationSheetEnabled);if(l._rootUrl=n,e.customShader&&a.createEffectForParticles){var c=e.customShader,u=c.shaderOptions.defines.length>0?c.shaderOptions.defines.join(\"\\n\"):\"\",h=a.createEffectForParticles(c.shaderPath.fragmentElement,c.shaderOptions.uniforms,c.shaderOptions.samplers,u,void 0,void 0,void 0,l);l.setCustomEffect(h,0),l.customShader=c}return e.id&&(l.id=e.id),e.activeParticleCount&&(l.activeParticleCount=e.activeParticleCount),Ny._Parse(e,l,i,n),e.preventAutoStart&&(l.preventAutoStart=e.preventAutoStart),r||l.preventAutoStart||l.start(),l},t}(Pa),Fy=function(){function e(){this._emitterNodeIsOwned=!0,this.systems=new Array}return Object.defineProperty(e.prototype,\"emitterNode\",{get:function(){return this._emitterNode},set:function(e){this._emitterNodeIsOwned&&this._emitterNode&&(this._emitterNode.dispose&&this._emitterNode.dispose(),this._emitterNodeIsOwned=!1);for(var t=0,i=this.systems;t0&&i.set(this._uvs32,wi.UVKind),this._colors32.length>0&&i.set(this._colors32,wi.ColorKind),i.applyToMesh(this.mesh,this._updatable),this.mesh.isPickable=this._pickable,this._pickable)for(var n=0,r=0;rd?d:n,i=Math.round(d/n),r=0):i=i>d?d:i;for(var p=[],f=[],_=[],m=[],g=[],v=x.Zero(),y=i;hd-(i=y+Math.floor((1+r)*Math.random()))&&(i=d-h),p.length=0,f.length=0,_.length=0,m.length=0,g.length=0;for(var b=0,T=3*h;T<3*(h+i);T++){_.push(b);var E=a[T],S=3*E;if(p.push(o[S],o[S+1],o[S+2]),f.push(c[S],c[S+1],c[S+2]),s){var A=2*E;m.push(s[A],s[A+1])}if(l){var R=4*E;g.push(l[R],l[R+1],l[R+2],l[R+3])}b++}var C=this.nbParticles,P=this._posToShape(p),M=this._uvsToShapeUV(m),I=_.slice(),O=g.slice(),D=f.slice();v.copyFromFloats(0,0,0);var N=void 0;for(N=0;N65535&&(this._needs32Bits=!0)}if(this._depthSort||this._multimaterialEnabled){var k=null!==b.materialIndex?b.materialIndex:0;this.depthSortedParticles.push(new ky(d,t,r.length,k))}return b},e.prototype._posToShape=function(e){for(var t=[],i=0;i=this.nbParticles||!this._updatable)return[];var n=this.particles,r=this.nbParticles;if(t=this.nbParticles?this.nbParticles-1:t,this._computeBoundingBox&&(0!=e||t!=this.nbParticles-1)){var B=this.mesh.getBoundingInfo();B&&(v.copyFrom(B.minimum),y.copyFrom(B.maximum))}var U=(I=this.particles[e]._pos)/3|0;N=4*U,F=2*U;for(var V=e;V<=t;V++){var k=this.particles[V];this.updateParticle(k);var G=k._model._shape,z=k._model._shapeUV,W=k._rotationMatrix,H=k.position,X=k.rotation,j=k.scaling,Y=k._globalPosition;if(p){var K=this.depthSortedParticles[V];K.idx=k.idx,K.ind=k._ind,K.indicesLength=k._model._indicesLength,K.sqDistance=x.DistanceSquared(k.position,b)}if(k.alive&&(!k._stillInvisible||k.isVisible||this._recomputeInvisibles)){if(k.isVisible){k._stillInvisible=!1;var Q=f[12];if(k.pivot.multiplyToRef(j,Q),this.billboard&&(X.x=0,X.y=0),(this._computeParticleRotation||this.billboard)&&k.getRotationMatrix(n),null!==k.parentId){var q=this.getParticleById(k.parentId);if(q){var Z=q._rotationMatrix,J=q._globalPosition,$=H.x*Z[1]+H.y*Z[4]+H.z*Z[7],ee=H.x*Z[0]+H.y*Z[3]+H.z*Z[6],te=H.x*Z[2]+H.y*Z[5]+H.z*Z[8];if(Y.x=J.x+ee,Y.y=J.y+$,Y.z=J.z+te,this._computeParticleRotation||this.billboard){var ie=n.m;W[0]=ie[0]*Z[0]+ie[1]*Z[3]+ie[2]*Z[6],W[1]=ie[0]*Z[1]+ie[1]*Z[4]+ie[2]*Z[7],W[2]=ie[0]*Z[2]+ie[1]*Z[5]+ie[2]*Z[8],W[3]=ie[4]*Z[0]+ie[5]*Z[3]+ie[6]*Z[6],W[4]=ie[4]*Z[1]+ie[5]*Z[4]+ie[6]*Z[7],W[5]=ie[4]*Z[2]+ie[5]*Z[5]+ie[6]*Z[8],W[6]=ie[8]*Z[0]+ie[9]*Z[3]+ie[10]*Z[6],W[7]=ie[8]*Z[1]+ie[9]*Z[4]+ie[10]*Z[7],W[8]=ie[8]*Z[2]+ie[9]*Z[5]+ie[10]*Z[8]}}else k.parentId=null}else Y.x=H.x,Y.y=H.y,Y.z=H.z,(this._computeParticleRotation||this.billboard)&&(ie=n.m,W[0]=ie[0],W[1]=ie[1],W[2]=ie[2],W[3]=ie[4],W[4]=ie[5],W[5]=ie[6],W[6]=ie[8],W[7]=ie[9],W[8]=ie[10]);var ne=f[11];for(k.translateFromPivot?ne.setAll(0):ne.copyFrom(Q),w=0;w0)for(var t=0;t0&&t.set(this._uvs32,wi.UVKind);var i=0;this._colors32.length>0&&(i=1,t.set(this._colors32,wi.ColorKind));var n=new Ur(this.name,this._scene);t.applyToMesh(n,this._updatable),this.mesh=n,this._positions=null,this._uvs=null,this._colors=null,this._updatable||(this.particles.length=0);var r=e;return r||((r=new Xl(\"point cloud material\",this._scene)).emissiveColor=new N(i,i,i),r.disableLighting=!0,r.pointsCloud=!0,r.pointSize=this._size),n.material=r,new Promise((function(e){return e(n)}))},e.prototype._addParticle=function(e,t,i,n){var r=new Wy(e,t,i,n,this);return this.particles.push(r),r},e.prototype._randomUnitVector=function(e){e.position=new x(Math.random(),Math.random(),Math.random()),e.color=new L(1,1,1,1)},e.prototype._getColorIndicesForCoord=function(e,t,i,n){var r=e._groupImageData,o=i*(4*n)+4*t,a=[o,o+1,o+2,o+3],s=a[1],l=a[2],c=a[3],u=r[a[0]],h=r[s],d=r[l],p=r[c];return new L(u/255,h/255,d/255,p)},e.prototype._setPointsColorOrUV=function(e,t,i,n,r,o,a){i&&e.updateFacetData();var s=2*e.getBoundingInfo().boundingSphere.radius,l=e.getVerticesData(wi.PositionKind),c=e.getIndices(),u=e.getVerticesData(wi.UVKind),d=e.getVerticesData(wi.ColorKind),p=x.Zero();e.computeWorldMatrix();var f=e.getWorldMatrix();if(!f.isIdentity()){l=l.slice(0);for(var _=0;_1&&(Le=1),(Fe=we.b+De)<0&&(Fe=0),Fe>1&&(Fe=1),N.HSVtoRGBToRef(Ne,Le,Fe,Ue),ve.set(Ue.r,Ue.g,Ue.b,1)):ve=ue.set(Math.random(),Math.random(),Math.random(),1),ke.color=new L(ve.x,ve.y,ve.z,ve.w),this._colors.push(ve.x,ve.y,ve.z,ve.w))}},e.prototype._colorFromTexture=function(e,t,i){var n=this;if(null===e.material)return Q.Warn(e.name+\"has no material.\"),t._groupImageData=null,void this._setPointsColorOrUV(e,t,i,!0,!1);var r=e.material.getActiveTextures();if(0===r.length)return Q.Warn(e.name+\"has no usable texture.\"),t._groupImageData=null,void this._setPointsColorOrUV(e,t,i,!0,!1);var o=e.clone();o.setEnabled(!1),this._promises.push(new Promise((function(e){qr.WhenAllReady(r,(function(){var a=t._textureNb;a<0&&(a=0),a>r.length-1&&(a=r.length-1);var s=function(){t._groupImgWidth=r[a].getSize().width,t._groupImgHeight=r[a].getSize().height,n._setPointsColorOrUV(o,t,i,!0,!0),o.dispose(),e()};t._groupImageData=null;var l=r[a].readPixels();l?l.then((function(e){t._groupImageData=e,s()})):s()}))})))},e.prototype._calculateDensity=function(e,t,i){for(var n,r,o,a,s,l,c,u,h,d,p,f,_,m,g,v,y,b=new Array,T=x.Zero(),E=x.Zero(),S=x.Zero(),A=x.Zero(),R=x.Zero(),C=x.Zero(),P=new Array,M=0,I=i.length/3,O=0;O0&&(b=b.map((function(e){return e+L}))),O=0;O3)&&(o=By.Random);var a=e.getVerticesData(wi.PositionKind),s=e.getIndices();this._groups.push(this._groupCounter);var l=new Hy(this._groupCounter,null);switch(l._groupDensity=this._calculateDensity(t,a,s),o===By.Color?l._textureNb=n||0:n=n||new L(1,1,1,1),o){case By.Color:this._colorFromTexture(e,l,!1);break;case By.UV:this._setPointsColorOrUV(e,l,!1,!1,!1);break;case By.Random:this._setPointsColorOrUV(e,l,!1);break;case By.Stated:this._setPointsColorOrUV(e,l,!1,void 0,void 0,n,r)}return this.nbParticles+=t,this._groupCounter++,this._groupCounter-1},e.prototype.addVolumePoints=function(e,t,i,n,r){var o=i||By.Random;(isNaN(o)||o<0||o>3)&&(o=By.Random);var a=e.getVerticesData(wi.PositionKind),s=e.getIndices();this._groups.push(this._groupCounter);var l=new Hy(this._groupCounter,null);switch(l._groupDensity=this._calculateDensity(t,a,s),o===By.Color?l._textureNb=n||0:n=n||new L(1,1,1,1),o){case By.Color:this._colorFromTexture(e,l,!0);break;case By.UV:this._setPointsColorOrUV(e,l,!0,!1,!1);break;case By.Random:this._setPointsColorOrUV(e,l,!0);break;case By.Stated:this._setPointsColorOrUV(e,l,!0,void 0,void 0,n,r)}return this.nbParticles+=t,this._groupCounter++,this._groupCounter-1},e.prototype.setParticles=function(e,t,i){var n,r;if(void 0===e&&(e=0),void 0===t&&(t=this.nbParticles-1),void 0===i&&(i=!0),!this._updatable||!this._isReady)return this;this.beforeUpdateParticles(e,t,i);var o=O.Matrix[0],a=this.mesh,s=this._colors32,l=this._positions32,c=this._uvs32,u=O.Vector3,h=u[5].copyFromFloats(1,0,0),d=u[6].copyFromFloats(0,1,0),p=u[7].copyFromFloats(0,0,1),f=u[8].setAll(Number.MAX_VALUE),_=u[9].setAll(-Number.MAX_VALUE);M.IdentityToRef(o);var m=0;if((null===(n=this.mesh)||void 0===n?void 0:n.isFacetDataEnabled)&&(this._computeBoundingBox=!0),t=t>=this.nbParticles?this.nbParticles-1:t,this._computeBoundingBox&&(0!=e||t!=this.nbParticles-1)){var g=null===(r=this.mesh)||void 0===r?void 0:r.getBoundingInfo();g&&(f.copyFrom(g.minimum),_.copyFrom(g.maximum))}m=0;for(var v=0,y=0,b=0,T=e;T<=t;T++){var E=this.particles[T];v=3*(m=E.idx),y=4*m,b=2*m,this.updateParticle(E);var S=E._rotationMatrix,A=E.position,R=E._globalPosition;if(this._computeParticleRotation&&E.getRotationMatrix(o),null!==E.parentId){var x=this.particles[E.parentId],C=x._rotationMatrix,P=x._globalPosition,I=A.x*C[1]+A.y*C[4]+A.z*C[7],D=A.x*C[0]+A.y*C[3]+A.z*C[6],N=A.x*C[2]+A.y*C[5]+A.z*C[8];if(R.x=P.x+D,R.y=P.y+I,R.z=P.z+N,this._computeParticleRotation){var L=o.m;S[0]=L[0]*C[0]+L[1]*C[3]+L[2]*C[6],S[1]=L[0]*C[1]+L[1]*C[4]+L[2]*C[7],S[2]=L[0]*C[2]+L[1]*C[5]+L[2]*C[8],S[3]=L[4]*C[0]+L[5]*C[3]+L[6]*C[6],S[4]=L[4]*C[1]+L[5]*C[4]+L[6]*C[7],S[5]=L[4]*C[2]+L[5]*C[5]+L[6]*C[8],S[6]=L[8]*C[0]+L[9]*C[3]+L[10]*C[6],S[7]=L[8]*C[1]+L[9]*C[4]+L[10]*C[7],S[8]=L[8]*C[2]+L[9]*C[5]+L[10]*C[8]}}else R.x=0,R.y=0,R.z=0,this._computeParticleRotation&&(L=o.m,S[0]=L[0],S[1]=L[1],S[2]=L[2],S[3]=L[4],S[4]=L[5],S[5]=L[6],S[6]=L[8],S[7]=L[9],S[8]=L[10]);var F=u[11];E.translateFromPivot?F.setAll(0):F.copyFrom(E.pivot);var w=u[0];w.copyFrom(E.position);var B=w.x-E.pivot.x,U=w.y-E.pivot.y,V=w.z-E.pivot.z,k=B*S[0]+U*S[3]+V*S[6],G=B*S[1]+U*S[4]+V*S[7],z=B*S[2]+U*S[5]+V*S[8];k+=F.x,G+=F.y,z+=F.z;var W=l[v]=R.x+h.x*k+d.x*G+p.x*z,H=l[v+1]=R.y+h.y*k+d.y*G+p.y*z,X=l[v+2]=R.z+h.z*k+d.z*G+p.z*z;if(this._computeBoundingBox&&(f.minimizeInPlaceFromFloats(W,H,X),_.maximizeInPlaceFromFloats(W,H,X)),this._computeParticleColor&&E.color){var j=E.color,Y=this._colors32;Y[y]=j.r,Y[y+1]=j.g,Y[y+2]=j.b,Y[y+3]=j.a}if(this._computeParticleTexture&&E.uv){var K=E.uv,Q=this._uvs32;Q[b]=K.x,Q[b+1]=K.y}}return a&&(i&&(this._computeParticleColor&&a.updateVerticesData(wi.ColorKind,s,!1,!1),this._computeParticleTexture&&a.updateVerticesData(wi.UVKind,c,!1,!1),a.updateVerticesData(wi.PositionKind,l,!1,!1)),this._computeBoundingBox&&(a.hasBoundingInfo?a.getBoundingInfo().reConstruct(f,_,a._worldMatrix):a.buildBoundingInfo(f,_,a._worldMatrix))),this.afterUpdateParticles(e,t,i),this},e.prototype.dispose=function(){var e;null===(e=this.mesh)||void 0===e||e.dispose(),this.vars=null,this._positions=null,this._indices=null,this._normals=null,this._uvs=null,this._colors=null,this._indices32=null,this._positions32=null,this._uvs32=null,this._colors32=null},e.prototype.refreshVisibleSize=function(){var e;return this._isVisibilityBoxLocked||null===(e=this.mesh)||void 0===e||e.refreshBoundingInfo(),this},e.prototype.setVisibilityBox=function(e){if(this.mesh){var t=e/2;this.mesh.buildBoundingInfo(new x(-t,-t,-t),new x(t,t,t))}},Object.defineProperty(e.prototype,\"isAlwaysVisible\",{get:function(){return this._alwaysVisible},set:function(e){this.mesh&&(this._alwaysVisible=e,this.mesh.alwaysSelectAsActiveMesh=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"computeParticleRotation\",{set:function(e){this._computeParticleRotation=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"computeParticleColor\",{get:function(){return this._computeParticleColor},set:function(e){this._computeParticleColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"computeParticleTexture\",{get:function(){return this._computeParticleTexture},set:function(e){this._computeParticleTexture=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"computeBoundingBox\",{get:function(){return this._computeBoundingBox},set:function(e){this._computeBoundingBox=e},enumerable:!1,configurable:!0}),e.prototype.initParticles=function(){},e.prototype.recycleParticle=function(e){return e},e.prototype.updateParticle=function(e){return e},e.prototype.beforeUpdateParticles=function(e,t,i){},e.prototype.afterUpdateParticles=function(e,t,i){},e}();mn.prototype.getPhysicsEngine=function(){return this._physicsEngine},mn.prototype.enablePhysics=function(e,t){if(void 0===e&&(e=null),this._physicsEngine)return!0;var i=this._getComponent(zi.NAME_PHYSICSENGINE);i||(i=new Ky(this),this._addComponent(i));try{return this._physicsEngine=new G_(e,t),this._physicsTimeAccumulator=0,!0}catch(e){return Q.Error(e.message),!1}},mn.prototype.disablePhysicsEngine=function(){this._physicsEngine&&(this._physicsEngine.dispose(),this._physicsEngine=null)},mn.prototype.isPhysicsEnabled=function(){return void 0!==this._physicsEngine},mn.prototype.deleteCompoundImpostor=function(e){var t=e.parts[0].mesh;t.physicsImpostor&&(t.physicsImpostor.dispose(),t.physicsImpostor=null)},mn.prototype._advancePhysicsEngineStep=function(e){if(this._physicsEngine){var t=this._physicsEngine.getSubTimeStep();if(t>0)for(this._physicsTimeAccumulator+=e;this._physicsTimeAccumulator>t;)this.onBeforePhysicsObservable.notifyObservers(this),this._physicsEngine._step(t/1e3),this.onAfterPhysicsObservable.notifyObservers(this),this._physicsTimeAccumulator-=t;else this.onBeforePhysicsObservable.notifyObservers(this),this._physicsEngine._step(e/1e3),this.onAfterPhysicsObservable.notifyObservers(this)}},Object.defineProperty(Sr.prototype,\"physicsImpostor\",{get:function(){return this._physicsImpostor},set:function(e){var t=this;this._physicsImpostor!==e&&(this._disposePhysicsObserver&&this.onDisposeObservable.remove(this._disposePhysicsObserver),this._physicsImpostor=e,e&&(this._disposePhysicsObserver=this.onDisposeObservable.add((function(){t.physicsImpostor&&(t.physicsImpostor.dispose(),t.physicsImpostor=null)}))))},enumerable:!0,configurable:!0}),Sr.prototype.getPhysicsImpostor=function(){return this.physicsImpostor},Sr.prototype.applyImpulse=function(e,t){return this.physicsImpostor?(this.physicsImpostor.applyImpulse(e,t),this):this},Sr.prototype.setPhysicsLinkWith=function(e,t,i,n){return this.physicsImpostor&&e.physicsImpostor?(this.physicsImpostor.createJoint(e.physicsImpostor,Mo.HingeJoint,{mainPivot:t,connectedPivot:i,nativeParams:n}),this):this};var jy,Yy,Ky=function(){function e(e){var t=this;this.name=zi.NAME_PHYSICSENGINE,this.scene=e,this.scene.onBeforePhysicsObservable=new u,this.scene.onAfterPhysicsObservable=new u,this.scene.getDeterministicFrameTime=function(){return t.scene._physicsEngine?1e3*t.scene._physicsEngine.getTimeStep():1e3/60}}return e.prototype.register=function(){},e.prototype.rebuild=function(){},e.prototype.dispose=function(){this.scene.onBeforePhysicsObservable.clear(),this.scene.onAfterPhysicsObservable.clear(),this.scene._physicsEngine&&this.scene.disablePhysicsEngine()},e}(),Qy=function(){function e(e){this._scene=e,this._physicsEngine=this._scene.getPhysicsEngine(),this._physicsEngine||Q.Warn(\"Physics engine not enabled. Please enable the physics before you can use the methods.\")}return e.prototype.applyRadialExplosionImpulse=function(e,t,i,n){if(!this._physicsEngine)return Q.Warn(\"Physics engine not enabled. Please enable the physics before you call this method.\"),null;var r=this._physicsEngine.getImpostors();if(0===r.length)return null;\"number\"==typeof t&&((t=new eb).radius=t,t.strength=i||t.strength,t.falloff=n||t.falloff);var o=new qy(this._scene,t),a=Array();return r.forEach((function(t){var i=o.getImpostorHitData(t,e);i&&(t.applyImpulse(i.force,i.contactPoint),a.push({impostor:t,hitData:i}))})),o.triggerAffectedImpostorsCallback(a),o.dispose(!1),o},e.prototype.applyRadialExplosionForce=function(e,t,i,n){if(!this._physicsEngine)return Q.Warn(\"Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.\"),null;var r=this._physicsEngine.getImpostors();if(0===r.length)return null;\"number\"==typeof t&&((t=new eb).radius=t,t.strength=i||t.strength,t.falloff=n||t.falloff);var o=new qy(this._scene,t),a=Array();return r.forEach((function(t){var i=o.getImpostorHitData(t,e);i&&(t.applyForce(i.force,i.contactPoint),a.push({impostor:t,hitData:i}))})),o.triggerAffectedImpostorsCallback(a),o.dispose(!1),o},e.prototype.gravitationalField=function(e,t,i,n){if(!this._physicsEngine)return Q.Warn(\"Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.\"),null;if(0===this._physicsEngine.getImpostors().length)return null;\"number\"==typeof t&&((t=new eb).radius=t,t.strength=i||t.strength,t.falloff=n||t.falloff);var r=new Zy(this,this._scene,e,t);return r.dispose(!1),r},e.prototype.updraft=function(e,t,i,n,r){if(!this._physicsEngine)return Q.Warn(\"Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.\"),null;if(0===this._physicsEngine.getImpostors().length)return null;\"number\"==typeof t&&((t=new tb).radius=t,t.strength=i||t.strength,t.height=n||t.height,t.updraftMode=r||t.updraftMode);var o=new Jy(this._scene,e,t);return o.dispose(!1),o},e.prototype.vortex=function(e,t,i,n){if(!this._physicsEngine)return Q.Warn(\"Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.\"),null;if(0===this._physicsEngine.getImpostors().length)return null;\"number\"==typeof t&&((t=new ib).radius=t,t.strength=i||t.strength,t.height=n||t.height);var r=new $y(this._scene,e,t);return r.dispose(!1),r},e}(),qy=function(){function e(e,t){this._scene=e,this._options=t,this._dataFetched=!1,this._options=k(k({},new eb),this._options)}return e.prototype.getData=function(){return this._dataFetched=!0,{sphere:this._sphere}},e.prototype.getImpostorHitData=function(e,t){if(0===e.mass)return null;if(!this._intersectsWithSphere(e,t,this._options.radius))return null;if(\"Mesh\"!==e.object.getClassName()&&\"InstancedMesh\"!==e.object.getClassName())return null;var i=e.getObjectCenter().subtract(t),n=new fo(t,i,this._options.radius).intersectsMesh(e.object).pickedPoint;if(!n)return null;var r=x.Distance(t,n);if(r>this._options.radius)return null;var o=this._options.falloff===jy.Constant?this._options.strength:this._options.strength*(1-r/this._options.radius);return{force:i.multiplyByFloats(o,o,o),contactPoint:n,distanceFromOrigin:r}},e.prototype.triggerAffectedImpostorsCallback=function(e){this._options.affectedImpostorsCallback&&this._options.affectedImpostorsCallback(e)},e.prototype.dispose=function(e){var t=this;void 0===e&&(e=!0),e?this._sphere.dispose():setTimeout((function(){t._dataFetched||t._sphere.dispose()}),0)},e.prototype._prepareSphere=function(){this._sphere||(this._sphere=jc(\"radialExplosionEventSphere\",this._options.sphere,this._scene),this._sphere.isVisible=!1)},e.prototype._intersectsWithSphere=function(e,t,i){var n=e.object;return this._prepareSphere(),this._sphere.position=t,this._sphere.scaling=new x(2*i,2*i,2*i),this._sphere._updateBoundingInfo(),this._sphere.computeWorldMatrix(!0),this._sphere.intersectsMesh(n,!0)},e}(),Zy=function(){function e(e,t,i,n){this._physicsHelper=e,this._scene=t,this._origin=i,this._options=n,this._dataFetched=!1,this._options=k(k({},new eb),this._options),this._tickCallback=this._tick.bind(this),this._options.strength=-1*this._options.strength}return e.prototype.getData=function(){return this._dataFetched=!0,{sphere:this._sphere}},e.prototype.enable=function(){this._tickCallback.call(this),this._scene.registerBeforeRender(this._tickCallback)},e.prototype.disable=function(){this._scene.unregisterBeforeRender(this._tickCallback)},e.prototype.dispose=function(e){var t=this;void 0===e&&(e=!0),e?this._sphere.dispose():setTimeout((function(){t._dataFetched||t._sphere.dispose()}),0)},e.prototype._tick=function(){if(this._sphere)this._physicsHelper.applyRadialExplosionForce(this._origin,this._options);else{var e=this._physicsHelper.applyRadialExplosionForce(this._origin,this._options);e&&(this._sphere=e.getData().sphere.clone(\"radialExplosionEventSphereClone\"))}},e}(),Jy=function(){function e(e,t,i){this._scene=e,this._origin=t,this._options=i,this._originTop=x.Zero(),this._originDirection=x.Zero(),this._cylinderPosition=x.Zero(),this._dataFetched=!1,this._physicsEngine=this._scene.getPhysicsEngine(),this._options=k(k({},new tb),this._options),this._origin.addToRef(new x(0,this._options.height/2,0),this._cylinderPosition),this._origin.addToRef(new x(0,this._options.height,0),this._originTop),this._options.updraftMode===Yy.Perpendicular&&(this._originDirection=this._origin.subtract(this._originTop).normalize()),this._tickCallback=this._tick.bind(this),this._prepareCylinder()}return e.prototype.getData=function(){return this._dataFetched=!0,{cylinder:this._cylinder}},e.prototype.enable=function(){this._tickCallback.call(this),this._scene.registerBeforeRender(this._tickCallback)},e.prototype.disable=function(){this._scene.unregisterBeforeRender(this._tickCallback)},e.prototype.dispose=function(e){var t=this;void 0===e&&(e=!0),this._cylinder&&(e?this._cylinder.dispose():setTimeout((function(){t._dataFetched||t._cylinder.dispose()}),0))},e.prototype._getImpostorHitData=function(e){if(0===e.mass)return null;if(!this._intersectsWithCylinder(e))return null;var t,i=e.getObjectCenter();t=this._options.updraftMode===Yy.Perpendicular?this._originDirection:i.subtract(this._originTop);var n=x.Distance(this._origin,i),r=-1*this._options.strength;return{force:t.multiplyByFloats(r,r,r),contactPoint:i,distanceFromOrigin:n}},e.prototype._tick=function(){var e=this;this._physicsEngine.getImpostors().forEach((function(t){var i=e._getImpostorHitData(t);i&&t.applyForce(i.force,i.contactPoint)}))},e.prototype._prepareCylinder=function(){this._cylinder||(this._cylinder=sc(\"updraftEventCylinder\",{height:this._options.height,diameter:2*this._options.radius},this._scene),this._cylinder.isVisible=!1)},e.prototype._intersectsWithCylinder=function(e){var t=e.object;return this._cylinder.position=this._cylinderPosition,this._cylinder.intersectsMesh(t,!0)},e}(),$y=function(){function e(e,t,i){this._scene=e,this._origin=t,this._options=i,this._originTop=x.Zero(),this._cylinderPosition=x.Zero(),this._dataFetched=!1,this._physicsEngine=this._scene.getPhysicsEngine(),this._options=k(k({},new ib),this._options),this._origin.addToRef(new x(0,this._options.height/2,0),this._cylinderPosition),this._origin.addToRef(new x(0,this._options.height,0),this._originTop),this._tickCallback=this._tick.bind(this),this._prepareCylinder()}return e.prototype.getData=function(){return this._dataFetched=!0,{cylinder:this._cylinder}},e.prototype.enable=function(){this._tickCallback.call(this),this._scene.registerBeforeRender(this._tickCallback)},e.prototype.disable=function(){this._scene.unregisterBeforeRender(this._tickCallback)},e.prototype.dispose=function(e){var t=this;void 0===e&&(e=!0),e?this._cylinder.dispose():setTimeout((function(){t._dataFetched||t._cylinder.dispose()}),0)},e.prototype._getImpostorHitData=function(e){if(0===e.mass)return null;if(!this._intersectsWithCylinder(e))return null;if(\"Mesh\"!==e.object.getClassName()&&\"InstancedMesh\"!==e.object.getClassName())return null;var t=e.getObjectCenter(),i=new x(this._origin.x,t.y,this._origin.z),n=t.subtract(i),r=new fo(i,n,this._options.radius).intersectsMesh(e.object),o=r.pickedPoint;if(!o)return null;var a,s,l,c=r.distance/this._options.radius,u=o.normalize();if(c>this._options.centripetalForceThreshold&&(u=u.negate()),c>this._options.centripetalForceThreshold)a=u.x*this._options.centripetalForceMultiplier,s=u.y*this._options.updraftForceMultiplier,l=u.z*this._options.centripetalForceMultiplier;else{var h=x.Cross(i,t).normalize();a=(h.x+u.x)*this._options.centrifugalForceMultiplier,s=this._originTop.y*this._options.updraftForceMultiplier,l=(h.z+u.z)*this._options.centrifugalForceMultiplier}var d=new x(a,s,l);return{force:d=d.multiplyByFloats(this._options.strength,this._options.strength,this._options.strength),contactPoint:t,distanceFromOrigin:c}},e.prototype._tick=function(){var e=this;this._physicsEngine.getImpostors().forEach((function(t){var i=e._getImpostorHitData(t);i&&t.applyForce(i.force,i.contactPoint)}))},e.prototype._prepareCylinder=function(){this._cylinder||(this._cylinder=sc(\"vortexEventCylinder\",{height:this._options.height,diameter:2*this._options.radius},this._scene),this._cylinder.isVisible=!1)},e.prototype._intersectsWithCylinder=function(e){var t=e.object;return this._cylinder.position=this._cylinderPosition,this._cylinder.intersectsMesh(t,!0)},e}(),eb=function(){this.radius=5,this.strength=10,this.falloff=jy.Constant,this.sphere={segments:32,diameter:1}},tb=function(){this.radius=5,this.strength=10,this.height=10,this.updraftMode=Yy.Center},ib=function(){this.radius=5,this.strength=10,this.height=10,this.centripetalForceThreshold=.7,this.centripetalForceMultiplier=5,this.centrifugalForceMultiplier=.5,this.updraftForceMultiplier=.02};!function(e){e[e.Constant=0]=\"Constant\",e[e.Linear=1]=\"Linear\"}(jy||(jy={})),function(e){e[e.Center=0]=\"Center\",e[e.Perpendicular=1]=\"Perpendicular\"}(Yy||(Yy={}));It.ShadersStore.blackAndWhitePixelShader=\"varying vec2 vUV;\\nuniform sampler2D textureSampler;\\nuniform float degree;\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void) \\n{\\nvec3 color=texture2D(textureSampler,vUV).rgb;\\nfloat luminance=dot(color,vec3(0.3,0.59,0.11)); \\nvec3 blackAndWhite=vec3(luminance,luminance,luminance);\\ngl_FragColor=vec4(color-((color-blackAndWhite)*degree),1.0);\\n}\";var nb=function(e){function t(t,i,n,r,o,a){var s=e.call(this,t,\"blackAndWhite\",[\"degree\"],null,i,n,r,o,a)||this;return s.degree=1,s.onApplyObservable.add((function(e){e.setFloat(\"degree\",s.degree)})),s}return V(t,e),t.prototype.getClassName=function(){return\"BlackAndWhitePostProcess\"},t._Parse=function(e,i,n,r){return Le.Parse((function(){return new t(e.name,e.options,i,e.renderTargetSamplingMode,n.getEngine(),e.reusable)}),e,n,r)},G([be()],t.prototype,\"degree\",void 0),t}(pa);b(\"BABYLON.BlackAndWhitePostProcess\",nb);var rb=function(){function e(e,t,i,n){this._name=t,this._singleInstance=n||!0,this._getPostProcesses=i,this._cameras={},this._indicesForCamera={},this._postProcesses={}}return Object.defineProperty(e.prototype,\"isSupported\",{get:function(){for(var e in this._postProcesses)if(Object.prototype.hasOwnProperty.call(this._postProcesses,e))for(var t=this._postProcesses[e],i=0;i\\nvarying vec2 vUV;\\nuniform sampler2D textureSampler;\\nuniform float threshold;\\nuniform float exposure;\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void) \\n{\\ngl_FragColor=texture2D(textureSampler,vUV);\\nfloat luma=dot(LuminanceEncodeApprox,gl_FragColor.rgb*exposure);\\ngl_FragColor.rgb=step(threshold,luma)*gl_FragColor.rgb;\\n}\";var ob=function(e){function t(t,i,n,r,o,s,l,c){void 0===l&&(l=a.TEXTURETYPE_UNSIGNED_INT),void 0===c&&(c=!1);var u=e.call(this,t,\"extractHighlights\",[\"threshold\",\"exposure\"],null,i,n,r,o,s,null,l,void 0,null,c)||this;return u.threshold=.9,u._exposure=1,u._inputPostProcess=null,u.onApplyObservable.add((function(e){u.externalTextureSamplerBinding=!!u._inputPostProcess,u._inputPostProcess&&e.setTextureFromPostProcess(\"textureSampler\",u._inputPostProcess),e.setFloat(\"threshold\",Math.pow(u.threshold,d)),e.setFloat(\"exposure\",u._exposure)})),u}return V(t,e),t.prototype.getClassName=function(){return\"ExtractHighlightsPostProcess\"},G([be()],t.prototype,\"threshold\",void 0),t}(pa);b(\"BABYLON.ExtractHighlightsPostProcess\",ob);It.ShadersStore.bloomMergePixelShader=\"uniform sampler2D textureSampler;\\nuniform sampler2D bloomBlur;\\nvarying vec2 vUV;\\nuniform float bloomWeight;\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void)\\n{\\ngl_FragColor=texture2D(textureSampler,vUV);\\nvec3 blurred=texture2D(bloomBlur,vUV).rgb;\\ngl_FragColor.rgb=gl_FragColor.rgb+(blurred.rgb*bloomWeight); \\n}\\n\";var ab=function(e){function t(t,i,n,r,o,s,l,c,u,h,d){void 0===h&&(h=a.TEXTURETYPE_UNSIGNED_INT),void 0===d&&(d=!1);var p=e.call(this,t,\"bloomMerge\",[\"bloomWeight\"],[\"bloomBlur\"],o,s,l,c,u,null,h,void 0,null,!0)||this;return p.weight=1,p.weight=r,p.externalTextureSamplerBinding=!0,p.onApplyObservable.add((function(e){e.setTextureFromPostProcess(\"textureSampler\",i),e.setTextureFromPostProcessOutput(\"bloomBlur\",n),e.setFloat(\"bloomWeight\",p.weight)})),d||p.updateEffect(),p}return V(t,e),t.prototype.getClassName=function(){return\"BloomMergePostProcess\"},G([be()],t.prototype,\"weight\",void 0),t}(pa);b(\"BABYLON.BloomMergePostProcess\",ab);var sb=function(e){function t(t,i,n,r,o,a){void 0===o&&(o=0),void 0===a&&(a=!1);var s=e.call(this,t.getEngine(),\"bloom\",(function(){return s._effects}),!0)||this;return s._bloomScale=i,s._effects=[],s._downscale=new ob(\"highlights\",1,null,to.BILINEAR_SAMPLINGMODE,t.getEngine(),!1,o,a),s._blurX=new zp(\"horizontal blur\",new R(1,0),10,i,null,to.BILINEAR_SAMPLINGMODE,t.getEngine(),!1,o,void 0,a),s._blurX.alwaysForcePOT=!0,s._blurX.autoClear=!1,s._blurY=new zp(\"vertical blur\",new R(0,1),10,i,null,to.BILINEAR_SAMPLINGMODE,t.getEngine(),!1,o,void 0,a),s._blurY.alwaysForcePOT=!0,s._blurY.autoClear=!1,s.kernel=r,s._effects=[s._downscale,s._blurX,s._blurY],s._merge=new ab(\"bloomMerge\",s._downscale,s._blurY,n,i,null,to.BILINEAR_SAMPLINGMODE,t.getEngine(),!1,o,a),s._merge.autoClear=!1,s._effects.push(s._merge),s}return V(t,e),Object.defineProperty(t.prototype,\"threshold\",{get:function(){return this._downscale.threshold},set:function(e){this._downscale.threshold=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"weight\",{get:function(){return this._merge.weight},set:function(e){this._merge.weight=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"kernel\",{get:function(){return this._blurX.kernel/this._bloomScale},set:function(e){this._blurX.kernel=e*this._bloomScale,this._blurY.kernel=e*this._bloomScale},enumerable:!1,configurable:!0}),t.prototype.disposeEffects=function(e){for(var t=0;t0\\nuniform sampler2D blurStep1;\\n#endif\\n#if BLUR_LEVEL>1\\nuniform sampler2D blurStep2;\\n#endif\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void)\\n{\\nfloat coc=texture2D(circleOfConfusionSampler,vUV).r;\\n#if BLUR_LEVEL==0\\nvec4 original=texture2D(textureSampler,vUV);\\nvec4 blurred0=texture2D(blurStep0,vUV);\\ngl_FragColor=mix(original,blurred0,coc);\\n#endif\\n#if BLUR_LEVEL==1\\nif(coc<0.5){\\nvec4 original=texture2D(textureSampler,vUV);\\nvec4 blurred1=texture2D(blurStep1,vUV);\\ngl_FragColor=mix(original,blurred1,coc/0.5);\\n}else{\\nvec4 blurred0=texture2D(blurStep0,vUV); \\nvec4 blurred1=texture2D(blurStep1,vUV);\\ngl_FragColor=mix(blurred1,blurred0,(coc-0.5)/0.5);\\n}\\n#endif\\n#if BLUR_LEVEL==2\\nif(coc<0.33){\\nvec4 original=texture2D(textureSampler,vUV);\\nvec4 blurred2=texture2D(blurStep2,vUV);\\ngl_FragColor=mix(original,blurred2,coc/0.33);\\n}else if(coc<0.66){\\nvec4 blurred1=texture2D(blurStep1,vUV);\\nvec4 blurred2=texture2D(blurStep2,vUV);\\ngl_FragColor=mix(blurred2,blurred1,(coc-0.33)/0.33);\\n}else{\\nvec4 blurred0=texture2D(blurStep0,vUV);\\nvec4 blurred1=texture2D(blurStep1,vUV);\\ngl_FragColor=mix(blurred1,blurred0,(coc-0.66)/0.34);\\n}\\n#endif\\n}\\n\";var pb,fb=function(){},_b=function(e){function t(t,i,n,r,o,s,l,c,u,h,d){void 0===h&&(h=a.TEXTURETYPE_UNSIGNED_INT),void 0===d&&(d=!1);var p=e.call(this,t,\"depthOfFieldMerge\",[],[\"circleOfConfusionSampler\",\"blurStep0\",\"blurStep1\",\"blurStep2\"],o,s,l,c,u,null,h,void 0,null,!0)||this;return p._blurSteps=r,p.externalTextureSamplerBinding=!0,p.onApplyObservable.add((function(e){e.setTextureFromPostProcess(\"textureSampler\",i),e.setTextureFromPostProcessOutput(\"circleOfConfusionSampler\",n),r.forEach((function(t,i){e.setTextureFromPostProcessOutput(\"blurStep\"+(r.length-i-1),t)}))})),d||p.updateEffect(),p}return V(t,e),t.prototype.getClassName=function(){return\"DepthOfFieldMergePostProcess\"},t.prototype.updateEffect=function(t,i,n,r,o,a){void 0===t&&(t=null),void 0===i&&(i=null),void 0===n&&(n=null),t||(t=\"\",t+=\"#define BLUR_LEVEL \"+(this._blurSteps.length-1)+\"\\n\"),e.prototype.updateEffect.call(this,t,i,n,r,o,a)},t}(pa);!function(e){e[e.Low=0]=\"Low\",e[e.Medium=1]=\"Medium\",e[e.High=2]=\"High\"}(pb||(pb={}));var mb=function(e){function t(t,i,n,r,o){void 0===n&&(n=pb.Low),void 0===r&&(r=0),void 0===o&&(o=!1);var a=e.call(this,t.getEngine(),\"depth of field\",(function(){return a._effects}),!0)||this;a._effects=[],a._circleOfConfusion=new cb(\"circleOfConfusion\",i,1,null,to.BILINEAR_SAMPLINGMODE,t.getEngine(),!1,r,o),a._depthOfFieldBlurY=[],a._depthOfFieldBlurX=[];var s=1,l=15;switch(n){case pb.High:s=3,l=51;break;case pb.Medium:s=2,l=31;break;default:l=15,s=1}for(var c=l/Math.pow(2,s-1),u=1,h=0;h=edgeVert;\\nfloat subpixA=subpixNSWE*2.0+subpixNWSWNESE;\\nif (!horzSpan)\\n{\\nlumaN=lumaW;\\n}\\nif (!horzSpan) \\n{\\nlumaS=lumaE;\\n}\\nif (horzSpan) \\n{\\nlengthSign=texelSize.y;\\n}\\nfloat subpixB=(subpixA*(1.0/12.0))-lumaM;\\nfloat gradientN=lumaN-lumaM;\\nfloat gradientS=lumaS-lumaM;\\nfloat lumaNN=lumaN+lumaM;\\nfloat lumaSS=lumaS+lumaM;\\nbool pairN=abs(gradientN)>=abs(gradientS);\\nfloat gradient=max(abs(gradientN),abs(gradientS));\\nif (pairN)\\n{\\nlengthSign=-lengthSign;\\n}\\nfloat subpixC=clamp(abs(subpixB)*subpixRcpRange,0.0,1.0);\\nvec2 posB;\\nposB.x=posM.x;\\nposB.y=posM.y;\\nvec2 offNP;\\noffNP.x=(!horzSpan) ? 0.0 : texelSize.x;\\noffNP.y=(horzSpan) ? 0.0 : texelSize.y;\\nif (!horzSpan) \\n{\\nposB.x+=lengthSign*0.5;\\n}\\nif (horzSpan)\\n{\\nposB.y+=lengthSign*0.5;\\n}\\nvec2 posN;\\nposN.x=posB.x-offNP.x*1.5;\\nposN.y=posB.y-offNP.y*1.5;\\nvec2 posP;\\nposP.x=posB.x+offNP.x*1.5;\\nposP.y=posB.y+offNP.y*1.5;\\nfloat subpixD=((-2.0)*subpixC)+3.0;\\nfloat lumaEndN=FxaaLuma(texture2D(textureSampler,posN,0.0));\\nfloat subpixE=subpixC*subpixC;\\nfloat lumaEndP=FxaaLuma(texture2D(textureSampler,posP,0.0));\\nif (!pairN) \\n{\\nlumaNN=lumaSS;\\n}\\nfloat gradientScaled=gradient*1.0/4.0;\\nfloat lumaMM=lumaM-lumaNN*0.5;\\nfloat subpixF=subpixD*subpixE;\\nbool lumaMLTZero=lumaMM<0.0;\\nlumaEndN-=lumaNN*0.5;\\nlumaEndP-=lumaNN*0.5;\\nbool doneN=abs(lumaEndN)>=gradientScaled;\\nbool doneP=abs(lumaEndP)>=gradientScaled;\\nif (!doneN) \\n{\\nposN.x-=offNP.x*3.0;\\n}\\nif (!doneN) \\n{\\nposN.y-=offNP.y*3.0;\\n}\\nbool doneNP=(!doneN) || (!doneP);\\nif (!doneP) \\n{\\nposP.x+=offNP.x*3.0;\\n}\\nif (!doneP)\\n{\\nposP.y+=offNP.y*3.0;\\n}\\nif (doneNP)\\n{\\nif (!doneN) lumaEndN=FxaaLuma(texture2D(textureSampler,posN.xy,0.0));\\nif (!doneP) lumaEndP=FxaaLuma(texture2D(textureSampler,posP.xy,0.0));\\nif (!doneN) lumaEndN=lumaEndN-lumaNN*0.5;\\nif (!doneP) lumaEndP=lumaEndP-lumaNN*0.5;\\ndoneN=abs(lumaEndN)>=gradientScaled;\\ndoneP=abs(lumaEndP)>=gradientScaled;\\nif (!doneN) posN.x-=offNP.x*12.0;\\nif (!doneN) posN.y-=offNP.y*12.0;\\ndoneNP=(!doneN) || (!doneP);\\nif (!doneP) posP.x+=offNP.x*12.0;\\nif (!doneP) posP.y+=offNP.y*12.0;\\n}\\nfloat dstN=posM.x-posN.x;\\nfloat dstP=posP.x-posM.x;\\nif (!horzSpan)\\n{\\ndstN=posM.y-posN.y;\\n}\\nif (!horzSpan) \\n{\\ndstP=posP.y-posM.y;\\n}\\nbool goodSpanN=(lumaEndN<0.0) != lumaMLTZero;\\nfloat spanLength=(dstP+dstN);\\nbool goodSpanP=(lumaEndP<0.0) != lumaMLTZero;\\nfloat spanLengthRcp=1.0/spanLength;\\nbool directionN=dstN-1?\"#define MALI 1\\n\":null},t._Parse=function(e,i,n,r){return Le.Parse((function(){return new t(e.name,e.options,i,e.renderTargetSamplingMode,n.getEngine(),e.reusable)}),e,n,r)},t}(pa);b(\"BABYLON.FxaaPostProcess\",yb);It.ShadersStore.grainPixelShader=\"#include\\nuniform sampler2D textureSampler; \\nuniform float intensity;\\nuniform float animatedSeed;\\nvarying vec2 vUV;\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void)\\n{\\ngl_FragColor=texture2D(textureSampler,vUV);\\nvec2 seed=vUV*(animatedSeed);\\nfloat grain=dither(seed,intensity);\\nfloat lum=getLuminance(gl_FragColor.rgb);\\nfloat grainAmount=(cos(-PI+(lum*PI*2.))+1.)/2.;\\ngl_FragColor.rgb+=grain*grainAmount;\\ngl_FragColor.rgb=max(gl_FragColor.rgb,0.0);\\n}\";var bb=function(e){function t(t,i,n,r,o,s,l,c){void 0===l&&(l=a.TEXTURETYPE_UNSIGNED_INT),void 0===c&&(c=!1);var u=e.call(this,t,\"grain\",[\"intensity\",\"animatedSeed\"],[],i,n,r,o,s,null,l,void 0,null,c)||this;return u.intensity=30,u.animated=!1,u.onApplyObservable.add((function(e){e.setFloat(\"intensity\",u.intensity),e.setFloat(\"animatedSeed\",u.animated?Math.random()+1:1)})),u}return V(t,e),t.prototype.getClassName=function(){return\"GrainPostProcess\"},t._Parse=function(e,i,n,r){return Le.Parse((function(){return new t(e.name,e.options,i,e.renderTargetSamplingMode,n.getEngine(),e.reusable)}),e,n,r)},G([be()],t.prototype,\"intensity\",void 0),G([be()],t.prototype,\"animated\",void 0),t}(pa);b(\"BABYLON.GrainPostProcess\",bb);It.ShadersStore.highlightsPixelShader=\"varying vec2 vUV;\\nuniform sampler2D textureSampler;\\nconst vec3 RGBLuminanceCoefficients=vec3(0.2126,0.7152,0.0722);\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void) \\n{\\nvec4 tex=texture2D(textureSampler,vUV);\\nvec3 c=tex.rgb;\\nfloat luma=dot(c.rgb,RGBLuminanceCoefficients);\\ngl_FragColor=vec4(pow(c,vec3(25.0-luma*15.0)),tex.a); \\n}\";var Tb=function(e){function t(t,i,n,r,o,s,l){return void 0===l&&(l=a.TEXTURETYPE_UNSIGNED_INT),e.call(this,t,\"highlights\",null,null,i,n,r,o,s,null,l)||this}return V(t,e),t.prototype.getClassName=function(){return\"HighlightsPostProcess\"},t}(pa);It.IncludesShadersStore.mrtFragmentDeclaration=\"#if defined(WEBGL2) || defined(WEBGPU)\\nlayout(location=0) out vec4 glFragData[{X}];\\n#endif\\n\";It.ShadersStore.geometryPixelShader=\"#extension GL_EXT_draw_buffers : require\\n#if defined(BUMP) || !defined(NORMAL)\\n#extension GL_OES_standard_derivatives : enable\\n#endif\\nprecision highp float;\\n#ifdef BUMP\\nvarying mat4 vWorldView;\\nvarying vec3 vNormalW;\\n#else\\nvarying vec3 vNormalV;\\n#endif\\nvarying vec4 vViewPos;\\n#if defined(POSITION) || defined(BUMP)\\nvarying vec3 vPositionW;\\n#endif\\n#ifdef VELOCITY\\nvarying vec4 vCurrentPosition;\\nvarying vec4 vPreviousPosition;\\n#endif\\n#ifdef NEED_UV\\nvarying vec2 vUV;\\n#endif\\n#ifdef BUMP\\nuniform vec3 vBumpInfos;\\nuniform vec2 vTangentSpaceParams;\\n#endif\\n#if defined(REFLECTIVITY)\\n#if defined(ORMTEXTURE) || defined(SPECULARGLOSSINESSTEXTURE) || defined(REFLECTIVITYTEXTURE)\\nuniform sampler2D reflectivitySampler;\\nvarying vec2 vReflectivityUV;\\n#endif\\n#ifdef ALBEDOTEXTURE\\nvarying vec2 vAlbedoUV;\\nuniform sampler2D albedoSampler;\\n#endif\\n#ifdef REFLECTIVITYCOLOR\\nuniform vec3 reflectivityColor;\\n#endif\\n#ifdef ALBEDOCOLOR\\nuniform vec3 albedoColor;\\n#endif\\n#ifdef METALLIC\\nuniform float metallic;\\n#endif\\n#ifdef ROUGHNESS\\nuniform float glossiness;\\n#endif\\n#endif\\n#ifdef ALPHATEST\\nuniform sampler2D diffuseSampler;\\n#endif\\n#include[RENDER_TARGET_COUNT]\\n#include\\n#include\\n#include\\nvoid main() {\\n#ifdef ALPHATEST\\nif (texture2D(diffuseSampler,vUV).a<0.4)\\ndiscard;\\n#endif\\nvec3 normalOutput;\\n#ifdef BUMP\\nvec3 normalW=normalize(vNormalW);\\n#include\\nnormalOutput=normalize(vec3(vWorldView*vec4(normalW,0.0)));\\n#else\\nnormalOutput=normalize(vNormalV);\\n#endif\\n#ifdef PREPASS\\n#ifdef PREPASS_DEPTH\\ngl_FragData[DEPTH_INDEX]=vec4(vViewPos.z/vViewPos.w,0.0,0.0,1.0);\\n#endif\\n#ifdef PREPASS_NORMAL\\ngl_FragData[NORMAL_INDEX]=vec4(normalOutput,1.0);\\n#endif\\n#else\\ngl_FragData[0]=vec4(vViewPos.z/vViewPos.w,0.0,0.0,1.0);\\ngl_FragData[1]=vec4(normalOutput,1.0);\\n#endif\\n#ifdef POSITION\\ngl_FragData[POSITION_INDEX]=vec4(vPositionW,1.0);\\n#endif\\n#ifdef VELOCITY\\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;\\nvec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;\\nvec2 velocity=abs(a-b);\\nvelocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;\\ngl_FragData[VELOCITY_INDEX]=vec4(velocity,0.0,1.0);\\n#endif\\n#ifdef REFLECTIVITY\\nvec4 reflectivity=vec4(1.0,1.0,1.0,1.0);\\n#ifdef METALLICWORKFLOW\\nfloat metal=1.0;\\nfloat roughness=1.0;\\n#ifdef ORMTEXTURE\\nmetal*=texture2D(reflectivitySampler,vReflectivityUV).b;\\nroughness*=texture2D(reflectivitySampler,vReflectivityUV).g;\\n#endif\\n#ifdef METALLIC\\nmetal*=metallic;\\n#endif\\n#ifdef ROUGHNESS\\nroughness*=(1.0-glossiness); \\n#endif\\nreflectivity.a-=roughness;\\nvec3 color=vec3(1.0);\\n#ifdef ALBEDOTEXTURE\\ncolor=texture2D(albedoSampler,vAlbedoUV).rgb;\\n#ifdef GAMMAALBEDO\\ncolor=toLinearSpace(color);\\n#endif\\n#endif\\n#ifdef ALBEDOCOLOR\\ncolor*=albedoColor.xyz;\\n#endif\\nreflectivity.rgb=mix(vec3(0.04),color,metal);\\n#else\\n#ifdef SPECULARGLOSSINESSTEXTURE\\nreflectivity=texture2D(reflectivitySampler,vReflectivityUV);\\n#ifdef GAMMAREFLECTIVITYTEXTURE\\nreflectivity.rgb=toLinearSpace(reflectivity.rgb);\\n#endif\\n#ifdef GLOSSINESSS\\nreflectivity.a*=glossiness;\\n#endif\\n#else \\n#ifdef REFLECTIVITYTEXTURE\\nreflectivity.rbg=texture2D(reflectivitySampler,vReflectivityUV).rbg;\\n#ifdef GAMMAREFLECTIVITYTEXTURE\\nreflectivity.rgb=toLinearSpace(reflectivity.rgb);\\n#endif\\n#else\\n#ifdef REFLECTIVITYCOLOR\\nreflectivity.rgb=reflectivityColor.xyz;\\nreflectivity.a=1.0;\\n#endif\\n#endif \\n#ifdef GLOSSINESSS\\nreflectivity.a=glossiness; \\n#else\\nreflectivity.a=1.0; \\n#endif\\n#endif\\n#endif\\nreflectivity.rgb=toGammaSpace(reflectivity.rgb); \\ngl_FragData[REFLECTIVITY_INDEX]=reflectivity;\\n#endif\\n}\\n\";It.IncludesShadersStore.geometryVertexDeclaration=\"uniform mat4 viewProjection;\\nuniform mat4 view;\";It.IncludesShadersStore.geometryUboDeclaration=\"#include\\n\";It.ShadersStore.geometryVertexShader=\"precision highp float;\\n#include\\n#include\\n#include\\n#include[0..maxSimultaneousMorphTargets]\\n#include\\n#include<__decl__geometryVertex>\\nattribute vec3 position;\\nattribute vec3 normal;\\n#ifdef NEED_UV\\nvarying vec2 vUV;\\n#ifdef ALPHATEST\\nuniform mat4 diffuseMatrix;\\n#endif\\n#ifdef BUMP\\nuniform mat4 bumpMatrix;\\nvarying vec2 vBumpUV;\\n#endif\\n#ifdef REFLECTIVITY\\nuniform mat4 reflectivityMatrix;\\nuniform mat4 albedoMatrix;\\nvarying vec2 vReflectivityUV;\\nvarying vec2 vAlbedoUV;\\n#endif\\n#ifdef UV1\\nattribute vec2 uv;\\n#endif\\n#ifdef UV2\\nattribute vec2 uv2;\\n#endif\\n#endif\\n#ifdef BUMP\\nvarying mat4 vWorldView;\\n#endif\\n#ifdef BUMP\\nvarying vec3 vNormalW;\\n#else\\nvarying vec3 vNormalV;\\n#endif\\nvarying vec4 vViewPos;\\n#if defined(POSITION) || defined(BUMP)\\nvarying vec3 vPositionW;\\n#endif\\n#ifdef VELOCITY\\nuniform mat4 previousViewProjection;\\nvarying vec4 vCurrentPosition;\\nvarying vec4 vPreviousPosition;\\n#endif\\n#define CUSTOM_VERTEX_DEFINITIONS\\nvoid main(void)\\n{\\nvec3 positionUpdated=position;\\nvec3 normalUpdated=normal;\\n#ifdef UV1\\nvec2 uvUpdated=uv;\\n#endif\\n#include\\n#include[0..maxSimultaneousMorphTargets]\\n#include\\n#if defined(VELOCITY) && !defined(BONES_VELOCITY_ENABLED)\\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\\nvPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0);\\n#endif\\n#include\\n#include\\nvec4 pos=vec4(finalWorld*vec4(positionUpdated,1.0));\\n#ifdef BUMP\\nvWorldView=view*finalWorld;\\nvNormalW=normalUpdated;\\n#else\\nvNormalV=normalize(vec3((view*finalWorld)*vec4(normalUpdated,0.0)));\\n#endif\\nvViewPos=view*pos;\\n#if defined(VELOCITY) && defined(BONES_VELOCITY_ENABLED)\\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\\n#if NUM_BONE_INFLUENCERS>0\\nmat4 previousInfluence;\\npreviousInfluence=mPreviousBones[int(matricesIndices[0])]*matricesWeights[0];\\n#if NUM_BONE_INFLUENCERS>1\\npreviousInfluence+=mPreviousBones[int(matricesIndices[1])]*matricesWeights[1];\\n#endif\\n#if NUM_BONE_INFLUENCERS>2\\npreviousInfluence+=mPreviousBones[int(matricesIndices[2])]*matricesWeights[2];\\n#endif\\n#if NUM_BONE_INFLUENCERS>3\\npreviousInfluence+=mPreviousBones[int(matricesIndices[3])]*matricesWeights[3];\\n#endif\\n#if NUM_BONE_INFLUENCERS>4\\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\\n#endif\\n#if NUM_BONE_INFLUENCERS>5\\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\\n#endif\\n#if NUM_BONE_INFLUENCERS>6\\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\\n#endif\\n#if NUM_BONE_INFLUENCERS>7\\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\\n#endif\\nvPreviousPosition=previousViewProjection*finalPreviousWorld*previousInfluence*vec4(positionUpdated,1.0);\\n#else\\nvPreviousPosition=previousViewProjection*finalPreviousWorld*vec4(positionUpdated,1.0);\\n#endif\\n#endif\\n#if defined(POSITION) || defined(BUMP)\\nvPositionW=pos.xyz/pos.w;\\n#endif\\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\\n#ifdef NEED_UV\\n#ifdef UV1\\n#if defined(ALPHATEST) && defined(ALPHATEST_UV1)\\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\\n#else\\nvUV=uv;\\n#endif\\n#ifdef BUMP_UV1\\nvBumpUV=vec2(bumpMatrix*vec4(uvUpdated,1.0,0.0));\\n#endif\\n#ifdef REFLECTIVITY_UV1\\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uvUpdated,1.0,0.0));\\n#endif\\n#ifdef ALBEDO_UV1\\nvAlbedoUV=vec2(albedoMatrix*vec4(uvUpdated,1.0,0.0));\\n#endif\\n#endif\\n#ifdef UV2\\n#if defined(ALPHATEST) && defined(ALPHATEST_UV2)\\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\\n#else\\nvUV=uv2;\\n#endif\\n#ifdef BUMP_UV2\\nvBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));\\n#endif\\n#ifdef REFLECTIVITY_UV2\\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uv2,1.0,0.0));\\n#endif\\n#ifdef ALBEDO_UV2\\nvAlbedoUV=vec2(albedoMatrix*vec4(uv2,1.0,0.0));\\n#endif\\n#endif\\n#endif\\n#include\\n}\\n\";var Eb=function(){function e(t,i,n){void 0===i&&(i=1),void 0===n&&(n=a.TEXTUREFORMAT_DEPTH16),this._previousTransformationMatrices={},this._previousBonesTransformationMatrices={},this.excludedSkinnedMeshesFromVelocity=[],this.renderTransparentMeshes=!0,this._resizeObserver=null,this._enablePosition=!1,this._enableVelocity=!1,this._enableReflectivity=!1,this._positionIndex=-1,this._velocityIndex=-1,this._reflectivityIndex=-1,this._depthIndex=-1,this._normalIndex=-1,this._linkedWithPrePass=!1,this._scene=t,this._ratio=i,this._useUbo=t.getEngine().supportsUniformBuffers,this._depthFormat=n,e._SceneComponentInitialization(this._scene),this._createRenderTargets()}return e.prototype._linkPrePassRenderer=function(e){this._linkedWithPrePass=!0,this._prePassRenderer=e,this._multiRenderTarget&&(this._multiRenderTarget.onClearObservable.clear(),this._multiRenderTarget.onClearObservable.add((function(){})))},e.prototype._unlinkPrePassRenderer=function(){this._linkedWithPrePass=!1,this._createRenderTargets()},e.prototype._resetLayout=function(){this._enablePosition=!1,this._enableReflectivity=!1,this._enableVelocity=!1,this._attachments=[]},e.prototype._forceTextureType=function(t,i){t===e.POSITION_TEXTURE_TYPE?(this._positionIndex=i,this._enablePosition=!0):t===e.VELOCITY_TEXTURE_TYPE?(this._velocityIndex=i,this._enableVelocity=!0):t===e.REFLECTIVITY_TEXTURE_TYPE?(this._reflectivityIndex=i,this._enableReflectivity=!0):t===e.DEPTH_TEXTURE_TYPE?this._depthIndex=i:t===e.NORMAL_TEXTURE_TYPE&&(this._normalIndex=i)},e.prototype._setAttachments=function(e){this._attachments=e},e.prototype._linkInternalTexture=function(e){this._multiRenderTarget.setInternalTexture(e,0,!1)},Object.defineProperty(e.prototype,\"renderList\",{get:function(){return this._multiRenderTarget.renderList},set:function(e){this._multiRenderTarget.renderList=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"isSupported\",{get:function(){return this._multiRenderTarget.isSupported},enumerable:!1,configurable:!0}),e.prototype.getTextureIndex=function(t){switch(t){case e.POSITION_TEXTURE_TYPE:return this._positionIndex;case e.VELOCITY_TEXTURE_TYPE:return this._velocityIndex;case e.REFLECTIVITY_TEXTURE_TYPE:return this._reflectivityIndex;default:return-1}},Object.defineProperty(e.prototype,\"enablePosition\",{get:function(){return this._enablePosition},set:function(e){this._enablePosition=e,this._linkedWithPrePass||(this.dispose(),this._createRenderTargets())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"enableVelocity\",{get:function(){return this._enableVelocity},set:function(e){this._enableVelocity=e,e||(this._previousTransformationMatrices={}),this._linkedWithPrePass||(this.dispose(),this._createRenderTargets()),this._scene.needsPreviousWorldMatrices=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"enableReflectivity\",{get:function(){return this._enableReflectivity},set:function(e){this._enableReflectivity=e,this._linkedWithPrePass||(this.dispose(),this._createRenderTargets())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"scene\",{get:function(){return this._scene},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"ratio\",{get:function(){return this._ratio},enumerable:!1,configurable:!0}),e.prototype.isReady=function(e,t){var i=e.getMaterial();if(i&&i.disableDepthWrite)return!1;var n=[],r=[wi.PositionKind,wi.NormalKind],o=e.getMesh();if(i){var a=!1;if(i.needAlphaTesting()&&i.getAlphaTestTexture()&&(n.push(\"#define ALPHATEST\"),n.push(\"#define ALPHATEST_UV\".concat(i.getAlphaTestTexture().coordinatesIndex+1)),a=!0),i.bumpTexture&&Nl.BumpTextureEnabled&&(n.push(\"#define BUMP\"),n.push(\"#define BUMP_UV\".concat(i.bumpTexture.coordinatesIndex+1)),a=!0),this._enableReflectivity){var s=!1;\"PBRMetallicRoughnessMaterial\"===i.getClassName()?(null!==i.metallicRoughnessTexture&&(n.push(\"#define ORMTEXTURE\"),n.push(\"#define REFLECTIVITY_UV\".concat(i.metallicRoughnessTexture.coordinatesIndex+1)),n.push(\"#define METALLICWORKFLOW\"),a=!0,s=!0),null!==i.metallic&&(n.push(\"#define METALLIC\"),n.push(\"#define METALLICWORKFLOW\"),s=!0),null!==i.roughness&&(n.push(\"#define ROUGHNESS\"),n.push(\"#define METALLICWORKFLOW\"),s=!0),s&&(null!==i.baseTexture&&(n.push(\"#define ALBEDOTEXTURE\"),n.push(\"#define ALBEDO_UV\".concat(i.baseTexture.coordinatesIndex+1)),i.baseTexture.gammaSpace&&n.push(\"#define GAMMAALBEDO\"),a=!0),null!==i.baseColor&&n.push(\"#define ALBEDOCOLOR\"))):\"PBRSpecularGlossinessMaterial\"===i.getClassName()?(null!==i.specularGlossinessTexture?(n.push(\"#define SPECULARGLOSSINESSTEXTURE\"),n.push(\"#define REFLECTIVITY_UV\".concat(i.specularGlossinessTexture.coordinatesIndex+1)),a=!0,i.specularGlossinessTexture.gammaSpace&&n.push(\"#define GAMMAREFLECTIVITYTEXTURE\")):null!==i.specularColor&&n.push(\"#define REFLECTIVITYCOLOR\"),null!==i.glossiness&&n.push(\"#define GLOSSINESSS\")):\"PBRMaterial\"===i.getClassName()?(null!==i.metallicTexture&&(n.push(\"#define ORMTEXTURE\"),n.push(\"#define REFLECTIVITY_UV\".concat(i.metallicTexture.coordinatesIndex+1)),n.push(\"#define METALLICWORKFLOW\"),a=!0,s=!0),null!==i.metallic&&(n.push(\"#define METALLIC\"),n.push(\"#define METALLICWORKFLOW\"),s=!0),null!==i.roughness&&(n.push(\"#define ROUGHNESS\"),n.push(\"#define METALLICWORKFLOW\"),s=!0),s?(null!==i.albedoTexture&&(n.push(\"#define ALBEDOTEXTURE\"),n.push(\"#define ALBEDO_UV\".concat(i.albedoTexture.coordinatesIndex+1)),i.albedoTexture.gammaSpace&&n.push(\"#define GAMMAALBEDO\"),a=!0),null!==i.albedoColor&&n.push(\"#define ALBEDOCOLOR\")):(null!==i.reflectivityTexture?(n.push(\"#define SPECULARGLOSSINESSTEXTURE\"),n.push(\"#define REFLECTIVITY_UV\".concat(i.reflectivityTexture.coordinatesIndex+1)),i.reflectivityTexture.gammaSpace&&n.push(\"#define GAMMAREFLECTIVITYTEXTURE\"),a=!0):null!==i.reflectivityColor&&n.push(\"#define REFLECTIVITYCOLOR\"),null!==i.microSurface&&n.push(\"#define GLOSSINESSS\"))):\"StandardMaterial\"===i.getClassName()&&(null!==i.specularTexture&&(n.push(\"#define REFLECTIVITYTEXTURE\"),n.push(\"#define REFLECTIVITY_UV\".concat(i.specularTexture.coordinatesIndex+1)),i.specularTexture.gammaSpace&&n.push(\"#define GAMMAREFLECTIVITYTEXTURE\"),a=!0),null!==i.specularColor&&n.push(\"#define REFLECTIVITYCOLOR\"))}a&&(n.push(\"#define NEED_UV\"),o.isVerticesDataPresent(wi.UVKind)&&(r.push(wi.UVKind),n.push(\"#define UV1\")),o.isVerticesDataPresent(wi.UV2Kind)&&(r.push(wi.UV2Kind),n.push(\"#define UV2\")))}this._linkedWithPrePass&&(n.push(\"#define PREPASS\"),-1!==this._depthIndex&&(n.push(\"#define DEPTH_INDEX \"+this._depthIndex),n.push(\"#define PREPASS_DEPTH\")),-1!==this._normalIndex&&(n.push(\"#define NORMAL_INDEX \"+this._normalIndex),n.push(\"#define PREPASS_NORMAL\"))),this._enablePosition&&(n.push(\"#define POSITION\"),n.push(\"#define POSITION_INDEX \"+this._positionIndex)),this._enableVelocity&&(n.push(\"#define VELOCITY\"),n.push(\"#define VELOCITY_INDEX \"+this._velocityIndex),-1===this.excludedSkinnedMeshesFromVelocity.indexOf(o)&&n.push(\"#define BONES_VELOCITY_ENABLED\")),this._enableReflectivity&&(n.push(\"#define REFLECTIVITY\"),n.push(\"#define REFLECTIVITY_INDEX \"+this._reflectivityIndex)),o.useBones&&o.computeBonesUsingShaders?(r.push(wi.MatricesIndicesKind),r.push(wi.MatricesWeightsKind),o.numBoneInfluencers>4&&(r.push(wi.MatricesIndicesExtraKind),r.push(wi.MatricesWeightsExtraKind)),n.push(\"#define NUM_BONE_INFLUENCERS \"+o.numBoneInfluencers),n.push(\"#define BonesPerMesh \"+(o.skeleton?o.skeleton.bones.length+1:0))):n.push(\"#define NUM_BONE_INFLUENCERS 0\");var l=o.morphTargetManager,c=0;l&&l.numInfluencers>0&&(c=l.numInfluencers,n.push(\"#define MORPHTARGETS\"),n.push(\"#define NUM_MORPH_INFLUENCERS \"+c),l.isUsingTextureForTargets&&n.push(\"#define MORPHTARGETS_TEXTURE\"),Pr.PrepareAttributesForMorphTargetsInfluencers(r,o,c)),t&&(n.push(\"#define INSTANCES\"),Pr.PushAttributesForInstances(r,this._enableVelocity),e.getRenderingMesh().hasThinInstances&&n.push(\"#define THIN_INSTANCES\")),this._linkedWithPrePass?n.push(\"#define RENDER_TARGET_COUNT \"+this._attachments.length):n.push(\"#define RENDER_TARGET_COUNT \"+this._multiRenderTarget.textures.length);var u=this._scene.getEngine(),h=e._getDrawWrapper(void 0,!0),d=h.defines,p=n.join(\"\\n\");return d!==p&&h.setEffect(u.createEffect(\"geometry\",{attributes:r,uniformsNames:[\"world\",\"mBones\",\"viewProjection\",\"diffuseMatrix\",\"view\",\"previousWorld\",\"previousViewProjection\",\"mPreviousBones\",\"bumpMatrix\",\"reflectivityMatrix\",\"albedoMatrix\",\"reflectivityColor\",\"albedoColor\",\"metallic\",\"glossiness\",\"vTangentSpaceParams\",\"vBumpInfos\",\"morphTargetInfluences\",\"morphTargetTextureInfo\",\"morphTargetTextureIndices\"],samplers:[\"diffuseSampler\",\"bumpSampler\",\"reflectivitySampler\",\"albedoSampler\",\"morphTargets\"],defines:p,onCompiled:null,fallbacks:null,onError:null,uniformBuffersNames:[\"Scene\"],indexParameters:{buffersCount:this._multiRenderTarget.textures.length-1,maxSimultaneousMorphTargets:c}},u),p),h.effect.isReady()},e.prototype.getGBuffer=function(){return this._multiRenderTarget},Object.defineProperty(e.prototype,\"samples\",{get:function(){return this._multiRenderTarget.samples},set:function(e){this._multiRenderTarget.samples=e},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){this._resizeObserver&&(this._scene.getEngine().onResizeObservable.remove(this._resizeObserver),this._resizeObserver=null),this.getGBuffer().dispose()},e.prototype._assignRenderTargetIndices=function(){var e=[],t=2;return e.push(\"gBuffer_Depth\",\"gBuffer_Normal\"),this._enablePosition&&(this._positionIndex=t,t++,e.push(\"gBuffer_Position\")),this._enableVelocity&&(this._velocityIndex=t,t++,e.push(\"gBuffer_Velocity\")),this._enableReflectivity&&(this._reflectivityIndex=t,t++,e.push(\"gBuffer_Reflectivity\")),[t,e]},e.prototype._createRenderTargets=function(){var e=this,t=this._scene.getEngine(),i=this._assignRenderTargetIndices(),n=i[0],r=i[1],o=a.TEXTURETYPE_UNSIGNED_BYTE;if(t._caps.textureFloat&&t._caps.textureFloatLinearFiltering?o=a.TEXTURETYPE_FLOAT:t._caps.textureHalfFloat&&t._caps.textureHalfFloatLinearFiltering&&(o=a.TEXTURETYPE_HALF_FLOAT),this._multiRenderTarget=new Mm(\"gBuffer\",{width:t.getRenderWidth()*this._ratio,height:t.getRenderHeight()*this._ratio},n,this._scene,{generateMipMaps:!1,generateDepthTexture:!0,defaultType:o,depthTextureFormat:this._depthFormat},r.concat(\"gBuffer_DepthBuffer\")),this.isSupported){this._multiRenderTarget.wrapU=to.CLAMP_ADDRESSMODE,this._multiRenderTarget.wrapV=to.CLAMP_ADDRESSMODE,this._multiRenderTarget.refreshRate=1,this._multiRenderTarget.renderParticles=!1,this._multiRenderTarget.renderList=null,this._multiRenderTarget.onClearObservable.add((function(e){e.clear(new L(0,0,0,0),!0,!0,!0)})),this._resizeObserver=t.onResizeObservable.add((function(){e._multiRenderTarget&&e._multiRenderTarget.resize({width:t.getRenderWidth()*e._ratio,height:t.getRenderHeight()*e._ratio})}));var s=function(t){var i=t.getRenderingMesh(),n=t.getEffectiveMesh(),r=e._scene,o=r.getEngine(),a=t.getMaterial();if(a){if(n._internalAbstractMeshDataInfo._isActiveIntermediate=!1,e._enableVelocity&&!e._previousTransformationMatrices[n.uniqueId]&&(e._previousTransformationMatrices[n.uniqueId]={world:M.Identity(),viewProjection:r.getTransformMatrix()},i.skeleton)){var s=i.skeleton.getTransformMatrices(i);e._previousBonesTransformationMatrices[i.uniqueId]=e._copyBonesTransformationMatrices(s,new Float32Array(s.length))}var l=i._getInstancesRenderList(t._id,!!t.getReplacementMesh());if(!l.mustReturn){var c=o.getCaps().instancedArrays&&(null!==l.visibleInstances[t._id]||i.hasThinInstances),u=n.getWorldMatrix();if(e.isReady(t,c)){var h=t._getDrawWrapper();if(!h)return;var d=h.effect;if(o.enableEffect(h),c||i._bind(t,d,a.fillMode),e._useUbo?(Pr.BindSceneUniformBuffer(d,e._scene.getSceneUniformBuffer()),e._scene.finalizeSceneUbo()):(d.setMatrix(\"viewProjection\",r.getTransformMatrix()),d.setMatrix(\"view\",r.getViewMatrix())),a){var p=void 0,f=i._instanceDataStorage;if(f.isFrozen||!a.backFaceCulling&&null===i.overrideMaterialSideOrientation)p=f.sideOrientation;else{var _=n._getWorldMatrixDeterminant();null===(p=i.overrideMaterialSideOrientation)&&(p=a.sideOrientation),_<0&&(p=p===Ir.ClockWiseSideOrientation?Ir.CounterClockWiseSideOrientation:Ir.ClockWiseSideOrientation)}if(a._preBind(h,p),a.needAlphaTesting()){var m=a.getAlphaTestTexture();m&&(d.setTexture(\"diffuseSampler\",m),d.setMatrix(\"diffuseMatrix\",m.getTextureMatrix()))}a.bumpTexture&&r.getEngine().getCaps().standardDerivatives&&Nl.BumpTextureEnabled&&(d.setFloat3(\"vBumpInfos\",a.bumpTexture.coordinatesIndex,1/a.bumpTexture.level,a.parallaxScaleBias),d.setMatrix(\"bumpMatrix\",a.bumpTexture.getTextureMatrix()),d.setTexture(\"bumpSampler\",a.bumpTexture),d.setFloat2(\"vTangentSpaceParams\",a.invertNormalMapX?-1:1,a.invertNormalMapY?-1:1)),e._enableReflectivity&&(\"PBRMetallicRoughnessMaterial\"===a.getClassName()?(null!==a.metallicRoughnessTexture&&(d.setTexture(\"reflectivitySampler\",a.metallicRoughnessTexture),d.setMatrix(\"reflectivityMatrix\",a.metallicRoughnessTexture.getTextureMatrix())),null!==a.metallic&&d.setFloat(\"metallic\",a.metallic),null!==a.roughness&&d.setFloat(\"glossiness\",1-a.roughness),null!==a.baseTexture&&(d.setTexture(\"albedoSampler\",a.baseTexture),d.setMatrix(\"albedoMatrix\",a.baseTexture.getTextureMatrix())),null!==a.baseColor&&d.setColor3(\"albedoColor\",a.baseColor)):\"PBRSpecularGlossinessMaterial\"===a.getClassName()?(null!==a.specularGlossinessTexture?(d.setTexture(\"reflectivitySampler\",a.specularGlossinessTexture),d.setMatrix(\"reflectivityMatrix\",a.specularGlossinessTexture.getTextureMatrix())):null!==a.specularColor&&d.setColor3(\"reflectivityColor\",a.specularColor),null!==a.glossiness&&d.setFloat(\"glossiness\",a.glossiness)):\"PBRMaterial\"===a.getClassName()?(null!==a.metallicTexture&&(d.setTexture(\"reflectivitySampler\",a.metallicTexture),d.setMatrix(\"reflectivityMatrix\",a.metallicTexture.getTextureMatrix())),null!==a.metallic&&d.setFloat(\"metallic\",a.metallic),null!==a.roughness&&d.setFloat(\"glossiness\",1-a.roughness),null!==a.roughness||null!==a.metallic||null!==a.metallicTexture?(null!==a.albedoTexture&&(d.setTexture(\"albedoSampler\",a.albedoTexture),d.setMatrix(\"albedoMatrix\",a.albedoTexture.getTextureMatrix())),null!==a.albedoColor&&d.setColor3(\"albedoColor\",a.albedoColor)):(null!==a.reflectivityTexture?(d.setTexture(\"reflectivitySampler\",a.reflectivityTexture),d.setMatrix(\"reflectivityMatrix\",a.reflectivityTexture.getTextureMatrix())):null!==a.reflectivityColor&&d.setColor3(\"reflectivityColor\",a.reflectivityColor),null!==a.microSurface&&d.setFloat(\"glossiness\",a.microSurface))):\"StandardMaterial\"===a.getClassName()&&(null!==a.specularTexture&&(d.setTexture(\"reflectivitySampler\",a.specularTexture),d.setMatrix(\"reflectivityMatrix\",a.specularTexture.getTextureMatrix())),null!==a.specularColor&&d.setColor3(\"reflectivityColor\",a.specularColor)))}i.useBones&&i.computeBonesUsingShaders&&i.skeleton&&(d.setMatrices(\"mBones\",i.skeleton.getTransformMatrices(i)),e._enableVelocity&&d.setMatrices(\"mPreviousBones\",e._previousBonesTransformationMatrices[i.uniqueId])),Pr.BindMorphTargetParameters(i,d),i.morphTargetManager&&i.morphTargetManager.isUsingTextureForTargets&&i.morphTargetManager._bind(d),e._enableVelocity&&(d.setMatrix(\"previousWorld\",e._previousTransformationMatrices[n.uniqueId].world),d.setMatrix(\"previousViewProjection\",e._previousTransformationMatrices[n.uniqueId].viewProjection)),c&&i.hasThinInstances&&d.setMatrix(\"world\",u),i._processRendering(n,t,d,a.fillMode,l,c,(function(e,t){e||d.setMatrix(\"world\",t)}))}e._enableVelocity&&(e._previousTransformationMatrices[n.uniqueId].world=u.clone(),e._previousTransformationMatrices[n.uniqueId].viewProjection=e._scene.getTransformMatrix().clone(),i.skeleton&&e._copyBonesTransformationMatrices(i.skeleton.getTransformMatrices(i),e._previousBonesTransformationMatrices[n.uniqueId]))}}};this._multiRenderTarget.customIsReadyFunction=function(i,n){if(!i.isReady(!1))return!1;if(0===n&&i.subMeshes)for(var r=0;r=samplesCount)\\nbreak;\\nvec2 offset=vUV+velocity*(hlim+float(i));\\nresult+=texture2D(textureSampler,offset);\\n}\\ngl_FragColor=result/float(samplesCount);\\ngl_FragColor.a=1.0;\\n#else\\nvec2 texelSize=1.0/screenSize;\\nfloat depth=texture2D(depthSampler,vUV).r;\\nvec4 cpos=vec4(vUV*2.0-1.0,depth,1.0);\\ncpos=cpos*inverseViewProjection;\\nvec4 ppos=cpos*prevViewProjection;\\nppos.xyz/=ppos.w;\\nppos.xy=ppos.xy*0.5+0.5;\\nvec2 velocity=(ppos.xy-vUV)*motionScale*motionStrength;\\nfloat speed=length(velocity/texelSize);\\nint nSamples=int(clamp(speed,1.0,SAMPLES));\\nvec4 result=texture2D(textureSampler,vUV);\\nfor (int i=1; i=nSamples)\\nbreak;\\nvec2 offset1=vUV+velocity*(float(i)/float(nSamples-1)-0.5);\\nresult+=texture2D(textureSampler,offset1);\\n}\\ngl_FragColor=result/float(nSamples);\\n#endif\\n#else\\ngl_FragColor=texture2D(textureSampler,vUV);\\n#endif\\n}\\n\";var Rb=function(e){function t(t,i,n,r,o,s,l,c,u,h){void 0===c&&(c=a.TEXTURETYPE_UNSIGNED_INT),void 0===u&&(u=!1),void 0===h&&(h=!1);var d=e.call(this,t,\"motionBlur\",[\"motionStrength\",\"motionScale\",\"screenSize\",\"inverseViewProjection\",\"prevViewProjection\"],[\"velocitySampler\"],n,r,o,s,l,\"#define GEOMETRY_SUPPORTED\\n#define SAMPLES 64.0\\n#define OBJECT_BASED\",c,void 0,null,u)||this;return d.motionStrength=1,d._motionBlurSamples=32,d._isObjectBased=!0,d._forceGeometryBuffer=!1,d._invViewProjection=null,d._previousViewProjection=null,d._forceGeometryBuffer=h,d._forceGeometryBuffer?(i.enableGeometryBufferRenderer(),d._geometryBufferRenderer&&(d._geometryBufferRenderer.enableVelocity=!0)):(i.enablePrePassRenderer(),d._prePassRenderer&&(d._prePassRenderer.markAsDirty(),d._prePassEffectConfiguration=new Sb)),d._applyMode(),d}return V(t,e),Object.defineProperty(t.prototype,\"motionBlurSamples\",{get:function(){return this._motionBlurSamples},set:function(e){this._motionBlurSamples=e,this._updateEffect()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"isObjectBased\",{get:function(){return this._isObjectBased},set:function(e){this._isObjectBased!==e&&(this._isObjectBased=e,this._applyMode())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"_geometryBufferRenderer\",{get:function(){return this._forceGeometryBuffer?this._scene.geometryBufferRenderer:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"_prePassRenderer\",{get:function(){return this._forceGeometryBuffer?null:this._scene.prePassRenderer},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return\"MotionBlurPostProcess\"},t.prototype.excludeSkinnedMesh=function(e){if(e.skeleton){var t=void 0;if(this._geometryBufferRenderer)t=this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity;else{if(!this._prePassRenderer)return;t=this._prePassRenderer.excludedSkinnedMesh}t.push(e)}},t.prototype.removeExcludedSkinnedMesh=function(e){if(e.skeleton){var t=void 0;if(this._geometryBufferRenderer)t=this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity;else{if(!this._prePassRenderer)return;t=this._prePassRenderer.excludedSkinnedMesh}var i=t.indexOf(e);-1!==i&&t.splice(i,1)}},t.prototype.dispose=function(t){this._geometryBufferRenderer&&(this._geometryBufferRenderer._previousTransformationMatrices={},this._geometryBufferRenderer._previousBonesTransformationMatrices={},this._geometryBufferRenderer.excludedSkinnedMeshesFromVelocity=[]),e.prototype.dispose.call(this,t)},t.prototype._applyMode=function(){var e=this;if(!this._geometryBufferRenderer&&!this._prePassRenderer)return Q.Warn(\"Multiple Render Target support needed to compute object based motion blur\"),this.updateEffect();this._updateEffect(),this._invViewProjection=null,this._previousViewProjection=null,this.isObjectBased?(this._prePassRenderer&&this._prePassEffectConfiguration&&(this._prePassEffectConfiguration.texturesRequired[0]=a.PREPASS_VELOCITY_TEXTURE_TYPE),this.onApply=function(t){return e._onApplyObjectBased(t)}):(this._invViewProjection=M.Identity(),this._previousViewProjection=M.Identity(),this._prePassRenderer&&this._prePassEffectConfiguration&&(this._prePassEffectConfiguration.texturesRequired[0]=a.PREPASS_DEPTH_TEXTURE_TYPE),this.onApply=function(t){return e._onApplyScreenBased(t)})},t.prototype._onApplyObjectBased=function(e){if(e.setVector2(\"screenSize\",new R(this.width,this.height)),e.setFloat(\"motionScale\",this._scene.getAnimationRatio()),e.setFloat(\"motionStrength\",this.motionStrength),this._geometryBufferRenderer){var t=this._geometryBufferRenderer.getTextureIndex(Eb.VELOCITY_TEXTURE_TYPE);e.setTexture(\"velocitySampler\",this._geometryBufferRenderer.getGBuffer().textures[t])}else this._prePassRenderer&&(t=this._prePassRenderer.getIndex(a.PREPASS_VELOCITY_TEXTURE_TYPE),e.setTexture(\"velocitySampler\",this._prePassRenderer.getRenderTarget().textures[t]))},t.prototype._onApplyScreenBased=function(e){var t=this._scene.getProjectionMatrix().multiply(this._scene.getViewMatrix());if(t.invertToRef(this._invViewProjection),e.setMatrix(\"inverseViewProjection\",this._invViewProjection),e.setMatrix(\"prevViewProjection\",this._previousViewProjection),this._previousViewProjection=t,e.setVector2(\"screenSize\",new R(this.width,this.height)),e.setFloat(\"motionScale\",this._scene.getAnimationRatio()),e.setFloat(\"motionStrength\",this.motionStrength),this._geometryBufferRenderer){var i=this._geometryBufferRenderer.getTextureIndex(Eb.DEPTH_TEXTURE_TYPE);e.setTexture(\"depthSampler\",this._geometryBufferRenderer.getGBuffer().textures[i])}else this._prePassRenderer&&(i=this._prePassRenderer.getIndex(a.PREPASS_DEPTH_TEXTURE_TYPE),e.setTexture(\"depthSampler\",this._prePassRenderer.getRenderTarget().textures[i]))},t.prototype._updateEffect=function(){if(this._geometryBufferRenderer||this._prePassRenderer){var e=[\"#define GEOMETRY_SUPPORTED\",\"#define SAMPLES \"+this._motionBlurSamples.toFixed(1),this._isObjectBased?\"#define OBJECT_BASED\":\"#define SCREEN_BASED\"];this.updateEffect(e.join(\"\\n\"))}},t._Parse=function(e,i,n,r){return Le.Parse((function(){return new t(e.name,n,e.options,i,e.renderTargetSamplingMode,n.getEngine(),e.reusable,e.textureType,!1)}),e,n,r)},G([be()],t.prototype,\"motionStrength\",void 0),G([be()],t.prototype,\"motionBlurSamples\",null),G([be()],t.prototype,\"isObjectBased\",null),t}(pa);b(\"BABYLON.MotionBlurPostProcess\",Rb);It.ShadersStore.refractionPixelShader=\"varying vec2 vUV;\\nuniform sampler2D textureSampler;\\nuniform sampler2D refractionSampler;\\nuniform vec3 baseColor;\\nuniform float depth;\\nuniform float colorLevel;\\nvoid main() {\\nfloat ref=1.0-texture2D(refractionSampler,vUV).r;\\nvec2 uv=vUV-vec2(0.5);\\nvec2 offset=uv*depth*ref;\\nvec3 sourceColor=texture2D(textureSampler,vUV-offset).rgb;\\ngl_FragColor=vec4(sourceColor+sourceColor*ref*colorLevel,1.0);\\n}\";var xb=function(e){function t(t,i,n,r,o,a,s,l,c,u){var h=e.call(this,t,\"refraction\",[\"baseColor\",\"depth\",\"colorLevel\"],[\"refractionSampler\"],a,s,l,c,u)||this;return h._ownRefractionTexture=!0,h.color=n,h.depth=r,h.colorLevel=o,h.refractionTextureUrl=i,h.onActivateObservable.add((function(e){h._refTexture=h._refTexture||new to(i,e.getScene())})),h.onApplyObservable.add((function(e){e.setColor3(\"baseColor\",h.color),e.setFloat(\"depth\",h.depth),e.setFloat(\"colorLevel\",h.colorLevel),e.setTexture(\"refractionSampler\",h._refTexture)})),h}return V(t,e),Object.defineProperty(t.prototype,\"refractionTexture\",{get:function(){return this._refTexture},set:function(e){this._refTexture&&this._ownRefractionTexture&&this._refTexture.dispose(),this._refTexture=e,this._ownRefractionTexture=!1},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return\"RefractionPostProcess\"},t.prototype.dispose=function(t){this._refTexture&&this._ownRefractionTexture&&(this._refTexture.dispose(),this._refTexture=null),e.prototype.dispose.call(this,t)},t._Parse=function(e,i,n,r){return Le.Parse((function(){return new t(e.name,e.refractionTextureUrl,e.color,e.depth,e.colorLevel,e.options,i,e.renderTargetSamplingMode,n.getEngine(),e.reusable)}),e,n,r)},G([be()],t.prototype,\"color\",void 0),G([be()],t.prototype,\"depth\",void 0),G([be()],t.prototype,\"colorLevel\",void 0),G([be()],t.prototype,\"refractionTextureUrl\",void 0),t}(pa);b(\"BABYLON.RefractionPostProcess\",xb);It.ShadersStore.sharpenPixelShader=\"varying vec2 vUV;\\nuniform sampler2D textureSampler;\\nuniform vec2 screenSize;\\nuniform vec2 sharpnessAmounts;\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void)\\n{\\nvec2 onePixel=vec2(1.0,1.0)/screenSize;\\nvec4 color=texture2D(textureSampler,vUV);\\nvec4 edgeDetection=texture2D(textureSampler,vUV+onePixel*vec2(0,-1)) +\\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,0)) +\\ntexture2D(textureSampler,vUV+onePixel*vec2(1,0)) +\\ntexture2D(textureSampler,vUV+onePixel*vec2(0,1)) -\\ncolor*4.0;\\ngl_FragColor=max(vec4(color.rgb*sharpnessAmounts.y,color.a)-(sharpnessAmounts.x*vec4(edgeDetection.rgb,0)),0.);\\n}\";var Cb=function(e){function t(t,i,n,r,o,s,l,c){void 0===l&&(l=a.TEXTURETYPE_UNSIGNED_INT),void 0===c&&(c=!1);var u=e.call(this,t,\"sharpen\",[\"sharpnessAmounts\",\"screenSize\"],null,i,n,r,o,s,null,l,void 0,null,c)||this;return u.colorAmount=1,u.edgeAmount=.3,u.onApply=function(e){e.setFloat2(\"screenSize\",u.width,u.height),e.setFloat2(\"sharpnessAmounts\",u.edgeAmount,u.colorAmount)},u}return V(t,e),t.prototype.getClassName=function(){return\"SharpenPostProcess\"},t._Parse=function(e,i,n,r){return Le.Parse((function(){return new t(e.name,e.options,i,e.renderTargetSamplingMode,n.getEngine(),e.textureType,e.reusable)}),e,n,r)},G([be()],t.prototype,\"colorAmount\",void 0),G([be()],t.prototype,\"edgeAmount\",void 0),t}(pa);b(\"BABYLON.SharpenPostProcess\",Cb);var Pb=function(){function e(e,t){this._engine=e,this._name=t,this._renderEffects={},this._renderEffectsForIsolatedPass=new Array,this._cameras=[]}return Object.defineProperty(e.prototype,\"name\",{get:function(){return this._name},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"cameras\",{get:function(){return this._cameras},enumerable:!1,configurable:!0}),e.prototype.getClassName=function(){return\"PostProcessRenderPipeline\"},Object.defineProperty(e.prototype,\"isSupported\",{get:function(){for(var e in this._renderEffects)if(Object.prototype.hasOwnProperty.call(this._renderEffects,e)&&!this._renderEffects[e].isSupported)return!1;return!0},enumerable:!1,configurable:!0}),e.prototype.addEffect=function(e){this._renderEffects[e._name]=e},e.prototype._rebuild=function(){},e.prototype._enableEffect=function(e,t){var i=this._renderEffects[e];i&&i._enable(mi.MakeArray(t||this._cameras))},e.prototype._disableEffect=function(e,t){var i=this._renderEffects[e];i&&i._disable(mi.MakeArray(t||this._cameras))},e.prototype._attachCameras=function(e,t){var i=mi.MakeArray(e||this._cameras);if(i){var n,r=[];for(n=0;n0){var i=this._renderEffects[t[0]].getPostProcesses();i&&(i[0].samples=e)}return!0},e.prototype.setPrePassRenderer=function(e){return!1},e.prototype.dispose=function(){},G([be()],e.prototype,\"_name\",void 0),e}(),Mb=function(){function e(){this._renderPipelines={}}return Object.defineProperty(e.prototype,\"supportedPipelines\",{get:function(){var e=[];for(var t in this._renderPipelines)if(Object.prototype.hasOwnProperty.call(this._renderPipelines,t)){var i=this._renderPipelines[t];i.isSupported&&e.push(i)}return e},enumerable:!1,configurable:!0}),e.prototype.addPipeline=function(e){this._renderPipelines[e._name]=e},e.prototype.attachCamerasToRenderPipeline=function(e,t,i){void 0===i&&(i=!1);var n=this._renderPipelines[e];n&&n._attachCameras(t,i)},e.prototype.detachCamerasFromRenderPipeline=function(e,t){var i=this._renderPipelines[e];i&&i._detachCameras(t)},e.prototype.enableEffectInPipeline=function(e,t,i){var n=this._renderPipelines[e];n&&n._enableEffect(t,i)},e.prototype.disableEffectInPipeline=function(e,t,i){var n=this._renderPipelines[e];n&&n._disableEffect(t,i)},e.prototype.update=function(){for(var e in this._renderPipelines)if(Object.prototype.hasOwnProperty.call(this._renderPipelines,e)){var t=this._renderPipelines[e];t.isSupported?t._update():(t.dispose(),delete this._renderPipelines[e])}},e.prototype._rebuild=function(){for(var e in this._renderPipelines)Object.prototype.hasOwnProperty.call(this._renderPipelines,e)&&this._renderPipelines[e]._rebuild()},e.prototype.dispose=function(){for(var e in this._renderPipelines)Object.prototype.hasOwnProperty.call(this._renderPipelines,e)&&this._renderPipelines[e].dispose()},e}();Object.defineProperty(mn.prototype,\"postProcessRenderPipelineManager\",{get:function(){if(!this._postProcessRenderPipelineManager){var e=this._getComponent(zi.NAME_POSTPROCESSRENDERPIPELINEMANAGER);e||(e=new Ib(this),this._addComponent(e)),this._postProcessRenderPipelineManager=new Mb}return this._postProcessRenderPipelineManager},enumerable:!0,configurable:!0});var Ib=function(){function e(e){this.name=zi.NAME_POSTPROCESSRENDERPIPELINEMANAGER,this.scene=e}return e.prototype.register=function(){this.scene._gatherRenderTargetsStage.registerStep(zi.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER,this,this._gatherRenderTargets)},e.prototype.rebuild=function(){this.scene._postProcessRenderPipelineManager&&this.scene._postProcessRenderPipelineManager._rebuild()},e.prototype.dispose=function(){this.scene._postProcessRenderPipelineManager&&this.scene._postProcessRenderPipelineManager.dispose()},e.prototype._gatherRenderTargets=function(){this.scene._postProcessRenderPipelineManager&&this.scene._postProcessRenderPipelineManager.update()},e}(),Ob=function(e){function t(t,i,n,r,o){void 0===t&&(t=\"\"),void 0===i&&(i=!0),void 0===n&&(n=S.LastCreatedScene),void 0===o&&(o=!0);var s=e.call(this,n.getEngine(),t)||this;s._camerasToBeAttached=[],s.SharpenPostProcessId=\"SharpenPostProcessEffect\",s.ImageProcessingPostProcessId=\"ImageProcessingPostProcessEffect\",s.FxaaPostProcessId=\"FxaaPostProcessEffect\",s.ChromaticAberrationPostProcessId=\"ChromaticAberrationPostProcessEffect\",s.GrainPostProcessId=\"GrainPostProcessEffect\",s._glowLayer=null,s.animations=[],s._imageProcessingConfigurationObserver=null,s._sharpenEnabled=!1,s._bloomEnabled=!1,s._depthOfFieldEnabled=!1,s._depthOfFieldBlurLevel=pb.Low,s._fxaaEnabled=!1,s._imageProcessingEnabled=!0,s._bloomScale=.5,s._chromaticAberrationEnabled=!1,s._grainEnabled=!1,s._buildAllowed=!0,s.onBuildObservable=new u,s._resizeObserver=null,s._hardwareScaleLevel=1,s._bloomKernel=64,s._bloomWeight=.15,s._bloomThreshold=.9,s._samples=1,s._hasCleared=!1,s._prevPostProcess=null,s._prevPrevPostProcess=null,s._depthOfFieldSceneObserver=null,s._activeCameraChangedObserver=null,s._activeCamerasChangedObserver=null,s._cameras=r||n.cameras,s._cameras=s._cameras.slice(),s._camerasToBeAttached=s._cameras.slice(),s._buildAllowed=o,s._scene=n;var l=s._scene.getEngine().getCaps();s._hdr=i&&(l.textureHalfFloatRender||l.textureFloatRender),s._hdr?l.textureHalfFloatRender?s._defaultPipelineTextureType=a.TEXTURETYPE_HALF_FLOAT:l.textureFloatRender&&(s._defaultPipelineTextureType=a.TEXTURETYPE_FLOAT):s._defaultPipelineTextureType=a.TEXTURETYPE_UNSIGNED_INT,n.postProcessRenderPipelineManager.addPipeline(s);var c=s._scene.getEngine();return s.sharpen=new Cb(\"sharpen\",1,null,to.BILINEAR_SAMPLINGMODE,c,!1,s._defaultPipelineTextureType,!0),s._sharpenEffect=new rb(c,s.SharpenPostProcessId,(function(){return s.sharpen}),!0),s.depthOfField=new mb(s._scene,null,s._depthOfFieldBlurLevel,s._defaultPipelineTextureType,!0),s.bloom=new sb(s._scene,s._bloomScale,s._bloomWeight,s.bloomKernel,s._defaultPipelineTextureType,!0),s.chromaticAberration=new lb(\"ChromaticAberration\",c.getRenderWidth(),c.getRenderHeight(),1,null,to.BILINEAR_SAMPLINGMODE,c,!1,s._defaultPipelineTextureType,!0),s._chromaticAberrationEffect=new rb(c,s.ChromaticAberrationPostProcessId,(function(){return s.chromaticAberration}),!0),s.grain=new bb(\"Grain\",1,null,to.BILINEAR_SAMPLINGMODE,c,!1,s._defaultPipelineTextureType,!0),s._grainEffect=new rb(c,s.GrainPostProcessId,(function(){return s.grain}),!0),s._resizeObserver=c.onResizeObservable.add((function(){s._hardwareScaleLevel=c.getHardwareScalingLevel(),s.bloomKernel=s._bloomKernel})),s._imageProcessingConfigurationObserver=s._scene.imageProcessingConfiguration.onUpdateParameters.add((function(){s.bloom._downscale._exposure=s._scene.imageProcessingConfiguration.exposure,s.imageProcessingEnabled!==s._scene.imageProcessingConfiguration.isEnabled&&(s._imageProcessingEnabled=s._scene.imageProcessingConfiguration.isEnabled,s._buildPipeline())})),s._buildPipeline(),s}return V(t,e),Object.defineProperty(t.prototype,\"scene\",{get:function(){return this._scene},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"sharpenEnabled\",{get:function(){return this._sharpenEnabled},set:function(e){this._sharpenEnabled!==e&&(this._sharpenEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"bloomKernel\",{get:function(){return this._bloomKernel},set:function(e){this._bloomKernel=e,this.bloom.kernel=e/this._hardwareScaleLevel},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"bloomWeight\",{get:function(){return this._bloomWeight},set:function(e){this._bloomWeight!==e&&(this.bloom.weight=e,this._bloomWeight=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"bloomThreshold\",{get:function(){return this._bloomThreshold},set:function(e){this._bloomThreshold!==e&&(this.bloom.threshold=e,this._bloomThreshold=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"bloomScale\",{get:function(){return this._bloomScale},set:function(e){this._bloomScale!==e&&(this._bloomScale=e,this._rebuildBloom(),this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"bloomEnabled\",{get:function(){return this._bloomEnabled},set:function(e){this._bloomEnabled!==e&&(this._bloomEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),t.prototype._rebuildBloom=function(){var e=this.bloom;this.bloom=new sb(this._scene,this.bloomScale,this._bloomWeight,this.bloomKernel,this._defaultPipelineTextureType,!1),this.bloom.threshold=e.threshold;for(var t=0;t1){for(var i=0,n=this._cameras;i-1&&(e.depthOfField.depthTexture=t.enableDepthRenderer(t.activeCamera).getDepthMap())}))}else{this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver);var o=this._scene.enableDepthRenderer(this._cameras[0]);this.depthOfField.depthTexture=o.getDepthMap()}this.depthOfField._isReady()||this.depthOfField._updateEffects(),this.addEffect(this.depthOfField),this._setAutoClearAndTextureSharing(this.depthOfField._effects[0],!0)}else this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver);this.bloomEnabled&&(this.bloom._isReady()||this.bloom._updateEffects(),this.addEffect(this.bloom),this._setAutoClearAndTextureSharing(this.bloom._effects[0],!0)),this._imageProcessingEnabled&&(this.imageProcessing=new Ql(\"imageProcessing\",1,null,to.BILINEAR_SAMPLINGMODE,t,!1,this._defaultPipelineTextureType,this.scene.imageProcessingConfiguration),this._hdr?(this.addEffect(new rb(t,this.ImageProcessingPostProcessId,(function(){return e.imageProcessing}),!0)),this._setAutoClearAndTextureSharing(this.imageProcessing)):this._scene.imageProcessingConfiguration.applyByPostProcess=!1,this._cameras&&0!==this._cameras.length||(this._scene.imageProcessingConfiguration.applyByPostProcess=!1),this.imageProcessing.getEffect()||this.imageProcessing._updateParameters()),this.sharpenEnabled&&(this.sharpen.isReady()||this.sharpen.updateEffect(),this.addEffect(this._sharpenEffect),this._setAutoClearAndTextureSharing(this.sharpen)),this.grainEnabled&&(this.grain.isReady()||this.grain.updateEffect(),this.addEffect(this._grainEffect),this._setAutoClearAndTextureSharing(this.grain)),this.chromaticAberrationEnabled&&(this.chromaticAberration.isReady()||this.chromaticAberration.updateEffect(),this.addEffect(this._chromaticAberrationEffect),this._setAutoClearAndTextureSharing(this.chromaticAberration)),this.fxaaEnabled&&(this.fxaa=new yb(\"fxaa\",1,null,to.BILINEAR_SAMPLINGMODE,t,!1,this._defaultPipelineTextureType),this.addEffect(new rb(t,this.FxaaPostProcessId,(function(){return e.fxaa}),!0)),this._setAutoClearAndTextureSharing(this.fxaa,!0)),null!==this._cameras&&this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name,this._cameras),(this._scene.activeCameras&&this._scene.activeCameras.length>1||this._scene.activeCamera&&-1===this._cameras.indexOf(this._scene.activeCamera))&&(this._scene.autoClear=!0),this._activeCameraChangedObserver||(this._activeCameraChangedObserver=this._scene.onActiveCameraChanged.add((function(){e._scene.activeCamera&&-1===e._cameras.indexOf(e._scene.activeCamera)&&(e._scene.autoClear=!0)}))),this._activeCamerasChangedObserver||(this._activeCamerasChangedObserver=this._scene.onActiveCamerasChanged.add((function(){e._scene.activeCameras&&e._scene.activeCameras.length>1&&(e._scene.autoClear=!0)}))),!this._enableMSAAOnFirstPostProcess(this.samples)&&this.samples>1&&Q.Warn(\"MSAA failed to enable, MSAA is only supported in browsers that support webGL >= 2.0\"),this.onBuildObservable.notifyObservers(this)}},t.prototype._disposePostProcesses=function(e){void 0===e&&(e=!1);for(var t=0;t1.0) { lum_threshold=0.94+0.01*threshold; }\\nelse { lum_threshold=0.5+0.44*threshold; }\\nluminance=clamp((luminance-lum_threshold)*(1.0/(1.0-lum_threshold)),0.0,1.0);\\nhighlight*=luminance*gain;\\nhighlight.a=1.0;\\nreturn highlight;\\n}\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void)\\n{\\nvec4 original=texture2D(textureSampler,vUV);\\nif (gain==-1.0) {\\ngl_FragColor=vec4(0.0,0.0,0.0,1.0);\\nreturn;\\n}\\nfloat w=2.0/screen_width;\\nfloat h=2.0/screen_height;\\nfloat weight=1.0;\\nvec4 blurred=vec4(0.0,0.0,0.0,0.0);\\n#ifdef PENTAGON\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.84*w,0.43*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.48*w,-1.29*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.61*w,1.51*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.55*w,-0.74*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.71*w,-0.52*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.94*w,1.59*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.40*w,-1.87*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.62*w,1.16*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.09*w,0.25*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.46*w,-1.71*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.08*w,2.42*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.85*w,-1.89*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.89*w,0.16*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.29*w,1.88*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.40*w,-2.81*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.54*w,2.26*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.60*w,-0.61*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.31*w,-1.30*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.83*w,2.53*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.12*w,-2.48*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.60*w,1.11*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.82*w,0.99*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.50*w,-2.81*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.85*w,3.33*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.94*w,-1.92*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.27*w,-0.53*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.95*w,2.48*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.23*w,-3.04*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.17*w,2.05*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.97*w,-0.04*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.25*w,-2.00*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.31*w,3.08*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.94*w,-2.59*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.37*w,0.64*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.13*w,1.93*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.03*w,-3.65*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.60*w,3.17*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.14*w,-1.19*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.00*w,-1.19*h)));\\n#else\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.85*w,0.36*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.52*w,-1.14*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.46*w,1.42*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.46*w,-0.83*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.79*w,-0.42*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.11*w,1.62*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.29*w,-2.07*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.69*w,1.39*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.28*w,0.12*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.65*w,-1.69*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.08*w,2.44*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.63*w,-1.90*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.55*w,0.31*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.13*w,1.52*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.56*w,-2.61*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.38*w,2.34*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.64*w,-0.81*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.53*w,-1.21*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.06*w,2.63*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.00*w,-2.69*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.59*w,1.32*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.82*w,0.78*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.57*w,-2.50*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.54*w,2.93*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.39*w,-1.81*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.01*w,-0.28*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.04*w,2.25*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.02*w,-3.05*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.09*w,2.25*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.07*w,-0.25*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.44*w,-1.90*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.52*w,3.05*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.68*w,-2.61*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.01*w,0.79*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.76*w,1.46*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.05*w,-2.94*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.21*w,2.88*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.84*w,-1.30*h)));\\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.98*w,-0.96*h)));\\n#endif\\nblurred/=39.0;\\ngl_FragColor=blurred;\\n}\";It.ShadersStore.depthOfFieldPixelShader=\"uniform sampler2D textureSampler;\\nuniform sampler2D highlightsSampler;\\nuniform sampler2D depthSampler;\\nuniform sampler2D grainSampler;\\nuniform float grain_amount;\\nuniform bool blur_noise;\\nuniform float screen_width;\\nuniform float screen_height;\\nuniform float distortion;\\nuniform bool dof_enabled;\\nuniform float screen_distance; \\nuniform float aperture;\\nuniform float darken;\\nuniform float edge_blur;\\nuniform bool highlights;\\nuniform float near;\\nuniform float far;\\nvarying vec2 vUV;\\n#define PI 3.14159265\\n#define TWOPI 6.28318530\\n#define inverse_focal_length 0.1 \\nvec2 centered_screen_pos;\\nvec2 distorted_coords;\\nfloat radius2;\\nfloat radius;\\nvec2 rand(vec2 co)\\n{\\nfloat noise1=(fract(sin(dot(co,vec2(12.9898,78.233)))*43758.5453));\\nfloat noise2=(fract(sin(dot(co,vec2(12.9898,78.233)*2.0))*43758.5453));\\nreturn clamp(vec2(noise1,noise2),0.0,1.0);\\n}\\nvec2 getDistortedCoords(vec2 coords) {\\nif (distortion==0.0) { return coords; }\\nvec2 direction=1.0*normalize(centered_screen_pos);\\nvec2 dist_coords=vec2(0.5,0.5);\\ndist_coords.x=0.5+direction.x*radius2*1.0;\\ndist_coords.y=0.5+direction.y*radius2*1.0;\\nfloat dist_amount=clamp(distortion*0.23,0.0,1.0);\\ndist_coords=mix(coords,dist_coords,dist_amount);\\nreturn dist_coords;\\n}\\nfloat sampleScreen(inout vec4 color,in vec2 offset,in float weight) {\\nvec2 coords=distorted_coords;\\nfloat angle=rand(coords*100.0).x*TWOPI;\\ncoords+=vec2(offset.x*cos(angle)-offset.y*sin(angle),offset.x*sin(angle)+offset.y*cos(angle));\\ncolor+=texture2D(textureSampler,coords)*weight;\\nreturn weight;\\n}\\nfloat getBlurLevel(float size) {\\nreturn min(3.0,ceil(size/1.0));\\n}\\nvec4 getBlurColor(float size) {\\nvec4 col=texture2D(textureSampler,distorted_coords);\\nfloat blur_level=getBlurLevel(size);\\nfloat w=(size/screen_width);\\nfloat h=(size/screen_height);\\nfloat total_weight=1.0;\\nvec2 sample_coords;\\ntotal_weight+=sampleScreen(col,vec2(-0.50*w,0.24*h),0.93);\\ntotal_weight+=sampleScreen(col,vec2(0.30*w,-0.75*h),0.90);\\ntotal_weight+=sampleScreen(col,vec2(0.36*w,0.96*h),0.87);\\ntotal_weight+=sampleScreen(col,vec2(-1.08*w,-0.55*h),0.85);\\ntotal_weight+=sampleScreen(col,vec2(1.33*w,-0.37*h),0.83);\\ntotal_weight+=sampleScreen(col,vec2(-0.82*w,1.31*h),0.80);\\ntotal_weight+=sampleScreen(col,vec2(-0.31*w,-1.67*h),0.78);\\ntotal_weight+=sampleScreen(col,vec2(1.47*w,1.11*h),0.76);\\ntotal_weight+=sampleScreen(col,vec2(-1.97*w,0.19*h),0.74);\\ntotal_weight+=sampleScreen(col,vec2(1.42*w,-1.57*h),0.72);\\nif (blur_level>1.0) {\\ntotal_weight+=sampleScreen(col,vec2(0.01*w,2.25*h),0.70);\\ntotal_weight+=sampleScreen(col,vec2(-1.62*w,-1.74*h),0.67);\\ntotal_weight+=sampleScreen(col,vec2(2.49*w,0.20*h),0.65);\\ntotal_weight+=sampleScreen(col,vec2(-2.07*w,1.61*h),0.63);\\ntotal_weight+=sampleScreen(col,vec2(0.46*w,-2.70*h),0.61);\\ntotal_weight+=sampleScreen(col,vec2(1.55*w,2.40*h),0.59);\\ntotal_weight+=sampleScreen(col,vec2(-2.88*w,-0.75*h),0.56);\\ntotal_weight+=sampleScreen(col,vec2(2.73*w,-1.44*h),0.54);\\ntotal_weight+=sampleScreen(col,vec2(-1.08*w,3.02*h),0.52);\\ntotal_weight+=sampleScreen(col,vec2(-1.28*w,-3.05*h),0.49);\\n}\\nif (blur_level>2.0) {\\ntotal_weight+=sampleScreen(col,vec2(3.11*w,1.43*h),0.46);\\ntotal_weight+=sampleScreen(col,vec2(-3.36*w,1.08*h),0.44);\\ntotal_weight+=sampleScreen(col,vec2(1.80*w,-3.16*h),0.41);\\ntotal_weight+=sampleScreen(col,vec2(0.83*w,3.65*h),0.38);\\ntotal_weight+=sampleScreen(col,vec2(-3.16*w,-2.19*h),0.34);\\ntotal_weight+=sampleScreen(col,vec2(3.92*w,-0.53*h),0.31);\\ntotal_weight+=sampleScreen(col,vec2(-2.59*w,3.12*h),0.26);\\ntotal_weight+=sampleScreen(col,vec2(-0.20*w,-4.15*h),0.22);\\ntotal_weight+=sampleScreen(col,vec2(3.02*w,3.00*h),0.15);\\n}\\ncol/=total_weight; \\nif (darken>0.0) {\\ncol.rgb*=clamp(0.3,1.0,1.05-size*0.5*darken);\\n}\\nreturn col;\\n}\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void)\\n{\\ncentered_screen_pos=vec2(vUV.x-0.5,vUV.y-0.5);\\nradius2=centered_screen_pos.x*centered_screen_pos.x+centered_screen_pos.y*centered_screen_pos.y;\\nradius=sqrt(radius2);\\ndistorted_coords=getDistortedCoords(vUV); \\nvec2 texels_coords=vec2(vUV.x*screen_width,vUV.y*screen_height); \\nfloat depth=texture2D(depthSampler,distorted_coords).r; \\nfloat distance=near+(far-near)*depth; \\nvec4 color=texture2D(textureSampler,vUV); \\nfloat coc=abs(aperture*(screen_distance*(inverse_focal_length-1.0/distance)-1.0));\\nif (dof_enabled==false || coc<0.07) { coc=0.0; }\\nfloat edge_blur_amount=0.0;\\nif (edge_blur>0.0) {\\nedge_blur_amount=clamp((radius*2.0-1.0+0.15*edge_blur)*1.5,0.0,1.0)*1.3;\\n}\\nfloat blur_amount=max(edge_blur_amount,coc);\\nif (blur_amount==0.0) {\\ngl_FragColor=texture2D(textureSampler,distorted_coords);\\n}\\nelse {\\ngl_FragColor=getBlurColor(blur_amount*1.7);\\nif (highlights) {\\ngl_FragColor.rgb+=clamp(coc,0.0,1.0)*texture2D(highlightsSampler,distorted_coords).rgb;\\n}\\nif (blur_noise) {\\nvec2 noise=rand(distorted_coords)*0.01*blur_amount;\\nvec2 blurred_coord=vec2(distorted_coords.x+noise.x,distorted_coords.y+noise.y);\\ngl_FragColor=0.04*texture2D(textureSampler,blurred_coord)+0.96*gl_FragColor;\\n}\\n}\\nif (grain_amount>0.0) {\\nvec4 grain_color=texture2D(grainSampler,texels_coords*0.003);\\ngl_FragColor.rgb+=(-0.5+grain_color.rgb)*0.30*grain_amount;\\n}\\n}\\n\";var Db=function(e){function t(t,i,n,r,o){void 0===r&&(r=1);var a=e.call(this,n.getEngine(),t)||this;return a.LensChromaticAberrationEffect=\"LensChromaticAberrationEffect\",a.HighlightsEnhancingEffect=\"HighlightsEnhancingEffect\",a.LensDepthOfFieldEffect=\"LensDepthOfFieldEffect\",a._pentagonBokehIsEnabled=!1,a._scene=n,a._depthTexture=n.enableDepthRenderer().getDepthMap(),i.grain_texture?a._grainTexture=i.grain_texture:a._createGrainTexture(),a._edgeBlur=i.edge_blur?i.edge_blur:0,a._grainAmount=i.grain_amount?i.grain_amount:0,a._chromaticAberration=i.chromatic_aberration?i.chromatic_aberration:0,a._distortion=i.distortion?i.distortion:0,a._highlightsGain=void 0!==i.dof_gain?i.dof_gain:-1,a._highlightsThreshold=i.dof_threshold?i.dof_threshold:1,a._dofDistance=void 0!==i.dof_focus_distance?i.dof_focus_distance:-1,a._dofAperture=i.dof_aperture?i.dof_aperture:1,a._dofDarken=i.dof_darken?i.dof_darken:0,a._dofPentagon=void 0===i.dof_pentagon||i.dof_pentagon,a._blurNoise=void 0===i.blur_noise||i.blur_noise,a._createChromaticAberrationPostProcess(r),a._createHighlightsPostProcess(r),a._createDepthOfFieldPostProcess(r/4),a.addEffect(new rb(n.getEngine(),a.LensChromaticAberrationEffect,(function(){return a._chromaticAberrationPostProcess}),!0)),a.addEffect(new rb(n.getEngine(),a.HighlightsEnhancingEffect,(function(){return a._highlightsPostProcess}),!0)),a.addEffect(new rb(n.getEngine(),a.LensDepthOfFieldEffect,(function(){return a._depthOfFieldPostProcess}),!0)),-1===a._highlightsGain&&a._disableEffect(a.HighlightsEnhancingEffect,null),n.postProcessRenderPipelineManager.addPipeline(a),o&&n.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(t,o),a}return V(t,e),t.prototype.getClassName=function(){return\"LensRenderingPipeline\"},Object.defineProperty(t.prototype,\"scene\",{get:function(){return this._scene},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"edgeBlur\",{get:function(){return this._edgeBlur},set:function(e){this.setEdgeBlur(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"grainAmount\",{get:function(){return this._grainAmount},set:function(e){this.setGrainAmount(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"chromaticAberration\",{get:function(){return this._chromaticAberration},set:function(e){this.setChromaticAberration(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"dofAperture\",{get:function(){return this._dofAperture},set:function(e){this.setAperture(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"edgeDistortion\",{get:function(){return this._distortion},set:function(e){this.setEdgeDistortion(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"dofDistortion\",{get:function(){return this._dofDistance},set:function(e){this.setFocusDistance(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"darkenOutOfFocus\",{get:function(){return this._dofDarken},set:function(e){this.setDarkenOutOfFocus(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"blurNoise\",{get:function(){return this._blurNoise},set:function(e){this._blurNoise=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"pentagonBokeh\",{get:function(){return this._pentagonBokehIsEnabled},set:function(e){e?this.enablePentagonBokeh():this.disablePentagonBokeh()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"highlightsGain\",{get:function(){return this._highlightsGain},set:function(e){this.setHighlightsGain(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"highlightsThreshold\",{get:function(){return this._highlightsThreshold},set:function(e){this.setHighlightsThreshold(e)},enumerable:!1,configurable:!0}),t.prototype.setEdgeBlur=function(e){this._edgeBlur=e},t.prototype.disableEdgeBlur=function(){this._edgeBlur=0},t.prototype.setGrainAmount=function(e){this._grainAmount=e},t.prototype.disableGrain=function(){this._grainAmount=0},t.prototype.setChromaticAberration=function(e){this._chromaticAberration=e},t.prototype.disableChromaticAberration=function(){this._chromaticAberration=0},t.prototype.setEdgeDistortion=function(e){this._distortion=e},t.prototype.disableEdgeDistortion=function(){this._distortion=0},t.prototype.setFocusDistance=function(e){this._dofDistance=e},t.prototype.disableDepthOfField=function(){this._dofDistance=-1},t.prototype.setAperture=function(e){this._dofAperture=e},t.prototype.setDarkenOutOfFocus=function(e){this._dofDarken=e},t.prototype.enablePentagonBokeh=function(){this._highlightsPostProcess.updateEffect(\"#define PENTAGON\\n\"),this._pentagonBokehIsEnabled=!0},t.prototype.disablePentagonBokeh=function(){this._pentagonBokehIsEnabled=!1,this._highlightsPostProcess.updateEffect()},t.prototype.enableNoiseBlur=function(){this._blurNoise=!0},t.prototype.disableNoiseBlur=function(){this._blurNoise=!1},t.prototype.setHighlightsGain=function(e){this._highlightsGain=e},t.prototype.setHighlightsThreshold=function(e){-1===this._highlightsGain&&(this._highlightsGain=1),this._highlightsThreshold=e},t.prototype.disableHighlights=function(){this._highlightsGain=-1},t.prototype.dispose=function(e){void 0===e&&(e=!1),this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name,this._scene.cameras),this._chromaticAberrationPostProcess=null,this._highlightsPostProcess=null,this._depthOfFieldPostProcess=null,this._grainTexture.dispose(),e&&this._scene.disableDepthRenderer()},t.prototype._createChromaticAberrationPostProcess=function(e){var t=this;this._chromaticAberrationPostProcess=new pa(\"LensChromaticAberration\",\"chromaticAberration\",[\"chromatic_aberration\",\"screen_width\",\"screen_height\",\"direction\",\"radialIntensity\",\"centerPosition\"],[],e,null,to.TRILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1),this._chromaticAberrationPostProcess.onApply=function(e){e.setFloat(\"chromatic_aberration\",t._chromaticAberration),e.setFloat(\"screen_width\",t._scene.getEngine().getRenderWidth()),e.setFloat(\"screen_height\",t._scene.getEngine().getRenderHeight()),e.setFloat(\"radialIntensity\",1),e.setFloat2(\"direction\",17,17),e.setFloat2(\"centerPosition\",.5,.5)}},t.prototype._createHighlightsPostProcess=function(e){var t=this;this._highlightsPostProcess=new pa(\"LensHighlights\",\"lensHighlights\",[\"gain\",\"threshold\",\"screen_width\",\"screen_height\"],[],e,null,to.TRILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,this._dofPentagon?\"#define PENTAGON\\n\":\"\"),this._highlightsPostProcess.externalTextureSamplerBinding=!0,this._highlightsPostProcess.onApply=function(e){e.setFloat(\"gain\",t._highlightsGain),e.setFloat(\"threshold\",t._highlightsThreshold),e.setTextureFromPostProcess(\"textureSampler\",t._chromaticAberrationPostProcess),e.setFloat(\"screen_width\",t._scene.getEngine().getRenderWidth()),e.setFloat(\"screen_height\",t._scene.getEngine().getRenderHeight())}},t.prototype._createDepthOfFieldPostProcess=function(e){var t=this;this._depthOfFieldPostProcess=new pa(\"LensDepthOfField\",\"depthOfField\",[\"grain_amount\",\"blur_noise\",\"screen_width\",\"screen_height\",\"distortion\",\"dof_enabled\",\"screen_distance\",\"aperture\",\"darken\",\"edge_blur\",\"highlights\",\"near\",\"far\"],[\"depthSampler\",\"grainSampler\",\"highlightsSampler\"],e,null,to.TRILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1),this._depthOfFieldPostProcess.externalTextureSamplerBinding=!0,this._depthOfFieldPostProcess.onApply=function(e){e.setTexture(\"depthSampler\",t._depthTexture),e.setTexture(\"grainSampler\",t._grainTexture),e.setTextureFromPostProcess(\"textureSampler\",t._highlightsPostProcess),e.setTextureFromPostProcess(\"highlightsSampler\",t._depthOfFieldPostProcess),e.setFloat(\"grain_amount\",t._grainAmount),e.setBool(\"blur_noise\",t._blurNoise),e.setFloat(\"screen_width\",t._scene.getEngine().getRenderWidth()),e.setFloat(\"screen_height\",t._scene.getEngine().getRenderHeight()),e.setFloat(\"distortion\",t._distortion),e.setBool(\"dof_enabled\",-1!==t._dofDistance),e.setFloat(\"screen_distance\",1/(.1-1/t._dofDistance)),e.setFloat(\"aperture\",t._dofAperture),e.setFloat(\"darken\",t._dofDarken),e.setFloat(\"edge_blur\",t._edgeBlur),e.setBool(\"highlights\",-1!==t._highlightsGain),t._scene.activeCamera&&(e.setFloat(\"near\",t._scene.activeCamera.minZ),e.setFloat(\"far\",t._scene.activeCamera.maxZ))}},t.prototype._createGrainTexture=function(){this._grainTexture=new jl(\"LensNoiseTexture\",512,this._scene,!1,to.BILINEAR_SAMPLINGMODE),this._grainTexture.wrapU=to.WRAP_ADDRESSMODE,this._grainTexture.wrapV=to.WRAP_ADDRESSMODE;for(var e,t=this._grainTexture.getContext(),i=0;i<512;i++)for(var n=0;n<512;n++)e=Math.floor(255*(.42,.58,Math.random()*(.58-.42)+.42)),t.fillStyle=\"rgb(\"+e+\", \"+e+\", \"+e+\")\",t.fillRect(i,n,1,1);this._grainTexture.update(!1)},t}(Pb),Nb=function(){this.enabled=!1,this.name=\"ssao2\",this.texturesRequired=[a.PREPASS_NORMAL_TEXTURE_TYPE,a.PREPASS_DEPTH_TEXTURE_TYPE]};It.ShadersStore.ssao2PixelShader=\"precision highp float;\\nuniform sampler2D textureSampler;\\nuniform float near;\\nuniform float far;\\nuniform float radius;\\nfloat scales[16]=float[16](\\n0.1,\\n0.11406250000000001,\\n0.131640625,\\n0.15625,\\n0.187890625,\\n0.2265625,\\n0.272265625,\\n0.325,\\n0.384765625,\\n0.4515625,\\n0.525390625,\\n0.60625,\\n0.694140625,\\n0.7890625,\\n0.891015625,\\n1.0\\n);\\nvarying vec2 vUV;\\nfloat perspectiveDepthToViewZ(in float invClipZ,in float near,in float far ) {\\nreturn ( near*far )/( ( far-near )*invClipZ-far );\\n}\\nfloat viewZToPerspectiveDepth( in float viewZ,in float near,in float far ) {\\nreturn ( near*far/viewZ+far)/( far-near );\\n}\\nfloat viewZToOrthographicDepth( in float viewZ,in float near,in float far ) {\\nreturn ( viewZ+near )/( near-far );\\n}\\n#ifdef SSAO\\nuniform sampler2D randomSampler;\\nuniform sampler2D depthSampler;\\nuniform sampler2D normalSampler;\\nuniform float randTextureTiles;\\nuniform float samplesFactor;\\nuniform vec3 sampleSphere[SAMPLES];\\nuniform float totalStrength;\\nuniform float base;\\nuniform float xViewport;\\nuniform float yViewport;\\nuniform mat3 depthProjection;\\nuniform float maxZ;\\nuniform float minZAspect;\\nuniform vec2 texelSize;\\nuniform mat4 projection;\\nvoid main()\\n{\\nvec3 random=texture2D(randomSampler,vUV*randTextureTiles).rgb;\\nfloat depth=texture2D(depthSampler,vUV).r;\\nfloat depthSign=depth/abs(depth);\\ndepth=depth*depthSign;\\nvec3 normal=texture2D(normalSampler,vUV).rgb;\\nfloat occlusion=0.0;\\nfloat correctedRadius=min(radius,minZAspect*depth/near);\\nvec3 vViewRay=vec3((vUV.x*2.0-1.0)*xViewport,(vUV.y*2.0-1.0)*yViewport,depthSign);\\nvec3 vDepthFactor=depthProjection*vec3(1.0,1.0,depth);\\nvec3 origin=vViewRay*vDepthFactor;\\nvec3 rvec=random*2.0-1.0;\\nrvec.z=0.0;\\nfloat dotProduct=dot(rvec,normal);\\nrvec=1.0-abs(dotProduct)>1e-2 ? rvec : vec3(-rvec.y,0.0,rvec.x);\\nvec3 tangent=normalize(rvec-normal*dot(rvec,normal));\\nvec3 bitangent=cross(normal,tangent);\\nmat3 tbn=mat3(tangent,bitangent,normal);\\nfloat difference;\\nfor (int i=0; i1.0 || offset.y>1.0) {\\ncontinue;\\n}\\nfloat sampleDepth=abs(texture2D(depthSampler,offset.xy).r);\\ndifference=depthSign*samplePosition.z-sampleDepth;\\nfloat rangeCheck=1.0-smoothstep(correctedRadius*0.5,correctedRadius,difference);\\nocclusion+=(difference>=0.0 ? 1.0 : 0.0)*rangeCheck;\\n}\\nocclusion=occlusion*(1.0-smoothstep(maxZ*0.75,maxZ,depth));\\nfloat ao=1.0-totalStrength*occlusion*samplesFactor;\\nfloat result=clamp(ao+base,0.0,1.0);\\ngl_FragColor=vec4(vec3(result),1.0);\\n}\\n#endif\\n#ifdef BILATERAL_BLUR\\nuniform sampler2D depthSampler;\\nuniform float outSize;\\nuniform float samplerOffsets[SAMPLES];\\nvec4 blur9(sampler2D image,vec2 uv,float resolution,vec2 direction) {\\nvec4 color=vec4(0.0);\\nvec2 off1=vec2(1.3846153846)*direction;\\nvec2 off2=vec2(3.2307692308)*direction;\\ncolor+=texture2D(image,uv)*0.2270270270;\\ncolor+=texture2D(image,uv+(off1/resolution))*0.3162162162;\\ncolor+=texture2D(image,uv-(off1/resolution))*0.3162162162;\\ncolor+=texture2D(image,uv+(off2/resolution))*0.0702702703;\\ncolor+=texture2D(image,uv-(off2/resolution))*0.0702702703;\\nreturn color;\\n}\\nvec4 blur13(sampler2D image,vec2 uv,float resolution,vec2 direction) {\\nvec4 color=vec4(0.0);\\nvec2 off1=vec2(1.411764705882353)*direction;\\nvec2 off2=vec2(3.2941176470588234)*direction;\\nvec2 off3=vec2(5.176470588235294)*direction;\\ncolor+=texture2D(image,uv)*0.1964825501511404;\\ncolor+=texture2D(image,uv+(off1/resolution))*0.2969069646728344;\\ncolor+=texture2D(image,uv-(off1/resolution))*0.2969069646728344;\\ncolor+=texture2D(image,uv+(off2/resolution))*0.09447039785044732;\\ncolor+=texture2D(image,uv-(off2/resolution))*0.09447039785044732;\\ncolor+=texture2D(image,uv+(off3/resolution))*0.010381362401148057;\\ncolor+=texture2D(image,uv-(off3/resolution))*0.010381362401148057;\\nreturn color;\\n}\\nvec4 blur13Bilateral(sampler2D image,vec2 uv,float resolution,vec2 direction) {\\nvec4 color=vec4(0.0);\\nvec2 off1=vec2(1.411764705882353)*direction;\\nvec2 off2=vec2(3.2941176470588234)*direction;\\nvec2 off3=vec2(5.176470588235294)*direction;\\nfloat compareDepth=abs(texture2D(depthSampler,uv).r);\\nfloat sampleDepth;\\nfloat weight;\\nfloat weightSum=30.0;\\ncolor+=texture2D(image,uv)*30.0;\\nsampleDepth=abs(texture2D(depthSampler,uv+(off1/resolution)).r);\\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\\nweightSum+= weight;\\ncolor+=texture2D(image,uv+(off1/resolution))*weight;\\nsampleDepth=abs(texture2D(depthSampler,uv-(off1/resolution)).r);\\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\\nweightSum+= weight;\\ncolor+=texture2D(image,uv-(off1/resolution))*weight;\\nsampleDepth=abs(texture2D(depthSampler,uv+(off2/resolution)).r);\\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\\nweightSum+=weight;\\ncolor+=texture2D(image,uv+(off2/resolution))*weight;\\nsampleDepth=abs(texture2D(depthSampler,uv-(off2/resolution)).r);\\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\\nweightSum+=weight;\\ncolor+=texture2D(image,uv-(off2/resolution))*weight;\\nsampleDepth=abs(texture2D(depthSampler,uv+(off3/resolution)).r);\\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\\nweightSum+=weight;\\ncolor+=texture2D(image,uv+(off3/resolution))*weight;\\nsampleDepth=abs(texture2D(depthSampler,uv-(off3/resolution)).r);\\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\\nweightSum+=weight;\\ncolor+=texture2D(image,uv-(off3/resolution))*weight;\\nreturn color/weightSum;\\n}\\nvoid main()\\n{\\n#if EXPENSIVE\\nfloat compareDepth=abs(texture2D(depthSampler,vUV).r);\\nfloat texelsize=1.0/outSize;\\nfloat result=0.0;\\nfloat weightSum=0.0;\\nfor (int i=0; i0?n._ssaoCombinePostProcess.width:n._originalColorPostProcess.width),e.setFloat(\"near\",n._scene.activeCamera.minZ),e.setFloat(\"far\",n._scene.activeCamera.maxZ),e.setFloat(\"radius\",n.radius),n._geometryBufferRenderer?e.setTexture(\"depthSampler\",n._geometryBufferRenderer.getGBuffer().textures[0]):n._prePassRenderer&&e.setTexture(\"depthSampler\",n._prePassRenderer.getRenderTarget().textures[n._prePassRenderer.getIndex(a.PREPASS_DEPTH_TEXTURE_TYPE)]),e.setArray(\"samplerOffsets\",n._samplerOffsets))},this._blurVPostProcess=new pa(\"BlurV\",\"ssao2\",[\"outSize\",\"samplerOffsets\",\"near\",\"far\",\"radius\"],[\"depthSampler\"],t,null,to.TRILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,\"#define BILATERAL_BLUR\\n#define BILATERAL_BLUR_V\\n#define SAMPLES 16\\n#define EXPENSIVE \"+(r?\"1\":\"0\")+\"\\n\",i),this._blurVPostProcess.onApply=function(e){n._scene.activeCamera&&(e.setFloat(\"outSize\",n._ssaoCombinePostProcess.height>0?n._ssaoCombinePostProcess.height:n._originalColorPostProcess.height),e.setFloat(\"near\",n._scene.activeCamera.minZ),e.setFloat(\"far\",n._scene.activeCamera.maxZ),e.setFloat(\"radius\",n.radius),n._geometryBufferRenderer?e.setTexture(\"depthSampler\",n._geometryBufferRenderer.getGBuffer().textures[0]):n._prePassRenderer&&e.setTexture(\"depthSampler\",n._prePassRenderer.getRenderTarget().textures[n._prePassRenderer.getIndex(a.PREPASS_DEPTH_TEXTURE_TYPE)]),e.setArray(\"samplerOffsets\",n._samplerOffsets))},this._blurHPostProcess.samples=this.textureSamples,this._blurVPostProcess.samples=this.textureSamples},t.prototype._rebuild=function(){e.prototype._rebuild.call(this)},t.prototype._radicalInverse_VdC=function(e){return this._bits[0]=e,this._bits[0]=(this._bits[0]<<16|this._bits[0]>>16)>>>0,this._bits[0]=(1431655765&this._bits[0])<<1|(2863311530&this._bits[0])>>>1>>>0,this._bits[0]=(858993459&this._bits[0])<<2|(3435973836&this._bits[0])>>>2>>>0,this._bits[0]=(252645135&this._bits[0])<<4|(4042322160&this._bits[0])>>>4>>>0,this._bits[0]=(16711935&this._bits[0])<<8|(4278255360&this._bits[0])>>>8>>>0,2.3283064365386963e-10*this._bits[0]},t.prototype._hammersley=function(e,t){return[e/t,this._radicalInverse_VdC(e)]},t.prototype._hemisphereSample_uniform=function(e,t){var i=2*t*Math.PI,n=1-.85*e,r=Math.sqrt(1-n*n);return new x(Math.cos(i)*r,Math.sin(i)*r,n)},t.prototype._generateHemisphere=function(){for(var e,t=this.samples,i=[],n=0;n0.0)\\nhitCoord-=dir;\\nelse\\nhitCoord+=dir;\\ninfo.color+=texture2D(textureSampler,projectedCoord.xy).rgb;\\n}\\nprojectedCoord=projection*vec4(hitCoord,1.0);\\nprojectedCoord.xy/=projectedCoord.w;\\nprojectedCoord.xy=0.5*projectedCoord.xy+vec2(0.5);\\ninfo.coords=vec4(projectedCoord.xy,sampledDepth,1.0);\\ninfo.color+=texture2D(textureSampler,projectedCoord.xy).rgb;\\ninfo.color/=float(SMOOTH_STEPS+1);\\nreturn info;\\n}\\n/**\\n* Tests the given world position (hitCoord) according to the given reflection vector (dir)\\n* until it finds a collision (means that depth is enough close to say \\\"it's the pixel to sample!\\\").\\n*/\\nReflectionInfo getReflectionInfo(vec3 dir,vec3 hitCoord)\\n{\\nReflectionInfo info;\\nvec4 projectedCoord;\\nfloat sampledDepth;\\ndir*=stepSize;\\nfor(int i=0; i>0)),e.push(\"#define SMOOTH_STEPS \"+(this._smoothSteps>>0)),this.updateEffect(e.join(\"\\n\"))},t._Parse=function(e,i,n,r){return Le.Parse((function(){return new t(e.name,n,e.options,i,e.renderTargetSamplingMode,n.getEngine(),e.textureType,e.reusable)}),e,n,r)},G([be()],t.prototype,\"threshold\",void 0),G([be()],t.prototype,\"strength\",void 0),G([be()],t.prototype,\"reflectionSpecularFalloffExponent\",void 0),G([be()],t.prototype,\"step\",void 0),G([be()],t.prototype,\"roughnessFactor\",void 0),G([be()],t.prototype,\"enableSmoothReflections\",null),G([be()],t.prototype,\"reflectionSamples\",null),G([be()],t.prototype,\"smoothSteps\",null),t}(pa);b(\"BABYLON.ScreenSpaceReflectionPostProcess\",Bb);It.ShadersStore.standardPixelShader=\"uniform sampler2D textureSampler;\\nvarying vec2 vUV;\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\n#if defined(PASS_POST_PROCESS)\\nvoid main(void)\\n{\\nvec4 color=texture2D(textureSampler,vUV);\\ngl_FragColor=color;\\n}\\n#endif\\n#if defined(DOWN_SAMPLE_X4)\\nuniform vec2 dsOffsets[16];\\nvoid main(void)\\n{\\nvec4 average=vec4(0.0,0.0,0.0,0.0);\\naverage=texture2D(textureSampler,vUV+dsOffsets[0]);\\naverage+=texture2D(textureSampler,vUV+dsOffsets[1]);\\naverage+=texture2D(textureSampler,vUV+dsOffsets[2]);\\naverage+=texture2D(textureSampler,vUV+dsOffsets[3]);\\naverage+=texture2D(textureSampler,vUV+dsOffsets[4]);\\naverage+=texture2D(textureSampler,vUV+dsOffsets[5]);\\naverage+=texture2D(textureSampler,vUV+dsOffsets[6]);\\naverage+=texture2D(textureSampler,vUV+dsOffsets[7]);\\naverage+=texture2D(textureSampler,vUV+dsOffsets[8]);\\naverage+=texture2D(textureSampler,vUV+dsOffsets[9]);\\naverage+=texture2D(textureSampler,vUV+dsOffsets[10]);\\naverage+=texture2D(textureSampler,vUV+dsOffsets[11]);\\naverage+=texture2D(textureSampler,vUV+dsOffsets[12]);\\naverage+=texture2D(textureSampler,vUV+dsOffsets[13]);\\naverage+=texture2D(textureSampler,vUV+dsOffsets[14]);\\naverage+=texture2D(textureSampler,vUV+dsOffsets[15]);\\naverage/=16.0;\\ngl_FragColor=average;\\n}\\n#endif\\n#if defined(BRIGHT_PASS)\\nuniform vec2 dsOffsets[4];\\nuniform float brightThreshold;\\nvoid main(void)\\n{\\nvec4 average=vec4(0.0,0.0,0.0,0.0);\\naverage=texture2D(textureSampler,vUV+vec2(dsOffsets[0].x,dsOffsets[0].y));\\naverage+=texture2D(textureSampler,vUV+vec2(dsOffsets[1].x,dsOffsets[1].y));\\naverage+=texture2D(textureSampler,vUV+vec2(dsOffsets[2].x,dsOffsets[2].y));\\naverage+=texture2D(textureSampler,vUV+vec2(dsOffsets[3].x,dsOffsets[3].y));\\naverage*=0.25;\\nfloat luminance=length(average.rgb);\\nif (luminanceshadowPixelDepth)\\naccumFog+=sunColor*computeScattering(dot(rayDirection,sunDirection));\\ncurrentPosition+=stepL;\\n}\\naccumFog/=NB_STEPS;\\nvec3 color=accumFog*scatteringPower;\\ngl_FragColor=vec4(color*exp(color) ,1.0);\\n}\\n#endif\\n#if defined(VLSMERGE)\\nuniform sampler2D originalSampler;\\nvoid main(void)\\n{\\ngl_FragColor=texture2D(originalSampler,vUV)+texture2D(textureSampler,vUV);\\n}\\n#endif\\n#if defined(LUMINANCE)\\nuniform vec2 lumOffsets[4];\\nvoid main()\\n{\\nfloat average=0.0;\\nvec4 color=vec4(0.0);\\nfloat maximum=-1e20;\\nvec3 weight=vec3(0.299,0.587,0.114);\\nfor (int i=0; i<4; i++)\\n{\\ncolor=texture2D(textureSampler,vUV+ lumOffsets[i]);\\nfloat GreyValue=dot(color.rgb,vec3(0.33,0.33,0.33));\\n#ifdef WEIGHTED_AVERAGE\\nfloat GreyValue=dot(color.rgb,weight);\\n#endif\\n#ifdef BRIGHTNESS\\nfloat GreyValue=max(color.r,max(color.g,color.b));\\n#endif\\n#ifdef HSL_COMPONENT\\nfloat GreyValue=0.5*(max(color.r,max(color.g,color.b))+min(color.r,min(color.g,color.b)));\\n#endif\\n#ifdef MAGNITUDE\\nfloat GreyValue=length(color.rgb);\\n#endif\\nmaximum=max(maximum,GreyValue);\\naverage+=(0.25*log(1e-5+GreyValue));\\n}\\naverage=exp(average);\\ngl_FragColor=vec4(average,maximum,0.0,1.0);\\n}\\n#endif\\n#if defined(LUMINANCE_DOWN_SAMPLE)\\nuniform vec2 dsOffsets[9];\\nuniform float halfDestPixelSize;\\n#ifdef FINAL_DOWN_SAMPLER\\n#include\\n#endif\\nvoid main()\\n{\\nvec4 color=vec4(0.0);\\nfloat average=0.0;\\nfor (int i=0; i<9; i++)\\n{\\ncolor=texture2D(textureSampler,vUV+vec2(halfDestPixelSize,halfDestPixelSize)+dsOffsets[i]);\\naverage+=color.r;\\n}\\naverage/=9.0;\\n#ifdef FINAL_DOWN_SAMPLER\\ngl_FragColor=pack(average);\\n#else\\ngl_FragColor=vec4(average,average,0.0,1.0);\\n#endif\\n}\\n#endif\\n#if defined(HDR)\\nuniform sampler2D textureAdderSampler;\\nuniform float averageLuminance;\\nvoid main()\\n{\\nvec4 color=texture2D(textureAdderSampler,vUV);\\n#ifndef AUTO_EXPOSURE\\nvec4 adjustedColor=color/averageLuminance;\\ncolor=adjustedColor;\\ncolor.a=1.0;\\n#endif\\ngl_FragColor=color;\\n}\\n#endif\\n#if defined(LENS_FLARE)\\n#define GHOSTS 3\\nuniform sampler2D lensColorSampler;\\nuniform float strength;\\nuniform float ghostDispersal;\\nuniform float haloWidth;\\nuniform vec2 resolution;\\nuniform float distortionStrength;\\nfloat hash(vec2 p)\\n{\\nfloat h=dot(p,vec2(127.1,311.7));\\nreturn -1.0+2.0*fract(sin(h)*43758.5453123);\\n}\\nfloat noise(in vec2 p)\\n{\\nvec2 i=floor(p);\\nvec2 f=fract(p);\\nvec2 u=f*f*(3.0-2.0*f);\\nreturn mix(mix(hash(i+vec2(0.0,0.0)),\\nhash(i+vec2(1.0,0.0)),u.x),\\nmix(hash(i+vec2(0.0,1.0)),\\nhash(i+vec2(1.0,1.0)),u.x),u.y);\\n}\\nfloat fbm(vec2 p)\\n{\\nfloat f=0.0;\\nf+=0.5000*noise(p); p*=2.02;\\nf+=0.2500*noise(p); p*=2.03;\\nf+=0.1250*noise(p); p*=2.01;\\nf+=0.0625*noise(p); p*=2.04;\\nf/=0.9375;\\nreturn f;\\n}\\nvec3 pattern(vec2 uv)\\n{\\nvec2 p=-1.0+2.0*uv;\\nfloat p2=dot(p,p);\\nfloat f=fbm(vec2(15.0*p2))/2.0;\\nfloat r=0.2+0.6*sin(12.5*length(uv-vec2(0.5)));\\nfloat g=0.2+0.6*sin(20.5*length(uv-vec2(0.5)));\\nfloat b=0.2+0.6*sin(17.2*length(uv-vec2(0.5)));\\nreturn (1.0-f)*vec3(r,g,b);\\n}\\nfloat luminance(vec3 color)\\n{\\nreturn dot(color.rgb,vec3(0.2126,0.7152,0.0722));\\n}\\nvec4 textureDistorted(sampler2D tex,vec2 texcoord,vec2 direction,vec3 distortion)\\n{\\nreturn vec4(\\ntexture2D(tex,texcoord+direction*distortion.r).r,\\ntexture2D(tex,texcoord+direction*distortion.g).g,\\ntexture2D(tex,texcoord+direction*distortion.b).b,\\n1.0\\n);\\n}\\nvoid main(void)\\n{\\nvec2 uv=-vUV+vec2(1.0);\\nvec2 ghostDir=(vec2(0.5)-uv)*ghostDispersal;\\nvec2 texelSize=1.0/resolution;\\nvec3 distortion=vec3(-texelSize.x*distortionStrength,0.0,texelSize.x*distortionStrength);\\nvec4 result=vec4(0.0);\\nfloat ghostIndice=1.0;\\nfor (int i=0; i=nSamples)\\nbreak;\\nvec2 offset1=vUV+velocity*(float(i)/float(nSamples-1)-0.5);\\nresult+=texture2D(textureSampler,offset1);\\n}\\ngl_FragColor=result/float(nSamples);\\n}\\n#endif\\n\";var Ub=function(e){function t(t,i,n,r,o){void 0===r&&(r=null);var s=e.call(this,i.getEngine(),t)||this;return s.downSampleX4PostProcess=null,s.brightPassPostProcess=null,s.blurHPostProcesses=[],s.blurVPostProcesses=[],s.textureAdderPostProcess=null,s.volumetricLightPostProcess=null,s.volumetricLightSmoothXPostProcess=null,s.volumetricLightSmoothYPostProcess=null,s.volumetricLightMergePostProces=null,s.volumetricLightFinalPostProcess=null,s.luminancePostProcess=null,s.luminanceDownSamplePostProcesses=[],s.hdrPostProcess=null,s.textureAdderFinalPostProcess=null,s.lensFlareFinalPostProcess=null,s.hdrFinalPostProcess=null,s.lensFlarePostProcess=null,s.lensFlareComposePostProcess=null,s.motionBlurPostProcess=null,s.depthOfFieldPostProcess=null,s.fxaaPostProcess=null,s.screenSpaceReflectionPostProcess=null,s.brightThreshold=1,s.blurWidth=512,s.horizontalBlur=!1,s.lensTexture=null,s.volumetricLightCoefficient=.2,s.volumetricLightPower=4,s.volumetricLightBlurScale=64,s.sourceLight=null,s.hdrMinimumLuminance=1,s.hdrDecreaseRate=.5,s.hdrIncreaseRate=.5,s.lensColorTexture=null,s.lensFlareStrength=20,s.lensFlareGhostDispersal=1.4,s.lensFlareHaloWidth=.7,s.lensFlareDistortionStrength=16,s.lensFlareBlurWidth=512,s.lensStarTexture=null,s.lensFlareDirtTexture=null,s.depthOfFieldDistance=10,s.depthOfFieldBlurWidth=64,s.animations=[],s._currentDepthOfFieldSource=null,s._fixedExposure=1,s._currentExposure=1,s._hdrAutoExposure=!1,s._hdrCurrentLuminance=1,s._motionStrength=1,s._isObjectBasedMotionBlur=!1,s._camerasToBeAttached=[],s._bloomEnabled=!1,s._depthOfFieldEnabled=!1,s._vlsEnabled=!1,s._lensFlareEnabled=!1,s._hdrEnabled=!1,s._motionBlurEnabled=!1,s._fxaaEnabled=!1,s._screenSpaceReflectionsEnabled=!1,s._motionBlurSamples=64,s._volumetricLightStepsCount=50,s._samples=1,s._cameras=o||i.cameras,s._cameras=s._cameras.slice(),s._camerasToBeAttached=s._cameras.slice(),s._scene=i,s._basePostProcess=r,s._ratio=n,s._floatTextureType=i.getEngine().getCaps().textureFloatRender?a.TEXTURETYPE_FLOAT:a.TEXTURETYPE_HALF_FLOAT,i.postProcessRenderPipelineManager.addPipeline(s),s._buildPipeline(),s}return V(t,e),Object.defineProperty(t.prototype,\"exposure\",{get:function(){return this._fixedExposure},set:function(e){this._fixedExposure=e,this._currentExposure=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"hdrAutoExposure\",{get:function(){return this._hdrAutoExposure},set:function(e){if(this._hdrAutoExposure=e,this.hdrPostProcess){var t=[\"#define HDR\"];e&&t.push(\"#define AUTO_EXPOSURE\"),this.hdrPostProcess.updateEffect(t.join(\"\\n\"))}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"motionStrength\",{get:function(){return this._motionStrength},set:function(e){this._motionStrength=e,this._isObjectBasedMotionBlur&&this.motionBlurPostProcess&&(this.motionBlurPostProcess.motionStrength=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"objectBasedMotionBlur\",{get:function(){return this._isObjectBasedMotionBlur},set:function(e){var t=this._isObjectBasedMotionBlur!==e;this._isObjectBasedMotionBlur=e,t&&this._buildPipeline()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"BloomEnabled\",{get:function(){return this._bloomEnabled},set:function(e){this._bloomEnabled!==e&&(this._bloomEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"DepthOfFieldEnabled\",{get:function(){return this._depthOfFieldEnabled},set:function(e){this._depthOfFieldEnabled!==e&&(this._depthOfFieldEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"LensFlareEnabled\",{get:function(){return this._lensFlareEnabled},set:function(e){this._lensFlareEnabled!==e&&(this._lensFlareEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"HDREnabled\",{get:function(){return this._hdrEnabled},set:function(e){this._hdrEnabled!==e&&(this._hdrEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"VLSEnabled\",{get:function(){return this._vlsEnabled},set:function(e){if(this._vlsEnabled!==e){if(e&&!this._scene.enableGeometryBufferRenderer())return void Q.Warn(\"Geometry renderer is not supported, cannot create volumetric lights in Standard Rendering Pipeline\");this._vlsEnabled=e,this._buildPipeline()}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"MotionBlurEnabled\",{get:function(){return this._motionBlurEnabled},set:function(e){this._motionBlurEnabled!==e&&(this._motionBlurEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"fxaaEnabled\",{get:function(){return this._fxaaEnabled},set:function(e){this._fxaaEnabled!==e&&(this._fxaaEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"screenSpaceReflectionsEnabled\",{get:function(){return this._screenSpaceReflectionsEnabled},set:function(e){this._screenSpaceReflectionsEnabled!==e&&(this._screenSpaceReflectionsEnabled=e,this._buildPipeline())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"volumetricLightStepsCount\",{get:function(){return this._volumetricLightStepsCount},set:function(e){this.volumetricLightPostProcess&&this.volumetricLightPostProcess.updateEffect(\"#define VLS\\n#define NB_STEPS \"+e.toFixed(1)),this._volumetricLightStepsCount=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"motionBlurSamples\",{get:function(){return this._motionBlurSamples},set:function(e){this.motionBlurPostProcess&&(this._isObjectBasedMotionBlur?this.motionBlurPostProcess.motionBlurSamples=e:this.motionBlurPostProcess.updateEffect(\"#define MOTION_BLUR\\n#define MAX_MOTION_SAMPLES \"+e.toFixed(1))),this._motionBlurSamples=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"samples\",{get:function(){return this._samples},set:function(e){this._samples!==e&&(this._samples=e,this._buildPipeline())},enumerable:!1,configurable:!0}),t.prototype._buildPipeline=function(){var e=this,t=this._ratio,i=this._scene;this._disposePostProcesses(),null!==this._cameras&&(this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name,this._cameras),this._cameras=this._camerasToBeAttached.slice()),this._reset(),this._screenSpaceReflectionsEnabled&&(this.screenSpaceReflectionPostProcess=new Bb(\"HDRPass\",i,t,null,to.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,this._floatTextureType),this.screenSpaceReflectionPostProcess.onApplyObservable.add((function(){e._currentDepthOfFieldSource=e.screenSpaceReflectionPostProcess})),this.addEffect(new rb(i.getEngine(),\"HDRScreenSpaceReflections\",(function(){return e.screenSpaceReflectionPostProcess}),!0))),this._basePostProcess?this.originalPostProcess=this._basePostProcess:this.originalPostProcess=new pa(\"HDRPass\",\"standard\",[],[],t,null,to.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,\"#define PASS_POST_PROCESS\",this._floatTextureType),this.originalPostProcess.autoClear=!this.screenSpaceReflectionPostProcess,this.originalPostProcess.onApplyObservable.add((function(){e._currentDepthOfFieldSource=e.originalPostProcess})),this.addEffect(new rb(i.getEngine(),\"HDRPassPostProcess\",(function(){return e.originalPostProcess}),!0)),this._bloomEnabled&&(this._createDownSampleX4PostProcess(i,t/4),this._createBrightPassPostProcess(i,t/4),this._createBlurPostProcesses(i,t/4,1),this._createTextureAdderPostProcess(i,t),this.textureAdderFinalPostProcess=new pa(\"HDRDepthOfFieldSource\",\"standard\",[],[],t,null,to.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,\"#define PASS_POST_PROCESS\",a.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new rb(i.getEngine(),\"HDRBaseDepthOfFieldSource\",(function(){return e.textureAdderFinalPostProcess}),!0))),this._vlsEnabled&&(this._createVolumetricLightPostProcess(i,t),this.volumetricLightFinalPostProcess=new pa(\"HDRVLSFinal\",\"standard\",[],[],t,null,to.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,\"#define PASS_POST_PROCESS\",a.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new rb(i.getEngine(),\"HDRVLSFinal\",(function(){return e.volumetricLightFinalPostProcess}),!0))),this._lensFlareEnabled&&(this._createLensFlarePostProcess(i,t),this.lensFlareFinalPostProcess=new pa(\"HDRPostLensFlareDepthOfFieldSource\",\"standard\",[],[],t,null,to.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,\"#define PASS_POST_PROCESS\",a.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new rb(i.getEngine(),\"HDRPostLensFlareDepthOfFieldSource\",(function(){return e.lensFlareFinalPostProcess}),!0))),this._hdrEnabled&&(this._createLuminancePostProcesses(i,this._floatTextureType),this._createHdrPostProcess(i,t),this.hdrFinalPostProcess=new pa(\"HDRPostHDReDepthOfFieldSource\",\"standard\",[],[],t,null,to.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,\"#define PASS_POST_PROCESS\",a.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new rb(i.getEngine(),\"HDRPostHDReDepthOfFieldSource\",(function(){return e.hdrFinalPostProcess}),!0))),this._depthOfFieldEnabled&&(this._createBlurPostProcesses(i,t/2,3,\"depthOfFieldBlurWidth\"),this._createDepthOfFieldPostProcess(i,t)),this._motionBlurEnabled&&this._createMotionBlurPostProcess(i,t),this._fxaaEnabled&&(this.fxaaPostProcess=new yb(\"fxaa\",1,null,to.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,a.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new rb(i.getEngine(),\"HDRFxaa\",(function(){return e.fxaaPostProcess}),!0))),null!==this._cameras&&this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name,this._cameras),!this._enableMSAAOnFirstPostProcess(this._samples)&&this._samples>1&&Q.Warn(\"MSAA failed to enable, MSAA is only supported in browsers that support webGL >= 2.0\")},t.prototype._createDownSampleX4PostProcess=function(e,t){var i=this,n=new Array(32);this.downSampleX4PostProcess=new pa(\"HDRDownSampleX4\",\"standard\",[\"dsOffsets\"],[],t,null,to.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,\"#define DOWN_SAMPLE_X4\",this._floatTextureType),this.downSampleX4PostProcess.onApply=function(e){for(var t=0,r=i.downSampleX4PostProcess.width,o=i.downSampleX4PostProcess.height,a=-2;a<2;a++)for(var s=-2;s<2;s++)n[t]=(a+.5)*(1/r),n[t+1]=(s+.5)*(1/o),t+=2;e.setArray2(\"dsOffsets\",n)},this.addEffect(new rb(e.getEngine(),\"HDRDownSampleX4\",(function(){return i.downSampleX4PostProcess}),!0))},t.prototype._createBrightPassPostProcess=function(e,t){var i=this,n=new Array(8);this.brightPassPostProcess=new pa(\"HDRBrightPass\",\"standard\",[\"dsOffsets\",\"brightThreshold\"],[],t,null,to.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,\"#define BRIGHT_PASS\",this._floatTextureType),this.brightPassPostProcess.onApply=function(e){var t=1/i.brightPassPostProcess.width,r=1/i.brightPassPostProcess.height;n[0]=-.5*t,n[1]=.5*r,n[2]=.5*t,n[3]=.5*r,n[4]=-.5*t,n[5]=-.5*r,n[6]=.5*t,n[7]=-.5*r,e.setArray2(\"dsOffsets\",n),e.setFloat(\"brightThreshold\",i.brightThreshold)},this.addEffect(new rb(e.getEngine(),\"HDRBrightPass\",(function(){return i.brightPassPostProcess}),!0))},t.prototype._createBlurPostProcesses=function(e,t,i,n){var r=this;void 0===n&&(n=\"blurWidth\");var o=e.getEngine(),a=new zp(\"HDRBlurH_\"+i,new R(1,0),this[n],t,null,to.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,this._floatTextureType),s=new zp(\"HDRBlurV_\"+i,new R(0,1),this[n],t,null,to.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,this._floatTextureType);a.onActivateObservable.add((function(){var e=a.width/o.getRenderWidth();a.kernel=r[n]*e})),s.onActivateObservable.add((function(){var e=s.height/o.getRenderHeight();s.kernel=r.horizontalBlur?64*e:r[n]*e})),this.addEffect(new rb(e.getEngine(),\"HDRBlurH\"+i,(function(){return a}),!0)),this.addEffect(new rb(e.getEngine(),\"HDRBlurV\"+i,(function(){return s}),!0)),this.blurHPostProcesses.push(a),this.blurVPostProcesses.push(s)},t.prototype._createTextureAdderPostProcess=function(e,t){var i=this;this.textureAdderPostProcess=new pa(\"HDRTextureAdder\",\"standard\",[\"exposure\"],[\"otherSampler\",\"lensSampler\"],t,null,to.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,\"#define TEXTURE_ADDER\",this._floatTextureType),this.textureAdderPostProcess.onApply=function(e){e.setTextureFromPostProcess(\"otherSampler\",i._vlsEnabled?i._currentDepthOfFieldSource:i.originalPostProcess),e.setTexture(\"lensSampler\",i.lensTexture),e.setFloat(\"exposure\",i._currentExposure),i._currentDepthOfFieldSource=i.textureAdderFinalPostProcess},this.addEffect(new rb(e.getEngine(),\"HDRTextureAdder\",(function(){return i.textureAdderPostProcess}),!0))},t.prototype._createVolumetricLightPostProcess=function(e,t){var i=this,n=e.enableGeometryBufferRenderer();n.enablePosition=!0;var r=n.getGBuffer();this.volumetricLightPostProcess=new pa(\"HDRVLS\",\"standard\",[\"shadowViewProjection\",\"cameraPosition\",\"sunDirection\",\"sunColor\",\"scatteringCoefficient\",\"scatteringPower\",\"depthValues\"],[\"shadowMapSampler\",\"positionSampler\"],t/8,null,to.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,\"#define VLS\\n#define NB_STEPS \"+this._volumetricLightStepsCount.toFixed(1));var o=R.Zero();this.volumetricLightPostProcess.onApply=function(e){if(i.sourceLight&&i.sourceLight.getShadowGenerator()&&i._scene.activeCamera){var t=i.sourceLight.getShadowGenerator();e.setTexture(\"shadowMapSampler\",t.getShadowMap()),e.setTexture(\"positionSampler\",r.textures[2]),e.setColor3(\"sunColor\",i.sourceLight.diffuse),e.setVector3(\"sunDirection\",i.sourceLight.getShadowDirection()),e.setVector3(\"cameraPosition\",i._scene.activeCamera.globalPosition),e.setMatrix(\"shadowViewProjection\",t.getTransformMatrix()),e.setFloat(\"scatteringCoefficient\",i.volumetricLightCoefficient),e.setFloat(\"scatteringPower\",i.volumetricLightPower),o.x=i.sourceLight.getDepthMinZ(i._scene.activeCamera),o.y=i.sourceLight.getDepthMaxZ(i._scene.activeCamera),e.setVector2(\"depthValues\",o)}},this.addEffect(new rb(e.getEngine(),\"HDRVLS\",(function(){return i.volumetricLightPostProcess}),!0)),this._createBlurPostProcesses(e,t/4,0,\"volumetricLightBlurScale\"),this.volumetricLightMergePostProces=new pa(\"HDRVLSMerge\",\"standard\",[],[\"originalSampler\"],t,null,to.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,\"#define VLSMERGE\"),this.volumetricLightMergePostProces.onApply=function(e){e.setTextureFromPostProcess(\"originalSampler\",i._bloomEnabled?i.textureAdderFinalPostProcess:i.originalPostProcess),i._currentDepthOfFieldSource=i.volumetricLightFinalPostProcess},this.addEffect(new rb(e.getEngine(),\"HDRVLSMerge\",(function(){return i.volumetricLightMergePostProces}),!0))},t.prototype._createLuminancePostProcesses=function(e,i){var n=this,r=Math.pow(3,t.LuminanceSteps);this.luminancePostProcess=new pa(\"HDRLuminance\",\"standard\",[\"lumOffsets\"],[],{width:r,height:r},null,to.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,\"#define LUMINANCE\",i);var o=[];this.luminancePostProcess.onApply=function(e){var t=1/n.luminancePostProcess.width,i=1/n.luminancePostProcess.height;o[0]=-.5*t,o[1]=.5*i,o[2]=.5*t,o[3]=.5*i,o[4]=-.5*t,o[5]=-.5*i,o[6]=.5*t,o[7]=-.5*i,e.setArray2(\"lumOffsets\",o)},this.addEffect(new rb(e.getEngine(),\"HDRLuminance\",(function(){return n.luminancePostProcess}),!0));for(var a=t.LuminanceSteps-1;a>=0;a--){r=Math.pow(3,a);var s=\"#define LUMINANCE_DOWN_SAMPLE\\n\";0===a&&(s+=\"#define FINAL_DOWN_SAMPLER\");var l=new pa(\"HDRLuminanceDownSample\"+a,\"standard\",[\"dsOffsets\",\"halfDestPixelSize\"],[],{width:r,height:r},null,to.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,s,i);this.luminanceDownSamplePostProcesses.push(l)}var c=this.luminancePostProcess;this.luminanceDownSamplePostProcesses.forEach((function(t,i){var r=new Array(18);t.onApply=function(e){if(c){for(var o=0,a=-1;a<2;a++)for(var s=-1;s<2;s++)r[o]=a/c.width,r[o+1]=s/c.height,o+=2;e.setArray2(\"dsOffsets\",r),e.setFloat(\"halfDestPixelSize\",.5/c.width),c=i===n.luminanceDownSamplePostProcesses.length-1?n.luminancePostProcess:t}},i===n.luminanceDownSamplePostProcesses.length-1&&(t.onAfterRender=function(){var t=e.getEngine().readPixels(0,0,1,1),i=new C(1/16581375,1/65025,1/255,1);t.then((function(e){var t=new Uint8Array(e.buffer);n._hdrCurrentLuminance=(t[0]*i.x+t[1]*i.y+t[2]*i.z+t[3]*i.w)/100}))}),n.addEffect(new rb(e.getEngine(),\"HDRLuminanceDownSample\"+i,(function(){return t}),!0))}))},t.prototype._createHdrPostProcess=function(e,t){var i=this,n=[\"#define HDR\"];this._hdrAutoExposure&&n.push(\"#define AUTO_EXPOSURE\"),this.hdrPostProcess=new pa(\"HDR\",\"standard\",[\"averageLuminance\"],[\"textureAdderSampler\"],t,null,to.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,n.join(\"\\n\"),a.TEXTURETYPE_UNSIGNED_INT);var r=1,o=0,s=0;this.hdrPostProcess.onApply=function(t){if(t.setTextureFromPostProcess(\"textureAdderSampler\",i._currentDepthOfFieldSource),o+=e.getEngine().getDeltaTime(),r<0)r=i._hdrCurrentLuminance;else{var n=(s-o)/1e3;i._hdrCurrentLuminancer-i.hdrIncreaseRate*n?r-=i.hdrIncreaseRate*n:r=i._hdrCurrentLuminance}i.hdrAutoExposure?i._currentExposure=i._fixedExposure/r:(r=h.Clamp(r,i.hdrMinimumLuminance,1e20),t.setFloat(\"averageLuminance\",r)),s=o,i._currentDepthOfFieldSource=i.hdrFinalPostProcess},this.addEffect(new rb(e.getEngine(),\"HDR\",(function(){return i.hdrPostProcess}),!0))},t.prototype._createLensFlarePostProcess=function(e,t){var i=this;this.lensFlarePostProcess=new pa(\"HDRLensFlare\",\"standard\",[\"strength\",\"ghostDispersal\",\"haloWidth\",\"resolution\",\"distortionStrength\"],[\"lensColorSampler\"],t/2,null,to.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,\"#define LENS_FLARE\",a.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new rb(e.getEngine(),\"HDRLensFlare\",(function(){return i.lensFlarePostProcess}),!0)),this._createBlurPostProcesses(e,t/4,2,\"lensFlareBlurWidth\"),this.lensFlareComposePostProcess=new pa(\"HDRLensFlareCompose\",\"standard\",[\"lensStarMatrix\"],[\"otherSampler\",\"lensDirtSampler\",\"lensStarSampler\"],t,null,to.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,\"#define LENS_FLARE_COMPOSE\",a.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new rb(e.getEngine(),\"HDRLensFlareCompose\",(function(){return i.lensFlareComposePostProcess}),!0));var n=new R(0,0);this.lensFlarePostProcess.externalTextureSamplerBinding=!0,this.lensFlarePostProcess.onApply=function(e){e.setTextureFromPostProcess(\"textureSampler\",i._bloomEnabled?i.blurHPostProcesses[0]:i.originalPostProcess),e.setTexture(\"lensColorSampler\",i.lensColorTexture),e.setFloat(\"strength\",i.lensFlareStrength),e.setFloat(\"ghostDispersal\",i.lensFlareGhostDispersal),e.setFloat(\"haloWidth\",i.lensFlareHaloWidth),n.x=i.lensFlarePostProcess.width,n.y=i.lensFlarePostProcess.height,e.setVector2(\"resolution\",n),e.setFloat(\"distortionStrength\",i.lensFlareDistortionStrength)};var r=M.FromValues(2,0,-1,0,0,2,-1,0,0,0,1,0,0,0,0,1),o=M.FromValues(.5,0,.5,0,0,.5,.5,0,0,0,1,0,0,0,0,1);this.lensFlareComposePostProcess.onApply=function(e){if(i._scene.activeCamera){e.setTextureFromPostProcess(\"otherSampler\",i.lensFlarePostProcess),e.setTexture(\"lensDirtSampler\",i.lensFlareDirtTexture),e.setTexture(\"lensStarSampler\",i.lensStarTexture);var t=i._scene.activeCamera.getViewMatrix().getRow(0),n=i._scene.activeCamera.getViewMatrix().getRow(2),a=x.Dot(t.toVector3(),new x(1,0,0))+x.Dot(n.toVector3(),new x(0,0,1));a*=4;var s=M.FromValues(.5*Math.cos(a),-Math.sin(a),0,0,Math.sin(a),.5*Math.cos(a),0,0,0,0,1,0,0,0,0,1),l=o.multiply(s).multiply(r);e.setMatrix(\"lensStarMatrix\",l),i._currentDepthOfFieldSource=i.lensFlareFinalPostProcess}}},t.prototype._createDepthOfFieldPostProcess=function(e,t){var i=this;this.depthOfFieldPostProcess=new pa(\"HDRDepthOfField\",\"standard\",[\"distance\"],[\"otherSampler\",\"depthSampler\"],t,null,to.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,\"#define DEPTH_OF_FIELD\",a.TEXTURETYPE_UNSIGNED_INT),this.depthOfFieldPostProcess.onApply=function(e){e.setTextureFromPostProcess(\"otherSampler\",i._currentDepthOfFieldSource),e.setTexture(\"depthSampler\",i._getDepthTexture()),e.setFloat(\"distance\",i.depthOfFieldDistance)},this.addEffect(new rb(e.getEngine(),\"HDRDepthOfField\",(function(){return i.depthOfFieldPostProcess}),!0))},t.prototype._createMotionBlurPostProcess=function(e,t){var i=this;if(this._isObjectBasedMotionBlur){var n=new Rb(\"HDRMotionBlur\",e,t,null,to.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,a.TEXTURETYPE_UNSIGNED_INT);n.motionStrength=this.motionStrength,n.motionBlurSamples=this.motionBlurSamples,this.motionBlurPostProcess=n}else{this.motionBlurPostProcess=new pa(\"HDRMotionBlur\",\"standard\",[\"inverseViewProjection\",\"prevViewProjection\",\"screenSize\",\"motionScale\",\"motionStrength\"],[\"depthSampler\"],t,null,to.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,\"#define MOTION_BLUR\\n#define MAX_MOTION_SAMPLES \"+this.motionBlurSamples.toFixed(1),a.TEXTURETYPE_UNSIGNED_INT);var r=0,o=M.Identity(),s=M.Identity(),l=M.Identity(),c=R.Zero();this.motionBlurPostProcess.onApply=function(t){(l=e.getProjectionMatrix().multiply(e.getViewMatrix())).invertToRef(s),t.setMatrix(\"inverseViewProjection\",s),t.setMatrix(\"prevViewProjection\",o),o=l,c.x=i.motionBlurPostProcess.width,c.y=i.motionBlurPostProcess.height,t.setVector2(\"screenSize\",c),r=e.getEngine().getFps()/60,t.setFloat(\"motionScale\",r),t.setFloat(\"motionStrength\",i.motionStrength),t.setTexture(\"depthSampler\",i._getDepthTexture())}}this.addEffect(new rb(e.getEngine(),\"HDRMotionBlur\",(function(){return i.motionBlurPostProcess}),!0))},t.prototype._getDepthTexture=function(){return this._scene.getEngine().getCaps().drawBuffersExtension?this._scene.enableGeometryBufferRenderer().getGBuffer().textures[0]:this._scene.enableDepthRenderer().getDepthMap()},t.prototype._disposePostProcesses=function(){for(var e=0;e\\n#include\\n#include\\n#include[0..maxSimultaneousMorphTargets]\\n#include\\nuniform mat4 viewProjection;\\nuniform vec2 depthValues;\\n#if defined(ALPHATEST) || defined(NEED_UV)\\nvarying vec2 vUV;\\nuniform mat4 diffuseMatrix;\\n#ifdef UV1\\nattribute vec2 uv;\\n#endif\\n#ifdef UV2\\nattribute vec2 uv2;\\n#endif\\n#endif\\n#define CUSTOM_VERTEX_DEFINITIONS\\nvoid main(void)\\n{\\nvec3 positionUpdated=position;\\n#if (defined(ALPHATEST) || defined(NEED_UV)) && defined(UV1)\\nvec2 uvUpdated=uv;\\n#endif\\n#include\\n#include[0..maxSimultaneousMorphTargets]\\n#include\\n#include\\n#include\\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\\n#if defined(ALPHATEST) || defined(BASIC_RENDER)\\n#ifdef UV1\\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\\n#endif\\n#ifdef UV2\\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\\n#endif\\n#endif\\n}\\n\";It.ShadersStore.volumetricLightScatteringPassPixelShader=\"#if defined(ALPHATEST) || defined(NEED_UV)\\nvarying vec2 vUV;\\n#endif\\n#if defined(ALPHATEST)\\nuniform sampler2D diffuseSampler;\\n#endif\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void)\\n{\\n#if defined(ALPHATEST)\\nvec4 diffuseColor=texture2D(diffuseSampler,vUV);\\nif (diffuseColor.a<0.4)\\ndiscard;\\n#endif\\ngl_FragColor=vec4(0.0,0.0,0.0,1.0);\\n}\\n\";var Gb=function(e){function t(i,n,r,o,a,s,l,c,u){void 0===a&&(a=100),void 0===s&&(s=to.BILINEAR_SAMPLINGMODE);var h,d=this;return(d=e.call(this,i,\"volumetricLightScattering\",[\"decay\",\"exposure\",\"weight\",\"meshPositionOnScreen\",\"density\"],[\"lightScatteringSampler\"],n.postProcessRatio||n,r,s,l,c,\"#define NUM_SAMPLES \"+a)||this)._screenCoordinates=R.Zero(),d.customMeshPosition=x.Zero(),d.useCustomMeshPosition=!1,d.invert=!0,d.excludedMeshes=new Array,d.exposure=.3,d.decay=.96815,d.weight=.58767,d.density=.926,l=(u=null!==(h=null==r?void 0:r.getScene())&&void 0!==h?h:u).getEngine(),d._viewPort=new Rr(0,0,1,1).toGlobal(l.getRenderWidth(),l.getRenderHeight()),d.mesh=null!=o?o:t.CreateDefaultMesh(\"VolumetricLightScatteringMesh\",u),d._createPass(u,n.passRatio||n),d.onActivate=function(e){d.isSupported||d.dispose(e),d.onActivate=null},d.onApplyObservable.add((function(e){d._updateMeshScreenCoordinates(u),e.setTexture(\"lightScatteringSampler\",d._volumetricLightScatteringRTT),e.setFloat(\"exposure\",d.exposure),e.setFloat(\"decay\",d.decay),e.setFloat(\"weight\",d.weight),e.setFloat(\"density\",d.density),e.setVector2(\"meshPositionOnScreen\",d._screenCoordinates)})),d}return V(t,e),Object.defineProperty(t.prototype,\"useDiffuseColor\",{get:function(){return Q.Warn(\"VolumetricLightScatteringPostProcess.useDiffuseColor is no longer used, use the mesh material directly instead\"),!1},set:function(e){Q.Warn(\"VolumetricLightScatteringPostProcess.useDiffuseColor is no longer used, use the mesh material directly instead\")},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return\"VolumetricLightScatteringPostProcess\"},t.prototype._isReady=function(e,t){var i,n=e.getMesh();if(n===this.mesh&&n.material)return n.material.isReady(n);var r=null===(i=n._internalAbstractMeshDataInfo._materialForRenderPass)||void 0===i?void 0:i[this._scene.getEngine().currentRenderPassId];if(r)return r.isReadyForSubMesh(n,e,t);var o=[],a=[wi.PositionKind],s=e.getMaterial();s&&(s.needAlphaTesting()&&o.push(\"#define ALPHATEST\"),n.isVerticesDataPresent(wi.UVKind)&&(a.push(wi.UVKind),o.push(\"#define UV1\")),n.isVerticesDataPresent(wi.UV2Kind)&&(a.push(wi.UV2Kind),o.push(\"#define UV2\"))),n.useBones&&n.computeBonesUsingShaders?(a.push(wi.MatricesIndicesKind),a.push(wi.MatricesWeightsKind),o.push(\"#define NUM_BONE_INFLUENCERS \"+n.numBoneInfluencers),o.push(\"#define BonesPerMesh \"+(n.skeleton?n.skeleton.bones.length+1:0))):o.push(\"#define NUM_BONE_INFLUENCERS 0\"),t&&(o.push(\"#define INSTANCES\"),Pr.PushAttributesForInstances(a),e.getRenderingMesh().hasThinInstances&&o.push(\"#define THIN_INSTANCES\"));var l=e._getDrawWrapper(void 0,!0),c=l.defines,u=o.join(\"\\n\");return c!==u&&l.setEffect(n.getScene().getEngine().createEffect(\"volumetricLightScatteringPass\",a,[\"world\",\"mBones\",\"viewProjection\",\"diffuseMatrix\"],[\"diffuseSampler\"],u,void 0,void 0,void 0,{maxSimultaneousMorphTargets:n.numBoneInfluencers}),u),l.effect.isReady()},t.prototype.setCustomMeshPosition=function(e){this.customMeshPosition=e},t.prototype.getCustomMeshPosition=function(){return this.customMeshPosition},t.prototype.dispose=function(t){var i=t.getScene().customRenderTargets.indexOf(this._volumetricLightScatteringRTT);-1!==i&&t.getScene().customRenderTargets.splice(i,1),this._volumetricLightScatteringRTT.dispose(),e.prototype.dispose.call(this,t)},t.prototype.getPass=function(){return this._volumetricLightScatteringRTT},t.prototype._meshExcluded=function(e){return this.excludedMeshes.length>0&&-1!==this.excludedMeshes.indexOf(e)},t.prototype._createPass=function(e,t){var i=this,n=e.getEngine();this._volumetricLightScatteringRTT=new Ia(\"volumetricLightScatteringMap\",{width:n.getRenderWidth()*t,height:n.getRenderHeight()*t},e,!1,!0,a.TEXTURETYPE_UNSIGNED_INT),this._volumetricLightScatteringRTT.wrapU=to.CLAMP_ADDRESSMODE,this._volumetricLightScatteringRTT.wrapV=to.CLAMP_ADDRESSMODE,this._volumetricLightScatteringRTT.renderList=null,this._volumetricLightScatteringRTT.renderParticles=!1,this._volumetricLightScatteringRTT.ignoreCameraViewport=!0;var r=this.getCamera();r?r.customRenderTargets.push(this._volumetricLightScatteringRTT):e.customRenderTargets.push(this._volumetricLightScatteringRTT);var o,s=function(e){var t,n=e.getRenderingMesh(),r=e.getEffectiveMesh();if(!i._meshExcluded(n)){r._internalAbstractMeshDataInfo._isActiveIntermediate=!1;var o=e.getMaterial();if(o){var a=n.getScene(),s=a.getEngine();s.setState(o.backFaceCulling,void 0,void 0,void 0,o.cullBackFaces);var l=n._getInstancesRenderList(e._id,!!e.getReplacementMesh());if(!l.mustReturn){var c=s.getCaps().instancedArrays&&(null!==l.visibleInstances[e._id]||n.hasThinInstances);if(i._isReady(e,c)){var u=null===(t=r._internalAbstractMeshDataInfo._materialForRenderPass)||void 0===t?void 0:t[s.currentRenderPassId],h=e._getDrawWrapper();if(n!==i.mesh||h||(h=o._getDrawWrapper()),!h)return;var d=h.effect;if(s.enableEffect(h),c||n._bind(e,d,o.fillMode),n===i.mesh)o.bind(r.getWorldMatrix(),n);else if(u)u.bindForSubMesh(r.getWorldMatrix(),r,e);else{if(d.setMatrix(\"viewProjection\",a.getTransformMatrix()),o&&o.needAlphaTesting()){var p=o.getAlphaTestTexture();d.setTexture(\"diffuseSampler\",p),p&&d.setMatrix(\"diffuseMatrix\",p.getTextureMatrix())}n.useBones&&n.computeBonesUsingShaders&&n.skeleton&&d.setMatrices(\"mBones\",n.skeleton.getTransformMatrices(n))}c&&n.hasThinInstances&&d.setMatrix(\"world\",r.getWorldMatrix()),n._processRendering(r,e,d,Ir.TriangleFillMode,l,c,(function(e,t){e||d.setMatrix(\"world\",t)}))}}}}},l=new L(0,0,0,1);this._volumetricLightScatteringRTT.onBeforeRenderObservable.add((function(){o=e.clearColor,e.clearColor=l})),this._volumetricLightScatteringRTT.onAfterRenderObservable.add((function(){e.clearColor=o})),this._volumetricLightScatteringRTT.customIsReadyFunction=function(e,t){if(!e.isReady(!1))return!1;if(0===t&&e.subMeshes)for(var r=0;rt._alphaIndex?1:e._alphaIndext._distanceToCamera?-1:0})),l.setAlphaMode(a.ALPHA_COMBINE),o=0;o\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void) {\\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\\ngl_FragColor=color;\\n#define CUSTOM_FRAGMENT_MAIN_END\\n}\";It.IncludesShadersStore.boundingBoxRendererVertexDeclaration=\"uniform mat4 world;\\nuniform mat4 viewProjection;\\n#ifdef MULTIVIEW\\nuniform mat4 viewProjectionR;\\n#endif\\n\";It.ShadersStore.boundingBoxRendererVertexShader=\"attribute vec3 position;\\n#include<__decl__boundingBoxRendererVertex>\\n#define CUSTOM_VERTEX_DEFINITIONS\\nvoid main(void) {\\n#define CUSTOM_VERTEX_MAIN_BEGIN\\nvec4 worldPos=world*vec4(position,1.0);\\n#ifdef MULTIVIEW\\nif (gl_ViewID_OVR==0u) {\\ngl_Position=viewProjection*worldPos;\\n} else {\\ngl_Position=viewProjectionR*worldPos;\\n}\\n#else\\ngl_Position=viewProjection*worldPos;\\n#endif\\n#define CUSTOM_VERTEX_MAIN_END\\n}\\n\",Object.defineProperty(mn.prototype,\"forceShowBoundingBoxes\",{get:function(){return this._forceShowBoundingBoxes||!1},set:function(e){this._forceShowBoundingBoxes=e,e&&this.getBoundingBoxRenderer()},enumerable:!0,configurable:!0}),mn.prototype.getBoundingBoxRenderer=function(){return this._boundingBoxRenderer||(this._boundingBoxRenderer=new Wb(this)),this._boundingBoxRenderer},Object.defineProperty(Sr.prototype,\"showBoundingBox\",{get:function(){return this._showBoundingBox||!1},set:function(e){this._showBoundingBox=e,e&&this.getScene().getBoundingBoxRenderer()},enumerable:!0,configurable:!0});var Wb=function(){function e(e){this.name=zi.NAME_BOUNDINGBOXRENDERER,this.frontColor=new N(1,1,1),this.backColor=new N(.1,.1,.1),this.showBackLines=!0,this.onBeforeBoxRenderingObservable=new u,this.onAfterBoxRenderingObservable=new u,this.onResourcesReadyObservable=new u,this.enabled=!0,this.renderList=new yi(32),this._vertexBuffers={},this._fillIndexBuffer=null,this._fillIndexData=null,this.scene=e,e._addComponent(this),this._uniformBufferFront=new Li(this.scene.getEngine(),void 0,void 0,\"BoundingBoxRendererFront\",!this.scene.getEngine().isWebGPU),this._buildUniformLayout(this._uniformBufferFront),this._uniformBufferBack=new Li(this.scene.getEngine(),void 0,void 0,\"BoundingBoxRendererBack\",!this.scene.getEngine().isWebGPU),this._buildUniformLayout(this._uniformBufferBack)}return e.prototype._buildUniformLayout=function(e){e.addUniform(\"color\",4),e.addUniform(\"world\",16),e.addUniform(\"viewProjection\",16),e.addUniform(\"viewProjectionR\",16),e.create()},e.prototype.register=function(){this.scene._beforeEvaluateActiveMeshStage.registerStep(zi.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER,this,this.reset),this.scene._preActiveMeshStage.registerStep(zi.STEP_PREACTIVEMESH_BOUNDINGBOXRENDERER,this,this._preActiveMesh),this.scene._evaluateSubMeshStage.registerStep(zi.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER,this,this._evaluateSubMesh),this.scene._afterRenderingGroupDrawStage.registerStep(zi.STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER,this,this.render)},e.prototype._evaluateSubMesh=function(e,t){if(e.showSubMeshesBoundingBox){var i=t.getBoundingInfo();null!=i&&(i.boundingBox._tag=e.renderingGroupId,this.renderList.push(i.boundingBox))}},e.prototype._preActiveMesh=function(e){if(e.showBoundingBox||this.scene.forceShowBoundingBoxes){var t=e.getBoundingInfo();t.boundingBox._tag=e.renderingGroupId,this.renderList.push(t.boundingBox)}},e.prototype._prepareResources=function(){if(!this._colorShader){this._colorShader=new eu(\"colorShader\",this.scene,\"boundingBoxRenderer\",{attributes:[wi.PositionKind],uniforms:[\"world\",\"viewProjection\",\"viewProjectionR\",\"color\"],uniformBuffers:[\"BoundingBoxRenderer\"]},!1),this._colorShader.reservedDataStore={hidden:!0},this._colorShaderForOcclusionQuery=new eu(\"colorShaderOccQuery\",this.scene,\"boundingBoxRenderer\",{attributes:[wi.PositionKind],uniforms:[\"world\",\"viewProjection\",\"viewProjectionR\",\"color\"],uniformBuffers:[\"BoundingBoxRenderer\"]},!0),this._colorShaderForOcclusionQuery.reservedDataStore={hidden:!0};var e=this.scene.getEngine(),t=zc({size:1});this._vertexBuffers[wi.PositionKind]=new wi(e,t.positions,wi.PositionKind,!1),this._createIndexBuffer(),this._fillIndexData=t.indices,this.onResourcesReadyObservable.notifyObservers(this)}},e.prototype._createIndexBuffer=function(){var e=this.scene.getEngine();this._indexBuffer=e.createIndexBuffer([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,7,1,6,2,5,3,4])},e.prototype.rebuild=function(){var e=this._vertexBuffers[wi.PositionKind];e&&e._rebuild(),this._createIndexBuffer()},e.prototype.reset=function(){this.renderList.reset()},e.prototype.render=function(e){var t,i;if(0!==this.renderList.length&&this.enabled&&(this._prepareResources(),this._colorShader.isReady())){var n=this.scene.getEngine();n.setDepthWrite(!1);for(var r=this.frontColor.toColor4(),o=this.backColor.toColor4(),a=this.scene.getTransformMatrix(),s=0;s\\nuniform vec4 color;\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void) {\\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\\n#include\\ngl_FragColor=color;\\n#define CUSTOM_FRAGMENT_MAIN_END\\n}\";It.ShadersStore.lineVertexShader=\"#include\\n#include\\nattribute vec3 position;\\nattribute vec4 normal;\\nuniform mat4 viewProjection;\\nuniform float width;\\nuniform float aspectRatio;\\n#define CUSTOM_VERTEX_DEFINITIONS\\nvoid main(void) {\\n#define CUSTOM_VERTEX_MAIN_BEGIN\\n#include\\nmat4 worldViewProjection=viewProjection*finalWorld;\\nvec4 viewPosition=worldViewProjection*vec4(position,1.0);\\nvec4 viewPositionNext=worldViewProjection*vec4(normal.xyz,1.0);\\nvec2 currentScreen=viewPosition.xy/viewPosition.w;\\nvec2 nextScreen=viewPositionNext.xy/viewPositionNext.w;\\ncurrentScreen.x*=aspectRatio;\\nnextScreen.x*=aspectRatio;\\nvec2 dir=normalize(nextScreen-currentScreen);\\nvec2 normalDir=vec2(-dir.y,dir.x);\\nnormalDir*=width/2.0;\\nnormalDir.x/=aspectRatio;\\nvec4 offset=vec4(normalDir*normal.w,0.0,0.0);\\ngl_Position=viewPosition+offset;\\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6)\\nvec4 worldPos=finalWorld*vec4(position,1.0);\\n#include\\n#endif\\n#define CUSTOM_VERTEX_MAIN_END\\n}\",Sr.prototype.disableEdgesRendering=function(){return this._edgesRenderer&&(this._edgesRenderer.dispose(),this._edgesRenderer=null),this},Sr.prototype.enableEdgesRendering=function(e,t,i){return void 0===e&&(e=.95),void 0===t&&(t=!1),this.disableEdgesRendering(),this._edgesRenderer=new Qb(this,e,t,!0,i),this},Object.defineProperty(Sr.prototype,\"edgesRenderer\",{get:function(){return this._edgesRenderer},enumerable:!0,configurable:!0}),tu.prototype.enableEdgesRendering=function(e,t){return void 0===e&&(e=.95),void 0===t&&(t=!1),this.disableEdgesRendering(),this._edgesRenderer=new qb(this,e,t),this},iu.prototype.enableEdgesRendering=function(e,t){return void 0===e&&(e=.95),void 0===t&&(t=!1),tu.prototype.enableEdgesRendering.apply(this,arguments),this};var Kb=function(){this.edges=new Array,this.edgesConnectedCount=0},Qb=function(){function e(e,t,i,n,r){void 0===t&&(t=.95),void 0===i&&(i=!1),void 0===n&&(n=!0);var o,a=this;this.edgesWidthScalerForOrthographic=1e3,this.edgesWidthScalerForPerspective=50,this._linesPositions=new Array,this._linesNormals=new Array,this._linesIndices=new Array,this._buffers={},this._buffersForInstances={},this._checkVerticesInsteadOfIndices=!1,this.isEnabled=!0,this.customInstances=new yi(32),this._source=e,this._checkVerticesInsteadOfIndices=i,this._options=null!=r?r:null,this._epsilon=t,this._source.getScene().getEngine().isWebGPU&&(this._drawWrapper=new Ht(e.getEngine())),this._prepareRessources(),n&&(null===(o=null==r?void 0:r.useAlternateEdgeFinder)||void 0===o||o?this._generateEdgesLinesAlternate():this._generateEdgesLines()),this._meshRebuildObserver=this._source.onRebuildObservable.add((function(){a._rebuild()})),this._meshDisposeObserver=this._source.onDisposeObservable.add((function(){a.dispose()}))}return Object.defineProperty(e.prototype,\"linesPositions\",{get:function(){return this._linesPositions},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"linesNormals\",{get:function(){return this._linesNormals},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"linesIndices\",{get:function(){return this._linesIndices},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"lineShader\",{get:function(){return this._lineShader},set:function(e){this._lineShader=e},enumerable:!1,configurable:!0}),e._GetShader=function(e){if(!e._edgeRenderLineShader){var t=new eu(\"lineShader\",e,\"line\",{attributes:[\"position\",\"normal\"],uniforms:[\"world\",\"viewProjection\",\"color\",\"width\",\"aspectRatio\"]},!1);t.disableDepthWrite=!0,t.backFaceCulling=!1,t.checkReadyOnEveryCall=e.getEngine().isWebGPU,e._edgeRenderLineShader=t}return e._edgeRenderLineShader},e.prototype._prepareRessources=function(){this._lineShader||(this._lineShader=e._GetShader(this._source.getScene()))},e.prototype._rebuild=function(){var e=this._buffers[wi.PositionKind];e&&e._rebuild(),(e=this._buffers[wi.NormalKind])&&e._rebuild();var t=this._source.getScene().getEngine();this._ib=t.createIndexBuffer(this._linesIndices)},e.prototype.dispose=function(){var e;this._source.onRebuildObservable.remove(this._meshRebuildObserver),this._source.onDisposeObservable.remove(this._meshDisposeObserver);var t=this._buffers[wi.PositionKind];t&&(t.dispose(),this._buffers[wi.PositionKind]=null),(t=this._buffers[wi.NormalKind])&&(t.dispose(),this._buffers[wi.NormalKind]=null),this._ib&&this._source.getScene().getEngine()._releaseBuffer(this._ib),this._lineShader.dispose(),null===(e=this._drawWrapper)||void 0===e||e.dispose()},e.prototype._processEdgeForAdjacencies=function(e,t,i,n,r){return e===i&&t===n||e===n&&t===i?0:e===n&&t===r||e===r&&t===n?1:e===r&&t===i||e===i&&t===r?2:-1},e.prototype._processEdgeForAdjacenciesWithVertices=function(e,t,i,n,r){var o=1e-10;return e.equalsWithEpsilon(i,o)&&t.equalsWithEpsilon(n,o)||e.equalsWithEpsilon(n,o)&&t.equalsWithEpsilon(i,o)?0:e.equalsWithEpsilon(n,o)&&t.equalsWithEpsilon(r,o)||e.equalsWithEpsilon(r,o)&&t.equalsWithEpsilon(n,o)?1:e.equalsWithEpsilon(r,o)&&t.equalsWithEpsilon(i,o)||e.equalsWithEpsilon(i,o)&&t.equalsWithEpsilon(r,o)?2:-1},e.prototype._checkEdge=function(e,t,i,n,r){(void 0===t||x.Dot(i[e],i[t])=0&&t.push(i);for(var n=0;n=e[0].length&&e[1].length>=e[2].length?o=1:e[2].length>=e[0].length&&e[2].length>=e[1].length&&(o=2);for(var a=0;a<3;++a)a===o?e[a].sort((function(e,t){return e[1]t[1]?1:0})):e[a].sort((function(e,t){return e[1]>t[1]?-1:e[1]=o+1;--u)r(e[u%3],l,u!==o+2?n[i[t+(u+1)%3]]:-1);var h=l.length;i.push(n[i[t+o]],s[0],l[0]),i.push(n[i[t+(o+1)%3]],l[h-1],s[c-1]);for(var d=c<=h,p=d?c:h,f=d?h:c,_=d?c-1:h-1,m=d?0:1,g=c+h-2,v=0,y=0,b=d?s:l,T=d?l:s,E=0;g-- >0;){m?i.push(b[v],T[y]):i.push(T[y],b[v]);var S=void 0;(E+=p)>=f&&v<_?(S=b[++v],E-=f):S=T[++y],i.push(S)}i[t+0]=i[i.length-3],i[t+1]=i[i.length-2],i[t+2]=i[i.length-1],i.length=i.length-3},e.prototype._generateEdgesLinesAlternate=function(){var e,t,i,n,r,o,a,s,l,c,u=this._source.getVerticesData(wi.PositionKind),h=this._source.getIndices();if(h&&u){Array.isArray(h)||(h=Array.from(h));var d=null===(t=null===(e=this._options)||void 0===e?void 0:e.useFastVertexMerger)||void 0===t||t,p=d?Math.round(-Math.log(null!==(n=null===(i=this._options)||void 0===i?void 0:i.epsilonVertexMerge)&&void 0!==n?n:1e-6)/Math.log(10)):null!==(o=null===(r=this._options)||void 0===r?void 0:r.epsilonVertexMerge)&&void 0!==o?o:1e-6,f=[],_=[];if(d)for(var m={},g=0;gF){var te=L;L=F,F=te}(ne=$[ie=L+\"_\"+F])?ne.done||(x.Dot(ee,ne.normal)0||this._source.hasThinInstances)},e.prototype.render=function(){var e=this._source.getScene(),t=this._lineShader._getDrawWrapper();if(this._drawWrapper&&this._lineShader._setDrawWrapper(this._drawWrapper),this.isReady()&&e.activeCamera){var i=this._source.hasInstances&&this.customInstances.length>0,n=i||this._source.hasThinInstances,r=0;if(n)if(this._buffersForInstances.world0=this._source.getVertexBuffer(\"world0\"),this._buffersForInstances.world1=this._source.getVertexBuffer(\"world1\"),this._buffersForInstances.world2=this._source.getVertexBuffer(\"world2\"),this._buffersForInstances.world3=this._source.getVertexBuffer(\"world3\"),i){var o=this._source._instanceDataStorage;if(r=this.customInstances.length,!o.instancesData)return void(this._source.getScene()._activeMeshesFrozen||this.customInstances.reset());if(!o.isFrozen){for(var s=0,l=0;l0&&(t.push(!0),i.push(!1));this._multiRenderAttachments=this._engine.buildTextureLayout(e),this._clearAttachments=this._engine.buildTextureLayout(t),this._defaultAttachments=this._engine.buildTextureLayout(i)},e.prototype._resetLayout=function(){for(var t=0;t=0;e--)this.renderTargets[e].dispose();for(e=0;e\\n#include\\n#include\\n#include\\nvarying vec2 vUV;\\nuniform vec2 texelSize;\\nuniform sampler2D textureSampler;\\nuniform sampler2D irradianceSampler;\\nuniform sampler2D depthSampler;\\nuniform sampler2D albedoSampler;\\nuniform vec2 viewportSize;\\nuniform float metersPerUnit;\\nconst float LOG2_E=1.4426950408889634;\\nconst float SSS_PIXELS_PER_SAMPLE=4.;\\nconst int _SssSampleBudget=40;\\n#define rcp(x) 1./x\\n#define Sq(x) x*x\\n#define SSS_BILATERAL_FILTER true\\nvec3 EvalBurleyDiffusionProfile(float r,vec3 S)\\n{\\nvec3 exp_13=exp2(((LOG2_E*(-1.0/3.0))*r)*S); \\nvec3 expSum=exp_13*(1.+exp_13*exp_13); \\nreturn (S*rcp(8.*PI))*expSum; \\n}\\nvec2 SampleBurleyDiffusionProfile(float u,float rcpS)\\n{\\nu=1.-u; \\nfloat g=1.+(4.*u)*(2.*u+sqrt(1.+(4.*u)*u));\\nfloat n=exp2(log2(g)*(-1.0/3.0)); \\nfloat p=(g*n)*n; \\nfloat c=1.+p+n; \\nfloat d=(3./LOG2_E*2.)+(3./LOG2_E)*log2(u); \\nfloat x=(3./LOG2_E)*log2(c)-d; \\nfloat rcpExp=((c*c)*c)*rcp((4.*u)*((c*c)+(4.*u)*(4.*u)));\\nfloat r=x*rcpS;\\nfloat rcpPdf=(8.*PI*rcpS)*rcpExp; \\nreturn vec2(r,rcpPdf);\\n}\\nvec3 ComputeBilateralWeight(float xy2,float z,float mmPerUnit,vec3 S,float rcpPdf)\\n{\\n#ifndef SSS_BILATERAL_FILTER\\nz=0.;\\n#endif\\nfloat r=sqrt(xy2+(z*mmPerUnit)*(z*mmPerUnit));\\nfloat area=rcpPdf;\\n#if SSS_CLAMP_ARTIFACT\\nreturn clamp(EvalBurleyDiffusionProfile(r,S)*area,0.0,1.0);\\n#else\\nreturn EvalBurleyDiffusionProfile(r,S)*area;\\n#endif\\n}\\nvoid EvaluateSample(int i,int n,vec3 S,float d,vec3 centerPosVS,float mmPerUnit,float pixelsPerMm,\\nfloat phase,inout vec3 totalIrradiance,inout vec3 totalWeight)\\n{\\nfloat scale =rcp(float(n));\\nfloat offset=rcp(float(n))*0.5;\\nfloat sinPhase,cosPhase;\\nsinPhase=sin(phase);\\ncosPhase=cos(phase);\\nvec2 bdp=SampleBurleyDiffusionProfile(float(i)*scale+offset,d);\\nfloat r=bdp.x;\\nfloat rcpPdf=bdp.y;\\nfloat phi=SampleDiskGolden(i,n).y;\\nfloat sinPhi,cosPhi;\\nsinPhi=sin(phi);\\ncosPhi=cos(phi);\\nfloat sinPsi=cosPhase*sinPhi+sinPhase*cosPhi; \\nfloat cosPsi=cosPhase*cosPhi-sinPhase*sinPhi; \\nvec2 vec=r*vec2(cosPsi,sinPsi);\\nvec2 position; \\nfloat xy2;\\nposition=vUV+round((pixelsPerMm*r)*vec2(cosPsi,sinPsi))*texelSize;\\nxy2 =r*r;\\nvec4 textureSample=texture2D(irradianceSampler,position);\\nfloat viewZ=texture2D(depthSampler,position).r;\\nvec3 irradiance =textureSample.rgb;\\nif (testLightingForSSS(textureSample.a))\\n{\\nfloat relZ=viewZ-centerPosVS.z;\\nvec3 weight=ComputeBilateralWeight(xy2,relZ,mmPerUnit,S,rcpPdf);\\ntotalIrradiance+=weight*irradiance;\\ntotalWeight +=weight;\\n}\\nelse\\n{\\n}\\n}\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void) \\n{\\nvec4 irradianceAndDiffusionProfile =texture2D(irradianceSampler,vUV);\\nvec3 centerIrradiance=irradianceAndDiffusionProfile.rgb;\\nint diffusionProfileIndex=int(round(irradianceAndDiffusionProfile.a*255.));\\nfloat centerDepth =0.;\\nvec4 inputColor=texture2D(textureSampler,vUV);\\nbool passedStencilTest=testLightingForSSS(irradianceAndDiffusionProfile.a);\\nif (passedStencilTest)\\n{\\ncenterDepth=texture2D(depthSampler,vUV).r;\\n}\\nif (!passedStencilTest) { \\ngl_FragColor=inputColor;\\nreturn;\\n}\\nfloat distScale =1.;\\nvec3 S =diffusionS[diffusionProfileIndex];\\nfloat d =diffusionD[diffusionProfileIndex];\\nfloat filterRadius=filterRadii[diffusionProfileIndex];\\nvec2 centerPosNDC=vUV;\\nvec2 cornerPosNDC=vUV+0.5*texelSize;\\nvec3 centerPosVS =vec3(centerPosNDC*viewportSize,1.0)*centerDepth; \\nvec3 cornerPosVS =vec3(cornerPosNDC*viewportSize,1.0)*centerDepth; \\nfloat mmPerUnit =1000.*(metersPerUnit*rcp(distScale));\\nfloat unitsPerMm=rcp(mmPerUnit);\\nfloat unitsPerPixel=2.*abs(cornerPosVS.x-centerPosVS.x);\\nfloat pixelsPerMm =rcp(unitsPerPixel)*unitsPerMm;\\nfloat filterArea =PI*Sq(filterRadius*pixelsPerMm);\\nint sampleCount =int(filterArea*rcp(SSS_PIXELS_PER_SAMPLE));\\nint sampleBudget=_SssSampleBudget;\\nint texturingMode=0;\\nvec3 albedo =texture2D(albedoSampler,vUV).rgb;\\nif (distScale==0. || sampleCount<1)\\n{\\n#ifdef DEBUG_SSS_SAMPLES\\nvec3 green=vec3(0.,1.,0.);\\ngl_FragColor=vec4(green,1.0);\\nreturn;\\n#endif\\ngl_FragColor=vec4(inputColor.rgb+albedo*centerIrradiance,1.0);\\nreturn;\\n}\\n#ifdef DEBUG_SSS_SAMPLES\\nvec3 red =vec3(1.,0.,0.);\\nvec3 blue=vec3(0.,0.,1.);\\ngl_FragColor=vec4(mix(blue,red,clamp(float(sampleCount)/float(sampleBudget),0.0,1.0)),1.0);\\nreturn;\\n#endif\\nfloat phase=0.;\\nint n=min(sampleCount,sampleBudget);\\nvec3 centerWeight =vec3(0.); \\nvec3 totalIrradiance=vec3(0.);\\nvec3 totalWeight =vec3(0.);\\nfor (int i=0; i=5)return Q.Error(\"You already reached the maximum number of diffusion profiles.\"),0;for(var t=0;t\\n#include\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void) {\\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\\n#include\\n#ifdef ALPHATEST\\nif (texture2D(diffuseSampler,vUV).a<0.4)\\ndiscard;\\n#endif\\n#include\\ngl_FragColor=color;\\n#define CUSTOM_FRAGMENT_MAIN_END\\n}\";It.ShadersStore.outlineVertexShader=\"attribute vec3 position;\\nattribute vec3 normal;\\n#include\\n#include\\n#include\\n#include[0..maxSimultaneousMorphTargets]\\n#include\\nuniform float offset;\\n#include\\nuniform mat4 viewProjection;\\n#ifdef ALPHATEST\\nvarying vec2 vUV;\\nuniform mat4 diffuseMatrix;\\n#ifdef UV1\\nattribute vec2 uv;\\n#endif\\n#ifdef UV2\\nattribute vec2 uv2;\\n#endif\\n#endif\\n#include\\n#define CUSTOM_VERTEX_DEFINITIONS\\nvoid main(void)\\n{\\nvec3 positionUpdated=position;\\nvec3 normalUpdated=normal;\\n#ifdef UV1\\nvec2 uvUpdated=uv;\\n#endif\\n#include\\n#include[0..maxSimultaneousMorphTargets]\\nvec3 offsetPosition=positionUpdated+(normalUpdated*offset);\\n#include\\n#include\\n#include\\nvec4 worldPos=finalWorld*vec4(offsetPosition,1.0);\\ngl_Position=viewProjection*worldPos;\\n#ifdef ALPHATEST\\n#ifdef UV1\\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\\n#endif\\n#ifdef UV2\\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\\n#endif\\n#endif\\n#include\\n#include\\n}\\n\",mn.prototype.getOutlineRenderer=function(){return this._outlineRenderer||(this._outlineRenderer=new nT(this)),this._outlineRenderer},Object.defineProperty(Ur.prototype,\"renderOutline\",{get:function(){return this._renderOutline},set:function(e){e&&this.getScene().getOutlineRenderer(),this._renderOutline=e},enumerable:!0,configurable:!0}),Object.defineProperty(Ur.prototype,\"renderOverlay\",{get:function(){return this._renderOverlay},set:function(e){e&&this.getScene().getOutlineRenderer(),this._renderOverlay=e},enumerable:!0,configurable:!0});var nT=function(){function e(e){this.name=zi.NAME_OUTLINERENDERER,this.zOffset=1,this.zOffsetUnits=4,this.scene=e,this._engine=e.getEngine(),this.scene._addComponent(this),this._passIdForDrawWrapper=[];for(var t=0;t<4;++t)this._passIdForDrawWrapper[t]=this._engine.createRenderPassId(\"Outline Renderer (\".concat(t,\")\"))}return e.prototype.register=function(){this.scene._beforeRenderingMeshStage.registerStep(zi.STEP_BEFORERENDERINGMESH_OUTLINE,this,this._beforeRenderingMesh),this.scene._afterRenderingMeshStage.registerStep(zi.STEP_AFTERRENDERINGMESH_OUTLINE,this,this._afterRenderingMesh)},e.prototype.rebuild=function(){},e.prototype.dispose=function(){for(var e=0;e4&&(r.push(wi.MatricesIndicesExtraKind),r.push(wi.MatricesWeightsExtraKind)),n.push(\"#define NUM_BONE_INFLUENCERS \"+o.numBoneInfluencers),n.push(\"#define BonesPerMesh \"+(o.skeleton?o.skeleton.bones.length+1:0))):n.push(\"#define NUM_BONE_INFLUENCERS 0\");var l=o.morphTargetManager,c=0;l&&l.numInfluencers>0&&(c=l.numInfluencers,n.push(\"#define MORPHTARGETS\"),n.push(\"#define NUM_MORPH_INFLUENCERS \"+c),l.isUsingTextureForTargets&&n.push(\"#define MORPHTARGETS_TEXTURE\"),Pr.PrepareAttributesForMorphTargetsInfluencers(r,o,c)),t&&(n.push(\"#define INSTANCES\"),Pr.PushAttributesForInstances(r),e.getRenderingMesh().hasThinInstances&&n.push(\"#define THIN_INSTANCES\")),s.clipPlane&&n.push(\"#define CLIPPLANE\"),s.clipPlane2&&n.push(\"#define CLIPPLANE2\"),s.clipPlane3&&n.push(\"#define CLIPPLANE3\"),s.clipPlane4&&n.push(\"#define CLIPPLANE4\"),s.clipPlane5&&n.push(\"#define CLIPPLANE5\"),s.clipPlane6&&n.push(\"#define CLIPPLANE6\");var u=e._getDrawWrapper(i,!0),h=u.defines,d=n.join(\"\\n\");return h!==d&&u.setEffect(this.scene.getEngine().createEffect(\"outline\",r,[\"world\",\"mBones\",\"viewProjection\",\"diffuseMatrix\",\"offset\",\"color\",\"logarithmicDepthConstant\",\"morphTargetInfluences\",\"morphTargetTextureInfo\",\"morphTargetTextureIndices\",\"vClipPlane\",\"vClipPlane2\",\"vClipPlane3\",\"vClipPlane4\",\"vClipPlane5\",\"vClipPlane6\"],[\"diffuseSampler\",\"morphTargets\"],d,void 0,void 0,void 0,{maxSimultaneousMorphTargets:c}),d),u.effect.isReady()},e.prototype._beforeRenderingMesh=function(t,i,n){if(this._savedDepthWrite=this._engine.getDepthWrite(),t.renderOutline){var r=i.getMaterial();r&&r.needAlphaBlendingForMesh(t)&&(this._engine.cacheStencilState(),this._engine.setDepthWrite(!1),this._engine.setColorWrite(!1),this._engine.setStencilBuffer(!0),this._engine.setStencilOperationPass(a.REPLACE),this._engine.setStencilFunction(a.ALWAYS),this._engine.setStencilMask(e._StencilReference),this._engine.setStencilFunctionReference(e._StencilReference),this._engine.stencilStateComposer.useStencilGlobalOnly=!0,this.render(i,n,!0,this._passIdForDrawWrapper[1]),this._engine.setColorWrite(!0),this._engine.setStencilFunction(a.NOTEQUAL)),this._engine.setDepthWrite(!1),this.render(i,n,!1,this._passIdForDrawWrapper[0]),this._engine.setDepthWrite(this._savedDepthWrite),r&&r.needAlphaBlendingForMesh(t)&&(this._engine.stencilStateComposer.useStencilGlobalOnly=!1,this._engine.restoreStencilState())}},e.prototype._afterRenderingMesh=function(e,t,i){if(e.renderOverlay){var n=this._engine.getAlphaMode(),r=this._engine.alphaState.alphaBlend;this._engine.setAlphaMode(a.ALPHA_COMBINE),this.render(t,i,!0,this._passIdForDrawWrapper[3]),this._engine.setAlphaMode(n),this._engine.setDepthWrite(this._savedDepthWrite),this._engine.alphaState.alphaBlend=r}e.renderOutline&&this._savedDepthWrite&&(this._engine.setDepthWrite(!0),this._engine.setColorWrite(!1),this.render(t,i,!1,this._passIdForDrawWrapper[2]),this._engine.setColorWrite(!0))},e._StencilReference=4,e}(),rT=function(e){function t(t,i){var n=e.call(this)||this;return n.name=t,n.animations=new Array,n.isPickable=!1,n.useAlphaForPicking=!1,n.onDisposeObservable=new u,n._onAnimationEnd=null,n._endAnimation=function(){n._onAnimationEnd&&n._onAnimationEnd(),n.disposeWhenFinishedAnimating&&n.dispose()},n.color=new L(1,1,1,1),n.position=x.Zero(),n._manager=i,n._manager.sprites.push(n),n.uniqueId=n._manager.scene.getUniqueId(),n}return V(t,e),Object.defineProperty(t.prototype,\"size\",{get:function(){return this.width},set:function(e){this.width=e,this.height=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"manager\",{get:function(){return this._manager},enumerable:!1,configurable:!0}),t.prototype.getClassName=function(){return\"Sprite\"},Object.defineProperty(t.prototype,\"fromIndex\",{get:function(){return this._fromIndex},set:function(e){this.playAnimation(e,this._toIndex,this._loopAnimation,this._delay,this._onAnimationEnd)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"toIndex\",{get:function(){return this._toIndex},set:function(e){this.playAnimation(this._fromIndex,e,this._loopAnimation,this._delay,this._onAnimationEnd)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"loopAnimation\",{get:function(){return this._loopAnimation},set:function(e){this.playAnimation(this._fromIndex,this._toIndex,e,this._delay,this._onAnimationEnd)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"delay\",{get:function(){return Math.max(this._delay,1)},set:function(e){this.playAnimation(this._fromIndex,this._toIndex,this._loopAnimation,e,this._onAnimationEnd)},enumerable:!1,configurable:!0}),t.prototype.playAnimation=function(t,i,n,r,o){void 0===o&&(o=null),this._onAnimationEnd=o,e.prototype.playAnimation.call(this,t,i,n,r,this._endAnimation)},t.prototype.dispose=function(){for(var e=0;ethis._delay&&(this._time=this._time%this._delay,this.cellIndex+=this._direction,(this._direction>0&&this.cellIndex>this._toIndex||this._direction<0&&this.cellIndex0?this._fromIndex:this._toIndex:(this.cellIndex=this._toIndex,this._animationStarted=!1,this._onBaseAnimationEnd&&this._onBaseAnimationEnd()))))},e}());mn.prototype._internalPickSprites=function(e,t,i,n){if(!Bi)return null;var r=null;if(!n){if(!this.activeCamera)return null;n=this.activeCamera}if(this.spriteManagers.length>0)for(var o=0;o=r.distance))&&(r=s,i))break}}return r||new Bi},mn.prototype._internalMultiPickSprites=function(e,t,i){if(!Bi)return null;var n=new Array;if(!i){if(!this.activeCamera)return null;i=this.activeCamera}if(this.spriteManagers.length>0)for(var r=0;r0&&(i=r.pickSprite(e,t,this._spritePredicate,!1,r.cameraToUseForPointers||void 0))&&i.hit&&i.pickedSprite&&i.pickedSprite.actionManager){switch(r._pickedDownSprite=i.pickedSprite,n.button){case 0:i.pickedSprite.actionManager.processTrigger(a.ACTION_OnLeftPickTrigger,B.CreateNewFromSprite(i.pickedSprite,r,n));break;case 1:i.pickedSprite.actionManager.processTrigger(a.ACTION_OnCenterPickTrigger,B.CreateNewFromSprite(i.pickedSprite,r,n));break;case 2:i.pickedSprite.actionManager.processTrigger(a.ACTION_OnRightPickTrigger,B.CreateNewFromSprite(i.pickedSprite,r,n))}i.pickedSprite.actionManager&&i.pickedSprite.actionManager.processTrigger(a.ACTION_OnPickDownTrigger,B.CreateNewFromSprite(i.pickedSprite,r,n))}return i},e.prototype._pointerUp=function(e,t,i,n,r){var o=this.scene;if(o.spriteManagers.length>0){var s=o.pickSprite(e,t,this._spritePredicate,!1,o.cameraToUseForPointers||void 0);s&&(s.hit&&s.pickedSprite&&s.pickedSprite.actionManager&&(s.pickedSprite.actionManager.processTrigger(a.ACTION_OnPickUpTrigger,B.CreateNewFromSprite(s.pickedSprite,o,n)),s.pickedSprite.actionManager&&(this.scene._inputManager._isPointerSwiping()||s.pickedSprite.actionManager.processTrigger(a.ACTION_OnPickTrigger,B.CreateNewFromSprite(s.pickedSprite,o,n)),r&&s.pickedSprite.actionManager.processTrigger(a.ACTION_OnDoublePickTrigger,B.CreateNewFromSprite(s.pickedSprite,o,n)))),o._pickedDownSprite&&o._pickedDownSprite.actionManager&&o._pickedDownSprite!==s.pickedSprite&&o._pickedDownSprite.actionManager.processTrigger(a.ACTION_OnPickOutTrigger,B.CreateNewFromSprite(o._pickedDownSprite,o,n)))}return i},e}();It.IncludesShadersStore.imageProcessingCompatibility=\"#ifdef IMAGEPROCESSINGPOSTPROCESS\\ngl_FragColor.rgb=pow(gl_FragColor.rgb,vec3(2.2));\\n#endif\\n\";It.ShadersStore.spritesPixelShader=\"uniform bool alphaTest;\\nvarying vec4 vColor;\\nvarying vec2 vUV;\\nuniform sampler2D diffuseSampler;\\n#include\\n#define CUSTOM_FRAGMENT_DEFINITIONS\\nvoid main(void) {\\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\\nvec4 color=texture2D(diffuseSampler,vUV);\\nif (float(alphaTest) != 0.)\\n{\\nif (color.a<0.95)\\ndiscard;\\n}\\ncolor*=vColor;\\n#include\\ngl_FragColor=color;\\n#include\\n#define CUSTOM_FRAGMENT_MAIN_END\\n}\";It.ShadersStore.spritesVertexShader=\"attribute vec4 position;\\nattribute vec2 options;\\nattribute vec2 offsets;\\nattribute vec2 inverts;\\nattribute vec4 cellInfo;\\nattribute vec4 color;\\nuniform mat4 view;\\nuniform mat4 projection;\\nvarying vec2 vUV;\\nvarying vec4 vColor;\\n#include\\n#define CUSTOM_VERTEX_DEFINITIONS\\nvoid main(void) {\\n#define CUSTOM_VERTEX_MAIN_BEGIN\\nvec3 viewPos=(view*vec4(position.xyz,1.0)).xyz; \\nvec2 cornerPos;\\nfloat angle=position.w;\\nvec2 size=vec2(options.x,options.y);\\nvec2 offset=offsets.xy;\\ncornerPos=vec2(offset.x-0.5,offset.y -0.5)*size;\\nvec3 rotatedCorner;\\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\\nrotatedCorner.z=0.;\\nviewPos+=rotatedCorner;\\ngl_Position=projection*vec4(viewPos,1.0); \\nvColor=color;\\nvec2 uvOffset=vec2(abs(offset.x-inverts.x),abs(1.0-offset.y-inverts.y));\\nvec2 uvPlace=cellInfo.xy;\\nvec2 uvSize=cellInfo.zw;\\nvUV.x=uvPlace.x+uvSize.x*uvOffset.x;\\nvUV.y=uvPlace.y+uvSize.y*uvOffset.y;\\n#ifdef FOG\\nvFogDistance=viewPos;\\n#endif\\n#define CUSTOM_VERTEX_MAIN_END\\n}\";var aT=function(){function e(e,t,i,n){void 0===i&&(i=.01),void 0===n&&(n=null),this.blendMode=a.ALPHA_COMBINE,this.autoResetAlpha=!0,this.disableDepthWrite=!1,this.fogEnabled=!0,this._useVAO=!1,this._useInstancing=!1,this._vertexBuffers={},this._capacity=t,this._epsilon=i,this._engine=e,this._useInstancing=e.getCaps().instancedArrays&&e._features.supportSpriteInstancing,this._useVAO=e.getCaps().vertexArrayObject&&!e.disableVertexArrayObjects,this._scene=n,this._drawWrapperBase=new Ht(e),this._drawWrapperFog=new Ht(e),this._drawWrapperDepth=new Ht(e,!1),this._drawWrapperFogDepth=new Ht(e,!1),this._useInstancing||this._buildIndexBuffer(),this._drawWrapperBase.drawContext&&(this._drawWrapperBase.drawContext.useInstancing=this._useInstancing),this._drawWrapperFog.drawContext&&(this._drawWrapperFog.drawContext.useInstancing=this._useInstancing),this._drawWrapperDepth.drawContext&&(this._drawWrapperDepth.drawContext.useInstancing=this._useInstancing),this._drawWrapperFogDepth.drawContext&&(this._drawWrapperFogDepth.drawContext.useInstancing=this._useInstancing),this._vertexBufferSize=this._useInstancing?16:18,this._vertexData=new Float32Array(t*this._vertexBufferSize*(this._useInstancing?1:4)),this._buffer=new Fi(e,this._vertexData,!0,this._vertexBufferSize);var r,o=this._buffer.createVertexBuffer(wi.PositionKind,0,4,this._vertexBufferSize,this._useInstancing),s=this._buffer.createVertexBuffer(\"options\",4,2,this._vertexBufferSize,this._useInstancing),l=6;if(this._useInstancing){var c=new Float32Array([0,0,1,0,0,1,1,1]);this._spriteBuffer=new Fi(e,c,!1,2),r=this._spriteBuffer.createVertexBuffer(\"offsets\",0,2)}else r=this._buffer.createVertexBuffer(\"offsets\",l,2,this._vertexBufferSize,this._useInstancing),l+=2;var u=this._buffer.createVertexBuffer(\"inverts\",l,2,this._vertexBufferSize,this._useInstancing),h=this._buffer.createVertexBuffer(\"cellInfo\",l+2,4,this._vertexBufferSize,this._useInstancing),d=this._buffer.createVertexBuffer(wi.ColorKind,l+6,4,this._vertexBufferSize,this._useInstancing);this._vertexBuffers[wi.PositionKind]=o,this._vertexBuffers.options=s,this._vertexBuffers.offsets=r,this._vertexBuffers.inverts=u,this._vertexBuffers.cellInfo=h,this._vertexBuffers[wi.ColorKind]=d,this._drawWrapperBase.effect=this._engine.createEffect(\"sprites\",[wi.PositionKind,\"options\",\"offsets\",\"inverts\",\"cellInfo\",wi.ColorKind],[\"view\",\"projection\",\"textureInfos\",\"alphaTest\"],[\"diffuseSampler\"],\"\"),this._drawWrapperDepth.effect=this._drawWrapperBase.effect,this._drawWrapperDepth.materialContext=this._drawWrapperBase.materialContext,this._scene&&(this._drawWrapperFog.effect=this._scene.getEngine().createEffect(\"sprites\",[wi.PositionKind,\"options\",\"offsets\",\"inverts\",\"cellInfo\",wi.ColorKind],[\"view\",\"projection\",\"textureInfos\",\"alphaTest\",\"vFogInfos\",\"vFogColor\"],[\"diffuseSampler\"],\"#define FOG\"),this._drawWrapperFogDepth.effect=this._drawWrapperFog.effect,this._drawWrapperFogDepth.materialContext=this._drawWrapperFog.materialContext)}return Object.defineProperty(e.prototype,\"capacity\",{get:function(){return this._capacity},enumerable:!1,configurable:!0}),e.prototype.render=function(e,t,i,n,r){if(void 0===r&&(r=null),this.texture&&this.texture.isReady()&&e.length){var o=this._drawWrapperBase,s=this._drawWrapperDepth,l=!1;this.fogEnabled&&this._scene&&this._scene.fogEnabled&&0!==this._scene.fogMode&&(o=this._drawWrapperFog,s=this._drawWrapperFogDepth,l=!0);var c=o.effect;if(c.isReady()){for(var u=this._engine,h=!(!this._scene||!this._scene.useRightHandedSystem),d=this.texture.getBaseSize(),p=Math.min(this._capacity,e.length),f=0,_=!0,m=0;m>0;t._xOffset=(t.cellIndex-c*l)*this.cellWidth/r.width,t._yOffset=c*this.cellHeight/r.height,t._xSize=this.cellWidth,t._ySize=this.cellHeight}this._vertexData[s]=t.position.x,this._vertexData[s+1]=t.position.y,this._vertexData[s+2]=t.position.z,this._vertexData[s+3]=t.angle,this._vertexData[s+4]=t.width,this._vertexData[s+5]=t.height,this._useInstancing?s-=2:(this._vertexData[s+6]=i,this._vertexData[s+7]=n),this._vertexData[s+8]=o?t.invertU?0:1:t.invertU?1:0,this._vertexData[s+9]=t.invertV?1:0,this._vertexData[s+10]=t._xOffset,this._vertexData[s+11]=t._yOffset,this._vertexData[s+12]=t._xSize/r.width,this._vertexData[s+13]=t._ySize/r.height,this._vertexData[s+14]=t.color.r,this._vertexData[s+15]=t.color.g,this._vertexData[s+16]=t.color.b,this._vertexData[s+17]=t.color.a},e.prototype._buildIndexBuffer=function(){for(var e=[],t=0,i=0;i0);var u=e.substring(0,c-1)+\".json\";mi.LoadFile(u,(function(e){try{var t=JSON.parse(e),n=Reflect.ownKeys(t.frames);i._spriteMap=n,i._packedAndReady=!0,i._cellData=t.frames}catch(e){throw i._fromPacked=!1,i._packedAndReady=!1,new Error(\"Invalid JSON format. Please check documentation for format specifications.\")}}),void 0,void 0,!1,(function(){Q.Error(\"JSON ERROR: Unable to load JSON file.\"),i._fromPacked=!1,i._packedAndReady=!1}))}},e.prototype._checkTextureAlpha=function(e,t,i,n,r){if(!e.useAlphaForPicking||!this.texture)return!0;var o=this.texture.getSize();this._textureContent||(this._textureContent=new Uint8Array(o.width*o.height*4),this.texture.readPixels(0,0,this._textureContent));var a=O.Vector3[0];a.copyFrom(t.direction),a.normalize(),a.scaleInPlace(i),a.addInPlace(t.origin);var s=(a.x-n.x)/(r.x-n.x)-.5,l=1-(a.y-n.y)/(r.y-n.y)-.5,c=e.angle,u=s*Math.cos(c)-l*Math.sin(c)+.5,h=s*Math.sin(c)+l*Math.cos(c)+.5,d=e._xOffset*o.width+u*e._xSize|0,p=e._yOffset*o.height+h*e._ySize|0;return this._textureContent[4*(d+p*o.width)+3]>.5},e.prototype.intersects=function(e,t,i,n){for(var r=Math.min(this.capacity,this.sprites.length),o=x.Zero(),a=x.Zero(),s=Number.MAX_VALUE,l=null,c=O.Vector3[0],u=O.Vector3[1],h=t.getViewMatrix(),d=e,p=e,f=0;fm){if(!this._checkTextureAlpha(_,d,m,o,a))continue;if(p=d,s=m,l=_,n)break}}}}if(l){var g=new Bi;h.invertToRef(O.Matrix[0]),g.hit=!0,g.pickedSprite=l,g.distance=s;var v=O.Vector3[2];return v.copyFrom(p.direction),v.normalize(),v.scaleInPlace(s),p.origin.addToRef(v,c),g.pickedPoint=x.TransformCoordinates(c,O.Matrix[0]),g}return null},e.prototype.multiIntersects=function(e,t,i){for(var n,r=Math.min(this.capacity,this.sprites.length),o=x.Zero(),a=x.Zero(),s=[],l=O.Vector3[0].copyFromFloats(0,0,0),c=O.Vector3[1].copyFromFloats(0,0,0),u=t.getViewMatrix(),h=0;h0.) {\\nmt=mod(time*animationData.z,1.0);\\nfor(float f=0.; fmt){\\nframeID=animationData.x;\\nbreak;\\n}\\nanimationData=texture2D(animationMap,vec2((frameID+0.5)/spriteCount,aFrameSteps*f),0.);\\n}\\n}\\nmat4 frameData=getFrameData(frameID+0.5);\\nvec2 frameSize=(frameData[0].zw)/spriteMapSize;\\nvec2 offset=frameData[0].xy*sheetUnits;\\nvec2 ratio=frameData[2].xy/frameData[0].zw;\\nif (frameData[2].z==1.){\\ntileUV.xy=tileUV.yx;\\n}\\nif (i==0){\\ncolor=texture2D(spriteSheet,tileUV*frameSize+offset);\\n} else {\\nvec4 nc=texture2D(spriteSheet,tileUV*frameSize+offset);\\nfloat alpha=min(color.a+nc.a,1.0);\\nvec3 mixed=mix(color.xyz,nc.xyz,nc.a);\\ncolor=vec4(mixed,alpha);\\n}\\n}\\ncolor.xyz*=colorMul;\\ngl_FragColor=color;\\n}\";It.ShadersStore.spriteMapVertexShader=\"precision highp float;\\nattribute vec3 position;\\nattribute vec3 normal;\\nattribute vec2 uv;\\nvarying vec3 vPosition;\\nvarying vec2 vUV;\\nvarying vec2 tUV;\\nvarying vec2 stageUnits;\\nvarying vec2 levelUnits;\\nvarying vec2 tileID;\\nuniform float time;\\nuniform mat4 worldViewProjection;\\nuniform vec2 outputSize;\\nuniform vec2 stageSize;\\nuniform vec2 spriteMapSize;\\nuniform float stageScale;\\nvoid main() {\\nvec4 p=vec4( position,1. );\\nvPosition=p.xyz;\\nvUV=uv;\\ntUV=uv*stageSize; \\ngl_Position=worldViewProjection*p;\\n}\";var lT,cT=function(){function e(e,t,i,n,r){var o=this;this.name=e,this.sprites=[],this.atlasJSON=t,this.sprites=this.atlasJSON.frames,this.spriteSheet=i,this.options=n,n.stageSize=n.stageSize||new R(1,1),n.outputSize=n.outputSize||n.stageSize,n.outputPosition=n.outputPosition||x.Zero(),n.outputRotation=n.outputRotation||x.Zero(),n.layerCount=n.layerCount||1,n.maxAnimationFrames=n.maxAnimationFrames||0,n.baseTile=n.baseTile||0,n.flipU=n.flipU||!1,n.colorMultiply=n.colorMultiply||new x(1,1,1),this._scene=r,this._frameMap=this._createFrameBuffer(),this._tileMaps=new Array;for(var a=0;a0&&(e+=\"\\n\\r\"),e+=this._tileMaps[t]._texture._bufferView.toString();var i=document.createElement(\"a\");i.href=\"data:octet/stream;charset=utf-8,\"+encodeURI(e),i.target=\"_blank\",i.download=this.name+\".tilemaps\",i.click(),i.remove()},e.prototype.loadTileMaps=function(e){var t=this,i=new XMLHttpRequest;i.open(\"GET\",e);var n=this.options.layerCount||0;i.onload=function(){for(var e=i.response.split(\"\\n\\r\"),r=0;r-1&&this._tasks.splice(t,1)},e.prototype._decreaseWaitingTasksCount=function(e){this._waitingTasksCount--;try{this.onProgress&&this.onProgress(this._waitingTasksCount,this._totalTasksCount,e),this.onProgressObservable.notifyObservers(new dT(this._waitingTasksCount,this._totalTasksCount,e))}catch(e){Q.Error(\"Error running progress callbacks.\"),console.log(e)}if(0===this._waitingTasksCount){try{var t=this._tasks.slice();this.onFinish&&this.onFinish(t);for(var i=0,n=t;i-1&&this._tasks.splice(o,1)}}this.onTasksDoneObservable.notifyObservers(this._tasks)}catch(e){Q.Error(\"Error running tasks-done callbacks.\"),console.log(e)}this._isLoading=!1,this.autoHideLoadingUI&&this._scene.getEngine().hideLoadingUI()}},e.prototype._runTask=function(e){var t=this,i=function(i,n){e._setErrorObject(i,n),t.onTaskError?t.onTaskError(e):e.onError||Q.Error(t._formatTaskErrorMessage(e)),t.onTaskErrorObservable.notifyObservers(e),t._decreaseWaitingTasksCount(e)};e.run(this._scene,(function(){try{t.onTaskSuccess&&t.onTaskSuccess(e),t.onTaskSuccessObservable.notifyObservers(e),t._decreaseWaitingTasksCount(e)}catch(e){i(\"Error executing task success callbacks\",e)}}),i)},e.prototype._formatTaskErrorMessage=function(e){var t=\"Unable to complete task \"+e.name;return e.errorObject.message&&(t+=\": \".concat(e.errorObject.message)),e.errorObject.exception&&(t+=\": \".concat(e.errorObject.exception)),t},e.prototype.reset=function(){return this._isLoading=!1,this._tasks=new Array,this},e.prototype.load=function(){if(this._isLoading)return this;if(this._isLoading=!0,this._waitingTasksCount=this._tasks.length,this._totalTasksCount=this._tasks.length,0===this._waitingTasksCount)return this._isLoading=!1,this.onFinish&&this.onFinish(this._tasks),this.onTasksDoneObservable.notifyObservers(this._tasks),this;this.useDefaultLoadingScreen&&this._scene.getEngine().displayLoadingUI();for(var e=0;e=0&&this._meshes.splice(i,1),this._centerPosition=this._centerMesh.getAbsolutePosition().clone();for(var n=0;n0&&this._textureLoadingCallback(e)}this._currentScene.render()}},e.prototype._drag=function(e){e.stopPropagation(),e.preventDefault()},e.prototype._drop=function(e){e.stopPropagation(),e.preventDefault(),this.loadFiles(e)},e.prototype._traverseFolder=function(e,t,i,n){var r=this,o=e.createReader(),a=e.fullPath.replace(/^\\//,\"\").replace(/(.+?)\\/?$/,\"$1/\");o.readEntries((function(e){i.count+=e.length;for(var o=0,s=e;o0)){for(var i=new Array,n=[],r=e.dataTransfer?e.dataTransfer.items:null,o=0;o0&&Q.ClearLogCache(),this._engine.stopRenderLoop()),Uo.ShowLoadingScreen=!1,this._engine.displayLoadingUI(),this.loadAsync(this._sceneFileToLoad,this._progressCallback).then((function(t){e._currentScene&&e._currentScene.dispose(),e._currentScene=t,e._sceneLoadedCallback&&e._sceneLoadedCallback(e._sceneFileToLoad,e._currentScene),e._currentScene.executeWhenReady((function(){e._engine.hideLoadingUI(),e._engine.runRenderLoop((function(){e._renderFunction()}))}))})).catch((function(t){e._engine.hideLoadingUI(),e._errorCallback&&e._errorCallback(e._sceneFileToLoad,e._currentScene,t.message)}))):Q.Error(\"Please provide a valid .babylon file.\")},e}(),xT=function(){function e(){}return e.prototype.dispose=function(){if(this._observers&&this._observables)for(var e=0;ethis.maximumSize&&(r.scale(this.step),i=!1)}}return i},t}(CT),MT=function(e){function t(t,i,n){void 0===t&&(t=0),void 0===i&&(i=2),void 0===n&&(n=.25);var r=e.call(this,t)||this;return r.priority=t,r.maximumScale=i,r.step=n,r._currentScale=-1,r._directionOffset=1,r}return V(t,e),t.prototype.getDescription=function(){return\"Setting hardware scaling level to \"+this._currentScale},t.prototype.apply=function(e,t){return-1===this._currentScale&&(this._currentScale=e.getEngine().getHardwareScalingLevel(),this._currentScale>this.maximumScale&&(this._directionOffset=-1)),this._currentScale+=this._directionOffset*this.step,e.getEngine().setHardwareScalingLevel(this._currentScale),1===this._directionOffset?this._currentScale>=this.maximumScale:this._currentScale<=this.maximumScale},t}(CT),IT=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return V(t,e),t.prototype.getDescription=function(){return\"Turning shadows on/off\"},t.prototype.apply=function(e,t){return e.shadowsEnabled=t.isInImprovementMode,!0},t}(CT),OT=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return V(t,e),t.prototype.getDescription=function(){return\"Turning post-processes on/off\"},t.prototype.apply=function(e,t){return e.postProcessesEnabled=t.isInImprovementMode,!0},t}(CT),DT=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return V(t,e),t.prototype.getDescription=function(){return\"Turning lens flares on/off\"},t.prototype.apply=function(e,t){return e.lensFlaresEnabled=t.isInImprovementMode,!0},t}(CT),NT=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return V(t,e),t.prototype.getDescription=function(){return this.onGetDescription?this.onGetDescription():\"Running user defined callback\"},t.prototype.apply=function(e,t){return!this.onApply||this.onApply(e,t)},t}(CT),LT=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return V(t,e),t.prototype.getDescription=function(){return\"Turning particles on/off\"},t.prototype.apply=function(e,t){return e.particlesEnabled=t.isInImprovementMode,!0},t}(CT),FT=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return V(t,e),t.prototype.getDescription=function(){return\"Turning render targets off\"},t.prototype.apply=function(e,t){return e.renderTargetsEnabled=t.isInImprovementMode,!0},t}(CT),wT=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._canBeMerged=function(e){if(!(e instanceof Ur))return!1;var t=e;return!(t.isDisposed()||!t.isVisible||!t.isEnabled()||t.instances.length>0||t.skeleton||t.hasLODLevels)},t}return V(t,e),Object.defineProperty(t,\"UpdateSelectionTree\",{get:function(){return t._UpdateSelectionTree},set:function(e){t._UpdateSelectionTree=e},enumerable:!1,configurable:!0}),t.prototype.getDescription=function(){return\"Merging similar meshes together\"},t.prototype.apply=function(e,i,n){for(var r=e.meshes.slice(0),o=r.length,a=0;a=this._targetFrameRate)return this._isRunning=!1,void this.onSuccessObservable.notifyObservers(this);for(var n=!0,r=!0,o=0;o0){s.animationGroups=[];for(var p=0;p0)for(s.reflectionProbes=[],n=0;n0&&setTimeout((function(){i.stopRecording()}),1e3*t),this._fileName=e,this._recordedChunks=[],this._resolve=null,this._reject=null,this._canvas.isRecording=!0,this._mediaRecorder.start(this._options.recordChunckSize),new Promise((function(e,t){i._resolve=e,i._reject=t}))},e.prototype.dispose=function(){this._canvas=null,this._mediaRecorder=null,this._recordedChunks=[],this._fileName=null,this._resolve=null,this._reject=null},e.prototype._handleDataAvailable=function(e){e.data.size>0&&this._recordedChunks.push(e.data)},e.prototype._handleError=function(e){if(this.stopRecording(),!this._reject)throw new e.error;this._reject(e.error)},e.prototype._handleStop=function(){this.stopRecording();var e=new Blob(this._recordedChunks);this._resolve&&this._resolve(e),window.URL.createObjectURL(e),this._fileName&&mi.Download(e,this._fileName)},e._DefaultOptions={mimeType:\"video/webm\",fps:25,recordChunckSize:3e3},e}();function HT(e,t,i,n,r,o){void 0===r&&(r=\"image/png\"),void 0===o&&(o=!1);var a=QT(e,t,i),s=a.height,l=a.width;if(s&&l){mi._ScreenshotCanvas||(mi._ScreenshotCanvas=document.createElement(\"canvas\")),mi._ScreenshotCanvas.width=l,mi._ScreenshotCanvas.height=s;var c=mi._ScreenshotCanvas.getContext(\"2d\"),u=e.getRenderWidth()/e.getRenderHeight(),h=l,d=h/u;d>s&&(h=(d=s)*u);var p=Math.max(0,l-h)/2,f=Math.max(0,s-d)/2;t.getScene().activeCamera!==t?YT(e,t,i,(function(e){if(o){var t=new Blob([e]);mi.DownloadBlob(t),n&&n(\"\")}else n&&n(e)}),r,1,e.getCreationOptions().antialias):e.onEndFrameObservable.addOnce((function(){var t=e.getRenderingCanvas();c&&t&&c.drawImage(t,p,f,h,d),o?(mi.EncodeScreenshotCanvasData(void 0,r),n&&n(\"\")):mi.EncodeScreenshotCanvasData(n,r)}))}else Q.Error(\"Invalid 'size' parameter !\")}function XT(e,t,i,n){return void 0===n&&(n=\"image/png\"),new Promise((function(r,o){HT(e,t,i,(function(e){void 0!==e?r(e):o(new Error(\"Data is undefined\"))}),n)}))}function jT(e,t,i,n,r){return void 0===r&&(r=\"image/png\"),new Promise((function(o){HT(e,t,{width:i,height:n},(function(){o()}),r,!0)}))}function YT(e,t,i,n,r,o,s,l,c,u){void 0===r&&(r=\"image/png\"),void 0===o&&(o=1),void 0===s&&(s=!1),void 0===c&&(c=!1),void 0===u&&(u=!1);var h=QT(e,t,i),d=h.height,p=h.width,f={width:p,height:d};if(d&&p){var _={width:e.getRenderWidth(),height:e.getRenderHeight()};e.setSize(p,d);var m=t.getScene(),g=null,v=m.activeCameras;m.activeCameras=null,m.activeCamera!==t&&(g=m.activeCamera,m.activeCamera=t),m.render();var y=new Ia(\"screenShot\",f,m,!1,!1,a.TEXTURETYPE_UNSIGNED_INT,!1,to.NEAREST_SAMPLINGMODE,void 0,u,void 0,void 0,void 0,o);y.renderList=null,y.samples=o,y.renderSprites=c;var b=function(){e.onEndFrameObservable.addOnce((function(){y.readPixels(void 0,void 0,void 0,!1).then((function(e){mi.DumpData(p,d,e,n,r,l,!0),y.dispose()}))})),m.incrementRenderId(),m.resetCachedMaterial(),y.render(!0),m.incrementRenderId(),m.resetCachedMaterial(),g&&(m.activeCamera=g),m.activeCameras=v,e.setSize(_.width,_.height),t.getProjectionMatrix(!0),m.render()};if(s){var T=new yb(\"antialiasing\",1,m.activeCamera);y.addPostProcess(T),T.getEffect().isReady()?b():T.getEffect().onCompiled=function(){b()}}else b()}else Q.Error(\"Invalid 'size' parameter !\")}function KT(e,t,i,n,r,o,a,s){return void 0===n&&(n=\"image/png\"),void 0===r&&(r=1),void 0===o&&(o=!1),void 0===s&&(s=!1),new Promise((function(l,c){YT(e,t,i,(function(e){void 0!==e?l(e):c(new Error(\"Data is undefined\"))}),n,r,o,a,s)}))}function QT(e,t,i){var n=0,r=0;if(\"object\"==typeof i){var o=i.precision?Math.abs(i.precision):1;i.width&&i.height?(n=i.height*o,r=i.width*o):i.width&&!i.height?(r=i.width*o,n=Math.round(r/e.getAspectRatio(t))):i.height&&!i.width?(n=i.height*o,r=Math.round(n*e.getAspectRatio(t))):(r=Math.round(e.getRenderWidth()*o),n=Math.round(r/e.getAspectRatio(t)))}else isNaN(i)||(n=i,r=i);return r&&(r=Math.floor(r)),n&&(n=Math.floor(n)),{height:0|n,width:0|r}}var qT,ZT={CreateScreenshot:HT,CreateScreenshotAsync:XT,CreateScreenshotWithResizeAsync:jT,CreateScreenshotUsingRenderTarget:YT,CreateScreenshotUsingRenderTargetAsync:KT};mi.CreateScreenshot=HT,mi.CreateScreenshotAsync=XT,mi.CreateScreenshotUsingRenderTarget=YT,mi.CreateScreenshotUsingRenderTargetAsync=KT,function(e){e[e.Checkbox=0]=\"Checkbox\",e[e.Slider=1]=\"Slider\",e[e.Vector3=2]=\"Vector3\",e[e.Quaternion=3]=\"Quaternion\",e[e.Color3=4]=\"Color3\",e[e.String=5]=\"String\",e[e.Button=6]=\"Button\",e[e.Options=7]=\"Options\",e[e.Tab=8]=\"Tab\",e[e.FileButton=9]=\"FileButton\"}(qT||(qT={}));var JT,$T=function(){function e(e){this.byteOffset=0,this.buffer=e}return e.prototype.loadAsync=function(e){var t=this;return this.buffer.readAsync(this.byteOffset,e).then((function(e){t._dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),t._dataByteOffset=0}))},e.prototype.readUint32=function(){var e=this._dataView.getUint32(this._dataByteOffset,!0);return this._dataByteOffset+=4,this.byteOffset+=4,e},e.prototype.readUint8Array=function(e){var t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._dataByteOffset,e);return this._dataByteOffset+=e,this.byteOffset+=e,t},e.prototype.readString=function(e){return ut(this.readUint8Array(e))},e.prototype.skipBytes=function(e){this._dataByteOffset+=e,this.byteOffset+=e},e}(),eE=function(){function e(){}return e._GetStorage=function(){try{return localStorage.setItem(\"test\",\"\"),localStorage.removeItem(\"test\"),localStorage}catch(t){var e={};return{getItem:function(t){var i=e[t];return void 0===i?null:i},setItem:function(t,i){e[t]=i}}}},e.ReadString=function(e,t){var i=this._Storage.getItem(e);return null!==i?i:t},e.WriteString=function(e,t){this._Storage.setItem(e,t)},e.ReadBoolean=function(e,t){var i=this._Storage.getItem(e);return null!==i?\"true\"===i:t},e.WriteBoolean=function(e,t){this._Storage.setItem(e,t?\"true\":\"false\")},e.ReadNumber=function(e,t){var i=this._Storage.getItem(e);return null!==i?parseFloat(i):t},e.WriteNumber=function(e,t){this._Storage.setItem(e,t.toString())},e._Storage=e._GetStorage(),e}(),tE=function(){function e(){this._trackedScene=null}return e.prototype.track=function(e){this._trackedScene=e,Le.AllowLoadingUniqueId=!0,this._savedJSON=zT.Serialize(e),Le.AllowLoadingUniqueId=!1},e.prototype.getDelta=function(){if(!this._trackedScene)return null;var e=to.ForceSerializeBuffers;to.ForceSerializeBuffers=!1,Le.AllowLoadingUniqueId=!0;var t=zT.Serialize(this._trackedScene);Le.AllowLoadingUniqueId=!1;var i={};for(var n in t)this._compareCollections(n,this._savedJSON[n],t[n],i);return to.ForceSerializeBuffers=e,i},e.prototype._compareArray=function(e,t,i,n){if(0===t.length&&0===i.length)return!0;if(t.length&&!isNaN(t[0])||i.length&&!isNaN(i[0])){if(t.length!==i.length)return!1;if(0===t.length)return!0;for(var r=0;re._MAX_SEQUENCE_LENGTH)throw new Error(\"Sequences longer than \"+e._MAX_SEQUENCE_LENGTH+\" not supported.\");this._alphabet=i,this._characters=t.map((function(e){return n._alphabet.getCharacterIdx(e)}))}return e.prototype.serialize=function(){return JSON.stringify(this._characters)},e.Deserialize=function(t,i){var n=new e([],i);return n._characters=JSON.parse(t),n},e.prototype.distance=function(t){return e._Distance(this,t)},e._Distance=function(t,i){var n=t._alphabet;if(n!==i._alphabet)throw new Error(\"Cannot Levenshtein compare Sequences built from different alphabets.\");var r=t._characters,o=i._characters,a=r.length,s=o.length,l=e._CostMatrix;l[0][0]=0;for(var c=0;c.98||(x.CrossToRef(e._ForwardDir,e._InverseFromVec,e._UpDir),e._UpDir.normalize(),M.LookAtLHToRef(t,i,e._UpDir,e._LookMatrix),n.subtractToRef(i,e._FromToVec),e._FromToVec.normalize(),x.TransformNormalToRef(e._FromToVec,e._LookMatrix,r),0))},e._TokenizeSegment=function(t,i){e._BestMatch=0,e._Score=x.Dot(t,i[0]),e._BestScore=e._Score;for(var n=1;ne._BestScore&&(e._BestMatch=n,e._BestScore=e._Score);return e._BestMatch},e._ForwardDir=new x,e._InverseFromVec=new x,e._UpDir=new x,e._FromToVec=new x,e._LookMatrix=new M,e}(),nE=function(){function e(e){this.chars=new Array(e)}return e.Generate=function(t,i,n,r,o){void 0===t&&(t=64),void 0===i&&(i=256),void 0===n&&(n=.1),void 0===r&&(r=.001),void 0===o&&(o=[]);for(var a,s,l=new e(t),c=0;c1e-6&&d.scaleAndAddToRef(1/(d.lengthSquared()*s),h)})),h.scaleInPlace(a),l.chars[e].addInPlace(h),l.chars[e].normalize()};for(c=o.length;c4;o=Math.floor(o/2))r.push(t.resampleAtTargetResolution(o).tokenize(i.chars));return r},e.prototype.distance=function(e){for(var t=0,i=0;i0&&(this._averageDistance=Math.max(this._averageDistance/this._descriptors.length,e._MIN_AVERAGE_DISTANCE))},e._MIN_AVERAGE_DISTANCE=1,e}(),aE=function(){function e(){this._maximumAllowableMatchCost=4,this._nameToDescribedTrajectory=new Map}return e.prototype.serialize=function(){var e={};return e.maximumAllowableMatchCost=this._maximumAllowableMatchCost,e.vector3Alphabet=this._vector3Alphabet.serialize(),e.levenshteinAlphabet=this._levenshteinAlphabet.serialize(),e.nameToDescribedTrajectory=[],this._nameToDescribedTrajectory.forEach((function(t,i){e.nameToDescribedTrajectory.push(i),e.nameToDescribedTrajectory.push(t.serialize())})),JSON.stringify(e)},e.Deserialize=function(t){var i=JSON.parse(t),n=new e;n._maximumAllowableMatchCost=i.maximumAllowableMatchCost,n._vector3Alphabet=nE.Deserialize(i.vector3Alphabet),n._levenshteinAlphabet=JT.Alphabet.Deserialize(i.levenshteinAlphabet);for(var r=0;r=this._itemLength?NaN:this._view[e]},e.prototype.subarray=function(e,t){return e>=t||e<0?new Float32Array(0):(t>this._itemLength&&(t=this._itemLength),this._view.subarray(e,t))},e.prototype.push=function(e){this._view[this._itemLength]=e,this._itemLength++,this._itemLength>=this._view.length&&this._growArray()},e.prototype._growArray=function(){var e=Math.floor(1.5*this._view.length),t=new Float32Array(e);t.set(this._view),this._view=t},e}(),cE=1800,uE=\"timestamp\",hE=\"numPoints\",dE=/\\r/g,pE=\"@\",fE=function(){function e(t,i){var n=this;this._scene=t,this._collectDataAtFrame=function(){var t=it.Now-n._startingTimestamp,i=n.datasets.ids.length,r=n.datasets.startingIndices.itemLength,o=0;if(r>0){var a=n.datasets.startingIndices.at(r-1);o=a+n.datasets.data.at(a+e.NumberOfPointsOffset)+e.SliceDataOffset}if(n.datasets.startingIndices.push(o),n.datasets.data.push(t),n.datasets.data.push(i),n.datasets.ids.forEach((function(e){var t=n._strategies.get(e);t&&n.datasets.data.push(t.getData())})),n.datasetObservable.hasObservers()){for(var s=[t,i],l=0;l>i&255).toString(16)).substr(-2);return n},e.prototype.getCurrentSlice=function(){var e=this,t=[it.Now-this._startingTimestamp,this.datasets.ids.length];this.datasets.ids.forEach((function(i){var n=e._strategies.get(i);n&&e.datasetObservable.hasObservers()&&t.push(n.getData())})),this.datasetObservable.hasObservers()&&this.datasetObservable.notifyObservers(t)},e.prototype.updateMetadata=function(e,t,i){var n=this._datasetMeta.get(e);n&&(n[t]=i,this.metadataObservable.notifyObservers(this._datasetMeta))},e.prototype.clear=function(e){this.datasets.data=new lE(cE),this.datasets.ids.length=0,this.datasets.startingIndices=new lE(cE),this._datasetMeta.clear(),this._strategies.forEach((function(e){return e.dispose()})),this._strategies.clear(),e||this._eventRestoreSet.clear(),this._hasLoadedData=!1},Object.defineProperty(e.prototype,\"hasLoadedData\",{get:function(){return this._hasLoadedData},enumerable:!1,configurable:!0}),e.prototype.loadFromFileData=function(t,i){var n=t.replace(dE,\"\").split(\"\\n\").map((function(e){return e.split(\",\").filter((function(e){return e.length>0}))})).filter((function(e){return e.length>0})),r=e.NumberOfPointsOffset;if(n.length<2)return!1;var o={ids:[],data:new lE(cE),startingIndices:new lE(cE)},a=n[0],s=n.slice(1);if(a.length<2||a[0]!==uE||a[r]!==hE)return!1;for(var l=new Map,c=e.SliceDataOffset;c0&&this.onFeaturePointsAddedObservable.notifyObservers(r),n.length>0&&this.onFeaturePointsUpdatedObservable.notifyObservers(n)}}},t.prototype._init=function(){this._xrSessionManager.session.trySetFeaturePointCloudEnabled&&this._xrSessionManager.session.trySetFeaturePointCloudEnabled(!0)&&(this._enabled=!0)},t.Name=xo.FEATURE_POINTS,t.Version=1,t}(Po);Co.AddWebXRFeature(xE.Name,(function(e){return function(){return new xE(e)}}),xE.Version);var CE,PE=0,ME=function(e){function t(t,i){void 0===i&&(i={});var n=e.call(this,t)||this;return n._options=i,n._detectedMeshes=new Map,n.onMeshAddedObservable=new u,n.onMeshRemovedObservable=new u,n.onMeshUpdatedObservable=new u,n.xrNativeFeatureName=\"mesh-detection\",n._xrSessionManager.session?n._init():n._xrSessionManager.onXRSessionInit.addOnce((function(){n._init()})),n}return V(t,e),t.prototype.detach=function(){var t=this;return!!e.prototype.detach.call(this)&&(this._xrSessionManager.isNative&&this._xrSessionManager.session.trySetMeshDetectorEnabled&&this._xrSessionManager.session.trySetMeshDetectorEnabled(!1),this._options.doNotRemoveMeshesOnSessionEnded||(this._detectedMeshes.forEach((function(e){t.onMeshRemovedObservable.notifyObservers(e)})),this._detectedMeshes.clear()),!0)},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.onMeshAddedObservable.clear(),this.onMeshRemovedObservable.clear(),this.onMeshUpdatedObservable.clear()},t.prototype._onXRFrame=function(e){var t,i=this;try{if(!this.attached||!e)return;var n=null===(t=e.worldInformation)||void 0===t?void 0:t.detectedMeshes;if(n){var r=new Set;this._detectedMeshes.forEach((function(e,t){n.has(t)||r.add(t)})),r.forEach((function(e){var t=i._detectedMeshes.get(e);t&&(i.onMeshRemovedObservable.notifyObservers(t),i._detectedMeshes.delete(e))})),n.forEach((function(t){if(i._detectedMeshes.has(t))t.lastChangedTime===i._xrSessionManager.currentTimestamp&&(r=i._detectedMeshes.get(t))&&(i._updateVertexDataWithXRMesh(t,r,e),i.onMeshUpdatedObservable.notifyObservers(r));else{var n={id:PE++,xrMesh:t},r=i._updateVertexDataWithXRMesh(t,n,e);i._detectedMeshes.set(t,r),i.onMeshAddedObservable.notifyObservers(r)}}))}}catch(e){console.log(e.stack)}},t.prototype._init=function(){this._xrSessionManager.isNative&&(this._xrSessionManager.session.trySetMeshDetectorEnabled&&this._xrSessionManager.session.trySetMeshDetectorEnabled(!0),this._options.preferredDetectorOptions&&this._xrSessionManager.session.trySetPreferredMeshDetectorOptions&&this._xrSessionManager.session.trySetPreferredMeshDetectorOptions(this._options.preferredDetectorOptions))},t.prototype._updateVertexDataWithXRMesh=function(e,t,i){if(t.xrMesh=e,t.worldParentNode=this._options.worldParentNode,this._options.convertCoordinateSystems){if(this._xrSessionManager.scene.useRightHandedSystem)t.positions=e.positions,t.normals=e.normals;else{t.positions=new Float32Array(e.positions.length);for(var n=0;n0?CE.Received:CE.NotReceived,[2]}}))}))},t.Name=xo.IMAGE_TRACKING,t.Version=1,t}(Po);Co.AddWebXRFeature(IE.Name,(function(e,t){return function(){return new IE(e,t)}}),IE.Version,!1);var OE=function(e){function t(t,i){var n=e.call(this,t)||this;return n.options=i,n._domOverlayType=null,n._beforeXRSelectListener=null,n._element=null,n.xrNativeFeatureName=\"dom-overlay\",mi.Warn(\"dom-overlay is an experimental and unstable feature.\"),n}return V(t,e),t.prototype.attach=function(){return!(!e.prototype.attach.call(this)||!this._xrSessionManager.session.domOverlayState||null===this._xrSessionManager.session.domOverlayState.type||(this._domOverlayType=this._xrSessionManager.session.domOverlayState.type,null!==this._element&&!0===this.options.supressXRSelectEvents&&(this._beforeXRSelectListener=function(e){e.preventDefault()},this._element.addEventListener(\"beforexrselect\",this._beforeXRSelectListener)),0))},Object.defineProperty(t.prototype,\"domOverlayType\",{get:function(){return this._domOverlayType},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){e.prototype.dispose.call(this),null!==this._element&&this._beforeXRSelectListener&&this._element.removeEventListener(\"beforexrselect\",this._beforeXRSelectListener)},t.prototype._onXRFrame=function(e){},t.prototype.getXRSessionInitExtension=function(){return z(this,void 0,void 0,(function(){var e;return W(this,(function(t){if(void 0===this.options.element)return mi.Warn('\"element\" option must be provided to attach xr-dom-overlay feature.'),[2,{}];if(\"string\"==typeof this.options.element){if(null===(e=document.querySelector(this.options.element)))return mi.Warn(\"element not found '\".concat(this.options.element,\"' (not requesting xr-dom-overlay)\")),[2,{}];this._element=e}else this._element=this.options.element;return[2,{domOverlay:{root:this._element}}]}))}))},t.Name=xo.DOM_OVERLAY,t.Version=1,t}(Po);Co.AddWebXRFeature(OE.Name,(function(e,t){return function(){return new OE(e,t)}}),OE.Version,!1);var DE=function(e){function t(i,n){var r,o,a,s,l,c,u=this;return(u=e.call(this,i)||this)._controllers={},u._currentRegistrationConfigurations=[],u._movementDirection=null,u._tmpRotationMatrix=M.Identity(),u._tmpTranslationDirection=new x,u._tmpMovementTranslation=new x,u._attachController=function(e){if(!u._controllers[e.uniqueId]){u._controllers[e.uniqueId]={xrController:e,registeredComponents:[]};var t=u._controllers[e.uniqueId];if(\"tracked-pointer\"===t.xrController.inputSource.targetRayMode&&t.xrController.inputSource.gamepad){var i=function(){if(e.motionController)for(var i=function(i){var n=null;if(i.allowedComponentTypes)for(var r=0,o=i.allowedComponentTypes;ri.rotationThreshold?e.x:0,t.rotateY=Math.abs(e.y)>i.rotationThreshold?e.y:0}},{allowedComponentTypes:[Lf.THUMBSTICK_TYPE,Lf.TOUCHPAD_TYPE],forceHandedness:\"right\",axisChangedHandler:function(e,t,i){t.moveX=Math.abs(e.x)>i.movementThreshold?e.x:0,t.moveY=Math.abs(e.y)>i.movementThreshold?e.y:0}}]},t.Version=1,t}(Po);Co.AddWebXRFeature(DE.Name,(function(e,t){return function(){return new DE(e,t)}}),DE.Version,!0);var NE=function(e){function t(t,i){var n=e.call(this,t)||this;return n.options=i,n._canvasContext=null,n._reflectionCubeMap=null,n._xrLightEstimate=null,n._xrLightProbe=null,n._xrWebGLBinding=null,n._lightDirection=x.Up().negateInPlace(),n._lightColor=N.White(),n._intensity=1,n._sphericalHarmonics=new Fu,n._cubeMapPollTime=Date.now(),n._lightEstimationPollTime=Date.now(),n._reflectionCubeMapTextureSize=16,n.directionalLight=null,n.onReflectionCubeMapUpdatedObservable=new u,n._updateReflectionCubeMap=function(){var e;if(n._xrLightProbe){if(n.options.cubeMapPollInterval){var t=Date.now();if(t-n._cubeMapPollTime=this._samples.length)throw new Error(\"Index out of bounds\");return this._samples[(this._idx+e)%this._samples.length]},e}(),wE=function(){function e(){this._samples=new FE(20),this._entropy=0,this.onFirstStepDetected=new u}return e.prototype.update=function(e,t,i,n){this._samples.push(e,t);var r=this._samples.at(0);if(this._entropy*=this._entropyDecayFactor,this._entropy+=R.Distance(r,this._samples.at(1)),!(this._entropy>this._entropyThreshold)){var o;for(o=this._samePointCheckStartIdx;oa&&(s=c,a=l);if(!(ao*this._squaredProjectionDistanceThreshold)){var _=O.Vector3[0];_.set(i,n,0);var m=O.Vector3[1];m.set(h.x,h.y,0);var g=x.Cross(_,m).z>0,v=r.clone(),y=r.clone();u.subtractToRef(r,h),g?(h.scaleAndAddToRef(this._axisToApexShrinkFactor,v),h.scaleAndAddToRef(this._axisToApexExtendFactor,y)):(h.scaleAndAddToRef(this._axisToApexExtendFactor,v),h.scaleAndAddToRef(this._axisToApexShrinkFactor,y)),this.onFirstStepDetected.notifyObservers({leftApex:v,rightApex:y,currentPosition:r,currentStepDirection:g?\"right\":\"left\"})}}}}},e.prototype.reset=function(){for(var e=0;ethis._maxT&&(this._maxT=this._t,this._maxTPosition.copyFromFloats(e,t)),!(this._vitalityi&&(this.onMovement.notifyObservers({deltaT:this._t-i}),i<.5&&this._t>=.5&&this.onFootfall.notifyObservers({foot:this._steppingLeft?\"left\":\"right\"})),this._t<.95*this._maxT&&(this._currentPosition.copyFromFloats(e,t),this._steppingLeft?this._leftApex.copyFrom(this._maxTPosition):this._rightApex.copyFrom(this._maxTPosition),this._reset(this._leftApex,this._rightApex,this._currentPosition,!this._steppingLeft)),this._axisLength<.03))},Object.defineProperty(e.prototype,\"_vitalityThreshold\",{get:function(){return.1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,\"forward\",{get:function(){return this._forward},enumerable:!1,configurable:!0}),e}(),UE=function(){function e(t){var i=this;this._detector=new wE,this._walker=null,this._movement=new R,this._millisecondsSinceLastUpdate=e._MillisecondsPerUpdate,this.movementThisFrame=x.Zero(),this._engine=t,this._detector.onFirstStepDetected.add((function(e){i._walker||(i._walker=new BE(e.leftApex,e.rightApex,e.currentPosition,e.currentStepDirection),i._walker.onFootfall.add((function(){console.log(\"Footfall!\")})),i._walker.onMovement.add((function(e){i._walker.forward.scaleAndAddToRef(.024*e.deltaT,i._movement)})))}))}return Object.defineProperty(e,\"_MillisecondsPerUpdate\",{get:function(){return 1e3/15},enumerable:!1,configurable:!0}),e.prototype.update=function(t,i){i.y=0,i.normalize(),this._millisecondsSinceLastUpdate+=this._engine.getDeltaTime(),this._millisecondsSinceLastUpdate>=e._MillisecondsPerUpdate&&(this._millisecondsSinceLastUpdate-=e._MillisecondsPerUpdate,this._detector.update(t.x,t.z,i.x,i.z),this._walker&&(this._walker.update(t.x,t.z)||(this._walker=null)),this._movement.scaleInPlace(.85)),this.movementThisFrame.set(this._movement.x,0,this._movement.y)},e}(),VE=function(e){function t(t,i){var n=e.call(this,t)||this;return n._up=new x,n._forward=new x,n._position=new x,n._movement=new x,n._sessionManager=t,n.locomotionTarget=i.locomotionTarget,n._isLocomotionTargetWebXRCamera&&Q.Warn(\"Using walking locomotion directly on a WebXRCamera may have unintended interactions with other XR techniques. Using an XR space parent is highly recommended\"),n}return V(t,e),Object.defineProperty(t,\"Name\",{get:function(){return xo.WALKING_LOCOMOTION},enumerable:!1,configurable:!0}),Object.defineProperty(t,\"Version\",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,\"locomotionTarget\",{get:function(){return this._locomotionTarget},set:function(e){this._locomotionTarget=e,this._isLocomotionTargetWebXRCamera=\"WebXRCamera\"===this._locomotionTarget.getClassName()},enumerable:!1,configurable:!0}),t.prototype.isCompatible=function(){return void 0===this._sessionManager.sessionMode||\"immersive-vr\"===this._sessionManager.sessionMode},t.prototype.attach=function(){return!(!this.isCompatible||!e.prototype.attach.call(this)||(this._walker=new UE(this._sessionManager.scene.getEngine()),0))},t.prototype.detach=function(){return!!e.prototype.detach.call(this)&&(this._walker=null,!0)},t.prototype._onXRFrame=function(e){var t=e.getViewerPose(this._sessionManager.baseReferenceSpace);if(t){var i=this.locomotionTarget.getScene().useRightHandedSystem?1:-1,n=t.transform.matrix;this._up.copyFromFloats(n[4],n[5],i*n[6]),this._forward.copyFromFloats(n[8],n[9],i*n[10]),this._position.copyFromFloats(n[12],n[13],i*n[14]),this._forward.scaleAndAddToRef(.05,this._position),this._up.scaleAndAddToRef(-.05,this._position),this._walker.update(this._position,this._forward),this._movement.copyFrom(this._walker.movementThisFrame),this._isLocomotionTargetWebXRCamera||x.TransformNormalToRef(this._movement,this.locomotionTarget.getWorldMatrix(),this._movement),this.locomotionTarget.position.addInPlace(this._movement)}},t}(Po);Co.AddWebXRFeature(VE.Name,(function(e,t){return function(){return new VE(e,t)}}),VE.Version,!1);var kE=function(e){function t(t,i,n,r,o,a){var s=e.call(this,t,i,n,r,a)||this;return s.getWidth=t,s.getHeight=i,s.layer=n,s.layerType=r,s.isMultiview=o,s.createRTTProvider=a,s}return V(t,e),t}(ql),GE=function(e){function t(t,i,n){var r=e.call(this,t.scene,n)||this;return r._xrSessionManager=t,r._xrWebGLBinding=i,r.layerWrapper=n,r._lastSubImages=new Map,r._compositionLayer=n.layer,r}return V(t,e),t.prototype._getRenderTargetForSubImage=function(e,t){var i=this._lastSubImages.get(t),n=\"left\"==t?0:1;return this._renderTargetTextures[n]&&(null==i?void 0:i.textureWidth)===e.textureWidth&&(null==i?void 0:i.textureHeight)==e.textureHeight||(this._renderTargetTextures[n]=this._createRenderTargetTexture(e.textureWidth,e.textureHeight,null,e.colorTexture,e.depthStencilTexture,this.layerWrapper.isMultiview),this._framebufferDimensions={framebufferWidth:e.textureWidth,framebufferHeight:e.textureHeight}),this._lastSubImages.set(t,e),this._renderTargetTextures[n]},t.prototype._getSubImageForEye=function(e){var t=this._xrSessionManager.currentFrame;return t?this._xrWebGLBinding.getSubImage(this._compositionLayer,t,e):null},t.prototype.getRenderTargetTextureForEye=function(e){var t=this._getSubImageForEye(e);return t?this._getRenderTargetForSubImage(t,e):null},t.prototype.getRenderTargetTextureForView=function(e){return this.getRenderTargetTextureForEye(e.eye)},t.prototype._setViewportForSubImage=function(e,t){var i=t.textureWidth,n=t.textureHeight,r=t.viewport;e.x=r.x/i,e.y=r.y/n,e.width=r.width/i,e.height=r.height/n},t.prototype.trySetViewportForView=function(e,t){var i=this._lastSubImages.get(t.eye)||this._getSubImageForEye(t.eye);return!!i&&(this._setViewportForSubImage(e,i),!0)},t}(Zl),zE=function(e){function t(t,i,n){var r=e.call(this,(function(){return t.textureWidth}),(function(){return t.textureHeight}),t,\"XRProjectionLayer\",i,(function(e){return new WE(e,n,r)}))||this;return r.layer=t,r}return V(t,e),t}(kE),WE=function(e){function t(t,i,n){var r=e.call(this,t,i,n)||this;return r.layerWrapper=n,r._projectionLayer=n.layer,r}return V(t,e),t.prototype._getSubImageForView=function(e){return this._xrWebGLBinding.getViewSubImage(this._projectionLayer,e)},t.prototype.getRenderTargetTextureForView=function(e){return this._getRenderTargetForSubImage(this._getSubImageForView(e),e.eye)},t.prototype.getRenderTargetTextureForEye=function(e){var t=this._lastSubImages.get(e);return t?this._getRenderTargetForSubImage(t,e):null},t.prototype.trySetViewportForView=function(e,t){var i=this._lastSubImages.get(t.eye)||this._getSubImageForView(t);return!!i&&(this._setViewportForSubImage(e,i),!0)},t}(GE),HE={},XE={textureType:\"texture\",colorFormat:6408,depthFormat:35056,scaleFactor:1},jE=function(e){function t(t,i){void 0===i&&(i={});var n=e.call(this,t)||this;return n._options=i,n._existingLayers=[],n.xrNativeFeatureName=\"layers\",n}return V(t,e),t.prototype.attach=function(){if(!e.prototype.attach.call(this))return!1;var t=this._xrSessionManager.scene.getEngine();this._glContext=t._gl,this._xrWebGLBinding=new XRWebGLBinding(this._xrSessionManager.session,this._glContext),this._existingLayers.length=0;var i=k({},XE),n=this._options.preferMultiviewOnInit&&t.getCaps().multiview;return n&&(i.textureType=\"texture-array\"),this.addXRSessionLayer(this.createProjectionLayer(i,n)),!0},t.prototype.detach=function(){return!!e.prototype.detach.call(this)&&(this._existingLayers.length=0,!0)},t.prototype.createXRWebGLLayer=function(e){void 0===e&&(e=HE);var t=new XRWebGLLayer(this._xrSessionManager.session,this._glContext,e);return new Jl(t)},t.prototype.createProjectionLayer=function(e,t){if(void 0===e&&(e=XE),void 0===t&&(t=!1),t&&\"texture-array\"!==e.textureType)throw new Error(\"Projection layers can only be made multiview if they use texture arrays. Set the textureType parameter to 'texture-array'.\");if(!t&&\"texture-array\"===e.textureType)throw new Error(\"We currently only support multiview rendering when the textureType parameter is set to 'texture-array'.\");var i=this._xrWebGLBinding.createProjectionLayer(e);return new zE(i,t,this._xrWebGLBinding)},t.prototype.addXRSessionLayer=function(e){this.setXRSessionLayers(H(H([],this._existingLayers,!0),[e],!1))},t.prototype.setXRSessionLayers=function(e){this._existingLayers=e;var t=k({},this._xrSessionManager.session.renderState);t.baseLayer=void 0,t.layers=e.map((function(e){return e.layer})),this._xrSessionManager.updateRenderState(t),this._xrSessionManager._setBaseLayerWrapper(e.length>0?e[0]:null)},t.prototype.isCompatible=function(){return!this._xrSessionManager.isNative&&\"undefined\"!=typeof XRWebGLBinding&&!!XRWebGLBinding.prototype.createProjectionLayer},t.prototype.dispose=function(){e.prototype.dispose.call(this)},t.prototype._onXRFrame=function(e){},t.Name=xo.LAYERS,t.Version=1,t}(Po);Co.AddWebXRFeature(jE.Name,(function(e,t){return function(){return new jE(e,t)}}),jE.Version,!1);var YE=function(e){function t(t,i,n){var r=e.call(this,t,KE[n],i,n,!0)||this;return r.profileId=\"generic-hand-select-grasp\",r}return V(t,e),t.prototype._getFilenameAndPath=function(){return{filename:\"generic.babylon\",path:\"https://controllers.babylonjs.com/generic/\"}},t.prototype._getModelLoadingConstraints=function(){return!0},t.prototype._processLoadedModel=function(e){},t.prototype._setRootMesh=function(e){},t.prototype._updateModel=function(){},t}(Ff);kf.RegisterController(\"generic-hand-select-grasp\",(function(e,t){return new YE(t,e.gamepad,e.handedness)}));var KE={left:{selectComponentId:\"xr-standard-trigger\",components:{\"xr-standard-trigger\":{type:\"trigger\",gamepadIndices:{button:0},rootNodeName:\"xr-standard-trigger\",visualResponses:{}},grasp:{type:\"trigger\",gamepadIndices:{button:4},rootNodeName:\"grasp\",visualResponses:{}}},gamepadMapping:\"xr-standard\",rootNodeName:\"generic-hand-select-grasp-left\",assetPath:\"left.glb\"},right:{selectComponentId:\"xr-standard-trigger\",components:{\"xr-standard-trigger\":{type:\"trigger\",gamepadIndices:{button:0},rootNodeName:\"xr-standard-trigger\",visualResponses:{}},grasp:{type:\"trigger\",gamepadIndices:{button:4},rootNodeName:\"grasp\",visualResponses:{}}},gamepadMapping:\"xr-standard\",rootNodeName:\"generic-hand-select-grasp-right\",assetPath:\"right.glb\"},none:{selectComponentId:\"xr-standard-trigger\",components:{\"xr-standard-trigger\":{type:\"trigger\",gamepadIndices:{button:0},rootNodeName:\"xr-standard-trigger\",visualResponses:{}},grasp:{type:\"trigger\",gamepadIndices:{button:4},rootNodeName:\"grasp\",visualResponses:{}}},gamepadMapping:\"xr-standard\",rootNodeName:\"generic-hand-select-grasp-none\",assetPath:\"none.glb\"}},QE=function(e){function t(t,i,n){var r=e.call(this,t,qE[\"left-right\"],i,n)||this;return r._mapping={defaultButton:{valueNodeName:\"VALUE\",unpressedNodeName:\"UNPRESSED\",pressedNodeName:\"PRESSED\"},defaultAxis:{valueNodeName:\"VALUE\",minNodeName:\"MIN\",maxNodeName:\"MAX\"},buttons:{\"xr-standard-trigger\":{rootNodeName:\"SELECT\",componentProperty:\"button\",states:[\"default\",\"touched\",\"pressed\"]},\"xr-standard-squeeze\":{rootNodeName:\"GRASP\",componentProperty:\"state\",states:[\"pressed\"]},\"xr-standard-touchpad\":{rootNodeName:\"TOUCHPAD_PRESS\",labelAnchorNodeName:\"squeeze-label\",touchPointNodeName:\"TOUCH\"},\"xr-standard-thumbstick\":{rootNodeName:\"THUMBSTICK_PRESS\",componentProperty:\"state\",states:[\"pressed\"]}},axes:{\"xr-standard-touchpad\":{\"x-axis\":{rootNodeName:\"TOUCHPAD_TOUCH_X\"},\"y-axis\":{rootNodeName:\"TOUCHPAD_TOUCH_Y\"}},\"xr-standard-thumbstick\":{\"x-axis\":{rootNodeName:\"THUMBSTICK_X\"},\"y-axis\":{rootNodeName:\"THUMBSTICK_Y\"}}}},r.profileId=\"microsoft-mixed-reality\",r}return V(t,e),t.prototype._getFilenameAndPath=function(){return{filename:\"left\"===this.handedness?t.MODEL_LEFT_FILENAME:t.MODEL_RIGHT_FILENAME,path:t.MODEL_BASE_URL+\"default/\"}},t.prototype._getModelLoadingConstraints=function(){var e=Uo.IsPluginForExtensionAvailable(\".glb\");return e||Q.Warn(\"glTF / glb loaded was not registered, using generic controller instead\"),e},t.prototype._processLoadedModel=function(e){var t=this;this.rootMesh&&(this.getComponentIds().forEach((function(e,i){if(!t.disableAnimation&&e&&t.rootMesh){var n=t._mapping.buttons[e],r=n.rootNodeName;if(!r)return void Q.Log(\"Skipping unknown button at index: \"+i+\" with mapped name: \"+e);var o=t._getChildByName(t.rootMesh,r);if(!o)return void Q.Warn(\"Missing button mesh with name: \"+r);if(n.valueMesh=t._getImmediateChildByName(o,t._mapping.defaultButton.valueNodeName),n.pressedMesh=t._getImmediateChildByName(o,t._mapping.defaultButton.pressedNodeName),n.unpressedMesh=t._getImmediateChildByName(o,t._mapping.defaultButton.unpressedNodeName),n.valueMesh&&n.pressedMesh&&n.unpressedMesh){var a=t.getComponent(e);a&&a.onButtonStateChangedObservable.add((function(e){t._lerpTransform(n,e.value)}),void 0,!0)}else Q.Warn(\"Missing button submesh under mesh with name: \"+r)}})),this.getComponentIds().forEach((function(e){var i=t.getComponent(e);i.isAxes()&&[\"x-axis\",\"y-axis\"].forEach((function(n){if(t.rootMesh){var r=t._mapping.axes[e][n],o=t._getChildByName(t.rootMesh,r.rootNodeName);o?(r.valueMesh=t._getImmediateChildByName(o,t._mapping.defaultAxis.valueNodeName),r.minMesh=t._getImmediateChildByName(o,t._mapping.defaultAxis.minNodeName),r.maxMesh=t._getImmediateChildByName(o,t._mapping.defaultAxis.maxNodeName),r.valueMesh&&r.minMesh&&r.maxMesh?i&&i.onAxisValueChangedObservable.add((function(e){var i=\"x-axis\"===n?e.x:e.y;t._lerpTransform(r,i,!0)}),void 0,!0):Q.Warn(\"Missing axis submesh under mesh with name: \"+r.rootNodeName)):Q.Warn(\"Missing axis mesh with name: \"+r.rootNodeName)}}))})))},t.prototype._setRootMesh=function(e){var t;this.rootMesh=new Ur(this.profileId+\" \"+this.handedness,this.scene),this.rootMesh.isPickable=!1;for(var i=0;i { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"distance\": () => (/* binding */ distance),\n/* harmony export */ \"limit\": () => (/* binding */ limit)\n/* harmony export */ });\nfunction distance(a, b) {\r\n return a.subtract(b).length();\r\n}\r\n/**\r\n * Return a `Vector3` whose magnitude is clamped to the upper bound of `limit`. The vector itself is not affected.\r\n * @param v Input vector to clamp\r\n * @param limit The maximum magnitude for the vector\r\n * @return The resulting clamped `Vector3`.\r\n */\r\nfunction limit(v, limit) {\r\n return v.normalize().scale(Math.max(limit, v.length()));\r\n}\r\n\n\n//# sourceURL=webpack://cs4241_assignment_3/./src/js/Utils.js?"); + +/***/ }), + +/***/ "./src/js/boids/Boid.js": +/*!******************************!*\ + !*** ./src/js/boids/Boid.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 babylonjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs */ \"./node_modules/babylonjs/babylon.js\");\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Utils.js */ \"./src/js/Utils.js\");\n/* harmony import */ var _scripts_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../scripts.js */ \"./src/js/scripts.js\");\n\r\n\r\n\r\nclass Boid {\r\n constructor(scene, id, pos, mesh) {\r\n this.id = id;\r\n this.scene = scene;\r\n this.mesh = mesh;\r\n this.position = pos;\r\n this.velocity = babylonjs__WEBPACK_IMPORTED_MODULE_0__.Vector3.Zero();\r\n this.acceleration = babylonjs__WEBPACK_IMPORTED_MODULE_0__.Vector3.Zero();\r\n this.neighbors = [];\r\n this.chunk = {};\r\n // Constraints\r\n this.maxSpeed = 0.3;\r\n this.maxForce = 0.03;\r\n this.neighborDist = 10;\r\n this.desiredSeparation = 2; // Should be less than neighborDist\r\n this.forceMultiplier = 0.25; // Multiplies all of the following forces\r\n this.separationMultiplier = 1; // Forces boids to separate to desiredSeparation\r\n this.cohesionMultiplier = 0.1; // Forces boids towards one another when within neighborDist\r\n this.alignmentMultiplier = 2.5; // Forces boids to turn in the same direction as those within neighborDist\r\n this.cursorMultiplier = 0.3; // Forces boids away from the mouse. Make negative to attract them to the mouse\r\n }\r\n get position() { return this.mesh.position; }\r\n set position(val) { this.mesh.position = val; }\r\n renderPosition() {\r\n return this.position.add(this.chunk.flock.position);\r\n }\r\n run(boids) {\r\n this.flock(boids);\r\n this.update();\r\n this.borders();\r\n this.updateChunk();\r\n }\r\n // If this boids chunk is defined and it no longer contains this boid, move to the appropriate chunk\r\n updateChunk() {\r\n if (this.chunk !== undefined && !this.chunk.contains(this.position)) {\r\n let flock = this.chunk.flock;\r\n // Calculate the new chunk coordinate based on the position\r\n let newRow = Math.floor((this.position.x - flock.position.x) / flock.chunkSize);\r\n let newCol = Math.floor((this.position.y - flock.position.y) / flock.chunkSize);\r\n let newSlice = Math.floor((this.position.z - flock.position.z) / flock.chunkSize);\r\n let newChunk = flock.getChunk(newRow, newCol, newSlice);\r\n // Remove this boid from the old chunk and add it to the new one\r\n this.chunk.removeBoid(this.id);\r\n newChunk.addBoid(this);\r\n }\r\n }\r\n update() {\r\n this.velocity.addInPlace(this.acceleration);\r\n // Set velocity to max speed\r\n this.velocity.normalize();\r\n this.velocity.scaleInPlace(this.maxSpeed);\r\n // Orient to flight direction\r\n const fin = babylonjs__WEBPACK_IMPORTED_MODULE_0__.Vector3.Up();\r\n const side = babylonjs__WEBPACK_IMPORTED_MODULE_0__.Vector3.Cross(this.forward(), fin);\r\n this.mesh.rotation = babylonjs__WEBPACK_IMPORTED_MODULE_0__.Vector3.RotationFromAxis(side, this.forward(), fin);\r\n this.position.addInPlace(this.velocity.scale(_scripts_js__WEBPACK_IMPORTED_MODULE_2__.deltaTime * 0.05));\r\n this.acceleration.scaleInPlace(0);\r\n }\r\n // Wraps position to the other side when moving offscreen\r\n borders() {\r\n const flock = this.chunk.flock;\r\n const offset = 0.01;\r\n if (this.position.x < flock.position.x)\r\n this.position.x = flock.position.x + flock.width - offset;\r\n if (this.position.y < flock.position.y)\r\n this.position.y = flock.position.y + flock.height - offset;\r\n if (this.position.z < flock.position.z)\r\n this.position.z = flock.position.z + flock.depth - offset;\r\n if (this.position.x > flock.position.x + flock.width)\r\n this.position.x = flock.position.x + offset;\r\n if (this.position.y > flock.position.y + flock.height)\r\n this.position.y = flock.position.y + offset;\r\n if (this.position.z > flock.position.z + flock.depth)\r\n this.position.z = flock.position.z + offset;\r\n }\r\n applyForce(force) {\r\n this.acceleration.addInPlace(force);\r\n }\r\n flock(boids) {\r\n // Get all boids within range\r\n this.neighbors = [];\r\n boids.forEach((boid, i) => {\r\n let d = this.position.subtract(boid.position).length();\r\n if (d < this.neighborDist)\r\n this.neighbors.push(boid);\r\n });\r\n let sep = this.separate(this.neighbors);\r\n let ali = this.align(this.neighbors);\r\n let coh = this.cohesion(this.neighbors);\r\n // Get mouse position and calculate a repulsion vector\r\n let cursor = babylonjs__WEBPACK_IMPORTED_MODULE_0__.Vector3.Zero();\r\n let cursorPos = this.chunk.flock.cursor.position;\r\n if ((0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.distance)(this.position, cursorPos) < 40)\r\n cursor = this.seek(cursorPos).scale(-1);\r\n // Force weights\r\n sep.scaleInPlace(this.forceMultiplier * this.separationMultiplier);\r\n ali.scaleInPlace(this.forceMultiplier * this.alignmentMultiplier);\r\n coh.scaleInPlace(this.forceMultiplier * this.cohesionMultiplier);\r\n cursor.scaleInPlace(this.forceMultiplier * this.cursorMultiplier);\r\n // Apply forces\r\n this.applyForce(sep);\r\n this.applyForce(ali);\r\n this.applyForce(coh);\r\n this.applyForce(cursor);\r\n this.applyForce(this.forward());\r\n }\r\n forward() {\r\n const velCopy = this.velocity.clone();\r\n velCopy.normalize();\r\n return velCopy;\r\n }\r\n seek(target) {\r\n // Normalized vector pointing towards the target\r\n let targetVel = target.subtract(this.position);\r\n targetVel.normalize().scaleInPlace(this.maxSpeed);\r\n // Delta vector to targetVel to apply an appropriate force\r\n let steer = targetVel.subtract(this.velocity);\r\n steer = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.limit)(steer, this.maxForce);\r\n return steer;\r\n }\r\n // Returns the force to steer away from nearby boids\r\n separate(boids) {\r\n let steer = babylonjs__WEBPACK_IMPORTED_MODULE_0__.Vector3.Zero();\r\n let count = 0;\r\n // For every boid in the system, check if it's too close\r\n boids.forEach((other, i) => {\r\n let d = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.distance)(this.position, other.position);\r\n // If the distance is greater than 0 and less than an arbitrary amount (0 when you are yourself)\r\n if ((d > 0) && (d < this.desiredSeparation)) {\r\n // Calculate vector pointing away from neighbor\r\n let diff = this.position.subtract(other.position);\r\n diff.normalize();\r\n diff.scaleInPlace(1 / d); // Weight by distance\r\n steer.add(diff);\r\n count++; // Keep track of how many\r\n }\r\n });\r\n // Average -- divide by how many\r\n if (count > 0) {\r\n steer.scaleInPlace(1 / count);\r\n }\r\n // As long as the vector is greater than 0\r\n if (steer.length() > 0) {\r\n // Implement Reynolds: Steering = Desired - Velocity\r\n steer.normalize().scaleInPlace(this.maxSpeed);\r\n steer.subtractInPlace(this.velocity);\r\n steer = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.limit)(steer, this.maxForce);\r\n }\r\n return steer;\r\n }\r\n // Steer towards the average velocity of all nearby boids\r\n align(boids) {\r\n let sum = babylonjs__WEBPACK_IMPORTED_MODULE_0__.Vector3.Zero();\r\n let count = 0;\r\n boids.forEach((other, i) => {\r\n let d = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.distance)(this.position, other.position);\r\n if (d > 0) {\r\n sum.add(other.velocity);\r\n count++;\r\n }\r\n });\r\n if (count > 0) {\r\n sum.scaleInPlace(1 / count);\r\n // Implement Reynolds: Steering = Desired - Velocity\r\n sum.normalize().scaleInPlace(this.maxSpeed);\r\n let steer = sum.subtract(this.velocity);\r\n steer = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.limit)(steer, this.maxForce);\r\n return steer;\r\n }\r\n else {\r\n return babylonjs__WEBPACK_IMPORTED_MODULE_0__.Vector3.Zero();\r\n }\r\n }\r\n // Steer towards the average position of all nearby boids\r\n cohesion(boids) {\r\n let sum = babylonjs__WEBPACK_IMPORTED_MODULE_0__.Vector3.Zero(); // Start with empty vector to accumulate all positions\r\n let count = 0;\r\n boids.forEach((other, i) => {\r\n let d = (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.distance)(this.position, other.position);\r\n if (d > 0) {\r\n sum.add(other.position); // Add position\r\n count++;\r\n }\r\n });\r\n if (count > 0) {\r\n sum.scaleInPlace(1 / count);\r\n return this.seek(sum); // Steer towards the position\r\n }\r\n else {\r\n return babylonjs__WEBPACK_IMPORTED_MODULE_0__.Vector3.Zero();\r\n }\r\n }\r\n}\r\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Boid);\r\n\n\n//# sourceURL=webpack://cs4241_assignment_3/./src/js/boids/Boid.js?"); + +/***/ }), + +/***/ "./src/js/boids/BoidChunk.js": +/*!***********************************!*\ + !*** ./src/js/boids/BoidChunk.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 babylonjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs */ \"./node_modules/babylonjs/babylon.js\");\n\r\nclass BoidChunk {\r\n constructor(scene, coordinate, size, flock) {\r\n this.size = babylonjs__WEBPACK_IMPORTED_MODULE_0__.Vector3.One().scale(size);\r\n this.boids = [];\r\n this.flock = flock;\r\n this.scene = scene;\r\n this.coordinates = coordinate;\r\n }\r\n get row() { return this.coordinates.x; }\r\n set row(val) { this.coordinates.x = val; }\r\n get column() { return this.coordinates.y; }\r\n set column(val) { this.coordinates.y = val; }\r\n get slice() { return this.coordinates.z; }\r\n set slice(val) { this.coordinates.z = val; }\r\n get width() { return this.size.x; }\r\n set width(val) { this.size.x = val; }\r\n get height() { return this.size.y; }\r\n set height(val) { this.size.y = val; }\r\n get depth() { return this.size.z; }\r\n set depth(val) { this.size.z = val; }\r\n // Remove a specified boid by the boid id\r\n removeBoid(id) {\r\n for (let i = 0; i < this.boids.length; i++) {\r\n let boid = this.boids[i];\r\n if (boid.id === id) {\r\n this.boids.splice(i, 1);\r\n break;\r\n }\r\n }\r\n }\r\n // **Use this instead of manually setting the boid chunk of the boid**\r\n // Adds the boid and sets its chunk to this\r\n addBoid(boid) {\r\n this.boids.push(boid);\r\n boid.chunk = this;\r\n }\r\n // Checks if this cell contains given coordinates\r\n contains(coordinates) {\r\n let xContained = (coordinates.x >= this.width * this.row) && (coordinates.x < this.width * (this.row + 1));\r\n let yContained = (coordinates.y >= this.height * this.column) && (coordinates.y < this.height * (this.column + 1));\r\n let zContained = (coordinates.z >= this.depth * this.slice) && (coordinates.z < this.depth * (this.slice + 1));\r\n return xContained && yContained && zContained;\r\n }\r\n position() {\r\n return this.flock.position.add(new babylonjs__WEBPACK_IMPORTED_MODULE_0__.Vector3(this.flock.position.x + (this.column * this.flock.chunkSize), this.flock.position.y + (this.row * this.flock.chunkSize), this.flock.position.z + (this.slice * this.flock.chunkSize)));\r\n }\r\n}\r\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (BoidChunk);\r\n\n\n//# sourceURL=webpack://cs4241_assignment_3/./src/js/boids/BoidChunk.js?"); + +/***/ }), + +/***/ "./src/js/boids/Flock.js": +/*!*******************************!*\ + !*** ./src/js/boids/Flock.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 _BoidChunk_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BoidChunk.js */ \"./src/js/boids/BoidChunk.js\");\n/* harmony import */ var babylonjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs */ \"./node_modules/babylonjs/babylon.js\");\n\r\n\r\nclass Flock {\r\n constructor(scene, cursor, pos, size) {\r\n this.chunkSize = 0;\r\n this.position = pos;\r\n this.size = size;\r\n this.chunkArrayDims = new babylonjs__WEBPACK_IMPORTED_MODULE_1__.Vector3();\r\n this.chunks = [];\r\n this.cursor = cursor;\r\n this.scene = scene;\r\n }\r\n get width() { return this.size.x; }\r\n get height() { return this.size.y; }\r\n get depth() { return this.size.z; }\r\n get numRows() { return this.chunkArrayDims.x; }\r\n set numRows(val) { this.chunkArrayDims.x = val; }\r\n get numCols() { return this.chunkArrayDims.y; }\r\n set numCols(val) { this.chunkArrayDims.y = val; }\r\n get numSlices() { return this.chunkArrayDims.z; }\r\n set numSlices(val) { this.chunkArrayDims.z = val; }\r\n // Runs every boid in every chunk\r\n run() {\r\n // Lookup neighboring boids\r\n for (const boidCell of this.chunks) {\r\n for (const boid of boidCell.boids) {\r\n // Get all boids in current and neighboring chunks\r\n let neighboringBoids = this.allBoidsIn(this.cellAndNeighboring(boidCell.row, boidCell.column, boidCell.slice));\r\n boid.flock(neighboringBoids);\r\n }\r\n }\r\n // Set boid velocities based on forces\r\n for (const boidCell of this.chunks) {\r\n for (const boid of boidCell.boids) {\r\n boid.update();\r\n }\r\n }\r\n // Teleport to the opposite side if the boid reaches a border\r\n for (const boidCell of this.chunks) {\r\n for (const boid of boidCell.boids) {\r\n boid.borders();\r\n }\r\n }\r\n // Move to appropriate chunk based on position\r\n for (const boidCell of this.chunks) {\r\n for (const boid of boidCell.boids) {\r\n boid.updateChunk();\r\n }\r\n }\r\n }\r\n // Returns an array containing the chunk at the given row and column and its neighbors\r\n cellAndNeighboring(chunkRow, chunkCol, chunkSlice) {\r\n const localChunks = [];\r\n const beginningRow = Math.max(chunkRow - 1, 0);\r\n const beginningCol = Math.max(chunkCol - 1, 0);\r\n const beginningSlice = Math.max(chunkSlice - 1, 0);\r\n const endingRow = Math.min(chunkRow + 1, this.numRows - 1);\r\n const endingCol = Math.min(chunkCol + 1, this.numCols - 1);\r\n const endingSlice = Math.min(chunkSlice + 1, this.numSlices - 1);\r\n for (let row = beginningRow; row <= endingRow; row++) {\r\n for (let col = beginningCol; col <= endingCol; col++) {\r\n for (let slice = beginningSlice; slice <= endingSlice; slice++) {\r\n localChunks.push(this.getChunk(row, col, slice));\r\n if (this.getChunk(row, col, slice) === undefined)\r\n console.log(`Chunk [${row}] [${col}] [${slice}] is undefined`);\r\n }\r\n }\r\n }\r\n return localChunks;\r\n }\r\n // Returns a list of all the boids in the given list of chunks\r\n allBoidsIn(chunks) {\r\n let boids = [];\r\n chunks.forEach((chunk, i) => {\r\n chunk.boids.forEach((boid, j) => {\r\n boids.push(boid);\r\n });\r\n });\r\n return boids;\r\n }\r\n getChunk(row, column, slice) {\r\n const rowOffset = row * this.numCols * this.numSlices;\r\n const colOffset = column * this.numSlices;\r\n return this.chunks[rowOffset + colOffset + slice];\r\n }\r\n addBoid(boid) {\r\n // The first boid added determines the chunk size\r\n if (this.chunks.length === 0) {\r\n this.generateChunks(boid.neighborDist);\r\n }\r\n // Calculate which chunk the boid should be placed in and add it\r\n let boidRow = Math.floor(boid.position.y / this.chunkSize);\r\n let boidCol = Math.floor(boid.position.x / this.chunkSize);\r\n let boidSlice = Math.floor(boid.position.z / this.chunkSize);\r\n this.getChunk(boidRow, boidCol, boidSlice).addBoid(boid);\r\n }\r\n // Create an array of chunks based on the screen size and cell size\r\n generateChunks(chunkSize) {\r\n this.chunkSize = chunkSize;\r\n this.numRows = Math.ceil(this.height / this.chunkSize);\r\n this.numCols = Math.ceil(this.width / this.chunkSize);\r\n this.numSlices = Math.ceil(this.depth / this.chunkSize);\r\n for (let row = 0; row < this.numRows; row++) {\r\n for (let col = 0; col < this.numCols; col++) {\r\n for (let slice = 0; slice < this.numSlices; slice++) {\r\n const newChunk = new _BoidChunk_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"](this.scene, new babylonjs__WEBPACK_IMPORTED_MODULE_1__.Vector3(row, col, slice), this.chunkSize, this);\r\n this.chunks.push(newChunk);\r\n }\r\n }\r\n }\r\n this.size = this.chunkArrayDims.scale(this.chunkSize);\r\n }\r\n}\r\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Flock);\r\n\n\n//# sourceURL=webpack://cs4241_assignment_3/./src/js/boids/Flock.js?"); + +/***/ }), + +/***/ "./src/js/scripts.js": +/*!***************************!*\ + !*** ./src/js/scripts.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 */ \"deltaTime\": () => (/* binding */ deltaTime)\n/* harmony export */ });\n/* harmony import */ var babylonjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs */ \"./node_modules/babylonjs/babylon.js\");\n/* harmony import */ var _boids_Flock_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./boids/Flock.js */ \"./src/js/boids/Flock.js\");\n/* harmony import */ var _boids_Boid_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./boids/Boid.js */ \"./src/js/boids/Boid.js\");\n\r\n\r\n\r\nconst AREA_SIZE = 200;\r\nconst BOID_COUNT = 200;\r\n// **************************\r\n// * Setup Babylon JS Scene *\r\n// **************************\r\n// create the canvas html element and attach it to the webpage\r\nconst canvas = document.getElementById(\"main-canvas\");\r\n// initialize babylon scene and engine\r\nconst engine = new babylonjs__WEBPACK_IMPORTED_MODULE_0__.Engine(canvas, true);\r\nconst scene = new babylonjs__WEBPACK_IMPORTED_MODULE_0__.Scene(engine);\r\nconst camera = new babylonjs__WEBPACK_IMPORTED_MODULE_0__.ArcRotateCamera(\"Camera\", Math.PI / 2, Math.PI / 2, 100, babylonjs__WEBPACK_IMPORTED_MODULE_0__.Vector3.Zero(), scene);\r\ncamera.attachControl(canvas, true);\r\n// Add lighting\r\nconst light1 = new babylonjs__WEBPACK_IMPORTED_MODULE_0__.HemisphericLight(\"light1\", new babylonjs__WEBPACK_IMPORTED_MODULE_0__.Vector3(1, 1, 0), scene);\r\n// *****************************\r\n// * Create new Flock of Boids *\r\n// *****************************\r\n// Make Cursor with gizmo\r\nconst gizmoManager = new babylonjs__WEBPACK_IMPORTED_MODULE_0__.GizmoManager(scene);\r\nconst cursor = babylonjs__WEBPACK_IMPORTED_MODULE_0__.MeshBuilder.CreateSphere(\"Cursor\", { diameter: 1 }, scene);\r\ngizmoManager.positionGizmoEnabled = true;\r\ngizmoManager.enableAutoPicking = false;\r\ngizmoManager.attachToMesh(cursor);\r\n// Make flock and bounding box for flock\r\nconst areaSize = babylonjs__WEBPACK_IMPORTED_MODULE_0__.Vector3.One().scale(AREA_SIZE);\r\nconst flock = new _boids_Flock_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"](scene, cursor, areaSize.scale(-0.5), areaSize);\r\n// Spawn agents in the center\r\nlet spawnArea = babylonjs__WEBPACK_IMPORTED_MODULE_0__.Vector3.One().scale(20);\r\nfor (let i = 0; i < BOID_COUNT; i++) {\r\n let newBoid = new _boids_Boid_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"](scene, i, new babylonjs__WEBPACK_IMPORTED_MODULE_0__.Vector3(Math.random() * spawnArea.x, Math.random() * spawnArea.y, Math.random() * spawnArea.z), babylonjs__WEBPACK_IMPORTED_MODULE_0__.MeshBuilder.CreateCylinder('Boid', { diameterTop: 0, diameterBottom: 1 }, scene));\r\n // Set the velocity in a random direction\r\n let newVel = new babylonjs__WEBPACK_IMPORTED_MODULE_0__.Vector3(Math.random(), Math.random(), Math.random());\r\n newVel.normalize().scaleInPlace(newBoid.maxSpeed);\r\n newBoid.velocity = newVel;\r\n flock.addBoid(newBoid);\r\n}\r\nvar lastFrameTime = Date.now();\r\nvar deltaTime = 1000 / 30;\r\nfunction runFlock() {\r\n flock.run();\r\n // Get frame delta time\r\n const now = Date.now();\r\n deltaTime = now - lastFrameTime;\r\n lastFrameTime = now;\r\n requestAnimationFrame(runFlock);\r\n}\r\nrequestAnimationFrame(runFlock);\r\n// hide/show the Inspector\r\nwindow.addEventListener(\"keydown\", (ev) => {\r\n // Shift+Ctrl+Alt+I\r\n if (ev.shiftKey && ev.ctrlKey && ev.altKey && ev.keyCode === 73) {\r\n if (scene.debugLayer.isVisible()) {\r\n scene.debugLayer.hide();\r\n }\r\n else {\r\n scene.debugLayer.show();\r\n }\r\n }\r\n});\r\ncanvas.addEventListener(\"scroll\", ev => ev.preventDefault());\r\n// run the main render loop\r\nengine.runRenderLoop(() => {\r\n scene.render();\r\n});\r\n\n\n//# sourceURL=webpack://cs4241_assignment_3/./src/js/scripts.js?"); + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // 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/global */ +/******/ (() => { +/******/ __webpack_require__.g = (function() { +/******/ if (typeof globalThis === 'object') return globalThis; +/******/ try { +/******/ return this || new Function('return this')(); +/******/ } catch (e) { +/******/ if (typeof window === 'object') return window; +/******/ } +/******/ })(); +/******/ })(); +/******/ +/******/ /* 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 is referenced by other modules so it can't be inlined +/******/ var __webpack_exports__ = __webpack_require__("./src/js/scripts.js"); +/******/ +/******/ })() +; \ No newline at end of file diff --git a/src/index.html b/src/index.html new file mode 100644 index 00000000..24bf66ec --- /dev/null +++ b/src/index.html @@ -0,0 +1,21 @@ + + + + 3D Flocking + + + + + + + + + + +

Welcome to 3D Boids!

+

Click and drag to rotate the camera and move the cursor around to repel the boids!

+
+ +
+ + diff --git a/src/js/Utils.js b/src/js/Utils.js new file mode 100644 index 00000000..b8081650 --- /dev/null +++ b/src/js/Utils.js @@ -0,0 +1,12 @@ +export function distance(a, b) { + return a.subtract(b).length(); +} +/** + * Return a `Vector3` whose magnitude is clamped to the upper bound of `limit`. The vector itself is not affected. + * @param v Input vector to clamp + * @param limit The maximum magnitude for the vector + * @return The resulting clamped `Vector3`. + */ +export function limit(v, limit) { + return v.normalize().scale(Math.max(limit, v.length())); +} diff --git a/src/js/Utils.ts b/src/js/Utils.ts new file mode 100644 index 00000000..bbd77358 --- /dev/null +++ b/src/js/Utils.ts @@ -0,0 +1,15 @@ +import {Vector3} from "babylonjs"; + +export function distance(a: Vector3, b: Vector3): number { + return a.subtract(b).length(); +} + +/** + * Return a `Vector3` whose magnitude is clamped to the upper bound of `limit`. The vector itself is not affected. + * @param v Input vector to clamp + * @param limit The maximum magnitude for the vector + * @return The resulting clamped `Vector3`. + */ +export function limit(v: Vector3, limit: number): Vector3 { + return v.normalize().scale(Math.max(limit, v.length())) +} \ No newline at end of file diff --git a/src/js/boids/Boid.js b/src/js/boids/Boid.js new file mode 100644 index 00000000..35677a40 --- /dev/null +++ b/src/js/boids/Boid.js @@ -0,0 +1,197 @@ +import { Vector3 } from "babylonjs"; +import { distance, limit } from "../Utils.js"; +import { deltaTime } from "../scripts.js"; +class Boid { + constructor(scene, id, pos, mesh) { + this.id = id; + this.scene = scene; + this.mesh = mesh; + this.position = pos; + this.velocity = Vector3.Zero(); + this.acceleration = Vector3.Zero(); + this.neighbors = []; + this.chunk = {}; + // Constraints + this.maxSpeed = 0.3; + this.maxForce = 0.03; + this.neighborDist = 10; + this.desiredSeparation = 2; // Should be less than neighborDist + this.forceMultiplier = 0.25; // Multiplies all of the following forces + this.separationMultiplier = 1; // Forces boids to separate to desiredSeparation + this.cohesionMultiplier = 0.1; // Forces boids towards one another when within neighborDist + this.alignmentMultiplier = 2.5; // Forces boids to turn in the same direction as those within neighborDist + this.cursorMultiplier = 0.3; // Forces boids away from the mouse. Make negative to attract them to the mouse + } + get position() { return this.mesh.position; } + set position(val) { this.mesh.position = val; } + renderPosition() { + return this.position.add(this.chunk.flock.position); + } + run(boids) { + this.flock(boids); + this.update(); + this.borders(); + this.updateChunk(); + } + // If this boids chunk is defined and it no longer contains this boid, move to the appropriate chunk + updateChunk() { + if (this.chunk !== undefined && !this.chunk.contains(this.position)) { + let flock = this.chunk.flock; + // Calculate the new chunk coordinate based on the position + let newRow = Math.floor((this.position.x - flock.position.x) / flock.chunkSize); + let newCol = Math.floor((this.position.y - flock.position.y) / flock.chunkSize); + let newSlice = Math.floor((this.position.z - flock.position.z) / flock.chunkSize); + let newChunk = flock.getChunk(newRow, newCol, newSlice); + // Remove this boid from the old chunk and add it to the new one + this.chunk.removeBoid(this.id); + newChunk.addBoid(this); + } + } + update() { + this.velocity.addInPlace(this.acceleration); + // Set velocity to max speed + this.velocity.normalize(); + this.velocity.scaleInPlace(this.maxSpeed); + // Orient to flight direction + const fin = Vector3.Up(); + const side = Vector3.Cross(this.forward(), fin); + this.mesh.rotation = Vector3.RotationFromAxis(side, this.forward(), fin); + this.position.addInPlace(this.velocity.scale(deltaTime * 0.05)); + this.acceleration.scaleInPlace(0); + } + // Wraps position to the other side when moving offscreen + borders() { + const flock = this.chunk.flock; + const offset = 0.01; + if (this.position.x < flock.position.x) + this.position.x = flock.position.x + flock.width - offset; + if (this.position.y < flock.position.y) + this.position.y = flock.position.y + flock.height - offset; + if (this.position.z < flock.position.z) + this.position.z = flock.position.z + flock.depth - offset; + if (this.position.x > flock.position.x + flock.width) + this.position.x = flock.position.x + offset; + if (this.position.y > flock.position.y + flock.height) + this.position.y = flock.position.y + offset; + if (this.position.z > flock.position.z + flock.depth) + this.position.z = flock.position.z + offset; + } + applyForce(force) { + this.acceleration.addInPlace(force); + } + flock(boids) { + // Get all boids within range + this.neighbors = []; + boids.forEach((boid, i) => { + let d = this.position.subtract(boid.position).length(); + if (d < this.neighborDist) + this.neighbors.push(boid); + }); + let sep = this.separate(this.neighbors); + let ali = this.align(this.neighbors); + let coh = this.cohesion(this.neighbors); + // Get mouse position and calculate a repulsion vector + let cursor = Vector3.Zero(); + let cursorPos = this.chunk.flock.cursor.position; + if (distance(this.position, cursorPos) < 40) + cursor = this.seek(cursorPos).scale(-1); + // Force weights + sep.scaleInPlace(this.forceMultiplier * this.separationMultiplier); + ali.scaleInPlace(this.forceMultiplier * this.alignmentMultiplier); + coh.scaleInPlace(this.forceMultiplier * this.cohesionMultiplier); + cursor.scaleInPlace(this.forceMultiplier * this.cursorMultiplier); + // Apply forces + this.applyForce(sep); + this.applyForce(ali); + this.applyForce(coh); + this.applyForce(cursor); + this.applyForce(this.forward()); + } + forward() { + const velCopy = this.velocity.clone(); + velCopy.normalize(); + return velCopy; + } + seek(target) { + // Normalized vector pointing towards the target + let targetVel = target.subtract(this.position); + targetVel.normalize().scaleInPlace(this.maxSpeed); + // Delta vector to targetVel to apply an appropriate force + let steer = targetVel.subtract(this.velocity); + steer = limit(steer, this.maxForce); + return steer; + } + // Returns the force to steer away from nearby boids + separate(boids) { + let steer = Vector3.Zero(); + let count = 0; + // For every boid in the system, check if it's too close + boids.forEach((other, i) => { + let d = distance(this.position, other.position); + // If the distance is greater than 0 and less than an arbitrary amount (0 when you are yourself) + if ((d > 0) && (d < this.desiredSeparation)) { + // Calculate vector pointing away from neighbor + let diff = this.position.subtract(other.position); + diff.normalize(); + diff.scaleInPlace(1 / d); // Weight by distance + steer.add(diff); + count++; // Keep track of how many + } + }); + // Average -- divide by how many + if (count > 0) { + steer.scaleInPlace(1 / count); + } + // As long as the vector is greater than 0 + if (steer.length() > 0) { + // Implement Reynolds: Steering = Desired - Velocity + steer.normalize().scaleInPlace(this.maxSpeed); + steer.subtractInPlace(this.velocity); + steer = limit(steer, this.maxForce); + } + return steer; + } + // Steer towards the average velocity of all nearby boids + align(boids) { + let sum = Vector3.Zero(); + let count = 0; + boids.forEach((other, i) => { + let d = distance(this.position, other.position); + if (d > 0) { + sum.add(other.velocity); + count++; + } + }); + if (count > 0) { + sum.scaleInPlace(1 / count); + // Implement Reynolds: Steering = Desired - Velocity + sum.normalize().scaleInPlace(this.maxSpeed); + let steer = sum.subtract(this.velocity); + steer = limit(steer, this.maxForce); + return steer; + } + else { + return Vector3.Zero(); + } + } + // Steer towards the average position of all nearby boids + cohesion(boids) { + let sum = Vector3.Zero(); // Start with empty vector to accumulate all positions + let count = 0; + boids.forEach((other, i) => { + let d = distance(this.position, other.position); + if (d > 0) { + sum.add(other.position); // Add position + count++; + } + }); + if (count > 0) { + sum.scaleInPlace(1 / count); + return this.seek(sum); // Steer towards the position + } + else { + return Vector3.Zero(); + } + } +} +export default Boid; diff --git a/src/js/boids/Boid.ts b/src/js/boids/Boid.ts new file mode 100644 index 00000000..b2a7345f --- /dev/null +++ b/src/js/boids/Boid.ts @@ -0,0 +1,256 @@ +import BoidChunk from "./BoidChunk.js"; +import {Mesh, Scene, Vector3} from "babylonjs"; +import {distance, limit} from "../Utils.js"; +import {deltaTime} from "../scripts.js"; + +class Boid { + + id: number; + + get position() { return this.mesh.position } + set position(val) { this.mesh.position = val } + velocity: Vector3; + acceleration: Vector3; + + neighbors: Array; + chunk: BoidChunk; + + maxSpeed: number; + maxForce: number; + neighborDist: number; + desiredSeparation: number; + forceMultiplier: number; + separationMultiplier: number; + cohesionMultiplier: number; + alignmentMultiplier: number; + cursorMultiplier: number; + + mesh: Mesh; + scene: Scene; + + constructor(scene: Scene, id: number, pos: Vector3, mesh: Mesh) { + this.id = id; + + this.scene = scene; + this.mesh = mesh; + + this.position = pos; + this.velocity = Vector3.Zero(); + this.acceleration = Vector3.Zero(); + + this.neighbors = []; + this.chunk = {}; + + // Constraints + this.maxSpeed = 0.3; + this.maxForce = 0.03; + + this.neighborDist = 10; + this.desiredSeparation = 2; // Should be less than neighborDist + + this.forceMultiplier = 0.25; // Multiplies all of the following forces + this.separationMultiplier = 1; // Forces boids to separate to desiredSeparation + this.cohesionMultiplier = 0.1; // Forces boids towards one another when within neighborDist + this.alignmentMultiplier = 2.5; // Forces boids to turn in the same direction as those within neighborDist + this.cursorMultiplier = 0.3; // Forces boids away from the mouse. Make negative to attract them to the mouse + } + + renderPosition() { + return this.position.add(this.chunk.flock.position); + } + + run(boids: Array) { + this.flock(boids); + this.update(); + this.borders(); + this.updateChunk(); + } + + // If this boids chunk is defined and it no longer contains this boid, move to the appropriate chunk + updateChunk() { + if(this.chunk !== undefined && !this.chunk.contains(this.position)) { + let flock = this.chunk.flock; + + // Calculate the new chunk coordinate based on the position + let newRow = Math.floor((this.position.x - flock.position.x) / flock.chunkSize); + let newCol = Math.floor((this.position.y - flock.position.y) / flock.chunkSize); + let newSlice = Math.floor((this.position.z - flock.position.z) / flock.chunkSize); + + let newChunk = flock.getChunk(newRow, newCol, newSlice); + + // Remove this boid from the old chunk and add it to the new one + this.chunk.removeBoid(this.id); + newChunk.addBoid(this); + } + } + + update() { + this.velocity.addInPlace(this.acceleration); + + // Set velocity to max speed + this.velocity.normalize(); + this.velocity.scaleInPlace(this.maxSpeed); + + // Orient to flight direction + const fin = Vector3.Up(); + const side = Vector3.Cross(this.forward(), fin); + this.mesh.rotation = Vector3.RotationFromAxis(side, this.forward(), fin); + + this.position.addInPlace(this.velocity.scale(deltaTime * 0.05)); + this.acceleration.scaleInPlace(0); + } + + // Wraps position to the other side when moving offscreen + borders() { + const flock = this.chunk.flock; + const offset = 0.01; + + if (this.position.x < flock.position.x) + this.position.x = flock.position.x + flock.width - offset; + if (this.position.y < flock.position.y) + this.position.y = flock.position.y + flock.height - offset; + if (this.position.z < flock.position.z) + this.position.z = flock.position.z + flock.depth - offset; + if (this.position.x > flock.position.x + flock.width) + this.position.x = flock.position.x + offset; + if (this.position.y > flock.position.y + flock.height) + this.position.y = flock.position.y + offset; + if (this.position.z > flock.position.z + flock.depth) + this.position.z = flock.position.z + offset; + } + + applyForce(force: Vector3) { + this.acceleration.addInPlace(force); + } + + flock(boids: Array) { + // Get all boids within range + this.neighbors = []; + boids.forEach((boid, i) => { + let d = this.position.subtract(boid.position).length(); + if(d < this.neighborDist) + this.neighbors.push(boid); + }); + + let sep = this.separate(this.neighbors); + let ali = this.align(this.neighbors); + let coh = this.cohesion(this.neighbors); + + // Get mouse position and calculate a repulsion vector + let cursor = Vector3.Zero(); + let cursorPos = this.chunk.flock.cursor.position; + if(distance(this.position, cursorPos) < 40) + cursor = this.seek(cursorPos).scale(-1); + + // Force weights + sep.scaleInPlace(this.forceMultiplier*this.separationMultiplier); + ali.scaleInPlace(this.forceMultiplier*this.alignmentMultiplier); + coh.scaleInPlace(this.forceMultiplier*this.cohesionMultiplier); + cursor.scaleInPlace(this.forceMultiplier*this.cursorMultiplier); + + // Apply forces + this.applyForce(sep); + this.applyForce(ali); + this.applyForce(coh); + this.applyForce(cursor); + this.applyForce(this.forward()); + } + + forward() { + const velCopy = this.velocity.clone(); + velCopy.normalize(); + return velCopy; + } + + seek(target: Vector3) { + // Normalized vector pointing towards the target + let targetVel = target.subtract(this.position); + targetVel.normalize().scaleInPlace(this.maxSpeed); + + // Delta vector to targetVel to apply an appropriate force + let steer = targetVel.subtract(this.velocity); + steer = limit(steer, this.maxForce); + return steer; + } + + // Returns the force to steer away from nearby boids + separate(boids: Array) { + let steer = Vector3.Zero(); + let count = 0; + // For every boid in the system, check if it's too close + boids.forEach((other, i) => { + let d = distance(this.position, other.position); + // If the distance is greater than 0 and less than an arbitrary amount (0 when you are yourself) + if ((d > 0) && (d < this.desiredSeparation)) { + // Calculate vector pointing away from neighbor + let diff = this.position.subtract(other.position); + diff.normalize(); + diff.scaleInPlace(1/d); // Weight by distance + steer.add(diff); + count++; // Keep track of how many + } + }); + // Average -- divide by how many + if (count > 0) { + steer.scaleInPlace(1/count); + } + + // As long as the vector is greater than 0 + if (steer.length() > 0) { + // Implement Reynolds: Steering = Desired - Velocity + steer.normalize().scaleInPlace(this.maxSpeed); + steer.subtractInPlace(this.velocity); + steer = limit(steer, this.maxForce); + } + return steer; + } + + // Steer towards the average velocity of all nearby boids + align(boids: Array) { + let sum = Vector3.Zero(); + let count = 0; + boids.forEach((other, i) => { + let d = distance(this.position, other.position); + if (d > 0) { + sum.add(other.velocity); + count++; + } + }); + if (count > 0) { + sum.scaleInPlace(1/count); + + // Implement Reynolds: Steering = Desired - Velocity + sum.normalize().scaleInPlace(this.maxSpeed); + let steer = sum.subtract(this.velocity); + steer = limit(steer, this.maxForce); + return steer; + } + else { + return Vector3.Zero(); + } + } + + // Steer towards the average position of all nearby boids + cohesion(boids: Array) { + let sum = Vector3.Zero(); // Start with empty vector to accumulate all positions + let count = 0; + boids.forEach((other, i) => { + let d = distance(this.position, other.position); + if (d > 0) { + sum.add(other.position); // Add position + count++; + } + }); + + if (count > 0) { + sum.scaleInPlace(1/count); + return this.seek(sum); // Steer towards the position + } + else { + return Vector3.Zero(); + } + } + +} + +export default Boid; \ No newline at end of file diff --git a/src/js/boids/BoidChunk.js b/src/js/boids/BoidChunk.js new file mode 100644 index 00000000..b554381f --- /dev/null +++ b/src/js/boids/BoidChunk.js @@ -0,0 +1,49 @@ +import { Vector3 } from "babylonjs"; +class BoidChunk { + constructor(scene, coordinate, size, flock) { + this.size = Vector3.One().scale(size); + this.boids = []; + this.flock = flock; + this.scene = scene; + this.coordinates = coordinate; + } + get row() { return this.coordinates.x; } + set row(val) { this.coordinates.x = val; } + get column() { return this.coordinates.y; } + set column(val) { this.coordinates.y = val; } + get slice() { return this.coordinates.z; } + set slice(val) { this.coordinates.z = val; } + get width() { return this.size.x; } + set width(val) { this.size.x = val; } + get height() { return this.size.y; } + set height(val) { this.size.y = val; } + get depth() { return this.size.z; } + set depth(val) { this.size.z = val; } + // Remove a specified boid by the boid id + removeBoid(id) { + for (let i = 0; i < this.boids.length; i++) { + let boid = this.boids[i]; + if (boid.id === id) { + this.boids.splice(i, 1); + break; + } + } + } + // **Use this instead of manually setting the boid chunk of the boid** + // Adds the boid and sets its chunk to this + addBoid(boid) { + this.boids.push(boid); + boid.chunk = this; + } + // Checks if this cell contains given coordinates + contains(coordinates) { + let xContained = (coordinates.x >= this.width * this.row) && (coordinates.x < this.width * (this.row + 1)); + let yContained = (coordinates.y >= this.height * this.column) && (coordinates.y < this.height * (this.column + 1)); + let zContained = (coordinates.z >= this.depth * this.slice) && (coordinates.z < this.depth * (this.slice + 1)); + return xContained && yContained && zContained; + } + position() { + return this.flock.position.add(new Vector3(this.flock.position.x + (this.column * this.flock.chunkSize), this.flock.position.y + (this.row * this.flock.chunkSize), this.flock.position.z + (this.slice * this.flock.chunkSize))); + } +} +export default BoidChunk; diff --git a/src/js/boids/BoidChunk.ts b/src/js/boids/BoidChunk.ts new file mode 100644 index 00000000..b3076138 --- /dev/null +++ b/src/js/boids/BoidChunk.ts @@ -0,0 +1,83 @@ +import Flock from "./Flock.js"; +import Boid from "./Boid.js"; +import {Scene, Vector3} from "babylonjs"; + + +class BoidChunk { + + // Coordinate Properties + coordinates: Vector3 + get row(): number { return this.coordinates.x } + set row(val) { this.coordinates.x = val } + + get column(): number { return this.coordinates.y } + set column(val) { this.coordinates.y = val } + + get slice(): number { return this.coordinates.z } + set slice(val) { this.coordinates.z = val } + + + // Size Properties + size: Vector3 + get width(): number { return this.size.x } + set width(val) { this.size.x = val } + + get height(): number { return this.size.y } + set height(val) { this.size.y = val } + + get depth(): number { return this.size.z } + set depth(val) { this.size.z = val } + + + boids: Array; + flock: Flock; + + scene: Scene; + + constructor(scene: Scene, coordinate: Vector3, size: number, flock: Flock) { + this.size = Vector3.One().scale(size); + + this.boids = []; + this.flock = flock; + + this.scene = scene; + this.coordinates = coordinate; + } + + // Remove a specified boid by the boid id + removeBoid(id: number) { + for(let i=0; i= this.width*this.row) && (coordinates.x < this.width*(this.row+1)); + let yContained = (coordinates.y >= this.height*this.column) && (coordinates.y < this.height*(this.column+1)); + let zContained = (coordinates.z >= this.depth*this.slice) && (coordinates.z < this.depth*(this.slice+1)); + + return xContained && yContained && zContained; + } + + position() { + return this.flock.position.add( + new Vector3(this.flock.position.x + (this.column * this.flock.chunkSize), + this.flock.position.y + (this.row * this.flock.chunkSize), + this.flock.position.z + (this.slice * this.flock.chunkSize)) + ); + } +} + +export default BoidChunk; \ No newline at end of file diff --git a/src/js/boids/Flock.js b/src/js/boids/Flock.js new file mode 100644 index 00000000..31bbc4f8 --- /dev/null +++ b/src/js/boids/Flock.js @@ -0,0 +1,114 @@ +import BoidChunk from "./BoidChunk.js"; +import { Vector3 } from "babylonjs"; +class Flock { + constructor(scene, cursor, pos, size) { + this.chunkSize = 0; + this.position = pos; + this.size = size; + this.chunkArrayDims = new Vector3(); + this.chunks = []; + this.cursor = cursor; + this.scene = scene; + } + get width() { return this.size.x; } + get height() { return this.size.y; } + get depth() { return this.size.z; } + get numRows() { return this.chunkArrayDims.x; } + set numRows(val) { this.chunkArrayDims.x = val; } + get numCols() { return this.chunkArrayDims.y; } + set numCols(val) { this.chunkArrayDims.y = val; } + get numSlices() { return this.chunkArrayDims.z; } + set numSlices(val) { this.chunkArrayDims.z = val; } + // Runs every boid in every chunk + run() { + // Lookup neighboring boids + for (const boidCell of this.chunks) { + for (const boid of boidCell.boids) { + // Get all boids in current and neighboring chunks + let neighboringBoids = this.allBoidsIn(this.cellAndNeighboring(boidCell.row, boidCell.column, boidCell.slice)); + boid.flock(neighboringBoids); + } + } + // Set boid velocities based on forces + for (const boidCell of this.chunks) { + for (const boid of boidCell.boids) { + boid.update(); + } + } + // Teleport to the opposite side if the boid reaches a border + for (const boidCell of this.chunks) { + for (const boid of boidCell.boids) { + boid.borders(); + } + } + // Move to appropriate chunk based on position + for (const boidCell of this.chunks) { + for (const boid of boidCell.boids) { + boid.updateChunk(); + } + } + } + // Returns an array containing the chunk at the given row and column and its neighbors + cellAndNeighboring(chunkRow, chunkCol, chunkSlice) { + const localChunks = []; + const beginningRow = Math.max(chunkRow - 1, 0); + const beginningCol = Math.max(chunkCol - 1, 0); + const beginningSlice = Math.max(chunkSlice - 1, 0); + const endingRow = Math.min(chunkRow + 1, this.numRows - 1); + const endingCol = Math.min(chunkCol + 1, this.numCols - 1); + const endingSlice = Math.min(chunkSlice + 1, this.numSlices - 1); + for (let row = beginningRow; row <= endingRow; row++) { + for (let col = beginningCol; col <= endingCol; col++) { + for (let slice = beginningSlice; slice <= endingSlice; slice++) { + localChunks.push(this.getChunk(row, col, slice)); + if (this.getChunk(row, col, slice) === undefined) + console.log(`Chunk [${row}] [${col}] [${slice}] is undefined`); + } + } + } + return localChunks; + } + // Returns a list of all the boids in the given list of chunks + allBoidsIn(chunks) { + let boids = []; + chunks.forEach((chunk, i) => { + chunk.boids.forEach((boid, j) => { + boids.push(boid); + }); + }); + return boids; + } + getChunk(row, column, slice) { + const rowOffset = row * this.numCols * this.numSlices; + const colOffset = column * this.numSlices; + return this.chunks[rowOffset + colOffset + slice]; + } + addBoid(boid) { + // The first boid added determines the chunk size + if (this.chunks.length === 0) { + this.generateChunks(boid.neighborDist); + } + // Calculate which chunk the boid should be placed in and add it + let boidRow = Math.floor(boid.position.y / this.chunkSize); + let boidCol = Math.floor(boid.position.x / this.chunkSize); + let boidSlice = Math.floor(boid.position.z / this.chunkSize); + this.getChunk(boidRow, boidCol, boidSlice).addBoid(boid); + } + // Create an array of chunks based on the screen size and cell size + generateChunks(chunkSize) { + this.chunkSize = chunkSize; + this.numRows = Math.ceil(this.height / this.chunkSize); + this.numCols = Math.ceil(this.width / this.chunkSize); + this.numSlices = Math.ceil(this.depth / this.chunkSize); + for (let row = 0; row < this.numRows; row++) { + for (let col = 0; col < this.numCols; col++) { + for (let slice = 0; slice < this.numSlices; slice++) { + const newChunk = new BoidChunk(this.scene, new Vector3(row, col, slice), this.chunkSize, this); + this.chunks.push(newChunk); + } + } + } + this.size = this.chunkArrayDims.scale(this.chunkSize); + } +} +export default Flock; diff --git a/src/js/boids/Flock.ts b/src/js/boids/Flock.ts new file mode 100644 index 00000000..9aa4815c --- /dev/null +++ b/src/js/boids/Flock.ts @@ -0,0 +1,147 @@ +import BoidChunk from "./BoidChunk.js"; +import Boid from "./Boid.js"; +import {Mesh, MeshBuilder, Scene, Vector3} from "babylonjs"; + +class Flock { + + position: Vector3; + + size: Vector3 + get width() { return this.size.x } + get height() { return this.size.y } + get depth() { return this.size.z } + + chunks: Array; + chunkSize: number = 0; + + chunkArrayDims: Vector3 + get numRows() { return this.chunkArrayDims.x; } + set numRows(val) { this.chunkArrayDims.x = val; } + get numCols() { return this.chunkArrayDims.y; } + set numCols(val) { this.chunkArrayDims.y = val; } + get numSlices() { return this.chunkArrayDims.z; } + set numSlices(val) { this.chunkArrayDims.z = val; } + + cursor: Mesh; + + scene: Scene; + + constructor(scene: Scene, cursor: Mesh, pos: Vector3, size: Vector3) { + this.position = pos; + this.size = size; + this.chunkArrayDims = new Vector3(); + + this.chunks = []; + + this.cursor = cursor; + this.scene = scene; + } + + // Runs every boid in every chunk + run() { + // Lookup neighboring boids + for (const boidCell of this.chunks) { + for(const boid of boidCell.boids) { + // Get all boids in current and neighboring chunks + let neighboringBoids = this.allBoidsIn(this.cellAndNeighboring(boidCell.row, boidCell.column, boidCell.slice)); + boid.flock(neighboringBoids); + } + } + + // Set boid velocities based on forces + for (const boidCell of this.chunks) { + for(const boid of boidCell.boids) { + boid.update(); + } + } + + // Teleport to the opposite side if the boid reaches a border + for (const boidCell of this.chunks) { + for(const boid of boidCell.boids) { + boid.borders(); + } + } + + // Move to appropriate chunk based on position + for (const boidCell of this.chunks) { + for(const boid of boidCell.boids) { + boid.updateChunk(); + } + } + } + + // Returns an array containing the chunk at the given row and column and its neighbors + cellAndNeighboring(chunkRow: number, chunkCol: number, chunkSlice: number) { + const localChunks = []; + const beginningRow = Math.max(chunkRow - 1, 0); + const beginningCol = Math.max(chunkCol - 1, 0); + const beginningSlice = Math.max(chunkSlice - 1, 0); + const endingRow = Math.min(chunkRow + 1, this.numRows - 1); + const endingCol = Math.min(chunkCol + 1, this.numCols - 1); + const endingSlice = Math.min(chunkSlice + 1, this.numSlices - 1); + + for (let row = beginningRow; row <= endingRow; row++) { + for (let col = beginningCol; col <= endingCol; col++) { + for (let slice = beginningSlice; slice <= endingSlice; slice++) { + localChunks.push(this.getChunk(row, col, slice)); + if (this.getChunk(row, col, slice) === undefined) + console.log(`Chunk [${row}] [${col}] [${slice}] is undefined`); + } + } + } + + return localChunks; + } + + // Returns a list of all the boids in the given list of chunks + allBoidsIn(chunks: Array): Array { + let boids: Array = []; + chunks.forEach((chunk, i) => { + chunk.boids.forEach((boid, j) => { + boids.push(boid); + }); + }); + + return boids; + } + + getChunk(row: number, column: number, slice: number): BoidChunk { + const rowOffset = row * this.numCols * this.numSlices; + const colOffset = column * this.numSlices; + + return this.chunks[rowOffset + colOffset + slice]; + } + + addBoid(boid: Boid) { + // The first boid added determines the chunk size + if (this.chunks.length === 0) { + this.generateChunks(boid.neighborDist); + } + + // Calculate which chunk the boid should be placed in and add it + let boidRow = Math.floor(boid.position.y / this.chunkSize); + let boidCol = Math.floor(boid.position.x / this.chunkSize); + let boidSlice = Math.floor(boid.position.z / this.chunkSize); + this.getChunk(boidRow, boidCol, boidSlice).addBoid(boid); + } + + // Create an array of chunks based on the screen size and cell size + generateChunks(chunkSize: number) { + this.chunkSize = chunkSize; + this.numRows = Math.ceil(this.height / this.chunkSize); + this.numCols = Math.ceil(this.width / this.chunkSize); + this.numSlices = Math.ceil(this.depth / this.chunkSize); + for (let row = 0; row < this.numRows; row++) { + for (let col = 0; col < this.numCols; col++) { + for (let slice = 0; slice < this.numSlices; slice++) { + const newChunk = new BoidChunk(this.scene, new Vector3(row, col, slice), this.chunkSize, this); + this.chunks.push(newChunk); + } + } + } + + this.size = this.chunkArrayDims.scale(this.chunkSize); + } +} + +export default Flock; \ No newline at end of file diff --git a/src/js/scripts.js b/src/js/scripts.js new file mode 100644 index 00000000..3d3d1182 --- /dev/null +++ b/src/js/scripts.js @@ -0,0 +1,67 @@ +import { ArcRotateCamera, Engine, MeshBuilder, Scene, Vector3, GizmoManager, HemisphericLight } from "babylonjs"; +import Flock from "./boids/Flock.js"; +import Boid from "./boids/Boid.js"; +const AREA_SIZE = 200; +const BOID_COUNT = 200; +// ************************** +// * Setup Babylon JS Scene * +// ************************** +// create the canvas html element and attach it to the webpage +const canvas = document.getElementById("main-canvas"); +// initialize babylon scene and engine +const engine = new Engine(canvas, true); +const scene = new Scene(engine); +const camera = new ArcRotateCamera("Camera", Math.PI / 2, Math.PI / 2, 100, Vector3.Zero(), scene); +camera.attachControl(canvas, true); +// Add lighting +const light1 = new HemisphericLight("light1", new Vector3(1, 1, 0), scene); +// ***************************** +// * Create new Flock of Boids * +// ***************************** +// Make Cursor with gizmo +const gizmoManager = new GizmoManager(scene); +const cursor = MeshBuilder.CreateSphere("Cursor", { diameter: 1 }, scene); +gizmoManager.positionGizmoEnabled = true; +gizmoManager.enableAutoPicking = false; +gizmoManager.attachToMesh(cursor); +// Make flock and bounding box for flock +const areaSize = Vector3.One().scale(AREA_SIZE); +const flock = new Flock(scene, cursor, areaSize.scale(-0.5), areaSize); +// Spawn agents in the center +let spawnArea = Vector3.One().scale(20); +for (let i = 0; i < BOID_COUNT; i++) { + let newBoid = new Boid(scene, i, new Vector3(Math.random() * spawnArea.x, Math.random() * spawnArea.y, Math.random() * spawnArea.z), MeshBuilder.CreateCylinder('Boid', { diameterTop: 0, diameterBottom: 1 }, scene)); + // Set the velocity in a random direction + let newVel = new Vector3(Math.random(), Math.random(), Math.random()); + newVel.normalize().scaleInPlace(newBoid.maxSpeed); + newBoid.velocity = newVel; + flock.addBoid(newBoid); +} +var lastFrameTime = Date.now(); +export var deltaTime = 1000 / 30; +function runFlock() { + flock.run(); + // Get frame delta time + const now = Date.now(); + deltaTime = now - lastFrameTime; + lastFrameTime = now; + requestAnimationFrame(runFlock); +} +requestAnimationFrame(runFlock); +// hide/show the Inspector +window.addEventListener("keydown", (ev) => { + // Shift+Ctrl+Alt+I + if (ev.shiftKey && ev.ctrlKey && ev.altKey && ev.keyCode === 73) { + if (scene.debugLayer.isVisible()) { + scene.debugLayer.hide(); + } + else { + scene.debugLayer.show(); + } + } +}); +canvas.addEventListener("scroll", ev => ev.preventDefault()); +// run the main render loop +engine.runRenderLoop(() => { + scene.render(); +}); diff --git a/src/js/scripts.ts b/src/js/scripts.ts new file mode 100644 index 00000000..8f261cd4 --- /dev/null +++ b/src/js/scripts.ts @@ -0,0 +1,90 @@ +import {ArcRotateCamera, Engine, MeshBuilder, Scene, Vector3, GizmoManager, HemisphericLight } from "babylonjs"; +import Flock from "./boids/Flock.js"; +import Boid from "./boids/Boid.js"; + + +const AREA_SIZE = 200; +const BOID_COUNT = 200; + +// ************************** +// * Setup Babylon JS Scene * +// ************************** + +// create the canvas html element and attach it to the webpage +const canvas = document.getElementById("main-canvas"); + +// initialize babylon scene and engine +const engine = new Engine(canvas, true); +const scene = new Scene(engine); + +const camera: ArcRotateCamera = new ArcRotateCamera("Camera", Math.PI / 2, Math.PI / 2, 100, Vector3.Zero(), scene); +camera.attachControl(canvas, true); + +// Add lighting +const light1: HemisphericLight = new HemisphericLight("light1", new Vector3(1, 1, 0), scene); + +// ***************************** +// * Create new Flock of Boids * +// ***************************** + +// Make Cursor with gizmo +const gizmoManager = new GizmoManager(scene); +const cursor = MeshBuilder.CreateSphere("Cursor", {diameter: 1}, scene); +gizmoManager.positionGizmoEnabled = true; +gizmoManager.enableAutoPicking = false; +gizmoManager.attachToMesh(cursor); + +// Make flock and bounding box for flock +const areaSize = Vector3.One().scale(AREA_SIZE); +const flock = new Flock(scene, cursor, areaSize.scale(-0.5), areaSize); + +// Spawn agents in the center +let spawnArea = Vector3.One().scale(20); + +for (let i=0; i { + // Shift+Ctrl+Alt+I + if (ev.shiftKey && ev.ctrlKey && ev.altKey && ev.keyCode === 73) { + if (scene.debugLayer.isVisible()) { + scene.debugLayer.hide(); + } else { + scene.debugLayer.show(); + } + } +}); + +canvas.addEventListener("scroll", ev => ev.preventDefault()); + +// run the main render loop +engine.runRenderLoop(() => { + scene.render(); +}); \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..7a6f5071 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,103 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + + /* Language and Environment */ + "target": "es2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "es2022", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + // "outDir": "./", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + } +} diff --git a/webpack.config.cjs b/webpack.config.cjs new file mode 100644 index 00000000..a4e012ce --- /dev/null +++ b/webpack.config.cjs @@ -0,0 +1,10 @@ +const path = require('path'); + +module.exports = { + mode: 'development', + entry: './src/js/scripts.js', + output: { + path: path.resolve(__dirname, './src/dist'), + filename: 'index.bundle.js', + }, +}; \ No newline at end of file