A hell of a lot cleaning
This commit is contained in:
parent
bb938e5342
commit
86f2094af6
|
@ -1,10 +1,8 @@
|
||||||
extends ../../../views/main
|
extends ../../../views/withjs
|
||||||
block title
|
block title
|
||||||
title #{title} - Bouncing cube
|
title #{title} - Bouncing cube
|
||||||
|
|
||||||
block extrajs
|
block extrajs
|
||||||
script(src="/static/js/three.min.js")
|
|
||||||
script(src="/static/js/threetools.min.js")
|
|
||||||
script(src="/static/js/bouncing.min.js")
|
script(src="/static/js/bouncing.min.js")
|
||||||
|
|
||||||
block content
|
block content
|
||||||
|
|
|
@ -5,7 +5,7 @@ block title
|
||||||
|
|
||||||
block extrajs
|
block extrajs
|
||||||
script(src="/static/js/three.min.js")
|
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")
|
script(src="/static/js/multisphere.min.js")
|
||||||
|
|
||||||
block content
|
block content
|
||||||
|
|
|
@ -4,7 +4,8 @@ block title
|
||||||
title #{title} - Prototype
|
title #{title} - Prototype
|
||||||
|
|
||||||
block extrajs
|
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 configjs
|
||||||
block mainjs
|
block mainjs
|
||||||
script document.getElementById('music').volume = 0.5;
|
script document.getElementById('music').volume = 0.5;
|
||||||
|
|
|
@ -4,7 +4,6 @@ block title
|
||||||
title #{title} - Prototype
|
title #{title} - Prototype
|
||||||
|
|
||||||
block extrajs
|
block extrajs
|
||||||
script(src="/static/js/prototypetools.min.js")
|
|
||||||
script RecommendedCamera = FixedCamera;
|
script RecommendedCamera = FixedCamera;
|
||||||
script var params = params || {}; params.get = params.get || {}; params.get.id = #{id};
|
script var params = params || {}; params.get = params.get || {}; params.get.id = #{id};
|
||||||
script initMainScene = #{initjs}
|
script initMainScene = #{initjs}
|
||||||
|
|
|
@ -6,8 +6,8 @@ block title
|
||||||
block extrajs
|
block extrajs
|
||||||
script params = {}; params.get= {}; params.get.res = #{resolution}
|
script params = {}; params.get= {}; params.get.res = #{resolution}
|
||||||
script(src="/static/js/three.min.js")
|
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/socket.io.min.js")
|
||||||
|
script(src="/static/js/l3d.min.js")
|
||||||
script(src="/static/js/streamingsimulator.min.js")
|
script(src="/static/js/streamingsimulator.min.js")
|
||||||
script(type='text/javascript').
|
script(type='text/javascript').
|
||||||
$(function() {
|
$(function() {
|
||||||
|
|
|
@ -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;
|
|
||||||
};
|
|
112
js/Makefile
112
js/Makefile
|
@ -6,103 +6,91 @@ else
|
||||||
CLOSURE=../utils/simple-compiler/compiler.sh
|
CLOSURE=../utils/simple-compiler/compiler.sh
|
||||||
endif
|
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:
|
Socket:
|
||||||
cp socket.io/socket.io.min.js ../static/js
|
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:
|
Three:
|
||||||
cp three/three.min.js ../static/js/
|
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) \
|
$(CLOSURE) $(OPT) \
|
||||||
--js three/DDSLoader.js \
|
--js three/DDSLoader.js \
|
||||||
--js three/MTLLoader.js \
|
--js three/MTLLoader.js \
|
||||||
--js three/OBJMTLLoader.js \
|
--js three/OBJMTLLoader.js \
|
||||||
--js three/OBJLoader.js \
|
--js three/OBJLoader.js \
|
||||||
--js three/OrbitControls.js \
|
--js three/OrbitControls.js \
|
||||||
--js Tools.js \
|
--js three/threex.transparency.js >> ../static/js/three.min.js
|
||||||
--js_output_file ../static/js/threetools.min.js
|
|
||||||
|
Stats:
|
||||||
|
cp three/stats.min.js ../static/js/
|
||||||
|
|
||||||
Bouncing:
|
Bouncing:
|
||||||
$(CLOSURE) $(OPT) \
|
$(CLOSURE) $(OPT) \
|
||||||
--js Camera.js \
|
--js l3d/apps/bouncing-cube/BouncingCube.js \
|
||||||
--js Cube.js \
|
--js l3d/apps/bouncing-cube/main.js \
|
||||||
--js BouncingCube.js \
|
|
||||||
--js bouncing/BouncingMain.js \
|
|
||||||
--js_output_file ../static/js/bouncing.min.js
|
--js_output_file ../static/js/bouncing.min.js
|
||||||
|
|
||||||
Multisphere:
|
Multisphere:
|
||||||
$(CLOSURE) $(OPT) \
|
$(CLOSURE) $(OPT) \
|
||||||
--js Camera.js \
|
--js l3d/apps/multisphere/main.js \
|
||||||
--js Cube.js \
|
|
||||||
--js multisphere/MultiSphere.js \
|
|
||||||
--js_output_file ../static/js/multisphere.min.js
|
--js_output_file ../static/js/multisphere.min.js
|
||||||
|
|
||||||
StreamingSimulator:
|
StreamingSimulator:
|
||||||
$(CLOSURE) $(OPT) \
|
$(CLOSURE) $(OPT) \
|
||||||
--js Camera.js \
|
--js l3d/apps/stream-demo/main.js \
|
||||||
--js Cube.js \
|
|
||||||
--js ProgressiveSphere.js \
|
|
||||||
--js stream/main.js \
|
|
||||||
--js_output_file ../static/js/streamingsimulator.min.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:
|
PrototypeInteractive:
|
||||||
$(CLOSURE) $(OPT) \
|
$(CLOSURE) $(OPT) \
|
||||||
--js prototype/main.js \
|
--js l3d/apps/prototype/interactive/main.js \
|
||||||
--js_output_file ../static/js/prototypeinteractive.min.js
|
--js_output_file ../static/js/prototypeinteractive.min.js
|
||||||
|
|
||||||
PrototypeReplay:
|
PrototypeReplay:
|
||||||
$(CLOSURE) $(OPT) \
|
$(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
|
--js_output_file ../static/js/replay.min.js
|
||||||
|
|
||||||
Tutorial:
|
Tutorial:
|
||||||
$(CLOSURE) $(OPT) \
|
$(CLOSURE) $(OPT) \
|
||||||
--js TutoCamera.js \
|
--js l3d/apps/prototype/ButtonManager.js \
|
||||||
--js prototype/TutorialSteps.js \
|
--js l3d/apps/prototype/Coin.js \
|
||||||
--js prototype/tutorial.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
|
--js_output_file ../static/js/tutorial.min.js
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|
|
@ -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;
|
|
||||||
};
|
|
|
@ -315,7 +315,6 @@ THREE.MTLLoader.MaterialCreator.prototype = {
|
||||||
params[ 'map' ] = this.loadTexture( this.baseUrl + value );
|
params[ 'map' ] = this.loadTexture( this.baseUrl + value );
|
||||||
params[ 'map' ].wrapS = this.wrap;
|
params[ 'map' ].wrapS = this.wrap;
|
||||||
params[ 'map' ].wrapT = this.wrap;
|
params[ 'map' ].wrapT = this.wrap;
|
||||||
map = params['map'];
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -4,4 +4,4 @@ block js
|
||||||
script(src="/static/js/three.min.js")
|
script(src="/static/js/three.min.js")
|
||||||
script(src="/static/js/stats.min.js")
|
script(src="/static/js/stats.min.js")
|
||||||
script(src="/static/js/socket.io.min.js")
|
script(src="/static/js/socket.io.min.js")
|
||||||
script(src="/static/js/threetools.min.js")
|
script(src="/static/js/l3d.min.js")
|
||||||
|
|
Loading…
Reference in New Issue