Skip to content

Commit

Permalink
Fail when using global THREE in linting and fix outstanding THREE issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jsantell committed Oct 6, 2017
1 parent 8796ff6 commit 77e9f02
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"es6": true
},
"globals": {
"THREE": false,
"global": false,
"VRFrameData": false
},
"parserOptions": {
Expand Down
3 changes: 2 additions & 1 deletion src/ARPlanes.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
Geometry,
Vector3,
Face3,
Mesh,
} from 'three';

import { getRandomPaletteColor } from './ARUtils';
Expand Down Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/ARUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 0 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
4 changes: 2 additions & 2 deletions src/loaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) {
Expand Down

0 comments on commit 77e9f02

Please sign in to comment.