mirror of
https://github.com/google-ar/three.ar.js.git
synced 2026-01-18 13:56:33 +00:00
Fail when using global THREE in linting and fix outstanding THREE issues
This commit is contained in:
parent
8796ff6050
commit
77e9f02007
@ -11,7 +11,7 @@
|
||||
"es6": true
|
||||
},
|
||||
"globals": {
|
||||
"THREE": false,
|
||||
"global": false,
|
||||
"VRFrameData": false
|
||||
},
|
||||
"parserOptions": {
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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';
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user