提交 8f29cf03 编写于 作者: A alteredq

Prettified formatting of new Matrix4 set methods and also fixed implied globals in setRotAxis.

上级 41c69282
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -295,50 +295,84 @@ THREE.Matrix4.prototype = {
},
setTranslation: function( x, y, z ) {
this.set( 1, 0, 0, x, 0, 1, 0, y, 0, 0, 1, z, 0, 0, 0, 1 );
return this;
},
this.set( 1, 0, 0, x,
0, 1, 0, y,
0, 0, 1, z,
0, 0, 0, 1 );
return this;
},
setScale: function( x, y, z ) {
this.set( x, 0, 0, 0, 0, y, 0, 0, 0, 0, z, 0, 0, 0, 0, 1 );
return this;
},
this.set( x, 0, 0, 0,
0, y, 0, 0,
0, 0, z, 0,
0, 0, 0, 1 );
return this;
},
setRotX: function( theta ) {
var c = Math.cos( theta ), s = Math.sin( theta );
this.set( 1, 0, 0, 0, 0, c, -s, 0, 0, s, c, 0, 0, 0, 0, 1 );
return this;
},
var c = Math.cos( theta ), s = Math.sin( theta );
this.set( 1, 0, 0, 0,
0, c, -s, 0,
0, s, c, 0,
0, 0, 0, 1 );
return this;
},
setRotY: function( theta ) {
var c = Math.cos( theta ), s = Math.sin( theta );
this.set( c, 0, s, 0, 0, 1, 0, 0, -s, 0, c, 0, 0, 0, 0, 1 );
return this;
},
var c = Math.cos( theta ), s = Math.sin( theta );
this.set( c, 0, s, 0,
0, 1, 0, 0,
-s, 0, c, 0,
0, 0, 0, 1 );
return this;
},
setRotZ: function( theta ) {
var c = Math.cos( theta ), s = Math.sin( theta );
this.set( c, -s, 0, 0, s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 );
return this;
},
var c = Math.cos( theta ), s = Math.sin( theta );
this.set( c, -s, 0, 0,
s, c, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1 );
return this;
},
setRotAxis: function( axis, angle ) {
//Based on http://www.gamedev.net/reference/articles/article1199.asp
//Based on http://www.gamedev.net/reference/articles/article1199.asp
c = Math.cos( angle ),
s = Math.sin( angle ),
t = 1 - c,
x = axis.x, y = axis.y, z = axis.z,
tx = t * x, ty = t * y;
var c = Math.cos( angle ),
s = Math.sin( angle ),
t = 1 - c,
x = axis.x, y = axis.y, z = axis.z,
tx = t * x, ty = t * y;
this.set( tx * x + c, tx * y - s * z, tx * z + s * y, 0,
tx * y + s * z, ty * y + c, ty * z - s * x, 0,
tx * z - s * y, ty * z + s * x, t * z * z + c, 0,
0, 0, 0, 1 );
tx * y + s * z, ty * y + c, ty * z - s * x, 0,
tx * z - s * y, ty * z + s * x, t * z * z + c, 0,
0, 0, 0, 1 );
return this;
},
},
toString: function() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册