Browse files

support for data-baseURL in <script>

  • Loading branch information...
1 parent 4d39f20 commit 0fca8340d666b959e2c78135a6c7065758a23271 @jeromeetienne committed Mar 5, 2013
View
1 Makefile
@@ -136,6 +136,7 @@ buildBundleRequire: buildBundle
cat build/tquery-bundle.js > build/tquery-bundle-require.js
cat plugins/requirejs/vendor/require.js >> build/tquery-bundle-require.js
cat plugins/requirejs/build/all.confrequire.js >> build/tquery-bundle-require.js
+ cat plugins/requirejs/footer.js >> build/tquery-bundle-require.js
minifyBundleRequire: buildBundleRequire
echo $(BANNER) > build/tquery-bundle-require.min.js
View
17 build/tquery-bundle-require.js
@@ -38532,7 +38532,7 @@ tQuery.World = function(opts)
// create a camera in the scene
if( !opts.camera ){
- this._camera = new THREE.PerspectiveCamera(90, opts.renderW / opts.renderH, 0.01, 10000 );
+ this._camera = new THREE.PerspectiveCamera(35, opts.renderW / opts.renderH, 0.01, 10000 );
this._camera.position.set(0, 0, 3);
this._scene.add(this._camera);
}else{
@@ -40859,3 +40859,18 @@ requirejs.config({
]
}
});
+(function(){
+ var scripts = document.getElementsByTagName('script');
+ var element = scripts[scripts.length-1];
+ var baseUrl = element.getAttribute('data-baseURL');
+ console.log('baseUrl', baseUrl, element);
+ if( baseUrl === null ) return;
+ requirejs.config({
+ paths : {
+ "build" : baseUrl+'/build',
+ "plugins" : baseUrl+'/plugins',
+ "threex" : baseUrl+'/vendor/threex',
+ "three.js" : baseUrl+'/vendor/three.js',
+ },
+ });
+})()
View
2 build/tquery-bundle.js
@@ -38532,7 +38532,7 @@ tQuery.World = function(opts)
// create a camera in the scene
if( !opts.camera ){
- this._camera = new THREE.PerspectiveCamera(90, opts.renderW / opts.renderH, 0.01, 10000 );
+ this._camera = new THREE.PerspectiveCamera(35, opts.renderW / opts.renderH, 0.01, 10000 );
this._camera.position.set(0, 0, 3);
this._scene.add(this._camera);
}else{
View
2 build/tquery.js
@@ -1306,7 +1306,7 @@ tQuery.World = function(opts)
// create a camera in the scene
if( !opts.camera ){
- this._camera = new THREE.PerspectiveCamera(90, opts.renderW / opts.renderH, 0.01, 10000 );
+ this._camera = new THREE.PerspectiveCamera(35, opts.renderW / opts.renderH, 0.01, 10000 );
this._camera.position.set(0, 0, 3);
this._scene.add(this._camera);
}else{
View
1 plugins/requirejs/bin/tomainconfigfile.js
@@ -28,6 +28,7 @@ var content = require('fs').readFileSync('head.confrequire.js', 'utf8')
filenames.forEach(function(filename){
content += require('fs').readFileSync('confrequire/'+filename, 'utf8')
})
+
// eval every *.confrequire.js config
eval(content)
// output the merged options object for requirejs.config()
View
18 plugins/requirejs/controls.confrequire.js
@@ -1,18 +0,0 @@
-requirejs.config({
- map : {
- "*" : {
- 'tquery.controls' : 'plugins/controls/tquery.controlwrapper',
- }
- },
- shim : {
- 'plugins/controls/tquery.controlwrapper' : [
- 'three.js/controls/FirstPersonControls',
- 'three.js/controls/OrbitControls',
- 'three.js/controls/PointerLockControls',
- 'three.js/controls/TrackballControls',
- 'three.js/controls/FlyControls',
- 'three.js/controls/PathControls',
- 'three.js/controls/RollControls',
- ]
- }
-});
View
15 plugins/requirejs/footer.js
@@ -0,0 +1,15 @@
+(function(){
+ var scripts = document.getElementsByTagName('script');
+ var element = scripts[scripts.length-1];
+ var baseUrl = element.getAttribute('data-baseURL');
+ console.log('baseUrl', baseUrl, element);
+ if( baseUrl === null ) return;
+ requirejs.config({
+ paths : {
+ "build" : baseUrl+'/build',
+ "plugins" : baseUrl+'/plugins',
+ "threex" : baseUrl+'/vendor/threex',
+ "three.js" : baseUrl+'/vendor/three.js',
+ },
+ });
+})()
View
2 plugins/requirejs/head.confrequire.js
@@ -11,3 +11,5 @@ requirejs.config({
"three.js" : '../../../vendor/three.js',
},
});
+
+

0 comments on commit 0fca834

Please sign in to comment.