summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2019-01-27 17:27:14 +0100
committerJules Laplace <julescarbon@gmail.com>2019-01-27 17:27:14 +0100
commit3f16cb26e6a5e7858c9c3db10d02bec9c18b9511 (patch)
tree2f3b5533d4ff2ddb1138bf7793143635c46115bc
parentc9d476e421a50aa5e3e20389365263d5c36e5696 (diff)
remove dependencies from DRACO and MeshLine
-rw-r--r--client/splash/index.js2
-rw-r--r--client/splash/vendor/DRACOLoader.js59
-rw-r--r--client/splash/vendor/geometry_helper.js4
-rw-r--r--client/splash/vendor/three.meshline.js29
-rw-r--r--site/assets/css/applets.css2
-rw-r--r--site/assets/css/css.css1
-rw-r--r--site/assets/css/splash.css6
-rw-r--r--site/assets/demo/splash/index.html4
8 files changed, 52 insertions, 55 deletions
diff --git a/client/splash/index.js b/client/splash/index.js
index 988de9b4..de356862 100644
--- a/client/splash/index.js
+++ b/client/splash/index.js
@@ -1,2 +1,4 @@
import oktween from './vendor/oktween'
+import { MeshLine, MeshLineMaterial } from './vendor/three.meshline'
+
diff --git a/client/splash/vendor/DRACOLoader.js b/client/splash/vendor/DRACOLoader.js
index 03fecb6b..64e6d801 100644
--- a/client/splash/vendor/DRACOLoader.js
+++ b/client/splash/vendor/DRACOLoader.js
@@ -12,12 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
-'use strict';
+
+import * as THREE from 'three';
/**
* @param {THREE.LoadingManager} manager
*/
-THREE.DRACOLoader = function(manager) {
+DRACOLoader = function(manager) {
this.timeLoaded = 0;
this.manager = manager || THREE.DefaultLoadingManager;
this.materials = null;
@@ -33,9 +34,9 @@ THREE.DRACOLoader = function(manager) {
};
};
-THREE.DRACOLoader.prototype = {
+DRACOLoader.prototype = {
- constructor: THREE.DRACOLoader,
+ constructor: DRACOLoader,
load: function(url, onLoad, onProgress, onError) {
var scope = this;
@@ -103,7 +104,7 @@ THREE.DRACOLoader.prototype = {
decodeDracoFile: function(rawBuffer, callback, attributeUniqueIdMap,
attributeTypeMap) {
var scope = this;
- THREE.DRACOLoader.getDecoderModule()
+ DRACOLoader.getDecoderModule()
.then( function ( module ) {
scope.decodeDracoFileInternal( rawBuffer, module.decoder, callback,
attributeUniqueIdMap || {}, attributeTypeMap || {});
@@ -386,7 +387,7 @@ THREE.DRACOLoader.prototype = {
},
isVersionSupported: function(version, callback) {
- THREE.DRACOLoader.getDecoderModule()
+ DRACOLoader.getDecoderModule()
.then( function ( module ) {
callback( module.decoder.isVersionSupported( version ) );
});
@@ -399,16 +400,16 @@ THREE.DRACOLoader.prototype = {
}
};
-THREE.DRACOLoader.decoderPath = './';
-THREE.DRACOLoader.decoderConfig = {};
-THREE.DRACOLoader.decoderModulePromise = null;
+DRACOLoader.decoderPath = './';
+DRACOLoader.decoderConfig = {};
+DRACOLoader.decoderModulePromise = null;
/**
* Sets the base path for decoder source files.
* @param {string} path
*/
-THREE.DRACOLoader.setDecoderPath = function ( path ) {
- THREE.DRACOLoader.decoderPath = path;
+DRACOLoader.setDecoderPath = function ( path ) {
+ DRACOLoader.decoderPath = path;
};
/**
@@ -416,21 +417,21 @@ THREE.DRACOLoader.setDecoderPath = function ( path ) {
* will be recreated with the next decoding call.
* @param {Object} config
*/
-THREE.DRACOLoader.setDecoderConfig = function ( config ) {
- var wasmBinary = THREE.DRACOLoader.decoderConfig.wasmBinary;
- THREE.DRACOLoader.decoderConfig = config || {};
- THREE.DRACOLoader.releaseDecoderModule();
+DRACOLoader.setDecoderConfig = function ( config ) {
+ var wasmBinary = DRACOLoader.decoderConfig.wasmBinary;
+ DRACOLoader.decoderConfig = config || {};
+ DRACOLoader.releaseDecoderModule();
// Reuse WASM binary.
- if ( wasmBinary ) THREE.DRACOLoader.decoderConfig.wasmBinary = wasmBinary;
+ if ( wasmBinary ) DRACOLoader.decoderConfig.wasmBinary = wasmBinary;
};
/**
* Releases the singleton DracoDecoderModule instance. Module will be recreated
* with the next decoding call.
*/
-THREE.DRACOLoader.releaseDecoderModule = function () {
- THREE.DRACOLoader.decoderModulePromise = null;
+DRACOLoader.releaseDecoderModule = function () {
+ DRACOLoader.decoderModulePromise = null;
};
/**
@@ -439,11 +440,11 @@ THREE.DRACOLoader.releaseDecoderModule = function () {
* module is available.
* @return {Promise<{decoder: DracoDecoderModule}>}
*/
-THREE.DRACOLoader.getDecoderModule = function () {
+DRACOLoader.getDecoderModule = function () {
var scope = this;
- var path = THREE.DRACOLoader.decoderPath;
- var config = THREE.DRACOLoader.decoderConfig;
- var promise = THREE.DRACOLoader.decoderModulePromise;
+ var path = DRACOLoader.decoderPath;
+ var config = DRACOLoader.decoderConfig;
+ var promise = DRACOLoader.decoderModulePromise;
if ( promise ) return promise;
@@ -453,13 +454,13 @@ THREE.DRACOLoader.getDecoderModule = function () {
promise = Promise.resolve();
} else if ( typeof WebAssembly !== 'object' || config.type === 'js' ) {
// Load with asm.js.
- promise = THREE.DRACOLoader._loadScript( path + 'draco_decoder.js' );
+ promise = DRACOLoader._loadScript( path + 'draco_decoder.js' );
} else {
// Load with WebAssembly.
config.wasmBinaryFile = path + 'draco_decoder.wasm';
- promise = THREE.DRACOLoader._loadScript( path + 'draco_wasm_wrapper.js' )
+ promise = DRACOLoader._loadScript( path + 'draco_wasm_wrapper.js' )
.then( function () {
- return THREE.DRACOLoader._loadArrayBuffer( config.wasmBinaryFile );
+ return DRACOLoader._loadArrayBuffer( config.wasmBinaryFile );
} )
.then( function ( wasmBinary ) {
config.wasmBinary = wasmBinary;
@@ -478,7 +479,7 @@ THREE.DRACOLoader.getDecoderModule = function () {
} );
} );
- THREE.DRACOLoader.decoderModulePromise = promise;
+ DRACOLoader.decoderModulePromise = promise;
return promise;
};
@@ -486,7 +487,7 @@ THREE.DRACOLoader.getDecoderModule = function () {
* @param {string} src
* @return {Promise}
*/
-THREE.DRACOLoader._loadScript = function ( src ) {
+DRACOLoader._loadScript = function ( src ) {
var prevScript = document.getElementById( 'decoder_script' );
if ( prevScript !== null ) {
prevScript.parentNode.removeChild( prevScript );
@@ -506,10 +507,12 @@ THREE.DRACOLoader._loadScript = function ( src ) {
* @param {string} src
* @return {Promise}
*/
-THREE.DRACOLoader._loadArrayBuffer = function ( src ) {
+DRACOLoader._loadArrayBuffer = function ( src ) {
var loader = new THREE.FileLoader();
loader.setResponseType( 'arraybuffer' );
return new Promise( function( resolve, reject ) {
loader.load( src, resolve, undefined, reject );
});
};
+
+export default DRACOLoader
diff --git a/client/splash/vendor/geometry_helper.js b/client/splash/vendor/geometry_helper.js
index 095f7970..1ac88f3b 100644
--- a/client/splash/vendor/geometry_helper.js
+++ b/client/splash/vendor/geometry_helper.js
@@ -13,6 +13,8 @@
// limitations under the License.
//
+import * as THREE from 'three';
+
/**
* @fileoverview Helper class implementing various utilities for THREE.js
* geometry.
@@ -100,3 +102,5 @@ GeometryHelper.prototype = {
}
},
};
+
+export default GeometryHelper
diff --git a/client/splash/vendor/three.meshline.js b/client/splash/vendor/three.meshline.js
index c6e998e3..00096f58 100644
--- a/client/splash/vendor/three.meshline.js
+++ b/client/splash/vendor/three.meshline.js
@@ -1,14 +1,4 @@
-;(function() {
-
-"use strict";
-
-var root = this
-
-var has_require = typeof require !== 'undefined'
-
-var THREE = root.THREE || has_require && require('three')
-if( !THREE )
- throw new Error( 'MeshLine requires three.js' )
+import * as THREE from 'three';
function MeshLine() {
@@ -471,16 +461,7 @@ MeshLineMaterial.prototype.copy = function ( source ) {
};
-if( typeof exports !== 'undefined' ) {
- if( typeof module !== 'undefined' && module.exports ) {
- exports = module.exports = { MeshLine: MeshLine, MeshLineMaterial: MeshLineMaterial };
- }
- exports.MeshLine = MeshLine;
- exports.MeshLineMaterial = MeshLineMaterial;
-}
-else {
- root.MeshLine = MeshLine;
- root.MeshLineMaterial = MeshLineMaterial;
-}
-
-}).call(this); \ No newline at end of file
+export default {
+ MeshLine,
+ MeshLineMaterial,
+};
diff --git a/site/assets/css/applets.css b/site/assets/css/applets.css
index f437d1e8..aa9ce47f 100644
--- a/site/assets/css/applets.css
+++ b/site/assets/css/applets.css
@@ -1,3 +1,5 @@
+/* applets */
+
.applet_container {
min-height: 340px;
}
diff --git a/site/assets/css/css.css b/site/assets/css/css.css
index 50958427..e29f2595 100644
--- a/site/assets/css/css.css
+++ b/site/assets/css/css.css
@@ -467,6 +467,7 @@ section.fullwidth .image {
.content .dataset-intro .first_paragraph {
margin-top: 10px;
}
+
/* intro - list of datasets */
.dataset-list {
diff --git a/site/assets/css/splash.css b/site/assets/css/splash.css
index e60c7261..fbfc9b6f 100644
--- a/site/assets/css/splash.css
+++ b/site/assets/css/splash.css
@@ -7,13 +7,19 @@ html, body {
header {
position: absolute;
background: transparent;
+ box-shadow: none;
}
footer {
background: transparent;
position: absolute;
bottom: 0; left: 0;
}
+footer div {
+ z-index: 2;
+}
.splash {
+}
+#three_container {
position: absolute;
top: 0; left: 0;
width: 100%; height: 100%;
diff --git a/site/assets/demo/splash/index.html b/site/assets/demo/splash/index.html
index f2a4f94e..28063651 100644
--- a/site/assets/demo/splash/index.html
+++ b/site/assets/demo/splash/index.html
@@ -24,9 +24,7 @@
</div>
</header>
<div class="splash">
-
-
-
+ <div id="three_container"></div>
</div>
<footer>
<div>