Codrops 원본
Matrix Sentinels: Building Dynamic Particle Trails with TSL
배경 · MIT
갤러리 안에서는 화면을 벗어나거나 움직임을 멈추면 예제도 닫힙니다. 다시 재생할 때는 처음부터 시작해요.
SOURCE FILES
원본 코드 읽기
수집한 원본 소스와 실행 안내를 함께 제공합니다.
src/Experience/Experience.js
import * as THREE from 'three/webgpu'
import EventEmitter from './Utils/EventEmitter.js'
import Debug from './Utils/Debug.js'
import Sizes from './Utils/Sizes.js'
import Time from './Utils/Time.js'
import Renderer from './Renderer.js'
import Worlds from './Worlds.js'
import Resources from './Utils/Resources.js'
import Sound from "./Utils/Sound.js";
import sources from './Sources.js'
import gsap from "gsap";
import MotionPathPlugin from "gsap/MotionPathPlugin";
import State from './State.js'
import PostProcess from './Utils/PostProcess.js'
import { isMobile } from '@experience/Utils/Helpers/Global/isMobile';
import Ui from "@experience/Ui/Ui.js";
export default class Experience extends EventEmitter {
static _instance = null
appLoaded = false;
firstRender = false;
static getInstance() {
return Experience._instance || new Experience()
}
constructor( _canvas ) {
super()
// Singleton
if ( Experience._instance ) {
return Experience._instance
}
Experience._instance = this
// Global access
window.experience = this
// Html Elements
this.html = {}
this.html.preloader = document.getElementById( "preloader" )
this.html.playButton = document.getElementById( "play-button" )
this.html.main = document.getElementsByTagName( "main" )[ 0 ]
this.isMobile = isMobile.any()
// Options
this.canvas = _canvas
THREE.ColorManagement.enabled = false
if ( !this.canvas ) {
console.warn( 'Missing \'Canvas\' property' )
return
}
this.setDefaultCode();
this.init()
}
init() {
// Start Loading Resources
this.resources = new Resources( sources )
// Setup
this.timeline = gsap.timeline({
paused: true,
});
this.debug = new Debug()
this.sizes = new Sizes()
this.time = new Time()
this.ui = new Ui()
this.renderer = new Renderer()
this.state = new State()
this.sound = new Sound()
this.mainCamera = undefined
this.mainScene = undefined
if ( this.state.postprocessing ) {
this.postProcess = new PostProcess( this.renderer.instance )
}
// Wait for resources
this.resources.on( 'ready', () => {
setTimeout( () => {
window.preloader.hidePreloader()
this.html.main.style.display = "block"
// window.preloader.showPlayButton(() => {
// // start media playing
// })
}, 1000)
this.time.reset()
this.worlds = new Worlds()
this.animationPipeline();
this.postInit()
this.setListeners()
this.trigger("classesReady");
window.dispatchEvent( new CustomEvent( "3d-app:classes-ready" ) );
this.appLoaded = true
} )
}
animationPipeline() {
this.worlds?.animationPipeline()
}
postInit() {
this.renderer.postInit()
this.postProcess?.postInit()
this.worlds?.postInit()
this.debug?.postInit()
}
resize() {
this.worlds.resize()
this.renderer.resize()
this.postProcess?.resize()
this.debug?.resize()
this.state?.resize()
//this.sound.resize()
}
async update() {
this.worlds.update( this.time.delta )
if ( this.state.postprocessing ) {
this.postProcess.update( this.time.delta )
} else {
this.renderer.update( this.time.delta )
}
if ( this.debug.active ) {
this.debug.update( this.time.delta )
}
this.postUpdate( this.time.delta )
this.debug?.stats?.update();
}
_fireReady() {
this.trigger( 'ready' )
window.dispatchEvent( new CustomEvent( "3d-app:ready" ) );
this.firstRender = 'done';
}
postUpdate( deltaTime ) {
if ( this.firstRender === true ) {
window.dispatchEvent( new CustomEvent( "app:first-render" ) );
// Dispatch event
this._fireReady();
}
if ( this.resources.loadedAll && this.appLoaded && this.firstRender === false ) {
this.firstRender = true;
}
this.worlds.postUpdate( deltaTime )
}
setListeners() {
// Resize event
this.sizes.on( 'resize', () => {
this.resize()
} )
this.renderer.instance.setAnimationLoop( async () => this.update() )
}
setDefaultCode() {
document.ondblclick = function ( e ) {
e.preventDefault()
}
gsap.registerPlugin( MotionPathPlugin );
}
startWithPreloader() {
this.ui.playButton.classList.add( "fade-in" );
this.ui.playButton.addEventListener( 'click', () => {
this.ui.playButton.classList.replace( "fade-in", "fade-out" );
//this.sound.createSounds();
setTimeout( () => {
this.time.reset()
// Setup
this.setupWorlds()
// Remove preloader
this.ui.preloader.classList.add( "preloaded" );
setTimeout( () => {
this.ui.preloader.remove();
this.ui.playButton.remove();
}, 2500 );
}, 100 );
}, { once: true } );
}
destroy() {
this.sizes.off( 'resize' )
this.time.off( 'tick' )
// Traverse the whole scene
this.scene.traverse( ( child ) => {
// Test if it's a mesh
if ( child instanceof THREE.Mesh ) {
child.geometry.dispose()
// Loop through the material properties
for ( const key in child.material ) {
const value = child.material[ key ]
// Test if there is a dispose function
if ( value && typeof value.dispose === 'function' ) {
value.dispose()
}
}
}
} )
this.camera.controls.dispose()
this.renderer.instance.dispose()
if ( this.debug.active )
this.debug.ui.destroy()
}
}
src/Experience/Materials/GridMaterial.js
import { MeshBasicNodeMaterial, SpriteNodeMaterial } from 'three/webgpu'
import { If, min, color, range, sin, instanceIndex, timerDelta, smoothstep, step, timerGlobal, Fn, uniform, uv, vec3, vec4, positionWorld, vec2, normalWorld, mix, max } from 'three/tsl'
const projectedGridUv = Fn(([ position, normal ]) =>
{
const dotX = normal.dot(vec3(1, 0, 0)).abs()
const dotY = normal.dot(vec3(0, 1, 0)).abs()
const dotZ = normal.dot(vec3(0, 0, 1)).abs()
const uvX = position.yz.toVar()
const uvY = position.xz.toVar()
const uvZ = position.xy.toVar()
const uv = uvX
If(dotZ.greaterThan(dotX), () =>
{
uv.assign(uvZ)
})
If(dotY.greaterThan(dotX).and(dotY.greaterThan(dotZ)), () =>
{
uv.assign(uvY)
})
return uv
})
const projectedGrid = Fn(([scale, thickness, offset]) =>
{
const uv = projectedGridUv(positionWorld, normalWorld).div(scale).add(thickness.mul(0.5)).add(offset).mod(1)
return max(
uv.x.step(thickness),
uv.y.step(thickness)
)
})
const scaleUniform = uniform(0.1)
const thicknessUniform = uniform(0.1)
const offsetUniform = uniform(vec2(0, 0))
const colorBackUniform = uniform(color('#171617'))
const colorSmallUniform = uniform(color('#39364f'))
const colorBigUniform = uniform(color('#705df2'))
let finalColor = mix(
colorBackUniform,
colorSmallUniform,
projectedGrid(scaleUniform, thicknessUniform, offsetUniform)
)
finalColor = mix(
finalColor,
colorBigUniform,
projectedGrid(scaleUniform.mul(10), thicknessUniform.div(10), offsetUniform)
)
const gridMaterial = new MeshBasicNodeMaterial()
gridMaterial.colorNode = vec4(finalColor, 1)
// gui.add(scaleUniform, 'value', 0, 0.2, 0.001).name('scale')
// gui.add(thicknessUniform, 'value', 0, 1, 0.001).name('thickness')
// gui.add(offsetUniform.value, 'x', 0, 1, 0.001).name('offsetX')
// gui.add(offsetUniform.value, 'y', 0, 1, 0.001).name('offsetY')
// gui.addColor({ color: colorBackUniform.value.getHexString(THREE.SRGBColorSpace) }, 'color').onChange((value) => { colorBackUniform.value.set(value) }).name('colorBack')
// gui.addColor({ color: colorSmallUniform.value.getHexString(THREE.SRGBColorSpace) }, 'color').onChange((value) => { colorSmallUniform.value.set(value) }).name('colorSmall')
// gui.addColor({ color: colorBigUniform.value.getHexString(THREE.SRGBColorSpace) }, 'color').onChange((value) => { colorBigUniform.value.set(value) }).name('colorBig')
export default gridMaterial
함께 쓰는 파일 58개 보기
src/Experience/Materials/Materials.js
import * as THREE from 'three/webgpu'
import Experience from '@experience/Experience.js'
import Debug from '@experience/Utils/Debug.js'
import State from "@experience/State.js";
export default class Materials {
static _instance = null
static getInstance() {
return Materials._instance || new Materials()
}
constructor() {
if ( Materials._instance ) {
return Materials._instance
}
Materials._instance = this
this.experience = Experience.getInstance()
this.debug = Debug.getInstance()
this.state = State.getInstance()
this.materials = {}
}
}
src/Experience/Renderer.js
import * as THREE from 'three/webgpu'
import Experience from './Experience.js'
import State from "@experience/State.js";
export default class Renderer {
constructor() {
this.experience = new Experience()
this.canvas = this.experience.canvas
this.sizes = this.experience.sizes
this.debug = this.experience.debug
this.resources = this.experience.resources
this.html = this.experience.html
this.setInstance()
this.setDebug()
}
postInit() {
this.camera = this.experience.mainCamera.instance
this.scene = this.experience.mainScene
this.state = this.experience.state
}
setInstance() {
this.clearColor = '#010101'
//console.log(THREE.WebGLRenderer.compile)
//THREE.WebGLRenderer.prototype.compile = compilePatch.bind( THREE.WebGLRenderer.prototype.compile )
this.instance = new THREE.WebGPURenderer( {
canvas: this.canvas,
//powerPreference: "high-performance",
antialias: true,
//samples: 4,
alpha: false,
stencil: false,
depth: true,
useLegacyLights: false,
physicallyCorrectLights: true,
forceWebGL: false
} )
//this.instance.compile = compilePatch.bind( this.instance.compile )
this.instance.outputColorSpace = THREE.SRGBColorSpace
this.instance.setSize( this.sizes.width, this.sizes.height )
this.instance.setPixelRatio( Math.min( this.sizes.pixelRatio, 2 ) )
this.instance.setClearColor( this.clearColor, 1 )
this.instance.setSize( this.sizes.width, this.sizes.height )
//this.instance.toneMapping = THREE.ACESFilmicToneMapping
}
setDebug() {
if ( this.debug.active ) {
if ( this.debug.panel ) {
const debugFolder = this.debug.panel.addFolder({
title: 'Renderer',
expanded: false,
});
debugFolder.addBinding( this.instance, "toneMapping", {
label: "Tone Mapping",
options: {
"No": THREE.NoToneMapping,
"Linear": THREE.LinearToneMapping,
"Reinhard": THREE.ReinhardToneMapping,
"Cineon": THREE.CineonToneMapping,
"ACESFilmic": THREE.ACESFilmicToneMapping,
"AgXToneMapping": THREE.AgXToneMapping,
"NeutralToneMapping": THREE.NeutralToneMapping
}
} ).on( 'change', () => {
if ( this.state.postprocessing ) {
this.experience.postProcess.composer.needsUpdate = true
}
})
// this.debugFolder.add( this.instance, "toneMappingExposure" )
// .min( 0 ).max( 2 ).step( 0.01 ).name( "Tone Mapping Exposure" );
debugFolder.addBinding( this.instance, "toneMappingExposure", {
min: 0,
max: 2,
step: 0.01,
label: "Tone Mapping Exposure"
} )
}
}
}
update() {
if ( this.debug.active ) {
this.debugRender()
} else {
this.productionRender()
}
}
productionRender() {
this.instance.renderAsync( this.scene, this.camera )
}
debugRender() {
this.instance.renderAsync( this.scene, this.camera )
}
resize() {
// Instance
// console.log(this.sizes.width, this.sizes.height)
this.instance.setSize( this.sizes.width, this.sizes.height )
this.instance.setPixelRatio( this.sizes.pixelRatio )
}
destroy() {
}
}
src/Experience/Shaders/Bloom/CompositeMaterial/fragment.glsl
varying vec2 vUv;
uniform sampler2D blurTexture1;
uniform sampler2D blurTexture2;
uniform sampler2D blurTexture3;
uniform sampler2D blurTexture4;
uniform sampler2D blurTexture5;
uniform sampler2D dirtTexture;
uniform float bloomStrength;
uniform float bloomRadius;
uniform float bloomFactors[NUM_MIPS];
uniform vec3 bloomTintColors[NUM_MIPS];
uniform vec3 uTintColor;
uniform float uTintStrength;
float lerpBloomFactor(const in float factor) {
float mirrorFactor = 1.2 - factor;
return mix(factor, mirrorFactor, bloomRadius);
}
void main() {
vec4 color = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +
lerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +
lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +
lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +
lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );
color.rgb = mix(color.rgb, uTintColor, uTintStrength);
gl_FragColor = color;
}
src/Experience/Shaders/Bloom/fragment.glsl
uniform sampler2D baseTexture;
uniform sampler2D bloomTexture;
varying vec2 vUv;
void main() {
gl_FragColor = ( texture2D( baseTexture, vUv ) + vec4( 1.0 ) * texture2D( bloomTexture, vUv ) );
// #include <tonemapping_fragment>
// #include <colorspace_fragment>
}
src/Experience/Shaders/Bloom/vertex.glsl
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}
src/Experience/Shaders/Clear/fragment.glsl
uniform sampler2D baseTexture;
uniform sampler2D u_DepthTexture;
uniform sampler2D u_TransitionTexture;
uniform vec2 u_Resolution;
uniform vec4 u_TransitionTextureResolution;
uniform float u_TransitionProgress;
uniform float cameraNear;
uniform float cameraFar;
uniform bool u_ScreenShow;
varying vec2 vUv;
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
// -near maps to 0; -far maps to 1
return ( viewZ + near ) / ( near - far );
}
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
// maps perspective depth in [ 0, 1 ] to viewZ
return ( near * far ) / ( ( far - near ) * depth - far );
}
float readDepth( sampler2D depthSampler, vec2 coord ) {
float fragCoordZ = texture2D( depthSampler, coord ).x;
float viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );
return viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );
}
float sdCircle( vec2 p, float r )
{
return length(p) - r;
}
float rand(vec2 co) {
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
}
float noise(vec2 p) {
vec2 ip = floor(p);
vec2 u = fract(p);
u = u*u*(3.0-2.0*u);
float res = mix(
mix(rand(ip),rand(ip+vec2(1.0,0.0)),u.x),
mix(rand(ip+vec2(0.0,1.0)),rand(ip+vec2(1.0,1.0)),u.x),u.y);
return res*res;
}
void main() {
vec2 screenUV = gl_FragCoord.xy / u_Resolution;
//float depth = readDepth( u_DepthTexture, screenUV );
vec4 depth = texture2D( u_DepthTexture, vUv );
vec4 prevTexture = texture2D( baseTexture, vUv );
vec2 centerUv = (vUv - vec2(0.5))*u_TransitionTextureResolution.zw + vec2(0.5);
vec4 transitionTexture = texture2D( u_TransitionTexture, centerUv );
vec2 normalizeUv = screenUV;
// Normalized pixel coordinates (from -1 to 1)
normalizeUv *= 2.0;
normalizeUv -= 1.0;
// Fix resize window
normalizeUv.x *= u_Resolution.x / u_Resolution.y;
// smooth circle
vec4 color = prevTexture;
vec2 circleUv = normalizeUv;
float dist = sdCircle(circleUv, 4.0 * u_TransitionProgress);
bool inner = false;
if ( dist < 0.0 ) {
inner = true;
}
dist = abs(dist);
dist = smoothstep(0.0, .7, dist);
vec3 mask = color.rgb + transitionTexture.rgb;
// change component RGB
vec2 redShift = vec2(u_TransitionProgress * 0.1, 0.0);
vec2 greenShift = vec2(0.0, -u_TransitionProgress * 0.1);
vec2 blueShift = vec2(-u_TransitionProgress * 0.1, 0.0);
vec4 red = texture(u_TransitionTexture, centerUv + redShift);
vec4 green = texture(u_TransitionTexture, centerUv + greenShift);
vec4 blue = texture(u_TransitionTexture, centerUv + blueShift);
vec3 maskRGB = vec3(mask.r - red.r, mask.g - green.g, mask.b - blue.b);
maskRGB.g = 0.0;
maskRGB.r = 0.0;
maskRGB.b /= 2.0;
mask = mix(texture2D( baseTexture, vUv * transitionTexture.r ).rgb, prevTexture.rgb, transitionTexture.r);
mask = mix(mask, texture2D( baseTexture, vUv - transitionTexture.r ).rgb, u_TransitionProgress);
mask = mix(mask, maskRGB, 0.5);
mask = mix(mask, prevTexture.rgb, smoothstep(0.0, 1.0, u_TransitionProgress));
if ( inner ) {
gl_FragColor = mix(vec4( mask , 1.0), vec4(0.0), smoothstep(0.0, 1.0, dist));
} else {
if ( u_ScreenShow ) {
gl_FragColor = mix(vec4(mask, 1.0), prevTexture, smoothstep(0.0, 1.0, dist));
gl_FragColor.a = 1.0;
} else {
if( depth.r == 0.0 ) {
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
} else {
gl_FragColor = prevTexture;
}
}
}
//gl_FragColor = vec4(0.0);
// if ( depth.r == 0.0 ) {
// discard;
// } else {
// gl_FragColor = prevTexture;
// }
//gl_FragColor.rgb = 1.0 - vec3( depth );
// gl_FragColor.a = 1.0;
//
// gl_FragColor = prevTexture;
//gl_FragColor = ( texture2D( baseTexture, vUv ) + vec4( 1.0 ) * texture2D( bloomTexture, vUv ) );
//gl_FragColor = texture2D( baseTexture, vUv );
// gl_FragColor.rgb = vec3( depth );
// gl_FragColor.a = 1.0;
// #include <tonemapping_fragment>
// #include <colorspace_fragment>
}
src/Experience/Shaders/Clear/vertex.glsl
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}
src/Experience/Shaders/Example/fragment.glsl
void main() {
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}
src/Experience/Shaders/Example/vertex.glsl
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}
src/Experience/Shaders/Gpgpu/particles.glsl
uniform float uTime;
uniform float uDeltaTime;
uniform sampler2D uBase;
uniform float uFlowFieldInfluence;
uniform float uFlowFieldStrength;
uniform float uFlowFieldFrequency;
#include ../Includes/simplexNoise4d.glsl
void main()
{
float time = uTime * 0.2;
vec2 uv = gl_FragCoord.xy / resolution.xy;
vec4 particle = texture(uParticles, uv);
vec4 base = texture(uBase, uv);
// Dead
if(particle.a >= 1.0)
{
particle.a = mod(particle.a, 1.0);
particle.xyz = base.xyz;
}
// Alive
else
{
// Strength
float strength = simplexNoise4d(vec4(base.xyz * 0.2, time + 1.0));
float influence = (uFlowFieldInfluence - 0.5) * (- 2.0);
strength = smoothstep(influence, 1.0, strength);
// Flow field
vec3 flowField = vec3(
simplexNoise4d(vec4(particle.xyz * uFlowFieldFrequency + 0.0, time)),
simplexNoise4d(vec4(particle.xyz * uFlowFieldFrequency + 1.0, time)),
simplexNoise4d(vec4(particle.xyz * uFlowFieldFrequency + 2.0, time))
);
flowField = normalize(flowField);
particle.xyz += flowField * uDeltaTime * uFlowFieldStrength /* * strength */;
// Decay
particle.a += uDeltaTime * 0.01;
}
gl_FragColor = particle;
}
src/Experience/Shaders/Includes/simplexNoise3d.glsl
// Simplex 3D Noise
// by Ian McEwan, Ashima Arts
//
vec4 permute_3d(vec4 x){ return mod(((x*34.0)+1.0)*x, 289.0); }
vec4 taylorInvSqrt3d(vec4 r){ return 1.79284291400159 - 0.85373472095314 * r; }
float simplexNoise3d(vec3 v)
{
const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;
const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);
// First corner
vec3 i = floor(v + dot(v, C.yyy) );
vec3 x0 = v - i + dot(i, C.xxx) ;
// Other corners
vec3 g = step(x0.yzx, x0.xyz);
vec3 l = 1.0 - g;
vec3 i1 = min( g.xyz, l.zxy );
vec3 i2 = max( g.xyz, l.zxy );
// x0 = x0 - 0. + 0.0 * C
vec3 x1 = x0 - i1 + 1.0 * C.xxx;
vec3 x2 = x0 - i2 + 2.0 * C.xxx;
vec3 x3 = x0 - 1. + 3.0 * C.xxx;
// Permutations
i = mod(i, 289.0 );
vec4 p = permute_3d( permute_3d( permute_3d( i.z + vec4(0.0, i1.z, i2.z, 1.0 )) + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));
// Gradients
// ( N*N points uniformly over a square, mapped onto an octahedron.)
float n_ = 1.0/7.0; // N=7
vec3 ns = n_ * D.wyz - D.xzx;
vec4 j = p - 49.0 * floor(p * ns.z *ns.z); // mod(p,N*N)
vec4 x_ = floor(j * ns.z);
vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N)
vec4 x = x_ *ns.x + ns.yyyy;
vec4 y = y_ *ns.x + ns.yyyy;
vec4 h = 1.0 - abs(x) - abs(y);
vec4 b0 = vec4( x.xy, y.xy );
vec4 b1 = vec4( x.zw, y.zw );
vec4 s0 = floor(b0)*2.0 + 1.0;
vec4 s1 = floor(b1)*2.0 + 1.0;
vec4 sh = -step(h, vec4(0.0));
vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;
vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;
vec3 p0 = vec3(a0.xy,h.x);
vec3 p1 = vec3(a0.zw,h.y);
vec3 p2 = vec3(a1.xy,h.z);
vec3 p3 = vec3(a1.zw,h.w);
// Normalise gradients
vec4 norm = taylorInvSqrt3d(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));
p0 *= norm.x;
p1 *= norm.y;
p2 *= norm.z;
p3 *= norm.w;
// Mix final noise value
vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);
m = m * m;
return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), dot(p2,x2), dot(p3,x3) ) );
}
src/Experience/Shaders/Includes/simplexNoise4d.glsl
// Simplex 4D Noise
// by Ian McEwan, Ashima Arts
//
vec4 permute(vec4 x){return mod(((x*34.0)+1.0)*x, 289.0);}
float permute(float x){return floor(mod(((x*34.0)+1.0)*x, 289.0));}
vec4 taylorInvSqrt(vec4 r){return 1.79284291400159 - 0.85373472095314 * r;}
float taylorInvSqrt(float r){return 1.79284291400159 - 0.85373472095314 * r;}
vec4 grad4(float j, vec4 ip){
const vec4 ones = vec4(1.0, 1.0, 1.0, -1.0);
vec4 p,s;
p.xyz = floor( fract (vec3(j) * ip.xyz) * 7.0) * ip.z - 1.0;
p.w = 1.5 - dot(abs(p.xyz), ones.xyz);
s = vec4(lessThan(p, vec4(0.0)));
p.xyz = p.xyz + (s.xyz*2.0 - 1.0) * s.www;
return p;
}
float simplexNoise4d(vec4 v){
const vec2 C = vec2( 0.138196601125010504, // (5 - sqrt(5))/20 G4
0.309016994374947451); // (sqrt(5) - 1)/4 F4
// First corner
vec4 i = floor(v + dot(v, C.yyyy) );
vec4 x0 = v - i + dot(i, C.xxxx);
// Other corners
// Rank sorting originally contributed by Bill Licea-Kane, AMD (formerly ATI)
vec4 i0;
vec3 isX = step( x0.yzw, x0.xxx );
vec3 isYZ = step( x0.zww, x0.yyz );
// i0.x = dot( isX, vec3( 1.0 ) );
i0.x = isX.x + isX.y + isX.z;
i0.yzw = 1.0 - isX;
// i0.y += dot( isYZ.xy, vec2( 1.0 ) );
i0.y += isYZ.x + isYZ.y;
i0.zw += 1.0 - isYZ.xy;
i0.z += isYZ.z;
i0.w += 1.0 - isYZ.z;
// i0 now contains the unique values 0,1,2,3 in each channel
vec4 i3 = clamp( i0, 0.0, 1.0 );
vec4 i2 = clamp( i0-1.0, 0.0, 1.0 );
vec4 i1 = clamp( i0-2.0, 0.0, 1.0 );
// x0 = x0 - 0.0 + 0.0 * C
vec4 x1 = x0 - i1 + 1.0 * C.xxxx;
vec4 x2 = x0 - i2 + 2.0 * C.xxxx;
vec4 x3 = x0 - i3 + 3.0 * C.xxxx;
vec4 x4 = x0 - 1.0 + 4.0 * C.xxxx;
// Permutations
i = mod(i, 289.0);
float j0 = permute( permute( permute( permute(i.w) + i.z) + i.y) + i.x);
vec4 j1 = permute( permute( permute( permute (
i.w + vec4(i1.w, i2.w, i3.w, 1.0 ))
+ i.z + vec4(i1.z, i2.z, i3.z, 1.0 ))
+ i.y + vec4(i1.y, i2.y, i3.y, 1.0 ))
+ i.x + vec4(i1.x, i2.x, i3.x, 1.0 ));
// Gradients
// ( 7*7*6 points uniformly over a cube, mapped onto a 4-octahedron.)
// 7*7*6 = 294, which is close to the ring size 17*17 = 289.
vec4 ip = vec4(1.0/294.0, 1.0/49.0, 1.0/7.0, 0.0) ;
vec4 p0 = grad4(j0, ip);
vec4 p1 = grad4(j1.x, ip);
vec4 p2 = grad4(j1.y, ip);
vec4 p3 = grad4(j1.z, ip);
vec4 p4 = grad4(j1.w, ip);
// Normalise gradients
vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));
p0 *= norm.x;
p1 *= norm.y;
p2 *= norm.z;
p3 *= norm.w;
p4 *= taylorInvSqrt(dot(p4,p4));
// Mix contributions from the five corners
vec3 m0 = max(0.6 - vec3(dot(x0,x0), dot(x1,x1), dot(x2,x2)), 0.0);
vec2 m1 = max(0.6 - vec2(dot(x3,x3), dot(x4,x4) ), 0.0);
m0 = m0 * m0;
m1 = m1 * m1;
return 49.0 * ( dot(m0*m0, vec3( dot( p0, x0 ), dot( p1, x1 ), dot( p2, x2 )))
+ dot(m1*m1, vec2( dot( p3, x3 ), dot( p4, x4 ) ) ) ) ;
}src/Experience/Sources.js
export default [
// {
// name: 'exampleSound',
// type: 'audio',
// path: '/sounds/example.mp3'
// },
// {
// name: 'exampleModel',
// type: 'gltfModel',
// path: '/models/example.glb'
// },
// {
// name: 'exampleModel',
// type: 'gltfModel',
// path: '/models/points_3.glb',
// meta: {
// "type": "gltfModel"
// }
// },
// {
// name: 'exampleAttribute',
// type: 'json',
// path: '/models/attr.json',
// meta: {
// "type": "json"
// }
// },
]
src/Experience/State.js
import * as THREE from 'three/webgpu'
import Experience from './Experience.js'
import Sizes from "./Utils/Sizes.js"
import { color, uniform } from 'three/tsl'
export default class State {
static _instance = null
static getInstance() {
return State._instance || new State()
}
experience = Experience.getInstance()
renderer = this.experience.renderer.instance
sizes = Sizes.getInstance()
postprocessing = true;
uniforms = {
resolution: uniform( new THREE.Vector2( this.sizes.width_DPR, this.sizes.height_DPR ) ),
mainScene: {
environment: {
topColor: uniform( color( 0x0487e2 ) ),
bottomColor: uniform( color( 0x0066ff ) ),
//fogColor: uniform( new THREE.Color( 0x0487e2 ) ),
fogColor: uniform( color( 0x000000 ) ),
fogNear: uniform( 0 ),
fogFar: uniform( 47.83 ),
},
bloomPass: {
strength: uniform( 0.9 ),
radius: uniform( 0.3 ),
threshold: uniform( 0 ),
}
}
}
unrealBloom = {
enabled: true,
strength: 0.9,
radius: 0.3,
threshold: 0.0,
}
constructor() {
// Singleton
if ( State._instance ) {
return State._instance
}
State._instance = this
this.experience = Experience.getInstance()
this.renderer = this.experience.renderer.instance
this.canvas = this.experience.canvas
this.sizes = Sizes.getInstance()
this.setLayers()
}
setLayers() {
this.layersConst = {
BLOOM_SCENE: 1,
DEFAULT: 0,
}
this.bloomLayer = new THREE.Layers();
this.bloomLayer.set( this.layersConst.BLOOM_SCENE );
}
resize() {
}
}
src/Experience/TSL/curlNoise3d.js
// Base on https://al-ro.github.io/projects/embers/
import { EPSILON, cross, Fn, vec3 } from "three/tsl"
import { simplexNoise3d } from './simplexNoise3d.js'
const curlNoise3d = Fn(([ inputA ]) =>
{
// X
const aXPos = simplexNoise3d(inputA.add(vec3(EPSILON, 0, 0)))
const aXNeg = simplexNoise3d(inputA.sub(vec3(EPSILON, 0, 0)))
const aXAverage = aXPos.sub(aXNeg).div(EPSILON.mul(2))
// Y
const aYPos = simplexNoise3d(inputA.add(vec3(0, EPSILON, 0)))
const aYNeg = simplexNoise3d(inputA.sub(vec3(0, EPSILON, 0)))
const aYAverage = aYPos.sub(aYNeg).div(EPSILON.mul(2))
// Z
const aZPos = simplexNoise3d(inputA.add(vec3(0, 0, EPSILON)))
const aZNeg = simplexNoise3d(inputA.sub(vec3(0, 0, EPSILON)))
const aZAverage = aZPos.sub(aZNeg).div(EPSILON.mul(2))
const aGrabNoise = vec3(aXAverage, aYAverage, aZAverage).normalize()
// Offset position for second noise read
const inputB = inputA.add(3.5) // Because breaks the simplex noise 10000.5
// X
const bXPos = simplexNoise3d(inputB.add(vec3(EPSILON, 0, 0)))
const bXNeg = simplexNoise3d(inputB.sub(vec3(EPSILON, 0, 0)))
const bXAverage = bXPos.sub(bXNeg).div(EPSILON.mul(2))
// Y
const bYPos = simplexNoise3d(inputB.add(vec3(0, EPSILON, 0)))
const bYNeg = simplexNoise3d(inputB.sub(vec3(0, EPSILON, 0)))
const bYAverage = bYPos.sub(bYNeg).div(EPSILON.mul(2))
// Z
const bZPos = simplexNoise3d(inputB.add(vec3(0, 0, EPSILON)))
const bZNeg = simplexNoise3d(inputB.sub(vec3(0, 0, EPSILON)))
const bZAverage = bZPos.sub(bZNeg).div(EPSILON.mul(2))
const bGrabNoise = vec3(bXAverage, bYAverage, bZAverage).normalize()
return cross(aGrabNoise, bGrabNoise).normalize()
})
curlNoise3d.setLayout( {
name: 'curlNoise3d',
type: 'vec3',
inputs: [
{ name: 'input', type: 'vec3' }
]
} )
export { curlNoise3d }
src/Experience/TSL/curlNoise4d.js
// Base on https://al-ro.github.io/projects/embers/
// Added a 4th dimension
import { cross, float, Fn, vec3, vec4 } from "three/tsl"
import { simplexNoise4d } from './simplexNoise4d.js'
const curlNoise4d = Fn(([ inputA ]) =>
{
const epsilon = float(1e-4) // Because EPSILON doesn't work with high input
// X
const aXPos = simplexNoise4d(inputA.add(vec4(epsilon, 0, 0, 0)))
const aXNeg = simplexNoise4d(inputA.sub(vec4(epsilon, 0, 0, 0)))
const aXAverage = aXPos.sub(aXNeg).div(epsilon.mul(2))
// Y
const aYPos = simplexNoise4d(inputA.add(vec4(0, epsilon, 0, 0)))
const aYNeg = simplexNoise4d(inputA.sub(vec4(0, epsilon, 0, 0)))
const aYAverage = aYPos.sub(aYNeg).div(epsilon.mul(2))
// Z
const aZPos = simplexNoise4d(inputA.add(vec4(0, 0, epsilon, 0)))
const aZNeg = simplexNoise4d(inputA.sub(vec4(0, 0, epsilon, 0)))
const aZAverage = aZPos.sub(aZNeg).div(epsilon.mul(2))
// W
const aWPos = simplexNoise4d(inputA.add(vec4(0, 0, 0, epsilon)))
const aWNeg = simplexNoise4d(inputA.sub(vec4(0, 0, 0, epsilon)))
const aWAverage = aWPos.sub(aWNeg).div(epsilon.mul(2))
const aGrabNoise = vec4(aXAverage, aYAverage, aZAverage, aWAverage).normalize()
// Second noise read
const inputB = inputA.add(3.5) // Because 10000.5 breaks the simplex noise
// X
const bXPos = simplexNoise4d(inputB.add(vec4(epsilon, 0, 0, 0)))
const bXNeg = simplexNoise4d(inputB.sub(vec4(epsilon, 0, 0, 0)))
const bXAverage = bXPos.sub(bXNeg).div(epsilon.mul(2))
// Y
const bYPos = simplexNoise4d(inputB.add(vec4(0, epsilon, 0, 0)))
const bYNeg = simplexNoise4d(inputB.sub(vec4(0, epsilon, 0, 0)))
const bYAverage = bYPos.sub(bYNeg).div(epsilon.mul(2))
// Z
const bZPos = simplexNoise4d(inputB.add(vec4(0, 0, epsilon, 0)))
const bZNeg = simplexNoise4d(inputB.sub(vec4(0, 0, epsilon, 0)))
const bZAverage = bZPos.sub(bZNeg).div(epsilon.mul(2))
// W
const bWPos = simplexNoise4d(inputB.add(vec4(0, 0, 0, epsilon)))
const bWNeg = simplexNoise4d(inputB.sub(vec4(0, 0, 0, epsilon)))
const bWAverage = bWPos.sub(bWNeg).div(epsilon.mul(2))
const bGrabNoise = vec4(bXAverage, bYAverage, bZAverage, bWAverage).normalize()
return cross(aGrabNoise, bGrabNoise).normalize()
})
curlNoise4d.setLayout( {
name: 'curlNoise4d',
type: 'vec3',
inputs: [
{ name: 'inputCurlNoise4d', type: 'vec4' }
]
} )
export { curlNoise4d }
src/Experience/TSL/fbm.js
import { vec4, mod, Fn, mul, sub, vec3, vec2, dot, floor, step, min, max, float, abs, int, If, Loop } from 'three/tsl';
const permute = Fn( ( [ x_immutable ] ) => {
const x = vec4( x_immutable ).toVar();
return mod( x.mul( 34.0 ).add( 1.0 ).mul( x ), 289.0 );
} );
const taylorInvSqrt = Fn( ( [ r_immutable ] ) => {
const r = vec4( r_immutable ).toVar();
return sub( 1.79284291400159, mul( 0.85373472095314, r ) );
} );
const fbm = Fn( ( [ v_immutable ] ) => {
const v = vec3( v_immutable ).toVar();
const C = vec2( 1.0 / 6.0, 1.0 / 3.0 );
const D = vec4( 0.0, 0.5, 1.0, 2.0 );
const i = vec3( floor( v.add( dot( v, C.yyy ) ) ) ).toVar();
const x0 = vec3( v.sub( i ).add( dot( i, C.xxx ) ) ).toVar();
const g = vec3( step( x0.yzx, x0.xyz ) ).toVar();
const l = vec3( sub( 1.0, g ) ).toVar();
const i1 = vec3( min( g.xyz, l.zxy ) ).toVar();
const i2 = vec3( max( g.xyz, l.zxy ) ).toVar();
const x1 = vec3( x0.sub( i1 ).add( mul( 1.0, C.xxx ) ) ).toVar();
const x2 = vec3( x0.sub( i2 ).add( mul( 2.0, C.xxx ) ) ).toVar();
const x3 = vec3( x0.sub( 1. ).add( mul( 3.0, C.xxx ) ) ).toVar();
i.assign( mod( i, 289.0 ) );
const p = vec4( permute( permute( permute( i.z.add( vec4( 0.0, i1.z, i2.z, 1.0 ) ) ).add( i.y.add( vec4( 0.0, i1.y, i2.y, 1.0 ) ) ) ).add( i.x.add( vec4( 0.0, i1.x, i2.x, 1.0 ) ) ) ) ).toVar();
const n_ = float( 1.0 / 7.0 ).toVar();
const ns = vec3( n_.mul( D.wyz ).sub( D.xzx ) ).toVar();
const j = vec4( p.sub( mul( 49.0, floor( p.mul( ns.z.mul( ns.z ) ) ) ) ) ).toVar();
const x_ = vec4( floor( j.mul( ns.z ) ) ).toVar();
const y_ = vec4( floor( j.sub( mul( 7.0, x_ ) ) ) ).toVar();
const x = vec4( x_.mul( ns.x ).add( ns.yyyy ) ).toVar();
const y = vec4( y_.mul( ns.x ).add( ns.yyyy ) ).toVar();
const h = vec4( sub( 1.0, abs( x ).sub( abs( y ) ) ) ).toVar();
const b0 = vec4( x.xy, y.xy ).toVar();
const b1 = vec4( x.zw, y.zw ).toVar();
const s0 = vec4( floor( b0 ).mul( 2.0 ).add( 1.0 ) ).toVar();
const s1 = vec4( floor( b1 ).mul( 2.0 ).add( 1.0 ) ).toVar();
const sh = vec4( step( h, vec4( 0.0 ) ).negate() ).toVar();
const a0 = vec4( b0.xzyw.add( s0.xzyw.mul( sh.xxyy ) ) ).toVar();
const a1 = vec4( b1.xzyw.add( s1.xzyw.mul( sh.zzww ) ) ).toVar();
const p0 = vec3( a0.xy, h.x ).toVar();
const p1 = vec3( a0.zw, h.y ).toVar();
const p2 = vec3( a1.xy, h.z ).toVar();
const p3 = vec3( a1.zw, h.w ).toVar();
const norm = vec4( taylorInvSqrt( vec4( dot( p0, p0 ), dot( p1, p1 ), dot( p2, p2 ), dot( p3, p3 ) ) ) ).toVar();
p0.mulAssign( norm.x );
p1.mulAssign( norm.y );
p2.mulAssign( norm.z );
p3.mulAssign( norm.w );
const m = vec4( max( sub( 0.6, vec4( dot( x0, x0 ), dot( x1, x1 ), dot( x2, x2 ), dot( x3, x3 ) ) ), 0.0 ) ).toVar();
m.assign( m.mul( m ) );
return mul( 42.0, dot( m.mul( m ), vec4( dot( p0, x0 ), dot( p1, x1 ), dot( p2, x2 ), dot( p3, x3 ) ) ) );
} );
const fbm3d = Fn( ( [ x_immutable, it ] ) => {
const x = vec3( x_immutable ).toVar();
const v = float( 0.0 ).toVar();
const a = float( 0.5 ).toVar();
const shift = vec3( int( 100 ) ).toVar();
Loop( { start: int( 0 ), end: int( 32 ) }, ( { i } ) => {
If( i.lessThan( it ), () => {
v.addAssign( a.mul( fbm( x ) ) );
x.assign( x.mul( 2.0 ).add( shift ) );
a.mulAssign( 0.5 );
} );
} );
return v;
} )
// layouts
permute.setLayout( {
name: 'permute',
type: 'vec4',
inputs: [
{ name: 'x', type: 'vec4' }
]
} );
taylorInvSqrt.setLayout( {
name: 'taylorInvSqrt',
type: 'vec4',
inputs: [
{ name: 'r', type: 'vec4' }
]
} );
fbm.setLayout( {
name: 'simplexNoise3d',
type: 'float',
inputs: [
{ name: 'v', type: 'vec3' }
]
} );
fbm3d.setLayout( {
name: 'fbm3d',
type: 'float',
inputs: [
{ name: 'x', type: 'vec3' },
{ name: 'it', type: 'int', qualifier: 'in' }
]
} );
export { permute, taylorInvSqrt, fbm, fbm3d };
src/Experience/TSL/linearStep.js
import { float, clamp, Fn } from 'three/tsl';
const linearStep = /*#__PURE__*/ Fn( ( [ edge0_immutable, edge1_immutable, x_immutable ] ) => {
const x = float( x_immutable ).toVar();
const edge1 = float( edge1_immutable ).toVar();
const edge0 = float( edge0_immutable ).toVar();
return clamp( x.sub( edge0 ).div( edge1.sub( edge0 ) ), 0.0, 1.0 );
} ).setLayout( {
name: 'linearStep',
type: 'float',
inputs: [
{ name: 'edge0', type: 'float' },
{ name: 'edge1', type: 'float' },
{ name: 'x', type: 'float' }
]
} );
export { linearStep };
src/Experience/TSL/simplexNoise3d.js
// Three.js Transpiler r164
import { vec4, mod, Fn, mul, sub, vec3, vec2, dot, floor, step, min, max, float, abs } from 'three/tsl';
const permute = Fn( ( [ x_immutable ] ) => {
const x = vec4( x_immutable ).toVar();
return mod( x.mul( 34.0 ).add( 1.0 ).mul( x ), 289.0 );
} );
const taylorInvSqrt = Fn( ( [ r_immutable ] ) => {
const r = vec4( r_immutable ).toVar();
return sub( 1.79284291400159, mul( 0.85373472095314, r ) );
} );
const simplexNoise3d = Fn( ( [ v_immutable ] ) => {
const v = vec3( v_immutable ).toVar();
const C = vec2( 1.0 / 6.0, 1.0 / 3.0 );
const D = vec4( 0.0, 0.5, 1.0, 2.0 );
const i = vec3( floor( v.add( dot( v, C.yyy ) ) ) ).toVar();
const x0 = vec3( v.sub( i ).add( dot( i, C.xxx ) ) ).toVar();
const g = vec3( step( x0.yzx, x0.xyz ) ).toVar();
const l = vec3( sub( 1.0, g ) ).toVar();
const i1 = vec3( min( g.xyz, l.zxy ) ).toVar();
const i2 = vec3( max( g.xyz, l.zxy ) ).toVar();
const x1 = vec3( x0.sub( i1 ).add( mul( 1.0, C.xxx ) ) ).toVar();
const x2 = vec3( x0.sub( i2 ).add( mul( 2.0, C.xxx ) ) ).toVar();
const x3 = vec3( x0.sub( 1. ).add( mul( 3.0, C.xxx ) ) ).toVar();
i.assign( mod( i, 289.0 ) );
const p = vec4( permute( permute( permute( i.z.add( vec4( 0.0, i1.z, i2.z, 1.0 ) ) ).add( i.y.add( vec4( 0.0, i1.y, i2.y, 1.0 ) ) ) ).add( i.x.add( vec4( 0.0, i1.x, i2.x, 1.0 ) ) ) ) ).toVar();
const n_ = float( 1.0 / 7.0 ).toVar();
const ns = vec3( n_.mul( D.wyz ).sub( D.xzx ) ).toVar();
const j = vec4( p.sub( mul( 49.0, floor( p.mul( ns.z.mul( ns.z ) ) ) ) ) ).toVar();
const x_ = vec4( floor( j.mul( ns.z ) ) ).toVar();
const y_ = vec4( floor( j.sub( mul( 7.0, x_ ) ) ) ).toVar();
const x = vec4( x_.mul( ns.x ).add( ns.yyyy ) ).toVar();
const y = vec4( y_.mul( ns.x ).add( ns.yyyy ) ).toVar();
const h = vec4( sub( 1.0, abs( x ).sub( abs( y ) ) ) ).toVar();
const b0 = vec4( x.xy, y.xy ).toVar();
const b1 = vec4( x.zw, y.zw ).toVar();
const s0 = vec4( floor( b0 ).mul( 2.0 ).add( 1.0 ) ).toVar();
const s1 = vec4( floor( b1 ).mul( 2.0 ).add( 1.0 ) ).toVar();
const sh = vec4( step( h, vec4( 0.0 ) ).negate() ).toVar();
const a0 = vec4( b0.xzyw.add( s0.xzyw.mul( sh.xxyy ) ) ).toVar();
const a1 = vec4( b1.xzyw.add( s1.xzyw.mul( sh.zzww ) ) ).toVar();
const p0 = vec3( a0.xy, h.x ).toVar();
const p1 = vec3( a0.zw, h.y ).toVar();
const p2 = vec3( a1.xy, h.z ).toVar();
const p3 = vec3( a1.zw, h.w ).toVar();
const norm = vec4( taylorInvSqrt( vec4( dot( p0, p0 ), dot( p1, p1 ), dot( p2, p2 ), dot( p3, p3 ) ) ) ).toVar();
p0.mulAssign( norm.x );
p1.mulAssign( norm.y );
p2.mulAssign( norm.z );
p3.mulAssign( norm.w );
const m = vec4( max( sub( 0.6, vec4( dot( x0, x0 ), dot( x1, x1 ), dot( x2, x2 ), dot( x3, x3 ) ) ), 0.0 ) ).toVar();
m.assign( m.mul( m ) );
return mul( 42.0, dot( m.mul( m ), vec4( dot( p0, x0 ), dot( p1, x1 ), dot( p2, x2 ), dot( p3, x3 ) ) ) );
} );
// layouts
permute.setLayout( {
name: 'permute',
type: 'vec4',
inputs: [
{ name: 'x', type: 'vec4' }
]
} );
taylorInvSqrt.setLayout( {
name: 'taylorInvSqrt',
type: 'vec4',
inputs: [
{ name: 'r', type: 'vec4' }
]
} );
simplexNoise3d.setLayout( {
name: 'simplexNoise3d',
type: 'float',
inputs: [
{ name: 'v', type: 'vec3' }
]
} );
export { permute, taylorInvSqrt, simplexNoise3d };
src/Experience/TSL/simplexNoise4d.js
import {
vec4,
mod,
Fn,
float,
floor,
overloadingFn,
mul,
sub,
vec3,
fract,
abs,
dot,
vec2,
step,
clamp,
max,
If, select
} from 'three/tsl';
const permute_0 = Fn( ( [ x_immutable ] ) => {
const x = vec4( x_immutable ).toVar();
return mod( x.mul( 34.0 ).add( 1.0 ).mul( x ), 289.0 );
} );
const permute_1 = Fn( ( [ x_immutable ] ) => {
const x = float( x_immutable ).toVar();
return floor( mod( x.mul( 34.0 ).add( 1.0 ).mul( x ), 289.0 ) );
} );
const permute = overloadingFn( [ permute_0, permute_1 ] );
const taylorInvSqrt_0 = Fn( ( [ r_immutable ] ) => {
const r = vec4( r_immutable ).toVar();
return sub( 1.79284291400159, mul( 0.85373472095314, r ) );
} );
const taylorInvSqrt_1 = Fn( ( [ r_immutable ] ) => {
const r = float( r_immutable ).toVar();
return sub( 1.79284291400159, mul( 0.85373472095314, r ) );
} );
const taylorInvSqrt = overloadingFn( [ taylorInvSqrt_0, taylorInvSqrt_1 ] );
const grad4 = Fn( ( [ j_immutable, ip_immutable ] ) => {
const ip = vec4( ip_immutable ).toVar();
const j = float( j_immutable ).toVar();
const ones = vec4( 1.0, 1.0, 1.0, -1.0 );
const p = vec4().toVar();
const s = vec4().toVar();
p.xyz.assign( floor( fract( vec3( j ).mul( ip.xyz ) ).mul( 7.0 ) ).mul( ip.z ).sub( 1.0 ) );
p.w.assign( sub( 1.5, dot( abs( p.xyz ), ones.xyz ) ) );
// s.x = s.x.lessThanAssign(p.x, 0.0, 1)
// s.y = s.y.lessThanAssign(p.y, 0.0, 1)
// s.z = s.z.lessThanAssign(p.z, 0.0, 1)
// s.w = s.w.lessThanAssign(p.w, 0.0, 1)
s.x = select( s.x.lessThan( p.x ), 0.0, 1.0 )
s.y = select( s.y.lessThan( p.y ), 0.0, 1.0 )
s.z = select( s.z.lessThan( p.z ), 0.0, 1.0 )
s.w = select( s.w.lessThan( p.w ), 0.0, 1.0 )
p.xyz.assign( p.xyz.add( s.xyz.mul( 2.0 ).sub( 1.0 ).mul( s.www ) ) );
return p;
} );
const simplexNoise4d = Fn( ( [ v_immutable ] ) => {
const v = vec4( v_immutable ).toVar();
const C = vec2( 0.138196601125010504, 0.309016994374947451 );
const i = vec4( floor( v.add( dot( v, C.yyyy ) ) ) ).toVar();
const x0 = vec4( v.sub( i ).add( dot( i, C.xxxx ) ) ).toVar();
const i0 = vec4().toVar();
const isX = vec3( step( x0.yzw, x0.xxx ) ).toVar();
const isYZ = vec3( step( x0.zww, x0.yyz ) ).toVar();
i0.x.assign( isX.x.add( isX.y.add( isX.z ) ) );
i0.yzw.assign( sub( 1.0, isX ) );
i0.y.addAssign( isYZ.x.add( isYZ.y ) );
i0.zw.addAssign( sub( 1.0, isYZ.xy ) );
i0.z.addAssign( isYZ.z );
i0.w.addAssign( sub( 1.0, isYZ.z ) );
const i3 = vec4( clamp( i0, 0.0, 1.0 ) ).toVar();
const i2 = vec4( clamp( i0.sub( 1.0 ), 0.0, 1.0 ) ).toVar();
const i1 = vec4( clamp( i0.sub( 2.0 ), 0.0, 1.0 ) ).toVar();
const x1 = vec4( x0.sub( i1 ).add( mul( 1.0, C.xxxx ) ) ).toVar();
const x2 = vec4( x0.sub( i2 ).add( mul( 2.0, C.xxxx ) ) ).toVar();
const x3 = vec4( x0.sub( i3 ).add( mul( 3.0, C.xxxx ) ) ).toVar();
const x4 = vec4( x0.sub( 1.0 ).add( mul( 4.0, C.xxxx ) ) ).toVar();
i.assign( mod( i, 289.0 ) );
const j0 = float( permute( permute( permute( permute( i.w ).add( i.z ) ).add( i.y ) ).add( i.x ) ) ).toVar();
const j1 = vec4( permute( permute( permute( permute( i.w.add( vec4( i1.w, i2.w, i3.w, 1.0 ) ) ).add( i.z.add( vec4( i1.z, i2.z, i3.z, 1.0 ) ) ) ).add( i.y.add( vec4( i1.y, i2.y, i3.y, 1.0 ) ) ) ).add( i.x.add( vec4( i1.x, i2.x, i3.x, 1.0 ) ) ) ) ).toVar();
const ip = vec4( 1.0 / 294.0, 1.0 / 49.0, 1.0 / 7.0, 0.0 ).toVar();
const p0 = vec4( grad4( j0, ip ) ).toVar();
const p1 = vec4( grad4( j1.x, ip ) ).toVar();
const p2 = vec4( grad4( j1.y, ip ) ).toVar();
const p3 = vec4( grad4( j1.z, ip ) ).toVar();
const p4 = vec4( grad4( j1.w, ip ) ).toVar();
const norm = vec4( taylorInvSqrt( vec4( dot( p0, p0 ), dot( p1, p1 ), dot( p2, p2 ), dot( p3, p3 ) ) ) ).toVar();
p0.mulAssign( norm.x );
p1.mulAssign( norm.y );
p2.mulAssign( norm.z );
p3.mulAssign( norm.w );
p4.mulAssign( taylorInvSqrt( dot( p4, p4 ) ) );
const m0 = vec3( max( sub( 0.6, vec3( dot( x0, x0 ), dot( x1, x1 ), dot( x2, x2 ) ) ), 0.0 ) ).toVar();
const m1 = vec2( max( sub( 0.6, vec2( dot( x3, x3 ), dot( x4, x4 ) ) ), 0.0 ) ).toVar();
m0.assign( m0.mul( m0 ) );
m1.assign( m1.mul( m1 ) );
return mul( 49.0, dot( m0.mul( m0 ), vec3( dot( p0, x0 ), dot( p1, x1 ), dot( p2, x2 ) ) ).add( dot( m1.mul( m1 ), vec2( dot( p3, x3 ), dot( p4, x4 ) ) ) ) );
} );
// layouts
permute_0.setLayout( {
name: 'permute_0',
type: 'vec4',
inputs: [
{ name: 'x', type: 'vec4' }
]
} );
permute_1.setLayout( {
name: 'permute_1',
type: 'float',
inputs: [
{ name: 'x', type: 'float' }
]
} );
taylorInvSqrt_0.setLayout( {
name: 'taylorInvSqrt_0',
type: 'vec4',
inputs: [
{ name: 'r', type: 'vec4' }
]
} );
taylorInvSqrt_1.setLayout( {
name: 'taylorInvSqrt_1',
type: 'float',
inputs: [
{ name: 'r', type: 'float' }
]
} );
grad4.setLayout( {
name: 'grad4',
type: 'vec4',
inputs: [
{ name: 'j', type: 'float' },
{ name: 'ip', type: 'vec4' }
]
} );
simplexNoise4d.setLayout( {
name: 'simplexNoise4d',
type: 'float',
inputs: [
{ name: 'v', type: 'vec4' }
]
} );
export { permute, taylorInvSqrt, grad4, simplexNoise4d };
src/Experience/Ui/Ui.js
import EventEmitter from '@experience/Utils/EventEmitter.js'
import Experience from '@experience/Experience.js'
import Sizes from '@experience/Utils/Sizes.js'
export default class Ui extends EventEmitter {
static _instance = null
static getInstance() {
return Ui._instance || new Ui()
}
experience = Experience.getInstance()
sizes = Sizes.getInstance()
constructor() {
// Singleton
if ( Ui._instance ) {
return Ui._instance
}
super()
Ui._instance = this
this.init()
}
init() {
this.preloader = document.getElementById( "preloader" )
this.playButton = document.getElementById( "play-button" )
}
hardRemovePreloader() {
this.playButton.classList.replace( "fade-in", "fade-out" );
this.preloader.classList.add( "preloaded" );
this.preloader.remove();
this.playButton.remove();
}
}
src/Experience/Utils/Debug.js
import * as THREE from 'three/webgpu'
import * as Helpers from '@experience/Utils/Helpers.js'
import Stats from 'stats.js'
import { Pane } from 'tweakpane';
import Experience from "@experience/Experience.js";
import Sizes from "./Sizes.js";
import {
output, mrt
} from 'three/tsl'
export default class Debug {
static _instance = null
static getInstance() {
return Debug._instance || new Debug()
}
experience = Experience.getInstance()
sizes = Sizes.getInstance()
constructor() {
// Singleton
if ( Debug._instance ) {
return Debug._instance
}
Debug._instance = this
//this.active = window.location.hash === '#debug'
this.active = true
if ( this.active ) {
this.panel = new Pane({
title: 'Debug',
container: document.getElementById('debug-panel'),
});
this.stats = new Stats()
this.stats.showPanel( 0 );
//document.body.appendChild( this.stats.dom )
}
}
postInit() {
this.scene = experience.scene
//this.camera = this.experience.camera.instance
}
createDebugTexture( texture, world ) {
this.debugTexture = texture;
this.world = world;
this.scene = world.scene;
this.camera = world.camera.instance;
const material = new THREE.SpriteNodeMaterial( {
map: texture,
// depthWrite: false,
depthTest: false,
// //blending: THREE.NoBlending
toneMapped: false
} );
// material.mrtNode = mrt({
// output
// });
//material.colorNode = vec4(1, 1, 1, 1);
// material.fragmentNode = Fn(() =>
// {
// return texture( this.resources.items.displacementTexture, uv() )
// })()
const sprite = this.sprite = new THREE.Sprite( material );
sprite.center.set( 0.0, 0.0 );
sprite.renderOrder = 10000;
this.scene.add(sprite);
this._updateSprite();
}
_updateSprite() {
if ( !this.debugTexture ) return;
const position = Helpers.projectNDCTo3D(-1, -1, this.camera, 10)
this.sprite.position.copy( position )
}
resize() {
this._updateSprite();
}
update( deltaTime ) {
if ( this.debugTexture ) {
this._updateSprite()
}
}
}
src/Experience/Utils/ElastickNumner.js
export default class ElasticNumber {
constructor(initialValue) {
this.value = initialValue;
this.target = initialValue;
this.speed = 3;
}
update(time) {
let delta = this.target - this.value;
this.value += delta * (this.speed * Math.min(time, 0.1));
return true;
}
}
src/Experience/Utils/EventEmitter.js
export default class EventEmitter
{
constructor()
{
this.callbacks = {}
this.callbacks.base = {}
}
on(_names, callback)
{
// Errors
if(typeof _names === 'undefined' || _names === '')
{
console.warn('wrong names')
return false
}
if(typeof callback === 'undefined')
{
console.warn('wrong callback')
return false
}
// Resolve names
const names = this.resolveNames(_names)
// Each name
names.forEach((_name) =>
{
// Resolve name
const name = this.resolveName(_name)
// Create namespace if not exist
if(!(this.callbacks[ name.namespace ] instanceof Object))
this.callbacks[ name.namespace ] = {}
// Create callback if not exist
if(!(this.callbacks[ name.namespace ][ name.value ] instanceof Array))
this.callbacks[ name.namespace ][ name.value ] = []
// Add callback
this.callbacks[ name.namespace ][ name.value ].push(callback)
})
return this
}
off(_names)
{
// Errors
if(typeof _names === 'undefined' || _names === '')
{
console.warn('wrong name')
return false
}
// Resolve names
const names = this.resolveNames(_names)
// Each name
names.forEach((_name) =>
{
// Resolve name
const name = this.resolveName(_name)
// Remove namespace
if(name.namespace !== 'base' && name.value === '')
{
delete this.callbacks[ name.namespace ]
}
// Remove specific callback in namespace
else
{
// Default
if(name.namespace === 'base')
{
// Try to remove from each namespace
for(const namespace in this.callbacks)
{
if(this.callbacks[ namespace ] instanceof Object && this.callbacks[ namespace ][ name.value ] instanceof Array)
{
delete this.callbacks[ namespace ][ name.value ]
// Remove namespace if empty
if(Object.keys(this.callbacks[ namespace ]).length === 0)
delete this.callbacks[ namespace ]
}
}
}
// Specified namespace
else if(this.callbacks[ name.namespace ] instanceof Object && this.callbacks[ name.namespace ][ name.value ] instanceof Array)
{
delete this.callbacks[ name.namespace ][ name.value ]
// Remove namespace if empty
if(Object.keys(this.callbacks[ name.namespace ]).length === 0)
delete this.callbacks[ name.namespace ]
}
}
})
return this
}
trigger(_name, _args)
{
// Errors
if(typeof _name === 'undefined' || _name === '')
{
console.warn('wrong name')
return false
}
let finalResult = null
let result = null
// Default args
const args = !(_args instanceof Array) ? [] : _args
// Resolve names (should on have one event)
let name = this.resolveNames(_name)
// Resolve name
name = this.resolveName(name[ 0 ])
// Default namespace
if(name.namespace === 'base')
{
// Try to find callback in each namespace
for(const namespace in this.callbacks)
{
if(this.callbacks[ namespace ] instanceof Object && this.callbacks[ namespace ][ name.value ] instanceof Array)
{
this.callbacks[ namespace ][ name.value ].forEach(function(callback)
{
result = callback.apply(this, args)
if(typeof finalResult === 'undefined')
{
finalResult = result
}
})
}
}
}
// Specified namespace
else if(this.callbacks[ name.namespace ] instanceof Object)
{
if(name.value === '')
{
console.warn('wrong name')
return this
}
this.callbacks[ name.namespace ][ name.value ].forEach(function(callback)
{
result = callback.apply(this, args)
if(typeof finalResult === 'undefined')
finalResult = result
})
}
return finalResult
}
resolveNames(_names)
{
let names = _names
names = names.replace(/[^a-zA-Z0-9 ,/.]/g, '')
names = names.replace(/[,/]+/g, ' ')
names = names.split(' ')
return names
}
resolveName(name)
{
const newName = {}
const parts = name.split('.')
newName.original = name
newName.value = parts[ 0 ]
newName.namespace = 'base' // Base namespace
// Specified namespace
if(parts.length > 1 && parts[ 1 ] !== '')
{
newName.namespace = parts[ 1 ]
}
return newName
}
}src/Experience/Utils/Gizmo.js
import * as THREE from 'three/webgpu'
export default class Gizmo extends HTMLElement{
constructor(camera, options) {
super();
this.camera = camera;
this.options = Object.assign({
size: 90,
padding: 8,
bubbleSizePrimary: 8,
bubbleSizeSeconday: 6,
showSecondary: true,
lineWidth: 2,
fontSize: "11px",
fontFamily: "arial",
fontWeight: "bold",
fontColor: "#151515",
fontYAdjust: 0,
colors: {
x: ["#f73c3c", "#942424"],
y: ["#6ccb26", "#417a17"],
z: ["#178cf0", "#0e5490"],
}
}, options);
// Function called when axis is clicked
this.onAxisSelected = null;
// Generate list of axes
this.bubbles = [
{ axis: "x", direction: new THREE.Vector3(1, 0, 0), size: this.options.bubbleSizePrimary, color: this.options.colors.x, line: this.options.lineWidth, label: "X" },
{ axis: "y", direction: new THREE.Vector3(0, 1, 0), size: this.options.bubbleSizePrimary, color: this.options.colors.y, line: this.options.lineWidth, label: "Y" },
{ axis: "z", direction: new THREE.Vector3(0, 0, 1), size: this.options.bubbleSizePrimary, color: this.options.colors.z, line: this.options.lineWidth, label: "Z" },
{ axis: "-x", direction: new THREE.Vector3(-1, 0, 0), size: this.options.bubbleSizeSeconday, color: this.options.colors.x },
{ axis: "-y", direction: new THREE.Vector3(0, -1, 0), size: this.options.bubbleSizeSeconday, color: this.options.colors.y },
{ axis: "-z", direction: new THREE.Vector3(0, 0, -1), size: this.options.bubbleSizeSeconday, color: this.options.colors.z },
];
this.center = new THREE.Vector3(this.options.size / 2, this.options.size / 2, 0);
this.selectedAxis = null;
// All we need is a canvas
this.innerHTML = "<canvas width='" + this.options.size + "' height='" + this.options.size + "'></canvas>";
this.onMouseMove = this.onMouseMove.bind(this);
this.onMouseOut = this.onMouseOut.bind(this);
this.onMouseClick = this.onMouseClick.bind(this);
}
connectedCallback() {
this.canvas = this.querySelector("canvas");
this.context = this.canvas.getContext("2d");
this.canvas.addEventListener('mousemove', this.onMouseMove, false);
this.canvas.addEventListener('mouseout', this.onMouseOut, false);
this.canvas.addEventListener('click', this.onMouseClick, false);
}
disconnectedCallback() {
this.canvas.removeEventListener('mousemove', this.onMouseMove, false);
this.canvas.removeEventListener('mouseout', this.onMouseOut, false);
this.canvas.removeEventListener('click', this.onMouseClick, false);
}
onMouseMove(evt) {
const rect = this.canvas.getBoundingClientRect();
this.mouse = new THREE.Vector3(evt.clientX - rect.left, evt.clientY - rect.top, 0);
}
onMouseOut(evt) {
this.mouse = null;
}
onMouseClick(evt) {
if (!!this.onAxisSelected && typeof this.onAxisSelected == "function") {
this.onAxisSelected({ axis: this.selectedAxis.axis, direction: this.selectedAxis.direction.clone() });
}
}
clear() {
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
}
drawCircle(p, radius = 10, color = "#FF0000") {
this.context.beginPath();
this.context.arc(p.x, p.y, radius, 0, 2 * Math.PI, false);
this.context.fillStyle = color;
this.context.fill();
this.context.closePath();
}
drawLine(p1, p2, width = 1, color = "#FF0000") {
this.context.beginPath();
this.context.moveTo(p1.x, p1.y);
this.context.lineTo(p2.x, p2.y);
this.context.lineWidth = width;
this.context.strokeStyle = color;
this.context.stroke();
this.context.closePath();
}
update() {
this.clear();
// Calculate the rotation matrix from the camera
let rotMat = new THREE.Matrix4().makeRotationFromEuler(this.camera.rotation);
let invRotMat = rotMat.clone().invert();
for (var bubble of this.bubbles) {
bubble.position = this.getBubblePosition(bubble.direction.clone().applyMatrix4(invRotMat));
}
// Generate a list of layers to draw
const layers = [];
for (let axis in this.bubbles) {
// Check if the name starts with a negative and dont add it to the layer list if secondary axis is turned off
if (this.options.showSecondary === true || axis[0] !== "-") {
layers.push(this.bubbles[axis]);
}
}
// Sort the layers where the +Z position is last so its drawn on top of anything below it
layers.sort((a, b) => (a.position.z > b.position.z) ? 1 : -1);
// If the mouse is over the gizmo, find the closest axis and highlight it
this.selectedAxis = null;
if (this.mouse) {
let closestDist = Infinity;
// Loop through each layer
for (var bubble of layers) {
const distance = this.mouse.distanceTo(bubble.position);
// Only select the axis if its closer to the mouse than the previous or if its within its bubble circle
if (distance < closestDist || distance < bubble.size) {
closestDist = distance;
this.selectedAxis = bubble;
}
}
}
// Draw the layers
this.drawLayers(layers);
}
drawLayers(layers) {
// For each layer, draw the bubble
for (let bubble of layers) {
let color = bubble.color;
// Find the color
if (this.selectedAxis === bubble) {
color = "#FFFFFF";
} else if (bubble.position.z >= -0.01) {
color = bubble.color[0]
} else {
color = bubble.color[1]
}
// Draw the circle for the bubbble
this.drawCircle(bubble.position, bubble.size, color);
// Draw the line that connects it to the center if enabled
if (bubble.line) {
this.drawLine(this.center, bubble.position, bubble.line, color);
}
// Write the axis label (X,Y,Z) if provided
if (bubble.label) {
this.context.font = [this.options.fontWeight, this.options.fontSize, this.options.fontFamily].join(" ");
this.context.fillStyle = this.options.fontColor;
this.context.textBaseline = 'middle';
this.context.textAlign = 'center';
this.context.fillText(bubble.label, bubble.position.x, bubble.position.y + this.options.fontYAdjust);
}
}
}
getBubblePosition(position) {
return new THREE.Vector3((position.x * (this.center.x - (this.options.bubbleSizePrimary / 2) - this.options.padding)) + this.center.x,
this.center.y - (position.y * (this.center.y - (this.options.bubbleSizePrimary / 2) - this.options.padding)),
position.z);
}
}
window.customElements.define('gizmo-helper', Gizmo);
src/Experience/Utils/Helpers/Global/isMobile.js
export const isMobile = {
Android: function() {
return navigator.userAgent.match( /Android/i );
},
BlackBerry: function() {
return navigator.userAgent.match( /BlackBerry/i );
},
iOS: function() {
return navigator.userAgent.match( /iPhone|iPad|iPod/i ) || ( navigator.userAgent.includes( "Mac" ) && "ontouchend" in document );
},
Opera: function() {
return navigator.userAgent.match( /Opera Mini/i );
},
Windows: function() {
return navigator.userAgent.match( /IEMobile/i ) || navigator.userAgent.match( /WPDesktop/i );
},
any: function() {
return ( isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows() );
}
};
src/Experience/Utils/Helpers.js
import * as THREE from 'three/webgpu'
// get position from min Y three attribute position array
export function getMinPositionY( positions ) {
let minPosition = new THREE.Vector3(positions[0], positions[1], positions[2]);
let minY = Number.MAX_VALUE;
for (let i = 0; i < positions.length / 3; i++) {
if (positions[3 * i + 1] < minY) {
minY = positions[3 * i + 1];
minPosition.set(
positions[3 * i + 0],
positions[3 * i + 1],
positions[3 * i + 2]
);
}
}
return minPosition;
}
// get centroid from three attribute position array
export function getCentroid( positions ) {
let centroid = new THREE.Vector3();
for (let i = 0; i < positions.length / 3; i++) {
centroid.x += positions[3 * i + 0];
centroid.y += positions[3 * i + 1];
centroid.z += positions[3 * i + 2];
}
centroid.x /= positions.length / 3;
centroid.y /= positions.length / 3;
centroid.z /= positions.length / 3;
// // get nearest point to the centroid
// let nearestPoint = new THREE.Vector3(positions[0], positions[1], positions[2]);
// let nearestDistance = centroid.distanceTo(nearestPoint);
//
// for (let i = 0; i < positions.length / 3; i++) {
// let point = new THREE.Vector3(
// positions[3 * i + 0],
// positions[3 * i + 1],
// positions[3 * i + 2]
// );
//
// let distance = centroid.distanceTo(point);
//
// if (distance < nearestDistance) {
// nearestDistance = distance;
// nearestPoint = point;
// }
// }
//
// return nearestPoint;
return centroid;
}
export function cloneAllMaterials( container ) {
container.traverse( child => {
if ( child.isMesh ) {
const cloneMaterial = child.material.clone();
child.material.dispose();
child.material = cloneMaterial;
}
} )
}
export function meshToBatchedMesh( mesh, container, batchedMeshesIds = {} ) {
let materials = [];
let maxGeometryCount = 0;
let maxVertexCount = 0;
let maxIndexCount = 0;
mesh.traverse( ( child ) => {
if ( child.isMesh ) {
maxGeometryCount++;
maxVertexCount += child.geometry.attributes.position.count;
maxIndexCount += child.geometry.index.count;
}
} )
mesh.traverse( ( child ) => {
if ( child.isMesh ) {
child.updateMatrixWorld()
// child.geometry.applyMatrix4( child.matrixWorld )
if ( materials[ child.material.uuid ] === undefined ) {
const batchedMesh = new THREE.BatchedMesh( maxGeometryCount, maxVertexCount, maxIndexCount, child.material );
container.add( batchedMesh );
batchedMeshesIds[ batchedMesh.uuid ] = [];
materials[ child.material.uuid ] = {};
materials[ child.material.uuid ].batchedMesh = batchedMesh;
const geometry = child.geometry.clone();
geometry.applyMatrix4( child.matrixWorld );
const batchId = batchedMesh.addGeometry( geometry );
batchedMeshesIds[ batchedMesh.uuid ][ batchId ] = child;
batchedMeshesIds[ batchedMesh.uuid ][ 'batchedMesh' ] = batchedMesh;
} else {
const geometry = child.geometry.clone();
geometry.applyMatrix4( child.matrixWorld );
const batchId = materials[ child.material.uuid ].batchedMesh.addGeometry( geometry );
batchedMeshesIds[ materials[ child.material.uuid ].batchedMesh.uuid ][ batchId ] = child;
}
}
} )
}
export function makeTexture( g ) {
let vertAmount = g.attributes.position.count;
let texWidth = Math.ceil( Math.sqrt( vertAmount ) );
let texHeight = Math.ceil( vertAmount / texWidth );
let data = new Float32Array( texWidth * texHeight * 4 );
function shuffleArrayByThree( array ) {
const groupLength = 3;
let numGroups = Math.floor( array.length / groupLength );
for ( let i = numGroups - 1; i > 0; i-- ) {
const j = Math.floor( Math.random() * ( i + 1 ) );
for ( let k = 0; k < groupLength; k++ ) {
let temp = array[ i * groupLength + k ];
array[ i * groupLength + k ] = array[ j * groupLength + k ];
array[ j * groupLength + k ] = temp;
}
}
return array;
}
shuffleArrayByThree( g.attributes.position.array );
for ( let i = 0; i < vertAmount; i++ ) {
//let f = Math.floor(Math.random() * (randomTemp.length / 3) );
const x = g.attributes.position.array[ i * 3 + 0 ] ?? 2;
const y = g.attributes.position.array[ i * 3 + 1 ] ?? 0;
const z = g.attributes.position.array[ i * 3 + 2 ] ?? 0;
const w = 0;
//randomTemp.splice(f * 3, 3);
data[ i * 4 + 0 ] = x;
data[ i * 4 + 1 ] = y;
data[ i * 4 + 2 ] = z;
data[ i * 4 + 3 ] = w;
}
let dataTexture = new THREE.DataTexture( data, texWidth, texHeight, THREE.RGBAFormat, THREE.FloatType );
dataTexture.needsUpdate = true;
return dataTexture;
}
export function getTransitionTextureResolution( texture, sizes ) {
this.imageAspect = texture.image.height / texture.image.width;
let a1;
let a2;
if ( sizes.height / sizes.width > this.imageAspect ) {
a1 = ( sizes.width / sizes.height ) * this.imageAspect;
a2 = 1;
} else {
a1 = 1;
a2 = ( sizes.height / sizes.width ) / this.imageAspect;
}
//this.postProcess.clearPass.uniforms.u_TransitionTextureResolution.value.set( texture.image.width, texture.image.height, a1, a2 );
}
export function projectNDCTo3D(x, y, camera, distance = undefined) {
const vector = new THREE.Vector3(x, y, 0.5);
vector.unproject(camera);
const dir = vector.sub(camera.position).normalize(); // Direction from camera to point in NDC
const cameraDirection = new THREE.Vector3();
camera.getWorldDirection(cameraDirection); // Camera view direction
// Distance to the plane perpendicular to the camera view direction
if( !distance ) {
distance = - camera.position.dot(cameraDirection) / dir.dot(cameraDirection);
}
// Point in 3D space
return camera.position.clone().add(dir.multiplyScalar(distance));
}
export function calculateUVTransform( texture, sizes ) {
const screenAspect = sizes.width / sizes.height;
const imageAspect = texture.image.width / texture.image.height;
const uvScale = new THREE.Vector2( 1, 1 );
const uvOffset = new THREE.Vector2( 0, 0 );
if ( screenAspect > imageAspect ) {
// Screen is wider: image height is adjusted, UV is corrected by Y
uvScale.y = imageAspect / screenAspect;
uvOffset.y = ( 1 - uvScale.y ) / 2;
} else {
// Screen is taller: image width is adjusted, UV is corrected by X
uvScale.x = screenAspect / imageAspect;
uvOffset.x = ( 1 - uvScale.x ) / 2;
}
return { uvScale, uvOffset };
}
src/Experience/Utils/Input.js
import * as THREE from 'three/webgpu'
import * as Helpers from '@experience/Utils/Helpers.js'
import Experience from '../Experience.js'
import normalizeWheel from 'normalize-wheel'
import Sizes from "./Sizes.js";
export default class Input {
static _instance = null
static getInstance() {
return Input._instance || new Input()
}
constructor( parameters = {} ) {
if ( Input._instance ) {
return Input._instance
}
Input._instance = this
this.experience = Experience.getInstance()
this.sizes = Sizes.getInstance()
this.camera = parameters.camera
this.cursor = { x: 0, y: 0, side: 'left'}
this.cursor3D = new THREE.Vector3()
this.cursorDirection = new THREE.Vector3()
this.clientX = 0
this.clientY = 0
this.init()
}
init() {
window.addEventListener( 'mousemove', this._onMouseMoved)
window.addEventListener( 'touchstart', this._onTouchStart)
window.addEventListener( 'touchmove', this._onTouchMoved)
}
postInit() {
}
getNDCFrom3d(x, y, z) {
const vector = new THREE.Vector3( x, y, z );
vector.project( this.camera );
return vector;
}
_onMouseMoved = ( event ) =>{
this.clientX = event.clientX
this.clientY = event.clientY
this.cursor.x = event.clientX / this.sizes.width * 2 - 1
this.cursor.y = -( event.clientY / this.sizes.height ) * 2 + 1
this.cursor.side = event.clientX > this.sizes.width / 2 ? 'right' : 'left'
this.previosCursor3D = this.cursor3D.clone()
this.cursor3D = Helpers.projectNDCTo3D(this.cursor.x, this.cursor.y, this.camera)
this.cursorDirection = this.cursor3D.clone().sub(this.previosCursor3D).normalize()
}
_onTouchStart = ( event ) => {
this._onTouchMoved( event )
}
_onTouchMoved = ( event ) => {
this.cursor.x = event.touches[ 0 ].clientX / this.sizes.width * 2 - 1
this.cursor.y = -( event.touches[ 0 ].clientY / this.sizes.height ) * 2 + 1
this.cursor.side = event.touches[ 0 ].clientX > this.sizes.width / 2 ? 'right' : 'left'
this.previosCursor3D = this.cursor3D.clone()
this.cursor3D = this.projectNDCTo3D(this.cursor.x, this.cursor.y)
this.cursorDirection = this.cursor3D.clone().sub(this.previosCursor3D).normalize()
}
}
src/Experience/Utils/MathHelper.js
export function mix( x, y, a ) {
return x * ( 1 - a ) + y * a;
}
export function remap( x, oMin, oMax, nMin, nMax ) {
return mix( nMin, nMax, ( x - oMin ) / ( oMax - oMin ) );
}
export function simplexNoise4d( x, y, z, w ) {
return simplex.noise4d( x, y, z, w );
}
src/Experience/Utils/PostProcess.js
import * as THREE from 'three/webgpu'
import * as Helpers from '@experience/Utils/Helpers.js'
import Experience from '@experience/Experience.js'
import Debug from '@experience/Utils/Debug.js'
import State from "@experience/State.js";
import Sizes from "./Sizes.js";
import Materials from "@experience/Materials/Materials.js";
import gsap from "gsap";
import {
luminance,
cos,
float,
min,
time,
atan,
uniform,
pass,
mrt,
output,
emissive,
diffuseColor,
PI,
PI2,
color,
positionLocal,
oneMinus,
sin,
texture,
Fn,
uv,
spherizeUV,
screenUV,
screenCoordinate,
vec2,
vec3,
vec4,
distance,
transmission
} from 'three/tsl';
import { bloom } from 'three/addons/tsl/display/BloomNode.js';
import { transition } from 'three/addons/tsl/display/TransitionNode.js';
export default class PostProcess {
experience = Experience.getInstance()
debug = Debug.getInstance()
sizes = Sizes.getInstance()
state = State.getInstance()
materials = Materials.getInstance()
rendererClass = this.experience.renderer
scene = experience.scene
time = experience.time
resources = experience.resources
timeline = experience.time.timeline;
container = new THREE.Group();
passes = {}
uniforms = {
transitionPassParams: {
progress: uniform( 0 ), // progress 0 -> 1
threshold: uniform( 0.1 ), // threshold
useTexture: uniform( 1 ), // use texture
uvScale: uniform( vec2( 1, 1 ) ),
uvOffset: uniform( vec2( 0, 0 ) ),
uvMultiplier: uniform( 2 ),
},
uResolution: uniform( vec2( this.sizes.width_DPR, this.sizes.height_DPR ) )
}
transitionPassParams = {
progress: uniform( 0 ), // progress 0 -> 1
threshold: uniform( 0.1 ), // threshold
useTexture: uniform( 1 ), // use texture
uvScale: uniform( vec2( 1, 1 ) ),
uvOffset: uniform( vec2( 0, 0 ) )
}
constructor( renderer ) {
this.renderer = renderer
}
postInit() {
this.worlds = this.experience.worlds
this.preloadWorld = this.worlds.preloadWorld
this.mainWorld = this.worlds.mainWorld
this.setComposer()
this.setDebug()
}
setComposer() {
const composer = this.composer = new THREE.PostProcessing( this.renderer );
//this._scenePreloadPass()
this._sceneMainPass()
//this._transitionPass() // Transition Pass (Preload -><- Main)
//composer.outputNode = scenePassColorMain.add( ...Object.values( this.passes ) );
//composer.outputNode = scenePassPreload
composer.outputNode = this.scenePassMainFinalColor
//composer.outputColorTransform = false
}
// Preload Scene
_scenePreloadPass() {
this.scenePassPreload = pass( this.preloadWorld.scene, this.preloadWorld.camera.instance, {} );
this.scenePassPreloadFinalColor = this.scenePassPreload.getTextureNode( 'output' );
}
// Main Scene
_sceneMainPass() {
const scenePassMain = this.scenePassMain = pass( this.mainWorld.scene, this.mainWorld.camera.instance, {} );
scenePassMain.setMRT( mrt( {
output,
emissive
} ) );
this.scenePassColorMain = scenePassMain.getTextureNode( 'output' );
this.emissivePassMain = scenePassMain.getTextureNode( 'emissive' );
// Bloom Pass for Main Scene
this.bloomPassMain = this.passes.bloomPassMain = bloom(
this.emissivePassMain,
this.state.unrealBloom.strength,
this.state.unrealBloom.radius,
this.state.unrealBloom.threshold,
);
this.scenePassMainFinalColor = this.scenePassColorMain.add( this.bloomPassMain )
}
_transitionPass() {
const displacementTexture = this.displacementTexture = this.resources.items.displacementTexture;
displacementTexture.wrapS = THREE.RepeatWrapping;
displacementTexture.wrapT = THREE.RepeatWrapping;
this._calculateUVTransform( displacementTexture );
this.uResolution = uniform( vec2( this.sizes.width_DPR, this.sizes.height_DPR ) )
const transitionTexture = Fn( ( params ) => {
const noiseTexture = params.noiseTexture
const uResolution = params.uResolution.toVar()
const aspect = uResolution.x.div( uResolution.y ).toVar()
let uv = screenUV.div( vec2( 1, aspect ) ).toVar()
let dist = distance( uv, vec2( 0.5, float( 0.5 ).div( aspect ) ) ).toVar()
dist = dist.mul( noiseTexture.r )
return vec4( dist );
} )
const transitionPass = this.transitionPass = transition(
this.scenePassMainFinalColor,
this.scenePassPreloadFinalColor,
transitionTexture( {
uResolution: this.uniforms.uResolution,
noiseTexture: texture(
displacementTexture,
uv().mul( this.transitionPassParams.uvScale )
.add( this.transitionPassParams.uvOffset )
.mul( this.uniforms.transitionPassParams.uvMultiplier )
),
} ),
//texture(displacementTexture, uv().mul( this.transitionPassParams.uvScale ).add( this.transitionPassParams.uvOffset ).mul( 2 )),
this.uniforms.transitionPassParams.progress,
this.uniforms.transitionPassParams.threshold,
this.uniforms.transitionPassParams.useTexture
);
}
_calculateUVTransform() {
const { uvScale, uvOffset } = Helpers.calculateUVTransform( this.displacementTexture, this.sizes );
this.transitionPassParams.uvScale.value.set( uvScale.x, uvScale.y );
this.transitionPassParams.uvOffset.value.set( uvOffset.x, uvOffset.y );
}
startTransitionPreloadToMain() {
gsap.to( this.uniforms.transitionPassParams.progress, {
value: 1.0,
duration: 2,
ease: 'power1.in',
onComplete: () => {
this.composer.outputNode = this.scenePassMainFinalColor
this.composer.needsUpdate = true
}
} )
}
resize() {
//this._calculateUVTransform()
//this.uniforms.uResolution.value.set( this.sizes.width_DPR, this.sizes.height_DPR )
// this.composer.setSize( this.sizes.width, this.sizes.height )
// this.composer.setPixelRatio( this.sizes.pixelRatio )
//
// this.bloomComposer?.setSize( this.sizes.width, this.sizes.height )
// this.bloomComposer?.setPixelRatio( this.sizes.pixelRatio )
}
setDebug() {
if ( !this.debug.active ) return
if ( this.debug.panel ) {
const postProcessFolder = this.debug.panel.addFolder( {
title: 'PostProcess', expanded: false
} )
const bloomFolder = postProcessFolder.addFolder( {
title: 'UnrealBloomPass', expanded: true
} )
bloomFolder.addBinding( this.state.unrealBloom, 'enabled', { label: 'Enabled' } ).on( 'change', ( e ) => {
this.state.unrealBloom.enabled = e.value
if ( e.value ) {
this.passes.bloomPassMain = this.bloomPassMain
this.composer.outputNode = this.scenePassColorMain.add( ...Object.values( this.passes ) );
} else {
this.composer.outputNode = this.scenePassColorMain
delete this.passes.bloomPassMain
}
this.composer.needsUpdate = true
} )
bloomFolder.addBinding( this.bloomPassMain.strength, 'value', {
min: 0, max: 5, step: 0.001, label: 'Strength'
} )
bloomFolder.addBinding( this.bloomPassMain.radius, 'value', {
min: -2, max: 1, step: 0.001, label: 'Radius'
} )
bloomFolder.addBinding( this.bloomPassMain.threshold, 'value', {
min: 0, max: 1, step: 0.001, label: 'Threshold'
} )
}
}
productionRender() {
this.composer.renderAsync()
}
debugRender() {
this.composer.renderAsync()
}
update( deltaTime ) {
if ( this.debug.active ) {
this.debugRender()
} else {
this.productionRender()
}
}
}
src/Experience/Utils/Resources.js
import * as THREE from 'three/webgpu'
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js'
import { OBJLoader } from "three/addons/loaders/OBJLoader.js";
import { FontLoader } from 'three/examples/jsm/loaders/FontLoader.js'
import { RGBELoader } from 'three/examples/jsm/loaders/RGBELoader.js'
import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader.js'
import { KTX2Loader } from 'three/examples/jsm/loaders/KTX2Loader.js'
import { MeshoptDecoder } from 'three/examples/jsm/libs/meshopt_decoder.module.js'
import EventEmitter from './EventEmitter.js'
export default class Resources extends EventEmitter {
constructor( sources ) {
super()
this.sources = sources
// this.sourcesFilter()
// this.obfuscate = Obfuscate.getInstance()
this.items = {}
this.toLoad = this.sources.length
this.loaded = 0
this.loadedAll = false
this.setLoaders()
this.startLoading()
}
sourcesFilter() {
if ( import.meta.env.MODE === "development" ) {
return true
}
this.sources.forEach( source => {
if ( source.obfuscate === true ) {
if ( source.type.match( /model/i ) ) {
// replace .glb, .gltf, .obj with .bin
source.path = source.path.replace( /\.(glb|gltf|obj)/i, '.bin' )
source.type = 'binModel'
}
if ( source.type === 'json' ) {
// replace image name to .bin
source.path = source.path.replace( /\.(json)/i, '.bin' )
source.type = 'binJson'
}
if ( source.type.match( /texture/i ) ) {
// replace image name to .bin
source.path = source.path.replace( /\.(jpg|jpeg|png)/i, '.bin' )
source.type = 'binTexture'
}
}
} )
}
setLoaders() {
this.loaders = {}
this.loaders.gltfLoader = new GLTFLoader()
this.loaders.objLoader = new OBJLoader()
this.loaders.textureLoader = new THREE.TextureLoader()
this.loaders.cubeTextureLoader = new THREE.CubeTextureLoader()
this.loaders.RGBELoader = new RGBELoader()
this.loaders.fontLoader = new FontLoader()
this.loaders.AudioLoader = new THREE.AudioLoader()
// add DRACOLoader
const dracoLoader = new DRACOLoader()
dracoLoader.setDecoderPath( '/draco/' )
const ktx2Loader = new KTX2Loader();
ktx2Loader.setTranscoderPath( '/basis/' );
this.loaders.gltfLoader.setDRACOLoader( dracoLoader )
this.loaders.gltfLoader.setKTX2Loader( ktx2Loader );
this.loaders.gltfLoader.setMeshoptDecoder( MeshoptDecoder );
}
startLoading() {
// Load each source
for ( const source of this.sources ) {
switch ( source.type ) {
case 'binModel':
this.obfuscate.loadFile( source.path, ( arrayBuffer ) => {
this.obfuscate.decode( arrayBuffer, source.path, ( model ) => {
this.sourceLoaded( source, model )
} )
} )
break
case 'binJson':
this.obfuscate.loadFile( source.path, ( arrayBuffer ) => {
this.obfuscate.decode( arrayBuffer, source.path, ( json ) => {
this.sourceLoaded( source, json )
} )
} )
break
case 'binTexture':
this.obfuscate.loadFile( source.path, ( arrayBuffer ) => {
this.obfuscate.decode( arrayBuffer, source.path, ( textureBuffer ) => {
const blob = new Blob( [ textureBuffer ] );
createImageBitmap( blob ).then( ( imageBitmap ) => {
const texture = new THREE.Texture( imageBitmap );
texture.needsUpdate = true;
//texture.colorSpace = THREE.SRGBColorSpace;
this.sourceLoaded( source, texture );
} ).catch( err => console.error( "Error texture loading:", err ) );
// // Convert the array of data into a base64 string
// const encodedData = btoa( new Uint8Array( textureBuffer ).reduce( function ( data, byte ) {
// return data + String.fromCharCode( byte );
// }, '' ) );
// const dataURI = "data:image/jpeg;base64," + encodedData;
//
// this.loaders.textureLoader.load(
// dataURI,
// ( file ) => {
// // Default settings
// file.colorSpace = THREE.SRGBColorSpace;
//
// this.sourceLoaded( source, file )
// }
// )
} )
} )
break
case 'gltfModel':
this.loaders.gltfLoader.load(
source.path,
( file ) => {
this.sourceLoaded( source, file )
}
)
break
case 'objModel':
this.loaders.objLoader.load(
source.path,
( file ) => {
this.sourceLoaded( source, file )
}
)
break
case 'texture':
this.loaders.textureLoader.load(
source.path,
( file ) => {
// Default settings
//file.colorSpace = THREE.SRGBColorSpace;
this.sourceLoaded( source, file )
}
)
break
case 'videoTexture':
let videoElement = document.createElement( 'video' )
videoElement.src = source.path
videoElement.setAttribute( 'crossorigin', 'anonymous' )
videoElement.muted = true
videoElement.loop = true
videoElement.load()
videoElement.setAttribute( 'playsinline', '' )
videoElement.setAttribute( 'webkit-playsinline', '' )
videoElement.play()
const obj = {
videoTexture: new THREE.VideoTexture( videoElement ),
videoElement: videoElement
}
videoElement.addEventListener( 'canplaythrough', () => {
this.sourceLoaded( source, obj )
} )
break
case 'cubeTexture':
this.loaders.cubeTextureLoader.load(
source.path,
( file ) => {
this.sourceLoaded( source, file )
}
)
break
case 'rgbeTexture':
this.loaders.RGBELoader.load(
source.path,
( file ) => {
this.sourceLoaded( source, file )
}
)
break
case 'font':
this.loaders.fontLoader.load(
source.path,
( file ) => {
this.sourceLoaded( source, file )
}
)
break
case 'audio':
this.loaders.AudioLoader.load(
source.path,
( file ) => {
this.sourceLoaded( source, file )
}
)
break
case 'json':
fetch( source.path ).then(
response => {
response.json().then(
data => {
this.sourceLoaded( source, data )
return data
}
)
}
)
break
}
}
if ( this.sources.length === 0 ) {
setTimeout( () => {
this.loadedAll = true
this.trigger( 'ready' )
} );
}
}
sourceLoaded( source, file ) {
this.items[ source.name ] = file
this.loaded++
if ( this.loaded === this.toLoad ) {
this.loadedAll = true
this.trigger( 'ready' )
}
}
}
src/Experience/Utils/Sizes.js
import EventEmitter from './EventEmitter.js'
export default class Sizes extends EventEmitter {
static _instance = null
static getInstance() {
return Sizes._instance || new Sizes()
}
constructor() {
// Singleton
if ( Sizes._instance ) {
return Sizes._instance
}
super()
Sizes._instance = this
// Setup
this.pixelRatio = Math.min( window.devicePixelRatio, 2 )
this.width = window.innerWidth
this.height = window.innerHeight
this.width_DPR = this.width * window.devicePixelRatio
this.height_DPR = this.height * window.devicePixelRatio
// Resize event
window.addEventListener( 'resize', () => {
this.pixelRatio = Math.min( window.devicePixelRatio, 2 )
this.width = window.innerWidth
this.height = window.innerHeight
this.width_DPR = this.width * window.devicePixelRatio
this.height_DPR = this.height * window.devicePixelRatio
this.trigger( 'resize' )
} )
}
}
src/Experience/Utils/Sound.js
import * as THREE from 'three/webgpu'
import EventEmitter from './EventEmitter.js'
import Experience from '@experience/Experience.js'
import Debug from './Debug.js'
import Sizes from './Sizes.js'
export default class Sound extends EventEmitter
{
constructor()
{
super()
this.experience = Experience.getInstance()
//this.camera = this.experience.camera.instance
this.resources = this.experience.resources
this.renderer = this.experience.renderer.instance
this.debug = Debug.getInstance()
this.sizes = Sizes.getInstance()
this.soundsCreated = false;
}
isTabVisible() {
return document.visibilityState === "visible";
}
handleVisibilityChange() {
if (this.isTabVisible()) {
this.backgroundSound.play();
this.listener.setMasterVolume(1)
} else {
this.backgroundSound.pause();
this.listener.setMasterVolume(0)
}
}
createSounds() {
if ( this.soundsCreated === true )
return
this.listener = new THREE.AudioListener();
this.camera.add( this.listener );
this.backgroundSound = new THREE.Audio( this.listener );
this.backgroundSound.setBuffer( this.resources.items.backgroundSound );
this.backgroundSound.setLoop( true );
this.backgroundSound.setVolume( 0.8 );
this.backgroundSound.play();
this.soundsCreated = true;
document.addEventListener('visibilitychange', () => this.handleVisibilityChange(), false);
// window.addEventListener('blur', () => this.backgroundSound.pause());
// window.addEventListener('focus', () => {
// if (isTabVisible()) {
// this.backgroundSound.play();
// }
// });
}
update() {
}
resize() {
}
}
src/Experience/Utils/Time.js
import EventEmitter from './EventEmitter.js'
import gsap from "gsap";
export default class Time extends EventEmitter {
static _instance = null
static getInstance() {
return Time._instance || new Time()
}
constructor() {
if ( Time._instance ) {
return Time._instance
}
super()
Time._instance = this
// Setup
this.start = Date.now()
this.current = this.start
this.playing = true
this.elapsed = 0
this.delta = 0.016666666666666668
this.deltaSim = 0.016666666666666668
this.timeline = gsap.timeline( {
paused: true,
} );
window.requestAnimationFrame( () => {
this.tick()
} )
}
tick() {
const currentTime = Date.now()
this.delta = (currentTime - this.current ) * 0.001
this.deltaSim = Math.min( ( currentTime - this.current ) * 0.001, 0.016 )
this.current = currentTime
this.elapsed = ( this.current - this.start ) * 0.001
if ( this.deltaSim > 0.06 ) {
this.deltaSim = 0.06
}
this.timeline.time( this.elapsed );
this.trigger( 'tick' )
window.requestAnimationFrame( () => {
this.tick()
} )
}
reset() {
this.start = Date.now()
this.current = this.start
this.elapsed = 0
}
}
src/Experience/Utils/tsl-utils.js
import {
float, vec2, vec3, cos, sin, Fn, normalize, max, color,
length, smoothstep, Loop, int, uvec2, uint, mat3, sub, mul, fract, dot, mix,
floor, bitcast, pow, saturate, add, reflect
} from 'three/tsl';
bitcast.setParameterLength( 1 );
const rotateY = /*#__PURE__*/ Fn( ( [ theta_immutable ] ) => {
const theta = float( theta_immutable ).toVar();
const c = float( cos( theta ) ).toVar();
const s = float( sin( theta ) ).toVar();
return mat3( vec3( c, int( 0 ), s ), vec3( int( 0 ), int( 1 ), int( 0 ) ), vec3( s.negate(), int( 0 ), c ) );
} ).setLayout( {
name: 'rotateY',
type: 'mat3',
inputs: [
{ name: 'theta', type: 'float' }
]
} );
const rotateZ = /*#__PURE__*/ Fn( ( [ v_immutable, angle_immutable ] ) => {
const angle = float( angle_immutable ).toVar();
const v = vec3( v_immutable ).toVar();
const cosAngle = float( cos( angle ) ).toVar();
const sinAngle = float( sin( angle ) ).toVar();
return vec3( v.x.mul( cosAngle ).sub( v.y.mul( sinAngle ) ), v.x.mul( sinAngle ).add( v.y.mul( cosAngle ) ), v.z );
} ).setLayout( {
name: 'rotateZ',
type: 'vec3',
inputs: [
{ name: 'v', type: 'vec3' },
{ name: 'angle', type: 'float' }
]
} );
const facture = Fn( ( [ vector_immutable ] ) => {
const vector = vec3( vector_immutable ).toVar();
const normalizedVector = vec3( normalize( vector ) ).toVar();
return max( max( normalizedVector.x, normalizedVector.y ), normalizedVector.z );
} ).setLayout( {
name: 'facture',
type: 'float',
inputs: [
{ name: 'vector', type: 'vec3' }
]
} );
const emission = Fn( ( [ color_immutable, strength_immutable ] ) => {
const strength = float( strength_immutable ).toVar();
const color = vec3( color_immutable ).toVar();
return color.mul( strength );
} ).setLayout( {
name: 'emission',
type: 'vec3',
inputs: [
{ name: 'color', type: 'vec3' },
{ name: 'strength', type: 'float' }
]
} );
const directionalBlur = /*#__PURE__*/ Fn( ( [ uv_immutable, direction_immutable, radius_immutable ] ) => {
const radius = float( radius_immutable ).toVar();
const direction = vec2( direction_immutable ).toVar();
const uv = vec2( uv_immutable ).toVar();
const sum = float( 0.0 ).toVar();
const total = float( 0.0 ).toVar();
Loop( { start: int( radius.negate() ), end: int( radius ), type: 'int', condition: '<=' }, ( { i } ) => {
const offset = vec2( uv.add( direction.mul( i ).div( radius ) ) ).toVar();
const dist = float( length( offset.sub( vec2( 0.5, 0.5 ) ) ) ).toVar();
const circle = float( smoothstep( 0.4, 0.5, dist ) ).toVar();
sum.addAssign( circle );
total.addAssign( 1.0 );
} );
return sum.div( total );
} ).setLayout( {
name: 'directionalBlur',
type: 'float',
inputs: [
{ name: 'uv', type: 'vec2' },
{ name: 'direction', type: 'vec2' },
{ name: 'radius', type: 'float' }
]
} );
const scaleWithCenter = /*#__PURE__*/ Fn( ( [ uv_immutable, scale_immutable, center_immutable ] ) => {
const center = vec2( center_immutable ).toVar();
const scale = vec2( scale_immutable ).toVar();
const uv = vec2( uv_immutable ).toVar();
return center.add( uv.sub( center ).mul( scale ) );
} ).setLayout( {
name: 'scaleWithCenter',
type: 'vec2',
inputs: [
{ name: 'uv', type: 'vec2' },
{ name: 'scale', type: 'vec2' },
{ name: 'center', type: 'vec2' }
]
} );
const murmurHash21 = /*#__PURE__*/ Fn( ( [ src_immutable ] ) => {
const src = uint( src_immutable ).toVar();
const M = uint( int( 0x5bd1e995 ) );
const h = uvec2( uint( 1190494759 ), uint( 2147483647 ) ).toVar();
src.mulAssign( M );
src.bitXorAssign( src.shiftRight( uint( 24 ) ) );
src.mulAssign( M );
h.mulAssign( M );
h.bitXorAssign( src );
h.bitXorAssign( h.shiftRight( uvec2( uint( 13 ), uint( 13 ) ) ) );
h.mulAssign( M );
h.bitXorAssign( h.shiftRight( uvec2( uint( 15 ), uint( 13 ) ) ) );
return h;
} ).setLayout( {
name: 'murmurHash21',
type: 'uvec2',
inputs: [
{ name: 'src', type: 'uint' }
]
} );
// 2 outputs, 1 input
const hash21 = /*#__PURE__*/ Fn( ( [ src_immutable ] ) => {
const src = float( src_immutable ).toVar();
const h = uvec2( murmurHash21( bitcast( src ) ) ).toVar();
const x = bitcast( h.x.bitAnd( int( 0x007fffff ) ).bitOr( int( 0x3f800000 ) ) );
const y = bitcast( h.y.bitAnd( int( 0x007fffff ) ).bitOr( int( 0x3f800000 ) ) );
return vec2( x, y ).sub( 1.0 );
//return float( h.bitAnd( int( 0x007fffff ) ).bitOr( int( 0x3f800000 ) ) ).sub( 1.0 );
} ).setLayout( {
name: 'hash21',
type: 'vec2',
inputs: [
{ name: 'src', type: 'float' }
]
} );
// const hash21 = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => {
//
// const p = float( p_immutable ).toVar();
// const p3 = vec3( fract( vec3( p ).mul( vec3( .1031, .1030, .0973 ) ) ) ).toVar();
// p3.addAssign( dot( p3, p3.yzx.add( 33.33 ) ) );
//
// return fract( p3.xx.add( p3.yz ).mul( p3.zy ) );
//
// } ).setLayout( {
// name: 'hash21',
// type: 'vec2',
// inputs: [
// { name: 'p', type: 'float' }
// ]
// } );
const _hash = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => {
const p = vec3( p_immutable ).toVar();
p.assign( vec3( dot( p, vec3( 127.1, 311.7, 74.7 ) ), dot( p, vec3( 269.5, 183.3, 246.1 ) ), dot( p, vec3( 113.5, 271.9, 124.6 ) ) ) );
return float( -1.0 ).add( mul( 2.0, fract( sin( p ).mul( 43758.5453123 ) ) ) );
} ).setLayout( {
name: 'hash',
type: 'vec3',
inputs: [
{ name: 'p', type: 'vec3' }
]
} );
const easeOut = /*#__PURE__*/ Fn( ( [ x_immutable, t_immutable ] ) => {
const t = float( t_immutable ).toVar();
const x = float( x_immutable ).toVar();
return sub( 1.0, pow( sub( 1.0, x ), t ) );
} ).setLayout( {
name: 'easeOut',
type: 'float',
inputs: [
{ name: 'x', type: 'float' },
{ name: 't', type: 'float' }
]
} );
const rotateAxis = /*#__PURE__*/ Fn( ( [ axis_immutable, angle_immutable ] ) => {
const angle = float( angle_immutable ).toVar();
const axis = vec3( axis_immutable ).toVar();
const s = float( sin( angle ) ).toVar();
const c = float( cos( angle ) ).toVar();
const oc = float( sub( 1.0, c ) ).toVar();
return mat3(
oc.mul( axis.x ).mul( axis.x ).add( c ),
oc.mul( axis.x ).mul( axis.y ).sub( axis.z.mul( s ) ),
oc.mul( axis.z ).mul( axis.x ).add( axis.y.mul( s ) ),
oc.mul( axis.x ).mul( axis.y ).add( axis.z.mul( s ) ),
oc.mul( axis.y ).mul( axis.y ).add( c ),
oc.mul( axis.y ).mul( axis.z ).sub( axis.x.mul( s ) ),
oc.mul( axis.z ).mul( axis.x ).sub( axis.y.mul( s ) ),
oc.mul( axis.y ).mul( axis.z ).add( axis.x.mul( s ) ),
oc.mul( axis.z ).mul( axis.z ).add( c )
);
} ).setLayout( {
name: 'rotateAxis',
type: 'mat3',
inputs: [
{ name: 'axis', type: 'vec3' },
{ name: 'angle', type: 'float' }
]
} );
const bezier = /*#__PURE__*/ Fn( ( [ P0_immutable, P1_immutable, P2_immutable, P3_immutable, t_immutable ] ) => {
const t = float( t_immutable ).toVar();
const P3 = vec3( P3_immutable ).toVar();
const P2 = vec3( P2_immutable ).toVar();
const P1 = vec3( P1_immutable ).toVar();
const P0 = vec3( P0_immutable ).toVar();
return sub( 1.0, t ).mul( sub( 1.0, t ) ).mul( sub( 1.0, t ) ).mul( P0 ).add( mul( 3.0, sub( 1.0, t ) ).mul( sub( 1.0, t ) ).mul( t ).mul( P1 ) ).add( mul( 3.0, sub( 1.0, t ) ).mul( t ).mul( t ).mul( P2 ) ).add( t.mul( t ).mul( t ).mul( P3 ) );
} ).setLayout( {
name: 'bezier',
type: 'vec3',
inputs: [
{ name: 'P0', type: 'vec3' },
{ name: 'P1', type: 'vec3' },
{ name: 'P2', type: 'vec3' },
{ name: 'P3', type: 'vec3' },
{ name: 't', type: 'float' }
]
} );
const bezierGrad = /*#__PURE__*/ Fn( ( [ P0_immutable, P1_immutable, P2_immutable, P3_immutable, t_immutable ] ) => {
const t = float( t_immutable ).toVar();
const P3 = vec3( P3_immutable ).toVar();
const P2 = vec3( P2_immutable ).toVar();
const P1 = vec3( P1_immutable ).toVar();
const P0 = vec3( P0_immutable ).toVar();
return mul( 3.0, sub( 1.0, t ) ).mul( sub( 1.0, t ) ).mul( P1.sub( P0 ) ).add( mul( 6.0, sub( 1.0, t ) ).mul( t ).mul( P2.sub( P1 ) ) ).add( mul( 3.0, t ).mul( t ).mul( P3.sub( P2 ) ) );
} ).setLayout( {
name: 'bezierGrad',
type: 'vec3',
inputs: [
{ name: 'P0', type: 'vec3' },
{ name: 'P1', type: 'vec3' },
{ name: 'P2', type: 'vec3' },
{ name: 'P3', type: 'vec3' },
{ name: 't', type: 'float' }
]
} );
const noise = /*#__PURE__*/ Fn( ( [ p_immutable ] ) => {
const p = vec3( p_immutable ).toVar();
const i = vec3( floor( p ) ).toVar();
const f = vec3( fract( p ) ).toVar();
const u = vec3( f.mul( f ).mul( sub( 3.0, mul( 2.0, f ) ) ) ).toVar();
return mix( mix( mix( dot( _hash( i.add( vec3( 0.0, 0.0, 0.0 ) ) ),
f.sub( vec3( 0.0, 0.0, 0.0 ) ) ),
dot( _hash( i.add( vec3( 1.0, 0.0, 0.0 ) ) ),
f.sub( vec3( 1.0, 0.0, 0.0 ) ) ), u.x ),
mix( dot( _hash( i.add( vec3( 0.0, 1.0, 0.0 ) ) ),
f.sub( vec3( 0.0, 1.0, 0.0 ) ) ),
dot( _hash( i.add( vec3( 1.0, 1.0, 0.0 ) ) ),
f.sub( vec3( 1.0, 1.0, 0.0 ) ) ), u.x ), u.y ),
mix( mix( dot( _hash( i.add( vec3( 0.0, 0.0, 1.0 ) ) ),
f.sub( vec3( 0.0, 0.0, 1.0 ) ) ),
dot( _hash( i.add( vec3( 1.0, 0.0, 1.0 ) ) ),
f.sub( vec3( 1.0, 0.0, 1.0 ) ) ), u.x ),
mix( dot( _hash( i.add( vec3( 0.0, 1.0, 1.0 ) ) ),
f.sub( vec3( 0.0, 1.0, 1.0 ) ) ),
dot( _hash( i.add( vec3( 1.0, 1.0, 1.0 ) ) ),
f.sub( vec3( 1.0, 1.0, 1.0 ) ) ), u.x ), u.y ), u.z );
} ).setLayout( {
name: 'noise',
type: 'float',
inputs: [
{ name: 'p', type: 'vec3', qualifier: 'in' }
]
} );
const terrainHeight = /*#__PURE__*/ Fn( ( [ worldPos_immutable ] ) => {
const worldPos = vec3( worldPos_immutable ).toVar();
return vec3( worldPos.x, noise( worldPos.mul( 0.02 ) ).mul( 10.0 ), worldPos.z );
} ).setLayout( {
name: 'terrainHeight',
type: 'vec3',
inputs: [
{ name: 'worldPos', type: 'vec3' }
]
} );
const lambertLight = /*#__PURE__*/ Fn( ( [ normal_immutable, viewDir_immutable, lightDir_immutable, lightColour_immutable ] ) => {
const lightColour = vec3( lightColour_immutable ).toVar();
const lightDir = vec3( lightDir_immutable ).toVar();
const viewDir = vec3( viewDir_immutable ).toVar();
const normal = vec3( normal_immutable ).toVar();
const wrap = float( 0.5 ).toVar();
const dotNL = float( saturate( dot( normal, lightDir ).add( wrap ).div( add( 1.0, wrap ) ) ) ).toVar();
const lighting = vec3( dotNL ).toVar();
const backlight = float( saturate( dot( viewDir, lightDir.negate() ).add( wrap ).div( add( 1.0, wrap ) ) ) ).toVar();
const scatter = vec3( pow( backlight, 2.0 ) ).toVar();
lighting.addAssign( scatter );
return lighting.mul( lightColour );
} ).setLayout( {
name: 'lambertLight',
type: 'vec3',
inputs: [
{ name: 'normal', type: 'vec3' },
{ name: 'viewDir', type: 'vec3' },
{ name: 'lightDir', type: 'vec3' },
{ name: 'lightColour', type: 'vec3' }
]
} );
const hemiLight = /*#__PURE__*/ Fn( ( [ normal_immutable, groundColour_immutable, skyColour_immutable ] ) => {
const skyColour = vec3( skyColour_immutable ).toVar();
const groundColour = vec3( groundColour_immutable ).toVar();
const normal = vec3( normal_immutable ).toVar();
return mix( groundColour, skyColour, mul( 0.5, normal.y ).add( 0.5 ) );
} ).setLayout( {
name: 'hemiLight',
type: 'vec3',
inputs: [
{ name: 'normal', type: 'vec3' },
{ name: 'groundColour', type: 'vec3' },
{ name: 'skyColour', type: 'vec3' }
]
} );
const phongSpecular = /*#__PURE__*/ Fn( ( [ normal_immutable, lightDir_immutable, viewDir_immutable ] ) => {
const viewDir = vec3( viewDir_immutable ).toVar();
const lightDir = vec3( lightDir_immutable ).toVar();
const normal = vec3( normal_immutable ).toVar();
const dotNL = float( saturate( dot( normal, lightDir ) ) ).toVar();
const r = vec3( normalize( reflect( lightDir.negate(), normal ) ) ).toVar();
const phongValue = float( max( 0.0, dot( viewDir, r ) ) ).toVar();
phongValue.assign( pow( phongValue, 32.0 ) );
const specular = vec3( dotNL.mul( vec3( phongValue ) ) ).toVar();
return specular;
} ).setLayout( {
name: 'phongSpecular',
type: 'vec3',
inputs: [
{ name: 'normal', type: 'vec3' },
{ name: 'lightDir', type: 'vec3' },
{ name: 'viewDir', type: 'vec3' }
]
} );
export {
rotateY,
rotateZ,
emission,
facture,
scaleWithCenter,
directionalBlur,
murmurHash21,
hash21,
_hash,
easeOut,
rotateAxis,
bezier,
bezierGrad,
noise,
terrainHeight,
phongSpecular,
hemiLight,
lambertLight
}
src/Experience/Worlds/Abstracts/Model.js
import * as THREE from 'three/webgpu'
import Experience from '@experience/Experience.js'
import Resources from "@experience/Utils/Resources.js";
export default class Model {
constructor() {
}
// loadModel( inputElement ) {
//
// if ( this[this.sources[0].name] || this.loadingModel ) {
// return;
// }
//
// this.loadingModel = true;
//
// const preloaderElement = document.createElement( 'div' )
// preloaderElement.classList.add( 'loader' )
// inputElement.parentElement.appendChild( preloaderElement )
//
// this.localResources = new Resources( this.sources, this.sourcesReady )
//
// this.localResources.on( this.sourcesReady, () => {
// this.setModel()
// this.setDebug()
// inputElement.parentElement.removeChild( preloaderElement )
// this.loadingModel = false;
// } )
// }
setModel() {
}
setDebug() {
}
}
src/Experience/Worlds/MainWorld/Camera.js
import * as THREE from 'three/webgpu'
import Experience from '@experience/Experience.js'
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js'
import gsap from "gsap";
import { TransformControls } from 'three/addons/controls/TransformControls.js';
export default class Camera {
constructor( parameters = {} ) {
this.experience = new Experience()
this.sizes = this.experience.sizes
this.time = this.experience.time
this.canvas = this.experience.canvas
this.timeline = this.experience.timeline
this.renderer = this.experience.renderer.instance
this.cursorEnabled = false
this.lerpVector = new THREE.Vector3();
this.setInstance()
this.setControls()
}
setInstance() {
this.instance = new THREE.PerspectiveCamera( 25, this.sizes.width / this.sizes.height, 0.1, 300 )
this.defaultCameraPosition = new THREE.Vector3( 0, 4.5, 12 );
this.instance.position.copy( this.defaultCameraPosition )
this.instance.lookAt( new THREE.Vector3( 0, 0, 0 ) );
this.lerpVector.copy( this.instance.position );
}
setControls() {
this.controls = new OrbitControls( this.instance, this.canvas )
this.controls.enableDamping = true
this.controls.minDistance = 0;
this.controls.maxDistance = 500;
this.controls.enabled = true;
this.controls.target = new THREE.Vector3( 0, 0, 0 );
// this.controls.mouseButtons = {
// LEFT: THREE.MOUSE.ROTATE,
// MIDDLE: null,
// RIGHT: null, // Отключает действие для правой кнопки мыши
// };
//
// this.controls.enableZoom = false;
this.transformControls = new TransformControls( this.instance, this.renderer.domElement );
//this.transformControls.addEventListener( 'change', render );
this.transformControls.addEventListener( 'dragging-changed', ( event ) => {
this.controls.enabled = ! event.value;
} );
this.setListeners()
}
setListeners() {
const control = this.transformControls;
window.addEventListener( 'keydown', ( event ) => {
switch ( event.key ) {
case 'q':
control.setSpace( control.space === 'local' ? 'world' : 'local' );
break;
case 'Shift':
control.setTranslationSnap( 1 );
control.setRotationSnap( THREE.MathUtils.degToRad( 15 ) );
control.setScaleSnap( 0.25 );
break;
case 'w':
control.setMode( 'translate' );
break;
case 'e':
control.setMode( 'rotate' );
break;
case 'r':
control.setMode( 'scale' );
break;
case '+':
case '=':
control.setSize( control.size + 0.1 );
break;
case '-':
case '_':
control.setSize( Math.max( control.size - 0.1, 0.1 ) );
break;
case 'x':
control.showX = ! control.showX;
break;
case 'y':
control.showY = ! control.showY;
break;
case 'z':
control.showZ = ! control.showZ;
break;
case ' ':
control.enabled = ! control.enabled;
break;
case 'Escape':
control.reset();
break;
}
} );
window.addEventListener( 'keyup', function ( event ) {
switch ( event.key ) {
case 'Shift':
control.setTranslationSnap( null );
control.setRotationSnap( null );
control.setScaleSnap( null );
break;
}
} );
}
resize() {
this.instance.aspect = this.sizes.width / this.sizes.height
this.instance.updateProjectionMatrix()
}
update() {
this.controls.update()
//this.instance.updateMatrixWorld() // To be used in projection
}
animateCameraPosition() {
}
}
src/Experience/Worlds/MainWorld/Environment.js
import * as THREE from 'three/webgpu'
import Experience from '@experience/Experience.js'
import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js';
export default class Environment {
constructor( parameters = {} ) {
this.experience = new Experience()
this.scene = parameters.world.scene
this.resources = this.experience.resources
this.debug = this.experience.debug
this.renderer = this.experience.renderer.instance
this.scene.colorSpace = THREE.SRGBColorSpace
this.uniforms = {
topColor: new THREE.Color().setRGB( 0.0, 0.0, 0.0 ),
bottomColor: new THREE.Color().setRGB( 0.0, 0.0, 0.07 )
}
this.setAmbientLight()
this.setDirectionalLight()
//his.setEnvironmentMap()
//this.setHDRI()
this.setDebug()
}
setAmbientLight() {
this.ambientLight = new THREE.AmbientLight( '#ffffff', 0.05 )
this.scene.add( this.ambientLight )
}
setDirectionalLight() {
this.directionalLight = new THREE.DirectionalLight( '#ffffff', 1 )
this.directionalLight.position.set( 0, 5, 5 )
this.scene.add( this.directionalLight )
}
setEnvironmentMap() {
const environment = new RoomEnvironment( this.renderer );
const pmremGenerator = new THREE.PMREMGenerator( this.renderer );
pmremGenerator.fromSceneAsync( environment ).then( ( envMap ) => {
const env = envMap.texture;
this.scene.background = env;
this.scene.environment = env;
this.scene.backgroundBlurriness = 0.5;
// Free memory
pmremGenerator.dispose();
} ).catch( ( error ) => {
console.error( "Error Generating environment:", error );
} );
// //environment.dispose();
// //set background transparent
// this.scene.background = null;
}
createGradientTexture( topColor, bottomColor ) {
const canvas = document.createElement( 'canvas' );
const ctx = canvas.getContext( '2d' );
canvas.width = 10;
canvas.height = 10;
const gradient = ctx.createLinearGradient( 0, 0, 0, canvas.height );
gradient.addColorStop( 0, '#' + topColor.getHexString() ); // top color
gradient.addColorStop( 1, '#' + bottomColor.getHexString() ); // bottom color
ctx.fillStyle = gradient;
ctx.fillRect( 0, 0, canvas.width, canvas.height );
return new THREE.CanvasTexture( canvas );
}
setHDRI() {
const hdriTexture = this.resources.items.hdriTexture
// set EquiRectangular projection
hdriTexture.mapping = THREE.EquirectangularReflectionMapping
this.scene.environment = hdriTexture
// this.scene.background = this.resources.items.gradientTexture
// this.scene.backgroundBlurriness = 0.2
// set scene background gradient
this.scene.background = this.createGradientTexture( this.uniforms.topColor, this.uniforms.bottomColor )
}
setDebug() {
if ( this.debug.active ) {
const environmentFolder = this.debug.panel.addFolder( {
title: 'Environment',
expanded: true,
} )
environmentFolder.addBinding( this.uniforms, 'topColor', {
label: 'Top Color',
color: { type: 'float' }
} ).on( 'change', ( e ) => {
this.scene.background = this.createGradientTexture( this.uniforms.topColor, this.uniforms.bottomColor )
} )
environmentFolder.addBinding( this.uniforms, 'bottomColor', {
label: 'Bottom Color',
color: { type: 'float' }
} ).on( 'change', ( e ) => {
this.scene.background = this.createGradientTexture( this.uniforms.topColor, this.uniforms.bottomColor )
} )
}
}
}
src/Experience/Worlds/MainWorld/MainWorld.js
import * as THREE from 'three'
import Experience from '@experience/Experience.js'
import DebugHelpers from "../Objects/DebugHelpers.js";
import Time from "@experience/Utils/Time.js";
import EventEmitter from '@experience/Utils/EventEmitter.js';
import Camera from './Camera.js'
import Input from "@experience/Utils/Input.js";
import Environment from "./Environment.js";
import ParticlesTrails from "@experience/Worlds/MainWorld/ParticlesTrails.js";
export default class MainWorld extends EventEmitter{
constructor() {
super();
this.experience = Experience.getInstance()
this.time = Time.getInstance()
this.renderer = this.experience.renderer.instance
this.state = this.experience.state
this.scene = new THREE.Scene()
this.camera = new Camera( { scene: this.scene } )
this.input = new Input( { camera: this.camera.instance } )
this.resources = this.experience.resources
this.html = this.experience.html
this.sound = this.experience.sound
this.debug = this.experience.debug
this.enabled = true
this._setDebug()
this.particlesTrails = new ParticlesTrails( { world: this } )
this.environment = new Environment( { world: this } )
//this.debugHelpers = new DebugHelpers( { world: this } )
this.scene.add( this.camera.instance )
}
animationPipeline() {
this.particlesTrails?.animationPipeline()
}
postInit() {
this.particlesTrails?.postInit()
}
resize() {
this.particlesTrails?.resize()
this.camera?.resize()
}
update( deltaTime ) {
if ( !this.enabled )
return
this.particlesTrails?.update( deltaTime )
this.camera?.update()
}
postUpdate( deltaTime ) {
}
_setDebug() {
if ( !this.debug.active ) return
this.debugFolder = this.debug.panel.addFolder( {
title: 'Main World', expanded: true
} )
}
}
src/Experience/Worlds/MainWorld/ParticlesTrails.js
import * as THREE from 'three/webgpu'
import Model from '@experience/Worlds/Abstracts/Model.js'
import Experience from '@experience/Experience.js'
import Debug from '@experience/Utils/Debug.js'
import State from "@experience/State.js";
import {
positionLocal, time, vec3, vec4, uniform, color, If, instanceIndex,
uint, Fn, float, smoothstep, instancedArray, deltaTime, hash
} from 'three/tsl'
import { simplexNoise4d } from "@experience/TSL/simplexNoise4d.js"
export default class ParticlesTrails extends Model {
experience = Experience.getInstance()
debug = Debug.getInstance()
state = State.getInstance()
sizes = experience.sizes
input = experience.input
time = experience.time
renderer = experience.renderer.instance
resources = experience.resources
container = new THREE.Group();
isMobile = this.experience.isMobile
tails_count = 10 // n-1 point tails
particles_count = this.tails_count * 200 // need % tails_count
story_count = 2 // story for 1 position
story_snake = this.tails_count * this.story_count
full_story_length = ( this.particles_count / this.tails_count ) * this.story_snake
initialCompute = false
uniforms = {
color: uniform( color( 0x00ff00 ) ),
size: uniform( 0.489 ),
uFlowFieldInfluence: uniform( 0.5 ),
uFlowFieldStrength: uniform( 3.043 ),
uFlowFieldFrequency: uniform( 0.207 ),
}
varyings = {}
constructor( parameters = {} ) {
super()
this.world = parameters.world
this.camera = this.world.camera.instance
this.cameraClass = this.world.camera
this.scene = this.world.scene
this.logo = this.world.logo
this.postProcess = this.experience.postProcess
this.setModel()
this.setDebug()
}
postInit() {
}
setModel() {
const positionsArray = new Float32Array( this.particles_count * 3 )
const lifeArray = new Float32Array( this.particles_count )
const positionInitBuffer = instancedArray( positionsArray, 'vec3' );
const positionBuffer = instancedArray( positionsArray, 'vec3' );
// Tails
const positionStoryBuffer = instancedArray( new Float32Array( this.particles_count * this.tails_count * this.story_count ), 'vec3' );
const lifeBuffer = instancedArray( lifeArray, 'float' );
const particlesMaterial = new THREE.MeshStandardNodeMaterial( {
metalness: 1.0,
roughness: 0
} );
const computeInit = this.computeInit = Fn( () => {
const position = positionBuffer.element( instanceIndex )
const positionInit = positionInitBuffer.element( instanceIndex );
const life = lifeBuffer.element( instanceIndex )
// Position
position.xyz = vec3(
hash( instanceIndex.add( uint( Math.random() * 0xffffff ) ) ),
hash( instanceIndex.add( uint( Math.random() * 0xffffff ) ) ),
hash( instanceIndex.add( uint( Math.random() * 0xffffff ) ) )
).sub( 0.5 ).mul( vec3( 5, 5, 5 ) );
// Copy Init
positionInit.assign( position )
const cycleStep = uint( float( instanceIndex ).div( this.tails_count ).floor() )
// Life
const lifeRandom = hash( cycleStep.add( uint( Math.random() * 0xffffff ) ) )
life.assign( lifeRandom )
} )().compute( this.particles_count );
this.renderer.computeAsync( this.computeInit ).then( () => {
this.initialCompute = true
} )
const computeUpdate = this.computeUpdate = Fn( () => {
const position = positionBuffer.element( instanceIndex )
const positionInit = positionInitBuffer.element( instanceIndex )
const life = lifeBuffer.element( instanceIndex );
const _time = time.mul( 0.2 )
const uFlowFieldInfluence = this.uniforms.uFlowFieldInfluence
const uFlowFieldStrength = this.uniforms.uFlowFieldStrength
const uFlowFieldFrequency = this.uniforms.uFlowFieldFrequency
If( life.greaterThanEqual( 1 ), () => {
life.assign( life.mod( 1 ) )
position.assign( positionInit )
} ).Else( () => {
life.addAssign( deltaTime.mul( 0.2 ) )
} )
// Strength
const strength = simplexNoise4d( vec4( position.mul( 0.2 ), _time.add( 1 ) ) ).toVar()
const influence = uFlowFieldInfluence.sub( 0.5 ).mul( -2.0 ).toVar()
strength.assign( smoothstep( influence, 1.0, strength ) )
// Flow field
const flowField = vec3(
simplexNoise4d( vec4( position.mul( uFlowFieldFrequency ).add( 0 ), _time ) ),
simplexNoise4d( vec4( position.mul( uFlowFieldFrequency ).add( 1.0 ), _time ) ),
simplexNoise4d( vec4( position.mul( uFlowFieldFrequency ).add( 2.0 ), _time ) )
).normalize()
const cycleStep = instanceIndex.mod( uint( this.tails_count ) )
If( cycleStep.equal( 0 ), () => { // Head
const newPos = position.add( flowField.mul( deltaTime ).mul( uFlowFieldStrength ) /* * strength */ )
position.assign( newPos )
} ).Else( () => { // Tail
const prevTail = positionStoryBuffer.element( instanceIndex.mul( this.story_count ) )
position.assign( prevTail )
} )
} )().compute( this.particles_count );
const computePositionStory = this.computePositionStory = Fn( () => {
const positionStory = positionStoryBuffer.element( instanceIndex )
const cycleStep = instanceIndex.mod( uint( this.story_snake ) )
const lastPosition = positionBuffer.element( uint( float( instanceIndex.div( this.story_snake ) ).floor().mul( this.tails_count ) ) )
If( cycleStep.equal( 0 ), () => { // Head
positionStory.assign( lastPosition )
} )
positionStoryBuffer.element( instanceIndex.add( 1 ) ).assign( positionStoryBuffer.element( instanceIndex ) )
} )().compute( this.full_story_length );
particlesMaterial.positionNode = Fn( () => {
const position = positionBuffer.element( instanceIndex );
const cycleStep = instanceIndex.mod( uint( this.tails_count ) )
const finalSize = this.uniforms.size.toVar()
If( cycleStep.equal( 0 ), () => {
finalSize.addAssign( 0.5 )
} )
return positionLocal.mul( finalSize ).add( position )
} )()
particlesMaterial.emissiveNode = this.uniforms.color
const sphereGeometry = new THREE.SphereGeometry( 0.1, 32, 32 );
const particlesMesh = this.particlesMesh = new THREE.InstancedMesh( sphereGeometry, particlesMaterial, this.particles_count );
particlesMesh.instanceMatrix.setUsage( THREE.DynamicDrawUsage );
particlesMesh.frustumCulled = false;
this.scene.add( this.particlesMesh )
this.scene.add( this.container )
// setInterval( async () => {
//
// }, 1/60 );
}
animationPipeline() {
}
resize() {
}
setDebug() {
if ( !this.debug.active ) return
//this.debug.createDebugTexture( this.resources.items.displacementTexture, this.world )
//this.debug.createDebugNode( viewportDepthTexture( uv().flipY() ), this.world )
//this.debug.createDebugNode( viewportLinearDepth, this.world )
const particlesFolder = this.world.debugFolder.addFolder( {
title: 'Particles',
expanded: true
} )
// Particles
const commonFolder = particlesFolder.addFolder( {
title: '🖲️ Common',
expanded: true
} )
commonFolder.addBinding( this.uniforms.color, 'value', {
label: 'Color',
color: { type: 'float' }
})
commonFolder.addBinding( this.uniforms.uFlowFieldInfluence, 'value', {
min: 0, max: 1, step: 0.001, label: 'uFlowFieldInfluence'
} )
commonFolder.addBinding( this.uniforms.uFlowFieldStrength, 'value', {
min: 0, max: 10, step: 0.001, label: 'uFlowFieldStrength'
} )
commonFolder.addBinding( this.uniforms.uFlowFieldFrequency, 'value', {
min: 0, max: 1, step: 0.001, label: 'uFlowFieldFrequency'
} )
}
async update( deltaTime ) {
// Compute update
if ( this.initialCompute ) {
await this.renderer.computeAsync( this.computePositionStory )
await this.renderer.computeAsync( this.computeUpdate )
}
}
}
src/Experience/Worlds/Objects/DebugHelpers.js
import * as THREE from 'three/webgpu'
import Experience from '@experience/Experience.js'
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js'
import { ViewHelper } from 'three/examples/jsm/helpers/ViewHelper.js'
import Gizmo from '@experience/Utils/Gizmo.js'
import gridMaterial from '@experience/Materials/GridMaterial.js'
export default class DebugHelpers {
experience = new Experience()
debug = experience.debug
time = experience.time
renderer = experience.renderer.instance
resources = experience.resources
cursor = experience.cursor
timeline = experience.timeline;
controls = experience.camera?.controls
container = new THREE.Group();
constructor( parameters = {} ) {
if ( !this.debug.active ) return
this.world = parameters.world
this.scene = this.world.scene
this.camera = this.world.camera.instance
this.setupDebugFeatures()
}
setupDebugFeatures() {
this.addGlobalAxes()
this.addViewHelper()
//this.addGrid()
}
addGlobalAxes() {
const axesHelper = new THREE.AxesHelper( 5 );
this.scene.add( axesHelper );
}
addViewHelper() {
this.gizmo = new Gizmo(this.camera, { size: 100, padding: 8 });
document.body.appendChild(this.gizmo);
this.gizmo.onAxisSelected = function(axis) {
console.log(axis); // { axis: "x", direction: THREE.Vector3(1,0,0) }
}
}
addGrid() {
/**
* Grid
*/
const grid = new THREE.Mesh(
new THREE.PlaneGeometry(100, 100),
gridMaterial
)
grid.rotation.x = - Math.PI * 0.5
grid.position.y = 0
this.scene.add(grid)
}
resize() {
}
update( deltaTime ) {
this.gizmo?.update();
}
}
src/Experience/Worlds/Objects/SceneDepth/SceneDepth.js
import * as THREE from 'three/webgpu'
import Model from '@experience/World/Abstracts/Model.js'
import Experience from '@experience/Experience.js'
import Debug from '@experience/Utils/Debug.js'
import State from "@experience/State.js";
import FBO from "@experience/Utils/FBO.js";
export default class SceneDepth extends Model {
experience = Experience.getInstance()
debug = Debug.getInstance()
state = State.getInstance()
fbo = FBO.getInstance()
sizes = experience.sizes
scene = experience.scene
time = experience.time
camera = experience.camera.instance
renderer = experience.renderer.instance
resources = experience.resources
postProcess = this.experience.postProcess
container = new THREE.Group();
constructor() {
super()
this.setScene()
this.setDebug()
}
setScene() {
this.sceneDepth = new THREE.Scene()
this.sceneDepth.add( this.container )
this.setDepthBuffer()
}
setDepthBuffer() {
const dpr = this.renderer.getPixelRatio();
const depthRenderTarget = this.fbo.createRenderTarget( this.sizes.width * this.sizes.pixelRatio, this.sizes.height * this.sizes.pixelRatio, false, false, 0 );
depthRenderTarget.depthTexture = new THREE.DepthTexture();
depthRenderTarget.depthTexture.format = THREE.DepthFormat;
depthRenderTarget.depthTexture.type = THREE.UnsignedShortType;
this.depthRenderTarget = depthRenderTarget;
}
resize() {
this.depthRenderTarget.setSize( this.sizes.width * this.sizes.pixelRatio, this.sizes.height * this.sizes.pixelRatio )
this.depthRenderTarget.depthTexture.image.width = this.sizes.width * this.sizes.pixelRatio
this.depthRenderTarget.depthTexture.image.height = this.sizes.height * this.sizes.pixelRatio
this.postUpdate( this.time.delta ) // fix flickering background objects
}
setDebug() {
if ( !this.debug.active ) return
this.debug.createDebugTexture( this.depthRenderTarget.texture )
}
postUpdate( deltaTime ) {
this.renderer.autoClear = true
this.renderer.setRenderTarget( this.depthRenderTarget );
this.renderer.render( this.sceneDepth, this.camera )
this.renderer.setRenderTarget( null );
this.postProcess.clearPass.uniforms.u_DepthTexture.value = this.depthRenderTarget.texture;
// this.postProcess.clearPass.uniforms.cameraNear.value = this.camera.near;
// this.postProcess.clearPass.uniforms.cameraFar.value = this.camera.far;
//this.renderer.render( this.sceneDepth, this.camera );
}
}
src/Experience/Worlds.js
import Experience from '@experience/Experience.js'
import EventEmitter from '@experience/Utils/EventEmitter.js';
import MainWorld from '@experience/Worlds/MainWorld/MainWorld.js'
import Debug from "@experience/Utils/Debug.js";
export default class Worlds extends EventEmitter{
debug = Debug.getInstance()
constructor() {
super();
this.experience = Experience.getInstance()
this.setupWorlds()
this.setDebug()
}
setupWorlds() {
// Setup
this.mainWorld = new MainWorld()
this.experience.mainScene = this.mainWorld.scene
this.experience.mainCamera = this.mainWorld.camera
}
setDebug() {
if ( !this.debug.active ) return
const gizmo = this.experience.mainCamera.transformControls.getHelper();
this.experience.mainScene.add( gizmo );
}
postInit() {
this.mainWorld?.postInit()
this.postProcess = this.experience.postProcess
}
animationPipeline() {
this.mainWorld?.animationPipeline()
}
resize() {
this.mainWorld?.resize()
}
update( deltaTime ) {
this.mainWorld?.update( deltaTime )
}
postUpdate( deltaTime ) {
this.mainWorld?.postUpdate( deltaTime )
}
}
src/index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Matrix Sentinels</title>
<link rel="icon" href="./images/icons/favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="./style.css">
</head>
<body>
<canvas id="preloader"></canvas>
<main>
<header class="frame">
<h1 class="frame__title">Matrix Sentinels</h1>
<a class="frame__back" href="https://tympanus.net/codrops/?p=92796">Article</a>
<a class="frame__archive" href="https://tympanus.net/codrops/demos/">All demos</a>
<a class="frame__github" href="https://github.com/MisterPrada/vortex-glass-sphere">GitHub</a>
<nav class="frame__tags">
<a href="https://tympanus.net/codrops/demos/?tag=three-js">#three.js</a>
<a href="https://tympanus.net/codrops/demos/?tag=tsl">#tsl</a>
</nav>
<!-- <nav class="frame__demos">-->
<!-- <span>Variation 1</span>-->
<!-- <a href="index2.html">Variation 2</a>-->
<!-- <a href="index3.html">Variation 3</a>-->
<!-- </nav>-->
</header>
<!-- <div class="content">-->
<!-- <h2>The Content</h2>-->
<!-- </div>-->
</main>
<div id="debug-panel"></div>
<canvas class="webgl"></canvas>
<script type="module" src="./script.js"></script>
</body>
</html>
src/preloader.js
/* Author: https://github.com/MisterPrada */
import * as MathHelper from '@experience/Utils/MathHelper.js'
class Star {
ctx = window.preloader.ctx;
preloader = window.preloader
id = 0;
params = {
maxDistFromCursor: 50,
dotsSpeed: 0,
backgroundSpeed: 0
};
constructor( id, x, y ) {
this.id = id;
this.x = x;
this.y = y;
this.r = Math.floor( Math.random() * 2 ) + 1;
const alpha = ( Math.floor( Math.random() * 10 ) + 1 ) / 10 / 2;
this.color = "rgba(255,255,255," + alpha + ")";
}
draw() {
this.ctx.fillStyle = this.color;
this.ctx.shadowBlur = this.r * 2;
this.ctx.beginPath();
this.ctx.arc( this.x, this.y, this.r, 0, 2 * Math.PI, false );
this.ctx.closePath();
this.ctx.fill();
}
move() {
this.y -= this.preloader.deltaTime * 15 + this.params.backgroundSpeed / 100;
if ( this.y <= -10 ) this.y = this.preloader.ch + 10;
this.draw();
}
}
class Preloader {
preloader = document.getElementById( 'preloader' );
ctx = this.preloader.getContext( '2d' );
cw = this.preloader.width;
ch = this.preloader.height;
size = 20;
centerX = this.preloader.width / 2;
centerY = this.preloader.height / 2;
strokeWidth = 4;
angle = 0;
nextTime = 0;
delay = 1000 / 60 * 0.5;
deltaTime = 0.016666666666666668;
current = Date.now();
start = this.current;
elapsed = 0;
animationShow = true;
activePreloader = true;
animationState = 0;
animationInterval = undefined;
triangleState = 0;
triangleStateNormalize = 0;
resizeAction = false;
aspectRatio = 1 / window.innerHeight
playButtonAngle = 0
playButtonState = 0
stars = []
initStarsPopulation = 100
dots = []
constructor() {
window.preloader = this
this.init()
this.initStars()
window.requestAnimationFrame( this.animate );
}
init() {
this.resize()
window.addEventListener( 'resize', () => {
this.resize()
this.initStars()
this.resizeAction = true
})
}
animate = ( time ) => {
if ( !this.activePreloader ) {
requestAnimationFrame( this.animate );
return
}
const currentTime = Date.now()
this.deltaTime = Math.min( ( currentTime - this.current ) * 0.001, 0.016 )
this.current = currentTime
this.elapsed = ( this.current - this.start ) * 0.001
if ( this.deltaTime > 0.06 ) {
this.deltaTime = 0.06
}
if ( time < this.nextTime && !this.resizeAction ) {
requestAnimationFrame( this.animate );
return;
}
this.resizeAction = false;
this.nextTime = time + this.delay * this.deltaTime;
this.ctx.clearRect( 0, 0, this.cw, this.ch );
this.ctx.fillStyle = 'black';
this.ctx.globalCompositeOperation = 'xor';
this.ctx.fillRect( 0, 0, this.cw, this.ch );
this.ctx.fillStyle = 'black';
this.ctx.globalCompositeOperation = 'source-over';
this.ctx.fillRect( 0, 0, this.cw, this.ch );
// Создаем линейный градиент
const gradient = this.ctx.createLinearGradient( 0, 0, 0, this.ch );
// Добавляем цвета
gradient.addColorStop( 0, '#000000' ); // Черный цвет на начале
gradient.addColorStop( 1, '#5788fe' ); // Синий цвет на конце
// // Применяем градиент к заливке
// this.ctx.fillStyle = gradient;
//
// // Рисуем прямоугольник, заполняя весь холст
// this.ctx.fillRect( 0, 0, this.cw, this.ch );
this.drawStars();
this.drawTriangle()
this.triangleState += 3 * this.deltaTime;
if ( this.triangleState > 4.0 ) {
this.triangleState = 0;
}
this.triangleStateNormalize = this.triangleState / 1.7;
//this.angle += 60 * this.deltaTime;
requestAnimationFrame( this.animate );
}
drawTriangle() {
//this.ctx.clearRect( 0, 0, this.cw, this.ch );
//this.ctx.globalAlpha = 1.0 - this.animationState
this.ctx.save();
//const sideLength = this.ch / 3 * this.remap(this.animationState, 0, 1, 1, 0.4); // Length of the side of the big triangle
const sideLength = (this.ch / 3) / (1 + this.playButtonState * 2);
const height = sideLength * Math.sqrt( 3 ) / 2 + 1; // Height of the big triangle
const centroidY = height / 6; // Y-coordinate of the centroid of the big triangle
// Offset for the center of mass
this.ctx.translate( this.cw / 2, this.ch / 2 );
this.ctx.rotate( this.angle * Math.PI / 180 ); // Rotation of the big triangle
// Rotation animation for play button
this.ctx.rotate( this.playButtonAngle )
const smallTriangleCount = 9; // Count of small triangles
const smallSideLength = sideLength / smallTriangleCount; // Length of the side of the small triangle
const smallHeight = smallSideLength * Math.sqrt( 3 ) / 2; // Height of the small triangle
const smallCentroidY = smallHeight / 6; // Y-coordinate of the centroid of the small triangle
// first minX from smallTriangleCount = 1
const firstSmallHeight = sideLength * Math.sqrt( 3 ) / 2;
const firstMinX = Math.abs(-sideLength / 2 + Math.abs( ( -height / 2 + firstSmallHeight / 2 + height / 2 ) / Math.sqrt( 3 ) ));
// Draw small triangles
for ( let y = -height / 2 + smallHeight / 2; y <= height / 2 - smallHeight / 2; y += smallHeight ) {
const minX = -sideLength / 2 + Math.abs( ( y + height / 2 ) / Math.sqrt( 3 ) );
const maxX = sideLength / 2 - Math.abs( ( y + height / 2 ) / Math.sqrt( 3 ) ) + 1;
let offsetWhite = 0.2;
let offsetBlack = 0;
let distanceToCenter = Math.abs( y );
offsetWhite = 2 * distanceToCenter / ( sideLength / 2 );
offsetBlack = 1 * distanceToCenter / ( sideLength / 2 );
for ( let x = minX; x <= maxX - smallSideLength / 2; x += smallSideLength ) {
const offsetX = firstMinX / smallTriangleCount;
const offsetY = firstMinX / 2 + 6;
this.drawSmallTriangle( x + offsetX, y + offsetY, smallSideLength,'white', false, offsetWhite ); // Small triangles
this.drawSmallTriangle( x + offsetX, y + offsetY, smallSideLength,`black`, false, offsetBlack ); // Small triangles
if ( x + smallSideLength / 2 <= maxX - smallSideLength ) {
this.drawSmallTriangle( x + offsetX + smallSideLength / 2, y + offsetY, smallSideLength, 'white', true, offsetWhite ); // Reverse small triangles
this.drawSmallTriangle( x + offsetX + smallSideLength / 2, y + offsetY, smallSideLength, `black`, true, offsetBlack ); // Reverse small triangles
}
distanceToCenter = Math.abs( x + offsetX );
offsetWhite = 3 * distanceToCenter / ( sideLength / 2 );
offsetBlack = 2 * distanceToCenter / ( sideLength / 2 );
}
}
this.drawXorTriangle( sideLength );
this.ctx.restore();
//this.drawCenter()
}
drawSmallTriangle( x, y, length, fillStyle, flipped, offset = 0 ) {
let scale = 1.0 - this.clamp( this.triangleState - offset, 0, 1 );
// PlayButton Scale
scale = MathHelper.mix(scale, offset * 0.9, this.playButtonState) + Math.sin( this.elapsed ) * 0.3 * this.playButtonState
const newLength = length * scale; // New length of the small triangle
const h = newLength * Math.sqrt( 3 ) / 2; // New height of the small triangle
const oldHeight = length * Math.sqrt( 3 ) / 2; // Old height of the small triangle
// Offset for the center of mass
const offsetY = ( oldHeight - h ) / 3;
this.ctx.beginPath();
if ( !flipped ) {
// Basis triangle
this.ctx.moveTo( x, y + h / 2 - offsetY );
this.ctx.lineTo( x + newLength / 2, y - h / 2 - offsetY );
this.ctx.lineTo( x - newLength / 2, y - h / 2 - offsetY );
} else {
// Reversed triangle
this.ctx.moveTo( x, y - h / 2 - offsetY );
this.ctx.lineTo( x + newLength / 2, y + h / 2 - offsetY );
this.ctx.lineTo( x - newLength / 2, y + h / 2 - offsetY );
}
this.ctx.closePath();
this.ctx.fillStyle = fillStyle; // Color of the small triangle
this.ctx.fill();
// add border
this.ctx.strokeStyle = 'black';
this.ctx.lineWidth = 1;
this.ctx.stroke();
}
resize() {
this.preloader.width = window.innerWidth;
this.preloader.height = window.innerHeight;
this.cw = this.preloader.width;
this.ch = this.preloader.height;
this.centerX = this.preloader.width / 2;
this.centerY = this.preloader.height / 2;
this.ctx.fillStyle = 'rgba(0, 0, 0, 1.0)';
this.ctx.fillRect( 0, 0, this.cw, this.ch );
this.preloader.setAttribute( "width", this.cw );
this.preloader.setAttribute( "height", this.ch );
this.aspectRatio = 1 / window.innerHeight
}
initStars() {
this.ctx.strokeStyle = "white";
this.ctx.shadowColor = "white";
for ( let i = 0; i < this.initStarsPopulation; i++ ) {
this.stars[ i ] = new Star( i, Math.floor( Math.random() * this.cw ), Math.floor( Math.random() * this.ch ) );
//stars[i].draw();
}
this.ctx.shadowBlur = 0;
}
drawStars() {
this.ctx.save()
//ctx.clearRect(0, 0, WIDTH, HEIGHT);
for ( let i in this.stars ) {
this.stars[ i ].move();
}
for ( let i in this.dots ) {
this.dots[ i ].move();
}
this.ctx.restore()
}
drawXorTriangle( sideLength ) {
this.ctx.globalCompositeOperation = 'xor';
this.ctx.rotate( Math.PI * this.animationState ); // Rotation of the big triangle
// Draw the big triangle
let mainSideLength = sideLength * 100 * this.animationState;
let mainHeight = mainSideLength * Math.sqrt( 3 ) / 2 - 4;
let mainCentroidY = mainHeight / 6;
this.ctx.beginPath();
this.ctx.moveTo( -mainSideLength / 2, -mainHeight / 2 + mainCentroidY );
this.ctx.lineTo( mainSideLength / 2, -mainHeight / 2 + mainCentroidY );
this.ctx.lineTo( 0, mainHeight / 2 + mainCentroidY );
this.ctx.closePath();
this.ctx.fillStyle = `rgba(0,0,0,${this.animationState + 1})`; // Color of the big triangle
this.ctx.fill();
}
drawCenter() {
this.ctx.fillStyle = 'red';
this.ctx.beginPath();
this.ctx.arc( this.cw / 2, this.ch / 2, 1, 0, 2 * Math.PI );
this.ctx.fill();
}
showPreloader() {
this.preloader.style.pointerEvents = 'all';
this.preloader.style.display = 'block';
this.activePreloader = true;
clearInterval( this.animationInterval );
this.animationState = 1;
let startTime = Date.now();
let interval = this.animationInterval = setInterval( () => {
if ( this.animationState <= 0.0 ) {
clearInterval( interval );
return;
}
this.animationState = 1.0 - this.easeOutCubic( ( Date.now() - startTime ) / 1000 * 1.6 );
} );
}
hidePreloader() {
this.preloader.style.pointerEvents = 'none';
clearInterval( this.animationInterval );
this.animationState = 0;
let startTime = Date.now();
let interval = this.animationInterval = setInterval( () => {
if ( this.animationState >= 1 ) {
clearInterval( interval );
this.activePreloader = false;
this.preloader.style.display = 'none';
return;
}
this.animationState = this.expoInOut( ( Date.now() - startTime ) / 1000 );
} );
}
showPlayButton(callback = () => {}) {
this.preloader.style.cursor = 'pointer';
let startTime = Date.now();
let animationState = 0
const targetAngle = -Math.PI / 1.95
let interval = this.animationInterval = setInterval( () => {
if ( animationState >= 1 ) {
clearInterval( interval );
return;
}
animationState = this.expoInOut( ( Date.now() - startTime ) / 1000 );
this.playButtonState = animationState
this.playButtonAngle = targetAngle * animationState;
} );
this.preloader.addEventListener( 'click', () => {
this.hidePreloader()
callback()
}, { once: true } )
//this.animationState -= 0.001;
//console.log(Math.PI)
}
expoInOut( t ) {
return t === 0 || t === 1 ? t : t < 0.5 ? +0.5 * Math.pow( 2, ( 20 * t ) - 10 ) : -0.5 * Math.pow( 2, 10 - ( t * 20 ) ) + 1;
}
expoIn( t ) {
return t === 0 ? 0 : Math.pow( 2, 10 * ( t - 1 ) );
}
expoOut( t ) {
return t === 1 ? t : 1 - Math.pow( 2, -10 * t );
}
easeOutCubic( t ) {
return ( --t ) * t * t + 1;
}
clamp( num, min, max ) {
return num <= min ? min : num >= max ? max : num;
}
remap( value, low1, high1, low2, high2 ) {
return low2 + ( value - low1 ) * ( high2 - low2 ) / ( high1 - low1 );
}
}
new Preloader()
src/script.js
import './preloader.js'
import Experience from './Experience/Experience.js'
const experience = new Experience(document.querySelector('canvas.webgl'))
src/style.css
*
{
margin: 0;
padding: 0;
-ms-touch-action: none;
touch-action: none;
/* Disable selection */
-webkit-user-select: none; /* Safari */
-ms-user-select: none; /* IE 10 and IE 11 */
user-select: none; /* Standard syntax */
}
html,
body
{
overflow: hidden;
background-color: black;
}
.webgl
{
position: fixed;
top: 0;
left: 0;
outline: none;
}
/********************* Debug Panel *********************/
#debug-panel
{
position: fixed;
right: 0;
z-index: 10000999;
}
/********************* End Debug Panel *********************/
/********************* Gizmo *********************/
gizmo-helper {
position: fixed;
bottom: 0;
left: 0;
z-index: 100000;
}
gizmo-helper:hover {
background: rgba(255, 255, 255, .2);
border-radius: 100%;
cursor: pointer;
}
/********************* End Gizmo *********************/
#preloader {
z-index: 99999999;
width: 100%;
height: 100%;
display: block;
position: absolute;
}
/******************** Coderops ********************/
*,
*::after,
*::before {
box-sizing: border-box;
}
:root {
font-size: 12px;
--color-text: #fff;
--color-bg: #000;
--color-link: #fff;
--color-link-hover: #fff;
--page-padding: 1.5rem;
}
body {
margin: 0;
color: var(--color-text);
background-color: var(--color-bg);
font-family: ui-monospace, monospace;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
@media (scripting: enabled) {
.loading {
&::before,
&::after {
content: '';
position: fixed;
z-index: 10000;
}
&::before {
top: 0;
left: 0;
width: 100%;
height: 100%;
background: var(--color-bg);
}
&::after {
top: 50%;
left: 50%;
width: 100px;
height: 1px;
margin: 0 0 0 -50px;
background: var(--color-link);
animation: loaderAnim 1.5s ease-in-out infinite alternate forwards;
}
@keyframes loaderAnim {
0% {
transform: scaleX(0);
transform-origin: 0% 50%;
}
50% {
transform: scaleX(1);
transform-origin: 0% 50%;
}
50.1% {
transform: scaleX(1);
transform-origin: 100% 50%;
}
100% {
transform: scaleX(0);
transform-origin: 100% 50%;
}
}
}
}
a {
text-decoration: none;
color: var(--color-link);
outline: none;
cursor: pointer;
&:hover {
text-decoration: underline;
color: var(--color-link-hover);
}
&:focus {
outline: none;
background: lightgrey;
&:not(:focus-visible) {
background: transparent;
}
&:focus-visible {
outline: 2px solid red;
background: transparent;
}
}
}
.frame {
padding: 3rem var(--page-padding) 0;
display: grid;
z-index: 1000;
position: relative;
grid-row-gap: 1rem;
grid-column-gap: 2rem;
pointer-events: none;
justify-items: start;
grid-template-columns: auto auto;
grid-template-areas:
'title'
'back'
'archive'
'github'
'demos'
'tags'
'sponsor';
#cdawrap {
justify-self: start;
grid-area: sponsor;
}
a,
button {
pointer-events: auto;
}
.frame__title {
grid-area: title;
font-size: inherit;
margin: 0;
}
.frame__back {
grid-area: back;
justify-self: start;
}
.frame__archive {
grid-area: archive;
justify-self: start;
}
.frame__github {
grid-area: github;
}
.frame__tags {
grid-area: tags;
display: flex;
flex-wrap: wrap;
gap: 1rem;
}
.frame__demos {
grid-area: demos;
display: flex;
flex-wrap: wrap;
gap: 1rem;
}
@media screen and (min-width: 53em) {
padding: var(--page-padding);
height: 100%;
position: fixed;
top: 0;
left: 0;
width: 100%;
grid-template-columns: auto auto auto auto 1fr;
grid-template-rows: auto auto;
align-content: space-between;
grid-template-areas:
'title back github archive demos'
'tags tags tags sponsor sponsor';
.frame__tags {
align-self: end;
}
.frame__demos,
#cdawrap {
justify-self: end;
text-align: right;
max-width: 300px;
}
}
}
.content {
padding: var(--page-padding);
display: flex;
flex-direction: column;
width: 100vw;
position: relative;
@media screen and (min-width: 53em) {
min-height: 100vh;
justify-content: center;
align-items: center;
}
}
main {
position: fixed;
display: none;
z-index: 9999;
pointer-events: none;
}
static/basis/basis_transcoder.js
var BASIS = (function() {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(BASIS) {
BASIS = BASIS || {};
var Module=typeof BASIS!=="undefined"?BASIS:{};var readyPromiseResolve,readyPromiseReject;Module["ready"]=new Promise(function(resolve,reject){readyPromiseResolve=resolve;readyPromiseReject=reject});var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var arguments_=[];var thisProgram="./this.program";var quit_=function(status,toThrow){throw toThrow};var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string";ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;var nodeFS;var nodePath;if(ENVIRONMENT_IS_NODE){if(ENVIRONMENT_IS_WORKER){scriptDirectory=require("path").dirname(scriptDirectory)+"/"}else{scriptDirectory=__dirname+"/"}read_=function shell_read(filename,binary){if(!nodeFS)nodeFS=require("fs");if(!nodePath)nodePath=require("path");filename=nodePath["normalize"](filename);return nodeFS["readFileSync"](filename,binary?null:"utf8")};readBinary=function readBinary(filename){var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret};if(process["argv"].length>1){thisProgram=process["argv"][1].replace(/\\/g,"/")}arguments_=process["argv"].slice(2);process["on"]("uncaughtException",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});process["on"]("unhandledRejection",abort);quit_=function(status){process["exit"](status)};Module["inspect"]=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_SHELL){if(typeof read!="undefined"){read_=function shell_read(f){return read(f)}}readBinary=function readBinary(f){var data;if(typeof readbuffer==="function"){return new Uint8Array(readbuffer(f))}data=read(f,"binary");assert(typeof data==="object");return data};if(typeof scriptArgs!="undefined"){arguments_=scriptArgs}else if(typeof arguments!="undefined"){arguments_=arguments}if(typeof quit==="function"){quit_=function(status){quit(status)}}if(typeof print!=="undefined"){if(typeof console==="undefined")console={};console.log=print;console.warn=console.error=typeof printErr!=="undefined"?printErr:print}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!=="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(_scriptDir){scriptDirectory=_scriptDir}if(scriptDirectory.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=function shell_read(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=function readBinary(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=function readAsync(url,onload,onerror){var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=function xhr_onload(){if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=function(title){document.title=title}}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);for(key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var tempRet0=0;var setTempRet0=function(value){tempRet0=value};var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var noExitRuntime;if(Module["noExitRuntime"])noExitRuntime=Module["noExitRuntime"];if(typeof WebAssembly!=="object"){abort("no native wasm support detected")}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort("Assertion failed: "+text)}}var UTF8Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf8"):undefined;function UTF8ArrayToString(heap,idx,maxBytesToRead){var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heap[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heap.subarray&&UTF8Decoder){return UTF8Decoder.decode(heap.subarray(idx,endPtr))}else{var str="";while(idx<endPtr){var u0=heap[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heap[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heap[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u0=(u0&7)<<18|u1<<12|u2<<6|heap[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}function stringToUTF8Array(str,heap,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i<str.length;++i){var u=str.charCodeAt(i);if(u>=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i<str.length;++i){var u=str.charCodeAt(i);if(u>=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127)++len;else if(u<=2047)len+=2;else if(u<=65535)len+=3;else len+=4}return len}var UTF16Decoder=typeof TextDecoder!=="undefined"?new TextDecoder("utf-16le"):undefined;function UTF16ToString(ptr,maxBytesToRead){var endPtr=ptr;var idx=endPtr>>1;var maxIdx=idx+maxBytesToRead/2;while(!(idx>=maxIdx)&&HEAPU16[idx])++idx;endPtr=idx<<1;if(endPtr-ptr>32&&UTF16Decoder){return UTF16Decoder.decode(HEAPU8.subarray(ptr,endPtr))}else{var str="";for(var i=0;!(i>=maxBytesToRead/2);++i){var codeUnit=HEAP16[ptr+i*2>>1];if(codeUnit==0)break;str+=String.fromCharCode(codeUnit)}return str}}function stringToUTF16(str,outPtr,maxBytesToWrite){if(maxBytesToWrite===undefined){maxBytesToWrite=2147483647}if(maxBytesToWrite<2)return 0;maxBytesToWrite-=2;var startPtr=outPtr;var numCharsToWrite=maxBytesToWrite<str.length*2?maxBytesToWrite/2:str.length;for(var i=0;i<numCharsToWrite;++i){var codeUnit=str.charCodeAt(i);HEAP16[outPtr>>1]=codeUnit;outPtr+=2}HEAP16[outPtr>>1]=0;return outPtr-startPtr}function lengthBytesUTF16(str){return str.length*2}function UTF32ToString(ptr,maxBytesToRead){var i=0;var str="";while(!(i>=maxBytesToRead/4)){var utf32=HEAP32[ptr+i*4>>2];if(utf32==0)break;++i;if(utf32>=65536){var ch=utf32-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}else{str+=String.fromCharCode(utf32)}}return str}function stringToUTF32(str,outPtr,maxBytesToWrite){if(maxBytesToWrite===undefined){maxBytesToWrite=2147483647}if(maxBytesToWrite<4)return 0;var startPtr=outPtr;var endPtr=startPtr+maxBytesToWrite-4;for(var i=0;i<str.length;++i){var codeUnit=str.charCodeAt(i);if(codeUnit>=55296&&codeUnit<=57343){var trailSurrogate=str.charCodeAt(++i);codeUnit=65536+((codeUnit&1023)<<10)|trailSurrogate&1023}HEAP32[outPtr>>2]=codeUnit;outPtr+=4;if(outPtr+4>endPtr)break}HEAP32[outPtr>>2]=0;return outPtr-startPtr}function lengthBytesUTF32(str){var len=0;for(var i=0;i<str.length;++i){var codeUnit=str.charCodeAt(i);if(codeUnit>=55296&&codeUnit<=57343)++i;len+=4}return len}function alignUp(x,multiple){if(x%multiple>0){x+=multiple-x%multiple}return x}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferAndViews(buf){buffer=buf;Module["HEAP8"]=HEAP8=new Int8Array(buf);Module["HEAP16"]=HEAP16=new Int16Array(buf);Module["HEAP32"]=HEAP32=new Int32Array(buf);Module["HEAPU8"]=HEAPU8=new Uint8Array(buf);Module["HEAPU16"]=HEAPU16=new Uint16Array(buf);Module["HEAPU32"]=HEAPU32=new Uint32Array(buf);Module["HEAPF32"]=HEAPF32=new Float32Array(buf);Module["HEAPF64"]=HEAPF64=new Float64Array(buf)}var INITIAL_MEMORY=Module["INITIAL_MEMORY"]||16777216;var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}Module["preloadedImages"]={};Module["preloadedAudios"]={};function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what+="";err(what);ABORT=true;EXITSTATUS=1;what="abort("+what+"). Build with -s ASSERTIONS=1 for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}function hasPrefix(str,prefix){return String.prototype.startsWith?str.startsWith(prefix):str.indexOf(prefix)===0}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return hasPrefix(filename,dataURIPrefix)}var fileURIPrefix="file://";function isFileURI(filename){return hasPrefix(filename,fileURIPrefix)}var wasmBinaryFile="basis_transcoder.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(){try{if(wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(wasmBinaryFile)}else{throw"both async and sync fetching of the wasm failed"}}catch(err){abort(err)}}function getBinaryPromise(){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)&&typeof fetch==="function"&&!isFileURI(wasmBinaryFile)){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+wasmBinaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary()})}return Promise.resolve().then(getBinary)}function createWasm(){var info={"a":asmLibraryArg};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;wasmMemory=Module["asm"]["K"];updateGlobalBufferAndViews(wasmMemory.buffer);wasmTable=Module["asm"]["L"];removeRunDependency("wasm-instantiate")}addRunDependency("wasm-instantiate");function receiveInstantiatedSource(output){receiveInstance(output["instance"])}function instantiateArrayBuffer(receiver){return getBinaryPromise().then(function(binary){return WebAssembly.instantiate(binary,info)}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(){if(!wasmBinary&&typeof WebAssembly.instantiateStreaming==="function"&&!isDataURI(wasmBinaryFile)&&!isFileURI(wasmBinaryFile)&&typeof fetch==="function"){return fetch(wasmBinaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,info);return result.then(receiveInstantiatedSource,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(receiveInstantiatedSource)})})}else{return instantiateArrayBuffer(receiveInstantiatedSource)}}if(Module["instantiateWasm"]){try{var exports=Module["instantiateWasm"](info,receiveInstance);return exports}catch(e){err("Module.instantiateWasm callback failed with error: "+e);return false}}instantiateAsync().catch(readyPromiseReject);return{}}function callRuntimeCallbacks(callbacks){while(callbacks.length>0){var callback=callbacks.shift();if(typeof callback=="function"){callback(Module);continue}var func=callback.func;if(typeof func==="number"){if(callback.arg===undefined){wasmTable.get(func)()}else{wasmTable.get(func)(callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}var structRegistrations={};function runDestructors(destructors){while(destructors.length){var ptr=destructors.pop();var del=destructors.pop();del(ptr)}}function simpleReadValueFromPointer(pointer){return this["fromWireType"](HEAPU32[pointer>>2])}var awaitingDependencies={};var registeredTypes={};var typeDependencies={};var char_0=48;var char_9=57;function makeLegalFunctionName(name){if(undefined===name){return"_unknown"}name=name.replace(/[^a-zA-Z0-9_]/g,"$");var f=name.charCodeAt(0);if(f>=char_0&&f<=char_9){return"_"+name}else{return name}}function createNamedFunction(name,body){name=makeLegalFunctionName(name);return new Function("body","return function "+name+"() {\n"+' "use strict";'+" return body.apply(this, arguments);\n"+"};\n")(body)}function extendError(baseErrorType,errorName){var errorClass=createNamedFunction(errorName,function(message){this.name=errorName;this.message=message;var stack=new Error(message).stack;if(stack!==undefined){this.stack=this.toString()+"\n"+stack.replace(/^Error(:[^\n]*)?\n/,"")}});errorClass.prototype=Object.create(baseErrorType.prototype);errorClass.prototype.constructor=errorClass;errorClass.prototype.toString=function(){if(this.message===undefined){return this.name}else{return this.name+": "+this.message}};return errorClass}var InternalError=undefined;function throwInternalError(message){throw new InternalError(message)}function whenDependentTypesAreResolved(myTypes,dependentTypes,getTypeConverters){myTypes.forEach(function(type){typeDependencies[type]=dependentTypes});function onComplete(typeConverters){var myTypeConverters=getTypeConverters(typeConverters);if(myTypeConverters.length!==myTypes.length){throwInternalError("Mismatched type converter count")}for(var i=0;i<myTypes.length;++i){registerType(myTypes[i],myTypeConverters[i])}}var typeConverters=new Array(dependentTypes.length);var unregisteredTypes=[];var registered=0;dependentTypes.forEach(function(dt,i){if(registeredTypes.hasOwnProperty(dt)){typeConverters[i]=registeredTypes[dt]}else{unregisteredTypes.push(dt);if(!awaitingDependencies.hasOwnProperty(dt)){awaitingDependencies[dt]=[]}awaitingDependencies[dt].push(function(){typeConverters[i]=registeredTypes[dt];++registered;if(registered===unregisteredTypes.length){onComplete(typeConverters)}})}});if(0===unregisteredTypes.length){onComplete(typeConverters)}}function __embind_finalize_value_object(structType){var reg=structRegistrations[structType];delete structRegistrations[structType];var rawConstructor=reg.rawConstructor;var rawDestructor=reg.rawDestructor;var fieldRecords=reg.fields;var fieldTypes=fieldRecords.map(function(field){return field.getterReturnType}).concat(fieldRecords.map(function(field){return field.setterArgumentType}));whenDependentTypesAreResolved([structType],fieldTypes,function(fieldTypes){var fields={};fieldRecords.forEach(function(field,i){var fieldName=field.fieldName;var getterReturnType=fieldTypes[i];var getter=field.getter;var getterContext=field.getterContext;var setterArgumentType=fieldTypes[i+fieldRecords.length];var setter=field.setter;var setterContext=field.setterContext;fields[fieldName]={read:function(ptr){return getterReturnType["fromWireType"](getter(getterContext,ptr))},write:function(ptr,o){var destructors=[];setter(setterContext,ptr,setterArgumentType["toWireType"](destructors,o));runDestructors(destructors)}}});return[{name:reg.name,"fromWireType":function(ptr){var rv={};for(var i in fields){rv[i]=fields[i].read(ptr)}rawDestructor(ptr);return rv},"toWireType":function(destructors,o){for(var fieldName in fields){if(!(fieldName in o)){throw new TypeError('Missing field: "'+fieldName+'"')}}var ptr=rawConstructor();for(fieldName in fields){fields[fieldName].write(ptr,o[fieldName])}if(destructors!==null){destructors.push(rawDestructor,ptr)}return ptr},"argPackAdvance":8,"readValueFromPointer":simpleReadValueFromPointer,destructorFunction:rawDestructor}]})}function getShiftFromSize(size){switch(size){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+size)}}function embind_init_charCodes(){var codes=new Array(256);for(var i=0;i<256;++i){codes[i]=String.fromCharCode(i)}embind_charCodes=codes}var embind_charCodes=undefined;function readLatin1String(ptr){var ret="";var c=ptr;while(HEAPU8[c]){ret+=embind_charCodes[HEAPU8[c++]]}return ret}var BindingError=undefined;function throwBindingError(message){throw new BindingError(message)}function registerType(rawType,registeredInstance,options){options=options||{};if(!("argPackAdvance"in registeredInstance)){throw new TypeError("registerType registeredInstance requires argPackAdvance")}var name=registeredInstance.name;if(!rawType){throwBindingError('type "'+name+'" must have a positive integer typeid pointer')}if(registeredTypes.hasOwnProperty(rawType)){if(options.ignoreDuplicateRegistrations){return}else{throwBindingError("Cannot register type '"+name+"' twice")}}registeredTypes[rawType]=registeredInstance;delete typeDependencies[rawType];if(awaitingDependencies.hasOwnProperty(rawType)){var callbacks=awaitingDependencies[rawType];delete awaitingDependencies[rawType];callbacks.forEach(function(cb){cb()})}}function __embind_register_bool(rawType,name,size,trueValue,falseValue){var shift=getShiftFromSize(size);name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":function(wt){return!!wt},"toWireType":function(destructors,o){return o?trueValue:falseValue},"argPackAdvance":8,"readValueFromPointer":function(pointer){var heap;if(size===1){heap=HEAP8}else if(size===2){heap=HEAP16}else if(size===4){heap=HEAP32}else{throw new TypeError("Unknown boolean type size: "+name)}return this["fromWireType"](heap[pointer>>shift])},destructorFunction:null})}function ClassHandle_isAliasOf(other){if(!(this instanceof ClassHandle)){return false}if(!(other instanceof ClassHandle)){return false}var leftClass=this.$$.ptrType.registeredClass;var left=this.$$.ptr;var rightClass=other.$$.ptrType.registeredClass;var right=other.$$.ptr;while(leftClass.baseClass){left=leftClass.upcast(left);leftClass=leftClass.baseClass}while(rightClass.baseClass){right=rightClass.upcast(right);rightClass=rightClass.baseClass}return leftClass===rightClass&&left===right}function shallowCopyInternalPointer(o){return{count:o.count,deleteScheduled:o.deleteScheduled,preservePointerOnDelete:o.preservePointerOnDelete,ptr:o.ptr,ptrType:o.ptrType,smartPtr:o.smartPtr,smartPtrType:o.smartPtrType}}function throwInstanceAlreadyDeleted(obj){function getInstanceTypeName(handle){return handle.$$.ptrType.registeredClass.name}throwBindingError(getInstanceTypeName(obj)+" instance already deleted")}var finalizationGroup=false;function detachFinalizer(handle){}function runDestructor($$){if($$.smartPtr){$$.smartPtrType.rawDestructor($$.smartPtr)}else{$$.ptrType.registeredClass.rawDestructor($$.ptr)}}function releaseClassHandle($$){$$.count.value-=1;var toDelete=0===$$.count.value;if(toDelete){runDestructor($$)}}function attachFinalizer(handle){if("undefined"===typeof FinalizationGroup){attachFinalizer=function(handle){return handle};return handle}finalizationGroup=new FinalizationGroup(function(iter){for(var result=iter.next();!result.done;result=iter.next()){var $$=result.value;if(!$$.ptr){console.warn("object already deleted: "+$$.ptr)}else{releaseClassHandle($$)}}});attachFinalizer=function(handle){finalizationGroup.register(handle,handle.$$,handle.$$);return handle};detachFinalizer=function(handle){finalizationGroup.unregister(handle.$$)};return attachFinalizer(handle)}function ClassHandle_clone(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.preservePointerOnDelete){this.$$.count.value+=1;return this}else{var clone=attachFinalizer(Object.create(Object.getPrototypeOf(this),{$$:{value:shallowCopyInternalPointer(this.$$)}}));clone.$$.count.value+=1;clone.$$.deleteScheduled=false;return clone}}function ClassHandle_delete(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete){throwBindingError("Object already scheduled for deletion")}detachFinalizer(this);releaseClassHandle(this.$$);if(!this.$$.preservePointerOnDelete){this.$$.smartPtr=undefined;this.$$.ptr=undefined}}function ClassHandle_isDeleted(){return!this.$$.ptr}var delayFunction=undefined;var deletionQueue=[];function flushPendingDeletes(){while(deletionQueue.length){var obj=deletionQueue.pop();obj.$$.deleteScheduled=false;obj["delete"]()}}function ClassHandle_deleteLater(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete){throwBindingError("Object already scheduled for deletion")}deletionQueue.push(this);if(deletionQueue.length===1&&delayFunction){delayFunction(flushPendingDeletes)}this.$$.deleteScheduled=true;return this}function init_ClassHandle(){ClassHandle.prototype["isAliasOf"]=ClassHandle_isAliasOf;ClassHandle.prototype["clone"]=ClassHandle_clone;ClassHandle.prototype["delete"]=ClassHandle_delete;ClassHandle.prototype["isDeleted"]=ClassHandle_isDeleted;ClassHandle.prototype["deleteLater"]=ClassHandle_deleteLater}function ClassHandle(){}var registeredPointers={};function ensureOverloadTable(proto,methodName,humanName){if(undefined===proto[methodName].overloadTable){var prevFunc=proto[methodName];proto[methodName]=function(){if(!proto[methodName].overloadTable.hasOwnProperty(arguments.length)){throwBindingError("Function '"+humanName+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+proto[methodName].overloadTable+")!")}return proto[methodName].overloadTable[arguments.length].apply(this,arguments)};proto[methodName].overloadTable=[];proto[methodName].overloadTable[prevFunc.argCount]=prevFunc}}function exposePublicSymbol(name,value,numArguments){if(Module.hasOwnProperty(name)){if(undefined===numArguments||undefined!==Module[name].overloadTable&&undefined!==Module[name].overloadTable[numArguments]){throwBindingError("Cannot register public name '"+name+"' twice")}ensureOverloadTable(Module,name,name);if(Module.hasOwnProperty(numArguments)){throwBindingError("Cannot register multiple overloads of a function with the same number of arguments ("+numArguments+")!")}Module[name].overloadTable[numArguments]=value}else{Module[name]=value;if(undefined!==numArguments){Module[name].numArguments=numArguments}}}function RegisteredClass(name,constructor,instancePrototype,rawDestructor,baseClass,getActualType,upcast,downcast){this.name=name;this.constructor=constructor;this.instancePrototype=instancePrototype;this.rawDestructor=rawDestructor;this.baseClass=baseClass;this.getActualType=getActualType;this.upcast=upcast;this.downcast=downcast;this.pureVirtualFunctions=[]}function upcastPointer(ptr,ptrClass,desiredClass){while(ptrClass!==desiredClass){if(!ptrClass.upcast){throwBindingError("Expected null or instance of "+desiredClass.name+", got an instance of "+ptrClass.name)}ptr=ptrClass.upcast(ptr);ptrClass=ptrClass.baseClass}return ptr}function constNoSmartPtrRawPointerToWireType(destructors,handle){if(handle===null){if(this.isReference){throwBindingError("null is not a valid "+this.name)}return 0}if(!handle.$$){throwBindingError('Cannot pass "'+_embind_repr(handle)+'" as a '+this.name)}if(!handle.$$.ptr){throwBindingError("Cannot pass deleted object as a pointer of type "+this.name)}var handleClass=handle.$$.ptrType.registeredClass;var ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);return ptr}function genericPointerToWireType(destructors,handle){var ptr;if(handle===null){if(this.isReference){throwBindingError("null is not a valid "+this.name)}if(this.isSmartPointer){ptr=this.rawConstructor();if(destructors!==null){destructors.push(this.rawDestructor,ptr)}return ptr}else{return 0}}if(!handle.$$){throwBindingError('Cannot pass "'+_embind_repr(handle)+'" as a '+this.name)}if(!handle.$$.ptr){throwBindingError("Cannot pass deleted object as a pointer of type "+this.name)}if(!this.isConst&&handle.$$.ptrType.isConst){throwBindingError("Cannot convert argument of type "+(handle.$$.smartPtrType?handle.$$.smartPtrType.name:handle.$$.ptrType.name)+" to parameter type "+this.name)}var handleClass=handle.$$.ptrType.registeredClass;ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);if(this.isSmartPointer){if(undefined===handle.$$.smartPtr){throwBindingError("Passing raw pointer to smart pointer is illegal")}switch(this.sharingPolicy){case 0:if(handle.$$.smartPtrType===this){ptr=handle.$$.smartPtr}else{throwBindingError("Cannot convert argument of type "+(handle.$$.smartPtrType?handle.$$.smartPtrType.name:handle.$$.ptrType.name)+" to parameter type "+this.name)}break;case 1:ptr=handle.$$.smartPtr;break;case 2:if(handle.$$.smartPtrType===this){ptr=handle.$$.smartPtr}else{var clonedHandle=handle["clone"]();ptr=this.rawShare(ptr,__emval_register(function(){clonedHandle["delete"]()}));if(destructors!==null){destructors.push(this.rawDestructor,ptr)}}break;default:throwBindingError("Unsupporting sharing policy")}}return ptr}function nonConstNoSmartPtrRawPointerToWireType(destructors,handle){if(handle===null){if(this.isReference){throwBindingError("null is not a valid "+this.name)}return 0}if(!handle.$$){throwBindingError('Cannot pass "'+_embind_repr(handle)+'" as a '+this.name)}if(!handle.$$.ptr){throwBindingError("Cannot pass deleted object as a pointer of type "+this.name)}if(handle.$$.ptrType.isConst){throwBindingError("Cannot convert argument of type "+handle.$$.ptrType.name+" to parameter type "+this.name)}var handleClass=handle.$$.ptrType.registeredClass;var ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);return ptr}function RegisteredPointer_getPointee(ptr){if(this.rawGetPointee){ptr=this.rawGetPointee(ptr)}return ptr}function RegisteredPointer_destructor(ptr){if(this.rawDestructor){this.rawDestructor(ptr)}}function RegisteredPointer_deleteObject(handle){if(handle!==null){handle["delete"]()}}function downcastPointer(ptr,ptrClass,desiredClass){if(ptrClass===desiredClass){return ptr}if(undefined===desiredClass.baseClass){return null}var rv=downcastPointer(ptr,ptrClass,desiredClass.baseClass);if(rv===null){return null}return desiredClass.downcast(rv)}function getInheritedInstanceCount(){return Object.keys(registeredInstances).length}function getLiveInheritedInstances(){var rv=[];for(var k in registeredInstances){if(registeredInstances.hasOwnProperty(k)){rv.push(registeredInstances[k])}}return rv}function setDelayFunction(fn){delayFunction=fn;if(deletionQueue.length&&delayFunction){delayFunction(flushPendingDeletes)}}function init_embind(){Module["getInheritedInstanceCount"]=getInheritedInstanceCount;Module["getLiveInheritedInstances"]=getLiveInheritedInstances;Module["flushPendingDeletes"]=flushPendingDeletes;Module["setDelayFunction"]=setDelayFunction}var registeredInstances={};function getBasestPointer(class_,ptr){if(ptr===undefined){throwBindingError("ptr should not be undefined")}while(class_.baseClass){ptr=class_.upcast(ptr);class_=class_.baseClass}return ptr}function getInheritedInstance(class_,ptr){ptr=getBasestPointer(class_,ptr);return registeredInstances[ptr]}function makeClassHandle(prototype,record){if(!record.ptrType||!record.ptr){throwInternalError("makeClassHandle requires ptr and ptrType")}var hasSmartPtrType=!!record.smartPtrType;var hasSmartPtr=!!record.smartPtr;if(hasSmartPtrType!==hasSmartPtr){throwInternalError("Both smartPtrType and smartPtr must be specified")}record.count={value:1};return attachFinalizer(Object.create(prototype,{$$:{value:record}}))}function RegisteredPointer_fromWireType(ptr){var rawPointer=this.getPointee(ptr);if(!rawPointer){this.destructor(ptr);return null}var registeredInstance=getInheritedInstance(this.registeredClass,rawPointer);if(undefined!==registeredInstance){if(0===registeredInstance.$$.count.value){registeredInstance.$$.ptr=rawPointer;registeredInstance.$$.smartPtr=ptr;return registeredInstance["clone"]()}else{var rv=registeredInstance["clone"]();this.destructor(ptr);return rv}}function makeDefaultHandle(){if(this.isSmartPointer){return makeClassHandle(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:rawPointer,smartPtrType:this,smartPtr:ptr})}else{return makeClassHandle(this.registeredClass.instancePrototype,{ptrType:this,ptr:ptr})}}var actualType=this.registeredClass.getActualType(rawPointer);var registeredPointerRecord=registeredPointers[actualType];if(!registeredPointerRecord){return makeDefaultHandle.call(this)}var toType;if(this.isConst){toType=registeredPointerRecord.constPointerType}else{toType=registeredPointerRecord.pointerType}var dp=downcastPointer(rawPointer,this.registeredClass,toType.registeredClass);if(dp===null){return makeDefaultHandle.call(this)}if(this.isSmartPointer){return makeClassHandle(toType.registeredClass.instancePrototype,{ptrType:toType,ptr:dp,smartPtrType:this,smartPtr:ptr})}else{return makeClassHandle(toType.registeredClass.instancePrototype,{ptrType:toType,ptr:dp})}}function init_RegisteredPointer(){RegisteredPointer.prototype.getPointee=RegisteredPointer_getPointee;RegisteredPointer.prototype.destructor=RegisteredPointer_destructor;RegisteredPointer.prototype["argPackAdvance"]=8;RegisteredPointer.prototype["readValueFromPointer"]=simpleReadValueFromPointer;RegisteredPointer.prototype["deleteObject"]=RegisteredPointer_deleteObject;RegisteredPointer.prototype["fromWireType"]=RegisteredPointer_fromWireType}function RegisteredPointer(name,registeredClass,isReference,isConst,isSmartPointer,pointeeType,sharingPolicy,rawGetPointee,rawConstructor,rawShare,rawDestructor){this.name=name;this.registeredClass=registeredClass;this.isReference=isReference;this.isConst=isConst;this.isSmartPointer=isSmartPointer;this.pointeeType=pointeeType;this.sharingPolicy=sharingPolicy;this.rawGetPointee=rawGetPointee;this.rawConstructor=rawConstructor;this.rawShare=rawShare;this.rawDestructor=rawDestructor;if(!isSmartPointer&®isteredClass.baseClass===undefined){if(isConst){this["toWireType"]=constNoSmartPtrRawPointerToWireType;this.destructorFunction=null}else{this["toWireType"]=nonConstNoSmartPtrRawPointerToWireType;this.destructorFunction=null}}else{this["toWireType"]=genericPointerToWireType}}function replacePublicSymbol(name,value,numArguments){if(!Module.hasOwnProperty(name)){throwInternalError("Replacing nonexistant public symbol")}if(undefined!==Module[name].overloadTable&&undefined!==numArguments){Module[name].overloadTable[numArguments]=value}else{Module[name]=value;Module[name].argCount=numArguments}}function dynCallLegacy(sig,ptr,args){if(args&&args.length){return Module["dynCall_"+sig].apply(null,[ptr].concat(args))}return Module["dynCall_"+sig].call(null,ptr)}function dynCall(sig,ptr,args){if(sig.indexOf("j")!=-1){return dynCallLegacy(sig,ptr,args)}return wasmTable.get(ptr).apply(null,args)}function getDynCaller(sig,ptr){assert(sig.indexOf("j")>=0,"getDynCaller should only be called with i64 sigs");var argCache=[];return function(){argCache.length=arguments.length;for(var i=0;i<arguments.length;i++){argCache[i]=arguments[i]}return dynCall(sig,ptr,argCache)}}function embind__requireFunction(signature,rawFunction){signature=readLatin1String(signature);function makeDynCaller(){if(signature.indexOf("j")!=-1){return getDynCaller(signature,rawFunction)}return wasmTable.get(rawFunction)}var fp=makeDynCaller();if(typeof fp!=="function"){throwBindingError("unknown function pointer with signature "+signature+": "+rawFunction)}return fp}var UnboundTypeError=undefined;function getTypeName(type){var ptr=___getTypeName(type);var rv=readLatin1String(ptr);_free(ptr);return rv}function throwUnboundTypeError(message,types){var unboundTypes=[];var seen={};function visit(type){if(seen[type]){return}if(registeredTypes[type]){return}if(typeDependencies[type]){typeDependencies[type].forEach(visit);return}unboundTypes.push(type);seen[type]=true}types.forEach(visit);throw new UnboundTypeError(message+": "+unboundTypes.map(getTypeName).join([", "]))}function __embind_register_class(rawType,rawPointerType,rawConstPointerType,baseClassRawType,getActualTypeSignature,getActualType,upcastSignature,upcast,downcastSignature,downcast,name,destructorSignature,rawDestructor){name=readLatin1String(name);getActualType=embind__requireFunction(getActualTypeSignature,getActualType);if(upcast){upcast=embind__requireFunction(upcastSignature,upcast)}if(downcast){downcast=embind__requireFunction(downcastSignature,downcast)}rawDestructor=embind__requireFunction(destructorSignature,rawDestructor);var legalFunctionName=makeLegalFunctionName(name);exposePublicSymbol(legalFunctionName,function(){throwUnboundTypeError("Cannot construct "+name+" due to unbound types",[baseClassRawType])});whenDependentTypesAreResolved([rawType,rawPointerType,rawConstPointerType],baseClassRawType?[baseClassRawType]:[],function(base){base=base[0];var baseClass;var basePrototype;if(baseClassRawType){baseClass=base.registeredClass;basePrototype=baseClass.instancePrototype}else{basePrototype=ClassHandle.prototype}var constructor=createNamedFunction(legalFunctionName,function(){if(Object.getPrototypeOf(this)!==instancePrototype){throw new BindingError("Use 'new' to construct "+name)}if(undefined===registeredClass.constructor_body){throw new BindingError(name+" has no accessible constructor")}var body=registeredClass.constructor_body[arguments.length];if(undefined===body){throw new BindingError("Tried to invoke ctor of "+name+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(registeredClass.constructor_body).toString()+") parameters instead!")}return body.apply(this,arguments)});var instancePrototype=Object.create(basePrototype,{constructor:{value:constructor}});constructor.prototype=instancePrototype;var registeredClass=new RegisteredClass(name,constructor,instancePrototype,rawDestructor,baseClass,getActualType,upcast,downcast);var referenceConverter=new RegisteredPointer(name,registeredClass,true,false,false);var pointerConverter=new RegisteredPointer(name+"*",registeredClass,false,false,false);var constPointerConverter=new RegisteredPointer(name+" const*",registeredClass,false,true,false);registeredPointers[rawType]={pointerType:pointerConverter,constPointerType:constPointerConverter};replacePublicSymbol(legalFunctionName,constructor);return[referenceConverter,pointerConverter,constPointerConverter]})}function heap32VectorToArray(count,firstElement){var array=[];for(var i=0;i<count;i++){array.push(HEAP32[(firstElement>>2)+i])}return array}function __embind_register_class_constructor(rawClassType,argCount,rawArgTypesAddr,invokerSignature,invoker,rawConstructor){assert(argCount>0);var rawArgTypes=heap32VectorToArray(argCount,rawArgTypesAddr);invoker=embind__requireFunction(invokerSignature,invoker);var args=[rawConstructor];var destructors=[];whenDependentTypesAreResolved([],[rawClassType],function(classType){classType=classType[0];var humanName="constructor "+classType.name;if(undefined===classType.registeredClass.constructor_body){classType.registeredClass.constructor_body=[]}if(undefined!==classType.registeredClass.constructor_body[argCount-1]){throw new BindingError("Cannot register multiple constructors with identical number of parameters ("+(argCount-1)+") for class '"+classType.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!")}classType.registeredClass.constructor_body[argCount-1]=function unboundTypeHandler(){throwUnboundTypeError("Cannot construct "+classType.name+" due to unbound types",rawArgTypes)};whenDependentTypesAreResolved([],rawArgTypes,function(argTypes){classType.registeredClass.constructor_body[argCount-1]=function constructor_body(){if(arguments.length!==argCount-1){throwBindingError(humanName+" called with "+arguments.length+" arguments, expected "+(argCount-1))}destructors.length=0;args.length=argCount;for(var i=1;i<argCount;++i){args[i]=argTypes[i]["toWireType"](destructors,arguments[i-1])}var ptr=invoker.apply(null,args);runDestructors(destructors);return argTypes[0]["fromWireType"](ptr)};return[]});return[]})}function new_(constructor,argumentList){if(!(constructor instanceof Function)){throw new TypeError("new_ called with constructor type "+typeof constructor+" which is not a function")}var dummy=createNamedFunction(constructor.name||"unknownFunctionName",function(){});dummy.prototype=constructor.prototype;var obj=new dummy;var r=constructor.apply(obj,argumentList);return r instanceof Object?r:obj}function craftInvokerFunction(humanName,argTypes,classType,cppInvokerFunc,cppTargetFunc){var argCount=argTypes.length;if(argCount<2){throwBindingError("argTypes array size mismatch! Must at least get return value and 'this' types!")}var isClassMethodFunc=argTypes[1]!==null&&classType!==null;var needsDestructorStack=false;for(var i=1;i<argTypes.length;++i){if(argTypes[i]!==null&&argTypes[i].destructorFunction===undefined){needsDestructorStack=true;break}}var returns=argTypes[0].name!=="void";var argsList="";var argsListWired="";for(var i=0;i<argCount-2;++i){argsList+=(i!==0?", ":"")+"arg"+i;argsListWired+=(i!==0?", ":"")+"arg"+i+"Wired"}var invokerFnBody="return function "+makeLegalFunctionName(humanName)+"("+argsList+") {\n"+"if (arguments.length !== "+(argCount-2)+") {\n"+"throwBindingError('function "+humanName+" called with ' + arguments.length + ' arguments, expected "+(argCount-2)+" args!');\n"+"}\n";if(needsDestructorStack){invokerFnBody+="var destructors = [];\n"}var dtorStack=needsDestructorStack?"destructors":"null";var args1=["throwBindingError","invoker","fn","runDestructors","retType","classParam"];var args2=[throwBindingError,cppInvokerFunc,cppTargetFunc,runDestructors,argTypes[0],argTypes[1]];if(isClassMethodFunc){invokerFnBody+="var thisWired = classParam.toWireType("+dtorStack+", this);\n"}for(var i=0;i<argCount-2;++i){invokerFnBody+="var arg"+i+"Wired = argType"+i+".toWireType("+dtorStack+", arg"+i+"); // "+argTypes[i+2].name+"\n";args1.push("argType"+i);args2.push(argTypes[i+2])}if(isClassMethodFunc){argsListWired="thisWired"+(argsListWired.length>0?", ":"")+argsListWired}invokerFnBody+=(returns?"var rv = ":"")+"invoker(fn"+(argsListWired.length>0?", ":"")+argsListWired+");\n";if(needsDestructorStack){invokerFnBody+="runDestructors(destructors);\n"}else{for(var i=isClassMethodFunc?1:2;i<argTypes.length;++i){var paramName=i===1?"thisWired":"arg"+(i-2)+"Wired";if(argTypes[i].destructorFunction!==null){invokerFnBody+=paramName+"_dtor("+paramName+"); // "+argTypes[i].name+"\n";args1.push(paramName+"_dtor");args2.push(argTypes[i].destructorFunction)}}}if(returns){invokerFnBody+="var ret = retType.fromWireType(rv);\n"+"return ret;\n"}else{}invokerFnBody+="}\n";args1.push(invokerFnBody);var invokerFunction=new_(Function,args1).apply(null,args2);return invokerFunction}function __embind_register_class_function(rawClassType,methodName,argCount,rawArgTypesAddr,invokerSignature,rawInvoker,context,isPureVirtual){var rawArgTypes=heap32VectorToArray(argCount,rawArgTypesAddr);methodName=readLatin1String(methodName);rawInvoker=embind__requireFunction(invokerSignature,rawInvoker);whenDependentTypesAreResolved([],[rawClassType],function(classType){classType=classType[0];var humanName=classType.name+"."+methodName;if(isPureVirtual){classType.registeredClass.pureVirtualFunctions.push(methodName)}function unboundTypesHandler(){throwUnboundTypeError("Cannot call "+humanName+" due to unbound types",rawArgTypes)}var proto=classType.registeredClass.instancePrototype;var method=proto[methodName];if(undefined===method||undefined===method.overloadTable&&method.className!==classType.name&&method.argCount===argCount-2){unboundTypesHandler.argCount=argCount-2;unboundTypesHandler.className=classType.name;proto[methodName]=unboundTypesHandler}else{ensureOverloadTable(proto,methodName,humanName);proto[methodName].overloadTable[argCount-2]=unboundTypesHandler}whenDependentTypesAreResolved([],rawArgTypes,function(argTypes){var memberFunction=craftInvokerFunction(humanName,argTypes,classType,rawInvoker,context);if(undefined===proto[methodName].overloadTable){memberFunction.argCount=argCount-2;proto[methodName]=memberFunction}else{proto[methodName].overloadTable[argCount-2]=memberFunction}return[]});return[]})}function __embind_register_constant(name,type,value){name=readLatin1String(name);whenDependentTypesAreResolved([],[type],function(type){type=type[0];Module[name]=type["fromWireType"](value);return[]})}var emval_free_list=[];var emval_handle_array=[{},{value:undefined},{value:null},{value:true},{value:false}];function __emval_decref(handle){if(handle>4&&0===--emval_handle_array[handle].refcount){emval_handle_array[handle]=undefined;emval_free_list.push(handle)}}function count_emval_handles(){var count=0;for(var i=5;i<emval_handle_array.length;++i){if(emval_handle_array[i]!==undefined){++count}}return count}function get_first_emval(){for(var i=5;i<emval_handle_array.length;++i){if(emval_handle_array[i]!==undefined){return emval_handle_array[i]}}return null}function init_emval(){Module["count_emval_handles"]=count_emval_handles;Module["get_first_emval"]=get_first_emval}function __emval_register(value){switch(value){case undefined:{return 1}case null:{return 2}case true:{return 3}case false:{return 4}default:{var handle=emval_free_list.length?emval_free_list.pop():emval_handle_array.length;emval_handle_array[handle]={refcount:1,value:value};return handle}}}function __embind_register_emval(rawType,name){name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":function(handle){var rv=emval_handle_array[handle].value;__emval_decref(handle);return rv},"toWireType":function(destructors,value){return __emval_register(value)},"argPackAdvance":8,"readValueFromPointer":simpleReadValueFromPointer,destructorFunction:null})}function enumReadValueFromPointer(name,shift,signed){switch(shift){case 0:return function(pointer){var heap=signed?HEAP8:HEAPU8;return this["fromWireType"](heap[pointer])};case 1:return function(pointer){var heap=signed?HEAP16:HEAPU16;return this["fromWireType"](heap[pointer>>1])};case 2:return function(pointer){var heap=signed?HEAP32:HEAPU32;return this["fromWireType"](heap[pointer>>2])};default:throw new TypeError("Unknown integer type: "+name)}}function __embind_register_enum(rawType,name,size,isSigned){var shift=getShiftFromSize(size);name=readLatin1String(name);function ctor(){}ctor.values={};registerType(rawType,{name:name,constructor:ctor,"fromWireType":function(c){return this.constructor.values[c]},"toWireType":function(destructors,c){return c.value},"argPackAdvance":8,"readValueFromPointer":enumReadValueFromPointer(name,shift,isSigned),destructorFunction:null});exposePublicSymbol(name,ctor)}function requireRegisteredType(rawType,humanName){var impl=registeredTypes[rawType];if(undefined===impl){throwBindingError(humanName+" has unknown type "+getTypeName(rawType))}return impl}function __embind_register_enum_value(rawEnumType,name,enumValue){var enumType=requireRegisteredType(rawEnumType,"enum");name=readLatin1String(name);var Enum=enumType.constructor;var Value=Object.create(enumType.constructor.prototype,{value:{value:enumValue},constructor:{value:createNamedFunction(enumType.name+"_"+name,function(){})}});Enum.values[enumValue]=Value;Enum[name]=Value}function _embind_repr(v){if(v===null){return"null"}var t=typeof v;if(t==="object"||t==="array"||t==="function"){return v.toString()}else{return""+v}}function floatReadValueFromPointer(name,shift){switch(shift){case 2:return function(pointer){return this["fromWireType"](HEAPF32[pointer>>2])};case 3:return function(pointer){return this["fromWireType"](HEAPF64[pointer>>3])};default:throw new TypeError("Unknown float type: "+name)}}function __embind_register_float(rawType,name,size){var shift=getShiftFromSize(size);name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":function(value){return value},"toWireType":function(destructors,value){if(typeof value!=="number"&&typeof value!=="boolean"){throw new TypeError('Cannot convert "'+_embind_repr(value)+'" to '+this.name)}return value},"argPackAdvance":8,"readValueFromPointer":floatReadValueFromPointer(name,shift),destructorFunction:null})}function __embind_register_function(name,argCount,rawArgTypesAddr,signature,rawInvoker,fn){var argTypes=heap32VectorToArray(argCount,rawArgTypesAddr);name=readLatin1String(name);rawInvoker=embind__requireFunction(signature,rawInvoker);exposePublicSymbol(name,function(){throwUnboundTypeError("Cannot call "+name+" due to unbound types",argTypes)},argCount-1);whenDependentTypesAreResolved([],argTypes,function(argTypes){var invokerArgsArray=[argTypes[0],null].concat(argTypes.slice(1));replacePublicSymbol(name,craftInvokerFunction(name,invokerArgsArray,null,rawInvoker,fn),argCount-1);return[]})}function integerReadValueFromPointer(name,shift,signed){switch(shift){case 0:return signed?function readS8FromPointer(pointer){return HEAP8[pointer]}:function readU8FromPointer(pointer){return HEAPU8[pointer]};case 1:return signed?function readS16FromPointer(pointer){return HEAP16[pointer>>1]}:function readU16FromPointer(pointer){return HEAPU16[pointer>>1]};case 2:return signed?function readS32FromPointer(pointer){return HEAP32[pointer>>2]}:function readU32FromPointer(pointer){return HEAPU32[pointer>>2]};default:throw new TypeError("Unknown integer type: "+name)}}function __embind_register_integer(primitiveType,name,size,minRange,maxRange){name=readLatin1String(name);if(maxRange===-1){maxRange=4294967295}var shift=getShiftFromSize(size);var fromWireType=function(value){return value};if(minRange===0){var bitshift=32-8*size;fromWireType=function(value){return value<<bitshift>>>bitshift}}var isUnsignedType=name.indexOf("unsigned")!=-1;registerType(primitiveType,{name:name,"fromWireType":fromWireType,"toWireType":function(destructors,value){if(typeof value!=="number"&&typeof value!=="boolean"){throw new TypeError('Cannot convert "'+_embind_repr(value)+'" to '+this.name)}if(value<minRange||value>maxRange){throw new TypeError('Passing a number "'+_embind_repr(value)+'" from JS side to C/C++ side to an argument of type "'+name+'", which is outside the valid range ['+minRange+", "+maxRange+"]!")}return isUnsignedType?value>>>0:value|0},"argPackAdvance":8,"readValueFromPointer":integerReadValueFromPointer(name,shift,minRange!==0),destructorFunction:null})}function __embind_register_memory_view(rawType,dataTypeIndex,name){var typeMapping=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];var TA=typeMapping[dataTypeIndex];function decodeMemoryView(handle){handle=handle>>2;var heap=HEAPU32;var size=heap[handle];var data=heap[handle+1];return new TA(buffer,data,size)}name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":decodeMemoryView,"argPackAdvance":8,"readValueFromPointer":decodeMemoryView},{ignoreDuplicateRegistrations:true})}function __embind_register_std_string(rawType,name){name=readLatin1String(name);var stdStringIsUTF8=name==="std::string";registerType(rawType,{name:name,"fromWireType":function(value){var length=HEAPU32[value>>2];var str;if(stdStringIsUTF8){var decodeStartPtr=value+4;for(var i=0;i<=length;++i){var currentBytePtr=value+4+i;if(i==length||HEAPU8[currentBytePtr]==0){var maxRead=currentBytePtr-decodeStartPtr;var stringSegment=UTF8ToString(decodeStartPtr,maxRead);if(str===undefined){str=stringSegment}else{str+=String.fromCharCode(0);str+=stringSegment}decodeStartPtr=currentBytePtr+1}}}else{var a=new Array(length);for(var i=0;i<length;++i){a[i]=String.fromCharCode(HEAPU8[value+4+i])}str=a.join("")}_free(value);return str},"toWireType":function(destructors,value){if(value instanceof ArrayBuffer){value=new Uint8Array(value)}var getLength;var valueIsOfTypeString=typeof value==="string";if(!(valueIsOfTypeString||value instanceof Uint8Array||value instanceof Uint8ClampedArray||value instanceof Int8Array)){throwBindingError("Cannot pass non-string to std::string")}if(stdStringIsUTF8&&valueIsOfTypeString){getLength=function(){return lengthBytesUTF8(value)}}else{getLength=function(){return value.length}}var length=getLength();var ptr=_malloc(4+length+1);HEAPU32[ptr>>2]=length;if(stdStringIsUTF8&&valueIsOfTypeString){stringToUTF8(value,ptr+4,length+1)}else{if(valueIsOfTypeString){for(var i=0;i<length;++i){var charCode=value.charCodeAt(i);if(charCode>255){_free(ptr);throwBindingError("String has UTF-16 code units that do not fit in 8 bits")}HEAPU8[ptr+4+i]=charCode}}else{for(var i=0;i<length;++i){HEAPU8[ptr+4+i]=value[i]}}}if(destructors!==null){destructors.push(_free,ptr)}return ptr},"argPackAdvance":8,"readValueFromPointer":simpleReadValueFromPointer,destructorFunction:function(ptr){_free(ptr)}})}function __embind_register_std_wstring(rawType,charSize,name){name=readLatin1String(name);var decodeString,encodeString,getHeap,lengthBytesUTF,shift;if(charSize===2){decodeString=UTF16ToString;encodeString=stringToUTF16;lengthBytesUTF=lengthBytesUTF16;getHeap=function(){return HEAPU16};shift=1}else if(charSize===4){decodeString=UTF32ToString;encodeString=stringToUTF32;lengthBytesUTF=lengthBytesUTF32;getHeap=function(){return HEAPU32};shift=2}registerType(rawType,{name:name,"fromWireType":function(value){var length=HEAPU32[value>>2];var HEAP=getHeap();var str;var decodeStartPtr=value+4;for(var i=0;i<=length;++i){var currentBytePtr=value+4+i*charSize;if(i==length||HEAP[currentBytePtr>>shift]==0){var maxReadBytes=currentBytePtr-decodeStartPtr;var stringSegment=decodeString(decodeStartPtr,maxReadBytes);if(str===undefined){str=stringSegment}else{str+=String.fromCharCode(0);str+=stringSegment}decodeStartPtr=currentBytePtr+charSize}}_free(value);return str},"toWireType":function(destructors,value){if(!(typeof value==="string")){throwBindingError("Cannot pass non-string to C++ string type "+name)}var length=lengthBytesUTF(value);var ptr=_malloc(4+length+charSize);HEAPU32[ptr>>2]=length>>shift;encodeString(value,ptr+4,length+charSize);if(destructors!==null){destructors.push(_free,ptr)}return ptr},"argPackAdvance":8,"readValueFromPointer":simpleReadValueFromPointer,destructorFunction:function(ptr){_free(ptr)}})}function __embind_register_value_object(rawType,name,constructorSignature,rawConstructor,destructorSignature,rawDestructor){structRegistrations[rawType]={name:readLatin1String(name),rawConstructor:embind__requireFunction(constructorSignature,rawConstructor),rawDestructor:embind__requireFunction(destructorSignature,rawDestructor),fields:[]}}function __embind_register_value_object_field(structType,fieldName,getterReturnType,getterSignature,getter,getterContext,setterArgumentType,setterSignature,setter,setterContext){structRegistrations[structType].fields.push({fieldName:readLatin1String(fieldName),getterReturnType:getterReturnType,getter:embind__requireFunction(getterSignature,getter),getterContext:getterContext,setterArgumentType:setterArgumentType,setter:embind__requireFunction(setterSignature,setter),setterContext:setterContext})}function __embind_register_void(rawType,name){name=readLatin1String(name);registerType(rawType,{isVoid:true,name:name,"argPackAdvance":0,"fromWireType":function(){return undefined},"toWireType":function(destructors,o){return undefined}})}function requireHandle(handle){if(!handle){throwBindingError("Cannot use deleted val. handle = "+handle)}return emval_handle_array[handle].value}function __emval_as(handle,returnType,destructorsRef){handle=requireHandle(handle);returnType=requireRegisteredType(returnType,"emval::as");var destructors=[];var rd=__emval_register(destructors);HEAP32[destructorsRef>>2]=rd;return returnType["toWireType"](destructors,handle)}var emval_symbols={};function getStringOrSymbol(address){var symbol=emval_symbols[address];if(symbol===undefined){return readLatin1String(address)}else{return symbol}}var emval_methodCallers=[];function __emval_call_void_method(caller,handle,methodName,args){caller=emval_methodCallers[caller];handle=requireHandle(handle);methodName=getStringOrSymbol(methodName);caller(handle,methodName,null,args)}function emval_get_global(){if(typeof globalThis==="object"){return globalThis}return function(){return Function}()("return this")()}function __emval_get_global(name){if(name===0){return __emval_register(emval_get_global())}else{name=getStringOrSymbol(name);return __emval_register(emval_get_global()[name])}}function __emval_addMethodCaller(caller){var id=emval_methodCallers.length;emval_methodCallers.push(caller);return id}function __emval_lookupTypes(argCount,argTypes){var a=new Array(argCount);for(var i=0;i<argCount;++i){a[i]=requireRegisteredType(HEAP32[(argTypes>>2)+i],"parameter "+i)}return a}function __emval_get_method_caller(argCount,argTypes){var types=__emval_lookupTypes(argCount,argTypes);var retType=types[0];var signatureName=retType.name+"_$"+types.slice(1).map(function(t){return t.name}).join("_")+"$";var params=["retType"];var args=[retType];var argsList="";for(var i=0;i<argCount-1;++i){argsList+=(i!==0?", ":"")+"arg"+i;params.push("argType"+i);args.push(types[1+i])}var functionName=makeLegalFunctionName("methodCaller_"+signatureName);var functionBody="return function "+functionName+"(handle, name, destructors, args) {\n";var offset=0;for(var i=0;i<argCount-1;++i){functionBody+=" var arg"+i+" = argType"+i+".readValueFromPointer(args"+(offset?"+"+offset:"")+");\n";offset+=types[i+1]["argPackAdvance"]}functionBody+=" var rv = handle[name]("+argsList+");\n";for(var i=0;i<argCount-1;++i){if(types[i+1]["deleteObject"]){functionBody+=" argType"+i+".deleteObject(arg"+i+");\n"}}if(!retType.isVoid){functionBody+=" return retType.toWireType(destructors, rv);\n"}functionBody+="};\n";params.push(functionBody);var invokerFunction=new_(Function,params).apply(null,args);return __emval_addMethodCaller(invokerFunction)}function __emval_get_module_property(name){name=getStringOrSymbol(name);return __emval_register(Module[name])}function __emval_get_property(handle,key){handle=requireHandle(handle);key=requireHandle(key);return __emval_register(handle[key])}function __emval_incref(handle){if(handle>4){emval_handle_array[handle].refcount+=1}}function craftEmvalAllocator(argCount){var argsList="";for(var i=0;i<argCount;++i){argsList+=(i!==0?", ":"")+"arg"+i}var functionBody="return function emval_allocator_"+argCount+"(constructor, argTypes, args) {\n";for(var i=0;i<argCount;++i){functionBody+="var argType"+i+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+i+'], "parameter '+i+'");\n'+"var arg"+i+" = argType"+i+".readValueFromPointer(args);\n"+"args += argType"+i+"['argPackAdvance'];\n"}functionBody+="var obj = new constructor("+argsList+");\n"+"return __emval_register(obj);\n"+"}\n";return new Function("requireRegisteredType","Module","__emval_register",functionBody)(requireRegisteredType,Module,__emval_register)}var emval_newers={};function __emval_new(handle,argCount,argTypes,args){handle=requireHandle(handle);var newer=emval_newers[argCount];if(!newer){newer=craftEmvalAllocator(argCount);emval_newers[argCount]=newer}return newer(handle,argTypes,args)}function __emval_new_cstring(v){return __emval_register(getStringOrSymbol(v))}function __emval_run_destructors(handle){var destructors=emval_handle_array[handle].value;runDestructors(destructors);__emval_decref(handle)}function _abort(){abort()}function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num)}function _emscripten_get_heap_size(){return HEAPU8.length}function emscripten_realloc_buffer(size){try{wasmMemory.grow(size-buffer.byteLength+65535>>>16);updateGlobalBufferAndViews(wasmMemory.buffer);return 1}catch(e){}}function _emscripten_resize_heap(requestedSize){requestedSize=requestedSize>>>0;var oldSize=_emscripten_get_heap_size();var maxHeapSize=2147483648;if(requestedSize>maxHeapSize){return false}var minHeapSize=16777216;for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignUp(Math.max(minHeapSize,requestedSize,overGrownHeapSize),65536));var replacement=emscripten_realloc_buffer(newSize);if(replacement){return true}}return false}var SYSCALLS={mappings:{},buffers:[null,[],[]],printChar:function(stream,curr){var buffer=SYSCALLS.buffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer,0));buffer.length=0}else{buffer.push(curr)}},varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret},get64:function(low,high){return low}};function _fd_close(fd){return 0}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){}function _fd_write(fd,iov,iovcnt,pnum){var num=0;for(var i=0;i<iovcnt;i++){var ptr=HEAP32[iov+i*8>>2];var len=HEAP32[iov+(i*8+4)>>2];for(var j=0;j<len;j++){SYSCALLS.printChar(fd,HEAPU8[ptr+j])}num+=len}HEAP32[pnum>>2]=num;return 0}function _setTempRet0($i){setTempRet0($i|0)}InternalError=Module["InternalError"]=extendError(Error,"InternalError");embind_init_charCodes();BindingError=Module["BindingError"]=extendError(Error,"BindingError");init_ClassHandle();init_RegisteredPointer();init_embind();UnboundTypeError=Module["UnboundTypeError"]=extendError(Error,"UnboundTypeError");init_emval();__ATINIT__.push({func:function(){___wasm_call_ctors()}});var asmLibraryArg={"t":__embind_finalize_value_object,"I":__embind_register_bool,"x":__embind_register_class,"w":__embind_register_class_constructor,"d":__embind_register_class_function,"k":__embind_register_constant,"H":__embind_register_emval,"n":__embind_register_enum,"a":__embind_register_enum_value,"A":__embind_register_float,"i":__embind_register_function,"j":__embind_register_integer,"h":__embind_register_memory_view,"B":__embind_register_std_string,"v":__embind_register_std_wstring,"u":__embind_register_value_object,"c":__embind_register_value_object_field,"J":__embind_register_void,"m":__emval_as,"s":__emval_call_void_method,"b":__emval_decref,"y":__emval_get_global,"p":__emval_get_method_caller,"r":__emval_get_module_property,"e":__emval_get_property,"g":__emval_incref,"q":__emval_new,"f":__emval_new_cstring,"l":__emval_run_destructors,"o":_abort,"E":_emscripten_memcpy_big,"F":_emscripten_resize_heap,"G":_fd_close,"C":_fd_seek,"z":_fd_write,"D":_setTempRet0};var asm=createWasm();var ___wasm_call_ctors=Module["___wasm_call_ctors"]=function(){return(___wasm_call_ctors=Module["___wasm_call_ctors"]=Module["asm"]["M"]).apply(null,arguments)};var _malloc=Module["_malloc"]=function(){return(_malloc=Module["_malloc"]=Module["asm"]["N"]).apply(null,arguments)};var _free=Module["_free"]=function(){return(_free=Module["_free"]=Module["asm"]["O"]).apply(null,arguments)};var ___getTypeName=Module["___getTypeName"]=function(){return(___getTypeName=Module["___getTypeName"]=Module["asm"]["P"]).apply(null,arguments)};var ___embind_register_native_and_builtin_types=Module["___embind_register_native_and_builtin_types"]=function(){return(___embind_register_native_and_builtin_types=Module["___embind_register_native_and_builtin_types"]=Module["asm"]["Q"]).apply(null,arguments)};var dynCall_jiji=Module["dynCall_jiji"]=function(){return(dynCall_jiji=Module["dynCall_jiji"]=Module["asm"]["R"]).apply(null,arguments)};var calledRun;function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(args){args=args||arguments_;if(runDependencies>0){return}preRun();if(runDependencies>0)return;function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();preMain();readyPromiseResolve(Module);if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}Module["run"]=run;if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}noExitRuntime=true;run();
return BASIS.ready
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = BASIS;
else if (typeof define === 'function' && define['amd'])
define([], function() { return BASIS; });
else if (typeof exports === 'object')
exports["BASIS"] = BASIS;
static/draco/draco_wasm_wrapper.js
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(k){var n=0;return function(){return n<k.length?{done:!1,value:k[n++]}:{done:!0}}};$jscomp.arrayIterator=function(k){return{next:$jscomp.arrayIteratorImpl(k)}};$jscomp.makeIterator=function(k){var n="undefined"!=typeof Symbol&&Symbol.iterator&&k[Symbol.iterator];return n?n.call(k):$jscomp.arrayIterator(k)};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;
$jscomp.ISOLATE_POLYFILLS=!1;$jscomp.FORCE_POLYFILL_PROMISE=!1;$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1;$jscomp.getGlobal=function(k){k=["object"==typeof globalThis&&globalThis,k,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var n=0;n<k.length;++n){var l=k[n];if(l&&l.Math==Math)return l}throw Error("Cannot find global object");};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(k,n,l){if(k==Array.prototype||k==Object.prototype)return k;k[n]=l.value;return k};$jscomp.IS_SYMBOL_NATIVE="function"===typeof Symbol&&"symbol"===typeof Symbol("x");$jscomp.TRUST_ES6_POLYFILLS=!$jscomp.ISOLATE_POLYFILLS||$jscomp.IS_SYMBOL_NATIVE;$jscomp.polyfills={};$jscomp.propertyToPolyfillSymbol={};$jscomp.POLYFILL_PREFIX="$jscp$";
var $jscomp$lookupPolyfilledValue=function(k,n){var l=$jscomp.propertyToPolyfillSymbol[n];if(null==l)return k[n];l=k[l];return void 0!==l?l:k[n]};$jscomp.polyfill=function(k,n,l,p){n&&($jscomp.ISOLATE_POLYFILLS?$jscomp.polyfillIsolated(k,n,l,p):$jscomp.polyfillUnisolated(k,n,l,p))};
$jscomp.polyfillUnisolated=function(k,n,l,p){l=$jscomp.global;k=k.split(".");for(p=0;p<k.length-1;p++){var h=k[p];if(!(h in l))return;l=l[h]}k=k[k.length-1];p=l[k];n=n(p);n!=p&&null!=n&&$jscomp.defineProperty(l,k,{configurable:!0,writable:!0,value:n})};
$jscomp.polyfillIsolated=function(k,n,l,p){var h=k.split(".");k=1===h.length;p=h[0];p=!k&&p in $jscomp.polyfills?$jscomp.polyfills:$jscomp.global;for(var A=0;A<h.length-1;A++){var f=h[A];if(!(f in p))return;p=p[f]}h=h[h.length-1];l=$jscomp.IS_SYMBOL_NATIVE&&"es6"===l?p[h]:null;n=n(l);null!=n&&(k?$jscomp.defineProperty($jscomp.polyfills,h,{configurable:!0,writable:!0,value:n}):n!==l&&(void 0===$jscomp.propertyToPolyfillSymbol[h]&&(l=1E9*Math.random()>>>0,$jscomp.propertyToPolyfillSymbol[h]=$jscomp.IS_SYMBOL_NATIVE?
$jscomp.global.Symbol(h):$jscomp.POLYFILL_PREFIX+l+"$"+h),$jscomp.defineProperty(p,$jscomp.propertyToPolyfillSymbol[h],{configurable:!0,writable:!0,value:n})))};
$jscomp.polyfill("Promise",function(k){function n(){this.batch_=null}function l(f){return f instanceof h?f:new h(function(q,v){q(f)})}if(k&&(!($jscomp.FORCE_POLYFILL_PROMISE||$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION&&"undefined"===typeof $jscomp.global.PromiseRejectionEvent)||!$jscomp.global.Promise||-1===$jscomp.global.Promise.toString().indexOf("[native code]")))return k;n.prototype.asyncExecute=function(f){if(null==this.batch_){this.batch_=[];var q=this;this.asyncExecuteFunction(function(){q.executeBatch_()})}this.batch_.push(f)};
var p=$jscomp.global.setTimeout;n.prototype.asyncExecuteFunction=function(f){p(f,0)};n.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var f=this.batch_;this.batch_=[];for(var q=0;q<f.length;++q){var v=f[q];f[q]=null;try{v()}catch(z){this.asyncThrow_(z)}}}this.batch_=null};n.prototype.asyncThrow_=function(f){this.asyncExecuteFunction(function(){throw f;})};var h=function(f){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];this.isRejectionHandled_=!1;var q=this.createResolveAndReject_();
try{f(q.resolve,q.reject)}catch(v){q.reject(v)}};h.prototype.createResolveAndReject_=function(){function f(z){return function(O){v||(v=!0,z.call(q,O))}}var q=this,v=!1;return{resolve:f(this.resolveTo_),reject:f(this.reject_)}};h.prototype.resolveTo_=function(f){if(f===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(f instanceof h)this.settleSameAsPromise_(f);else{a:switch(typeof f){case "object":var q=null!=f;break a;case "function":q=!0;break a;default:q=!1}q?this.resolveToNonPromiseObj_(f):
this.fulfill_(f)}};h.prototype.resolveToNonPromiseObj_=function(f){var q=void 0;try{q=f.then}catch(v){this.reject_(v);return}"function"==typeof q?this.settleSameAsThenable_(q,f):this.fulfill_(f)};h.prototype.reject_=function(f){this.settle_(2,f)};h.prototype.fulfill_=function(f){this.settle_(1,f)};h.prototype.settle_=function(f,q){if(0!=this.state_)throw Error("Cannot settle("+f+", "+q+"): Promise already settled in state"+this.state_);this.state_=f;this.result_=q;2===this.state_&&this.scheduleUnhandledRejectionCheck_();
this.executeOnSettledCallbacks_()};h.prototype.scheduleUnhandledRejectionCheck_=function(){var f=this;p(function(){if(f.notifyUnhandledRejection_()){var q=$jscomp.global.console;"undefined"!==typeof q&&q.error(f.result_)}},1)};h.prototype.notifyUnhandledRejection_=function(){if(this.isRejectionHandled_)return!1;var f=$jscomp.global.CustomEvent,q=$jscomp.global.Event,v=$jscomp.global.dispatchEvent;if("undefined"===typeof v)return!0;"function"===typeof f?f=new f("unhandledrejection",{cancelable:!0}):
"function"===typeof q?f=new q("unhandledrejection",{cancelable:!0}):(f=$jscomp.global.document.createEvent("CustomEvent"),f.initCustomEvent("unhandledrejection",!1,!0,f));f.promise=this;f.reason=this.result_;return v(f)};h.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var f=0;f<this.onSettledCallbacks_.length;++f)A.asyncExecute(this.onSettledCallbacks_[f]);this.onSettledCallbacks_=null}};var A=new n;h.prototype.settleSameAsPromise_=function(f){var q=this.createResolveAndReject_();
f.callWhenSettled_(q.resolve,q.reject)};h.prototype.settleSameAsThenable_=function(f,q){var v=this.createResolveAndReject_();try{f.call(q,v.resolve,v.reject)}catch(z){v.reject(z)}};h.prototype.then=function(f,q){function v(t,x){return"function"==typeof t?function(D){try{z(t(D))}catch(R){O(R)}}:x}var z,O,ba=new h(function(t,x){z=t;O=x});this.callWhenSettled_(v(f,z),v(q,O));return ba};h.prototype.catch=function(f){return this.then(void 0,f)};h.prototype.callWhenSettled_=function(f,q){function v(){switch(z.state_){case 1:f(z.result_);
break;case 2:q(z.result_);break;default:throw Error("Unexpected state: "+z.state_);}}var z=this;null==this.onSettledCallbacks_?A.asyncExecute(v):this.onSettledCallbacks_.push(v);this.isRejectionHandled_=!0};h.resolve=l;h.reject=function(f){return new h(function(q,v){v(f)})};h.race=function(f){return new h(function(q,v){for(var z=$jscomp.makeIterator(f),O=z.next();!O.done;O=z.next())l(O.value).callWhenSettled_(q,v)})};h.all=function(f){var q=$jscomp.makeIterator(f),v=q.next();return v.done?l([]):new h(function(z,
O){function ba(D){return function(R){t[D]=R;x--;0==x&&z(t)}}var t=[],x=0;do t.push(void 0),x++,l(v.value).callWhenSettled_(ba(t.length-1),O),v=q.next();while(!v.done)})};return h},"es6","es3");$jscomp.owns=function(k,n){return Object.prototype.hasOwnProperty.call(k,n)};$jscomp.assign=$jscomp.TRUST_ES6_POLYFILLS&&"function"==typeof Object.assign?Object.assign:function(k,n){for(var l=1;l<arguments.length;l++){var p=arguments[l];if(p)for(var h in p)$jscomp.owns(p,h)&&(k[h]=p[h])}return k};
$jscomp.polyfill("Object.assign",function(k){return k||$jscomp.assign},"es6","es3");$jscomp.checkStringArgs=function(k,n,l){if(null==k)throw new TypeError("The 'this' value for String.prototype."+l+" must not be null or undefined");if(n instanceof RegExp)throw new TypeError("First argument to String.prototype."+l+" must not be a regular expression");return k+""};
$jscomp.polyfill("String.prototype.startsWith",function(k){return k?k:function(n,l){var p=$jscomp.checkStringArgs(this,n,"startsWith");n+="";var h=p.length,A=n.length;l=Math.max(0,Math.min(l|0,p.length));for(var f=0;f<A&&l<h;)if(p[l++]!=n[f++])return!1;return f>=A}},"es6","es3");
$jscomp.polyfill("Array.prototype.copyWithin",function(k){function n(l){l=Number(l);return Infinity===l||-Infinity===l?l:l|0}return k?k:function(l,p,h){var A=this.length;l=n(l);p=n(p);h=void 0===h?A:n(h);l=0>l?Math.max(A+l,0):Math.min(l,A);p=0>p?Math.max(A+p,0):Math.min(p,A);h=0>h?Math.max(A+h,0):Math.min(h,A);if(l<p)for(;p<h;)p in this?this[l++]=this[p++]:(delete this[l++],p++);else for(h=Math.min(h,A+p-l),l+=h-p;h>p;)--h in this?this[--l]=this[h]:delete this[--l];return this}},"es6","es3");
$jscomp.typedArrayCopyWithin=function(k){return k?k:Array.prototype.copyWithin};$jscomp.polyfill("Int8Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Uint8Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Uint8ClampedArray.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Int16Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");
$jscomp.polyfill("Uint16Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Int32Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Uint32Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Float32Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Float64Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");
var DracoDecoderModule=function(){var k="undefined"!==typeof document&&document.currentScript?document.currentScript.src:void 0;"undefined"!==typeof __filename&&(k=k||__filename);return function(n){function l(e){return a.locateFile?a.locateFile(e,U):U+e}function p(e,b,c){var d=b+c;for(c=b;e[c]&&!(c>=d);)++c;if(16<c-b&&e.buffer&&va)return va.decode(e.subarray(b,c));for(d="";b<c;){var g=e[b++];if(g&128){var u=e[b++]&63;if(192==(g&224))d+=String.fromCharCode((g&31)<<6|u);else{var X=e[b++]&63;g=224==
(g&240)?(g&15)<<12|u<<6|X:(g&7)<<18|u<<12|X<<6|e[b++]&63;65536>g?d+=String.fromCharCode(g):(g-=65536,d+=String.fromCharCode(55296|g>>10,56320|g&1023))}}else d+=String.fromCharCode(g)}return d}function h(e,b){return e?p(ea,e,b):""}function A(){var e=ja.buffer;a.HEAP8=Y=new Int8Array(e);a.HEAP16=new Int16Array(e);a.HEAP32=ca=new Int32Array(e);a.HEAPU8=ea=new Uint8Array(e);a.HEAPU16=new Uint16Array(e);a.HEAPU32=V=new Uint32Array(e);a.HEAPF32=new Float32Array(e);a.HEAPF64=new Float64Array(e)}function f(e){if(a.onAbort)a.onAbort(e);
e="Aborted("+e+")";da(e);wa=!0;e=new WebAssembly.RuntimeError(e+". Build with -sASSERTIONS for more info.");ka(e);throw e;}function q(e){try{if(e==P&&fa)return new Uint8Array(fa);if(ma)return ma(e);throw"both async and sync fetching of the wasm failed";}catch(b){f(b)}}function v(){if(!fa&&(xa||ha)){if("function"==typeof fetch&&!P.startsWith("file://"))return fetch(P,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load wasm binary file at '"+P+"'";return e.arrayBuffer()}).catch(function(){return q(P)});
if(na)return new Promise(function(e,b){na(P,function(c){e(new Uint8Array(c))},b)})}return Promise.resolve().then(function(){return q(P)})}function z(e){for(;0<e.length;)e.shift()(a)}function O(e){this.excPtr=e;this.ptr=e-24;this.set_type=function(b){V[this.ptr+4>>2]=b};this.get_type=function(){return V[this.ptr+4>>2]};this.set_destructor=function(b){V[this.ptr+8>>2]=b};this.get_destructor=function(){return V[this.ptr+8>>2]};this.set_refcount=function(b){ca[this.ptr>>2]=b};this.set_caught=function(b){Y[this.ptr+
12>>0]=b?1:0};this.get_caught=function(){return 0!=Y[this.ptr+12>>0]};this.set_rethrown=function(b){Y[this.ptr+13>>0]=b?1:0};this.get_rethrown=function(){return 0!=Y[this.ptr+13>>0]};this.init=function(b,c){this.set_adjusted_ptr(0);this.set_type(b);this.set_destructor(c);this.set_refcount(0);this.set_caught(!1);this.set_rethrown(!1)};this.add_ref=function(){ca[this.ptr>>2]+=1};this.release_ref=function(){var b=ca[this.ptr>>2];ca[this.ptr>>2]=b-1;return 1===b};this.set_adjusted_ptr=function(b){V[this.ptr+
16>>2]=b};this.get_adjusted_ptr=function(){return V[this.ptr+16>>2]};this.get_exception_ptr=function(){if(ya(this.get_type()))return V[this.excPtr>>2];var b=this.get_adjusted_ptr();return 0!==b?b:this.excPtr}}function ba(){function e(){if(!la&&(la=!0,a.calledRun=!0,!wa)){za=!0;z(oa);Aa(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;)Ba.unshift(a.postRun.shift());z(Ba)}}if(!(0<aa)){if(a.preRun)for("function"==
typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)Ca.unshift(a.preRun.shift());z(Ca);0<aa||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);e()},1)):e())}}function t(){}function x(e){return(e||t).__cache__}function D(e,b){var c=x(b),d=c[e];if(d)return d;d=Object.create((b||t).prototype);d.ptr=e;return c[e]=d}function R(e){if("string"===typeof e){for(var b=0,c=0;c<e.length;++c){var d=e.charCodeAt(c);127>=d?b++:2047>=d?b+=2:55296<=d&&57343>=
d?(b+=4,++c):b+=3}b=Array(b+1);c=0;d=b.length;if(0<d){d=c+d-1;for(var g=0;g<e.length;++g){var u=e.charCodeAt(g);if(55296<=u&&57343>=u){var X=e.charCodeAt(++g);u=65536+((u&1023)<<10)|X&1023}if(127>=u){if(c>=d)break;b[c++]=u}else{if(2047>=u){if(c+1>=d)break;b[c++]=192|u>>6}else{if(65535>=u){if(c+2>=d)break;b[c++]=224|u>>12}else{if(c+3>=d)break;b[c++]=240|u>>18;b[c++]=128|u>>12&63}b[c++]=128|u>>6&63}b[c++]=128|u&63}}b[c]=0}e=r.alloc(b,Y);r.copy(b,Y,e);return e}return e}function pa(e){if("object"===typeof e){var b=
r.alloc(e,Y);r.copy(e,Y,b);return b}return e}function Z(){throw"cannot construct a VoidPtr, no constructor in IDL";}function S(){this.ptr=Da();x(S)[this.ptr]=this}function Q(){this.ptr=Ea();x(Q)[this.ptr]=this}function W(){this.ptr=Fa();x(W)[this.ptr]=this}function w(){this.ptr=Ga();x(w)[this.ptr]=this}function C(){this.ptr=Ha();x(C)[this.ptr]=this}function F(){this.ptr=Ia();x(F)[this.ptr]=this}function G(){this.ptr=Ja();x(G)[this.ptr]=this}function E(){this.ptr=Ka();x(E)[this.ptr]=this}function T(){this.ptr=
La();x(T)[this.ptr]=this}function B(){throw"cannot construct a Status, no constructor in IDL";}function H(){this.ptr=Ma();x(H)[this.ptr]=this}function I(){this.ptr=Na();x(I)[this.ptr]=this}function J(){this.ptr=Oa();x(J)[this.ptr]=this}function K(){this.ptr=Pa();x(K)[this.ptr]=this}function L(){this.ptr=Qa();x(L)[this.ptr]=this}function M(){this.ptr=Ra();x(M)[this.ptr]=this}function N(){this.ptr=Sa();x(N)[this.ptr]=this}function y(){this.ptr=Ta();x(y)[this.ptr]=this}function m(){this.ptr=Ua();x(m)[this.ptr]=
this}n=void 0===n?{}:n;var a="undefined"!=typeof n?n:{},Aa,ka;a.ready=new Promise(function(e,b){Aa=e;ka=b});var Va=!1,Wa=!1;a.onRuntimeInitialized=function(){Va=!0;if(Wa&&"function"===typeof a.onModuleLoaded)a.onModuleLoaded(a)};a.onModuleParsed=function(){Wa=!0;if(Va&&"function"===typeof a.onModuleLoaded)a.onModuleLoaded(a)};a.isVersionSupported=function(e){if("string"!==typeof e)return!1;e=e.split(".");return 2>e.length||3<e.length?!1:1==e[0]&&0<=e[1]&&5>=e[1]?!0:0!=e[0]||10<e[1]?!1:!0};var Xa=
Object.assign({},a),xa="object"==typeof window,ha="function"==typeof importScripts,Ya="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,U="";if(Ya){var Za=require("fs"),qa=require("path");U=ha?qa.dirname(U)+"/":__dirname+"/";var $a=function(e,b){e=e.startsWith("file://")?new URL(e):qa.normalize(e);return Za.readFileSync(e,b?void 0:"utf8")};var ma=function(e){e=$a(e,!0);e.buffer||(e=new Uint8Array(e));return e};var na=function(e,b,c){e=e.startsWith("file://")?
new URL(e):qa.normalize(e);Za.readFile(e,function(d,g){d?c(d):b(g.buffer)})};1<process.argv.length&&process.argv[1].replace(/\\/g,"/");process.argv.slice(2);a.inspect=function(){return"[Emscripten Module object]"}}else if(xa||ha)ha?U=self.location.href:"undefined"!=typeof document&&document.currentScript&&(U=document.currentScript.src),k&&(U=k),U=0!==U.indexOf("blob:")?U.substr(0,U.replace(/[?#].*/,"").lastIndexOf("/")+1):"",$a=function(e){var b=new XMLHttpRequest;b.open("GET",e,!1);b.send(null);
return b.responseText},ha&&(ma=function(e){var b=new XMLHttpRequest;b.open("GET",e,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)}),na=function(e,b,c){var d=new XMLHttpRequest;d.open("GET",e,!0);d.responseType="arraybuffer";d.onload=function(){200==d.status||0==d.status&&d.response?b(d.response):c()};d.onerror=c;d.send(null)};var ud=a.print||console.log.bind(console),da=a.printErr||console.warn.bind(console);Object.assign(a,Xa);Xa=null;var fa;a.wasmBinary&&(fa=a.wasmBinary);
"object"!=typeof WebAssembly&&f("no native wasm support detected");var ja,wa=!1,va="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,Y,ea,ca,V,Ca=[],oa=[],Ba=[],za=!1,aa=0,ra=null,ia=null;var P="draco_decoder.wasm";P.startsWith("data:application/octet-stream;base64,")||(P=l(P));var vd=0,wd=[null,[],[]],xd={b:function(e,b,c){(new O(e)).init(b,c);vd++;throw e;},a:function(){f("")},g:function(e,b,c){ea.copyWithin(e,b,b+c)},e:function(e){var b=ea.length;e>>>=0;if(2147483648<e)return!1;for(var c=
1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,e+100663296);var g=Math;d=Math.max(e,d);g=g.min.call(g,2147483648,d+(65536-d%65536)%65536);a:{d=ja.buffer;try{ja.grow(g-d.byteLength+65535>>>16);A();var u=1;break a}catch(X){}u=void 0}if(u)return!0}return!1},f:function(e){return 52},d:function(e,b,c,d,g){return 70},c:function(e,b,c,d){for(var g=0,u=0;u<c;u++){var X=V[b>>2],ab=V[b+4>>2];b+=8;for(var sa=0;sa<ab;sa++){var ta=ea[X+sa],ua=wd[e];0===ta||10===ta?((1===e?ud:da)(p(ua,0)),ua.length=0):ua.push(ta)}g+=
ab}V[d>>2]=g;return 0}};(function(){function e(g,u){a.asm=g.exports;ja=a.asm.h;A();oa.unshift(a.asm.i);aa--;a.monitorRunDependencies&&a.monitorRunDependencies(aa);0==aa&&(null!==ra&&(clearInterval(ra),ra=null),ia&&(g=ia,ia=null,g()))}function b(g){e(g.instance)}function c(g){return v().then(function(u){return WebAssembly.instantiate(u,d)}).then(function(u){return u}).then(g,function(u){da("failed to asynchronously prepare wasm: "+u);f(u)})}var d={a:xd};aa++;a.monitorRunDependencies&&a.monitorRunDependencies(aa);
if(a.instantiateWasm)try{return a.instantiateWasm(d,e)}catch(g){da("Module.instantiateWasm callback failed with error: "+g),ka(g)}(function(){return fa||"function"!=typeof WebAssembly.instantiateStreaming||P.startsWith("data:application/octet-stream;base64,")||P.startsWith("file://")||Ya||"function"!=typeof fetch?c(b):fetch(P,{credentials:"same-origin"}).then(function(g){return WebAssembly.instantiateStreaming(g,d).then(b,function(u){da("wasm streaming compile failed: "+u);da("falling back to ArrayBuffer instantiation");
return c(b)})})})().catch(ka);return{}})();var bb=a._emscripten_bind_VoidPtr___destroy___0=function(){return(bb=a._emscripten_bind_VoidPtr___destroy___0=a.asm.k).apply(null,arguments)},Da=a._emscripten_bind_DecoderBuffer_DecoderBuffer_0=function(){return(Da=a._emscripten_bind_DecoderBuffer_DecoderBuffer_0=a.asm.l).apply(null,arguments)},cb=a._emscripten_bind_DecoderBuffer_Init_2=function(){return(cb=a._emscripten_bind_DecoderBuffer_Init_2=a.asm.m).apply(null,arguments)},db=a._emscripten_bind_DecoderBuffer___destroy___0=
function(){return(db=a._emscripten_bind_DecoderBuffer___destroy___0=a.asm.n).apply(null,arguments)},Ea=a._emscripten_bind_AttributeTransformData_AttributeTransformData_0=function(){return(Ea=a._emscripten_bind_AttributeTransformData_AttributeTransformData_0=a.asm.o).apply(null,arguments)},eb=a._emscripten_bind_AttributeTransformData_transform_type_0=function(){return(eb=a._emscripten_bind_AttributeTransformData_transform_type_0=a.asm.p).apply(null,arguments)},fb=a._emscripten_bind_AttributeTransformData___destroy___0=
function(){return(fb=a._emscripten_bind_AttributeTransformData___destroy___0=a.asm.q).apply(null,arguments)},Fa=a._emscripten_bind_GeometryAttribute_GeometryAttribute_0=function(){return(Fa=a._emscripten_bind_GeometryAttribute_GeometryAttribute_0=a.asm.r).apply(null,arguments)},gb=a._emscripten_bind_GeometryAttribute___destroy___0=function(){return(gb=a._emscripten_bind_GeometryAttribute___destroy___0=a.asm.s).apply(null,arguments)},Ga=a._emscripten_bind_PointAttribute_PointAttribute_0=function(){return(Ga=
a._emscripten_bind_PointAttribute_PointAttribute_0=a.asm.t).apply(null,arguments)},hb=a._emscripten_bind_PointAttribute_size_0=function(){return(hb=a._emscripten_bind_PointAttribute_size_0=a.asm.u).apply(null,arguments)},ib=a._emscripten_bind_PointAttribute_GetAttributeTransformData_0=function(){return(ib=a._emscripten_bind_PointAttribute_GetAttributeTransformData_0=a.asm.v).apply(null,arguments)},jb=a._emscripten_bind_PointAttribute_attribute_type_0=function(){return(jb=a._emscripten_bind_PointAttribute_attribute_type_0=
a.asm.w).apply(null,arguments)},kb=a._emscripten_bind_PointAttribute_data_type_0=function(){return(kb=a._emscripten_bind_PointAttribute_data_type_0=a.asm.x).apply(null,arguments)},lb=a._emscripten_bind_PointAttribute_num_components_0=function(){return(lb=a._emscripten_bind_PointAttribute_num_components_0=a.asm.y).apply(null,arguments)},mb=a._emscripten_bind_PointAttribute_normalized_0=function(){return(mb=a._emscripten_bind_PointAttribute_normalized_0=a.asm.z).apply(null,arguments)},nb=a._emscripten_bind_PointAttribute_byte_stride_0=
function(){return(nb=a._emscripten_bind_PointAttribute_byte_stride_0=a.asm.A).apply(null,arguments)},ob=a._emscripten_bind_PointAttribute_byte_offset_0=function(){return(ob=a._emscripten_bind_PointAttribute_byte_offset_0=a.asm.B).apply(null,arguments)},pb=a._emscripten_bind_PointAttribute_unique_id_0=function(){return(pb=a._emscripten_bind_PointAttribute_unique_id_0=a.asm.C).apply(null,arguments)},qb=a._emscripten_bind_PointAttribute___destroy___0=function(){return(qb=a._emscripten_bind_PointAttribute___destroy___0=
a.asm.D).apply(null,arguments)},Ha=a._emscripten_bind_AttributeQuantizationTransform_AttributeQuantizationTransform_0=function(){return(Ha=a._emscripten_bind_AttributeQuantizationTransform_AttributeQuantizationTransform_0=a.asm.E).apply(null,arguments)},rb=a._emscripten_bind_AttributeQuantizationTransform_InitFromAttribute_1=function(){return(rb=a._emscripten_bind_AttributeQuantizationTransform_InitFromAttribute_1=a.asm.F).apply(null,arguments)},sb=a._emscripten_bind_AttributeQuantizationTransform_quantization_bits_0=
function(){return(sb=a._emscripten_bind_AttributeQuantizationTransform_quantization_bits_0=a.asm.G).apply(null,arguments)},tb=a._emscripten_bind_AttributeQuantizationTransform_min_value_1=function(){return(tb=a._emscripten_bind_AttributeQuantizationTransform_min_value_1=a.asm.H).apply(null,arguments)},ub=a._emscripten_bind_AttributeQuantizationTransform_range_0=function(){return(ub=a._emscripten_bind_AttributeQuantizationTransform_range_0=a.asm.I).apply(null,arguments)},vb=a._emscripten_bind_AttributeQuantizationTransform___destroy___0=
function(){return(vb=a._emscripten_bind_AttributeQuantizationTransform___destroy___0=a.asm.J).apply(null,arguments)},Ia=a._emscripten_bind_AttributeOctahedronTransform_AttributeOctahedronTransform_0=function(){return(Ia=a._emscripten_bind_AttributeOctahedronTransform_AttributeOctahedronTransform_0=a.asm.K).apply(null,arguments)},wb=a._emscripten_bind_AttributeOctahedronTransform_InitFromAttribute_1=function(){return(wb=a._emscripten_bind_AttributeOctahedronTransform_InitFromAttribute_1=a.asm.L).apply(null,
arguments)},xb=a._emscripten_bind_AttributeOctahedronTransform_quantization_bits_0=function(){return(xb=a._emscripten_bind_AttributeOctahedronTransform_quantization_bits_0=a.asm.M).apply(null,arguments)},yb=a._emscripten_bind_AttributeOctahedronTransform___destroy___0=function(){return(yb=a._emscripten_bind_AttributeOctahedronTransform___destroy___0=a.asm.N).apply(null,arguments)},Ja=a._emscripten_bind_PointCloud_PointCloud_0=function(){return(Ja=a._emscripten_bind_PointCloud_PointCloud_0=a.asm.O).apply(null,
arguments)},zb=a._emscripten_bind_PointCloud_num_attributes_0=function(){return(zb=a._emscripten_bind_PointCloud_num_attributes_0=a.asm.P).apply(null,arguments)},Ab=a._emscripten_bind_PointCloud_num_points_0=function(){return(Ab=a._emscripten_bind_PointCloud_num_points_0=a.asm.Q).apply(null,arguments)},Bb=a._emscripten_bind_PointCloud___destroy___0=function(){return(Bb=a._emscripten_bind_PointCloud___destroy___0=a.asm.R).apply(null,arguments)},Ka=a._emscripten_bind_Mesh_Mesh_0=function(){return(Ka=
a._emscripten_bind_Mesh_Mesh_0=a.asm.S).apply(null,arguments)},Cb=a._emscripten_bind_Mesh_num_faces_0=function(){return(Cb=a._emscripten_bind_Mesh_num_faces_0=a.asm.T).apply(null,arguments)},Db=a._emscripten_bind_Mesh_num_attributes_0=function(){return(Db=a._emscripten_bind_Mesh_num_attributes_0=a.asm.U).apply(null,arguments)},Eb=a._emscripten_bind_Mesh_num_points_0=function(){return(Eb=a._emscripten_bind_Mesh_num_points_0=a.asm.V).apply(null,arguments)},Fb=a._emscripten_bind_Mesh___destroy___0=function(){return(Fb=
a._emscripten_bind_Mesh___destroy___0=a.asm.W).apply(null,arguments)},La=a._emscripten_bind_Metadata_Metadata_0=function(){return(La=a._emscripten_bind_Metadata_Metadata_0=a.asm.X).apply(null,arguments)},Gb=a._emscripten_bind_Metadata___destroy___0=function(){return(Gb=a._emscripten_bind_Metadata___destroy___0=a.asm.Y).apply(null,arguments)},Hb=a._emscripten_bind_Status_code_0=function(){return(Hb=a._emscripten_bind_Status_code_0=a.asm.Z).apply(null,arguments)},Ib=a._emscripten_bind_Status_ok_0=function(){return(Ib=
a._emscripten_bind_Status_ok_0=a.asm._).apply(null,arguments)},Jb=a._emscripten_bind_Status_error_msg_0=function(){return(Jb=a._emscripten_bind_Status_error_msg_0=a.asm.$).apply(null,arguments)},Kb=a._emscripten_bind_Status___destroy___0=function(){return(Kb=a._emscripten_bind_Status___destroy___0=a.asm.aa).apply(null,arguments)},Ma=a._emscripten_bind_DracoFloat32Array_DracoFloat32Array_0=function(){return(Ma=a._emscripten_bind_DracoFloat32Array_DracoFloat32Array_0=a.asm.ba).apply(null,arguments)},
Lb=a._emscripten_bind_DracoFloat32Array_GetValue_1=function(){return(Lb=a._emscripten_bind_DracoFloat32Array_GetValue_1=a.asm.ca).apply(null,arguments)},Mb=a._emscripten_bind_DracoFloat32Array_size_0=function(){return(Mb=a._emscripten_bind_DracoFloat32Array_size_0=a.asm.da).apply(null,arguments)},Nb=a._emscripten_bind_DracoFloat32Array___destroy___0=function(){return(Nb=a._emscripten_bind_DracoFloat32Array___destroy___0=a.asm.ea).apply(null,arguments)},Na=a._emscripten_bind_DracoInt8Array_DracoInt8Array_0=
function(){return(Na=a._emscripten_bind_DracoInt8Array_DracoInt8Array_0=a.asm.fa).apply(null,arguments)},Ob=a._emscripten_bind_DracoInt8Array_GetValue_1=function(){return(Ob=a._emscripten_bind_DracoInt8Array_GetValue_1=a.asm.ga).apply(null,arguments)},Pb=a._emscripten_bind_DracoInt8Array_size_0=function(){return(Pb=a._emscripten_bind_DracoInt8Array_size_0=a.asm.ha).apply(null,arguments)},Qb=a._emscripten_bind_DracoInt8Array___destroy___0=function(){return(Qb=a._emscripten_bind_DracoInt8Array___destroy___0=
a.asm.ia).apply(null,arguments)},Oa=a._emscripten_bind_DracoUInt8Array_DracoUInt8Array_0=function(){return(Oa=a._emscripten_bind_DracoUInt8Array_DracoUInt8Array_0=a.asm.ja).apply(null,arguments)},Rb=a._emscripten_bind_DracoUInt8Array_GetValue_1=function(){return(Rb=a._emscripten_bind_DracoUInt8Array_GetValue_1=a.asm.ka).apply(null,arguments)},Sb=a._emscripten_bind_DracoUInt8Array_size_0=function(){return(Sb=a._emscripten_bind_DracoUInt8Array_size_0=a.asm.la).apply(null,arguments)},Tb=a._emscripten_bind_DracoUInt8Array___destroy___0=
function(){return(Tb=a._emscripten_bind_DracoUInt8Array___destroy___0=a.asm.ma).apply(null,arguments)},Pa=a._emscripten_bind_DracoInt16Array_DracoInt16Array_0=function(){return(Pa=a._emscripten_bind_DracoInt16Array_DracoInt16Array_0=a.asm.na).apply(null,arguments)},Ub=a._emscripten_bind_DracoInt16Array_GetValue_1=function(){return(Ub=a._emscripten_bind_DracoInt16Array_GetValue_1=a.asm.oa).apply(null,arguments)},Vb=a._emscripten_bind_DracoInt16Array_size_0=function(){return(Vb=a._emscripten_bind_DracoInt16Array_size_0=
a.asm.pa).apply(null,arguments)},Wb=a._emscripten_bind_DracoInt16Array___destroy___0=function(){return(Wb=a._emscripten_bind_DracoInt16Array___destroy___0=a.asm.qa).apply(null,arguments)},Qa=a._emscripten_bind_DracoUInt16Array_DracoUInt16Array_0=function(){return(Qa=a._emscripten_bind_DracoUInt16Array_DracoUInt16Array_0=a.asm.ra).apply(null,arguments)},Xb=a._emscripten_bind_DracoUInt16Array_GetValue_1=function(){return(Xb=a._emscripten_bind_DracoUInt16Array_GetValue_1=a.asm.sa).apply(null,arguments)},
Yb=a._emscripten_bind_DracoUInt16Array_size_0=function(){return(Yb=a._emscripten_bind_DracoUInt16Array_size_0=a.asm.ta).apply(null,arguments)},Zb=a._emscripten_bind_DracoUInt16Array___destroy___0=function(){return(Zb=a._emscripten_bind_DracoUInt16Array___destroy___0=a.asm.ua).apply(null,arguments)},Ra=a._emscripten_bind_DracoInt32Array_DracoInt32Array_0=function(){return(Ra=a._emscripten_bind_DracoInt32Array_DracoInt32Array_0=a.asm.va).apply(null,arguments)},$b=a._emscripten_bind_DracoInt32Array_GetValue_1=
function(){return($b=a._emscripten_bind_DracoInt32Array_GetValue_1=a.asm.wa).apply(null,arguments)},ac=a._emscripten_bind_DracoInt32Array_size_0=function(){return(ac=a._emscripten_bind_DracoInt32Array_size_0=a.asm.xa).apply(null,arguments)},bc=a._emscripten_bind_DracoInt32Array___destroy___0=function(){return(bc=a._emscripten_bind_DracoInt32Array___destroy___0=a.asm.ya).apply(null,arguments)},Sa=a._emscripten_bind_DracoUInt32Array_DracoUInt32Array_0=function(){return(Sa=a._emscripten_bind_DracoUInt32Array_DracoUInt32Array_0=
a.asm.za).apply(null,arguments)},cc=a._emscripten_bind_DracoUInt32Array_GetValue_1=function(){return(cc=a._emscripten_bind_DracoUInt32Array_GetValue_1=a.asm.Aa).apply(null,arguments)},dc=a._emscripten_bind_DracoUInt32Array_size_0=function(){return(dc=a._emscripten_bind_DracoUInt32Array_size_0=a.asm.Ba).apply(null,arguments)},ec=a._emscripten_bind_DracoUInt32Array___destroy___0=function(){return(ec=a._emscripten_bind_DracoUInt32Array___destroy___0=a.asm.Ca).apply(null,arguments)},Ta=a._emscripten_bind_MetadataQuerier_MetadataQuerier_0=
function(){return(Ta=a._emscripten_bind_MetadataQuerier_MetadataQuerier_0=a.asm.Da).apply(null,arguments)},fc=a._emscripten_bind_MetadataQuerier_HasEntry_2=function(){return(fc=a._emscripten_bind_MetadataQuerier_HasEntry_2=a.asm.Ea).apply(null,arguments)},gc=a._emscripten_bind_MetadataQuerier_GetIntEntry_2=function(){return(gc=a._emscripten_bind_MetadataQuerier_GetIntEntry_2=a.asm.Fa).apply(null,arguments)},hc=a._emscripten_bind_MetadataQuerier_GetIntEntryArray_3=function(){return(hc=a._emscripten_bind_MetadataQuerier_GetIntEntryArray_3=
a.asm.Ga).apply(null,arguments)},ic=a._emscripten_bind_MetadataQuerier_GetDoubleEntry_2=function(){return(ic=a._emscripten_bind_MetadataQuerier_GetDoubleEntry_2=a.asm.Ha).apply(null,arguments)},jc=a._emscripten_bind_MetadataQuerier_GetStringEntry_2=function(){return(jc=a._emscripten_bind_MetadataQuerier_GetStringEntry_2=a.asm.Ia).apply(null,arguments)},kc=a._emscripten_bind_MetadataQuerier_NumEntries_1=function(){return(kc=a._emscripten_bind_MetadataQuerier_NumEntries_1=a.asm.Ja).apply(null,arguments)},
lc=a._emscripten_bind_MetadataQuerier_GetEntryName_2=function(){return(lc=a._emscripten_bind_MetadataQuerier_GetEntryName_2=a.asm.Ka).apply(null,arguments)},mc=a._emscripten_bind_MetadataQuerier___destroy___0=function(){return(mc=a._emscripten_bind_MetadataQuerier___destroy___0=a.asm.La).apply(null,arguments)},Ua=a._emscripten_bind_Decoder_Decoder_0=function(){return(Ua=a._emscripten_bind_Decoder_Decoder_0=a.asm.Ma).apply(null,arguments)},nc=a._emscripten_bind_Decoder_DecodeArrayToPointCloud_3=function(){return(nc=
a._emscripten_bind_Decoder_DecodeArrayToPointCloud_3=a.asm.Na).apply(null,arguments)},oc=a._emscripten_bind_Decoder_DecodeArrayToMesh_3=function(){return(oc=a._emscripten_bind_Decoder_DecodeArrayToMesh_3=a.asm.Oa).apply(null,arguments)},pc=a._emscripten_bind_Decoder_GetAttributeId_2=function(){return(pc=a._emscripten_bind_Decoder_GetAttributeId_2=a.asm.Pa).apply(null,arguments)},qc=a._emscripten_bind_Decoder_GetAttributeIdByName_2=function(){return(qc=a._emscripten_bind_Decoder_GetAttributeIdByName_2=
a.asm.Qa).apply(null,arguments)},rc=a._emscripten_bind_Decoder_GetAttributeIdByMetadataEntry_3=function(){return(rc=a._emscripten_bind_Decoder_GetAttributeIdByMetadataEntry_3=a.asm.Ra).apply(null,arguments)},sc=a._emscripten_bind_Decoder_GetAttribute_2=function(){return(sc=a._emscripten_bind_Decoder_GetAttribute_2=a.asm.Sa).apply(null,arguments)},tc=a._emscripten_bind_Decoder_GetAttributeByUniqueId_2=function(){return(tc=a._emscripten_bind_Decoder_GetAttributeByUniqueId_2=a.asm.Ta).apply(null,arguments)},
uc=a._emscripten_bind_Decoder_GetMetadata_1=function(){return(uc=a._emscripten_bind_Decoder_GetMetadata_1=a.asm.Ua).apply(null,arguments)},vc=a._emscripten_bind_Decoder_GetAttributeMetadata_2=function(){return(vc=a._emscripten_bind_Decoder_GetAttributeMetadata_2=a.asm.Va).apply(null,arguments)},wc=a._emscripten_bind_Decoder_GetFaceFromMesh_3=function(){return(wc=a._emscripten_bind_Decoder_GetFaceFromMesh_3=a.asm.Wa).apply(null,arguments)},xc=a._emscripten_bind_Decoder_GetTriangleStripsFromMesh_2=
function(){return(xc=a._emscripten_bind_Decoder_GetTriangleStripsFromMesh_2=a.asm.Xa).apply(null,arguments)},yc=a._emscripten_bind_Decoder_GetTrianglesUInt16Array_3=function(){return(yc=a._emscripten_bind_Decoder_GetTrianglesUInt16Array_3=a.asm.Ya).apply(null,arguments)},zc=a._emscripten_bind_Decoder_GetTrianglesUInt32Array_3=function(){return(zc=a._emscripten_bind_Decoder_GetTrianglesUInt32Array_3=a.asm.Za).apply(null,arguments)},Ac=a._emscripten_bind_Decoder_GetAttributeFloat_3=function(){return(Ac=
a._emscripten_bind_Decoder_GetAttributeFloat_3=a.asm._a).apply(null,arguments)},Bc=a._emscripten_bind_Decoder_GetAttributeFloatForAllPoints_3=function(){return(Bc=a._emscripten_bind_Decoder_GetAttributeFloatForAllPoints_3=a.asm.$a).apply(null,arguments)},Cc=a._emscripten_bind_Decoder_GetAttributeIntForAllPoints_3=function(){return(Cc=a._emscripten_bind_Decoder_GetAttributeIntForAllPoints_3=a.asm.ab).apply(null,arguments)},Dc=a._emscripten_bind_Decoder_GetAttributeInt8ForAllPoints_3=function(){return(Dc=
a._emscripten_bind_Decoder_GetAttributeInt8ForAllPoints_3=a.asm.bb).apply(null,arguments)},Ec=a._emscripten_bind_Decoder_GetAttributeUInt8ForAllPoints_3=function(){return(Ec=a._emscripten_bind_Decoder_GetAttributeUInt8ForAllPoints_3=a.asm.cb).apply(null,arguments)},Fc=a._emscripten_bind_Decoder_GetAttributeInt16ForAllPoints_3=function(){return(Fc=a._emscripten_bind_Decoder_GetAttributeInt16ForAllPoints_3=a.asm.db).apply(null,arguments)},Gc=a._emscripten_bind_Decoder_GetAttributeUInt16ForAllPoints_3=
function(){return(Gc=a._emscripten_bind_Decoder_GetAttributeUInt16ForAllPoints_3=a.asm.eb).apply(null,arguments)},Hc=a._emscripten_bind_Decoder_GetAttributeInt32ForAllPoints_3=function(){return(Hc=a._emscripten_bind_Decoder_GetAttributeInt32ForAllPoints_3=a.asm.fb).apply(null,arguments)},Ic=a._emscripten_bind_Decoder_GetAttributeUInt32ForAllPoints_3=function(){return(Ic=a._emscripten_bind_Decoder_GetAttributeUInt32ForAllPoints_3=a.asm.gb).apply(null,arguments)},Jc=a._emscripten_bind_Decoder_GetAttributeDataArrayForAllPoints_5=
function(){return(Jc=a._emscripten_bind_Decoder_GetAttributeDataArrayForAllPoints_5=a.asm.hb).apply(null,arguments)},Kc=a._emscripten_bind_Decoder_SkipAttributeTransform_1=function(){return(Kc=a._emscripten_bind_Decoder_SkipAttributeTransform_1=a.asm.ib).apply(null,arguments)},Lc=a._emscripten_bind_Decoder_GetEncodedGeometryType_Deprecated_1=function(){return(Lc=a._emscripten_bind_Decoder_GetEncodedGeometryType_Deprecated_1=a.asm.jb).apply(null,arguments)},Mc=a._emscripten_bind_Decoder_DecodeBufferToPointCloud_2=
function(){return(Mc=a._emscripten_bind_Decoder_DecodeBufferToPointCloud_2=a.asm.kb).apply(null,arguments)},Nc=a._emscripten_bind_Decoder_DecodeBufferToMesh_2=function(){return(Nc=a._emscripten_bind_Decoder_DecodeBufferToMesh_2=a.asm.lb).apply(null,arguments)},Oc=a._emscripten_bind_Decoder___destroy___0=function(){return(Oc=a._emscripten_bind_Decoder___destroy___0=a.asm.mb).apply(null,arguments)},Pc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_INVALID_TRANSFORM=function(){return(Pc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_INVALID_TRANSFORM=
a.asm.nb).apply(null,arguments)},Qc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_NO_TRANSFORM=function(){return(Qc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_NO_TRANSFORM=a.asm.ob).apply(null,arguments)},Rc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_QUANTIZATION_TRANSFORM=function(){return(Rc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_QUANTIZATION_TRANSFORM=a.asm.pb).apply(null,arguments)},Sc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_OCTAHEDRON_TRANSFORM=
function(){return(Sc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_OCTAHEDRON_TRANSFORM=a.asm.qb).apply(null,arguments)},Tc=a._emscripten_enum_draco_GeometryAttribute_Type_INVALID=function(){return(Tc=a._emscripten_enum_draco_GeometryAttribute_Type_INVALID=a.asm.rb).apply(null,arguments)},Uc=a._emscripten_enum_draco_GeometryAttribute_Type_POSITION=function(){return(Uc=a._emscripten_enum_draco_GeometryAttribute_Type_POSITION=a.asm.sb).apply(null,arguments)},Vc=a._emscripten_enum_draco_GeometryAttribute_Type_NORMAL=
function(){return(Vc=a._emscripten_enum_draco_GeometryAttribute_Type_NORMAL=a.asm.tb).apply(null,arguments)},Wc=a._emscripten_enum_draco_GeometryAttribute_Type_COLOR=function(){return(Wc=a._emscripten_enum_draco_GeometryAttribute_Type_COLOR=a.asm.ub).apply(null,arguments)},Xc=a._emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD=function(){return(Xc=a._emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD=a.asm.vb).apply(null,arguments)},Yc=a._emscripten_enum_draco_GeometryAttribute_Type_GENERIC=
function(){return(Yc=a._emscripten_enum_draco_GeometryAttribute_Type_GENERIC=a.asm.wb).apply(null,arguments)},Zc=a._emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE=function(){return(Zc=a._emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE=a.asm.xb).apply(null,arguments)},$c=a._emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD=function(){return($c=a._emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD=a.asm.yb).apply(null,arguments)},ad=a._emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH=
function(){return(ad=a._emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH=a.asm.zb).apply(null,arguments)},bd=a._emscripten_enum_draco_DataType_DT_INVALID=function(){return(bd=a._emscripten_enum_draco_DataType_DT_INVALID=a.asm.Ab).apply(null,arguments)},cd=a._emscripten_enum_draco_DataType_DT_INT8=function(){return(cd=a._emscripten_enum_draco_DataType_DT_INT8=a.asm.Bb).apply(null,arguments)},dd=a._emscripten_enum_draco_DataType_DT_UINT8=function(){return(dd=a._emscripten_enum_draco_DataType_DT_UINT8=
a.asm.Cb).apply(null,arguments)},ed=a._emscripten_enum_draco_DataType_DT_INT16=function(){return(ed=a._emscripten_enum_draco_DataType_DT_INT16=a.asm.Db).apply(null,arguments)},fd=a._emscripten_enum_draco_DataType_DT_UINT16=function(){return(fd=a._emscripten_enum_draco_DataType_DT_UINT16=a.asm.Eb).apply(null,arguments)},gd=a._emscripten_enum_draco_DataType_DT_INT32=function(){return(gd=a._emscripten_enum_draco_DataType_DT_INT32=a.asm.Fb).apply(null,arguments)},hd=a._emscripten_enum_draco_DataType_DT_UINT32=
function(){return(hd=a._emscripten_enum_draco_DataType_DT_UINT32=a.asm.Gb).apply(null,arguments)},id=a._emscripten_enum_draco_DataType_DT_INT64=function(){return(id=a._emscripten_enum_draco_DataType_DT_INT64=a.asm.Hb).apply(null,arguments)},jd=a._emscripten_enum_draco_DataType_DT_UINT64=function(){return(jd=a._emscripten_enum_draco_DataType_DT_UINT64=a.asm.Ib).apply(null,arguments)},kd=a._emscripten_enum_draco_DataType_DT_FLOAT32=function(){return(kd=a._emscripten_enum_draco_DataType_DT_FLOAT32=a.asm.Jb).apply(null,
arguments)},ld=a._emscripten_enum_draco_DataType_DT_FLOAT64=function(){return(ld=a._emscripten_enum_draco_DataType_DT_FLOAT64=a.asm.Kb).apply(null,arguments)},md=a._emscripten_enum_draco_DataType_DT_BOOL=function(){return(md=a._emscripten_enum_draco_DataType_DT_BOOL=a.asm.Lb).apply(null,arguments)},nd=a._emscripten_enum_draco_DataType_DT_TYPES_COUNT=function(){return(nd=a._emscripten_enum_draco_DataType_DT_TYPES_COUNT=a.asm.Mb).apply(null,arguments)},od=a._emscripten_enum_draco_StatusCode_OK=function(){return(od=
a._emscripten_enum_draco_StatusCode_OK=a.asm.Nb).apply(null,arguments)},pd=a._emscripten_enum_draco_StatusCode_DRACO_ERROR=function(){return(pd=a._emscripten_enum_draco_StatusCode_DRACO_ERROR=a.asm.Ob).apply(null,arguments)},qd=a._emscripten_enum_draco_StatusCode_IO_ERROR=function(){return(qd=a._emscripten_enum_draco_StatusCode_IO_ERROR=a.asm.Pb).apply(null,arguments)},rd=a._emscripten_enum_draco_StatusCode_INVALID_PARAMETER=function(){return(rd=a._emscripten_enum_draco_StatusCode_INVALID_PARAMETER=
a.asm.Qb).apply(null,arguments)},sd=a._emscripten_enum_draco_StatusCode_UNSUPPORTED_VERSION=function(){return(sd=a._emscripten_enum_draco_StatusCode_UNSUPPORTED_VERSION=a.asm.Rb).apply(null,arguments)},td=a._emscripten_enum_draco_StatusCode_UNKNOWN_VERSION=function(){return(td=a._emscripten_enum_draco_StatusCode_UNKNOWN_VERSION=a.asm.Sb).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.Tb).apply(null,arguments)};a._free=function(){return(a._free=a.asm.Ub).apply(null,arguments)};
var ya=function(){return(ya=a.asm.Vb).apply(null,arguments)};a.___start_em_js=15856;a.___stop_em_js=15954;var la;ia=function b(){la||ba();la||(ia=b)};if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();ba();t.prototype=Object.create(t.prototype);t.prototype.constructor=t;t.prototype.__class__=t;t.__cache__={};a.WrapperObject=t;a.getCache=x;a.wrapPointer=D;a.castObject=function(b,c){return D(b.ptr,c)};a.NULL=D(0);a.destroy=function(b){if(!b.__destroy__)throw"Error: Cannot destroy object. (Did you create it yourself?)";
b.__destroy__();delete x(b.__class__)[b.ptr]};a.compare=function(b,c){return b.ptr===c.ptr};a.getPointer=function(b){return b.ptr};a.getClass=function(b){return b.__class__};var r={buffer:0,size:0,pos:0,temps:[],needed:0,prepare:function(){if(r.needed){for(var b=0;b<r.temps.length;b++)a._free(r.temps[b]);r.temps.length=0;a._free(r.buffer);r.buffer=0;r.size+=r.needed;r.needed=0}r.buffer||(r.size+=128,r.buffer=a._malloc(r.size),r.buffer||f(void 0));r.pos=0},alloc:function(b,c){r.buffer||f(void 0);b=
b.length*c.BYTES_PER_ELEMENT;b=b+7&-8;r.pos+b>=r.size?(0<b||f(void 0),r.needed+=b,c=a._malloc(b),r.temps.push(c)):(c=r.buffer+r.pos,r.pos+=b);return c},copy:function(b,c,d){d>>>=0;switch(c.BYTES_PER_ELEMENT){case 2:d>>>=1;break;case 4:d>>>=2;break;case 8:d>>>=3}for(var g=0;g<b.length;g++)c[d+g]=b[g]}};Z.prototype=Object.create(t.prototype);Z.prototype.constructor=Z;Z.prototype.__class__=Z;Z.__cache__={};a.VoidPtr=Z;Z.prototype.__destroy__=Z.prototype.__destroy__=function(){bb(this.ptr)};S.prototype=
Object.create(t.prototype);S.prototype.constructor=S;S.prototype.__class__=S;S.__cache__={};a.DecoderBuffer=S;S.prototype.Init=S.prototype.Init=function(b,c){var d=this.ptr;r.prepare();"object"==typeof b&&(b=pa(b));c&&"object"===typeof c&&(c=c.ptr);cb(d,b,c)};S.prototype.__destroy__=S.prototype.__destroy__=function(){db(this.ptr)};Q.prototype=Object.create(t.prototype);Q.prototype.constructor=Q;Q.prototype.__class__=Q;Q.__cache__={};a.AttributeTransformData=Q;Q.prototype.transform_type=Q.prototype.transform_type=
function(){return eb(this.ptr)};Q.prototype.__destroy__=Q.prototype.__destroy__=function(){fb(this.ptr)};W.prototype=Object.create(t.prototype);W.prototype.constructor=W;W.prototype.__class__=W;W.__cache__={};a.GeometryAttribute=W;W.prototype.__destroy__=W.prototype.__destroy__=function(){gb(this.ptr)};w.prototype=Object.create(t.prototype);w.prototype.constructor=w;w.prototype.__class__=w;w.__cache__={};a.PointAttribute=w;w.prototype.size=w.prototype.size=function(){return hb(this.ptr)};w.prototype.GetAttributeTransformData=
w.prototype.GetAttributeTransformData=function(){return D(ib(this.ptr),Q)};w.prototype.attribute_type=w.prototype.attribute_type=function(){return jb(this.ptr)};w.prototype.data_type=w.prototype.data_type=function(){return kb(this.ptr)};w.prototype.num_components=w.prototype.num_components=function(){return lb(this.ptr)};w.prototype.normalized=w.prototype.normalized=function(){return!!mb(this.ptr)};w.prototype.byte_stride=w.prototype.byte_stride=function(){return nb(this.ptr)};w.prototype.byte_offset=
w.prototype.byte_offset=function(){return ob(this.ptr)};w.prototype.unique_id=w.prototype.unique_id=function(){return pb(this.ptr)};w.prototype.__destroy__=w.prototype.__destroy__=function(){qb(this.ptr)};C.prototype=Object.create(t.prototype);C.prototype.constructor=C;C.prototype.__class__=C;C.__cache__={};a.AttributeQuantizationTransform=C;C.prototype.InitFromAttribute=C.prototype.InitFromAttribute=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return!!rb(c,b)};C.prototype.quantization_bits=
C.prototype.quantization_bits=function(){return sb(this.ptr)};C.prototype.min_value=C.prototype.min_value=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return tb(c,b)};C.prototype.range=C.prototype.range=function(){return ub(this.ptr)};C.prototype.__destroy__=C.prototype.__destroy__=function(){vb(this.ptr)};F.prototype=Object.create(t.prototype);F.prototype.constructor=F;F.prototype.__class__=F;F.__cache__={};a.AttributeOctahedronTransform=F;F.prototype.InitFromAttribute=F.prototype.InitFromAttribute=
function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return!!wb(c,b)};F.prototype.quantization_bits=F.prototype.quantization_bits=function(){return xb(this.ptr)};F.prototype.__destroy__=F.prototype.__destroy__=function(){yb(this.ptr)};G.prototype=Object.create(t.prototype);G.prototype.constructor=G;G.prototype.__class__=G;G.__cache__={};a.PointCloud=G;G.prototype.num_attributes=G.prototype.num_attributes=function(){return zb(this.ptr)};G.prototype.num_points=G.prototype.num_points=function(){return Ab(this.ptr)};
G.prototype.__destroy__=G.prototype.__destroy__=function(){Bb(this.ptr)};E.prototype=Object.create(t.prototype);E.prototype.constructor=E;E.prototype.__class__=E;E.__cache__={};a.Mesh=E;E.prototype.num_faces=E.prototype.num_faces=function(){return Cb(this.ptr)};E.prototype.num_attributes=E.prototype.num_attributes=function(){return Db(this.ptr)};E.prototype.num_points=E.prototype.num_points=function(){return Eb(this.ptr)};E.prototype.__destroy__=E.prototype.__destroy__=function(){Fb(this.ptr)};T.prototype=
Object.create(t.prototype);T.prototype.constructor=T;T.prototype.__class__=T;T.__cache__={};a.Metadata=T;T.prototype.__destroy__=T.prototype.__destroy__=function(){Gb(this.ptr)};B.prototype=Object.create(t.prototype);B.prototype.constructor=B;B.prototype.__class__=B;B.__cache__={};a.Status=B;B.prototype.code=B.prototype.code=function(){return Hb(this.ptr)};B.prototype.ok=B.prototype.ok=function(){return!!Ib(this.ptr)};B.prototype.error_msg=B.prototype.error_msg=function(){return h(Jb(this.ptr))};
B.prototype.__destroy__=B.prototype.__destroy__=function(){Kb(this.ptr)};H.prototype=Object.create(t.prototype);H.prototype.constructor=H;H.prototype.__class__=H;H.__cache__={};a.DracoFloat32Array=H;H.prototype.GetValue=H.prototype.GetValue=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return Lb(c,b)};H.prototype.size=H.prototype.size=function(){return Mb(this.ptr)};H.prototype.__destroy__=H.prototype.__destroy__=function(){Nb(this.ptr)};I.prototype=Object.create(t.prototype);I.prototype.constructor=
I;I.prototype.__class__=I;I.__cache__={};a.DracoInt8Array=I;I.prototype.GetValue=I.prototype.GetValue=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return Ob(c,b)};I.prototype.size=I.prototype.size=function(){return Pb(this.ptr)};I.prototype.__destroy__=I.prototype.__destroy__=function(){Qb(this.ptr)};J.prototype=Object.create(t.prototype);J.prototype.constructor=J;J.prototype.__class__=J;J.__cache__={};a.DracoUInt8Array=J;J.prototype.GetValue=J.prototype.GetValue=function(b){var c=
this.ptr;b&&"object"===typeof b&&(b=b.ptr);return Rb(c,b)};J.prototype.size=J.prototype.size=function(){return Sb(this.ptr)};J.prototype.__destroy__=J.prototype.__destroy__=function(){Tb(this.ptr)};K.prototype=Object.create(t.prototype);K.prototype.constructor=K;K.prototype.__class__=K;K.__cache__={};a.DracoInt16Array=K;K.prototype.GetValue=K.prototype.GetValue=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return Ub(c,b)};K.prototype.size=K.prototype.size=function(){return Vb(this.ptr)};
K.prototype.__destroy__=K.prototype.__destroy__=function(){Wb(this.ptr)};L.prototype=Object.create(t.prototype);L.prototype.constructor=L;L.prototype.__class__=L;L.__cache__={};a.DracoUInt16Array=L;L.prototype.GetValue=L.prototype.GetValue=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return Xb(c,b)};L.prototype.size=L.prototype.size=function(){return Yb(this.ptr)};L.prototype.__destroy__=L.prototype.__destroy__=function(){Zb(this.ptr)};M.prototype=Object.create(t.prototype);M.prototype.constructor=
M;M.prototype.__class__=M;M.__cache__={};a.DracoInt32Array=M;M.prototype.GetValue=M.prototype.GetValue=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return $b(c,b)};M.prototype.size=M.prototype.size=function(){return ac(this.ptr)};M.prototype.__destroy__=M.prototype.__destroy__=function(){bc(this.ptr)};N.prototype=Object.create(t.prototype);N.prototype.constructor=N;N.prototype.__class__=N;N.__cache__={};a.DracoUInt32Array=N;N.prototype.GetValue=N.prototype.GetValue=function(b){var c=
this.ptr;b&&"object"===typeof b&&(b=b.ptr);return cc(c,b)};N.prototype.size=N.prototype.size=function(){return dc(this.ptr)};N.prototype.__destroy__=N.prototype.__destroy__=function(){ec(this.ptr)};y.prototype=Object.create(t.prototype);y.prototype.constructor=y;y.prototype.__class__=y;y.__cache__={};a.MetadataQuerier=y;y.prototype.HasEntry=y.prototype.HasEntry=function(b,c){var d=this.ptr;r.prepare();b&&"object"===typeof b&&(b=b.ptr);c=c&&"object"===typeof c?c.ptr:R(c);return!!fc(d,b,c)};y.prototype.GetIntEntry=
y.prototype.GetIntEntry=function(b,c){var d=this.ptr;r.prepare();b&&"object"===typeof b&&(b=b.ptr);c=c&&"object"===typeof c?c.ptr:R(c);return gc(d,b,c)};y.prototype.GetIntEntryArray=y.prototype.GetIntEntryArray=function(b,c,d){var g=this.ptr;r.prepare();b&&"object"===typeof b&&(b=b.ptr);c=c&&"object"===typeof c?c.ptr:R(c);d&&"object"===typeof d&&(d=d.ptr);hc(g,b,c,d)};y.prototype.GetDoubleEntry=y.prototype.GetDoubleEntry=function(b,c){var d=this.ptr;r.prepare();b&&"object"===typeof b&&(b=b.ptr);c=
c&&"object"===typeof c?c.ptr:R(c);return ic(d,b,c)};y.prototype.GetStringEntry=y.prototype.GetStringEntry=function(b,c){var d=this.ptr;r.prepare();b&&"object"===typeof b&&(b=b.ptr);c=c&&"object"===typeof c?c.ptr:R(c);return h(jc(d,b,c))};y.prototype.NumEntries=y.prototype.NumEntries=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return kc(c,b)};y.prototype.GetEntryName=y.prototype.GetEntryName=function(b,c){var d=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=
c.ptr);return h(lc(d,b,c))};y.prototype.__destroy__=y.prototype.__destroy__=function(){mc(this.ptr)};m.prototype=Object.create(t.prototype);m.prototype.constructor=m;m.prototype.__class__=m;m.__cache__={};a.Decoder=m;m.prototype.DecodeArrayToPointCloud=m.prototype.DecodeArrayToPointCloud=function(b,c,d){var g=this.ptr;r.prepare();"object"==typeof b&&(b=pa(b));c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return D(nc(g,b,c,d),B)};m.prototype.DecodeArrayToMesh=m.prototype.DecodeArrayToMesh=
function(b,c,d){var g=this.ptr;r.prepare();"object"==typeof b&&(b=pa(b));c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return D(oc(g,b,c,d),B)};m.prototype.GetAttributeId=m.prototype.GetAttributeId=function(b,c){var d=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);return pc(d,b,c)};m.prototype.GetAttributeIdByName=m.prototype.GetAttributeIdByName=function(b,c){var d=this.ptr;r.prepare();b&&"object"===typeof b&&(b=b.ptr);c=c&&"object"===typeof c?
c.ptr:R(c);return qc(d,b,c)};m.prototype.GetAttributeIdByMetadataEntry=m.prototype.GetAttributeIdByMetadataEntry=function(b,c,d){var g=this.ptr;r.prepare();b&&"object"===typeof b&&(b=b.ptr);c=c&&"object"===typeof c?c.ptr:R(c);d=d&&"object"===typeof d?d.ptr:R(d);return rc(g,b,c,d)};m.prototype.GetAttribute=m.prototype.GetAttribute=function(b,c){var d=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);return D(sc(d,b,c),w)};m.prototype.GetAttributeByUniqueId=m.prototype.GetAttributeByUniqueId=
function(b,c){var d=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);return D(tc(d,b,c),w)};m.prototype.GetMetadata=m.prototype.GetMetadata=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return D(uc(c,b),T)};m.prototype.GetAttributeMetadata=m.prototype.GetAttributeMetadata=function(b,c){var d=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);return D(vc(d,b,c),T)};m.prototype.GetFaceFromMesh=m.prototype.GetFaceFromMesh=function(b,
c,d){var g=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!wc(g,b,c,d)};m.prototype.GetTriangleStripsFromMesh=m.prototype.GetTriangleStripsFromMesh=function(b,c){var d=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);return xc(d,b,c)};m.prototype.GetTrianglesUInt16Array=m.prototype.GetTrianglesUInt16Array=function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);
d&&"object"===typeof d&&(d=d.ptr);return!!yc(g,b,c,d)};m.prototype.GetTrianglesUInt32Array=m.prototype.GetTrianglesUInt32Array=function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!zc(g,b,c,d)};m.prototype.GetAttributeFloat=m.prototype.GetAttributeFloat=function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!Ac(g,b,c,d)};m.prototype.GetAttributeFloatForAllPoints=
m.prototype.GetAttributeFloatForAllPoints=function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!Bc(g,b,c,d)};m.prototype.GetAttributeIntForAllPoints=m.prototype.GetAttributeIntForAllPoints=function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!Cc(g,b,c,d)};m.prototype.GetAttributeInt8ForAllPoints=m.prototype.GetAttributeInt8ForAllPoints=
function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!Dc(g,b,c,d)};m.prototype.GetAttributeUInt8ForAllPoints=m.prototype.GetAttributeUInt8ForAllPoints=function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!Ec(g,b,c,d)};m.prototype.GetAttributeInt16ForAllPoints=m.prototype.GetAttributeInt16ForAllPoints=function(b,c,d){var g=this.ptr;
b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!Fc(g,b,c,d)};m.prototype.GetAttributeUInt16ForAllPoints=m.prototype.GetAttributeUInt16ForAllPoints=function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!Gc(g,b,c,d)};m.prototype.GetAttributeInt32ForAllPoints=m.prototype.GetAttributeInt32ForAllPoints=function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&
(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!Hc(g,b,c,d)};m.prototype.GetAttributeUInt32ForAllPoints=m.prototype.GetAttributeUInt32ForAllPoints=function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!Ic(g,b,c,d)};m.prototype.GetAttributeDataArrayForAllPoints=m.prototype.GetAttributeDataArrayForAllPoints=function(b,c,d,g,u){var X=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&
"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);g&&"object"===typeof g&&(g=g.ptr);u&&"object"===typeof u&&(u=u.ptr);return!!Jc(X,b,c,d,g,u)};m.prototype.SkipAttributeTransform=m.prototype.SkipAttributeTransform=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);Kc(c,b)};m.prototype.GetEncodedGeometryType_Deprecated=m.prototype.GetEncodedGeometryType_Deprecated=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return Lc(c,b)};m.prototype.DecodeBufferToPointCloud=
m.prototype.DecodeBufferToPointCloud=function(b,c){var d=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);return D(Mc(d,b,c),B)};m.prototype.DecodeBufferToMesh=m.prototype.DecodeBufferToMesh=function(b,c){var d=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);return D(Nc(d,b,c),B)};m.prototype.__destroy__=m.prototype.__destroy__=function(){Oc(this.ptr)};(function(){function b(){a.ATTRIBUTE_INVALID_TRANSFORM=Pc();a.ATTRIBUTE_NO_TRANSFORM=Qc();
a.ATTRIBUTE_QUANTIZATION_TRANSFORM=Rc();a.ATTRIBUTE_OCTAHEDRON_TRANSFORM=Sc();a.INVALID=Tc();a.POSITION=Uc();a.NORMAL=Vc();a.COLOR=Wc();a.TEX_COORD=Xc();a.GENERIC=Yc();a.INVALID_GEOMETRY_TYPE=Zc();a.POINT_CLOUD=$c();a.TRIANGULAR_MESH=ad();a.DT_INVALID=bd();a.DT_INT8=cd();a.DT_UINT8=dd();a.DT_INT16=ed();a.DT_UINT16=fd();a.DT_INT32=gd();a.DT_UINT32=hd();a.DT_INT64=id();a.DT_UINT64=jd();a.DT_FLOAT32=kd();a.DT_FLOAT64=ld();a.DT_BOOL=md();a.DT_TYPES_COUNT=nd();a.OK=od();a.DRACO_ERROR=pd();a.IO_ERROR=qd();
a.INVALID_PARAMETER=rd();a.UNSUPPORTED_VERSION=sd();a.UNKNOWN_VERSION=td()}za?b():oa.unshift(b)})();if("function"===typeof a.onModuleParsed)a.onModuleParsed();a.Decoder.prototype.GetEncodedGeometryType=function(b){if(b.__class__&&b.__class__===a.DecoderBuffer)return a.Decoder.prototype.GetEncodedGeometryType_Deprecated(b);if(8>b.byteLength)return a.INVALID_GEOMETRY_TYPE;switch(b[7]){case 0:return a.POINT_CLOUD;case 1:return a.TRIANGULAR_MESH;default:return a.INVALID_GEOMETRY_TYPE}};return n.ready}}();
"object"===typeof exports&&"object"===typeof module?module.exports=DracoDecoderModule:"function"===typeof define&&define.amd?define([],function(){return DracoDecoderModule}):"object"===typeof exports&&(exports.DracoDecoderModule=DracoDecoderModule);
static/draco/gltf/draco_wasm_wrapper.js
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(h){var n=0;return function(){return n<h.length?{done:!1,value:h[n++]}:{done:!0}}};$jscomp.arrayIterator=function(h){return{next:$jscomp.arrayIteratorImpl(h)}};$jscomp.makeIterator=function(h){var n="undefined"!=typeof Symbol&&Symbol.iterator&&h[Symbol.iterator];return n?n.call(h):$jscomp.arrayIterator(h)};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;
$jscomp.ISOLATE_POLYFILLS=!1;$jscomp.FORCE_POLYFILL_PROMISE=!1;$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1;$jscomp.getGlobal=function(h){h=["object"==typeof globalThis&&globalThis,h,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var n=0;n<h.length;++n){var k=h[n];if(k&&k.Math==Math)return k}throw Error("Cannot find global object");};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(h,n,k){if(h==Array.prototype||h==Object.prototype)return h;h[n]=k.value;return h};$jscomp.IS_SYMBOL_NATIVE="function"===typeof Symbol&&"symbol"===typeof Symbol("x");$jscomp.TRUST_ES6_POLYFILLS=!$jscomp.ISOLATE_POLYFILLS||$jscomp.IS_SYMBOL_NATIVE;$jscomp.polyfills={};$jscomp.propertyToPolyfillSymbol={};$jscomp.POLYFILL_PREFIX="$jscp$";
var $jscomp$lookupPolyfilledValue=function(h,n){var k=$jscomp.propertyToPolyfillSymbol[n];if(null==k)return h[n];k=h[k];return void 0!==k?k:h[n]};$jscomp.polyfill=function(h,n,k,p){n&&($jscomp.ISOLATE_POLYFILLS?$jscomp.polyfillIsolated(h,n,k,p):$jscomp.polyfillUnisolated(h,n,k,p))};
$jscomp.polyfillUnisolated=function(h,n,k,p){k=$jscomp.global;h=h.split(".");for(p=0;p<h.length-1;p++){var l=h[p];if(!(l in k))return;k=k[l]}h=h[h.length-1];p=k[h];n=n(p);n!=p&&null!=n&&$jscomp.defineProperty(k,h,{configurable:!0,writable:!0,value:n})};
$jscomp.polyfillIsolated=function(h,n,k,p){var l=h.split(".");h=1===l.length;p=l[0];p=!h&&p in $jscomp.polyfills?$jscomp.polyfills:$jscomp.global;for(var y=0;y<l.length-1;y++){var f=l[y];if(!(f in p))return;p=p[f]}l=l[l.length-1];k=$jscomp.IS_SYMBOL_NATIVE&&"es6"===k?p[l]:null;n=n(k);null!=n&&(h?$jscomp.defineProperty($jscomp.polyfills,l,{configurable:!0,writable:!0,value:n}):n!==k&&(void 0===$jscomp.propertyToPolyfillSymbol[l]&&(k=1E9*Math.random()>>>0,$jscomp.propertyToPolyfillSymbol[l]=$jscomp.IS_SYMBOL_NATIVE?
$jscomp.global.Symbol(l):$jscomp.POLYFILL_PREFIX+k+"$"+l),$jscomp.defineProperty(p,$jscomp.propertyToPolyfillSymbol[l],{configurable:!0,writable:!0,value:n})))};
$jscomp.polyfill("Promise",function(h){function n(){this.batch_=null}function k(f){return f instanceof l?f:new l(function(q,u){q(f)})}if(h&&(!($jscomp.FORCE_POLYFILL_PROMISE||$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION&&"undefined"===typeof $jscomp.global.PromiseRejectionEvent)||!$jscomp.global.Promise||-1===$jscomp.global.Promise.toString().indexOf("[native code]")))return h;n.prototype.asyncExecute=function(f){if(null==this.batch_){this.batch_=[];var q=this;this.asyncExecuteFunction(function(){q.executeBatch_()})}this.batch_.push(f)};
var p=$jscomp.global.setTimeout;n.prototype.asyncExecuteFunction=function(f){p(f,0)};n.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var f=this.batch_;this.batch_=[];for(var q=0;q<f.length;++q){var u=f[q];f[q]=null;try{u()}catch(A){this.asyncThrow_(A)}}}this.batch_=null};n.prototype.asyncThrow_=function(f){this.asyncExecuteFunction(function(){throw f;})};var l=function(f){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];this.isRejectionHandled_=!1;var q=this.createResolveAndReject_();
try{f(q.resolve,q.reject)}catch(u){q.reject(u)}};l.prototype.createResolveAndReject_=function(){function f(A){return function(F){u||(u=!0,A.call(q,F))}}var q=this,u=!1;return{resolve:f(this.resolveTo_),reject:f(this.reject_)}};l.prototype.resolveTo_=function(f){if(f===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(f instanceof l)this.settleSameAsPromise_(f);else{a:switch(typeof f){case "object":var q=null!=f;break a;case "function":q=!0;break a;default:q=!1}q?this.resolveToNonPromiseObj_(f):
this.fulfill_(f)}};l.prototype.resolveToNonPromiseObj_=function(f){var q=void 0;try{q=f.then}catch(u){this.reject_(u);return}"function"==typeof q?this.settleSameAsThenable_(q,f):this.fulfill_(f)};l.prototype.reject_=function(f){this.settle_(2,f)};l.prototype.fulfill_=function(f){this.settle_(1,f)};l.prototype.settle_=function(f,q){if(0!=this.state_)throw Error("Cannot settle("+f+", "+q+"): Promise already settled in state"+this.state_);this.state_=f;this.result_=q;2===this.state_&&this.scheduleUnhandledRejectionCheck_();
this.executeOnSettledCallbacks_()};l.prototype.scheduleUnhandledRejectionCheck_=function(){var f=this;p(function(){if(f.notifyUnhandledRejection_()){var q=$jscomp.global.console;"undefined"!==typeof q&&q.error(f.result_)}},1)};l.prototype.notifyUnhandledRejection_=function(){if(this.isRejectionHandled_)return!1;var f=$jscomp.global.CustomEvent,q=$jscomp.global.Event,u=$jscomp.global.dispatchEvent;if("undefined"===typeof u)return!0;"function"===typeof f?f=new f("unhandledrejection",{cancelable:!0}):
"function"===typeof q?f=new q("unhandledrejection",{cancelable:!0}):(f=$jscomp.global.document.createEvent("CustomEvent"),f.initCustomEvent("unhandledrejection",!1,!0,f));f.promise=this;f.reason=this.result_;return u(f)};l.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var f=0;f<this.onSettledCallbacks_.length;++f)y.asyncExecute(this.onSettledCallbacks_[f]);this.onSettledCallbacks_=null}};var y=new n;l.prototype.settleSameAsPromise_=function(f){var q=this.createResolveAndReject_();
f.callWhenSettled_(q.resolve,q.reject)};l.prototype.settleSameAsThenable_=function(f,q){var u=this.createResolveAndReject_();try{f.call(q,u.resolve,u.reject)}catch(A){u.reject(A)}};l.prototype.then=function(f,q){function u(w,B){return"function"==typeof w?function(R){try{A(w(R))}catch(Z){F(Z)}}:B}var A,F,v=new l(function(w,B){A=w;F=B});this.callWhenSettled_(u(f,A),u(q,F));return v};l.prototype.catch=function(f){return this.then(void 0,f)};l.prototype.callWhenSettled_=function(f,q){function u(){switch(A.state_){case 1:f(A.result_);
break;case 2:q(A.result_);break;default:throw Error("Unexpected state: "+A.state_);}}var A=this;null==this.onSettledCallbacks_?y.asyncExecute(u):this.onSettledCallbacks_.push(u);this.isRejectionHandled_=!0};l.resolve=k;l.reject=function(f){return new l(function(q,u){u(f)})};l.race=function(f){return new l(function(q,u){for(var A=$jscomp.makeIterator(f),F=A.next();!F.done;F=A.next())k(F.value).callWhenSettled_(q,u)})};l.all=function(f){var q=$jscomp.makeIterator(f),u=q.next();return u.done?k([]):new l(function(A,
F){function v(R){return function(Z){w[R]=Z;B--;0==B&&A(w)}}var w=[],B=0;do w.push(void 0),B++,k(u.value).callWhenSettled_(v(w.length-1),F),u=q.next();while(!u.done)})};return l},"es6","es3");$jscomp.owns=function(h,n){return Object.prototype.hasOwnProperty.call(h,n)};$jscomp.assign=$jscomp.TRUST_ES6_POLYFILLS&&"function"==typeof Object.assign?Object.assign:function(h,n){for(var k=1;k<arguments.length;k++){var p=arguments[k];if(p)for(var l in p)$jscomp.owns(p,l)&&(h[l]=p[l])}return h};
$jscomp.polyfill("Object.assign",function(h){return h||$jscomp.assign},"es6","es3");$jscomp.checkStringArgs=function(h,n,k){if(null==h)throw new TypeError("The 'this' value for String.prototype."+k+" must not be null or undefined");if(n instanceof RegExp)throw new TypeError("First argument to String.prototype."+k+" must not be a regular expression");return h+""};
$jscomp.polyfill("String.prototype.startsWith",function(h){return h?h:function(n,k){var p=$jscomp.checkStringArgs(this,n,"startsWith");n+="";var l=p.length,y=n.length;k=Math.max(0,Math.min(k|0,p.length));for(var f=0;f<y&&k<l;)if(p[k++]!=n[f++])return!1;return f>=y}},"es6","es3");
$jscomp.polyfill("Array.prototype.copyWithin",function(h){function n(k){k=Number(k);return Infinity===k||-Infinity===k?k:k|0}return h?h:function(k,p,l){var y=this.length;k=n(k);p=n(p);l=void 0===l?y:n(l);k=0>k?Math.max(y+k,0):Math.min(k,y);p=0>p?Math.max(y+p,0):Math.min(p,y);l=0>l?Math.max(y+l,0):Math.min(l,y);if(k<p)for(;p<l;)p in this?this[k++]=this[p++]:(delete this[k++],p++);else for(l=Math.min(l,y+p-k),k+=l-p;l>p;)--l in this?this[--k]=this[l]:delete this[--k];return this}},"es6","es3");
$jscomp.typedArrayCopyWithin=function(h){return h?h:Array.prototype.copyWithin};$jscomp.polyfill("Int8Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Uint8Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Uint8ClampedArray.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Int16Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");
$jscomp.polyfill("Uint16Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Int32Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Uint32Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Float32Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Float64Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");
var DracoDecoderModule=function(){var h="undefined"!==typeof document&&document.currentScript?document.currentScript.src:void 0;"undefined"!==typeof __filename&&(h=h||__filename);return function(n){function k(e){return a.locateFile?a.locateFile(e,U):U+e}function p(e,b){if(e){var c=ia;var d=e+b;for(b=e;c[b]&&!(b>=d);)++b;if(16<b-e&&c.buffer&&ra)c=ra.decode(c.subarray(e,b));else{for(d="";e<b;){var g=c[e++];if(g&128){var t=c[e++]&63;if(192==(g&224))d+=String.fromCharCode((g&31)<<6|t);else{var aa=c[e++]&
63;g=224==(g&240)?(g&15)<<12|t<<6|aa:(g&7)<<18|t<<12|aa<<6|c[e++]&63;65536>g?d+=String.fromCharCode(g):(g-=65536,d+=String.fromCharCode(55296|g>>10,56320|g&1023))}}else d+=String.fromCharCode(g)}c=d}}else c="";return c}function l(){var e=ja.buffer;a.HEAP8=W=new Int8Array(e);a.HEAP16=new Int16Array(e);a.HEAP32=ca=new Int32Array(e);a.HEAPU8=ia=new Uint8Array(e);a.HEAPU16=new Uint16Array(e);a.HEAPU32=Y=new Uint32Array(e);a.HEAPF32=new Float32Array(e);a.HEAPF64=new Float64Array(e)}function y(e){if(a.onAbort)a.onAbort(e);
e="Aborted("+e+")";da(e);sa=!0;e=new WebAssembly.RuntimeError(e+". Build with -sASSERTIONS for more info.");ka(e);throw e;}function f(e){try{if(e==P&&ea)return new Uint8Array(ea);if(ma)return ma(e);throw"both async and sync fetching of the wasm failed";}catch(b){y(b)}}function q(){if(!ea&&(ta||fa)){if("function"==typeof fetch&&!P.startsWith("file://"))return fetch(P,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load wasm binary file at '"+P+"'";return e.arrayBuffer()}).catch(function(){return f(P)});
if(na)return new Promise(function(e,b){na(P,function(c){e(new Uint8Array(c))},b)})}return Promise.resolve().then(function(){return f(P)})}function u(e){for(;0<e.length;)e.shift()(a)}function A(e){this.excPtr=e;this.ptr=e-24;this.set_type=function(b){Y[this.ptr+4>>2]=b};this.get_type=function(){return Y[this.ptr+4>>2]};this.set_destructor=function(b){Y[this.ptr+8>>2]=b};this.get_destructor=function(){return Y[this.ptr+8>>2]};this.set_refcount=function(b){ca[this.ptr>>2]=b};this.set_caught=function(b){W[this.ptr+
12>>0]=b?1:0};this.get_caught=function(){return 0!=W[this.ptr+12>>0]};this.set_rethrown=function(b){W[this.ptr+13>>0]=b?1:0};this.get_rethrown=function(){return 0!=W[this.ptr+13>>0]};this.init=function(b,c){this.set_adjusted_ptr(0);this.set_type(b);this.set_destructor(c);this.set_refcount(0);this.set_caught(!1);this.set_rethrown(!1)};this.add_ref=function(){ca[this.ptr>>2]+=1};this.release_ref=function(){var b=ca[this.ptr>>2];ca[this.ptr>>2]=b-1;return 1===b};this.set_adjusted_ptr=function(b){Y[this.ptr+
16>>2]=b};this.get_adjusted_ptr=function(){return Y[this.ptr+16>>2]};this.get_exception_ptr=function(){if(ua(this.get_type()))return Y[this.excPtr>>2];var b=this.get_adjusted_ptr();return 0!==b?b:this.excPtr}}function F(){function e(){if(!la&&(la=!0,a.calledRun=!0,!sa)){va=!0;u(oa);wa(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;)xa.unshift(a.postRun.shift());u(xa)}}if(!(0<ba)){if(a.preRun)for("function"==
typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)ya.unshift(a.preRun.shift());u(ya);0<ba||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);e()},1)):e())}}function v(){}function w(e){return(e||v).__cache__}function B(e,b){var c=w(b),d=c[e];if(d)return d;d=Object.create((b||v).prototype);d.ptr=e;return c[e]=d}function R(e){if("string"===typeof e){for(var b=0,c=0;c<e.length;++c){var d=e.charCodeAt(c);127>=d?b++:2047>=d?b+=2:55296<=d&&57343>=
d?(b+=4,++c):b+=3}b=Array(b+1);c=0;d=b.length;if(0<d){d=c+d-1;for(var g=0;g<e.length;++g){var t=e.charCodeAt(g);if(55296<=t&&57343>=t){var aa=e.charCodeAt(++g);t=65536+((t&1023)<<10)|aa&1023}if(127>=t){if(c>=d)break;b[c++]=t}else{if(2047>=t){if(c+1>=d)break;b[c++]=192|t>>6}else{if(65535>=t){if(c+2>=d)break;b[c++]=224|t>>12}else{if(c+3>=d)break;b[c++]=240|t>>18;b[c++]=128|t>>12&63}b[c++]=128|t>>6&63}b[c++]=128|t&63}}b[c]=0}e=r.alloc(b,W);r.copy(b,W,e);return e}return e}function Z(e){if("object"===
typeof e){var b=r.alloc(e,W);r.copy(e,W,b);return b}return e}function X(){throw"cannot construct a VoidPtr, no constructor in IDL";}function S(){this.ptr=za();w(S)[this.ptr]=this}function Q(){this.ptr=Aa();w(Q)[this.ptr]=this}function V(){this.ptr=Ba();w(V)[this.ptr]=this}function x(){this.ptr=Ca();w(x)[this.ptr]=this}function D(){this.ptr=Da();w(D)[this.ptr]=this}function G(){this.ptr=Ea();w(G)[this.ptr]=this}function H(){this.ptr=Fa();w(H)[this.ptr]=this}function E(){this.ptr=Ga();w(E)[this.ptr]=
this}function T(){this.ptr=Ha();w(T)[this.ptr]=this}function C(){throw"cannot construct a Status, no constructor in IDL";}function I(){this.ptr=Ia();w(I)[this.ptr]=this}function J(){this.ptr=Ja();w(J)[this.ptr]=this}function K(){this.ptr=Ka();w(K)[this.ptr]=this}function L(){this.ptr=La();w(L)[this.ptr]=this}function M(){this.ptr=Ma();w(M)[this.ptr]=this}function N(){this.ptr=Na();w(N)[this.ptr]=this}function O(){this.ptr=Oa();w(O)[this.ptr]=this}function z(){this.ptr=Pa();w(z)[this.ptr]=this}function m(){this.ptr=
Qa();w(m)[this.ptr]=this}n=void 0===n?{}:n;var a="undefined"!=typeof n?n:{},wa,ka;a.ready=new Promise(function(e,b){wa=e;ka=b});var Ra=!1,Sa=!1;a.onRuntimeInitialized=function(){Ra=!0;if(Sa&&"function"===typeof a.onModuleLoaded)a.onModuleLoaded(a)};a.onModuleParsed=function(){Sa=!0;if(Ra&&"function"===typeof a.onModuleLoaded)a.onModuleLoaded(a)};a.isVersionSupported=function(e){if("string"!==typeof e)return!1;e=e.split(".");return 2>e.length||3<e.length?!1:1==e[0]&&0<=e[1]&&5>=e[1]?!0:0!=e[0]||10<
e[1]?!1:!0};var Ta=Object.assign({},a),ta="object"==typeof window,fa="function"==typeof importScripts,Ua="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,U="";if(Ua){var Va=require("fs"),pa=require("path");U=fa?pa.dirname(U)+"/":__dirname+"/";var Wa=function(e,b){e=e.startsWith("file://")?new URL(e):pa.normalize(e);return Va.readFileSync(e,b?void 0:"utf8")};var ma=function(e){e=Wa(e,!0);e.buffer||(e=new Uint8Array(e));return e};var na=function(e,
b,c){e=e.startsWith("file://")?new URL(e):pa.normalize(e);Va.readFile(e,function(d,g){d?c(d):b(g.buffer)})};1<process.argv.length&&process.argv[1].replace(/\\/g,"/");process.argv.slice(2);a.inspect=function(){return"[Emscripten Module object]"}}else if(ta||fa)fa?U=self.location.href:"undefined"!=typeof document&&document.currentScript&&(U=document.currentScript.src),h&&(U=h),U=0!==U.indexOf("blob:")?U.substr(0,U.replace(/[?#].*/,"").lastIndexOf("/")+1):"",Wa=function(e){var b=new XMLHttpRequest;b.open("GET",
e,!1);b.send(null);return b.responseText},fa&&(ma=function(e){var b=new XMLHttpRequest;b.open("GET",e,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)}),na=function(e,b,c){var d=new XMLHttpRequest;d.open("GET",e,!0);d.responseType="arraybuffer";d.onload=function(){200==d.status||0==d.status&&d.response?b(d.response):c()};d.onerror=c;d.send(null)};a.print||console.log.bind(console);var da=a.printErr||console.warn.bind(console);Object.assign(a,Ta);Ta=null;var ea;a.wasmBinary&&
(ea=a.wasmBinary);"object"!=typeof WebAssembly&&y("no native wasm support detected");var ja,sa=!1,ra="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,W,ia,ca,Y,ya=[],oa=[],xa=[],va=!1,ba=0,qa=null,ha=null;var P="draco_decoder_gltf.wasm";P.startsWith("data:application/octet-stream;base64,")||(P=k(P));var pd=0,qd={b:function(e,b,c){(new A(e)).init(b,c);pd++;throw e;},a:function(){y("")},d:function(e,b,c){ia.copyWithin(e,b,b+c)},c:function(e){var b=ia.length;e>>>=0;if(2147483648<e)return!1;
for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,e+100663296);var g=Math;d=Math.max(e,d);g=g.min.call(g,2147483648,d+(65536-d%65536)%65536);a:{d=ja.buffer;try{ja.grow(g-d.byteLength+65535>>>16);l();var t=1;break a}catch(aa){}t=void 0}if(t)return!0}return!1}};(function(){function e(g,t){a.asm=g.exports;ja=a.asm.e;l();oa.unshift(a.asm.f);ba--;a.monitorRunDependencies&&a.monitorRunDependencies(ba);0==ba&&(null!==qa&&(clearInterval(qa),qa=null),ha&&(g=ha,ha=null,g()))}function b(g){e(g.instance)}
function c(g){return q().then(function(t){return WebAssembly.instantiate(t,d)}).then(function(t){return t}).then(g,function(t){da("failed to asynchronously prepare wasm: "+t);y(t)})}var d={a:qd};ba++;a.monitorRunDependencies&&a.monitorRunDependencies(ba);if(a.instantiateWasm)try{return a.instantiateWasm(d,e)}catch(g){da("Module.instantiateWasm callback failed with error: "+g),ka(g)}(function(){return ea||"function"!=typeof WebAssembly.instantiateStreaming||P.startsWith("data:application/octet-stream;base64,")||
P.startsWith("file://")||Ua||"function"!=typeof fetch?c(b):fetch(P,{credentials:"same-origin"}).then(function(g){return WebAssembly.instantiateStreaming(g,d).then(b,function(t){da("wasm streaming compile failed: "+t);da("falling back to ArrayBuffer instantiation");return c(b)})})})().catch(ka);return{}})();var Xa=a._emscripten_bind_VoidPtr___destroy___0=function(){return(Xa=a._emscripten_bind_VoidPtr___destroy___0=a.asm.h).apply(null,arguments)},za=a._emscripten_bind_DecoderBuffer_DecoderBuffer_0=
function(){return(za=a._emscripten_bind_DecoderBuffer_DecoderBuffer_0=a.asm.i).apply(null,arguments)},Ya=a._emscripten_bind_DecoderBuffer_Init_2=function(){return(Ya=a._emscripten_bind_DecoderBuffer_Init_2=a.asm.j).apply(null,arguments)},Za=a._emscripten_bind_DecoderBuffer___destroy___0=function(){return(Za=a._emscripten_bind_DecoderBuffer___destroy___0=a.asm.k).apply(null,arguments)},Aa=a._emscripten_bind_AttributeTransformData_AttributeTransformData_0=function(){return(Aa=a._emscripten_bind_AttributeTransformData_AttributeTransformData_0=
a.asm.l).apply(null,arguments)},$a=a._emscripten_bind_AttributeTransformData_transform_type_0=function(){return($a=a._emscripten_bind_AttributeTransformData_transform_type_0=a.asm.m).apply(null,arguments)},ab=a._emscripten_bind_AttributeTransformData___destroy___0=function(){return(ab=a._emscripten_bind_AttributeTransformData___destroy___0=a.asm.n).apply(null,arguments)},Ba=a._emscripten_bind_GeometryAttribute_GeometryAttribute_0=function(){return(Ba=a._emscripten_bind_GeometryAttribute_GeometryAttribute_0=
a.asm.o).apply(null,arguments)},bb=a._emscripten_bind_GeometryAttribute___destroy___0=function(){return(bb=a._emscripten_bind_GeometryAttribute___destroy___0=a.asm.p).apply(null,arguments)},Ca=a._emscripten_bind_PointAttribute_PointAttribute_0=function(){return(Ca=a._emscripten_bind_PointAttribute_PointAttribute_0=a.asm.q).apply(null,arguments)},cb=a._emscripten_bind_PointAttribute_size_0=function(){return(cb=a._emscripten_bind_PointAttribute_size_0=a.asm.r).apply(null,arguments)},db=a._emscripten_bind_PointAttribute_GetAttributeTransformData_0=
function(){return(db=a._emscripten_bind_PointAttribute_GetAttributeTransformData_0=a.asm.s).apply(null,arguments)},eb=a._emscripten_bind_PointAttribute_attribute_type_0=function(){return(eb=a._emscripten_bind_PointAttribute_attribute_type_0=a.asm.t).apply(null,arguments)},fb=a._emscripten_bind_PointAttribute_data_type_0=function(){return(fb=a._emscripten_bind_PointAttribute_data_type_0=a.asm.u).apply(null,arguments)},gb=a._emscripten_bind_PointAttribute_num_components_0=function(){return(gb=a._emscripten_bind_PointAttribute_num_components_0=
a.asm.v).apply(null,arguments)},hb=a._emscripten_bind_PointAttribute_normalized_0=function(){return(hb=a._emscripten_bind_PointAttribute_normalized_0=a.asm.w).apply(null,arguments)},ib=a._emscripten_bind_PointAttribute_byte_stride_0=function(){return(ib=a._emscripten_bind_PointAttribute_byte_stride_0=a.asm.x).apply(null,arguments)},jb=a._emscripten_bind_PointAttribute_byte_offset_0=function(){return(jb=a._emscripten_bind_PointAttribute_byte_offset_0=a.asm.y).apply(null,arguments)},kb=a._emscripten_bind_PointAttribute_unique_id_0=
function(){return(kb=a._emscripten_bind_PointAttribute_unique_id_0=a.asm.z).apply(null,arguments)},lb=a._emscripten_bind_PointAttribute___destroy___0=function(){return(lb=a._emscripten_bind_PointAttribute___destroy___0=a.asm.A).apply(null,arguments)},Da=a._emscripten_bind_AttributeQuantizationTransform_AttributeQuantizationTransform_0=function(){return(Da=a._emscripten_bind_AttributeQuantizationTransform_AttributeQuantizationTransform_0=a.asm.B).apply(null,arguments)},mb=a._emscripten_bind_AttributeQuantizationTransform_InitFromAttribute_1=
function(){return(mb=a._emscripten_bind_AttributeQuantizationTransform_InitFromAttribute_1=a.asm.C).apply(null,arguments)},nb=a._emscripten_bind_AttributeQuantizationTransform_quantization_bits_0=function(){return(nb=a._emscripten_bind_AttributeQuantizationTransform_quantization_bits_0=a.asm.D).apply(null,arguments)},ob=a._emscripten_bind_AttributeQuantizationTransform_min_value_1=function(){return(ob=a._emscripten_bind_AttributeQuantizationTransform_min_value_1=a.asm.E).apply(null,arguments)},pb=
a._emscripten_bind_AttributeQuantizationTransform_range_0=function(){return(pb=a._emscripten_bind_AttributeQuantizationTransform_range_0=a.asm.F).apply(null,arguments)},qb=a._emscripten_bind_AttributeQuantizationTransform___destroy___0=function(){return(qb=a._emscripten_bind_AttributeQuantizationTransform___destroy___0=a.asm.G).apply(null,arguments)},Ea=a._emscripten_bind_AttributeOctahedronTransform_AttributeOctahedronTransform_0=function(){return(Ea=a._emscripten_bind_AttributeOctahedronTransform_AttributeOctahedronTransform_0=
a.asm.H).apply(null,arguments)},rb=a._emscripten_bind_AttributeOctahedronTransform_InitFromAttribute_1=function(){return(rb=a._emscripten_bind_AttributeOctahedronTransform_InitFromAttribute_1=a.asm.I).apply(null,arguments)},sb=a._emscripten_bind_AttributeOctahedronTransform_quantization_bits_0=function(){return(sb=a._emscripten_bind_AttributeOctahedronTransform_quantization_bits_0=a.asm.J).apply(null,arguments)},tb=a._emscripten_bind_AttributeOctahedronTransform___destroy___0=function(){return(tb=
a._emscripten_bind_AttributeOctahedronTransform___destroy___0=a.asm.K).apply(null,arguments)},Fa=a._emscripten_bind_PointCloud_PointCloud_0=function(){return(Fa=a._emscripten_bind_PointCloud_PointCloud_0=a.asm.L).apply(null,arguments)},ub=a._emscripten_bind_PointCloud_num_attributes_0=function(){return(ub=a._emscripten_bind_PointCloud_num_attributes_0=a.asm.M).apply(null,arguments)},vb=a._emscripten_bind_PointCloud_num_points_0=function(){return(vb=a._emscripten_bind_PointCloud_num_points_0=a.asm.N).apply(null,
arguments)},wb=a._emscripten_bind_PointCloud___destroy___0=function(){return(wb=a._emscripten_bind_PointCloud___destroy___0=a.asm.O).apply(null,arguments)},Ga=a._emscripten_bind_Mesh_Mesh_0=function(){return(Ga=a._emscripten_bind_Mesh_Mesh_0=a.asm.P).apply(null,arguments)},xb=a._emscripten_bind_Mesh_num_faces_0=function(){return(xb=a._emscripten_bind_Mesh_num_faces_0=a.asm.Q).apply(null,arguments)},yb=a._emscripten_bind_Mesh_num_attributes_0=function(){return(yb=a._emscripten_bind_Mesh_num_attributes_0=
a.asm.R).apply(null,arguments)},zb=a._emscripten_bind_Mesh_num_points_0=function(){return(zb=a._emscripten_bind_Mesh_num_points_0=a.asm.S).apply(null,arguments)},Ab=a._emscripten_bind_Mesh___destroy___0=function(){return(Ab=a._emscripten_bind_Mesh___destroy___0=a.asm.T).apply(null,arguments)},Ha=a._emscripten_bind_Metadata_Metadata_0=function(){return(Ha=a._emscripten_bind_Metadata_Metadata_0=a.asm.U).apply(null,arguments)},Bb=a._emscripten_bind_Metadata___destroy___0=function(){return(Bb=a._emscripten_bind_Metadata___destroy___0=
a.asm.V).apply(null,arguments)},Cb=a._emscripten_bind_Status_code_0=function(){return(Cb=a._emscripten_bind_Status_code_0=a.asm.W).apply(null,arguments)},Db=a._emscripten_bind_Status_ok_0=function(){return(Db=a._emscripten_bind_Status_ok_0=a.asm.X).apply(null,arguments)},Eb=a._emscripten_bind_Status_error_msg_0=function(){return(Eb=a._emscripten_bind_Status_error_msg_0=a.asm.Y).apply(null,arguments)},Fb=a._emscripten_bind_Status___destroy___0=function(){return(Fb=a._emscripten_bind_Status___destroy___0=
a.asm.Z).apply(null,arguments)},Ia=a._emscripten_bind_DracoFloat32Array_DracoFloat32Array_0=function(){return(Ia=a._emscripten_bind_DracoFloat32Array_DracoFloat32Array_0=a.asm._).apply(null,arguments)},Gb=a._emscripten_bind_DracoFloat32Array_GetValue_1=function(){return(Gb=a._emscripten_bind_DracoFloat32Array_GetValue_1=a.asm.$).apply(null,arguments)},Hb=a._emscripten_bind_DracoFloat32Array_size_0=function(){return(Hb=a._emscripten_bind_DracoFloat32Array_size_0=a.asm.aa).apply(null,arguments)},Ib=
a._emscripten_bind_DracoFloat32Array___destroy___0=function(){return(Ib=a._emscripten_bind_DracoFloat32Array___destroy___0=a.asm.ba).apply(null,arguments)},Ja=a._emscripten_bind_DracoInt8Array_DracoInt8Array_0=function(){return(Ja=a._emscripten_bind_DracoInt8Array_DracoInt8Array_0=a.asm.ca).apply(null,arguments)},Jb=a._emscripten_bind_DracoInt8Array_GetValue_1=function(){return(Jb=a._emscripten_bind_DracoInt8Array_GetValue_1=a.asm.da).apply(null,arguments)},Kb=a._emscripten_bind_DracoInt8Array_size_0=
function(){return(Kb=a._emscripten_bind_DracoInt8Array_size_0=a.asm.ea).apply(null,arguments)},Lb=a._emscripten_bind_DracoInt8Array___destroy___0=function(){return(Lb=a._emscripten_bind_DracoInt8Array___destroy___0=a.asm.fa).apply(null,arguments)},Ka=a._emscripten_bind_DracoUInt8Array_DracoUInt8Array_0=function(){return(Ka=a._emscripten_bind_DracoUInt8Array_DracoUInt8Array_0=a.asm.ga).apply(null,arguments)},Mb=a._emscripten_bind_DracoUInt8Array_GetValue_1=function(){return(Mb=a._emscripten_bind_DracoUInt8Array_GetValue_1=
a.asm.ha).apply(null,arguments)},Nb=a._emscripten_bind_DracoUInt8Array_size_0=function(){return(Nb=a._emscripten_bind_DracoUInt8Array_size_0=a.asm.ia).apply(null,arguments)},Ob=a._emscripten_bind_DracoUInt8Array___destroy___0=function(){return(Ob=a._emscripten_bind_DracoUInt8Array___destroy___0=a.asm.ja).apply(null,arguments)},La=a._emscripten_bind_DracoInt16Array_DracoInt16Array_0=function(){return(La=a._emscripten_bind_DracoInt16Array_DracoInt16Array_0=a.asm.ka).apply(null,arguments)},Pb=a._emscripten_bind_DracoInt16Array_GetValue_1=
function(){return(Pb=a._emscripten_bind_DracoInt16Array_GetValue_1=a.asm.la).apply(null,arguments)},Qb=a._emscripten_bind_DracoInt16Array_size_0=function(){return(Qb=a._emscripten_bind_DracoInt16Array_size_0=a.asm.ma).apply(null,arguments)},Rb=a._emscripten_bind_DracoInt16Array___destroy___0=function(){return(Rb=a._emscripten_bind_DracoInt16Array___destroy___0=a.asm.na).apply(null,arguments)},Ma=a._emscripten_bind_DracoUInt16Array_DracoUInt16Array_0=function(){return(Ma=a._emscripten_bind_DracoUInt16Array_DracoUInt16Array_0=
a.asm.oa).apply(null,arguments)},Sb=a._emscripten_bind_DracoUInt16Array_GetValue_1=function(){return(Sb=a._emscripten_bind_DracoUInt16Array_GetValue_1=a.asm.pa).apply(null,arguments)},Tb=a._emscripten_bind_DracoUInt16Array_size_0=function(){return(Tb=a._emscripten_bind_DracoUInt16Array_size_0=a.asm.qa).apply(null,arguments)},Ub=a._emscripten_bind_DracoUInt16Array___destroy___0=function(){return(Ub=a._emscripten_bind_DracoUInt16Array___destroy___0=a.asm.ra).apply(null,arguments)},Na=a._emscripten_bind_DracoInt32Array_DracoInt32Array_0=
function(){return(Na=a._emscripten_bind_DracoInt32Array_DracoInt32Array_0=a.asm.sa).apply(null,arguments)},Vb=a._emscripten_bind_DracoInt32Array_GetValue_1=function(){return(Vb=a._emscripten_bind_DracoInt32Array_GetValue_1=a.asm.ta).apply(null,arguments)},Wb=a._emscripten_bind_DracoInt32Array_size_0=function(){return(Wb=a._emscripten_bind_DracoInt32Array_size_0=a.asm.ua).apply(null,arguments)},Xb=a._emscripten_bind_DracoInt32Array___destroy___0=function(){return(Xb=a._emscripten_bind_DracoInt32Array___destroy___0=
a.asm.va).apply(null,arguments)},Oa=a._emscripten_bind_DracoUInt32Array_DracoUInt32Array_0=function(){return(Oa=a._emscripten_bind_DracoUInt32Array_DracoUInt32Array_0=a.asm.wa).apply(null,arguments)},Yb=a._emscripten_bind_DracoUInt32Array_GetValue_1=function(){return(Yb=a._emscripten_bind_DracoUInt32Array_GetValue_1=a.asm.xa).apply(null,arguments)},Zb=a._emscripten_bind_DracoUInt32Array_size_0=function(){return(Zb=a._emscripten_bind_DracoUInt32Array_size_0=a.asm.ya).apply(null,arguments)},$b=a._emscripten_bind_DracoUInt32Array___destroy___0=
function(){return($b=a._emscripten_bind_DracoUInt32Array___destroy___0=a.asm.za).apply(null,arguments)},Pa=a._emscripten_bind_MetadataQuerier_MetadataQuerier_0=function(){return(Pa=a._emscripten_bind_MetadataQuerier_MetadataQuerier_0=a.asm.Aa).apply(null,arguments)},ac=a._emscripten_bind_MetadataQuerier_HasEntry_2=function(){return(ac=a._emscripten_bind_MetadataQuerier_HasEntry_2=a.asm.Ba).apply(null,arguments)},bc=a._emscripten_bind_MetadataQuerier_GetIntEntry_2=function(){return(bc=a._emscripten_bind_MetadataQuerier_GetIntEntry_2=
a.asm.Ca).apply(null,arguments)},cc=a._emscripten_bind_MetadataQuerier_GetIntEntryArray_3=function(){return(cc=a._emscripten_bind_MetadataQuerier_GetIntEntryArray_3=a.asm.Da).apply(null,arguments)},dc=a._emscripten_bind_MetadataQuerier_GetDoubleEntry_2=function(){return(dc=a._emscripten_bind_MetadataQuerier_GetDoubleEntry_2=a.asm.Ea).apply(null,arguments)},ec=a._emscripten_bind_MetadataQuerier_GetStringEntry_2=function(){return(ec=a._emscripten_bind_MetadataQuerier_GetStringEntry_2=a.asm.Fa).apply(null,
arguments)},fc=a._emscripten_bind_MetadataQuerier_NumEntries_1=function(){return(fc=a._emscripten_bind_MetadataQuerier_NumEntries_1=a.asm.Ga).apply(null,arguments)},gc=a._emscripten_bind_MetadataQuerier_GetEntryName_2=function(){return(gc=a._emscripten_bind_MetadataQuerier_GetEntryName_2=a.asm.Ha).apply(null,arguments)},hc=a._emscripten_bind_MetadataQuerier___destroy___0=function(){return(hc=a._emscripten_bind_MetadataQuerier___destroy___0=a.asm.Ia).apply(null,arguments)},Qa=a._emscripten_bind_Decoder_Decoder_0=
function(){return(Qa=a._emscripten_bind_Decoder_Decoder_0=a.asm.Ja).apply(null,arguments)},ic=a._emscripten_bind_Decoder_DecodeArrayToPointCloud_3=function(){return(ic=a._emscripten_bind_Decoder_DecodeArrayToPointCloud_3=a.asm.Ka).apply(null,arguments)},jc=a._emscripten_bind_Decoder_DecodeArrayToMesh_3=function(){return(jc=a._emscripten_bind_Decoder_DecodeArrayToMesh_3=a.asm.La).apply(null,arguments)},kc=a._emscripten_bind_Decoder_GetAttributeId_2=function(){return(kc=a._emscripten_bind_Decoder_GetAttributeId_2=
a.asm.Ma).apply(null,arguments)},lc=a._emscripten_bind_Decoder_GetAttributeIdByName_2=function(){return(lc=a._emscripten_bind_Decoder_GetAttributeIdByName_2=a.asm.Na).apply(null,arguments)},mc=a._emscripten_bind_Decoder_GetAttributeIdByMetadataEntry_3=function(){return(mc=a._emscripten_bind_Decoder_GetAttributeIdByMetadataEntry_3=a.asm.Oa).apply(null,arguments)},nc=a._emscripten_bind_Decoder_GetAttribute_2=function(){return(nc=a._emscripten_bind_Decoder_GetAttribute_2=a.asm.Pa).apply(null,arguments)},
oc=a._emscripten_bind_Decoder_GetAttributeByUniqueId_2=function(){return(oc=a._emscripten_bind_Decoder_GetAttributeByUniqueId_2=a.asm.Qa).apply(null,arguments)},pc=a._emscripten_bind_Decoder_GetMetadata_1=function(){return(pc=a._emscripten_bind_Decoder_GetMetadata_1=a.asm.Ra).apply(null,arguments)},qc=a._emscripten_bind_Decoder_GetAttributeMetadata_2=function(){return(qc=a._emscripten_bind_Decoder_GetAttributeMetadata_2=a.asm.Sa).apply(null,arguments)},rc=a._emscripten_bind_Decoder_GetFaceFromMesh_3=
function(){return(rc=a._emscripten_bind_Decoder_GetFaceFromMesh_3=a.asm.Ta).apply(null,arguments)},sc=a._emscripten_bind_Decoder_GetTriangleStripsFromMesh_2=function(){return(sc=a._emscripten_bind_Decoder_GetTriangleStripsFromMesh_2=a.asm.Ua).apply(null,arguments)},tc=a._emscripten_bind_Decoder_GetTrianglesUInt16Array_3=function(){return(tc=a._emscripten_bind_Decoder_GetTrianglesUInt16Array_3=a.asm.Va).apply(null,arguments)},uc=a._emscripten_bind_Decoder_GetTrianglesUInt32Array_3=function(){return(uc=
a._emscripten_bind_Decoder_GetTrianglesUInt32Array_3=a.asm.Wa).apply(null,arguments)},vc=a._emscripten_bind_Decoder_GetAttributeFloat_3=function(){return(vc=a._emscripten_bind_Decoder_GetAttributeFloat_3=a.asm.Xa).apply(null,arguments)},wc=a._emscripten_bind_Decoder_GetAttributeFloatForAllPoints_3=function(){return(wc=a._emscripten_bind_Decoder_GetAttributeFloatForAllPoints_3=a.asm.Ya).apply(null,arguments)},xc=a._emscripten_bind_Decoder_GetAttributeIntForAllPoints_3=function(){return(xc=a._emscripten_bind_Decoder_GetAttributeIntForAllPoints_3=
a.asm.Za).apply(null,arguments)},yc=a._emscripten_bind_Decoder_GetAttributeInt8ForAllPoints_3=function(){return(yc=a._emscripten_bind_Decoder_GetAttributeInt8ForAllPoints_3=a.asm._a).apply(null,arguments)},zc=a._emscripten_bind_Decoder_GetAttributeUInt8ForAllPoints_3=function(){return(zc=a._emscripten_bind_Decoder_GetAttributeUInt8ForAllPoints_3=a.asm.$a).apply(null,arguments)},Ac=a._emscripten_bind_Decoder_GetAttributeInt16ForAllPoints_3=function(){return(Ac=a._emscripten_bind_Decoder_GetAttributeInt16ForAllPoints_3=
a.asm.ab).apply(null,arguments)},Bc=a._emscripten_bind_Decoder_GetAttributeUInt16ForAllPoints_3=function(){return(Bc=a._emscripten_bind_Decoder_GetAttributeUInt16ForAllPoints_3=a.asm.bb).apply(null,arguments)},Cc=a._emscripten_bind_Decoder_GetAttributeInt32ForAllPoints_3=function(){return(Cc=a._emscripten_bind_Decoder_GetAttributeInt32ForAllPoints_3=a.asm.cb).apply(null,arguments)},Dc=a._emscripten_bind_Decoder_GetAttributeUInt32ForAllPoints_3=function(){return(Dc=a._emscripten_bind_Decoder_GetAttributeUInt32ForAllPoints_3=
a.asm.db).apply(null,arguments)},Ec=a._emscripten_bind_Decoder_GetAttributeDataArrayForAllPoints_5=function(){return(Ec=a._emscripten_bind_Decoder_GetAttributeDataArrayForAllPoints_5=a.asm.eb).apply(null,arguments)},Fc=a._emscripten_bind_Decoder_SkipAttributeTransform_1=function(){return(Fc=a._emscripten_bind_Decoder_SkipAttributeTransform_1=a.asm.fb).apply(null,arguments)},Gc=a._emscripten_bind_Decoder_GetEncodedGeometryType_Deprecated_1=function(){return(Gc=a._emscripten_bind_Decoder_GetEncodedGeometryType_Deprecated_1=
a.asm.gb).apply(null,arguments)},Hc=a._emscripten_bind_Decoder_DecodeBufferToPointCloud_2=function(){return(Hc=a._emscripten_bind_Decoder_DecodeBufferToPointCloud_2=a.asm.hb).apply(null,arguments)},Ic=a._emscripten_bind_Decoder_DecodeBufferToMesh_2=function(){return(Ic=a._emscripten_bind_Decoder_DecodeBufferToMesh_2=a.asm.ib).apply(null,arguments)},Jc=a._emscripten_bind_Decoder___destroy___0=function(){return(Jc=a._emscripten_bind_Decoder___destroy___0=a.asm.jb).apply(null,arguments)},Kc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_INVALID_TRANSFORM=
function(){return(Kc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_INVALID_TRANSFORM=a.asm.kb).apply(null,arguments)},Lc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_NO_TRANSFORM=function(){return(Lc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_NO_TRANSFORM=a.asm.lb).apply(null,arguments)},Mc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_QUANTIZATION_TRANSFORM=function(){return(Mc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_QUANTIZATION_TRANSFORM=
a.asm.mb).apply(null,arguments)},Nc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_OCTAHEDRON_TRANSFORM=function(){return(Nc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_OCTAHEDRON_TRANSFORM=a.asm.nb).apply(null,arguments)},Oc=a._emscripten_enum_draco_GeometryAttribute_Type_INVALID=function(){return(Oc=a._emscripten_enum_draco_GeometryAttribute_Type_INVALID=a.asm.ob).apply(null,arguments)},Pc=a._emscripten_enum_draco_GeometryAttribute_Type_POSITION=function(){return(Pc=a._emscripten_enum_draco_GeometryAttribute_Type_POSITION=
a.asm.pb).apply(null,arguments)},Qc=a._emscripten_enum_draco_GeometryAttribute_Type_NORMAL=function(){return(Qc=a._emscripten_enum_draco_GeometryAttribute_Type_NORMAL=a.asm.qb).apply(null,arguments)},Rc=a._emscripten_enum_draco_GeometryAttribute_Type_COLOR=function(){return(Rc=a._emscripten_enum_draco_GeometryAttribute_Type_COLOR=a.asm.rb).apply(null,arguments)},Sc=a._emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD=function(){return(Sc=a._emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD=
a.asm.sb).apply(null,arguments)},Tc=a._emscripten_enum_draco_GeometryAttribute_Type_GENERIC=function(){return(Tc=a._emscripten_enum_draco_GeometryAttribute_Type_GENERIC=a.asm.tb).apply(null,arguments)},Uc=a._emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE=function(){return(Uc=a._emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE=a.asm.ub).apply(null,arguments)},Vc=a._emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD=function(){return(Vc=a._emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD=
a.asm.vb).apply(null,arguments)},Wc=a._emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH=function(){return(Wc=a._emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH=a.asm.wb).apply(null,arguments)},Xc=a._emscripten_enum_draco_DataType_DT_INVALID=function(){return(Xc=a._emscripten_enum_draco_DataType_DT_INVALID=a.asm.xb).apply(null,arguments)},Yc=a._emscripten_enum_draco_DataType_DT_INT8=function(){return(Yc=a._emscripten_enum_draco_DataType_DT_INT8=a.asm.yb).apply(null,arguments)},Zc=
a._emscripten_enum_draco_DataType_DT_UINT8=function(){return(Zc=a._emscripten_enum_draco_DataType_DT_UINT8=a.asm.zb).apply(null,arguments)},$c=a._emscripten_enum_draco_DataType_DT_INT16=function(){return($c=a._emscripten_enum_draco_DataType_DT_INT16=a.asm.Ab).apply(null,arguments)},ad=a._emscripten_enum_draco_DataType_DT_UINT16=function(){return(ad=a._emscripten_enum_draco_DataType_DT_UINT16=a.asm.Bb).apply(null,arguments)},bd=a._emscripten_enum_draco_DataType_DT_INT32=function(){return(bd=a._emscripten_enum_draco_DataType_DT_INT32=
a.asm.Cb).apply(null,arguments)},cd=a._emscripten_enum_draco_DataType_DT_UINT32=function(){return(cd=a._emscripten_enum_draco_DataType_DT_UINT32=a.asm.Db).apply(null,arguments)},dd=a._emscripten_enum_draco_DataType_DT_INT64=function(){return(dd=a._emscripten_enum_draco_DataType_DT_INT64=a.asm.Eb).apply(null,arguments)},ed=a._emscripten_enum_draco_DataType_DT_UINT64=function(){return(ed=a._emscripten_enum_draco_DataType_DT_UINT64=a.asm.Fb).apply(null,arguments)},fd=a._emscripten_enum_draco_DataType_DT_FLOAT32=
function(){return(fd=a._emscripten_enum_draco_DataType_DT_FLOAT32=a.asm.Gb).apply(null,arguments)},gd=a._emscripten_enum_draco_DataType_DT_FLOAT64=function(){return(gd=a._emscripten_enum_draco_DataType_DT_FLOAT64=a.asm.Hb).apply(null,arguments)},hd=a._emscripten_enum_draco_DataType_DT_BOOL=function(){return(hd=a._emscripten_enum_draco_DataType_DT_BOOL=a.asm.Ib).apply(null,arguments)},id=a._emscripten_enum_draco_DataType_DT_TYPES_COUNT=function(){return(id=a._emscripten_enum_draco_DataType_DT_TYPES_COUNT=
a.asm.Jb).apply(null,arguments)},jd=a._emscripten_enum_draco_StatusCode_OK=function(){return(jd=a._emscripten_enum_draco_StatusCode_OK=a.asm.Kb).apply(null,arguments)},kd=a._emscripten_enum_draco_StatusCode_DRACO_ERROR=function(){return(kd=a._emscripten_enum_draco_StatusCode_DRACO_ERROR=a.asm.Lb).apply(null,arguments)},ld=a._emscripten_enum_draco_StatusCode_IO_ERROR=function(){return(ld=a._emscripten_enum_draco_StatusCode_IO_ERROR=a.asm.Mb).apply(null,arguments)},md=a._emscripten_enum_draco_StatusCode_INVALID_PARAMETER=
function(){return(md=a._emscripten_enum_draco_StatusCode_INVALID_PARAMETER=a.asm.Nb).apply(null,arguments)},nd=a._emscripten_enum_draco_StatusCode_UNSUPPORTED_VERSION=function(){return(nd=a._emscripten_enum_draco_StatusCode_UNSUPPORTED_VERSION=a.asm.Ob).apply(null,arguments)},od=a._emscripten_enum_draco_StatusCode_UNKNOWN_VERSION=function(){return(od=a._emscripten_enum_draco_StatusCode_UNKNOWN_VERSION=a.asm.Pb).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.Qb).apply(null,arguments)};
a._free=function(){return(a._free=a.asm.Rb).apply(null,arguments)};var ua=function(){return(ua=a.asm.Sb).apply(null,arguments)};a.___start_em_js=11660;a.___stop_em_js=11758;var la;ha=function b(){la||F();la||(ha=b)};if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();F();v.prototype=Object.create(v.prototype);v.prototype.constructor=v;v.prototype.__class__=v;v.__cache__={};a.WrapperObject=v;a.getCache=w;a.wrapPointer=B;a.castObject=function(b,
c){return B(b.ptr,c)};a.NULL=B(0);a.destroy=function(b){if(!b.__destroy__)throw"Error: Cannot destroy object. (Did you create it yourself?)";b.__destroy__();delete w(b.__class__)[b.ptr]};a.compare=function(b,c){return b.ptr===c.ptr};a.getPointer=function(b){return b.ptr};a.getClass=function(b){return b.__class__};var r={buffer:0,size:0,pos:0,temps:[],needed:0,prepare:function(){if(r.needed){for(var b=0;b<r.temps.length;b++)a._free(r.temps[b]);r.temps.length=0;a._free(r.buffer);r.buffer=0;r.size+=
r.needed;r.needed=0}r.buffer||(r.size+=128,r.buffer=a._malloc(r.size),r.buffer||y(void 0));r.pos=0},alloc:function(b,c){r.buffer||y(void 0);b=b.length*c.BYTES_PER_ELEMENT;b=b+7&-8;r.pos+b>=r.size?(0<b||y(void 0),r.needed+=b,c=a._malloc(b),r.temps.push(c)):(c=r.buffer+r.pos,r.pos+=b);return c},copy:function(b,c,d){d>>>=0;switch(c.BYTES_PER_ELEMENT){case 2:d>>>=1;break;case 4:d>>>=2;break;case 8:d>>>=3}for(var g=0;g<b.length;g++)c[d+g]=b[g]}};X.prototype=Object.create(v.prototype);X.prototype.constructor=
X;X.prototype.__class__=X;X.__cache__={};a.VoidPtr=X;X.prototype.__destroy__=X.prototype.__destroy__=function(){Xa(this.ptr)};S.prototype=Object.create(v.prototype);S.prototype.constructor=S;S.prototype.__class__=S;S.__cache__={};a.DecoderBuffer=S;S.prototype.Init=S.prototype.Init=function(b,c){var d=this.ptr;r.prepare();"object"==typeof b&&(b=Z(b));c&&"object"===typeof c&&(c=c.ptr);Ya(d,b,c)};S.prototype.__destroy__=S.prototype.__destroy__=function(){Za(this.ptr)};Q.prototype=Object.create(v.prototype);
Q.prototype.constructor=Q;Q.prototype.__class__=Q;Q.__cache__={};a.AttributeTransformData=Q;Q.prototype.transform_type=Q.prototype.transform_type=function(){return $a(this.ptr)};Q.prototype.__destroy__=Q.prototype.__destroy__=function(){ab(this.ptr)};V.prototype=Object.create(v.prototype);V.prototype.constructor=V;V.prototype.__class__=V;V.__cache__={};a.GeometryAttribute=V;V.prototype.__destroy__=V.prototype.__destroy__=function(){bb(this.ptr)};x.prototype=Object.create(v.prototype);x.prototype.constructor=
x;x.prototype.__class__=x;x.__cache__={};a.PointAttribute=x;x.prototype.size=x.prototype.size=function(){return cb(this.ptr)};x.prototype.GetAttributeTransformData=x.prototype.GetAttributeTransformData=function(){return B(db(this.ptr),Q)};x.prototype.attribute_type=x.prototype.attribute_type=function(){return eb(this.ptr)};x.prototype.data_type=x.prototype.data_type=function(){return fb(this.ptr)};x.prototype.num_components=x.prototype.num_components=function(){return gb(this.ptr)};x.prototype.normalized=
x.prototype.normalized=function(){return!!hb(this.ptr)};x.prototype.byte_stride=x.prototype.byte_stride=function(){return ib(this.ptr)};x.prototype.byte_offset=x.prototype.byte_offset=function(){return jb(this.ptr)};x.prototype.unique_id=x.prototype.unique_id=function(){return kb(this.ptr)};x.prototype.__destroy__=x.prototype.__destroy__=function(){lb(this.ptr)};D.prototype=Object.create(v.prototype);D.prototype.constructor=D;D.prototype.__class__=D;D.__cache__={};a.AttributeQuantizationTransform=
D;D.prototype.InitFromAttribute=D.prototype.InitFromAttribute=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return!!mb(c,b)};D.prototype.quantization_bits=D.prototype.quantization_bits=function(){return nb(this.ptr)};D.prototype.min_value=D.prototype.min_value=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return ob(c,b)};D.prototype.range=D.prototype.range=function(){return pb(this.ptr)};D.prototype.__destroy__=D.prototype.__destroy__=function(){qb(this.ptr)};G.prototype=
Object.create(v.prototype);G.prototype.constructor=G;G.prototype.__class__=G;G.__cache__={};a.AttributeOctahedronTransform=G;G.prototype.InitFromAttribute=G.prototype.InitFromAttribute=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return!!rb(c,b)};G.prototype.quantization_bits=G.prototype.quantization_bits=function(){return sb(this.ptr)};G.prototype.__destroy__=G.prototype.__destroy__=function(){tb(this.ptr)};H.prototype=Object.create(v.prototype);H.prototype.constructor=H;H.prototype.__class__=
H;H.__cache__={};a.PointCloud=H;H.prototype.num_attributes=H.prototype.num_attributes=function(){return ub(this.ptr)};H.prototype.num_points=H.prototype.num_points=function(){return vb(this.ptr)};H.prototype.__destroy__=H.prototype.__destroy__=function(){wb(this.ptr)};E.prototype=Object.create(v.prototype);E.prototype.constructor=E;E.prototype.__class__=E;E.__cache__={};a.Mesh=E;E.prototype.num_faces=E.prototype.num_faces=function(){return xb(this.ptr)};E.prototype.num_attributes=E.prototype.num_attributes=
function(){return yb(this.ptr)};E.prototype.num_points=E.prototype.num_points=function(){return zb(this.ptr)};E.prototype.__destroy__=E.prototype.__destroy__=function(){Ab(this.ptr)};T.prototype=Object.create(v.prototype);T.prototype.constructor=T;T.prototype.__class__=T;T.__cache__={};a.Metadata=T;T.prototype.__destroy__=T.prototype.__destroy__=function(){Bb(this.ptr)};C.prototype=Object.create(v.prototype);C.prototype.constructor=C;C.prototype.__class__=C;C.__cache__={};a.Status=C;C.prototype.code=
C.prototype.code=function(){return Cb(this.ptr)};C.prototype.ok=C.prototype.ok=function(){return!!Db(this.ptr)};C.prototype.error_msg=C.prototype.error_msg=function(){return p(Eb(this.ptr))};C.prototype.__destroy__=C.prototype.__destroy__=function(){Fb(this.ptr)};I.prototype=Object.create(v.prototype);I.prototype.constructor=I;I.prototype.__class__=I;I.__cache__={};a.DracoFloat32Array=I;I.prototype.GetValue=I.prototype.GetValue=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return Gb(c,
b)};I.prototype.size=I.prototype.size=function(){return Hb(this.ptr)};I.prototype.__destroy__=I.prototype.__destroy__=function(){Ib(this.ptr)};J.prototype=Object.create(v.prototype);J.prototype.constructor=J;J.prototype.__class__=J;J.__cache__={};a.DracoInt8Array=J;J.prototype.GetValue=J.prototype.GetValue=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return Jb(c,b)};J.prototype.size=J.prototype.size=function(){return Kb(this.ptr)};J.prototype.__destroy__=J.prototype.__destroy__=function(){Lb(this.ptr)};
K.prototype=Object.create(v.prototype);K.prototype.constructor=K;K.prototype.__class__=K;K.__cache__={};a.DracoUInt8Array=K;K.prototype.GetValue=K.prototype.GetValue=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return Mb(c,b)};K.prototype.size=K.prototype.size=function(){return Nb(this.ptr)};K.prototype.__destroy__=K.prototype.__destroy__=function(){Ob(this.ptr)};L.prototype=Object.create(v.prototype);L.prototype.constructor=L;L.prototype.__class__=L;L.__cache__={};a.DracoInt16Array=
L;L.prototype.GetValue=L.prototype.GetValue=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return Pb(c,b)};L.prototype.size=L.prototype.size=function(){return Qb(this.ptr)};L.prototype.__destroy__=L.prototype.__destroy__=function(){Rb(this.ptr)};M.prototype=Object.create(v.prototype);M.prototype.constructor=M;M.prototype.__class__=M;M.__cache__={};a.DracoUInt16Array=M;M.prototype.GetValue=M.prototype.GetValue=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return Sb(c,b)};
M.prototype.size=M.prototype.size=function(){return Tb(this.ptr)};M.prototype.__destroy__=M.prototype.__destroy__=function(){Ub(this.ptr)};N.prototype=Object.create(v.prototype);N.prototype.constructor=N;N.prototype.__class__=N;N.__cache__={};a.DracoInt32Array=N;N.prototype.GetValue=N.prototype.GetValue=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return Vb(c,b)};N.prototype.size=N.prototype.size=function(){return Wb(this.ptr)};N.prototype.__destroy__=N.prototype.__destroy__=function(){Xb(this.ptr)};
O.prototype=Object.create(v.prototype);O.prototype.constructor=O;O.prototype.__class__=O;O.__cache__={};a.DracoUInt32Array=O;O.prototype.GetValue=O.prototype.GetValue=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return Yb(c,b)};O.prototype.size=O.prototype.size=function(){return Zb(this.ptr)};O.prototype.__destroy__=O.prototype.__destroy__=function(){$b(this.ptr)};z.prototype=Object.create(v.prototype);z.prototype.constructor=z;z.prototype.__class__=z;z.__cache__={};a.MetadataQuerier=
z;z.prototype.HasEntry=z.prototype.HasEntry=function(b,c){var d=this.ptr;r.prepare();b&&"object"===typeof b&&(b=b.ptr);c=c&&"object"===typeof c?c.ptr:R(c);return!!ac(d,b,c)};z.prototype.GetIntEntry=z.prototype.GetIntEntry=function(b,c){var d=this.ptr;r.prepare();b&&"object"===typeof b&&(b=b.ptr);c=c&&"object"===typeof c?c.ptr:R(c);return bc(d,b,c)};z.prototype.GetIntEntryArray=z.prototype.GetIntEntryArray=function(b,c,d){var g=this.ptr;r.prepare();b&&"object"===typeof b&&(b=b.ptr);c=c&&"object"===
typeof c?c.ptr:R(c);d&&"object"===typeof d&&(d=d.ptr);cc(g,b,c,d)};z.prototype.GetDoubleEntry=z.prototype.GetDoubleEntry=function(b,c){var d=this.ptr;r.prepare();b&&"object"===typeof b&&(b=b.ptr);c=c&&"object"===typeof c?c.ptr:R(c);return dc(d,b,c)};z.prototype.GetStringEntry=z.prototype.GetStringEntry=function(b,c){var d=this.ptr;r.prepare();b&&"object"===typeof b&&(b=b.ptr);c=c&&"object"===typeof c?c.ptr:R(c);return p(ec(d,b,c))};z.prototype.NumEntries=z.prototype.NumEntries=function(b){var c=this.ptr;
b&&"object"===typeof b&&(b=b.ptr);return fc(c,b)};z.prototype.GetEntryName=z.prototype.GetEntryName=function(b,c){var d=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);return p(gc(d,b,c))};z.prototype.__destroy__=z.prototype.__destroy__=function(){hc(this.ptr)};m.prototype=Object.create(v.prototype);m.prototype.constructor=m;m.prototype.__class__=m;m.__cache__={};a.Decoder=m;m.prototype.DecodeArrayToPointCloud=m.prototype.DecodeArrayToPointCloud=function(b,c,d){var g=
this.ptr;r.prepare();"object"==typeof b&&(b=Z(b));c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return B(ic(g,b,c,d),C)};m.prototype.DecodeArrayToMesh=m.prototype.DecodeArrayToMesh=function(b,c,d){var g=this.ptr;r.prepare();"object"==typeof b&&(b=Z(b));c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return B(jc(g,b,c,d),C)};m.prototype.GetAttributeId=m.prototype.GetAttributeId=function(b,c){var d=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&
(c=c.ptr);return kc(d,b,c)};m.prototype.GetAttributeIdByName=m.prototype.GetAttributeIdByName=function(b,c){var d=this.ptr;r.prepare();b&&"object"===typeof b&&(b=b.ptr);c=c&&"object"===typeof c?c.ptr:R(c);return lc(d,b,c)};m.prototype.GetAttributeIdByMetadataEntry=m.prototype.GetAttributeIdByMetadataEntry=function(b,c,d){var g=this.ptr;r.prepare();b&&"object"===typeof b&&(b=b.ptr);c=c&&"object"===typeof c?c.ptr:R(c);d=d&&"object"===typeof d?d.ptr:R(d);return mc(g,b,c,d)};m.prototype.GetAttribute=
m.prototype.GetAttribute=function(b,c){var d=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);return B(nc(d,b,c),x)};m.prototype.GetAttributeByUniqueId=m.prototype.GetAttributeByUniqueId=function(b,c){var d=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);return B(oc(d,b,c),x)};m.prototype.GetMetadata=m.prototype.GetMetadata=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return B(pc(c,b),T)};m.prototype.GetAttributeMetadata=m.prototype.GetAttributeMetadata=
function(b,c){var d=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);return B(qc(d,b,c),T)};m.prototype.GetFaceFromMesh=m.prototype.GetFaceFromMesh=function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!rc(g,b,c,d)};m.prototype.GetTriangleStripsFromMesh=m.prototype.GetTriangleStripsFromMesh=function(b,c){var d=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);
return sc(d,b,c)};m.prototype.GetTrianglesUInt16Array=m.prototype.GetTrianglesUInt16Array=function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!tc(g,b,c,d)};m.prototype.GetTrianglesUInt32Array=m.prototype.GetTrianglesUInt32Array=function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!uc(g,b,c,d)};m.prototype.GetAttributeFloat=m.prototype.GetAttributeFloat=
function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!vc(g,b,c,d)};m.prototype.GetAttributeFloatForAllPoints=m.prototype.GetAttributeFloatForAllPoints=function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!wc(g,b,c,d)};m.prototype.GetAttributeIntForAllPoints=m.prototype.GetAttributeIntForAllPoints=function(b,c,d){var g=this.ptr;
b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!xc(g,b,c,d)};m.prototype.GetAttributeInt8ForAllPoints=m.prototype.GetAttributeInt8ForAllPoints=function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!yc(g,b,c,d)};m.prototype.GetAttributeUInt8ForAllPoints=m.prototype.GetAttributeUInt8ForAllPoints=function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=
b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!zc(g,b,c,d)};m.prototype.GetAttributeInt16ForAllPoints=m.prototype.GetAttributeInt16ForAllPoints=function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!Ac(g,b,c,d)};m.prototype.GetAttributeUInt16ForAllPoints=m.prototype.GetAttributeUInt16ForAllPoints=function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&
(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!Bc(g,b,c,d)};m.prototype.GetAttributeInt32ForAllPoints=m.prototype.GetAttributeInt32ForAllPoints=function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);return!!Cc(g,b,c,d)};m.prototype.GetAttributeUInt32ForAllPoints=m.prototype.GetAttributeUInt32ForAllPoints=function(b,c,d){var g=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===
typeof d&&(d=d.ptr);return!!Dc(g,b,c,d)};m.prototype.GetAttributeDataArrayForAllPoints=m.prototype.GetAttributeDataArrayForAllPoints=function(b,c,d,g,t){var aa=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);d&&"object"===typeof d&&(d=d.ptr);g&&"object"===typeof g&&(g=g.ptr);t&&"object"===typeof t&&(t=t.ptr);return!!Ec(aa,b,c,d,g,t)};m.prototype.SkipAttributeTransform=m.prototype.SkipAttributeTransform=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);Fc(c,
b)};m.prototype.GetEncodedGeometryType_Deprecated=m.prototype.GetEncodedGeometryType_Deprecated=function(b){var c=this.ptr;b&&"object"===typeof b&&(b=b.ptr);return Gc(c,b)};m.prototype.DecodeBufferToPointCloud=m.prototype.DecodeBufferToPointCloud=function(b,c){var d=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===typeof c&&(c=c.ptr);return B(Hc(d,b,c),C)};m.prototype.DecodeBufferToMesh=m.prototype.DecodeBufferToMesh=function(b,c){var d=this.ptr;b&&"object"===typeof b&&(b=b.ptr);c&&"object"===
typeof c&&(c=c.ptr);return B(Ic(d,b,c),C)};m.prototype.__destroy__=m.prototype.__destroy__=function(){Jc(this.ptr)};(function(){function b(){a.ATTRIBUTE_INVALID_TRANSFORM=Kc();a.ATTRIBUTE_NO_TRANSFORM=Lc();a.ATTRIBUTE_QUANTIZATION_TRANSFORM=Mc();a.ATTRIBUTE_OCTAHEDRON_TRANSFORM=Nc();a.INVALID=Oc();a.POSITION=Pc();a.NORMAL=Qc();a.COLOR=Rc();a.TEX_COORD=Sc();a.GENERIC=Tc();a.INVALID_GEOMETRY_TYPE=Uc();a.POINT_CLOUD=Vc();a.TRIANGULAR_MESH=Wc();a.DT_INVALID=Xc();a.DT_INT8=Yc();a.DT_UINT8=Zc();a.DT_INT16=
$c();a.DT_UINT16=ad();a.DT_INT32=bd();a.DT_UINT32=cd();a.DT_INT64=dd();a.DT_UINT64=ed();a.DT_FLOAT32=fd();a.DT_FLOAT64=gd();a.DT_BOOL=hd();a.DT_TYPES_COUNT=id();a.OK=jd();a.DRACO_ERROR=kd();a.IO_ERROR=ld();a.INVALID_PARAMETER=md();a.UNSUPPORTED_VERSION=nd();a.UNKNOWN_VERSION=od()}va?b():oa.unshift(b)})();if("function"===typeof a.onModuleParsed)a.onModuleParsed();a.Decoder.prototype.GetEncodedGeometryType=function(b){if(b.__class__&&b.__class__===a.DecoderBuffer)return a.Decoder.prototype.GetEncodedGeometryType_Deprecated(b);
if(8>b.byteLength)return a.INVALID_GEOMETRY_TYPE;switch(b[7]){case 0:return a.POINT_CLOUD;case 1:return a.TRIANGULAR_MESH;default:return a.INVALID_GEOMETRY_TYPE}};return n.ready}}();"object"===typeof exports&&"object"===typeof module?module.exports=DracoDecoderModule:"function"===typeof define&&define.amd?define([],function(){return DracoDecoderModule}):"object"===typeof exports&&(exports.DracoDecoderModule=DracoDecoderModule);
vite.config.js
import restart from 'vite-plugin-restart'
import glsl from 'vite-plugin-glsl'
import basicSsl from '@vitejs/plugin-basic-ssl'
import path from 'path'
import Terminal from 'vite-plugin-terminal'
const dirname = path.resolve()
const isCodeSandbox = 'SANDBOX_URL' in process.env || 'CODESANDBOX_HOST' in process.env
export default ({ mode }) => ({
root: 'src/',
publicDir: '../static/',
base: './',
resolve:
{
alias:
{
'@experience' : path.resolve(dirname, './src/Experience/'),
}
},
server:
{
host: true,
open: !isCodeSandbox // Open if it's not a CodeSandbox
},
build:
{
outDir: '../dist',
emptyOutDir: true,
sourcemap: mode !== 'production'
},
plugins:
[
restart({ restart: [ '../static/**', ] }), // Restart server on static file change
glsl(),
basicSsl(),
// Terminal({
// console: 'terminal',
// output: ['terminal', 'console']
// })
]
})
Media credits and license evidence실행 안내·자료
README.md
## License
[MIT](LICENSE)
static/basis/README.md
## License
[Apache License 2.0](https://github.com/BinomialLLC/basis_universal/blob/master/LICENSE)
static/draco/README.md
## License
[Apache License 2.0](https://github.com/google/draco/blob/master/LICENSE)
LICENSE실행 안내·자료
MIT License
Copyright (c) 2009 - 2025 [Codrops](https://tympanus.net/codrops)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Bundled dependency licenses실행 안내·자료
GSAP standard license snapshot
Source: https://gsap.com/community/standard-license/
Retrieved: 2026-09-22T04:22:49.089Z
Original distribution copyright and version headers remain in the runtime code.
Standard "No Charge" GSAP License
I. DEFINITIONS
“GSAP License” means the terms and conditions of this GSAP Software License Agreement.
"GSAP Products" means any Software made available at gsap.com (https://gsap.com) or any successor sites, including but not limited to the GSAP animation library and related plugins, tools, or extensions.
"Permitted Uses" means the implementation and/or use of GSAP Products on any website, web application, or digital interface by any person or entity (which may include, for clarity, those of companies that compete with Webflow in other areas of business).
"Prohibited Uses" means any implementation and/or use of GSAP Products in tools that allow users to build visual animations without code that encourages, induces, or materially assists in creating a solution that competes with Webflow’s visual animation building capabilities.
"Competitive Products" means any software, tool, or service that enables users to create, edit, or manage animations through a visual interface or builder similar to Webflow (https://webflow.com).
II. GRANT OF LICENSE
Subject to the terms and conditions of this GSAP License, Webflow grants you a non-exclusive, worldwide license to use, reproduce, display, and implement GSAP Products solely for Permitted Uses.
III. RESTRICTIONS
You may not:
Use any GSAP Products for any Prohibited Uses without prior written consent;
Reverse engineer any GSAP Products for the purpose of creating Competitive Products;
Remove or alter any proprietary notices or branding from GSAP Products.
IV. OWNERSHIP AND INTELLECTUAL PROPERTY
All intellectual property rights in GSAP Products, including but not limited to copyright, patents, trademarks, and trade secrets, remain the exclusive property of Webflow. This GSAP License does not transfer any ownership rights in GSAP Products to you.
V. TERMINATION
Webflow may terminate this GSAP License and revoke your access in its discretion if you fail to comply with any of these terms and conditions. Upon termination, you must cease all use of GSAP Products and destroy all copies in your possession.
VI. MISCELLANEOUS PROVISIONS
General: This GSAP License is incorporated into and subject to Webflow’s Terms of Service available here (https://webflow.com/legal/terms) ("Terms of Service"). In the event of any conflict or inconsistency between this GSAP License and the Terms of Service, the terms of this GSAP License shall govern in relation to your use of any GSAP Products.
Amendments: Webflow reserves the right to update or modify this GSAP License at any time by posting the revised terms on this website, provided that any such updates or modifications shall not result in any material degradation to the security, integrity, or functionality of any GSAP Products. You understand and agree that your continued use of any GSAP Products after such revisions to this GSAP License constitutes your acceptance of this GSAP License as revised. If you do not accept the revised GSAP License, you are prohibited from using versions of the GSAP Products released after the effective date of the revised GSAP License (as well as any updates made to previous versions). Notwithstanding, you may continue using previous versions of GSAP Products under the applicable terms licensed to you prior to the effective date of the revised GSAP License (for clarity, excluding any updates made thereto).
No Waiver: Failure of Webflow to enforce any provision of this GSAP License shall not constitute a waiver of future enforcement of that or any other provision.
FAQ
Is it acceptable for AI tools like ChatGPT, Cursor, Lovable, Webstudio, etc. to generate GSAP code?
Absolutely! AI-generated code is not a "Prohibited Use".
What if a WordPress plugin or theme or other niche tool allows users to create GSAP-driven effects through a visual interface? Is that prohibited?
We want to encourage developers to build on top of GSAP, including visual tools that don't directly compete with Webflow's rich animation-building capabilities. If you are not sure if your product might be considered a "Prohibited Use", feel free to contact us (https://gsap.com/contact) so we can talk through it!
Can I really use GSAP in commercial projects without paying anything?
Yes, really! Commercial usage is covered under the standard license. All of GSAP including the plugins that were formerly "members-only" like SplitText (https://gsap.com/docs/v3/Plugins/SplitText/) and MorphSVG (https://gsap.com/docs/v3/Plugins/MorphSVGPlugin) can be used in commercial projects at no charge. Enjoy! 💚
Effective date: April 30, 2025
Last modified date: May 30, 2025
Copyright (©) 2025, Webflow
three@0.176.0 — LICENSE
The MIT License
Copyright © 2010-2025 three.js authors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
stats.js@0.17.0 — LICENSE
The MIT License
Copyright (c) 2009-2016 stats.js authors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
normalize-wheel@1.0.1 — LICENSE
BSD License
For FixedDataTable software
Copyright (c) 2015, Facebook, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name Facebook nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
BEHIND THE EXAMPLE
이 장면을 만드는 원리
자취 이력과 입자 갱신의 GPU 실행 순서
화면 크기·입력·동시 작업을 고정하고 실제 렌더링 실패와 비용을 관찰합니다.
- 이 예제에서는
- ParticlesTrails는 초기 compute가 끝난 후 매 update에서 computePositionStory를 먼저 기다리고 computeUpdate를 실행합니다. 이 순서가 자취가 참조하는 위치의 시점을 정합니다.
코드와 함께 확인하기
코드에서 찾기
updateParticlesTrails.js두 computeAsync를 순서대로 await합니다.
직접 해보기
초기화 지연과 많은 입자 조건에서 자취의 첫 프레임·연속성을 관찰합니다.
살펴볼 변화초기 버퍼를 읽기 전에 준비가 끝나는지와 겹친 update 요청이 생기는지 확인해야 합니다.
