A hell of a lot cleaning

This commit is contained in:
Thomas FORGIONE 2015-07-01 15:03:11 +02:00
parent bb938e5342
commit 86f2094af6
45 changed files with 56 additions and 193 deletions

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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}

View File

@ -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() {

View File

@ -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;
};

View File

@ -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:

View File

@ -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;
};

View File

@ -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;

View File

@ -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")