我的目标是将MapControls添加到我的应用程序中,例如以下示例: https://github.com/felixpalmer/amd-three.js
此示例可与TrackballControlls配合使用。但是MapControls需要定义THREE.MOUSE。因此,我将three.min.js的版本更新为当前版本,现在没有任何效果。我收到这些错误:
ReferenceError:未定义三个TrackballControls.js:5:1
ReferenceError:未定义三个MapControls.js:18:1
TypeError:THREE.MapControls不是构造函数
config.js
// Configure Require.js
var require = {
// Default load path for js files
baseUrl: 'js/app',
shim: {
// --- Use shim to mix together all THREE.js subcomponents
'threeCore': { exports: 'THREE' },
'TrackballControls': { deps: ['threeCore'], exports: 'THREE' },
'MapControls': { deps: ['threeCore'], exports: 'THREE' },
// --- end THREE sub-components
'detector': { exports: 'Detector' },
'stats': { exports: 'Stats' }
},
// Third party code lives in js/lib
paths: {
// --- start THREE sub-components
three: '../lib/three',
threeCore: '../lib/three.min',
TrackballControls: '../lib/controls/TrackballControls',
MapControls: '../lib/controls/MapControls',
// --- end THREE sub-components
detector: '../lib/Detector',
stats: '../lib/stats.min',
// Require.js plugins
text: '../lib/text',
shader: '../lib/shader',
// Where to look for shader files
shaders: '../shaders'
}
};
three.js
// As THREE.js comes with many addons/plugins mix them all into one three object here
define( ["threeCore", "TrackballControls", "MapControls"], function( threeCore ) {
return threeCore;
} );