diff --git a/examples/js/postprocessing/EffectComposer.js b/examples/js/postprocessing/EffectComposer.js index 909992d253d9c0e953a180dbc1b239f6984957ce..d597c02f5034cbec9060f128532396546de4d00f 100644 --- a/examples/js/postprocessing/EffectComposer.js +++ b/examples/js/postprocessing/EffectComposer.js @@ -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; diff --git a/examples/webgl_geometry_subdivison.html b/examples/webgl_geometry_subdivison.html index 62d6ef0971c61bfcc6a1dbbd77051e9ae622450b..46c4ecd3205874fc41baf28698e01342bb1f6133 100644 --- a/examples/webgl_geometry_subdivison.html +++ b/examples/webgl_geometry_subdivison.html @@ -185,10 +185,10 @@ info.innerHTML = 'Drag to spin THREE.' + params.type + - '

Subdivisions: ' + subdivisions + + '

Subdivisions: ' + subdivisions + ' more/less' + '
Geometry: ' + dropdown + ' next' + - '

Vertices count: before ' + geometry.vertices.length + ' after ' + smooth.vertices.length + + '

Vertices count: before ' + geometry.vertices.length + ' after ' + smooth.vertices.length + '
Face count: before ' + geometry.faces.length + ' after ' + smooth.faces.length ; //+ params.args; } @@ -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 ) ); } @@ -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 ); diff --git a/examples/webgl_interactive_draggablecubes.html b/examples/webgl_interactive_draggablecubes.html index 12443953fae8e39e5cf51c4da70dfd80623e27b8..068d7a42511ad55e915fc25ba69762f6d7cfdd6a 100644 --- a/examples/webgl_interactive_draggablecubes.html +++ b/examples/webgl_interactive_draggablecubes.html @@ -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 ); diff --git a/examples/webgl_shader.html b/examples/webgl_shader.html index 5edbc97a058a663eaaf15e315edebcf4e9bc96ac..5cbca7f8e1b7d12d618883461a8a68cfd8a17c8c 100644 --- a/examples/webgl_shader.html +++ b/examples/webgl_shader.html @@ -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(); diff --git a/examples/webgl_terrain_dynamic.html b/examples/webgl_terrain_dynamic.html index ea3d0a594c956d15b92fe1bbed346733803af590..1316679c62fa38e383241f4e443effc78eed13e1 100644 --- a/examples/webgl_terrain_dynamic.html +++ b/examples/webgl_terrain_dynamic.html @@ -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(); diff --git a/src/core/Matrix4.js b/src/core/Matrix4.js index b29bd6ddadfeafd92514a81ad8ac905337f244cb..7bbd5dc9fc414a9733e63e8c6525751cdaf71138 100644 --- a/src/core/Matrix4.js +++ b/src/core/Matrix4.js @@ -317,7 +317,7 @@ THREE.Matrix4.prototype = { }, - setTranslation: function( x, y, z ) { + makeTranslation: function ( x, y, z ) { this.set( @@ -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 ); @@ -364,7 +349,7 @@ THREE.Matrix4.prototype = { }, - setRotationY: function( theta ) { + makeRotationY: function ( theta ) { var c = Math.cos( theta ), s = Math.sin( theta ); @@ -381,7 +366,7 @@ THREE.Matrix4.prototype = { }, - setRotationZ: function( theta ) { + makeRotationZ: function ( theta ) { var c = Math.cos( theta ), s = Math.sin( theta ); @@ -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 @@ -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; @@ -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 ); diff --git a/src/extras/GeometryUtils.js b/src/extras/GeometryUtils.js index 45f14e14b2052e51b9348762acc85715e6cca676..784253b770459c52b29dd542ad11b2c00946152a 100644 --- a/src/extras/GeometryUtils.js +++ b/src/extras/GeometryUtils.js @@ -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; diff --git a/src/extras/geometries/LatheGeometry.js b/src/extras/geometries/LatheGeometry.js index 1461583b045bcaa58a263928931cf536346eff41..f66d19b5e7022180eb17be1d02a1d8cea21dfacc 100644 --- a/src/extras/geometries/LatheGeometry.js +++ b/src/extras/geometries/LatheGeometry.js @@ -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 ++ ) { diff --git a/src/extras/geometries/TubeGeometry.js b/src/extras/geometries/TubeGeometry.js index 35824f6bd3624fe7a1c7a049f497f921f8d112ef..ce01056e4f66e4c3a0fe64b8ee36d831dcab566a 100644 --- a/src/extras/geometries/TubeGeometry.js +++ b/src/extras/geometries/TubeGeometry.js @@ -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 ] ); } @@ -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 ] ); } diff --git a/src/extras/helpers/ArrowHelper.js b/src/extras/helpers/ArrowHelper.js index 9dc955b856b48e34cca3c0d66176c5add1744608..84d50c21fd5d3d56fca5feb558f71bdc0341bf8e 100644 --- a/src/extras/helpers/ArrowHelper.js +++ b/src/extras/helpers/ArrowHelper.js @@ -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 );