Browse Source

- Scene.add > Scene.addObject
- Enabled Scene.removeObject
- Removed computeNormals() from Geometry

Mr.doob 15 years ago
parent
commit
4d0fdbb1c6
6 changed files with 29 additions and 60 deletions
  1. 11 1
      README.md
  2. 0 1
      build/three.js
  3. 0 46
      src/core/Geometry.js
  4. 14 8
      src/scenes/Scene.js
  5. 1 1
      utils/deployer.py
  6. 3 3
      utils/export_threejs.py

+ 11 - 1
README.md

@@ -23,6 +23,8 @@ Other similar projects: [pre3d](http://deanm.github.com/pre3d/), [pvjs](http://c
 [![particles_wave](http://github.com/mrdoob/three.js/raw/master/assets/examples/01_waves.png)](http://mrdoob.com/projects/three.js/examples/particles_waves.html)
 [![particles_wave](http://github.com/mrdoob/three.js/raw/master/assets/examples/01_waves.png)](http://mrdoob.com/projects/three.js/examples/particles_waves.html)
 [![particles_floor](http://github.com/mrdoob/three.js/raw/master/assets/examples/00_floor.png)](http://mrdoob.com/projects/three.js/examples/particles_floor.html)
 [![particles_floor](http://github.com/mrdoob/three.js/raw/master/assets/examples/00_floor.png)](http://mrdoob.com/projects/three.js/examples/particles_floor.html)
 
 
+[![Rat](http://github.com/mrdoob/three.js/raw/master/assets/projects/06_rat.png)](http://tech.lab212.org/2010/07/export-textured-models-from-blender2-5-to-three-js/)
+[![Failure](http://github.com/mrdoob/three.js/raw/master/assets/projects/05_failure.png)](http://www.is-real.net/experiments/three/failure/)
 [![Space Cannon 3D](http://github.com/mrdoob/three.js/raw/master/assets/projects/02_spacecannon.png)](http://labs.brian-stoner.com/spacecannon/)
 [![Space Cannon 3D](http://github.com/mrdoob/three.js/raw/master/assets/projects/02_spacecannon.png)](http://labs.brian-stoner.com/spacecannon/)
 [![Alocasia](http://github.com/mrdoob/three.js/raw/master/assets/projects/04_alocasia.png)](http://arithmetric.com/projects/alocasia/)
 [![Alocasia](http://github.com/mrdoob/three.js/raw/master/assets/projects/04_alocasia.png)](http://arithmetric.com/projects/alocasia/)
 [![DDD](http://github.com/mrdoob/three.js/raw/master/assets/projects/01_ddd.png)](http://the389.com/works/three/)
 [![DDD](http://github.com/mrdoob/three.js/raw/master/assets/projects/01_ddd.png)](http://the389.com/works/three/)
@@ -58,7 +60,7 @@ This code creates a camera, then creates a scene object, adds a bunch of random
 				particle.position.x = Math.random() * 2000 - 1000;
 				particle.position.x = Math.random() * 2000 - 1000;
 				particle.position.y = Math.random() * 2000 - 1000;
 				particle.position.y = Math.random() * 2000 - 1000;
 				particle.position.z = Math.random() * 2000 - 1000;
 				particle.position.z = Math.random() * 2000 - 1000;
-				scene.add( particle );
+				scene.addObject( particle );
 
 
 			}
 			}
 
 
@@ -119,6 +121,14 @@ Thanks to the power of the internets (and github <3) these people have kindly he
 
 
 ### Change Log ###
 ### Change Log ###
 
 
+2010 07 03 - **r11** (23.541 kb)
+
+* Blender 2.5 exporter (utils/export_threejs.py) now exports UV and normals (Thx [kikko](http://github.com/kikko))
+* Scene.add > Scene.addObject
+* Enabled Scene.removeObject
+* Removed computeNormals() from Geometry
+
+
 2010 06 22 - **r10** (23.959 kb)
 2010 06 22 - **r10** (23.959 kb)
 
 
 * Changed Camera system. (Thx [Paul Brunt](http://github.com/supereggbert))
 * Changed Camera system. (Thx [Paul Brunt](http://github.com/supereggbert))

File diff suppressed because it is too large
+ 0 - 1
build/three.js


+ 0 - 46
src/core/Geometry.js

@@ -9,50 +9,4 @@ THREE.Geometry = function () {
 	this.faces = [];
 	this.faces = [];
 	this.uvs = [];
 	this.uvs = [];
 
 
-	this.computeNormals = function () {
-
-		var v, f, vA, vB, vC, cb, ab, normal;
-
-		for( v = 0; v < this.vertices.length; v++ ) {
-
-			this.vertices[v].normal.set(0,0,0);
-
-		}
-
-		for( f = 0; f < this.faces.length; f++ ) {
-
-			vA = this.vertices[ this.faces[f].a ];
-			vB = this.vertices[ this.faces[f].b ];
-			vC = this.vertices[ this.faces[f].c ];
-
-			cb = new THREE.Vector3();
-			ab = new THREE.Vector3();
-			normal = new THREE.Vector3();
-
-			cb.sub(vC.position,vB.position);
-			ab.sub(vA.position,vB.position);
-			cb.cross(ab);
-
-			if ( !cb.isZero() ) {
-
-				cb.normalize();
-
-			}
-
-			this.faces[f].normal = cb;
-
-			vA.normal.addSelf( normal );
-			vB.normal.addSelf( normal );
-			vC.normal.addSelf( normal );
-
-			if ( this.faces[f] instanceof THREE.Face4 ) {
-
-				this.vertices[ this.faces[f].d ].normal.addSelf( normal );
-
-			}
-
-		}
-
-	};
-
 };
 };

+ 14 - 8
src/scenes/Scene.js

@@ -5,27 +5,33 @@
 THREE.Scene = function () {
 THREE.Scene = function () {
 
 
 	this.objects = [];
 	this.objects = [];
+	// this.lights = [];
 
 
-	this.add = function (object) {
+	this.addObject = function ( object ) {
 
 
 		this.objects.push(object);
 		this.objects.push(object);
 
 
 	};
 	};
 
 
-	/*
-	this.remove = function (object) {
+	this.removeObject = function ( object ) {
 
 
-		var nrObjects = this.objects.length;
+		for ( var i = 0, l = this.objects.length; i < l; i++ ) {
 
 
-		for(var i = 0; i < nrObjects; i++) {
+			if ( object == this.objects[ i ] ) {
 
 
-			if(object == this.objects[i]) {
+				this.objects.splice( i, 1 );
+				return;
 
 
-				alert("yay");
 			}
 			}
 		}
 		}
 	}
 	}
-	*/
+
+	// Deprecated
+	this.add = function ( object ) {
+
+		this.addObject( object );
+
+	};
 
 
 	this.toString = function () {
 	this.toString = function () {
 
 

+ 1 - 1
utils/deployer.py

@@ -3,7 +3,7 @@ import os
 
 
 # MERGER
 # MERGER
 
 
-rev = 10;
+rev = 11;
 
 
 files = [];
 files = [];
 files.append('Three.js');
 files.append('Three.js');

+ 3 - 3
utils/export_threejs.py

@@ -1,5 +1,5 @@
-__author__ = "Mr.doob"
-__url__ = ("http://mrdoob.com")
+__author__ = "Mr.doob, Kikko"
+__url__ = ['http://mrdoob.com', 'http://github.com/kikko']
 __version__ = "1"
 __version__ = "1"
 __bpydoc__ = """\
 __bpydoc__ = """\
 This script exports the selected object for the three.js engine.
 This script exports the selected object for the three.js engine.
@@ -209,4 +209,4 @@ def unregister():
     bpy.types.INFO_MT_file_export.remove(menu_func)
     bpy.types.INFO_MT_file_export.remove(menu_func)
 
 
 if __name__ == "__main__":
 if __name__ == "__main__":
-    register()
+    register()

Some files were not shown because too many files changed in this diff