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

Removed all the toString methods (saving 6kbytes)

I don't remember when was the last time I used them. Current Web Developer Tools do this already for you.

Color::updateRGBA ⟶ Color::updateRGB
上级 a325cd60
......@@ -134,7 +134,7 @@ This code creates a camera, then creates a scene object, adds a bunch of random
### Change Log ###
2011 02 26 - **r33** (190.451 KB, gzip: 46.278 KB)
2011 02 26 - **r33** (184.605 KB, gzip: 45.481 KB)
* Added `ParticleSystem` object to `WebGLRenderer` ([alteredq](http://github.com/alteredq))
* Added `Line` support to `WebGLRenderer` ([alteredq](http://github.com/alteredq))
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -38,7 +38,7 @@ var Torus=function(a,d,b,f){this.radius=a||100;this.tube=d||40;this.segmentsR=b|
var Icosahedron=function(a){function d(v,q,n){var p=Math.sqrt(v*v+q*q+n*n);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(v/p,q/p,n/p)))-1}function b(v,q,n,p){p.faces.push(new THREE.Face3(v,q,n))}function f(v,q){var n=g.vertices[v].position,p=g.vertices[q].position;return d((n.x+p.x)/2,(n.y+p.y)/2,(n.z+p.z)/2)}var g=this,c=new THREE.Geometry,e;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;d(-1,a,0);d(1,a,0);d(-1,-a,0);d(1,-a,0);d(0,-1,a);d(0,1,a);d(0,-1,-a);d(0,
1,-a);d(a,0,-1);d(a,0,1);d(-a,0,-1);d(-a,0,1);b(0,11,5,c);b(0,5,1,c);b(0,1,7,c);b(0,7,10,c);b(0,10,11,c);b(1,5,9,c);b(5,11,4,c);b(11,10,2,c);b(10,7,6,c);b(7,1,8,c);b(3,9,4,c);b(3,4,2,c);b(3,2,6,c);b(3,6,8,c);b(3,8,9,c);b(4,9,5,c);b(2,4,11,c);b(6,2,10,c);b(8,6,7,c);b(9,8,1,c);for(a=0;a<this.subdivisions;a++){e=new THREE.Geometry;for(var h in c.faces){var j=f(c.faces[h].a,c.faces[h].b),l=f(c.faces[h].b,c.faces[h].c),m=f(c.faces[h].c,c.faces[h].a);b(c.faces[h].a,j,m,e);b(c.faces[h].b,l,j,e);b(c.faces[h].c,
m,l,e);b(j,l,m,e)}c.faces=e.faces}g.faces=c.faces;delete c;delete e;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
function LathedObject(a,d,b){THREE.Geometry.call(this);b=b||2*Math.PI;d=b/(d||12);for(var f=[],g=[],c=[],e=[],h=0;h<a.length;h++){this.vertices.push(new THREE.Vertex(a[h]));g[h]=this.vertices.length-1;f[h]=new THREE.Vector3(a[h].x,a[h].y,a[h].z)}for(var j=THREE.Matrix4.rotationZMatrix(d),l=0;l<=b+0.0010;l+=d){for(h=0;h<f.length;h++)if(l<b){f[h]=j.multiplyVector3(f[h].clone());this.vertices.push(new THREE.Vertex(f[h]));c[h]=this.vertices.length-1}else c=e;l==0&&(e=g);for(h=0;h<g.length-1;h++){this.faces.push(new THREE.Face4(c[h],
function LathedObject(a,d,b){THREE.Geometry.call(this);b=b||2*Math.PI;d=b/(d||12);for(var f=[],g=[],c=[],e=[],h=0;h<a.length;h++){this.vertices.push(new THREE.Vertex(a[h]));g[h]=this.vertices.length-1;f[h]=new THREE.Vector3(a[h].x,a[h].y,a[h].z)}for(var j=THREE.Matrix4.rotationZMatrix(d),l=0;l<=b+0.001;l+=d){for(h=0;h<f.length;h++)if(l<b){f[h]=j.multiplyVector3(f[h].clone());this.vertices.push(new THREE.Vertex(f[h]));c[h]=this.vertices.length-1}else c=e;l==0&&(e=g);for(h=0;h<g.length-1;h++){this.faces.push(new THREE.Face4(c[h],
c[h+1],g[h+1],g[h]));this.uvs.push([new THREE.UV(l/b,h/a.length),new THREE.UV(l/b,(h+1)/a.length),new THREE.UV((l-d)/b,(h+1)/a.length),new THREE.UV((l-d)/b,h/a.length)])}g=c;c=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
THREE.MarchingCubes=function(a,d){THREE.Object3D.call(this);this.materials=d instanceof Array?d:[d];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,f,g){return b+(f-b)*g};this.VIntX=function(b,f,g,c,e,h,j,l,m,v){e=(e-m)/(v-m);m=this.normal_cache;f[c]=h+e*this.delta;f[c+1]=j;f[c+2]=l;g[c]=this.lerp(m[b],m[b+3],e);g[c+1]=this.lerp(m[b+1],m[b+4],e);g[c+2]=this.lerp(m[b+2],m[b+5],e)};this.VIntY=function(b,f,g,c,e,h,j,l,m,v){e=(e-m)/(v-m);m=this.normal_cache;f[c]=h;f[c+1]=j+e*this.delta;f[c+
......
此差异已折叠。
此差异已折叠。
......@@ -3,96 +3,96 @@
*/
THREE.AnimationHandler = (function() {
var playing = [];
var that = {};
//--- update ---
that.update = function( time ) {
for( var i = 0; i < playing.length; i++ )
playing[ i ].update( time );
};
//--- add ---
that.add = function( animation ) {
if( playing.indexOf( animation ) === -1 )
playing.push( animation );
};
//--- remove ---
that.remove = function( animation ) {
var index = playing.indexOf( animation );
var index = playing.indexOf( animation );
if( index !== -1 )
playing.splice( childIndex, 1 );
};
//--- init data ---
that.initData = function( data ) {
if( data.initialized === true )
return;
// loop through all keys
// loop through all keys
for( var h = 0; h < data.hierarchy.length; h++ ) {
for( var k = 0; k < data.hierarchy[ h ].keys.length; k++ ) {
// remove minus times
if( data.hierarchy[ h ].keys[ k ].time < 0 )
data.hierarchy[ h ].keys[ k ].time = 0;
// set index
data.hierarchy[ h ].keys[ k ].index = k;
// create quaternions
if( data.hierarchy[ h ].keys[ k ].rot !== undefined &&
!( data.hierarchy[ h ].keys[ k ].rot instanceof THREE.Quaternion ) ) {
var quat = data.hierarchy[ h ].keys[ k ].rot;
data.hierarchy[ h ].keys[ k ].rot = new THREE.Quaternion( quat[0], quat[1], quat[2], quat[3] );
data.hierarchy[ h ].keys[ k ].rot = new THREE.Quaternion( quat[0], quat[1], quat[2], quat[3] );
}
}
}
}
// JIT
var lengthInFrames = parseInt( data.length * data.fps, 10 );
data.JIT = {};
data.JIT.hierarchy = [];
for( var h = 0; h < data.hierarchy.length; h++ )
data.JIT.hierarchy.push( new Array( lengthInFrames ));
// done
data.initialized = true;
};
return that;
}());
......@@ -5,52 +5,56 @@
*/
function bind( scope, fn ) {
return function () {
fn.apply( scope, arguments );
};
}
THREE.QuakeCamera = function ( parameters ) {
THREE.Camera.call( this, parameters.fov, parameters.aspect, parameters.near, parameters.far, parameters.target );
this.movement_speed = 1.0;
this.look_speed = 0.005;
this.nofly = false;
this.look_vertical = true;
this.domElement = document;
if ( parameters ) {
if ( parameters.movement_speed !== undefined ) this.movement_speed = parameters.movement_speed;
if ( parameters.look_speed !== undefined ) this.look_speed = parameters.look_speed;
if ( parameters.nofly !== undefined ) this.nofly = parameters.nofly;
if ( parameters.look_vertical !== undefined ) this.look_vertical = parameters.look_vertical;
if ( parameters.domElement !== undefined ) this.domElement = parameters.domElement;
}
}
this.mouseX = 0;
this.mouseY = 0;
this.lat = 0;
this.lon = 0;
this.phy = 0;
this.theta = 0;
this.moveForward = false;
this.moveBackward = false;
this.moveLeft = false;
this.moveRight = false;
this.windowHalfX = window.innerWidth / 2;
this.windowHalfY = window.innerHeight / 2;
this.onMouseDown = function ( event ) {
event.preventDefault();
event.stopPropagation();
......@@ -83,7 +87,7 @@ THREE.QuakeCamera = function ( parameters ) {
this.mouseY = event.clientY - this.windowHalfY;
};
this.onKeyDown = function ( event ) {
switch( event.keyCode ) {
......@@ -123,13 +127,13 @@ THREE.QuakeCamera = function ( parameters ) {
}
};
this.update = function() {
if ( this.moveForward ) this.translateZ( - this.movement_speed, this.nofly );
if ( this.moveBackward ) this.translateZ( this.movement_speed, this.nofly );
if ( this.moveLeft ) this.translateX( - this.movement_speed, this.nofly );
if ( this.moveRight ) this.translateX( this.movement_speed, this.nofly );
if ( this.moveForward ) this.translateZ( - this.movement_speed, this.nofly );
if ( this.moveBackward ) this.translateZ( this.movement_speed, this.nofly );
if ( this.moveLeft ) this.translateX( - this.movement_speed, this.nofly );
if ( this.moveRight ) this.translateX( this.movement_speed, this.nofly );
this.lon += this.mouseX * this.look_speed;
if( this.look_vertical ) this.lat -= this.mouseY * this.look_speed;
......@@ -140,7 +144,7 @@ THREE.QuakeCamera = function ( parameters ) {
var target_position = this.target.position,
position = this.position;
target_position.x = position.x + 100 * Math.sin( this.phi ) * Math.cos( this.theta );
target_position.y = position.y + 100 * Math.cos( this.phi );
target_position.z = position.z + 100 * Math.sin( this.phi ) * Math.sin( this.theta );
......@@ -148,18 +152,18 @@ THREE.QuakeCamera = function ( parameters ) {
this.supr.update.call( this );
};
this.domElement.addEventListener( 'contextmenu', function ( event ) { event.preventDefault(); }, false );
this.domElement.addEventListener( 'mousemove', bind( this, this.onMouseMove ), false );
this.domElement.addEventListener( 'mousedown', bind( this, this.onMouseDown ), false );
this.domElement.addEventListener( 'mouseup', bind( this, this.onMouseUp ), false );
this.domElement.addEventListener( 'keydown', bind( this, this.onKeyDown ), false );
this.domElement.addEventListener( 'keyup', bind( this, this.onKeyUp ), false );
};
THREE.QuakeCamera.prototype = new THREE.Camera();
THREE.QuakeCamera.prototype = new THREE.Camera();
THREE.QuakeCamera.prototype.constructor = THREE.QuakeCamera;
THREE.QuakeCamera.prototype.supr = THREE.Camera.prototype;
THREE.QuakeCamera.prototype.supr = THREE.Camera.prototype;
......@@ -79,7 +79,7 @@ THREE.Color.prototype = {
if ( this.autoUpdate ) {
this.updateRGBA();
this.updateRGB();
this.updateStyleString();
}
......@@ -92,7 +92,7 @@ THREE.Color.prototype = {
},
updateRGBA : function () {
updateRGB : function () {
this.r = ( this.hex >> 16 & 255 ) / 255;
this.g = ( this.hex >> 8 & 255 ) / 255;
......@@ -110,12 +110,6 @@ THREE.Color.prototype = {
return new THREE.Color( this.hex );
},
toString : function () {
return 'THREE.Color ( r: ' + this.r + ', g: ' + this.g + ', b: ' + this.b + ', hex: ' + this.hex + ' )';
}
};
......@@ -15,13 +15,3 @@ THREE.Face3 = function ( a, b, c, normal, materials ) {
this.materials = materials instanceof Array ? materials : [ materials ];
};
THREE.Face3.prototype = {
toString : function () {
return 'THREE.Face3 ( ' + this.a + ', ' + this.b + ', ' + this.c + ' )';
}
};
......@@ -16,14 +16,3 @@ THREE.Face4 = function ( a, b, c, d, normal, materials ) {
this.materials = materials instanceof Array ? materials : [ materials ];
};
THREE.Face4.prototype = {
toString : function () {
return 'THREE.Face4 ( ' + this.a + ', ' + this.b + ', ' + this.c + ' ' + this.d + ' )';
}
};
......@@ -465,12 +465,6 @@ THREE.Geometry.prototype = {
}
},
toString: function () {
return 'THREE.Geometry ( vertices: ' + this.vertices + ', faces: ' + this.faces + ', uvs: ' + this.uvs + ' )';
}
};
......
......@@ -17,7 +17,7 @@ THREE.Matrix3.prototype = {
return this;
},
transposeIntoArray: function ( r ) {
var m = this.m;
......@@ -31,7 +31,7 @@ THREE.Matrix3.prototype = {
r[ 6 ] = m[ 2 ];
r[ 7 ] = m[ 5 ];
r[ 8 ] = m[ 8 ];
return this;
}
......
......@@ -346,11 +346,11 @@ THREE.Matrix4.prototype = {
transpose: function () {
var tmp;
tmp = this.n21; this.n21 = this.n12; this.n12 = tmp;
tmp = this.n31; this.n31 = this.n13; this.n13 = tmp;
tmp = this.n32; this.n32 = this.n23; this.n23 = tmp;
tmp = this.n41; this.n41 = this.n14; this.n14 = tmp;
tmp = this.n42; this.n42 = this.n24; this.n24 = tmp;
tmp = this.n43; this.n43 = this.n34; this.n43 = tmp;
......@@ -585,15 +585,6 @@ THREE.Matrix4.prototype = {
return this;
},
toString : function() {
return "| " + this.n11 + " " + this.n12 + " " + this.n13 + " " + this.n14 + " |\n" +
"| " + this.n21 + " " + this.n22 + " " + this.n23 + " " + this.n24 + " |\n" +
"| " + this.n31 + " " + this.n32 + " " + this.n33 + " " + this.n34 + " |\n" +
"| " + this.n41 + " " + this.n42 + " " + this.n43 + " " + this.n44 + " |";
}
};
......
......@@ -197,10 +197,4 @@ THREE.Rectangle = function () {
};
this.toString = function () {
return "THREE.Rectangle ( left: " + _left + ", right: " + _right + ", top: " + _top + ", bottom: " + _bottom + ", width: " + _width + ", height: " + _height + " )";
};
};
......@@ -35,12 +35,6 @@ THREE.UV.prototype = {
return this;
},
toString : function () {
return 'THREE.UV (' + this.u + ', ' + this.v + ')';
}
};
......@@ -140,12 +140,6 @@ THREE.Vector2.prototype = {
return new THREE.Vector2( this.x, this.y );
},
toString : function () {
return 'THREE.Vector2 (' + this.x + ', ' + this.y + ')';
}
};
......@@ -297,12 +297,6 @@ THREE.Vector3.prototype = {
return new THREE.Vector3( this.x, this.y, this.z );
},
toString : function () {
return 'THREE.Vector3 ( ' + this.x + ', ' + this.y + ', ' + this.z + ' )';
}
};
......@@ -152,12 +152,6 @@ THREE.Vector4.prototype = {
return new THREE.Vector4( this.x, this.y, this.z, this.w );
},
toString : function () {
return 'THREE.Vector4 (' + this.x + ', ' + this.y + ', ' + this.z + ', ' + this.w + ')';
}
};
......@@ -17,12 +17,3 @@ THREE.Vertex = function ( position, normal ) {
this.__visible = true;
};
THREE.Vertex.prototype = {
toString : function () {
return 'THREE.Vertex ( position: ' + this.position + ', normal: ' + this.normal + ' )';
}
};
......@@ -20,58 +20,33 @@
THREE.LineBasicMaterial = function ( parameters ) {
this.id = THREE.MaterialCounter.value ++;
this.color = new THREE.Color( 0xffffff );
this.opacity = 1.0;
this.blending = THREE.NormalBlending;
this.depth_test = true;
this.linewidth = 1.0;
this.linecap = 'round'; // implemented just in CanvasRenderer
this.linejoin = 'round'; // implemented just in CanvasRenderer
this.linecap = 'round'; // implemented just in CanvasRenderer
this.linejoin = 'round'; // implemented just in CanvasRenderer
this.vertex_colors = false;
if ( parameters ) {
if ( parameters.color !== undefined ) this.color.setHex( parameters.color );
if ( parameters.opacity !== undefined ) this.opacity = parameters.opacity;
if ( parameters.blending !== undefined ) this.blending = parameters.blending;
if ( parameters.depth_test !== undefined ) this.depth_test = parameters.depth_test;
if ( parameters.linewidth !== undefined ) this.linewidth = parameters.linewidth;
if ( parameters.linecap !== undefined ) this.linecap = parameters.linecap;
if ( parameters.linejoin !== undefined ) this.linejoin = parameters.linejoin;
if ( parameters.vertex_colors !== undefined ) this.vertex_colors = parameters.vertex_colors;
}
};
THREE.LineBasicMaterial.prototype = {
toString: function () {
return 'THREE.LineBasicMaterial (<br/>' +
'id: ' + this.id + '<br/>' +
'color: ' + this.color + '<br/>' +
'opacity: ' + this.opacity + '<br/>' +
'blending: ' + this.blending + '<br/>' +
'depth_test: ' + this.depth_test + '<br/>' +
'linewidth: ' + this.linewidth +'<br/>' +
'linecap: ' + this.linecap +'<br/>' +
'linejoin: ' + this.linejoin +'<br/>' +
'vertex_colors: ' + this.vertex_colors + '<br/>' +
')';
if ( parameters.vertex_colors !== undefined ) this.vertex_colors = parameters.vertex_colors;
}
};
......@@ -49,12 +49,12 @@ THREE.MeshBasicMaterial = function ( parameters ) {
this.wireframe = false;
this.wireframe_linewidth = 1.0;
this.wireframe_linecap = 'round'; // implemented just in CanvasRenderer
this.wireframe_linejoin = 'round'; // implemented just in CanvasRenderer
this.wireframe_linecap = 'round'; // implemented just in CanvasRenderer
this.wireframe_linejoin = 'round'; // implemented just in CanvasRenderer
this.vertex_colors = false;
this.skinning = false;
if ( parameters ) {
if ( parameters.color !== undefined ) this.color.setHex( parameters.color );
......@@ -78,44 +78,10 @@ THREE.MeshBasicMaterial = function ( parameters ) {
if ( parameters.wireframe_linewidth !== undefined ) this.wireframe_linewidth = parameters.wireframe_linewidth;
if ( parameters.wireframe_linecap !== undefined ) this.wireframe_linecap = parameters.wireframe_linecap;
if ( parameters.wireframe_linejoin !== undefined ) this.wireframe_linejoin = parameters.wireframe_linejoin;
if ( parameters.vertex_colors !== undefined ) this.vertex_colors = parameters.vertex_colors;
if ( parameters.skinning !== undefined ) this.skinning = parameters.skinning;
}
};
THREE.MeshBasicMaterial.prototype = {
toString: function () {
return 'THREE.MeshBasicMaterial (<br/>' +
'id: ' + this.id + '<br/>' +
'color: ' + this.color + '<br/>' +
'opacity: ' + this.opacity + '<br/>' +
'map: ' + this.map + '<br/>' +
'light_map: ' + this.light_map + '<br/>' +
'env_map: ' + this.env_map + '<br/>' +
'combine: ' + this.combine + '<br/>' +
'reflectivity: ' + this.reflectivity + '<br/>' +
'refraction_ratio: ' + this.refraction_ratio + '<br/>' +
'blending: ' + this.blending + '<br/>' +
'depth_test: ' + this.depth_test + '<br/>' +
'wireframe: ' + this.wireframe + '<br/>' +
'wireframe_linewidth: ' + this.wireframe_linewidth +'<br/>' +
'wireframe_linecap: ' + this.wireframe_linecap +'<br/>' +
'wireframe_linejoin: ' + this.wireframe_linejoin +'<br/>' +
'vertex_colors: ' + this.vertex_colors + '<br/>' +
'skinning: ' + this.skinning + '<br/>' +
')';
}
};
......@@ -16,45 +16,26 @@
THREE.MeshDepthMaterial = function ( parameters ) {
this.id = THREE.MaterialCounter.value ++;
this.opacity = 1.0;
this.shading = THREE.SmoothShading; // doesn't really apply here, normals are not used
this.blending = THREE.NormalBlending;
this.depth_test = true;
this.wireframe = false;
this.wireframe_linewidth = 1.0;
if ( parameters ) {
if ( parameters.opacity !== undefined ) this.opacity = parameters.opacity;
if ( parameters.shading !== undefined ) this.shading = parameters.shading;
if ( parameters.blending !== undefined ) this.blending = parameters.blending;
if ( parameters.depth_test !== undefined ) this.depth_test = parameters.depth_test;
if ( parameters.wireframe !== undefined ) this.wireframe = parameters.wireframe;
if ( parameters.wireframe_linewidth !== undefined ) this.wireframe_linewidth = parameters.wireframe_linewidth;
}
};
THREE.MeshDepthMaterial.prototype = {
toString: function () {
return 'THREE.MeshDepthMaterial (<br/>' +
'id: ' + this.id + '<br/>' +
'opacity: ' + this.opacity + '<br/>' +
'blending: ' + this.blending + '<br/>' +
'depth_test: ' + this.depth_test + '<br/>' +
'wireframe: ' + this.wireframe + '<br/>' +
'wireframe_linewidth: ' + this.wireframe_linewidth + '<br/>' +
')';
}
......
......@@ -5,13 +5,3 @@
THREE.MeshFaceMaterial = function () {
};
THREE.MeshFaceMaterial.prototype = {
toString: function () {
return 'THREE.MeshFaceMaterial';
}
};
......@@ -35,7 +35,7 @@ THREE.MeshLambertMaterial = function ( parameters ) {
this.map = null;
this.light_map = null;
this.env_map = null;
this.combine = THREE.MultiplyOperation;
this.reflectivity = 1.0;
......@@ -49,12 +49,12 @@ THREE.MeshLambertMaterial = function ( parameters ) {
this.wireframe = false;
this.wireframe_linewidth = 1.0;
this.wireframe_linecap = 'round'; // implemented just in CanvasRenderer
this.wireframe_linejoin = 'round'; // implemented just in CanvasRenderer
this.wireframe_linecap = 'round'; // implemented just in CanvasRenderer
this.wireframe_linejoin = 'round'; // implemented just in CanvasRenderer
this.vertex_colors = false;
this.skinning = false;
if ( parameters ) {
if ( parameters.color !== undefined ) this.color.setHex( parameters.color );
......@@ -62,7 +62,7 @@ THREE.MeshLambertMaterial = function ( parameters ) {
if ( parameters.map !== undefined ) this.map = parameters.map;
if ( parameters.light_map !== undefined ) this.light_map = parameters.light_map;
if ( parameters.env_map !== undefined ) this.env_map = parameters.env_map;
if ( parameters.combine !== undefined ) this.combine = parameters.combine;
if ( parameters.reflectivity !== undefined ) this.reflectivity = parameters.reflectivity;
......@@ -73,7 +73,7 @@ THREE.MeshLambertMaterial = function ( parameters ) {
if ( parameters.shading !== undefined ) this.shading = parameters.shading;
if ( parameters.blending !== undefined ) this.blending = parameters.blending;
if ( parameters.depth_test !== undefined ) this.depth_test = parameters.depth_test;
if ( parameters.wireframe !== undefined ) this.wireframe = parameters.wireframe;
if ( parameters.wireframe_linewidth !== undefined ) this.wireframe_linewidth = parameters.wireframe_linewidth;
if ( parameters.wireframe_linecap !== undefined ) this.wireframe_linecap = parameters.wireframe_linecap;
......@@ -81,43 +81,7 @@ THREE.MeshLambertMaterial = function ( parameters ) {
if ( parameters.vertex_colors !== undefined ) this.vertex_colors = parameters.vertex_colors;
if ( parameters.skinning !== undefined ) this.skinning = parameters.skinning;
}
};
THREE.MeshLambertMaterial.prototype = {
toString: function () {
return 'THREE.MeshLambertMaterial (<br/>' +
'id: ' + this.id + '<br/>' +
'color: ' + this.color + '<br/>' +
'opacity: ' + this.opacity + '<br/>' +
'map: ' + this.map + '<br/>' +
'light_map: ' + this.light_map + '<br/>' +
'env_map: ' + this.env_map + '<br/>' +
'combine: ' + this.combine + '<br/>' +
'reflectivity: ' + this.reflectivity + '<br/>' +
'refraction_ratio: ' + this.refraction_ratio + '<br/>' +
'shading: ' + this.shading + '<br/>' +
'blending: ' + this.blending + '<br/>' +
'depth_test: ' + this.depth_test + '<br/>' +
'wireframe: ' + this.wireframe + '<br/>' +
'wireframe_linewidth: ' + this.wireframe_linewidth +'<br/>' +
'wireframe_linecap: ' + this.wireframe_linecap +'<br/>' +
'wireframe_linejoin: ' + this.wireframe_linejoin +'<br/>' +
'vertex_colors: ' + this.vertex_colors + '<br/>' +
'skinning: ' + this.skinning + '<br/>' +
' )';
}
};
......@@ -16,47 +16,27 @@
THREE.MeshNormalMaterial = function ( parameters ) {
this.id = THREE.MaterialCounter.value ++;
this.opacity = 1.0;
this.shading = THREE.FlatShading;
this.blending = THREE.NormalBlending;
this.depth_test = true;
this.wireframe = false;
this.wireframe_linewidth = 1.0;
if ( parameters ) {
if ( parameters.opacity !== undefined ) this.opacity = parameters.opacity;
if ( parameters.shading !== undefined ) this.shading = parameters.shading;
if ( parameters.blending !== undefined ) this.blending = parameters.blending;
if ( parameters.depth_test !== undefined ) this.depth_test = parameters.depth_test;
if ( parameters.wireframe !== undefined ) this.wireframe = parameters.wireframe;
if ( parameters.wireframe_linewidth !== undefined ) this.wireframe_linewidth = parameters.wireframe_linewidth;
}
};
THREE.MeshNormalMaterial.prototype = {
toString: function () {
return 'THREE.MeshNormalMaterial (<br/>' +
'id: ' + this.id + '<br/>' +
'opacity: ' + this.opacity + '<br/>' +
'blending: ' + this.blending + '<br/>' +
'depth_test: ' + this.depth_test + '<br/>' +
'wireframe: ' + this.wireframe + '<br/>' +
'wireframe_linewidth: ' + this.wireframe_linewidth + '<br/>' +
')';
}
};
......@@ -43,7 +43,7 @@ THREE.MeshPhongMaterial = function ( parameters ) {
this.map = null;
this.light_map = null;
this.env_map = null;
this.combine = THREE.MultiplyOperation;
this.reflectivity = 1.0;
......@@ -54,12 +54,12 @@ THREE.MeshPhongMaterial = function ( parameters ) {
this.shading = THREE.SmoothShading;
this.blending = THREE.NormalBlending;
this.depth_test = true;
this.wireframe = false;
this.wireframe_linewidth = 1.0;
this.wireframe_linecap = 'round'; // implemented just in CanvasRenderer
this.wireframe_linejoin = 'round'; // implemented just in CanvasRenderer
this.wireframe_linecap = 'round'; // implemented just in CanvasRenderer
this.wireframe_linejoin = 'round'; // implemented just in CanvasRenderer
this.vertex_colors = false;
this.skinning = false;
......@@ -72,7 +72,7 @@ THREE.MeshPhongMaterial = function ( parameters ) {
if ( parameters.opacity !== undefined ) this.opacity = parameters.opacity;
if ( parameters.light_map !== undefined ) this.light_map = parameters.light_map;
if ( parameters.map !== undefined ) this.map = parameters.map;
if ( parameters.env_map !== undefined ) this.env_map = parameters.env_map;
......@@ -90,48 +90,10 @@ THREE.MeshPhongMaterial = function ( parameters ) {
if ( parameters.wireframe_linewidth !== undefined ) this.wireframe_linewidth = parameters.wireframe_linewidth;
if ( parameters.wireframe_linecap !== undefined ) this.wireframe_linecap = parameters.wireframe_linecap;
if ( parameters.wireframe_linejoin !== undefined ) this.wireframe_linejoin = parameters.wireframe_linejoin;
if ( parameters.vertex_colors !== undefined ) this.vertex_colors = parameters.vertex_colors;
if ( parameters.skinning !== undefined ) this.skinning = parameters.skinning;
}
};
THREE.MeshPhongMaterial.prototype = {
toString: function () {
return 'THREE.MeshPhongMaterial (<br/>' +
'id: ' + this.id + '<br/>' +
'color: ' + this.color + '<br/>' +
'ambient: ' + this.ambient + '<br/>' +
'specular: ' + this.specular + '<br/>' +
'shininess: ' + this.shininess + '<br/>' +
'opacity: ' + this.opacity + '<br/>' +
'map: ' + this.map + '<br/>' +
'env_map: ' + this.env_map + '<br/>' +
'combine: ' + this.combine + '<br/>' +
'reflectivity: ' + this.reflectivity + '<br/>' +
'refraction_ratio: ' + this.refraction_ratio + '<br/>' +
'shading: ' + this.shading + '<br/>' +
'blending: ' + this.blending + '<br/>' +
'depth_test: ' + this.depth_test + '<br/>' +
'wireframe: ' + this.wireframe + '<br/>' +
'wireframe_linewidth: ' + this.wireframe_linewidth + '<br/>' +
'wireframe_linecap: ' + this.wireframe_linecap +'<br/>' +
'wireframe_linejoin: ' + this.wireframe_linejoin +'<br/>' +
'vertex_colors: ' + this.vertex_colors + '<br/>' +
'skinning: ' + this.skinning + '<br/>' +
')';
}
};
......@@ -28,7 +28,7 @@ THREE.MeshShaderMaterial = function ( parameters ) {
this.uniforms = {};
this.opacity = 1.0; // set to < 1.0 to renderer in transparent batch
this.shading = THREE.SmoothShading;
this.blending = THREE.NormalBlending;
this.depth_test = true;
......@@ -49,7 +49,7 @@ THREE.MeshShaderMaterial = function ( parameters ) {
if ( parameters.uniforms !== undefined ) this.uniforms = parameters.uniforms;
if ( parameters.opacity !== undefined ) this.opacity = parameters.opacity;
if ( parameters.shading !== undefined ) this.shading = parameters.shading;
if ( parameters.blending !== undefined ) this.blending = parameters.blending;
if ( parameters.depth_test !== undefined ) this.depth_test = parameters.depth_test;
......@@ -58,34 +58,10 @@ THREE.MeshShaderMaterial = function ( parameters ) {
if ( parameters.wireframe_linewidth !== undefined ) this.wireframe_linewidth = parameters.wireframe_linewidth;
if ( parameters.wireframe_linecap !== undefined ) this.wireframe_linecap = parameters.wireframe_linecap;
if ( parameters.wireframe_linejoin !== undefined ) this.wireframe_linejoin = parameters.wireframe_linejoin;
if ( parameters.vertex_colors !== undefined ) this.vertex_colors = parameters.vertex_colors;
if ( parameters.skinning !== undefined ) this.skinning = parameters.skinning;
}
};
THREE.MeshShaderMaterial.prototype = {
toString: function () {
return 'THREE.MeshShaderMaterial (<br/>' +
'id: ' + this.id + '<br/>' +
'blending: ' + this.blending + '<br/>' +
'depth_test: ' + this.depth_test + '<br/>' +
'wireframe: ' + this.wireframe + '<br/>' +
'wireframe_linewidth: ' + this.wireframe_linewidth +'<br/>' +
'wireframe_linecap: ' + this.wireframe_linecap +'<br/>' +
'wireframe_linejoin: ' + this.wireframe_linejoin +'<br/>' +
'vertex_colors: ' + this.vertex_colors + '<br/>' +
'skinning: ' + this.skinning + '<br/>' +
')';
}
};
......@@ -19,13 +19,13 @@
THREE.ParticleBasicMaterial = function ( parameters ) {
this.id = THREE.MaterialCounter.value ++;
this.color = new THREE.Color( 0xffffff );
this.opacity = 1.0;
this.map = null;
this.size = 1.0;
this.blending = THREE.NormalBlending;
this.depth_test = true;
......@@ -38,38 +38,14 @@ THREE.ParticleBasicMaterial = function ( parameters ) {
if ( parameters.color !== undefined ) this.color.setHex( parameters.color );
if ( parameters.opacity !== undefined ) this.opacity = parameters.opacity;
if ( parameters.map !== undefined ) this.map = parameters.map;
if ( parameters.size !== undefined ) this.size = parameters.size;
if ( parameters.blending !== undefined ) this.blending = parameters.blending;
if ( parameters.depth_test !== undefined ) this.depth_test = parameters.depth_test;
if ( parameters.vertex_colors !== undefined ) this.vertex_colors = parameters.vertex_colors;
}
};
THREE.ParticleBasicMaterial.prototype = {
toString: function () {
return 'THREE.ParticleBasicMaterial (<br/>' +
'id: ' + this.id + '<br/>' +
'color: ' + this.color + '<br/>' +
'opacity: ' + this.opacity + '<br/>' +
'map: ' + this.map + '<br/>' +
'size: ' + this.size + '<br/>' +
'blending: ' + this.blending + '<br/>' +
'depth_test: ' + this.depth_test + '<br/>' +
'vertex_colors: ' + this.vertex_colors + '<br/>' +
')';
if ( parameters.vertex_colors !== undefined ) this.vertex_colors = parameters.vertex_colors;
}
};
......@@ -11,7 +11,7 @@
THREE.ParticleCircleMaterial = function ( parameters ) {
this.id = THREE.MaterialCounter.value ++;
this.color = new THREE.Color( 0xffffff );
this.opacity = 1;
this.blending = THREE.NormalBlending;
......@@ -25,17 +25,3 @@ THREE.ParticleCircleMaterial = function ( parameters ) {
}
};
THREE.ParticleCircleMaterial.prototype = {
toString: function () {
return 'THREE.ParticleCircleMaterial (<br/>' +
'color: ' + this.color + '<br/>' +
'opacity: ' + this.opacity + '<br/>' +
'blending: ' + this.blending + '<br/>' +
')';
}
};
......@@ -5,18 +5,7 @@
THREE.ParticleDOMMaterial = function ( domElement ) {
this.id = THREE.MaterialCounter.value ++;
this.domElement = domElement;
};
THREE.ParticleDOMMaterial.prototype = {
toString: function () {
return 'THREE.ParticleDOMMaterial ( domElement: ' + this.domElement + ' )';
}
this.domElement = domElement;
};
......@@ -15,7 +15,7 @@ THREE.Texture = function ( image, mapping, wrap_s, wrap_t, mag_filter, min_filte
this.mag_filter = mag_filter !== undefined ? mag_filter : THREE.LinearFilter;
this.min_filter = min_filter !== undefined ? min_filter : THREE.LinearMipMapLinearFilter;
this.needsUpdate = false;
};
......@@ -26,18 +26,6 @@ THREE.Texture.prototype = {
return new THREE.Texture( this.image, this.mapping, this.wrap_s, this.wrap_t, this.mag_filter, this.min_filter );
},
toString: function () {
return 'THREE.Texture (<br/>' +
'image: ' + this.image + '<br/>' +
'wrap_s: ' + this.wrap_s + '<br/>' +
'wrap_t: ' + this.wrap_t + '<br/>' +
'mag_filter: ' + this.mag_filter + '<br/>' +
'min_filter: ' + this.min_filter + '<br/>' +
')';
}
};
......
......@@ -31,25 +31,25 @@ var Uniforms = {
return uniforms_dst;
},
merge: function( uniforms ) {
var u, p, tmp, merged = {};
for( u = 0; u < uniforms.length; u++ ) {
tmp = this.clone( uniforms[ u ] );
for ( p in tmp ) {
merged[ p ] = tmp[ p ];
}
}
return merged;
}
};
文件模式从 100644 更改为 100755
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册