Browse Source

Merge pull request #6975 from WestLangley/dev-geometry

Added transform methods to Geometry and BufferGeometry
Mr.doob 10 years ago
parent
commit
5bbf895bb9
32 changed files with 297 additions and 65 deletions
  1. 1 1
      docs/api/core/Geometry.html
  2. 1 1
      examples/canvas_geometry_cube.html
  3. 1 1
      examples/canvas_geometry_terrain.html
  4. 1 1
      examples/canvas_interactive_voxelpainter.html
  5. 1 1
      examples/css3d_molecules.html
  6. 1 1
      examples/js/Ocean.js
  7. 1 1
      examples/misc_controls_deviceorientation.html
  8. 1 1
      examples/misc_controls_pointerlock.html
  9. 1 1
      examples/misc_lookat.html
  10. 2 2
      examples/vr_video.html
  11. 6 7
      examples/webgl_buffergeometry_constructed_from_geometry.html
  12. 2 5
      examples/webgl_camera_logarithmicdepthbuffer.html
  13. 1 1
      examples/webgl_geometry_dynamic.html
  14. 9 9
      examples/webgl_geometry_minecraft.html
  15. 12 12
      examples/webgl_geometry_minecraft_ao.html
  16. 1 1
      examples/webgl_geometry_normals.html
  17. 1 1
      examples/webgl_geometry_spline_editor.html
  18. 1 1
      examples/webgl_geometry_terrain.html
  19. 1 1
      examples/webgl_geometry_terrain_fog.html
  20. 3 3
      examples/webgl_geometry_terrain_raycast.html
  21. 1 1
      examples/webgl_gpgpu_birds.html
  22. 1 1
      examples/webgl_interactive_voxelpainter.html
  23. 1 1
      examples/webgl_loader_pdb.html
  24. 1 1
      examples/webgl_modifier_subdivision.html
  25. 1 1
      examples/webgl_panorama_equirectangular.html
  26. 1 1
      examples/webgl_shadowmap.html
  27. 1 1
      examples/webgl_video_panorama_equirectangular.html
  28. 119 1
      src/core/BufferGeometry.js
  29. 119 1
      src/core/Geometry.js
  30. 1 1
      src/extras/helpers/ArrowHelper.js
  31. 1 1
      src/extras/helpers/HemisphereLightHelper.js
  32. 2 2
      src/extras/helpers/SpotLightHelper.js

+ 1 - 1
docs/api/core/Geometry.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html lang="en">
 	<head>
-		<meta charset="utf-8" />
+		<meta charset="utf-8" />
 		<base href="../../" />
 		<script src="list.js"></script>
 		<script src="page.js"></script>

+ 1 - 1
examples/canvas_geometry_cube.html

@@ -82,7 +82,7 @@
 				// Plane
 
 				var geometry = new THREE.PlaneBufferGeometry( 200, 200 );
-				geometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) );
+				geometry.rotateX( - Math.PI / 2 );
 
 				var material = new THREE.MeshBasicMaterial( { color: 0xe0e0e0, overdraw: 0.5 } );
 

+ 1 - 1
examples/canvas_geometry_terrain.html

@@ -77,7 +77,7 @@
 				var quality = 16, step = 1024 / quality;
 
 				var geometry = new THREE.PlaneGeometry( 2000, 2000, quality - 1, quality - 1 );
-				geometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) );
+				geometry.rotateX( - Math.PI / 2 );
 
 				for ( var i = 0, l = geometry.vertices.length; i < l; i ++ ) {
 

+ 1 - 1
examples/canvas_interactive_voxelpainter.html

@@ -82,7 +82,7 @@
 				mouse = new THREE.Vector2();
 
 				var geometry = new THREE.PlaneBufferGeometry( 1000, 1000 );
-				geometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) );
+				geometry.rotateX( - Math.PI / 2 );
 
 				plane = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { visible: false } ) );
 				scene.add( plane );

+ 1 - 1
examples/css3d_molecules.html

@@ -347,7 +347,7 @@
 				loader.load( url, function ( geometry, geometryBonds ) {
 
 					var offset = geometry.center();
-					geometryBonds.applyMatrix( new THREE.Matrix4().makeTranslation( offset.x, offset.y, offset.z ) );
+					geometryBonds.translate( offset.x, offset.y, offset.z );
 
 					for ( var i = 0; i < geometry.vertices.length; i ++ ) {
 

+ 1 - 1
examples/js/Ocean.js

@@ -210,7 +210,7 @@ THREE.Ocean.prototype.generateMesh = function () {
 
 	var geometry = new THREE.PlaneBufferGeometry( this.geometrySize, this.geometrySize, this.geometryResolution, this.geometryResolution );
 
-	geometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) );
+	geometry.rotateX( - Math.PI / 2 );
 
 	this.oceanMesh = new THREE.Mesh( geometry, this.materialOcean );
 

+ 1 - 1
examples/misc_controls_deviceorientation.html

@@ -65,7 +65,7 @@
 						scene = new THREE.Scene();
 
 						var geometry = new THREE.SphereGeometry( 500, 16, 8 );
-						geometry.applyMatrix( new THREE.Matrix4().makeScale( -1, 1, 1 ) );
+						geometry.scale( - 1, 1, 1 );
 
 						var material = new THREE.MeshBasicMaterial( {
 							map: THREE.ImageUtils.loadTexture( 'textures/2294472375_24a3b8ef46_o.jpg' )

+ 1 - 1
examples/misc_controls_pointerlock.html

@@ -267,7 +267,7 @@
 				// floor
 
 				geometry = new THREE.PlaneGeometry( 2000, 2000, 100, 100 );
-				geometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) );
+				geometry.rotateX( - Math.PI / 2 );
 
 				for ( var i = 0, l = geometry.vertices.length; i < l; i ++ ) {
 

+ 1 - 1
examples/misc_lookat.html

@@ -68,7 +68,7 @@
 				scene.add( sphere );
 
 				var geometry = new THREE.CylinderGeometry( 0, 10, 100, 3 );
-				geometry.applyMatrix( new THREE.Matrix4().makeRotationFromEuler( new THREE.Euler( Math.PI / 2, Math.PI, 0 ) ) );
+				geometry.rotateX( Math.PI / 2 );
 
 				var material = new THREE.MeshNormalMaterial();
 

+ 2 - 2
examples/vr_video.html

@@ -73,7 +73,7 @@
 				sceneLeft = new THREE.Scene();
 
 				var geometry = new THREE.SphereGeometry( 500, 60, 40 );
-				geometry.applyMatrix( new THREE.Matrix4().makeScale( -1, 1, 1 ) );
+				geometry.scale( - 1, 1, 1 );
 
 				var uvs = geometry.faceVertexUvs[ 0 ];
 
@@ -98,7 +98,7 @@
 				sceneRight = new THREE.Scene();
 
 				var geometry = new THREE.SphereGeometry( 500, 60, 40 );
-				geometry.applyMatrix( new THREE.Matrix4().makeScale( -1, 1, 1 ) );
+				geometry.scale( - 1, 1, 1 );
 
 				var uvs = geometry.faceVertexUvs[ 0 ];
 

+ 6 - 7
examples/webgl_buffergeometry_constructed_from_geometry.html

@@ -111,9 +111,8 @@
 				bevelThickness: 1
 			};
 			var geom = new THREE.ExtrudeGeometry( heart_shape, extrudeSettings );
-			geom.applyMatrix( new THREE.Matrix4().makeRotationX( -THREE.Math.degToRad( 90 ) ) );
-			geom.applyMatrix( new THREE.Matrix4().makeScale( 0.1, 0.1, 0.1 ) );
-			geom.applyMatrix( new THREE.Matrix4().makeScale( 4, 4, 4 ) );
+			geom.rotateX( - Math.PI / 2 );
+			geom.scale( 0.4, 0.4, 0.4 );
 			return geom;
 
 		}
@@ -149,10 +148,10 @@
 
 					var geometry = createGeometry();
 
-					geometry.applyMatrix( new THREE.Matrix4().makeTranslation( 0, height / 2, 0 ) );
-					geometry.applyMatrix( new THREE.Matrix4().makeRotationX( -THREE.Math.degToRad( 90 ) ) );
-					geometry.applyMatrix( new THREE.Matrix4().lookAt( new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( x, y, z ), new THREE.Vector3( 0, 1, 0 ) ) );
-					geometry.applyMatrix( new THREE.Matrix4().makeTranslation( x, y, z ) );
+					geometry.translate( 0, height / 2, 0 );
+					geometry.rotateX( - Math.PI / 2 );
+					geometry.lookAt( new THREE.Vector3( - x, - y, - z ) );
+					geometry.translate( x, y, z );
 
 					var color = new THREE.Color( 0xffffff );
 					color.setHSL( lat / 180.0, 1.0, 0.7 );

+ 2 - 5
examples/webgl_camera_logarithmicdepthbuffer.html

@@ -170,14 +170,12 @@
 
 				var materialargs = {
 					color: 0xffffff,
-					specular: 0xffaa00,
+					specular: 0x050505,
 					shininess: 50,
 					shading: THREE.SmoothShading,
 					emissive: 0x000000
 				};
 
-				var geomtransform = new THREE.Matrix4();
-				var tmpvec = new THREE.Vector3();
 				var meshes = [];
 				var coloroffset = 0;
 				var colorskip = ['black', 'antiquewhite', 'bisque', 'beige', 'blanchedalmond', 'darkblue', 'darkcyan'];
@@ -195,8 +193,7 @@
 					labelgeo.computeBoundingSphere();
 
 					// center text
-					geomtransform.setPosition( tmpvec.set( -labelgeo.boundingSphere.radius, 0, 0 ) );
-					labelgeo.applyMatrix( geomtransform );
+					labelgeo.translate( - labelgeo.boundingSphere.radius, 0, 0 );
 
 					// Pick a color at "random".  Exclude black, because it looks bad.
 					while ( colorskip.indexOf( colorkeys[ i + coloroffset ] ) != -1 ) {

+ 1 - 1
examples/webgl_geometry_dynamic.html

@@ -86,7 +86,7 @@
 				scene.fog = new THREE.FogExp2( 0xaaccff, 0.0007 );
 
 				geometry = new THREE.PlaneGeometry( 20000, 20000, worldWidth - 1, worldDepth - 1 );
-				geometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) );
+				geometry.rotateX( - Math.PI / 2 );
 
 				for ( var i = 0, l = geometry.vertices.length; i < l; i ++ ) {
 

+ 9 - 9
examples/webgl_geometry_minecraft.html

@@ -95,31 +95,31 @@
 				var pxGeometry = new THREE.PlaneBufferGeometry( 100, 100 );
 				pxGeometry.attributes.uv.array[ 1 ] = 0.5;
 				pxGeometry.attributes.uv.array[ 3 ] = 0.5;
-				pxGeometry.applyMatrix( matrix.makeRotationY( Math.PI / 2 ) );
-				pxGeometry.applyMatrix( matrix.makeTranslation( 50, 0, 0 ) );
+				pxGeometry.rotateY( Math.PI / 2 );
+				pxGeometry.translate( 50, 0, 0 );
 
 				var nxGeometry = new THREE.PlaneBufferGeometry( 100, 100 );
 				nxGeometry.attributes.uv.array[ 1 ] = 0.5;
 				nxGeometry.attributes.uv.array[ 3 ] = 0.5;
-				nxGeometry.applyMatrix( matrix.makeRotationY( - Math.PI / 2 ) );
-				nxGeometry.applyMatrix( matrix.makeTranslation( - 50, 0, 0 ) );
+				nxGeometry.rotateY( - Math.PI / 2 );
+				nxGeometry.translate( - 50, 0, 0 );
 
 				var pyGeometry = new THREE.PlaneBufferGeometry( 100, 100 );
 				pyGeometry.attributes.uv.array[ 5 ] = 0.5;
 				pyGeometry.attributes.uv.array[ 7 ] = 0.5;
-				pyGeometry.applyMatrix( matrix.makeRotationX( - Math.PI / 2 ) );
-				pyGeometry.applyMatrix( matrix.makeTranslation( 0, 50, 0 ) );
+				pyGeometry.rotateX( - Math.PI / 2 );
+				pyGeometry.translate( 0, 50, 0 );
 
 				var pzGeometry = new THREE.PlaneBufferGeometry( 100, 100 );
 				pzGeometry.attributes.uv.array[ 1 ] = 0.5;
 				pzGeometry.attributes.uv.array[ 3 ] = 0.5;
-				pzGeometry.applyMatrix( matrix.makeTranslation( 0, 0, 50 ) );
+				pzGeometry.translate( 0, 0, 50 );
 
 				var nzGeometry = new THREE.PlaneBufferGeometry( 100, 100 );
 				nzGeometry.attributes.uv.array[ 1 ] = 0.5;
 				nzGeometry.attributes.uv.array[ 3 ] = 0.5;
-				nzGeometry.applyMatrix( matrix.makeRotationY( Math.PI ) );
-				nzGeometry.applyMatrix( matrix.makeTranslation( 0, 0, -50 ) );
+				nzGeometry.rotateY( Math.PI );
+				nzGeometry.translate( 0, 0, -50 );
 
 				//
 

+ 12 - 12
examples/webgl_geometry_minecraft_ao.html

@@ -108,8 +108,8 @@
 				pxGeometry.faceVertexUvs[ 0 ][ 0 ][ 0 ].y = 0.5;
 				pxGeometry.faceVertexUvs[ 0 ][ 0 ][ 2 ].y = 0.5;
 				pxGeometry.faceVertexUvs[ 0 ][ 1 ][ 2 ].y = 0.5;
-				pxGeometry.applyMatrix( matrix.makeRotationY( Math.PI / 2 ) );
-				pxGeometry.applyMatrix( matrix.makeTranslation( 50, 0, 0 ) );
+				pxGeometry.rotateY( Math.PI / 2 );
+				pxGeometry.translate( 50, 0, 0 );
 
 				var nxGeometry = new THREE.PlaneGeometry( 100, 100 );
 				nxGeometry.faces[ 0 ].vertexColors = [ light, shadow, light ];
@@ -117,8 +117,8 @@
 				nxGeometry.faceVertexUvs[ 0 ][ 0 ][ 0 ].y = 0.5;
 				nxGeometry.faceVertexUvs[ 0 ][ 0 ][ 2 ].y = 0.5;
 				nxGeometry.faceVertexUvs[ 0 ][ 1 ][ 2 ].y = 0.5;
-				nxGeometry.applyMatrix( matrix.makeRotationY( - Math.PI / 2 ) );
-				nxGeometry.applyMatrix( matrix.makeTranslation( - 50, 0, 0 ) );
+				nxGeometry.rotateY( - Math.PI / 2 );
+				nxGeometry.translate( - 50, 0, 0 );
 
 				var pyGeometry = new THREE.PlaneGeometry( 100, 100 );
 				pyGeometry.faces[ 0 ].vertexColors = [ light, light, light ];
@@ -126,8 +126,8 @@
 				pyGeometry.faceVertexUvs[ 0 ][ 0 ][ 1 ].y = 0.5;
 				pyGeometry.faceVertexUvs[ 0 ][ 1 ][ 0 ].y = 0.5;
 				pyGeometry.faceVertexUvs[ 0 ][ 1 ][ 1 ].y = 0.5;
-				pyGeometry.applyMatrix( matrix.makeRotationX( - Math.PI / 2 ) );
-				pyGeometry.applyMatrix( matrix.makeTranslation( 0, 50, 0 ) );
+				pyGeometry.rotateX( - Math.PI / 2 );
+				pyGeometry.translate( 0, 50, 0 );
 
 				var py2Geometry = new THREE.PlaneGeometry( 100, 100 );
 				py2Geometry.faces[ 0 ].vertexColors = [ light, light, light ];
@@ -135,9 +135,9 @@
 				py2Geometry.faceVertexUvs[ 0 ][ 0 ][ 1 ].y = 0.5;
 				py2Geometry.faceVertexUvs[ 0 ][ 1 ][ 0 ].y = 0.5;
 				py2Geometry.faceVertexUvs[ 0 ][ 1 ][ 1 ].y = 0.5;
-				py2Geometry.applyMatrix( matrix.makeRotationX( - Math.PI / 2 ) );
-				py2Geometry.applyMatrix( matrix.makeRotationY( Math.PI / 2 ) );
-				py2Geometry.applyMatrix( matrix.makeTranslation( 0, 50, 0 ) );
+				py2Geometry.rotateX( - Math.PI / 2 );
+				py2Geometry.rotateY( Math.PI / 2 );
+				py2Geometry.translate( 0, 50, 0 );
 
 				var pzGeometry = new THREE.PlaneGeometry( 100, 100 );
 				pzGeometry.faces[ 0 ].vertexColors = [ light, shadow, light ];
@@ -145,7 +145,7 @@
 				pzGeometry.faceVertexUvs[ 0 ][ 0 ][ 0 ].y = 0.5;
 				pzGeometry.faceVertexUvs[ 0 ][ 0 ][ 2 ].y = 0.5;
 				pzGeometry.faceVertexUvs[ 0 ][ 1 ][ 2 ].y = 0.5;
-				pzGeometry.applyMatrix( matrix.makeTranslation( 0, 0, 50 ) );
+				pzGeometry.translate( 0, 0, 50 );
 
 				var nzGeometry = new THREE.PlaneGeometry( 100, 100 );
 				nzGeometry.faces[ 0 ].vertexColors = [ light, shadow, light ];
@@ -153,8 +153,8 @@
 				nzGeometry.faceVertexUvs[ 0 ][ 0 ][ 0 ].y = 0.5;
 				nzGeometry.faceVertexUvs[ 0 ][ 0 ][ 2 ].y = 0.5;
 				nzGeometry.faceVertexUvs[ 0 ][ 1 ][ 2 ].y = 0.5;
-				nzGeometry.applyMatrix( matrix.makeRotationY( Math.PI ) );
-				nzGeometry.applyMatrix( matrix.makeTranslation( 0, 0, - 50 ) );
+				nzGeometry.rotateY( Math.PI );
+				nzGeometry.translate( 0, 0, - 50 );
 
 				//
 

+ 1 - 1
examples/webgl_geometry_normals.html

@@ -174,7 +174,7 @@
 				geometry.computeBoundingSphere();
 
 				var scaleFactor = 160 / geometry.boundingSphere.radius;
-				geometry.applyMatrix( new THREE.Matrix4().makeScale( scaleFactor, scaleFactor, scaleFactor ) );
+				geometry.scale( scaleFactor, scaleFactor, scaleFactor );
 
 				var originalGeometry = geometry.clone();
 				originalGeometry.computeFaceNormals();

+ 1 - 1
examples/webgl_geometry_spline_editor.html

@@ -81,7 +81,7 @@
 				spotlight = light;
 
 				var planeGeometry = new THREE.PlaneGeometry( 2000, 2000, 20, 20 );
-				planeGeometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) );
+				planeGeometry.rotateX( - Math.PI / 2 );
 				var planeMaterial = new THREE.MeshBasicMaterial( { color: 0xeeeeee } );
 
 				var plane = new THREE.Mesh( planeGeometry, planeMaterial );

+ 1 - 1
examples/webgl_geometry_terrain.html

@@ -82,7 +82,7 @@
 				camera.position.y = data[ worldHalfWidth + worldHalfDepth * worldWidth ] * 10 + 500;
 
 				var geometry = new THREE.PlaneBufferGeometry( 7500, 7500, worldWidth - 1, worldDepth - 1 );
-				geometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) );
+				geometry.rotateX( - Math.PI / 2 );
 
 				var vertices = geometry.attributes.position.array;
 

+ 1 - 1
examples/webgl_geometry_terrain_fog.html

@@ -84,7 +84,7 @@
 				camera.position.y = data[ worldHalfWidth + worldHalfDepth * worldWidth ] * 10 + 500;
 
 				var geometry = new THREE.PlaneBufferGeometry( 7500, 7500, worldWidth - 1, worldDepth - 1 );
-				geometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) );
+				geometry.rotateX( - Math.PI / 2 );
 
 				var vertices = geometry.attributes.position.array;
 

+ 3 - 3
examples/webgl_geometry_terrain_raycast.html

@@ -89,7 +89,7 @@
 				camera.position.x = 2000;
 
 				var geometry = new THREE.PlaneBufferGeometry( 7500, 7500, worldWidth - 1, worldDepth - 1 );
-				geometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) );
+				geometry.rotateX( - Math.PI / 2 );
 
 				var vertices = geometry.attributes.position.array;
 
@@ -108,8 +108,8 @@
 				scene.add( mesh );
 
 				var geometry = new THREE.CylinderGeometry( 0, 20, 100, 3 );
-				geometry.applyMatrix( new THREE.Matrix4().makeTranslation( 0, 50, 0 ) );
-				geometry.applyMatrix( new THREE.Matrix4().makeRotationX( Math.PI / 2 ) );
+				geometry.translate( 0, 50, 0 );
+				geometry.rotateX( Math.PI / 2 );
 				helper = new THREE.Mesh( geometry, new THREE.MeshNormalMaterial() );
 				scene.add( helper );
 

+ 1 - 1
examples/webgl_gpgpu_birds.html

@@ -451,7 +451,7 @@
 
 				}
 
-				this.applyMatrix( new THREE.Matrix4().makeScale( 0.2, 0.2, 0.2 ) );
+				this.scale( 0.2, 0.2, 0.2 );
 
 			};
 

+ 1 - 1
examples/webgl_interactive_voxelpainter.html

@@ -96,7 +96,7 @@
 				mouse = new THREE.Vector2();
 
 				var geometry = new THREE.PlaneBufferGeometry( 1000, 1000 );
-				geometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) );
+				geometry.rotateX( - Math.PI / 2 );
 
 				plane = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { visible: false } ) );
 				scene.add( plane );

+ 1 - 1
examples/webgl_loader_pdb.html

@@ -197,7 +197,7 @@
 					var sphereGeometry = new THREE.IcosahedronGeometry( 1, 2 );
 
 					var offset = geometry.center();
-					geometryBonds.applyMatrix( new THREE.Matrix4().makeTranslation( offset.x, offset.y, offset.z ) );
+					geometryBonds.translate( offset.x, offset.y, offset.z );
 
 					for ( var i = 0; i < geometry.vertices.length; i ++ ) {
 

+ 1 - 1
examples/webgl_modifier_subdivision.html

@@ -196,7 +196,7 @@
 
 				if ( params.scale ) {
 
-					geometry.applyMatrix( new THREE.Matrix4().makeScale( params.scale, params.scale, params.scale ) );
+					geometry.scale( params.scale, params.scale, params.scale );
 
 				}
 

+ 1 - 1
examples/webgl_panorama_equirectangular.html

@@ -62,7 +62,7 @@
 				scene = new THREE.Scene();
 
 				var geometry = new THREE.SphereGeometry( 500, 60, 40 );
-				geometry.applyMatrix( new THREE.Matrix4().makeScale( -1, 1, 1 ) );
+				geometry.scale( - 1, 1, 1 );
 
 				var material = new THREE.MeshBasicMaterial( {
 					map: THREE.ImageUtils.loadTexture( 'textures/2294472375_24a3b8ef46_o.jpg' )

+ 1 - 1
examples/webgl_shadowmap.html

@@ -217,7 +217,7 @@
 				var hudWidth = hudHeight * SHADOW_MAP_WIDTH / SHADOW_MAP_HEIGHT;
 
 				var hudGeo = new THREE.PlaneBufferGeometry( hudWidth, hudHeight );
-				hudGeo.applyMatrix( new THREE.Matrix4().makeTranslation( hudWidth / 2, hudHeight / 2, 0 ) );
+				hudGeo.translate( hudWidth / 2, hudHeight / 2, 0 );
 
 				hudMesh = new THREE.Mesh( hudGeo, hudMaterial );
 

+ 1 - 1
examples/webgl_video_panorama_equirectangular.html

@@ -59,7 +59,7 @@
 				scene = new THREE.Scene();
 
 				var geometry = new THREE.SphereGeometry( 500, 60, 40 );
-				geometry.applyMatrix( new THREE.Matrix4().makeScale( -1, 1, 1 ) );
+				geometry.scale( - 1, 1, 1 );
 
 				var video = document.createElement( 'video' );
 				video.width = 640;

+ 119 - 1
src/core/BufferGeometry.js

@@ -116,13 +116,131 @@ THREE.BufferGeometry.prototype = {
 
 	},
 
+	rotateX: function () {
+
+		// rotate geometry around world x-axis
+
+		var m1;
+
+		return function rotateX( angle ) {
+
+			if ( m1 === undefined ) m1 = new THREE.Matrix4();
+
+			m1.makeRotationX( angle );
+
+			this.applyMatrix( m1 );
+
+			return this;
+
+		};
+
+	}(),
+
+	rotateY: function () {
+
+		// rotate geometry around world y-axis
+
+		var m1;
+
+		return function rotateY( angle ) {
+
+			if ( m1 === undefined ) m1 = new THREE.Matrix4();
+
+			m1.makeRotationY( angle );
+
+			this.applyMatrix( m1 );
+
+			return this;
+
+		};
+
+	}(),
+
+	rotateZ: function () {
+
+		// rotate geometry around world z-axis
+
+		var m1;
+
+		return function rotateZ( angle ) {
+
+			if ( m1 === undefined ) m1 = new THREE.Matrix4();
+
+			m1.makeRotationZ( angle );
+
+			this.applyMatrix( m1 );
+
+			return this;
+
+		};
+
+	}(),
+
+	translate: function () {
+
+		// translate geometry
+
+		var m1;
+
+		return function translate( x, y, z ) {
+
+			if ( m1 === undefined ) m1 = new THREE.Matrix4();
+
+			m1.makeTranslation( x, y, z );
+
+			this.applyMatrix( m1 );
+
+			return this;
+
+		};
+
+	}(),
+
+	scale: function () {
+
+		// scale geometry
+
+		var m1;
+
+		return function scale( x, y, z ) {
+
+			if ( m1 === undefined ) m1 = new THREE.Matrix4();
+
+			m1.makeScale( x, y, z );
+
+			this.applyMatrix( m1 );
+
+			return this;
+
+		};
+
+	}(),
+
+	lookAt: function () {
+
+		var obj;
+
+		return function lookAt( vector ) {
+
+			if ( obj === undefined ) obj = new THREE.Object3D();
+
+			obj.lookAt( vector );
+
+			obj.updateMatrix();
+
+			this.applyMatrix( obj.matrix );
+
+		};
+
+	}(),
+
 	center: function () {
 
 		this.computeBoundingBox();
 
 		var offset = this.boundingBox.center().negate();
 
-		this.applyMatrix( new THREE.Matrix4().setPosition( offset ) );
+		this.translate( offset.x, offset.y, offset.z );
 
 		return offset;
 

+ 119 - 1
src/core/Geometry.js

@@ -92,6 +92,124 @@ THREE.Geometry.prototype = {
 
 	},
 
+	rotateX: function () {
+
+		// rotate geometry around world x-axis
+
+		var m1;
+
+		return function rotateX( angle ) {
+
+			if ( m1 === undefined ) m1 = new THREE.Matrix4();
+
+			m1.makeRotationX( angle );
+
+			this.applyMatrix( m1 );
+
+			return this;
+
+		};
+
+	}(),
+
+	rotateY: function () {
+
+		// rotate geometry around world y-axis
+
+		var m1;
+
+		return function rotateY( angle ) {
+
+			if ( m1 === undefined ) m1 = new THREE.Matrix4();
+
+			m1.makeRotationY( angle );
+
+			this.applyMatrix( m1 );
+
+			return this;
+
+		};
+
+	}(),
+
+	rotateZ: function () {
+
+		// rotate geometry around world z-axis
+
+		var m1;
+
+		return function rotateZ( angle ) {
+
+			if ( m1 === undefined ) m1 = new THREE.Matrix4();
+
+			m1.makeRotationZ( angle );
+
+			this.applyMatrix( m1 );
+
+			return this;
+
+		};
+
+	}(),
+
+	translate: function () {
+
+		// translate geometry
+
+		var m1;
+
+		return function translate( x, y, z ) {
+
+			if ( m1 === undefined ) m1 = new THREE.Matrix4();
+
+			m1.makeTranslation( x, y, z );
+
+			this.applyMatrix( m1 );
+
+			return this;
+
+		};
+
+	}(),
+
+	scale: function () {
+
+		// scale geometry
+
+		var m1;
+
+		return function scale( x, y, z ) {
+
+			if ( m1 === undefined ) m1 = new THREE.Matrix4();
+
+			m1.makeScale( x, y, z );
+
+			this.applyMatrix( m1 );
+
+			return this;
+
+		};
+
+	}(),
+
+	lookAt: function () {
+
+		var obj;
+
+		return function lookAt( vector ) {
+
+			if ( obj === undefined ) obj = new THREE.Object3D();
+
+			obj.lookAt( vector );
+
+			obj.updateMatrix();
+
+			this.applyMatrix( obj.matrix );
+
+		};
+
+	}(),
+
 	fromBufferGeometry: function ( geometry ) {
 
 		var scope = this;
@@ -245,7 +363,7 @@ THREE.Geometry.prototype = {
 
 		var offset = this.boundingBox.center().negate();
 
-		this.applyMatrix( new THREE.Matrix4().setPosition( offset ) );
+		this.translate( offset.x, offset.y, offset.z );
 
 		return offset;
 

+ 1 - 1
src/extras/helpers/ArrowHelper.js

@@ -20,7 +20,7 @@ THREE.ArrowHelper = ( function () {
 	lineGeometry.vertices.push( new THREE.Vector3( 0, 0, 0 ), new THREE.Vector3( 0, 1, 0 ) );
 
 	var coneGeometry = new THREE.CylinderGeometry( 0, 0.5, 1, 5, 1 );
-	coneGeometry.applyMatrix( new THREE.Matrix4().makeTranslation( 0, - 0.5, 0 ) );
+	coneGeometry.translate( 0, - 0.5, 0 );
 
 	return function ArrowHelper( dir, origin, length, color, headLength, headWidth ) {
 

+ 1 - 1
src/extras/helpers/HemisphereLightHelper.js

@@ -16,7 +16,7 @@ THREE.HemisphereLightHelper = function ( light, sphereSize ) {
 	this.colors = [ new THREE.Color(), new THREE.Color() ];
 
 	var geometry = new THREE.SphereGeometry( sphereSize, 4, 2 );
-	geometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) );
+	geometry.rotateX( - Math.PI / 2 );
 
 	for ( var i = 0, il = 8; i < il; i ++ ) {
 

+ 2 - 2
src/extras/helpers/SpotLightHelper.js

@@ -16,8 +16,8 @@ THREE.SpotLightHelper = function ( light ) {
 
 	var geometry = new THREE.CylinderGeometry( 0, 1, 1, 8, 1, true );
 
-	geometry.applyMatrix( new THREE.Matrix4().makeTranslation( 0, - 0.5, 0 ) );
-	geometry.applyMatrix( new THREE.Matrix4().makeRotationX( - Math.PI / 2 ) );
+	geometry.translate( 0, - 0.5, 0 );
+	geometry.rotateX( - Math.PI / 2 );
 
 	var material = new THREE.MeshBasicMaterial( { wireframe: true, fog: false } );