From a02d884fabe539a67923a6c9d9b1f9dc10f610cd Mon Sep 17 00:00:00 2001 From: Benjamin Hetherington Date: Fri, 27 Sep 2019 18:58:19 -0400 Subject: [PATCH 1/4] Attempted to add hydraulic erosion --- .babelrc | 7 + .gitignore | 2 + client/css/index.css | 8 + client/index.html | 11 + client/js/controller.js | 60 + client/js/entity.js | 36 + client/js/main.js | 208 + client/js/noise.js | 53 + client/js/player.js | 0 client/js/terrain.js | 415 + client/js/world.js | 13 + dist/css.967bad95.css | 11 + dist/css.967bad95.css.map | 1 + dist/css.967bad95.js | 396 + dist/css.967bad95.js.map | 1 + dist/index.html | 11 + dist/main.fb6bbcaf.js | 105624 +++++++++++++++++++++++++++++++++++ dist/main.fb6bbcaf.js.map | 1 + package-lock.json | 8054 +++ package.json | 42 + server/loader.js | 2 + server/main.js | 14 + 22 files changed, 114970 insertions(+) create mode 100644 .babelrc create mode 100644 .gitignore create mode 100644 client/css/index.css create mode 100644 client/index.html create mode 100644 client/js/controller.js create mode 100644 client/js/entity.js create mode 100644 client/js/main.js create mode 100644 client/js/noise.js create mode 100644 client/js/player.js create mode 100644 client/js/terrain.js create mode 100644 client/js/world.js create mode 100644 dist/css.967bad95.css create mode 100644 dist/css.967bad95.css.map create mode 100644 dist/css.967bad95.js create mode 100644 dist/css.967bad95.js.map create mode 100644 dist/index.html create mode 100644 dist/main.fb6bbcaf.js create mode 100644 dist/main.fb6bbcaf.js.map create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 server/loader.js create mode 100644 server/main.js diff --git a/.babelrc b/.babelrc new file mode 100644 index 000000000..02b40ff97 --- /dev/null +++ b/.babelrc @@ -0,0 +1,7 @@ +{ + "presets": ["@babel/preset-react", "@babel/preset-env"], + "plugins": [ + "@babel/plugin-proposal-class-properties", + "@babel/plugin-transform-runtime" + ] +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..c935a51ea --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +.cache \ No newline at end of file diff --git a/client/css/index.css b/client/css/index.css new file mode 100644 index 000000000..f08bef310 --- /dev/null +++ b/client/css/index.css @@ -0,0 +1,8 @@ +body { + margin: 0px; +} + +canvas { + width: 100%; + height: 100%; +} diff --git a/client/index.html b/client/index.html new file mode 100644 index 000000000..6eaa9a86d --- /dev/null +++ b/client/index.html @@ -0,0 +1,11 @@ + + + + + Page + + + + + + diff --git a/client/js/controller.js b/client/js/controller.js new file mode 100644 index 000000000..c0dba1ad1 --- /dev/null +++ b/client/js/controller.js @@ -0,0 +1,60 @@ +const toCartesian = (angle, magnitude) => { + return [1, 1]; +}; + +class Controller { + constructor() { + this.inputs = { + up: false, + down: false, + left: false, + right: false + }; + this.target = null; + } + + attachTo(entity) { + this.target = entity; + } + + update() { + const { target } = this; + if (target) { + } + } + + register() { + window.onkeydown(e => { + switch (e.key) { + case "w": + this.inputs.up = true; + break; + case "a": + this.inputs.left = true; + break; + case "d": + this.inputs.right = true; + break; + case "s": + this.inputs.down = true; + break; + } + }); + window.onkeyup(e => { + switch (e.key) { + case "w": + this.inputs.up = false; + break; + case "a": + this.inputs.left = false; + break; + case "d": + this.inputs.right = false; + break; + case "s": + this.inputs.down = false; + break; + } + }); + } +} diff --git a/client/js/entity.js b/client/js/entity.js new file mode 100644 index 000000000..c6e958f9e --- /dev/null +++ b/client/js/entity.js @@ -0,0 +1,36 @@ +import { BoxGeometry, MeshPhongMaterial, Mesh } from "three-full"; + +class Entity { + constructor() { + const geometry = new BoxGeometry(1, 1, 1); + const material = new MeshPhongMaterial({ color: 0x1f0707, shininess: 200 }); + this.mesh = new Mesh(geometry, material); + this.velocity = { + x: 0, + y: 0, + z: 0 + }; + } + + get rotation() { + return this.mesh.rotation; + } + + get position() { + return this.mesh.position; + } + + setVelocity(x, y, z) { + this.velocity.x = x; + this.velocity.y = y; + this.velocity.z = z; + } + + update() { + this.position.x += this.velocity.x; + this.position.y += this.velocity.y; + this.position.z += this.velocity.z; + } +} + +export default Entity; diff --git a/client/js/main.js b/client/js/main.js new file mode 100644 index 000000000..41f6818d8 --- /dev/null +++ b/client/js/main.js @@ -0,0 +1,208 @@ +import { + AmbientLight, + HemisphereLight, + WebGLRenderer, + Scene, + PerspectiveCamera, + BoxGeometry, + Mesh, + MeshPhongMaterial, + PointLight, + DirectionalLight, + Fog, + Sky, + OrbitControls, + SphereBufferGeometry, + MeshBasicMaterial +} from "three-full"; +import { GUI } from "dat.gui"; +import Terrain from "./terrain"; + +class App { + constructor() { + this.settings = { + amplitude: 3, + dropoff: 0.2, + layers: 4, + drops: 10 + }; + this.constructRenderer(); + this.constructScene(); + this.updateTerrain(); + this.constructCamera(); + this.constructLight(); + this.constructGUI(); + this.initWindowListeners(); + this.render = this.render.bind(this); + } + + get aspectRatio() { + return window.innerWidth / window.innerHeight; + } + + deleteMesh(mesh) { + this.scene.remove(mesh); + mesh.geometry.dispose(); + mesh.material.dispose(); + } + + updateTerrain() { + const { terrainMesh, settings } = this; + if (terrainMesh) { + this.deleteMesh(terrainMesh); + } + + this.terrainGen = new Terrain(50, 50, settings); + this.terrainMesh = this.terrainGen.toMesh(); + this.scene.add(this.terrainMesh); + } + + initWindowListeners() { + const controls = new OrbitControls(this.camera, this.renderer.domElement); + + this.mouseDown = false; + window.addEventListener("resize", () => { + this.renderer.setSize(window.innerWidth, window.innerHeight); + this.camera.aspect = this.aspectRatio; + this.camera.updateProjectionMatrix(); + }); + // window.addEventListener("mousedown", () => { + // this.mouseDown = true; + // }); + // window.addEventListener("mouseup", () => { + // this.mouseDown = false; + // }); + // window.addEventListener("mousemove", e => { + // if (this.mouseDown) { + // const { movementX: dx, movementY: dy } = e; + // this.camera.rotation.y += dx * 0.01; + // this.camera.rotation.x += dy * 0.01; + // } + // }); + } + + constructGUI() { + const gui = new GUI(); + + const lightSettings = gui.addFolder("Light"); + lightSettings.add(this.light.position, "x", -100, 100); + lightSettings.add(this.light.position, "y", -100, 100); + lightSettings.add(this.light.position, "z", -100, 100); + lightSettings.add(this.light, "intensity", 0, 10); + + const terrainSettings = gui.addFolder("Terrain"); + const tA = terrainSettings.add(this.settings, "amplitude", 0, 10); + const tP = terrainSettings.add(this.settings, "dropoff", 0, 1); + const tO = terrainSettings.add(this.settings, "layers", 1, 30); + const tD = terrainSettings.add(this.settings, "drops", 0, 10000); + + const eroder = { + erode: () => { + this.deleteMesh(this.terrainMesh); + for (let i = 0; i < this.settings.drops; i++) { + this.terrainGen.erode(); + } + this.terrainMesh = this.terrainGen.toMesh(); + this.scene.add(this.terrainMesh); + } + }; + + terrainSettings.add(eroder, "erode"); + + tA.onFinishChange(() => { + this.updateTerrain(); + }); + + tP.onFinishChange(() => { + this.updateTerrain(); + }); + + tO.onFinishChange(() => { + this.updateTerrain(); + }); + + // gui.add(this.light.position, "z", 10, 200); + } + + constructRenderer() { + const renderer = new WebGLRenderer({ antialias: true }); + renderer.setClearColor("#000000"); + renderer.setSize(window.innerWidth, window.innerHeight); + this.renderer = renderer; + } + + constructCamera() { + const camera = new PerspectiveCamera(75, this.aspectRatio, 0.1, 2000000); + camera.position.y = 20; + camera.rotation.x = 1; + this.camera = camera; + } + + constructLight() { + this.light = new HemisphereLight(0x000000, 0xffffff, 0.95); + this.light.position.set(0, -50, -100); + this.scene.add(this.light); + + this.ambientLight = new AmbientLight(0xaaccff, 0.35); + this.ambientLight.position.set(-200, -100, 200); + this.scene.add(this.ambientLight); + } + + constructScene() { + const scene = new Scene(); + this.scene = scene; + const fog = new Fog(0x304050, 0.025, 75); + // scene.fog = fog; + + const cube = new BoxGeometry(1, 1, 1); + const mat = new MeshPhongMaterial({ color: 0x444444, shininess: 1000 }); + const mesh = new Mesh(cube, mat); + mesh.position.y = 10; + this.scene.add(mesh); + + // const mesh = new Mesh( + // new BoxGeometry(1, 1, 1), + // new MeshPhongMaterial({ color: 0x444444, shininess: 2000 }) + // ); + + const sky = new Sky(); + sky.scale.setScalar(450000); + this.scene.add(sky); + scene.sky = sky; + + // Add Sun Helper + const sunSphere = new Mesh( + new SphereBufferGeometry(20000, 16, 8), + new MeshBasicMaterial({ color: 0xffffff }) + ); + sunSphere.position.y = -700000; + sunSphere.visible = false; + scene.add(sunSphere); + } + + attachRenderer() { + document.body.appendChild(this.renderer.domElement); + } + + render() { + window.requestAnimationFrame(this.render); + + this.renderer.render(this.scene, this.camera); + } + + start() { + this.attachRenderer(); + this.render(); + } +} + +const render = () => { + requestAnimationFrame(render); +}; + +const main = async () => { + const app = new App(); + app.start(); +}; + +window.onload = main; diff --git a/client/js/noise.js b/client/js/noise.js new file mode 100644 index 000000000..4ade48be2 --- /dev/null +++ b/client/js/noise.js @@ -0,0 +1,53 @@ +export const fillMatrix = (width, height, value = 0) => { + const len = width * height; + const data = new Float64Array(len); + for (let i = 0; i < len; i++) { + data[i] = value; + } + return data; +}; + +export const averageNeighbors = (x, y, width, height, data) => { + const tl = ((x - 1 + width) % width) + ((y - 1 + height) % height) * width; + const tc = x + ((y - 1 + height) % height) * width; + const tr = ((x + 1 + width) % width) + ((y - 1 + height) % height) * width; + const cl = ((x - 1 + width) % width) + y * width; + const cc = x + y * width; + const cr = ((x + 1 + width) % width) + y * width; + const bl = ((x - 1 + width) % width) + ((y + 1 + height) % height) * width; + const bc = x + ((y - 1 + height) % height) * width; + const br = ((x + 1 + width) % width) + ((y + 1 + height) % height) * width; + const avg = + (data[tl] + + data[tc] + + data[tr] + + data[cl] + + data[cc] + + data[cr] + + data[bl] + + data[bc] + + data[br]) / + 9; + return avg; +}; + +const normalize = data => { + const max = Math.max.apply(null, data); + if (max > 0) { + for (let i = 0; i < data.length; i++) { + data[i] /= max; + } + } +}; + +export const generateNoise = (width, height, simplex) => { + const data = fillMatrix(width, height, 0); + + for (let x = 0; x < width; x++) { + for (let y = 0; y < height; y++) { + data[x + y * width] = averageNeighbors(x, y, width, height, data); + } + } + normalize(data); + return data; +}; diff --git a/client/js/player.js b/client/js/player.js new file mode 100644 index 000000000..e69de29bb diff --git a/client/js/terrain.js b/client/js/terrain.js new file mode 100644 index 000000000..6d58412d9 --- /dev/null +++ b/client/js/terrain.js @@ -0,0 +1,415 @@ +import { + PlaneGeometry, + Mesh, + MeshPhongMaterial, + SimplexNoise, + FlatShading +} from "three-full"; + +import { averageNeighbors, fillMatrix } from "./noise"; + +class Terrain { + constructor(width, height, options = {}) { + const { + amplitude = 0.5, + dropoff = 0.2, + layers = 10, + sedimentPickup = 0.01, + drops + } = options; + this.drops = drops; + this.amplitude = amplitude; + this.dropoff = dropoff; + this.layers = layers; + this.width = width; + this.height = height; + this.sedimentPickup = sedimentPickup; + this.simplices = []; + this.changeQueue = []; + for (let i = 0; i < layers; i++) { + this.simplices.push(new SimplexNoise()); + } + + this.generateData(); + } + + isValid(x, y) { + return 0 <= x && x < this.width && 0 <= y && y < this.height; + } + + getPoint(x, y) { + if (this.isValid(x, y)) { + return this.data[x + y * this.width]; + } else { + return Infinity; + } + } + + setPoint(x, y, value) { + if (this.isValid(x, y)) { + this.data[x + y * this.width] = value; + } + } + + queueChange(x, y, value) { + this.changeQueue.push({ x, y, value }); + } + + clearQueue() { + for (const { x, y, value } of this.changeQueue) { + this.setPoint(x, y, value); + } + this.changeQueue = []; + } + + calculatePoint(x, y) { + // Top left corner + const topLeftX = Math.floor(x); + const topLeftY = Math.floor(y); + const topLeftZ = this.getPoint(topLeftX, topLeftY); + + // Top right corner + const topRightX = topLeftX + 1; + const topRightY = topLeftY; + const topRightZ = this.getPoint(topRightX, topRightY); + + // Bottom left corner + const botLeftX = topLeftX; + const botLeftY = topLeftY + 1; + const botLeftZ = this.getPoint(botLeftX, botLeftY); + + // Bottom right corner + const botRightX = topRightX; + const botRightY = botLeftY; + const botRightZ = this.getPoint(botRightX, botRightY); + + // Calculate distance to each point + const topLeftDx = topLeftX - x; + const topLeftDy = topLeftY - y; + const topLeftDist = Math.sqrt( + topLeftDx * topLeftDx + topLeftDy * topLeftDy + ); + + const topRightDx = topRightX - x; + const topRightDy = topRightY - y; + const topRightDist = Math.sqrt( + topRightDx * topRightDx + topRightDy * topRightDy + ); + + const botLeftDx = botLeftX - x; + const botLeftDy = botLeftY - y; + const botLeftDist = Math.sqrt( + botLeftDx * botLeftDx + botLeftDy * botLeftDy + ); + + const botRightDx = botRightX - x; + const botRightDy = botRightY - y; + const botRightDist = Math.sqrt( + botRightDx * botRightDx + botRightDy * botRightDy + ); + + // Interpolate the height at the point + const z = + (1 - topLeftDist) * topLeftZ + + (1 - topRightDist) * topRightZ + + (1 - botLeftDist) * botLeftZ + + (1 - botRightDist) * botRightZ; + + // Calculate direction of flow + const topLeftDz = topLeftZ - z; + const topRightDz = topRightZ - z; + const botLeftDz = botLeftZ - z; + const botRightDz = botRightZ - z; + + // Subtract each dz from the max dz + // This is to weight lower points higher + const maxDz = Math.max(topLeftDz, topRightDz, botLeftDz, botRightDz); + const weightedTopLeftDz = maxDz - topLeftDz; + const weightedTopRightDz = maxDz - topRightDz; + const weightedBotLeftDz = maxDz - botLeftDz; + const weightedBotRightDz = maxDz - botRightDz; + + const weightedSum = + weightedTopLeftDz + + weightedTopRightDz + + weightedBotLeftDz + + weightedBotRightDz; + + // Calculate each points contribution to the flow direction + const topLeftWeight = weightedTopLeftDz / weightedSum; + const topRightWeight = weightedTopRightDz / weightedSum; + const botLeftWeight = weightedBotLeftDz / weightedSum; + const botRightWeight = weightedBotRightDz / weightedSum; + + // Gradient should be weighted average of dzs + const gradientX = + topLeftWeight * topLeftDx + + topRightWeight * topRightDx + + botLeftWeight * botLeftDx + + botRightWeight * botRightDx; + + const gradientY = + topLeftWeight * topLeftDy + + topRightWeight * topRightDy + + botLeftWeight * botLeftDy + + botRightWeight * botRightDy; + + const gradientZ = + topLeftWeight * topLeftDz + + topRightWeight * topRightDz + + botLeftWeight * botLeftDz + + botRightWeight * botRightDz; + + return { + z, + topLeftX, + topLeftY, + topLeftZ, + topRightX, + topRightY, + topRightZ, + botLeftX, + botLeftY, + botLeftZ, + botRightX, + botRightY, + botRightZ, + topLeftWeight, + topRightWeight, + botLeftWeight, + botRightWeight, + gradientX, + gradientY, + gradientZ + }; + } + + getXBounded(x) { + while (x < 0) { + x += this.width; + } + while (x >= this.width) { + x -= this.width; + } + return x; + } + + getYBounded(y) { + while (y < 0) { + y += this.height; + } + while (y >= this.height) { + y -= this.height; + } + return y; + } + + simulateDrop(x, y) { + let { sedimentPickup } = this; + let sediment = 0; + let water = 1; + let speed = 0; + + for (let step = 0; step < 30; step++) { + water -= 0.01; + + const analysis = this.calculatePoint(x, y); + if (analysis) { + const { + z, + topLeftX, + topLeftY, + topLeftZ, + topRightX, + topRightY, + topRightZ, + botLeftX, + botLeftY, + botLeftZ, + botRightX, + botRightY, + botRightZ, + topLeftWeight, + topRightWeight, + botLeftWeight, + botRightWeight, + gradientX, + gradientY, + gradientZ + } = this.calculatePoint(x, y); + + // Calculate gradient magnitude + const gradientMagnitude = Math.sqrt( + gradientX * gradientX + gradientY * gradientY + ); + + // Calculate normalized gradient to represent the direction + const normalizedDx = gradientX / gradientMagnitude; + const normalizedDy = gradientY / gradientMagnitude; + // const normalizedDz = gradientZ / gradientMagnitude; + + // Increase the speed according to the z gradient + speed -= gradientZ; + + // Calculate capacity + const capacity = Math.max(0.05, speed * water); + const inertia = speed * water * 10; + + // Check if we're either moving uphill or over capacity + if (sediment > capacity || gradientZ - inertia > 0) { + if (gradientZ > 0) { + // Attempt to deposit up to the gradient + const deposit = Math.min(sediment, gradientZ); + sediment -= deposit; + + // Deposit across the cell + this.setPoint( + topLeftX, + topLeftY, + topLeftZ + topLeftWeight * deposit + ); + this.setPoint( + topRightX, + topRightY, + topRightZ + topRightWeight * deposit + ); + this.setPoint( + botLeftX, + botLeftY, + botLeftZ + botLeftWeight * deposit + ); + this.setPoint( + botRightX, + botRightY, + botRightZ + botRightWeight * deposit + ); + + // Try to keep going + if (sediment >= gradientZ - inertia) { + const dx = normalizedDx * speed; + const dy = normalizedDy * speed; + x += dx; + y += dy; + } + } else { + // Otherwise we are over capacity + // Drop some and keep going + const deposit = sediment - capacity; + sediment -= deposit; + + // Deposit across the cell + this.setPoint( + topLeftX, + topLeftY, + topLeftZ + topLeftWeight * deposit + ); + this.setPoint( + topRightX, + topRightY, + topRightZ + topRightWeight * deposit + ); + this.setPoint( + botLeftX, + botLeftY, + botLeftZ + botLeftWeight * deposit + ); + this.setPoint( + botRightX, + botRightY, + botRightZ + botRightWeight * deposit + ); + + // Keep flowing + const dx = normalizedDx * speed; + const dy = normalizedDy * speed; + x += dx; + y += dy; + } + } else { + // Continue flowing but erode the terrain + const pickup = sedimentPickup; + this.setPoint(topLeftX, topLeftY, topLeftZ - topLeftWeight * pickup); + this.setPoint( + topRightX, + topRightY, + topRightZ - topRightWeight * pickup + ); + this.setPoint(botLeftX, botLeftY, botLeftZ - botLeftWeight * pickup); + this.setPoint( + botRightX, + botRightY, + botRightZ - botRightWeight * pickup + ); + + // Go on + const dx = normalizedDx * speed; + const dy = normalizedDy * speed; + x += dx; + y += dy; + } + } + } + } + + erode() { + const x = Math.random() * this.width; + const y = Math.random() * this.height; + this.simulateDrop(x, y); + } + + getNoise(layer, x, y, z, w = 0) { + return this.simplices[layer].noise4d(x, y, z, w); + } + + addLayers(x, y, dropoff, layers) { + let sum = 0; + let mult = 0.01; + + for (let i = 0; i < layers; i++) { + const add = this.getNoise(i, x * mult, y * mult, 0, 0) / mult / 10; + mult /= dropoff; + sum += add; + } + + return sum; + } + + generateData() { + this.data = fillMatrix(this.width, this.height); + for (let x = 0; x < this.width; x++) { + for (let y = 0; y < this.height; y++) { + const index = x + y * this.width; + this.data[index] = this.addLayers(x, y, this.dropoff, this.layers); + } + } + } + + toMesh() { + const geometry = new PlaneGeometry( + 100, + 100, + this.width - 1, + this.height - 1 + ); + const { vertices } = geometry; + geometry.verticesNeedUpdate = true; + for (let i = 0; i < vertices.length; i++) { + vertices[i].z = this.data[i] * this.amplitude; + } + geometry.flatShading = true; + geometry.computeVertexNormals(); + + const material = new MeshPhongMaterial({ + color: 0x444444, + shininess: 1000 + }); + + const mesh = new Mesh(geometry, material); + + mesh.rotation.x = Math.PI * -0.5; + + return mesh; + } +} + +export default Terrain; diff --git a/client/js/world.js b/client/js/world.js new file mode 100644 index 000000000..171391bd0 --- /dev/null +++ b/client/js/world.js @@ -0,0 +1,13 @@ +import { Scene } from "three-full"; + +class World { + constructor() { + this.scene = new Scene(); + } + + add(entity) { + this.scene.add(entity.mesh); + } +} + +export default World; diff --git a/dist/css.967bad95.css b/dist/css.967bad95.css new file mode 100644 index 000000000..1d447a838 --- /dev/null +++ b/dist/css.967bad95.css @@ -0,0 +1,11 @@ +body { + margin: 0px; +} + +canvas { + width: 100%; + height: 100%; +} + + +/*# sourceMappingURL=/css.967bad95.css.map */ \ No newline at end of file diff --git a/dist/css.967bad95.css.map b/dist/css.967bad95.css.map new file mode 100644 index 000000000..fe635954c --- /dev/null +++ b/dist/css.967bad95.css.map @@ -0,0 +1 @@ +{"version":3,"sources":["css/index.css"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"css.967bad95.css","sourceRoot":"../client","sourcesContent":["body {\n margin: 0px;\n}\n\ncanvas {\n width: 100%;\n height: 100%;\n}\n"]} \ No newline at end of file diff --git a/dist/css.967bad95.js b/dist/css.967bad95.js new file mode 100644 index 000000000..958f961d5 --- /dev/null +++ b/dist/css.967bad95.js @@ -0,0 +1,396 @@ +// modules are defined as an array +// [ module function, map of requires ] +// +// map of requires is short require name -> numeric require +// +// anything defined in a previous bundle is accessed via the +// orig method which is the require for previous bundles +parcelRequire = (function (modules, cache, entry, globalName) { + // Save the require from previous bundle to this closure if any + var previousRequire = typeof parcelRequire === 'function' && parcelRequire; + var nodeRequire = typeof require === 'function' && require; + + function newRequire(name, jumped) { + if (!cache[name]) { + if (!modules[name]) { + // if we cannot find the module within our internal map or + // cache jump to the current global require ie. the last bundle + // that was added to the page. + var currentRequire = typeof parcelRequire === 'function' && parcelRequire; + if (!jumped && currentRequire) { + return currentRequire(name, true); + } + + // If there are other bundles on this page the require from the + // previous one is saved to 'previousRequire'. Repeat this as + // many times as there are bundles until the module is found or + // we exhaust the require chain. + if (previousRequire) { + return previousRequire(name, true); + } + + // Try the node require function if it exists. + if (nodeRequire && typeof name === 'string') { + return nodeRequire(name); + } + + var err = new Error('Cannot find module \'' + name + '\''); + err.code = 'MODULE_NOT_FOUND'; + throw err; + } + + localRequire.resolve = resolve; + localRequire.cache = {}; + + var module = cache[name] = new newRequire.Module(name); + + modules[name][0].call(module.exports, localRequire, module, module.exports, this); + } + + return cache[name].exports; + + function localRequire(x){ + return newRequire(localRequire.resolve(x)); + } + + function resolve(x){ + return modules[name][1][x] || x; + } + } + + function Module(moduleName) { + this.id = moduleName; + this.bundle = newRequire; + this.exports = {}; + } + + newRequire.isParcelRequire = true; + newRequire.Module = Module; + newRequire.modules = modules; + newRequire.cache = cache; + newRequire.parent = previousRequire; + newRequire.register = function (id, exports) { + modules[id] = [function (require, module) { + module.exports = exports; + }, {}]; + }; + + var error; + for (var i = 0; i < entry.length; i++) { + try { + newRequire(entry[i]); + } catch (e) { + // Save first error but execute all entries + if (!error) { + error = e; + } + } + } + + if (entry.length) { + // Expose entry point to Node, AMD or browser globals + // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js + var mainExports = newRequire(entry[entry.length - 1]); + + // CommonJS + if (typeof exports === "object" && typeof module !== "undefined") { + module.exports = mainExports; + + // RequireJS + } else if (typeof define === "function" && define.amd) { + define(function () { + return mainExports; + }); + + // + + + + diff --git a/dist/main.fb6bbcaf.js b/dist/main.fb6bbcaf.js new file mode 100644 index 000000000..f284edec2 --- /dev/null +++ b/dist/main.fb6bbcaf.js @@ -0,0 +1,105624 @@ +// modules are defined as an array +// [ module function, map of requires ] +// +// map of requires is short require name -> numeric require +// +// anything defined in a previous bundle is accessed via the +// orig method which is the require for previous bundles +parcelRequire = (function (modules, cache, entry, globalName) { + // Save the require from previous bundle to this closure if any + var previousRequire = typeof parcelRequire === 'function' && parcelRequire; + var nodeRequire = typeof require === 'function' && require; + + function newRequire(name, jumped) { + if (!cache[name]) { + if (!modules[name]) { + // if we cannot find the module within our internal map or + // cache jump to the current global require ie. the last bundle + // that was added to the page. + var currentRequire = typeof parcelRequire === 'function' && parcelRequire; + if (!jumped && currentRequire) { + return currentRequire(name, true); + } + + // If there are other bundles on this page the require from the + // previous one is saved to 'previousRequire'. Repeat this as + // many times as there are bundles until the module is found or + // we exhaust the require chain. + if (previousRequire) { + return previousRequire(name, true); + } + + // Try the node require function if it exists. + if (nodeRequire && typeof name === 'string') { + return nodeRequire(name); + } + + var err = new Error('Cannot find module \'' + name + '\''); + err.code = 'MODULE_NOT_FOUND'; + throw err; + } + + localRequire.resolve = resolve; + localRequire.cache = {}; + + var module = cache[name] = new newRequire.Module(name); + + modules[name][0].call(module.exports, localRequire, module, module.exports, this); + } + + return cache[name].exports; + + function localRequire(x){ + return newRequire(localRequire.resolve(x)); + } + + function resolve(x){ + return modules[name][1][x] || x; + } + } + + function Module(moduleName) { + this.id = moduleName; + this.bundle = newRequire; + this.exports = {}; + } + + newRequire.isParcelRequire = true; + newRequire.Module = Module; + newRequire.modules = modules; + newRequire.cache = cache; + newRequire.parent = previousRequire; + newRequire.register = function (id, exports) { + modules[id] = [function (require, module) { + module.exports = exports; + }, {}]; + }; + + var error; + for (var i = 0; i < entry.length; i++) { + try { + newRequire(entry[i]); + } catch (e) { + // Save first error but execute all entries + if (!error) { + error = e; + } + } + } + + if (entry.length) { + // Expose entry point to Node, AMD or browser globals + // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js + var mainExports = newRequire(entry[entry.length - 1]); + + // CommonJS + if (typeof exports === "object" && typeof module !== "undefined") { + module.exports = mainExports; + + // RequireJS + } else if (typeof define === "function" && define.amd) { + define(function () { + return mainExports; + }); + + // - - - - diff --git a/dist/main.fb6bbcaf.js b/dist/main.fb6bbcaf.js deleted file mode 100644 index f284edec2..000000000 --- a/dist/main.fb6bbcaf.js +++ /dev/null @@ -1,105624 +0,0 @@ -// modules are defined as an array -// [ module function, map of requires ] -// -// map of requires is short require name -> numeric require -// -// anything defined in a previous bundle is accessed via the -// orig method which is the require for previous bundles -parcelRequire = (function (modules, cache, entry, globalName) { - // Save the require from previous bundle to this closure if any - var previousRequire = typeof parcelRequire === 'function' && parcelRequire; - var nodeRequire = typeof require === 'function' && require; - - function newRequire(name, jumped) { - if (!cache[name]) { - if (!modules[name]) { - // if we cannot find the module within our internal map or - // cache jump to the current global require ie. the last bundle - // that was added to the page. - var currentRequire = typeof parcelRequire === 'function' && parcelRequire; - if (!jumped && currentRequire) { - return currentRequire(name, true); - } - - // If there are other bundles on this page the require from the - // previous one is saved to 'previousRequire'. Repeat this as - // many times as there are bundles until the module is found or - // we exhaust the require chain. - if (previousRequire) { - return previousRequire(name, true); - } - - // Try the node require function if it exists. - if (nodeRequire && typeof name === 'string') { - return nodeRequire(name); - } - - var err = new Error('Cannot find module \'' + name + '\''); - err.code = 'MODULE_NOT_FOUND'; - throw err; - } - - localRequire.resolve = resolve; - localRequire.cache = {}; - - var module = cache[name] = new newRequire.Module(name); - - modules[name][0].call(module.exports, localRequire, module, module.exports, this); - } - - return cache[name].exports; - - function localRequire(x){ - return newRequire(localRequire.resolve(x)); - } - - function resolve(x){ - return modules[name][1][x] || x; - } - } - - function Module(moduleName) { - this.id = moduleName; - this.bundle = newRequire; - this.exports = {}; - } - - newRequire.isParcelRequire = true; - newRequire.Module = Module; - newRequire.modules = modules; - newRequire.cache = cache; - newRequire.parent = previousRequire; - newRequire.register = function (id, exports) { - modules[id] = [function (require, module) { - module.exports = exports; - }, {}]; - }; - - var error; - for (var i = 0; i < entry.length; i++) { - try { - newRequire(entry[i]); - } catch (e) { - // Save first error but execute all entries - if (!error) { - error = e; - } - } - } - - if (entry.length) { - // Expose entry point to Node, AMD or browser globals - // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js - var mainExports = newRequire(entry[entry.length - 1]); - - // CommonJS - if (typeof exports === "object" && typeof module !== "undefined") { - module.exports = mainExports; - - // RequireJS - } else if (typeof define === "function" && define.amd) { - define(function () { - return mainExports; - }); - - //