-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js.map
1 lines (1 loc) · 46.8 KB
/
main.js.map
1
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./js/KeyboardHandler.js","webpack:///./js/TextArea.js","webpack:///./js/Monitor.js","webpack:///./js/RiftSandbox.js","webpack:///./js/File.js","webpack:///./js/Sketch.js","webpack:///./js/Files/Cube.js","webpack:///./js/index.js","webpack:///./js/SketchController.js"],"names":["webpackJsonpCallback","data","moduleId","chunkId","chunkIds","moreModules","executeModules","i","resolves","length","Object","prototype","hasOwnProperty","call","installedChunks","push","modules","parentJsonpFunction","shift","deferredModules","apply","checkDeferredModules","result","deferredModule","fulfilled","j","depId","splice","__webpack_require__","s","installedModules","0","exports","module","l","m","c","d","name","getter","o","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","p","jsonpArray","window","oldJsonpFunction","slice","getShortcut","sketchController","this","_sketchController","domTextArea","file","kibo","down","spinNumberAndKeepSelection","resetSensor","toggleTextAreas","riftSandbox","toggleMonitor","startVrMode","_bindNumberShortcuts","FONT_SIZE_PX","NUM_LINES","CANVAS_SIZE_PX","UPDATE_INTERVAL_MS","hasCamera","_hasCamera","canvasSize","canvas","document","createElement","width","height","context","getContext","font","globalCompositeOperation","textMetrics","measureText","charWidth","numCols","Math","floor","viewPort","line","col","textTexture","needsUpdate","minFilter","textAreaMat","map","side","transparent","position","y","castShadow","setupInfoPane","lastUpdate","Date","now","isBlinkOff","infoContext","fillStyle","fillRect","fillText","infoTexture","infoMat","infoMesh","add","msg","clearRect","shouldBeVisible","visible","start","selectionStart","end","selectionEnd","charsSeenWithNewLines","split","isLineSelected","lineStart","lineEnd","text","newText","oldText","newStart","oldStart","newEnd","oldEnd","hasStartChanged","lines","substring","match","shouldUpdateTexture","getLines","updateViewport","min","lineText","nextLine","MESH_SIZE","WIDTH","HEIGHT","ASPECT","domMonitor","_domMonitor","_canvas","_monitorTexture","monitorMaterial","opacity","set","rotation","PI","drawImage","_width","_height","_textAreas","areTextAreasVisible","scene","_sceneStuff","renderer","_initWebGL","_initScene","resize","fog","_camera","dolly","z","maxAnisotropy","capabilities","getMaxAnisotropy","groundTexture","load","anisotropy","wrapS","wrapT","repeat","ground","roughness","metalness","x","receiveShadow","_monitor","domTextAreas","textArea","_resetTextAreas","forEach","rotateOnAxis","translateZ","oldAdd","obj","toggle","setInfo","antialias","getElementById","setPixelRatio","devicePixelRatio","vr","enabled","shadowMap","type","button","VRButton","createButton","style","backgroundColor","body","append","e","alert","setClearColor","setSize","container","remove","update","render","innerWidth","innerHeight","aspect","updateProjectionMatrix","contents","uuid","generateUUID","index","number","direction","amount","indexOf","parseInt","toString","parseFloat","toFixed","_findNumberAt","undefined","newNumber","_spinNumber","files","initialized","state","code","innerHTML","github","_keyboardHandler","_sketchLoop","google","families","active","readyState","addEventListener","_init","display","_setupDomTextArea","_mainLoop","_focusCurrentTextArea","navigator","mediaDevices","getUserMedia","video","then","stream","srcObject","catch","console","info","storedSketches","localStorage","getItem","_sketch","fromJSON","JSON","parse","Cube","_domTextAreas","_currentDomTextArea","focus","_riftSandbox","setTextAreas","interceptScene","id","target","_readCode","stopPropagation","bindKeyboardShortcuts","err","log","setItem","stringify","toJSON","clearScene","Function","getCode","_sketchFunc","cameraPivot","loop","spinNumberAt","_initializeSketch","_initializeUnsupportedModal","setAnimationLoop","location","search","blur"],"mappings":"aACE,SAASA,EAAqBC,GAQ7B,IAPA,IAMIC,EAAUC,EANVC,EAAWH,EAAK,GAChBI,EAAcJ,EAAK,GACnBK,EAAiBL,EAAK,GAIHM,EAAI,EAAGC,EAAW,GACpCD,EAAIH,EAASK,OAAQF,IACzBJ,EAAUC,EAASG,GAChBG,OAAOC,UAAUC,eAAeC,KAAKC,EAAiBX,IAAYW,EAAgBX,IACpFK,EAASO,KAAKD,EAAgBX,GAAS,IAExCW,EAAgBX,GAAW,EAE5B,IAAID,KAAYG,EACZK,OAAOC,UAAUC,eAAeC,K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AsBpN,UAG5CA,SAASwI,KAAK0C,iBAAiB,QAASvM,KAAK4M,uBAE7C5M,KAAKuP,8BAEL5P,OAAO4M,iBAAiB,SAAUvM,KAAKkO,aAAahH,QAAQ,GAE5DlH,KAAKkO,aAAahH,SAElBlH,KAAKkO,aAAanH,SAASyI,iBAAiBxP,KAAK2M,YAEP,IAAtC8C,SAASC,OAAOxE,QAAQ,UAC1BlL,KAAKW,cAIT,kBACMX,KAAKkO,aAAatH,oBACpB5G,KAAKgO,oBAAoB2B,OAEzB3P,KAAK4M,wBAEP5M,KAAKkO,aAAa1N,kBAGpB,wBACER,KAAKgO,oBAAoBC,QAG3B,2BACE,OAAOjO,KAAKgO,oBAAoB9J","file":"main.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tfunction webpackJsonpCallback(data) {\n \t\tvar chunkIds = data[0];\n \t\tvar moreModules = data[1];\n \t\tvar executeModules = data[2];\n\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(data);\n\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n\n \t\t// add entry modules from loaded chunk to deferred list\n \t\tdeferredModules.push.apply(deferredModules, executeModules || []);\n\n \t\t// run deferred modules when all chunks ready\n \t\treturn checkDeferredModules();\n \t};\n \tfunction checkDeferredModules() {\n \t\tvar result;\n \t\tfor(var i = 0; i < deferredModules.length; i++) {\n \t\t\tvar deferredModule = deferredModules[i];\n \t\t\tvar fulfilled = true;\n \t\t\tfor(var j = 1; j < deferredModule.length; j++) {\n \t\t\t\tvar depId = deferredModule[j];\n \t\t\t\tif(installedChunks[depId] !== 0) fulfilled = false;\n \t\t\t}\n \t\t\tif(fulfilled) {\n \t\t\t\tdeferredModules.splice(i--, 1);\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = deferredModule[0]);\n \t\t\t}\n \t\t}\n\n \t\treturn result;\n \t}\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// undefined = chunk not loaded, null = chunk preloaded/prefetched\n \t// Promise = chunk loading, 0 = chunk loaded\n \tvar installedChunks = {\n \t\t0: 0\n \t};\n\n \tvar deferredModules = [];\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \tvar jsonpArray = window[\"webpackJsonp\"] = window[\"webpackJsonp\"] || [];\n \tvar oldJsonpFunction = jsonpArray.push.bind(jsonpArray);\n \tjsonpArray.push = webpackJsonpCallback;\n \tjsonpArray = jsonpArray.slice();\n \tfor(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);\n \tvar parentJsonpFunction = oldJsonpFunction;\n\n\n \t// add entry module to deferred list\n \tdeferredModules.push([5,1]);\n \t// run deferred modules when ready\n \treturn checkDeferredModules();\n","import Kibo from \"@brianpeiris/kibo\";\n\nconst getShortcut = function(key) {\n key = key || \"\";\n return [\"alt shift \" + key, \"ctrl shift \" + key];\n};\n\nexport default class KeyboardHandler {\n constructor(sketchController) {\n this._sketchController = sketchController;\n }\n\n _bindNumberShortcuts(domTextArea, file, kibo) {\n kibo.down(getShortcut(\"u\"), () => {\n this._sketchController.spinNumberAndKeepSelection(domTextArea, file, -1, 10);\n return false;\n });\n kibo.down(getShortcut(\"i\"), () => {\n this._sketchController.spinNumberAndKeepSelection(domTextArea, file, 1, 10);\n return false;\n });\n kibo.down(getShortcut(\"j\"), () => {\n this._sketchController.spinNumberAndKeepSelection(domTextArea, file, -1, 1);\n return false;\n });\n kibo.down(getShortcut(\"k\"), () => {\n this._sketchController.spinNumberAndKeepSelection(domTextArea, file, 1, 1);\n return false;\n });\n kibo.down(getShortcut(\"n\"), () => {\n this._sketchController.spinNumberAndKeepSelection(domTextArea, file, -1, 0.1);\n return false;\n });\n kibo.down(getShortcut(\"m\"), () => {\n this._sketchController.spinNumberAndKeepSelection(domTextArea, file, 1, 0.1);\n return false;\n });\n }\n\n bindKeyboardShortcuts(domTextArea, file) {\n const kibo = new Kibo(domTextArea);\n kibo.down(getShortcut(\"z\"), () => {\n this._sketchController.resetSensor();\n return false;\n });\n kibo.down(getShortcut(\"e\"), () => {\n this._sketchController.toggleTextAreas();\n return false;\n });\n kibo.down(getShortcut(\"r\"), () => {\n this.riftSandbox.toggleMonitor();\n return false;\n });\n\n kibo.down(getShortcut(\"v\"), () => {\n this._sketchController.startVrMode();\n return false;\n });\n\n if (file) {\n this._bindNumberShortcuts(domTextArea, file, kibo);\n }\n }\n}\n","import * as THREE from \"three\";\n\nconst FONT_SIZE_PX = 40;\nconst NUM_LINES = 20;\nconst CANVAS_SIZE_PX = NUM_LINES * FONT_SIZE_PX + FONT_SIZE_PX * 0.2;\nconst UPDATE_INTERVAL_MS = 500;\nexport default class TextArea {\n constructor(domTextArea, hasCamera) {\n this.domTextArea = domTextArea;\n this._hasCamera = hasCamera;\n\n this.canvasSize = CANVAS_SIZE_PX;\n const canvas = document.createElement(\"canvas\");\n canvas.width = canvas.height = this.canvasSize;\n\n this.context = canvas.getContext(\"2d\");\n this.context.font = FONT_SIZE_PX + \"px Ubuntu Mono, monospace\";\n this.context.globalCompositeOperation = \"darker\";\n const textMetrics = this.context.measureText(\"0\");\n this.charWidth = textMetrics.width;\n this.numCols = Math.floor(CANVAS_SIZE_PX / this.charWidth);\n\n this.viewPort = {\n line: 0,\n col: 0\n };\n\n this.textTexture = new THREE.Texture(canvas);\n this.textTexture.needsUpdate = true;\n this.textTexture.minFilter = THREE.LinearFilter;\n\n const textAreaMat = new THREE.MeshBasicMaterial({ map: this.textTexture, side: THREE.DoubleSide });\n textAreaMat.transparent = true;\n\n this.object = new THREE.Mesh(new THREE.PlaneBufferGeometry(2, 2), new THREE.MeshBasicMaterial(textAreaMat));\n this.object.position.y = 1.5;\n this.object.castShadow = true;\n\n this.setupInfoPane();\n\n this.lastUpdate = Date.now();\n this.isBlinkOff = false;\n }\n\n setupInfoPane() {\n const canvas = document.createElement(\"canvas\");\n canvas.width = this.canvasSize;\n canvas.height = 200;\n\n this.infoContext = canvas.getContext(\"2d\");\n this.infoContext.font = FONT_SIZE_PX + \"px Ubuntu Mono, monospace\";\n this.infoContext.fillStyle = \"hsla(200, 50%, 90%, 0.9)\";\n this.infoContext.fillRect(0, 0, this.canvasSize, this.canvasSize);\n this.infoContext.fillStyle = \"hsl(0, 0%, 25%)\";\n this.infoContext.fillText(\"Alt/Ctrl + Shift + ...\", 0, FONT_SIZE_PX * 2);\n this.infoContext.fillText(`e - toggle editor${this._hasCamera ? \" | r - webcam\" : \"\"}`, 0, FONT_SIZE_PX * 3);\n this.infoContext.fillText(\"j/k, u/i, n/m - change number\", 0, FONT_SIZE_PX * 4);\n\n this.infoTexture = new THREE.Texture(canvas);\n this.infoTexture.needsUpdate = true;\n this.infoTexture.minFilter = THREE.LinearFilter;\n\n const infoMat = new THREE.MeshBasicMaterial({ map: this.infoTexture, side: THREE.DoubleSide });\n infoMat.transparent = true;\n\n const infoMesh = new THREE.Mesh(new THREE.PlaneBufferGeometry(2, 0.5), new THREE.MeshBasicMaterial(infoMat));\n infoMesh.castShadow = true;\n infoMesh.position.y = -1.3;\n\n this.object.add(infoMesh);\n }\n\n setInfo(msg) {\n this.infoContext.clearRect(0, 0, this.canvasSize, FONT_SIZE_PX * 1.2);\n this.infoContext.fillStyle = \"hsla(200, 50%, 90%, 0.9)\";\n this.infoContext.fillRect(0, 0, this.canvasSize, FONT_SIZE_PX * 1.2);\n this.infoContext.fillStyle = \"hsl(0, 50%, 50%)\";\n this.infoContext.fillText(msg, 0, FONT_SIZE_PX);\n this.infoTexture.needsUpdate = true;\n }\n\n toggle(shouldBeVisible) {\n this.object.visible = shouldBeVisible;\n }\n\n getLines() {\n const start = this.domTextArea.selectionStart;\n const end = this.domTextArea.selectionEnd;\n\n let charsSeenWithNewLines = 0;\n\n const lines = this.domTextArea.value.split(\"\\n\");\n return lines.map(function(line) {\n const isLineSelected = start <= charsSeenWithNewLines + line.length && end >= charsSeenWithNewLines;\n\n let lineStart = 0,\n lineEnd = line.length;\n if (isLineSelected) {\n if (start >= charsSeenWithNewLines) {\n lineStart = start - charsSeenWithNewLines;\n }\n if (end <= charsSeenWithNewLines + line.length) {\n lineEnd = end - charsSeenWithNewLines;\n }\n } else {\n lineStart = lineEnd = null;\n }\n\n charsSeenWithNewLines += line.length + 1;\n\n const lineObj = {\n text: line,\n selectionStart: lineStart,\n selectionEnd: lineEnd\n };\n\n return lineObj;\n });\n }\n\n shouldUpdateTexture() {\n if (Date.now() - this.lastUpdate > UPDATE_INTERVAL_MS) {\n this.lastUpdate = Date.now();\n return true;\n }\n const newText = this.domTextArea.value;\n if (this.oldText !== newText) {\n this.oldText = this.domTextArea.value;\n return true;\n }\n const newStart = this.domTextArea.selectionStart;\n if (this.oldStart !== newStart) {\n this.oldStart = newStart;\n return true;\n }\n const newEnd = this.domTextArea.selectionEnd;\n if (this.oldEnd !== newEnd) {\n this.oldEnd = newEnd;\n return true;\n }\n }\n\n updateViewport(hasStartChanged, lines) {\n const position = hasStartChanged ? this.domTextArea.selectionStart : this.domTextArea.selectionEnd;\n const substring = this.domTextArea.value.substring(0, position);\n const linesUpToPosition = substring.match(/\\n/g) || [];\n let line = linesUpToPosition.length + 1;\n if (line < this.viewPort.line + 1) {\n this.viewPort.line = line - 1;\n } else if (line > this.viewPort.line + NUM_LINES) {\n this.viewPort.line = line - NUM_LINES;\n }\n\n line = lines[line - 1];\n const col = hasStartChanged ? line.selectionStart : line.selectionEnd;\n if (col < this.viewPort.col) {\n this.viewPort.col = col;\n } else if (col > this.viewPort.col + this.numCols) {\n this.viewPort.col = col - this.numCols;\n }\n }\n\n update() {\n const hasStartChanged = this.domTextArea.selectionStart != this.oldStart;\n if (!this.shouldUpdateTexture()) {\n return;\n }\n\n const lines = this.getLines(this.domTextArea);\n this.updateViewport(hasStartChanged, lines);\n\n this.context.clearRect(0, 0, this.canvasSize, this.canvasSize);\n this.context.fillStyle = \"hsla(0, 0%, 100%, 0.8)\";\n this.context.fillRect(0, 0, this.canvasSize, this.canvasSize);\n\n for (let i = this.viewPort.line; i < Math.min(this.viewPort.line + NUM_LINES, lines.length); i++) {\n const j = i - this.viewPort.line;\n const line = lines[i];\n this.context.fillStyle = \"hsl(0, 0%, 25%)\";\n const lineText = line.text.substring(this.viewPort.col, this.viewPort.col + this.numCols);\n this.context.fillText(lineText, 0, FONT_SIZE_PX + FONT_SIZE_PX * j);\n\n if (line.selectionStart === null) {\n continue;\n }\n\n this.context.fillStyle = \"rgba(100, 100, 200, 0.8)\";\n let width = (line.selectionEnd - line.selectionStart) * this.charWidth;\n if (width === 0) {\n width = 5;\n const nextLine = lines[i + 1];\n const isLastSelectedLine = !nextLine || nextLine.selectionStart === null;\n if (isLastSelectedLine && this.isBlinkOff) {\n continue;\n }\n }\n this.context.fillRect(\n (line.selectionStart - this.viewPort.col) * this.charWidth,\n 0.2 * FONT_SIZE_PX + FONT_SIZE_PX * j,\n width,\n FONT_SIZE_PX\n );\n }\n this.isBlinkOff = !this.isBlinkOff;\n this.textTexture.needsUpdate = true;\n }\n}\n","import * as THREE from \"three\";\nconst MESH_SIZE = 0.5;\nconst WIDTH = 1024;\nconst HEIGHT = 512;\nconst ASPECT = HEIGHT / WIDTH;\nexport default class Monitor {\n constructor(domMonitor) {\n this._domMonitor = domMonitor;\n\n this._canvas = document.createElement(\"canvas\");\n this._canvas.width = WIDTH;\n this._canvas.height = HEIGHT;\n this.context = this._canvas.getContext(\"2d\");\n\n this._monitorTexture = new THREE.Texture(this._canvas);\n this._monitorTexture.needsUpdate = true;\n\n const monitorMaterial = new THREE.MeshBasicMaterial({\n map: this._monitorTexture,\n side: THREE.DoubleSide,\n transparent: true,\n opacity: 0.8\n });\n\n this.object = new THREE.Mesh(new THREE.PlaneBufferGeometry(MESH_SIZE, MESH_SIZE * ASPECT, 1, 1), monitorMaterial);\n this.object.visible = false;\n this.object.position.set(0, -0.2, -0.5);\n this.object.rotation.set(-Math.PI / 4, 0, 0);\n }\n\n toggle() {\n this.object.visible = !this.object.visible;\n }\n\n update() {\n if (!this._domMonitor) return;\n this.context.drawImage(this._domMonitor, 0, 0, WIDTH, HEIGHT);\n this._monitorTexture.needsUpdate = true;\n }\n}\n","import * as THREE from \"three\";\nimport { VRButton } from \"three/examples/jsm/webxr/VRButton\";\n\nimport TextArea from \"./TextArea\";\nimport Monitor from \"./Monitor\";\n\nexport default class RiftSandbox {\n constructor(width, height, domMonitor) {\n this._width = width;\n this._height = height;\n this._textAreas = null;\n this.areTextAreasVisible = true;\n this._domMonitor = domMonitor;\n\n this.scene = null;\n this._sceneStuff = [];\n this.renderer = null;\n\n this._initWebGL();\n this._initScene();\n\n this.resize = this.resize.bind(this);\n }\n\n _initScene() {\n this.scene = new THREE.Scene();\n this.scene.fog = new THREE.FogExp2(\"lightgrey\", 0.03);\n\n this._camera = new THREE.PerspectiveCamera(75, this._width / this._height, 0.1, 200);\n this._camera.position.y = 1.6;\n\n const dolly = new THREE.Group();\n dolly.position.z = 2;\n dolly.add(this._camera);\n this.scene.add(dolly);\n\n const maxAnisotropy = this.renderer.capabilities.getMaxAnisotropy();\n const groundTexture = new THREE.TextureLoader().load(\"img/ground.png\");\n\n groundTexture.anisotropy = maxAnisotropy;\n groundTexture.wrapS = groundTexture.wrapT = THREE.RepeatWrapping;\n groundTexture.repeat.set(200, 200);\n\n const ground = new THREE.Mesh(\n new THREE.PlaneBufferGeometry(200, 200),\n new THREE.MeshStandardMaterial({ map: groundTexture, roughness: 1, metalness: 0 })\n );\n ground.rotation.x = -Math.PI / 2;\n ground.receiveShadow = true;\n this.scene.add(ground);\n\n this._monitor = new Monitor(this._domMonitor);\n this._camera.add(this._monitor.object);\n }\n\n setTextAreas(domTextAreas, hasCamera) {\n this.domTextAreas = domTextAreas;\n this._textAreas = this.domTextAreas.map(domTextArea => {\n const textArea = new TextArea(domTextArea, hasCamera);\n this.scene.add(textArea.object);\n return textArea;\n });\n\n this._resetTextAreas();\n }\n\n _resetTextAreas() {\n this._textAreas.forEach(function(textArea, i) {\n textArea.object.rotateOnAxis(new THREE.Vector3(0, 1, 0), (Math.PI / 4) * -(i + 1));\n textArea.object.translateZ(-1.5);\n });\n }\n\n interceptScene() {\n const oldAdd = this.scene.add;\n this.scene.add = obj => {\n this._sceneStuff.push(obj);\n oldAdd.call(this.scene, obj);\n };\n }\n\n toggleTextAreas() {\n this.areTextAreasVisible = !this.areTextAreasVisible;\n this._textAreas.forEach(textArea => {\n textArea.toggle(this.areTextAreasVisible);\n });\n }\n\n toggleMonitor() {\n this._monitor.toggle();\n }\n\n setInfo(msg) {\n this._textAreas.forEach(function(textArea) {\n textArea.setInfo(msg);\n });\n }\n\n _initWebGL() {\n try {\n this.renderer = new THREE.WebGLRenderer({\n antialias: true,\n canvas: document.getElementById(\"viewer\")\n });\n this.renderer.setPixelRatio(devicePixelRatio);\n this.renderer.vr.enabled = true;\n this.renderer.shadowMap.enabled = true;\n this.renderer.shadowMap.type = THREE.PCFSoftShadowMap;\n const button = VRButton.createButton(this.renderer);\n button.style.backgroundColor = \"black\";\n document.body.append(button);\n } catch (e) {\n alert(\"This application needs WebGL enabled!\");\n return false;\n }\n\n this.renderer.setClearColor(0xd3d3d3, 1.0);\n this.renderer.setSize(this._width, this._height);\n\n this.container = document.getElementById(\"container\");\n }\n\n clearScene() {\n for (let i = 0; i < this._sceneStuff.length; i++) {\n this.scene.remove(this._sceneStuff[i]);\n }\n this._sceneStuff = [];\n }\n\n render() {\n if (this._textAreas) {\n this._textAreas.forEach(function(textArea) {\n textArea.update();\n });\n }\n this._monitor.update();\n\n this.renderer.render(this.scene, this._camera);\n }\n\n resize() {\n this._width = window.innerWidth;\n this._height = window.innerHeight;\n this._camera.aspect = this._width / this._height;\n this._camera.updateProjectionMatrix();\n this.renderer.setSize(this._width, this._height);\n }\n\n resetSensor() {\n // TODO Is this still valid with WebXR?\n }\n\n startVrMode() {\n // TODO Enter VR\n }\n}\n","import { Math } from \"three\";\n\nexport default class File {\n constructor(name, contents, uuid) {\n this.uuid = uuid || Math.generateUUID();\n this.name = name || \"Example\";\n this.contents = contents;\n }\n _findNumberAt(index) {\n const match = this.contents.substring(index).match(/-?\\d+\\.?\\d*/);\n if (match) {\n return match[0];\n }\n }\n _spinNumber(number, direction, amount) {\n if (number.indexOf(\".\") === -1) {\n return (parseInt(number, 10) + direction * amount).toString();\n } else {\n return (parseFloat(number) + direction * amount).toFixed(2);\n }\n }\n spinNumberAt(index, direction, amount) {\n const number = this._findNumberAt(index);\n if (number === undefined) {\n return;\n }\n const newNumber = this._spinNumber(number, direction, amount);\n this.contents = this.contents.substring(0, index) + newNumber + this.contents.substring(index + number.length);\n }\n}\n","import { Math } from \"three\";\n\nimport File from \"./File\";\n\nexport default class Sketch {\n constructor(name, files, uuid) {\n this.uuid = uuid || Math.generateUUID();\n this.name = name || \"Example Sketch\";\n this.files = files || [new File()];\n this.initialized = false;\n this.state = {};\n }\n getCode() {\n let code = \"\";\n for (let i = 0; i < this.files.length; i++) {\n code += this.files[i].contents;\n }\n return code;\n }\n initialState(obj) {\n if (this.initialized) return;\n for (const key in obj) {\n if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;\n this.state[key] = obj[key];\n }\n }\n toJSON() {\n return {\n uuid: this.uuid,\n name: this.name,\n files: this.files\n };\n }\n static fromJSON(obj) {\n return new Sketch(\n obj.name,\n obj.files.map(file => new File(file.name, file.contents, file.uuid)),\n obj.uuid\n );\n }\n}\n","export default \"const t3 = THREE;\\n\\nconst sky = \\\"lightblue\\\";\\nrenderer.setClearColor(sky);\\nscene.fog.color.setStyle(sky);\\n\\nconst light = new t3.DirectionalLight();\\nlight.castShadow = true;\\nlight.position.set(7, 5.0, 4.0);\\nlight.shadow.mapSize.setScalar(2048);\\nscene.add(light);\\n\\nscene.add(\\n new THREE.AmbientLight(\\\"white\\\", 0.5)\\n);\\n\\nfunction makeCube(x, y, z) {\\n const cube = new t3.Mesh(\\n new t3.BoxGeometry(1.0, 0.2, 1.0),\\n new t3.MeshStandardMaterial({\\n color: \\\"green\\\",\\n roughness: 0.5,\\n metalness: 0.6\\n })\\n );\\n cube.castShadow = true;\\n cube.receiveShadow = true;\\n cube.position.set(x, y, z);\\n return cube;\\n}\\n\\nconst star = new t3.Mesh(\\n new t3.OctahedronGeometry(1, 0),\\n new t3.MeshStandardMaterial({\\n color: \\\"gold\\\",\\n roughness: 0.5,\\n metalness: 0.6\\n })\\n);\\nstar.castShadow = true;\\nstar.scale.setScalar(0.2);\\nstar.position.set(-1.0, 3.4, -1.0);\\nscene.add(star);\\n\\nconst numCubes = 16;\\nconst cubes = [];\\nfor (let i = 0; i < numCubes; i++) {\\n const cube = makeCube(-1, i / 5, -1);\\n cube.scale.setScalar(\\n (1 / (i + 4)) * 6\\n );\\n cube.scale.y = 1;\\n cube.material.color.setStyle(\\n i % 2 === 0 ? \\\"red\\\" : \\\"darkgreen\\\"\\n );\\n scene.add(cube);\\n cubes.push(cube);\\n}\\n\\nsketch.initialState({ t: 0 });\\nsketch.loop = () => {\\n const { state } = sketch;\\n for (let i = 0; i < numCubes; i++) {\\n const cube = cubes[i];\\n cube.rotation.y =\\n (state.t * i) / numCubes;\\n }\\n star.rotation.y = state.t;\\n state.t += 0.02;\\n};\\n\";","import SketchController from \"./SketchController\";\nimport github from \"raw-loader!@fortawesome/fontawesome-free/svgs/brands/github.svg\";\n\ndocument.getElementById(\"github\").innerHTML = github;\nnew SketchController();\n","import * as THREE from \"three\";\nimport WebFont from \"webfontloader\";\n\nimport KeyboardHandler from \"./KeyboardHandler\";\nimport RiftSandbox from \"./RiftSandbox\";\nimport File from \"./File\";\nimport Sketch from \"./Sketch\";\n\nimport Cube from \"raw-loader!./Files/Cube.js\";\n\nexport default class SketchController {\n constructor() {\n //this._setupVideoPassthrough();\n\n this._keyboardHandler = new KeyboardHandler(this);\n\n this._sketchLoop = function() {};\n\n WebFont.load({\n google: { families: [\"Ubuntu Mono\"] },\n active: () => {\n if (document.readyState === \"loading\") {\n document.addEventListener(\"DOMContentLoaded\", () => this._init());\n } else {\n this._init();\n document.getElementById(\"loading\").style.display = \"none\";\n }\n }\n });\n\n this._setupDomTextArea = this._setupDomTextArea.bind(this);\n this._mainLoop = this._mainLoop.bind(this);\n this._focusCurrentTextArea = this._focusCurrentTextArea.bind(this);\n }\n\n _setupVideoPassthrough() {\n this._domMonitor = document.getElementById(\"monitor\");\n if (navigator.mediaDevices) {\n navigator.mediaDevices\n .getUserMedia({ video: true })\n .then(stream => {\n this._domMonitor.srcObject = stream;\n })\n .catch(e => {\n console.info(\"Could not get video passthrough\", e);\n });\n }\n }\n\n _initializeSketch() {\n const storedSketches = localStorage.getItem(\"sketches_v1\");\n if (storedSketches) {\n this._sketch = Sketch.fromJSON(JSON.parse(storedSketches)[0]);\n } else {\n this._sketch = new Sketch(\"\", [new File(\"Cube\", Cube)]);\n }\n this._domTextAreas = this._sketch.files.map(this._setupDomTextArea);\n this._currentDomTextArea = this._domTextAreas[0];\n this._currentDomTextArea.focus();\n this._riftSandbox.setTextAreas(this._domTextAreas);\n this._riftSandbox.interceptScene();\n }\n\n _setupDomTextArea(file) {\n const domTextArea = document.createElement(\"textarea\");\n domTextArea.id = file.name;\n domTextArea.addEventListener(\"keyup\", e => {\n const contents = e.target.value;\n if (contents === file.contents) {\n return;\n }\n file.contents = contents;\n this._readCode();\n });\n domTextArea.addEventListener(\"keydown\", e => {\n e.stopPropagation();\n });\n document.body.append(domTextArea);\n this._keyboardHandler.bindKeyboardShortcuts(domTextArea, file);\n return domTextArea;\n }\n\n _mainLoop() {\n try {\n this._sketchLoop();\n } catch (err) {\n console.log(\"Sketch Error\", err);\n this._riftSandbox.setInfo(err.toString());\n }\n\n this._riftSandbox.render();\n }\n\n _readCode() {\n localStorage.setItem(\"sketches_v1\", JSON.stringify([this._sketch.toJSON()]));\n this._domTextAreas.forEach((domTextArea, i) => {\n domTextArea.value = this._sketch.files[i].contents;\n });\n\n this._riftSandbox.clearScene();\n let _sketchLoop;\n this._riftSandbox.setInfo(\"\");\n try {\n const _sketchFunc = new Function(\n \"THREE\",\n \"scene\",\n \"camera\",\n \"sketch\",\n \"renderer\",\n '\"use strict\";\\n' + this._sketch.getCode()\n );\n _sketchFunc(\n THREE,\n this._riftSandbox.scene,\n this._riftSandbox.cameraPivot,\n this._sketch,\n this._riftSandbox.renderer\n );\n _sketchLoop = this._sketch.loop;\n } catch (err) {\n console.log(\"Sketch Error\", err);\n this._riftSandbox.setInfo(err.toString());\n }\n if (_sketchLoop) {\n this._sketchLoop = _sketchLoop;\n }\n\n this._sketch.initialized = true;\n }\n\n spinNumberAndKeepSelection(domTextArea, file, direction, amount) {\n const start = domTextArea.selectionStart;\n file.spinNumberAt(start, direction, amount);\n this._readCode();\n domTextArea.selectionStart = domTextArea.selectionEnd = start;\n }\n\n resetSensor() {\n this._riftSandbox.resetSensor();\n }\n\n startVrMode() {\n this._riftSandbox.startVrMode();\n }\n\n _initializeUnsupportedModal() {\n // TODO Determine VR support\n const supportsVR = false;\n if (!supportsVR && !localStorage.getItem(\"alreadyIgnoredUnsupported\")) {\n // TODO Unsupported UI\n }\n }\n\n _init() {\n this._riftSandbox = new RiftSandbox(window.innerWidth, window.innerHeight, this._domMonitor);\n this._initializeSketch();\n this._readCode();\n this._keyboardHandler.riftSandbox = this._riftSandbox;\n this._keyboardHandler.bindKeyboardShortcuts(document);\n\n // TODO Focus on VR entry or fullscreen\n document.body.addEventListener(\"click\", this._focusCurrentTextArea);\n\n this._initializeUnsupportedModal();\n\n window.addEventListener(\"resize\", this._riftSandbox.resize, false);\n\n this._riftSandbox.resize();\n\n this._riftSandbox.renderer.setAnimationLoop(this._mainLoop);\n\n if (location.search.indexOf(\"vr=on\") !== -1) {\n this.startVrMode();\n }\n }\n\n toggleTextAreas() {\n if (this._riftSandbox.areTextAreasVisible) {\n this._currentDomTextArea.blur();\n } else {\n this._focusCurrentTextArea();\n }\n this._riftSandbox.toggleTextAreas();\n }\n\n _focusCurrentTextArea() {\n this._currentDomTextArea.focus();\n }\n\n getCurrentSelectionStart() {\n return this._currentDomTextArea.selectionStart;\n }\n}\n"],"sourceRoot":""}