Browse Source

Editor: Switched to BufferGeometry. See #8617.

Mr.doob 9 years ago
parent
commit
ff340dc7fb

+ 8 - 8
editor/js/Menubar.Add.js

@@ -56,7 +56,7 @@ Menubar.Add = function ( editor ) {
 	option.setTextContent( 'Plane' );
 	option.onClick( function () {
 
-		var geometry = new THREE.PlaneGeometry( 2, 2 );
+		var geometry = new THREE.PlaneBufferGeometry( 2, 2 );
 		var material = new THREE.MeshStandardMaterial();
 		var mesh = new THREE.Mesh( geometry, material );
 		mesh.name = 'Plane ' + ( ++ meshCount );
@@ -73,7 +73,7 @@ Menubar.Add = function ( editor ) {
 	option.setTextContent( 'Box' );
 	option.onClick( function () {
 
-		var geometry = new THREE.BoxGeometry( 1, 1, 1 );
+		var geometry = new THREE.BoxBufferGeometry( 1, 1, 1 );
 		var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
 		mesh.name = 'Box ' + ( ++ meshCount );
 
@@ -92,7 +92,7 @@ Menubar.Add = function ( editor ) {
 		var radius = 1;
 		var segments = 32;
 
-		var geometry = new THREE.CircleGeometry( radius, segments );
+		var geometry = new THREE.CircleBufferGeometry( radius, segments );
 		var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
 		mesh.name = 'Circle ' + ( ++ meshCount );
 
@@ -115,7 +115,7 @@ Menubar.Add = function ( editor ) {
 		var heightSegments = 1;
 		var openEnded = false;
 
-		var geometry = new THREE.CylinderGeometry( radiusTop, radiusBottom, height, radiusSegments, heightSegments, openEnded );
+		var geometry = new THREE.CylinderBufferGeometry( radiusTop, radiusBottom, height, radiusSegments, heightSegments, openEnded );
 		var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
 		mesh.name = 'Cylinder ' + ( ++ meshCount );
 
@@ -139,7 +139,7 @@ Menubar.Add = function ( editor ) {
 		var thetaStart = 0;
 		var thetaLength = Math.PI;
 
-		var geometry = new THREE.SphereGeometry( radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength );
+		var geometry = new THREE.SphereBufferGeometry( radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength );
 		var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
 		mesh.name = 'Sphere ' + ( ++ meshCount );
 
@@ -180,7 +180,7 @@ Menubar.Add = function ( editor ) {
 		var tubularSegments = 12;
 		var arc = Math.PI * 2;
 
-		var geometry = new THREE.TorusGeometry( radius, tube, radialSegments, tubularSegments, arc );
+		var geometry = new THREE.TorusBufferGeometry( radius, tube, radialSegments, tubularSegments, arc );
 		var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
 		mesh.name = 'Torus ' + ( ++ meshCount );
 
@@ -203,7 +203,7 @@ Menubar.Add = function ( editor ) {
 		var p = 2;
 		var q = 3;
 
-		var geometry = new THREE.TorusKnotGeometry( radius, tube, tubularSegments, radialSegments, p, q );
+		var geometry = new THREE.TorusKnotBufferGeometry( radius, tube, tubularSegments, radialSegments, p, q );
 		var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
 		mesh.name = 'TorusKnot ' + ( ++ meshCount );
 
@@ -265,7 +265,7 @@ Menubar.Add = function ( editor ) {
 		var phiStart = 0;
 		var phiLength = 2 * Math.PI;
 
-		var geometry = new THREE.LatheGeometry( points, segments, phiStart, phiLength );
+		var geometry = new THREE.LatheBufferGeometry( points, segments, phiStart, phiLength );
 		var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial( { side: THREE.DoubleSide } ) );
 		mesh.name = 'Lathe ' + ( ++ meshCount );
 

+ 6 - 3
editor/js/Sidebar.Geometry.BoxGeometry.js

@@ -8,7 +8,8 @@ Sidebar.Geometry.BoxGeometry = function ( editor, object ) {
 
 	var container = new UI.Row();
 
-	var parameters = object.geometry.parameters;
+	var geometry = object.geometry;
+	var parameters = geometry.parameters;
 
 	// width
 
@@ -74,7 +75,7 @@ Sidebar.Geometry.BoxGeometry = function ( editor, object ) {
 
 	function update() {
 
-		editor.execute( new SetGeometryCommand( object, new THREE.BoxGeometry(
+		editor.execute( new SetGeometryCommand( object, new THREE[ geometry.type ](
 			width.getValue(),
 			height.getValue(),
 			depth.getValue(),
@@ -87,4 +88,6 @@ Sidebar.Geometry.BoxGeometry = function ( editor, object ) {
 
 	return container;
 
-}
+};
+
+Sidebar.Geometry.BoxBufferGeometry = Sidebar.Geometry.BoxGeometry;

+ 6 - 3
editor/js/Sidebar.Geometry.CircleGeometry.js

@@ -8,7 +8,8 @@ Sidebar.Geometry.CircleGeometry = function ( editor, object ) {
 
 	var container = new UI.Row();
 
-	var parameters = object.geometry.parameters;
+	var geometry = object.geometry;
+	var parameters = geometry.parameters;
 
 	// radius
 
@@ -54,7 +55,7 @@ Sidebar.Geometry.CircleGeometry = function ( editor, object ) {
 
 	function update() {
 
-		editor.execute( new SetGeometryCommand( object, new THREE.CircleGeometry(
+		editor.execute( new SetGeometryCommand( object, new THREE[ geometry.type ](
 			radius.getValue(),
 			segments.getValue(),
 			thetaStart.getValue(),
@@ -65,4 +66,6 @@ Sidebar.Geometry.CircleGeometry = function ( editor, object ) {
 
 	return container;
 
-}
+};
+
+Sidebar.Geometry.CircleBufferGeometry = Sidebar.Geometry.CircleGeometry;

+ 6 - 3
editor/js/Sidebar.Geometry.CylinderGeometry.js

@@ -8,7 +8,8 @@ Sidebar.Geometry.CylinderGeometry = function ( editor, object ) {
 
 	var container = new UI.Row();
 
-	var parameters = object.geometry.parameters;
+	var geometry = object.geometry;
+	var parameters = geometry.parameters;
 
 	// radiusTop
 
@@ -74,7 +75,7 @@ Sidebar.Geometry.CylinderGeometry = function ( editor, object ) {
 
 	function update() {
 
-		editor.execute( new SetGeometryCommand( object, new THREE.CylinderGeometry(
+		editor.execute( new SetGeometryCommand( object, new THREE[ geometry.type ](
 			radiusTop.getValue(),
 			radiusBottom.getValue(),
 			height.getValue(),
@@ -87,4 +88,6 @@ Sidebar.Geometry.CylinderGeometry = function ( editor, object ) {
 
 	return container;
 
-}
+};
+
+Sidebar.Geometry.CylinderBufferGeometry = Sidebar.Geometry.CylinderGeometry;

+ 3 - 3
editor/js/Sidebar.Geometry.Geometry.js

@@ -30,7 +30,7 @@ Sidebar.Geometry.Geometry = function ( editor ) {
 
 	//
 
-	var update = function ( object ) {
+	function update( object ) {
 
 		if ( object === null ) return;
 
@@ -49,11 +49,11 @@ Sidebar.Geometry.Geometry = function ( editor ) {
 
 		}
 
-	};
+	}
 
 	signals.objectSelected.add( update );
 	signals.geometryChanged.add( update );
 
 	return container;
 
-}
+};

+ 6 - 3
editor/js/Sidebar.Geometry.IcosahedronGeometry.js

@@ -8,7 +8,8 @@ Sidebar.Geometry.IcosahedronGeometry = function ( editor, object ) {
 
 	var container = new UI.Row();
 
-	var parameters = object.geometry.parameters;
+	var geometry = object.geometry;
+	var parameters = geometry.parameters;
 
 	// radius
 
@@ -35,7 +36,7 @@ Sidebar.Geometry.IcosahedronGeometry = function ( editor, object ) {
 
 	function update() {
 
-		editor.execute( new SetGeometryCommand( object, new THREE.IcosahedronGeometry(
+		editor.execute( new SetGeometryCommand( object, new THREE[ geometry.type ](
 			radius.getValue(),
 			detail.getValue()
 		) ) );
@@ -46,4 +47,6 @@ Sidebar.Geometry.IcosahedronGeometry = function ( editor, object ) {
 
 	return container;
 
-}
+};
+
+Sidebar.Geometry.IcosahedronBufferGeometry = Sidebar.Geometry.IcosahedronGeometry;

+ 6 - 5
editor/js/Sidebar.Geometry.LatheGeometry.js

@@ -8,7 +8,8 @@ Sidebar.Geometry.LatheGeometry = function( editor, object ) {
 
 	var container = new UI.Row();
 
-	var parameters = object.geometry.parameters;
+	var geometry = object.geometry;
+	var parameters = geometry.parameters;
 
 	// segments
 
@@ -133,17 +134,17 @@ Sidebar.Geometry.LatheGeometry = function( editor, object ) {
 
 		}
 
-		var geometry = new THREE.LatheGeometry(
+		editor.execute( new SetGeometryCommand( object, new THREE[ geometry.type ](
 			points,
 			segments.getValue(),
 			phiStart.getValue() / 180 * Math.PI,
 			phiLength.getValue() / 180 * Math.PI
-		);
-
-		editor.execute( new SetGeometryCommand( object, geometry ) );
+		) ) );
 
 	}
 
 	return container;
 
 };
+
+Sidebar.Geometry.LatheBufferGeometry = Sidebar.Geometry.LatheGeometry;

+ 6 - 3
editor/js/Sidebar.Geometry.PlaneGeometry.js

@@ -8,7 +8,8 @@ Sidebar.Geometry.PlaneGeometry = function ( editor, object ) {
 
 	var container = new UI.Row();
 
-	var parameters = object.geometry.parameters;
+	var geometry = object.geometry;
+	var parameters = geometry.parameters;
 
 	// width
 
@@ -55,7 +56,7 @@ Sidebar.Geometry.PlaneGeometry = function ( editor, object ) {
 
 	function update() {
 
-		editor.execute( new SetGeometryCommand( object, new THREE.PlaneGeometry(
+		editor.execute( new SetGeometryCommand( object, new THREE[ geometry.type ](
 			width.getValue(),
 			height.getValue(),
 			widthSegments.getValue(),
@@ -66,4 +67,6 @@ Sidebar.Geometry.PlaneGeometry = function ( editor, object ) {
 
 	return container;
 
-}
+};
+
+Sidebar.Geometry.PlaneBufferGeometry = Sidebar.Geometry.PlaneGeometry;

+ 6 - 3
editor/js/Sidebar.Geometry.SphereGeometry.js

@@ -8,7 +8,8 @@ Sidebar.Geometry.SphereGeometry = function ( editor, object ) {
 
 	var container = new UI.Row();
 
-	var parameters = object.geometry.parameters;
+	var geometry = object.geometry;
+	var parameters = geometry.parameters;
 
 	// radius
 
@@ -85,7 +86,7 @@ Sidebar.Geometry.SphereGeometry = function ( editor, object ) {
 
 	function update() {
 
-		editor.execute( new SetGeometryCommand( object, new THREE.SphereGeometry(
+		editor.execute( new SetGeometryCommand( object, new THREE[ geometry.type ](
 			radius.getValue(),
 			widthSegments.getValue(),
 			heightSegments.getValue(),
@@ -99,4 +100,6 @@ Sidebar.Geometry.SphereGeometry = function ( editor, object ) {
 
 	return container;
 
-}
+};
+
+Sidebar.Geometry.SphereBufferGeometry = Sidebar.Geometry.SphereGeometry;

+ 1 - 1
editor/js/Sidebar.Geometry.TeapotBufferGeometry.js

@@ -100,4 +100,4 @@ Sidebar.Geometry.TeapotBufferGeometry = function ( signals, object ) {
 
 	return container;
 
-}
+};

+ 6 - 3
editor/js/Sidebar.Geometry.TorusGeometry.js

@@ -8,7 +8,8 @@ Sidebar.Geometry.TorusGeometry = function ( editor, object ) {
 
 	var container = new UI.Row();
 
-	var parameters = object.geometry.parameters;
+	var geometry = object.geometry;
+	var parameters = geometry.parameters;
 
 	// radius
 
@@ -65,7 +66,7 @@ Sidebar.Geometry.TorusGeometry = function ( editor, object ) {
 
 	function update() {
 
-		editor.execute( new SetGeometryCommand( object, new THREE.TorusGeometry(
+		editor.execute( new SetGeometryCommand( object, new THREE[ geometry.type ](
 			radius.getValue(),
 			tube.getValue(),
 			radialSegments.getValue(),
@@ -77,4 +78,6 @@ Sidebar.Geometry.TorusGeometry = function ( editor, object ) {
 
 	return container;
 
-}
+};
+
+Sidebar.Geometry.TorusBufferGeometry = Sidebar.Geometry.TorusGeometry;

+ 6 - 3
editor/js/Sidebar.Geometry.TorusKnotGeometry.js

@@ -8,7 +8,8 @@ Sidebar.Geometry.TorusKnotGeometry = function ( editor, object ) {
 
 	var container = new UI.Row();
 
-	var parameters = object.geometry.parameters;
+	var geometry = object.geometry;
+	var parameters = geometry.parameters;
 
 	// radius
 
@@ -75,7 +76,7 @@ Sidebar.Geometry.TorusKnotGeometry = function ( editor, object ) {
 
 	function update() {
 
-		editor.execute( new SetGeometryCommand( object, new THREE.TorusKnotGeometry(
+		editor.execute( new SetGeometryCommand( object, new THREE[ geometry.type ](
 			radius.getValue(),
 			tube.getValue(),
 			tubularSegments.getValue(),
@@ -88,4 +89,6 @@ Sidebar.Geometry.TorusKnotGeometry = function ( editor, object ) {
 
 	return container;
 
-}
+};
+
+Sidebar.Geometry.TorusKnotBufferGeometry = Sidebar.Geometry.TorusKnotGeometry;