From e915fb58e7adefbf196906fc765afa3e95f47fff Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Thu, 25 Jun 2015 16:51:47 +0200 Subject: [PATCH] Got rid of static_path...was a bad idea --- controllers/prototype/views/prototype.jade | 1 - .../prototype/views/prototype_replays.jade | 1 - js/ProgressiveSphere.js | 2 +- js/multisphere/MultiSphere.js | 2 +- js/prototype/Coin.js | 4 +-- js/prototype/initScene.js | 27 ++++++++----------- js/prototype/main.js | 12 ++++----- js/prototype/replay.js | 2 +- js/prototype/tutorial.js | 2 +- 9 files changed, 23 insertions(+), 30 deletions(-) diff --git a/controllers/prototype/views/prototype.jade b/controllers/prototype/views/prototype.jade index 471579e..24dac71 100644 --- a/controllers/prototype/views/prototype.jade +++ b/controllers/prototype/views/prototype.jade @@ -4,7 +4,6 @@ block title title #{title} - Prototype block extrajs - script static_path = '/static/'; script(src="/static/js/prototypetools.min.js") block configjs block mainjs diff --git a/controllers/prototype/views/prototype_replays.jade b/controllers/prototype/views/prototype_replays.jade index 3f8740e..93e99cb 100644 --- a/controllers/prototype/views/prototype_replays.jade +++ b/controllers/prototype/views/prototype_replays.jade @@ -4,7 +4,6 @@ block title title #{title} - Prototype block extrajs - script static_path = '/static/' script(src="/static/js/prototypetools.min.js") script RecommendedCamera = FixedCamera; script var params = params || {}; params.get = params.get || {}; params.get.id = #{id}; diff --git a/js/ProgressiveSphere.js b/js/ProgressiveSphere.js index 9547645..ae4bbcf 100644 --- a/js/ProgressiveSphere.js +++ b/js/ProgressiveSphere.js @@ -10,7 +10,7 @@ var ProgessiveSphere = function(loader, res) { res = 5; (function(self) { - loader.load(static_path + 'data/spheres/' + res + '.obj', function(object) { + loader.load('/static/data/spheres/' + res + '.obj', function(object) { object.traverse(function(child) { if (child instanceof THREE.Mesh) { child.up = new THREE.Vector3(0,0,1); diff --git a/js/multisphere/MultiSphere.js b/js/multisphere/MultiSphere.js index 3c09d73..97165ce 100644 --- a/js/multisphere/MultiSphere.js +++ b/js/multisphere/MultiSphere.js @@ -52,7 +52,7 @@ function init() { // Capture of i // I am pretty good (function(i) { - loader.load(static_path + 'data/spheres/' + (i+1) + '.obj', function (object) { + loader.load('/static/data/spheres/' + (i+1) + '.obj', function (object) { object.traverse(function (child) { if (child instanceof THREE.Mesh ) { child.material.color.setHex(0xff0000); diff --git a/js/prototype/Coin.js b/js/prototype/Coin.js index 5580ecd..85b4118 100644 --- a/js/prototype/Coin.js +++ b/js/prototype/Coin.js @@ -147,7 +147,7 @@ Coin.init = function(scale) { } Coin._loader.load( - static_path + 'data/coin/Coin.obj', + '/static/data/coin/Coin.obj', function(object) { object.traverse(function (mesh) { if (mesh instanceof THREE.Mesh) { @@ -161,6 +161,6 @@ Coin.init = function(scale) { } ); - Coin.nextSound = new Audio(static_path + 'data/music/redcoins/1' + Coin.extension); + Coin.nextSound = new Audio('/static/data/music/redcoins/1' + Coin.extension); } } diff --git a/js/prototype/initScene.js b/js/prototype/initScene.js index a37e6f7..990d856 100644 --- a/js/prototype/initScene.js +++ b/js/prototype/initScene.js @@ -43,7 +43,7 @@ function resetPeachElements() { }; } -function initPeach(camera, scene, static_path, coins) { +function initPeach(camera, scene, coins) { addLight(scene); var loader = new THREE.OBJMTLLoader(); @@ -66,20 +66,15 @@ function initPeach(camera, scene, static_path, coins) { return cameras; } -function initZeldaScene(scene, collidableObjects, loader, static_path) { +function initZeldaScene(scene, collidableObjects, loader) { // Create loader if not already done if (loader === undefined) { loader = new THREE.OBJMTLLoader(); } - // Try to guess the path to static files - if (static_path === undefined) { - static_path = "/static/"; - } - loader.load( - static_path + 'data/zelda/Island.obj', - static_path + 'data/zelda/Island.mtl', + '/static/data/zelda/Island.obj', + '/static/data/zelda/Island.mtl', function ( object ) { collidableObjects.push(object); object.scale.set(0.01,0.01,0.01); @@ -163,7 +158,7 @@ function createPeachCameras(width, height) { function initBobombScene(scene, collidableObjects, loader, camera) { var loader = new ProgressiveLoaderGeometry( - static_path + 'data/bobomb/bobomb battlefeild.obj', + '/static/data/bobomb/bobomb battlefeild.obj', scene, null, function(object) { @@ -273,7 +268,7 @@ function createBobombCameras(width, height) { } -function initBobomb(camera, scene, static_path, coins) { +function initBobomb(camera, scene, coins) { addLight(scene); var loader = new THREE.OBJMTLLoader(); @@ -309,7 +304,7 @@ function initBobomb(camera, scene, static_path, coins) { function initWhompScene(scene, collidableObjects, loader, camera) { var loader = new ProgressiveLoaderGeometry( - static_path + 'data/whomp/Whomps Fortress.obj', + '/static/data/whomp/Whomps Fortress.obj', scene, null, function(object) { @@ -437,7 +432,7 @@ function resetWhompElements() { }; } -function initWhomp(camera, scene, static_path, coins) { +function initWhomp(camera, scene, coins) { addLight(scene); var loader = new THREE.OBJMTLLoader(); @@ -473,7 +468,7 @@ function initWhomp(camera, scene, static_path, coins) { function initMountainScene(scene, collidableObjects, loader, camera) { var loader = new ProgressiveLoaderGeometry( - static_path + 'data/mountain/coocoolmountain.obj', + '/static/data/mountain/coocoolmountain.obj', scene, null, function(object) { @@ -590,7 +585,7 @@ function resetMountainElements() { } } -function initMountain(camera, scene, static_path, coins) { +function initMountain(camera, scene, coins) { addLight(scene); var loader = new THREE.OBJMTLLoader(); @@ -691,7 +686,7 @@ function resetSponzaElements() { }; } -function initSponza(camera, scene, static_path, coins) { +function initSponza(camera, scene, coins) { addLight(scene); var loader = new THREE.JSONLoader(); diff --git a/js/prototype/main.js b/js/prototype/main.js index 36b877b..149d010 100644 --- a/js/prototype/main.js +++ b/js/prototype/main.js @@ -125,12 +125,12 @@ function init() { startCanvas.render(); - cameras = initMainScene(camera1, scene, static_path, coins); - // cameras = initPeach(camera1, scene, static_path, coins); - // cameras = initBobomb(camera1, scene, static_path, coins); - // cameras = initWhomp(camera1, scene, static_path, coins); - // cameras = initMountain(camera1, scene, static_path, coins); - // cameras = initSponza(camera1, scene, static_path, coins); + cameras = initMainScene(camera1, scene, coins); + // cameras = initPeach(camera1, scene, coins); + // cameras = initBobomb(camera1, scene, coins); + // cameras = initWhomp(camera1, scene, , coins); + // cameras = initMountain(camera1, scene, coins); + // cameras = initSponza(camera1, scene, coins); // Add listeners initListeners(); diff --git a/js/prototype/replay.js b/js/prototype/replay.js index 8b2f28b..6d7f6b3 100644 --- a/js/prototype/replay.js +++ b/js/prototype/replay.js @@ -72,7 +72,7 @@ function init() { // Initialize pointer camera var camera1 = new ReplayCamera(50, container_size.width() / container_size.height(), 0.01, 100000, coins); - cameras = initMainScene(camera1, scene, static_path, coins); + cameras = initMainScene(camera1, scene, coins); camera1.cameras = cameras; // Add listeners diff --git a/js/prototype/tutorial.js b/js/prototype/tutorial.js index d273269..d53cbe7 100644 --- a/js/prototype/tutorial.js +++ b/js/prototype/tutorial.js @@ -92,7 +92,7 @@ function init() { tutorial.setCameras(cameras); // Load peach scene - initPeach(camera1, scene, static_path); + initPeach(camera1, scene); initListeners();