提交 4d0fdbb1 编写于 作者: M Mr.doob

- Scene.add > Scene.addObject

- Enabled Scene.removeObject
- Removed computeNormals() from Geometry
上级 fbad38c7
......@@ -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_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/)
[![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/)
......@@ -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.y = 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 ###
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)
* Changed Camera system. (Thx [Paul Brunt](http://github.com/supereggbert))
......
此差异已折叠。
......@@ -9,50 +9,4 @@ THREE.Geometry = function () {
this.faces = [];
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 );
}
}
};
};
......@@ -5,27 +5,33 @@
THREE.Scene = function () {
this.objects = [];
// this.lights = [];
this.add = function (object) {
this.addObject = function ( 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 () {
......
......@@ -3,7 +3,7 @@ import os
# MERGER
rev = 10;
rev = 11;
files = [];
files.append('Three.js');
......
__author__ = "Mr.doob"
__url__ = ("http://mrdoob.com")
__author__ = "Mr.doob, Kikko"
__url__ = ['http://mrdoob.com', 'http://github.com/kikko']
__version__ = "1"
__bpydoc__ = """\
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)
if __name__ == "__main__":
register()
\ No newline at end of file
register()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册