Skip to content

Commit

Permalink
Renamed Matrix4's setTranslation, setRotationX, setRotationY, setRota…
Browse files Browse the repository at this point in the history
…tionZ, setRotationAxis and setScale to makeTranslation, makeRotationX, makeRotationY, makeRotationZ, makeRotationAxis and makeScale. Fixes mrdoob#1615.
  • Loading branch information
Mr.doob committed Apr 8, 2012
1 parent a1cf507 commit 7f05ba1
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion examples/js/postprocessing/EffectComposer.js
Expand Up @@ -126,7 +126,7 @@ THREE.EffectComposer.camera = new THREE.OrthographicCamera( window.innerWidth /
// shared fullscreen quad scene

THREE.EffectComposer.geometry = new THREE.PlaneGeometry( 1, 1 );
THREE.EffectComposer.geometry.applyMatrix( new THREE.Matrix4().setRotationX( Math.PI / 2 ) );
THREE.EffectComposer.geometry.applyMatrix( new THREE.Matrix4().makeRotationX( Math.PI / 2 ) );

THREE.EffectComposer.quad = new THREE.Mesh( THREE.EffectComposer.geometry, null );
THREE.EffectComposer.quad.position.z = -100;
Expand Down
8 changes: 4 additions & 4 deletions examples/webgl_geometry_subdivison.html
Expand Up @@ -185,10 +185,10 @@

info.innerHTML = 'Drag to spin THREE.' + params.type +

'<br/><br/>Subdivisions: ' + subdivisions +
'<br><br>Subdivisions: ' + subdivisions +
' <a href="#" onclick="nextSubdivision(1); return false;">more</a>/<a href="#" onclick="nextSubdivision(-1); return false;">less</a>' +
'<br>Geometry: ' + dropdown + ' <a href="#" onclick="nextGeometry();return false;">next</a>' +
'<br/><br>Vertices count: before ' + geometry.vertices.length + ' after ' + smooth.vertices.length +
'<br><br>Vertices count: before ' + geometry.vertices.length + ' after ' + smooth.vertices.length +
'<br>Face count: before ' + geometry.faces.length + ' after ' + smooth.faces.length
; //+ params.args;
}
Expand All @@ -214,7 +214,7 @@

if ( params.scale ) {

geometry.applyMatrix( new THREE.Matrix4().setScale( params.scale, params.scale, params.scale ) );
geometry.applyMatrix( new THREE.Matrix4().makeScale( params.scale, params.scale, params.scale ) );

}

Expand Down Expand Up @@ -362,7 +362,7 @@

addStuff();

renderer = new THREE.WebGLRenderer( { antialias: true, clearColor: 0xf0f0f0 } ); // WebGLRenderer CanvasRenderer
renderer = new THREE.WebGLRenderer( { antialias: true } ); // WebGLRenderer CanvasRenderer
renderer.setSize( window.innerWidth, window.innerHeight );

container.appendChild( renderer.domElement );
Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_interactive_draggablecubes.html
Expand Up @@ -91,7 +91,7 @@
}

plane = new THREE.Mesh( new THREE.PlaneGeometry( 2000, 2000, 8, 8 ), new THREE.MeshBasicMaterial( { color: 0x000000, opacity: 0.25, transparent: true, wireframe: true } ) );
plane.geometry.applyMatrix( new THREE.Matrix4().setRotationX( Math.PI / 2 ) );
plane.geometry.applyMatrix( new THREE.Matrix4().makeRotationX( Math.PI / 2 ) );
plane.lookAt( camera.position );
plane.visible = false;
scene.add( plane );
Expand Down
4 changes: 2 additions & 2 deletions examples/webgl_shader.html
Expand Up @@ -126,10 +126,10 @@
vertexShader: document.getElementById( 'vertexShader' ).textContent,
fragmentShader: document.getElementById( 'fragmentShader' ).textContent

} );
} );

mesh = new THREE.Mesh( new THREE.PlaneGeometry( 2, 2 ), material );
mesh.geometry.applyMatrix( new THREE.Matrix4().setRotationX( Math.PI / 2 ) );
mesh.geometry.applyMatrix( new THREE.Matrix4().makeRotationX( Math.PI / 2 ) );
scene.add( mesh );

renderer = new THREE.WebGLRenderer();
Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_terrain_dynamic.html
Expand Up @@ -425,7 +425,7 @@
// TERRAIN MESH

var geometryTerrain = new THREE.PlaneGeometry( 6000, 6000, 256, 256 );
geometryTerrain.applyMatrix( new THREE.Matrix4().setRotationX( Math.PI / 2 ) );
geometryTerrain.applyMatrix( new THREE.Matrix4().makeRotationX( Math.PI / 2 ) );

geometryTerrain.computeFaceNormals();
geometryTerrain.computeVertexNormals();
Expand Down
42 changes: 21 additions & 21 deletions src/core/Matrix4.js
Expand Up @@ -317,7 +317,7 @@ THREE.Matrix4.prototype = {

},

setTranslation: function( x, y, z ) {
makeTranslation: function ( x, y, z ) {

this.set(

Expand All @@ -332,22 +332,7 @@ THREE.Matrix4.prototype = {

},

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;

},

setRotationX: function ( theta ) {
makeRotationX: function ( theta ) {

var c = Math.cos( theta ), s = Math.sin( theta );

Expand All @@ -364,7 +349,7 @@ THREE.Matrix4.prototype = {

},

setRotationY: function( theta ) {
makeRotationY: function ( theta ) {

var c = Math.cos( theta ), s = Math.sin( theta );

Expand All @@ -381,7 +366,7 @@ THREE.Matrix4.prototype = {

},

setRotationZ: function( theta ) {
makeRotationZ: function ( theta ) {

var c = Math.cos( theta ), s = Math.sin( theta );

Expand All @@ -398,7 +383,7 @@ THREE.Matrix4.prototype = {

},

setRotationAxis: function( axis, angle ) {
makeRotationAxis: function ( axis, angle ) {

// Based on http://www.gamedev.net/reference/articles/article1199.asp

Expand All @@ -421,6 +406,21 @@ THREE.Matrix4.prototype = {

},

makeScale: function ( x, y, z ) {

this.set(

x, 0, 0, 0,
0, y, 0, 0,
0, 0, z, 0,
0, 0, 0, 1

);

return this;

},

setPosition: function ( v ) {

this.n14 = v.x;
Expand Down Expand Up @@ -649,7 +649,7 @@ THREE.Matrix4.prototype = {
mRotation.identity();
mRotation.setRotationFromQuaternion( rotation );

mScale.setScale( scale.x, scale.y, scale.z );
mScale.makeScale( scale.x, scale.y, scale.z );

this.multiply( mRotation, mScale );

Expand Down
2 changes: 1 addition & 1 deletion src/extras/GeometryUtils.js
Expand Up @@ -453,7 +453,7 @@ THREE.GeometryUtils = {
offset.add( bb.min, bb.max );
offset.multiplyScalar( -0.5 );

geometry.applyMatrix( new THREE.Matrix4().setTranslation( offset.x, offset.y, offset.z ) );
geometry.applyMatrix( new THREE.Matrix4().makeTranslation( offset.x, offset.y, offset.z ) );
geometry.computeBoundingBox();

return offset;
Expand Down
2 changes: 1 addition & 1 deletion src/extras/geometries/LatheGeometry.js
Expand Up @@ -11,7 +11,7 @@ THREE.LatheGeometry = function ( points, steps, angle ) {

var stepSize = this.angle / this.steps,
newV = [], oldInds = [], newInds = [], startInds = [],
matrix = new THREE.Matrix4().setRotationZ( stepSize );
matrix = new THREE.Matrix4().makeRotationZ( stepSize );

for ( var j = 0; j < points.length; j ++ ) {

Expand Down
4 changes: 2 additions & 2 deletions src/extras/geometries/TubeGeometry.js
Expand Up @@ -146,7 +146,7 @@ THREE.TubeGeometry = function( path, segments, radius, segmentsRadius, closed, d

theta = Math.acos( tangents[ i-1 ].dot( tangents[ i ] ) );

mat.setRotationAxis( vec, theta ).multiplyVector3( normals[ i ] );
mat.makeRotationAxis( vec, theta ).multiplyVector3( normals[ i ] );

}

Expand All @@ -171,7 +171,7 @@ THREE.TubeGeometry = function( path, segments, radius, segmentsRadius, closed, d
for ( i = 1; i < numpoints; i++ ) {

// twist a little...
mat.setRotationAxis( tangents[ i ], theta * i ).multiplyVector3( normals[ i ] );
mat.makeRotationAxis( tangents[ i ], theta * i ).multiplyVector3( normals[ i ] );
binormals[ i ].cross( tangents[ i ], normals[ i ] );

}
Expand Down
2 changes: 1 addition & 1 deletion src/extras/helpers/ArrowHelper.js
Expand Up @@ -51,7 +51,7 @@ THREE.ArrowHelper.prototype.setDirection = function( dir ) {

var radians = Math.acos( new THREE.Vector3( 0, 1, 0 ).dot( dir.clone().normalize() ) );

this.matrix = new THREE.Matrix4().setRotationAxis( axis.normalize(), radians );
this.matrix = new THREE.Matrix4().makeRotationAxis( axis.normalize(), radians );

this.rotation.getRotationFromMatrix( this.matrix, this.scale );

Expand Down

0 comments on commit 7f05ba1

Please sign in to comment.