diff --git a/index.html b/index.html index 7a47c98be..5bf7cae15 100644 --- a/index.html +++ b/index.html @@ -14,7 +14,7 @@ - + diff --git a/package.json b/package.json index 6a89e5c8f..938b62cbb 100644 --- a/package.json +++ b/package.json @@ -2,37 +2,18 @@ "private": true, "version": "1.0.0", "scripts": { - "build": "cross-env NODE_ENV=production webpack", - "deploy": "npm run predeploy && ghpages git@github.com:supermedium/moonrider.git -p .ghpages && rm -rf .ghpages", + "build": "cross-env NODE_ENV=production NODE_OPTIONS=--openssl-legacy-provider webpack", + "deploy": "yarn run predeploy && ghpages git@github.com:Maxmystere/moonrider.git -p .ghpages && shx rm -rf .ghpages", "lint": "semistandard -v | snazzy", "lint:fix": "semistandard --fix", - "predeploy": "cross-env NODE_ENV=production npm run build && shx mkdir -p .ghpages && cp -r index.html assets build vendor CNAME .ghpages", - "start": "webpack-dev-server --host 0.0.0.0 --progress --colors --hot-only --inline --port 3000" + "predeploy": "cross-env NODE_ENV=production yarn run build && shx mkdir -p .ghpages && shx cp -r index.html assets build vendor CNAME .ghpages", + "start": "cross-env NODE_OPTIONS=--openssl-legacy-provider webpack serve --host 0.0.0.0 --progress --color --hot-only --inline --port 3000" }, "dependencies": { - "@babel/cli": "^7.17.0", "@babel/core": "^7.17.2", - "@babel/plugin-proposal-class-properties": "^7.16.7", - "@babel/plugin-proposal-decorators": "^7.17.2", - "@babel/plugin-proposal-do-expressions": "^7.16.7", - "@babel/plugin-proposal-export-default-from": "^7.16.7", - "@babel/plugin-proposal-export-namespace-from": "^7.16.7", - "@babel/plugin-proposal-function-bind": "^7.16.7", - "@babel/plugin-proposal-function-sent": "^7.16.7", - "@babel/plugin-proposal-json-strings": "^7.16.7", - "@babel/plugin-proposal-logical-assignment-operators": "^7.16.7", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7", - "@babel/plugin-proposal-numeric-separator": "^7.16.7", - "@babel/plugin-proposal-optional-chaining": "^7.16.7", - "@babel/plugin-proposal-pipeline-operator": "^7.16.7", - "@babel/plugin-proposal-throw-expressions": "^7.16.7", - "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-syntax-import-meta": "^7.10.4", - "@babel/preset-env": "^7.16.11", "aframe-aabb-collider-component": "^3.1.0", - "aframe-atlas-uvs-component": "^2.1.0", + "aframe-atlas-uvs-component": "^3.0.0", "aframe-audioanalyser-component": "^6.0.0", - "aframe-event-decorators": "^1.0.2", "aframe-event-set-component": "^4.2.1", "aframe-geometry-merger-component": "^2.0.0-beta1", "aframe-haptics-component": "^1.6.3", @@ -40,52 +21,34 @@ "aframe-log-component": "^1.0.7", "aframe-orbit-controls": "^1.2.0", "aframe-proxy-event-component": "^2.1.0", - "aframe-render-order-component": "^1.1.0", "aframe-slice9-component": "^1.0.0", "aframe-state-component": "6.7.0", - "aframe-super-hot-html-loader": "^1.2.0", "aframe-super-hot-loader": "^1.5.0", "aframe-thumb-controls-component": "^2.0.2", - "ansi-html": "0.0.7", - "autoprefixer": "^7.2.3", "babel-loader": "^8.0.5", - "babel-preset-minify": "^0.5.0", "css-loader": "^0.28.7", - "debug": "^4.1.0", "firebase": "^7.19.0", "html-require-loader": "^1.0.1", "ip": "1.1.5", "json-loader": "^0.5.7", "lodash.debounce": "^4.0.8", "profane-words": "^1.3.1", - "promise-polyfill": "^8.1.0", "style-loader": "^0.23.1", "super-nunjucks-loader": "^2.0.0", - "uglify-es": "git://github.com/mishoo/UglifyJS2.git#harmony", - "uglify-js": "git://github.com/mishoo/UglifyJS2#harmony", - "uglifyjs-webpack-plugin": "0.4.6", "url-loader": "^1.1.2", "webpack": "^4.46.0", + "webpack-cli": "^4.10.0", "webpack-glsl-loader": "^1.0.1", "webpack-sources": "1.0.1", - "zip-loader": "github:ngokevin/ziploader#xhrdist", "unzip-js": "^1.0.0" }, - "overrides": { - "aframe-render-order-component": { - "webpack": "~4.46.0" - }, - "uglifyjs-webpack-plugin": { - "webpack": "~4.46.0" - } - }, "devDependencies": { + "aframe-super-hot-html-loader": "^1.2.0", "cross-env": "4.0.0", "ghpages": "0.0.10", "semistandard": "10.0.0", "shx": "^0.2.2", "snazzy": "7.0.0", - "superagent": "^3.8.2", "webpack-dev-server": "^3.2.0" }, "semistandard": { diff --git a/src/components/beat-cut-fx.js b/src/components/beat-cut-fx.js index 2d15c2f53..8da82b3ad 100644 --- a/src/components/beat-cut-fx.js +++ b/src/components/beat-cut-fx.js @@ -107,7 +107,7 @@ AFRAME.registerComponent('beat-cut-fx', { for (let i = 0; i < this.pieces.length; i++) { let piece = this.pieces[i]; piece.posVelocity.copy(AUX_VECTOR); - piece.rotation.z = THREE.Math.degToRad(ROTATIONS[beatDirection]); + piece.rotation.z = THREE.MathUtils.degToRad(ROTATIONS[beatDirection]); if (correctHit) { // Dir is a hardcoded value, based on the position of meshes in .OBJ files. let dir = i % 2 == 0 ? -0.001 : 0.001; diff --git a/src/components/beat-generator.js b/src/components/beat-generator.js index dc15f72ea..11efc6a46 100644 --- a/src/components/beat-generator.js +++ b/src/components/beat-generator.js @@ -306,11 +306,11 @@ AFRAME.registerComponent('beat-generator', { if (data.gameMode === 'ride') { beatEl.components.plume.onGenerate(songPosition, horizontalPosition, verticalPosition, this.playerHeight.beatOffset); - beatEl.setAttribute('render-order', renderOrder); + beatEl.setAttribute('render-order', renderOrder); } else { beatEl.components.beat.onGenerate(songPosition, horizontalPosition, verticalPosition, cutDirection, this.playerHeight.beatOffset); - beatEl.components.beat.blockEl.object3D.renderOrder = renderOrder; + beatEl.components.beat.blockEl.object3D.renderOrder = renderOrder; } beatEl.play(); }, diff --git a/src/components/beat.js b/src/components/beat.js index 557b3cdb7..8c5e6cdab 100644 --- a/src/components/beat.js +++ b/src/components/beat.js @@ -397,7 +397,7 @@ AFRAME.registerComponent('beat', { el.object3D.position.x += this.beatSystem.horizontalPositions[horizontalPosition]; if (data.type !== DOT) { - el.object3D.rotation.z = THREE.Math.degToRad(ROTATIONS[cutDirection]); + el.object3D.rotation.z = THREE.MathUtils.degToRad(ROTATIONS[cutDirection]); } // Set up rotation warmup. diff --git a/src/components/raycaster-target.js b/src/components/raycaster-target.js index 1d1afb1da..6c0f17840 100644 --- a/src/components/raycaster-target.js +++ b/src/components/raycaster-target.js @@ -48,9 +48,9 @@ AFRAME.registerComponent('raycaster-target', { raycastTarget.object3D.visible = false; raycastTarget.object3D.position.copy(data.position); - raycastTarget.object3D.rotation.x = THREE.Math.degToRad(data.rotation.x); - raycastTarget.object3D.rotation.y = THREE.Math.degToRad(data.rotation.y); - raycastTarget.object3D.rotation.z = THREE.Math.degToRad(data.rotation.z); + raycastTarget.object3D.rotation.x = THREE.MathUtils.degToRad(data.rotation.x); + raycastTarget.object3D.rotation.y = THREE.MathUtils.degToRad(data.rotation.y); + raycastTarget.object3D.rotation.z = THREE.MathUtils.degToRad(data.rotation.z); el.appendChild(raycastTarget); }; diff --git a/src/components/tail.js b/src/components/tail.js index 3e5d95c93..5d8e02934 100644 --- a/src/components/tail.js +++ b/src/components/tail.js @@ -12,7 +12,7 @@ AFRAME.registerComponent('tail', { init: function () { const data = this.data; - const geometry = this.geometry = new THREE.PlaneBufferGeometry( + const geometry = this.geometry = new THREE.PlaneGeometry( data.width, data.height, data.segments, 1); geometry.deleteAttribute('normal'); geometry.translate(data.width / 2, 0, 0); diff --git a/src/components/text-geometry.js b/src/components/text-geometry.js deleted file mode 100644 index c7a7cd22a..000000000 --- a/src/components/text-geometry.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * TextGeometry component for A-Frame. - */ -var debug = AFRAME.utils.debug; - -var error = debug('aframe-text-component:error'); - -var fontLoader = new THREE.FontLoader(); - -AFRAME.registerComponent('text-geometry', { - schema: { - bevelEnabled: {default: false}, - bevelSize: {default: 8, min: 0}, - bevelThickness: {default: 12, min: 0}, - curveSegments: {default: 12, min: 0}, - font: {type: 'asset', default: 'https://rawgit.com/ngokevin/kframe/master/components/text-geometry/lib/helvetiker_regular.typeface.json'}, - height: {default: 0.05, min: 0}, - size: {default: 0.5, min: 0}, - style: {default: 'normal', oneOf: ['normal', 'italics']}, - weight: {default: 'normal', oneOf: ['normal', 'bold']}, - value: {default: ''} - }, - - /** - * Called when component is attached and when component data changes. - * Generally modifies the entity based on the data. - */ - update: function (oldData) { - const data = this.data; - const el = this.el; - - if (!data.value) { return; } - - let mesh = el.getObject3D('mesh'); - if (!mesh) { - mesh = new THREE.Mesh(); - el.setObject3D('mesh', mesh); - } - - if (data.font.constructor === String) { - // Load typeface.json font. - fontLoader.load(data.font, function (response) { - const textData = AFRAME.utils.clone(data); - textData.font = response; - mesh.geometry = new THREE.TextGeometry(data.value, textData); - mesh.geometry.translate(-0.18, 0, -0.07); - }); - } else if (data.font.constructor === Object) { - // Set font if already have a typeface.json through setAttribute. - mesh.geometry = new THREE.TextGeometry(data.value, data); - mesh.geometry.translate(-0.18, 0, -0.07); - } else { - error('Must provide `font` (typeface.json) or `fontPath` (string) to text component.'); - } - } -}); diff --git a/src/index.js b/src/index.js index 994fc83fa..a3494483c 100644 --- a/src/index.js +++ b/src/index.js @@ -6,6 +6,7 @@ console.timeEnd = () => { }; require('../vendor/BufferGeometryUtils'); +require('../vendor/aframe-text-geometry-component.min'); require('aframe-aabb-collider-component'); require('aframe-atlas-uvs-component'); @@ -21,7 +22,7 @@ if (process.env.DEBUG_LOG) { } require('aframe-orbit-controls'); require('aframe-proxy-event-component'); -require('aframe-render-order-component'); +require('../vendor/aframe-render-order-component.min'); require('aframe-state-component'); require('aframe-slice9-component'); require('aframe-thumb-controls-component'); diff --git a/vendor/Curve.js b/vendor/Curve.js index 34e48d055..3ac1d16b0 100644 --- a/vendor/Curve.js +++ b/vendor/Curve.js @@ -1,6 +1,6 @@ // Modified to allow optional targets for GC. // TODO: Upstream. -const _Math = THREE.Math; +const _Math = THREE.MathUtils; const Vector3 = THREE.Vector3; const Matrix4 = THREE.Matrix4; diff --git a/vendor/aframe-master.js b/vendor/aframe-master.js deleted file mode 100644 index 584101ba0..000000000 --- a/vendor/aframe-master.js +++ /dev/null @@ -1,81482 +0,0 @@ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.AFRAME = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i 0) { - throw new Error('Invalid string. Length must be a multiple of 4') - } - - // Trim off extra bytes after placeholder bytes are found - // See: https://github.com/beatgammit/base64-js/issues/42 - var validLen = b64.indexOf('=') - if (validLen === -1) validLen = len - - var placeHoldersLen = validLen === len - ? 0 - : 4 - (validLen % 4) - - return [validLen, placeHoldersLen] -} - -// base64 is 4/3 + up to two characters of the original data -function byteLength (b64) { - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} - -function _byteLength (b64, validLen, placeHoldersLen) { - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} - -function toByteArray (b64) { - var tmp - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - - var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) - - var curByte = 0 - - // if there are placeholders, only get up to the last complete 4 chars - var len = placeHoldersLen > 0 - ? validLen - 4 - : validLen - - for (var i = 0; i < len; i += 4) { - tmp = - (revLookup[b64.charCodeAt(i)] << 18) | - (revLookup[b64.charCodeAt(i + 1)] << 12) | - (revLookup[b64.charCodeAt(i + 2)] << 6) | - revLookup[b64.charCodeAt(i + 3)] - arr[curByte++] = (tmp >> 16) & 0xFF - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF - } - - if (placeHoldersLen === 2) { - tmp = - (revLookup[b64.charCodeAt(i)] << 2) | - (revLookup[b64.charCodeAt(i + 1)] >> 4) - arr[curByte++] = tmp & 0xFF - } - - if (placeHoldersLen === 1) { - tmp = - (revLookup[b64.charCodeAt(i)] << 10) | - (revLookup[b64.charCodeAt(i + 1)] << 4) | - (revLookup[b64.charCodeAt(i + 2)] >> 2) - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF - } - - return arr -} - -function tripletToBase64 (num) { - return lookup[num >> 18 & 0x3F] + - lookup[num >> 12 & 0x3F] + - lookup[num >> 6 & 0x3F] + - lookup[num & 0x3F] -} - -function encodeChunk (uint8, start, end) { - var tmp - var output = [] - for (var i = start; i < end; i += 3) { - tmp = - ((uint8[i] << 16) & 0xFF0000) + - ((uint8[i + 1] << 8) & 0xFF00) + - (uint8[i + 2] & 0xFF) - output.push(tripletToBase64(tmp)) - } - return output.join('') -} - -function fromByteArray (uint8) { - var tmp - var len = uint8.length - var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes - var parts = [] - var maxChunkLength = 16383 // must be multiple of 3 - - // go through the array every three bytes, we'll deal with trailing stuff later - for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { - parts.push(encodeChunk( - uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength) - )) - } - - // pad the end with zeros, but make sure to not forget the extra bytes - if (extraBytes === 1) { - tmp = uint8[len - 1] - parts.push( - lookup[tmp >> 2] + - lookup[(tmp << 4) & 0x3F] + - '==' - ) - } else if (extraBytes === 2) { - tmp = (uint8[len - 2] << 8) + uint8[len - 1] - parts.push( - lookup[tmp >> 10] + - lookup[(tmp >> 4) & 0x3F] + - lookup[(tmp << 2) & 0x3F] + - '=' - ) - } - - return parts.join('') -} - -},{}],4:[function(_dereq_,module,exports){ -'use strict'; -// For more information about browser field, check out the browser field at https://github.com/substack/browserify-handbook#browser-field. - -module.exports = { - // Create a tag with optional data attributes - createLink: function(href, attributes) { - var head = document.head || document.getElementsByTagName('head')[0]; - var link = document.createElement('link'); - - link.href = href; - link.rel = 'stylesheet'; - - for (var key in attributes) { - if ( ! attributes.hasOwnProperty(key)) { - continue; - } - var value = attributes[key]; - link.setAttribute('data-' + key, value); - } - - head.appendChild(link); - }, - // Create a