diff --git a/INSTRUCTIONS.md b/INSTRUCTIONS.md
new file mode 100644
index 0000000..ae3da83
--- /dev/null
+++ b/INSTRUCTIONS.md
@@ -0,0 +1,81 @@
+# CIS 566 Homework 2: Implicit Surfaces
+
+## Objective
+- Gain experience with signed distance functions
+- Experiment with animation curves
+
+## Base Code
+
+Please feel free to use this code as a base (https://www.shadertoy.com/view/fsdXzM)
+
+The code we have provided for this assignment features the following:
+- A square that spans the range [-1, 1] in X and Y that is rendered with a
+shader that does not apply a projection matrix to it, thus rendering it as the
+entirety of your screen
+- TypeScript code just like the code in homework 1 to set up a WebGL framework
+- Code that passes certain camera attributes (listed in the next section),
+the screen dimensions, and a time counter to the shader program.
+
+## Assignment Requirements
+- __(10 points)__ Modify the provided `flat-frag.glsl` to cast rays from a
+virtual camera. We have set up uniform variables in your shader that take in
+the eye position, reference point position, and up vector of the `Camera` in
+the provided TypeScript code, along with a uniform that stores the screen width
+and height. Using these uniform variables, and only these uniform variables,
+you must write a function that uses the NDC coordinates of the current fragment
+(i.e. its fs_Pos value) and projects a ray from that pixel. Refer to the [slides
+on ray casting](https://docs.google.com/presentation/d/e/2PACX-1vSN5ntJISgdOXOSNyoHimSVKblnPnL-Nywd6aRPI-XPucX9CeqzIEGTjFTwvmjYUgCglTqgvyP1CpxZ/pub?start=false&loop=false&delayms=60000&slide=id.g27215b64c6_0_107)
+from CIS 560 for reference on how to cast a ray without an explicit
+view-projection matrix. You'll have to compute your camera's Right vector based
+on the provided Up vector, Eye point, and Ref point. You can test your ray
+casting function by converting your ray directions to colors using the formula
+`color = 0.5 * (dir + vec3(1.0, 1.0, 1.0))`. If your screen looks like the
+following image, your rays are being cast correctly:
+![](rayDir.png)
+- __(70 points)__ Create a scene using raymarched signed distance functions.
+The subject of your scene should be based on some reference image, such as a
+shot from a movie or a piece of artwork. Your scene should incorporate the
+following elements:
+ - The SDF combination operation Smooth Blend.
+ - Basic Lambertian reflection using a hard-coded light source and SDF surface normals.
+ - Animation of at least one element of the scene, with at least two Toolbox Functions
+ used to control the animation(s).
+ - Hard-edged shadows cast by shapes in the scene onto one another using a shadow-feeler ray.
+
+For the next assignment you will build upon this scene with procedural textures and more
+advanced lighting and reflection models, so don't worry if your scene looks a bit drab
+given the requirements listed above.
+
+- __(10 points)__ Following the specifications listed
+[here](https://github.com/pjcozzi/Articles/blob/master/CIS565/GitHubRepo/README.md),
+create your own README.md, renaming this file to INSTRUCTIONS.md. Don't worry
+about discussing runtime optimization for this project. Make sure your
+README contains the following information:
+ - Your name and PennKey
+ - Citation of any external resources you found helpful when implementing this
+ assignment.
+ - A link to your live github.io demo (refer to the pinned Piazza post on
+ how to make a live demo through github.io)
+ - An explanation of the techniques you used to model and animate your scene.
+
+## Useful Links
+- [IQ's Article on SDFs](http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm)
+- [IQ's Article on Smooth Blending](http://www.iquilezles.org/www/articles/smin/smin.htm)
+- [IQ's Article on Useful Functions](http://www.iquilezles.org/www/articles/functions/functions.htm)
+- [Breakdown of Rendering an SDF Scene](http://www.iquilezles.org/www/material/nvscene2008/rwwtt.pdf)
+
+
+## Submission
+Commit and push to Github, then submit a link to your commit on Canvas. Remember
+to make your own README!
+
+## Inspiration
+- [Alien Corridor](https://www.shadertoy.com/view/4slyRs)
+- [The Evolution of Motion](https://www.shadertoy.com/view/XlfGzH)
+- [Fractal Land](https://www.shadertoy.com/view/XsBXWt)
+- [Voxel Edges](https://www.shadertoy.com/view/4dfGzs)
+- [Snail](https://www.shadertoy.com/view/ld3Gz2)
+- [Cubescape](https://www.shadertoy.com/view/Msl3Rr)
+- [Journey Tribute](https://www.shadertoy.com/view/ldlcRf)
+- [Stormy Landscape](https://www.shadertoy.com/view/4ts3z2)
+- [Generators](https://www.shadertoy.com/view/Xtf3Rn)
diff --git a/README.md b/README.md
index ae3da83..6056f26 100644
--- a/README.md
+++ b/README.md
@@ -1,81 +1,48 @@
# CIS 566 Homework 2: Implicit Surfaces
+Author: Nathaniel Korzekwa
-## Objective
-- Gain experience with signed distance functions
-- Experiment with animation curves
+PennKey: korzekwa
-## Base Code
+[Live Demo](https://ciscprocess.github.io/hw02-raymarching-sdfs/)
-Please feel free to use this code as a base (https://www.shadertoy.com/view/fsdXzM)
+# Overview and Goal
+This project currently lays the technical foundation for what I hope to be a
+musically-animated piano, ideally with some somewhat interesting decorations in
+the scene.
-The code we have provided for this assignment features the following:
-- A square that spans the range [-1, 1] in X and Y that is rendered with a
-shader that does not apply a projection matrix to it, thus rendering it as the
-entirety of your screen
-- TypeScript code just like the code in homework 1 to set up a WebGL framework
-- Code that passes certain camera attributes (listed in the next section),
-the screen dimensions, and a time counter to the shader program.
+I have a soft-spot for old-school MIDI-style or other "low-quality" synthetic
+music, and my hope is to be able to write a program/shader that can render the
+keystrokes that match the music being played. Ideally, this could include procdural
+"music" rendered by some sort of noise function, but that may not be realistic.
-## Assignment Requirements
-- __(10 points)__ Modify the provided `flat-frag.glsl` to cast rays from a
-virtual camera. We have set up uniform variables in your shader that take in
-the eye position, reference point position, and up vector of the `Camera` in
-the provided TypeScript code, along with a uniform that stores the screen width
-and height. Using these uniform variables, and only these uniform variables,
-you must write a function that uses the NDC coordinates of the current fragment
-(i.e. its fs_Pos value) and projects a ray from that pixel. Refer to the [slides
-on ray casting](https://docs.google.com/presentation/d/e/2PACX-1vSN5ntJISgdOXOSNyoHimSVKblnPnL-Nywd6aRPI-XPucX9CeqzIEGTjFTwvmjYUgCglTqgvyP1CpxZ/pub?start=false&loop=false&delayms=60000&slide=id.g27215b64c6_0_107)
-from CIS 560 for reference on how to cast a ray without an explicit
-view-projection matrix. You'll have to compute your camera's Right vector based
-on the provided Up vector, Eye point, and Ref point. You can test your ray
-casting function by converting your ray directions to colors using the formula
-`color = 0.5 * (dir + vec3(1.0, 1.0, 1.0))`. If your screen looks like the
-following image, your rays are being cast correctly:
-![](rayDir.png)
-- __(70 points)__ Create a scene using raymarched signed distance functions.
-The subject of your scene should be based on some reference image, such as a
-shot from a movie or a piece of artwork. Your scene should incorporate the
-following elements:
- - The SDF combination operation Smooth Blend.
- - Basic Lambertian reflection using a hard-coded light source and SDF surface normals.
- - Animation of at least one element of the scene, with at least two Toolbox Functions
- used to control the animation(s).
- - Hard-edged shadows cast by shapes in the scene onto one another using a shadow-feeler ray.
+# Engine
+Currently, the raymarching engine closely follows the template given in class:
+rays are cast from the eye through voxels in the screen, and points are generated
+based on the distance to the closest object along the ray until a collision is
+found.
-For the next assignment you will build upon this scene with procedural textures and more
-advanced lighting and reflection models, so don't worry if your scene looks a bit drab
-given the requirements listed above.
+I did add a bounding box around the most complicated part of the scene (the keys),
+to limit the amount of rays that needed to compute that part of the SDF, as well
+as a somewhat trivial "max distance" ray limiter.
-- __(10 points)__ Following the specifications listed
-[here](https://github.com/pjcozzi/Articles/blob/master/CIS565/GitHubRepo/README.md),
-create your own README.md, renaming this file to INSTRUCTIONS.md. Don't worry
-about discussing runtime optimization for this project. Make sure your
-README contains the following information:
- - Your name and PennKey
- - Citation of any external resources you found helpful when implementing this
- assignment.
- - A link to your live github.io demo (refer to the pinned Piazza post on
- how to make a live demo through github.io)
- - An explanation of the techniques you used to model and animate your scene.
+Since I have old hardware and the piano keys add a huge drain, I actually downsampled
+the resolution and may need to keep it that way (or add it as a setting perhaps),
+since timing will be so critical in this project.
-## Useful Links
-- [IQ's Article on SDFs](http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm)
-- [IQ's Article on Smooth Blending](http://www.iquilezles.org/www/articles/smin/smin.htm)
-- [IQ's Article on Useful Functions](http://www.iquilezles.org/www/articles/functions/functions.htm)
-- [Breakdown of Rendering an SDF Scene](http://www.iquilezles.org/www/material/nvscene2008/rwwtt.pdf)
+# Status
+
+
+
+Current Rendering
+Currently the scene is pretty drab. It's not really my best work, but the
+basics are there to be improved upon. The 'D' keys are animated according to
+exponential impulse and cosine over time, and parts of the piano are smoothed
+together. I did add basic coloring since the white was painful on my eyes.
-## Submission
-Commit and push to Github, then submit a link to your commit on Canvas. Remember
-to make your own README!
+I used some smooth union and smooth subtraction operations to make things look
+a little nicer than plain min/max operations.
-## Inspiration
-- [Alien Corridor](https://www.shadertoy.com/view/4slyRs)
-- [The Evolution of Motion](https://www.shadertoy.com/view/XlfGzH)
-- [Fractal Land](https://www.shadertoy.com/view/XsBXWt)
-- [Voxel Edges](https://www.shadertoy.com/view/4dfGzs)
-- [Snail](https://www.shadertoy.com/view/ld3Gz2)
-- [Cubescape](https://www.shadertoy.com/view/Msl3Rr)
-- [Journey Tribute](https://www.shadertoy.com/view/ldlcRf)
-- [Stormy Landscape](https://www.shadertoy.com/view/4ts3z2)
-- [Generators](https://www.shadertoy.com/view/Xtf3Rn)
+But there are still many details off: No pedals, no bench, no music, the number
+of keys is wrong, and I'm sure there are some other piano details that will
+throw red flags. I hope to adress these later in the project.
\ No newline at end of file
diff --git a/dist/bundle.js b/dist/bundle.js
index 561c482..1f9a95e 100644
--- a/dist/bundle.js
+++ b/dist/bundle.js
@@ -8,242 +8,242 @@
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
-
-
-module.exports = createCamera
-
-var now = __webpack_require__(/*! right-now */ "./node_modules/right-now/browser.js")
-var createView = __webpack_require__(/*! 3d-view */ "./node_modules/3d-view/view.js")
-var mouseChange = __webpack_require__(/*! mouse-change */ "./node_modules/mouse-change/mouse-listen.js")
-var mouseWheel = __webpack_require__(/*! mouse-wheel */ "./node_modules/mouse-wheel/wheel.js")
-var mouseOffset = __webpack_require__(/*! mouse-event-offset */ "./node_modules/mouse-event-offset/index.js")
-var hasPassive = __webpack_require__(/*! has-passive-events */ "./node_modules/has-passive-events/index.js")
-
-function createCamera(element, options) {
- element = element || document.body
- options = options || {}
-
- var limits = [ 0.01, Infinity ]
- if('distanceLimits' in options) {
- limits[0] = options.distanceLimits[0]
- limits[1] = options.distanceLimits[1]
- }
- if('zoomMin' in options) {
- limits[0] = options.zoomMin
- }
- if('zoomMax' in options) {
- limits[1] = options.zoomMax
- }
-
- var view = createView({
- center: options.center || [0,0,0],
- up: options.up || [0,1,0],
- eye: options.eye || [0,0,10],
- mode: options.mode || 'orbit',
- distanceLimits: limits
- })
-
- var pmatrix = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
- var distance = 0.0
- var width = element.clientWidth
- var height = element.clientHeight
-
- var camera = {
- view: view,
- element: element,
- delay: options.delay || 16,
- rotateSpeed: options.rotateSpeed || 1,
- zoomSpeed: options.zoomSpeed || 1,
- translateSpeed: options.translateSpeed || 1,
- flipX: !!options.flipX,
- flipY: !!options.flipY,
- modes: view.modes,
- tick: function() {
- var t = now()
- var delay = this.delay
- view.idle(t-delay)
- view.flush(t-(100+delay*2))
- var ctime = t - 2 * delay
- view.recalcMatrix(ctime)
- var allEqual = true
- var matrix = view.computedMatrix
- for(var i=0; i<16; ++i) {
- allEqual = allEqual && (pmatrix[i] === matrix[i])
- pmatrix[i] = matrix[i]
- }
- var sizeChanged =
- element.clientWidth === width &&
- element.clientHeight === height
- width = element.clientWidth
- height = element.clientHeight
- if(allEqual) {
- return !sizeChanged
- }
- distance = Math.exp(view.computedRadius[0])
- return true
- },
- lookAt: function(center, eye, up) {
- view.lookAt(view.lastT(), center, eye, up)
- },
- rotate: function(pitch, yaw, roll) {
- view.rotate(view.lastT(), pitch, yaw, roll)
- },
- pan: function(dx, dy, dz) {
- view.pan(view.lastT(), dx, dy, dz)
- },
- translate: function(dx, dy, dz) {
- view.translate(view.lastT(), dx, dy, dz)
- }
- }
-
- Object.defineProperties(camera, {
- matrix: {
- get: function() {
- return view.computedMatrix
- },
- set: function(mat) {
- view.setMatrix(view.lastT(), mat)
- return view.computedMatrix
- },
- enumerable: true
- },
- mode: {
- get: function() {
- return view.getMode()
- },
- set: function(mode) {
- view.setMode(mode)
- return view.getMode()
- },
- enumerable: true
- },
- center: {
- get: function() {
- return view.computedCenter
- },
- set: function(ncenter) {
- view.lookAt(view.lastT(), ncenter)
- return view.computedCenter
- },
- enumerable: true
- },
- eye: {
- get: function() {
- return view.computedEye
- },
- set: function(neye) {
- view.lookAt(view.lastT(), null, neye)
- return view.computedEye
- },
- enumerable: true
- },
- up: {
- get: function() {
- return view.computedUp
- },
- set: function(nup) {
- view.lookAt(view.lastT(), null, null, nup)
- return view.computedUp
- },
- enumerable: true
- },
- distance: {
- get: function() {
- return distance
- },
- set: function(d) {
- view.setDistance(view.lastT(), d)
- return d
- },
- enumerable: true
- },
- distanceLimits: {
- get: function() {
- return view.getDistanceLimits(limits)
- },
- set: function(v) {
- view.setDistanceLimits(v)
- return v
- },
- enumerable: true
- }
- })
-
- element.addEventListener('contextmenu', function(ev) {
- ev.preventDefault()
- return false
- })
-
- var lastX = 0, lastY = 0, lastMods = {shift: false, control: false, alt: false, meta: false}
- mouseChange(element, handleInteraction)
-
- //enable simple touch interactions
- element.addEventListener('touchstart', function (ev) {
- var xy = mouseOffset(ev.changedTouches[0], element)
- handleInteraction(0, xy[0], xy[1], lastMods)
- handleInteraction(1, xy[0], xy[1], lastMods)
-
- ev.preventDefault()
- }, hasPassive ? {passive: false} : false)
-
- element.addEventListener('touchmove', function (ev) {
- var xy = mouseOffset(ev.changedTouches[0], element)
- handleInteraction(1, xy[0], xy[1], lastMods)
-
- ev.preventDefault()
- }, hasPassive ? {passive: false} : false)
-
- element.addEventListener('touchend', function (ev) {
- var xy = mouseOffset(ev.changedTouches[0], element)
- handleInteraction(0, lastX, lastY, lastMods)
-
- ev.preventDefault()
- }, hasPassive ? {passive: false} : false)
-
- function handleInteraction (buttons, x, y, mods) {
- var scale = 1.0 / element.clientHeight
- var dx = scale * (x - lastX)
- var dy = scale * (y - lastY)
-
- var flipX = camera.flipX ? 1 : -1
- var flipY = camera.flipY ? 1 : -1
-
- var drot = Math.PI * camera.rotateSpeed
-
- var t = now()
-
- if(buttons & 1) {
- if(mods.shift) {
- view.rotate(t, 0, 0, -dx * drot)
- } else {
- view.rotate(t, flipX * drot * dx, -flipY * drot * dy, 0)
- }
- } else if(buttons & 2) {
- view.pan(t, -camera.translateSpeed * dx * distance, camera.translateSpeed * dy * distance, 0)
- } else if(buttons & 4) {
- var kzoom = camera.zoomSpeed * dy / window.innerHeight * (t - view.lastT()) * 50.0
- view.pan(t, 0, 0, distance * (Math.exp(kzoom) - 1))
- }
-
- lastX = x
- lastY = y
- lastMods = mods
- }
-
- mouseWheel(element, function(dx, dy, dz) {
- var flipX = camera.flipX ? 1 : -1
- var flipY = camera.flipY ? 1 : -1
- var t = now()
- if(Math.abs(dx) > Math.abs(dy)) {
- view.rotate(t, 0, 0, -dx * flipX * Math.PI * camera.rotateSpeed / window.innerWidth)
- } else {
- var kzoom = camera.zoomSpeed * flipY * dy / window.innerHeight * (t - view.lastT()) / 100.0
- view.pan(t, 0, 0, distance * (Math.exp(kzoom) - 1))
- }
- }, true)
-
- return camera
-}
+
+
+module.exports = createCamera
+
+var now = __webpack_require__(/*! right-now */ "./node_modules/right-now/browser.js")
+var createView = __webpack_require__(/*! 3d-view */ "./node_modules/3d-view/view.js")
+var mouseChange = __webpack_require__(/*! mouse-change */ "./node_modules/mouse-change/mouse-listen.js")
+var mouseWheel = __webpack_require__(/*! mouse-wheel */ "./node_modules/mouse-wheel/wheel.js")
+var mouseOffset = __webpack_require__(/*! mouse-event-offset */ "./node_modules/mouse-event-offset/index.js")
+var hasPassive = __webpack_require__(/*! has-passive-events */ "./node_modules/has-passive-events/index.js")
+
+function createCamera(element, options) {
+ element = element || document.body
+ options = options || {}
+
+ var limits = [ 0.01, Infinity ]
+ if('distanceLimits' in options) {
+ limits[0] = options.distanceLimits[0]
+ limits[1] = options.distanceLimits[1]
+ }
+ if('zoomMin' in options) {
+ limits[0] = options.zoomMin
+ }
+ if('zoomMax' in options) {
+ limits[1] = options.zoomMax
+ }
+
+ var view = createView({
+ center: options.center || [0,0,0],
+ up: options.up || [0,1,0],
+ eye: options.eye || [0,0,10],
+ mode: options.mode || 'orbit',
+ distanceLimits: limits
+ })
+
+ var pmatrix = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
+ var distance = 0.0
+ var width = element.clientWidth
+ var height = element.clientHeight
+
+ var camera = {
+ view: view,
+ element: element,
+ delay: options.delay || 16,
+ rotateSpeed: options.rotateSpeed || 1,
+ zoomSpeed: options.zoomSpeed || 1,
+ translateSpeed: options.translateSpeed || 1,
+ flipX: !!options.flipX,
+ flipY: !!options.flipY,
+ modes: view.modes,
+ tick: function() {
+ var t = now()
+ var delay = this.delay
+ view.idle(t-delay)
+ view.flush(t-(100+delay*2))
+ var ctime = t - 2 * delay
+ view.recalcMatrix(ctime)
+ var allEqual = true
+ var matrix = view.computedMatrix
+ for(var i=0; i<16; ++i) {
+ allEqual = allEqual && (pmatrix[i] === matrix[i])
+ pmatrix[i] = matrix[i]
+ }
+ var sizeChanged =
+ element.clientWidth === width &&
+ element.clientHeight === height
+ width = element.clientWidth
+ height = element.clientHeight
+ if(allEqual) {
+ return !sizeChanged
+ }
+ distance = Math.exp(view.computedRadius[0])
+ return true
+ },
+ lookAt: function(center, eye, up) {
+ view.lookAt(view.lastT(), center, eye, up)
+ },
+ rotate: function(pitch, yaw, roll) {
+ view.rotate(view.lastT(), pitch, yaw, roll)
+ },
+ pan: function(dx, dy, dz) {
+ view.pan(view.lastT(), dx, dy, dz)
+ },
+ translate: function(dx, dy, dz) {
+ view.translate(view.lastT(), dx, dy, dz)
+ }
+ }
+
+ Object.defineProperties(camera, {
+ matrix: {
+ get: function() {
+ return view.computedMatrix
+ },
+ set: function(mat) {
+ view.setMatrix(view.lastT(), mat)
+ return view.computedMatrix
+ },
+ enumerable: true
+ },
+ mode: {
+ get: function() {
+ return view.getMode()
+ },
+ set: function(mode) {
+ view.setMode(mode)
+ return view.getMode()
+ },
+ enumerable: true
+ },
+ center: {
+ get: function() {
+ return view.computedCenter
+ },
+ set: function(ncenter) {
+ view.lookAt(view.lastT(), ncenter)
+ return view.computedCenter
+ },
+ enumerable: true
+ },
+ eye: {
+ get: function() {
+ return view.computedEye
+ },
+ set: function(neye) {
+ view.lookAt(view.lastT(), null, neye)
+ return view.computedEye
+ },
+ enumerable: true
+ },
+ up: {
+ get: function() {
+ return view.computedUp
+ },
+ set: function(nup) {
+ view.lookAt(view.lastT(), null, null, nup)
+ return view.computedUp
+ },
+ enumerable: true
+ },
+ distance: {
+ get: function() {
+ return distance
+ },
+ set: function(d) {
+ view.setDistance(view.lastT(), d)
+ return d
+ },
+ enumerable: true
+ },
+ distanceLimits: {
+ get: function() {
+ return view.getDistanceLimits(limits)
+ },
+ set: function(v) {
+ view.setDistanceLimits(v)
+ return v
+ },
+ enumerable: true
+ }
+ })
+
+ element.addEventListener('contextmenu', function(ev) {
+ ev.preventDefault()
+ return false
+ })
+
+ var lastX = 0, lastY = 0, lastMods = {shift: false, control: false, alt: false, meta: false}
+ mouseChange(element, handleInteraction)
+
+ //enable simple touch interactions
+ element.addEventListener('touchstart', function (ev) {
+ var xy = mouseOffset(ev.changedTouches[0], element)
+ handleInteraction(0, xy[0], xy[1], lastMods)
+ handleInteraction(1, xy[0], xy[1], lastMods)
+
+ ev.preventDefault()
+ }, hasPassive ? {passive: false} : false)
+
+ element.addEventListener('touchmove', function (ev) {
+ var xy = mouseOffset(ev.changedTouches[0], element)
+ handleInteraction(1, xy[0], xy[1], lastMods)
+
+ ev.preventDefault()
+ }, hasPassive ? {passive: false} : false)
+
+ element.addEventListener('touchend', function (ev) {
+ var xy = mouseOffset(ev.changedTouches[0], element)
+ handleInteraction(0, lastX, lastY, lastMods)
+
+ ev.preventDefault()
+ }, hasPassive ? {passive: false} : false)
+
+ function handleInteraction (buttons, x, y, mods) {
+ var scale = 1.0 / element.clientHeight
+ var dx = scale * (x - lastX)
+ var dy = scale * (y - lastY)
+
+ var flipX = camera.flipX ? 1 : -1
+ var flipY = camera.flipY ? 1 : -1
+
+ var drot = Math.PI * camera.rotateSpeed
+
+ var t = now()
+
+ if(buttons & 1) {
+ if(mods.shift) {
+ view.rotate(t, 0, 0, -dx * drot)
+ } else {
+ view.rotate(t, flipX * drot * dx, -flipY * drot * dy, 0)
+ }
+ } else if(buttons & 2) {
+ view.pan(t, -camera.translateSpeed * dx * distance, camera.translateSpeed * dy * distance, 0)
+ } else if(buttons & 4) {
+ var kzoom = camera.zoomSpeed * dy / window.innerHeight * (t - view.lastT()) * 50.0
+ view.pan(t, 0, 0, distance * (Math.exp(kzoom) - 1))
+ }
+
+ lastX = x
+ lastY = y
+ lastMods = mods
+ }
+
+ mouseWheel(element, function(dx, dy, dz) {
+ var flipX = camera.flipX ? 1 : -1
+ var flipY = camera.flipY ? 1 : -1
+ var t = now()
+ if(Math.abs(dx) > Math.abs(dy)) {
+ view.rotate(t, 0, 0, -dx * flipX * Math.PI * camera.rotateSpeed / window.innerWidth)
+ } else {
+ var kzoom = camera.zoomSpeed * flipY * dy / window.innerHeight * (t - view.lastT()) / 100.0
+ view.pan(t, 0, 0, distance * (Math.exp(kzoom) - 1))
+ }
+ }, true)
+
+ return camera
+}
/***/ }),
@@ -1810,9 +1810,13 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export */ "fromRotationTranslationScaleOrigin": () => (/* binding */ fromRotationTranslationScaleOrigin),
/* harmony export */ "fromQuat": () => (/* binding */ fromQuat),
/* harmony export */ "frustum": () => (/* binding */ frustum),
+/* harmony export */ "perspectiveNO": () => (/* binding */ perspectiveNO),
/* harmony export */ "perspective": () => (/* binding */ perspective),
+/* harmony export */ "perspectiveZO": () => (/* binding */ perspectiveZO),
/* harmony export */ "perspectiveFromFieldOfView": () => (/* binding */ perspectiveFromFieldOfView),
+/* harmony export */ "orthoNO": () => (/* binding */ orthoNO),
/* harmony export */ "ortho": () => (/* binding */ ortho),
+/* harmony export */ "orthoZO": () => (/* binding */ orthoZO),
/* harmony export */ "lookAt": () => (/* binding */ lookAt),
/* harmony export */ "targetTo": () => (/* binding */ targetTo),
/* harmony export */ "str": () => (/* binding */ str),
@@ -3188,6 +3192,8 @@ function frustum(out, left, right, bottom, top, near, far) {
}
/**
* Generates a perspective projection matrix with the given bounds.
+ * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],
+ * which matches WebGL/OpenGL's clip volume.
* Passing null/undefined/no value for far will generate infinite projection matrix.
*
* @param {mat4} out mat4 frustum matrix will be written into
@@ -3198,7 +3204,7 @@ function frustum(out, left, right, bottom, top, near, far) {
* @returns {mat4} out
*/
-function perspective(out, fovy, aspect, near, far) {
+function perspectiveNO(out, fovy, aspect, near, far) {
var f = 1.0 / Math.tan(fovy / 2),
nf;
out[0] = f / aspect;
@@ -3227,6 +3233,55 @@ function perspective(out, fovy, aspect, near, far) {
return out;
}
+/**
+ * Alias for {@link mat4.perspectiveNO}
+ * @function
+ */
+
+var perspective = perspectiveNO;
+/**
+ * Generates a perspective projection matrix suitable for WebGPU with the given bounds.
+ * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],
+ * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.
+ * Passing null/undefined/no value for far will generate infinite projection matrix.
+ *
+ * @param {mat4} out mat4 frustum matrix will be written into
+ * @param {number} fovy Vertical field of view in radians
+ * @param {number} aspect Aspect ratio. typically viewport width/height
+ * @param {number} near Near bound of the frustum
+ * @param {number} far Far bound of the frustum, can be null or Infinity
+ * @returns {mat4} out
+ */
+
+function perspectiveZO(out, fovy, aspect, near, far) {
+ var f = 1.0 / Math.tan(fovy / 2),
+ nf;
+ out[0] = f / aspect;
+ out[1] = 0;
+ out[2] = 0;
+ out[3] = 0;
+ out[4] = 0;
+ out[5] = f;
+ out[6] = 0;
+ out[7] = 0;
+ out[8] = 0;
+ out[9] = 0;
+ out[11] = -1;
+ out[12] = 0;
+ out[13] = 0;
+ out[15] = 0;
+
+ if (far != null && far !== Infinity) {
+ nf = 1 / (near - far);
+ out[10] = far * nf;
+ out[14] = far * near * nf;
+ } else {
+ out[10] = -1;
+ out[14] = -near;
+ }
+
+ return out;
+}
/**
* Generates a perspective projection matrix with the given field of view.
* This is primarily useful for generating projection matrices to be used
@@ -3265,7 +3320,9 @@ function perspectiveFromFieldOfView(out, fov, near, far) {
return out;
}
/**
- * Generates a orthogonal projection matrix with the given bounds
+ * Generates a orthogonal projection matrix with the given bounds.
+ * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],
+ * which matches WebGL/OpenGL's clip volume.
*
* @param {mat4} out mat4 frustum matrix will be written into
* @param {number} left Left bound of the frustum
@@ -3277,7 +3334,7 @@ function perspectiveFromFieldOfView(out, fov, near, far) {
* @returns {mat4} out
*/
-function ortho(out, left, right, bottom, top, near, far) {
+function orthoNO(out, left, right, bottom, top, near, far) {
var lr = 1 / (left - right);
var bt = 1 / (bottom - top);
var nf = 1 / (near - far);
@@ -3299,6 +3356,49 @@ function ortho(out, left, right, bottom, top, near, far) {
out[15] = 1;
return out;
}
+/**
+ * Alias for {@link mat4.orthoNO}
+ * @function
+ */
+
+var ortho = orthoNO;
+/**
+ * Generates a orthogonal projection matrix with the given bounds.
+ * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],
+ * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.
+ *
+ * @param {mat4} out mat4 frustum matrix will be written into
+ * @param {number} left Left bound of the frustum
+ * @param {number} right Right bound of the frustum
+ * @param {number} bottom Bottom bound of the frustum
+ * @param {number} top Top bound of the frustum
+ * @param {number} near Near bound of the frustum
+ * @param {number} far Far bound of the frustum
+ * @returns {mat4} out
+ */
+
+function orthoZO(out, left, right, bottom, top, near, far) {
+ var lr = 1 / (left - right);
+ var bt = 1 / (bottom - top);
+ var nf = 1 / (near - far);
+ out[0] = -2 * lr;
+ out[1] = 0;
+ out[2] = 0;
+ out[3] = 0;
+ out[4] = 0;
+ out[5] = -2 * bt;
+ out[6] = 0;
+ out[7] = 0;
+ out[8] = 0;
+ out[9] = 0;
+ out[10] = nf;
+ out[11] = 0;
+ out[12] = (left + right) * lr;
+ out[13] = (top + bottom) * bt;
+ out[14] = near * nf;
+ out[15] = 1;
+ return out;
+}
/**
* Generates a look-at matrix with the given eye position, focal point, and up axis.
* If you want a matrix that actually makes an object look at another object, you should use targetTo instead.
@@ -5412,30 +5512,30 @@ function normalize(out, a) {
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
-
-
-var isBrowser = __webpack_require__(/*! is-browser */ "./node_modules/is-browser/client.js")
-
-function detect() {
- var supported = false
-
- try {
- var opts = Object.defineProperty({}, 'passive', {
- get: function() {
- supported = true
- }
- })
-
- window.addEventListener('test', null, opts)
- window.removeEventListener('test', null, opts)
- } catch(e) {
- supported = false
- }
-
- return supported
-}
-
-module.exports = isBrowser && detect()
+
+
+var isBrowser = __webpack_require__(/*! is-browser */ "./node_modules/is-browser/client.js")
+
+function detect() {
+ var supported = false
+
+ try {
+ var opts = Object.defineProperty({}, 'passive', {
+ get: function() {
+ supported = true
+ }
+ })
+
+ window.addEventListener('test', null, opts)
+ window.removeEventListener('test', null, opts)
+ } catch(e) {
+ supported = false
+ }
+
+ return supported
+}
+
+module.exports = isBrowser && detect()
/***/ }),
@@ -6867,17 +6967,6 @@ module.exports =
}
-/***/ }),
-
-/***/ "./node_modules/stats-js/build/stats.min.js":
-/*!**************************************************!*\
- !*** ./node_modules/stats-js/build/stats.min.js ***!
- \**************************************************/
-/***/ (function(module) {
-
-!function(e,t){ true?module.exports=t():0}(this,function(){"use strict";var c=function(){var n=0,l=document.createElement("div");function e(e){return l.appendChild(e.dom),e}function t(e){for(var t=0;t {
-module.exports = "#version 300 es\r\nprecision highp float;\r\n\r\nuniform vec3 u_Eye, u_Ref, u_Up;\r\nuniform vec2 u_Dimensions;\r\nuniform float u_Time;\r\n\r\nin vec2 fs_Pos;\r\nout vec4 out_Col;\r\n\r\nvoid main() {\r\n out_Col = vec4(0.5 * (fs_Pos + vec2(1.0)), 0.5 * (sin(u_Time * 3.14159 * 0.01) + 1.0), 1.0);\r\n}\r\n"
+module.exports = "#version 300 es\n\n#define keyPadding 0.011f\n#define keyScale 2.7f\nprecision highp float;\n\nuniform vec3 u_Eye, u_Ref, u_Up;\nuniform vec2 u_Dimensions;\nuniform float u_Time;\n\nin vec2 fs_Pos;\nout vec4 out_Col;\n\nconst int MAX_RAY_STEPS = 128;\nconst float FOV = 45.0;\nconst float FOV_TAN = tan(45.0);\nconst float EPSILON = 1e-6;\n\nconst vec3 EYE = vec3(0.0, 0.0, -10.0);\nconst vec3 ORIGIN = vec3(0.0, 0.0, 0.0);\nconst vec3 WORLD_UP = vec3(0.0, 1.0, 0.0);\nconst vec3 WORLD_RIGHT = vec3(1.0, 0.0, 0.0);\nconst vec3 WORLD_FORWARD = vec3(0.0, 0.0, 1.0);\nconst vec3 LIGHT_DIR = vec3(-1.0, -1.0, -2.0);\n\nconst vec3 ebCut = vec3(0.062, -0.27f, 0.f) / keyScale;\nconst vec3 ebCutB = vec3(0.04, 0.45, 0.121) / keyScale;\nconst vec3 whiteKeyBox = vec3(0.1, 0.71, 0.12) / keyScale;\nconst vec3 keyStep = vec3(0.2f + keyPadding, 0.f, 0.f) / keyScale;\n\nstruct Surface {\n float distance;\n vec3 color;\n};\n\nSurface mins(Surface a, Surface b) {\n if (a.distance < b.distance) {\n return a;\n } else {\n return b;\n }\n}\n\nSurface maxs(Surface a, Surface b) {\n if (a.distance > b.distance) {\n return a;\n } else {\n return b;\n }\n}\n\nstruct Ray \n{\n vec3 origin;\n vec3 direction;\n};\n\nstruct Intersection \n{\n vec3 position;\n vec3 normal;\n float distance_t;\n int material_id;\n vec3 color;\n};\n\n// --- Geometry helpers ---\nfloat smoothSubtraction(float d1, float d2, float k) {\n float h = clamp( 0.5 - 0.5*(d2+d1)/k, 0.0, 1.0 );\n return mix( d2, -d1, h ) + k*h*(1.0-h); \n}\n\nfloat lengthInf(vec3 p) {\n return max(p.x, max(p.y, p.y));\n}\n\nvec3 flipX(vec3 p) {\n return vec3(-p.x, p.y, p.z);\n}\n\nfloat smin(float a, float b, float k) {\n float h = clamp(0.5 + 0.5 * (b - a) / k, 0.0, 1.0);\n return mix(b, a, h) - k * h * (1.0 - h);\n}\n\nmat3 rotationMatrix(vec3 axis, float angle)\n{\n axis = normalize(axis);\n float s = sin(angle);\n float c = cos(angle);\n float oc = 1.0 - c;\n \n return mat3(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s,\n oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s,\n oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c);\n}\n\nvec3 translateTo(vec3 p, vec3 c) {\n return p - c;\n}\n\nvec3 rotateAround(vec3 p, vec3 axis, float angle) {\n return rotationMatrix(axis, angle) * p;\n}\n\n// L2-Norm SDFs\nfloat sdCappedCylinder(vec3 p, float h, float r) {\n vec2 d = abs(vec2(length(p.xz), p.y)) - vec2(h,r);\n return min(max(d.x, d.y), 0.0) + length(max(d, 0.0));\n}\n\nfloat sdfSphere(vec3 query_position, vec3 position, float radius) {\n return length(query_position - position) - radius;\n}\n\nfloat sdfRoundBox(vec3 p, vec3 b, float r) {\n vec3 q = abs(p) - b;\n return length(max(q,0.0)) + min(max(q.x,max(q.y,q.z)),0.0) - r;\n}\n\nfloat sdfBox( vec3 p, vec3 b ) {\n vec3 q = abs(p) - b;\n return length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0);\n}\n\nSurface sdfIvoryKey(vec3 p) {\n Surface s;\n s.distance = sdfBox(p, vec3(0.05, 0.45, 0.18) / keyScale);\n s.color = vec3(0.09f, 0.09f, 0.09f);\n return s;\n}\n\nSurface sdfEBKey(vec3 p) {\n Surface s;\n vec3 pt = p + ebCut;\n //return max(-sdfBox(pt, ebCutB), sdfBox(p, whiteKeyBox));\n float d1 = -sdfBox(pt, ebCutB);\n float d2 = sdfBox(p, whiteKeyBox);\n s.distance = d1 > d2 ? d1 : d2;\n s.color = vec3(0.98, 0.98, 0.98);\n return s;\n}\n\nSurface sdfCFKey(vec3 p) {\n return sdfEBKey(p - vec3(p.x * 2.f, 0.f, 0.f));\n}\n\nfloat expImpulse(float x, float k) {\n float h = k*x;\n return h*exp(1.0-h);\n}\n\nSurface sdfDKey(vec3 p) {\n Surface s;\n float mod = (1. + cos(u_Time / 4.f)) / 25.f;\n p.z -= expImpulse(mod, 1.f/25.f) * 4.5f;\n vec3 pt = p + vec3(0.085, -0.27f, 0.f) / keyScale;\n float leftBox = sdfBox(pt, vec3(0.02, 0.45, 0.121) / keyScale);\n pt = p + vec3(-0.089, -0.27f, 0.f) / keyScale;\n float rightBox = sdfBox(pt, vec3(0.02, 0.45, 0.121) / keyScale);\n s.distance = max(-rightBox, max(-leftBox, sdfBox(p, vec3(0.1, 0.71, 0.12) / keyScale)));\n s.color = vec3(0.98, 0.98, 0.98);\n return s;\n}\n\nSurface sdfGKey(vec3 p) {\n Surface s;\n vec3 pt = p + vec3(0.085, -0.27f, 0.f) / keyScale;\n float leftBox = sdfBox(pt, vec3(0.018, 0.45, 0.121) / keyScale);\n pt = p + vec3(-0.076, -0.27f, 0.f) / keyScale;\n float rightBox = sdfBox(pt, vec3(0.025, 0.45, 0.121) / keyScale);\n s.distance = max(-rightBox, max(-leftBox, sdfBox(p, vec3(0.1, 0.71, 0.12) / keyScale)));\n s.color = vec3(0.98, 0.98, 0.98);\n return s;\n}\n\nSurface sdfAKey(vec3 p) {\n return sdfGKey(p - vec3(p.x * 2.f, 0.f, 0.f));\n}\n\nSurface sdfMusicStand(vec3 p) {\n Surface s;\n vec3 p2 = p + vec3(0.f, 0.58f, 0.5f);\n p2 = rotateAround(p2, vec3(1.f, 0.f, 0.f), 0.3);\n s.distance = smoothSubtraction(\n sdCappedCylinder(p2 + vec3(-1.46f, 0.f, 0.2f), 0.2, 0.022),\n smoothSubtraction(\n sdCappedCylinder(p2 + vec3(1.46f, 0.f, 0.2f), 0.2, 0.022), \n sdfBox(p2, vec3(1.5f, 0.02f, 0.25f)),\n 0.1), 0.1);\n\n s.color = vec3(0.09, 0.09, 0.09);\n return s;\n}\n\n//const vec3 keyStep = vec3(0.2f + keyPadding, 0.f, 0.f) / keyScale;\nSurface sdfOctave(vec3 p, out vec3 p2) {\n vec3 ip = p - vec3(0.08, 0.28, -0.063) / keyScale;\n Surface c = sdfCFKey(p);\n p -= keyStep;\n Surface cs = sdfIvoryKey(ip);\n ip.x -= 0.255 / keyScale;\n Surface d = sdfDKey(p);\n p -= keyStep;\n Surface ds = sdfIvoryKey(ip);\n ip.x -= 0.38 / keyScale;\n Surface e = sdfEBKey(p);\n p -= keyStep;\n Surface f = sdfCFKey(p);\n p -= keyStep;\n Surface fs = sdfIvoryKey(ip);\n ip.x -= 0.24 / keyScale;\n Surface g = sdfGKey(p);\n p -= keyStep;\n Surface gs = sdfIvoryKey(ip);\n ip.x -= 0.23 / keyScale;\n Surface a = sdfAKey(p);\n p -= keyStep;\n Surface as = sdfIvoryKey(ip);\n Surface b = sdfEBKey(p);\n p -= keyStep;\n p2 = p;\n return mins(b, mins(mins(as, a), mins(mins(gs, g), mins(mins(fs, f), mins(e, mins(mins(ds, d), mins(cs, c)))))));\n //return e;\n}\n\nSurface sdfFrame(vec3 p) {\n Surface s;\n s.color = vec3(0.3f, 0.3f, 0.3f);\n vec3 mainB = vec3(7.f, 2.f, 6.f) / 4.f;\n vec3 sideB = vec3(0.05, 0.9, 0.9);\n vec3 frontB = vec3(mainB.x, sideB.x, 0.2);\n float top = sdfRoundBox(p + vec3(0.f, 0.f, 1.5f), vec3(7.1f, 2.1f, 0.1f) / 4.f, 0.01);\n float bottom = \n sdfBox(p + vec3(0.f, 1.f, -0.1f), vec3(1.7f, 0.3f, 0.1f));\n s.distance = min(sdfBox(p + vec3(0.f, mainB.y + sideB.y - frontB.y * 3.f, 0.f), frontB), \n smin(\n sdfRoundBox(p - flipX(mainB) + flipX(sideB), sideB, 0.01), \n smin(sdfRoundBox(p - mainB + sideB, sideB, 0.01), sdfBox(p, mainB), 0.1), 0.1));\n\n s.distance = smin(top, s.distance, 0.1);\n s.distance = min(s.distance, bottom);\n return s;\n}\n\nSurface sdfKeys(vec3 p, int octaves) {\n Surface v;\n v.distance = 999999.f;\n vec3 p2 = p;\n for (int i = 0; i < octaves; i++) {\n v = mins(v, sdfOctave(p2, p2));\n }\n\n return v;\n}\n\nSurface sceneSDF(vec3 queryPos) {\n float box = sdfBox(queryPos + vec3(0.f, 1.f, 0.2f), vec3(1.7f, 0.3f, 0.6f));\n Surface keys;\n keys.distance = 999999.f;\n if (box < EPSILON) {\n keys = sdfKeys(queryPos + vec3(1.6f, 0.95f, 0.2f), 6);\n }\n\n // Surface boxs;\n // boxs.distance = box;\n // boxs.color = vec3(0.f, 0.f, 1.f);\n\n // vec3 q2 = rotateAround(\n // queryPos,\n // vec3(0.0, 0.1f,0.1f),\n // 0.5f);\n\n // return sdfBox(\n // q2, \n // vec3(0.5f, 0.5f, 0.5f));\n\n //return sdfOctave(queryPos);\n vec3 p;\n Surface o1 = sdfFrame(queryPos);//sdfOctave(queryPos, p);\n //float o2 = sdfOctave(p, p);\n //return min(o1, o2);\n return mins(sdfMusicStand(queryPos), mins(keys, o1));\n}\n\n// Linf Norm SDFs\n\nconst float d = 0.001f;\nvec3 sceneSDFGrad(vec3 queryPos) {\n vec3 diffVec = vec3(d, 0.f, 0.f);\n return normalize(vec3(\n sceneSDF(queryPos + diffVec).distance - sceneSDF(queryPos - diffVec).distance ,\n sceneSDF(queryPos + diffVec.yxz).distance - sceneSDF(queryPos - diffVec.yxz).distance ,\n sceneSDF(queryPos + diffVec.zyx).distance - sceneSDF(queryPos - diffVec.zyx).distance \n ));\n}\n\nRay getRay(vec2 uv)\n{\n Ray r;\n \n vec3 look = normalize(u_Ref - u_Eye);\n vec3 camera_RIGHT = normalize(cross(u_Up, look));\n vec3 camera_UP = u_Up;\n \n float aspect_ratio = u_Dimensions.x / u_Dimensions.y;\n vec3 screen_vertical = camera_UP * FOV_TAN; \n vec3 screen_horizontal = camera_RIGHT * aspect_ratio * FOV_TAN;\n vec3 screen_point = (look + uv.x * screen_horizontal + uv.y * screen_vertical);\n \n r.origin = (screen_point + u_Eye) / 2.f;\n r.direction = normalize(screen_point - u_Eye);\n\n return r;\n}\n\nconst float MIN_STEP = EPSILON * 2.f;\nIntersection getRaymarchedIntersection(vec2 uv)\n{\n Intersection intersection;\n intersection.distance_t = -1.0;\n Ray ray = getRay(uv);\n\n float distance_t = 0.f;\n float prevDist = 99999.f;\n // if (uv.x < 0.5f || uv.y < 0.5f) {\n // return intersection;\n // }\n\n for (int step = 0; step < MAX_RAY_STEPS; step++) {\n vec3 point = ray.origin + ray.direction * distance_t;\n Surface s = sceneSDF(point);\n // if (point.y > 5.f || point.z > 5.f) {\n // break;\n // }\n // if (isinf(point.x) || isinf(point.y) || isinf(point.z)) {\n // break;\n // }\n\n // if (dist > prevDist) {\n // break;\n // }\n\n if (s.distance < EPSILON) {\n intersection.distance_t = s.distance;\n intersection.position = point;\n intersection.normal = sceneSDFGrad(point);\n intersection.color = s.color;\n\n return intersection;\n }\n\n distance_t += max(s.distance, MIN_STEP);\n\n if (distance_t > 100.f) {\n break;\n }\n }\n\n return intersection;\n}\n\nconst vec3 light = vec3(10.f, 14.f, 3.f);\nvec3 getSceneColor(vec2 uv) {\n Intersection intersection = getRaymarchedIntersection(uv);\n // if (uv.x > 0.3f && uv.y < -0.3f) {\n // if (abs(intersection.distance_t) < EPSILON) {\n // if (isinf(intersection.position.x)) {\n // return vec3(1.f, 0.f, 0.f);\n // }\n // }\n // return vec3(0.f, 0.f, 1.f);\n // }\n\n if (abs(intersection.distance_t) < EPSILON)\n {\n float diffuseTerm = dot(intersection.normal, normalize(u_Eye - intersection.position));\n diffuseTerm = clamp(diffuseTerm, 0.f, 1.f);\n\n return intersection.color * (diffuseTerm + 0.2);\n }\n\n return vec3(0.7, 0.2, 0.2);\n}\n\nvoid main() {\n // downsample resolution\n // vec2 target = u_Dimensions / 2.f;\n // vec2 scaled = (fs_Pos + vec2(1.f, 1.f)) / 2.f;\n // vec2 uv = vec2(floor(target.x * scaled.x), floor(target.y * scaled.y));\n // uv.x /= target.x;\n // uv.y /= target.y;\n // uv = uv * 2.f - vec2(1.f, 1.f);\n // Time varying pixel color\n vec3 col = getSceneColor(fs_Pos);\n\n // Output to screen\n out_Col = vec4(col, 1.0);//vec4(0.5 * (fs_Pos + vec2(1.0)), 0.5 * (sin(u_Time * 3.14159 * 0.01) + 1.0), 1.0);\n}"
/***/ }),
@@ -7869,7 +7958,7 @@ module.exports = "#version 300 es\r\nprecision highp float;\r\n\r\nuniform vec3
\************************************/
/***/ ((module) => {
-module.exports = "#version 300 es\r\nprecision highp float;\r\n\r\n// The vertex shader used to render the background of the scene\r\n\r\nin vec4 vs_Pos;\r\nout vec2 fs_Pos;\r\n\r\nvoid main() {\r\n fs_Pos = vs_Pos.xy;\r\n gl_Position = vs_Pos;\r\n}\r\n"
+module.exports = "#version 300 es\nprecision highp float;\n\n// The vertex shader used to render the background of the scene\n\nin vec4 vs_Pos;\nout vec2 fs_Pos;\n\nvoid main() {\n fs_Pos = vs_Pos.xy;\n gl_Position = vs_Pos;\n}\n"
/***/ })
@@ -7893,25 +7982,13 @@ module.exports = "#version 300 es\r\nprecision highp float;\r\n\r\n// The vertex
/******/ };
/******/
/******/ // Execute the module function
-/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
-/******/ /* webpack/runtime/compat get default export */
-/******/ (() => {
-/******/ // getDefaultExport function for compatibility with non-harmony modules
-/******/ __webpack_require__.n = (module) => {
-/******/ var getter = module && module.__esModule ?
-/******/ () => (module['default']) :
-/******/ () => (module);
-/******/ __webpack_require__.d(getter, { a: getter });
-/******/ return getter;
-/******/ };
-/******/ })();
-/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
@@ -7961,18 +8038,15 @@ var __webpack_exports__ = {};
!*** ./src/main.ts ***!
\*********************/
__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var gl_matrix__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! gl-matrix */ "./node_modules/gl-matrix/esm/vec3.js");
-/* harmony import */ var stats_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! stats-js */ "./node_modules/stats-js/build/stats.min.js");
-/* harmony import */ var stats_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(stats_js__WEBPACK_IMPORTED_MODULE_0__);
-Object(function webpackMissingModule() { var e = new Error("Cannot find module 'dat-gui'"); e.code = 'MODULE_NOT_FOUND'; throw e; }());
-/* harmony import */ var _geometry_Square__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./geometry/Square */ "./src/geometry/Square.ts");
-/* harmony import */ var _rendering_gl_OpenGLRenderer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./rendering/gl/OpenGLRenderer */ "./src/rendering/gl/OpenGLRenderer.ts");
-/* harmony import */ var _Camera__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Camera */ "./src/Camera.ts");
-/* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./globals */ "./src/globals.ts");
-/* harmony import */ var _rendering_gl_ShaderProgram__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./rendering/gl/ShaderProgram */ "./src/rendering/gl/ShaderProgram.ts");
-
-
+/* harmony import */ var gl_matrix__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! gl-matrix */ "./node_modules/gl-matrix/esm/vec3.js");
+/* harmony import */ var _geometry_Square__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./geometry/Square */ "./src/geometry/Square.ts");
+/* harmony import */ var _rendering_gl_OpenGLRenderer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./rendering/gl/OpenGLRenderer */ "./src/rendering/gl/OpenGLRenderer.ts");
+/* harmony import */ var _Camera__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Camera */ "./src/Camera.ts");
+/* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./globals */ "./src/globals.ts");
+/* harmony import */ var _rendering_gl_ShaderProgram__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./rendering/gl/ShaderProgram */ "./src/rendering/gl/ShaderProgram.ts");
+// import * as Stats from 'stats-js';
+// import * as DAT from 'dat-gui';
@@ -7987,7 +8061,7 @@ const controls = {
let square;
let time = 0;
function loadScene() {
- square = new _geometry_Square__WEBPACK_IMPORTED_MODULE_2__["default"](gl_matrix__WEBPACK_IMPORTED_MODULE_7__.fromValues(0, 0, 0));
+ square = new _geometry_Square__WEBPACK_IMPORTED_MODULE_0__["default"](gl_matrix__WEBPACK_IMPORTED_MODULE_5__.fromValues(0, 0, 0));
square.create();
// time = 0;
}
@@ -8004,14 +8078,14 @@ function main() {
}
}, false);
// Initial display for framerate
- const stats = stats_js__WEBPACK_IMPORTED_MODULE_0__();
- stats.setMode(0);
- stats.domElement.style.position = 'absolute';
- stats.domElement.style.left = '0px';
- stats.domElement.style.top = '0px';
- document.body.appendChild(stats.domElement);
+ // const stats = Stats();
+ // stats.setMode(0);
+ // stats.domElement.style.position = 'absolute';
+ // stats.domElement.style.left = '0px';
+ // stats.domElement.style.top = '0px';
+ // document.body.appendChild(stats.domElement);
// Add controls to the gui
- const gui = new Object(function webpackMissingModule() { var e = new Error("Cannot find module 'dat-gui'"); e.code = 'MODULE_NOT_FOUND'; throw e; }())();
+ // const gui = new DAT.GUI();
// get canvas and webgl context
const canvas = document.getElementById('canvas');
const gl = canvas.getContext('webgl2');
@@ -8020,16 +8094,16 @@ function main() {
}
// `setGL` is a function imported above which sets the value of `gl` in the `globals.ts` module.
// Later, we can import `gl` from `globals.ts` to access it
- (0,_globals__WEBPACK_IMPORTED_MODULE_5__.setGL)(gl);
+ (0,_globals__WEBPACK_IMPORTED_MODULE_3__.setGL)(gl);
// Initial call to load scene
loadScene();
- const camera = new _Camera__WEBPACK_IMPORTED_MODULE_4__["default"](gl_matrix__WEBPACK_IMPORTED_MODULE_7__.fromValues(0, 0, -10), gl_matrix__WEBPACK_IMPORTED_MODULE_7__.fromValues(0, 0, 0));
- const renderer = new _rendering_gl_OpenGLRenderer__WEBPACK_IMPORTED_MODULE_3__["default"](canvas);
+ const camera = new _Camera__WEBPACK_IMPORTED_MODULE_2__["default"](gl_matrix__WEBPACK_IMPORTED_MODULE_5__.fromValues(0, 0, -10), gl_matrix__WEBPACK_IMPORTED_MODULE_5__.fromValues(0, 0, 0));
+ const renderer = new _rendering_gl_OpenGLRenderer__WEBPACK_IMPORTED_MODULE_1__["default"](canvas);
renderer.setClearColor(164.0 / 255.0, 233.0 / 255.0, 1.0, 1);
gl.enable(gl.DEPTH_TEST);
- const flat = new _rendering_gl_ShaderProgram__WEBPACK_IMPORTED_MODULE_6__["default"]([
- new _rendering_gl_ShaderProgram__WEBPACK_IMPORTED_MODULE_6__.Shader(gl.VERTEX_SHADER, __webpack_require__(/*! ./shaders/flat-vert.glsl */ "./src/shaders/flat-vert.glsl")),
- new _rendering_gl_ShaderProgram__WEBPACK_IMPORTED_MODULE_6__.Shader(gl.FRAGMENT_SHADER, __webpack_require__(/*! ./shaders/flat-frag.glsl */ "./src/shaders/flat-frag.glsl")),
+ const flat = new _rendering_gl_ShaderProgram__WEBPACK_IMPORTED_MODULE_4__["default"]([
+ new _rendering_gl_ShaderProgram__WEBPACK_IMPORTED_MODULE_4__.Shader(gl.VERTEX_SHADER, __webpack_require__(/*! ./shaders/flat-vert.glsl */ "./src/shaders/flat-vert.glsl")),
+ new _rendering_gl_ShaderProgram__WEBPACK_IMPORTED_MODULE_4__.Shader(gl.FRAGMENT_SHADER, __webpack_require__(/*! ./shaders/flat-frag.glsl */ "./src/shaders/flat-frag.glsl")),
]);
function processKeyPresses() {
// Use this if you wish
@@ -8037,28 +8111,31 @@ function main() {
// This function will be called every frame
function tick() {
camera.update();
- stats.begin();
- gl.viewport(0, 0, window.innerWidth, window.innerHeight);
+ gl.viewport(0, 0, canvas.width, canvas.height);
renderer.clear();
processKeyPresses();
renderer.render(camera, flat, [
square,
], time);
time++;
- stats.end();
// Tell the browser to call `tick` again whenever it renders a new frame
requestAnimationFrame(tick);
}
+ const resDiv = 2;
window.addEventListener('resize', function () {
- renderer.setSize(window.innerWidth, window.innerHeight);
- camera.setAspectRatio(window.innerWidth / window.innerHeight);
+ let width = window.innerWidth / resDiv;
+ let height = window.innerHeight / resDiv;
+ renderer.setSize(width, height);
+ camera.setAspectRatio(width / height);
camera.updateProjectionMatrix();
- flat.setDimensions(window.innerWidth, window.innerHeight);
+ flat.setDimensions(width, height);
}, false);
- renderer.setSize(window.innerWidth, window.innerHeight);
- camera.setAspectRatio(window.innerWidth / window.innerHeight);
+ let width = window.innerWidth / resDiv;
+ let height = window.innerHeight / resDiv;
+ renderer.setSize(width, height);
+ camera.setAspectRatio(width / height);
camera.updateProjectionMatrix();
- flat.setDimensions(window.innerWidth, window.innerHeight);
+ flat.setDimensions(width, height);
// Start the render loop
tick();
}
diff --git a/dist/bundle.js.map b/dist/bundle.js.map
index 79b9ef0..ebd47ce 100644
--- a/dist/bundle.js.map
+++ b/dist/bundle.js.map
@@ -1 +1 @@
-{"version":3,"file":"bundle.js","mappings":";;;;;;;;;;AAAY;AACZ;AACA;AACA;AACA,kBAAkB,mBAAO,CAAC,sDAAW;AACrC,kBAAkB,mBAAO,CAAC,+CAAS;AACnC,kBAAkB,mBAAO,CAAC,iEAAc;AACxC,kBAAkB,mBAAO,CAAC,wDAAa;AACvC,kBAAkB,mBAAO,CAAC,sEAAoB;AAC9C,kBAAkB,mBAAO,CAAC,sEAAoB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,MAAM;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG,gBAAgB,gBAAgB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA,GAAG,gBAAgB,gBAAgB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA,GAAG,gBAAgB,gBAAgB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;;;;;;;;;;;AC3OY;;AAEZ;;AAEA,sBAAsB,mBAAO,CAAC,4FAA6B;AAC3D,sBAAsB,mBAAO,CAAC,gFAAyB;AACvD,sBAAsB,mBAAO,CAAC,mFAA0B;;AAExD;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA;AACA;AACA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA;AACA;AACA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA;AACA;AACA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA;AACA;AACA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA;AACA;AACA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA;AACA;AACA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA;AACA;AACA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA;AACA;AACA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;;;;;;;;;;;AC1JY;;AAEZ;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,OAAO,YAAY,OAAO;AAC5C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO,YAAY,OAAO;AAC3C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO,YAAY,OAAO;AAC3C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,OAAO,YAAY,OAAO;AAC5C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB;AACnB,kBAAkB,YAAY,OAAO;AACrC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gCAAgC,+BAA+B;AAC/D,gCAAgC,+BAA+B;AAC/D,gCAAgC,+BAA+B;AAC/D,gCAAgC,+BAA+B;AAC/D,gCAAgC;AAChC;;;;;;;;;;;;ACnEY;;AAEZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,MAAM;AACjC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,MAAM;AACjC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,yBAAyB;;;;;;;;;;;ACtCb;;AAEZ;;AAEA,mBAAmB,mBAAO,CAAC,8DAAe;AAC1C,cAAc,mBAAO,CAAC,kFAAsB;;AAE5C;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe,kBAAkB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA,IAAI;AACJ;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,KAAK;AACxB;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,eAAe,KAAK;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,KAAK;AACxB;AACA;AACA,MAAM;AACN;AACA,mBAAmB,KAAK;AACxB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,8BAA8B,MAAM;AACpC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,KAAK;AACpB,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA;AACA,eAAe,KAAK;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,KAAK;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,KAAK;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,KAAK;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,KAAK;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;AClSA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AC3BA;;AAEA;AACA;AACA;AACA,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AC1BA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;;AC7BA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;;;AC9CA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;ACpDA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AC1BA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;;;ACtDA,eAAe,mBAAO,CAAC,sDAAY;;AAEnC;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;;;ACzFA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,eAAe,WAAW,WAAW;AACrC;AACA;AACA;AACA;;AAEA,eAAe,WAAW,YAAY;AACtC;AACA;AACA;AACA;;AAEA,gBAAgB,YAAY,YAAY;AACxC;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;ACzCA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,gBAAgB,YAAY,YAAY;AACxC,gBAAgB,YAAY,YAAY;AACxC,gBAAgB,YAAY,aAAa;;AAEzC;AACA,yBAAyB,yBAAyB;AAClD,6BAA6B,qBAAqB;AAClD,6BAA6B,yBAAyB;;AAEtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AC/DA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AC3CA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AC3CA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AC3CA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AC9BA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN,oBAAoB,YAAY,YAAY;AAC5C,oBAAoB,YAAY,YAAY;AAC5C,oBAAoB,YAAY,aAAa;;AAE7C,sBAAsB,cAAc,cAAc;AAClD,sBAAsB,cAAc,cAAc;AAClD,sBAAsB,cAAc,eAAe;;AAEnD;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;;;ACrCA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;AChDA;AACA;AACA;AACA;AACA;AACO;AACA;AACA;AACP;AACA;AACA;AACA,WAAW,4CAA4C;AACvD;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa,SAAS;AACtB;;AAEO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACjDwC;AACxC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,MAAM;AACnB;;AAEO;AACP,gBAAgB,kDAAmB;;AAEnC,MAAM,kDAAmB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP,gBAAgB,kDAAmB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP,gBAAgB,kDAAmB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;;AAEnC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;;AAEnC;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;;AAEnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY,+CAAgB;AAC5B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;;AAEf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;;AAEvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;;AAGJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;;AAGJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;;AAGJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;;AAEA,YAAY,+CAAgB;AAC5B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA,yBAAyB;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA,yBAAyB;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA,yBAAyB;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,eAAe;AAC1B,aAAa,MAAM;AACnB;;AAEO;AACP,wBAAwB,kDAAmB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD;;AAEzD;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,MAAM;AAClB,YAAY,cAAc;AAC1B,YAAY,MAAM;AAClB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,MAAM;AAClB,YAAY,cAAc;AAC1B,YAAY,MAAM;AAClB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,YAAY,MAAM;AAClB;;AAEO;AACP,oBAAoB,kDAAmB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB;AACA,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iCAAiC,+CAAgB,+BAA+B,+CAAgB,+BAA+B,+CAAgB;AAC/I;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,SAAS;AACtB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,SAAS;AACtB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,+CAAgB,qEAAqE,+CAAgB,qEAAqE,+CAAgB,qEAAqE,+CAAgB,qEAAqE,+CAAgB,qEAAqE,+CAAgB,qEAAqE,+CAAgB,qEAAqE,+CAAgB,qEAAqE,+CAAgB,qEAAqE,+CAAgB,uEAAuE,+CAAgB,yEAAyE,+CAAgB,yEAAyE,+CAAgB,yEAAyE,+CAAgB,yEAAyE,+CAAgB,yEAAyE,+CAAgB;AAC/zC;AACA;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA,cAAc;AACd;AACA;;AAEO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACrxDiC;AACxC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,MAAM;AACnB;;AAEO;AACP,gBAAgB,kDAAmB;;AAEnC,MAAM,kDAAmB;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP,gBAAgB,kDAAmB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP,gBAAgB,kDAAmB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA,UAAU,8CAAe;AACzB,UAAU,8CAAe;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;;AAEA;AACA;AACA,6BAA6B;;AAE7B;AACA;AACA,kCAAkC;;AAElC;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA,cAAc;;AAEd;AACA;AACA,sBAAsB;;AAEtB;AACA;AACA,sDAAsD;;AAEtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA,cAAc;;AAEd;AACA;AACA,sBAAsB;;AAEtB;AACA;AACA,sDAAsD;;AAEtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA,cAAc;;AAEd;AACA;AACA,sBAAsB;;AAEtB;AACA;AACA,eAAe;;AAEf;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,SAAS;AACtB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,SAAS;AACtB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,+CAAgB,qEAAqE,+CAAgB,qEAAqE,+CAAgB;AACxN;AACA;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,UAAU;AACrB,WAAW,QAAQ;AACnB,aAAa,OAAO;AACpB;AACA;;AAEO;AACP;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA;;AAEA,qBAAqB,OAAO;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AClxBuC;AACxC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,MAAM;AACnB;;AAEO;AACP,gBAAgB,kDAAmB;;AAEnC,MAAM,kDAAmB;AACzB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP,gBAAgB,kDAAmB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP,gBAAgB,kDAAmB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP,wBAAwB;AACxB;AACA;;AAEA;AACA;;AAEA;AACA,SAAS,8CAAe;AACxB,SAAS,8CAAe;AACxB;AACA,IAAI;;AAEJ;AACA,SAAS,8CAAe;AACxB,SAAS,8CAAe;AACxB;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;AACA,sCAAsC;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,SAAS;AACtB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,SAAS;AACtB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,+CAAgB,qEAAqE,+CAAgB,qEAAqE,+CAAgB,qEAAqE,+CAAgB;AAC7S;AACA;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,UAAU;AACrB,WAAW,QAAQ;AACnB,aAAa,OAAO;AACpB;AACA;;AAEO;AACP;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA;;AAEA,qBAAqB,OAAO;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;;;;;;;;;ACtpBD;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;AClDA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;;;;;;;;AClBA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;;;;;;;;;;ACXA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;ACbA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;ACnBA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACtBY;AACZ;AACA,gBAAgB,mBAAO,CAAC,uDAAY;AACpC;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACvBA;;;;;;;;;;ACAA;AACA;AACA,sBAAsB;AACtB,sBAAsB;AACtB,sBAAsB;AACtB,sBAAsB;AACtB,sBAAsB;AACtB,sBAAsB;AACtB;;;AAGA;AACA;AACA;AACA;AACA;;AAEA,gBAAgB,mBAAO,CAAC,+DAAa;;AAErC,aAAa,mBAAO,CAAC,wDAAgB;AACrC,YAAY,mBAAO,CAAC,sDAAe;AACnC,kBAAkB,mBAAO,CAAC,kEAAqB;AAC/C,aAAa,mBAAO,CAAC,wDAAgB;AACrC,gBAAgB,mBAAO,CAAC,8DAAmB;AAC3C;AACA,YAAY,mBAAO,CAAC,wDAAgB;AACpC,eAAe,mBAAO,CAAC,8DAAmB;AAC1C,SAAS,mBAAO,CAAC,kDAAa;AAC9B,WAAW,mBAAO,CAAC,sDAAe;AAClC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;;;;;;;;AClLA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,MAAM;AACxB;AACA;AACA;;;;;;;;;;ACTA,WAAW,mBAAO,CAAC,oDAAc;;AAEjC,gBAAgB,mBAAO,CAAC,8DAAgB;AACxC,gBAAgB,mBAAO,CAAC,8DAAgB;AACxC,kBAAkB,mBAAO,CAAC,kEAAqB;AAC/C,YAAY,mBAAO,CAAC,sDAAY;;AAEhC;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;;ACnDA;AACA,sBAAsB;AACtB,sBAAsB;AACtB,sBAAsB;AACtB,sBAAsB;AACtB,sBAAsB;AACtB,sBAAsB;;AAEtB;AACA;;AAEA;AACA,cAAc,mBAAO,CAAC,4DAAkB;AACxC,eAAe,mBAAO,CAAC,8DAAmB;AAC1C,cAAc,mBAAO,CAAC,4DAAkB;AACxC,YAAY,mBAAO,CAAC,wDAAgB;AACpC,WAAW,mBAAO,CAAC,sDAAe;AAClC,6BAA6B,mBAAO,CAAC,0FAAiC;AACtE;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;;;;;;;;;AC3DY;;AAEZ,gBAAgB,mBAAO,CAAC,kFAAsB;AAC9C,gBAAgB,mBAAO,CAAC,kEAAkB;AAC1C,gBAAgB,mBAAO,CAAC,wDAAgB;AACxC,gBAAgB,mBAAO,CAAC,0DAAiB;AACzC,gBAAgB,mBAAO,CAAC,0DAAiB;AACzC,gBAAgB,mBAAO,CAAC,0DAAiB;AACzC,gBAAgB,mBAAO,CAAC,wDAAgB;AACxC,gBAAgB,mBAAO,CAAC,8DAAmB;AAC3C,gBAAgB,mBAAO,CAAC,sDAAe;AACvC,gBAAgB,mBAAO,CAAC,8DAAmB;;AAE3C;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,MAAM;AACvB;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,iBAAiB,MAAM;AACvB;AACA;AACA;AACA,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA,mBAAmB,MAAM;AACzB;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,KAAK;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,KAAK;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACrMY;;AAEZ;;AAEA,YAAY,mBAAO,CAAC,wDAAa;;AAEjC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,iBAAiB;AAC1C;AACA;AACA;AACA,UAAU;AACV;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;AACA,yBAAyB,oBAAoB;AAC7C;AACA,KAAK;AACL;AACA,yBAAyB,UAAU;AACnC;AACA,KAAK;AACL;AACA,yBAAyB,UAAU;AACnC;AACA,KAAK;AACL;AACA,yBAAyB,aAAa;AACtC;AACA;AACA,GAAG;;AAEH;AACA;;;;;;;;;;;AC5MA,qBAAqB;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;;;;;;;;;;;ACxBY;;AAEZ;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;;AAEf;AACA;AACA;AACA,eAAe;;AAEf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;;;;;;;;;;;AC3DG;;AAEZ,WAAW,mBAAO,CAAC,8CAAO;;AAE1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACvCY;;AAEZ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACxCY;;AAEZ;;AAEA,oBAAoB,mBAAO,CAAC,+DAAiB;AAC7C,oBAAoB,mBAAO,CAAC,wDAAgB;AAC5C,oBAAoB,mBAAO,CAAC,4DAAkB;AAC9C,oBAAoB,mBAAO,CAAC,wDAAgB;AAC5C,oBAAoB,mBAAO,CAAC,wFAAqB;;AAEjD;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,eAAe,KAAK;AACpB;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAe,KAAK;AACpB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;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CA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,KAAK;AACpB;AACA;AACA;AACA;AACA;AACA,eAAe,KAAK;AACpB;AACA;AACA;AACA;AACA;AACA,eAAe,KAAK;AACpB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,eAAe,KAAK;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,eAAe,KAAK;AACpB;AACA;;AAEA,eAAe,KAAK;AACpB;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AC3jBA,2DAA2D,wCAAwC,8BAA8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","sources":["webpack:///./node_modules/3d-view-controls/camera.js","webpack:///./node_modules/3d-view/view.js","webpack:///./node_modules/binary-search-bounds/search-bounds.js","webpack:///./node_modules/cubic-hermite/hermite.js","webpack:///./node_modules/filtered-vector/fvec.js","webpack:///./node_modules/gl-mat4/clone.js","webpack:///./node_modules/gl-mat4/create.js","webpack:///./node_modules/gl-mat4/determinant.js","webpack:///./node_modules/gl-mat4/fromQuat.js","webpack:///./node_modules/gl-mat4/fromRotationTranslation.js","webpack:///./node_modules/gl-mat4/identity.js","webpack:///./node_modules/gl-mat4/invert.js","webpack:///./node_modules/gl-mat4/lookAt.js","webpack:///./node_modules/gl-mat4/multiply.js","webpack:///./node_modules/gl-mat4/rotate.js","webpack:///./node_modules/gl-mat4/rotateX.js","webpack:///./node_modules/gl-mat4/rotateY.js","webpack:///./node_modules/gl-mat4/rotateZ.js","webpack:///./node_modules/gl-mat4/scale.js","webpack:///./node_modules/gl-mat4/translate.js","webpack:///./node_modules/gl-mat4/transpose.js","webpack:///./node_modules/gl-matrix/esm/common.js","webpack:///./node_modules/gl-matrix/esm/mat4.js","webpack:///./node_modules/gl-matrix/esm/vec3.js","webpack:///./node_modules/gl-matrix/esm/vec4.js","webpack:///./node_modules/gl-quat/slerp.js","webpack:///./node_modules/gl-vec3/cross.js","webpack:///./node_modules/gl-vec3/dot.js","webpack:///./node_modules/gl-vec3/length.js","webpack:///./node_modules/gl-vec3/lerp.js","webpack:///./node_modules/gl-vec3/normalize.js","webpack:///./node_modules/has-passive-events/index.js","webpack:///./node_modules/is-browser/client.js","webpack:///./node_modules/mat4-decompose/index.js","webpack:///./node_modules/mat4-decompose/normalize.js","webpack:///./node_modules/mat4-interpolate/index.js","webpack:///./node_modules/mat4-recompose/index.js","webpack:///./node_modules/matrix-camera-controller/matrix.js","webpack:///./node_modules/mouse-change/mouse-listen.js","webpack:///./node_modules/mouse-event-offset/index.js","webpack:///./node_modules/mouse-event/mouse.js","webpack:///./node_modules/mouse-wheel/wheel.js","webpack:///./node_modules/orbit-camera-controller/lib/quatFromFrame.js","webpack:///./node_modules/orbit-camera-controller/orbit.js","webpack:///./node_modules/parse-unit/index.js","webpack:///./node_modules/quat-slerp/index.js","webpack:///./node_modules/right-now/browser.js","webpack:///./node_modules/stats-js/build/stats.min.js","webpack:///./node_modules/to-px/browser.js","webpack:///./src/Camera.ts","webpack:///./src/geometry/Square.ts","webpack:///./src/globals.ts","webpack:///./src/rendering/gl/Drawable.ts","webpack:///./src/rendering/gl/OpenGLRenderer.ts","webpack:///./src/rendering/gl/ShaderProgram.ts","webpack:///./node_modules/turntable-camera-controller/turntable.js","webpack:///./src/shaders/flat-frag.glsl","webpack:///./src/shaders/flat-vert.glsl","webpack:///webpack/bootstrap","webpack:///webpack/runtime/compat get default export","webpack:///webpack/runtime/define property getters","webpack:///webpack/runtime/global","webpack:///webpack/runtime/hasOwnProperty shorthand","webpack:///webpack/runtime/make namespace object","webpack:///./src/main.ts"],"sourcesContent":["'use strict'\r\n\r\nmodule.exports = createCamera\r\n\r\nvar now = require('right-now')\r\nvar createView = require('3d-view')\r\nvar mouseChange = require('mouse-change')\r\nvar mouseWheel = require('mouse-wheel')\r\nvar mouseOffset = require('mouse-event-offset')\r\nvar hasPassive = require('has-passive-events')\r\n\r\nfunction createCamera(element, options) {\r\n element = element || document.body\r\n options = options || {}\r\n\r\n var limits = [ 0.01, Infinity ]\r\n if('distanceLimits' in options) {\r\n limits[0] = options.distanceLimits[0]\r\n limits[1] = options.distanceLimits[1]\r\n }\r\n if('zoomMin' in options) {\r\n limits[0] = options.zoomMin\r\n }\r\n if('zoomMax' in options) {\r\n limits[1] = options.zoomMax\r\n }\r\n\r\n var view = createView({\r\n center: options.center || [0,0,0],\r\n up: options.up || [0,1,0],\r\n eye: options.eye || [0,0,10],\r\n mode: options.mode || 'orbit',\r\n distanceLimits: limits\r\n })\r\n\r\n var pmatrix = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]\r\n var distance = 0.0\r\n var width = element.clientWidth\r\n var height = element.clientHeight\r\n\r\n var camera = {\r\n view: view,\r\n element: element,\r\n delay: options.delay || 16,\r\n rotateSpeed: options.rotateSpeed || 1,\r\n zoomSpeed: options.zoomSpeed || 1,\r\n translateSpeed: options.translateSpeed || 1,\r\n flipX: !!options.flipX,\r\n flipY: !!options.flipY,\r\n modes: view.modes,\r\n tick: function() {\r\n var t = now()\r\n var delay = this.delay\r\n view.idle(t-delay)\r\n view.flush(t-(100+delay*2))\r\n var ctime = t - 2 * delay\r\n view.recalcMatrix(ctime)\r\n var allEqual = true\r\n var matrix = view.computedMatrix\r\n for(var i=0; i<16; ++i) {\r\n allEqual = allEqual && (pmatrix[i] === matrix[i])\r\n pmatrix[i] = matrix[i]\r\n }\r\n var sizeChanged =\r\n element.clientWidth === width &&\r\n element.clientHeight === height\r\n width = element.clientWidth\r\n height = element.clientHeight\r\n if(allEqual) {\r\n return !sizeChanged\r\n }\r\n distance = Math.exp(view.computedRadius[0])\r\n return true\r\n },\r\n lookAt: function(center, eye, up) {\r\n view.lookAt(view.lastT(), center, eye, up)\r\n },\r\n rotate: function(pitch, yaw, roll) {\r\n view.rotate(view.lastT(), pitch, yaw, roll)\r\n },\r\n pan: function(dx, dy, dz) {\r\n view.pan(view.lastT(), dx, dy, dz)\r\n },\r\n translate: function(dx, dy, dz) {\r\n view.translate(view.lastT(), dx, dy, dz)\r\n }\r\n }\r\n\r\n Object.defineProperties(camera, {\r\n matrix: {\r\n get: function() {\r\n return view.computedMatrix\r\n },\r\n set: function(mat) {\r\n view.setMatrix(view.lastT(), mat)\r\n return view.computedMatrix\r\n },\r\n enumerable: true\r\n },\r\n mode: {\r\n get: function() {\r\n return view.getMode()\r\n },\r\n set: function(mode) {\r\n view.setMode(mode)\r\n return view.getMode()\r\n },\r\n enumerable: true\r\n },\r\n center: {\r\n get: function() {\r\n return view.computedCenter\r\n },\r\n set: function(ncenter) {\r\n view.lookAt(view.lastT(), ncenter)\r\n return view.computedCenter\r\n },\r\n enumerable: true\r\n },\r\n eye: {\r\n get: function() {\r\n return view.computedEye\r\n },\r\n set: function(neye) {\r\n view.lookAt(view.lastT(), null, neye)\r\n return view.computedEye\r\n },\r\n enumerable: true\r\n },\r\n up: {\r\n get: function() {\r\n return view.computedUp\r\n },\r\n set: function(nup) {\r\n view.lookAt(view.lastT(), null, null, nup)\r\n return view.computedUp\r\n },\r\n enumerable: true\r\n },\r\n distance: {\r\n get: function() {\r\n return distance\r\n },\r\n set: function(d) {\r\n view.setDistance(view.lastT(), d)\r\n return d\r\n },\r\n enumerable: true\r\n },\r\n distanceLimits: {\r\n get: function() {\r\n return view.getDistanceLimits(limits)\r\n },\r\n set: function(v) {\r\n view.setDistanceLimits(v)\r\n return v\r\n },\r\n enumerable: true\r\n }\r\n })\r\n\r\n element.addEventListener('contextmenu', function(ev) {\r\n ev.preventDefault()\r\n return false\r\n })\r\n\r\n var lastX = 0, lastY = 0, lastMods = {shift: false, control: false, alt: false, meta: false}\r\n mouseChange(element, handleInteraction)\r\n\r\n //enable simple touch interactions\r\n element.addEventListener('touchstart', function (ev) {\r\n var xy = mouseOffset(ev.changedTouches[0], element)\r\n handleInteraction(0, xy[0], xy[1], lastMods)\r\n handleInteraction(1, xy[0], xy[1], lastMods)\r\n\r\n ev.preventDefault()\r\n }, hasPassive ? {passive: false} : false)\r\n\r\n element.addEventListener('touchmove', function (ev) {\r\n var xy = mouseOffset(ev.changedTouches[0], element)\r\n handleInteraction(1, xy[0], xy[1], lastMods)\r\n\r\n ev.preventDefault()\r\n }, hasPassive ? {passive: false} : false)\r\n\r\n element.addEventListener('touchend', function (ev) {\r\n var xy = mouseOffset(ev.changedTouches[0], element)\r\n handleInteraction(0, lastX, lastY, lastMods)\r\n\r\n ev.preventDefault()\r\n }, hasPassive ? {passive: false} : false)\r\n\r\n function handleInteraction (buttons, x, y, mods) {\r\n var scale = 1.0 / element.clientHeight\r\n var dx = scale * (x - lastX)\r\n var dy = scale * (y - lastY)\r\n\r\n var flipX = camera.flipX ? 1 : -1\r\n var flipY = camera.flipY ? 1 : -1\r\n\r\n var drot = Math.PI * camera.rotateSpeed\r\n\r\n var t = now()\r\n\r\n if(buttons & 1) {\r\n if(mods.shift) {\r\n view.rotate(t, 0, 0, -dx * drot)\r\n } else {\r\n view.rotate(t, flipX * drot * dx, -flipY * drot * dy, 0)\r\n }\r\n } else if(buttons & 2) {\r\n view.pan(t, -camera.translateSpeed * dx * distance, camera.translateSpeed * dy * distance, 0)\r\n } else if(buttons & 4) {\r\n var kzoom = camera.zoomSpeed * dy / window.innerHeight * (t - view.lastT()) * 50.0\r\n view.pan(t, 0, 0, distance * (Math.exp(kzoom) - 1))\r\n }\r\n\r\n lastX = x\r\n lastY = y\r\n lastMods = mods\r\n }\r\n\r\n mouseWheel(element, function(dx, dy, dz) {\r\n var flipX = camera.flipX ? 1 : -1\r\n var flipY = camera.flipY ? 1 : -1\r\n var t = now()\r\n if(Math.abs(dx) > Math.abs(dy)) {\r\n view.rotate(t, 0, 0, -dx * flipX * Math.PI * camera.rotateSpeed / window.innerWidth)\r\n } else {\r\n var kzoom = camera.zoomSpeed * flipY * dy / window.innerHeight * (t - view.lastT()) / 100.0\r\n view.pan(t, 0, 0, distance * (Math.exp(kzoom) - 1))\r\n }\r\n }, true)\r\n\r\n return camera\r\n}\r\n","'use strict'\n\nmodule.exports = createViewController\n\nvar createTurntable = require('turntable-camera-controller')\nvar createOrbit = require('orbit-camera-controller')\nvar createMatrix = require('matrix-camera-controller')\n\nfunction ViewController(controllers, mode) {\n this._controllerNames = Object.keys(controllers)\n this._controllerList = this._controllerNames.map(function(n) {\n return controllers[n]\n })\n this._mode = mode\n this._active = controllers[mode]\n if(!this._active) {\n this._mode = 'turntable'\n this._active = controllers.turntable\n }\n this.modes = this._controllerNames\n this.computedMatrix = this._active.computedMatrix\n this.computedEye = this._active.computedEye\n this.computedUp = this._active.computedUp\n this.computedCenter = this._active.computedCenter\n this.computedRadius = this._active.computedRadius\n}\n\nvar proto = ViewController.prototype\n\nproto.flush = function(a0) {\n var cc = this._controllerList\n for (var i = 0; i < cc.length; ++i) {\n cc[i].flush(a0)\n }\n}\nproto.idle = function(a0) {\n var cc = this._controllerList\n for (var i = 0; i < cc.length; ++i) {\n cc[i].idle(a0)\n }\n}\nproto.lookAt = function(a0, a1, a2, a3) {\n var cc = this._controllerList\n for (var i = 0; i < cc.length; ++i) {\n cc[i].lookAt(a0, a1, a2, a3)\n }\n}\nproto.rotate = function(a0, a1, a2, a3) {\n var cc = this._controllerList\n for (var i = 0; i < cc.length; ++i) {\n cc[i].rotate(a0, a1, a2, a3)\n }\n}\nproto.pan = function(a0, a1, a2, a3) {\n var cc = this._controllerList\n for (var i = 0; i < cc.length; ++i) {\n cc[i].pan(a0, a1, a2, a3)\n }\n}\nproto.translate = function(a0, a1, a2, a3) {\n var cc = this._controllerList\n for (var i = 0; i < cc.length; ++i) {\n cc[i].translate(a0, a1, a2, a3)\n }\n}\nproto.setMatrix = function(a0, a1) {\n var cc = this._controllerList\n for (var i = 0; i < cc.length; ++i) {\n cc[i].setMatrix(a0, a1)\n }\n}\nproto.setDistanceLimits = function(a0, a1) {\n var cc = this._controllerList\n for (var i = 0; i < cc.length; ++i) {\n cc[i].setDistanceLimits(a0, a1)\n }\n}\nproto.setDistance = function(a0, a1) {\n var cc = this._controllerList\n for (var i = 0; i < cc.length; ++i) {\n cc[i].setDistance(a0, a1)\n }\n}\n\nproto.recalcMatrix = function(t) {\n this._active.recalcMatrix(t)\n}\n\nproto.getDistance = function(t) {\n return this._active.getDistance(t)\n}\nproto.getDistanceLimits = function(out) {\n return this._active.getDistanceLimits(out)\n}\n\nproto.lastT = function() {\n return this._active.lastT()\n}\n\nproto.setMode = function(mode) {\n if(mode === this._mode) {\n return\n }\n var idx = this._controllerNames.indexOf(mode)\n if(idx < 0) {\n return\n }\n var prev = this._active\n var next = this._controllerList[idx]\n var lastT = Math.max(prev.lastT(), next.lastT())\n\n prev.recalcMatrix(lastT)\n next.setMatrix(lastT, prev.computedMatrix)\n\n this._active = next\n this._mode = mode\n\n //Update matrix properties\n this.computedMatrix = this._active.computedMatrix\n this.computedEye = this._active.computedEye\n this.computedUp = this._active.computedUp\n this.computedCenter = this._active.computedCenter\n this.computedRadius = this._active.computedRadius\n}\n\nproto.getMode = function() {\n return this._mode\n}\n\nfunction createViewController(options) {\n options = options || {}\n\n var eye = options.eye || [0,0,1]\n var center = options.center || [0,0,0]\n var up = options.up || [0,1,0]\n var limits = options.distanceLimits || [0, Infinity]\n var mode = options.mode || 'turntable'\n\n var turntable = createTurntable()\n var orbit = createOrbit()\n var matrix = createMatrix()\n\n turntable.setDistanceLimits(limits[0], limits[1])\n turntable.lookAt(0, eye, center, up)\n orbit.setDistanceLimits(limits[0], limits[1])\n orbit.lookAt(0, eye, center, up)\n matrix.setDistanceLimits(limits[0], limits[1])\n matrix.lookAt(0, eye, center, up)\n\n return new ViewController({\n turntable: turntable,\n orbit: orbit,\n matrix: matrix\n }, mode)\n}","\"use strict\"\n\n// (a, y, c, l, h) = (array, y[, cmp, lo, hi])\n\nfunction ge(a, y, c, l, h) {\n var i = h + 1;\n while (l <= h) {\n var m = (l + h) >>> 1, x = a[m];\n var p = (c !== undefined) ? c(x, y) : (x - y);\n if (p >= 0) { i = m; h = m - 1 } else { l = m + 1 }\n }\n return i;\n};\n\nfunction gt(a, y, c, l, h) {\n var i = h + 1;\n while (l <= h) {\n var m = (l + h) >>> 1, x = a[m];\n var p = (c !== undefined) ? c(x, y) : (x - y);\n if (p > 0) { i = m; h = m - 1 } else { l = m + 1 }\n }\n return i;\n};\n\nfunction lt(a, y, c, l, h) {\n var i = l - 1;\n while (l <= h) {\n var m = (l + h) >>> 1, x = a[m];\n var p = (c !== undefined) ? c(x, y) : (x - y);\n if (p < 0) { i = m; l = m + 1 } else { h = m - 1 }\n }\n return i;\n};\n\nfunction le(a, y, c, l, h) {\n var i = l - 1;\n while (l <= h) {\n var m = (l + h) >>> 1, x = a[m];\n var p = (c !== undefined) ? c(x, y) : (x - y);\n if (p <= 0) { i = m; l = m + 1 } else { h = m - 1 }\n }\n return i;\n};\n\nfunction eq(a, y, c, l, h) {\n while (l <= h) {\n var m = (l + h) >>> 1, x = a[m];\n var p = (c !== undefined) ? c(x, y) : (x - y);\n if (p === 0) { return m }\n if (p <= 0) { l = m + 1 } else { h = m - 1 }\n }\n return -1;\n};\n\nfunction norm(a, y, c, l, h, f) {\n if (typeof c === 'function') {\n return f(a, y, c, (l === undefined) ? 0 : l | 0, (h === undefined) ? a.length - 1 : h | 0);\n }\n return f(a, y, undefined, (c === undefined) ? 0 : c | 0, (l === undefined) ? a.length - 1 : l | 0);\n}\n\nmodule.exports = {\n ge: function(a, y, c, l, h) { return norm(a, y, c, l, h, ge)},\n gt: function(a, y, c, l, h) { return norm(a, y, c, l, h, gt)},\n lt: function(a, y, c, l, h) { return norm(a, y, c, l, h, lt)},\n le: function(a, y, c, l, h) { return norm(a, y, c, l, h, le)},\n eq: function(a, y, c, l, h) { return norm(a, y, c, l, h, eq)}\n}\n","\"use strict\"\n\nfunction dcubicHermite(p0, v0, p1, v1, t, f) {\n var dh00 = 6*t*t-6*t,\n dh10 = 3*t*t-4*t + 1,\n dh01 = -6*t*t+6*t,\n dh11 = 3*t*t-2*t\n if(p0.length) {\n if(!f) {\n f = new Array(p0.length)\n }\n for(var i=p0.length-1; i>=0; --i) {\n f[i] = dh00*p0[i] + dh10*v0[i] + dh01*p1[i] + dh11*v1[i]\n }\n return f\n }\n return dh00*p0 + dh10*v0 + dh01*p1[i] + dh11*v1\n}\n\nfunction cubicHermite(p0, v0, p1, v1, t, f) {\n var ti = (t-1), t2 = t*t, ti2 = ti*ti,\n h00 = (1+2*t)*ti2,\n h10 = t*ti2,\n h01 = t2*(3-2*t),\n h11 = t2*ti\n if(p0.length) {\n if(!f) {\n f = new Array(p0.length)\n }\n for(var i=p0.length-1; i>=0; --i) {\n f[i] = h00*p0[i] + h10*v0[i] + h01*p1[i] + h11*v1[i]\n }\n return f\n }\n return h00*p0 + h10*v0 + h01*p1 + h11*v1\n}\n\nmodule.exports = cubicHermite\nmodule.exports.derivative = dcubicHermite","'use strict'\n\nmodule.exports = createFilteredVector\n\nvar cubicHermite = require('cubic-hermite')\nvar bsearch = require('binary-search-bounds')\n\nfunction clamp(lo, hi, x) {\n return Math.min(hi, Math.max(lo, x))\n}\n\nfunction FilteredVector(state0, velocity0, t0) {\n this.dimension = state0.length\n this.bounds = [ new Array(this.dimension), new Array(this.dimension) ]\n for(var i=0; i= n-1) {\n var ptr = state.length-1\n var tf = t - time[n-1]\n for(var i=0; i= n-1) {\n var ptr = state.length-1\n var tf = t - time[n-1]\n for(var i=0; i=0; --i) {\n if(velocity[--ptr]) {\n return false\n }\n }\n return true\n}\n\nproto.jump = function(t) {\n var t0 = this.lastT()\n var d = this.dimension\n if(t < t0 || arguments.length !== d+1) {\n return\n }\n var state = this._state\n var velocity = this._velocity\n var ptr = state.length-this.dimension\n var bounds = this.bounds\n var lo = bounds[0]\n var hi = bounds[1]\n this._time.push(t0, t)\n for(var j=0; j<2; ++j) {\n for(var i=0; i0; --i) {\n state.push(clamp(lo[i-1], hi[i-1], arguments[i]))\n velocity.push(0)\n }\n}\n\nproto.push = function(t) {\n var t0 = this.lastT()\n var d = this.dimension\n if(t < t0 || arguments.length !== d+1) {\n return\n }\n var state = this._state\n var velocity = this._velocity\n var ptr = state.length-this.dimension\n var dt = t - t0\n var bounds = this.bounds\n var lo = bounds[0]\n var hi = bounds[1]\n var sf = (dt > 1e-6) ? 1/dt : 0\n this._time.push(t)\n for(var i=d; i>0; --i) {\n var xc = clamp(lo[i-1], hi[i-1], arguments[i])\n state.push(xc)\n velocity.push((xc - state[ptr++]) * sf)\n }\n}\n\nproto.set = function(t) {\n var d = this.dimension\n if(t < this.lastT() || arguments.length !== d+1) {\n return\n }\n var state = this._state\n var velocity = this._velocity\n var bounds = this.bounds\n var lo = bounds[0]\n var hi = bounds[1]\n this._time.push(t)\n for(var i=d; i>0; --i) {\n state.push(clamp(lo[i-1], hi[i-1], arguments[i]))\n velocity.push(0)\n }\n}\n\nproto.move = function(t) {\n var t0 = this.lastT()\n var d = this.dimension\n if(t <= t0 || arguments.length !== d+1) {\n return\n }\n var state = this._state\n var velocity = this._velocity\n var statePtr = state.length - this.dimension\n var bounds = this.bounds\n var lo = bounds[0]\n var hi = bounds[1]\n var dt = t - t0\n var sf = (dt > 1e-6) ? 1/dt : 0.0\n this._time.push(t)\n for(var i=d; i>0; --i) {\n var dx = arguments[i]\n state.push(clamp(lo[i-1], hi[i-1], state[statePtr++] + dx))\n velocity.push(dx * sf)\n }\n}\n\nproto.idle = function(t) {\n var t0 = this.lastT()\n if(t < t0) {\n return\n }\n var d = this.dimension\n var state = this._state\n var velocity = this._velocity\n var statePtr = state.length-d\n var bounds = this.bounds\n var lo = bounds[0]\n var hi = bounds[1]\n var dt = t - t0\n this._time.push(t)\n for(var i=d-1; i>=0; --i) {\n state.push(clamp(lo[i], hi[i], state[statePtr] + dt * velocity[statePtr]))\n velocity.push(0)\n statePtr += 1\n }\n}\n\nfunction getZero(d) {\n var result = new Array(d)\n for(var i=0; iFormat: column-major, when typed out it looks like row-major
The matrices are being post multiplied.\r\n * @module mat4\r\n */\n\n/**\r\n * Creates a new identity mat4\r\n *\r\n * @returns {mat4} a new 4x4 matrix\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(16);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n }\n\n out[0] = 1;\n out[5] = 1;\n out[10] = 1;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a new mat4 initialized with values from an existing matrix\r\n *\r\n * @param {ReadonlyMat4} a matrix to clone\r\n * @returns {mat4} a new 4x4 matrix\r\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(16);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\r\n * Copy the values from one mat4 to another\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {ReadonlyMat4} a the source matrix\r\n * @returns {mat4} out\r\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\r\n * Create a new mat4 with the given values\r\n *\r\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\r\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\r\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\r\n * @param {Number} m03 Component in column 0, row 3 position (index 3)\r\n * @param {Number} m10 Component in column 1, row 0 position (index 4)\r\n * @param {Number} m11 Component in column 1, row 1 position (index 5)\r\n * @param {Number} m12 Component in column 1, row 2 position (index 6)\r\n * @param {Number} m13 Component in column 1, row 3 position (index 7)\r\n * @param {Number} m20 Component in column 2, row 0 position (index 8)\r\n * @param {Number} m21 Component in column 2, row 1 position (index 9)\r\n * @param {Number} m22 Component in column 2, row 2 position (index 10)\r\n * @param {Number} m23 Component in column 2, row 3 position (index 11)\r\n * @param {Number} m30 Component in column 3, row 0 position (index 12)\r\n * @param {Number} m31 Component in column 3, row 1 position (index 13)\r\n * @param {Number} m32 Component in column 3, row 2 position (index 14)\r\n * @param {Number} m33 Component in column 3, row 3 position (index 15)\r\n * @returns {mat4} A new mat4\r\n */\n\nexport function fromValues(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {\n var out = new glMatrix.ARRAY_TYPE(16);\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m03;\n out[4] = m10;\n out[5] = m11;\n out[6] = m12;\n out[7] = m13;\n out[8] = m20;\n out[9] = m21;\n out[10] = m22;\n out[11] = m23;\n out[12] = m30;\n out[13] = m31;\n out[14] = m32;\n out[15] = m33;\n return out;\n}\n/**\r\n * Set the components of a mat4 to the given values\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\r\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\r\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\r\n * @param {Number} m03 Component in column 0, row 3 position (index 3)\r\n * @param {Number} m10 Component in column 1, row 0 position (index 4)\r\n * @param {Number} m11 Component in column 1, row 1 position (index 5)\r\n * @param {Number} m12 Component in column 1, row 2 position (index 6)\r\n * @param {Number} m13 Component in column 1, row 3 position (index 7)\r\n * @param {Number} m20 Component in column 2, row 0 position (index 8)\r\n * @param {Number} m21 Component in column 2, row 1 position (index 9)\r\n * @param {Number} m22 Component in column 2, row 2 position (index 10)\r\n * @param {Number} m23 Component in column 2, row 3 position (index 11)\r\n * @param {Number} m30 Component in column 3, row 0 position (index 12)\r\n * @param {Number} m31 Component in column 3, row 1 position (index 13)\r\n * @param {Number} m32 Component in column 3, row 2 position (index 14)\r\n * @param {Number} m33 Component in column 3, row 3 position (index 15)\r\n * @returns {mat4} out\r\n */\n\nexport function set(out, m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m03;\n out[4] = m10;\n out[5] = m11;\n out[6] = m12;\n out[7] = m13;\n out[8] = m20;\n out[9] = m21;\n out[10] = m22;\n out[11] = m23;\n out[12] = m30;\n out[13] = m31;\n out[14] = m32;\n out[15] = m33;\n return out;\n}\n/**\r\n * Set a mat4 to the identity matrix\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @returns {mat4} out\r\n */\n\nexport function identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Transpose the values of a mat4\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {ReadonlyMat4} a the source matrix\r\n * @returns {mat4} out\r\n */\n\nexport function transpose(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a12 = a[6],\n a13 = a[7];\n var a23 = a[11];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a01;\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a02;\n out[9] = a12;\n out[11] = a[14];\n out[12] = a03;\n out[13] = a13;\n out[14] = a23;\n } else {\n out[0] = a[0];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a[1];\n out[5] = a[5];\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a[2];\n out[9] = a[6];\n out[10] = a[10];\n out[11] = a[14];\n out[12] = a[3];\n out[13] = a[7];\n out[14] = a[11];\n out[15] = a[15];\n }\n\n return out;\n}\n/**\r\n * Inverts a mat4\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {ReadonlyMat4} a the source matrix\r\n * @returns {mat4} out\r\n */\n\nexport function invert(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n var b00 = a00 * a11 - a01 * a10;\n var b01 = a00 * a12 - a02 * a10;\n var b02 = a00 * a13 - a03 * a10;\n var b03 = a01 * a12 - a02 * a11;\n var b04 = a01 * a13 - a03 * a11;\n var b05 = a02 * a13 - a03 * a12;\n var b06 = a20 * a31 - a21 * a30;\n var b07 = a20 * a32 - a22 * a30;\n var b08 = a20 * a33 - a23 * a30;\n var b09 = a21 * a32 - a22 * a31;\n var b10 = a21 * a33 - a23 * a31;\n var b11 = a22 * a33 - a23 * a32; // Calculate the determinant\n\n var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) {\n return null;\n }\n\n det = 1.0 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n return out;\n}\n/**\r\n * Calculates the adjugate of a mat4\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {ReadonlyMat4} a the source matrix\r\n * @returns {mat4} out\r\n */\n\nexport function adjoint(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n out[0] = a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22);\n out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22));\n out[2] = a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12);\n out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12));\n out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22));\n out[5] = a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22);\n out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12));\n out[7] = a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12);\n out[8] = a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21);\n out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21));\n out[10] = a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11);\n out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11));\n out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21));\n out[13] = a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21);\n out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11));\n out[15] = a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11);\n return out;\n}\n/**\r\n * Calculates the determinant of a mat4\r\n *\r\n * @param {ReadonlyMat4} a the source matrix\r\n * @returns {Number} determinant of a\r\n */\n\nexport function determinant(a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n var b00 = a00 * a11 - a01 * a10;\n var b01 = a00 * a12 - a02 * a10;\n var b02 = a00 * a13 - a03 * a10;\n var b03 = a01 * a12 - a02 * a11;\n var b04 = a01 * a13 - a03 * a11;\n var b05 = a02 * a13 - a03 * a12;\n var b06 = a20 * a31 - a21 * a30;\n var b07 = a20 * a32 - a22 * a30;\n var b08 = a20 * a33 - a23 * a30;\n var b09 = a21 * a32 - a22 * a31;\n var b10 = a21 * a33 - a23 * a31;\n var b11 = a22 * a33 - a23 * a32; // Calculate the determinant\n\n return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n}\n/**\r\n * Multiplies two mat4s\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {ReadonlyMat4} a the first operand\r\n * @param {ReadonlyMat4} b the second operand\r\n * @returns {mat4} out\r\n */\n\nexport function multiply(out, a, b) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15]; // Cache only the current line of the second matrix\n\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[4];\n b1 = b[5];\n b2 = b[6];\n b3 = b[7];\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[8];\n b1 = b[9];\n b2 = b[10];\n b3 = b[11];\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[12];\n b1 = b[13];\n b2 = b[14];\n b3 = b[15];\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n return out;\n}\n/**\r\n * Translate a mat4 by the given vector\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {ReadonlyMat4} a the matrix to translate\r\n * @param {ReadonlyVec3} v vector to translate by\r\n * @returns {mat4} out\r\n */\n\nexport function translate(out, a, v) {\n var x = v[0],\n y = v[1],\n z = v[2];\n var a00, a01, a02, a03;\n var a10, a11, a12, a13;\n var a20, a21, a22, a23;\n\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\n a00 = a[0];\n a01 = a[1];\n a02 = a[2];\n a03 = a[3];\n a10 = a[4];\n a11 = a[5];\n a12 = a[6];\n a13 = a[7];\n a20 = a[8];\n a21 = a[9];\n a22 = a[10];\n a23 = a[11];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a03;\n out[4] = a10;\n out[5] = a11;\n out[6] = a12;\n out[7] = a13;\n out[8] = a20;\n out[9] = a21;\n out[10] = a22;\n out[11] = a23;\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n\n return out;\n}\n/**\r\n * Scales the mat4 by the dimensions in the given vec3 not using vectorization\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {ReadonlyMat4} a the matrix to scale\r\n * @param {ReadonlyVec3} v the vec3 to scale the matrix by\r\n * @returns {mat4} out\r\n **/\n\nexport function scale(out, a, v) {\n var x = v[0],\n y = v[1],\n z = v[2];\n out[0] = a[0] * x;\n out[1] = a[1] * x;\n out[2] = a[2] * x;\n out[3] = a[3] * x;\n out[4] = a[4] * y;\n out[5] = a[5] * y;\n out[6] = a[6] * y;\n out[7] = a[7] * y;\n out[8] = a[8] * z;\n out[9] = a[9] * z;\n out[10] = a[10] * z;\n out[11] = a[11] * z;\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\r\n * Rotates a mat4 by the given angle around the given axis\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {ReadonlyMat4} a the matrix to rotate\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @param {ReadonlyVec3} axis the axis to rotate around\r\n * @returns {mat4} out\r\n */\n\nexport function rotate(out, a, rad, axis) {\n var x = axis[0],\n y = axis[1],\n z = axis[2];\n var len = Math.hypot(x, y, z);\n var s, c, t;\n var a00, a01, a02, a03;\n var a10, a11, a12, a13;\n var a20, a21, a22, a23;\n var b00, b01, b02;\n var b10, b11, b12;\n var b20, b21, b22;\n\n if (len < glMatrix.EPSILON) {\n return null;\n }\n\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c;\n a00 = a[0];\n a01 = a[1];\n a02 = a[2];\n a03 = a[3];\n a10 = a[4];\n a11 = a[5];\n a12 = a[6];\n a13 = a[7];\n a20 = a[8];\n a21 = a[9];\n a22 = a[10];\n a23 = a[11]; // Construct the elements of the rotation matrix\n\n b00 = x * x * t + c;\n b01 = y * x * t + z * s;\n b02 = z * x * t - y * s;\n b10 = x * y * t - z * s;\n b11 = y * y * t + c;\n b12 = z * y * t + x * s;\n b20 = x * z * t + y * s;\n b21 = y * z * t - x * s;\n b22 = z * z * t + c; // Perform rotation-specific matrix multiplication\n\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged last row\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n\n return out;\n}\n/**\r\n * Rotates a matrix by the given angle around the X axis\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {ReadonlyMat4} a the matrix to rotate\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function rotateX(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a10 = a[4];\n var a11 = a[5];\n var a12 = a[6];\n var a13 = a[7];\n var a20 = a[8];\n var a21 = a[9];\n var a22 = a[10];\n var a23 = a[11];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged rows\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n\n out[4] = a10 * c + a20 * s;\n out[5] = a11 * c + a21 * s;\n out[6] = a12 * c + a22 * s;\n out[7] = a13 * c + a23 * s;\n out[8] = a20 * c - a10 * s;\n out[9] = a21 * c - a11 * s;\n out[10] = a22 * c - a12 * s;\n out[11] = a23 * c - a13 * s;\n return out;\n}\n/**\r\n * Rotates a matrix by the given angle around the Y axis\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {ReadonlyMat4} a the matrix to rotate\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function rotateY(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a00 = a[0];\n var a01 = a[1];\n var a02 = a[2];\n var a03 = a[3];\n var a20 = a[8];\n var a21 = a[9];\n var a22 = a[10];\n var a23 = a[11];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged rows\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n\n out[0] = a00 * c - a20 * s;\n out[1] = a01 * c - a21 * s;\n out[2] = a02 * c - a22 * s;\n out[3] = a03 * c - a23 * s;\n out[8] = a00 * s + a20 * c;\n out[9] = a01 * s + a21 * c;\n out[10] = a02 * s + a22 * c;\n out[11] = a03 * s + a23 * c;\n return out;\n}\n/**\r\n * Rotates a matrix by the given angle around the Z axis\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {ReadonlyMat4} a the matrix to rotate\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function rotateZ(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a00 = a[0];\n var a01 = a[1];\n var a02 = a[2];\n var a03 = a[3];\n var a10 = a[4];\n var a11 = a[5];\n var a12 = a[6];\n var a13 = a[7];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged last row\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n\n out[0] = a00 * c + a10 * s;\n out[1] = a01 * c + a11 * s;\n out[2] = a02 * c + a12 * s;\n out[3] = a03 * c + a13 * s;\n out[4] = a10 * c - a00 * s;\n out[5] = a11 * c - a01 * s;\n out[6] = a12 * c - a02 * s;\n out[7] = a13 * c - a03 * s;\n return out;\n}\n/**\r\n * Creates a matrix from a vector translation\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, dest, vec);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {ReadonlyVec3} v Translation vector\r\n * @returns {mat4} out\r\n */\n\nexport function fromTranslation(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.scale(dest, dest, vec);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {ReadonlyVec3} v Scaling vector\r\n * @returns {mat4} out\r\n */\n\nexport function fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = v[1];\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = v[2];\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.rotate(dest, dest, rad, axis);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @param {ReadonlyVec3} axis the axis to rotate around\r\n * @returns {mat4} out\r\n */\n\nexport function fromRotation(out, rad, axis) {\n var x = axis[0],\n y = axis[1],\n z = axis[2];\n var len = Math.hypot(x, y, z);\n var s, c, t;\n\n if (len < glMatrix.EPSILON) {\n return null;\n }\n\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c; // Perform rotation-specific matrix multiplication\n\n out[0] = x * x * t + c;\n out[1] = y * x * t + z * s;\n out[2] = z * x * t - y * s;\n out[3] = 0;\n out[4] = x * y * t - z * s;\n out[5] = y * y * t + c;\n out[6] = z * y * t + x * s;\n out[7] = 0;\n out[8] = x * z * t + y * s;\n out[9] = y * z * t - x * s;\n out[10] = z * z * t + c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from the given angle around the X axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.rotateX(dest, dest, rad);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function fromXRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad); // Perform axis-specific matrix multiplication\n\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = c;\n out[6] = s;\n out[7] = 0;\n out[8] = 0;\n out[9] = -s;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from the given angle around the Y axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.rotateY(dest, dest, rad);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function fromYRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad); // Perform axis-specific matrix multiplication\n\n out[0] = c;\n out[1] = 0;\n out[2] = -s;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = s;\n out[9] = 0;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from the given angle around the Z axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.rotateZ(dest, dest, rad);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function fromZRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad); // Perform axis-specific matrix multiplication\n\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = 0;\n out[4] = -s;\n out[5] = c;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a quaternion rotation and vector translation\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {quat4} q Rotation quaternion\r\n * @param {ReadonlyVec3} v Translation vector\r\n * @returns {mat4} out\r\n */\n\nexport function fromRotationTranslation(out, q, v) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n out[0] = 1 - (yy + zz);\n out[1] = xy + wz;\n out[2] = xz - wy;\n out[3] = 0;\n out[4] = xy - wz;\n out[5] = 1 - (xx + zz);\n out[6] = yz + wx;\n out[7] = 0;\n out[8] = xz + wy;\n out[9] = yz - wx;\n out[10] = 1 - (xx + yy);\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a new mat4 from a dual quat.\r\n *\r\n * @param {mat4} out Matrix\r\n * @param {ReadonlyQuat2} a Dual Quaternion\r\n * @returns {mat4} mat4 receiving operation result\r\n */\n\nexport function fromQuat2(out, a) {\n var translation = new glMatrix.ARRAY_TYPE(3);\n var bx = -a[0],\n by = -a[1],\n bz = -a[2],\n bw = a[3],\n ax = a[4],\n ay = a[5],\n az = a[6],\n aw = a[7];\n var magnitude = bx * bx + by * by + bz * bz + bw * bw; //Only scale if it makes sense\n\n if (magnitude > 0) {\n translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude;\n translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude;\n translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude;\n } else {\n translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\n translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\n translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\n }\n\n fromRotationTranslation(out, a, translation);\n return out;\n}\n/**\r\n * Returns the translation vector component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslation,\r\n * the returned vector will be the same as the translation vector\r\n * originally supplied.\r\n * @param {vec3} out Vector to receive translation component\r\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\n\nexport function getTranslation(out, mat) {\n out[0] = mat[12];\n out[1] = mat[13];\n out[2] = mat[14];\n return out;\n}\n/**\r\n * Returns the scaling factor component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslationScale\r\n * with a normalized Quaternion paramter, the returned vector will be\r\n * the same as the scaling vector\r\n * originally supplied.\r\n * @param {vec3} out Vector to receive scaling factor component\r\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\n\nexport function getScaling(out, mat) {\n var m11 = mat[0];\n var m12 = mat[1];\n var m13 = mat[2];\n var m21 = mat[4];\n var m22 = mat[5];\n var m23 = mat[6];\n var m31 = mat[8];\n var m32 = mat[9];\n var m33 = mat[10];\n out[0] = Math.hypot(m11, m12, m13);\n out[1] = Math.hypot(m21, m22, m23);\n out[2] = Math.hypot(m31, m32, m33);\n return out;\n}\n/**\r\n * Returns a quaternion representing the rotational component\r\n * of a transformation matrix. If a matrix is built with\r\n * fromRotationTranslation, the returned quaternion will be the\r\n * same as the quaternion originally supplied.\r\n * @param {quat} out Quaternion to receive the rotation component\r\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\r\n * @return {quat} out\r\n */\n\nexport function getRotation(out, mat) {\n var scaling = new glMatrix.ARRAY_TYPE(3);\n getScaling(scaling, mat);\n var is1 = 1 / scaling[0];\n var is2 = 1 / scaling[1];\n var is3 = 1 / scaling[2];\n var sm11 = mat[0] * is1;\n var sm12 = mat[1] * is2;\n var sm13 = mat[2] * is3;\n var sm21 = mat[4] * is1;\n var sm22 = mat[5] * is2;\n var sm23 = mat[6] * is3;\n var sm31 = mat[8] * is1;\n var sm32 = mat[9] * is2;\n var sm33 = mat[10] * is3;\n var trace = sm11 + sm22 + sm33;\n var S = 0;\n\n if (trace > 0) {\n S = Math.sqrt(trace + 1.0) * 2;\n out[3] = 0.25 * S;\n out[0] = (sm23 - sm32) / S;\n out[1] = (sm31 - sm13) / S;\n out[2] = (sm12 - sm21) / S;\n } else if (sm11 > sm22 && sm11 > sm33) {\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\n out[3] = (sm23 - sm32) / S;\n out[0] = 0.25 * S;\n out[1] = (sm12 + sm21) / S;\n out[2] = (sm31 + sm13) / S;\n } else if (sm22 > sm33) {\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\n out[3] = (sm31 - sm13) / S;\n out[0] = (sm12 + sm21) / S;\n out[1] = 0.25 * S;\n out[2] = (sm23 + sm32) / S;\n } else {\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\n out[3] = (sm12 - sm21) / S;\n out[0] = (sm31 + sm13) / S;\n out[1] = (sm23 + sm32) / S;\n out[2] = 0.25 * S;\n }\n\n return out;\n}\n/**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale)\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {quat4} q Rotation quaternion\r\n * @param {ReadonlyVec3} v Translation vector\r\n * @param {ReadonlyVec3} s Scaling vector\r\n * @returns {mat4} out\r\n */\n\nexport function fromRotationTranslationScale(out, q, v, s) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n var sx = s[0];\n var sy = s[1];\n var sz = s[2];\n out[0] = (1 - (yy + zz)) * sx;\n out[1] = (xy + wz) * sx;\n out[2] = (xz - wy) * sx;\n out[3] = 0;\n out[4] = (xy - wz) * sy;\n out[5] = (1 - (xx + zz)) * sy;\n out[6] = (yz + wx) * sy;\n out[7] = 0;\n out[8] = (xz + wy) * sz;\n out[9] = (yz - wx) * sz;\n out[10] = (1 - (xx + yy)) * sz;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * mat4.translate(dest, origin);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale)\r\n * mat4.translate(dest, negativeOrigin);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {quat4} q Rotation quaternion\r\n * @param {ReadonlyVec3} v Translation vector\r\n * @param {ReadonlyVec3} s Scaling vector\r\n * @param {ReadonlyVec3} o The origin vector around which to scale and rotate\r\n * @returns {mat4} out\r\n */\n\nexport function fromRotationTranslationScaleOrigin(out, q, v, s, o) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n var sx = s[0];\n var sy = s[1];\n var sz = s[2];\n var ox = o[0];\n var oy = o[1];\n var oz = o[2];\n var out0 = (1 - (yy + zz)) * sx;\n var out1 = (xy + wz) * sx;\n var out2 = (xz - wy) * sx;\n var out4 = (xy - wz) * sy;\n var out5 = (1 - (xx + zz)) * sy;\n var out6 = (yz + wx) * sy;\n var out8 = (xz + wy) * sz;\n var out9 = (yz - wx) * sz;\n var out10 = (1 - (xx + yy)) * sz;\n out[0] = out0;\n out[1] = out1;\n out[2] = out2;\n out[3] = 0;\n out[4] = out4;\n out[5] = out5;\n out[6] = out6;\n out[7] = 0;\n out[8] = out8;\n out[9] = out9;\n out[10] = out10;\n out[11] = 0;\n out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);\n out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);\n out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);\n out[15] = 1;\n return out;\n}\n/**\r\n * Calculates a 4x4 matrix from the given quaternion\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {ReadonlyQuat} q Quaternion to create matrix from\r\n *\r\n * @returns {mat4} out\r\n */\n\nexport function fromQuat(out, q) {\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var yx = y * x2;\n var yy = y * y2;\n var zx = z * x2;\n var zy = z * y2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n out[0] = 1 - yy - zz;\n out[1] = yx + wz;\n out[2] = zx - wy;\n out[3] = 0;\n out[4] = yx - wz;\n out[5] = 1 - xx - zz;\n out[6] = zy + wx;\n out[7] = 0;\n out[8] = zx + wy;\n out[9] = zy - wx;\n out[10] = 1 - xx - yy;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Generates a frustum matrix with the given bounds\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {Number} left Left bound of the frustum\r\n * @param {Number} right Right bound of the frustum\r\n * @param {Number} bottom Bottom bound of the frustum\r\n * @param {Number} top Top bound of the frustum\r\n * @param {Number} near Near bound of the frustum\r\n * @param {Number} far Far bound of the frustum\r\n * @returns {mat4} out\r\n */\n\nexport function frustum(out, left, right, bottom, top, near, far) {\n var rl = 1 / (right - left);\n var tb = 1 / (top - bottom);\n var nf = 1 / (near - far);\n out[0] = near * 2 * rl;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = near * 2 * tb;\n out[6] = 0;\n out[7] = 0;\n out[8] = (right + left) * rl;\n out[9] = (top + bottom) * tb;\n out[10] = (far + near) * nf;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = far * near * 2 * nf;\n out[15] = 0;\n return out;\n}\n/**\r\n * Generates a perspective projection matrix with the given bounds.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {number} fovy Vertical field of view in radians\r\n * @param {number} aspect Aspect ratio. typically viewport width/height\r\n * @param {number} near Near bound of the frustum\r\n * @param {number} far Far bound of the frustum, can be null or Infinity\r\n * @returns {mat4} out\r\n */\n\nexport function perspective(out, fovy, aspect, near, far) {\n var f = 1.0 / Math.tan(fovy / 2),\n nf;\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[15] = 0;\n\n if (far != null && far !== Infinity) {\n nf = 1 / (near - far);\n out[10] = (far + near) * nf;\n out[14] = 2 * far * near * nf;\n } else {\n out[10] = -1;\n out[14] = -2 * near;\n }\n\n return out;\n}\n/**\r\n * Generates a perspective projection matrix with the given field of view.\r\n * This is primarily useful for generating projection matrices to be used\r\n * with the still experiemental WebVR API.\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {Object} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\r\n * @param {number} near Near bound of the frustum\r\n * @param {number} far Far bound of the frustum\r\n * @returns {mat4} out\r\n */\n\nexport function perspectiveFromFieldOfView(out, fov, near, far) {\n var upTan = Math.tan(fov.upDegrees * Math.PI / 180.0);\n var downTan = Math.tan(fov.downDegrees * Math.PI / 180.0);\n var leftTan = Math.tan(fov.leftDegrees * Math.PI / 180.0);\n var rightTan = Math.tan(fov.rightDegrees * Math.PI / 180.0);\n var xScale = 2.0 / (leftTan + rightTan);\n var yScale = 2.0 / (upTan + downTan);\n out[0] = xScale;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n out[4] = 0.0;\n out[5] = yScale;\n out[6] = 0.0;\n out[7] = 0.0;\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\n out[9] = (upTan - downTan) * yScale * 0.5;\n out[10] = far / (near - far);\n out[11] = -1.0;\n out[12] = 0.0;\n out[13] = 0.0;\n out[14] = far * near / (near - far);\n out[15] = 0.0;\n return out;\n}\n/**\r\n * Generates a orthogonal projection matrix with the given bounds\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {number} left Left bound of the frustum\r\n * @param {number} right Right bound of the frustum\r\n * @param {number} bottom Bottom bound of the frustum\r\n * @param {number} top Top bound of the frustum\r\n * @param {number} near Near bound of the frustum\r\n * @param {number} far Far bound of the frustum\r\n * @returns {mat4} out\r\n */\n\nexport function ortho(out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right);\n var bt = 1 / (bottom - top);\n var nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n}\n/**\r\n * Generates a look-at matrix with the given eye position, focal point, and up axis.\r\n * If you want a matrix that actually makes an object look at another object, you should use targetTo instead.\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {ReadonlyVec3} eye Position of the viewer\r\n * @param {ReadonlyVec3} center Point the viewer is looking at\r\n * @param {ReadonlyVec3} up vec3 pointing up\r\n * @returns {mat4} out\r\n */\n\nexport function lookAt(out, eye, center, up) {\n var x0, x1, x2, y0, y1, y2, z0, z1, z2, len;\n var eyex = eye[0];\n var eyey = eye[1];\n var eyez = eye[2];\n var upx = up[0];\n var upy = up[1];\n var upz = up[2];\n var centerx = center[0];\n var centery = center[1];\n var centerz = center[2];\n\n if (Math.abs(eyex - centerx) < glMatrix.EPSILON && Math.abs(eyey - centery) < glMatrix.EPSILON && Math.abs(eyez - centerz) < glMatrix.EPSILON) {\n return identity(out);\n }\n\n z0 = eyex - centerx;\n z1 = eyey - centery;\n z2 = eyez - centerz;\n len = 1 / Math.hypot(z0, z1, z2);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n x0 = upy * z2 - upz * z1;\n x1 = upz * z0 - upx * z2;\n x2 = upx * z1 - upy * z0;\n len = Math.hypot(x0, x1, x2);\n\n if (!len) {\n x0 = 0;\n x1 = 0;\n x2 = 0;\n } else {\n len = 1 / len;\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n\n y0 = z1 * x2 - z2 * x1;\n y1 = z2 * x0 - z0 * x2;\n y2 = z0 * x1 - z1 * x0;\n len = Math.hypot(y0, y1, y2);\n\n if (!len) {\n y0 = 0;\n y1 = 0;\n y2 = 0;\n } else {\n len = 1 / len;\n y0 *= len;\n y1 *= len;\n y2 *= len;\n }\n\n out[0] = x0;\n out[1] = y0;\n out[2] = z0;\n out[3] = 0;\n out[4] = x1;\n out[5] = y1;\n out[6] = z1;\n out[7] = 0;\n out[8] = x2;\n out[9] = y2;\n out[10] = z2;\n out[11] = 0;\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\n out[15] = 1;\n return out;\n}\n/**\r\n * Generates a matrix that makes something look at something else.\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {ReadonlyVec3} eye Position of the viewer\r\n * @param {ReadonlyVec3} center Point the viewer is looking at\r\n * @param {ReadonlyVec3} up vec3 pointing up\r\n * @returns {mat4} out\r\n */\n\nexport function targetTo(out, eye, target, up) {\n var eyex = eye[0],\n eyey = eye[1],\n eyez = eye[2],\n upx = up[0],\n upy = up[1],\n upz = up[2];\n var z0 = eyex - target[0],\n z1 = eyey - target[1],\n z2 = eyez - target[2];\n var len = z0 * z0 + z1 * z1 + z2 * z2;\n\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n }\n\n var x0 = upy * z2 - upz * z1,\n x1 = upz * z0 - upx * z2,\n x2 = upx * z1 - upy * z0;\n len = x0 * x0 + x1 * x1 + x2 * x2;\n\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n\n out[0] = x0;\n out[1] = x1;\n out[2] = x2;\n out[3] = 0;\n out[4] = z1 * x2 - z2 * x1;\n out[5] = z2 * x0 - z0 * x2;\n out[6] = z0 * x1 - z1 * x0;\n out[7] = 0;\n out[8] = z0;\n out[9] = z1;\n out[10] = z2;\n out[11] = 0;\n out[12] = eyex;\n out[13] = eyey;\n out[14] = eyez;\n out[15] = 1;\n return out;\n}\n/**\r\n * Returns a string representation of a mat4\r\n *\r\n * @param {ReadonlyMat4} a matrix to represent as a string\r\n * @returns {String} string representation of the matrix\r\n */\n\nexport function str(a) {\n return \"mat4(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \", \" + a[3] + \", \" + a[4] + \", \" + a[5] + \", \" + a[6] + \", \" + a[7] + \", \" + a[8] + \", \" + a[9] + \", \" + a[10] + \", \" + a[11] + \", \" + a[12] + \", \" + a[13] + \", \" + a[14] + \", \" + a[15] + \")\";\n}\n/**\r\n * Returns Frobenius norm of a mat4\r\n *\r\n * @param {ReadonlyMat4} a the matrix to calculate Frobenius norm of\r\n * @returns {Number} Frobenius norm\r\n */\n\nexport function frob(a) {\n return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]);\n}\n/**\r\n * Adds two mat4's\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {ReadonlyMat4} a the first operand\r\n * @param {ReadonlyMat4} b the second operand\r\n * @returns {mat4} out\r\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n out[8] = a[8] + b[8];\n out[9] = a[9] + b[9];\n out[10] = a[10] + b[10];\n out[11] = a[11] + b[11];\n out[12] = a[12] + b[12];\n out[13] = a[13] + b[13];\n out[14] = a[14] + b[14];\n out[15] = a[15] + b[15];\n return out;\n}\n/**\r\n * Subtracts matrix b from matrix a\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {ReadonlyMat4} a the first operand\r\n * @param {ReadonlyMat4} b the second operand\r\n * @returns {mat4} out\r\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n out[6] = a[6] - b[6];\n out[7] = a[7] - b[7];\n out[8] = a[8] - b[8];\n out[9] = a[9] - b[9];\n out[10] = a[10] - b[10];\n out[11] = a[11] - b[11];\n out[12] = a[12] - b[12];\n out[13] = a[13] - b[13];\n out[14] = a[14] - b[14];\n out[15] = a[15] - b[15];\n return out;\n}\n/**\r\n * Multiply each element of the matrix by a scalar.\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {ReadonlyMat4} a the matrix to scale\r\n * @param {Number} b amount to scale the matrix's elements by\r\n * @returns {mat4} out\r\n */\n\nexport function multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n out[8] = a[8] * b;\n out[9] = a[9] * b;\n out[10] = a[10] * b;\n out[11] = a[11] * b;\n out[12] = a[12] * b;\n out[13] = a[13] * b;\n out[14] = a[14] * b;\n out[15] = a[15] * b;\n return out;\n}\n/**\r\n * Adds two mat4's after multiplying each element of the second operand by a scalar value.\r\n *\r\n * @param {mat4} out the receiving vector\r\n * @param {ReadonlyMat4} a the first operand\r\n * @param {ReadonlyMat4} b the second operand\r\n * @param {Number} scale the amount to scale b's elements by before adding\r\n * @returns {mat4} out\r\n */\n\nexport function multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n out[6] = a[6] + b[6] * scale;\n out[7] = a[7] + b[7] * scale;\n out[8] = a[8] + b[8] * scale;\n out[9] = a[9] + b[9] * scale;\n out[10] = a[10] + b[10] * scale;\n out[11] = a[11] + b[11] * scale;\n out[12] = a[12] + b[12] * scale;\n out[13] = a[13] + b[13] * scale;\n out[14] = a[14] + b[14] * scale;\n out[15] = a[15] + b[15] * scale;\n return out;\n}\n/**\r\n * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)\r\n *\r\n * @param {ReadonlyMat4} a The first matrix.\r\n * @param {ReadonlyMat4} b The second matrix.\r\n * @returns {Boolean} True if the matrices are equal, false otherwise.\r\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15];\n}\n/**\r\n * Returns whether or not the matrices have approximately the same elements in the same position.\r\n *\r\n * @param {ReadonlyMat4} a The first matrix.\r\n * @param {ReadonlyMat4} b The second matrix.\r\n * @returns {Boolean} True if the matrices are equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var a4 = a[4],\n a5 = a[5],\n a6 = a[6],\n a7 = a[7];\n var a8 = a[8],\n a9 = a[9],\n a10 = a[10],\n a11 = a[11];\n var a12 = a[12],\n a13 = a[13],\n a14 = a[14],\n a15 = a[15];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n var b4 = b[4],\n b5 = b[5],\n b6 = b[6],\n b7 = b[7];\n var b8 = b[8],\n b9 = b[9],\n b10 = b[10],\n b11 = b[11];\n var b12 = b[12],\n b13 = b[13],\n b14 = b[14],\n b15 = b[15];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a15), Math.abs(b15));\n}\n/**\r\n * Alias for {@link mat4.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Alias for {@link mat4.subtract}\r\n * @function\r\n */\n\nexport var sub = subtract;","import * as glMatrix from \"./common.js\";\n/**\r\n * 3 Dimensional Vector\r\n * @module vec3\r\n */\n\n/**\r\n * Creates a new, empty vec3\r\n *\r\n * @returns {vec3} a new 3D vector\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(3);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n }\n\n return out;\n}\n/**\r\n * Creates a new vec3 initialized with values from an existing vector\r\n *\r\n * @param {ReadonlyVec3} a vector to clone\r\n * @returns {vec3} a new 3D vector\r\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(3);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n}\n/**\r\n * Calculates the length of a vec3\r\n *\r\n * @param {ReadonlyVec3} a vector to calculate length of\r\n * @returns {Number} length of a\r\n */\n\nexport function length(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n return Math.hypot(x, y, z);\n}\n/**\r\n * Creates a new vec3 initialized with the given values\r\n *\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @returns {vec3} a new 3D vector\r\n */\n\nexport function fromValues(x, y, z) {\n var out = new glMatrix.ARRAY_TYPE(3);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n}\n/**\r\n * Copy the values from one vec3 to another\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {ReadonlyVec3} a the source vector\r\n * @returns {vec3} out\r\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n}\n/**\r\n * Set the components of a vec3 to the given values\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @returns {vec3} out\r\n */\n\nexport function set(out, x, y, z) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n}\n/**\r\n * Adds two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {ReadonlyVec3} a the first operand\r\n * @param {ReadonlyVec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n return out;\n}\n/**\r\n * Subtracts vector b from vector a\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {ReadonlyVec3} a the first operand\r\n * @param {ReadonlyVec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n return out;\n}\n/**\r\n * Multiplies two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {ReadonlyVec3} a the first operand\r\n * @param {ReadonlyVec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n return out;\n}\n/**\r\n * Divides two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {ReadonlyVec3} a the first operand\r\n * @param {ReadonlyVec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n return out;\n}\n/**\r\n * Math.ceil the components of a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {ReadonlyVec3} a vector to ceil\r\n * @returns {vec3} out\r\n */\n\nexport function ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n return out;\n}\n/**\r\n * Math.floor the components of a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {ReadonlyVec3} a vector to floor\r\n * @returns {vec3} out\r\n */\n\nexport function floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n return out;\n}\n/**\r\n * Returns the minimum of two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {ReadonlyVec3} a the first operand\r\n * @param {ReadonlyVec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n return out;\n}\n/**\r\n * Returns the maximum of two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {ReadonlyVec3} a the first operand\r\n * @param {ReadonlyVec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n return out;\n}\n/**\r\n * Math.round the components of a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {ReadonlyVec3} a vector to round\r\n * @returns {vec3} out\r\n */\n\nexport function round(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n out[2] = Math.round(a[2]);\n return out;\n}\n/**\r\n * Scales a vec3 by a scalar number\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {ReadonlyVec3} a the vector to scale\r\n * @param {Number} b amount to scale the vector by\r\n * @returns {vec3} out\r\n */\n\nexport function scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n return out;\n}\n/**\r\n * Adds two vec3's after scaling the second operand by a scalar value\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {ReadonlyVec3} a the first operand\r\n * @param {ReadonlyVec3} b the second operand\r\n * @param {Number} scale the amount to scale b by before adding\r\n * @returns {vec3} out\r\n */\n\nexport function scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n return out;\n}\n/**\r\n * Calculates the euclidian distance between two vec3's\r\n *\r\n * @param {ReadonlyVec3} a the first operand\r\n * @param {ReadonlyVec3} b the second operand\r\n * @returns {Number} distance between a and b\r\n */\n\nexport function distance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n return Math.hypot(x, y, z);\n}\n/**\r\n * Calculates the squared euclidian distance between two vec3's\r\n *\r\n * @param {ReadonlyVec3} a the first operand\r\n * @param {ReadonlyVec3} b the second operand\r\n * @returns {Number} squared distance between a and b\r\n */\n\nexport function squaredDistance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n return x * x + y * y + z * z;\n}\n/**\r\n * Calculates the squared length of a vec3\r\n *\r\n * @param {ReadonlyVec3} a vector to calculate squared length of\r\n * @returns {Number} squared length of a\r\n */\n\nexport function squaredLength(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n return x * x + y * y + z * z;\n}\n/**\r\n * Negates the components of a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {ReadonlyVec3} a vector to negate\r\n * @returns {vec3} out\r\n */\n\nexport function negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n return out;\n}\n/**\r\n * Returns the inverse of the components of a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {ReadonlyVec3} a vector to invert\r\n * @returns {vec3} out\r\n */\n\nexport function inverse(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n return out;\n}\n/**\r\n * Normalize a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {ReadonlyVec3} a vector to normalize\r\n * @returns {vec3} out\r\n */\n\nexport function normalize(out, a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var len = x * x + y * y + z * z;\n\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n }\n\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n out[2] = a[2] * len;\n return out;\n}\n/**\r\n * Calculates the dot product of two vec3's\r\n *\r\n * @param {ReadonlyVec3} a the first operand\r\n * @param {ReadonlyVec3} b the second operand\r\n * @returns {Number} dot product of a and b\r\n */\n\nexport function dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n}\n/**\r\n * Computes the cross product of two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {ReadonlyVec3} a the first operand\r\n * @param {ReadonlyVec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function cross(out, a, b) {\n var ax = a[0],\n ay = a[1],\n az = a[2];\n var bx = b[0],\n by = b[1],\n bz = b[2];\n out[0] = ay * bz - az * by;\n out[1] = az * bx - ax * bz;\n out[2] = ax * by - ay * bx;\n return out;\n}\n/**\r\n * Performs a linear interpolation between two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {ReadonlyVec3} a the first operand\r\n * @param {ReadonlyVec3} b the second operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {vec3} out\r\n */\n\nexport function lerp(out, a, b, t) {\n var ax = a[0];\n var ay = a[1];\n var az = a[2];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n return out;\n}\n/**\r\n * Performs a hermite interpolation with two control points\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {ReadonlyVec3} a the first operand\r\n * @param {ReadonlyVec3} b the second operand\r\n * @param {ReadonlyVec3} c the third operand\r\n * @param {ReadonlyVec3} d the fourth operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {vec3} out\r\n */\n\nexport function hermite(out, a, b, c, d, t) {\n var factorTimes2 = t * t;\n var factor1 = factorTimes2 * (2 * t - 3) + 1;\n var factor2 = factorTimes2 * (t - 2) + t;\n var factor3 = factorTimes2 * (t - 1);\n var factor4 = factorTimes2 * (3 - 2 * t);\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n return out;\n}\n/**\r\n * Performs a bezier interpolation with two control points\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {ReadonlyVec3} a the first operand\r\n * @param {ReadonlyVec3} b the second operand\r\n * @param {ReadonlyVec3} c the third operand\r\n * @param {ReadonlyVec3} d the fourth operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {vec3} out\r\n */\n\nexport function bezier(out, a, b, c, d, t) {\n var inverseFactor = 1 - t;\n var inverseFactorTimesTwo = inverseFactor * inverseFactor;\n var factorTimes2 = t * t;\n var factor1 = inverseFactorTimesTwo * inverseFactor;\n var factor2 = 3 * t * inverseFactorTimesTwo;\n var factor3 = 3 * factorTimes2 * inverseFactor;\n var factor4 = factorTimes2 * t;\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n return out;\n}\n/**\r\n * Generates a random vector with the given scale\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\r\n * @returns {vec3} out\r\n */\n\nexport function random(out, scale) {\n scale = scale || 1.0;\n var r = glMatrix.RANDOM() * 2.0 * Math.PI;\n var z = glMatrix.RANDOM() * 2.0 - 1.0;\n var zScale = Math.sqrt(1.0 - z * z) * scale;\n out[0] = Math.cos(r) * zScale;\n out[1] = Math.sin(r) * zScale;\n out[2] = z * scale;\n return out;\n}\n/**\r\n * Transforms the vec3 with a mat4.\r\n * 4th vector component is implicitly '1'\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {ReadonlyVec3} a the vector to transform\r\n * @param {ReadonlyMat4} m matrix to transform with\r\n * @returns {vec3} out\r\n */\n\nexport function transformMat4(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2];\n var w = m[3] * x + m[7] * y + m[11] * z + m[15];\n w = w || 1.0;\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n return out;\n}\n/**\r\n * Transforms the vec3 with a mat3.\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {ReadonlyVec3} a the vector to transform\r\n * @param {ReadonlyMat3} m the 3x3 matrix to transform with\r\n * @returns {vec3} out\r\n */\n\nexport function transformMat3(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2];\n out[0] = x * m[0] + y * m[3] + z * m[6];\n out[1] = x * m[1] + y * m[4] + z * m[7];\n out[2] = x * m[2] + y * m[5] + z * m[8];\n return out;\n}\n/**\r\n * Transforms the vec3 with a quat\r\n * Can also be used for dual quaternions. (Multiply it with the real part)\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {ReadonlyVec3} a the vector to transform\r\n * @param {ReadonlyQuat} q quaternion to transform with\r\n * @returns {vec3} out\r\n */\n\nexport function transformQuat(out, a, q) {\n // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed\n var qx = q[0],\n qy = q[1],\n qz = q[2],\n qw = q[3];\n var x = a[0],\n y = a[1],\n z = a[2]; // var qvec = [qx, qy, qz];\n // var uv = vec3.cross([], qvec, a);\n\n var uvx = qy * z - qz * y,\n uvy = qz * x - qx * z,\n uvz = qx * y - qy * x; // var uuv = vec3.cross([], qvec, uv);\n\n var uuvx = qy * uvz - qz * uvy,\n uuvy = qz * uvx - qx * uvz,\n uuvz = qx * uvy - qy * uvx; // vec3.scale(uv, uv, 2 * w);\n\n var w2 = qw * 2;\n uvx *= w2;\n uvy *= w2;\n uvz *= w2; // vec3.scale(uuv, uuv, 2);\n\n uuvx *= 2;\n uuvy *= 2;\n uuvz *= 2; // return vec3.add(out, a, vec3.add(out, uv, uuv));\n\n out[0] = x + uvx + uuvx;\n out[1] = y + uvy + uuvy;\n out[2] = z + uvz + uuvz;\n return out;\n}\n/**\r\n * Rotate a 3D vector around the x-axis\r\n * @param {vec3} out The receiving vec3\r\n * @param {ReadonlyVec3} a The vec3 point to rotate\r\n * @param {ReadonlyVec3} b The origin of the rotation\r\n * @param {Number} rad The angle of rotation in radians\r\n * @returns {vec3} out\r\n */\n\nexport function rotateX(out, a, b, rad) {\n var p = [],\n r = []; //Translate point to the origin\n\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2]; //perform rotation\n\n r[0] = p[0];\n r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad);\n r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad); //translate to correct position\n\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\r\n * Rotate a 3D vector around the y-axis\r\n * @param {vec3} out The receiving vec3\r\n * @param {ReadonlyVec3} a The vec3 point to rotate\r\n * @param {ReadonlyVec3} b The origin of the rotation\r\n * @param {Number} rad The angle of rotation in radians\r\n * @returns {vec3} out\r\n */\n\nexport function rotateY(out, a, b, rad) {\n var p = [],\n r = []; //Translate point to the origin\n\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2]; //perform rotation\n\n r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad);\n r[1] = p[1];\n r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad); //translate to correct position\n\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\r\n * Rotate a 3D vector around the z-axis\r\n * @param {vec3} out The receiving vec3\r\n * @param {ReadonlyVec3} a The vec3 point to rotate\r\n * @param {ReadonlyVec3} b The origin of the rotation\r\n * @param {Number} rad The angle of rotation in radians\r\n * @returns {vec3} out\r\n */\n\nexport function rotateZ(out, a, b, rad) {\n var p = [],\n r = []; //Translate point to the origin\n\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2]; //perform rotation\n\n r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad);\n r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad);\n r[2] = p[2]; //translate to correct position\n\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\r\n * Get the angle between two 3D vectors\r\n * @param {ReadonlyVec3} a The first operand\r\n * @param {ReadonlyVec3} b The second operand\r\n * @returns {Number} The angle in radians\r\n */\n\nexport function angle(a, b) {\n var ax = a[0],\n ay = a[1],\n az = a[2],\n bx = b[0],\n by = b[1],\n bz = b[2],\n mag1 = Math.sqrt(ax * ax + ay * ay + az * az),\n mag2 = Math.sqrt(bx * bx + by * by + bz * bz),\n mag = mag1 * mag2,\n cosine = mag && dot(a, b) / mag;\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\n}\n/**\r\n * Set the components of a vec3 to zero\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @returns {vec3} out\r\n */\n\nexport function zero(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n out[2] = 0.0;\n return out;\n}\n/**\r\n * Returns a string representation of a vector\r\n *\r\n * @param {ReadonlyVec3} a vector to represent as a string\r\n * @returns {String} string representation of the vector\r\n */\n\nexport function str(a) {\n return \"vec3(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \")\";\n}\n/**\r\n * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)\r\n *\r\n * @param {ReadonlyVec3} a The first vector.\r\n * @param {ReadonlyVec3} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n}\n/**\r\n * Returns whether or not the vectors have approximately the same elements in the same position.\r\n *\r\n * @param {ReadonlyVec3} a The first vector.\r\n * @param {ReadonlyVec3} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2));\n}\n/**\r\n * Alias for {@link vec3.subtract}\r\n * @function\r\n */\n\nexport var sub = subtract;\n/**\r\n * Alias for {@link vec3.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Alias for {@link vec3.divide}\r\n * @function\r\n */\n\nexport var div = divide;\n/**\r\n * Alias for {@link vec3.distance}\r\n * @function\r\n */\n\nexport var dist = distance;\n/**\r\n * Alias for {@link vec3.squaredDistance}\r\n * @function\r\n */\n\nexport var sqrDist = squaredDistance;\n/**\r\n * Alias for {@link vec3.length}\r\n * @function\r\n */\n\nexport var len = length;\n/**\r\n * Alias for {@link vec3.squaredLength}\r\n * @function\r\n */\n\nexport var sqrLen = squaredLength;\n/**\r\n * Perform some operation over an array of vec3s.\r\n *\r\n * @param {Array} a the array of vectors to iterate over\r\n * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed\r\n * @param {Number} offset Number of elements to skip at the beginning of the array\r\n * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array\r\n * @param {Function} fn Function to call for each vector in the array\r\n * @param {Object} [arg] additional argument to pass to fn\r\n * @returns {Array} a\r\n * @function\r\n */\n\nexport var forEach = function () {\n var vec = create();\n return function (a, stride, offset, count, fn, arg) {\n var i, l;\n\n if (!stride) {\n stride = 3;\n }\n\n if (!offset) {\n offset = 0;\n }\n\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n vec[2] = a[i + 2];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n a[i + 2] = vec[2];\n }\n\n return a;\n };\n}();","import * as glMatrix from \"./common.js\";\n/**\r\n * 4 Dimensional Vector\r\n * @module vec4\r\n */\n\n/**\r\n * Creates a new, empty vec4\r\n *\r\n * @returns {vec4} a new 4D vector\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(4);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n }\n\n return out;\n}\n/**\r\n * Creates a new vec4 initialized with values from an existing vector\r\n *\r\n * @param {ReadonlyVec4} a vector to clone\r\n * @returns {vec4} a new 4D vector\r\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n/**\r\n * Creates a new vec4 initialized with the given values\r\n *\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @param {Number} w W component\r\n * @returns {vec4} a new 4D vector\r\n */\n\nexport function fromValues(x, y, z, w) {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n}\n/**\r\n * Copy the values from one vec4 to another\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {ReadonlyVec4} a the source vector\r\n * @returns {vec4} out\r\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n/**\r\n * Set the components of a vec4 to the given values\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @param {Number} w W component\r\n * @returns {vec4} out\r\n */\n\nexport function set(out, x, y, z, w) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n}\n/**\r\n * Adds two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {ReadonlyVec4} a the first operand\r\n * @param {ReadonlyVec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n return out;\n}\n/**\r\n * Subtracts vector b from vector a\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {ReadonlyVec4} a the first operand\r\n * @param {ReadonlyVec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n return out;\n}\n/**\r\n * Multiplies two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {ReadonlyVec4} a the first operand\r\n * @param {ReadonlyVec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n out[3] = a[3] * b[3];\n return out;\n}\n/**\r\n * Divides two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {ReadonlyVec4} a the first operand\r\n * @param {ReadonlyVec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n out[3] = a[3] / b[3];\n return out;\n}\n/**\r\n * Math.ceil the components of a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {ReadonlyVec4} a vector to ceil\r\n * @returns {vec4} out\r\n */\n\nexport function ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n out[3] = Math.ceil(a[3]);\n return out;\n}\n/**\r\n * Math.floor the components of a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {ReadonlyVec4} a vector to floor\r\n * @returns {vec4} out\r\n */\n\nexport function floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n out[3] = Math.floor(a[3]);\n return out;\n}\n/**\r\n * Returns the minimum of two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {ReadonlyVec4} a the first operand\r\n * @param {ReadonlyVec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n out[3] = Math.min(a[3], b[3]);\n return out;\n}\n/**\r\n * Returns the maximum of two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {ReadonlyVec4} a the first operand\r\n * @param {ReadonlyVec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n out[3] = Math.max(a[3], b[3]);\n return out;\n}\n/**\r\n * Math.round the components of a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {ReadonlyVec4} a vector to round\r\n * @returns {vec4} out\r\n */\n\nexport function round(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n out[2] = Math.round(a[2]);\n out[3] = Math.round(a[3]);\n return out;\n}\n/**\r\n * Scales a vec4 by a scalar number\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {ReadonlyVec4} a the vector to scale\r\n * @param {Number} b amount to scale the vector by\r\n * @returns {vec4} out\r\n */\n\nexport function scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n return out;\n}\n/**\r\n * Adds two vec4's after scaling the second operand by a scalar value\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {ReadonlyVec4} a the first operand\r\n * @param {ReadonlyVec4} b the second operand\r\n * @param {Number} scale the amount to scale b by before adding\r\n * @returns {vec4} out\r\n */\n\nexport function scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n return out;\n}\n/**\r\n * Calculates the euclidian distance between two vec4's\r\n *\r\n * @param {ReadonlyVec4} a the first operand\r\n * @param {ReadonlyVec4} b the second operand\r\n * @returns {Number} distance between a and b\r\n */\n\nexport function distance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n var w = b[3] - a[3];\n return Math.hypot(x, y, z, w);\n}\n/**\r\n * Calculates the squared euclidian distance between two vec4's\r\n *\r\n * @param {ReadonlyVec4} a the first operand\r\n * @param {ReadonlyVec4} b the second operand\r\n * @returns {Number} squared distance between a and b\r\n */\n\nexport function squaredDistance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n var w = b[3] - a[3];\n return x * x + y * y + z * z + w * w;\n}\n/**\r\n * Calculates the length of a vec4\r\n *\r\n * @param {ReadonlyVec4} a vector to calculate length of\r\n * @returns {Number} length of a\r\n */\n\nexport function length(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var w = a[3];\n return Math.hypot(x, y, z, w);\n}\n/**\r\n * Calculates the squared length of a vec4\r\n *\r\n * @param {ReadonlyVec4} a vector to calculate squared length of\r\n * @returns {Number} squared length of a\r\n */\n\nexport function squaredLength(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var w = a[3];\n return x * x + y * y + z * z + w * w;\n}\n/**\r\n * Negates the components of a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {ReadonlyVec4} a vector to negate\r\n * @returns {vec4} out\r\n */\n\nexport function negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = -a[3];\n return out;\n}\n/**\r\n * Returns the inverse of the components of a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {ReadonlyVec4} a vector to invert\r\n * @returns {vec4} out\r\n */\n\nexport function inverse(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n out[3] = 1.0 / a[3];\n return out;\n}\n/**\r\n * Normalize a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {ReadonlyVec4} a vector to normalize\r\n * @returns {vec4} out\r\n */\n\nexport function normalize(out, a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var w = a[3];\n var len = x * x + y * y + z * z + w * w;\n\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n }\n\n out[0] = x * len;\n out[1] = y * len;\n out[2] = z * len;\n out[3] = w * len;\n return out;\n}\n/**\r\n * Calculates the dot product of two vec4's\r\n *\r\n * @param {ReadonlyVec4} a the first operand\r\n * @param {ReadonlyVec4} b the second operand\r\n * @returns {Number} dot product of a and b\r\n */\n\nexport function dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n}\n/**\r\n * Returns the cross-product of three vectors in a 4-dimensional space\r\n *\r\n * @param {ReadonlyVec4} result the receiving vector\r\n * @param {ReadonlyVec4} U the first vector\r\n * @param {ReadonlyVec4} V the second vector\r\n * @param {ReadonlyVec4} W the third vector\r\n * @returns {vec4} result\r\n */\n\nexport function cross(out, u, v, w) {\n var A = v[0] * w[1] - v[1] * w[0],\n B = v[0] * w[2] - v[2] * w[0],\n C = v[0] * w[3] - v[3] * w[0],\n D = v[1] * w[2] - v[2] * w[1],\n E = v[1] * w[3] - v[3] * w[1],\n F = v[2] * w[3] - v[3] * w[2];\n var G = u[0];\n var H = u[1];\n var I = u[2];\n var J = u[3];\n out[0] = H * F - I * E + J * D;\n out[1] = -(G * F) + I * C - J * B;\n out[2] = G * E - H * C + J * A;\n out[3] = -(G * D) + H * B - I * A;\n return out;\n}\n/**\r\n * Performs a linear interpolation between two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {ReadonlyVec4} a the first operand\r\n * @param {ReadonlyVec4} b the second operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {vec4} out\r\n */\n\nexport function lerp(out, a, b, t) {\n var ax = a[0];\n var ay = a[1];\n var az = a[2];\n var aw = a[3];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n out[3] = aw + t * (b[3] - aw);\n return out;\n}\n/**\r\n * Generates a random vector with the given scale\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\r\n * @returns {vec4} out\r\n */\n\nexport function random(out, scale) {\n scale = scale || 1.0; // Marsaglia, George. Choosing a Point from the Surface of a\n // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646.\n // http://projecteuclid.org/euclid.aoms/1177692644;\n\n var v1, v2, v3, v4;\n var s1, s2;\n\n do {\n v1 = glMatrix.RANDOM() * 2 - 1;\n v2 = glMatrix.RANDOM() * 2 - 1;\n s1 = v1 * v1 + v2 * v2;\n } while (s1 >= 1);\n\n do {\n v3 = glMatrix.RANDOM() * 2 - 1;\n v4 = glMatrix.RANDOM() * 2 - 1;\n s2 = v3 * v3 + v4 * v4;\n } while (s2 >= 1);\n\n var d = Math.sqrt((1 - s1) / s2);\n out[0] = scale * v1;\n out[1] = scale * v2;\n out[2] = scale * v3 * d;\n out[3] = scale * v4 * d;\n return out;\n}\n/**\r\n * Transforms the vec4 with a mat4.\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {ReadonlyVec4} a the vector to transform\r\n * @param {ReadonlyMat4} m matrix to transform with\r\n * @returns {vec4} out\r\n */\n\nexport function transformMat4(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n}\n/**\r\n * Transforms the vec4 with a quat\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {ReadonlyVec4} a the vector to transform\r\n * @param {ReadonlyQuat} q quaternion to transform with\r\n * @returns {vec4} out\r\n */\n\nexport function transformQuat(out, a, q) {\n var x = a[0],\n y = a[1],\n z = a[2];\n var qx = q[0],\n qy = q[1],\n qz = q[2],\n qw = q[3]; // calculate quat * vec\n\n var ix = qw * x + qy * z - qz * y;\n var iy = qw * y + qz * x - qx * z;\n var iz = qw * z + qx * y - qy * x;\n var iw = -qx * x - qy * y - qz * z; // calculate result * inverse quat\n\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n out[3] = a[3];\n return out;\n}\n/**\r\n * Set the components of a vec4 to zero\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @returns {vec4} out\r\n */\n\nexport function zero(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n return out;\n}\n/**\r\n * Returns a string representation of a vector\r\n *\r\n * @param {ReadonlyVec4} a vector to represent as a string\r\n * @returns {String} string representation of the vector\r\n */\n\nexport function str(a) {\n return \"vec4(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \", \" + a[3] + \")\";\n}\n/**\r\n * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)\r\n *\r\n * @param {ReadonlyVec4} a The first vector.\r\n * @param {ReadonlyVec4} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n/**\r\n * Returns whether or not the vectors have approximately the same elements in the same position.\r\n *\r\n * @param {ReadonlyVec4} a The first vector.\r\n * @param {ReadonlyVec4} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3));\n}\n/**\r\n * Alias for {@link vec4.subtract}\r\n * @function\r\n */\n\nexport var sub = subtract;\n/**\r\n * Alias for {@link vec4.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Alias for {@link vec4.divide}\r\n * @function\r\n */\n\nexport var div = divide;\n/**\r\n * Alias for {@link vec4.distance}\r\n * @function\r\n */\n\nexport var dist = distance;\n/**\r\n * Alias for {@link vec4.squaredDistance}\r\n * @function\r\n */\n\nexport var sqrDist = squaredDistance;\n/**\r\n * Alias for {@link vec4.length}\r\n * @function\r\n */\n\nexport var len = length;\n/**\r\n * Alias for {@link vec4.squaredLength}\r\n * @function\r\n */\n\nexport var sqrLen = squaredLength;\n/**\r\n * Perform some operation over an array of vec4s.\r\n *\r\n * @param {Array} a the array of vectors to iterate over\r\n * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed\r\n * @param {Number} offset Number of elements to skip at the beginning of the array\r\n * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array\r\n * @param {Function} fn Function to call for each vector in the array\r\n * @param {Object} [arg] additional argument to pass to fn\r\n * @returns {Array} a\r\n * @function\r\n */\n\nexport var forEach = function () {\n var vec = create();\n return function (a, stride, offset, count, fn, arg) {\n var i, l;\n\n if (!stride) {\n stride = 4;\n }\n\n if (!offset) {\n offset = 0;\n }\n\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n vec[2] = a[i + 2];\n vec[3] = a[i + 3];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n a[i + 2] = vec[2];\n a[i + 3] = vec[3];\n }\n\n return a;\n };\n}();","module.exports = slerp\n\n/**\n * Performs a spherical linear interpolation between two quat\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a the first operand\n * @param {quat} b the second operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {quat} out\n */\nfunction slerp (out, a, b, t) {\n // benchmarks:\n // http://jsperf.com/quaternion-slerp-implementations\n\n var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n bx = b[0], by = b[1], bz = b[2], bw = b[3]\n\n var omega, cosom, sinom, scale0, scale1\n\n // calc cosine\n cosom = ax * bx + ay * by + az * bz + aw * bw\n // adjust signs (if necessary)\n if (cosom < 0.0) {\n cosom = -cosom\n bx = -bx\n by = -by\n bz = -bz\n bw = -bw\n }\n // calculate coefficients\n if ((1.0 - cosom) > 0.000001) {\n // standard case (slerp)\n omega = Math.acos(cosom)\n sinom = Math.sin(omega)\n scale0 = Math.sin((1.0 - t) * omega) / sinom\n scale1 = Math.sin(t * omega) / sinom\n } else {\n // \"from\" and \"to\" quaternions are very close\n // ... so we can do a linear interpolation\n scale0 = 1.0 - t\n scale1 = t\n }\n // calculate final values\n out[0] = scale0 * ax + scale1 * bx\n out[1] = scale0 * ay + scale1 * by\n out[2] = scale0 * az + scale1 * bz\n out[3] = scale0 * aw + scale1 * bw\n\n return out\n}\n","module.exports = cross;\n\n/**\n * Computes the cross product of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nfunction cross(out, a, b) {\n var ax = a[0], ay = a[1], az = a[2],\n bx = b[0], by = b[1], bz = b[2]\n\n out[0] = ay * bz - az * by\n out[1] = az * bx - ax * bz\n out[2] = ax * by - ay * bx\n return out\n}","module.exports = dot;\n\n/**\n * Calculates the dot product of two vec3's\n *\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {Number} dot product of a and b\n */\nfunction dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]\n}","module.exports = length;\n\n/**\n * Calculates the length of a vec3\n *\n * @param {vec3} a vector to calculate length of\n * @returns {Number} length of a\n */\nfunction length(a) {\n var x = a[0],\n y = a[1],\n z = a[2]\n return Math.sqrt(x*x + y*y + z*z)\n}","module.exports = lerp;\n\n/**\n * Performs a linear interpolation between two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {vec3} out\n */\nfunction lerp(out, a, b, t) {\n var ax = a[0],\n ay = a[1],\n az = a[2]\n out[0] = ax + t * (b[0] - ax)\n out[1] = ay + t * (b[1] - ay)\n out[2] = az + t * (b[2] - az)\n return out\n}","module.exports = normalize;\n\n/**\n * Normalize a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a vector to normalize\n * @returns {vec3} out\n */\nfunction normalize(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2]\n var len = x*x + y*y + z*z\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len)\n out[0] = a[0] * len\n out[1] = a[1] * len\n out[2] = a[2] * len\n }\n return out\n}","'use strict'\r\n\r\nvar isBrowser = require('is-browser')\r\n\r\nfunction detect() {\r\n\tvar supported = false\r\n\r\n\ttry {\r\n\t\tvar opts = Object.defineProperty({}, 'passive', {\r\n\t\t\tget: function() {\r\n\t\t\t\tsupported = true\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\twindow.addEventListener('test', null, opts)\r\n\t\twindow.removeEventListener('test', null, opts)\r\n\t} catch(e) {\r\n\t\tsupported = false\r\n\t}\r\n\r\n\treturn supported\r\n}\r\n\r\nmodule.exports = isBrowser && detect()\r\n","module.exports = true;","/*jshint unused:true*/\n/*\nInput: matrix ; a 4x4 matrix\nOutput: translation ; a 3 component vector\n scale ; a 3 component vector\n skew ; skew factors XY,XZ,YZ represented as a 3 component vector\n perspective ; a 4 component vector\n quaternion ; a 4 component vector\nReturns false if the matrix cannot be decomposed, true if it can\n\n\nReferences:\nhttps://github.com/kamicane/matrix3d/blob/master/lib/Matrix3d.js\nhttps://github.com/ChromiumWebApps/chromium/blob/master/ui/gfx/transform_util.cc\nhttp://www.w3.org/TR/css3-transforms/#decomposing-a-3d-matrix\n*/\n\nvar normalize = require('./normalize')\n\nvar create = require('gl-mat4/create')\nvar clone = require('gl-mat4/clone')\nvar determinant = require('gl-mat4/determinant')\nvar invert = require('gl-mat4/invert')\nvar transpose = require('gl-mat4/transpose')\nvar vec3 = {\n length: require('gl-vec3/length'),\n normalize: require('gl-vec3/normalize'),\n dot: require('gl-vec3/dot'),\n cross: require('gl-vec3/cross')\n}\n\nvar tmp = create()\nvar perspectiveMatrix = create()\nvar tmpVec4 = [0, 0, 0, 0]\nvar row = [ [0,0,0], [0,0,0], [0,0,0] ]\nvar pdum3 = [0,0,0]\n\nmodule.exports = function decomposeMat4(matrix, translation, scale, skew, perspective, quaternion) {\n if (!translation) translation = [0,0,0]\n if (!scale) scale = [0,0,0]\n if (!skew) skew = [0,0,0]\n if (!perspective) perspective = [0,0,0,1]\n if (!quaternion) quaternion = [0,0,0,1]\n\n //normalize, if not possible then bail out early\n if (!normalize(tmp, matrix))\n return false\n\n // perspectiveMatrix is used to solve for perspective, but it also provides\n // an easy way to test for singularity of the upper 3x3 component.\n clone(perspectiveMatrix, tmp)\n\n perspectiveMatrix[3] = 0\n perspectiveMatrix[7] = 0\n perspectiveMatrix[11] = 0\n perspectiveMatrix[15] = 1\n\n // If the perspectiveMatrix is not invertible, we are also unable to\n // decompose, so we'll bail early. Constant taken from SkMatrix44::invert.\n if (Math.abs(determinant(perspectiveMatrix) < 1e-8))\n return false\n\n var a03 = tmp[3], a13 = tmp[7], a23 = tmp[11],\n a30 = tmp[12], a31 = tmp[13], a32 = tmp[14], a33 = tmp[15]\n\n // First, isolate perspective.\n if (a03 !== 0 || a13 !== 0 || a23 !== 0) {\n tmpVec4[0] = a03\n tmpVec4[1] = a13\n tmpVec4[2] = a23\n tmpVec4[3] = a33\n\n // Solve the equation by inverting perspectiveMatrix and multiplying\n // rightHandSide by the inverse.\n // resuing the perspectiveMatrix here since it's no longer needed\n var ret = invert(perspectiveMatrix, perspectiveMatrix)\n if (!ret) return false\n transpose(perspectiveMatrix, perspectiveMatrix)\n\n //multiply by transposed inverse perspective matrix, into perspective vec4\n vec4multMat4(perspective, tmpVec4, perspectiveMatrix)\n } else { \n //no perspective\n perspective[0] = perspective[1] = perspective[2] = 0\n perspective[3] = 1\n }\n\n // Next take care of translation\n translation[0] = a30\n translation[1] = a31\n translation[2] = a32\n\n // Now get scale and shear. 'row' is a 3 element array of 3 component vectors\n mat3from4(row, tmp)\n\n // Compute X scale factor and normalize first row.\n scale[0] = vec3.length(row[0])\n vec3.normalize(row[0], row[0])\n\n // Compute XY shear factor and make 2nd row orthogonal to 1st.\n skew[0] = vec3.dot(row[0], row[1])\n combine(row[1], row[1], row[0], 1.0, -skew[0])\n\n // Now, compute Y scale and normalize 2nd row.\n scale[1] = vec3.length(row[1])\n vec3.normalize(row[1], row[1])\n skew[0] /= scale[1]\n\n // Compute XZ and YZ shears, orthogonalize 3rd row\n skew[1] = vec3.dot(row[0], row[2])\n combine(row[2], row[2], row[0], 1.0, -skew[1])\n skew[2] = vec3.dot(row[1], row[2])\n combine(row[2], row[2], row[1], 1.0, -skew[2])\n\n // Next, get Z scale and normalize 3rd row.\n scale[2] = vec3.length(row[2])\n vec3.normalize(row[2], row[2])\n skew[1] /= scale[2]\n skew[2] /= scale[2]\n\n\n // At this point, the matrix (in rows) is orthonormal.\n // Check for a coordinate system flip. If the determinant\n // is -1, then negate the matrix and the scaling factors.\n vec3.cross(pdum3, row[1], row[2])\n if (vec3.dot(row[0], pdum3) < 0) {\n for (var i = 0; i < 3; i++) {\n scale[i] *= -1;\n row[i][0] *= -1\n row[i][1] *= -1\n row[i][2] *= -1\n }\n }\n\n // Now, get the rotations out\n quaternion[0] = 0.5 * Math.sqrt(Math.max(1 + row[0][0] - row[1][1] - row[2][2], 0))\n quaternion[1] = 0.5 * Math.sqrt(Math.max(1 - row[0][0] + row[1][1] - row[2][2], 0))\n quaternion[2] = 0.5 * Math.sqrt(Math.max(1 - row[0][0] - row[1][1] + row[2][2], 0))\n quaternion[3] = 0.5 * Math.sqrt(Math.max(1 + row[0][0] + row[1][1] + row[2][2], 0))\n\n if (row[2][1] > row[1][2])\n quaternion[0] = -quaternion[0]\n if (row[0][2] > row[2][0])\n quaternion[1] = -quaternion[1]\n if (row[1][0] > row[0][1])\n quaternion[2] = -quaternion[2]\n return true\n}\n\n//will be replaced by gl-vec4 eventually\nfunction vec4multMat4(out, a, m) {\n var x = a[0], y = a[1], z = a[2], w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n}\n\n//gets upper-left of a 4x4 matrix into a 3x3 of vectors\nfunction mat3from4(out, mat4x4) {\n out[0][0] = mat4x4[0]\n out[0][1] = mat4x4[1]\n out[0][2] = mat4x4[2]\n \n out[1][0] = mat4x4[4]\n out[1][1] = mat4x4[5]\n out[1][2] = mat4x4[6]\n\n out[2][0] = mat4x4[8]\n out[2][1] = mat4x4[9]\n out[2][2] = mat4x4[10]\n}\n\nfunction combine(out, a, b, scale1, scale2) {\n out[0] = a[0] * scale1 + b[0] * scale2\n out[1] = a[1] * scale1 + b[1] * scale2\n out[2] = a[2] * scale1 + b[2] * scale2\n}","module.exports = function normalize(out, mat) {\n var m44 = mat[15]\n // Cannot normalize.\n if (m44 === 0) \n return false\n var scale = 1 / m44\n for (var i=0; i<16; i++)\n out[i] = mat[i] * scale\n return true\n}","var lerp = require('gl-vec3/lerp')\n\nvar recompose = require('mat4-recompose')\nvar decompose = require('mat4-decompose')\nvar determinant = require('gl-mat4/determinant')\nvar slerp = require('quat-slerp')\n\nvar state0 = state()\nvar state1 = state()\nvar tmp = state()\n\nmodule.exports = interpolate\nfunction interpolate(out, start, end, alpha) {\n if (determinant(start) === 0 || determinant(end) === 0)\n return false\n\n //decompose the start and end matrices into individual components\n var r0 = decompose(start, state0.translate, state0.scale, state0.skew, state0.perspective, state0.quaternion)\n var r1 = decompose(end, state1.translate, state1.scale, state1.skew, state1.perspective, state1.quaternion)\n if (!r0 || !r1)\n return false \n\n\n //now lerp/slerp the start and end components into a temporary lerp(tmptranslate, state0.translate, state1.translate, alpha)\n lerp(tmp.translate, state0.translate, state1.translate, alpha)\n lerp(tmp.skew, state0.skew, state1.skew, alpha)\n lerp(tmp.scale, state0.scale, state1.scale, alpha)\n lerp(tmp.perspective, state0.perspective, state1.perspective, alpha)\n slerp(tmp.quaternion, state0.quaternion, state1.quaternion, alpha)\n\n //and recompose into our 'out' matrix\n recompose(out, tmp.translate, tmp.scale, tmp.skew, tmp.perspective, tmp.quaternion)\n return true\n}\n\nfunction state() {\n return {\n translate: vec3(),\n scale: vec3(1),\n skew: vec3(),\n perspective: vec4(),\n quaternion: vec4()\n }\n}\n\nfunction vec3(n) {\n return [n||0,n||0,n||0]\n}\n\nfunction vec4() {\n return [0,0,0,1]\n}","/*\nInput: translation ; a 3 component vector\n scale ; a 3 component vector\n skew ; skew factors XY,XZ,YZ represented as a 3 component vector\n perspective ; a 4 component vector\n quaternion ; a 4 component vector\nOutput: matrix ; a 4x4 matrix\n\nFrom: http://www.w3.org/TR/css3-transforms/#recomposing-to-a-3d-matrix\n*/\n\nvar mat4 = {\n identity: require('gl-mat4/identity'),\n translate: require('gl-mat4/translate'),\n multiply: require('gl-mat4/multiply'),\n create: require('gl-mat4/create'),\n scale: require('gl-mat4/scale'),\n fromRotationTranslation: require('gl-mat4/fromRotationTranslation')\n}\n\nvar rotationMatrix = mat4.create()\nvar temp = mat4.create()\n\nmodule.exports = function recomposeMat4(matrix, translation, scale, skew, perspective, quaternion) {\n mat4.identity(matrix)\n\n //apply translation & rotation\n mat4.fromRotationTranslation(matrix, quaternion, translation)\n\n //apply perspective\n matrix[3] = perspective[0]\n matrix[7] = perspective[1]\n matrix[11] = perspective[2]\n matrix[15] = perspective[3]\n \n // apply skew\n // temp is a identity 4x4 matrix initially\n mat4.identity(temp)\n\n if (skew[2] !== 0) {\n temp[9] = skew[2]\n mat4.multiply(matrix, matrix, temp)\n }\n\n if (skew[1] !== 0) {\n temp[9] = 0\n temp[8] = skew[1]\n mat4.multiply(matrix, matrix, temp)\n }\n\n if (skew[0] !== 0) {\n temp[8] = 0\n temp[4] = skew[0]\n mat4.multiply(matrix, matrix, temp)\n }\n\n //apply scale\n mat4.scale(matrix, matrix, scale)\n return matrix\n}","'use strict'\n\nvar bsearch = require('binary-search-bounds')\nvar m4interp = require('mat4-interpolate')\nvar invert44 = require('gl-mat4/invert')\nvar rotateX = require('gl-mat4/rotateX')\nvar rotateY = require('gl-mat4/rotateY')\nvar rotateZ = require('gl-mat4/rotateZ')\nvar lookAt = require('gl-mat4/lookAt')\nvar translate = require('gl-mat4/translate')\nvar scale = require('gl-mat4/scale')\nvar normalize = require('gl-vec3/normalize')\n\nvar DEFAULT_CENTER = [0,0,0]\n\nmodule.exports = createMatrixCameraController\n\nfunction MatrixCameraController(initialMatrix) {\n this._components = initialMatrix.slice()\n this._time = [0]\n this.prevMatrix = initialMatrix.slice()\n this.nextMatrix = initialMatrix.slice()\n this.computedMatrix = initialMatrix.slice()\n this.computedInverse = initialMatrix.slice()\n this.computedEye = [0,0,0]\n this.computedUp = [0,0,0]\n this.computedCenter = [0,0,0]\n this.computedRadius = [0]\n this._limits = [-Infinity, Infinity]\n}\n\nvar proto = MatrixCameraController.prototype\n\nproto.recalcMatrix = function(t) {\n var time = this._time\n var tidx = bsearch.le(time, t)\n var mat = this.computedMatrix\n if(tidx < 0) {\n return\n }\n var comps = this._components\n if(tidx === time.length-1) {\n var ptr = 16*tidx\n for(var i=0; i<16; ++i) {\n mat[i] = comps[ptr++]\n }\n } else {\n var dt = (time[tidx+1] - time[tidx])\n var ptr = 16*tidx\n var prev = this.prevMatrix\n var allEqual = true\n for(var i=0; i<16; ++i) {\n prev[i] = comps[ptr++]\n }\n var next = this.nextMatrix\n for(var i=0; i<16; ++i) {\n next[i] = comps[ptr++]\n allEqual = allEqual && (prev[i] === next[i])\n }\n if(dt < 1e-6 || allEqual) {\n for(var i=0; i<16; ++i) {\n mat[i] = prev[i]\n }\n } else {\n m4interp(mat, prev, next, (t - time[tidx])/dt)\n }\n }\n\n var up = this.computedUp\n up[0] = mat[1]\n up[1] = mat[5]\n up[2] = mat[9]\n normalize(up, up)\n\n var imat = this.computedInverse\n invert44(imat, mat)\n var eye = this.computedEye\n var w = imat[15]\n eye[0] = imat[12]/w\n eye[1] = imat[13]/w\n eye[2] = imat[14]/w\n\n var center = this.computedCenter\n var radius = Math.exp(this.computedRadius[0])\n for(var i=0; i<3; ++i) {\n center[i] = eye[i] - mat[2+4*i] * radius\n }\n}\n\nproto.idle = function(t) {\n if(t < this.lastT()) {\n return\n }\n var mc = this._components\n var ptr = mc.length-16\n for(var i=0; i<16; ++i) {\n mc.push(mc[ptr++])\n }\n this._time.push(t)\n}\n\nproto.flush = function(t) {\n var idx = bsearch.gt(this._time, t) - 2\n if(idx < 0) {\n return\n }\n this._time.splice(0, idx)\n this._components.splice(0, 16*idx)\n}\n\nproto.lastT = function() {\n return this._time[this._time.length-1]\n}\n\nproto.lookAt = function(t, eye, center, up) {\n this.recalcMatrix(t)\n eye = eye || this.computedEye\n center = center || DEFAULT_CENTER\n up = up || this.computedUp\n this.setMatrix(t, lookAt(this.computedMatrix, eye, center, up))\n var d2 = 0.0\n for(var i=0; i<3; ++i) {\n d2 += Math.pow(center[i] - eye[i], 2)\n }\n d2 = Math.log(Math.sqrt(d2))\n this.computedRadius[0] = d2\n}\n\nproto.rotate = function(t, yaw, pitch, roll) {\n this.recalcMatrix(t)\n var mat = this.computedInverse\n if(yaw) rotateY(mat, mat, yaw)\n if(pitch) rotateX(mat, mat, pitch)\n if(roll) rotateZ(mat, mat, roll)\n this.setMatrix(t, invert44(this.computedMatrix, mat))\n}\n\nvar tvec = [0,0,0]\n\nproto.pan = function(t, dx, dy, dz) {\n tvec[0] = -(dx || 0.0)\n tvec[1] = -(dy || 0.0)\n tvec[2] = -(dz || 0.0)\n this.recalcMatrix(t)\n var mat = this.computedInverse\n translate(mat, mat, tvec)\n this.setMatrix(t, invert44(mat, mat))\n}\n\nproto.translate = function(t, dx, dy, dz) {\n tvec[0] = dx || 0.0\n tvec[1] = dy || 0.0\n tvec[2] = dz || 0.0\n this.recalcMatrix(t)\n var mat = this.computedMatrix\n translate(mat, mat, tvec)\n this.setMatrix(t, mat)\n}\n\nproto.setMatrix = function(t, mat) {\n if(t < this.lastT()) {\n return\n }\n this._time.push(t)\n for(var i=0; i<16; ++i) {\n this._components.push(mat[i])\n }\n}\n\nproto.setDistance = function(t, d) {\n this.computedRadius[0] = d\n}\n\nproto.setDistanceLimits = function(a,b) {\n var lim = this._limits\n lim[0] = a\n lim[1] = b\n}\n\nproto.getDistanceLimits = function(out) {\n var lim = this._limits\n if(out) {\n out[0] = lim[0]\n out[1] = lim[1]\n return out\n }\n return lim\n}\n\nfunction createMatrixCameraController(options) {\n options = options || {}\n var matrix = options.matrix || \n [1,0,0,0,\n 0,1,0,0,\n 0,0,1,0,\n 0,0,0,1]\n return new MatrixCameraController(matrix)\n}\n","'use strict'\n\nmodule.exports = mouseListen\n\nvar mouse = require('mouse-event')\n\nfunction mouseListen (element, callback) {\n if (!callback) {\n callback = element\n element = window\n }\n\n var buttonState = 0\n var x = 0\n var y = 0\n var mods = {\n shift: false,\n alt: false,\n control: false,\n meta: false\n }\n var attached = false\n\n function updateMods (ev) {\n var changed = false\n if ('altKey' in ev) {\n changed = changed || ev.altKey !== mods.alt\n mods.alt = !!ev.altKey\n }\n if ('shiftKey' in ev) {\n changed = changed || ev.shiftKey !== mods.shift\n mods.shift = !!ev.shiftKey\n }\n if ('ctrlKey' in ev) {\n changed = changed || ev.ctrlKey !== mods.control\n mods.control = !!ev.ctrlKey\n }\n if ('metaKey' in ev) {\n changed = changed || ev.metaKey !== mods.meta\n mods.meta = !!ev.metaKey\n }\n return changed\n }\n\n function handleEvent (nextButtons, ev) {\n var nextX = mouse.x(ev)\n var nextY = mouse.y(ev)\n if ('buttons' in ev) {\n nextButtons = ev.buttons | 0\n }\n if (nextButtons !== buttonState ||\n nextX !== x ||\n nextY !== y ||\n updateMods(ev)) {\n buttonState = nextButtons | 0\n x = nextX || 0\n y = nextY || 0\n callback && callback(buttonState, x, y, mods)\n }\n }\n\n function clearState (ev) {\n handleEvent(0, ev)\n }\n\n function handleBlur () {\n if (buttonState ||\n x ||\n y ||\n mods.shift ||\n mods.alt ||\n mods.meta ||\n mods.control) {\n x = y = 0\n buttonState = 0\n mods.shift = mods.alt = mods.control = mods.meta = false\n callback && callback(0, 0, 0, mods)\n }\n }\n\n function handleMods (ev) {\n if (updateMods(ev)) {\n callback && callback(buttonState, x, y, mods)\n }\n }\n\n function handleMouseMove (ev) {\n if (mouse.buttons(ev) === 0) {\n handleEvent(0, ev)\n } else {\n handleEvent(buttonState, ev)\n }\n }\n\n function handleMouseDown (ev) {\n handleEvent(buttonState | mouse.buttons(ev), ev)\n }\n\n function handleMouseUp (ev) {\n handleEvent(buttonState & ~mouse.buttons(ev), ev)\n }\n\n function attachListeners () {\n if (attached) {\n return\n }\n attached = true\n\n element.addEventListener('mousemove', handleMouseMove)\n\n element.addEventListener('mousedown', handleMouseDown)\n\n element.addEventListener('mouseup', handleMouseUp)\n\n element.addEventListener('mouseleave', clearState)\n element.addEventListener('mouseenter', clearState)\n element.addEventListener('mouseout', clearState)\n element.addEventListener('mouseover', clearState)\n\n element.addEventListener('blur', handleBlur)\n\n element.addEventListener('keyup', handleMods)\n element.addEventListener('keydown', handleMods)\n element.addEventListener('keypress', handleMods)\n\n if (element !== window) {\n window.addEventListener('blur', handleBlur)\n\n window.addEventListener('keyup', handleMods)\n window.addEventListener('keydown', handleMods)\n window.addEventListener('keypress', handleMods)\n }\n }\n\n function detachListeners () {\n if (!attached) {\n return\n }\n attached = false\n\n element.removeEventListener('mousemove', handleMouseMove)\n\n element.removeEventListener('mousedown', handleMouseDown)\n\n element.removeEventListener('mouseup', handleMouseUp)\n\n element.removeEventListener('mouseleave', clearState)\n element.removeEventListener('mouseenter', clearState)\n element.removeEventListener('mouseout', clearState)\n element.removeEventListener('mouseover', clearState)\n\n element.removeEventListener('blur', handleBlur)\n\n element.removeEventListener('keyup', handleMods)\n element.removeEventListener('keydown', handleMods)\n element.removeEventListener('keypress', handleMods)\n\n if (element !== window) {\n window.removeEventListener('blur', handleBlur)\n\n window.removeEventListener('keyup', handleMods)\n window.removeEventListener('keydown', handleMods)\n window.removeEventListener('keypress', handleMods)\n }\n }\n\n // Attach listeners\n attachListeners()\n\n var result = {\n element: element\n }\n\n Object.defineProperties(result, {\n enabled: {\n get: function () { return attached },\n set: function (f) {\n if (f) {\n attachListeners()\n } else {\n detachListeners()\n }\n },\n enumerable: true\n },\n buttons: {\n get: function () { return buttonState },\n enumerable: true\n },\n x: {\n get: function () { return x },\n enumerable: true\n },\n y: {\n get: function () { return y },\n enumerable: true\n },\n mods: {\n get: function () { return mods },\n enumerable: true\n }\n })\n\n return result\n}\n","var rootPosition = { left: 0, top: 0 }\n\nmodule.exports = mouseEventOffset\nfunction mouseEventOffset (ev, target, out) {\n target = target || ev.currentTarget || ev.srcElement\n if (!Array.isArray(out)) {\n out = [ 0, 0 ]\n }\n var cx = ev.clientX || 0\n var cy = ev.clientY || 0\n var rect = getBoundingClientOffset(target)\n out[0] = cx - rect.left\n out[1] = cy - rect.top\n return out\n}\n\nfunction getBoundingClientOffset (element) {\n if (element === window ||\n element === document ||\n element === document.body) {\n return rootPosition\n } else {\n return element.getBoundingClientRect()\n }\n}\n","'use strict'\n\nfunction mouseButtons(ev) {\n if(typeof ev === 'object') {\n if('buttons' in ev) {\n return ev.buttons\n } else if('which' in ev) {\n var b = ev.which\n if(b === 2) {\n return 4\n } else if(b === 3) {\n return 2\n } else if(b > 0) {\n return 1<<(b-1)\n }\n } else if('button' in ev) {\n var b = ev.button\n if(b === 1) {\n return 4\n } else if(b === 2) {\n return 2\n } else if(b >= 0) {\n return 1< 0) {\n var l = Math.sqrt(tr + 1.0)\n out[0] = 0.5 * (uz - fy) / l\n out[1] = 0.5 * (fx - rz) / l\n out[2] = 0.5 * (ry - uy) / l\n out[3] = 0.5 * l\n } else {\n var tf = Math.max(rx, uy, fz)\n var l = Math.sqrt(2 * tf - tr + 1.0)\n if(rx >= tf) {\n //x y z order\n out[0] = 0.5 * l\n out[1] = 0.5 * (ux + ry) / l\n out[2] = 0.5 * (fx + rz) / l\n out[3] = 0.5 * (uz - fy) / l\n } else if(uy >= tf) {\n //y z x order\n out[0] = 0.5 * (ry + ux) / l\n out[1] = 0.5 * l\n out[2] = 0.5 * (fy + uz) / l\n out[3] = 0.5 * (fx - rz) / l\n } else {\n //z x y order\n out[0] = 0.5 * (rz + fx) / l\n out[1] = 0.5 * (uz + fy) / l\n out[2] = 0.5 * l\n out[3] = 0.5 * (ry - ux) / l\n }\n }\n return out\n}","'use strict'\n\nmodule.exports = createOrbitController\n\nvar filterVector = require('filtered-vector')\nvar lookAt = require('gl-mat4/lookAt')\nvar mat4FromQuat = require('gl-mat4/fromQuat')\nvar invert44 = require('gl-mat4/invert')\nvar quatFromFrame = require('./lib/quatFromFrame')\n\nfunction len3(x,y,z) {\n return Math.sqrt(Math.pow(x,2) + Math.pow(y,2) + Math.pow(z,2))\n}\n\nfunction len4(w,x,y,z) {\n return Math.sqrt(Math.pow(w,2) + Math.pow(x,2) + Math.pow(y,2) + Math.pow(z,2))\n}\n\nfunction normalize4(out, a) {\n var ax = a[0]\n var ay = a[1]\n var az = a[2]\n var aw = a[3]\n var al = len4(ax, ay, az, aw)\n if(al > 1e-6) {\n out[0] = ax/al\n out[1] = ay/al\n out[2] = az/al\n out[3] = aw/al\n } else {\n out[0] = out[1] = out[2] = 0.0\n out[3] = 1.0\n }\n}\n\nfunction OrbitCameraController(initQuat, initCenter, initRadius) {\n this.radius = filterVector([initRadius])\n this.center = filterVector(initCenter)\n this.rotation = filterVector(initQuat)\n\n this.computedRadius = this.radius.curve(0)\n this.computedCenter = this.center.curve(0)\n this.computedRotation = this.rotation.curve(0)\n this.computedUp = [0.1,0,0]\n this.computedEye = [0.1,0,0]\n this.computedMatrix = [0.1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]\n\n this.recalcMatrix(0)\n}\n\nvar proto = OrbitCameraController.prototype\n\nproto.lastT = function() {\n return Math.max(\n this.radius.lastT(),\n this.center.lastT(),\n this.rotation.lastT())\n}\n\nproto.recalcMatrix = function(t) {\n this.radius.curve(t)\n this.center.curve(t)\n this.rotation.curve(t)\n\n var quat = this.computedRotation\n normalize4(quat, quat)\n\n var mat = this.computedMatrix\n mat4FromQuat(mat, quat)\n\n var center = this.computedCenter\n var eye = this.computedEye\n var up = this.computedUp\n var radius = Math.exp(this.computedRadius[0])\n\n eye[0] = center[0] + radius * mat[2]\n eye[1] = center[1] + radius * mat[6]\n eye[2] = center[2] + radius * mat[10]\n up[0] = mat[1]\n up[1] = mat[5]\n up[2] = mat[9]\n\n for(var i=0; i<3; ++i) {\n var rr = 0.0\n for(var j=0; j<3; ++j) {\n rr += mat[i+4*j] * eye[j]\n }\n mat[12+i] = -rr\n }\n}\n\nproto.getMatrix = function(t, result) {\n this.recalcMatrix(t)\n var m = this.computedMatrix\n if(result) {\n for(var i=0; i<16; ++i) {\n result[i] = m[i]\n }\n return result\n }\n return m\n}\n\nproto.idle = function(t) {\n this.center.idle(t)\n this.radius.idle(t)\n this.rotation.idle(t)\n}\n\nproto.flush = function(t) {\n this.center.flush(t)\n this.radius.flush(t)\n this.rotation.flush(t)\n}\n\nproto.pan = function(t, dx, dy, dz) {\n dx = dx || 0.0\n dy = dy || 0.0\n dz = dz || 0.0\n\n this.recalcMatrix(t)\n var mat = this.computedMatrix\n\n var ux = mat[1]\n var uy = mat[5]\n var uz = mat[9]\n var ul = len3(ux, uy, uz)\n ux /= ul\n uy /= ul\n uz /= ul\n\n var rx = mat[0]\n var ry = mat[4]\n var rz = mat[8]\n var ru = rx * ux + ry * uy + rz * uz\n rx -= ux * ru\n ry -= uy * ru\n rz -= uz * ru\n var rl = len3(rx, ry, rz)\n rx /= rl\n ry /= rl\n rz /= rl\n\n var fx = mat[2]\n var fy = mat[6]\n var fz = mat[10]\n var fu = fx * ux + fy * uy + fz * uz\n var fr = fx * rx + fy * ry + fz * rz\n fx -= fu * ux + fr * rx\n fy -= fu * uy + fr * ry\n fz -= fu * uz + fr * rz\n var fl = len3(fx, fy, fz)\n fx /= fl\n fy /= fl\n fz /= fl\n\n var vx = rx * dx + ux * dy\n var vy = ry * dx + uy * dy\n var vz = rz * dx + uz * dy\n\n this.center.move(t, vx, vy, vz)\n\n //Update z-component of radius\n var radius = Math.exp(this.computedRadius[0])\n radius = Math.max(1e-4, radius + dz)\n this.radius.set(t, Math.log(radius))\n}\n\nproto.rotate = function(t, dx, dy, dz) {\n this.recalcMatrix(t)\n\n dx = dx||0.0\n dy = dy||0.0\n\n var mat = this.computedMatrix\n\n var rx = mat[0]\n var ry = mat[4]\n var rz = mat[8]\n\n var ux = mat[1]\n var uy = mat[5]\n var uz = mat[9]\n\n var fx = mat[2]\n var fy = mat[6]\n var fz = mat[10]\n\n var qx = dx * rx + dy * ux\n var qy = dx * ry + dy * uy\n var qz = dx * rz + dy * uz\n\n var bx = -(fy * qz - fz * qy)\n var by = -(fz * qx - fx * qz)\n var bz = -(fx * qy - fy * qx) \n var bw = Math.sqrt(Math.max(0.0, 1.0 - Math.pow(bx,2) - Math.pow(by,2) - Math.pow(bz,2)))\n var bl = len4(bx, by, bz, bw)\n if(bl > 1e-6) {\n bx /= bl\n by /= bl\n bz /= bl\n bw /= bl\n } else {\n bx = by = bz = 0.0\n bw = 1.0\n }\n\n var rotation = this.computedRotation\n var ax = rotation[0]\n var ay = rotation[1]\n var az = rotation[2]\n var aw = rotation[3]\n\n var cx = ax*bw + aw*bx + ay*bz - az*by\n var cy = ay*bw + aw*by + az*bx - ax*bz\n var cz = az*bw + aw*bz + ax*by - ay*bx\n var cw = aw*bw - ax*bx - ay*by - az*bz\n \n //Apply roll\n if(dz) {\n bx = fx\n by = fy\n bz = fz\n var s = Math.sin(dz) / len3(bx, by, bz)\n bx *= s\n by *= s\n bz *= s\n bw = Math.cos(dx)\n cx = cx*bw + cw*bx + cy*bz - cz*by\n cy = cy*bw + cw*by + cz*bx - cx*bz\n cz = cz*bw + cw*bz + cx*by - cy*bx\n cw = cw*bw - cx*bx - cy*by - cz*bz\n }\n\n var cl = len4(cx, cy, cz, cw)\n if(cl > 1e-6) {\n cx /= cl\n cy /= cl\n cz /= cl\n cw /= cl\n } else {\n cx = cy = cz = 0.0\n cw = 1.0\n }\n\n this.rotation.set(t, cx, cy, cz, cw)\n}\n\nproto.lookAt = function(t, eye, center, up) {\n this.recalcMatrix(t)\n\n center = center || this.computedCenter\n eye = eye || this.computedEye\n up = up || this.computedUp\n\n var mat = this.computedMatrix\n lookAt(mat, eye, center, up)\n\n var rotation = this.computedRotation\n quatFromFrame(rotation,\n mat[0], mat[1], mat[2],\n mat[4], mat[5], mat[6],\n mat[8], mat[9], mat[10])\n normalize4(rotation, rotation)\n this.rotation.set(t, rotation[0], rotation[1], rotation[2], rotation[3])\n\n var fl = 0.0\n for(var i=0; i<3; ++i) {\n fl += Math.pow(center[i] - eye[i], 2)\n }\n this.radius.set(t, 0.5 * Math.log(Math.max(fl, 1e-6)))\n\n this.center.set(t, center[0], center[1], center[2])\n}\n\nproto.translate = function(t, dx, dy, dz) {\n this.center.move(t,\n dx||0.0,\n dy||0.0,\n dz||0.0)\n}\n\nproto.setMatrix = function(t, matrix) {\n\n var rotation = this.computedRotation\n quatFromFrame(rotation,\n matrix[0], matrix[1], matrix[2],\n matrix[4], matrix[5], matrix[6],\n matrix[8], matrix[9], matrix[10])\n normalize4(rotation, rotation)\n this.rotation.set(t, rotation[0], rotation[1], rotation[2], rotation[3])\n\n var mat = this.computedMatrix\n invert44(mat, matrix)\n var w = mat[15]\n if(Math.abs(w) > 1e-6) {\n var cx = mat[12]/w\n var cy = mat[13]/w\n var cz = mat[14]/w\n\n this.recalcMatrix(t) \n var r = Math.exp(this.computedRadius[0])\n this.center.set(t, cx-mat[2]*r, cy-mat[6]*r, cz-mat[10]*r)\n this.radius.idle(t)\n } else {\n this.center.idle(t)\n this.radius.idle(t)\n }\n}\n\nproto.setDistance = function(t, d) {\n if(d > 0) {\n this.radius.set(t, Math.log(d))\n }\n}\n\nproto.setDistanceLimits = function(lo, hi) {\n if(lo > 0) {\n lo = Math.log(lo)\n } else {\n lo = -Infinity \n }\n if(hi > 0) {\n hi = Math.log(hi)\n } else {\n hi = Infinity\n }\n hi = Math.max(hi, lo)\n this.radius.bounds[0][0] = lo\n this.radius.bounds[1][0] = hi\n}\n\nproto.getDistanceLimits = function(out) {\n var bounds = this.radius.bounds\n if(out) {\n out[0] = Math.exp(bounds[0][0])\n out[1] = Math.exp(bounds[1][0])\n return out\n }\n return [ Math.exp(bounds[0][0]), Math.exp(bounds[1][0]) ]\n}\n\nproto.toJSON = function() {\n this.recalcMatrix(this.lastT())\n return {\n center: this.computedCenter.slice(),\n rotation: this.computedRotation.slice(),\n distance: Math.log(this.computedRadius[0]),\n zoomMin: this.radius.bounds[0][0],\n zoomMax: this.radius.bounds[1][0]\n }\n}\n\nproto.fromJSON = function(options) {\n var t = this.lastT()\n var c = options.center\n if(c) {\n this.center.set(t, c[0], c[1], c[2])\n }\n var r = options.rotation\n if(r) {\n this.rotation.set(t, r[0], r[1], r[2], r[3])\n }\n var d = options.distance\n if(d && d > 0) {\n this.radius.set(t, Math.log(d))\n }\n this.setDistanceLimits(options.zoomMin, options.zoomMax)\n}\n\nfunction createOrbitController(options) {\n options = options || {}\n var center = options.center || [0,0,0]\n var rotation = options.rotation || [0,0,0,1]\n var radius = options.radius || 1.0\n\n center = [].slice.call(center, 0, 3)\n rotation = [].slice.call(rotation, 0, 4)\n normalize4(rotation, rotation)\n\n var result = new OrbitCameraController(\n rotation,\n center,\n Math.log(radius))\n\n result.setDistanceLimits(options.zoomMin, options.zoomMax)\n\n if('eye' in options || 'up' in options) {\n result.lookAt(0, options.eye, options.center, options.up)\n }\n\n return result\n}","module.exports = function parseUnit(str, out) {\n if (!out)\n out = [ 0, '' ]\n\n str = String(str)\n var num = parseFloat(str, 10)\n out[0] = num\n out[1] = str.match(/[\\d.\\-\\+]*\\s*(.*)/)[1] || ''\n return out\n}","module.exports = require('gl-quat/slerp')","module.exports =\n global.performance &&\n global.performance.now ? function now() {\n return performance.now()\n } : Date.now || function now() {\n return +new Date\n }\n","!function(e,t){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=t():\"function\"==typeof define&&define.amd?define(t):e.Stats=t()}(this,function(){\"use strict\";var c=function(){var n=0,l=document.createElement(\"div\");function e(e){return l.appendChild(e.dom),e}function t(e){for(var t=0;t, time: number) {\r\n prog.setEyeRefUp(camera.controls.eye, camera.controls.center, camera.controls.up);\r\n prog.setTime(time);\r\n\r\n for (let drawable of drawables) {\r\n prog.draw(drawable);\r\n }\r\n }\r\n};\r\n\r\nexport default OpenGLRenderer;\r\n","import {vec2, vec3, vec4, mat4} from 'gl-matrix';\r\nimport Drawable from './Drawable';\r\nimport {gl} from '../../globals';\r\n\r\nvar activeProgram: WebGLProgram = null;\r\n\r\nexport class Shader {\r\n shader: WebGLShader;\r\n\r\n constructor(type: number, source: string) {\r\n this.shader = gl.createShader(type);\r\n gl.shaderSource(this.shader, source);\r\n gl.compileShader(this.shader);\r\n\r\n if (!gl.getShaderParameter(this.shader, gl.COMPILE_STATUS)) {\r\n throw gl.getShaderInfoLog(this.shader);\r\n }\r\n }\r\n};\r\n\r\nclass ShaderProgram {\r\n prog: WebGLProgram;\r\n\r\n attrPos: number;\r\n attrNor: number;\r\n\r\n unifRef: WebGLUniformLocation;\r\n unifEye: WebGLUniformLocation;\r\n unifUp: WebGLUniformLocation;\r\n unifDimensions: WebGLUniformLocation;\r\n unifTime: WebGLUniformLocation;\r\n\r\n constructor(shaders: Array) {\r\n this.prog = gl.createProgram();\r\n\r\n for (let shader of shaders) {\r\n gl.attachShader(this.prog, shader.shader);\r\n }\r\n gl.linkProgram(this.prog);\r\n if (!gl.getProgramParameter(this.prog, gl.LINK_STATUS)) {\r\n throw gl.getProgramInfoLog(this.prog);\r\n }\r\n\r\n this.attrPos = gl.getAttribLocation(this.prog, \"vs_Pos\");\r\n this.unifEye = gl.getUniformLocation(this.prog, \"u_Eye\");\r\n this.unifRef = gl.getUniformLocation(this.prog, \"u_Ref\");\r\n this.unifUp = gl.getUniformLocation(this.prog, \"u_Up\");\r\n this.unifDimensions = gl.getUniformLocation(this.prog, \"u_Dimensions\");\r\n this.unifTime = gl.getUniformLocation(this.prog, \"u_Time\");\r\n }\r\n\r\n use() {\r\n if (activeProgram !== this.prog) {\r\n gl.useProgram(this.prog);\r\n activeProgram = this.prog;\r\n }\r\n }\r\n\r\n setEyeRefUp(eye: vec3, ref: vec3, up: vec3) {\r\n this.use();\r\n if(this.unifEye !== -1) {\r\n gl.uniform3f(this.unifEye, eye[0], eye[1], eye[2]);\r\n }\r\n if(this.unifRef !== -1) {\r\n gl.uniform3f(this.unifRef, ref[0], ref[1], ref[2]);\r\n }\r\n if(this.unifUp !== -1) {\r\n gl.uniform3f(this.unifUp, up[0], up[1], up[2]);\r\n }\r\n }\r\n\r\n setDimensions(width: number, height: number) {\r\n this.use();\r\n if(this.unifDimensions !== -1) {\r\n gl.uniform2f(this.unifDimensions, width, height);\r\n }\r\n }\r\n\r\n setTime(t: number) {\r\n this.use();\r\n if(this.unifTime !== -1) {\r\n gl.uniform1f(this.unifTime, t);\r\n }\r\n }\r\n\r\n draw(d: Drawable) {\r\n this.use();\r\n\r\n if (this.attrPos != -1 && d.bindPos()) {\r\n gl.enableVertexAttribArray(this.attrPos);\r\n gl.vertexAttribPointer(this.attrPos, 4, gl.FLOAT, false, 0, 0);\r\n }\r\n\r\n d.bindIdx();\r\n gl.drawElements(d.drawMode(), d.elemCount(), gl.UNSIGNED_INT, 0);\r\n\r\n if (this.attrPos != -1) gl.disableVertexAttribArray(this.attrPos);\r\n }\r\n};\r\n\r\nexport default ShaderProgram;\r\n","'use strict'\n\nmodule.exports = createTurntableController\n\nvar filterVector = require('filtered-vector')\nvar invert44 = require('gl-mat4/invert')\nvar rotateM = require('gl-mat4/rotate')\nvar cross = require('gl-vec3/cross')\nvar normalize3 = require('gl-vec3/normalize')\nvar dot3 = require('gl-vec3/dot')\n\nfunction len3(x, y, z) {\n return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2))\n}\n\nfunction clamp1(x) {\n return Math.min(1.0, Math.max(-1.0, x))\n}\n\nfunction findOrthoPair(v) {\n var vx = Math.abs(v[0])\n var vy = Math.abs(v[1])\n var vz = Math.abs(v[2])\n\n var u = [0,0,0]\n if(vx > Math.max(vy, vz)) {\n u[2] = 1\n } else if(vy > Math.max(vx, vz)) {\n u[0] = 1\n } else {\n u[1] = 1\n }\n\n var vv = 0\n var uv = 0\n for(var i=0; i<3; ++i ) {\n vv += v[i] * v[i]\n uv += u[i] * v[i]\n }\n for(var i=0; i<3; ++i) {\n u[i] -= (uv / vv) * v[i]\n }\n normalize3(u, u)\n return u\n}\n\nfunction TurntableController(zoomMin, zoomMax, center, up, right, radius, theta, phi) {\n this.center = filterVector(center)\n this.up = filterVector(up)\n this.right = filterVector(right)\n this.radius = filterVector([radius])\n this.angle = filterVector([theta, phi])\n this.angle.bounds = [[-Infinity,-Math.PI/2], [Infinity,Math.PI/2]]\n this.setDistanceLimits(zoomMin, zoomMax)\n\n this.computedCenter = this.center.curve(0)\n this.computedUp = this.up.curve(0)\n this.computedRight = this.right.curve(0)\n this.computedRadius = this.radius.curve(0)\n this.computedAngle = this.angle.curve(0)\n this.computedToward = [0,0,0]\n this.computedEye = [0,0,0]\n this.computedMatrix = new Array(16)\n for(var i=0; i<16; ++i) {\n this.computedMatrix[i] = 0.5\n }\n\n this.recalcMatrix(0)\n}\n\nvar proto = TurntableController.prototype\n\nproto.setDistanceLimits = function(minDist, maxDist) {\n if(minDist > 0) {\n minDist = Math.log(minDist)\n } else {\n minDist = -Infinity\n }\n if(maxDist > 0) {\n maxDist = Math.log(maxDist)\n } else {\n maxDist = Infinity\n }\n maxDist = Math.max(maxDist, minDist)\n this.radius.bounds[0][0] = minDist\n this.radius.bounds[1][0] = maxDist\n}\n\nproto.getDistanceLimits = function(out) {\n var bounds = this.radius.bounds[0]\n if(out) {\n out[0] = Math.exp(bounds[0][0])\n out[1] = Math.exp(bounds[1][0])\n return out\n }\n return [ Math.exp(bounds[0][0]), Math.exp(bounds[1][0]) ]\n}\n\nproto.recalcMatrix = function(t) {\n //Recompute curves\n this.center.curve(t)\n this.up.curve(t)\n this.right.curve(t)\n this.radius.curve(t)\n this.angle.curve(t)\n\n //Compute frame for camera matrix\n var up = this.computedUp\n var right = this.computedRight\n var uu = 0.0\n var ur = 0.0\n for(var i=0; i<3; ++i) {\n ur += up[i] * right[i]\n uu += up[i] * up[i]\n }\n var ul = Math.sqrt(uu)\n var rr = 0.0\n for(var i=0; i<3; ++i) {\n right[i] -= up[i] * ur / uu\n rr += right[i] * right[i]\n up[i] /= ul\n }\n var rl = Math.sqrt(rr)\n for(var i=0; i<3; ++i) {\n right[i] /= rl\n }\n\n //Compute toward vector\n var toward = this.computedToward\n cross(toward, up, right)\n normalize3(toward, toward)\n\n //Compute angular parameters\n var radius = Math.exp(this.computedRadius[0])\n var theta = this.computedAngle[0]\n var phi = this.computedAngle[1]\n\n var ctheta = Math.cos(theta)\n var stheta = Math.sin(theta)\n var cphi = Math.cos(phi)\n var sphi = Math.sin(phi)\n\n var center = this.computedCenter\n\n var wx = ctheta * cphi \n var wy = stheta * cphi\n var wz = sphi\n\n var sx = -ctheta * sphi\n var sy = -stheta * sphi\n var sz = cphi\n\n var eye = this.computedEye\n var mat = this.computedMatrix\n for(var i=0; i<3; ++i) {\n var x = wx * right[i] + wy * toward[i] + wz * up[i]\n mat[4*i+1] = sx * right[i] + sy * toward[i] + sz * up[i]\n mat[4*i+2] = x\n mat[4*i+3] = 0.0\n }\n\n var ax = mat[1]\n var ay = mat[5]\n var az = mat[9]\n var bx = mat[2]\n var by = mat[6]\n var bz = mat[10]\n var cx = ay * bz - az * by\n var cy = az * bx - ax * bz\n var cz = ax * by - ay * bx\n var cl = len3(cx, cy, cz)\n cx /= cl\n cy /= cl\n cz /= cl\n mat[0] = cx\n mat[4] = cy\n mat[8] = cz\n\n for(var i=0; i<3; ++i) {\n eye[i] = center[i] + mat[2+4*i]*radius\n }\n\n for(var i=0; i<3; ++i) {\n var rr = 0.0\n for(var j=0; j<3; ++j) {\n rr += mat[i+4*j] * eye[j]\n }\n mat[12+i] = -rr\n }\n mat[15] = 1.0\n}\n\nproto.getMatrix = function(t, result) {\n this.recalcMatrix(t)\n var mat = this.computedMatrix\n if(result) {\n for(var i=0; i<16; ++i) {\n result[i] = mat[i]\n }\n return result\n }\n return mat\n}\n\nvar zAxis = [0,0,0]\nproto.rotate = function(t, dtheta, dphi, droll) {\n this.angle.move(t, dtheta, dphi)\n if(droll) {\n this.recalcMatrix(t)\n\n var mat = this.computedMatrix\n zAxis[0] = mat[2]\n zAxis[1] = mat[6]\n zAxis[2] = mat[10]\n\n var up = this.computedUp\n var right = this.computedRight\n var toward = this.computedToward\n\n for(var i=0; i<3; ++i) {\n mat[4*i] = up[i]\n mat[4*i+1] = right[i]\n mat[4*i+2] = toward[i]\n }\n rotateM(mat, mat, droll, zAxis)\n for(var i=0; i<3; ++i) {\n up[i] = mat[4*i]\n right[i] = mat[4*i+1]\n }\n\n this.up.set(t, up[0], up[1], up[2])\n this.right.set(t, right[0], right[1], right[2])\n }\n}\n\nproto.pan = function(t, dx, dy, dz) {\n dx = dx || 0.0\n dy = dy || 0.0\n dz = dz || 0.0\n\n this.recalcMatrix(t)\n var mat = this.computedMatrix\n\n var dist = Math.exp(this.computedRadius[0])\n\n var ux = mat[1]\n var uy = mat[5]\n var uz = mat[9]\n var ul = len3(ux, uy, uz)\n ux /= ul\n uy /= ul\n uz /= ul\n\n var rx = mat[0]\n var ry = mat[4]\n var rz = mat[8]\n var ru = rx * ux + ry * uy + rz * uz\n rx -= ux * ru\n ry -= uy * ru\n rz -= uz * ru\n var rl = len3(rx, ry, rz)\n rx /= rl\n ry /= rl\n rz /= rl\n\n var vx = rx * dx + ux * dy\n var vy = ry * dx + uy * dy\n var vz = rz * dx + uz * dy\n this.center.move(t, vx, vy, vz)\n\n //Update z-component of radius\n var radius = Math.exp(this.computedRadius[0])\n radius = Math.max(1e-4, radius + dz)\n this.radius.set(t, Math.log(radius))\n}\n\nproto.translate = function(t, dx, dy, dz) {\n this.center.move(t,\n dx||0.0,\n dy||0.0,\n dz||0.0)\n}\n\n//Recenters the coordinate axes\nproto.setMatrix = function(t, mat, axes, noSnap) {\n \n //Get the axes for tare\n var ushift = 1\n if(typeof axes === 'number') {\n ushift = (axes)|0\n } \n if(ushift < 0 || ushift > 3) {\n ushift = 1\n }\n var vshift = (ushift + 2) % 3\n var fshift = (ushift + 1) % 3\n\n //Recompute state for new t value\n if(!mat) { \n this.recalcMatrix(t)\n mat = this.computedMatrix\n }\n\n //Get right and up vectors\n var ux = mat[ushift]\n var uy = mat[ushift+4]\n var uz = mat[ushift+8]\n if(!noSnap) {\n var ul = len3(ux, uy, uz)\n ux /= ul\n uy /= ul\n uz /= ul\n } else {\n var ax = Math.abs(ux)\n var ay = Math.abs(uy)\n var az = Math.abs(uz)\n var am = Math.max(ax,ay,az)\n if(ax === am) {\n ux = (ux < 0) ? -1 : 1\n uy = uz = 0\n } else if(az === am) {\n uz = (uz < 0) ? -1 : 1\n ux = uy = 0\n } else {\n uy = (uy < 0) ? -1 : 1\n ux = uz = 0\n }\n }\n\n var rx = mat[vshift]\n var ry = mat[vshift+4]\n var rz = mat[vshift+8]\n var ru = rx * ux + ry * uy + rz * uz\n rx -= ux * ru\n ry -= uy * ru\n rz -= uz * ru\n var rl = len3(rx, ry, rz)\n rx /= rl\n ry /= rl\n rz /= rl\n \n var fx = uy * rz - uz * ry\n var fy = uz * rx - ux * rz\n var fz = ux * ry - uy * rx\n var fl = len3(fx, fy, fz)\n fx /= fl\n fy /= fl\n fz /= fl\n\n this.center.jump(t, ex, ey, ez)\n this.radius.idle(t)\n this.up.jump(t, ux, uy, uz)\n this.right.jump(t, rx, ry, rz)\n\n var phi, theta\n if(ushift === 2) {\n var cx = mat[1]\n var cy = mat[5]\n var cz = mat[9]\n var cr = cx * rx + cy * ry + cz * rz\n var cf = cx * fx + cy * fy + cz * fz\n if(tu < 0) {\n phi = -Math.PI/2\n } else {\n phi = Math.PI/2\n }\n theta = Math.atan2(cf, cr)\n } else {\n var tx = mat[2]\n var ty = mat[6]\n var tz = mat[10]\n var tu = tx * ux + ty * uy + tz * uz\n var tr = tx * rx + ty * ry + tz * rz\n var tf = tx * fx + ty * fy + tz * fz\n\n phi = Math.asin(clamp1(tu))\n theta = Math.atan2(tf, tr)\n }\n\n this.angle.jump(t, theta, phi)\n\n this.recalcMatrix(t)\n var dx = mat[2]\n var dy = mat[6]\n var dz = mat[10]\n\n var imat = this.computedMatrix\n invert44(imat, mat)\n var w = imat[15]\n var ex = imat[12] / w\n var ey = imat[13] / w\n var ez = imat[14] / w\n\n var gs = Math.exp(this.computedRadius[0])\n this.center.jump(t, ex-dx*gs, ey-dy*gs, ez-dz*gs)\n}\n\nproto.lastT = function() {\n return Math.max(\n this.center.lastT(),\n this.up.lastT(),\n this.right.lastT(),\n this.radius.lastT(),\n this.angle.lastT())\n}\n\nproto.idle = function(t) {\n this.center.idle(t)\n this.up.idle(t)\n this.right.idle(t)\n this.radius.idle(t)\n this.angle.idle(t)\n}\n\nproto.flush = function(t) {\n this.center.flush(t)\n this.up.flush(t)\n this.right.flush(t)\n this.radius.flush(t)\n this.angle.flush(t)\n}\n\nproto.setDistance = function(t, d) {\n if(d > 0) {\n this.radius.set(t, Math.log(d))\n }\n}\n\nproto.lookAt = function(t, eye, center, up) {\n this.recalcMatrix(t)\n\n eye = eye || this.computedEye\n center = center || this.computedCenter\n up = up || this.computedUp\n\n var ux = up[0]\n var uy = up[1]\n var uz = up[2]\n var ul = len3(ux, uy, uz)\n if(ul < 1e-6) {\n return\n }\n ux /= ul\n uy /= ul\n uz /= ul\n\n var tx = eye[0] - center[0]\n var ty = eye[1] - center[1]\n var tz = eye[2] - center[2]\n var tl = len3(tx, ty, tz)\n if(tl < 1e-6) {\n return\n }\n tx /= tl\n ty /= tl\n tz /= tl\n\n var right = this.computedRight\n var rx = right[0]\n var ry = right[1]\n var rz = right[2]\n var ru = ux*rx + uy*ry + uz*rz\n rx -= ru * ux\n ry -= ru * uy\n rz -= ru * uz\n var rl = len3(rx, ry, rz)\n\n if(rl < 0.01) {\n rx = uy * tz - uz * ty\n ry = uz * tx - ux * tz\n rz = ux * ty - uy * tx\n rl = len3(rx, ry, rz)\n if(rl < 1e-6) {\n return\n }\n }\n rx /= rl\n ry /= rl\n rz /= rl\n\n this.up.set(t, ux, uy, uz)\n this.right.set(t, rx, ry, rz)\n this.center.set(t, center[0], center[1], center[2])\n this.radius.set(t, Math.log(tl))\n\n var fx = uy * rz - uz * ry\n var fy = uz * rx - ux * rz\n var fz = ux * ry - uy * rx\n var fl = len3(fx, fy, fz)\n fx /= fl\n fy /= fl\n fz /= fl\n\n var tu = ux*tx + uy*ty + uz*tz\n var tr = rx*tx + ry*ty + rz*tz\n var tf = fx*tx + fy*ty + fz*tz\n\n var phi = Math.asin(clamp1(tu))\n var theta = Math.atan2(tf, tr)\n\n var angleState = this.angle._state\n var lastTheta = angleState[angleState.length-1]\n var lastPhi = angleState[angleState.length-2]\n lastTheta = lastTheta % (2.0 * Math.PI)\n var dp = Math.abs(lastTheta + 2.0 * Math.PI - theta)\n var d0 = Math.abs(lastTheta - theta)\n var dn = Math.abs(lastTheta - 2.0 * Math.PI - theta)\n if(dp < d0) {\n lastTheta += 2.0 * Math.PI\n }\n if(dn < d0) {\n lastTheta -= 2.0 * Math.PI\n }\n\n this.angle.jump(this.angle.lastT(), lastTheta, lastPhi)\n this.angle.set(t, theta, phi)\n}\n\nfunction createTurntableController(options) {\n options = options || {}\n\n var center = options.center || [0,0,0]\n var up = options.up || [0,1,0]\n var right = options.right || findOrthoPair(up)\n var radius = options.radius || 1.0\n var theta = options.theta || 0.0\n var phi = options.phi || 0.0\n\n center = [].slice.call(center, 0, 3)\n\n up = [].slice.call(up, 0, 3)\n normalize3(up, up)\n\n right = [].slice.call(right, 0, 3)\n normalize3(right, right)\n\n if('eye' in options) {\n var eye = options.eye\n var toward = [\n eye[0]-center[0],\n eye[1]-center[1],\n eye[2]-center[2]\n ]\n cross(right, toward, up)\n if(len3(right[0], right[1], right[2]) < 1e-6) {\n right = findOrthoPair(up)\n } else {\n normalize3(right, right)\n }\n\n radius = len3(toward[0], toward[1], toward[2])\n\n var ut = dot3(up, toward) / radius\n var rt = dot3(right, toward) / radius\n phi = Math.acos(ut)\n theta = Math.acos(rt)\n }\n\n //Use logarithmic coordinates for radius\n radius = Math.log(radius)\n\n //Return the controller\n return new TurntableController(\n options.zoomMin,\n options.zoomMax,\n center,\n up,\n right,\n radius,\n theta,\n phi)\n}","module.exports = \"#version 300 es\\r\\nprecision highp float;\\r\\n\\r\\nuniform vec3 u_Eye, u_Ref, u_Up;\\r\\nuniform vec2 u_Dimensions;\\r\\nuniform float u_Time;\\r\\n\\r\\nin vec2 fs_Pos;\\r\\nout vec4 out_Col;\\r\\n\\r\\nvoid main() {\\r\\n out_Col = vec4(0.5 * (fs_Pos + vec2(1.0)), 0.5 * (sin(u_Time * 3.14159 * 0.01) + 1.0), 1.0);\\r\\n}\\r\\n\"","module.exports = \"#version 300 es\\r\\nprecision highp float;\\r\\n\\r\\n// The vertex shader used to render the background of the scene\\r\\n\\r\\nin vec4 vs_Pos;\\r\\nout vec2 fs_Pos;\\r\\n\\r\\nvoid main() {\\r\\n fs_Pos = vs_Pos.xy;\\r\\n gl_Position = vs_Pos;\\r\\n}\\r\\n\"","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import {vec2, vec3} from 'gl-matrix';\r\nimport * as Stats from 'stats-js';\r\nimport * as DAT from 'dat-gui';\r\nimport Square from './geometry/Square';\r\nimport OpenGLRenderer from './rendering/gl/OpenGLRenderer';\r\nimport Camera from './Camera';\r\nimport {setGL} from './globals';\r\nimport ShaderProgram, {Shader} from './rendering/gl/ShaderProgram';\r\n\r\n// Define an object with application parameters and button callbacks\r\n// This will be referred to by dat.GUI's functions that add GUI elements.\r\nconst controls = {\r\n tesselations: 5,\r\n 'Load Scene': loadScene, // A function pointer, essentially\r\n};\r\n\r\nlet square: Square;\r\nlet time: number = 0;\r\n\r\nfunction loadScene() {\r\n square = new Square(vec3.fromValues(0, 0, 0));\r\n square.create();\r\n // time = 0;\r\n}\r\n\r\nfunction main() {\r\n window.addEventListener('keypress', function (e) {\r\n // console.log(e.key);\r\n switch(e.key) {\r\n // Use this if you wish\r\n }\r\n }, false);\r\n\r\n window.addEventListener('keyup', function (e) {\r\n switch(e.key) {\r\n // Use this if you wish\r\n }\r\n }, false);\r\n\r\n // Initial display for framerate\r\n const stats = Stats();\r\n stats.setMode(0);\r\n stats.domElement.style.position = 'absolute';\r\n stats.domElement.style.left = '0px';\r\n stats.domElement.style.top = '0px';\r\n document.body.appendChild(stats.domElement);\r\n\r\n // Add controls to the gui\r\n const gui = new DAT.GUI();\r\n\r\n // get canvas and webgl context\r\n const canvas = document.getElementById('canvas');\r\n const gl = canvas.getContext('webgl2');\r\n if (!gl) {\r\n alert('WebGL 2 not supported!');\r\n }\r\n // `setGL` is a function imported above which sets the value of `gl` in the `globals.ts` module.\r\n // Later, we can import `gl` from `globals.ts` to access it\r\n setGL(gl);\r\n\r\n // Initial call to load scene\r\n loadScene();\r\n\r\n const camera = new Camera(vec3.fromValues(0, 0, -10), vec3.fromValues(0, 0, 0));\r\n\r\n const renderer = new OpenGLRenderer(canvas);\r\n renderer.setClearColor(164.0 / 255.0, 233.0 / 255.0, 1.0, 1);\r\n gl.enable(gl.DEPTH_TEST);\r\n\r\n const flat = new ShaderProgram([\r\n new Shader(gl.VERTEX_SHADER, require('./shaders/flat-vert.glsl')),\r\n new Shader(gl.FRAGMENT_SHADER, require('./shaders/flat-frag.glsl')),\r\n ]);\r\n\r\n function processKeyPresses() {\r\n // Use this if you wish\r\n }\r\n\r\n // This function will be called every frame\r\n function tick() {\r\n camera.update();\r\n stats.begin();\r\n gl.viewport(0, 0, window.innerWidth, window.innerHeight);\r\n renderer.clear();\r\n processKeyPresses();\r\n renderer.render(camera, flat, [\r\n square,\r\n ], time);\r\n time++;\r\n stats.end();\r\n\r\n // Tell the browser to call `tick` again whenever it renders a new frame\r\n requestAnimationFrame(tick);\r\n }\r\n\r\n window.addEventListener('resize', function() {\r\n renderer.setSize(window.innerWidth, window.innerHeight);\r\n camera.setAspectRatio(window.innerWidth / window.innerHeight);\r\n camera.updateProjectionMatrix();\r\n flat.setDimensions(window.innerWidth, window.innerHeight);\r\n }, false);\r\n\r\n renderer.setSize(window.innerWidth, window.innerHeight);\r\n camera.setAspectRatio(window.innerWidth / window.innerHeight);\r\n camera.updateProjectionMatrix();\r\n flat.setDimensions(window.innerWidth, window.innerHeight);\r\n\r\n // Start the render loop\r\n tick();\r\n}\r\n\r\nmain();\r\n"],"names":[],"sourceRoot":""}
\ No newline at end of file
+{"version":3,"file":"bundle.js","mappings":";;;;;;;;;;AAAY;AACZ;AACA;AACA;AACA,kBAAkB,mBAAO,CAAC,sDAAW;AACrC,kBAAkB,mBAAO,CAAC,+CAAS;AACnC,kBAAkB,mBAAO,CAAC,iEAAc;AACxC,kBAAkB,mBAAO,CAAC,wDAAa;AACvC,kBAAkB,mBAAO,CAAC,sEAAoB;AAC9C,kBAAkB,mBAAO,CAAC,sEAAoB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,MAAM;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG,gBAAgB,gBAAgB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA,GAAG,gBAAgB,gBAAgB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA,GAAG,gBAAgB,gBAAgB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;;;;;;;;;;;AC3OY;;AAEZ;;AAEA,sBAAsB,mBAAO,CAAC,4FAA6B;AAC3D,sBAAsB,mBAAO,CAAC,gFAAyB;AACvD,sBAAsB,mBAAO,CAAC,mFAA0B;;AAExD;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA;AACA;AACA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA;AACA;AACA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA;AACA;AACA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA;AACA;AACA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA;AACA;AACA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA;AACA;AACA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA;AACA;AACA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA;AACA;AACA;AACA,kBAAkB,eAAe;AACjC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;;;;;;;;;;;AC1JY;;AAEZ;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,OAAO,YAAY,OAAO;AAC5C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO,YAAY,OAAO;AAC3C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAO,YAAY,OAAO;AAC3C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,OAAO,YAAY,OAAO;AAC5C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB;AACnB,kBAAkB,YAAY,OAAO;AACrC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gCAAgC,+BAA+B;AAC/D,gCAAgC,+BAA+B;AAC/D,gCAAgC,+BAA+B;AAC/D,gCAAgC,+BAA+B;AAC/D,gCAAgC;AAChC;;;;;;;;;;;;ACnEY;;AAEZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,MAAM;AACjC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,MAAM;AACjC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,yBAAyB;;;;;;;;;;;ACtCb;;AAEZ;;AAEA,mBAAmB,mBAAO,CAAC,8DAAe;AAC1C,cAAc,mBAAO,CAAC,kFAAsB;;AAE5C;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe,kBAAkB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA,IAAI;AACJ;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,KAAK;AACxB;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,eAAe,KAAK;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,KAAK;AACxB;AACA;AACA,MAAM;AACN;AACA,mBAAmB,KAAK;AACxB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,8BAA8B,MAAM;AACpC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,KAAK;AACpB,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA;AACA,eAAe,KAAK;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,KAAK;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,KAAK;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,KAAK;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,KAAK;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;AClSA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AC3BA;;AAEA;AACA;AACA;AACA,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AC1BA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;;AC7BA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;;;AC9CA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;ACpDA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AC1BA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;;;ACtDA,eAAe,mBAAO,CAAC,sDAAY;;AAEnC;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;;;ACzFA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,eAAe,WAAW,WAAW;AACrC;AACA;AACA;AACA;;AAEA,eAAe,WAAW,YAAY;AACtC;AACA;AACA;AACA;;AAEA,gBAAgB,YAAY,YAAY;AACxC;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;ACzCA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,gBAAgB,YAAY,YAAY;AACxC,gBAAgB,YAAY,YAAY;AACxC,gBAAgB,YAAY,aAAa;;AAEzC;AACA,yBAAyB,yBAAyB;AAClD,6BAA6B,qBAAqB;AAClD,6BAA6B,yBAAyB;;AAEtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AC/DA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AC3CA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AC3CA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AC3CA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AC9BA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN,oBAAoB,YAAY,YAAY;AAC5C,oBAAoB,YAAY,YAAY;AAC5C,oBAAoB,YAAY,aAAa;;AAE7C,sBAAsB,cAAc,cAAc;AAClD,sBAAsB,cAAc,cAAc;AAClD,sBAAsB,cAAc,eAAe;;AAEnD;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;;;ACrCA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;AChDA;AACA;AACA;AACA;AACA;AACO;AACA;AACA;AACP;AACA;AACA;AACA,WAAW,4CAA4C;AACvD;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa,SAAS;AACtB;;AAEO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACjDwC;AACxC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,MAAM;AACnB;;AAEO;AACP,gBAAgB,kDAAmB;;AAEnC,MAAM,kDAAmB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP,gBAAgB,kDAAmB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP,gBAAgB,kDAAmB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;;AAEnC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;;AAEnC;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;;AAEnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY,+CAAgB;AAC5B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;;AAEf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;;AAEvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;;AAGJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;;AAGJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;;;AAGJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;;AAEA,YAAY,+CAAgB;AAC5B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA,yBAAyB;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA,yBAAyB;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA,yBAAyB;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,eAAe;AAC1B,aAAa,MAAM;AACnB;;AAEO;AACP,wBAAwB,kDAAmB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD;;AAEzD;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,MAAM;AAClB,YAAY,cAAc;AAC1B,YAAY,MAAM;AAClB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,MAAM;AAClB,YAAY,cAAc;AAC1B,YAAY,MAAM;AAClB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,YAAY,MAAM;AAClB;;AAEO;AACP,oBAAoB,kDAAmB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB;AACA,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iCAAiC,+CAAgB,+BAA+B,+CAAgB,+BAA+B,+CAAgB;AAC/I;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,SAAS;AACtB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,SAAS;AACtB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,+CAAgB,qEAAqE,+CAAgB,qEAAqE,+CAAgB,qEAAqE,+CAAgB,qEAAqE,+CAAgB,qEAAqE,+CAAgB,qEAAqE,+CAAgB,qEAAqE,+CAAgB,qEAAqE,+CAAgB,qEAAqE,+CAAgB,uEAAuE,+CAAgB,yEAAyE,+CAAgB,yEAAyE,+CAAgB,yEAAyE,+CAAgB,yEAAyE,+CAAgB,yEAAyE,+CAAgB;AAC/zC;AACA;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA,cAAc;AACd;AACA;;AAEO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACr3DiC;AACxC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,MAAM;AACnB;;AAEO;AACP,gBAAgB,kDAAmB;;AAEnC,MAAM,kDAAmB;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP,gBAAgB,kDAAmB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP,gBAAgB,kDAAmB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA,UAAU,8CAAe;AACzB,UAAU,8CAAe;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;;AAEA;AACA;AACA,6BAA6B;;AAE7B;AACA;AACA,kCAAkC;;AAElC;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA,cAAc;;AAEd;AACA;AACA,sBAAsB;;AAEtB;AACA;AACA,sDAAsD;;AAEtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA,cAAc;;AAEd;AACA;AACA,sBAAsB;;AAEtB;AACA;AACA,sDAAsD;;AAEtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA,cAAc;;AAEd;AACA;AACA,sBAAsB;;AAEtB;AACA;AACA,eAAe;;AAEf;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,SAAS;AACtB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,SAAS;AACtB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,+CAAgB,qEAAqE,+CAAgB,qEAAqE,+CAAgB;AACxN;AACA;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,UAAU;AACrB,WAAW,QAAQ;AACnB,aAAa,OAAO;AACpB;AACA;;AAEO;AACP;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA;;AAEA,qBAAqB,OAAO;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AClxBuC;AACxC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,MAAM;AACnB;;AAEO;AACP,gBAAgB,kDAAmB;;AAEnC,MAAM,kDAAmB;AACzB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP,gBAAgB,kDAAmB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP,gBAAgB,kDAAmB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;;AAEO;AACP,wBAAwB;AACxB;AACA;;AAEA;AACA;;AAEA;AACA,SAAS,8CAAe;AACxB,SAAS,8CAAe;AACxB;AACA,IAAI;;AAEJ;AACA,SAAS,8CAAe;AACxB,SAAS,8CAAe;AACxB;AACA,IAAI;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;AACA,sCAAsC;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,aAAa,QAAQ;AACrB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,SAAS;AACtB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,cAAc;AACzB,aAAa,SAAS;AACtB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,+CAAgB,qEAAqE,+CAAgB,qEAAqE,+CAAgB,qEAAqE,+CAAgB;AAC7S;AACA;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA,cAAc;AACd;AACA;;AAEO;AACP;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,UAAU;AACrB,WAAW,QAAQ;AACnB,aAAa,OAAO;AACpB;AACA;;AAEO;AACP;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA;;AAEA,qBAAqB,OAAO;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;;;;;;;;;ACtpBD;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;AClDA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;;;;;;;;AClBA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;;;;;;;;;;ACXA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;ACbA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,QAAQ;AACnB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;ACnBA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACtBY;AACZ;AACA,gBAAgB,mBAAO,CAAC,uDAAY;AACpC;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACvBA;;;;;;;;;;ACAA;AACA;AACA,sBAAsB;AACtB,sBAAsB;AACtB,sBAAsB;AACtB,sBAAsB;AACtB,sBAAsB;AACtB,sBAAsB;AACtB;;;AAGA;AACA;AACA;AACA;AACA;;AAEA,gBAAgB,mBAAO,CAAC,+DAAa;;AAErC,aAAa,mBAAO,CAAC,wDAAgB;AACrC,YAAY,mBAAO,CAAC,sDAAe;AACnC,kBAAkB,mBAAO,CAAC,kEAAqB;AAC/C,aAAa,mBAAO,CAAC,wDAAgB;AACrC,gBAAgB,mBAAO,CAAC,8DAAmB;AAC3C;AACA,YAAY,mBAAO,CAAC,wDAAgB;AACpC,eAAe,mBAAO,CAAC,8DAAmB;AAC1C,SAAS,mBAAO,CAAC,kDAAa;AAC9B,WAAW,mBAAO,CAAC,sDAAe;AAClC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;;;;;;;;AClLA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,MAAM;AACxB;AACA;AACA;;;;;;;;;;ACTA,WAAW,mBAAO,CAAC,oDAAc;;AAEjC,gBAAgB,mBAAO,CAAC,8DAAgB;AACxC,gBAAgB,mBAAO,CAAC,8DAAgB;AACxC,kBAAkB,mBAAO,CAAC,kEAAqB;AAC/C,YAAY,mBAAO,CAAC,sDAAY;;AAEhC;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;;ACnDA;AACA,sBAAsB;AACtB,sBAAsB;AACtB,sBAAsB;AACtB,sBAAsB;AACtB,sBAAsB;AACtB,sBAAsB;;AAEtB;AACA;;AAEA;AACA,cAAc,mBAAO,CAAC,4DAAkB;AACxC,eAAe,mBAAO,CAAC,8DAAmB;AAC1C,cAAc,mBAAO,CAAC,4DAAkB;AACxC,YAAY,mBAAO,CAAC,wDAAgB;AACpC,WAAW,mBAAO,CAAC,sDAAe;AAClC,6BAA6B,mBAAO,CAAC,0FAAiC;AACtE;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;;;;;;;;;AC3DY;;AAEZ,gBAAgB,mBAAO,CAAC,kFAAsB;AAC9C,gBAAgB,mBAAO,CAAC,kEAAkB;AAC1C,gBAAgB,mBAAO,CAAC,wDAAgB;AACxC,gBAAgB,mBAAO,CAAC,0DAAiB;AACzC,gBAAgB,mBAAO,CAAC,0DAAiB;AACzC,gBAAgB,mBAAO,CAAC,0DAAiB;AACzC,gBAAgB,mBAAO,CAAC,wDAAgB;AACxC,gBAAgB,mBAAO,CAAC,8DAAmB;AAC3C,gBAAgB,mBAAO,CAAC,sDAAe;AACvC,gBAAgB,mBAAO,CAAC,8DAAmB;;AAE3C;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,MAAM;AACvB;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,iBAAiB,MAAM;AACvB;AACA;AACA;AACA,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA,mBAAmB,MAAM;AACzB;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,KAAK;AACpB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,KAAK;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACrMY;;AAEZ;;AAEA,YAAY,mBAAO,CAAC,wDAAa;;AAEjC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,iBAAiB;AAC1C;AACA;AACA;AACA,UAAU;AACV;AACA;AACA,OAAO;AACP;AACA,KAAK;AACL;AACA,yBAAyB,oBAAoB;AAC7C;AACA,KAAK;AACL;AACA,yBAAyB,UAAU;AACnC;AACA,KAAK;AACL;AACA,yBAAyB,UAAU;AACnC;AACA,KAAK;AACL;AACA,yBAAyB,aAAa;AACtC;AACA;AACA,GAAG;;AAEH;AACA;;;;;;;;;;;AC5MA,qBAAqB;;AAErB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;;;;;;;;;;;ACxBY;;AAEZ;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;;AAEf;AACA;AACA;AACA,eAAe;;AAEf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;;;;;;;;;;;AC3DG;;AAEZ,WAAW,mBAAO,CAAC,8CAAO;;AAE1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACvCY;;AAEZ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACxCY;;AAEZ;;AAEA,oBAAoB,mBAAO,CAAC,+DAAiB;AAC7C,oBAAoB,mBAAO,CAAC,wDAAgB;AAC5C,oBAAoB,mBAAO,CAAC,4DAAkB;AAC9C,oBAAoB,mBAAO,CAAC,wDAAgB;AAC5C,oBAAoB,mBAAO,CAAC,wFAAqB;;AAEjD;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,eAAe,KAAK;AACpB;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAe,KAAK;AACpB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;;;;;;;;;ACxYA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;ACTA;;;;;;;;;;ACAA;AACA,EAAE,qBAAM;AACR,EAAE,qBAAM;AACR;AACA,IAAI;AACJ;AACA;;;;;;;;;;;;ACNY;;AAEZ,gBAAgB,mBAAO,CAAC,sDAAY;;AAEpC;;AAEA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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A;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA,eAAe,KAAK;AACpB;AACA;AACA;AACA,eAAe,KAAK;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe,KAAK;AACpB;AACA;AACA;AACA;AACA;AACA,eAAe,KAAK;AACpB;AACA;AACA;AACA;AACA;AACA,eAAe,KAAK;AACpB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,eAAe,KAAK;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,eAAe,KAAK;AACpB;AACA;;AAEA,eAAe,KAAK;AACpB;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,MAAM;AACvB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,iBAAiB,KAAK;AACtB;AACA;AACA;AACA;AACA;AACA,iBAAiB,KAAK;AACtB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA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","sources":["webpack:///./node_modules/3d-view-controls/camera.js","webpack:///./node_modules/3d-view/view.js","webpack:///./node_modules/binary-search-bounds/search-bounds.js","webpack:///./node_modules/cubic-hermite/hermite.js","webpack:///./node_modules/filtered-vector/fvec.js","webpack:///./node_modules/gl-mat4/clone.js","webpack:///./node_modules/gl-mat4/create.js","webpack:///./node_modules/gl-mat4/determinant.js","webpack:///./node_modules/gl-mat4/fromQuat.js","webpack:///./node_modules/gl-mat4/fromRotationTranslation.js","webpack:///./node_modules/gl-mat4/identity.js","webpack:///./node_modules/gl-mat4/invert.js","webpack:///./node_modules/gl-mat4/lookAt.js","webpack:///./node_modules/gl-mat4/multiply.js","webpack:///./node_modules/gl-mat4/rotate.js","webpack:///./node_modules/gl-mat4/rotateX.js","webpack:///./node_modules/gl-mat4/rotateY.js","webpack:///./node_modules/gl-mat4/rotateZ.js","webpack:///./node_modules/gl-mat4/scale.js","webpack:///./node_modules/gl-mat4/translate.js","webpack:///./node_modules/gl-mat4/transpose.js","webpack:///./node_modules/gl-matrix/esm/common.js","webpack:///./node_modules/gl-matrix/esm/mat4.js","webpack:///./node_modules/gl-matrix/esm/vec3.js","webpack:///./node_modules/gl-matrix/esm/vec4.js","webpack:///./node_modules/gl-quat/slerp.js","webpack:///./node_modules/gl-vec3/cross.js","webpack:///./node_modules/gl-vec3/dot.js","webpack:///./node_modules/gl-vec3/length.js","webpack:///./node_modules/gl-vec3/lerp.js","webpack:///./node_modules/gl-vec3/normalize.js","webpack:///./node_modules/has-passive-events/index.js","webpack:///./node_modules/is-browser/client.js","webpack:///./node_modules/mat4-decompose/index.js","webpack:///./node_modules/mat4-decompose/normalize.js","webpack:///./node_modules/mat4-interpolate/index.js","webpack:///./node_modules/mat4-recompose/index.js","webpack:///./node_modules/matrix-camera-controller/matrix.js","webpack:///./node_modules/mouse-change/mouse-listen.js","webpack:///./node_modules/mouse-event-offset/index.js","webpack:///./node_modules/mouse-event/mouse.js","webpack:///./node_modules/mouse-wheel/wheel.js","webpack:///./node_modules/orbit-camera-controller/lib/quatFromFrame.js","webpack:///./node_modules/orbit-camera-controller/orbit.js","webpack:///./node_modules/parse-unit/index.js","webpack:///./node_modules/quat-slerp/index.js","webpack:///./node_modules/right-now/browser.js","webpack:///./node_modules/to-px/browser.js","webpack:///./src/Camera.ts","webpack:///./src/geometry/Square.ts","webpack:///./src/globals.ts","webpack:///./src/rendering/gl/Drawable.ts","webpack:///./src/rendering/gl/OpenGLRenderer.ts","webpack:///./src/rendering/gl/ShaderProgram.ts","webpack:///./node_modules/turntable-camera-controller/turntable.js","webpack:///./src/shaders/flat-frag.glsl","webpack:///./src/shaders/flat-vert.glsl","webpack:///webpack/bootstrap","webpack:///webpack/runtime/define property getters","webpack:///webpack/runtime/global","webpack:///webpack/runtime/hasOwnProperty shorthand","webpack:///webpack/runtime/make namespace object","webpack:///./src/main.ts"],"sourcesContent":["'use strict'\r\n\r\nmodule.exports = createCamera\r\n\r\nvar now = require('right-now')\r\nvar createView = require('3d-view')\r\nvar mouseChange = require('mouse-change')\r\nvar mouseWheel = require('mouse-wheel')\r\nvar mouseOffset = require('mouse-event-offset')\r\nvar hasPassive = require('has-passive-events')\r\n\r\nfunction createCamera(element, options) {\r\n element = element || document.body\r\n options = options || {}\r\n\r\n var limits = [ 0.01, Infinity ]\r\n if('distanceLimits' in options) {\r\n limits[0] = options.distanceLimits[0]\r\n limits[1] = options.distanceLimits[1]\r\n }\r\n if('zoomMin' in options) {\r\n limits[0] = options.zoomMin\r\n }\r\n if('zoomMax' in options) {\r\n limits[1] = options.zoomMax\r\n }\r\n\r\n var view = createView({\r\n center: options.center || [0,0,0],\r\n up: options.up || [0,1,0],\r\n eye: options.eye || [0,0,10],\r\n mode: options.mode || 'orbit',\r\n distanceLimits: limits\r\n })\r\n\r\n var pmatrix = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]\r\n var distance = 0.0\r\n var width = element.clientWidth\r\n var height = element.clientHeight\r\n\r\n var camera = {\r\n view: view,\r\n element: element,\r\n delay: options.delay || 16,\r\n rotateSpeed: options.rotateSpeed || 1,\r\n zoomSpeed: options.zoomSpeed || 1,\r\n translateSpeed: options.translateSpeed || 1,\r\n flipX: !!options.flipX,\r\n flipY: !!options.flipY,\r\n modes: view.modes,\r\n tick: function() {\r\n var t = now()\r\n var delay = this.delay\r\n view.idle(t-delay)\r\n view.flush(t-(100+delay*2))\r\n var ctime = t - 2 * delay\r\n view.recalcMatrix(ctime)\r\n var allEqual = true\r\n var matrix = view.computedMatrix\r\n for(var i=0; i<16; ++i) {\r\n allEqual = allEqual && (pmatrix[i] === matrix[i])\r\n pmatrix[i] = matrix[i]\r\n }\r\n var sizeChanged =\r\n element.clientWidth === width &&\r\n element.clientHeight === height\r\n width = element.clientWidth\r\n height = element.clientHeight\r\n if(allEqual) {\r\n return !sizeChanged\r\n }\r\n distance = Math.exp(view.computedRadius[0])\r\n return true\r\n },\r\n lookAt: function(center, eye, up) {\r\n view.lookAt(view.lastT(), center, eye, up)\r\n },\r\n rotate: function(pitch, yaw, roll) {\r\n view.rotate(view.lastT(), pitch, yaw, roll)\r\n },\r\n pan: function(dx, dy, dz) {\r\n view.pan(view.lastT(), dx, dy, dz)\r\n },\r\n translate: function(dx, dy, dz) {\r\n view.translate(view.lastT(), dx, dy, dz)\r\n }\r\n }\r\n\r\n Object.defineProperties(camera, {\r\n matrix: {\r\n get: function() {\r\n return view.computedMatrix\r\n },\r\n set: function(mat) {\r\n view.setMatrix(view.lastT(), mat)\r\n return view.computedMatrix\r\n },\r\n enumerable: true\r\n },\r\n mode: {\r\n get: function() {\r\n return view.getMode()\r\n },\r\n set: function(mode) {\r\n view.setMode(mode)\r\n return view.getMode()\r\n },\r\n enumerable: true\r\n },\r\n center: {\r\n get: function() {\r\n return view.computedCenter\r\n },\r\n set: function(ncenter) {\r\n view.lookAt(view.lastT(), ncenter)\r\n return view.computedCenter\r\n },\r\n enumerable: true\r\n },\r\n eye: {\r\n get: function() {\r\n return view.computedEye\r\n },\r\n set: function(neye) {\r\n view.lookAt(view.lastT(), null, neye)\r\n return view.computedEye\r\n },\r\n enumerable: true\r\n },\r\n up: {\r\n get: function() {\r\n return view.computedUp\r\n },\r\n set: function(nup) {\r\n view.lookAt(view.lastT(), null, null, nup)\r\n return view.computedUp\r\n },\r\n enumerable: true\r\n },\r\n distance: {\r\n get: function() {\r\n return distance\r\n },\r\n set: function(d) {\r\n view.setDistance(view.lastT(), d)\r\n return d\r\n },\r\n enumerable: true\r\n },\r\n distanceLimits: {\r\n get: function() {\r\n return view.getDistanceLimits(limits)\r\n },\r\n set: function(v) {\r\n view.setDistanceLimits(v)\r\n return v\r\n },\r\n enumerable: true\r\n }\r\n })\r\n\r\n element.addEventListener('contextmenu', function(ev) {\r\n ev.preventDefault()\r\n return false\r\n })\r\n\r\n var lastX = 0, lastY = 0, lastMods = {shift: false, control: false, alt: false, meta: false}\r\n mouseChange(element, handleInteraction)\r\n\r\n //enable simple touch interactions\r\n element.addEventListener('touchstart', function (ev) {\r\n var xy = mouseOffset(ev.changedTouches[0], element)\r\n handleInteraction(0, xy[0], xy[1], lastMods)\r\n handleInteraction(1, xy[0], xy[1], lastMods)\r\n\r\n ev.preventDefault()\r\n }, hasPassive ? {passive: false} : false)\r\n\r\n element.addEventListener('touchmove', function (ev) {\r\n var xy = mouseOffset(ev.changedTouches[0], element)\r\n handleInteraction(1, xy[0], xy[1], lastMods)\r\n\r\n ev.preventDefault()\r\n }, hasPassive ? {passive: false} : false)\r\n\r\n element.addEventListener('touchend', function (ev) {\r\n var xy = mouseOffset(ev.changedTouches[0], element)\r\n handleInteraction(0, lastX, lastY, lastMods)\r\n\r\n ev.preventDefault()\r\n }, hasPassive ? {passive: false} : false)\r\n\r\n function handleInteraction (buttons, x, y, mods) {\r\n var scale = 1.0 / element.clientHeight\r\n var dx = scale * (x - lastX)\r\n var dy = scale * (y - lastY)\r\n\r\n var flipX = camera.flipX ? 1 : -1\r\n var flipY = camera.flipY ? 1 : -1\r\n\r\n var drot = Math.PI * camera.rotateSpeed\r\n\r\n var t = now()\r\n\r\n if(buttons & 1) {\r\n if(mods.shift) {\r\n view.rotate(t, 0, 0, -dx * drot)\r\n } else {\r\n view.rotate(t, flipX * drot * dx, -flipY * drot * dy, 0)\r\n }\r\n } else if(buttons & 2) {\r\n view.pan(t, -camera.translateSpeed * dx * distance, camera.translateSpeed * dy * distance, 0)\r\n } else if(buttons & 4) {\r\n var kzoom = camera.zoomSpeed * dy / window.innerHeight * (t - view.lastT()) * 50.0\r\n view.pan(t, 0, 0, distance * (Math.exp(kzoom) - 1))\r\n }\r\n\r\n lastX = x\r\n lastY = y\r\n lastMods = mods\r\n }\r\n\r\n mouseWheel(element, function(dx, dy, dz) {\r\n var flipX = camera.flipX ? 1 : -1\r\n var flipY = camera.flipY ? 1 : -1\r\n var t = now()\r\n if(Math.abs(dx) > Math.abs(dy)) {\r\n view.rotate(t, 0, 0, -dx * flipX * Math.PI * camera.rotateSpeed / window.innerWidth)\r\n } else {\r\n var kzoom = camera.zoomSpeed * flipY * dy / window.innerHeight * (t - view.lastT()) / 100.0\r\n view.pan(t, 0, 0, distance * (Math.exp(kzoom) - 1))\r\n }\r\n }, true)\r\n\r\n return camera\r\n}\r\n","'use strict'\n\nmodule.exports = createViewController\n\nvar createTurntable = require('turntable-camera-controller')\nvar createOrbit = require('orbit-camera-controller')\nvar createMatrix = require('matrix-camera-controller')\n\nfunction ViewController(controllers, mode) {\n this._controllerNames = Object.keys(controllers)\n this._controllerList = this._controllerNames.map(function(n) {\n return controllers[n]\n })\n this._mode = mode\n this._active = controllers[mode]\n if(!this._active) {\n this._mode = 'turntable'\n this._active = controllers.turntable\n }\n this.modes = this._controllerNames\n this.computedMatrix = this._active.computedMatrix\n this.computedEye = this._active.computedEye\n this.computedUp = this._active.computedUp\n this.computedCenter = this._active.computedCenter\n this.computedRadius = this._active.computedRadius\n}\n\nvar proto = ViewController.prototype\n\nproto.flush = function(a0) {\n var cc = this._controllerList\n for (var i = 0; i < cc.length; ++i) {\n cc[i].flush(a0)\n }\n}\nproto.idle = function(a0) {\n var cc = this._controllerList\n for (var i = 0; i < cc.length; ++i) {\n cc[i].idle(a0)\n }\n}\nproto.lookAt = function(a0, a1, a2, a3) {\n var cc = this._controllerList\n for (var i = 0; i < cc.length; ++i) {\n cc[i].lookAt(a0, a1, a2, a3)\n }\n}\nproto.rotate = function(a0, a1, a2, a3) {\n var cc = this._controllerList\n for (var i = 0; i < cc.length; ++i) {\n cc[i].rotate(a0, a1, a2, a3)\n }\n}\nproto.pan = function(a0, a1, a2, a3) {\n var cc = this._controllerList\n for (var i = 0; i < cc.length; ++i) {\n cc[i].pan(a0, a1, a2, a3)\n }\n}\nproto.translate = function(a0, a1, a2, a3) {\n var cc = this._controllerList\n for (var i = 0; i < cc.length; ++i) {\n cc[i].translate(a0, a1, a2, a3)\n }\n}\nproto.setMatrix = function(a0, a1) {\n var cc = this._controllerList\n for (var i = 0; i < cc.length; ++i) {\n cc[i].setMatrix(a0, a1)\n }\n}\nproto.setDistanceLimits = function(a0, a1) {\n var cc = this._controllerList\n for (var i = 0; i < cc.length; ++i) {\n cc[i].setDistanceLimits(a0, a1)\n }\n}\nproto.setDistance = function(a0, a1) {\n var cc = this._controllerList\n for (var i = 0; i < cc.length; ++i) {\n cc[i].setDistance(a0, a1)\n }\n}\n\nproto.recalcMatrix = function(t) {\n this._active.recalcMatrix(t)\n}\n\nproto.getDistance = function(t) {\n return this._active.getDistance(t)\n}\nproto.getDistanceLimits = function(out) {\n return this._active.getDistanceLimits(out)\n}\n\nproto.lastT = function() {\n return this._active.lastT()\n}\n\nproto.setMode = function(mode) {\n if(mode === this._mode) {\n return\n }\n var idx = this._controllerNames.indexOf(mode)\n if(idx < 0) {\n return\n }\n var prev = this._active\n var next = this._controllerList[idx]\n var lastT = Math.max(prev.lastT(), next.lastT())\n\n prev.recalcMatrix(lastT)\n next.setMatrix(lastT, prev.computedMatrix)\n\n this._active = next\n this._mode = mode\n\n //Update matrix properties\n this.computedMatrix = this._active.computedMatrix\n this.computedEye = this._active.computedEye\n this.computedUp = this._active.computedUp\n this.computedCenter = this._active.computedCenter\n this.computedRadius = this._active.computedRadius\n}\n\nproto.getMode = function() {\n return this._mode\n}\n\nfunction createViewController(options) {\n options = options || {}\n\n var eye = options.eye || [0,0,1]\n var center = options.center || [0,0,0]\n var up = options.up || [0,1,0]\n var limits = options.distanceLimits || [0, Infinity]\n var mode = options.mode || 'turntable'\n\n var turntable = createTurntable()\n var orbit = createOrbit()\n var matrix = createMatrix()\n\n turntable.setDistanceLimits(limits[0], limits[1])\n turntable.lookAt(0, eye, center, up)\n orbit.setDistanceLimits(limits[0], limits[1])\n orbit.lookAt(0, eye, center, up)\n matrix.setDistanceLimits(limits[0], limits[1])\n matrix.lookAt(0, eye, center, up)\n\n return new ViewController({\n turntable: turntable,\n orbit: orbit,\n matrix: matrix\n }, mode)\n}","\"use strict\"\n\n// (a, y, c, l, h) = (array, y[, cmp, lo, hi])\n\nfunction ge(a, y, c, l, h) {\n var i = h + 1;\n while (l <= h) {\n var m = (l + h) >>> 1, x = a[m];\n var p = (c !== undefined) ? c(x, y) : (x - y);\n if (p >= 0) { i = m; h = m - 1 } else { l = m + 1 }\n }\n return i;\n};\n\nfunction gt(a, y, c, l, h) {\n var i = h + 1;\n while (l <= h) {\n var m = (l + h) >>> 1, x = a[m];\n var p = (c !== undefined) ? c(x, y) : (x - y);\n if (p > 0) { i = m; h = m - 1 } else { l = m + 1 }\n }\n return i;\n};\n\nfunction lt(a, y, c, l, h) {\n var i = l - 1;\n while (l <= h) {\n var m = (l + h) >>> 1, x = a[m];\n var p = (c !== undefined) ? c(x, y) : (x - y);\n if (p < 0) { i = m; l = m + 1 } else { h = m - 1 }\n }\n return i;\n};\n\nfunction le(a, y, c, l, h) {\n var i = l - 1;\n while (l <= h) {\n var m = (l + h) >>> 1, x = a[m];\n var p = (c !== undefined) ? c(x, y) : (x - y);\n if (p <= 0) { i = m; l = m + 1 } else { h = m - 1 }\n }\n return i;\n};\n\nfunction eq(a, y, c, l, h) {\n while (l <= h) {\n var m = (l + h) >>> 1, x = a[m];\n var p = (c !== undefined) ? c(x, y) : (x - y);\n if (p === 0) { return m }\n if (p <= 0) { l = m + 1 } else { h = m - 1 }\n }\n return -1;\n};\n\nfunction norm(a, y, c, l, h, f) {\n if (typeof c === 'function') {\n return f(a, y, c, (l === undefined) ? 0 : l | 0, (h === undefined) ? a.length - 1 : h | 0);\n }\n return f(a, y, undefined, (c === undefined) ? 0 : c | 0, (l === undefined) ? a.length - 1 : l | 0);\n}\n\nmodule.exports = {\n ge: function(a, y, c, l, h) { return norm(a, y, c, l, h, ge)},\n gt: function(a, y, c, l, h) { return norm(a, y, c, l, h, gt)},\n lt: function(a, y, c, l, h) { return norm(a, y, c, l, h, lt)},\n le: function(a, y, c, l, h) { return norm(a, y, c, l, h, le)},\n eq: function(a, y, c, l, h) { return norm(a, y, c, l, h, eq)}\n}\n","\"use strict\"\n\nfunction dcubicHermite(p0, v0, p1, v1, t, f) {\n var dh00 = 6*t*t-6*t,\n dh10 = 3*t*t-4*t + 1,\n dh01 = -6*t*t+6*t,\n dh11 = 3*t*t-2*t\n if(p0.length) {\n if(!f) {\n f = new Array(p0.length)\n }\n for(var i=p0.length-1; i>=0; --i) {\n f[i] = dh00*p0[i] + dh10*v0[i] + dh01*p1[i] + dh11*v1[i]\n }\n return f\n }\n return dh00*p0 + dh10*v0 + dh01*p1[i] + dh11*v1\n}\n\nfunction cubicHermite(p0, v0, p1, v1, t, f) {\n var ti = (t-1), t2 = t*t, ti2 = ti*ti,\n h00 = (1+2*t)*ti2,\n h10 = t*ti2,\n h01 = t2*(3-2*t),\n h11 = t2*ti\n if(p0.length) {\n if(!f) {\n f = new Array(p0.length)\n }\n for(var i=p0.length-1; i>=0; --i) {\n f[i] = h00*p0[i] + h10*v0[i] + h01*p1[i] + h11*v1[i]\n }\n return f\n }\n return h00*p0 + h10*v0 + h01*p1 + h11*v1\n}\n\nmodule.exports = cubicHermite\nmodule.exports.derivative = dcubicHermite","'use strict'\n\nmodule.exports = createFilteredVector\n\nvar cubicHermite = require('cubic-hermite')\nvar bsearch = require('binary-search-bounds')\n\nfunction clamp(lo, hi, x) {\n return Math.min(hi, Math.max(lo, x))\n}\n\nfunction FilteredVector(state0, velocity0, t0) {\n this.dimension = state0.length\n this.bounds = [ new Array(this.dimension), new Array(this.dimension) ]\n for(var i=0; i= n-1) {\n var ptr = state.length-1\n var tf = t - time[n-1]\n for(var i=0; i= n-1) {\n var ptr = state.length-1\n var tf = t - time[n-1]\n for(var i=0; i=0; --i) {\n if(velocity[--ptr]) {\n return false\n }\n }\n return true\n}\n\nproto.jump = function(t) {\n var t0 = this.lastT()\n var d = this.dimension\n if(t < t0 || arguments.length !== d+1) {\n return\n }\n var state = this._state\n var velocity = this._velocity\n var ptr = state.length-this.dimension\n var bounds = this.bounds\n var lo = bounds[0]\n var hi = bounds[1]\n this._time.push(t0, t)\n for(var j=0; j<2; ++j) {\n for(var i=0; i0; --i) {\n state.push(clamp(lo[i-1], hi[i-1], arguments[i]))\n velocity.push(0)\n }\n}\n\nproto.push = function(t) {\n var t0 = this.lastT()\n var d = this.dimension\n if(t < t0 || arguments.length !== d+1) {\n return\n }\n var state = this._state\n var velocity = this._velocity\n var ptr = state.length-this.dimension\n var dt = t - t0\n var bounds = this.bounds\n var lo = bounds[0]\n var hi = bounds[1]\n var sf = (dt > 1e-6) ? 1/dt : 0\n this._time.push(t)\n for(var i=d; i>0; --i) {\n var xc = clamp(lo[i-1], hi[i-1], arguments[i])\n state.push(xc)\n velocity.push((xc - state[ptr++]) * sf)\n }\n}\n\nproto.set = function(t) {\n var d = this.dimension\n if(t < this.lastT() || arguments.length !== d+1) {\n return\n }\n var state = this._state\n var velocity = this._velocity\n var bounds = this.bounds\n var lo = bounds[0]\n var hi = bounds[1]\n this._time.push(t)\n for(var i=d; i>0; --i) {\n state.push(clamp(lo[i-1], hi[i-1], arguments[i]))\n velocity.push(0)\n }\n}\n\nproto.move = function(t) {\n var t0 = this.lastT()\n var d = this.dimension\n if(t <= t0 || arguments.length !== d+1) {\n return\n }\n var state = this._state\n var velocity = this._velocity\n var statePtr = state.length - this.dimension\n var bounds = this.bounds\n var lo = bounds[0]\n var hi = bounds[1]\n var dt = t - t0\n var sf = (dt > 1e-6) ? 1/dt : 0.0\n this._time.push(t)\n for(var i=d; i>0; --i) {\n var dx = arguments[i]\n state.push(clamp(lo[i-1], hi[i-1], state[statePtr++] + dx))\n velocity.push(dx * sf)\n }\n}\n\nproto.idle = function(t) {\n var t0 = this.lastT()\n if(t < t0) {\n return\n }\n var d = this.dimension\n var state = this._state\n var velocity = this._velocity\n var statePtr = state.length-d\n var bounds = this.bounds\n var lo = bounds[0]\n var hi = bounds[1]\n var dt = t - t0\n this._time.push(t)\n for(var i=d-1; i>=0; --i) {\n state.push(clamp(lo[i], hi[i], state[statePtr] + dt * velocity[statePtr]))\n velocity.push(0)\n statePtr += 1\n }\n}\n\nfunction getZero(d) {\n var result = new Array(d)\n for(var i=0; iFormat: column-major, when typed out it looks like row-major
The matrices are being post multiplied.\n * @module mat4\n */\n\n/**\n * Creates a new identity mat4\n *\n * @returns {mat4} a new 4x4 matrix\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(16);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n }\n\n out[0] = 1;\n out[5] = 1;\n out[10] = 1;\n out[15] = 1;\n return out;\n}\n/**\n * Creates a new mat4 initialized with values from an existing matrix\n *\n * @param {ReadonlyMat4} a matrix to clone\n * @returns {mat4} a new 4x4 matrix\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(16);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\n * Copy the values from one mat4 to another\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the source matrix\n * @returns {mat4} out\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\n * Create a new mat4 with the given values\n *\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\n * @param {Number} m03 Component in column 0, row 3 position (index 3)\n * @param {Number} m10 Component in column 1, row 0 position (index 4)\n * @param {Number} m11 Component in column 1, row 1 position (index 5)\n * @param {Number} m12 Component in column 1, row 2 position (index 6)\n * @param {Number} m13 Component in column 1, row 3 position (index 7)\n * @param {Number} m20 Component in column 2, row 0 position (index 8)\n * @param {Number} m21 Component in column 2, row 1 position (index 9)\n * @param {Number} m22 Component in column 2, row 2 position (index 10)\n * @param {Number} m23 Component in column 2, row 3 position (index 11)\n * @param {Number} m30 Component in column 3, row 0 position (index 12)\n * @param {Number} m31 Component in column 3, row 1 position (index 13)\n * @param {Number} m32 Component in column 3, row 2 position (index 14)\n * @param {Number} m33 Component in column 3, row 3 position (index 15)\n * @returns {mat4} A new mat4\n */\n\nexport function fromValues(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {\n var out = new glMatrix.ARRAY_TYPE(16);\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m03;\n out[4] = m10;\n out[5] = m11;\n out[6] = m12;\n out[7] = m13;\n out[8] = m20;\n out[9] = m21;\n out[10] = m22;\n out[11] = m23;\n out[12] = m30;\n out[13] = m31;\n out[14] = m32;\n out[15] = m33;\n return out;\n}\n/**\n * Set the components of a mat4 to the given values\n *\n * @param {mat4} out the receiving matrix\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\n * @param {Number} m03 Component in column 0, row 3 position (index 3)\n * @param {Number} m10 Component in column 1, row 0 position (index 4)\n * @param {Number} m11 Component in column 1, row 1 position (index 5)\n * @param {Number} m12 Component in column 1, row 2 position (index 6)\n * @param {Number} m13 Component in column 1, row 3 position (index 7)\n * @param {Number} m20 Component in column 2, row 0 position (index 8)\n * @param {Number} m21 Component in column 2, row 1 position (index 9)\n * @param {Number} m22 Component in column 2, row 2 position (index 10)\n * @param {Number} m23 Component in column 2, row 3 position (index 11)\n * @param {Number} m30 Component in column 3, row 0 position (index 12)\n * @param {Number} m31 Component in column 3, row 1 position (index 13)\n * @param {Number} m32 Component in column 3, row 2 position (index 14)\n * @param {Number} m33 Component in column 3, row 3 position (index 15)\n * @returns {mat4} out\n */\n\nexport function set(out, m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m03;\n out[4] = m10;\n out[5] = m11;\n out[6] = m12;\n out[7] = m13;\n out[8] = m20;\n out[9] = m21;\n out[10] = m22;\n out[11] = m23;\n out[12] = m30;\n out[13] = m31;\n out[14] = m32;\n out[15] = m33;\n return out;\n}\n/**\n * Set a mat4 to the identity matrix\n *\n * @param {mat4} out the receiving matrix\n * @returns {mat4} out\n */\n\nexport function identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Transpose the values of a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the source matrix\n * @returns {mat4} out\n */\n\nexport function transpose(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a12 = a[6],\n a13 = a[7];\n var a23 = a[11];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a01;\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a02;\n out[9] = a12;\n out[11] = a[14];\n out[12] = a03;\n out[13] = a13;\n out[14] = a23;\n } else {\n out[0] = a[0];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a[1];\n out[5] = a[5];\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a[2];\n out[9] = a[6];\n out[10] = a[10];\n out[11] = a[14];\n out[12] = a[3];\n out[13] = a[7];\n out[14] = a[11];\n out[15] = a[15];\n }\n\n return out;\n}\n/**\n * Inverts a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the source matrix\n * @returns {mat4} out\n */\n\nexport function invert(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n var b00 = a00 * a11 - a01 * a10;\n var b01 = a00 * a12 - a02 * a10;\n var b02 = a00 * a13 - a03 * a10;\n var b03 = a01 * a12 - a02 * a11;\n var b04 = a01 * a13 - a03 * a11;\n var b05 = a02 * a13 - a03 * a12;\n var b06 = a20 * a31 - a21 * a30;\n var b07 = a20 * a32 - a22 * a30;\n var b08 = a20 * a33 - a23 * a30;\n var b09 = a21 * a32 - a22 * a31;\n var b10 = a21 * a33 - a23 * a31;\n var b11 = a22 * a33 - a23 * a32; // Calculate the determinant\n\n var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) {\n return null;\n }\n\n det = 1.0 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n return out;\n}\n/**\n * Calculates the adjugate of a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the source matrix\n * @returns {mat4} out\n */\n\nexport function adjoint(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n out[0] = a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22);\n out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22));\n out[2] = a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12);\n out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12));\n out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22));\n out[5] = a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22);\n out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12));\n out[7] = a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12);\n out[8] = a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21);\n out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21));\n out[10] = a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11);\n out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11));\n out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21));\n out[13] = a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21);\n out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11));\n out[15] = a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11);\n return out;\n}\n/**\n * Calculates the determinant of a mat4\n *\n * @param {ReadonlyMat4} a the source matrix\n * @returns {Number} determinant of a\n */\n\nexport function determinant(a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n var b00 = a00 * a11 - a01 * a10;\n var b01 = a00 * a12 - a02 * a10;\n var b02 = a00 * a13 - a03 * a10;\n var b03 = a01 * a12 - a02 * a11;\n var b04 = a01 * a13 - a03 * a11;\n var b05 = a02 * a13 - a03 * a12;\n var b06 = a20 * a31 - a21 * a30;\n var b07 = a20 * a32 - a22 * a30;\n var b08 = a20 * a33 - a23 * a30;\n var b09 = a21 * a32 - a22 * a31;\n var b10 = a21 * a33 - a23 * a31;\n var b11 = a22 * a33 - a23 * a32; // Calculate the determinant\n\n return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n}\n/**\n * Multiplies two mat4s\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the first operand\n * @param {ReadonlyMat4} b the second operand\n * @returns {mat4} out\n */\n\nexport function multiply(out, a, b) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15]; // Cache only the current line of the second matrix\n\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[4];\n b1 = b[5];\n b2 = b[6];\n b3 = b[7];\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[8];\n b1 = b[9];\n b2 = b[10];\n b3 = b[11];\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[12];\n b1 = b[13];\n b2 = b[14];\n b3 = b[15];\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n return out;\n}\n/**\n * Translate a mat4 by the given vector\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to translate\n * @param {ReadonlyVec3} v vector to translate by\n * @returns {mat4} out\n */\n\nexport function translate(out, a, v) {\n var x = v[0],\n y = v[1],\n z = v[2];\n var a00, a01, a02, a03;\n var a10, a11, a12, a13;\n var a20, a21, a22, a23;\n\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\n a00 = a[0];\n a01 = a[1];\n a02 = a[2];\n a03 = a[3];\n a10 = a[4];\n a11 = a[5];\n a12 = a[6];\n a13 = a[7];\n a20 = a[8];\n a21 = a[9];\n a22 = a[10];\n a23 = a[11];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a03;\n out[4] = a10;\n out[5] = a11;\n out[6] = a12;\n out[7] = a13;\n out[8] = a20;\n out[9] = a21;\n out[10] = a22;\n out[11] = a23;\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n\n return out;\n}\n/**\n * Scales the mat4 by the dimensions in the given vec3 not using vectorization\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to scale\n * @param {ReadonlyVec3} v the vec3 to scale the matrix by\n * @returns {mat4} out\n **/\n\nexport function scale(out, a, v) {\n var x = v[0],\n y = v[1],\n z = v[2];\n out[0] = a[0] * x;\n out[1] = a[1] * x;\n out[2] = a[2] * x;\n out[3] = a[3] * x;\n out[4] = a[4] * y;\n out[5] = a[5] * y;\n out[6] = a[6] * y;\n out[7] = a[7] * y;\n out[8] = a[8] * z;\n out[9] = a[9] * z;\n out[10] = a[10] * z;\n out[11] = a[11] * z;\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\n * Rotates a mat4 by the given angle around the given axis\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @param {ReadonlyVec3} axis the axis to rotate around\n * @returns {mat4} out\n */\n\nexport function rotate(out, a, rad, axis) {\n var x = axis[0],\n y = axis[1],\n z = axis[2];\n var len = Math.hypot(x, y, z);\n var s, c, t;\n var a00, a01, a02, a03;\n var a10, a11, a12, a13;\n var a20, a21, a22, a23;\n var b00, b01, b02;\n var b10, b11, b12;\n var b20, b21, b22;\n\n if (len < glMatrix.EPSILON) {\n return null;\n }\n\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c;\n a00 = a[0];\n a01 = a[1];\n a02 = a[2];\n a03 = a[3];\n a10 = a[4];\n a11 = a[5];\n a12 = a[6];\n a13 = a[7];\n a20 = a[8];\n a21 = a[9];\n a22 = a[10];\n a23 = a[11]; // Construct the elements of the rotation matrix\n\n b00 = x * x * t + c;\n b01 = y * x * t + z * s;\n b02 = z * x * t - y * s;\n b10 = x * y * t - z * s;\n b11 = y * y * t + c;\n b12 = z * y * t + x * s;\n b20 = x * z * t + y * s;\n b21 = y * z * t - x * s;\n b22 = z * z * t + c; // Perform rotation-specific matrix multiplication\n\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged last row\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n\n return out;\n}\n/**\n * Rotates a matrix by the given angle around the X axis\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\n\nexport function rotateX(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a10 = a[4];\n var a11 = a[5];\n var a12 = a[6];\n var a13 = a[7];\n var a20 = a[8];\n var a21 = a[9];\n var a22 = a[10];\n var a23 = a[11];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged rows\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n\n out[4] = a10 * c + a20 * s;\n out[5] = a11 * c + a21 * s;\n out[6] = a12 * c + a22 * s;\n out[7] = a13 * c + a23 * s;\n out[8] = a20 * c - a10 * s;\n out[9] = a21 * c - a11 * s;\n out[10] = a22 * c - a12 * s;\n out[11] = a23 * c - a13 * s;\n return out;\n}\n/**\n * Rotates a matrix by the given angle around the Y axis\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\n\nexport function rotateY(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a00 = a[0];\n var a01 = a[1];\n var a02 = a[2];\n var a03 = a[3];\n var a20 = a[8];\n var a21 = a[9];\n var a22 = a[10];\n var a23 = a[11];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged rows\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n\n out[0] = a00 * c - a20 * s;\n out[1] = a01 * c - a21 * s;\n out[2] = a02 * c - a22 * s;\n out[3] = a03 * c - a23 * s;\n out[8] = a00 * s + a20 * c;\n out[9] = a01 * s + a21 * c;\n out[10] = a02 * s + a22 * c;\n out[11] = a03 * s + a23 * c;\n return out;\n}\n/**\n * Rotates a matrix by the given angle around the Z axis\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\n\nexport function rotateZ(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a00 = a[0];\n var a01 = a[1];\n var a02 = a[2];\n var a03 = a[3];\n var a10 = a[4];\n var a11 = a[5];\n var a12 = a[6];\n var a13 = a[7];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged last row\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n\n out[0] = a00 * c + a10 * s;\n out[1] = a01 * c + a11 * s;\n out[2] = a02 * c + a12 * s;\n out[3] = a03 * c + a13 * s;\n out[4] = a10 * c - a00 * s;\n out[5] = a11 * c - a01 * s;\n out[6] = a12 * c - a02 * s;\n out[7] = a13 * c - a03 * s;\n return out;\n}\n/**\n * Creates a matrix from a vector translation\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, dest, vec);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {ReadonlyVec3} v Translation vector\n * @returns {mat4} out\n */\n\nexport function fromTranslation(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from a vector scaling\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.scale(dest, dest, vec);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {ReadonlyVec3} v Scaling vector\n * @returns {mat4} out\n */\n\nexport function fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = v[1];\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = v[2];\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from a given angle around a given axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotate(dest, dest, rad, axis);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @param {ReadonlyVec3} axis the axis to rotate around\n * @returns {mat4} out\n */\n\nexport function fromRotation(out, rad, axis) {\n var x = axis[0],\n y = axis[1],\n z = axis[2];\n var len = Math.hypot(x, y, z);\n var s, c, t;\n\n if (len < glMatrix.EPSILON) {\n return null;\n }\n\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c; // Perform rotation-specific matrix multiplication\n\n out[0] = x * x * t + c;\n out[1] = y * x * t + z * s;\n out[2] = z * x * t - y * s;\n out[3] = 0;\n out[4] = x * y * t - z * s;\n out[5] = y * y * t + c;\n out[6] = z * y * t + x * s;\n out[7] = 0;\n out[8] = x * z * t + y * s;\n out[9] = y * z * t - x * s;\n out[10] = z * z * t + c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from the given angle around the X axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotateX(dest, dest, rad);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\n\nexport function fromXRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad); // Perform axis-specific matrix multiplication\n\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = c;\n out[6] = s;\n out[7] = 0;\n out[8] = 0;\n out[9] = -s;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from the given angle around the Y axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotateY(dest, dest, rad);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\n\nexport function fromYRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad); // Perform axis-specific matrix multiplication\n\n out[0] = c;\n out[1] = 0;\n out[2] = -s;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = s;\n out[9] = 0;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from the given angle around the Z axis\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.rotateZ(dest, dest, rad);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\n\nexport function fromZRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad); // Perform axis-specific matrix multiplication\n\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = 0;\n out[4] = -s;\n out[5] = c;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from a quaternion rotation and vector translation\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * let quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {quat4} q Rotation quaternion\n * @param {ReadonlyVec3} v Translation vector\n * @returns {mat4} out\n */\n\nexport function fromRotationTranslation(out, q, v) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n out[0] = 1 - (yy + zz);\n out[1] = xy + wz;\n out[2] = xz - wy;\n out[3] = 0;\n out[4] = xy - wz;\n out[5] = 1 - (xx + zz);\n out[6] = yz + wx;\n out[7] = 0;\n out[8] = xz + wy;\n out[9] = yz - wx;\n out[10] = 1 - (xx + yy);\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\n * Creates a new mat4 from a dual quat.\n *\n * @param {mat4} out Matrix\n * @param {ReadonlyQuat2} a Dual Quaternion\n * @returns {mat4} mat4 receiving operation result\n */\n\nexport function fromQuat2(out, a) {\n var translation = new glMatrix.ARRAY_TYPE(3);\n var bx = -a[0],\n by = -a[1],\n bz = -a[2],\n bw = a[3],\n ax = a[4],\n ay = a[5],\n az = a[6],\n aw = a[7];\n var magnitude = bx * bx + by * by + bz * bz + bw * bw; //Only scale if it makes sense\n\n if (magnitude > 0) {\n translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude;\n translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude;\n translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude;\n } else {\n translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\n translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\n translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\n }\n\n fromRotationTranslation(out, a, translation);\n return out;\n}\n/**\n * Returns the translation vector component of a transformation\n * matrix. If a matrix is built with fromRotationTranslation,\n * the returned vector will be the same as the translation vector\n * originally supplied.\n * @param {vec3} out Vector to receive translation component\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\n * @return {vec3} out\n */\n\nexport function getTranslation(out, mat) {\n out[0] = mat[12];\n out[1] = mat[13];\n out[2] = mat[14];\n return out;\n}\n/**\n * Returns the scaling factor component of a transformation\n * matrix. If a matrix is built with fromRotationTranslationScale\n * with a normalized Quaternion paramter, the returned vector will be\n * the same as the scaling vector\n * originally supplied.\n * @param {vec3} out Vector to receive scaling factor component\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\n * @return {vec3} out\n */\n\nexport function getScaling(out, mat) {\n var m11 = mat[0];\n var m12 = mat[1];\n var m13 = mat[2];\n var m21 = mat[4];\n var m22 = mat[5];\n var m23 = mat[6];\n var m31 = mat[8];\n var m32 = mat[9];\n var m33 = mat[10];\n out[0] = Math.hypot(m11, m12, m13);\n out[1] = Math.hypot(m21, m22, m23);\n out[2] = Math.hypot(m31, m32, m33);\n return out;\n}\n/**\n * Returns a quaternion representing the rotational component\n * of a transformation matrix. If a matrix is built with\n * fromRotationTranslation, the returned quaternion will be the\n * same as the quaternion originally supplied.\n * @param {quat} out Quaternion to receive the rotation component\n * @param {ReadonlyMat4} mat Matrix to be decomposed (input)\n * @return {quat} out\n */\n\nexport function getRotation(out, mat) {\n var scaling = new glMatrix.ARRAY_TYPE(3);\n getScaling(scaling, mat);\n var is1 = 1 / scaling[0];\n var is2 = 1 / scaling[1];\n var is3 = 1 / scaling[2];\n var sm11 = mat[0] * is1;\n var sm12 = mat[1] * is2;\n var sm13 = mat[2] * is3;\n var sm21 = mat[4] * is1;\n var sm22 = mat[5] * is2;\n var sm23 = mat[6] * is3;\n var sm31 = mat[8] * is1;\n var sm32 = mat[9] * is2;\n var sm33 = mat[10] * is3;\n var trace = sm11 + sm22 + sm33;\n var S = 0;\n\n if (trace > 0) {\n S = Math.sqrt(trace + 1.0) * 2;\n out[3] = 0.25 * S;\n out[0] = (sm23 - sm32) / S;\n out[1] = (sm31 - sm13) / S;\n out[2] = (sm12 - sm21) / S;\n } else if (sm11 > sm22 && sm11 > sm33) {\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\n out[3] = (sm23 - sm32) / S;\n out[0] = 0.25 * S;\n out[1] = (sm12 + sm21) / S;\n out[2] = (sm31 + sm13) / S;\n } else if (sm22 > sm33) {\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\n out[3] = (sm31 - sm13) / S;\n out[0] = (sm12 + sm21) / S;\n out[1] = 0.25 * S;\n out[2] = (sm23 + sm32) / S;\n } else {\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\n out[3] = (sm12 - sm21) / S;\n out[0] = (sm31 + sm13) / S;\n out[1] = (sm23 + sm32) / S;\n out[2] = 0.25 * S;\n }\n\n return out;\n}\n/**\n * Creates a matrix from a quaternion rotation, vector translation and vector scale\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * let quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n * mat4.scale(dest, scale)\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {quat4} q Rotation quaternion\n * @param {ReadonlyVec3} v Translation vector\n * @param {ReadonlyVec3} s Scaling vector\n * @returns {mat4} out\n */\n\nexport function fromRotationTranslationScale(out, q, v, s) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n var sx = s[0];\n var sy = s[1];\n var sz = s[2];\n out[0] = (1 - (yy + zz)) * sx;\n out[1] = (xy + wz) * sx;\n out[2] = (xz - wy) * sx;\n out[3] = 0;\n out[4] = (xy - wz) * sy;\n out[5] = (1 - (xx + zz)) * sy;\n out[6] = (yz + wx) * sy;\n out[7] = 0;\n out[8] = (xz + wy) * sz;\n out[9] = (yz - wx) * sz;\n out[10] = (1 - (xx + yy)) * sz;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\n * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * mat4.translate(dest, origin);\n * let quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n * mat4.scale(dest, scale)\n * mat4.translate(dest, negativeOrigin);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {quat4} q Rotation quaternion\n * @param {ReadonlyVec3} v Translation vector\n * @param {ReadonlyVec3} s Scaling vector\n * @param {ReadonlyVec3} o The origin vector around which to scale and rotate\n * @returns {mat4} out\n */\n\nexport function fromRotationTranslationScaleOrigin(out, q, v, s, o) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n var sx = s[0];\n var sy = s[1];\n var sz = s[2];\n var ox = o[0];\n var oy = o[1];\n var oz = o[2];\n var out0 = (1 - (yy + zz)) * sx;\n var out1 = (xy + wz) * sx;\n var out2 = (xz - wy) * sx;\n var out4 = (xy - wz) * sy;\n var out5 = (1 - (xx + zz)) * sy;\n var out6 = (yz + wx) * sy;\n var out8 = (xz + wy) * sz;\n var out9 = (yz - wx) * sz;\n var out10 = (1 - (xx + yy)) * sz;\n out[0] = out0;\n out[1] = out1;\n out[2] = out2;\n out[3] = 0;\n out[4] = out4;\n out[5] = out5;\n out[6] = out6;\n out[7] = 0;\n out[8] = out8;\n out[9] = out9;\n out[10] = out10;\n out[11] = 0;\n out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);\n out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);\n out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);\n out[15] = 1;\n return out;\n}\n/**\n * Calculates a 4x4 matrix from the given quaternion\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {ReadonlyQuat} q Quaternion to create matrix from\n *\n * @returns {mat4} out\n */\n\nexport function fromQuat(out, q) {\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var yx = y * x2;\n var yy = y * y2;\n var zx = z * x2;\n var zy = z * y2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n out[0] = 1 - yy - zz;\n out[1] = yx + wz;\n out[2] = zx - wy;\n out[3] = 0;\n out[4] = yx - wz;\n out[5] = 1 - xx - zz;\n out[6] = zy + wx;\n out[7] = 0;\n out[8] = zx + wy;\n out[9] = zy - wx;\n out[10] = 1 - xx - yy;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\n * Generates a frustum matrix with the given bounds\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {Number} left Left bound of the frustum\n * @param {Number} right Right bound of the frustum\n * @param {Number} bottom Bottom bound of the frustum\n * @param {Number} top Top bound of the frustum\n * @param {Number} near Near bound of the frustum\n * @param {Number} far Far bound of the frustum\n * @returns {mat4} out\n */\n\nexport function frustum(out, left, right, bottom, top, near, far) {\n var rl = 1 / (right - left);\n var tb = 1 / (top - bottom);\n var nf = 1 / (near - far);\n out[0] = near * 2 * rl;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = near * 2 * tb;\n out[6] = 0;\n out[7] = 0;\n out[8] = (right + left) * rl;\n out[9] = (top + bottom) * tb;\n out[10] = (far + near) * nf;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = far * near * 2 * nf;\n out[15] = 0;\n return out;\n}\n/**\n * Generates a perspective projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\n * which matches WebGL/OpenGL's clip volume.\n * Passing null/undefined/no value for far will generate infinite projection matrix.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} fovy Vertical field of view in radians\n * @param {number} aspect Aspect ratio. typically viewport width/height\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum, can be null or Infinity\n * @returns {mat4} out\n */\n\nexport function perspectiveNO(out, fovy, aspect, near, far) {\n var f = 1.0 / Math.tan(fovy / 2),\n nf;\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[15] = 0;\n\n if (far != null && far !== Infinity) {\n nf = 1 / (near - far);\n out[10] = (far + near) * nf;\n out[14] = 2 * far * near * nf;\n } else {\n out[10] = -1;\n out[14] = -2 * near;\n }\n\n return out;\n}\n/**\n * Alias for {@link mat4.perspectiveNO}\n * @function\n */\n\nexport var perspective = perspectiveNO;\n/**\n * Generates a perspective projection matrix suitable for WebGPU with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\n * Passing null/undefined/no value for far will generate infinite projection matrix.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} fovy Vertical field of view in radians\n * @param {number} aspect Aspect ratio. typically viewport width/height\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum, can be null or Infinity\n * @returns {mat4} out\n */\n\nexport function perspectiveZO(out, fovy, aspect, near, far) {\n var f = 1.0 / Math.tan(fovy / 2),\n nf;\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[15] = 0;\n\n if (far != null && far !== Infinity) {\n nf = 1 / (near - far);\n out[10] = far * nf;\n out[14] = far * near * nf;\n } else {\n out[10] = -1;\n out[14] = -near;\n }\n\n return out;\n}\n/**\n * Generates a perspective projection matrix with the given field of view.\n * This is primarily useful for generating projection matrices to be used\n * with the still experiemental WebVR API.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {Object} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\n\nexport function perspectiveFromFieldOfView(out, fov, near, far) {\n var upTan = Math.tan(fov.upDegrees * Math.PI / 180.0);\n var downTan = Math.tan(fov.downDegrees * Math.PI / 180.0);\n var leftTan = Math.tan(fov.leftDegrees * Math.PI / 180.0);\n var rightTan = Math.tan(fov.rightDegrees * Math.PI / 180.0);\n var xScale = 2.0 / (leftTan + rightTan);\n var yScale = 2.0 / (upTan + downTan);\n out[0] = xScale;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n out[4] = 0.0;\n out[5] = yScale;\n out[6] = 0.0;\n out[7] = 0.0;\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\n out[9] = (upTan - downTan) * yScale * 0.5;\n out[10] = far / (near - far);\n out[11] = -1.0;\n out[12] = 0.0;\n out[13] = 0.0;\n out[14] = far * near / (near - far);\n out[15] = 0.0;\n return out;\n}\n/**\n * Generates a orthogonal projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1],\n * which matches WebGL/OpenGL's clip volume.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} left Left bound of the frustum\n * @param {number} right Right bound of the frustum\n * @param {number} bottom Bottom bound of the frustum\n * @param {number} top Top bound of the frustum\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\n\nexport function orthoNO(out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right);\n var bt = 1 / (bottom - top);\n var nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n}\n/**\n * Alias for {@link mat4.orthoNO}\n * @function\n */\n\nexport var ortho = orthoNO;\n/**\n * Generates a orthogonal projection matrix with the given bounds.\n * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1],\n * which matches WebGPU/Vulkan/DirectX/Metal's clip volume.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} left Left bound of the frustum\n * @param {number} right Right bound of the frustum\n * @param {number} bottom Bottom bound of the frustum\n * @param {number} top Top bound of the frustum\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\n\nexport function orthoZO(out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right);\n var bt = 1 / (bottom - top);\n var nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = near * nf;\n out[15] = 1;\n return out;\n}\n/**\n * Generates a look-at matrix with the given eye position, focal point, and up axis.\n * If you want a matrix that actually makes an object look at another object, you should use targetTo instead.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {ReadonlyVec3} eye Position of the viewer\n * @param {ReadonlyVec3} center Point the viewer is looking at\n * @param {ReadonlyVec3} up vec3 pointing up\n * @returns {mat4} out\n */\n\nexport function lookAt(out, eye, center, up) {\n var x0, x1, x2, y0, y1, y2, z0, z1, z2, len;\n var eyex = eye[0];\n var eyey = eye[1];\n var eyez = eye[2];\n var upx = up[0];\n var upy = up[1];\n var upz = up[2];\n var centerx = center[0];\n var centery = center[1];\n var centerz = center[2];\n\n if (Math.abs(eyex - centerx) < glMatrix.EPSILON && Math.abs(eyey - centery) < glMatrix.EPSILON && Math.abs(eyez - centerz) < glMatrix.EPSILON) {\n return identity(out);\n }\n\n z0 = eyex - centerx;\n z1 = eyey - centery;\n z2 = eyez - centerz;\n len = 1 / Math.hypot(z0, z1, z2);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n x0 = upy * z2 - upz * z1;\n x1 = upz * z0 - upx * z2;\n x2 = upx * z1 - upy * z0;\n len = Math.hypot(x0, x1, x2);\n\n if (!len) {\n x0 = 0;\n x1 = 0;\n x2 = 0;\n } else {\n len = 1 / len;\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n\n y0 = z1 * x2 - z2 * x1;\n y1 = z2 * x0 - z0 * x2;\n y2 = z0 * x1 - z1 * x0;\n len = Math.hypot(y0, y1, y2);\n\n if (!len) {\n y0 = 0;\n y1 = 0;\n y2 = 0;\n } else {\n len = 1 / len;\n y0 *= len;\n y1 *= len;\n y2 *= len;\n }\n\n out[0] = x0;\n out[1] = y0;\n out[2] = z0;\n out[3] = 0;\n out[4] = x1;\n out[5] = y1;\n out[6] = z1;\n out[7] = 0;\n out[8] = x2;\n out[9] = y2;\n out[10] = z2;\n out[11] = 0;\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\n out[15] = 1;\n return out;\n}\n/**\n * Generates a matrix that makes something look at something else.\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {ReadonlyVec3} eye Position of the viewer\n * @param {ReadonlyVec3} center Point the viewer is looking at\n * @param {ReadonlyVec3} up vec3 pointing up\n * @returns {mat4} out\n */\n\nexport function targetTo(out, eye, target, up) {\n var eyex = eye[0],\n eyey = eye[1],\n eyez = eye[2],\n upx = up[0],\n upy = up[1],\n upz = up[2];\n var z0 = eyex - target[0],\n z1 = eyey - target[1],\n z2 = eyez - target[2];\n var len = z0 * z0 + z1 * z1 + z2 * z2;\n\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n }\n\n var x0 = upy * z2 - upz * z1,\n x1 = upz * z0 - upx * z2,\n x2 = upx * z1 - upy * z0;\n len = x0 * x0 + x1 * x1 + x2 * x2;\n\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n\n out[0] = x0;\n out[1] = x1;\n out[2] = x2;\n out[3] = 0;\n out[4] = z1 * x2 - z2 * x1;\n out[5] = z2 * x0 - z0 * x2;\n out[6] = z0 * x1 - z1 * x0;\n out[7] = 0;\n out[8] = z0;\n out[9] = z1;\n out[10] = z2;\n out[11] = 0;\n out[12] = eyex;\n out[13] = eyey;\n out[14] = eyez;\n out[15] = 1;\n return out;\n}\n/**\n * Returns a string representation of a mat4\n *\n * @param {ReadonlyMat4} a matrix to represent as a string\n * @returns {String} string representation of the matrix\n */\n\nexport function str(a) {\n return \"mat4(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \", \" + a[3] + \", \" + a[4] + \", \" + a[5] + \", \" + a[6] + \", \" + a[7] + \", \" + a[8] + \", \" + a[9] + \", \" + a[10] + \", \" + a[11] + \", \" + a[12] + \", \" + a[13] + \", \" + a[14] + \", \" + a[15] + \")\";\n}\n/**\n * Returns Frobenius norm of a mat4\n *\n * @param {ReadonlyMat4} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\n\nexport function frob(a) {\n return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]);\n}\n/**\n * Adds two mat4's\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the first operand\n * @param {ReadonlyMat4} b the second operand\n * @returns {mat4} out\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n out[8] = a[8] + b[8];\n out[9] = a[9] + b[9];\n out[10] = a[10] + b[10];\n out[11] = a[11] + b[11];\n out[12] = a[12] + b[12];\n out[13] = a[13] + b[13];\n out[14] = a[14] + b[14];\n out[15] = a[15] + b[15];\n return out;\n}\n/**\n * Subtracts matrix b from matrix a\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the first operand\n * @param {ReadonlyMat4} b the second operand\n * @returns {mat4} out\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n out[6] = a[6] - b[6];\n out[7] = a[7] - b[7];\n out[8] = a[8] - b[8];\n out[9] = a[9] - b[9];\n out[10] = a[10] - b[10];\n out[11] = a[11] - b[11];\n out[12] = a[12] - b[12];\n out[13] = a[13] - b[13];\n out[14] = a[14] - b[14];\n out[15] = a[15] - b[15];\n return out;\n}\n/**\n * Multiply each element of the matrix by a scalar.\n *\n * @param {mat4} out the receiving matrix\n * @param {ReadonlyMat4} a the matrix to scale\n * @param {Number} b amount to scale the matrix's elements by\n * @returns {mat4} out\n */\n\nexport function multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n out[8] = a[8] * b;\n out[9] = a[9] * b;\n out[10] = a[10] * b;\n out[11] = a[11] * b;\n out[12] = a[12] * b;\n out[13] = a[13] * b;\n out[14] = a[14] * b;\n out[15] = a[15] * b;\n return out;\n}\n/**\n * Adds two mat4's after multiplying each element of the second operand by a scalar value.\n *\n * @param {mat4} out the receiving vector\n * @param {ReadonlyMat4} a the first operand\n * @param {ReadonlyMat4} b the second operand\n * @param {Number} scale the amount to scale b's elements by before adding\n * @returns {mat4} out\n */\n\nexport function multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n out[6] = a[6] + b[6] * scale;\n out[7] = a[7] + b[7] * scale;\n out[8] = a[8] + b[8] * scale;\n out[9] = a[9] + b[9] * scale;\n out[10] = a[10] + b[10] * scale;\n out[11] = a[11] + b[11] * scale;\n out[12] = a[12] + b[12] * scale;\n out[13] = a[13] + b[13] * scale;\n out[14] = a[14] + b[14] * scale;\n out[15] = a[15] + b[15] * scale;\n return out;\n}\n/**\n * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyMat4} a The first matrix.\n * @param {ReadonlyMat4} b The second matrix.\n * @returns {Boolean} True if the matrices are equal, false otherwise.\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15];\n}\n/**\n * Returns whether or not the matrices have approximately the same elements in the same position.\n *\n * @param {ReadonlyMat4} a The first matrix.\n * @param {ReadonlyMat4} b The second matrix.\n * @returns {Boolean} True if the matrices are equal, false otherwise.\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var a4 = a[4],\n a5 = a[5],\n a6 = a[6],\n a7 = a[7];\n var a8 = a[8],\n a9 = a[9],\n a10 = a[10],\n a11 = a[11];\n var a12 = a[12],\n a13 = a[13],\n a14 = a[14],\n a15 = a[15];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n var b4 = b[4],\n b5 = b[5],\n b6 = b[6],\n b7 = b[7];\n var b8 = b[8],\n b9 = b[9],\n b10 = b[10],\n b11 = b[11];\n var b12 = b[12],\n b13 = b[13],\n b14 = b[14],\n b15 = b[15];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a15), Math.abs(b15));\n}\n/**\n * Alias for {@link mat4.multiply}\n * @function\n */\n\nexport var mul = multiply;\n/**\n * Alias for {@link mat4.subtract}\n * @function\n */\n\nexport var sub = subtract;","import * as glMatrix from \"./common.js\";\n/**\n * 3 Dimensional Vector\n * @module vec3\n */\n\n/**\n * Creates a new, empty vec3\n *\n * @returns {vec3} a new 3D vector\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(3);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n }\n\n return out;\n}\n/**\n * Creates a new vec3 initialized with values from an existing vector\n *\n * @param {ReadonlyVec3} a vector to clone\n * @returns {vec3} a new 3D vector\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(3);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n}\n/**\n * Calculates the length of a vec3\n *\n * @param {ReadonlyVec3} a vector to calculate length of\n * @returns {Number} length of a\n */\n\nexport function length(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n return Math.hypot(x, y, z);\n}\n/**\n * Creates a new vec3 initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @returns {vec3} a new 3D vector\n */\n\nexport function fromValues(x, y, z) {\n var out = new glMatrix.ARRAY_TYPE(3);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n}\n/**\n * Copy the values from one vec3 to another\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the source vector\n * @returns {vec3} out\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n}\n/**\n * Set the components of a vec3 to the given values\n *\n * @param {vec3} out the receiving vector\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @returns {vec3} out\n */\n\nexport function set(out, x, y, z) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n}\n/**\n * Adds two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n return out;\n}\n/**\n * Subtracts vector b from vector a\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n return out;\n}\n/**\n * Multiplies two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\n\nexport function multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n return out;\n}\n/**\n * Divides two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\n\nexport function divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n return out;\n}\n/**\n * Math.ceil the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to ceil\n * @returns {vec3} out\n */\n\nexport function ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n return out;\n}\n/**\n * Math.floor the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to floor\n * @returns {vec3} out\n */\n\nexport function floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n return out;\n}\n/**\n * Returns the minimum of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\n\nexport function min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n return out;\n}\n/**\n * Returns the maximum of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\n\nexport function max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n return out;\n}\n/**\n * Math.round the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to round\n * @returns {vec3} out\n */\n\nexport function round(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n out[2] = Math.round(a[2]);\n return out;\n}\n/**\n * Scales a vec3 by a scalar number\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {vec3} out\n */\n\nexport function scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n return out;\n}\n/**\n * Adds two vec3's after scaling the second operand by a scalar value\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @param {Number} scale the amount to scale b by before adding\n * @returns {vec3} out\n */\n\nexport function scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n return out;\n}\n/**\n * Calculates the euclidian distance between two vec3's\n *\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {Number} distance between a and b\n */\n\nexport function distance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n return Math.hypot(x, y, z);\n}\n/**\n * Calculates the squared euclidian distance between two vec3's\n *\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {Number} squared distance between a and b\n */\n\nexport function squaredDistance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n return x * x + y * y + z * z;\n}\n/**\n * Calculates the squared length of a vec3\n *\n * @param {ReadonlyVec3} a vector to calculate squared length of\n * @returns {Number} squared length of a\n */\n\nexport function squaredLength(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n return x * x + y * y + z * z;\n}\n/**\n * Negates the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to negate\n * @returns {vec3} out\n */\n\nexport function negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n return out;\n}\n/**\n * Returns the inverse of the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to invert\n * @returns {vec3} out\n */\n\nexport function inverse(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n return out;\n}\n/**\n * Normalize a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a vector to normalize\n * @returns {vec3} out\n */\n\nexport function normalize(out, a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var len = x * x + y * y + z * z;\n\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n }\n\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n out[2] = a[2] * len;\n return out;\n}\n/**\n * Calculates the dot product of two vec3's\n *\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {Number} dot product of a and b\n */\n\nexport function dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n}\n/**\n * Computes the cross product of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @returns {vec3} out\n */\n\nexport function cross(out, a, b) {\n var ax = a[0],\n ay = a[1],\n az = a[2];\n var bx = b[0],\n by = b[1],\n bz = b[2];\n out[0] = ay * bz - az * by;\n out[1] = az * bx - ax * bz;\n out[2] = ax * by - ay * bx;\n return out;\n}\n/**\n * Performs a linear interpolation between two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {vec3} out\n */\n\nexport function lerp(out, a, b, t) {\n var ax = a[0];\n var ay = a[1];\n var az = a[2];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n return out;\n}\n/**\n * Performs a hermite interpolation with two control points\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @param {ReadonlyVec3} c the third operand\n * @param {ReadonlyVec3} d the fourth operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {vec3} out\n */\n\nexport function hermite(out, a, b, c, d, t) {\n var factorTimes2 = t * t;\n var factor1 = factorTimes2 * (2 * t - 3) + 1;\n var factor2 = factorTimes2 * (t - 2) + t;\n var factor3 = factorTimes2 * (t - 1);\n var factor4 = factorTimes2 * (3 - 2 * t);\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n return out;\n}\n/**\n * Performs a bezier interpolation with two control points\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the first operand\n * @param {ReadonlyVec3} b the second operand\n * @param {ReadonlyVec3} c the third operand\n * @param {ReadonlyVec3} d the fourth operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {vec3} out\n */\n\nexport function bezier(out, a, b, c, d, t) {\n var inverseFactor = 1 - t;\n var inverseFactorTimesTwo = inverseFactor * inverseFactor;\n var factorTimes2 = t * t;\n var factor1 = inverseFactorTimesTwo * inverseFactor;\n var factor2 = 3 * t * inverseFactorTimesTwo;\n var factor3 = 3 * factorTimes2 * inverseFactor;\n var factor4 = factorTimes2 * t;\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n return out;\n}\n/**\n * Generates a random vector with the given scale\n *\n * @param {vec3} out the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\n * @returns {vec3} out\n */\n\nexport function random(out, scale) {\n scale = scale || 1.0;\n var r = glMatrix.RANDOM() * 2.0 * Math.PI;\n var z = glMatrix.RANDOM() * 2.0 - 1.0;\n var zScale = Math.sqrt(1.0 - z * z) * scale;\n out[0] = Math.cos(r) * zScale;\n out[1] = Math.sin(r) * zScale;\n out[2] = z * scale;\n return out;\n}\n/**\n * Transforms the vec3 with a mat4.\n * 4th vector component is implicitly '1'\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the vector to transform\n * @param {ReadonlyMat4} m matrix to transform with\n * @returns {vec3} out\n */\n\nexport function transformMat4(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2];\n var w = m[3] * x + m[7] * y + m[11] * z + m[15];\n w = w || 1.0;\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n return out;\n}\n/**\n * Transforms the vec3 with a mat3.\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the vector to transform\n * @param {ReadonlyMat3} m the 3x3 matrix to transform with\n * @returns {vec3} out\n */\n\nexport function transformMat3(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2];\n out[0] = x * m[0] + y * m[3] + z * m[6];\n out[1] = x * m[1] + y * m[4] + z * m[7];\n out[2] = x * m[2] + y * m[5] + z * m[8];\n return out;\n}\n/**\n * Transforms the vec3 with a quat\n * Can also be used for dual quaternions. (Multiply it with the real part)\n *\n * @param {vec3} out the receiving vector\n * @param {ReadonlyVec3} a the vector to transform\n * @param {ReadonlyQuat} q quaternion to transform with\n * @returns {vec3} out\n */\n\nexport function transformQuat(out, a, q) {\n // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed\n var qx = q[0],\n qy = q[1],\n qz = q[2],\n qw = q[3];\n var x = a[0],\n y = a[1],\n z = a[2]; // var qvec = [qx, qy, qz];\n // var uv = vec3.cross([], qvec, a);\n\n var uvx = qy * z - qz * y,\n uvy = qz * x - qx * z,\n uvz = qx * y - qy * x; // var uuv = vec3.cross([], qvec, uv);\n\n var uuvx = qy * uvz - qz * uvy,\n uuvy = qz * uvx - qx * uvz,\n uuvz = qx * uvy - qy * uvx; // vec3.scale(uv, uv, 2 * w);\n\n var w2 = qw * 2;\n uvx *= w2;\n uvy *= w2;\n uvz *= w2; // vec3.scale(uuv, uuv, 2);\n\n uuvx *= 2;\n uuvy *= 2;\n uuvz *= 2; // return vec3.add(out, a, vec3.add(out, uv, uuv));\n\n out[0] = x + uvx + uuvx;\n out[1] = y + uvy + uuvy;\n out[2] = z + uvz + uuvz;\n return out;\n}\n/**\n * Rotate a 3D vector around the x-axis\n * @param {vec3} out The receiving vec3\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @returns {vec3} out\n */\n\nexport function rotateX(out, a, b, rad) {\n var p = [],\n r = []; //Translate point to the origin\n\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2]; //perform rotation\n\n r[0] = p[0];\n r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad);\n r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad); //translate to correct position\n\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\n * Rotate a 3D vector around the y-axis\n * @param {vec3} out The receiving vec3\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @returns {vec3} out\n */\n\nexport function rotateY(out, a, b, rad) {\n var p = [],\n r = []; //Translate point to the origin\n\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2]; //perform rotation\n\n r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad);\n r[1] = p[1];\n r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad); //translate to correct position\n\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\n * Rotate a 3D vector around the z-axis\n * @param {vec3} out The receiving vec3\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @returns {vec3} out\n */\n\nexport function rotateZ(out, a, b, rad) {\n var p = [],\n r = []; //Translate point to the origin\n\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2]; //perform rotation\n\n r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad);\n r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad);\n r[2] = p[2]; //translate to correct position\n\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\n * Get the angle between two 3D vectors\n * @param {ReadonlyVec3} a The first operand\n * @param {ReadonlyVec3} b The second operand\n * @returns {Number} The angle in radians\n */\n\nexport function angle(a, b) {\n var ax = a[0],\n ay = a[1],\n az = a[2],\n bx = b[0],\n by = b[1],\n bz = b[2],\n mag1 = Math.sqrt(ax * ax + ay * ay + az * az),\n mag2 = Math.sqrt(bx * bx + by * by + bz * bz),\n mag = mag1 * mag2,\n cosine = mag && dot(a, b) / mag;\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\n}\n/**\n * Set the components of a vec3 to zero\n *\n * @param {vec3} out the receiving vector\n * @returns {vec3} out\n */\n\nexport function zero(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n out[2] = 0.0;\n return out;\n}\n/**\n * Returns a string representation of a vector\n *\n * @param {ReadonlyVec3} a vector to represent as a string\n * @returns {String} string representation of the vector\n */\n\nexport function str(a) {\n return \"vec3(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \")\";\n}\n/**\n * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyVec3} a The first vector.\n * @param {ReadonlyVec3} b The second vector.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n}\n/**\n * Returns whether or not the vectors have approximately the same elements in the same position.\n *\n * @param {ReadonlyVec3} a The first vector.\n * @param {ReadonlyVec3} b The second vector.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2));\n}\n/**\n * Alias for {@link vec3.subtract}\n * @function\n */\n\nexport var sub = subtract;\n/**\n * Alias for {@link vec3.multiply}\n * @function\n */\n\nexport var mul = multiply;\n/**\n * Alias for {@link vec3.divide}\n * @function\n */\n\nexport var div = divide;\n/**\n * Alias for {@link vec3.distance}\n * @function\n */\n\nexport var dist = distance;\n/**\n * Alias for {@link vec3.squaredDistance}\n * @function\n */\n\nexport var sqrDist = squaredDistance;\n/**\n * Alias for {@link vec3.length}\n * @function\n */\n\nexport var len = length;\n/**\n * Alias for {@link vec3.squaredLength}\n * @function\n */\n\nexport var sqrLen = squaredLength;\n/**\n * Perform some operation over an array of vec3s.\n *\n * @param {Array} a the array of vectors to iterate over\n * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed\n * @param {Number} offset Number of elements to skip at the beginning of the array\n * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array\n * @param {Function} fn Function to call for each vector in the array\n * @param {Object} [arg] additional argument to pass to fn\n * @returns {Array} a\n * @function\n */\n\nexport var forEach = function () {\n var vec = create();\n return function (a, stride, offset, count, fn, arg) {\n var i, l;\n\n if (!stride) {\n stride = 3;\n }\n\n if (!offset) {\n offset = 0;\n }\n\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n vec[2] = a[i + 2];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n a[i + 2] = vec[2];\n }\n\n return a;\n };\n}();","import * as glMatrix from \"./common.js\";\n/**\n * 4 Dimensional Vector\n * @module vec4\n */\n\n/**\n * Creates a new, empty vec4\n *\n * @returns {vec4} a new 4D vector\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(4);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n }\n\n return out;\n}\n/**\n * Creates a new vec4 initialized with values from an existing vector\n *\n * @param {ReadonlyVec4} a vector to clone\n * @returns {vec4} a new 4D vector\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n/**\n * Creates a new vec4 initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {vec4} a new 4D vector\n */\n\nexport function fromValues(x, y, z, w) {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n}\n/**\n * Copy the values from one vec4 to another\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the source vector\n * @returns {vec4} out\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n/**\n * Set the components of a vec4 to the given values\n *\n * @param {vec4} out the receiving vector\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {vec4} out\n */\n\nexport function set(out, x, y, z, w) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n}\n/**\n * Adds two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {vec4} out\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n return out;\n}\n/**\n * Subtracts vector b from vector a\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {vec4} out\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n return out;\n}\n/**\n * Multiplies two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {vec4} out\n */\n\nexport function multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n out[3] = a[3] * b[3];\n return out;\n}\n/**\n * Divides two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {vec4} out\n */\n\nexport function divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n out[3] = a[3] / b[3];\n return out;\n}\n/**\n * Math.ceil the components of a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a vector to ceil\n * @returns {vec4} out\n */\n\nexport function ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n out[3] = Math.ceil(a[3]);\n return out;\n}\n/**\n * Math.floor the components of a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a vector to floor\n * @returns {vec4} out\n */\n\nexport function floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n out[3] = Math.floor(a[3]);\n return out;\n}\n/**\n * Returns the minimum of two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {vec4} out\n */\n\nexport function min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n out[3] = Math.min(a[3], b[3]);\n return out;\n}\n/**\n * Returns the maximum of two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {vec4} out\n */\n\nexport function max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n out[3] = Math.max(a[3], b[3]);\n return out;\n}\n/**\n * Math.round the components of a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a vector to round\n * @returns {vec4} out\n */\n\nexport function round(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n out[2] = Math.round(a[2]);\n out[3] = Math.round(a[3]);\n return out;\n}\n/**\n * Scales a vec4 by a scalar number\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {vec4} out\n */\n\nexport function scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n return out;\n}\n/**\n * Adds two vec4's after scaling the second operand by a scalar value\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @param {Number} scale the amount to scale b by before adding\n * @returns {vec4} out\n */\n\nexport function scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n return out;\n}\n/**\n * Calculates the euclidian distance between two vec4's\n *\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {Number} distance between a and b\n */\n\nexport function distance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n var w = b[3] - a[3];\n return Math.hypot(x, y, z, w);\n}\n/**\n * Calculates the squared euclidian distance between two vec4's\n *\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {Number} squared distance between a and b\n */\n\nexport function squaredDistance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n var w = b[3] - a[3];\n return x * x + y * y + z * z + w * w;\n}\n/**\n * Calculates the length of a vec4\n *\n * @param {ReadonlyVec4} a vector to calculate length of\n * @returns {Number} length of a\n */\n\nexport function length(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var w = a[3];\n return Math.hypot(x, y, z, w);\n}\n/**\n * Calculates the squared length of a vec4\n *\n * @param {ReadonlyVec4} a vector to calculate squared length of\n * @returns {Number} squared length of a\n */\n\nexport function squaredLength(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var w = a[3];\n return x * x + y * y + z * z + w * w;\n}\n/**\n * Negates the components of a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a vector to negate\n * @returns {vec4} out\n */\n\nexport function negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = -a[3];\n return out;\n}\n/**\n * Returns the inverse of the components of a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a vector to invert\n * @returns {vec4} out\n */\n\nexport function inverse(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n out[3] = 1.0 / a[3];\n return out;\n}\n/**\n * Normalize a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a vector to normalize\n * @returns {vec4} out\n */\n\nexport function normalize(out, a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var w = a[3];\n var len = x * x + y * y + z * z + w * w;\n\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n }\n\n out[0] = x * len;\n out[1] = y * len;\n out[2] = z * len;\n out[3] = w * len;\n return out;\n}\n/**\n * Calculates the dot product of two vec4's\n *\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @returns {Number} dot product of a and b\n */\n\nexport function dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n}\n/**\n * Returns the cross-product of three vectors in a 4-dimensional space\n *\n * @param {ReadonlyVec4} result the receiving vector\n * @param {ReadonlyVec4} U the first vector\n * @param {ReadonlyVec4} V the second vector\n * @param {ReadonlyVec4} W the third vector\n * @returns {vec4} result\n */\n\nexport function cross(out, u, v, w) {\n var A = v[0] * w[1] - v[1] * w[0],\n B = v[0] * w[2] - v[2] * w[0],\n C = v[0] * w[3] - v[3] * w[0],\n D = v[1] * w[2] - v[2] * w[1],\n E = v[1] * w[3] - v[3] * w[1],\n F = v[2] * w[3] - v[3] * w[2];\n var G = u[0];\n var H = u[1];\n var I = u[2];\n var J = u[3];\n out[0] = H * F - I * E + J * D;\n out[1] = -(G * F) + I * C - J * B;\n out[2] = G * E - H * C + J * A;\n out[3] = -(G * D) + H * B - I * A;\n return out;\n}\n/**\n * Performs a linear interpolation between two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the first operand\n * @param {ReadonlyVec4} b the second operand\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\n * @returns {vec4} out\n */\n\nexport function lerp(out, a, b, t) {\n var ax = a[0];\n var ay = a[1];\n var az = a[2];\n var aw = a[3];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n out[3] = aw + t * (b[3] - aw);\n return out;\n}\n/**\n * Generates a random vector with the given scale\n *\n * @param {vec4} out the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\n * @returns {vec4} out\n */\n\nexport function random(out, scale) {\n scale = scale || 1.0; // Marsaglia, George. Choosing a Point from the Surface of a\n // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646.\n // http://projecteuclid.org/euclid.aoms/1177692644;\n\n var v1, v2, v3, v4;\n var s1, s2;\n\n do {\n v1 = glMatrix.RANDOM() * 2 - 1;\n v2 = glMatrix.RANDOM() * 2 - 1;\n s1 = v1 * v1 + v2 * v2;\n } while (s1 >= 1);\n\n do {\n v3 = glMatrix.RANDOM() * 2 - 1;\n v4 = glMatrix.RANDOM() * 2 - 1;\n s2 = v3 * v3 + v4 * v4;\n } while (s2 >= 1);\n\n var d = Math.sqrt((1 - s1) / s2);\n out[0] = scale * v1;\n out[1] = scale * v2;\n out[2] = scale * v3 * d;\n out[3] = scale * v4 * d;\n return out;\n}\n/**\n * Transforms the vec4 with a mat4.\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the vector to transform\n * @param {ReadonlyMat4} m matrix to transform with\n * @returns {vec4} out\n */\n\nexport function transformMat4(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n}\n/**\n * Transforms the vec4 with a quat\n *\n * @param {vec4} out the receiving vector\n * @param {ReadonlyVec4} a the vector to transform\n * @param {ReadonlyQuat} q quaternion to transform with\n * @returns {vec4} out\n */\n\nexport function transformQuat(out, a, q) {\n var x = a[0],\n y = a[1],\n z = a[2];\n var qx = q[0],\n qy = q[1],\n qz = q[2],\n qw = q[3]; // calculate quat * vec\n\n var ix = qw * x + qy * z - qz * y;\n var iy = qw * y + qz * x - qx * z;\n var iz = qw * z + qx * y - qy * x;\n var iw = -qx * x - qy * y - qz * z; // calculate result * inverse quat\n\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n out[3] = a[3];\n return out;\n}\n/**\n * Set the components of a vec4 to zero\n *\n * @param {vec4} out the receiving vector\n * @returns {vec4} out\n */\n\nexport function zero(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n return out;\n}\n/**\n * Returns a string representation of a vector\n *\n * @param {ReadonlyVec4} a vector to represent as a string\n * @returns {String} string representation of the vector\n */\n\nexport function str(a) {\n return \"vec4(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \", \" + a[3] + \")\";\n}\n/**\n * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)\n *\n * @param {ReadonlyVec4} a The first vector.\n * @param {ReadonlyVec4} b The second vector.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n/**\n * Returns whether or not the vectors have approximately the same elements in the same position.\n *\n * @param {ReadonlyVec4} a The first vector.\n * @param {ReadonlyVec4} b The second vector.\n * @returns {Boolean} True if the vectors are equal, false otherwise.\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3));\n}\n/**\n * Alias for {@link vec4.subtract}\n * @function\n */\n\nexport var sub = subtract;\n/**\n * Alias for {@link vec4.multiply}\n * @function\n */\n\nexport var mul = multiply;\n/**\n * Alias for {@link vec4.divide}\n * @function\n */\n\nexport var div = divide;\n/**\n * Alias for {@link vec4.distance}\n * @function\n */\n\nexport var dist = distance;\n/**\n * Alias for {@link vec4.squaredDistance}\n * @function\n */\n\nexport var sqrDist = squaredDistance;\n/**\n * Alias for {@link vec4.length}\n * @function\n */\n\nexport var len = length;\n/**\n * Alias for {@link vec4.squaredLength}\n * @function\n */\n\nexport var sqrLen = squaredLength;\n/**\n * Perform some operation over an array of vec4s.\n *\n * @param {Array} a the array of vectors to iterate over\n * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed\n * @param {Number} offset Number of elements to skip at the beginning of the array\n * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array\n * @param {Function} fn Function to call for each vector in the array\n * @param {Object} [arg] additional argument to pass to fn\n * @returns {Array} a\n * @function\n */\n\nexport var forEach = function () {\n var vec = create();\n return function (a, stride, offset, count, fn, arg) {\n var i, l;\n\n if (!stride) {\n stride = 4;\n }\n\n if (!offset) {\n offset = 0;\n }\n\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n vec[2] = a[i + 2];\n vec[3] = a[i + 3];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n a[i + 2] = vec[2];\n a[i + 3] = vec[3];\n }\n\n return a;\n };\n}();","module.exports = slerp\n\n/**\n * Performs a spherical linear interpolation between two quat\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a the first operand\n * @param {quat} b the second operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {quat} out\n */\nfunction slerp (out, a, b, t) {\n // benchmarks:\n // http://jsperf.com/quaternion-slerp-implementations\n\n var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n bx = b[0], by = b[1], bz = b[2], bw = b[3]\n\n var omega, cosom, sinom, scale0, scale1\n\n // calc cosine\n cosom = ax * bx + ay * by + az * bz + aw * bw\n // adjust signs (if necessary)\n if (cosom < 0.0) {\n cosom = -cosom\n bx = -bx\n by = -by\n bz = -bz\n bw = -bw\n }\n // calculate coefficients\n if ((1.0 - cosom) > 0.000001) {\n // standard case (slerp)\n omega = Math.acos(cosom)\n sinom = Math.sin(omega)\n scale0 = Math.sin((1.0 - t) * omega) / sinom\n scale1 = Math.sin(t * omega) / sinom\n } else {\n // \"from\" and \"to\" quaternions are very close\n // ... so we can do a linear interpolation\n scale0 = 1.0 - t\n scale1 = t\n }\n // calculate final values\n out[0] = scale0 * ax + scale1 * bx\n out[1] = scale0 * ay + scale1 * by\n out[2] = scale0 * az + scale1 * bz\n out[3] = scale0 * aw + scale1 * bw\n\n return out\n}\n","module.exports = cross;\n\n/**\n * Computes the cross product of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nfunction cross(out, a, b) {\n var ax = a[0], ay = a[1], az = a[2],\n bx = b[0], by = b[1], bz = b[2]\n\n out[0] = ay * bz - az * by\n out[1] = az * bx - ax * bz\n out[2] = ax * by - ay * bx\n return out\n}","module.exports = dot;\n\n/**\n * Calculates the dot product of two vec3's\n *\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {Number} dot product of a and b\n */\nfunction dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]\n}","module.exports = length;\n\n/**\n * Calculates the length of a vec3\n *\n * @param {vec3} a vector to calculate length of\n * @returns {Number} length of a\n */\nfunction length(a) {\n var x = a[0],\n y = a[1],\n z = a[2]\n return Math.sqrt(x*x + y*y + z*z)\n}","module.exports = lerp;\n\n/**\n * Performs a linear interpolation between two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {vec3} out\n */\nfunction lerp(out, a, b, t) {\n var ax = a[0],\n ay = a[1],\n az = a[2]\n out[0] = ax + t * (b[0] - ax)\n out[1] = ay + t * (b[1] - ay)\n out[2] = az + t * (b[2] - az)\n return out\n}","module.exports = normalize;\n\n/**\n * Normalize a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a vector to normalize\n * @returns {vec3} out\n */\nfunction normalize(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2]\n var len = x*x + y*y + z*z\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len)\n out[0] = a[0] * len\n out[1] = a[1] * len\n out[2] = a[2] * len\n }\n return out\n}","'use strict'\r\n\r\nvar isBrowser = require('is-browser')\r\n\r\nfunction detect() {\r\n\tvar supported = false\r\n\r\n\ttry {\r\n\t\tvar opts = Object.defineProperty({}, 'passive', {\r\n\t\t\tget: function() {\r\n\t\t\t\tsupported = true\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\twindow.addEventListener('test', null, opts)\r\n\t\twindow.removeEventListener('test', null, opts)\r\n\t} catch(e) {\r\n\t\tsupported = false\r\n\t}\r\n\r\n\treturn supported\r\n}\r\n\r\nmodule.exports = isBrowser && detect()\r\n","module.exports = true;","/*jshint unused:true*/\n/*\nInput: matrix ; a 4x4 matrix\nOutput: translation ; a 3 component vector\n scale ; a 3 component vector\n skew ; skew factors XY,XZ,YZ represented as a 3 component vector\n perspective ; a 4 component vector\n quaternion ; a 4 component vector\nReturns false if the matrix cannot be decomposed, true if it can\n\n\nReferences:\nhttps://github.com/kamicane/matrix3d/blob/master/lib/Matrix3d.js\nhttps://github.com/ChromiumWebApps/chromium/blob/master/ui/gfx/transform_util.cc\nhttp://www.w3.org/TR/css3-transforms/#decomposing-a-3d-matrix\n*/\n\nvar normalize = require('./normalize')\n\nvar create = require('gl-mat4/create')\nvar clone = require('gl-mat4/clone')\nvar determinant = require('gl-mat4/determinant')\nvar invert = require('gl-mat4/invert')\nvar transpose = require('gl-mat4/transpose')\nvar vec3 = {\n length: require('gl-vec3/length'),\n normalize: require('gl-vec3/normalize'),\n dot: require('gl-vec3/dot'),\n cross: require('gl-vec3/cross')\n}\n\nvar tmp = create()\nvar perspectiveMatrix = create()\nvar tmpVec4 = [0, 0, 0, 0]\nvar row = [ [0,0,0], [0,0,0], [0,0,0] ]\nvar pdum3 = [0,0,0]\n\nmodule.exports = function decomposeMat4(matrix, translation, scale, skew, perspective, quaternion) {\n if (!translation) translation = [0,0,0]\n if (!scale) scale = [0,0,0]\n if (!skew) skew = [0,0,0]\n if (!perspective) perspective = [0,0,0,1]\n if (!quaternion) quaternion = [0,0,0,1]\n\n //normalize, if not possible then bail out early\n if (!normalize(tmp, matrix))\n return false\n\n // perspectiveMatrix is used to solve for perspective, but it also provides\n // an easy way to test for singularity of the upper 3x3 component.\n clone(perspectiveMatrix, tmp)\n\n perspectiveMatrix[3] = 0\n perspectiveMatrix[7] = 0\n perspectiveMatrix[11] = 0\n perspectiveMatrix[15] = 1\n\n // If the perspectiveMatrix is not invertible, we are also unable to\n // decompose, so we'll bail early. Constant taken from SkMatrix44::invert.\n if (Math.abs(determinant(perspectiveMatrix) < 1e-8))\n return false\n\n var a03 = tmp[3], a13 = tmp[7], a23 = tmp[11],\n a30 = tmp[12], a31 = tmp[13], a32 = tmp[14], a33 = tmp[15]\n\n // First, isolate perspective.\n if (a03 !== 0 || a13 !== 0 || a23 !== 0) {\n tmpVec4[0] = a03\n tmpVec4[1] = a13\n tmpVec4[2] = a23\n tmpVec4[3] = a33\n\n // Solve the equation by inverting perspectiveMatrix and multiplying\n // rightHandSide by the inverse.\n // resuing the perspectiveMatrix here since it's no longer needed\n var ret = invert(perspectiveMatrix, perspectiveMatrix)\n if (!ret) return false\n transpose(perspectiveMatrix, perspectiveMatrix)\n\n //multiply by transposed inverse perspective matrix, into perspective vec4\n vec4multMat4(perspective, tmpVec4, perspectiveMatrix)\n } else { \n //no perspective\n perspective[0] = perspective[1] = perspective[2] = 0\n perspective[3] = 1\n }\n\n // Next take care of translation\n translation[0] = a30\n translation[1] = a31\n translation[2] = a32\n\n // Now get scale and shear. 'row' is a 3 element array of 3 component vectors\n mat3from4(row, tmp)\n\n // Compute X scale factor and normalize first row.\n scale[0] = vec3.length(row[0])\n vec3.normalize(row[0], row[0])\n\n // Compute XY shear factor and make 2nd row orthogonal to 1st.\n skew[0] = vec3.dot(row[0], row[1])\n combine(row[1], row[1], row[0], 1.0, -skew[0])\n\n // Now, compute Y scale and normalize 2nd row.\n scale[1] = vec3.length(row[1])\n vec3.normalize(row[1], row[1])\n skew[0] /= scale[1]\n\n // Compute XZ and YZ shears, orthogonalize 3rd row\n skew[1] = vec3.dot(row[0], row[2])\n combine(row[2], row[2], row[0], 1.0, -skew[1])\n skew[2] = vec3.dot(row[1], row[2])\n combine(row[2], row[2], row[1], 1.0, -skew[2])\n\n // Next, get Z scale and normalize 3rd row.\n scale[2] = vec3.length(row[2])\n vec3.normalize(row[2], row[2])\n skew[1] /= scale[2]\n skew[2] /= scale[2]\n\n\n // At this point, the matrix (in rows) is orthonormal.\n // Check for a coordinate system flip. If the determinant\n // is -1, then negate the matrix and the scaling factors.\n vec3.cross(pdum3, row[1], row[2])\n if (vec3.dot(row[0], pdum3) < 0) {\n for (var i = 0; i < 3; i++) {\n scale[i] *= -1;\n row[i][0] *= -1\n row[i][1] *= -1\n row[i][2] *= -1\n }\n }\n\n // Now, get the rotations out\n quaternion[0] = 0.5 * Math.sqrt(Math.max(1 + row[0][0] - row[1][1] - row[2][2], 0))\n quaternion[1] = 0.5 * Math.sqrt(Math.max(1 - row[0][0] + row[1][1] - row[2][2], 0))\n quaternion[2] = 0.5 * Math.sqrt(Math.max(1 - row[0][0] - row[1][1] + row[2][2], 0))\n quaternion[3] = 0.5 * Math.sqrt(Math.max(1 + row[0][0] + row[1][1] + row[2][2], 0))\n\n if (row[2][1] > row[1][2])\n quaternion[0] = -quaternion[0]\n if (row[0][2] > row[2][0])\n quaternion[1] = -quaternion[1]\n if (row[1][0] > row[0][1])\n quaternion[2] = -quaternion[2]\n return true\n}\n\n//will be replaced by gl-vec4 eventually\nfunction vec4multMat4(out, a, m) {\n var x = a[0], y = a[1], z = a[2], w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n}\n\n//gets upper-left of a 4x4 matrix into a 3x3 of vectors\nfunction mat3from4(out, mat4x4) {\n out[0][0] = mat4x4[0]\n out[0][1] = mat4x4[1]\n out[0][2] = mat4x4[2]\n \n out[1][0] = mat4x4[4]\n out[1][1] = mat4x4[5]\n out[1][2] = mat4x4[6]\n\n out[2][0] = mat4x4[8]\n out[2][1] = mat4x4[9]\n out[2][2] = mat4x4[10]\n}\n\nfunction combine(out, a, b, scale1, scale2) {\n out[0] = a[0] * scale1 + b[0] * scale2\n out[1] = a[1] * scale1 + b[1] * scale2\n out[2] = a[2] * scale1 + b[2] * scale2\n}","module.exports = function normalize(out, mat) {\n var m44 = mat[15]\n // Cannot normalize.\n if (m44 === 0) \n return false\n var scale = 1 / m44\n for (var i=0; i<16; i++)\n out[i] = mat[i] * scale\n return true\n}","var lerp = require('gl-vec3/lerp')\n\nvar recompose = require('mat4-recompose')\nvar decompose = require('mat4-decompose')\nvar determinant = require('gl-mat4/determinant')\nvar slerp = require('quat-slerp')\n\nvar state0 = state()\nvar state1 = state()\nvar tmp = state()\n\nmodule.exports = interpolate\nfunction interpolate(out, start, end, alpha) {\n if (determinant(start) === 0 || determinant(end) === 0)\n return false\n\n //decompose the start and end matrices into individual components\n var r0 = decompose(start, state0.translate, state0.scale, state0.skew, state0.perspective, state0.quaternion)\n var r1 = decompose(end, state1.translate, state1.scale, state1.skew, state1.perspective, state1.quaternion)\n if (!r0 || !r1)\n return false \n\n\n //now lerp/slerp the start and end components into a temporary lerp(tmptranslate, state0.translate, state1.translate, alpha)\n lerp(tmp.translate, state0.translate, state1.translate, alpha)\n lerp(tmp.skew, state0.skew, state1.skew, alpha)\n lerp(tmp.scale, state0.scale, state1.scale, alpha)\n lerp(tmp.perspective, state0.perspective, state1.perspective, alpha)\n slerp(tmp.quaternion, state0.quaternion, state1.quaternion, alpha)\n\n //and recompose into our 'out' matrix\n recompose(out, tmp.translate, tmp.scale, tmp.skew, tmp.perspective, tmp.quaternion)\n return true\n}\n\nfunction state() {\n return {\n translate: vec3(),\n scale: vec3(1),\n skew: vec3(),\n perspective: vec4(),\n quaternion: vec4()\n }\n}\n\nfunction vec3(n) {\n return [n||0,n||0,n||0]\n}\n\nfunction vec4() {\n return [0,0,0,1]\n}","/*\nInput: translation ; a 3 component vector\n scale ; a 3 component vector\n skew ; skew factors XY,XZ,YZ represented as a 3 component vector\n perspective ; a 4 component vector\n quaternion ; a 4 component vector\nOutput: matrix ; a 4x4 matrix\n\nFrom: http://www.w3.org/TR/css3-transforms/#recomposing-to-a-3d-matrix\n*/\n\nvar mat4 = {\n identity: require('gl-mat4/identity'),\n translate: require('gl-mat4/translate'),\n multiply: require('gl-mat4/multiply'),\n create: require('gl-mat4/create'),\n scale: require('gl-mat4/scale'),\n fromRotationTranslation: require('gl-mat4/fromRotationTranslation')\n}\n\nvar rotationMatrix = mat4.create()\nvar temp = mat4.create()\n\nmodule.exports = function recomposeMat4(matrix, translation, scale, skew, perspective, quaternion) {\n mat4.identity(matrix)\n\n //apply translation & rotation\n mat4.fromRotationTranslation(matrix, quaternion, translation)\n\n //apply perspective\n matrix[3] = perspective[0]\n matrix[7] = perspective[1]\n matrix[11] = perspective[2]\n matrix[15] = perspective[3]\n \n // apply skew\n // temp is a identity 4x4 matrix initially\n mat4.identity(temp)\n\n if (skew[2] !== 0) {\n temp[9] = skew[2]\n mat4.multiply(matrix, matrix, temp)\n }\n\n if (skew[1] !== 0) {\n temp[9] = 0\n temp[8] = skew[1]\n mat4.multiply(matrix, matrix, temp)\n }\n\n if (skew[0] !== 0) {\n temp[8] = 0\n temp[4] = skew[0]\n mat4.multiply(matrix, matrix, temp)\n }\n\n //apply scale\n mat4.scale(matrix, matrix, scale)\n return matrix\n}","'use strict'\n\nvar bsearch = require('binary-search-bounds')\nvar m4interp = require('mat4-interpolate')\nvar invert44 = require('gl-mat4/invert')\nvar rotateX = require('gl-mat4/rotateX')\nvar rotateY = require('gl-mat4/rotateY')\nvar rotateZ = require('gl-mat4/rotateZ')\nvar lookAt = require('gl-mat4/lookAt')\nvar translate = require('gl-mat4/translate')\nvar scale = require('gl-mat4/scale')\nvar normalize = require('gl-vec3/normalize')\n\nvar DEFAULT_CENTER = [0,0,0]\n\nmodule.exports = createMatrixCameraController\n\nfunction MatrixCameraController(initialMatrix) {\n this._components = initialMatrix.slice()\n this._time = [0]\n this.prevMatrix = initialMatrix.slice()\n this.nextMatrix = initialMatrix.slice()\n this.computedMatrix = initialMatrix.slice()\n this.computedInverse = initialMatrix.slice()\n this.computedEye = [0,0,0]\n this.computedUp = [0,0,0]\n this.computedCenter = [0,0,0]\n this.computedRadius = [0]\n this._limits = [-Infinity, Infinity]\n}\n\nvar proto = MatrixCameraController.prototype\n\nproto.recalcMatrix = function(t) {\n var time = this._time\n var tidx = bsearch.le(time, t)\n var mat = this.computedMatrix\n if(tidx < 0) {\n return\n }\n var comps = this._components\n if(tidx === time.length-1) {\n var ptr = 16*tidx\n for(var i=0; i<16; ++i) {\n mat[i] = comps[ptr++]\n }\n } else {\n var dt = (time[tidx+1] - time[tidx])\n var ptr = 16*tidx\n var prev = this.prevMatrix\n var allEqual = true\n for(var i=0; i<16; ++i) {\n prev[i] = comps[ptr++]\n }\n var next = this.nextMatrix\n for(var i=0; i<16; ++i) {\n next[i] = comps[ptr++]\n allEqual = allEqual && (prev[i] === next[i])\n }\n if(dt < 1e-6 || allEqual) {\n for(var i=0; i<16; ++i) {\n mat[i] = prev[i]\n }\n } else {\n m4interp(mat, prev, next, (t - time[tidx])/dt)\n }\n }\n\n var up = this.computedUp\n up[0] = mat[1]\n up[1] = mat[5]\n up[2] = mat[9]\n normalize(up, up)\n\n var imat = this.computedInverse\n invert44(imat, mat)\n var eye = this.computedEye\n var w = imat[15]\n eye[0] = imat[12]/w\n eye[1] = imat[13]/w\n eye[2] = imat[14]/w\n\n var center = this.computedCenter\n var radius = Math.exp(this.computedRadius[0])\n for(var i=0; i<3; ++i) {\n center[i] = eye[i] - mat[2+4*i] * radius\n }\n}\n\nproto.idle = function(t) {\n if(t < this.lastT()) {\n return\n }\n var mc = this._components\n var ptr = mc.length-16\n for(var i=0; i<16; ++i) {\n mc.push(mc[ptr++])\n }\n this._time.push(t)\n}\n\nproto.flush = function(t) {\n var idx = bsearch.gt(this._time, t) - 2\n if(idx < 0) {\n return\n }\n this._time.splice(0, idx)\n this._components.splice(0, 16*idx)\n}\n\nproto.lastT = function() {\n return this._time[this._time.length-1]\n}\n\nproto.lookAt = function(t, eye, center, up) {\n this.recalcMatrix(t)\n eye = eye || this.computedEye\n center = center || DEFAULT_CENTER\n up = up || this.computedUp\n this.setMatrix(t, lookAt(this.computedMatrix, eye, center, up))\n var d2 = 0.0\n for(var i=0; i<3; ++i) {\n d2 += Math.pow(center[i] - eye[i], 2)\n }\n d2 = Math.log(Math.sqrt(d2))\n this.computedRadius[0] = d2\n}\n\nproto.rotate = function(t, yaw, pitch, roll) {\n this.recalcMatrix(t)\n var mat = this.computedInverse\n if(yaw) rotateY(mat, mat, yaw)\n if(pitch) rotateX(mat, mat, pitch)\n if(roll) rotateZ(mat, mat, roll)\n this.setMatrix(t, invert44(this.computedMatrix, mat))\n}\n\nvar tvec = [0,0,0]\n\nproto.pan = function(t, dx, dy, dz) {\n tvec[0] = -(dx || 0.0)\n tvec[1] = -(dy || 0.0)\n tvec[2] = -(dz || 0.0)\n this.recalcMatrix(t)\n var mat = this.computedInverse\n translate(mat, mat, tvec)\n this.setMatrix(t, invert44(mat, mat))\n}\n\nproto.translate = function(t, dx, dy, dz) {\n tvec[0] = dx || 0.0\n tvec[1] = dy || 0.0\n tvec[2] = dz || 0.0\n this.recalcMatrix(t)\n var mat = this.computedMatrix\n translate(mat, mat, tvec)\n this.setMatrix(t, mat)\n}\n\nproto.setMatrix = function(t, mat) {\n if(t < this.lastT()) {\n return\n }\n this._time.push(t)\n for(var i=0; i<16; ++i) {\n this._components.push(mat[i])\n }\n}\n\nproto.setDistance = function(t, d) {\n this.computedRadius[0] = d\n}\n\nproto.setDistanceLimits = function(a,b) {\n var lim = this._limits\n lim[0] = a\n lim[1] = b\n}\n\nproto.getDistanceLimits = function(out) {\n var lim = this._limits\n if(out) {\n out[0] = lim[0]\n out[1] = lim[1]\n return out\n }\n return lim\n}\n\nfunction createMatrixCameraController(options) {\n options = options || {}\n var matrix = options.matrix || \n [1,0,0,0,\n 0,1,0,0,\n 0,0,1,0,\n 0,0,0,1]\n return new MatrixCameraController(matrix)\n}\n","'use strict'\n\nmodule.exports = mouseListen\n\nvar mouse = require('mouse-event')\n\nfunction mouseListen (element, callback) {\n if (!callback) {\n callback = element\n element = window\n }\n\n var buttonState = 0\n var x = 0\n var y = 0\n var mods = {\n shift: false,\n alt: false,\n control: false,\n meta: false\n }\n var attached = false\n\n function updateMods (ev) {\n var changed = false\n if ('altKey' in ev) {\n changed = changed || ev.altKey !== mods.alt\n mods.alt = !!ev.altKey\n }\n if ('shiftKey' in ev) {\n changed = changed || ev.shiftKey !== mods.shift\n mods.shift = !!ev.shiftKey\n }\n if ('ctrlKey' in ev) {\n changed = changed || ev.ctrlKey !== mods.control\n mods.control = !!ev.ctrlKey\n }\n if ('metaKey' in ev) {\n changed = changed || ev.metaKey !== mods.meta\n mods.meta = !!ev.metaKey\n }\n return changed\n }\n\n function handleEvent (nextButtons, ev) {\n var nextX = mouse.x(ev)\n var nextY = mouse.y(ev)\n if ('buttons' in ev) {\n nextButtons = ev.buttons | 0\n }\n if (nextButtons !== buttonState ||\n nextX !== x ||\n nextY !== y ||\n updateMods(ev)) {\n buttonState = nextButtons | 0\n x = nextX || 0\n y = nextY || 0\n callback && callback(buttonState, x, y, mods)\n }\n }\n\n function clearState (ev) {\n handleEvent(0, ev)\n }\n\n function handleBlur () {\n if (buttonState ||\n x ||\n y ||\n mods.shift ||\n mods.alt ||\n mods.meta ||\n mods.control) {\n x = y = 0\n buttonState = 0\n mods.shift = mods.alt = mods.control = mods.meta = false\n callback && callback(0, 0, 0, mods)\n }\n }\n\n function handleMods (ev) {\n if (updateMods(ev)) {\n callback && callback(buttonState, x, y, mods)\n }\n }\n\n function handleMouseMove (ev) {\n if (mouse.buttons(ev) === 0) {\n handleEvent(0, ev)\n } else {\n handleEvent(buttonState, ev)\n }\n }\n\n function handleMouseDown (ev) {\n handleEvent(buttonState | mouse.buttons(ev), ev)\n }\n\n function handleMouseUp (ev) {\n handleEvent(buttonState & ~mouse.buttons(ev), ev)\n }\n\n function attachListeners () {\n if (attached) {\n return\n }\n attached = true\n\n element.addEventListener('mousemove', handleMouseMove)\n\n element.addEventListener('mousedown', handleMouseDown)\n\n element.addEventListener('mouseup', handleMouseUp)\n\n element.addEventListener('mouseleave', clearState)\n element.addEventListener('mouseenter', clearState)\n element.addEventListener('mouseout', clearState)\n element.addEventListener('mouseover', clearState)\n\n element.addEventListener('blur', handleBlur)\n\n element.addEventListener('keyup', handleMods)\n element.addEventListener('keydown', handleMods)\n element.addEventListener('keypress', handleMods)\n\n if (element !== window) {\n window.addEventListener('blur', handleBlur)\n\n window.addEventListener('keyup', handleMods)\n window.addEventListener('keydown', handleMods)\n window.addEventListener('keypress', handleMods)\n }\n }\n\n function detachListeners () {\n if (!attached) {\n return\n }\n attached = false\n\n element.removeEventListener('mousemove', handleMouseMove)\n\n element.removeEventListener('mousedown', handleMouseDown)\n\n element.removeEventListener('mouseup', handleMouseUp)\n\n element.removeEventListener('mouseleave', clearState)\n element.removeEventListener('mouseenter', clearState)\n element.removeEventListener('mouseout', clearState)\n element.removeEventListener('mouseover', clearState)\n\n element.removeEventListener('blur', handleBlur)\n\n element.removeEventListener('keyup', handleMods)\n element.removeEventListener('keydown', handleMods)\n element.removeEventListener('keypress', handleMods)\n\n if (element !== window) {\n window.removeEventListener('blur', handleBlur)\n\n window.removeEventListener('keyup', handleMods)\n window.removeEventListener('keydown', handleMods)\n window.removeEventListener('keypress', handleMods)\n }\n }\n\n // Attach listeners\n attachListeners()\n\n var result = {\n element: element\n }\n\n Object.defineProperties(result, {\n enabled: {\n get: function () { return attached },\n set: function (f) {\n if (f) {\n attachListeners()\n } else {\n detachListeners()\n }\n },\n enumerable: true\n },\n buttons: {\n get: function () { return buttonState },\n enumerable: true\n },\n x: {\n get: function () { return x },\n enumerable: true\n },\n y: {\n get: function () { return y },\n enumerable: true\n },\n mods: {\n get: function () { return mods },\n enumerable: true\n }\n })\n\n return result\n}\n","var rootPosition = { left: 0, top: 0 }\n\nmodule.exports = mouseEventOffset\nfunction mouseEventOffset (ev, target, out) {\n target = target || ev.currentTarget || ev.srcElement\n if (!Array.isArray(out)) {\n out = [ 0, 0 ]\n }\n var cx = ev.clientX || 0\n var cy = ev.clientY || 0\n var rect = getBoundingClientOffset(target)\n out[0] = cx - rect.left\n out[1] = cy - rect.top\n return out\n}\n\nfunction getBoundingClientOffset (element) {\n if (element === window ||\n element === document ||\n element === document.body) {\n return rootPosition\n } else {\n return element.getBoundingClientRect()\n }\n}\n","'use strict'\n\nfunction mouseButtons(ev) {\n if(typeof ev === 'object') {\n if('buttons' in ev) {\n return ev.buttons\n } else if('which' in ev) {\n var b = ev.which\n if(b === 2) {\n return 4\n } else if(b === 3) {\n return 2\n } else if(b > 0) {\n return 1<<(b-1)\n }\n } else if('button' in ev) {\n var b = ev.button\n if(b === 1) {\n return 4\n } else if(b === 2) {\n return 2\n } else if(b >= 0) {\n return 1< 0) {\n var l = Math.sqrt(tr + 1.0)\n out[0] = 0.5 * (uz - fy) / l\n out[1] = 0.5 * (fx - rz) / l\n out[2] = 0.5 * (ry - uy) / l\n out[3] = 0.5 * l\n } else {\n var tf = Math.max(rx, uy, fz)\n var l = Math.sqrt(2 * tf - tr + 1.0)\n if(rx >= tf) {\n //x y z order\n out[0] = 0.5 * l\n out[1] = 0.5 * (ux + ry) / l\n out[2] = 0.5 * (fx + rz) / l\n out[3] = 0.5 * (uz - fy) / l\n } else if(uy >= tf) {\n //y z x order\n out[0] = 0.5 * (ry + ux) / l\n out[1] = 0.5 * l\n out[2] = 0.5 * (fy + uz) / l\n out[3] = 0.5 * (fx - rz) / l\n } else {\n //z x y order\n out[0] = 0.5 * (rz + fx) / l\n out[1] = 0.5 * (uz + fy) / l\n out[2] = 0.5 * l\n out[3] = 0.5 * (ry - ux) / l\n }\n }\n return out\n}","'use strict'\n\nmodule.exports = createOrbitController\n\nvar filterVector = require('filtered-vector')\nvar lookAt = require('gl-mat4/lookAt')\nvar mat4FromQuat = require('gl-mat4/fromQuat')\nvar invert44 = require('gl-mat4/invert')\nvar quatFromFrame = require('./lib/quatFromFrame')\n\nfunction len3(x,y,z) {\n return Math.sqrt(Math.pow(x,2) + Math.pow(y,2) + Math.pow(z,2))\n}\n\nfunction len4(w,x,y,z) {\n return Math.sqrt(Math.pow(w,2) + Math.pow(x,2) + Math.pow(y,2) + Math.pow(z,2))\n}\n\nfunction normalize4(out, a) {\n var ax = a[0]\n var ay = a[1]\n var az = a[2]\n var aw = a[3]\n var al = len4(ax, ay, az, aw)\n if(al > 1e-6) {\n out[0] = ax/al\n out[1] = ay/al\n out[2] = az/al\n out[3] = aw/al\n } else {\n out[0] = out[1] = out[2] = 0.0\n out[3] = 1.0\n }\n}\n\nfunction OrbitCameraController(initQuat, initCenter, initRadius) {\n this.radius = filterVector([initRadius])\n this.center = filterVector(initCenter)\n this.rotation = filterVector(initQuat)\n\n this.computedRadius = this.radius.curve(0)\n this.computedCenter = this.center.curve(0)\n this.computedRotation = this.rotation.curve(0)\n this.computedUp = [0.1,0,0]\n this.computedEye = [0.1,0,0]\n this.computedMatrix = [0.1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]\n\n this.recalcMatrix(0)\n}\n\nvar proto = OrbitCameraController.prototype\n\nproto.lastT = function() {\n return Math.max(\n this.radius.lastT(),\n this.center.lastT(),\n this.rotation.lastT())\n}\n\nproto.recalcMatrix = function(t) {\n this.radius.curve(t)\n this.center.curve(t)\n this.rotation.curve(t)\n\n var quat = this.computedRotation\n normalize4(quat, quat)\n\n var mat = this.computedMatrix\n mat4FromQuat(mat, quat)\n\n var center = this.computedCenter\n var eye = this.computedEye\n var up = this.computedUp\n var radius = Math.exp(this.computedRadius[0])\n\n eye[0] = center[0] + radius * mat[2]\n eye[1] = center[1] + radius * mat[6]\n eye[2] = center[2] + radius * mat[10]\n up[0] = mat[1]\n up[1] = mat[5]\n up[2] = mat[9]\n\n for(var i=0; i<3; ++i) {\n var rr = 0.0\n for(var j=0; j<3; ++j) {\n rr += mat[i+4*j] * eye[j]\n }\n mat[12+i] = -rr\n }\n}\n\nproto.getMatrix = function(t, result) {\n this.recalcMatrix(t)\n var m = this.computedMatrix\n if(result) {\n for(var i=0; i<16; ++i) {\n result[i] = m[i]\n }\n return result\n }\n return m\n}\n\nproto.idle = function(t) {\n this.center.idle(t)\n this.radius.idle(t)\n this.rotation.idle(t)\n}\n\nproto.flush = function(t) {\n this.center.flush(t)\n this.radius.flush(t)\n this.rotation.flush(t)\n}\n\nproto.pan = function(t, dx, dy, dz) {\n dx = dx || 0.0\n dy = dy || 0.0\n dz = dz || 0.0\n\n this.recalcMatrix(t)\n var mat = this.computedMatrix\n\n var ux = mat[1]\n var uy = mat[5]\n var uz = mat[9]\n var ul = len3(ux, uy, uz)\n ux /= ul\n uy /= ul\n uz /= ul\n\n var rx = mat[0]\n var ry = mat[4]\n var rz = mat[8]\n var ru = rx * ux + ry * uy + rz * uz\n rx -= ux * ru\n ry -= uy * ru\n rz -= uz * ru\n var rl = len3(rx, ry, rz)\n rx /= rl\n ry /= rl\n rz /= rl\n\n var fx = mat[2]\n var fy = mat[6]\n var fz = mat[10]\n var fu = fx * ux + fy * uy + fz * uz\n var fr = fx * rx + fy * ry + fz * rz\n fx -= fu * ux + fr * rx\n fy -= fu * uy + fr * ry\n fz -= fu * uz + fr * rz\n var fl = len3(fx, fy, fz)\n fx /= fl\n fy /= fl\n fz /= fl\n\n var vx = rx * dx + ux * dy\n var vy = ry * dx + uy * dy\n var vz = rz * dx + uz * dy\n\n this.center.move(t, vx, vy, vz)\n\n //Update z-component of radius\n var radius = Math.exp(this.computedRadius[0])\n radius = Math.max(1e-4, radius + dz)\n this.radius.set(t, Math.log(radius))\n}\n\nproto.rotate = function(t, dx, dy, dz) {\n this.recalcMatrix(t)\n\n dx = dx||0.0\n dy = dy||0.0\n\n var mat = this.computedMatrix\n\n var rx = mat[0]\n var ry = mat[4]\n var rz = mat[8]\n\n var ux = mat[1]\n var uy = mat[5]\n var uz = mat[9]\n\n var fx = mat[2]\n var fy = mat[6]\n var fz = mat[10]\n\n var qx = dx * rx + dy * ux\n var qy = dx * ry + dy * uy\n var qz = dx * rz + dy * uz\n\n var bx = -(fy * qz - fz * qy)\n var by = -(fz * qx - fx * qz)\n var bz = -(fx * qy - fy * qx) \n var bw = Math.sqrt(Math.max(0.0, 1.0 - Math.pow(bx,2) - Math.pow(by,2) - Math.pow(bz,2)))\n var bl = len4(bx, by, bz, bw)\n if(bl > 1e-6) {\n bx /= bl\n by /= bl\n bz /= bl\n bw /= bl\n } else {\n bx = by = bz = 0.0\n bw = 1.0\n }\n\n var rotation = this.computedRotation\n var ax = rotation[0]\n var ay = rotation[1]\n var az = rotation[2]\n var aw = rotation[3]\n\n var cx = ax*bw + aw*bx + ay*bz - az*by\n var cy = ay*bw + aw*by + az*bx - ax*bz\n var cz = az*bw + aw*bz + ax*by - ay*bx\n var cw = aw*bw - ax*bx - ay*by - az*bz\n \n //Apply roll\n if(dz) {\n bx = fx\n by = fy\n bz = fz\n var s = Math.sin(dz) / len3(bx, by, bz)\n bx *= s\n by *= s\n bz *= s\n bw = Math.cos(dx)\n cx = cx*bw + cw*bx + cy*bz - cz*by\n cy = cy*bw + cw*by + cz*bx - cx*bz\n cz = cz*bw + cw*bz + cx*by - cy*bx\n cw = cw*bw - cx*bx - cy*by - cz*bz\n }\n\n var cl = len4(cx, cy, cz, cw)\n if(cl > 1e-6) {\n cx /= cl\n cy /= cl\n cz /= cl\n cw /= cl\n } else {\n cx = cy = cz = 0.0\n cw = 1.0\n }\n\n this.rotation.set(t, cx, cy, cz, cw)\n}\n\nproto.lookAt = function(t, eye, center, up) {\n this.recalcMatrix(t)\n\n center = center || this.computedCenter\n eye = eye || this.computedEye\n up = up || this.computedUp\n\n var mat = this.computedMatrix\n lookAt(mat, eye, center, up)\n\n var rotation = this.computedRotation\n quatFromFrame(rotation,\n mat[0], mat[1], mat[2],\n mat[4], mat[5], mat[6],\n mat[8], mat[9], mat[10])\n normalize4(rotation, rotation)\n this.rotation.set(t, rotation[0], rotation[1], rotation[2], rotation[3])\n\n var fl = 0.0\n for(var i=0; i<3; ++i) {\n fl += Math.pow(center[i] - eye[i], 2)\n }\n this.radius.set(t, 0.5 * Math.log(Math.max(fl, 1e-6)))\n\n this.center.set(t, center[0], center[1], center[2])\n}\n\nproto.translate = function(t, dx, dy, dz) {\n this.center.move(t,\n dx||0.0,\n dy||0.0,\n dz||0.0)\n}\n\nproto.setMatrix = function(t, matrix) {\n\n var rotation = this.computedRotation\n quatFromFrame(rotation,\n matrix[0], matrix[1], matrix[2],\n matrix[4], matrix[5], matrix[6],\n matrix[8], matrix[9], matrix[10])\n normalize4(rotation, rotation)\n this.rotation.set(t, rotation[0], rotation[1], rotation[2], rotation[3])\n\n var mat = this.computedMatrix\n invert44(mat, matrix)\n var w = mat[15]\n if(Math.abs(w) > 1e-6) {\n var cx = mat[12]/w\n var cy = mat[13]/w\n var cz = mat[14]/w\n\n this.recalcMatrix(t) \n var r = Math.exp(this.computedRadius[0])\n this.center.set(t, cx-mat[2]*r, cy-mat[6]*r, cz-mat[10]*r)\n this.radius.idle(t)\n } else {\n this.center.idle(t)\n this.radius.idle(t)\n }\n}\n\nproto.setDistance = function(t, d) {\n if(d > 0) {\n this.radius.set(t, Math.log(d))\n }\n}\n\nproto.setDistanceLimits = function(lo, hi) {\n if(lo > 0) {\n lo = Math.log(lo)\n } else {\n lo = -Infinity \n }\n if(hi > 0) {\n hi = Math.log(hi)\n } else {\n hi = Infinity\n }\n hi = Math.max(hi, lo)\n this.radius.bounds[0][0] = lo\n this.radius.bounds[1][0] = hi\n}\n\nproto.getDistanceLimits = function(out) {\n var bounds = this.radius.bounds\n if(out) {\n out[0] = Math.exp(bounds[0][0])\n out[1] = Math.exp(bounds[1][0])\n return out\n }\n return [ Math.exp(bounds[0][0]), Math.exp(bounds[1][0]) ]\n}\n\nproto.toJSON = function() {\n this.recalcMatrix(this.lastT())\n return {\n center: this.computedCenter.slice(),\n rotation: this.computedRotation.slice(),\n distance: Math.log(this.computedRadius[0]),\n zoomMin: this.radius.bounds[0][0],\n zoomMax: this.radius.bounds[1][0]\n }\n}\n\nproto.fromJSON = function(options) {\n var t = this.lastT()\n var c = options.center\n if(c) {\n this.center.set(t, c[0], c[1], c[2])\n }\n var r = options.rotation\n if(r) {\n this.rotation.set(t, r[0], r[1], r[2], r[3])\n }\n var d = options.distance\n if(d && d > 0) {\n this.radius.set(t, Math.log(d))\n }\n this.setDistanceLimits(options.zoomMin, options.zoomMax)\n}\n\nfunction createOrbitController(options) {\n options = options || {}\n var center = options.center || [0,0,0]\n var rotation = options.rotation || [0,0,0,1]\n var radius = options.radius || 1.0\n\n center = [].slice.call(center, 0, 3)\n rotation = [].slice.call(rotation, 0, 4)\n normalize4(rotation, rotation)\n\n var result = new OrbitCameraController(\n rotation,\n center,\n Math.log(radius))\n\n result.setDistanceLimits(options.zoomMin, options.zoomMax)\n\n if('eye' in options || 'up' in options) {\n result.lookAt(0, options.eye, options.center, options.up)\n }\n\n return result\n}","module.exports = function parseUnit(str, out) {\n if (!out)\n out = [ 0, '' ]\n\n str = String(str)\n var num = parseFloat(str, 10)\n out[0] = num\n out[1] = str.match(/[\\d.\\-\\+]*\\s*(.*)/)[1] || ''\n return out\n}","module.exports = require('gl-quat/slerp')","module.exports =\n global.performance &&\n global.performance.now ? function now() {\n return performance.now()\n } : Date.now || function now() {\n return +new Date\n }\n","'use strict'\n\nvar parseUnit = require('parse-unit')\n\nmodule.exports = toPX\n\nvar PIXELS_PER_INCH = getSizeBrutal('in', document.body) // 96\n\n\nfunction getPropertyInPX(element, prop) {\n var parts = parseUnit(getComputedStyle(element).getPropertyValue(prop))\n return parts[0] * toPX(parts[1], element)\n}\n\n//This brutal hack is needed\nfunction getSizeBrutal(unit, element) {\n var testDIV = document.createElement('div')\n testDIV.style['height'] = '128' + unit\n element.appendChild(testDIV)\n var size = getPropertyInPX(testDIV, 'height') / 128\n element.removeChild(testDIV)\n return size\n}\n\nfunction toPX(str, element) {\n if (!str) return null\n\n element = element || document.body\n str = (str + '' || 'px').trim().toLowerCase()\n if(element === window || element === document) {\n element = document.body\n }\n\n switch(str) {\n case '%': //Ambiguous, not sure if we should use width or height\n return element.clientHeight / 100.0\n case 'ch':\n case 'ex':\n return getSizeBrutal(str, element)\n case 'em':\n return getPropertyInPX(element, 'font-size')\n case 'rem':\n return getPropertyInPX(document.body, 'font-size')\n case 'vw':\n return window.innerWidth/100\n case 'vh':\n return window.innerHeight/100\n case 'vmin':\n return Math.min(window.innerWidth, window.innerHeight) / 100\n case 'vmax':\n return Math.max(window.innerWidth, window.innerHeight) / 100\n case 'in':\n return PIXELS_PER_INCH\n case 'cm':\n return PIXELS_PER_INCH / 2.54\n case 'mm':\n return PIXELS_PER_INCH / 25.4\n case 'pt':\n return PIXELS_PER_INCH / 72\n case 'pc':\n return PIXELS_PER_INCH / 6\n case 'px':\n return 1\n }\n\n // detect number of units\n var parts = parseUnit(str)\n if (!isNaN(parts[0]) && parts[1]) {\n var px = toPX(parts[1], element)\n return typeof px === 'number' ? parts[0] * px : null\n }\n\n return null\n}\n","var CameraControls = require('3d-view-controls');\nimport {vec3, mat4} from 'gl-matrix';\n\nclass Camera {\n controls: any;\n projectionMatrix: mat4 = mat4.create();\n viewMatrix: mat4 = mat4.create();\n fovy: number = 45;\n aspectRatio: number = 1;\n near: number = 0.1;\n far: number = 1000;\n position: vec3 = vec3.create();\n direction: vec3 = vec3.create();\n target: vec3 = vec3.create();\n up: vec3 = vec3.create();\n\n constructor(position: vec3, target: vec3) {\n this.controls = CameraControls(document.getElementById('canvas'), {\n eye: position,\n center: target,\n });\n vec3.add(this.target, this.position, this.direction);\n mat4.lookAt(this.viewMatrix, this.controls.eye, this.controls.center, this.controls.up);\n }\n\n setAspectRatio(aspectRatio: number) {\n this.aspectRatio = aspectRatio;\n }\n\n updateProjectionMatrix() {\n mat4.perspective(this.projectionMatrix, this.fovy, this.aspectRatio, this.near, this.far);\n }\n\n update() {\n this.controls.tick();\n vec3.add(this.target, this.position, this.direction);\n mat4.lookAt(this.viewMatrix, this.controls.eye, this.controls.center, this.controls.up);\n }\n};\n\nexport default Camera;\n","import {vec3, vec4} from 'gl-matrix';\nimport Drawable from '../rendering/gl/Drawable';\nimport {gl} from '../globals';\n\nclass Square extends Drawable {\n indices: Uint32Array;\n positions: Float32Array;\n center: vec4;\n\n constructor(center: vec3) {\n super(); // Call the constructor of the super class. This is required.\n this.center = vec4.fromValues(center[0], center[1], center[2], 1);\n }\n\n create() {\n\n this.indices = new Uint32Array([0, 1, 2,\n 0, 2, 3]);\n this.positions = new Float32Array([-1, -1, 0.999, 1,\n 1, -1, 0.999, 1,\n 1, 1, 0.999, 1,\n -1, 1, 0.999, 1]);\n\n this.generateIdx();\n this.generatePos();\n\n this.count = this.indices.length;\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.bufIdx);\n gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this.indices, gl.STATIC_DRAW);\n\n gl.bindBuffer(gl.ARRAY_BUFFER, this.bufPos);\n gl.bufferData(gl.ARRAY_BUFFER, this.positions, gl.STATIC_DRAW);\n\n console.log(`Created square`);\n }\n};\n\nexport default Square;\n","\nexport var gl: WebGL2RenderingContext;\nexport function setGL(_gl: WebGL2RenderingContext) {\n gl = _gl;\n}\n","import {gl} from '../../globals';\n\nabstract class Drawable {\n count: number = 0;\n\n bufIdx: WebGLBuffer;\n bufPos: WebGLBuffer;\n\n idxBound: boolean = false;\n posBound: boolean = false;\n\n abstract create() : void;\n\n destory() {\n gl.deleteBuffer(this.bufIdx);\n gl.deleteBuffer(this.bufPos);\n }\n\n generateIdx() {\n this.idxBound = true;\n this.bufIdx = gl.createBuffer();\n }\n\n generatePos() {\n this.posBound = true;\n this.bufPos = gl.createBuffer();\n }\n\n bindIdx(): boolean {\n if (this.idxBound) {\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.bufIdx);\n }\n return this.idxBound;\n }\n\n bindPos(): boolean {\n if (this.posBound) {\n gl.bindBuffer(gl.ARRAY_BUFFER, this.bufPos);\n }\n return this.posBound;\n }\n\n elemCount(): number {\n return this.count;\n }\n\n drawMode(): GLenum {\n return gl.TRIANGLES;\n }\n};\n\nexport default Drawable;\n","import {mat4, vec4} from 'gl-matrix';\nimport Drawable from './Drawable';\nimport Camera from '../../Camera';\nimport {gl} from '../../globals';\nimport ShaderProgram from './ShaderProgram';\n\n// In this file, `gl` is accessible because it is imported above\nclass OpenGLRenderer {\n constructor(public canvas: HTMLCanvasElement) {\n }\n\n setClearColor(r: number, g: number, b: number, a: number) {\n gl.clearColor(r, g, b, a);\n }\n\n setSize(width: number, height: number) {\n this.canvas.width = width;\n this.canvas.height = height;\n }\n\n clear() {\n gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);\n }\n\n render(camera: Camera, prog: ShaderProgram, drawables: Array, time: number) {\n prog.setEyeRefUp(camera.controls.eye, camera.controls.center, camera.controls.up);\n prog.setTime(time);\n\n for (let drawable of drawables) {\n prog.draw(drawable);\n }\n }\n};\n\nexport default OpenGLRenderer;\n","import {vec2, vec3, vec4, mat4} from 'gl-matrix';\nimport Drawable from './Drawable';\nimport {gl} from '../../globals';\n\nvar activeProgram: WebGLProgram = null;\n\nexport class Shader {\n shader: WebGLShader;\n\n constructor(type: number, source: string) {\n this.shader = gl.createShader(type);\n gl.shaderSource(this.shader, source);\n gl.compileShader(this.shader);\n\n if (!gl.getShaderParameter(this.shader, gl.COMPILE_STATUS)) {\n throw gl.getShaderInfoLog(this.shader);\n }\n }\n};\n\nclass ShaderProgram {\n prog: WebGLProgram;\n\n attrPos: number;\n attrNor: number;\n\n unifRef: WebGLUniformLocation;\n unifEye: WebGLUniformLocation;\n unifUp: WebGLUniformLocation;\n unifDimensions: WebGLUniformLocation;\n unifTime: WebGLUniformLocation;\n\n constructor(shaders: Array) {\n this.prog = gl.createProgram();\n\n for (let shader of shaders) {\n gl.attachShader(this.prog, shader.shader);\n }\n gl.linkProgram(this.prog);\n if (!gl.getProgramParameter(this.prog, gl.LINK_STATUS)) {\n throw gl.getProgramInfoLog(this.prog);\n }\n\n this.attrPos = gl.getAttribLocation(this.prog, \"vs_Pos\");\n this.unifEye = gl.getUniformLocation(this.prog, \"u_Eye\");\n this.unifRef = gl.getUniformLocation(this.prog, \"u_Ref\");\n this.unifUp = gl.getUniformLocation(this.prog, \"u_Up\");\n this.unifDimensions = gl.getUniformLocation(this.prog, \"u_Dimensions\");\n this.unifTime = gl.getUniformLocation(this.prog, \"u_Time\");\n }\n\n use() {\n if (activeProgram !== this.prog) {\n gl.useProgram(this.prog);\n activeProgram = this.prog;\n }\n }\n\n setEyeRefUp(eye: vec3, ref: vec3, up: vec3) {\n this.use();\n if(this.unifEye !== -1) {\n gl.uniform3f(this.unifEye, eye[0], eye[1], eye[2]);\n }\n if(this.unifRef !== -1) {\n gl.uniform3f(this.unifRef, ref[0], ref[1], ref[2]);\n }\n if(this.unifUp !== -1) {\n gl.uniform3f(this.unifUp, up[0], up[1], up[2]);\n }\n }\n\n setDimensions(width: number, height: number) {\n this.use();\n if(this.unifDimensions !== -1) {\n gl.uniform2f(this.unifDimensions, width, height);\n }\n }\n\n setTime(t: number) {\n this.use();\n if(this.unifTime !== -1) {\n gl.uniform1f(this.unifTime, t);\n }\n }\n\n draw(d: Drawable) {\n this.use();\n\n if (this.attrPos != -1 && d.bindPos()) {\n gl.enableVertexAttribArray(this.attrPos);\n gl.vertexAttribPointer(this.attrPos, 4, gl.FLOAT, false, 0, 0);\n }\n\n d.bindIdx();\n gl.drawElements(d.drawMode(), d.elemCount(), gl.UNSIGNED_INT, 0);\n\n if (this.attrPos != -1) gl.disableVertexAttribArray(this.attrPos);\n }\n};\n\nexport default ShaderProgram;\n","'use strict'\n\nmodule.exports = createTurntableController\n\nvar filterVector = require('filtered-vector')\nvar invert44 = require('gl-mat4/invert')\nvar rotateM = require('gl-mat4/rotate')\nvar cross = require('gl-vec3/cross')\nvar normalize3 = require('gl-vec3/normalize')\nvar dot3 = require('gl-vec3/dot')\n\nfunction len3(x, y, z) {\n return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2))\n}\n\nfunction clamp1(x) {\n return Math.min(1.0, Math.max(-1.0, x))\n}\n\nfunction findOrthoPair(v) {\n var vx = Math.abs(v[0])\n var vy = Math.abs(v[1])\n var vz = Math.abs(v[2])\n\n var u = [0,0,0]\n if(vx > Math.max(vy, vz)) {\n u[2] = 1\n } else if(vy > Math.max(vx, vz)) {\n u[0] = 1\n } else {\n u[1] = 1\n }\n\n var vv = 0\n var uv = 0\n for(var i=0; i<3; ++i ) {\n vv += v[i] * v[i]\n uv += u[i] * v[i]\n }\n for(var i=0; i<3; ++i) {\n u[i] -= (uv / vv) * v[i]\n }\n normalize3(u, u)\n return u\n}\n\nfunction TurntableController(zoomMin, zoomMax, center, up, right, radius, theta, phi) {\n this.center = filterVector(center)\n this.up = filterVector(up)\n this.right = filterVector(right)\n this.radius = filterVector([radius])\n this.angle = filterVector([theta, phi])\n this.angle.bounds = [[-Infinity,-Math.PI/2], [Infinity,Math.PI/2]]\n this.setDistanceLimits(zoomMin, zoomMax)\n\n this.computedCenter = this.center.curve(0)\n this.computedUp = this.up.curve(0)\n this.computedRight = this.right.curve(0)\n this.computedRadius = this.radius.curve(0)\n this.computedAngle = this.angle.curve(0)\n this.computedToward = [0,0,0]\n this.computedEye = [0,0,0]\n this.computedMatrix = new Array(16)\n for(var i=0; i<16; ++i) {\n this.computedMatrix[i] = 0.5\n }\n\n this.recalcMatrix(0)\n}\n\nvar proto = TurntableController.prototype\n\nproto.setDistanceLimits = function(minDist, maxDist) {\n if(minDist > 0) {\n minDist = Math.log(minDist)\n } else {\n minDist = -Infinity\n }\n if(maxDist > 0) {\n maxDist = Math.log(maxDist)\n } else {\n maxDist = Infinity\n }\n maxDist = Math.max(maxDist, minDist)\n this.radius.bounds[0][0] = minDist\n this.radius.bounds[1][0] = maxDist\n}\n\nproto.getDistanceLimits = function(out) {\n var bounds = this.radius.bounds[0]\n if(out) {\n out[0] = Math.exp(bounds[0][0])\n out[1] = Math.exp(bounds[1][0])\n return out\n }\n return [ Math.exp(bounds[0][0]), Math.exp(bounds[1][0]) ]\n}\n\nproto.recalcMatrix = function(t) {\n //Recompute curves\n this.center.curve(t)\n this.up.curve(t)\n this.right.curve(t)\n this.radius.curve(t)\n this.angle.curve(t)\n\n //Compute frame for camera matrix\n var up = this.computedUp\n var right = this.computedRight\n var uu = 0.0\n var ur = 0.0\n for(var i=0; i<3; ++i) {\n ur += up[i] * right[i]\n uu += up[i] * up[i]\n }\n var ul = Math.sqrt(uu)\n var rr = 0.0\n for(var i=0; i<3; ++i) {\n right[i] -= up[i] * ur / uu\n rr += right[i] * right[i]\n up[i] /= ul\n }\n var rl = Math.sqrt(rr)\n for(var i=0; i<3; ++i) {\n right[i] /= rl\n }\n\n //Compute toward vector\n var toward = this.computedToward\n cross(toward, up, right)\n normalize3(toward, toward)\n\n //Compute angular parameters\n var radius = Math.exp(this.computedRadius[0])\n var theta = this.computedAngle[0]\n var phi = this.computedAngle[1]\n\n var ctheta = Math.cos(theta)\n var stheta = Math.sin(theta)\n var cphi = Math.cos(phi)\n var sphi = Math.sin(phi)\n\n var center = this.computedCenter\n\n var wx = ctheta * cphi \n var wy = stheta * cphi\n var wz = sphi\n\n var sx = -ctheta * sphi\n var sy = -stheta * sphi\n var sz = cphi\n\n var eye = this.computedEye\n var mat = this.computedMatrix\n for(var i=0; i<3; ++i) {\n var x = wx * right[i] + wy * toward[i] + wz * up[i]\n mat[4*i+1] = sx * right[i] + sy * toward[i] + sz * up[i]\n mat[4*i+2] = x\n mat[4*i+3] = 0.0\n }\n\n var ax = mat[1]\n var ay = mat[5]\n var az = mat[9]\n var bx = mat[2]\n var by = mat[6]\n var bz = mat[10]\n var cx = ay * bz - az * by\n var cy = az * bx - ax * bz\n var cz = ax * by - ay * bx\n var cl = len3(cx, cy, cz)\n cx /= cl\n cy /= cl\n cz /= cl\n mat[0] = cx\n mat[4] = cy\n mat[8] = cz\n\n for(var i=0; i<3; ++i) {\n eye[i] = center[i] + mat[2+4*i]*radius\n }\n\n for(var i=0; i<3; ++i) {\n var rr = 0.0\n for(var j=0; j<3; ++j) {\n rr += mat[i+4*j] * eye[j]\n }\n mat[12+i] = -rr\n }\n mat[15] = 1.0\n}\n\nproto.getMatrix = function(t, result) {\n this.recalcMatrix(t)\n var mat = this.computedMatrix\n if(result) {\n for(var i=0; i<16; ++i) {\n result[i] = mat[i]\n }\n return result\n }\n return mat\n}\n\nvar zAxis = [0,0,0]\nproto.rotate = function(t, dtheta, dphi, droll) {\n this.angle.move(t, dtheta, dphi)\n if(droll) {\n this.recalcMatrix(t)\n\n var mat = this.computedMatrix\n zAxis[0] = mat[2]\n zAxis[1] = mat[6]\n zAxis[2] = mat[10]\n\n var up = this.computedUp\n var right = this.computedRight\n var toward = this.computedToward\n\n for(var i=0; i<3; ++i) {\n mat[4*i] = up[i]\n mat[4*i+1] = right[i]\n mat[4*i+2] = toward[i]\n }\n rotateM(mat, mat, droll, zAxis)\n for(var i=0; i<3; ++i) {\n up[i] = mat[4*i]\n right[i] = mat[4*i+1]\n }\n\n this.up.set(t, up[0], up[1], up[2])\n this.right.set(t, right[0], right[1], right[2])\n }\n}\n\nproto.pan = function(t, dx, dy, dz) {\n dx = dx || 0.0\n dy = dy || 0.0\n dz = dz || 0.0\n\n this.recalcMatrix(t)\n var mat = this.computedMatrix\n\n var dist = Math.exp(this.computedRadius[0])\n\n var ux = mat[1]\n var uy = mat[5]\n var uz = mat[9]\n var ul = len3(ux, uy, uz)\n ux /= ul\n uy /= ul\n uz /= ul\n\n var rx = mat[0]\n var ry = mat[4]\n var rz = mat[8]\n var ru = rx * ux + ry * uy + rz * uz\n rx -= ux * ru\n ry -= uy * ru\n rz -= uz * ru\n var rl = len3(rx, ry, rz)\n rx /= rl\n ry /= rl\n rz /= rl\n\n var vx = rx * dx + ux * dy\n var vy = ry * dx + uy * dy\n var vz = rz * dx + uz * dy\n this.center.move(t, vx, vy, vz)\n\n //Update z-component of radius\n var radius = Math.exp(this.computedRadius[0])\n radius = Math.max(1e-4, radius + dz)\n this.radius.set(t, Math.log(radius))\n}\n\nproto.translate = function(t, dx, dy, dz) {\n this.center.move(t,\n dx||0.0,\n dy||0.0,\n dz||0.0)\n}\n\n//Recenters the coordinate axes\nproto.setMatrix = function(t, mat, axes, noSnap) {\n \n //Get the axes for tare\n var ushift = 1\n if(typeof axes === 'number') {\n ushift = (axes)|0\n } \n if(ushift < 0 || ushift > 3) {\n ushift = 1\n }\n var vshift = (ushift + 2) % 3\n var fshift = (ushift + 1) % 3\n\n //Recompute state for new t value\n if(!mat) { \n this.recalcMatrix(t)\n mat = this.computedMatrix\n }\n\n //Get right and up vectors\n var ux = mat[ushift]\n var uy = mat[ushift+4]\n var uz = mat[ushift+8]\n if(!noSnap) {\n var ul = len3(ux, uy, uz)\n ux /= ul\n uy /= ul\n uz /= ul\n } else {\n var ax = Math.abs(ux)\n var ay = Math.abs(uy)\n var az = Math.abs(uz)\n var am = Math.max(ax,ay,az)\n if(ax === am) {\n ux = (ux < 0) ? -1 : 1\n uy = uz = 0\n } else if(az === am) {\n uz = (uz < 0) ? -1 : 1\n ux = uy = 0\n } else {\n uy = (uy < 0) ? -1 : 1\n ux = uz = 0\n }\n }\n\n var rx = mat[vshift]\n var ry = mat[vshift+4]\n var rz = mat[vshift+8]\n var ru = rx * ux + ry * uy + rz * uz\n rx -= ux * ru\n ry -= uy * ru\n rz -= uz * ru\n var rl = len3(rx, ry, rz)\n rx /= rl\n ry /= rl\n rz /= rl\n \n var fx = uy * rz - uz * ry\n var fy = uz * rx - ux * rz\n var fz = ux * ry - uy * rx\n var fl = len3(fx, fy, fz)\n fx /= fl\n fy /= fl\n fz /= fl\n\n this.center.jump(t, ex, ey, ez)\n this.radius.idle(t)\n this.up.jump(t, ux, uy, uz)\n this.right.jump(t, rx, ry, rz)\n\n var phi, theta\n if(ushift === 2) {\n var cx = mat[1]\n var cy = mat[5]\n var cz = mat[9]\n var cr = cx * rx + cy * ry + cz * rz\n var cf = cx * fx + cy * fy + cz * fz\n if(tu < 0) {\n phi = -Math.PI/2\n } else {\n phi = Math.PI/2\n }\n theta = Math.atan2(cf, cr)\n } else {\n var tx = mat[2]\n var ty = mat[6]\n var tz = mat[10]\n var tu = tx * ux + ty * uy + tz * uz\n var tr = tx * rx + ty * ry + tz * rz\n var tf = tx * fx + ty * fy + tz * fz\n\n phi = Math.asin(clamp1(tu))\n theta = Math.atan2(tf, tr)\n }\n\n this.angle.jump(t, theta, phi)\n\n this.recalcMatrix(t)\n var dx = mat[2]\n var dy = mat[6]\n var dz = mat[10]\n\n var imat = this.computedMatrix\n invert44(imat, mat)\n var w = imat[15]\n var ex = imat[12] / w\n var ey = imat[13] / w\n var ez = imat[14] / w\n\n var gs = Math.exp(this.computedRadius[0])\n this.center.jump(t, ex-dx*gs, ey-dy*gs, ez-dz*gs)\n}\n\nproto.lastT = function() {\n return Math.max(\n this.center.lastT(),\n this.up.lastT(),\n this.right.lastT(),\n this.radius.lastT(),\n this.angle.lastT())\n}\n\nproto.idle = function(t) {\n this.center.idle(t)\n this.up.idle(t)\n this.right.idle(t)\n this.radius.idle(t)\n this.angle.idle(t)\n}\n\nproto.flush = function(t) {\n this.center.flush(t)\n this.up.flush(t)\n this.right.flush(t)\n this.radius.flush(t)\n this.angle.flush(t)\n}\n\nproto.setDistance = function(t, d) {\n if(d > 0) {\n this.radius.set(t, Math.log(d))\n }\n}\n\nproto.lookAt = function(t, eye, center, up) {\n this.recalcMatrix(t)\n\n eye = eye || this.computedEye\n center = center || this.computedCenter\n up = up || this.computedUp\n\n var ux = up[0]\n var uy = up[1]\n var uz = up[2]\n var ul = len3(ux, uy, uz)\n if(ul < 1e-6) {\n return\n }\n ux /= ul\n uy /= ul\n uz /= ul\n\n var tx = eye[0] - center[0]\n var ty = eye[1] - center[1]\n var tz = eye[2] - center[2]\n var tl = len3(tx, ty, tz)\n if(tl < 1e-6) {\n return\n }\n tx /= tl\n ty /= tl\n tz /= tl\n\n var right = this.computedRight\n var rx = right[0]\n var ry = right[1]\n var rz = right[2]\n var ru = ux*rx + uy*ry + uz*rz\n rx -= ru * ux\n ry -= ru * uy\n rz -= ru * uz\n var rl = len3(rx, ry, rz)\n\n if(rl < 0.01) {\n rx = uy * tz - uz * ty\n ry = uz * tx - ux * tz\n rz = ux * ty - uy * tx\n rl = len3(rx, ry, rz)\n if(rl < 1e-6) {\n return\n }\n }\n rx /= rl\n ry /= rl\n rz /= rl\n\n this.up.set(t, ux, uy, uz)\n this.right.set(t, rx, ry, rz)\n this.center.set(t, center[0], center[1], center[2])\n this.radius.set(t, Math.log(tl))\n\n var fx = uy * rz - uz * ry\n var fy = uz * rx - ux * rz\n var fz = ux * ry - uy * rx\n var fl = len3(fx, fy, fz)\n fx /= fl\n fy /= fl\n fz /= fl\n\n var tu = ux*tx + uy*ty + uz*tz\n var tr = rx*tx + ry*ty + rz*tz\n var tf = fx*tx + fy*ty + fz*tz\n\n var phi = Math.asin(clamp1(tu))\n var theta = Math.atan2(tf, tr)\n\n var angleState = this.angle._state\n var lastTheta = angleState[angleState.length-1]\n var lastPhi = angleState[angleState.length-2]\n lastTheta = lastTheta % (2.0 * Math.PI)\n var dp = Math.abs(lastTheta + 2.0 * Math.PI - theta)\n var d0 = Math.abs(lastTheta - theta)\n var dn = Math.abs(lastTheta - 2.0 * Math.PI - theta)\n if(dp < d0) {\n lastTheta += 2.0 * Math.PI\n }\n if(dn < d0) {\n lastTheta -= 2.0 * Math.PI\n }\n\n this.angle.jump(this.angle.lastT(), lastTheta, lastPhi)\n this.angle.set(t, theta, phi)\n}\n\nfunction createTurntableController(options) {\n options = options || {}\n\n var center = options.center || [0,0,0]\n var up = options.up || [0,1,0]\n var right = options.right || findOrthoPair(up)\n var radius = options.radius || 1.0\n var theta = options.theta || 0.0\n var phi = options.phi || 0.0\n\n center = [].slice.call(center, 0, 3)\n\n up = [].slice.call(up, 0, 3)\n normalize3(up, up)\n\n right = [].slice.call(right, 0, 3)\n normalize3(right, right)\n\n if('eye' in options) {\n var eye = options.eye\n var toward = [\n eye[0]-center[0],\n eye[1]-center[1],\n eye[2]-center[2]\n ]\n cross(right, toward, up)\n if(len3(right[0], right[1], right[2]) < 1e-6) {\n right = findOrthoPair(up)\n } else {\n normalize3(right, right)\n }\n\n radius = len3(toward[0], toward[1], toward[2])\n\n var ut = dot3(up, toward) / radius\n var rt = dot3(right, toward) / radius\n phi = Math.acos(ut)\n theta = Math.acos(rt)\n }\n\n //Use logarithmic coordinates for radius\n radius = Math.log(radius)\n\n //Return the controller\n return new TurntableController(\n options.zoomMin,\n options.zoomMax,\n center,\n up,\n right,\n radius,\n theta,\n phi)\n}","module.exports = \"#version 300 es\\n\\n#define keyPadding 0.011f\\n#define keyScale 2.7f\\nprecision highp float;\\n\\nuniform vec3 u_Eye, u_Ref, u_Up;\\nuniform vec2 u_Dimensions;\\nuniform float u_Time;\\n\\nin vec2 fs_Pos;\\nout vec4 out_Col;\\n\\nconst int MAX_RAY_STEPS = 128;\\nconst float FOV = 45.0;\\nconst float FOV_TAN = tan(45.0);\\nconst float EPSILON = 1e-6;\\n\\nconst vec3 EYE = vec3(0.0, 0.0, -10.0);\\nconst vec3 ORIGIN = vec3(0.0, 0.0, 0.0);\\nconst vec3 WORLD_UP = vec3(0.0, 1.0, 0.0);\\nconst vec3 WORLD_RIGHT = vec3(1.0, 0.0, 0.0);\\nconst vec3 WORLD_FORWARD = vec3(0.0, 0.0, 1.0);\\nconst vec3 LIGHT_DIR = vec3(-1.0, -1.0, -2.0);\\n\\nconst vec3 ebCut = vec3(0.062, -0.27f, 0.f) / keyScale;\\nconst vec3 ebCutB = vec3(0.04, 0.45, 0.121) / keyScale;\\nconst vec3 whiteKeyBox = vec3(0.1, 0.71, 0.12) / keyScale;\\nconst vec3 keyStep = vec3(0.2f + keyPadding, 0.f, 0.f) / keyScale;\\n\\nstruct Surface {\\n float distance;\\n vec3 color;\\n};\\n\\nSurface mins(Surface a, Surface b) {\\n if (a.distance < b.distance) {\\n return a;\\n } else {\\n return b;\\n }\\n}\\n\\nSurface maxs(Surface a, Surface b) {\\n if (a.distance > b.distance) {\\n return a;\\n } else {\\n return b;\\n }\\n}\\n\\nstruct Ray \\n{\\n vec3 origin;\\n vec3 direction;\\n};\\n\\nstruct Intersection \\n{\\n vec3 position;\\n vec3 normal;\\n float distance_t;\\n int material_id;\\n vec3 color;\\n};\\n\\n// --- Geometry helpers ---\\nfloat smoothSubtraction(float d1, float d2, float k) {\\n float h = clamp( 0.5 - 0.5*(d2+d1)/k, 0.0, 1.0 );\\n return mix( d2, -d1, h ) + k*h*(1.0-h); \\n}\\n\\nfloat lengthInf(vec3 p) {\\n return max(p.x, max(p.y, p.y));\\n}\\n\\nvec3 flipX(vec3 p) {\\n return vec3(-p.x, p.y, p.z);\\n}\\n\\nfloat smin(float a, float b, float k) {\\n float h = clamp(0.5 + 0.5 * (b - a) / k, 0.0, 1.0);\\n return mix(b, a, h) - k * h * (1.0 - h);\\n}\\n\\nmat3 rotationMatrix(vec3 axis, float angle)\\n{\\n axis = normalize(axis);\\n float s = sin(angle);\\n float c = cos(angle);\\n float oc = 1.0 - c;\\n \\n return mat3(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s,\\n oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s,\\n oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c);\\n}\\n\\nvec3 translateTo(vec3 p, vec3 c) {\\n return p - c;\\n}\\n\\nvec3 rotateAround(vec3 p, vec3 axis, float angle) {\\n return rotationMatrix(axis, angle) * p;\\n}\\n\\n// L2-Norm SDFs\\nfloat sdCappedCylinder(vec3 p, float h, float r) {\\n vec2 d = abs(vec2(length(p.xz), p.y)) - vec2(h,r);\\n return min(max(d.x, d.y), 0.0) + length(max(d, 0.0));\\n}\\n\\nfloat sdfSphere(vec3 query_position, vec3 position, float radius) {\\n return length(query_position - position) - radius;\\n}\\n\\nfloat sdfRoundBox(vec3 p, vec3 b, float r) {\\n vec3 q = abs(p) - b;\\n return length(max(q,0.0)) + min(max(q.x,max(q.y,q.z)),0.0) - r;\\n}\\n\\nfloat sdfBox( vec3 p, vec3 b ) {\\n vec3 q = abs(p) - b;\\n return length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0);\\n}\\n\\nSurface sdfIvoryKey(vec3 p) {\\n Surface s;\\n s.distance = sdfBox(p, vec3(0.05, 0.45, 0.18) / keyScale);\\n s.color = vec3(0.09f, 0.09f, 0.09f);\\n return s;\\n}\\n\\nSurface sdfEBKey(vec3 p) {\\n Surface s;\\n vec3 pt = p + ebCut;\\n //return max(-sdfBox(pt, ebCutB), sdfBox(p, whiteKeyBox));\\n float d1 = -sdfBox(pt, ebCutB);\\n float d2 = sdfBox(p, whiteKeyBox);\\n s.distance = d1 > d2 ? d1 : d2;\\n s.color = vec3(0.98, 0.98, 0.98);\\n return s;\\n}\\n\\nSurface sdfCFKey(vec3 p) {\\n return sdfEBKey(p - vec3(p.x * 2.f, 0.f, 0.f));\\n}\\n\\nfloat expImpulse(float x, float k) {\\n float h = k*x;\\n return h*exp(1.0-h);\\n}\\n\\nSurface sdfDKey(vec3 p) {\\n Surface s;\\n float mod = (1. + cos(u_Time / 4.f)) / 25.f;\\n p.z -= expImpulse(mod, 1.f/25.f) * 4.5f;\\n vec3 pt = p + vec3(0.085, -0.27f, 0.f) / keyScale;\\n float leftBox = sdfBox(pt, vec3(0.02, 0.45, 0.121) / keyScale);\\n pt = p + vec3(-0.089, -0.27f, 0.f) / keyScale;\\n float rightBox = sdfBox(pt, vec3(0.02, 0.45, 0.121) / keyScale);\\n s.distance = max(-rightBox, max(-leftBox, sdfBox(p, vec3(0.1, 0.71, 0.12) / keyScale)));\\n s.color = vec3(0.98, 0.98, 0.98);\\n return s;\\n}\\n\\nSurface sdfGKey(vec3 p) {\\n Surface s;\\n vec3 pt = p + vec3(0.085, -0.27f, 0.f) / keyScale;\\n float leftBox = sdfBox(pt, vec3(0.018, 0.45, 0.121) / keyScale);\\n pt = p + vec3(-0.076, -0.27f, 0.f) / keyScale;\\n float rightBox = sdfBox(pt, vec3(0.025, 0.45, 0.121) / keyScale);\\n s.distance = max(-rightBox, max(-leftBox, sdfBox(p, vec3(0.1, 0.71, 0.12) / keyScale)));\\n s.color = vec3(0.98, 0.98, 0.98);\\n return s;\\n}\\n\\nSurface sdfAKey(vec3 p) {\\n return sdfGKey(p - vec3(p.x * 2.f, 0.f, 0.f));\\n}\\n\\nSurface sdfMusicStand(vec3 p) {\\n Surface s;\\n vec3 p2 = p + vec3(0.f, 0.58f, 0.5f);\\n p2 = rotateAround(p2, vec3(1.f, 0.f, 0.f), 0.3);\\n s.distance = smoothSubtraction(\\n sdCappedCylinder(p2 + vec3(-1.46f, 0.f, 0.2f), 0.2, 0.022),\\n smoothSubtraction(\\n sdCappedCylinder(p2 + vec3(1.46f, 0.f, 0.2f), 0.2, 0.022), \\n sdfBox(p2, vec3(1.5f, 0.02f, 0.25f)),\\n 0.1), 0.1);\\n\\n s.color = vec3(0.09, 0.09, 0.09);\\n return s;\\n}\\n\\n//const vec3 keyStep = vec3(0.2f + keyPadding, 0.f, 0.f) / keyScale;\\nSurface sdfOctave(vec3 p, out vec3 p2) {\\n vec3 ip = p - vec3(0.08, 0.28, -0.063) / keyScale;\\n Surface c = sdfCFKey(p);\\n p -= keyStep;\\n Surface cs = sdfIvoryKey(ip);\\n ip.x -= 0.255 / keyScale;\\n Surface d = sdfDKey(p);\\n p -= keyStep;\\n Surface ds = sdfIvoryKey(ip);\\n ip.x -= 0.38 / keyScale;\\n Surface e = sdfEBKey(p);\\n p -= keyStep;\\n Surface f = sdfCFKey(p);\\n p -= keyStep;\\n Surface fs = sdfIvoryKey(ip);\\n ip.x -= 0.24 / keyScale;\\n Surface g = sdfGKey(p);\\n p -= keyStep;\\n Surface gs = sdfIvoryKey(ip);\\n ip.x -= 0.23 / keyScale;\\n Surface a = sdfAKey(p);\\n p -= keyStep;\\n Surface as = sdfIvoryKey(ip);\\n Surface b = sdfEBKey(p);\\n p -= keyStep;\\n p2 = p;\\n return mins(b, mins(mins(as, a), mins(mins(gs, g), mins(mins(fs, f), mins(e, mins(mins(ds, d), mins(cs, c)))))));\\n //return e;\\n}\\n\\nSurface sdfFrame(vec3 p) {\\n Surface s;\\n s.color = vec3(0.3f, 0.3f, 0.3f);\\n vec3 mainB = vec3(7.f, 2.f, 6.f) / 4.f;\\n vec3 sideB = vec3(0.05, 0.9, 0.9);\\n vec3 frontB = vec3(mainB.x, sideB.x, 0.2);\\n float top = sdfRoundBox(p + vec3(0.f, 0.f, 1.5f), vec3(7.1f, 2.1f, 0.1f) / 4.f, 0.01);\\n float bottom = \\n sdfBox(p + vec3(0.f, 1.f, -0.1f), vec3(1.7f, 0.3f, 0.1f));\\n s.distance = min(sdfBox(p + vec3(0.f, mainB.y + sideB.y - frontB.y * 3.f, 0.f), frontB), \\n smin(\\n sdfRoundBox(p - flipX(mainB) + flipX(sideB), sideB, 0.01), \\n smin(sdfRoundBox(p - mainB + sideB, sideB, 0.01), sdfBox(p, mainB), 0.1), 0.1));\\n\\n s.distance = smin(top, s.distance, 0.1);\\n s.distance = min(s.distance, bottom);\\n return s;\\n}\\n\\nSurface sdfKeys(vec3 p, int octaves) {\\n Surface v;\\n v.distance = 999999.f;\\n vec3 p2 = p;\\n for (int i = 0; i < octaves; i++) {\\n v = mins(v, sdfOctave(p2, p2));\\n }\\n\\n return v;\\n}\\n\\nSurface sceneSDF(vec3 queryPos) {\\n float box = sdfBox(queryPos + vec3(0.f, 1.f, 0.2f), vec3(1.7f, 0.3f, 0.6f));\\n Surface keys;\\n keys.distance = 999999.f;\\n if (box < EPSILON) {\\n keys = sdfKeys(queryPos + vec3(1.6f, 0.95f, 0.2f), 6);\\n }\\n\\n // Surface boxs;\\n // boxs.distance = box;\\n // boxs.color = vec3(0.f, 0.f, 1.f);\\n\\n // vec3 q2 = rotateAround(\\n // queryPos,\\n // vec3(0.0, 0.1f,0.1f),\\n // 0.5f);\\n\\n // return sdfBox(\\n // q2, \\n // vec3(0.5f, 0.5f, 0.5f));\\n\\n //return sdfOctave(queryPos);\\n vec3 p;\\n Surface o1 = sdfFrame(queryPos);//sdfOctave(queryPos, p);\\n //float o2 = sdfOctave(p, p);\\n //return min(o1, o2);\\n return mins(sdfMusicStand(queryPos), mins(keys, o1));\\n}\\n\\n// Linf Norm SDFs\\n\\nconst float d = 0.001f;\\nvec3 sceneSDFGrad(vec3 queryPos) {\\n vec3 diffVec = vec3(d, 0.f, 0.f);\\n return normalize(vec3(\\n sceneSDF(queryPos + diffVec).distance - sceneSDF(queryPos - diffVec).distance ,\\n sceneSDF(queryPos + diffVec.yxz).distance - sceneSDF(queryPos - diffVec.yxz).distance ,\\n sceneSDF(queryPos + diffVec.zyx).distance - sceneSDF(queryPos - diffVec.zyx).distance \\n ));\\n}\\n\\nRay getRay(vec2 uv)\\n{\\n Ray r;\\n \\n vec3 look = normalize(u_Ref - u_Eye);\\n vec3 camera_RIGHT = normalize(cross(u_Up, look));\\n vec3 camera_UP = u_Up;\\n \\n float aspect_ratio = u_Dimensions.x / u_Dimensions.y;\\n vec3 screen_vertical = camera_UP * FOV_TAN; \\n vec3 screen_horizontal = camera_RIGHT * aspect_ratio * FOV_TAN;\\n vec3 screen_point = (look + uv.x * screen_horizontal + uv.y * screen_vertical);\\n \\n r.origin = (screen_point + u_Eye) / 2.f;\\n r.direction = normalize(screen_point - u_Eye);\\n\\n return r;\\n}\\n\\nconst float MIN_STEP = EPSILON * 2.f;\\nIntersection getRaymarchedIntersection(vec2 uv)\\n{\\n Intersection intersection;\\n intersection.distance_t = -1.0;\\n Ray ray = getRay(uv);\\n\\n float distance_t = 0.f;\\n float prevDist = 99999.f;\\n // if (uv.x < 0.5f || uv.y < 0.5f) {\\n // return intersection;\\n // }\\n\\n for (int step = 0; step < MAX_RAY_STEPS; step++) {\\n vec3 point = ray.origin + ray.direction * distance_t;\\n Surface s = sceneSDF(point);\\n // if (point.y > 5.f || point.z > 5.f) {\\n // break;\\n // }\\n // if (isinf(point.x) || isinf(point.y) || isinf(point.z)) {\\n // break;\\n // }\\n\\n // if (dist > prevDist) {\\n // break;\\n // }\\n\\n if (s.distance < EPSILON) {\\n intersection.distance_t = s.distance;\\n intersection.position = point;\\n intersection.normal = sceneSDFGrad(point);\\n intersection.color = s.color;\\n\\n return intersection;\\n }\\n\\n distance_t += max(s.distance, MIN_STEP);\\n\\n if (distance_t > 100.f) {\\n break;\\n }\\n }\\n\\n return intersection;\\n}\\n\\nconst vec3 light = vec3(10.f, 14.f, 3.f);\\nvec3 getSceneColor(vec2 uv) {\\n Intersection intersection = getRaymarchedIntersection(uv);\\n // if (uv.x > 0.3f && uv.y < -0.3f) {\\n // if (abs(intersection.distance_t) < EPSILON) {\\n // if (isinf(intersection.position.x)) {\\n // return vec3(1.f, 0.f, 0.f);\\n // }\\n // }\\n // return vec3(0.f, 0.f, 1.f);\\n // }\\n\\n if (abs(intersection.distance_t) < EPSILON)\\n {\\n float diffuseTerm = dot(intersection.normal, normalize(u_Eye - intersection.position));\\n diffuseTerm = clamp(diffuseTerm, 0.f, 1.f);\\n\\n return intersection.color * (diffuseTerm + 0.2);\\n }\\n\\n return vec3(0.7, 0.2, 0.2);\\n}\\n\\nvoid main() {\\n // downsample resolution\\n // vec2 target = u_Dimensions / 2.f;\\n // vec2 scaled = (fs_Pos + vec2(1.f, 1.f)) / 2.f;\\n // vec2 uv = vec2(floor(target.x * scaled.x), floor(target.y * scaled.y));\\n // uv.x /= target.x;\\n // uv.y /= target.y;\\n // uv = uv * 2.f - vec2(1.f, 1.f);\\n // Time varying pixel color\\n vec3 col = getSceneColor(fs_Pos);\\n\\n // Output to screen\\n out_Col = vec4(col, 1.0);//vec4(0.5 * (fs_Pos + vec2(1.0)), 0.5 * (sin(u_Time * 3.14159 * 0.01) + 1.0), 1.0);\\n}\"","module.exports = \"#version 300 es\\nprecision highp float;\\n\\n// The vertex shader used to render the background of the scene\\n\\nin vec4 vs_Pos;\\nout vec2 fs_Pos;\\n\\nvoid main() {\\n fs_Pos = vs_Pos.xy;\\n gl_Position = vs_Pos;\\n}\\n\"","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import {vec2, vec3} from 'gl-matrix';\n// import * as Stats from 'stats-js';\n// import * as DAT from 'dat-gui';\nimport Square from './geometry/Square';\nimport OpenGLRenderer from './rendering/gl/OpenGLRenderer';\nimport Camera from './Camera';\nimport {setGL} from './globals';\nimport ShaderProgram, {Shader} from './rendering/gl/ShaderProgram';\n\n// Define an object with application parameters and button callbacks\n// This will be referred to by dat.GUI's functions that add GUI elements.\nconst controls = {\n tesselations: 5,\n 'Load Scene': loadScene, // A function pointer, essentially\n};\n\nlet square: Square;\nlet time: number = 0;\n\nfunction loadScene() {\n square = new Square(vec3.fromValues(0, 0, 0));\n square.create();\n // time = 0;\n}\n\nfunction main() {\n window.addEventListener('keypress', function (e) {\n // console.log(e.key);\n switch(e.key) {\n // Use this if you wish\n }\n }, false);\n\n window.addEventListener('keyup', function (e) {\n switch(e.key) {\n // Use this if you wish\n }\n }, false);\n\n // Initial display for framerate\n // const stats = Stats();\n // stats.setMode(0);\n // stats.domElement.style.position = 'absolute';\n // stats.domElement.style.left = '0px';\n // stats.domElement.style.top = '0px';\n // document.body.appendChild(stats.domElement);\n\n // Add controls to the gui\n // const gui = new DAT.GUI();\n\n // get canvas and webgl context\n const canvas = document.getElementById('canvas');\n const gl = canvas.getContext('webgl2');\n if (!gl) {\n alert('WebGL 2 not supported!');\n }\n // `setGL` is a function imported above which sets the value of `gl` in the `globals.ts` module.\n // Later, we can import `gl` from `globals.ts` to access it\n setGL(gl);\n\n // Initial call to load scene\n loadScene();\n\n const camera = new Camera(vec3.fromValues(0, 0, -10), vec3.fromValues(0, 0, 0));\n\n const renderer = new OpenGLRenderer(canvas);\n renderer.setClearColor(164.0 / 255.0, 233.0 / 255.0, 1.0, 1);\n gl.enable(gl.DEPTH_TEST);\n\n const flat = new ShaderProgram([\n new Shader(gl.VERTEX_SHADER, require('./shaders/flat-vert.glsl')),\n new Shader(gl.FRAGMENT_SHADER, require('./shaders/flat-frag.glsl')),\n ]);\n\n function processKeyPresses() {\n // Use this if you wish\n }\n\n // This function will be called every frame\n function tick() {\n camera.update();\n\n gl.viewport(0, 0, canvas.width, canvas.height);\n\n renderer.clear();\n processKeyPresses();\n renderer.render(camera, flat, [\n square,\n ], time);\n time++;\n\n // Tell the browser to call `tick` again whenever it renders a new frame\n requestAnimationFrame(tick);\n }\n\n const resDiv: number = 2;\n window.addEventListener('resize', function() {\n let width: number = window.innerWidth / resDiv;\n let height: number = window.innerHeight / resDiv;\n renderer.setSize(width, height);\n camera.setAspectRatio(width / height);\n camera.updateProjectionMatrix();\n flat.setDimensions(width, height);\n }, false);\n\n let width: number = window.innerWidth / resDiv;\n let height: number = window.innerHeight / resDiv;\n renderer.setSize(width, height);\n camera.setAspectRatio(width / height);\n camera.updateProjectionMatrix();\n flat.setDimensions(width, height);\n\n // Start the render loop\n tick();\n}\n\nmain();\n"],"names":[],"sourceRoot":""}
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index e1a47a3..8e496b0 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -57,12 +57,6 @@
"fastq": "^1.6.0"
}
},
- "@types/dat.gui": {
- "version": "0.7.7",
- "resolved": "https://registry.npmjs.org/@types/dat.gui/-/dat.gui-0.7.7.tgz",
- "integrity": "sha512-CxLCme0He5Jk3uQwfO/fGZMyNhb/ypANzqX0yU9lviBQMlen5SOvQTBQ/Cd9x5mFlUAK5Tk8RgvTyLj1nYkz+w==",
- "dev": true
- },
"@types/eslint": {
"version": "7.28.0",
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.28.0.tgz",
@@ -709,11 +703,6 @@
"resolved": "https://registry.npmjs.org/cubic-hermite/-/cubic-hermite-1.0.0.tgz",
"integrity": "sha1-hOOy8nKzFFToOTuZu2rtRRaMFOU="
},
- "dat.gui": {
- "version": "0.7.7",
- "resolved": "https://registry.npmjs.org/dat.gui/-/dat.gui-0.7.7.tgz",
- "integrity": "sha512-sRl/28gF/XRC5ywC9I4zriATTsQcpSsRG7seXCPnTkK8/EQMIbCu5NPMpICLGxX9ZEUvcXR3ArLYCtgreFoMDw=="
- },
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
@@ -1170,9 +1159,9 @@
"integrity": "sha512-sT5C0pwB1/e9G9AvAoLsoaJtbMGjfd/jfxo8jMCKqYYEnjZuFvqV5rehqar0538EmssjdDeiEWnKyBSTw7quoA=="
},
"gl-matrix": {
- "version": "3.3.0",
- "resolved": "https://registry.npmjs.org/gl-matrix/-/gl-matrix-3.3.0.tgz",
- "integrity": "sha512-COb7LDz+SXaHtl/h4LeaFcNdJdAQSDeVqjiIihSXNrkWObZLhDI4hIkZC11Aeqp7bcE72clzB0BnDXr2SmslRA=="
+ "version": "3.4.3",
+ "resolved": "https://registry.npmjs.org/gl-matrix/-/gl-matrix-3.4.3.tgz",
+ "integrity": "sha512-wcCp8vu8FT22BnvKVPjXa/ICBWRq/zjFfdofZy1WSpQZpphblv12/bOQLBC1rMM7SGOFS9ltVmKOHil5+Ml7gA=="
},
"gl-quat": {
"version": "1.0.0",
@@ -2686,11 +2675,6 @@
}
}
},
- "stats-js": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/stats-js/-/stats-js-1.0.1.tgz",
- "integrity": "sha512-EAwEFghGNv8mlYC4CZzI5kWghsnP8uBKXw6VLRHtXkOk5xySfUKLTqTkjgJFfDluIkf/O7eZwi5MXP50VeTbUg=="
- },
"statuses": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
diff --git a/src/main.ts b/src/main.ts
index fe526f9..4993d57 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -20,7 +20,7 @@ let time: number = 0;
function loadScene() {
square = new Square(vec3.fromValues(0, 0, 0));
square.create();
- // time = 0;
+ time = 0;
}
function main() {
@@ -79,31 +79,36 @@ function main() {
// This function will be called every frame
function tick() {
camera.update();
- // stats.begin();
- gl.viewport(0, 0, window.innerWidth, window.innerHeight);
+
+ gl.viewport(0, 0, canvas.width, canvas.height);
+
renderer.clear();
processKeyPresses();
renderer.render(camera, flat, [
square,
], time);
time++;
- // stats.end();
// Tell the browser to call `tick` again whenever it renders a new frame
requestAnimationFrame(tick);
}
+ const resDiv: number = 2;
window.addEventListener('resize', function() {
- renderer.setSize(window.innerWidth, window.innerHeight);
- camera.setAspectRatio(window.innerWidth / window.innerHeight);
+ let width: number = window.innerWidth / resDiv;
+ let height: number = window.innerHeight / resDiv;
+ renderer.setSize(width, height);
+ camera.setAspectRatio(width / height);
camera.updateProjectionMatrix();
- flat.setDimensions(window.innerWidth, window.innerHeight);
+ flat.setDimensions(width, height);
}, false);
- renderer.setSize(window.innerWidth, window.innerHeight);
- camera.setAspectRatio(window.innerWidth / window.innerHeight);
+ let width: number = window.innerWidth / resDiv;
+ let height: number = window.innerHeight / resDiv;
+ renderer.setSize(width, height);
+ camera.setAspectRatio(width / height);
camera.updateProjectionMatrix();
- flat.setDimensions(window.innerWidth, window.innerHeight);
+ flat.setDimensions(width, height);
// Start the render loop
tick();
diff --git a/src/shaders/flat-frag.glsl b/src/shaders/flat-frag.glsl
index 50434bd..418af2c 100644
--- a/src/shaders/flat-frag.glsl
+++ b/src/shaders/flat-frag.glsl
@@ -1,4 +1,7 @@
#version 300 es
+
+#define keyPadding 0.011f
+#define keyScale 2.7f
precision highp float;
uniform vec3 u_Eye, u_Ref, u_Up;
@@ -8,6 +11,389 @@ uniform float u_Time;
in vec2 fs_Pos;
out vec4 out_Col;
-void main() {
- out_Col = vec4(0.5 * (fs_Pos + vec2(1.0)), 0.5 * (sin(u_Time * 3.14159 * 0.01) + 1.0), 1.0);
+const int MAX_RAY_STEPS = 128;
+const float FOV = 45.0;
+const float FOV_TAN = tan(45.0);
+const float EPSILON = 1e-6;
+
+const vec3 EYE = vec3(0.0, 0.0, -10.0);
+const vec3 ORIGIN = vec3(0.0, 0.0, 0.0);
+const vec3 WORLD_UP = vec3(0.0, 1.0, 0.0);
+const vec3 WORLD_RIGHT = vec3(1.0, 0.0, 0.0);
+const vec3 WORLD_FORWARD = vec3(0.0, 0.0, 1.0);
+const vec3 LIGHT_DIR = vec3(-1.0, -1.0, -2.0);
+
+const vec3 ebCut = vec3(0.062, -0.27f, 0.f) / keyScale;
+const vec3 ebCutB = vec3(0.04, 0.45, 0.121) / keyScale;
+const vec3 whiteKeyBox = vec3(0.1, 0.71, 0.12) / keyScale;
+const vec3 keyStep = vec3(0.2f + keyPadding, 0.f, 0.f) / keyScale;
+
+struct Surface {
+ float distance;
+ vec3 color;
+};
+
+Surface mins(Surface a, Surface b) {
+ if (a.distance < b.distance) {
+ return a;
+ } else {
+ return b;
+ }
+}
+
+Surface maxs(Surface a, Surface b) {
+ if (a.distance > b.distance) {
+ return a;
+ } else {
+ return b;
+ }
+}
+
+struct Ray
+{
+ vec3 origin;
+ vec3 direction;
+};
+
+struct Intersection
+{
+ vec3 position;
+ vec3 normal;
+ float distance_t;
+ int material_id;
+ vec3 color;
+};
+
+// --- Geometry helpers ---
+float smoothSubtraction(float d1, float d2, float k) {
+ float h = clamp( 0.5 - 0.5*(d2+d1)/k, 0.0, 1.0 );
+ return mix( d2, -d1, h ) + k*h*(1.0-h);
+}
+
+float lengthInf(vec3 p) {
+ return max(p.x, max(p.y, p.y));
+}
+
+vec3 flipX(vec3 p) {
+ return vec3(-p.x, p.y, p.z);
+}
+
+float smin(float a, float b, float k) {
+ float h = clamp(0.5 + 0.5 * (b - a) / k, 0.0, 1.0);
+ return mix(b, a, h) - k * h * (1.0 - h);
+}
+
+mat3 rotationMatrix(vec3 axis, float angle)
+{
+ axis = normalize(axis);
+ float s = sin(angle);
+ float c = cos(angle);
+ float oc = 1.0 - c;
+
+ return mat3(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s,
+ oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s,
+ oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c);
+}
+
+vec3 translateTo(vec3 p, vec3 c) {
+ return p - c;
+}
+
+vec3 rotateAround(vec3 p, vec3 axis, float angle) {
+ return rotationMatrix(axis, angle) * p;
+}
+
+// L2-Norm SDFs
+float sdCappedCylinder(vec3 p, float h, float r) {
+ vec2 d = abs(vec2(length(p.xz), p.y)) - vec2(h,r);
+ return min(max(d.x, d.y), 0.0) + length(max(d, 0.0));
+}
+
+float sdfSphere(vec3 query_position, vec3 position, float radius) {
+ return length(query_position - position) - radius;
+}
+
+float sdfRoundBox(vec3 p, vec3 b, float r) {
+ vec3 q = abs(p) - b;
+ return length(max(q,0.0)) + min(max(q.x,max(q.y,q.z)),0.0) - r;
+}
+
+float sdfBox( vec3 p, vec3 b ) {
+ vec3 q = abs(p) - b;
+ return length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0);
+}
+
+Surface sdfIvoryKey(vec3 p) {
+ Surface s;
+ s.distance = sdfBox(p, vec3(0.05, 0.45, 0.18) / keyScale);
+ s.color = vec3(0.09f, 0.09f, 0.09f);
+ return s;
+}
+
+Surface sdfEBKey(vec3 p) {
+ Surface s;
+ vec3 pt = p + ebCut;
+ //return max(-sdfBox(pt, ebCutB), sdfBox(p, whiteKeyBox));
+ float d1 = -sdfBox(pt, ebCutB);
+ float d2 = sdfBox(p, whiteKeyBox);
+ s.distance = d1 > d2 ? d1 : d2;
+ s.color = vec3(0.98, 0.98, 0.98);
+ return s;
+}
+
+Surface sdfCFKey(vec3 p) {
+ return sdfEBKey(p - vec3(p.x * 2.f, 0.f, 0.f));
+}
+
+float expImpulse(float x, float k) {
+ float h = k*x;
+ return h*exp(1.0-h);
+}
+
+Surface sdfDKey(vec3 p) {
+ Surface s;
+ float mod = (1. + cos(u_Time / 4.f)) / 25.f;
+ p.z -= expImpulse(mod, 1.f/25.f) * 4.5f;
+ vec3 pt = p + vec3(0.085, -0.27f, 0.f) / keyScale;
+ float leftBox = sdfBox(pt, vec3(0.02, 0.45, 0.121) / keyScale);
+ pt = p + vec3(-0.089, -0.27f, 0.f) / keyScale;
+ float rightBox = sdfBox(pt, vec3(0.02, 0.45, 0.121) / keyScale);
+ s.distance = max(-rightBox, max(-leftBox, sdfBox(p, vec3(0.1, 0.71, 0.12) / keyScale)));
+ s.color = vec3(0.98, 0.98, 0.98);
+ return s;
+}
+
+Surface sdfGKey(vec3 p) {
+ Surface s;
+ vec3 pt = p + vec3(0.085, -0.27f, 0.f) / keyScale;
+ float leftBox = sdfBox(pt, vec3(0.018, 0.45, 0.121) / keyScale);
+ pt = p + vec3(-0.076, -0.27f, 0.f) / keyScale;
+ float rightBox = sdfBox(pt, vec3(0.025, 0.45, 0.121) / keyScale);
+ s.distance = max(-rightBox, max(-leftBox, sdfBox(p, vec3(0.1, 0.71, 0.12) / keyScale)));
+ s.color = vec3(0.98, 0.98, 0.98);
+ return s;
}
+
+Surface sdfAKey(vec3 p) {
+ return sdfGKey(p - vec3(p.x * 2.f, 0.f, 0.f));
+}
+
+Surface sdfMusicStand(vec3 p) {
+ Surface s;
+ vec3 p2 = p + vec3(0.f, 0.58f, 0.5f);
+ p2 = rotateAround(p2, vec3(1.f, 0.f, 0.f), 0.3);
+ s.distance = smoothSubtraction(
+ sdCappedCylinder(p2 + vec3(-1.46f, 0.f, 0.2f), 0.2, 0.022),
+ smoothSubtraction(
+ sdCappedCylinder(p2 + vec3(1.46f, 0.f, 0.2f), 0.2, 0.022),
+ sdfBox(p2, vec3(1.5f, 0.02f, 0.25f)),
+ 0.1), 0.1);
+
+ s.color = vec3(0.09, 0.09, 0.09);
+ return s;
+}
+
+//const vec3 keyStep = vec3(0.2f + keyPadding, 0.f, 0.f) / keyScale;
+Surface sdfOctave(vec3 p, out vec3 p2) {
+ vec3 ip = p - vec3(0.08, 0.28, -0.063) / keyScale;
+ Surface c = sdfCFKey(p);
+ p -= keyStep;
+ Surface cs = sdfIvoryKey(ip);
+ ip.x -= 0.255 / keyScale;
+ Surface d = sdfDKey(p);
+ p -= keyStep;
+ Surface ds = sdfIvoryKey(ip);
+ ip.x -= 0.38 / keyScale;
+ Surface e = sdfEBKey(p);
+ p -= keyStep;
+ Surface f = sdfCFKey(p);
+ p -= keyStep;
+ Surface fs = sdfIvoryKey(ip);
+ ip.x -= 0.24 / keyScale;
+ Surface g = sdfGKey(p);
+ p -= keyStep;
+ Surface gs = sdfIvoryKey(ip);
+ ip.x -= 0.23 / keyScale;
+ Surface a = sdfAKey(p);
+ p -= keyStep;
+ Surface as = sdfIvoryKey(ip);
+ Surface b = sdfEBKey(p);
+ p -= keyStep;
+ p2 = p;
+ return mins(b, mins(mins(as, a), mins(mins(gs, g), mins(mins(fs, f), mins(e, mins(mins(ds, d), mins(cs, c)))))));
+ //return e;
+}
+
+Surface sdfFrame(vec3 p) {
+ Surface s;
+ s.color = vec3(0.3f, 0.3f, 0.3f);
+ vec3 mainB = vec3(7.f, 2.f, 6.f) / 4.f;
+ vec3 sideB = vec3(0.05, 0.9, 0.9);
+ vec3 frontB = vec3(mainB.x, sideB.x, 0.2);
+ float top = sdfRoundBox(p + vec3(0.f, 0.f, 1.5f), vec3(7.1f, 2.1f, 0.1f) / 4.f, 0.01);
+ float bottom =
+ sdfBox(p + vec3(0.f, 1.f, -0.1f), vec3(1.7f, 0.3f, 0.1f));
+ s.distance = min(sdfBox(p + vec3(0.f, mainB.y + sideB.y - frontB.y * 3.f, 0.f), frontB),
+ smin(
+ sdfRoundBox(p - flipX(mainB) + flipX(sideB), sideB, 0.01),
+ smin(sdfRoundBox(p - mainB + sideB, sideB, 0.01), sdfBox(p, mainB), 0.1), 0.1));
+
+ s.distance = smin(top, s.distance, 0.1);
+ s.distance = min(s.distance, bottom);
+ return s;
+}
+
+Surface sdfKeys(vec3 p, int octaves) {
+ Surface v;
+ v.distance = 999999.f;
+ vec3 p2 = p;
+ for (int i = 0; i < octaves; i++) {
+ v = mins(v, sdfOctave(p2, p2));
+ }
+
+ return v;
+}
+
+Surface sceneSDF(vec3 queryPos) {
+ float box = sdfBox(queryPos + vec3(0.f, 1.f, 0.2f), vec3(1.7f, 0.3f, 0.6f));
+ Surface keys;
+ keys.distance = 999999.f;
+ if (box < EPSILON) {
+ keys = sdfKeys(queryPos + vec3(1.6f, 0.95f, 0.2f), 6);
+ }
+
+ // Surface boxs;
+ // boxs.distance = box;
+ // boxs.color = vec3(0.f, 0.f, 1.f);
+
+ // vec3 q2 = rotateAround(
+ // queryPos,
+ // vec3(0.0, 0.1f,0.1f),
+ // 0.5f);
+
+ // return sdfBox(
+ // q2,
+ // vec3(0.5f, 0.5f, 0.5f));
+
+ //return sdfOctave(queryPos);
+ vec3 p;
+ Surface o1 = sdfFrame(queryPos);//sdfOctave(queryPos, p);
+ //float o2 = sdfOctave(p, p);
+ //return min(o1, o2);
+ return mins(sdfMusicStand(queryPos), mins(keys, o1));
+}
+
+// Linf Norm SDFs
+
+const float d = 0.001f;
+vec3 sceneSDFGrad(vec3 queryPos) {
+ vec3 diffVec = vec3(d, 0.f, 0.f);
+ return normalize(vec3(
+ sceneSDF(queryPos + diffVec).distance - sceneSDF(queryPos - diffVec).distance ,
+ sceneSDF(queryPos + diffVec.yxz).distance - sceneSDF(queryPos - diffVec.yxz).distance ,
+ sceneSDF(queryPos + diffVec.zyx).distance - sceneSDF(queryPos - diffVec.zyx).distance
+ ));
+}
+
+Ray getRay(vec2 uv)
+{
+ Ray r;
+
+ vec3 look = normalize(u_Ref - u_Eye);
+ vec3 camera_RIGHT = normalize(cross(u_Up, look));
+ vec3 camera_UP = u_Up;
+
+ float aspect_ratio = u_Dimensions.x / u_Dimensions.y;
+ vec3 screen_vertical = camera_UP * FOV_TAN;
+ vec3 screen_horizontal = camera_RIGHT * aspect_ratio * FOV_TAN;
+ vec3 screen_point = (look + uv.x * screen_horizontal + uv.y * screen_vertical);
+
+ r.origin = (screen_point + u_Eye) / 2.f;
+ r.direction = normalize(screen_point - u_Eye);
+
+ return r;
+}
+
+const float MIN_STEP = EPSILON * 2.f;
+Intersection getRaymarchedIntersection(vec2 uv)
+{
+ Intersection intersection;
+ intersection.distance_t = -1.0;
+ Ray ray = getRay(uv);
+
+ float distance_t = 0.f;
+ float prevDist = 99999.f;
+ // if (uv.x < 0.5f || uv.y < 0.5f) {
+ // return intersection;
+ // }
+
+ for (int step = 0; step < MAX_RAY_STEPS; step++) {
+ vec3 point = ray.origin + ray.direction * distance_t;
+ Surface s = sceneSDF(point);
+ // if (point.y > 5.f || point.z > 5.f) {
+ // break;
+ // }
+ // if (isinf(point.x) || isinf(point.y) || isinf(point.z)) {
+ // break;
+ // }
+
+ // if (dist > prevDist) {
+ // break;
+ // }
+
+ if (s.distance < EPSILON) {
+ intersection.distance_t = s.distance;
+ intersection.position = point;
+ intersection.normal = sceneSDFGrad(point);
+ intersection.color = s.color;
+
+ return intersection;
+ }
+
+ distance_t += max(s.distance, MIN_STEP);
+
+ if (distance_t > 100.f) {
+ break;
+ }
+ }
+
+ return intersection;
+}
+
+const vec3 light = vec3(10.f, 14.f, 3.f);
+vec3 getSceneColor(vec2 uv) {
+ Intersection intersection = getRaymarchedIntersection(uv);
+ // if (uv.x > 0.3f && uv.y < -0.3f) {
+ // if (abs(intersection.distance_t) < EPSILON) {
+ // if (isinf(intersection.position.x)) {
+ // return vec3(1.f, 0.f, 0.f);
+ // }
+ // }
+ // return vec3(0.f, 0.f, 1.f);
+ // }
+
+ if (abs(intersection.distance_t) < EPSILON)
+ {
+ float diffuseTerm = dot(intersection.normal, normalize(u_Eye - intersection.position));
+ diffuseTerm = clamp(diffuseTerm, 0.f, 1.f);
+
+ return intersection.color * (diffuseTerm + 0.2);
+ }
+
+ return vec3(0.7, 0.2, 0.2);
+}
+
+void main() {
+ // downsample resolution
+ // vec2 target = u_Dimensions / 2.f;
+ // vec2 scaled = (fs_Pos + vec2(1.f, 1.f)) / 2.f;
+ // vec2 uv = vec2(floor(target.x * scaled.x), floor(target.y * scaled.y));
+ // uv.x /= target.x;
+ // uv.y /= target.y;
+ // uv = uv * 2.f - vec2(1.f, 1.f);
+ // Time varying pixel color
+ vec3 col = getSceneColor(fs_Pos);
+
+ // Output to screen
+ out_Col = vec4(col, 1.0);//vec4(0.5 * (fs_Pos + vec2(1.0)), 0.5 * (sin(u_Time * 3.14159 * 0.01) + 1.0), 1.0);
+}
\ No newline at end of file