浏览代码

ShapeGeometry: Make all parameters optional. (#22513)

Michael Herzog 3 年之前
父节点
当前提交
d9450c906b

+ 1 - 1
docs/api/en/geometries/ShapeGeometry.html

@@ -59,7 +59,7 @@
 
 
 		<h3>[name]([param:Array shapes], [param:Integer curveSegments])</h3>
 		<h3>[name]([param:Array shapes], [param:Integer curveSegments])</h3>
 		<p>
 		<p>
-		shapes — [page:Array] of shapes or a single [page:Shape shape].<br />
+		shapes — [page:Array] of shapes or a single [page:Shape shape]. Default is a single triangle shape.<br />
 		curveSegments - [page:Integer] - Number of segments per shape. Default is 12.
 		curveSegments - [page:Integer] - Number of segments per shape. Default is 12.
 		</p>
 		</p>
 
 

+ 1 - 1
docs/api/zh/geometries/ShapeGeometry.html

@@ -59,7 +59,7 @@
 
 
 		<h3>[name]([param:Array shapes], [param:Integer curveSegments])</h3>
 		<h3>[name]([param:Array shapes], [param:Integer curveSegments])</h3>
 		<p>
 		<p>
-		shapes — 一个单独的[page:Shape shape],或者一个包含形状的[page:Array]。<br />
+		shapes — 一个单独的[page:Shape shape],或者一个包含形状的[page:Array]。Default is a single triangle shape.<br />
 		curveSegments - [page:Integer] - 每一个形状的分段数,默认值为12。
 		curveSegments - [page:Integer] - 每一个形状的分段数,默认值为12。
 		</p>
 		</p>
 
 

+ 3 - 1
src/geometries/ShapeGeometry.js

@@ -1,10 +1,12 @@
 import { BufferGeometry } from '../core/BufferGeometry.js';
 import { BufferGeometry } from '../core/BufferGeometry.js';
 import { Float32BufferAttribute } from '../core/BufferAttribute.js';
 import { Float32BufferAttribute } from '../core/BufferAttribute.js';
+import { Shape } from '../extras/core/Shape.js';
 import { ShapeUtils } from '../extras/ShapeUtils.js';
 import { ShapeUtils } from '../extras/ShapeUtils.js';
+import { Vector2 } from '../math/Vector2.js';
 
 
 class ShapeGeometry extends BufferGeometry {
 class ShapeGeometry extends BufferGeometry {
 
 
-	constructor( shapes, curveSegments = 12 ) {
+	constructor( shapes = new Shape( [ new Vector2( 0, 0.5 ), new Vector2( - 0.5, - 0.5 ), new Vector2( 0.5, - 0.5 ) ] ), curveSegments = 12 ) {
 
 
 		super();
 		super();
 		this.type = 'ShapeGeometry';
 		this.type = 'ShapeGeometry';