Fail when using global THREE in linting and fix outstanding THREE issues

This commit is contained in:
Jordan Santell 2017-10-06 16:03:53 -07:00 committed by Jordan Santell
parent 8796ff6050
commit 77e9f02007
5 changed files with 6 additions and 6 deletions

View File

@ -11,7 +11,7 @@
"es6": true
},
"globals": {
"THREE": false,
"global": false,
"VRFrameData": false
},
"parserOptions": {

View File

@ -21,6 +21,7 @@ import {
Geometry,
Vector3,
Face3,
Mesh,
} from 'three';
import { getRandomPaletteColor } from './ARUtils';
@ -159,7 +160,7 @@ class ARPlanes extends Object3D {
this.materialMap.set(id, material);
}
const plane = new THREE.Mesh(geo, material);
const plane = new Mesh(geo, material);
planeObj.add(plane);
}

View File

@ -93,7 +93,7 @@ export const getARDisplay = ARUtils.getARDisplay;
* @return {THREE.Mesh}
*/
ARUtils.loadBlocksModel = (objPath, mtlPath) => new Promise((resolve, reject) => {
if (!THREE.OBJLoader || !THREE.MTLLoader) {
if (!global.THREE || !global.THREE.OBJLoader || !global.THREE.MTLLoader) {
reject(new Error('Must include THREE.OBJLoader and THREE.MTLLoader'));
return;
}

View File

@ -14,7 +14,6 @@
*/
/* eslint no-unused-vars: "off" */
/* eslint no-undef: "off" */
import ARDebug from './ARDebug';
import ARPerspectiveCamera from './ARPerspectiveCamera';
import ARReticle from './ARReticle';

View File

@ -21,7 +21,7 @@
const noop = function() {};
export const loadObj = (objPath, materials) => new Promise((resolve, reject) => {
const loader = new THREE.OBJLoader();
const loader = new global.THREE.OBJLoader();
if (materials) {
loader.setMaterials(materials);
@ -31,7 +31,7 @@ export const loadObj = (objPath, materials) => new Promise((resolve, reject) =>
});
export const loadMtl = mtlPath => new Promise((resolve, reject) => {
const loader = new THREE.MTLLoader();
const loader = new global.THREE.MTLLoader();
const pathChunks = mtlPath.split('/');
if (pathChunks.length >= 2) {