浏览代码

ParametricGeometry: Remove from core. (#22559)

* ParametricGeometry: Remove from core.

* Examples: Clean up.
Michael Herzog 3 年之前
父节点
当前提交
a86bfbcc7d

+ 1 - 3
docs/api/en/geometries/ParametricGeometry.html → docs/examples/en/geometries/ParametricGeometry.html

@@ -13,8 +13,6 @@
 
 		<p class="desc">Generate geometry representing a parametric surface.</p>
 
-		<iframe id="scene" src="scenes/geometry-browser.html#ParametricGeometry"></iframe>
-
 		<script>
 
 		// iOS iframe auto-resize workaround
@@ -65,7 +63,7 @@
 		<h2>Source</h2>
 
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+			[link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/geometries/ParametricGeometry.js examples/jsm/geometries/ParametricGeometry.js]
 		</p>
 	</body>
 </html>

+ 1 - 3
docs/api/zh/geometries/ParametricGeometry.html → docs/examples/zh/geometries/ParametricGeometry.html

@@ -13,8 +13,6 @@
 
 		<p class="desc">生成由参数表示其表面的几何体。</p>
 
-		<iframe id="scene" src="scenes/geometry-browser.html#ParametricGeometry"></iframe>
-
 		<script>
 
 		// iOS iframe auto-resize workaround
@@ -65,7 +63,7 @@
 		<h2>方法</h2>
 
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+			[link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/geometries/ParametricGeometry.js examples/jsm/geometries/ParametricGeometry.js]
 		</p>
 	</body>
 </html>

+ 4 - 4
docs/list.json

@@ -148,7 +148,6 @@
 				"IcosahedronGeometry": "api/en/geometries/IcosahedronGeometry",
 				"LatheGeometry": "api/en/geometries/LatheGeometry",
 				"OctahedronGeometry": "api/en/geometries/OctahedronGeometry",
-				"ParametricGeometry": "api/en/geometries/ParametricGeometry",
 				"PlaneGeometry": "api/en/geometries/PlaneGeometry",
 				"PolyhedronGeometry": "api/en/geometries/PolyhedronGeometry",
 				"RingGeometry": "api/en/geometries/RingGeometry",
@@ -351,7 +350,8 @@
 
 			"Geometries": {
 				"ConvexGeometry": "examples/en/geometries/ConvexGeometry",
-				"DecalGeometry": "examples/en/geometries/DecalGeometry"
+				"DecalGeometry": "examples/en/geometries/DecalGeometry",
+				"ParametricGeometry": "examples/en/geometries/ParametricGeometry"
 			},
 
 			"Helpers": {
@@ -658,7 +658,6 @@
 				"IcosahedronGeometry": "api/zh/geometries/IcosahedronGeometry",
 				"LatheGeometry": "api/zh/geometries/LatheGeometry",
 				"OctahedronGeometry": "api/zh/geometries/OctahedronGeometry",
-				"ParametricGeometry": "api/zh/geometries/ParametricGeometry",
 				"PlaneGeometry": "api/zh/geometries/PlaneGeometry",
 				"PolyhedronGeometry": "api/zh/geometries/PolyhedronGeometry",
 				"RingGeometry": "api/zh/geometries/RingGeometry",
@@ -860,7 +859,8 @@
 
 			"几何体": {
 				"ConvexGeometry": "examples/zh/geometries/ConvexGeometry",
-				"DecalGeometry": "examples/zh/geometries/DecalGeometry"
+				"DecalGeometry": "examples/zh/geometries/DecalGeometry",
+				"ParametricGeometry": "examples/zh/geometries/ParametricGeometry"
 			},
 
 			"辅助对象": {

+ 0 - 25
docs/scenes/geometry-browser.html

@@ -47,7 +47,6 @@
 				Mesh,
 				MeshPhongMaterial,
 				OctahedronGeometry,
-				ParametricGeometry,
 				PerspectiveCamera,
 				PlaneGeometry,
 				PointLight,
@@ -655,30 +654,6 @@
 
 				},
 
-				ParametricGeometry: function ( mesh ) {
-
-					const data = {
-						slices: 25,
-						stacks: 25
-					};
-
-					function generateGeometry() {
-
-						updateGroupGeometry( mesh,
-							new ParametricGeometry( ParametricGeometries.klein, data.slices, data.stacks )
-						);
-
-					}
-
-					const folder = gui.addFolder( 'THREE.ParametricGeometry' );
-
-					folder.add( data, 'slices', 1, 100 ).step( 1 ).onChange( generateGeometry );
-					folder.add( data, 'stacks', 1, 100 ).step( 1 ).onChange( generateGeometry );
-
-					generateGeometry();
-
-				},
-
 				TubeGeometry: function ( mesh ) {
 
 					const data = {

+ 2 - 1
examples/jsm/geometries/ParametricGeometries.js

@@ -1,9 +1,10 @@
 import {
 	Curve,
-	ParametricGeometry,
 	Vector3
 } from '../../../build/three.module.js';
 
+import { ParametricGeometry } from './ParametricGeometry.js';
+
 /**
  * Experimenting of primitive geometry creation using Surface Parametric equations
  */

+ 5 - 3
src/geometries/ParametricGeometry.js → examples/jsm/geometries/ParametricGeometry.js

@@ -3,9 +3,11 @@
  * based on the brilliant article by @prideout https://prideout.net/blog/old/blog/index.html@p=44.html
  */
 
-import { BufferGeometry } from '../core/BufferGeometry.js';
-import { Float32BufferAttribute } from '../core/BufferAttribute.js';
-import { Vector3 } from '../math/Vector3.js';
+import {
+	BufferGeometry,
+	Float32BufferAttribute,
+	Vector3
+} from '../../../build/three.module.js';
 
 class ParametricGeometry extends BufferGeometry {
 

+ 2 - 1
examples/webgl_animation_cloth.html

@@ -29,6 +29,7 @@
 			import { GUI } from './jsm/libs/dat.gui.module.js';
 
 			import { OrbitControls } from './jsm/controls/OrbitControls.js';
+			import { ParametricGeometry } from './jsm/geometries/ParametricGeometry.js';
 
 			/*
 			 * Cloth Simulation using a relaxed constraints solver
@@ -466,7 +467,7 @@
 
 				// cloth geometry
 
-				clothGeometry = new THREE.ParametricBufferGeometry( clothFunction, cloth.w, cloth.h );
+				clothGeometry = new ParametricGeometry( clothFunction, cloth.w, cloth.h );
 
 				// cloth mesh
 

+ 4 - 3
examples/webgl_geometries_parametric.html

@@ -18,6 +18,7 @@
 			import Stats from './jsm/libs/stats.module.js';
 
 			import { Curves } from './jsm/curves/CurveExtras.js';
+			import { ParametricGeometry } from './jsm/geometries/ParametricGeometry.js';
 			import { ParametricGeometries } from './jsm/geometries/ParametricGeometries.js';
 
 			let camera, scene, renderer, stats;
@@ -55,19 +56,19 @@
 
 				let geometry, object;
 
-				geometry = new THREE.ParametricBufferGeometry( ParametricGeometries.plane( 100, 100 ), 10, 10 );
+				geometry = new ParametricGeometry( ParametricGeometries.plane( 100, 100 ), 10, 10 );
 				geometry.center();
 				object = new THREE.Mesh( geometry, material );
 				object.position.set( - 200, 0, 200 );
 				scene.add( object );
 
-				geometry = new THREE.ParametricBufferGeometry( ParametricGeometries.klein, 20, 20 );
+				geometry = new ParametricGeometry( ParametricGeometries.klein, 20, 20 );
 				object = new THREE.Mesh( geometry, material );
 				object.position.set( 0, 0, 200 );
 				object.scale.multiplyScalar( 5 );
 				scene.add( object );
 
-				geometry = new THREE.ParametricBufferGeometry( ParametricGeometries.mobius, 20, 20 );
+				geometry = new ParametricGeometry( ParametricGeometries.mobius, 20, 20 );
 				object = new THREE.Mesh( geometry, material );
 				object.position.set( 200, 0, 200 );
 				object.scale.multiplyScalar( 30 );

+ 2 - 1
examples/webgl_geometry_nurbs.html

@@ -28,6 +28,7 @@
 
 			import { NURBSCurve } from './jsm/curves/NURBSCurve.js';
 			import { NURBSSurface } from './jsm/curves/NURBSSurface.js';
+			import { ParametricGeometry } from './jsm/geometries/ParametricGeometry.js';
 
 			let container, stats;
 
@@ -152,7 +153,7 @@
 
 				}
 
-				const geometry = new THREE.ParametricBufferGeometry( getSurfacePoint, 20, 20 );
+				const geometry = new ParametricGeometry( getSurfacePoint, 20, 20 );
 				const material = new THREE.MeshLambertMaterial( { map: map, side: THREE.DoubleSide } );
 				const object = new THREE.Mesh( geometry, material );
 				object.position.set( - 200, 100, 0 );

+ 0 - 1
src/geometries/Geometries.js

@@ -8,7 +8,6 @@ export * from './ExtrudeGeometry.js';
 export * from './IcosahedronGeometry.js';
 export * from './LatheGeometry.js';
 export * from './OctahedronGeometry.js';
-export * from './ParametricGeometry.js';
 export * from './PlaneGeometry.js';
 export * from './PolyhedronGeometry.js';
 export * from './RingGeometry.js';

+ 0 - 42
test/unit/src/geometries/ParametricGeometry.tests.js

@@ -1,42 +0,0 @@
-/* global QUnit */
-
-import { ParametricGeometry, ParametricBufferGeometry } from '../../../../src/geometries/ParametricGeometry';
-
-export default QUnit.module( 'Geometries', () => {
-
-	QUnit.module( 'ParametricGeometry', ( hooks ) => {
-
-		var geometries = undefined;
-		hooks.beforeEach( function () {
-
-			geometries = [
-				new ParametricGeometry(),
-				new ParametricBufferGeometry()
-			];
-
-		} );
-
-		// INHERITANCE
-		QUnit.todo( "Extending", ( assert ) => {
-
-			assert.ok( false, "everything's gonna be alright" );
-
-		} );
-
-		// INSTANCING
-		QUnit.todo( "Instancing", ( assert ) => {
-
-			assert.ok( false, "everything's gonna be alright" );
-
-		} );
-
-		// OTHERS
-		QUnit.todo( 'Standard geometry tests', ( assert ) => {
-
-			assert.ok( false, "everything's gonna be alright" );
-
-		} );
-
-	} );
-
-} );

+ 0 - 1
test/unit/three.source.unit.js

@@ -97,7 +97,6 @@ import './src/geometries/ExtrudeGeometry.tests';
 import './src/geometries/IcosahedronGeometry.tests';
 import './src/geometries/LatheGeometry.tests';
 import './src/geometries/OctahedronGeometry.tests';
-import './src/geometries/ParametricGeometry.tests';
 import './src/geometries/PlaneGeometry.tests';
 import './src/geometries/PolyhedronGeometry.tests';
 import './src/geometries/RingGeometry.tests';