diff --git a/controllers/bouncing/views/index.jade b/controllers/bouncing/views/index.jade index 02bebde..68d0764 100644 --- a/controllers/bouncing/views/index.jade +++ b/controllers/bouncing/views/index.jade @@ -1,10 +1,8 @@ -extends ../../../views/main +extends ../../../views/withjs block title title #{title} - Bouncing cube block extrajs - script(src="/static/js/three.min.js") - script(src="/static/js/threetools.min.js") script(src="/static/js/bouncing.min.js") block content diff --git a/controllers/multisphere/views/index.jade b/controllers/multisphere/views/index.jade index c1189c6..495a2f7 100644 --- a/controllers/multisphere/views/index.jade +++ b/controllers/multisphere/views/index.jade @@ -5,7 +5,7 @@ block title block extrajs script(src="/static/js/three.min.js") - script(src="/static/js/threetools.min.js") + script(src="/static/js/l3d.min.js") script(src="/static/js/multisphere.min.js") block content diff --git a/controllers/prototype/views/prototype.jade b/controllers/prototype/views/prototype.jade index 24dac71..8f744d3 100644 --- a/controllers/prototype/views/prototype.jade +++ b/controllers/prototype/views/prototype.jade @@ -4,7 +4,8 @@ block title title #{title} - Prototype block extrajs - script(src="/static/js/prototypetools.min.js") + script(src="/static/js/l3d.min.js") + script(src="/static/js/l3dp.min.js") block configjs block mainjs script document.getElementById('music').volume = 0.5; diff --git a/controllers/prototype/views/prototype_replays.jade b/controllers/prototype/views/prototype_replays.jade index 93e99cb..8d6d90f 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(src="/static/js/prototypetools.min.js") script RecommendedCamera = FixedCamera; script var params = params || {}; params.get = params.get || {}; params.get.id = #{id}; script initMainScene = #{initjs} diff --git a/controllers/stream/views/index.jade b/controllers/stream/views/index.jade index 6ef00f5..4255619 100644 --- a/controllers/stream/views/index.jade +++ b/controllers/stream/views/index.jade @@ -6,8 +6,8 @@ block title block extrajs script params = {}; params.get= {}; params.get.res = #{resolution} script(src="/static/js/three.min.js") - script(src="/static/js/threetools.min.js") script(src="/static/js/socket.io.min.js") + script(src="/static/js/l3d.min.js") script(src="/static/js/streamingsimulator.min.js") script(type='text/javascript'). $(function() { diff --git a/js/BufferGeometryToGeometry.js b/js/BufferGeometryToGeometry.js deleted file mode 100644 index 2211880..0000000 --- a/js/BufferGeometryToGeometry.js +++ /dev/null @@ -1,33 +0,0 @@ -var Converter = {}; - -Converter.toGeometry = function (bg) { - // The following snippet is from Mattatz - Masatatsu Nakamura http://mattatz.org - var attrib = bg.getAttribute('position'); - if(attrib === undefined) { - throw new Error('a given BufferGeometry object must have a position attribute.'); - } - - var positions = attrib.array; - - var vertices = []; - - var i; - for(i = 0, n = positions.length; i < n; i += 3) { - var x = positions[i]; - var y = positions[i + 1]; - var z = positions[i + 2]; - vertices.push(new THREE.Vector3(x, y, z)); - } - - var faces = []; - - for(i = 0, n = vertices.length; i < n; i += 3) { - faces.push(new THREE.Face3(i, i + 1, i + 2)); - } - - var geometry = new THREE.Geometry(); - geometry.vertices = vertices; - geometry.faces = faces; - geometry.computeFaceNormals(); - return geometry; -}; diff --git a/js/Makefile b/js/Makefile index 50e1ee0..05af510 100644 --- a/js/Makefile +++ b/js/Makefile @@ -6,103 +6,91 @@ else CLOSURE=../utils/simple-compiler/compiler.sh endif -all: List ListTest Socket Three Stats ThreeTools Bouncing Multisphere StreamingSimulator PrototypeTools PrototypeReplay PrototypeInteractive Tutorial +all: L3D L3DP Socket Three Stats Bouncing Multisphere StreamingSimulator PrototypeReplay PrototypeInteractive Tutorial + +L3D: + $(CLOSURE) $(OPT) \ + --js l3d/src/math/Tools.js \ + --js l3d/src/math/Hermite.js \ + --js l3d/src/utils/List.js \ + --js l3d/src/utils/ListTest.js \ + --js l3d/src/utils/CameraSelecter.js \ + --js l3d/src/utils/Logger.js \ + --js l3d/src/utils/Objects.js \ + --js l3d/src/utils/History.js \ + --js l3d/src/canvases/StartCanvas.js \ + --js l3d/src/canvases/MousePointer.js \ + --js l3d/src/canvases/Previewer.js \ + --js l3d/src/loaders/ProgressiveLoaderGeometry.js \ + --js l3d/src/loaders/ProgressiveLoader.js \ + --js l3d/src/recommendations/OldFixedCamera.js \ + --js l3d/src/recommendations/ArrowCamera.js \ + --js l3d/src/recommendations/FixedCamera.js \ + --js l3d/src/recommendations/ReverseCamera.js \ + --js l3d/src/cameras/ReplayCamera.js \ + --js l3d/src/cameras/Camera.js \ + --js l3d/src/cameras/PointerCamera.js \ + --js l3d/src/cameras/CameraContainer.js \ + --js l3d/src/scenes/initScene.js \ + --js_output_file ../static/js/l3d.min.js + +L3DP: + $(CLOSURE) $(OPT) \ + --js l3d/apps/prototype/ButtonManager.js \ + --js l3d/apps/prototype/Coin.js \ + --js_output_file ../static/js/l3dp.min.js Socket: cp socket.io/socket.io.min.js ../static/js - $(CLOSURE) $(OPT) \ - --js ProgressiveLoaderGeometry.js \ - --js ProgressiveLoader.js >> ../static/js/socket.io.min.js - -List: - $(CLOSURE) $(OPT) \ - --js List.js \ - --js_output_file ../static/js/List.min.js - -ListTest: - $(CLOSURE) $(OPT) \ - --js ListTest.js \ - --js_output_file ../static/js/ListTest.min.js - Three: cp three/three.min.js ../static/js/ - $(CLOSURE) $(OPT) \ - --js three/threex.transparency.js >> ../static/js/three.min.js - -Stats: - cp three/stats.min.js ../static/js/ - -ThreeTools: $(CLOSURE) $(OPT) \ --js three/DDSLoader.js \ --js three/MTLLoader.js \ --js three/OBJMTLLoader.js \ --js three/OBJLoader.js \ --js three/OrbitControls.js \ - --js Tools.js \ - --js_output_file ../static/js/threetools.min.js + --js three/threex.transparency.js >> ../static/js/three.min.js + +Stats: + cp three/stats.min.js ../static/js/ Bouncing: $(CLOSURE) $(OPT) \ - --js Camera.js \ - --js Cube.js \ - --js BouncingCube.js \ - --js bouncing/BouncingMain.js \ + --js l3d/apps/bouncing-cube/BouncingCube.js \ + --js l3d/apps/bouncing-cube/main.js \ --js_output_file ../static/js/bouncing.min.js Multisphere: $(CLOSURE) $(OPT) \ - --js Camera.js \ - --js Cube.js \ - --js multisphere/MultiSphere.js \ + --js l3d/apps/multisphere/main.js \ --js_output_file ../static/js/multisphere.min.js StreamingSimulator: $(CLOSURE) $(OPT) \ - --js Camera.js \ - --js Cube.js \ - --js ProgressiveSphere.js \ - --js stream/main.js \ + --js l3d/apps/stream-demo/main.js \ --js_output_file ../static/js/streamingsimulator.min.js -PrototypeTools: - $(CLOSURE) $(OPT) \ - --js History.js \ - --js StartCanvas.js \ - --js Hermite.js \ - --js Camera.js \ - --js PointerCamera.js \ - --js CameraContainer.js \ - --js MousePointer.js \ - --js prototype/ArrowCamera.js \ - --js prototype/FixedCamera.js \ - --js prototype/OldFixedCamera.js \ - --js prototype/ReverseCamera.js \ - --js prototype/ReplayCamera.js \ - --js prototype/initScene.js \ - --js prototype/raycasterTools.js \ - --js prototype/Previewer.js \ - --js prototype/ButtonManager.js \ - --js prototype/Coin.js \ - --js Logger.js \ - --js_output_file ../static/js/prototypetools.min.js - PrototypeInteractive: $(CLOSURE) $(OPT) \ - --js prototype/main.js \ + --js l3d/apps/prototype/interactive/main.js \ --js_output_file ../static/js/prototypeinteractive.min.js PrototypeReplay: $(CLOSURE) $(OPT) \ - --js prototype/replay.js \ + --js l3d/apps/prototype/ButtonManager.js \ + --js l3d/apps/prototype/Coin.js \ + --js l3d/apps/prototype/replay/main.js \ --js_output_file ../static/js/replay.min.js Tutorial: $(CLOSURE) $(OPT) \ - --js TutoCamera.js \ - --js prototype/TutorialSteps.js \ - --js prototype/tutorial.js \ + --js l3d/apps/prototype/ButtonManager.js \ + --js l3d/apps/prototype/Coin.js \ + --js l3d/apps/prototype/tutorial/TutoCamera.js \ + --js l3d/apps/prototype/tutorial/TutorialSteps.js \ + --js l3d/apps/prototype/tutorial/main.js \ --js_output_file ../static/js/tutorial.min.js clean: diff --git a/js/ProgressiveSphere.js b/js/ProgressiveSphere.js deleted file mode 100644 index 1aeebb0..0000000 --- a/js/ProgressiveSphere.js +++ /dev/null @@ -1,89 +0,0 @@ -var ProgessiveSphere = function(loader, res) { - Displayable.call(this); - this.started = false; - this.finished = false; - this.wasFinished = false; - this.begin = false; - this.addedToScene = false; - - if (res === undefined) - res = 5; - - (function(self) { - 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); - self.totalMesh = child; - self.geometry = new THREE.Geometry(); - self.material = new THREE.MeshLambertMaterial(); - self.material.color.setRGB(1,0,0); - self.material.side = THREE.DoubleSide; - self.mesh = new THREE.Mesh(self.geometry, self.material); - self.current_face = 0; - self.started = true; - self.begin = true; - self.addToScene(scene); - } - }); - }); - })(this); - -}; -ProgessiveSphere.prototype = Object.create(Displayable.prototype); -ProgessiveSphere.prototype.constructor = ProgessiveSphere; - -ProgessiveSphere.prototype.addFace = function() { - if (this.started && this.begin && this.addedToScene) { - if (this.current_face < this.totalMesh.geometry.attributes.position.array.length / 3) { - - // Add the 3 new vertices - this.geometry.vertices.push(new THREE.Vector3( - this.totalMesh.geometry.attributes.position.array[3*this.current_face], - this.totalMesh.geometry.attributes.position.array[3*this.current_face+1], - this.totalMesh.geometry.attributes.position.array[3*this.current_face+2] - )); - - this.geometry.vertices.push(new THREE.Vector3( - this.totalMesh.geometry.attributes.position.array[3*this.current_face+3], - this.totalMesh.geometry.attributes.position.array[3*this.current_face+4], - this.totalMesh.geometry.attributes.position.array[3*this.current_face+5] - )); - - this.geometry.vertices.push(new THREE.Vector3( - this.totalMesh.geometry.attributes.position.array[3*this.current_face+6], - this.totalMesh.geometry.attributes.position.array[3*this.current_face+7], - this.totalMesh.geometry.attributes.position.array[3*this.current_face+8] - )); - - // Add the new face - this.geometry.faces.push(new THREE.Face3( - this.geometry.vertices.length-3, - this.geometry.vertices.length-2, - this.geometry.vertices.length-1 - )); - - // Update the stuff - this.geometry.mergeVertices(); - this.geometry.computeFaceNormals(); - this.geometry.computeVertexNormals(); - this.current_face += 3; - this.geometry.elementsNeedUpdate = true; - this.geometry.normalsNeedUpdate = true; - this.geometry.verticesNeedUpdate = true; - this.geometry.groupsNeedUpdate = true; - } else { - this.finished = true; - } - } - - if (!this.wasFinished && this.finished) { - this.wasFinished = true; - console.log("Finished reconstructing the mesh !"); - } -}; - -ProgessiveSphere.prototype.addToScene = function(scene) { - Displayable.prototype.addToScene.call(this, scene); - this.addedToScene = true; -}; diff --git a/js/BouncingCube.js b/js/l3d/apps/bouncing-cube/BouncingCube.js similarity index 100% rename from js/BouncingCube.js rename to js/l3d/apps/bouncing-cube/BouncingCube.js diff --git a/js/bouncing/BouncingMain.js b/js/l3d/apps/bouncing-cube/main.js similarity index 100% rename from js/bouncing/BouncingMain.js rename to js/l3d/apps/bouncing-cube/main.js diff --git a/js/multisphere/MultiSphere.js b/js/l3d/apps/multisphere/main.js similarity index 100% rename from js/multisphere/MultiSphere.js rename to js/l3d/apps/multisphere/main.js diff --git a/js/prototype/ButtonManager.js b/js/l3d/apps/prototype/ButtonManager.js similarity index 100% rename from js/prototype/ButtonManager.js rename to js/l3d/apps/prototype/ButtonManager.js diff --git a/js/prototype/Coin.js b/js/l3d/apps/prototype/Coin.js similarity index 100% rename from js/prototype/Coin.js rename to js/l3d/apps/prototype/Coin.js diff --git a/js/prototype/main.js b/js/l3d/apps/prototype/interactive/main.js similarity index 100% rename from js/prototype/main.js rename to js/l3d/apps/prototype/interactive/main.js diff --git a/js/prototype/replay.js b/js/l3d/apps/prototype/replay/main.js similarity index 100% rename from js/prototype/replay.js rename to js/l3d/apps/prototype/replay/main.js diff --git a/js/TutoCamera.js b/js/l3d/apps/prototype/tutorial/TutoCamera.js similarity index 100% rename from js/TutoCamera.js rename to js/l3d/apps/prototype/tutorial/TutoCamera.js diff --git a/js/prototype/TutorialSteps.js b/js/l3d/apps/prototype/tutorial/TutorialSteps.js similarity index 100% rename from js/prototype/TutorialSteps.js rename to js/l3d/apps/prototype/tutorial/TutorialSteps.js diff --git a/js/prototype/tutorial.js b/js/l3d/apps/prototype/tutorial/main.js similarity index 100% rename from js/prototype/tutorial.js rename to js/l3d/apps/prototype/tutorial/main.js diff --git a/js/stream/main.js b/js/l3d/apps/stream-demo/main.js similarity index 100% rename from js/stream/main.js rename to js/l3d/apps/stream-demo/main.js diff --git a/js/Camera.js b/js/l3d/src/cameras/Camera.js similarity index 100% rename from js/Camera.js rename to js/l3d/src/cameras/Camera.js diff --git a/js/CameraContainer.js b/js/l3d/src/cameras/CameraContainer.js similarity index 100% rename from js/CameraContainer.js rename to js/l3d/src/cameras/CameraContainer.js diff --git a/js/PointerCamera.js b/js/l3d/src/cameras/PointerCamera.js similarity index 100% rename from js/PointerCamera.js rename to js/l3d/src/cameras/PointerCamera.js diff --git a/js/prototype/ReplayCamera.js b/js/l3d/src/cameras/ReplayCamera.js similarity index 100% rename from js/prototype/ReplayCamera.js rename to js/l3d/src/cameras/ReplayCamera.js diff --git a/js/MousePointer.js b/js/l3d/src/canvases/MousePointer.js similarity index 100% rename from js/MousePointer.js rename to js/l3d/src/canvases/MousePointer.js diff --git a/js/prototype/Previewer.js b/js/l3d/src/canvases/Previewer.js similarity index 100% rename from js/prototype/Previewer.js rename to js/l3d/src/canvases/Previewer.js diff --git a/js/StartCanvas.js b/js/l3d/src/canvases/StartCanvas.js similarity index 100% rename from js/StartCanvas.js rename to js/l3d/src/canvases/StartCanvas.js diff --git a/js/ProgressiveLoader.js b/js/l3d/src/loaders/ProgressiveLoader.js similarity index 100% rename from js/ProgressiveLoader.js rename to js/l3d/src/loaders/ProgressiveLoader.js diff --git a/js/ProgressiveLoaderGeometry.js b/js/l3d/src/loaders/ProgressiveLoaderGeometry.js similarity index 100% rename from js/ProgressiveLoaderGeometry.js rename to js/l3d/src/loaders/ProgressiveLoaderGeometry.js diff --git a/js/Hermite.js b/js/l3d/src/math/Hermite.js similarity index 100% rename from js/Hermite.js rename to js/l3d/src/math/Hermite.js diff --git a/js/HermiteTest/HermiteTest.js b/js/l3d/src/math/HermiteTest/HermiteTest.js similarity index 100% rename from js/HermiteTest/HermiteTest.js rename to js/l3d/src/math/HermiteTest/HermiteTest.js diff --git a/js/Tools.js b/js/l3d/src/math/Tools.js similarity index 100% rename from js/Tools.js rename to js/l3d/src/math/Tools.js diff --git a/js/ToolsTest.js b/js/l3d/src/math/ToolsTest.js similarity index 100% rename from js/ToolsTest.js rename to js/l3d/src/math/ToolsTest.js diff --git a/js/prototype/ArrowCamera.js b/js/l3d/src/recommendations/ArrowCamera.js similarity index 100% rename from js/prototype/ArrowCamera.js rename to js/l3d/src/recommendations/ArrowCamera.js diff --git a/js/prototype/FixedCamera.js b/js/l3d/src/recommendations/FixedCamera.js similarity index 100% rename from js/prototype/FixedCamera.js rename to js/l3d/src/recommendations/FixedCamera.js diff --git a/js/prototype/OldFixedCamera.js b/js/l3d/src/recommendations/OldFixedCamera.js similarity index 100% rename from js/prototype/OldFixedCamera.js rename to js/l3d/src/recommendations/OldFixedCamera.js diff --git a/js/prototype/ReverseCamera.js b/js/l3d/src/recommendations/ReverseCamera.js similarity index 100% rename from js/prototype/ReverseCamera.js rename to js/l3d/src/recommendations/ReverseCamera.js diff --git a/js/prototype/initScene.js b/js/l3d/src/scenes/initScene.js similarity index 100% rename from js/prototype/initScene.js rename to js/l3d/src/scenes/initScene.js diff --git a/js/prototype/raycasterTools.js b/js/l3d/src/utils/CameraSelecter.js similarity index 100% rename from js/prototype/raycasterTools.js rename to js/l3d/src/utils/CameraSelecter.js diff --git a/js/History.js b/js/l3d/src/utils/History.js similarity index 100% rename from js/History.js rename to js/l3d/src/utils/History.js diff --git a/js/List.js b/js/l3d/src/utils/List.js similarity index 100% rename from js/List.js rename to js/l3d/src/utils/List.js diff --git a/js/ListTest.js b/js/l3d/src/utils/ListTest.js similarity index 100% rename from js/ListTest.js rename to js/l3d/src/utils/ListTest.js diff --git a/js/Logger.js b/js/l3d/src/utils/Logger.js similarity index 100% rename from js/Logger.js rename to js/l3d/src/utils/Logger.js diff --git a/js/Cube.js b/js/l3d/src/utils/Objects.js similarity index 100% rename from js/Cube.js rename to js/l3d/src/utils/Objects.js diff --git a/js/three/MTLLoader.js b/js/three/MTLLoader.js index 72e60c5..a83d0ac 100644 --- a/js/three/MTLLoader.js +++ b/js/three/MTLLoader.js @@ -315,7 +315,6 @@ THREE.MTLLoader.MaterialCreator.prototype = { params[ 'map' ] = this.loadTexture( this.baseUrl + value ); params[ 'map' ].wrapS = this.wrap; params[ 'map' ].wrapT = this.wrap; - map = params['map']; break; diff --git a/views/withjs.jade b/views/withjs.jade index cb2b20a..473c7c2 100644 --- a/views/withjs.jade +++ b/views/withjs.jade @@ -4,4 +4,4 @@ block js script(src="/static/js/three.min.js") script(src="/static/js/stats.min.js") script(src="/static/js/socket.io.min.js") - script(src="/static/js/threetools.min.js") + script(src="/static/js/l3d.min.js")