瀏覽代碼

Geometries: Split files.

Mr.doob 4 年之前
父節點
當前提交
1040b5c971
共有 100 個文件被更改,包括 3015 次插入2854 次删除
  1. 1 1
      docs/api/en/geometries/BoxBufferGeometry.html
  2. 1 1
      docs/api/en/geometries/CircleBufferGeometry.html
  3. 2 2
      docs/api/en/geometries/ConeBufferGeometry.html
  4. 1 1
      docs/api/en/geometries/CylinderBufferGeometry.html
  5. 1 1
      docs/api/en/geometries/DodecahedronBufferGeometry.html
  6. 1 1
      docs/api/en/geometries/ExtrudeBufferGeometry.html
  7. 1 1
      docs/api/en/geometries/IcosahedronBufferGeometry.html
  8. 1 1
      docs/api/en/geometries/LatheBufferGeometry.html
  9. 1 1
      docs/api/en/geometries/OctahedronBufferGeometry.html
  10. 1 1
      docs/api/en/geometries/ParametricBufferGeometry.html
  11. 1 1
      docs/api/en/geometries/PlaneBufferGeometry.html
  12. 1 1
      docs/api/en/geometries/PolyhedronBufferGeometry.html
  13. 1 1
      docs/api/en/geometries/RingBufferGeometry.html
  14. 1 1
      docs/api/en/geometries/ShapeBufferGeometry.html
  15. 1 1
      docs/api/en/geometries/SphereBufferGeometry.html
  16. 1 1
      docs/api/en/geometries/TetrahedronBufferGeometry.html
  17. 1 1
      docs/api/en/geometries/TextBufferGeometry.html
  18. 1 1
      docs/api/en/geometries/TorusBufferGeometry.html
  19. 1 1
      docs/api/en/geometries/TorusKnotBufferGeometry.html
  20. 1 1
      docs/api/en/geometries/TubeBufferGeometry.html
  21. 1 1
      docs/api/zh/geometries/BoxBufferGeometry.html
  22. 1 1
      docs/api/zh/geometries/CircleBufferGeometry.html
  23. 1 1
      docs/api/zh/geometries/ConeBufferGeometry.html
  24. 1 1
      docs/api/zh/geometries/CylinderBufferGeometry.html
  25. 1 1
      docs/api/zh/geometries/DodecahedronBufferGeometry.html
  26. 1 2
      docs/api/zh/geometries/DodecahedronGeometry.html
  27. 1 1
      docs/api/zh/geometries/ExtrudeBufferGeometry.html
  28. 1 1
      docs/api/zh/geometries/IcosahedronBufferGeometry.html
  29. 1 1
      docs/api/zh/geometries/LatheBufferGeometry.html
  30. 1 1
      docs/api/zh/geometries/OctahedronBufferGeometry.html
  31. 1 1
      docs/api/zh/geometries/ParametricBufferGeometry.html
  32. 1 1
      docs/api/zh/geometries/PlaneBufferGeometry.html
  33. 1 1
      docs/api/zh/geometries/PolyhedronBufferGeometry.html
  34. 1 1
      docs/api/zh/geometries/RingBufferGeometry.html
  35. 1 1
      docs/api/zh/geometries/ShapeBufferGeometry.html
  36. 1 1
      docs/api/zh/geometries/SphereBufferGeometry.html
  37. 1 1
      docs/api/zh/geometries/TetrahedronBufferGeometry.html
  38. 1 1
      docs/api/zh/geometries/TextBufferGeometry.html
  39. 1 1
      docs/api/zh/geometries/TorusBufferGeometry.html
  40. 1 1
      docs/api/zh/geometries/TorusKnotBufferGeometry.html
  41. 1 1
      docs/api/zh/geometries/TubeBufferGeometry.html
  42. 1 1
      src/Three.Legacy.js
  43. 36 0
      src/geometries/BoxBufferGeometry.d.ts
  44. 164 0
      src/geometries/BoxBufferGeometry.js
  45. 1 41
      src/geometries/BoxGeometry.d.ts
  46. 2 167
      src/geometries/BoxGeometry.js
  47. 30 0
      src/geometries/CircleBufferGeometry.d.ts
  48. 89 0
      src/geometries/CircleBufferGeometry.js
  49. 0 30
      src/geometries/CircleGeometry.d.ts
  50. 2 92
      src/geometries/CircleGeometry.js
  51. 30 0
      src/geometries/ConeBufferGeometry.d.ts
  52. 24 0
      src/geometries/ConeBufferGeometry.js
  53. 0 30
      src/geometries/ConeGeometry.d.ts
  54. 1 28
      src/geometries/ConeGeometry.js
  55. 42 0
      src/geometries/CylinderBufferGeometry.d.ts
  56. 277 0
      src/geometries/CylinderBufferGeometry.js
  57. 0 42
      src/geometries/CylinderGeometry.d.ts
  58. 2 280
      src/geometries/CylinderGeometry.js
  59. 16 0
      src/geometries/DodecahedronBufferGeometry.d.ts
  60. 60 0
      src/geometries/DodecahedronBufferGeometry.js
  61. 0 16
      src/geometries/DodecahedronGeometry.d.ts
  62. 2 63
      src/geometries/DodecahedronGeometry.js
  63. 71 0
      src/geometries/ExtrudeBufferGeometry.d.ts
  64. 785 0
      src/geometries/ExtrudeBufferGeometry.js
  65. 1 19
      src/geometries/ExtrudeGeometry.d.ts
  66. 3 741
      src/geometries/ExtrudeGeometry.js
  67. 41 21
      src/geometries/Geometries.js
  68. 16 0
      src/geometries/IcosahedronBufferGeometry.d.ts
  69. 36 0
      src/geometries/IcosahedronBufferGeometry.js
  70. 2 20
      src/geometries/IcosahedronGeometry.d.ts
  71. 2 39
      src/geometries/IcosahedronGeometry.js
  72. 31 0
      src/geometries/LatheBufferGeometry.d.ts
  73. 153 0
      src/geometries/LatheBufferGeometry.js
  74. 0 30
      src/geometries/LatheGeometry.d.ts
  75. 2 156
      src/geometries/LatheGeometry.js
  76. 16 0
      src/geometries/OctahedronBufferGeometry.d.ts
  77. 31 0
      src/geometries/OctahedronBufferGeometry.js
  78. 2 20
      src/geometries/OctahedronGeometry.d.ts
  79. 2 35
      src/geometries/OctahedronGeometry.js
  80. 23 0
      src/geometries/ParametricBufferGeometry.d.ts
  81. 133 0
      src/geometries/ParametricBufferGeometry.js
  82. 0 22
      src/geometries/ParametricGeometry.d.ts
  83. 3 131
      src/geometries/ParametricGeometry.js
  84. 30 0
      src/geometries/PlaneBufferGeometry.d.ts
  85. 93 0
      src/geometries/PlaneBufferGeometry.js
  86. 0 30
      src/geometries/PlaneGeometry.d.ts
  87. 2 96
      src/geometries/PlaneGeometry.js
  88. 30 0
      src/geometries/PolyhedronBufferGeometry.d.ts
  89. 306 0
      src/geometries/PolyhedronBufferGeometry.js
  90. 0 32
      src/geometries/PolyhedronGeometry.d.ts
  91. 2 310
      src/geometries/PolyhedronGeometry.js
  92. 36 0
      src/geometries/RingBufferGeometry.d.ts
  93. 118 0
      src/geometries/RingBufferGeometry.js
  94. 0 36
      src/geometries/RingGeometry.d.ts
  95. 2 121
      src/geometries/RingGeometry.js
  96. 13 0
      src/geometries/ShapeBufferGeometry.d.ts
  97. 168 0
      src/geometries/ShapeBufferGeometry.js
  98. 0 12
      src/geometries/ShapeGeometry.d.ts
  99. 2 150
      src/geometries/ShapeGeometry.js
  100. 39 0
      src/geometries/SphereBufferGeometry.d.ts

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

@@ -75,7 +75,7 @@
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/BoxGeometry.js src/geometries/BoxGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -65,7 +65,7 @@
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/CircleGeometry.js src/geometries/CircleGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

+ 2 - 2
docs/api/en/geometries/ConeBufferGeometry.html

@@ -67,7 +67,7 @@
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/ConeGeometry.js src/geometries/ConeGeometry.js]
-		</p>	
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -68,7 +68,7 @@
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/CylinderGeometry.js src/geometries/CylinderGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -54,7 +54,7 @@
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/DodecahedronGeometry.js src/geometries/DodecahedronGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -108,7 +108,7 @@
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/ExtrudeGeometry.js src/geometries/ExtrudeGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -53,7 +53,7 @@
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/IcosahedronGeometry.js src/geometries/IcosahedronGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -72,7 +72,7 @@
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/LatheGeometry.js src/geometries/LatheGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -53,7 +53,7 @@
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/OctahedronGeometry.js src/geometries/OctahedronGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -66,7 +66,7 @@
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/ParametricGeometry.js src/geometries/ParametricGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -64,7 +64,7 @@
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/PlaneGeometry.js src/geometries/PlaneGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -63,7 +63,7 @@ var geometry = new THREE.PolyhedronBufferGeometry( verticesOfCube, indicesOfFace
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/PolyhedronGeometry.js src/geometries/PolyhedronGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -67,7 +67,7 @@
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/RingGeometry.js src/geometries/RingGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -78,7 +78,7 @@
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/ShapeGeometry.js src/geometries/ShapeGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -72,7 +72,7 @@
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/SphereGeometry.js src/geometries/SphereGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -54,7 +54,7 @@
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/TetrahedronGeometry.js src/geometries/TetrahedronGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -171,7 +171,7 @@
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/TextGeometry.js src/geometries/TextGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -65,7 +65,7 @@
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/TorusGeometry.js src/geometries/TorusGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -68,7 +68,7 @@
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/TorusKnotGeometry.js src/geometries/TorusKnotGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -105,7 +105,7 @@
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/TubeGeometry.js src/geometries/TubeGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -76,7 +76,7 @@
 		<h2>源代码</h2>
 		<h2>源代码</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/BoxGeometry.js src/geometries/BoxGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -65,7 +65,7 @@
 		<h2>源代码</h2>
 		<h2>源代码</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/CircleGeometry.js src/geometries/CircleGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -67,7 +67,7 @@
 		<h2>源代码</h2>
 		<h2>源代码</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/ConeGeometry.js src/geometries/ConeGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -68,7 +68,7 @@
 		<h2>源代码</h2>
 		<h2>源代码</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/CylinderGeometry.js src/geometries/CylinderGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -54,7 +54,7 @@
 		<h2>源代码</h2>
 		<h2>源代码</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/DodecahedronGeometry.js src/geometries/DodecahedronGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

+ 1 - 2
docs/api/zh/geometries/DodecahedronGeometry.html

@@ -54,8 +54,7 @@
 
 
 	<h2>源代码</h2>
 	<h2>源代码</h2>
 
 
-	[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/DodecahedronGeometry.js
-	src/geometries/DodecahedronGeometry.js]
+	[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 </body>
 </body>
 
 
 </html>
 </html>

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

@@ -107,7 +107,7 @@
 		<h2>源代码</h2>
 		<h2>源代码</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/ExtrudeGeometry.js src/geometries/ExtrudeGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -53,7 +53,7 @@
 		<h2>源代码</h2>
 		<h2>源代码</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/IcosahedronGeometry.js src/geometries/IcosahedronGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -72,7 +72,7 @@
 		<h2>源代码</h2>
 		<h2>源代码</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/LatheGeometry.js src/geometries/LatheGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -54,7 +54,7 @@
 		<h2>源代码</h2>
 		<h2>源代码</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/OctahedronGeometry.js src/geometries/OctahedronGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -66,7 +66,7 @@
 		<h2>方法</h2>
 		<h2>方法</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/ParametricGeometry.js src/geometries/ParametricGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -64,7 +64,7 @@
 		<h2>源代码</h2>
 		<h2>源代码</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/PlaneGeometry.js src/geometries/PlaneGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -62,7 +62,7 @@ var geometry = new THREE.PolyhedronBufferGeometry( verticesOfCube, indicesOfFace
 		<h2>源代码</h2>
 		<h2>源代码</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/PolyhedronGeometry.js src/geometries/PolyhedronGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -67,7 +67,7 @@
 		<h2>源代码</h2>
 		<h2>源代码</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/RingGeometry.js src/geometries/RingGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -78,7 +78,7 @@
 		<h2>源代码</h2>
 		<h2>源代码</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/ShapeGeometry.js src/geometries/ShapeGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -74,7 +74,7 @@
 		<h2>源代码</h2>
 		<h2>源代码</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/SphereGeometry.js src/geometries/SphereGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -54,7 +54,7 @@
 		<h2>源代码</h2>
 		<h2>源代码</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/TetrahedronGeometry.js src/geometries/TetrahedronGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -169,7 +169,7 @@
 		<h2>源代码</h2>
 		<h2>源代码</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/TextGeometry.js src/geometries/TextGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -65,7 +65,7 @@
 		<h2>源代码</h2>
 		<h2>源代码</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/TorusGeometry.js src/geometries/TorusGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -68,7 +68,7 @@
 		<h2>源代码</h2>
 		<h2>源代码</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/TorusKnotGeometry.js src/geometries/TorusKnotGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

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

@@ -105,7 +105,7 @@
 		<h2>源代码</h2>
 		<h2>源代码</h2>
 
 
 		<p>
 		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/geometries/TubeGeometry.js src/geometries/TubeGeometry.js]
+			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>
 	</body>
 	</body>
 </html>
 </html>

+ 1 - 1
src/Three.Legacy.js

@@ -40,7 +40,7 @@ import { SkeletonHelper } from './helpers/SkeletonHelper.js';
 import { BoxGeometry } from './geometries/BoxGeometry.js';
 import { BoxGeometry } from './geometries/BoxGeometry.js';
 import { EdgesGeometry } from './geometries/EdgesGeometry.js';
 import { EdgesGeometry } from './geometries/EdgesGeometry.js';
 import { ExtrudeGeometry } from './geometries/ExtrudeGeometry.js';
 import { ExtrudeGeometry } from './geometries/ExtrudeGeometry.js';
-import { ExtrudeBufferGeometry } from './geometries/ExtrudeGeometry.js';
+import { ExtrudeBufferGeometry } from './geometries/ExtrudeBufferGeometry.js';
 import { ShapeGeometry } from './geometries/ShapeGeometry.js';
 import { ShapeGeometry } from './geometries/ShapeGeometry.js';
 import { WireframeGeometry } from './geometries/WireframeGeometry.js';
 import { WireframeGeometry } from './geometries/WireframeGeometry.js';
 import { Light } from './lights/Light.js';
 import { Light } from './lights/Light.js';

+ 36 - 0
src/geometries/BoxBufferGeometry.d.ts

@@ -0,0 +1,36 @@
+import { BufferGeometry } from '../core/BufferGeometry';
+
+export class BoxBufferGeometry extends BufferGeometry {
+
+	/**
+	 * @param [width=1] — Width of the sides on the X axis.
+	 * @param [height=1] — Height of the sides on the Y axis.
+	 * @param [depth=1] — Depth of the sides on the Z axis.
+	 * @param [widthSegments=1] — Number of segmented faces along the width of the sides.
+	 * @param [heightSegments=1] — Number of segmented faces along the height of the sides.
+	 * @param [depthSegments=1] — Number of segmented faces along the depth of the sides.
+	 */
+	constructor(
+		width?: number,
+		height?: number,
+		depth?: number,
+		widthSegments?: number,
+		heightSegments?: number,
+		depthSegments?: number
+	);
+
+	/**
+	 * @default 'BoxBufferGeometry'
+	 */
+	type: string;
+
+	parameters: {
+		width: number;
+		height: number;
+		depth: number;
+		widthSegments: number;
+		heightSegments: number;
+		depthSegments: number;
+	};
+
+}

+ 164 - 0
src/geometries/BoxBufferGeometry.js

@@ -0,0 +1,164 @@
+import { BufferGeometry } from '../core/BufferGeometry.js';
+import { Float32BufferAttribute } from '../core/BufferAttribute.js';
+import { Vector3 } from '../math/Vector3.js';
+
+class BoxBufferGeometry extends BufferGeometry {
+
+	constructor( width = 1, height = 1, depth = 1, widthSegments = 1, heightSegments = 1, depthSegments = 1 ) {
+
+		super();
+
+		this.type = 'BoxBufferGeometry';
+
+		this.parameters = {
+			width: width,
+			height: height,
+			depth: depth,
+			widthSegments: widthSegments,
+			heightSegments: heightSegments,
+			depthSegments: depthSegments
+		};
+
+		const scope = this;
+
+		// segments
+
+		widthSegments = Math.floor( widthSegments );
+		heightSegments = Math.floor( heightSegments );
+		depthSegments = Math.floor( depthSegments );
+
+		// buffers
+
+		const indices = [];
+		const vertices = [];
+		const normals = [];
+		const uvs = [];
+
+		// helper variables
+
+		let numberOfVertices = 0;
+		let groupStart = 0;
+
+		// build each side of the box geometry
+
+		buildPlane( 'z', 'y', 'x', - 1, - 1, depth, height, width, depthSegments, heightSegments, 0 ); // px
+		buildPlane( 'z', 'y', 'x', 1, - 1, depth, height, - width, depthSegments, heightSegments, 1 ); // nx
+		buildPlane( 'x', 'z', 'y', 1, 1, width, depth, height, widthSegments, depthSegments, 2 ); // py
+		buildPlane( 'x', 'z', 'y', 1, - 1, width, depth, - height, widthSegments, depthSegments, 3 ); // ny
+		buildPlane( 'x', 'y', 'z', 1, - 1, width, height, depth, widthSegments, heightSegments, 4 ); // pz
+		buildPlane( 'x', 'y', 'z', - 1, - 1, width, height, - depth, widthSegments, heightSegments, 5 ); // nz
+
+		// build geometry
+
+		this.setIndex( indices );
+		this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
+		this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
+		this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
+
+		function buildPlane( u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex ) {
+
+			const segmentWidth = width / gridX;
+			const segmentHeight = height / gridY;
+
+			const widthHalf = width / 2;
+			const heightHalf = height / 2;
+			const depthHalf = depth / 2;
+
+			const gridX1 = gridX + 1;
+			const gridY1 = gridY + 1;
+
+			let vertexCounter = 0;
+			let groupCount = 0;
+
+			const vector = new Vector3();
+
+			// generate vertices, normals and uvs
+
+			for ( let iy = 0; iy < gridY1; iy ++ ) {
+
+				const y = iy * segmentHeight - heightHalf;
+
+				for ( let ix = 0; ix < gridX1; ix ++ ) {
+
+					const x = ix * segmentWidth - widthHalf;
+
+					// set values to correct vector component
+
+					vector[ u ] = x * udir;
+					vector[ v ] = y * vdir;
+					vector[ w ] = depthHalf;
+
+					// now apply vector to vertex buffer
+
+					vertices.push( vector.x, vector.y, vector.z );
+
+					// set values to correct vector component
+
+					vector[ u ] = 0;
+					vector[ v ] = 0;
+					vector[ w ] = depth > 0 ? 1 : - 1;
+
+					// now apply vector to normal buffer
+
+					normals.push( vector.x, vector.y, vector.z );
+
+					// uvs
+
+					uvs.push( ix / gridX );
+					uvs.push( 1 - ( iy / gridY ) );
+
+					// counters
+
+					vertexCounter += 1;
+
+				}
+
+			}
+
+			// indices
+
+			// 1. you need three indices to draw a single face
+			// 2. a single segment consists of two faces
+			// 3. so we need to generate six (2*3) indices per segment
+
+			for ( let iy = 0; iy < gridY; iy ++ ) {
+
+				for ( let ix = 0; ix < gridX; ix ++ ) {
+
+					const a = numberOfVertices + ix + gridX1 * iy;
+					const b = numberOfVertices + ix + gridX1 * ( iy + 1 );
+					const c = numberOfVertices + ( ix + 1 ) + gridX1 * ( iy + 1 );
+					const d = numberOfVertices + ( ix + 1 ) + gridX1 * iy;
+
+					// faces
+
+					indices.push( a, b, d );
+					indices.push( b, c, d );
+
+					// increase counter
+
+					groupCount += 6;
+
+				}
+
+			}
+
+			// add a group to the geometry. this will ensure multi material support
+
+			scope.addGroup( groupStart, groupCount, materialIndex );
+
+			// calculate new start value for groups
+
+			groupStart += groupCount;
+
+			// update total number of vertices
+
+			numberOfVertices += vertexCounter;
+
+		}
+
+	}
+
+}
+
+export { BoxBufferGeometry };

+ 1 - 41
src/geometries/BoxGeometry.d.ts

@@ -1,45 +1,5 @@
-import { Geometry } from '../core/Geometry';
-import { BufferGeometry } from '../core/BufferGeometry';
+import { Geometry } from './../core/Geometry';
 
 
-// Extras / Geometries /////////////////////////////////////////////////////////////////////
-export class BoxBufferGeometry extends BufferGeometry {
-
-	/**
-	 * @param [width=1] — Width of the sides on the X axis.
-	 * @param [height=1] — Height of the sides on the Y axis.
-	 * @param [depth=1] — Depth of the sides on the Z axis.
-	 * @param [widthSegments=1] — Number of segmented faces along the width of the sides.
-	 * @param [heightSegments=1] — Number of segmented faces along the height of the sides.
-	 * @param [depthSegments=1] — Number of segmented faces along the depth of the sides.
-	 */
-	constructor(
-		width?: number,
-		height?: number,
-		depth?: number,
-		widthSegments?: number,
-		heightSegments?: number,
-		depthSegments?: number
-	);
-
-	/**
-	 * @default 'BoxBufferGeometry'
-	 */
-	type: string;
-
-	parameters: {
-		width: number;
-		height: number;
-		depth: number;
-		widthSegments: number;
-		heightSegments: number;
-		depthSegments: number;
-	};
-
-}
-
-/**
- * BoxGeometry is the quadrilateral primitive geometry class. It is typically used for creating a cube or irregular quadrilateral of the dimensions provided within the (optional) 'width', 'height', & 'depth' constructor arguments.
- */
 export class BoxGeometry extends Geometry {
 export class BoxGeometry extends Geometry {
 
 
 	/**
 	/**

+ 2 - 167
src/geometries/BoxGeometry.js

@@ -1,9 +1,5 @@
 import { Geometry } from '../core/Geometry.js';
 import { Geometry } from '../core/Geometry.js';
-import { BufferGeometry } from '../core/BufferGeometry.js';
-import { Float32BufferAttribute } from '../core/BufferAttribute.js';
-import { Vector3 } from '../math/Vector3.js';
-
-// BoxGeometry
+import { BoxBufferGeometry } from './BoxBufferGeometry.js';
 
 
 class BoxGeometry extends Geometry {
 class BoxGeometry extends Geometry {
 
 
@@ -29,165 +25,4 @@ class BoxGeometry extends Geometry {
 
 
 }
 }
 
 
-// BoxBufferGeometry
-
-class BoxBufferGeometry extends BufferGeometry {
-
-	constructor( width = 1, height = 1, depth = 1, widthSegments = 1, heightSegments = 1, depthSegments = 1 ) {
-
-		super();
-
-		this.type = 'BoxBufferGeometry';
-
-		this.parameters = {
-			width: width,
-			height: height,
-			depth: depth,
-			widthSegments: widthSegments,
-			heightSegments: heightSegments,
-			depthSegments: depthSegments
-		};
-
-		const scope = this;
-
-		// segments
-
-		widthSegments = Math.floor( widthSegments );
-		heightSegments = Math.floor( heightSegments );
-		depthSegments = Math.floor( depthSegments );
-
-		// buffers
-
-		const indices = [];
-		const vertices = [];
-		const normals = [];
-		const uvs = [];
-
-		// helper variables
-
-		let numberOfVertices = 0;
-		let groupStart = 0;
-
-		// build each side of the box geometry
-
-		buildPlane( 'z', 'y', 'x', - 1, - 1, depth, height, width, depthSegments, heightSegments, 0 ); // px
-		buildPlane( 'z', 'y', 'x', 1, - 1, depth, height, - width, depthSegments, heightSegments, 1 ); // nx
-		buildPlane( 'x', 'z', 'y', 1, 1, width, depth, height, widthSegments, depthSegments, 2 ); // py
-		buildPlane( 'x', 'z', 'y', 1, - 1, width, depth, - height, widthSegments, depthSegments, 3 ); // ny
-		buildPlane( 'x', 'y', 'z', 1, - 1, width, height, depth, widthSegments, heightSegments, 4 ); // pz
-		buildPlane( 'x', 'y', 'z', - 1, - 1, width, height, - depth, widthSegments, heightSegments, 5 ); // nz
-
-		// build geometry
-
-		this.setIndex( indices );
-		this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
-		this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
-		this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
-
-		function buildPlane( u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex ) {
-
-			const segmentWidth = width / gridX;
-			const segmentHeight = height / gridY;
-
-			const widthHalf = width / 2;
-			const heightHalf = height / 2;
-			const depthHalf = depth / 2;
-
-			const gridX1 = gridX + 1;
-			const gridY1 = gridY + 1;
-
-			let vertexCounter = 0;
-			let groupCount = 0;
-
-			const vector = new Vector3();
-
-			// generate vertices, normals and uvs
-
-			for ( let iy = 0; iy < gridY1; iy ++ ) {
-
-				const y = iy * segmentHeight - heightHalf;
-
-				for ( let ix = 0; ix < gridX1; ix ++ ) {
-
-					const x = ix * segmentWidth - widthHalf;
-
-					// set values to correct vector component
-
-					vector[ u ] = x * udir;
-					vector[ v ] = y * vdir;
-					vector[ w ] = depthHalf;
-
-					// now apply vector to vertex buffer
-
-					vertices.push( vector.x, vector.y, vector.z );
-
-					// set values to correct vector component
-
-					vector[ u ] = 0;
-					vector[ v ] = 0;
-					vector[ w ] = depth > 0 ? 1 : - 1;
-
-					// now apply vector to normal buffer
-
-					normals.push( vector.x, vector.y, vector.z );
-
-					// uvs
-
-					uvs.push( ix / gridX );
-					uvs.push( 1 - ( iy / gridY ) );
-
-					// counters
-
-					vertexCounter += 1;
-
-				}
-
-			}
-
-			// indices
-
-			// 1. you need three indices to draw a single face
-			// 2. a single segment consists of two faces
-			// 3. so we need to generate six (2*3) indices per segment
-
-			for ( let iy = 0; iy < gridY; iy ++ ) {
-
-				for ( let ix = 0; ix < gridX; ix ++ ) {
-
-					const a = numberOfVertices + ix + gridX1 * iy;
-					const b = numberOfVertices + ix + gridX1 * ( iy + 1 );
-					const c = numberOfVertices + ( ix + 1 ) + gridX1 * ( iy + 1 );
-					const d = numberOfVertices + ( ix + 1 ) + gridX1 * iy;
-
-					// faces
-
-					indices.push( a, b, d );
-					indices.push( b, c, d );
-
-					// increase counter
-
-					groupCount += 6;
-
-				}
-
-			}
-
-			// add a group to the geometry. this will ensure multi material support
-
-			scope.addGroup( groupStart, groupCount, materialIndex );
-
-			// calculate new start value for groups
-
-			groupStart += groupCount;
-
-			// update total number of vertices
-
-			numberOfVertices += vertexCounter;
-
-		}
-
-	}
-
-}
-
-export { BoxGeometry, BoxBufferGeometry };
+export { BoxGeometry };

+ 30 - 0
src/geometries/CircleBufferGeometry.d.ts

@@ -0,0 +1,30 @@
+import { BufferGeometry } from '../core/BufferGeometry';
+
+export class CircleBufferGeometry extends BufferGeometry {
+
+	/**
+	 * @param [radius=1]
+	 * @param [segments=8]
+	 * @param [thetaStart=0]
+	 * @param [widthSegments=Math.PI * 2]
+	 */
+	constructor(
+		radius?: number,
+		segments?: number,
+		thetaStart?: number,
+		thetaLength?: number
+	);
+
+	/**
+	 * @default 'CircleBufferGeometry'
+	 */
+	type: string;
+
+	parameters: {
+		radius: number;
+		segments: number;
+		thetaStart: number;
+		thetaLength: number;
+	};
+
+}

+ 89 - 0
src/geometries/CircleBufferGeometry.js

@@ -0,0 +1,89 @@
+import { BufferGeometry } from '../core/BufferGeometry.js';
+import { Float32BufferAttribute } from '../core/BufferAttribute.js';
+import { Vector3 } from '../math/Vector3.js';
+import { Vector2 } from '../math/Vector2.js';
+
+class CircleBufferGeometry extends BufferGeometry {
+
+	constructor( radius, segments, thetaStart, thetaLength ) {
+
+		super();
+
+		this.type = 'CircleBufferGeometry';
+
+		this.parameters = {
+			radius: radius,
+			segments: segments,
+			thetaStart: thetaStart,
+			thetaLength: thetaLength
+		};
+
+		radius = radius || 1;
+		segments = segments !== undefined ? Math.max( 3, segments ) : 8;
+
+		thetaStart = thetaStart !== undefined ? thetaStart : 0;
+		thetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2;
+
+		// buffers
+
+		const indices = [];
+		const vertices = [];
+		const normals = [];
+		const uvs = [];
+
+		// helper variables
+
+		const vertex = new Vector3();
+		const uv = new Vector2();
+
+		// center point
+
+		vertices.push( 0, 0, 0 );
+		normals.push( 0, 0, 1 );
+		uvs.push( 0.5, 0.5 );
+
+		for ( let s = 0, i = 3; s <= segments; s ++, i += 3 ) {
+
+			const segment = thetaStart + s / segments * thetaLength;
+
+			// vertex
+
+			vertex.x = radius * Math.cos( segment );
+			vertex.y = radius * Math.sin( segment );
+
+			vertices.push( vertex.x, vertex.y, vertex.z );
+
+			// normal
+
+			normals.push( 0, 0, 1 );
+
+			// uvs
+
+			uv.x = ( vertices[ i ] / radius + 1 ) / 2;
+			uv.y = ( vertices[ i + 1 ] / radius + 1 ) / 2;
+
+			uvs.push( uv.x, uv.y );
+
+		}
+
+		// indices
+
+		for ( let i = 1; i <= segments; i ++ ) {
+
+			indices.push( i, i + 1, 0 );
+
+		}
+
+		// build geometry
+
+		this.setIndex( indices );
+		this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
+		this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
+		this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
+
+	}
+
+}
+
+
+export { CircleBufferGeometry };

+ 0 - 30
src/geometries/CircleGeometry.d.ts

@@ -1,34 +1,4 @@
 import { Geometry } from './../core/Geometry';
 import { Geometry } from './../core/Geometry';
-import { BufferGeometry } from '../core/BufferGeometry';
-
-export class CircleBufferGeometry extends BufferGeometry {
-
-	/**
-	 * @param [radius=1]
-	 * @param [segments=8]
-	 * @param [thetaStart=0]
-	 * @param [widthSegments=Math.PI * 2]
-	 */
-	constructor(
-		radius?: number,
-		segments?: number,
-		thetaStart?: number,
-		thetaLength?: number
-	);
-
-	/**
-	 * @default 'CircleBufferGeometry'
-	 */
-	type: string;
-
-	parameters: {
-		radius: number;
-		segments: number;
-		thetaStart: number;
-		thetaLength: number;
-	};
-
-}
 
 
 export class CircleGeometry extends Geometry {
 export class CircleGeometry extends Geometry {
 
 

+ 2 - 92
src/geometries/CircleGeometry.js

@@ -1,10 +1,5 @@
 import { Geometry } from '../core/Geometry.js';
 import { Geometry } from '../core/Geometry.js';
-import { BufferGeometry } from '../core/BufferGeometry.js';
-import { Float32BufferAttribute } from '../core/BufferAttribute.js';
-import { Vector3 } from '../math/Vector3.js';
-import { Vector2 } from '../math/Vector2.js';
-
-// CircleGeometry
+import { CircleBufferGeometry } from './CircleBufferGeometry.js';
 
 
 class CircleGeometry extends Geometry {
 class CircleGeometry extends Geometry {
 
 
@@ -27,89 +22,4 @@ class CircleGeometry extends Geometry {
 
 
 }
 }
 
 
-// CircleBufferGeometry
-
-class CircleBufferGeometry extends BufferGeometry {
-
-	constructor( radius, segments, thetaStart, thetaLength ) {
-
-		super();
-
-		this.type = 'CircleBufferGeometry';
-
-		this.parameters = {
-			radius: radius,
-			segments: segments,
-			thetaStart: thetaStart,
-			thetaLength: thetaLength
-		};
-
-		radius = radius || 1;
-		segments = segments !== undefined ? Math.max( 3, segments ) : 8;
-
-		thetaStart = thetaStart !== undefined ? thetaStart : 0;
-		thetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2;
-
-		// buffers
-
-		const indices = [];
-		const vertices = [];
-		const normals = [];
-		const uvs = [];
-
-		// helper variables
-
-		const vertex = new Vector3();
-		const uv = new Vector2();
-
-		// center point
-
-		vertices.push( 0, 0, 0 );
-		normals.push( 0, 0, 1 );
-		uvs.push( 0.5, 0.5 );
-
-		for ( let s = 0, i = 3; s <= segments; s ++, i += 3 ) {
-
-			const segment = thetaStart + s / segments * thetaLength;
-
-			// vertex
-
-			vertex.x = radius * Math.cos( segment );
-			vertex.y = radius * Math.sin( segment );
-
-			vertices.push( vertex.x, vertex.y, vertex.z );
-
-			// normal
-
-			normals.push( 0, 0, 1 );
-
-			// uvs
-
-			uv.x = ( vertices[ i ] / radius + 1 ) / 2;
-			uv.y = ( vertices[ i + 1 ] / radius + 1 ) / 2;
-
-			uvs.push( uv.x, uv.y );
-
-		}
-
-		// indices
-
-		for ( let i = 1; i <= segments; i ++ ) {
-
-			indices.push( i, i + 1, 0 );
-
-		}
-
-		// build geometry
-
-		this.setIndex( indices );
-		this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
-		this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
-		this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
-
-	}
-
-}
-
-
-export { CircleGeometry, CircleBufferGeometry };
+export { CircleGeometry };

+ 30 - 0
src/geometries/ConeBufferGeometry.d.ts

@@ -0,0 +1,30 @@
+import { CylinderBufferGeometry } from './CylinderGeometry';
+
+export class ConeBufferGeometry extends CylinderBufferGeometry {
+
+	/**
+	 * @param [radiusTop=0] — Radius of the cylinder at the top.
+	 * @param [radiusBottom=1] — Radius of the cylinder at the bottom.
+	 * @param [height=1] — Height of the cylinder.
+	 * @param [radiusSegments=8] — Number of segmented faces around the circumference of the cylinder.
+	 * @param [heightSegments=1] — Number of rows of faces along the height of the cylinder.
+	 * @param [openEnded=false] - A Boolean indicating whether or not to cap the ends of the cylinder.
+	 * @param [thetaStart=0]
+	 * @param [widthSegments=Math.PI * 2]
+	 */
+	constructor(
+		radius?: number,
+		height?: number,
+		radialSegment?: number,
+		heightSegment?: number,
+		openEnded?: boolean,
+		thetaStart?: number,
+		thetaLength?: number
+	);
+
+	/**
+	 * @default 'ConeBufferGeometry'
+	 */
+	type: string;
+
+}

+ 24 - 0
src/geometries/ConeBufferGeometry.js

@@ -0,0 +1,24 @@
+import { CylinderBufferGeometry } from './CylinderBufferGeometry.js';
+
+class ConeBufferGeometry extends CylinderBufferGeometry {
+
+	constructor( radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength ) {
+
+		super( 0, radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength );
+		this.type = 'ConeBufferGeometry';
+
+		this.parameters = {
+			radius: radius,
+			height: height,
+			radialSegments: radialSegments,
+			heightSegments: heightSegments,
+			openEnded: openEnded,
+			thetaStart: thetaStart,
+			thetaLength: thetaLength
+		};
+
+	}
+
+}
+
+export { ConeBufferGeometry };

+ 0 - 30
src/geometries/ConeGeometry.d.ts

@@ -1,34 +1,4 @@
 import { CylinderGeometry } from './CylinderGeometry';
 import { CylinderGeometry } from './CylinderGeometry';
-import { CylinderBufferGeometry } from './CylinderGeometry';
-
-export class ConeBufferGeometry extends CylinderBufferGeometry {
-
-	/**
-	 * @param [radiusTop=0] — Radius of the cylinder at the top.
-	 * @param [radiusBottom=1] — Radius of the cylinder at the bottom.
-	 * @param [height=1] — Height of the cylinder.
-	 * @param [radiusSegments=8] — Number of segmented faces around the circumference of the cylinder.
-	 * @param [heightSegments=1] — Number of rows of faces along the height of the cylinder.
-	 * @param [openEnded=false] - A Boolean indicating whether or not to cap the ends of the cylinder.
-	 * @param [thetaStart=0]
-	 * @param [widthSegments=Math.PI * 2]
-	 */
-	constructor(
-		radius?: number,
-		height?: number,
-		radialSegment?: number,
-		heightSegment?: number,
-		openEnded?: boolean,
-		thetaStart?: number,
-		thetaLength?: number
-	);
-
-	/**
-	 * @default 'ConeBufferGeometry'
-	 */
-	type: string;
-
-}
 
 
 export class ConeGeometry extends CylinderGeometry {
 export class ConeGeometry extends CylinderGeometry {
 
 

+ 1 - 28
src/geometries/ConeGeometry.js

@@ -1,7 +1,4 @@
 import { CylinderGeometry } from './CylinderGeometry.js';
 import { CylinderGeometry } from './CylinderGeometry.js';
-import { CylinderBufferGeometry } from './CylinderGeometry.js';
-
-// ConeGeometry
 
 
 class ConeGeometry extends CylinderGeometry {
 class ConeGeometry extends CylinderGeometry {
 
 
@@ -24,28 +21,4 @@ class ConeGeometry extends CylinderGeometry {
 
 
 }
 }
 
 
-// ConeBufferGeometry
-
-class ConeBufferGeometry extends CylinderBufferGeometry {
-
-	constructor( radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength ) {
-
-		super( 0, radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength );
-		this.type = 'ConeBufferGeometry';
-
-		this.parameters = {
-			radius: radius,
-			height: height,
-			radialSegments: radialSegments,
-			heightSegments: heightSegments,
-			openEnded: openEnded,
-			thetaStart: thetaStart,
-			thetaLength: thetaLength
-		};
-
-	}
-
-}
-
-
-export { ConeGeometry, ConeBufferGeometry };
+export { ConeGeometry };

+ 42 - 0
src/geometries/CylinderBufferGeometry.d.ts

@@ -0,0 +1,42 @@
+import { BufferGeometry } from '../core/BufferGeometry';
+
+export class CylinderBufferGeometry extends BufferGeometry {
+
+	/**
+	 * @param [radiusTop=1] — Radius of the cylinder at the top.
+	 * @param [radiusBottom=1] — Radius of the cylinder at the bottom.
+	 * @param [height=1] — Height of the cylinder.
+	 * @param [radiusSegments=8] — Number of segmented faces around the circumference of the cylinder.
+	 * @param [heightSegments=1] — Number of rows of faces along the height of the cylinder.
+	 * @param [openEnded=false] - A Boolean indicating whether or not to cap the ends of the cylinder.
+	 * @param [thetaStart=0]
+	 * @param [widthSegments=Math.PI * 2]
+	 */
+	constructor(
+		radiusTop?: number,
+		radiusBottom?: number,
+		height?: number,
+		radialSegments?: number,
+		heightSegments?: number,
+		openEnded?: boolean,
+		thetaStart?: number,
+		thetaLength?: number
+	);
+
+	/**
+	 * @default 'CylinderBufferGeometry'
+	 */
+	type: string;
+
+	parameters: {
+		radiusTop: number;
+		radiusBottom: number;
+		height: number;
+		radialSegments: number;
+		heightSegments: number;
+		openEnded: boolean;
+		thetaStart: number;
+		thetaLength: number;
+	};
+
+}

+ 277 - 0
src/geometries/CylinderBufferGeometry.js

@@ -0,0 +1,277 @@
+import { BufferGeometry } from '../core/BufferGeometry.js';
+import { Float32BufferAttribute } from '../core/BufferAttribute.js';
+import { Vector3 } from '../math/Vector3.js';
+import { Vector2 } from '../math/Vector2.js';
+
+class CylinderBufferGeometry extends BufferGeometry {
+
+	constructor( radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength ) {
+
+		super();
+		this.type = 'CylinderBufferGeometry';
+
+		this.parameters = {
+			radiusTop: radiusTop,
+			radiusBottom: radiusBottom,
+			height: height,
+			radialSegments: radialSegments,
+			heightSegments: heightSegments,
+			openEnded: openEnded,
+			thetaStart: thetaStart,
+			thetaLength: thetaLength
+		};
+
+		const scope = this;
+
+		radiusTop = radiusTop !== undefined ? radiusTop : 1;
+		radiusBottom = radiusBottom !== undefined ? radiusBottom : 1;
+		height = height || 1;
+
+		radialSegments = Math.floor( radialSegments ) || 8;
+		heightSegments = Math.floor( heightSegments ) || 1;
+
+		openEnded = openEnded !== undefined ? openEnded : false;
+		thetaStart = thetaStart !== undefined ? thetaStart : 0.0;
+		thetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2;
+
+		// buffers
+
+		const indices = [];
+		const vertices = [];
+		const normals = [];
+		const uvs = [];
+
+		// helper variables
+
+		let index = 0;
+		const indexArray = [];
+		const halfHeight = height / 2;
+		let groupStart = 0;
+
+		// generate geometry
+
+		generateTorso();
+
+		if ( openEnded === false ) {
+
+			if ( radiusTop > 0 ) generateCap( true );
+			if ( radiusBottom > 0 ) generateCap( false );
+
+		}
+
+		// build geometry
+
+		this.setIndex( indices );
+		this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
+		this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
+		this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
+
+		function generateTorso() {
+
+			const normal = new Vector3();
+			const vertex = new Vector3();
+
+			let groupCount = 0;
+
+			// this will be used to calculate the normal
+			const slope = ( radiusBottom - radiusTop ) / height;
+
+			// generate vertices, normals and uvs
+
+			for ( let y = 0; y <= heightSegments; y ++ ) {
+
+				const indexRow = [];
+
+				const v = y / heightSegments;
+
+				// calculate the radius of the current row
+
+				const radius = v * ( radiusBottom - radiusTop ) + radiusTop;
+
+				for ( let x = 0; x <= radialSegments; x ++ ) {
+
+					const u = x / radialSegments;
+
+					const theta = u * thetaLength + thetaStart;
+
+					const sinTheta = Math.sin( theta );
+					const cosTheta = Math.cos( theta );
+
+					// vertex
+
+					vertex.x = radius * sinTheta;
+					vertex.y = - v * height + halfHeight;
+					vertex.z = radius * cosTheta;
+					vertices.push( vertex.x, vertex.y, vertex.z );
+
+					// normal
+
+					normal.set( sinTheta, slope, cosTheta ).normalize();
+					normals.push( normal.x, normal.y, normal.z );
+
+					// uv
+
+					uvs.push( u, 1 - v );
+
+					// save index of vertex in respective row
+
+					indexRow.push( index ++ );
+
+				}
+
+				// now save vertices of the row in our index array
+
+				indexArray.push( indexRow );
+
+			}
+
+			// generate indices
+
+			for ( let x = 0; x < radialSegments; x ++ ) {
+
+				for ( let y = 0; y < heightSegments; y ++ ) {
+
+					// we use the index array to access the correct indices
+
+					const a = indexArray[ y ][ x ];
+					const b = indexArray[ y + 1 ][ x ];
+					const c = indexArray[ y + 1 ][ x + 1 ];
+					const d = indexArray[ y ][ x + 1 ];
+
+					// faces
+
+					indices.push( a, b, d );
+					indices.push( b, c, d );
+
+					// update group counter
+
+					groupCount += 6;
+
+				}
+
+			}
+
+			// add a group to the geometry. this will ensure multi material support
+
+			scope.addGroup( groupStart, groupCount, 0 );
+
+			// calculate new start value for groups
+
+			groupStart += groupCount;
+
+		}
+
+		function generateCap( top ) {
+
+			// save the index of the first center vertex
+			const centerIndexStart = index;
+
+			const uv = new Vector2();
+			const vertex = new Vector3();
+
+			let groupCount = 0;
+
+			const radius = ( top === true ) ? radiusTop : radiusBottom;
+			const sign = ( top === true ) ? 1 : - 1;
+
+			// first we generate the center vertex data of the cap.
+			// because the geometry needs one set of uvs per face,
+			// we must generate a center vertex per face/segment
+
+			for ( let x = 1; x <= radialSegments; x ++ ) {
+
+				// vertex
+
+				vertices.push( 0, halfHeight * sign, 0 );
+
+				// normal
+
+				normals.push( 0, sign, 0 );
+
+				// uv
+
+				uvs.push( 0.5, 0.5 );
+
+				// increase index
+
+				index ++;
+
+			}
+
+			// save the index of the last center vertex
+			const centerIndexEnd = index;
+
+			// now we generate the surrounding vertices, normals and uvs
+
+			for ( let x = 0; x <= radialSegments; x ++ ) {
+
+				const u = x / radialSegments;
+				const theta = u * thetaLength + thetaStart;
+
+				const cosTheta = Math.cos( theta );
+				const sinTheta = Math.sin( theta );
+
+				// vertex
+
+				vertex.x = radius * sinTheta;
+				vertex.y = halfHeight * sign;
+				vertex.z = radius * cosTheta;
+				vertices.push( vertex.x, vertex.y, vertex.z );
+
+				// normal
+
+				normals.push( 0, sign, 0 );
+
+				// uv
+
+				uv.x = ( cosTheta * 0.5 ) + 0.5;
+				uv.y = ( sinTheta * 0.5 * sign ) + 0.5;
+				uvs.push( uv.x, uv.y );
+
+				// increase index
+
+				index ++;
+
+			}
+
+			// generate indices
+
+			for ( let x = 0; x < radialSegments; x ++ ) {
+
+				const c = centerIndexStart + x;
+				const i = centerIndexEnd + x;
+
+				if ( top === true ) {
+
+					// face top
+
+					indices.push( i, i + 1, c );
+
+				} else {
+
+					// face bottom
+
+					indices.push( i + 1, i, c );
+
+				}
+
+				groupCount += 3;
+
+			}
+
+			// add a group to the geometry. this will ensure multi material support
+
+			scope.addGroup( groupStart, groupCount, top === true ? 1 : 2 );
+
+			// calculate new start value for groups
+
+			groupStart += groupCount;
+
+		}
+
+	}
+
+}
+
+
+export { CylinderBufferGeometry };

+ 0 - 42
src/geometries/CylinderGeometry.d.ts

@@ -1,46 +1,4 @@
 import { Geometry } from './../core/Geometry';
 import { Geometry } from './../core/Geometry';
-import { BufferGeometry } from '../core/BufferGeometry';
-
-export class CylinderBufferGeometry extends BufferGeometry {
-
-	/**
-	 * @param [radiusTop=1] — Radius of the cylinder at the top.
-	 * @param [radiusBottom=1] — Radius of the cylinder at the bottom.
-	 * @param [height=1] — Height of the cylinder.
-	 * @param [radiusSegments=8] — Number of segmented faces around the circumference of the cylinder.
-	 * @param [heightSegments=1] — Number of rows of faces along the height of the cylinder.
-	 * @param [openEnded=false] - A Boolean indicating whether or not to cap the ends of the cylinder.
-	 * @param [thetaStart=0]
-	 * @param [widthSegments=Math.PI * 2]
-	 */
-	constructor(
-		radiusTop?: number,
-		radiusBottom?: number,
-		height?: number,
-		radialSegments?: number,
-		heightSegments?: number,
-		openEnded?: boolean,
-		thetaStart?: number,
-		thetaLength?: number
-	);
-
-	/**
-	 * @default 'CylinderBufferGeometry'
-	 */
-	type: string;
-
-	parameters: {
-		radiusTop: number;
-		radiusBottom: number;
-		height: number;
-		radialSegments: number;
-		heightSegments: number;
-		openEnded: boolean;
-		thetaStart: number;
-		thetaLength: number;
-	};
-
-}
 
 
 export class CylinderGeometry extends Geometry {
 export class CylinderGeometry extends Geometry {
 
 

+ 2 - 280
src/geometries/CylinderGeometry.js

@@ -1,10 +1,5 @@
 import { Geometry } from '../core/Geometry.js';
 import { Geometry } from '../core/Geometry.js';
-import { BufferGeometry } from '../core/BufferGeometry.js';
-import { Float32BufferAttribute } from '../core/BufferAttribute.js';
-import { Vector3 } from '../math/Vector3.js';
-import { Vector2 } from '../math/Vector2.js';
-
-// CylinderGeometry
+import { CylinderBufferGeometry } from './CylinderBufferGeometry.js';
 
 
 class CylinderGeometry extends Geometry {
 class CylinderGeometry extends Geometry {
 
 
@@ -31,277 +26,4 @@ class CylinderGeometry extends Geometry {
 
 
 }
 }
 
 
-// CylinderBufferGeometry
-
-class CylinderBufferGeometry extends BufferGeometry {
-
-	constructor( radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength ) {
-
-		super();
-		this.type = 'CylinderBufferGeometry';
-
-		this.parameters = {
-			radiusTop: radiusTop,
-			radiusBottom: radiusBottom,
-			height: height,
-			radialSegments: radialSegments,
-			heightSegments: heightSegments,
-			openEnded: openEnded,
-			thetaStart: thetaStart,
-			thetaLength: thetaLength
-		};
-
-		const scope = this;
-
-		radiusTop = radiusTop !== undefined ? radiusTop : 1;
-		radiusBottom = radiusBottom !== undefined ? radiusBottom : 1;
-		height = height || 1;
-
-		radialSegments = Math.floor( radialSegments ) || 8;
-		heightSegments = Math.floor( heightSegments ) || 1;
-
-		openEnded = openEnded !== undefined ? openEnded : false;
-		thetaStart = thetaStart !== undefined ? thetaStart : 0.0;
-		thetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2;
-
-		// buffers
-
-		const indices = [];
-		const vertices = [];
-		const normals = [];
-		const uvs = [];
-
-		// helper variables
-
-		let index = 0;
-		const indexArray = [];
-		const halfHeight = height / 2;
-		let groupStart = 0;
-
-		// generate geometry
-
-		generateTorso();
-
-		if ( openEnded === false ) {
-
-			if ( radiusTop > 0 ) generateCap( true );
-			if ( radiusBottom > 0 ) generateCap( false );
-
-		}
-
-		// build geometry
-
-		this.setIndex( indices );
-		this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
-		this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
-		this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
-
-		function generateTorso() {
-
-			const normal = new Vector3();
-			const vertex = new Vector3();
-
-			let groupCount = 0;
-
-			// this will be used to calculate the normal
-			const slope = ( radiusBottom - radiusTop ) / height;
-
-			// generate vertices, normals and uvs
-
-			for ( let y = 0; y <= heightSegments; y ++ ) {
-
-				const indexRow = [];
-
-				const v = y / heightSegments;
-
-				// calculate the radius of the current row
-
-				const radius = v * ( radiusBottom - radiusTop ) + radiusTop;
-
-				for ( let x = 0; x <= radialSegments; x ++ ) {
-
-					const u = x / radialSegments;
-
-					const theta = u * thetaLength + thetaStart;
-
-					const sinTheta = Math.sin( theta );
-					const cosTheta = Math.cos( theta );
-
-					// vertex
-
-					vertex.x = radius * sinTheta;
-					vertex.y = - v * height + halfHeight;
-					vertex.z = radius * cosTheta;
-					vertices.push( vertex.x, vertex.y, vertex.z );
-
-					// normal
-
-					normal.set( sinTheta, slope, cosTheta ).normalize();
-					normals.push( normal.x, normal.y, normal.z );
-
-					// uv
-
-					uvs.push( u, 1 - v );
-
-					// save index of vertex in respective row
-
-					indexRow.push( index ++ );
-
-				}
-
-				// now save vertices of the row in our index array
-
-				indexArray.push( indexRow );
-
-			}
-
-			// generate indices
-
-			for ( let x = 0; x < radialSegments; x ++ ) {
-
-				for ( let y = 0; y < heightSegments; y ++ ) {
-
-					// we use the index array to access the correct indices
-
-					const a = indexArray[ y ][ x ];
-					const b = indexArray[ y + 1 ][ x ];
-					const c = indexArray[ y + 1 ][ x + 1 ];
-					const d = indexArray[ y ][ x + 1 ];
-
-					// faces
-
-					indices.push( a, b, d );
-					indices.push( b, c, d );
-
-					// update group counter
-
-					groupCount += 6;
-
-				}
-
-			}
-
-			// add a group to the geometry. this will ensure multi material support
-
-			scope.addGroup( groupStart, groupCount, 0 );
-
-			// calculate new start value for groups
-
-			groupStart += groupCount;
-
-		}
-
-		function generateCap( top ) {
-
-			// save the index of the first center vertex
-			const centerIndexStart = index;
-
-			const uv = new Vector2();
-			const vertex = new Vector3();
-
-			let groupCount = 0;
-
-			const radius = ( top === true ) ? radiusTop : radiusBottom;
-			const sign = ( top === true ) ? 1 : - 1;
-
-			// first we generate the center vertex data of the cap.
-			// because the geometry needs one set of uvs per face,
-			// we must generate a center vertex per face/segment
-
-			for ( let x = 1; x <= radialSegments; x ++ ) {
-
-				// vertex
-
-				vertices.push( 0, halfHeight * sign, 0 );
-
-				// normal
-
-				normals.push( 0, sign, 0 );
-
-				// uv
-
-				uvs.push( 0.5, 0.5 );
-
-				// increase index
-
-				index ++;
-
-			}
-
-			// save the index of the last center vertex
-			const centerIndexEnd = index;
-
-			// now we generate the surrounding vertices, normals and uvs
-
-			for ( let x = 0; x <= radialSegments; x ++ ) {
-
-				const u = x / radialSegments;
-				const theta = u * thetaLength + thetaStart;
-
-				const cosTheta = Math.cos( theta );
-				const sinTheta = Math.sin( theta );
-
-				// vertex
-
-				vertex.x = radius * sinTheta;
-				vertex.y = halfHeight * sign;
-				vertex.z = radius * cosTheta;
-				vertices.push( vertex.x, vertex.y, vertex.z );
-
-				// normal
-
-				normals.push( 0, sign, 0 );
-
-				// uv
-
-				uv.x = ( cosTheta * 0.5 ) + 0.5;
-				uv.y = ( sinTheta * 0.5 * sign ) + 0.5;
-				uvs.push( uv.x, uv.y );
-
-				// increase index
-
-				index ++;
-
-			}
-
-			// generate indices
-
-			for ( let x = 0; x < radialSegments; x ++ ) {
-
-				const c = centerIndexStart + x;
-				const i = centerIndexEnd + x;
-
-				if ( top === true ) {
-
-					// face top
-
-					indices.push( i, i + 1, c );
-
-				} else {
-
-					// face bottom
-
-					indices.push( i + 1, i, c );
-
-				}
-
-				groupCount += 3;
-
-			}
-
-			// add a group to the geometry. this will ensure multi material support
-
-			scope.addGroup( groupStart, groupCount, top === true ? 1 : 2 );
-
-			// calculate new start value for groups
-
-			groupStart += groupCount;
-
-		}
-
-	}
-
-}
-
-
-export { CylinderGeometry, CylinderBufferGeometry };
+export { CylinderGeometry };

+ 16 - 0
src/geometries/DodecahedronBufferGeometry.d.ts

@@ -0,0 +1,16 @@
+import { PolyhedronBufferGeometry } from './PolyhedronBufferGeometry';
+
+export class DodecahedronBufferGeometry extends PolyhedronBufferGeometry {
+
+	/**
+	 * @param [radius=1]
+	 * @param [detail=0]
+	 */
+	constructor( radius?: number, detail?: number );
+
+	/**
+	 * @default 'DodecahedronBufferGeometry'
+	 */
+	type: string;
+
+}

+ 60 - 0
src/geometries/DodecahedronBufferGeometry.js

@@ -0,0 +1,60 @@
+import { PolyhedronBufferGeometry } from './PolyhedronBufferGeometry.js';
+
+class DodecahedronBufferGeometry extends PolyhedronBufferGeometry {
+
+	constructor( radius, detail ) {
+
+		const t = ( 1 + Math.sqrt( 5 ) ) / 2;
+		const r = 1 / t;
+
+		const vertices = [
+
+			// (±1, ±1, ±1)
+			- 1, - 1, - 1,	- 1, - 1, 1,
+			- 1, 1, - 1, - 1, 1, 1,
+			1, - 1, - 1, 1, - 1, 1,
+			1, 1, - 1, 1, 1, 1,
+
+			// (0, ±1/φ, ±φ)
+			0, - r, - t, 0, - r, t,
+			0, r, - t, 0, r, t,
+
+			// (±1/φ, ±φ, 0)
+			- r, - t, 0, - r, t, 0,
+			r, - t, 0, r, t, 0,
+
+			// (±φ, 0, ±1/φ)
+			- t, 0, - r, t, 0, - r,
+			- t, 0, r, t, 0, r
+		];
+
+		const indices = [
+			3, 11, 7, 	3, 7, 15, 	3, 15, 13,
+			7, 19, 17, 	7, 17, 6, 	7, 6, 15,
+			17, 4, 8, 	17, 8, 10, 	17, 10, 6,
+			8, 0, 16, 	8, 16, 2, 	8, 2, 10,
+			0, 12, 1, 	0, 1, 18, 	0, 18, 16,
+			6, 10, 2, 	6, 2, 13, 	6, 13, 15,
+			2, 16, 18, 	2, 18, 3, 	2, 3, 13,
+			18, 1, 9, 	18, 9, 11, 	18, 11, 3,
+			4, 14, 12, 	4, 12, 0, 	4, 0, 8,
+			11, 9, 5, 	11, 5, 19, 	11, 19, 7,
+			19, 5, 14, 	19, 14, 4, 	19, 4, 17,
+			1, 12, 14, 	1, 14, 5, 	1, 5, 9
+		];
+
+		super( vertices, indices, radius, detail );
+
+		this.type = 'DodecahedronBufferGeometry';
+
+		this.parameters = {
+			radius: radius,
+			detail: detail
+		};
+
+	}
+
+}
+
+
+export { DodecahedronBufferGeometry };

+ 0 - 16
src/geometries/DodecahedronGeometry.d.ts

@@ -1,20 +1,4 @@
 import { Geometry } from './../core/Geometry';
 import { Geometry } from './../core/Geometry';
-import { PolyhedronBufferGeometry } from './PolyhedronGeometry';
-
-export class DodecahedronBufferGeometry extends PolyhedronBufferGeometry {
-
-	/**
-	 * @param [radius=1]
-	 * @param [detail=0]
-	 */
-	constructor( radius?: number, detail?: number );
-
-	/**
-	 * @default 'DodecahedronBufferGeometry'
-	 */
-	type: string;
-
-}
 
 
 export class DodecahedronGeometry extends Geometry {
 export class DodecahedronGeometry extends Geometry {
 
 

+ 2 - 63
src/geometries/DodecahedronGeometry.js

@@ -1,7 +1,5 @@
 import { Geometry } from '../core/Geometry.js';
 import { Geometry } from '../core/Geometry.js';
-import { PolyhedronBufferGeometry } from './PolyhedronGeometry.js';
-
-// DodecahedronGeometry
+import { DodecahedronBufferGeometry } from './DodecahedronBufferGeometry.js';
 
 
 class DodecahedronGeometry extends Geometry {
 class DodecahedronGeometry extends Geometry {
 
 
@@ -22,63 +20,4 @@ class DodecahedronGeometry extends Geometry {
 
 
 }
 }
 
 
-// DodecahedronBufferGeometry
-
-class DodecahedronBufferGeometry extends PolyhedronBufferGeometry {
-
-	constructor( radius, detail ) {
-
-		const t = ( 1 + Math.sqrt( 5 ) ) / 2;
-		const r = 1 / t;
-
-		const vertices = [
-
-			// (±1, ±1, ±1)
-			- 1, - 1, - 1,	- 1, - 1, 1,
-			- 1, 1, - 1, - 1, 1, 1,
-			1, - 1, - 1, 1, - 1, 1,
-			1, 1, - 1, 1, 1, 1,
-
-			// (0, ±1/φ, ±φ)
-			0, - r, - t, 0, - r, t,
-			0, r, - t, 0, r, t,
-
-			// (±1/φ, ±φ, 0)
-			- r, - t, 0, - r, t, 0,
-			r, - t, 0, r, t, 0,
-
-			// (±φ, 0, ±1/φ)
-			- t, 0, - r, t, 0, - r,
-			- t, 0, r, t, 0, r
-		];
-
-		const indices = [
-			3, 11, 7, 	3, 7, 15, 	3, 15, 13,
-			7, 19, 17, 	7, 17, 6, 	7, 6, 15,
-			17, 4, 8, 	17, 8, 10, 	17, 10, 6,
-			8, 0, 16, 	8, 16, 2, 	8, 2, 10,
-			0, 12, 1, 	0, 1, 18, 	0, 18, 16,
-			6, 10, 2, 	6, 2, 13, 	6, 13, 15,
-			2, 16, 18, 	2, 18, 3, 	2, 3, 13,
-			18, 1, 9, 	18, 9, 11, 	18, 11, 3,
-			4, 14, 12, 	4, 12, 0, 	4, 0, 8,
-			11, 9, 5, 	11, 5, 19, 	11, 19, 7,
-			19, 5, 14, 	19, 14, 4, 	19, 4, 17,
-			1, 12, 14, 	1, 14, 5, 	1, 5, 9
-		];
-
-		super( vertices, indices, radius, detail );
-
-		this.type = 'DodecahedronBufferGeometry';
-
-		this.parameters = {
-			radius: radius,
-			detail: detail
-		};
-
-	}
-
-}
-
-
-export { DodecahedronGeometry, DodecahedronBufferGeometry };
+export { DodecahedronGeometry };

+ 71 - 0
src/geometries/ExtrudeBufferGeometry.d.ts

@@ -0,0 +1,71 @@
+import { Curve } from './../extras/core/Curve';
+import { Vector2 } from './../math/Vector2';
+import { Vector3 } from './../math/Vector3';
+import { Shape } from './../extras/core/Shape';
+import { BufferGeometry } from './../core/BufferGeometry';
+
+export interface ExtrudeGeometryOptions {
+	/**
+	 * @default 12
+	 */
+	curveSegments?: number;
+	/**
+	 * @default 1
+	 */
+	steps?: number;
+	/**
+	 * @default 100
+	 */
+	depth?: number;
+	/**
+	 * @default true
+	 */
+	bevelEnabled?: boolean;
+	/**
+	 * @default 6
+	 */
+	bevelThickness?: number;
+	bevelSize?: number;
+	/**
+	 * @default 0
+	 */
+	bevelOffset?: number;
+	/**
+	 * @default 3
+	 */
+	bevelSegments?: number;
+	extrudePath?: Curve<Vector3>;
+	UVGenerator?: UVGenerator;
+}
+
+export interface UVGenerator {
+	generateTopUV(
+		geometry: ExtrudeBufferGeometry,
+		vertices: number[],
+		indexA: number,
+		indexB: number,
+		indexC: number
+	): Vector2[];
+	generateSideWallUV(
+		geometry: ExtrudeBufferGeometry,
+		vertices: number[],
+		indexA: number,
+		indexB: number,
+		indexC: number,
+		indexD: number
+	): Vector2[];
+}
+
+export class ExtrudeBufferGeometry extends BufferGeometry {
+
+	constructor( shapes: Shape | Shape[], options?: ExtrudeGeometryOptions );
+
+	/**
+	 * @default 'ExtrudeBufferGeometry'
+	 */
+	type: string;
+
+	addShapeList( shapes: Shape[], options?: any ): void;
+	addShape( shape: Shape, options?: any ): void;
+
+}

+ 785 - 0
src/geometries/ExtrudeBufferGeometry.js

@@ -0,0 +1,785 @@
+/**
+ * Creates extruded geometry from a path shape.
+ *
+ * parameters = {
+ *
+ *  curveSegments: <int>, // number of points on the curves
+ *  steps: <int>, // number of points for z-side extrusions / used for subdividing segments of extrude spline too
+ *  depth: <float>, // Depth to extrude the shape
+ *
+ *  bevelEnabled: <bool>, // turn on bevel
+ *  bevelThickness: <float>, // how deep into the original shape bevel goes
+ *  bevelSize: <float>, // how far from shape outline (including bevelOffset) is bevel
+ *  bevelOffset: <float>, // how far from shape outline does bevel start
+ *  bevelSegments: <int>, // number of bevel layers
+ *
+ *  extrudePath: <THREE.Curve> // curve to extrude shape along
+ *
+ *  UVGenerator: <Object> // object that provides UV generator functions
+ *
+ * }
+ */
+
+import { BufferGeometry } from '../core/BufferGeometry.js';
+import { Float32BufferAttribute } from '../core/BufferAttribute.js';
+import { Vector2 } from '../math/Vector2.js';
+import { Vector3 } from '../math/Vector3.js';
+import { ShapeUtils } from '../extras/ShapeUtils.js';
+
+class ExtrudeBufferGeometry extends BufferGeometry {
+
+	constructor( shapes, options ) {
+
+		super();
+
+		this.type = 'ExtrudeBufferGeometry';
+
+		this.parameters = {
+			shapes: shapes,
+			options: options
+		};
+
+		shapes = Array.isArray( shapes ) ? shapes : [ shapes ];
+
+		const scope = this;
+
+		const verticesArray = [];
+		const uvArray = [];
+
+		for ( let i = 0, l = shapes.length; i < l; i ++ ) {
+
+			const shape = shapes[ i ];
+			addShape( shape );
+
+		}
+
+		// build geometry
+
+		this.setAttribute( 'position', new Float32BufferAttribute( verticesArray, 3 ) );
+		this.setAttribute( 'uv', new Float32BufferAttribute( uvArray, 2 ) );
+
+		this.computeVertexNormals();
+
+		// functions
+
+		function addShape( shape ) {
+
+			const placeholder = [];
+
+			// options
+
+			const curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12;
+			const steps = options.steps !== undefined ? options.steps : 1;
+			let depth = options.depth !== undefined ? options.depth : 100;
+
+			let bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true;
+			let bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 6;
+			let bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 2;
+			let bevelOffset = options.bevelOffset !== undefined ? options.bevelOffset : 0;
+			let bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3;
+
+			const extrudePath = options.extrudePath;
+
+			const uvgen = options.UVGenerator !== undefined ? options.UVGenerator : WorldUVGenerator;
+
+			// deprecated options
+
+			if ( options.amount !== undefined ) {
+
+				console.warn( 'THREE.ExtrudeBufferGeometry: amount has been renamed to depth.' );
+				depth = options.amount;
+
+			}
+
+			//
+
+			let extrudePts, extrudeByPath = false;
+			let splineTube, binormal, normal, position2;
+
+			if ( extrudePath ) {
+
+				extrudePts = extrudePath.getSpacedPoints( steps );
+
+				extrudeByPath = true;
+				bevelEnabled = false; // bevels not supported for path extrusion
+
+				// SETUP TNB variables
+
+				// TODO1 - have a .isClosed in spline?
+
+				splineTube = extrudePath.computeFrenetFrames( steps, false );
+
+				// console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length);
+
+				binormal = new Vector3();
+				normal = new Vector3();
+				position2 = new Vector3();
+
+			}
+
+			// Safeguards if bevels are not enabled
+
+			if ( ! bevelEnabled ) {
+
+				bevelSegments = 0;
+				bevelThickness = 0;
+				bevelSize = 0;
+				bevelOffset = 0;
+
+			}
+
+			// Variables initialization
+
+			const shapePoints = shape.extractPoints( curveSegments );
+
+			let vertices = shapePoints.shape;
+			const holes = shapePoints.holes;
+
+			const reverse = ! ShapeUtils.isClockWise( vertices );
+
+			if ( reverse ) {
+
+				vertices = vertices.reverse();
+
+				// Maybe we should also check if holes are in the opposite direction, just to be safe ...
+
+				for ( let h = 0, hl = holes.length; h < hl; h ++ ) {
+
+					const ahole = holes[ h ];
+
+					if ( ShapeUtils.isClockWise( ahole ) ) {
+
+						holes[ h ] = ahole.reverse();
+
+					}
+
+				}
+
+			}
+
+
+			const faces = ShapeUtils.triangulateShape( vertices, holes );
+
+			/* Vertices */
+
+			const contour = vertices; // vertices has all points but contour has only points of circumference
+
+			for ( let h = 0, hl = holes.length; h < hl; h ++ ) {
+
+				const ahole = holes[ h ];
+
+				vertices = vertices.concat( ahole );
+
+			}
+
+
+			function scalePt2( pt, vec, size ) {
+
+				if ( ! vec ) console.error( "THREE.ExtrudeGeometry: vec does not exist" );
+
+				return vec.clone().multiplyScalar( size ).add( pt );
+
+			}
+
+			const vlen = vertices.length, flen = faces.length;
+
+
+			// Find directions for point movement
+
+
+			function getBevelVec( inPt, inPrev, inNext ) {
+
+				// computes for inPt the corresponding point inPt' on a new contour
+				//   shifted by 1 unit (length of normalized vector) to the left
+				// if we walk along contour clockwise, this new contour is outside the old one
+				//
+				// inPt' is the intersection of the two lines parallel to the two
+				//  adjacent edges of inPt at a distance of 1 unit on the left side.
+
+				let v_trans_x, v_trans_y, shrink_by; // resulting translation vector for inPt
+
+				// good reading for geometry algorithms (here: line-line intersection)
+				// http://geomalgorithms.com/a05-_intersect-1.html
+
+				const v_prev_x = inPt.x - inPrev.x,
+					v_prev_y = inPt.y - inPrev.y;
+				const v_next_x = inNext.x - inPt.x,
+					v_next_y = inNext.y - inPt.y;
+
+				const v_prev_lensq = ( v_prev_x * v_prev_x + v_prev_y * v_prev_y );
+
+				// check for collinear edges
+				const collinear0 = ( v_prev_x * v_next_y - v_prev_y * v_next_x );
+
+				if ( Math.abs( collinear0 ) > Number.EPSILON ) {
+
+					// not collinear
+
+					// length of vectors for normalizing
+
+					const v_prev_len = Math.sqrt( v_prev_lensq );
+					const v_next_len = Math.sqrt( v_next_x * v_next_x + v_next_y * v_next_y );
+
+					// shift adjacent points by unit vectors to the left
+
+					const ptPrevShift_x = ( inPrev.x - v_prev_y / v_prev_len );
+					const ptPrevShift_y = ( inPrev.y + v_prev_x / v_prev_len );
+
+					const ptNextShift_x = ( inNext.x - v_next_y / v_next_len );
+					const ptNextShift_y = ( inNext.y + v_next_x / v_next_len );
+
+					// scaling factor for v_prev to intersection point
+
+					const sf = ( ( ptNextShift_x - ptPrevShift_x ) * v_next_y -
+							( ptNextShift_y - ptPrevShift_y ) * v_next_x ) /
+						( v_prev_x * v_next_y - v_prev_y * v_next_x );
+
+					// vector from inPt to intersection point
+
+					v_trans_x = ( ptPrevShift_x + v_prev_x * sf - inPt.x );
+					v_trans_y = ( ptPrevShift_y + v_prev_y * sf - inPt.y );
+
+					// Don't normalize!, otherwise sharp corners become ugly
+					//  but prevent crazy spikes
+					const v_trans_lensq = ( v_trans_x * v_trans_x + v_trans_y * v_trans_y );
+					if ( v_trans_lensq <= 2 ) {
+
+						return new Vector2( v_trans_x, v_trans_y );
+
+					} else {
+
+						shrink_by = Math.sqrt( v_trans_lensq / 2 );
+
+					}
+
+				} else {
+
+					// handle special case of collinear edges
+
+					let direction_eq = false; // assumes: opposite
+
+					if ( v_prev_x > Number.EPSILON ) {
+
+						if ( v_next_x > Number.EPSILON ) {
+
+							direction_eq = true;
+
+						}
+
+					} else {
+
+						if ( v_prev_x < - Number.EPSILON ) {
+
+							if ( v_next_x < - Number.EPSILON ) {
+
+								direction_eq = true;
+
+							}
+
+						} else {
+
+							if ( Math.sign( v_prev_y ) === Math.sign( v_next_y ) ) {
+
+								direction_eq = true;
+
+							}
+
+						}
+
+					}
+
+					if ( direction_eq ) {
+
+						// console.log("Warning: lines are a straight sequence");
+						v_trans_x = - v_prev_y;
+						v_trans_y = v_prev_x;
+						shrink_by = Math.sqrt( v_prev_lensq );
+
+					} else {
+
+						// console.log("Warning: lines are a straight spike");
+						v_trans_x = v_prev_x;
+						v_trans_y = v_prev_y;
+						shrink_by = Math.sqrt( v_prev_lensq / 2 );
+
+					}
+
+				}
+
+				return new Vector2( v_trans_x / shrink_by, v_trans_y / shrink_by );
+
+			}
+
+
+			const contourMovements = [];
+
+			for ( let i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) {
+
+				if ( j === il ) j = 0;
+				if ( k === il ) k = 0;
+
+				//  (j)---(i)---(k)
+				// console.log('i,j,k', i, j , k)
+
+				contourMovements[ i ] = getBevelVec( contour[ i ], contour[ j ], contour[ k ] );
+
+			}
+
+			const holesMovements = [];
+			let oneHoleMovements, verticesMovements = contourMovements.concat();
+
+			for ( let h = 0, hl = holes.length; h < hl; h ++ ) {
+
+				const ahole = holes[ h ];
+
+				oneHoleMovements = [];
+
+				for ( let i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) {
+
+					if ( j === il ) j = 0;
+					if ( k === il ) k = 0;
+
+					//  (j)---(i)---(k)
+					oneHoleMovements[ i ] = getBevelVec( ahole[ i ], ahole[ j ], ahole[ k ] );
+
+				}
+
+				holesMovements.push( oneHoleMovements );
+				verticesMovements = verticesMovements.concat( oneHoleMovements );
+
+			}
+
+
+			// Loop bevelSegments, 1 for the front, 1 for the back
+
+			for ( let b = 0; b < bevelSegments; b ++ ) {
+
+				//for ( b = bevelSegments; b > 0; b -- ) {
+
+				const t = b / bevelSegments;
+				const z = bevelThickness * Math.cos( t * Math.PI / 2 );
+				const bs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelOffset;
+
+				// contract shape
+
+				for ( let i = 0, il = contour.length; i < il; i ++ ) {
+
+					const vert = scalePt2( contour[ i ], contourMovements[ i ], bs );
+
+					v( vert.x, vert.y, - z );
+
+				}
+
+				// expand holes
+
+				for ( let h = 0, hl = holes.length; h < hl; h ++ ) {
+
+					const ahole = holes[ h ];
+					oneHoleMovements = holesMovements[ h ];
+
+					for ( let i = 0, il = ahole.length; i < il; i ++ ) {
+
+						const vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );
+
+						v( vert.x, vert.y, - z );
+
+					}
+
+				}
+
+			}
+
+			const bs = bevelSize + bevelOffset;
+
+			// Back facing vertices
+
+			for ( let i = 0; i < vlen; i ++ ) {
+
+				const vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ];
+
+				if ( ! extrudeByPath ) {
+
+					v( vert.x, vert.y, 0 );
+
+				} else {
+
+					// v( vert.x, vert.y + extrudePts[ 0 ].y, extrudePts[ 0 ].x );
+
+					normal.copy( splineTube.normals[ 0 ] ).multiplyScalar( vert.x );
+					binormal.copy( splineTube.binormals[ 0 ] ).multiplyScalar( vert.y );
+
+					position2.copy( extrudePts[ 0 ] ).add( normal ).add( binormal );
+
+					v( position2.x, position2.y, position2.z );
+
+				}
+
+			}
+
+			// Add stepped vertices...
+			// Including front facing vertices
+
+			for ( let s = 1; s <= steps; s ++ ) {
+
+				for ( let i = 0; i < vlen; i ++ ) {
+
+					const vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ];
+
+					if ( ! extrudeByPath ) {
+
+						v( vert.x, vert.y, depth / steps * s );
+
+					} else {
+
+						// v( vert.x, vert.y + extrudePts[ s - 1 ].y, extrudePts[ s - 1 ].x );
+
+						normal.copy( splineTube.normals[ s ] ).multiplyScalar( vert.x );
+						binormal.copy( splineTube.binormals[ s ] ).multiplyScalar( vert.y );
+
+						position2.copy( extrudePts[ s ] ).add( normal ).add( binormal );
+
+						v( position2.x, position2.y, position2.z );
+
+					}
+
+				}
+
+			}
+
+
+			// Add bevel segments planes
+
+			//for ( b = 1; b <= bevelSegments; b ++ ) {
+			for ( let b = bevelSegments - 1; b >= 0; b -- ) {
+
+				const t = b / bevelSegments;
+				const z = bevelThickness * Math.cos( t * Math.PI / 2 );
+				const bs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelOffset;
+
+				// contract shape
+
+				for ( let i = 0, il = contour.length; i < il; i ++ ) {
+
+					const vert = scalePt2( contour[ i ], contourMovements[ i ], bs );
+					v( vert.x, vert.y, depth + z );
+
+				}
+
+				// expand holes
+
+				for ( let h = 0, hl = holes.length; h < hl; h ++ ) {
+
+					const ahole = holes[ h ];
+					oneHoleMovements = holesMovements[ h ];
+
+					for ( let i = 0, il = ahole.length; i < il; i ++ ) {
+
+						const vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );
+
+						if ( ! extrudeByPath ) {
+
+							v( vert.x, vert.y, depth + z );
+
+						} else {
+
+							v( vert.x, vert.y + extrudePts[ steps - 1 ].y, extrudePts[ steps - 1 ].x + z );
+
+						}
+
+					}
+
+				}
+
+			}
+
+			/* Faces */
+
+			// Top and bottom faces
+
+			buildLidFaces();
+
+			// Sides faces
+
+			buildSideFaces();
+
+
+			/////  Internal functions
+
+			function buildLidFaces() {
+
+				const start = verticesArray.length / 3;
+
+				if ( bevelEnabled ) {
+
+					let layer = 0; // steps + 1
+					let offset = vlen * layer;
+
+					// Bottom faces
+
+					for ( let i = 0; i < flen; i ++ ) {
+
+						const face = faces[ i ];
+						f3( face[ 2 ] + offset, face[ 1 ] + offset, face[ 0 ] + offset );
+
+					}
+
+					layer = steps + bevelSegments * 2;
+					offset = vlen * layer;
+
+					// Top faces
+
+					for ( let i = 0; i < flen; i ++ ) {
+
+						const face = faces[ i ];
+						f3( face[ 0 ] + offset, face[ 1 ] + offset, face[ 2 ] + offset );
+
+					}
+
+				} else {
+
+					// Bottom faces
+
+					for ( let i = 0; i < flen; i ++ ) {
+
+						const face = faces[ i ];
+						f3( face[ 2 ], face[ 1 ], face[ 0 ] );
+
+					}
+
+					// Top faces
+
+					for ( let i = 0; i < flen; i ++ ) {
+
+						const face = faces[ i ];
+						f3( face[ 0 ] + vlen * steps, face[ 1 ] + vlen * steps, face[ 2 ] + vlen * steps );
+
+					}
+
+				}
+
+				scope.addGroup( start, verticesArray.length / 3 - start, 0 );
+
+			}
+
+			// Create faces for the z-sides of the shape
+
+			function buildSideFaces() {
+
+				const start = verticesArray.length / 3;
+				let layeroffset = 0;
+				sidewalls( contour, layeroffset );
+				layeroffset += contour.length;
+
+				for ( let h = 0, hl = holes.length; h < hl; h ++ ) {
+
+					const ahole = holes[ h ];
+					sidewalls( ahole, layeroffset );
+
+					//, true
+					layeroffset += ahole.length;
+
+				}
+
+
+				scope.addGroup( start, verticesArray.length / 3 - start, 1 );
+
+
+			}
+
+			function sidewalls( contour, layeroffset ) {
+
+				let i = contour.length;
+
+				while ( -- i >= 0 ) {
+
+					const j = i;
+					let k = i - 1;
+					if ( k < 0 ) k = contour.length - 1;
+
+					//console.log('b', i,j, i-1, k,vertices.length);
+
+					for ( let s = 0, sl = ( steps + bevelSegments * 2 ); s < sl; s ++ ) {
+
+						const slen1 = vlen * s;
+						const slen2 = vlen * ( s + 1 );
+
+						const a = layeroffset + j + slen1,
+							b = layeroffset + k + slen1,
+							c = layeroffset + k + slen2,
+							d = layeroffset + j + slen2;
+
+						f4( a, b, c, d );
+
+					}
+
+				}
+
+			}
+
+			function v( x, y, z ) {
+
+				placeholder.push( x );
+				placeholder.push( y );
+				placeholder.push( z );
+
+			}
+
+
+			function f3( a, b, c ) {
+
+				addVertex( a );
+				addVertex( b );
+				addVertex( c );
+
+				const nextIndex = verticesArray.length / 3;
+				const uvs = uvgen.generateTopUV( scope, verticesArray, nextIndex - 3, nextIndex - 2, nextIndex - 1 );
+
+				addUV( uvs[ 0 ] );
+				addUV( uvs[ 1 ] );
+				addUV( uvs[ 2 ] );
+
+			}
+
+			function f4( a, b, c, d ) {
+
+				addVertex( a );
+				addVertex( b );
+				addVertex( d );
+
+				addVertex( b );
+				addVertex( c );
+				addVertex( d );
+
+
+				const nextIndex = verticesArray.length / 3;
+				const uvs = uvgen.generateSideWallUV( scope, verticesArray, nextIndex - 6, nextIndex - 3, nextIndex - 2, nextIndex - 1 );
+
+				addUV( uvs[ 0 ] );
+				addUV( uvs[ 1 ] );
+				addUV( uvs[ 3 ] );
+
+				addUV( uvs[ 1 ] );
+				addUV( uvs[ 2 ] );
+				addUV( uvs[ 3 ] );
+
+			}
+
+			function addVertex( index ) {
+
+				verticesArray.push( placeholder[ index * 3 + 0 ] );
+				verticesArray.push( placeholder[ index * 3 + 1 ] );
+				verticesArray.push( placeholder[ index * 3 + 2 ] );
+
+			}
+
+
+			function addUV( vector2 ) {
+
+				uvArray.push( vector2.x );
+				uvArray.push( vector2.y );
+
+			}
+
+		}
+
+	}
+
+	toJSON() {
+
+		const data = BufferGeometry.prototype.toJSON.call( this );
+
+		const shapes = this.parameters.shapes;
+		const options = this.parameters.options;
+
+		return toJSON( shapes, options, data );
+
+	}
+
+}
+
+const WorldUVGenerator = {
+
+	generateTopUV: function ( geometry, vertices, indexA, indexB, indexC ) {
+
+		const a_x = vertices[ indexA * 3 ];
+		const a_y = vertices[ indexA * 3 + 1 ];
+		const b_x = vertices[ indexB * 3 ];
+		const b_y = vertices[ indexB * 3 + 1 ];
+		const c_x = vertices[ indexC * 3 ];
+		const c_y = vertices[ indexC * 3 + 1 ];
+
+		return [
+			new Vector2( a_x, a_y ),
+			new Vector2( b_x, b_y ),
+			new Vector2( c_x, c_y )
+		];
+
+	},
+
+	generateSideWallUV: function ( geometry, vertices, indexA, indexB, indexC, indexD ) {
+
+		const a_x = vertices[ indexA * 3 ];
+		const a_y = vertices[ indexA * 3 + 1 ];
+		const a_z = vertices[ indexA * 3 + 2 ];
+		const b_x = vertices[ indexB * 3 ];
+		const b_y = vertices[ indexB * 3 + 1 ];
+		const b_z = vertices[ indexB * 3 + 2 ];
+		const c_x = vertices[ indexC * 3 ];
+		const c_y = vertices[ indexC * 3 + 1 ];
+		const c_z = vertices[ indexC * 3 + 2 ];
+		const d_x = vertices[ indexD * 3 ];
+		const d_y = vertices[ indexD * 3 + 1 ];
+		const d_z = vertices[ indexD * 3 + 2 ];
+
+		if ( Math.abs( a_y - b_y ) < 0.01 ) {
+
+			return [
+				new Vector2( a_x, 1 - a_z ),
+				new Vector2( b_x, 1 - b_z ),
+				new Vector2( c_x, 1 - c_z ),
+				new Vector2( d_x, 1 - d_z )
+			];
+
+		} else {
+
+			return [
+				new Vector2( a_y, 1 - a_z ),
+				new Vector2( b_y, 1 - b_z ),
+				new Vector2( c_y, 1 - c_z ),
+				new Vector2( d_y, 1 - d_z )
+			];
+
+		}
+
+	}
+
+};
+
+function toJSON( shapes, options, data ) {
+
+	data.shapes = [];
+
+	if ( Array.isArray( shapes ) ) {
+
+		for ( let i = 0, l = shapes.length; i < l; i ++ ) {
+
+			const shape = shapes[ i ];
+
+			data.shapes.push( shape.uuid );
+
+		}
+
+	} else {
+
+		data.shapes.push( shapes.uuid );
+
+	}
+
+	if ( options.extrudePath !== undefined ) data.options.extrudePath = options.extrudePath.toJSON();
+
+	return data;
+
+}
+
+
+export { ExtrudeBufferGeometry };

+ 1 - 19
src/geometries/ExtrudeGeometry.d.ts

@@ -3,7 +3,7 @@ import { Vector2 } from './../math/Vector2';
 import { Vector3 } from './../math/Vector3';
 import { Vector3 } from './../math/Vector3';
 import { Shape } from './../extras/core/Shape';
 import { Shape } from './../extras/core/Shape';
 import { Geometry } from './../core/Geometry';
 import { Geometry } from './../core/Geometry';
-import { BufferGeometry } from './../core/BufferGeometry';
+import { ExtrudeBufferGeometry } from './ExtrudeBufferGeometry';
 
 
 export interface ExtrudeGeometryOptions {
 export interface ExtrudeGeometryOptions {
 	/**
 	/**
@@ -57,28 +57,10 @@ export interface UVGenerator {
 	): Vector2[];
 	): Vector2[];
 }
 }
 
 
-export class ExtrudeBufferGeometry extends BufferGeometry {
-
-	constructor( shapes: Shape | Shape[], options?: ExtrudeGeometryOptions );
-
-	static WorldUVGenerator: UVGenerator;
-
-	/**
-	 * @default 'ExtrudeBufferGeometry'
-	 */
-	type: string;
-
-	addShapeList( shapes: Shape[], options?: any ): void;
-	addShape( shape: Shape, options?: any ): void;
-
-}
-
 export class ExtrudeGeometry extends Geometry {
 export class ExtrudeGeometry extends Geometry {
 
 
 	constructor( shapes: Shape | Shape[], options?: ExtrudeGeometryOptions );
 	constructor( shapes: Shape | Shape[], options?: ExtrudeGeometryOptions );
 
 
-	static WorldUVGenerator: UVGenerator;
-
 	/**
 	/**
 	 * @default 'ExtrudeGeometry'
 	 * @default 'ExtrudeGeometry'
 	 */
 	 */

+ 3 - 741
src/geometries/ExtrudeGeometry.js

@@ -1,10 +1,3 @@
-import { Geometry } from '../core/Geometry.js';
-import { BufferGeometry } from '../core/BufferGeometry.js';
-import { Float32BufferAttribute } from '../core/BufferAttribute.js';
-import { Vector2 } from '../math/Vector2.js';
-import { Vector3 } from '../math/Vector3.js';
-import { ShapeUtils } from '../extras/ShapeUtils.js';
-
 /**
 /**
  * Creates extruded geometry from a path shape.
  * Creates extruded geometry from a path shape.
  *
  *
@@ -27,7 +20,8 @@ import { ShapeUtils } from '../extras/ShapeUtils.js';
  * }
  * }
  */
  */
 
 
-// ExtrudeGeometry
+import { Geometry } from '../core/Geometry.js';
+import { ExtrudeBufferGeometry } from './ExtrudeBufferGeometry.js';
 
 
 class ExtrudeGeometry extends Geometry {
 class ExtrudeGeometry extends Geometry {
 
 
@@ -60,737 +54,6 @@ class ExtrudeGeometry extends Geometry {
 
 
 }
 }
 
 
-
-// ExtrudeBufferGeometry
-
-class ExtrudeBufferGeometry extends BufferGeometry {
-
-	constructor( shapes, options ) {
-
-		super();
-
-		this.type = 'ExtrudeBufferGeometry';
-
-		this.parameters = {
-			shapes: shapes,
-			options: options
-		};
-
-		shapes = Array.isArray( shapes ) ? shapes : [ shapes ];
-
-		const scope = this;
-
-		const verticesArray = [];
-		const uvArray = [];
-
-		for ( let i = 0, l = shapes.length; i < l; i ++ ) {
-
-			const shape = shapes[ i ];
-			addShape( shape );
-
-		}
-
-		// build geometry
-
-		this.setAttribute( 'position', new Float32BufferAttribute( verticesArray, 3 ) );
-		this.setAttribute( 'uv', new Float32BufferAttribute( uvArray, 2 ) );
-
-		this.computeVertexNormals();
-
-		// functions
-
-		function addShape( shape ) {
-
-			const placeholder = [];
-
-			// options
-
-			const curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12;
-			const steps = options.steps !== undefined ? options.steps : 1;
-			let depth = options.depth !== undefined ? options.depth : 100;
-
-			let bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true;
-			let bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 6;
-			let bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 2;
-			let bevelOffset = options.bevelOffset !== undefined ? options.bevelOffset : 0;
-			let bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3;
-
-			const extrudePath = options.extrudePath;
-
-			const uvgen = options.UVGenerator !== undefined ? options.UVGenerator : WorldUVGenerator;
-
-			// deprecated options
-
-			if ( options.amount !== undefined ) {
-
-				console.warn( 'THREE.ExtrudeBufferGeometry: amount has been renamed to depth.' );
-				depth = options.amount;
-
-			}
-
-			//
-
-			let extrudePts, extrudeByPath = false;
-			let splineTube, binormal, normal, position2;
-
-			if ( extrudePath ) {
-
-				extrudePts = extrudePath.getSpacedPoints( steps );
-
-				extrudeByPath = true;
-				bevelEnabled = false; // bevels not supported for path extrusion
-
-				// SETUP TNB variables
-
-				// TODO1 - have a .isClosed in spline?
-
-				splineTube = extrudePath.computeFrenetFrames( steps, false );
-
-				// console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length);
-
-				binormal = new Vector3();
-				normal = new Vector3();
-				position2 = new Vector3();
-
-			}
-
-			// Safeguards if bevels are not enabled
-
-			if ( ! bevelEnabled ) {
-
-				bevelSegments = 0;
-				bevelThickness = 0;
-				bevelSize = 0;
-				bevelOffset = 0;
-
-			}
-
-			// Variables initialization
-
-			const shapePoints = shape.extractPoints( curveSegments );
-
-			let vertices = shapePoints.shape;
-			const holes = shapePoints.holes;
-
-			const reverse = ! ShapeUtils.isClockWise( vertices );
-
-			if ( reverse ) {
-
-				vertices = vertices.reverse();
-
-				// Maybe we should also check if holes are in the opposite direction, just to be safe ...
-
-				for ( let h = 0, hl = holes.length; h < hl; h ++ ) {
-
-					const ahole = holes[ h ];
-
-					if ( ShapeUtils.isClockWise( ahole ) ) {
-
-						holes[ h ] = ahole.reverse();
-
-					}
-
-				}
-
-			}
-
-
-			const faces = ShapeUtils.triangulateShape( vertices, holes );
-
-			/* Vertices */
-
-			const contour = vertices; // vertices has all points but contour has only points of circumference
-
-			for ( let h = 0, hl = holes.length; h < hl; h ++ ) {
-
-				const ahole = holes[ h ];
-
-				vertices = vertices.concat( ahole );
-
-			}
-
-
-			function scalePt2( pt, vec, size ) {
-
-				if ( ! vec ) console.error( "THREE.ExtrudeGeometry: vec does not exist" );
-
-				return vec.clone().multiplyScalar( size ).add( pt );
-
-			}
-
-			const vlen = vertices.length, flen = faces.length;
-
-
-			// Find directions for point movement
-
-
-			function getBevelVec( inPt, inPrev, inNext ) {
-
-				// computes for inPt the corresponding point inPt' on a new contour
-				//   shifted by 1 unit (length of normalized vector) to the left
-				// if we walk along contour clockwise, this new contour is outside the old one
-				//
-				// inPt' is the intersection of the two lines parallel to the two
-				//  adjacent edges of inPt at a distance of 1 unit on the left side.
-
-				let v_trans_x, v_trans_y, shrink_by; // resulting translation vector for inPt
-
-				// good reading for geometry algorithms (here: line-line intersection)
-				// http://geomalgorithms.com/a05-_intersect-1.html
-
-				const v_prev_x = inPt.x - inPrev.x,
-					v_prev_y = inPt.y - inPrev.y;
-				const v_next_x = inNext.x - inPt.x,
-					v_next_y = inNext.y - inPt.y;
-
-				const v_prev_lensq = ( v_prev_x * v_prev_x + v_prev_y * v_prev_y );
-
-				// check for collinear edges
-				const collinear0 = ( v_prev_x * v_next_y - v_prev_y * v_next_x );
-
-				if ( Math.abs( collinear0 ) > Number.EPSILON ) {
-
-					// not collinear
-
-					// length of vectors for normalizing
-
-					const v_prev_len = Math.sqrt( v_prev_lensq );
-					const v_next_len = Math.sqrt( v_next_x * v_next_x + v_next_y * v_next_y );
-
-					// shift adjacent points by unit vectors to the left
-
-					const ptPrevShift_x = ( inPrev.x - v_prev_y / v_prev_len );
-					const ptPrevShift_y = ( inPrev.y + v_prev_x / v_prev_len );
-
-					const ptNextShift_x = ( inNext.x - v_next_y / v_next_len );
-					const ptNextShift_y = ( inNext.y + v_next_x / v_next_len );
-
-					// scaling factor for v_prev to intersection point
-
-					const sf = ( ( ptNextShift_x - ptPrevShift_x ) * v_next_y -
-							( ptNextShift_y - ptPrevShift_y ) * v_next_x ) /
-						( v_prev_x * v_next_y - v_prev_y * v_next_x );
-
-					// vector from inPt to intersection point
-
-					v_trans_x = ( ptPrevShift_x + v_prev_x * sf - inPt.x );
-					v_trans_y = ( ptPrevShift_y + v_prev_y * sf - inPt.y );
-
-					// Don't normalize!, otherwise sharp corners become ugly
-					//  but prevent crazy spikes
-					const v_trans_lensq = ( v_trans_x * v_trans_x + v_trans_y * v_trans_y );
-					if ( v_trans_lensq <= 2 ) {
-
-						return new Vector2( v_trans_x, v_trans_y );
-
-					} else {
-
-						shrink_by = Math.sqrt( v_trans_lensq / 2 );
-
-					}
-
-				} else {
-
-					// handle special case of collinear edges
-
-					let direction_eq = false; // assumes: opposite
-
-					if ( v_prev_x > Number.EPSILON ) {
-
-						if ( v_next_x > Number.EPSILON ) {
-
-							direction_eq = true;
-
-						}
-
-					} else {
-
-						if ( v_prev_x < - Number.EPSILON ) {
-
-							if ( v_next_x < - Number.EPSILON ) {
-
-								direction_eq = true;
-
-							}
-
-						} else {
-
-							if ( Math.sign( v_prev_y ) === Math.sign( v_next_y ) ) {
-
-								direction_eq = true;
-
-							}
-
-						}
-
-					}
-
-					if ( direction_eq ) {
-
-						// console.log("Warning: lines are a straight sequence");
-						v_trans_x = - v_prev_y;
-						v_trans_y = v_prev_x;
-						shrink_by = Math.sqrt( v_prev_lensq );
-
-					} else {
-
-						// console.log("Warning: lines are a straight spike");
-						v_trans_x = v_prev_x;
-						v_trans_y = v_prev_y;
-						shrink_by = Math.sqrt( v_prev_lensq / 2 );
-
-					}
-
-				}
-
-				return new Vector2( v_trans_x / shrink_by, v_trans_y / shrink_by );
-
-			}
-
-
-			const contourMovements = [];
-
-			for ( let i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) {
-
-				if ( j === il ) j = 0;
-				if ( k === il ) k = 0;
-
-				//  (j)---(i)---(k)
-				// console.log('i,j,k', i, j , k)
-
-				contourMovements[ i ] = getBevelVec( contour[ i ], contour[ j ], contour[ k ] );
-
-			}
-
-			const holesMovements = [];
-			let oneHoleMovements, verticesMovements = contourMovements.concat();
-
-			for ( let h = 0, hl = holes.length; h < hl; h ++ ) {
-
-				const ahole = holes[ h ];
-
-				oneHoleMovements = [];
-
-				for ( let i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i ++, j ++, k ++ ) {
-
-					if ( j === il ) j = 0;
-					if ( k === il ) k = 0;
-
-					//  (j)---(i)---(k)
-					oneHoleMovements[ i ] = getBevelVec( ahole[ i ], ahole[ j ], ahole[ k ] );
-
-				}
-
-				holesMovements.push( oneHoleMovements );
-				verticesMovements = verticesMovements.concat( oneHoleMovements );
-
-			}
-
-
-			// Loop bevelSegments, 1 for the front, 1 for the back
-
-			for ( let b = 0; b < bevelSegments; b ++ ) {
-
-				//for ( b = bevelSegments; b > 0; b -- ) {
-
-				const t = b / bevelSegments;
-				const z = bevelThickness * Math.cos( t * Math.PI / 2 );
-				const bs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelOffset;
-
-				// contract shape
-
-				for ( let i = 0, il = contour.length; i < il; i ++ ) {
-
-					const vert = scalePt2( contour[ i ], contourMovements[ i ], bs );
-
-					v( vert.x, vert.y, - z );
-
-				}
-
-				// expand holes
-
-				for ( let h = 0, hl = holes.length; h < hl; h ++ ) {
-
-					const ahole = holes[ h ];
-					oneHoleMovements = holesMovements[ h ];
-
-					for ( let i = 0, il = ahole.length; i < il; i ++ ) {
-
-						const vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );
-
-						v( vert.x, vert.y, - z );
-
-					}
-
-				}
-
-			}
-
-			const bs = bevelSize + bevelOffset;
-
-			// Back facing vertices
-
-			for ( let i = 0; i < vlen; i ++ ) {
-
-				const vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ];
-
-				if ( ! extrudeByPath ) {
-
-					v( vert.x, vert.y, 0 );
-
-				} else {
-
-					// v( vert.x, vert.y + extrudePts[ 0 ].y, extrudePts[ 0 ].x );
-
-					normal.copy( splineTube.normals[ 0 ] ).multiplyScalar( vert.x );
-					binormal.copy( splineTube.binormals[ 0 ] ).multiplyScalar( vert.y );
-
-					position2.copy( extrudePts[ 0 ] ).add( normal ).add( binormal );
-
-					v( position2.x, position2.y, position2.z );
-
-				}
-
-			}
-
-			// Add stepped vertices...
-			// Including front facing vertices
-
-			for ( let s = 1; s <= steps; s ++ ) {
-
-				for ( let i = 0; i < vlen; i ++ ) {
-
-					const vert = bevelEnabled ? scalePt2( vertices[ i ], verticesMovements[ i ], bs ) : vertices[ i ];
-
-					if ( ! extrudeByPath ) {
-
-						v( vert.x, vert.y, depth / steps * s );
-
-					} else {
-
-						// v( vert.x, vert.y + extrudePts[ s - 1 ].y, extrudePts[ s - 1 ].x );
-
-						normal.copy( splineTube.normals[ s ] ).multiplyScalar( vert.x );
-						binormal.copy( splineTube.binormals[ s ] ).multiplyScalar( vert.y );
-
-						position2.copy( extrudePts[ s ] ).add( normal ).add( binormal );
-
-						v( position2.x, position2.y, position2.z );
-
-					}
-
-				}
-
-			}
-
-
-			// Add bevel segments planes
-
-			//for ( b = 1; b <= bevelSegments; b ++ ) {
-			for ( let b = bevelSegments - 1; b >= 0; b -- ) {
-
-				const t = b / bevelSegments;
-				const z = bevelThickness * Math.cos( t * Math.PI / 2 );
-				const bs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelOffset;
-
-				// contract shape
-
-				for ( let i = 0, il = contour.length; i < il; i ++ ) {
-
-					const vert = scalePt2( contour[ i ], contourMovements[ i ], bs );
-					v( vert.x, vert.y, depth + z );
-
-				}
-
-				// expand holes
-
-				for ( let h = 0, hl = holes.length; h < hl; h ++ ) {
-
-					const ahole = holes[ h ];
-					oneHoleMovements = holesMovements[ h ];
-
-					for ( let i = 0, il = ahole.length; i < il; i ++ ) {
-
-						const vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs );
-
-						if ( ! extrudeByPath ) {
-
-							v( vert.x, vert.y, depth + z );
-
-						} else {
-
-							v( vert.x, vert.y + extrudePts[ steps - 1 ].y, extrudePts[ steps - 1 ].x + z );
-
-						}
-
-					}
-
-				}
-
-			}
-
-			/* Faces */
-
-			// Top and bottom faces
-
-			buildLidFaces();
-
-			// Sides faces
-
-			buildSideFaces();
-
-
-			/////  Internal functions
-
-			function buildLidFaces() {
-
-				const start = verticesArray.length / 3;
-
-				if ( bevelEnabled ) {
-
-					let layer = 0; // steps + 1
-					let offset = vlen * layer;
-
-					// Bottom faces
-
-					for ( let i = 0; i < flen; i ++ ) {
-
-						const face = faces[ i ];
-						f3( face[ 2 ] + offset, face[ 1 ] + offset, face[ 0 ] + offset );
-
-					}
-
-					layer = steps + bevelSegments * 2;
-					offset = vlen * layer;
-
-					// Top faces
-
-					for ( let i = 0; i < flen; i ++ ) {
-
-						const face = faces[ i ];
-						f3( face[ 0 ] + offset, face[ 1 ] + offset, face[ 2 ] + offset );
-
-					}
-
-				} else {
-
-					// Bottom faces
-
-					for ( let i = 0; i < flen; i ++ ) {
-
-						const face = faces[ i ];
-						f3( face[ 2 ], face[ 1 ], face[ 0 ] );
-
-					}
-
-					// Top faces
-
-					for ( let i = 0; i < flen; i ++ ) {
-
-						const face = faces[ i ];
-						f3( face[ 0 ] + vlen * steps, face[ 1 ] + vlen * steps, face[ 2 ] + vlen * steps );
-
-					}
-
-				}
-
-				scope.addGroup( start, verticesArray.length / 3 - start, 0 );
-
-			}
-
-			// Create faces for the z-sides of the shape
-
-			function buildSideFaces() {
-
-				const start = verticesArray.length / 3;
-				let layeroffset = 0;
-				sidewalls( contour, layeroffset );
-				layeroffset += contour.length;
-
-				for ( let h = 0, hl = holes.length; h < hl; h ++ ) {
-
-					const ahole = holes[ h ];
-					sidewalls( ahole, layeroffset );
-
-					//, true
-					layeroffset += ahole.length;
-
-				}
-
-
-				scope.addGroup( start, verticesArray.length / 3 - start, 1 );
-
-
-			}
-
-			function sidewalls( contour, layeroffset ) {
-
-				let i = contour.length;
-
-				while ( -- i >= 0 ) {
-
-					const j = i;
-					let k = i - 1;
-					if ( k < 0 ) k = contour.length - 1;
-
-					//console.log('b', i,j, i-1, k,vertices.length);
-
-					for ( let s = 0, sl = ( steps + bevelSegments * 2 ); s < sl; s ++ ) {
-
-						const slen1 = vlen * s;
-						const slen2 = vlen * ( s + 1 );
-
-						const a = layeroffset + j + slen1,
-							b = layeroffset + k + slen1,
-							c = layeroffset + k + slen2,
-							d = layeroffset + j + slen2;
-
-						f4( a, b, c, d );
-
-					}
-
-				}
-
-			}
-
-			function v( x, y, z ) {
-
-				placeholder.push( x );
-				placeholder.push( y );
-				placeholder.push( z );
-
-			}
-
-
-			function f3( a, b, c ) {
-
-				addVertex( a );
-				addVertex( b );
-				addVertex( c );
-
-				const nextIndex = verticesArray.length / 3;
-				const uvs = uvgen.generateTopUV( scope, verticesArray, nextIndex - 3, nextIndex - 2, nextIndex - 1 );
-
-				addUV( uvs[ 0 ] );
-				addUV( uvs[ 1 ] );
-				addUV( uvs[ 2 ] );
-
-			}
-
-			function f4( a, b, c, d ) {
-
-				addVertex( a );
-				addVertex( b );
-				addVertex( d );
-
-				addVertex( b );
-				addVertex( c );
-				addVertex( d );
-
-
-				const nextIndex = verticesArray.length / 3;
-				const uvs = uvgen.generateSideWallUV( scope, verticesArray, nextIndex - 6, nextIndex - 3, nextIndex - 2, nextIndex - 1 );
-
-				addUV( uvs[ 0 ] );
-				addUV( uvs[ 1 ] );
-				addUV( uvs[ 3 ] );
-
-				addUV( uvs[ 1 ] );
-				addUV( uvs[ 2 ] );
-				addUV( uvs[ 3 ] );
-
-			}
-
-			function addVertex( index ) {
-
-				verticesArray.push( placeholder[ index * 3 + 0 ] );
-				verticesArray.push( placeholder[ index * 3 + 1 ] );
-				verticesArray.push( placeholder[ index * 3 + 2 ] );
-
-			}
-
-
-			function addUV( vector2 ) {
-
-				uvArray.push( vector2.x );
-				uvArray.push( vector2.y );
-
-			}
-
-		}
-
-	}
-
-	toJSON() {
-
-		const data = BufferGeometry.prototype.toJSON.call( this );
-
-		const shapes = this.parameters.shapes;
-		const options = this.parameters.options;
-
-		return toJSON( shapes, options, data );
-
-	}
-
-}
-
-const WorldUVGenerator = {
-
-	generateTopUV: function ( geometry, vertices, indexA, indexB, indexC ) {
-
-		const a_x = vertices[ indexA * 3 ];
-		const a_y = vertices[ indexA * 3 + 1 ];
-		const b_x = vertices[ indexB * 3 ];
-		const b_y = vertices[ indexB * 3 + 1 ];
-		const c_x = vertices[ indexC * 3 ];
-		const c_y = vertices[ indexC * 3 + 1 ];
-
-		return [
-			new Vector2( a_x, a_y ),
-			new Vector2( b_x, b_y ),
-			new Vector2( c_x, c_y )
-		];
-
-	},
-
-	generateSideWallUV: function ( geometry, vertices, indexA, indexB, indexC, indexD ) {
-
-		const a_x = vertices[ indexA * 3 ];
-		const a_y = vertices[ indexA * 3 + 1 ];
-		const a_z = vertices[ indexA * 3 + 2 ];
-		const b_x = vertices[ indexB * 3 ];
-		const b_y = vertices[ indexB * 3 + 1 ];
-		const b_z = vertices[ indexB * 3 + 2 ];
-		const c_x = vertices[ indexC * 3 ];
-		const c_y = vertices[ indexC * 3 + 1 ];
-		const c_z = vertices[ indexC * 3 + 2 ];
-		const d_x = vertices[ indexD * 3 ];
-		const d_y = vertices[ indexD * 3 + 1 ];
-		const d_z = vertices[ indexD * 3 + 2 ];
-
-		if ( Math.abs( a_y - b_y ) < 0.01 ) {
-
-			return [
-				new Vector2( a_x, 1 - a_z ),
-				new Vector2( b_x, 1 - b_z ),
-				new Vector2( c_x, 1 - c_z ),
-				new Vector2( d_x, 1 - d_z )
-			];
-
-		} else {
-
-			return [
-				new Vector2( a_y, 1 - a_z ),
-				new Vector2( b_y, 1 - b_z ),
-				new Vector2( c_y, 1 - c_z ),
-				new Vector2( d_y, 1 - d_z )
-			];
-
-		}
-
-	}
-};
-
 function toJSON( shapes, options, data ) {
 function toJSON( shapes, options, data ) {
 
 
 	data.shapes = [];
 	data.shapes = [];
@@ -817,5 +80,4 @@ function toJSON( shapes, options, data ) {
 
 
 }
 }
 
 
-
-export { ExtrudeGeometry, ExtrudeBufferGeometry };
+export { ExtrudeGeometry };

+ 41 - 21
src/geometries/Geometries.js

@@ -1,22 +1,42 @@
-export { WireframeGeometry } from './WireframeGeometry.js';
-export { ParametricGeometry, ParametricBufferGeometry } from './ParametricGeometry.js';
-export { TetrahedronGeometry, TetrahedronBufferGeometry } from './TetrahedronGeometry.js';
-export { OctahedronGeometry, OctahedronBufferGeometry } from './OctahedronGeometry.js';
-export { IcosahedronGeometry, IcosahedronBufferGeometry } from './IcosahedronGeometry.js';
-export { DodecahedronGeometry, DodecahedronBufferGeometry } from './DodecahedronGeometry.js';
-export { PolyhedronGeometry, PolyhedronBufferGeometry } from './PolyhedronGeometry.js';
-export { TubeGeometry, TubeBufferGeometry } from './TubeGeometry.js';
-export { TorusKnotGeometry, TorusKnotBufferGeometry } from './TorusKnotGeometry.js';
-export { TorusGeometry, TorusBufferGeometry } from './TorusGeometry.js';
-export { TextGeometry, TextBufferGeometry } from './TextGeometry.js';
-export { SphereGeometry, SphereBufferGeometry } from './SphereGeometry.js';
-export { RingGeometry, RingBufferGeometry } from './RingGeometry.js';
-export { PlaneGeometry, PlaneBufferGeometry } from './PlaneGeometry.js';
-export { LatheGeometry, LatheBufferGeometry } from './LatheGeometry.js';
-export { ShapeGeometry, ShapeBufferGeometry } from './ShapeGeometry.js';
-export { ExtrudeGeometry, ExtrudeBufferGeometry } from './ExtrudeGeometry.js';
+export { BoxGeometry } from './BoxGeometry.js';
+export { BoxBufferGeometry } from './BoxBufferGeometry.js';
+export { CircleGeometry } from './CircleGeometry.js';
+export { CircleBufferGeometry } from './CircleBufferGeometry.js';
+export { ConeGeometry } from './ConeGeometry.js';
+export { ConeBufferGeometry } from './ConeBufferGeometry.js';
+export { CylinderGeometry } from './CylinderGeometry.js';
+export { CylinderBufferGeometry } from './CylinderBufferGeometry.js';
+export { DodecahedronGeometry } from './DodecahedronGeometry.js';
+export { DodecahedronBufferGeometry } from './DodecahedronBufferGeometry.js';
 export { EdgesGeometry } from './EdgesGeometry.js';
 export { EdgesGeometry } from './EdgesGeometry.js';
-export { ConeGeometry, ConeBufferGeometry } from './ConeGeometry.js';
-export { CylinderGeometry, CylinderBufferGeometry } from './CylinderGeometry.js';
-export { CircleGeometry, CircleBufferGeometry } from './CircleGeometry.js';
-export { BoxGeometry, BoxBufferGeometry } from './BoxGeometry.js';
+export { ExtrudeGeometry } from './ExtrudeGeometry.js';
+export { ExtrudeBufferGeometry } from './ExtrudeBufferGeometry.js';
+export { IcosahedronGeometry } from './IcosahedronGeometry.js';
+export { IcosahedronBufferGeometry } from './IcosahedronBufferGeometry.js';
+export { LatheGeometry } from './LatheGeometry.js';
+export { LatheBufferGeometry } from './LatheBufferGeometry.js';
+export { OctahedronGeometry } from './OctahedronGeometry.js';
+export { OctahedronBufferGeometry } from './OctahedronBufferGeometry.js';
+export { ParametricGeometry } from './ParametricGeometry.js';
+export { ParametricBufferGeometry } from './ParametricBufferGeometry.js';
+export { PlaneGeometry } from './PlaneGeometry.js';
+export { PlaneBufferGeometry } from './PlaneBufferGeometry.js';
+export { PolyhedronGeometry } from './PolyhedronGeometry.js';
+export { PolyhedronBufferGeometry } from './PolyhedronBufferGeometry.js';
+export { RingGeometry } from './RingGeometry.js';
+export { RingBufferGeometry } from './RingBufferGeometry.js';
+export { ShapeGeometry } from './ShapeGeometry.js';
+export { ShapeBufferGeometry } from './ShapeBufferGeometry.js';
+export { SphereGeometry } from './SphereGeometry.js';
+export { SphereBufferGeometry } from './SphereBufferGeometry.js';
+export { TetrahedronGeometry } from './TetrahedronGeometry.js';
+export { TetrahedronBufferGeometry } from './TetrahedronBufferGeometry.js';
+export { TextGeometry } from './TextGeometry.js';
+export { TextBufferGeometry } from './TextBufferGeometry.js';
+export { TorusGeometry } from './TorusGeometry.js';
+export { TorusBufferGeometry } from './TorusBufferGeometry.js';
+export { TorusKnotGeometry } from './TorusKnotGeometry.js';
+export { TorusKnotBufferGeometry } from './TorusKnotBufferGeometry.js';
+export { TubeGeometry } from './TubeGeometry.js';
+export { TubeBufferGeometry } from './TubeBufferGeometry.js';
+export { WireframeGeometry } from './WireframeGeometry.js';

+ 16 - 0
src/geometries/IcosahedronBufferGeometry.d.ts

@@ -0,0 +1,16 @@
+import { PolyhedronBufferGeometry } from './PolyhedronBufferGeometry';
+
+export class IcosahedronBufferGeometry extends PolyhedronBufferGeometry {
+
+	/**
+	 * @param [radius=1]
+	 * @param [detail=0]
+	 */
+	constructor( radius?: number, detail?: number );
+
+	/**
+	 * @default 'IcosahedronBufferGeometry'
+	 */
+	type: string;
+
+}

+ 36 - 0
src/geometries/IcosahedronBufferGeometry.js

@@ -0,0 +1,36 @@
+import { PolyhedronBufferGeometry } from './PolyhedronBufferGeometry.js';
+
+class IcosahedronBufferGeometry extends PolyhedronBufferGeometry {
+
+	constructor( radius, detail ) {
+
+		const t = ( 1 + Math.sqrt( 5 ) ) / 2;
+
+		const vertices = [
+			- 1, t, 0, 	1, t, 0, 	- 1, - t, 0, 	1, - t, 0,
+			0, - 1, t, 	0, 1, t,	0, - 1, - t, 	0, 1, - t,
+			t, 0, - 1, 	t, 0, 1, 	- t, 0, - 1, 	- t, 0, 1
+		];
+
+		const indices = [
+			0, 11, 5, 	0, 5, 1, 	0, 1, 7, 	0, 7, 10, 	0, 10, 11,
+			1, 5, 9, 	5, 11, 4,	11, 10, 2,	10, 7, 6,	7, 1, 8,
+			3, 9, 4, 	3, 4, 2,	3, 2, 6,	3, 6, 8,	3, 8, 9,
+			4, 9, 5, 	2, 4, 11,	6, 2, 10,	8, 6, 7,	9, 8, 1
+		];
+
+		super( vertices, indices, radius, detail );
+
+		this.type = 'IcosahedronBufferGeometry';
+
+		this.parameters = {
+			radius: radius,
+			detail: detail
+		};
+
+	}
+
+}
+
+
+export { IcosahedronBufferGeometry };

+ 2 - 20
src/geometries/IcosahedronGeometry.d.ts

@@ -1,24 +1,6 @@
-import {
-	PolyhedronGeometry,
-	PolyhedronBufferGeometry,
-} from './PolyhedronGeometry';
+import { Geometry } from './../core/Geometry';
 
 
-export class IcosahedronBufferGeometry extends PolyhedronBufferGeometry {
-
-	/**
-	 * @param [radius=1]
-	 * @param [detail=0]
-	 */
-	constructor( radius?: number, detail?: number );
-
-	/**
-	 * @default 'IcosahedronBufferGeometry'
-	 */
-	type: string;
-
-}
-
-export class IcosahedronGeometry extends PolyhedronGeometry {
+export class IcosahedronGeometry extends Geometry {
 
 
 	/**
 	/**
 	 * @param [radius=1]
 	 * @param [radius=1]

+ 2 - 39
src/geometries/IcosahedronGeometry.js

@@ -1,7 +1,5 @@
 import { Geometry } from '../core/Geometry.js';
 import { Geometry } from '../core/Geometry.js';
-import { PolyhedronBufferGeometry } from './PolyhedronGeometry.js';
-
-// IcosahedronGeometry
+import { IcosahedronBufferGeometry } from './IcosahedronBufferGeometry.js';
 
 
 class IcosahedronGeometry extends Geometry {
 class IcosahedronGeometry extends Geometry {
 
 
@@ -23,39 +21,4 @@ class IcosahedronGeometry extends Geometry {
 
 
 }
 }
 
 
-// IcosahedronBufferGeometry
-
-class IcosahedronBufferGeometry extends PolyhedronBufferGeometry {
-
-	constructor( radius, detail ) {
-
-		const t = ( 1 + Math.sqrt( 5 ) ) / 2;
-
-		const vertices = [
-			- 1, t, 0, 	1, t, 0, 	- 1, - t, 0, 	1, - t, 0,
-			0, - 1, t, 	0, 1, t,	0, - 1, - t, 	0, 1, - t,
-			t, 0, - 1, 	t, 0, 1, 	- t, 0, - 1, 	- t, 0, 1
-		];
-
-		const indices = [
-			0, 11, 5, 	0, 5, 1, 	0, 1, 7, 	0, 7, 10, 	0, 10, 11,
-			1, 5, 9, 	5, 11, 4,	11, 10, 2,	10, 7, 6,	7, 1, 8,
-			3, 9, 4, 	3, 4, 2,	3, 2, 6,	3, 6, 8,	3, 8, 9,
-			4, 9, 5, 	2, 4, 11,	6, 2, 10,	8, 6, 7,	9, 8, 1
-		];
-
-		super( vertices, indices, radius, detail );
-
-		this.type = 'IcosahedronBufferGeometry';
-
-		this.parameters = {
-			radius: radius,
-			detail: detail
-		};
-
-	}
-
-}
-
-
-export { IcosahedronGeometry, IcosahedronBufferGeometry };
+export { IcosahedronGeometry };

+ 31 - 0
src/geometries/LatheBufferGeometry.d.ts

@@ -0,0 +1,31 @@
+import { Vector2 } from './../math/Vector2';
+import { BufferGeometry } from './../core/BufferGeometry';
+
+export class LatheBufferGeometry extends BufferGeometry {
+
+	/**
+	 * @param points
+	 * @param [segments=12]
+	 * @param [phiStart=0]
+	 * @param [phiLength=Math.PI * 2]
+	 */
+	constructor(
+		points: Vector2[],
+		segments?: number,
+		phiStart?: number,
+		phiLength?: number
+	);
+
+	/**
+	 * @default 'LatheBufferGeometry'
+	 */
+	type: string;
+
+	parameters: {
+		points: Vector2[];
+		segments: number;
+		phiStart: number;
+		phiLength: number;
+	};
+
+}

+ 153 - 0
src/geometries/LatheBufferGeometry.js

@@ -0,0 +1,153 @@
+import { Float32BufferAttribute } from '../core/BufferAttribute.js';
+import { BufferGeometry } from '../core/BufferGeometry.js';
+import { Vector3 } from '../math/Vector3.js';
+import { Vector2 } from '../math/Vector2.js';
+import { MathUtils } from '../math/MathUtils.js';
+
+class LatheBufferGeometry extends BufferGeometry {
+
+	constructor( points, segments, phiStart, phiLength ) {
+
+		super();
+
+		this.type = 'LatheBufferGeometry';
+
+		this.parameters = {
+			points: points,
+			segments: segments,
+			phiStart: phiStart,
+			phiLength: phiLength
+		};
+
+		segments = Math.floor( segments ) || 12;
+		phiStart = phiStart || 0;
+		phiLength = phiLength || Math.PI * 2;
+
+		// clamp phiLength so it's in range of [ 0, 2PI ]
+
+		phiLength = MathUtils.clamp( phiLength, 0, Math.PI * 2 );
+
+
+		// buffers
+
+		const indices = [];
+		const vertices = [];
+		const uvs = [];
+
+		// helper variables
+
+		const inverseSegments = 1.0 / segments;
+		const vertex = new Vector3();
+		const uv = new Vector2();
+
+		// generate vertices and uvs
+
+		for ( let i = 0; i <= segments; i ++ ) {
+
+			const phi = phiStart + i * inverseSegments * phiLength;
+
+			const sin = Math.sin( phi );
+			const cos = Math.cos( phi );
+
+			for ( let j = 0; j <= ( points.length - 1 ); j ++ ) {
+
+				// vertex
+
+				vertex.x = points[ j ].x * sin;
+				vertex.y = points[ j ].y;
+				vertex.z = points[ j ].x * cos;
+
+				vertices.push( vertex.x, vertex.y, vertex.z );
+
+				// uv
+
+				uv.x = i / segments;
+				uv.y = j / ( points.length - 1 );
+
+				uvs.push( uv.x, uv.y );
+
+
+			}
+
+		}
+
+		// indices
+
+		for ( let i = 0; i < segments; i ++ ) {
+
+			for ( let j = 0; j < ( points.length - 1 ); j ++ ) {
+
+				const base = j + i * points.length;
+
+				const a = base;
+				const b = base + points.length;
+				const c = base + points.length + 1;
+				const d = base + 1;
+
+				// faces
+
+				indices.push( a, b, d );
+				indices.push( b, c, d );
+
+			}
+
+		}
+
+		// build geometry
+
+		this.setIndex( indices );
+		this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
+		this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
+
+		// generate normals
+
+		this.computeVertexNormals();
+
+		// if the geometry is closed, we need to average the normals along the seam.
+		// because the corresponding vertices are identical (but still have different UVs).
+
+		if ( phiLength === Math.PI * 2 ) {
+
+			const normals = this.attributes.normal.array;
+			const n1 = new Vector3();
+			const n2 = new Vector3();
+			const n = new Vector3();
+
+			// this is the buffer offset for the last line of vertices
+
+			const base = segments * points.length * 3;
+
+			for ( let i = 0, j = 0; i < points.length; i ++, j += 3 ) {
+
+				// select the normal of the vertex in the first line
+
+				n1.x = normals[ j + 0 ];
+				n1.y = normals[ j + 1 ];
+				n1.z = normals[ j + 2 ];
+
+				// select the normal of the vertex in the last line
+
+				n2.x = normals[ base + j + 0 ];
+				n2.y = normals[ base + j + 1 ];
+				n2.z = normals[ base + j + 2 ];
+
+				// average normals
+
+				n.addVectors( n1, n2 ).normalize();
+
+				// assign the new values to both normals
+
+				normals[ j + 0 ] = normals[ base + j + 0 ] = n.x;
+				normals[ j + 1 ] = normals[ base + j + 1 ] = n.y;
+				normals[ j + 2 ] = normals[ base + j + 2 ] = n.z;
+
+			}
+
+		}
+
+	}
+
+}
+
+
+export { LatheBufferGeometry };

+ 0 - 30
src/geometries/LatheGeometry.d.ts

@@ -1,35 +1,5 @@
 import { Vector2 } from './../math/Vector2';
 import { Vector2 } from './../math/Vector2';
 import { Geometry } from './../core/Geometry';
 import { Geometry } from './../core/Geometry';
-import { BufferGeometry } from './../core/BufferGeometry';
-
-export class LatheBufferGeometry extends BufferGeometry {
-
-	/**
-	 * @param points
-	 * @param [segments=12]
-	 * @param [phiStart=0]
-	 * @param [phiLength=Math.PI * 2]
-	 */
-	constructor(
-		points: Vector2[],
-		segments?: number,
-		phiStart?: number,
-		phiLength?: number
-	);
-
-	/**
-	 * @default 'LatheBufferGeometry'
-	 */
-	type: string;
-
-	parameters: {
-		points: Vector2[];
-		segments: number;
-		phiStart: number;
-		phiLength: number;
-	};
-
-}
 
 
 export class LatheGeometry extends Geometry {
 export class LatheGeometry extends Geometry {
 
 

+ 2 - 156
src/geometries/LatheGeometry.js

@@ -1,11 +1,5 @@
 import { Geometry } from '../core/Geometry.js';
 import { Geometry } from '../core/Geometry.js';
-import { Float32BufferAttribute } from '../core/BufferAttribute.js';
-import { BufferGeometry } from '../core/BufferGeometry.js';
-import { Vector3 } from '../math/Vector3.js';
-import { Vector2 } from '../math/Vector2.js';
-import { MathUtils } from '../math/MathUtils.js';
-
-// LatheGeometry
+import { LatheBufferGeometry } from './LatheBufferGeometry.js';
 
 
 class LatheGeometry extends Geometry {
 class LatheGeometry extends Geometry {
 
 
@@ -29,152 +23,4 @@ class LatheGeometry extends Geometry {
 
 
 }
 }
 
 
-// LatheBufferGeometry
-
-class LatheBufferGeometry extends BufferGeometry {
-
-	constructor( points, segments, phiStart, phiLength ) {
-
-		super();
-
-		this.type = 'LatheBufferGeometry';
-
-		this.parameters = {
-			points: points,
-			segments: segments,
-			phiStart: phiStart,
-			phiLength: phiLength
-		};
-
-		segments = Math.floor( segments ) || 12;
-		phiStart = phiStart || 0;
-		phiLength = phiLength || Math.PI * 2;
-
-		// clamp phiLength so it's in range of [ 0, 2PI ]
-
-		phiLength = MathUtils.clamp( phiLength, 0, Math.PI * 2 );
-
-
-		// buffers
-
-		const indices = [];
-		const vertices = [];
-		const uvs = [];
-
-		// helper variables
-
-		const inverseSegments = 1.0 / segments;
-		const vertex = new Vector3();
-		const uv = new Vector2();
-
-		// generate vertices and uvs
-
-		for ( let i = 0; i <= segments; i ++ ) {
-
-			const phi = phiStart + i * inverseSegments * phiLength;
-
-			const sin = Math.sin( phi );
-			const cos = Math.cos( phi );
-
-			for ( let j = 0; j <= ( points.length - 1 ); j ++ ) {
-
-				// vertex
-
-				vertex.x = points[ j ].x * sin;
-				vertex.y = points[ j ].y;
-				vertex.z = points[ j ].x * cos;
-
-				vertices.push( vertex.x, vertex.y, vertex.z );
-
-				// uv
-
-				uv.x = i / segments;
-				uv.y = j / ( points.length - 1 );
-
-				uvs.push( uv.x, uv.y );
-
-
-			}
-
-		}
-
-		// indices
-
-		for ( let i = 0; i < segments; i ++ ) {
-
-			for ( let j = 0; j < ( points.length - 1 ); j ++ ) {
-
-				const base = j + i * points.length;
-
-				const a = base;
-				const b = base + points.length;
-				const c = base + points.length + 1;
-				const d = base + 1;
-
-				// faces
-
-				indices.push( a, b, d );
-				indices.push( b, c, d );
-
-			}
-
-		}
-
-		// build geometry
-
-		this.setIndex( indices );
-		this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
-		this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
-
-		// generate normals
-
-		this.computeVertexNormals();
-
-		// if the geometry is closed, we need to average the normals along the seam.
-		// because the corresponding vertices are identical (but still have different UVs).
-
-		if ( phiLength === Math.PI * 2 ) {
-
-			const normals = this.attributes.normal.array;
-			const n1 = new Vector3();
-			const n2 = new Vector3();
-			const n = new Vector3();
-
-			// this is the buffer offset for the last line of vertices
-
-			const base = segments * points.length * 3;
-
-			for ( let i = 0, j = 0; i < points.length; i ++, j += 3 ) {
-
-				// select the normal of the vertex in the first line
-
-				n1.x = normals[ j + 0 ];
-				n1.y = normals[ j + 1 ];
-				n1.z = normals[ j + 2 ];
-
-				// select the normal of the vertex in the last line
-
-				n2.x = normals[ base + j + 0 ];
-				n2.y = normals[ base + j + 1 ];
-				n2.z = normals[ base + j + 2 ];
-
-				// average normals
-
-				n.addVectors( n1, n2 ).normalize();
-
-				// assign the new values to both normals
-
-				normals[ j + 0 ] = normals[ base + j + 0 ] = n.x;
-				normals[ j + 1 ] = normals[ base + j + 1 ] = n.y;
-				normals[ j + 2 ] = normals[ base + j + 2 ] = n.z;
-
-			}
-
-		}
-
-	}
-
-}
-
-
-export { LatheGeometry, LatheBufferGeometry };
+export { LatheGeometry };

+ 16 - 0
src/geometries/OctahedronBufferGeometry.d.ts

@@ -0,0 +1,16 @@
+import { PolyhedronBufferGeometry } from './PolyhedronBufferGeometry';
+
+export class OctahedronBufferGeometry extends PolyhedronBufferGeometry {
+
+	/**
+	 * @param [radius=1]
+	 * @param [detail=0]
+	 */
+	constructor( radius?: number, detail?: number );
+
+	/**
+	 * @default 'OctahedronBufferGeometry'
+	 */
+	type: string;
+
+}

+ 31 - 0
src/geometries/OctahedronBufferGeometry.js

@@ -0,0 +1,31 @@
+import { PolyhedronBufferGeometry } from './PolyhedronBufferGeometry.js';
+
+class OctahedronBufferGeometry extends PolyhedronBufferGeometry {
+
+	constructor( radius, detail ) {
+
+		const vertices = [
+			1, 0, 0, 	- 1, 0, 0,	0, 1, 0,
+			0, - 1, 0, 	0, 0, 1,	0, 0, - 1
+		];
+
+		const indices = [
+			0, 2, 4,	0, 4, 3,	0, 3, 5,
+			0, 5, 2,	1, 2, 5,	1, 5, 3,
+			1, 3, 4,	1, 4, 2
+		];
+
+		super( vertices, indices, radius, detail );
+
+		this.type = 'OctahedronBufferGeometry';
+
+		this.parameters = {
+			radius: radius,
+			detail: detail
+		};
+
+	}
+
+}
+
+export { OctahedronBufferGeometry };

+ 2 - 20
src/geometries/OctahedronGeometry.d.ts

@@ -1,24 +1,6 @@
-import {
-	PolyhedronGeometry,
-	PolyhedronBufferGeometry,
-} from './PolyhedronGeometry';
+import { Geometry } from './../core/Geometry';
 
 
-export class OctahedronBufferGeometry extends PolyhedronBufferGeometry {
-
-	/**
-	 * @param [radius=1]
-	 * @param [detail=0]
-	 */
-	constructor( radius?: number, detail?: number );
-
-	/**
-	 * @default 'OctahedronBufferGeometry'
-	 */
-	type: string;
-
-}
-
-export class OctahedronGeometry extends PolyhedronGeometry {
+export class OctahedronGeometry extends Geometry {
 
 
 	/**
 	/**
 	 * @param [radius=1]
 	 * @param [radius=1]

+ 2 - 35
src/geometries/OctahedronGeometry.js

@@ -1,7 +1,5 @@
 import { Geometry } from '../core/Geometry.js';
 import { Geometry } from '../core/Geometry.js';
-import { PolyhedronBufferGeometry } from './PolyhedronGeometry.js';
-
-// OctahedronGeometry
+import { OctahedronBufferGeometry } from './OctahedronBufferGeometry.js';
 
 
 class OctahedronGeometry extends Geometry {
 class OctahedronGeometry extends Geometry {
 
 
@@ -23,35 +21,4 @@ class OctahedronGeometry extends Geometry {
 
 
 }
 }
 
 
-// OctahedronBufferGeometry
-
-class OctahedronBufferGeometry extends PolyhedronBufferGeometry {
-
-	constructor( radius, detail ) {
-
-		const vertices = [
-			1, 0, 0, 	- 1, 0, 0,	0, 1, 0,
-			0, - 1, 0, 	0, 0, 1,	0, 0, - 1
-		];
-
-		const indices = [
-			0, 2, 4,	0, 4, 3,	0, 3, 5,
-			0, 5, 2,	1, 2, 5,	1, 5, 3,
-			1, 3, 4,	1, 4, 2
-		];
-
-		super( vertices, indices, radius, detail );
-
-		this.type = 'OctahedronBufferGeometry';
-
-		this.parameters = {
-			radius: radius,
-			detail: detail
-		};
-
-	}
-
-}
-
-
-export { OctahedronGeometry, OctahedronBufferGeometry };
+export { OctahedronGeometry };

+ 23 - 0
src/geometries/ParametricBufferGeometry.d.ts

@@ -0,0 +1,23 @@
+import { Vector3 } from './../math/Vector3';
+import { BufferGeometry } from './../core/BufferGeometry';
+
+export class ParametricBufferGeometry extends BufferGeometry {
+
+	constructor(
+		func: ( u: number, v: number, dest: Vector3 ) => void,
+		slices: number,
+		stacks: number
+	);
+
+	/**
+	 * @default 'ParametricBufferGeometry'
+	 */
+	type: string;
+
+	parameters: {
+		func: ( u: number, v: number, dest: Vector3 ) => void;
+		slices: number;
+		stacks: number;
+	};
+
+}

+ 133 - 0
src/geometries/ParametricBufferGeometry.js

@@ -0,0 +1,133 @@
+/**
+ * Parametric Surfaces Geometry
+ * 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';
+
+function ParametricBufferGeometry( func, slices, stacks ) {
+
+	BufferGeometry.call( this );
+
+	this.type = 'ParametricBufferGeometry';
+
+	this.parameters = {
+		func: func,
+		slices: slices,
+		stacks: stacks
+	};
+
+	// buffers
+
+	const indices = [];
+	const vertices = [];
+	const normals = [];
+	const uvs = [];
+
+	const EPS = 0.00001;
+
+	const normal = new Vector3();
+
+	const p0 = new Vector3(), p1 = new Vector3();
+	const pu = new Vector3(), pv = new Vector3();
+
+	if ( func.length < 3 ) {
+
+		console.error( 'THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.' );
+
+	}
+
+	// generate vertices, normals and uvs
+
+	const sliceCount = slices + 1;
+
+	for ( let i = 0; i <= stacks; i ++ ) {
+
+		const v = i / stacks;
+
+		for ( let j = 0; j <= slices; j ++ ) {
+
+			const u = j / slices;
+
+			// vertex
+
+			func( u, v, p0 );
+			vertices.push( p0.x, p0.y, p0.z );
+
+			// normal
+
+			// approximate tangent vectors via finite differences
+
+			if ( u - EPS >= 0 ) {
+
+				func( u - EPS, v, p1 );
+				pu.subVectors( p0, p1 );
+
+			} else {
+
+				func( u + EPS, v, p1 );
+				pu.subVectors( p1, p0 );
+
+			}
+
+			if ( v - EPS >= 0 ) {
+
+				func( u, v - EPS, p1 );
+				pv.subVectors( p0, p1 );
+
+			} else {
+
+				func( u, v + EPS, p1 );
+				pv.subVectors( p1, p0 );
+
+			}
+
+			// cross product of tangent vectors returns surface normal
+
+			normal.crossVectors( pu, pv ).normalize();
+			normals.push( normal.x, normal.y, normal.z );
+
+			// uv
+
+			uvs.push( u, v );
+
+		}
+
+	}
+
+	// generate indices
+
+	for ( let i = 0; i < stacks; i ++ ) {
+
+		for ( let j = 0; j < slices; j ++ ) {
+
+			const a = i * sliceCount + j;
+			const b = i * sliceCount + j + 1;
+			const c = ( i + 1 ) * sliceCount + j + 1;
+			const d = ( i + 1 ) * sliceCount + j;
+
+			// faces one and two
+
+			indices.push( a, b, d );
+			indices.push( b, c, d );
+
+		}
+
+	}
+
+	// build geometry
+
+	this.setIndex( indices );
+	this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
+	this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
+	this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
+
+}
+
+ParametricBufferGeometry.prototype = Object.create( BufferGeometry.prototype );
+ParametricBufferGeometry.prototype.constructor = ParametricBufferGeometry;
+
+
+export { ParametricBufferGeometry };

+ 0 - 22
src/geometries/ParametricGeometry.d.ts

@@ -1,27 +1,5 @@
 import { Vector3 } from './../math/Vector3';
 import { Vector3 } from './../math/Vector3';
 import { Geometry } from './../core/Geometry';
 import { Geometry } from './../core/Geometry';
-import { BufferGeometry } from './../core/BufferGeometry';
-
-export class ParametricBufferGeometry extends BufferGeometry {
-
-	constructor(
-		func: ( u: number, v: number, dest: Vector3 ) => void,
-		slices: number,
-		stacks: number
-	);
-
-	/**
-	 * @default 'ParametricBufferGeometry'
-	 */
-	type: string;
-
-	parameters: {
-		func: ( u: number, v: number, dest: Vector3 ) => void;
-		slices: number;
-		stacks: number;
-	};
-
-}
 
 
 export class ParametricGeometry extends Geometry {
 export class ParametricGeometry extends Geometry {
 
 

+ 3 - 131
src/geometries/ParametricGeometry.js

@@ -1,14 +1,10 @@
-import { Geometry } from '../core/Geometry.js';
-import { BufferGeometry } from '../core/BufferGeometry.js';
-import { Float32BufferAttribute } from '../core/BufferAttribute.js';
-import { Vector3 } from '../math/Vector3.js';
-
 /**
 /**
  * Parametric Surfaces Geometry
  * Parametric Surfaces Geometry
  * based on the brilliant article by @prideout https://prideout.net/blog/old/blog/index.html@p=44.html
  * based on the brilliant article by @prideout https://prideout.net/blog/old/blog/index.html@p=44.html
  */
  */
 
 
-// ParametricGeometry
+import { Geometry } from '../core/Geometry.js';
+import { ParametricBufferGeometry } from './ParametricBufferGeometry.js';
 
 
 function ParametricGeometry( func, slices, stacks ) {
 function ParametricGeometry( func, slices, stacks ) {
 
 
@@ -30,129 +26,5 @@ function ParametricGeometry( func, slices, stacks ) {
 ParametricGeometry.prototype = Object.create( Geometry.prototype );
 ParametricGeometry.prototype = Object.create( Geometry.prototype );
 ParametricGeometry.prototype.constructor = ParametricGeometry;
 ParametricGeometry.prototype.constructor = ParametricGeometry;
 
 
-// ParametricBufferGeometry
-
-function ParametricBufferGeometry( func, slices, stacks ) {
-
-	BufferGeometry.call( this );
-
-	this.type = 'ParametricBufferGeometry';
-
-	this.parameters = {
-		func: func,
-		slices: slices,
-		stacks: stacks
-	};
-
-	// buffers
-
-	const indices = [];
-	const vertices = [];
-	const normals = [];
-	const uvs = [];
-
-	const EPS = 0.00001;
-
-	const normal = new Vector3();
-
-	const p0 = new Vector3(), p1 = new Vector3();
-	const pu = new Vector3(), pv = new Vector3();
-
-	if ( func.length < 3 ) {
-
-		console.error( 'THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.' );
-
-	}
-
-	// generate vertices, normals and uvs
-
-	const sliceCount = slices + 1;
-
-	for ( let i = 0; i <= stacks; i ++ ) {
-
-		const v = i / stacks;
-
-		for ( let j = 0; j <= slices; j ++ ) {
-
-			const u = j / slices;
-
-			// vertex
-
-			func( u, v, p0 );
-			vertices.push( p0.x, p0.y, p0.z );
-
-			// normal
-
-			// approximate tangent vectors via finite differences
-
-			if ( u - EPS >= 0 ) {
-
-				func( u - EPS, v, p1 );
-				pu.subVectors( p0, p1 );
-
-			} else {
-
-				func( u + EPS, v, p1 );
-				pu.subVectors( p1, p0 );
-
-			}
-
-			if ( v - EPS >= 0 ) {
-
-				func( u, v - EPS, p1 );
-				pv.subVectors( p0, p1 );
-
-			} else {
-
-				func( u, v + EPS, p1 );
-				pv.subVectors( p1, p0 );
-
-			}
-
-			// cross product of tangent vectors returns surface normal
-
-			normal.crossVectors( pu, pv ).normalize();
-			normals.push( normal.x, normal.y, normal.z );
-
-			// uv
-
-			uvs.push( u, v );
-
-		}
-
-	}
-
-	// generate indices
-
-	for ( let i = 0; i < stacks; i ++ ) {
-
-		for ( let j = 0; j < slices; j ++ ) {
-
-			const a = i * sliceCount + j;
-			const b = i * sliceCount + j + 1;
-			const c = ( i + 1 ) * sliceCount + j + 1;
-			const d = ( i + 1 ) * sliceCount + j;
-
-			// faces one and two
-
-			indices.push( a, b, d );
-			indices.push( b, c, d );
-
-		}
-
-	}
-
-	// build geometry
-
-	this.setIndex( indices );
-	this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
-	this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
-	this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
-
-}
-
-ParametricBufferGeometry.prototype = Object.create( BufferGeometry.prototype );
-ParametricBufferGeometry.prototype.constructor = ParametricBufferGeometry;
-
 
 
-export { ParametricGeometry, ParametricBufferGeometry };
+export { ParametricGeometry };

+ 30 - 0
src/geometries/PlaneBufferGeometry.d.ts

@@ -0,0 +1,30 @@
+import { BufferGeometry } from './../core/BufferGeometry';
+
+export class PlaneBufferGeometry extends BufferGeometry {
+
+	/**
+	 * @param [width=1] — Width of the sides on the X axis.
+	 * @param [height=1] — Height of the sides on the Y axis.
+	 * @param [widthSegments=1] — Number of segmented faces along the width of the sides.
+	 * @param [heightSegments=1] — Number of segmented faces along the height of the sides.
+	 */
+	constructor(
+		width?: number,
+		height?: number,
+		widthSegments?: number,
+		heightSegments?: number
+	);
+
+	/**
+	 * @default 'PlaneBufferGeometry'
+	 */
+	type: string;
+
+	parameters: {
+		width: number;
+		height: number;
+		widthSegments: number;
+		heightSegments: number;
+	};
+
+}

+ 93 - 0
src/geometries/PlaneBufferGeometry.js

@@ -0,0 +1,93 @@
+import { BufferGeometry } from '../core/BufferGeometry.js';
+import { Float32BufferAttribute } from '../core/BufferAttribute.js';
+
+class PlaneBufferGeometry extends BufferGeometry {
+
+	constructor( width, height, widthSegments, heightSegments ) {
+
+		super();
+		this.type = 'PlaneBufferGeometry';
+
+		this.parameters = {
+			width: width,
+			height: height,
+			widthSegments: widthSegments,
+			heightSegments: heightSegments
+		};
+
+		width = width || 1;
+		height = height || 1;
+
+		const width_half = width / 2;
+		const height_half = height / 2;
+
+		const gridX = Math.floor( widthSegments ) || 1;
+		const gridY = Math.floor( heightSegments ) || 1;
+
+		const gridX1 = gridX + 1;
+		const gridY1 = gridY + 1;
+
+		const segment_width = width / gridX;
+		const segment_height = height / gridY;
+
+		// buffers
+
+		const indices = [];
+		const vertices = [];
+		const normals = [];
+		const uvs = [];
+
+		// generate vertices, normals and uvs
+
+		for ( let iy = 0; iy < gridY1; iy ++ ) {
+
+			const y = iy * segment_height - height_half;
+
+			for ( let ix = 0; ix < gridX1; ix ++ ) {
+
+				const x = ix * segment_width - width_half;
+
+				vertices.push( x, - y, 0 );
+
+				normals.push( 0, 0, 1 );
+
+				uvs.push( ix / gridX );
+				uvs.push( 1 - ( iy / gridY ) );
+
+			}
+
+		}
+
+		// indices
+
+		for ( let iy = 0; iy < gridY; iy ++ ) {
+
+			for ( let ix = 0; ix < gridX; ix ++ ) {
+
+				const a = ix + gridX1 * iy;
+				const b = ix + gridX1 * ( iy + 1 );
+				const c = ( ix + 1 ) + gridX1 * ( iy + 1 );
+				const d = ( ix + 1 ) + gridX1 * iy;
+
+				// faces
+
+				indices.push( a, b, d );
+				indices.push( b, c, d );
+
+			}
+
+		}
+
+		// build geometry
+
+		this.setIndex( indices );
+		this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
+		this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
+		this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
+
+	}
+
+}
+
+
+export { PlaneBufferGeometry };

+ 0 - 30
src/geometries/PlaneGeometry.d.ts

@@ -1,34 +1,4 @@
 import { Geometry } from './../core/Geometry';
 import { Geometry } from './../core/Geometry';
-import { BufferGeometry } from './../core/BufferGeometry';
-
-export class PlaneBufferGeometry extends BufferGeometry {
-
-	/**
-	 * @param [width=1] — Width of the sides on the X axis.
-	 * @param [height=1] — Height of the sides on the Y axis.
-	 * @param [widthSegments=1] — Number of segmented faces along the width of the sides.
-	 * @param [heightSegments=1] — Number of segmented faces along the height of the sides.
-	 */
-	constructor(
-		width?: number,
-		height?: number,
-		widthSegments?: number,
-		heightSegments?: number
-	);
-
-	/**
-	 * @default 'PlaneBufferGeometry'
-	 */
-	type: string;
-
-	parameters: {
-		width: number;
-		height: number;
-		widthSegments: number;
-		heightSegments: number;
-	};
-
-}
 
 
 export class PlaneGeometry extends Geometry {
 export class PlaneGeometry extends Geometry {
 
 

+ 2 - 96
src/geometries/PlaneGeometry.js

@@ -1,8 +1,5 @@
 import { Geometry } from '../core/Geometry.js';
 import { Geometry } from '../core/Geometry.js';
-import { BufferGeometry } from '../core/BufferGeometry.js';
-import { Float32BufferAttribute } from '../core/BufferAttribute.js';
-
-// PlaneGeometry
+import { PlaneBufferGeometry } from './PlaneBufferGeometry.js';
 
 
 class PlaneGeometry extends Geometry {
 class PlaneGeometry extends Geometry {
 
 
@@ -26,95 +23,4 @@ class PlaneGeometry extends Geometry {
 
 
 }
 }
 
 
-// PlaneBufferGeometry
-
-class PlaneBufferGeometry extends BufferGeometry {
-
-	constructor( width, height, widthSegments, heightSegments ) {
-
-		super();
-		this.type = 'PlaneBufferGeometry';
-
-		this.parameters = {
-			width: width,
-			height: height,
-			widthSegments: widthSegments,
-			heightSegments: heightSegments
-		};
-
-		width = width || 1;
-		height = height || 1;
-
-		const width_half = width / 2;
-		const height_half = height / 2;
-
-		const gridX = Math.floor( widthSegments ) || 1;
-		const gridY = Math.floor( heightSegments ) || 1;
-
-		const gridX1 = gridX + 1;
-		const gridY1 = gridY + 1;
-
-		const segment_width = width / gridX;
-		const segment_height = height / gridY;
-
-		// buffers
-
-		const indices = [];
-		const vertices = [];
-		const normals = [];
-		const uvs = [];
-
-		// generate vertices, normals and uvs
-
-		for ( let iy = 0; iy < gridY1; iy ++ ) {
-
-			const y = iy * segment_height - height_half;
-
-			for ( let ix = 0; ix < gridX1; ix ++ ) {
-
-				const x = ix * segment_width - width_half;
-
-				vertices.push( x, - y, 0 );
-
-				normals.push( 0, 0, 1 );
-
-				uvs.push( ix / gridX );
-				uvs.push( 1 - ( iy / gridY ) );
-
-			}
-
-		}
-
-		// indices
-
-		for ( let iy = 0; iy < gridY; iy ++ ) {
-
-			for ( let ix = 0; ix < gridX; ix ++ ) {
-
-				const a = ix + gridX1 * iy;
-				const b = ix + gridX1 * ( iy + 1 );
-				const c = ( ix + 1 ) + gridX1 * ( iy + 1 );
-				const d = ( ix + 1 ) + gridX1 * iy;
-
-				// faces
-
-				indices.push( a, b, d );
-				indices.push( b, c, d );
-
-			}
-
-		}
-
-		// build geometry
-
-		this.setIndex( indices );
-		this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
-		this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
-		this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
-
-	}
-
-}
-
-
-export { PlaneGeometry, PlaneBufferGeometry };
+export { PlaneGeometry };

+ 30 - 0
src/geometries/PolyhedronBufferGeometry.d.ts

@@ -0,0 +1,30 @@
+import { BufferGeometry } from './../core/BufferGeometry';
+
+export class PolyhedronBufferGeometry extends BufferGeometry {
+
+	/**
+	 * @param vertices
+	 * @param indices
+	 * @param [radius=1]
+	 * @param [detail=0]
+	 */
+	constructor(
+		vertices: number[],
+		indices: number[],
+		radius?: number,
+		detail?: number
+	);
+
+	/**
+	 * @default 'PolyhedronBufferGeometry'
+	 */
+	type: string;
+
+	parameters: {
+		vertices: number[];
+		indices: number[];
+		radius: number;
+		detail: number;
+	};
+
+}

+ 306 - 0
src/geometries/PolyhedronBufferGeometry.js

@@ -0,0 +1,306 @@
+import { BufferGeometry } from '../core/BufferGeometry.js';
+import { Float32BufferAttribute } from '../core/BufferAttribute.js';
+import { Vector3 } from '../math/Vector3.js';
+import { Vector2 } from '../math/Vector2.js';
+
+class PolyhedronBufferGeometry extends BufferGeometry {
+
+	constructor( vertices, indices, radius, detail ) {
+
+		super();
+
+		this.type = 'PolyhedronBufferGeometry';
+
+		this.parameters = {
+			vertices: vertices,
+			indices: indices,
+			radius: radius,
+			detail: detail
+		};
+
+		radius = radius || 1;
+		detail = detail || 0;
+
+		// default buffer data
+
+		const vertexBuffer = [];
+		const uvBuffer = [];
+
+		// the subdivision creates the vertex buffer data
+
+		subdivide( detail );
+
+		// all vertices should lie on a conceptual sphere with a given radius
+
+		applyRadius( radius );
+
+		// finally, create the uv data
+
+		generateUVs();
+
+		// build non-indexed geometry
+
+		this.setAttribute( 'position', new Float32BufferAttribute( vertexBuffer, 3 ) );
+		this.setAttribute( 'normal', new Float32BufferAttribute( vertexBuffer.slice(), 3 ) );
+		this.setAttribute( 'uv', new Float32BufferAttribute( uvBuffer, 2 ) );
+
+		if ( detail === 0 ) {
+
+			this.computeVertexNormals(); // flat normals
+
+		} else {
+
+			this.normalizeNormals(); // smooth normals
+
+		}
+
+		// helper functions
+
+		function subdivide( detail ) {
+
+			const a = new Vector3();
+			const b = new Vector3();
+			const c = new Vector3();
+
+			// iterate over all faces and apply a subdivison with the given detail value
+
+			for ( let i = 0; i < indices.length; i += 3 ) {
+
+				// get the vertices of the face
+
+				getVertexByIndex( indices[ i + 0 ], a );
+				getVertexByIndex( indices[ i + 1 ], b );
+				getVertexByIndex( indices[ i + 2 ], c );
+
+				// perform subdivision
+
+				subdivideFace( a, b, c, detail );
+
+			}
+
+		}
+
+		function subdivideFace( a, b, c, detail ) {
+
+			const cols = detail + 1;
+
+			// we use this multidimensional array as a data structure for creating the subdivision
+
+			const v = [];
+
+			// construct all of the vertices for this subdivision
+
+			for ( let i = 0; i <= cols; i ++ ) {
+
+				v[ i ] = [];
+
+				const aj = a.clone().lerp( c, i / cols );
+				const bj = b.clone().lerp( c, i / cols );
+
+				const rows = cols - i;
+
+				for ( let j = 0; j <= rows; j ++ ) {
+
+					if ( j === 0 && i === cols ) {
+
+						v[ i ][ j ] = aj;
+
+					} else {
+
+						v[ i ][ j ] = aj.clone().lerp( bj, j / rows );
+
+					}
+
+				}
+
+			}
+
+			// construct all of the faces
+
+			for ( let i = 0; i < cols; i ++ ) {
+
+				for ( let j = 0; j < 2 * ( cols - i ) - 1; j ++ ) {
+
+					const k = Math.floor( j / 2 );
+
+					if ( j % 2 === 0 ) {
+
+						pushVertex( v[ i ][ k + 1 ] );
+						pushVertex( v[ i + 1 ][ k ] );
+						pushVertex( v[ i ][ k ] );
+
+					} else {
+
+						pushVertex( v[ i ][ k + 1 ] );
+						pushVertex( v[ i + 1 ][ k + 1 ] );
+						pushVertex( v[ i + 1 ][ k ] );
+
+					}
+
+				}
+
+			}
+
+		}
+
+		function applyRadius( radius ) {
+
+			const vertex = new Vector3();
+
+			// iterate over the entire buffer and apply the radius to each vertex
+
+			for ( let i = 0; i < vertexBuffer.length; i += 3 ) {
+
+				vertex.x = vertexBuffer[ i + 0 ];
+				vertex.y = vertexBuffer[ i + 1 ];
+				vertex.z = vertexBuffer[ i + 2 ];
+
+				vertex.normalize().multiplyScalar( radius );
+
+				vertexBuffer[ i + 0 ] = vertex.x;
+				vertexBuffer[ i + 1 ] = vertex.y;
+				vertexBuffer[ i + 2 ] = vertex.z;
+
+			}
+
+		}
+
+		function generateUVs() {
+
+			const vertex = new Vector3();
+
+			for ( let i = 0; i < vertexBuffer.length; i += 3 ) {
+
+				vertex.x = vertexBuffer[ i + 0 ];
+				vertex.y = vertexBuffer[ i + 1 ];
+				vertex.z = vertexBuffer[ i + 2 ];
+
+				const u = azimuth( vertex ) / 2 / Math.PI + 0.5;
+				const v = inclination( vertex ) / Math.PI + 0.5;
+				uvBuffer.push( u, 1 - v );
+
+			}
+
+			correctUVs();
+
+			correctSeam();
+
+		}
+
+		function correctSeam() {
+
+			// handle case when face straddles the seam, see #3269
+
+			for ( let i = 0; i < uvBuffer.length; i += 6 ) {
+
+				// uv data of a single face
+
+				const x0 = uvBuffer[ i + 0 ];
+				const x1 = uvBuffer[ i + 2 ];
+				const x2 = uvBuffer[ i + 4 ];
+
+				const max = Math.max( x0, x1, x2 );
+				const min = Math.min( x0, x1, x2 );
+
+				// 0.9 is somewhat arbitrary
+
+				if ( max > 0.9 && min < 0.1 ) {
+
+					if ( x0 < 0.2 ) uvBuffer[ i + 0 ] += 1;
+					if ( x1 < 0.2 ) uvBuffer[ i + 2 ] += 1;
+					if ( x2 < 0.2 ) uvBuffer[ i + 4 ] += 1;
+
+				}
+
+			}
+
+		}
+
+		function pushVertex( vertex ) {
+
+			vertexBuffer.push( vertex.x, vertex.y, vertex.z );
+
+		}
+
+		function getVertexByIndex( index, vertex ) {
+
+			const stride = index * 3;
+
+			vertex.x = vertices[ stride + 0 ];
+			vertex.y = vertices[ stride + 1 ];
+			vertex.z = vertices[ stride + 2 ];
+
+		}
+
+		function correctUVs() {
+
+			const a = new Vector3();
+			const b = new Vector3();
+			const c = new Vector3();
+
+			const centroid = new Vector3();
+
+			const uvA = new Vector2();
+			const uvB = new Vector2();
+			const uvC = new Vector2();
+
+			for ( let i = 0, j = 0; i < vertexBuffer.length; i += 9, j += 6 ) {
+
+				a.set( vertexBuffer[ i + 0 ], vertexBuffer[ i + 1 ], vertexBuffer[ i + 2 ] );
+				b.set( vertexBuffer[ i + 3 ], vertexBuffer[ i + 4 ], vertexBuffer[ i + 5 ] );
+				c.set( vertexBuffer[ i + 6 ], vertexBuffer[ i + 7 ], vertexBuffer[ i + 8 ] );
+
+				uvA.set( uvBuffer[ j + 0 ], uvBuffer[ j + 1 ] );
+				uvB.set( uvBuffer[ j + 2 ], uvBuffer[ j + 3 ] );
+				uvC.set( uvBuffer[ j + 4 ], uvBuffer[ j + 5 ] );
+
+				centroid.copy( a ).add( b ).add( c ).divideScalar( 3 );
+
+				const azi = azimuth( centroid );
+
+				correctUV( uvA, j + 0, a, azi );
+				correctUV( uvB, j + 2, b, azi );
+				correctUV( uvC, j + 4, c, azi );
+
+			}
+
+		}
+
+		function correctUV( uv, stride, vector, azimuth ) {
+
+			if ( ( azimuth < 0 ) && ( uv.x === 1 ) ) {
+
+				uvBuffer[ stride ] = uv.x - 1;
+
+			}
+
+			if ( ( vector.x === 0 ) && ( vector.z === 0 ) ) {
+
+				uvBuffer[ stride ] = azimuth / 2 / Math.PI + 0.5;
+
+			}
+
+		}
+
+		// Angle around the Y axis, counter-clockwise when looking from above.
+
+		function azimuth( vector ) {
+
+			return Math.atan2( vector.z, - vector.x );
+
+		}
+
+
+		// Angle above the XZ plane.
+
+		function inclination( vector ) {
+
+			return Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );
+
+		}
+
+	}
+
+}
+
+export { PolyhedronBufferGeometry };

+ 0 - 32
src/geometries/PolyhedronGeometry.d.ts

@@ -1,35 +1,4 @@
-import { Sphere } from './../math/Sphere';
 import { Geometry } from './../core/Geometry';
 import { Geometry } from './../core/Geometry';
-import { BufferGeometry } from './../core/BufferGeometry';
-
-export class PolyhedronBufferGeometry extends BufferGeometry {
-
-	/**
-	 * @param vertices
-	 * @param indices
-	 * @param [radius=1]
-	 * @param [detail=0]
-	 */
-	constructor(
-		vertices: number[],
-		indices: number[],
-		radius?: number,
-		detail?: number
-	);
-
-	/**
-	 * @default 'PolyhedronBufferGeometry'
-	 */
-	type: string;
-
-	parameters: {
-		vertices: number[];
-		indices: number[];
-		radius: number;
-		detail: number;
-	};
-
-}
 
 
 export class PolyhedronGeometry extends Geometry {
 export class PolyhedronGeometry extends Geometry {
 
 
@@ -57,6 +26,5 @@ export class PolyhedronGeometry extends Geometry {
 		radius: number;
 		radius: number;
 		detail: number;
 		detail: number;
 	};
 	};
-	boundingSphere: Sphere;
 
 
 }
 }

+ 2 - 310
src/geometries/PolyhedronGeometry.js

@@ -1,10 +1,5 @@
 import { Geometry } from '../core/Geometry.js';
 import { Geometry } from '../core/Geometry.js';
-import { BufferGeometry } from '../core/BufferGeometry.js';
-import { Float32BufferAttribute } from '../core/BufferAttribute.js';
-import { Vector3 } from '../math/Vector3.js';
-import { Vector2 } from '../math/Vector2.js';
-
-// PolyhedronGeometry
+import { PolyhedronBufferGeometry } from './PolyhedronBufferGeometry.js';
 
 
 class PolyhedronGeometry extends Geometry {
 class PolyhedronGeometry extends Geometry {
 
 
@@ -28,307 +23,4 @@ class PolyhedronGeometry extends Geometry {
 
 
 }
 }
 
 
-// PolyhedronBufferGeometry
-
-class PolyhedronBufferGeometry extends BufferGeometry {
-
-	constructor( vertices, indices, radius, detail ) {
-
-		super();
-
-		this.type = 'PolyhedronBufferGeometry';
-
-		this.parameters = {
-			vertices: vertices,
-			indices: indices,
-			radius: radius,
-			detail: detail
-		};
-
-		radius = radius || 1;
-		detail = detail || 0;
-
-		// default buffer data
-
-		const vertexBuffer = [];
-		const uvBuffer = [];
-
-		// the subdivision creates the vertex buffer data
-
-		subdivide( detail );
-
-		// all vertices should lie on a conceptual sphere with a given radius
-
-		applyRadius( radius );
-
-		// finally, create the uv data
-
-		generateUVs();
-
-		// build non-indexed geometry
-
-		this.setAttribute( 'position', new Float32BufferAttribute( vertexBuffer, 3 ) );
-		this.setAttribute( 'normal', new Float32BufferAttribute( vertexBuffer.slice(), 3 ) );
-		this.setAttribute( 'uv', new Float32BufferAttribute( uvBuffer, 2 ) );
-
-		if ( detail === 0 ) {
-
-			this.computeVertexNormals(); // flat normals
-
-		} else {
-
-			this.normalizeNormals(); // smooth normals
-
-		}
-
-		// helper functions
-
-		function subdivide( detail ) {
-
-			const a = new Vector3();
-			const b = new Vector3();
-			const c = new Vector3();
-
-			// iterate over all faces and apply a subdivison with the given detail value
-
-			for ( let i = 0; i < indices.length; i += 3 ) {
-
-				// get the vertices of the face
-
-				getVertexByIndex( indices[ i + 0 ], a );
-				getVertexByIndex( indices[ i + 1 ], b );
-				getVertexByIndex( indices[ i + 2 ], c );
-
-				// perform subdivision
-
-				subdivideFace( a, b, c, detail );
-
-			}
-
-		}
-
-		function subdivideFace( a, b, c, detail ) {
-
-			const cols = detail + 1;
-
-			// we use this multidimensional array as a data structure for creating the subdivision
-
-			const v = [];
-
-			// construct all of the vertices for this subdivision
-
-			for ( let i = 0; i <= cols; i ++ ) {
-
-				v[ i ] = [];
-
-				const aj = a.clone().lerp( c, i / cols );
-				const bj = b.clone().lerp( c, i / cols );
-
-				const rows = cols - i;
-
-				for ( let j = 0; j <= rows; j ++ ) {
-
-					if ( j === 0 && i === cols ) {
-
-						v[ i ][ j ] = aj;
-
-					} else {
-
-						v[ i ][ j ] = aj.clone().lerp( bj, j / rows );
-
-					}
-
-				}
-
-			}
-
-			// construct all of the faces
-
-			for ( let i = 0; i < cols; i ++ ) {
-
-				for ( let j = 0; j < 2 * ( cols - i ) - 1; j ++ ) {
-
-					const k = Math.floor( j / 2 );
-
-					if ( j % 2 === 0 ) {
-
-						pushVertex( v[ i ][ k + 1 ] );
-						pushVertex( v[ i + 1 ][ k ] );
-						pushVertex( v[ i ][ k ] );
-
-					} else {
-
-						pushVertex( v[ i ][ k + 1 ] );
-						pushVertex( v[ i + 1 ][ k + 1 ] );
-						pushVertex( v[ i + 1 ][ k ] );
-
-					}
-
-				}
-
-			}
-
-		}
-
-		function applyRadius( radius ) {
-
-			const vertex = new Vector3();
-
-			// iterate over the entire buffer and apply the radius to each vertex
-
-			for ( let i = 0; i < vertexBuffer.length; i += 3 ) {
-
-				vertex.x = vertexBuffer[ i + 0 ];
-				vertex.y = vertexBuffer[ i + 1 ];
-				vertex.z = vertexBuffer[ i + 2 ];
-
-				vertex.normalize().multiplyScalar( radius );
-
-				vertexBuffer[ i + 0 ] = vertex.x;
-				vertexBuffer[ i + 1 ] = vertex.y;
-				vertexBuffer[ i + 2 ] = vertex.z;
-
-			}
-
-		}
-
-		function generateUVs() {
-
-			const vertex = new Vector3();
-
-			for ( let i = 0; i < vertexBuffer.length; i += 3 ) {
-
-				vertex.x = vertexBuffer[ i + 0 ];
-				vertex.y = vertexBuffer[ i + 1 ];
-				vertex.z = vertexBuffer[ i + 2 ];
-
-				const u = azimuth( vertex ) / 2 / Math.PI + 0.5;
-				const v = inclination( vertex ) / Math.PI + 0.5;
-				uvBuffer.push( u, 1 - v );
-
-			}
-
-			correctUVs();
-
-			correctSeam();
-
-		}
-
-		function correctSeam() {
-
-			// handle case when face straddles the seam, see #3269
-
-			for ( let i = 0; i < uvBuffer.length; i += 6 ) {
-
-				// uv data of a single face
-
-				const x0 = uvBuffer[ i + 0 ];
-				const x1 = uvBuffer[ i + 2 ];
-				const x2 = uvBuffer[ i + 4 ];
-
-				const max = Math.max( x0, x1, x2 );
-				const min = Math.min( x0, x1, x2 );
-
-				// 0.9 is somewhat arbitrary
-
-				if ( max > 0.9 && min < 0.1 ) {
-
-					if ( x0 < 0.2 ) uvBuffer[ i + 0 ] += 1;
-					if ( x1 < 0.2 ) uvBuffer[ i + 2 ] += 1;
-					if ( x2 < 0.2 ) uvBuffer[ i + 4 ] += 1;
-
-				}
-
-			}
-
-		}
-
-		function pushVertex( vertex ) {
-
-			vertexBuffer.push( vertex.x, vertex.y, vertex.z );
-
-		}
-
-		function getVertexByIndex( index, vertex ) {
-
-			const stride = index * 3;
-
-			vertex.x = vertices[ stride + 0 ];
-			vertex.y = vertices[ stride + 1 ];
-			vertex.z = vertices[ stride + 2 ];
-
-		}
-
-		function correctUVs() {
-
-			const a = new Vector3();
-			const b = new Vector3();
-			const c = new Vector3();
-
-			const centroid = new Vector3();
-
-			const uvA = new Vector2();
-			const uvB = new Vector2();
-			const uvC = new Vector2();
-
-			for ( let i = 0, j = 0; i < vertexBuffer.length; i += 9, j += 6 ) {
-
-				a.set( vertexBuffer[ i + 0 ], vertexBuffer[ i + 1 ], vertexBuffer[ i + 2 ] );
-				b.set( vertexBuffer[ i + 3 ], vertexBuffer[ i + 4 ], vertexBuffer[ i + 5 ] );
-				c.set( vertexBuffer[ i + 6 ], vertexBuffer[ i + 7 ], vertexBuffer[ i + 8 ] );
-
-				uvA.set( uvBuffer[ j + 0 ], uvBuffer[ j + 1 ] );
-				uvB.set( uvBuffer[ j + 2 ], uvBuffer[ j + 3 ] );
-				uvC.set( uvBuffer[ j + 4 ], uvBuffer[ j + 5 ] );
-
-				centroid.copy( a ).add( b ).add( c ).divideScalar( 3 );
-
-				const azi = azimuth( centroid );
-
-				correctUV( uvA, j + 0, a, azi );
-				correctUV( uvB, j + 2, b, azi );
-				correctUV( uvC, j + 4, c, azi );
-
-			}
-
-		}
-
-		function correctUV( uv, stride, vector, azimuth ) {
-
-			if ( ( azimuth < 0 ) && ( uv.x === 1 ) ) {
-
-				uvBuffer[ stride ] = uv.x - 1;
-
-			}
-
-			if ( ( vector.x === 0 ) && ( vector.z === 0 ) ) {
-
-				uvBuffer[ stride ] = azimuth / 2 / Math.PI + 0.5;
-
-			}
-
-		}
-
-		// Angle around the Y axis, counter-clockwise when looking from above.
-
-		function azimuth( vector ) {
-
-			return Math.atan2( vector.z, - vector.x );
-
-		}
-
-
-		// Angle above the XZ plane.
-
-		function inclination( vector ) {
-
-			return Math.atan2( - vector.y, Math.sqrt( ( vector.x * vector.x ) + ( vector.z * vector.z ) ) );
-
-		}
-
-	}
-
-}
-
-
-export { PolyhedronGeometry, PolyhedronBufferGeometry };
+export { PolyhedronGeometry };

+ 36 - 0
src/geometries/RingBufferGeometry.d.ts

@@ -0,0 +1,36 @@
+import { BufferGeometry } from './../core/BufferGeometry';
+
+export class RingBufferGeometry extends BufferGeometry {
+
+	/**
+	 * @param [innerRadius=0.5]
+	 * @param [outerRadius=1]
+	 * @param [thetaSegments=8]
+	 * @param [phiSegments=1]
+	 * @param [thetaStart=0]
+	 * @param [thetaLength=Math.PI * 2]
+	 */
+	constructor(
+		innerRadius?: number,
+		outerRadius?: number,
+		thetaSegments?: number,
+		phiSegments?: number,
+		thetaStart?: number,
+		thetaLength?: number
+	);
+
+	/**
+	 * @default 'RingBufferGeometry'
+	 */
+	type: string;
+
+	parameters: {
+		innerRadius: number;
+		outerRadius: number;
+		thetaSegments: number;
+		phiSegments: number;
+		thetaStart: number;
+		thetaLength: number;
+	};
+
+}

+ 118 - 0
src/geometries/RingBufferGeometry.js

@@ -0,0 +1,118 @@
+import { BufferGeometry } from '../core/BufferGeometry.js';
+import { Float32BufferAttribute } from '../core/BufferAttribute.js';
+import { Vector2 } from '../math/Vector2.js';
+import { Vector3 } from '../math/Vector3.js';
+
+class RingBufferGeometry extends BufferGeometry {
+
+	constructor( innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength ) {
+
+		super();
+
+		this.type = 'RingBufferGeometry';
+
+		this.parameters = {
+			innerRadius: innerRadius,
+			outerRadius: outerRadius,
+			thetaSegments: thetaSegments,
+			phiSegments: phiSegments,
+			thetaStart: thetaStart,
+			thetaLength: thetaLength
+		};
+
+		innerRadius = innerRadius || 0.5;
+		outerRadius = outerRadius || 1;
+
+		thetaStart = thetaStart !== undefined ? thetaStart : 0;
+		thetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2;
+
+		thetaSegments = thetaSegments !== undefined ? Math.max( 3, thetaSegments ) : 8;
+		phiSegments = phiSegments !== undefined ? Math.max( 1, phiSegments ) : 1;
+
+		// buffers
+
+		const indices = [];
+		const vertices = [];
+		const normals = [];
+		const uvs = [];
+
+		// some helper variables
+
+		let radius = innerRadius;
+		const radiusStep = ( ( outerRadius - innerRadius ) / phiSegments );
+		const vertex = new Vector3();
+		const uv = new Vector2();
+
+		// generate vertices, normals and uvs
+
+		for ( let j = 0; j <= phiSegments; j ++ ) {
+
+			for ( let i = 0; i <= thetaSegments; i ++ ) {
+
+				// values are generate from the inside of the ring to the outside
+
+				const segment = thetaStart + i / thetaSegments * thetaLength;
+
+				// vertex
+
+				vertex.x = radius * Math.cos( segment );
+				vertex.y = radius * Math.sin( segment );
+
+				vertices.push( vertex.x, vertex.y, vertex.z );
+
+				// normal
+
+				normals.push( 0, 0, 1 );
+
+				// uv
+
+				uv.x = ( vertex.x / outerRadius + 1 ) / 2;
+				uv.y = ( vertex.y / outerRadius + 1 ) / 2;
+
+				uvs.push( uv.x, uv.y );
+
+			}
+
+			// increase the radius for next row of vertices
+
+			radius += radiusStep;
+
+		}
+
+		// indices
+
+		for ( let j = 0; j < phiSegments; j ++ ) {
+
+			const thetaSegmentLevel = j * ( thetaSegments + 1 );
+
+			for ( let i = 0; i < thetaSegments; i ++ ) {
+
+				const segment = i + thetaSegmentLevel;
+
+				const a = segment;
+				const b = segment + thetaSegments + 1;
+				const c = segment + thetaSegments + 2;
+				const d = segment + 1;
+
+				// faces
+
+				indices.push( a, b, d );
+				indices.push( b, c, d );
+
+			}
+
+		}
+
+		// build geometry
+
+		this.setIndex( indices );
+		this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
+		this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
+		this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
+
+	}
+
+}
+
+
+export { RingBufferGeometry };

+ 0 - 36
src/geometries/RingGeometry.d.ts

@@ -1,40 +1,4 @@
 import { Geometry } from './../core/Geometry';
 import { Geometry } from './../core/Geometry';
-import { BufferGeometry } from './../core/BufferGeometry';
-
-export class RingBufferGeometry extends BufferGeometry {
-
-	/**
-	 * @param [innerRadius=0.5]
-	 * @param [outerRadius=1]
-	 * @param [thetaSegments=8]
-	 * @param [phiSegments=1]
-	 * @param [thetaStart=0]
-	 * @param [thetaLength=Math.PI * 2]
-	 */
-	constructor(
-		innerRadius?: number,
-		outerRadius?: number,
-		thetaSegments?: number,
-		phiSegments?: number,
-		thetaStart?: number,
-		thetaLength?: number
-	);
-
-	/**
-	 * @default 'RingBufferGeometry'
-	 */
-	type: string;
-
-	parameters: {
-		innerRadius: number;
-		outerRadius: number;
-		thetaSegments: number;
-		phiSegments: number;
-		thetaStart: number;
-		thetaLength: number;
-	};
-
-}
 
 
 export class RingGeometry extends Geometry {
 export class RingGeometry extends Geometry {
 
 

+ 2 - 121
src/geometries/RingGeometry.js

@@ -1,10 +1,5 @@
 import { Geometry } from '../core/Geometry.js';
 import { Geometry } from '../core/Geometry.js';
-import { BufferGeometry } from '../core/BufferGeometry.js';
-import { Float32BufferAttribute } from '../core/BufferAttribute.js';
-import { Vector2 } from '../math/Vector2.js';
-import { Vector3 } from '../math/Vector3.js';
-
-// RingGeometry
+import { RingBufferGeometry } from './RingBufferGeometry.js';
 
 
 class RingGeometry extends Geometry {
 class RingGeometry extends Geometry {
 
 
@@ -30,118 +25,4 @@ class RingGeometry extends Geometry {
 
 
 }
 }
 
 
-// RingBufferGeometry
-
-class RingBufferGeometry extends BufferGeometry {
-
-	constructor( innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength ) {
-
-		super();
-
-		this.type = 'RingBufferGeometry';
-
-		this.parameters = {
-			innerRadius: innerRadius,
-			outerRadius: outerRadius,
-			thetaSegments: thetaSegments,
-			phiSegments: phiSegments,
-			thetaStart: thetaStart,
-			thetaLength: thetaLength
-		};
-
-		innerRadius = innerRadius || 0.5;
-		outerRadius = outerRadius || 1;
-
-		thetaStart = thetaStart !== undefined ? thetaStart : 0;
-		thetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2;
-
-		thetaSegments = thetaSegments !== undefined ? Math.max( 3, thetaSegments ) : 8;
-		phiSegments = phiSegments !== undefined ? Math.max( 1, phiSegments ) : 1;
-
-		// buffers
-
-		const indices = [];
-		const vertices = [];
-		const normals = [];
-		const uvs = [];
-
-		// some helper variables
-
-		let radius = innerRadius;
-		const radiusStep = ( ( outerRadius - innerRadius ) / phiSegments );
-		const vertex = new Vector3();
-		const uv = new Vector2();
-
-		// generate vertices, normals and uvs
-
-		for ( let j = 0; j <= phiSegments; j ++ ) {
-
-			for ( let i = 0; i <= thetaSegments; i ++ ) {
-
-				// values are generate from the inside of the ring to the outside
-
-				const segment = thetaStart + i / thetaSegments * thetaLength;
-
-				// vertex
-
-				vertex.x = radius * Math.cos( segment );
-				vertex.y = radius * Math.sin( segment );
-
-				vertices.push( vertex.x, vertex.y, vertex.z );
-
-				// normal
-
-				normals.push( 0, 0, 1 );
-
-				// uv
-
-				uv.x = ( vertex.x / outerRadius + 1 ) / 2;
-				uv.y = ( vertex.y / outerRadius + 1 ) / 2;
-
-				uvs.push( uv.x, uv.y );
-
-			}
-
-			// increase the radius for next row of vertices
-
-			radius += radiusStep;
-
-		}
-
-		// indices
-
-		for ( let j = 0; j < phiSegments; j ++ ) {
-
-			const thetaSegmentLevel = j * ( thetaSegments + 1 );
-
-			for ( let i = 0; i < thetaSegments; i ++ ) {
-
-				const segment = i + thetaSegmentLevel;
-
-				const a = segment;
-				const b = segment + thetaSegments + 1;
-				const c = segment + thetaSegments + 2;
-				const d = segment + 1;
-
-				// faces
-
-				indices.push( a, b, d );
-				indices.push( b, c, d );
-
-			}
-
-		}
-
-		// build geometry
-
-		this.setIndex( indices );
-		this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
-		this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
-		this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
-
-	}
-
-}
-
-
-export { RingGeometry, RingBufferGeometry };
+export { RingGeometry };

+ 13 - 0
src/geometries/ShapeBufferGeometry.d.ts

@@ -0,0 +1,13 @@
+import { Shape } from './../extras/core/Shape';
+import { BufferGeometry } from './../core/BufferGeometry';
+
+export class ShapeBufferGeometry extends BufferGeometry {
+
+	/**
+	 * @default 'ShapeBufferGeometry'
+	 */
+	type: string;
+
+	constructor( shapes: Shape | Shape[], curveSegments?: number );
+
+}

+ 168 - 0
src/geometries/ShapeBufferGeometry.js

@@ -0,0 +1,168 @@
+import { BufferGeometry } from '../core/BufferGeometry.js';
+import { Float32BufferAttribute } from '../core/BufferAttribute.js';
+import { ShapeUtils } from '../extras/ShapeUtils.js';
+
+class ShapeBufferGeometry extends BufferGeometry {
+
+	constructor( shapes, curveSegments ) {
+
+		super();
+		this.type = 'ShapeBufferGeometry';
+
+		this.parameters = {
+			shapes: shapes,
+			curveSegments: curveSegments
+		};
+
+		curveSegments = curveSegments || 12;
+
+		// buffers
+
+		const indices = [];
+		const vertices = [];
+		const normals = [];
+		const uvs = [];
+
+		// helper variables
+
+		let groupStart = 0;
+		let groupCount = 0;
+
+		// allow single and array values for "shapes" parameter
+
+		if ( Array.isArray( shapes ) === false ) {
+
+			addShape( shapes );
+
+		} else {
+
+			for ( let i = 0; i < shapes.length; i ++ ) {
+
+				addShape( shapes[ i ] );
+
+				this.addGroup( groupStart, groupCount, i ); // enables MultiMaterial support
+
+				groupStart += groupCount;
+				groupCount = 0;
+
+			}
+
+		}
+
+		// build geometry
+
+		this.setIndex( indices );
+		this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
+		this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
+		this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
+
+
+		// helper functions
+
+		function addShape( shape ) {
+
+			const indexOffset = vertices.length / 3;
+			const points = shape.extractPoints( curveSegments );
+
+			let shapeVertices = points.shape;
+			const shapeHoles = points.holes;
+
+			// check direction of vertices
+
+			if ( ShapeUtils.isClockWise( shapeVertices ) === false ) {
+
+				shapeVertices = shapeVertices.reverse();
+
+			}
+
+			for ( let i = 0, l = shapeHoles.length; i < l; i ++ ) {
+
+				const shapeHole = shapeHoles[ i ];
+
+				if ( ShapeUtils.isClockWise( shapeHole ) === true ) {
+
+					shapeHoles[ i ] = shapeHole.reverse();
+
+				}
+
+			}
+
+			const faces = ShapeUtils.triangulateShape( shapeVertices, shapeHoles );
+
+			// join vertices of inner and outer paths to a single array
+
+			for ( let i = 0, l = shapeHoles.length; i < l; i ++ ) {
+
+				const shapeHole = shapeHoles[ i ];
+				shapeVertices = shapeVertices.concat( shapeHole );
+
+			}
+
+			// vertices, normals, uvs
+
+			for ( let i = 0, l = shapeVertices.length; i < l; i ++ ) {
+
+				const vertex = shapeVertices[ i ];
+
+				vertices.push( vertex.x, vertex.y, 0 );
+				normals.push( 0, 0, 1 );
+				uvs.push( vertex.x, vertex.y ); // world uvs
+
+			}
+
+			// incides
+
+			for ( let i = 0, l = faces.length; i < l; i ++ ) {
+
+				const face = faces[ i ];
+
+				const a = face[ 0 ] + indexOffset;
+				const b = face[ 1 ] + indexOffset;
+				const c = face[ 2 ] + indexOffset;
+
+				indices.push( a, b, c );
+				groupCount += 3;
+
+			}
+
+		}
+
+	}
+
+	toJSON() {
+
+		const data = BufferGeometry.prototype.toJSON.call( this );
+
+		const shapes = this.parameters.shapes;
+
+		return toJSON( shapes, data );
+
+	}
+
+}
+
+function toJSON( shapes, data ) {
+
+	data.shapes = [];
+
+	if ( Array.isArray( shapes ) ) {
+
+		for ( let i = 0, l = shapes.length; i < l; i ++ ) {
+
+			const shape = shapes[ i ];
+
+			data.shapes.push( shape.uuid );
+
+		}
+
+	} else {
+
+		data.shapes.push( shapes.uuid );
+
+	}
+
+	return data;
+
+}
+
+export { ShapeBufferGeometry };

+ 0 - 12
src/geometries/ShapeGeometry.d.ts

@@ -1,17 +1,5 @@
 import { Shape } from './../extras/core/Shape';
 import { Shape } from './../extras/core/Shape';
 import { Geometry } from './../core/Geometry';
 import { Geometry } from './../core/Geometry';
-import { BufferGeometry } from './../core/BufferGeometry';
-
-export class ShapeBufferGeometry extends BufferGeometry {
-
-	/**
-	 * @default 'ShapeBufferGeometry'
-	 */
-	type: string;
-
-	constructor( shapes: Shape | Shape[], curveSegments?: number );
-
-}
 
 
 export class ShapeGeometry extends Geometry {
 export class ShapeGeometry extends Geometry {
 
 

+ 2 - 150
src/geometries/ShapeGeometry.js

@@ -1,9 +1,5 @@
 import { Geometry } from '../core/Geometry.js';
 import { Geometry } from '../core/Geometry.js';
-import { BufferGeometry } from '../core/BufferGeometry.js';
-import { Float32BufferAttribute } from '../core/BufferAttribute.js';
-import { ShapeUtils } from '../extras/ShapeUtils.js';
-
-// ShapeGeometry
+import { ShapeBufferGeometry } from './ShapeBufferGeometry.js';
 
 
 class ShapeGeometry extends Geometry {
 class ShapeGeometry extends Geometry {
 
 
@@ -42,149 +38,6 @@ class ShapeGeometry extends Geometry {
 
 
 }
 }
 
 
-// ShapeBufferGeometry
-
-class ShapeBufferGeometry extends BufferGeometry {
-
-	constructor( shapes, curveSegments ) {
-
-		super();
-		this.type = 'ShapeBufferGeometry';
-
-		this.parameters = {
-			shapes: shapes,
-			curveSegments: curveSegments
-		};
-
-		curveSegments = curveSegments || 12;
-
-		// buffers
-
-		const indices = [];
-		const vertices = [];
-		const normals = [];
-		const uvs = [];
-
-		// helper variables
-
-		let groupStart = 0;
-		let groupCount = 0;
-
-		// allow single and array values for "shapes" parameter
-
-		if ( Array.isArray( shapes ) === false ) {
-
-			addShape( shapes );
-
-		} else {
-
-			for ( let i = 0; i < shapes.length; i ++ ) {
-
-				addShape( shapes[ i ] );
-
-				this.addGroup( groupStart, groupCount, i ); // enables MultiMaterial support
-
-				groupStart += groupCount;
-				groupCount = 0;
-
-			}
-
-		}
-
-		// build geometry
-
-		this.setIndex( indices );
-		this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
-		this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
-		this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
-
-
-		// helper functions
-
-		function addShape( shape ) {
-
-			const indexOffset = vertices.length / 3;
-			const points = shape.extractPoints( curveSegments );
-
-			let shapeVertices = points.shape;
-			const shapeHoles = points.holes;
-
-			// check direction of vertices
-
-			if ( ShapeUtils.isClockWise( shapeVertices ) === false ) {
-
-				shapeVertices = shapeVertices.reverse();
-
-			}
-
-			for ( let i = 0, l = shapeHoles.length; i < l; i ++ ) {
-
-				const shapeHole = shapeHoles[ i ];
-
-				if ( ShapeUtils.isClockWise( shapeHole ) === true ) {
-
-					shapeHoles[ i ] = shapeHole.reverse();
-
-				}
-
-			}
-
-			const faces = ShapeUtils.triangulateShape( shapeVertices, shapeHoles );
-
-			// join vertices of inner and outer paths to a single array
-
-			for ( let i = 0, l = shapeHoles.length; i < l; i ++ ) {
-
-				const shapeHole = shapeHoles[ i ];
-				shapeVertices = shapeVertices.concat( shapeHole );
-
-			}
-
-			// vertices, normals, uvs
-
-			for ( let i = 0, l = shapeVertices.length; i < l; i ++ ) {
-
-				const vertex = shapeVertices[ i ];
-
-				vertices.push( vertex.x, vertex.y, 0 );
-				normals.push( 0, 0, 1 );
-				uvs.push( vertex.x, vertex.y ); // world uvs
-
-			}
-
-			// incides
-
-			for ( let i = 0, l = faces.length; i < l; i ++ ) {
-
-				const face = faces[ i ];
-
-				const a = face[ 0 ] + indexOffset;
-				const b = face[ 1 ] + indexOffset;
-				const c = face[ 2 ] + indexOffset;
-
-				indices.push( a, b, c );
-				groupCount += 3;
-
-			}
-
-		}
-
-	}
-
-	toJSON() {
-
-		const data = BufferGeometry.prototype.toJSON.call( this );
-
-		const shapes = this.parameters.shapes;
-
-		return toJSON( shapes, data );
-
-	}
-
-}
-
-//
-
 function toJSON( shapes, data ) {
 function toJSON( shapes, data ) {
 
 
 	data.shapes = [];
 	data.shapes = [];
@@ -209,5 +62,4 @@ function toJSON( shapes, data ) {
 
 
 }
 }
 
 
-
-export { ShapeGeometry, ShapeBufferGeometry };
+export { ShapeGeometry };

+ 39 - 0
src/geometries/SphereBufferGeometry.d.ts

@@ -0,0 +1,39 @@
+import { BufferGeometry } from './../core/BufferGeometry';
+
+export class SphereBufferGeometry extends BufferGeometry {
+
+	/**
+	 * @param [radius=50] — sphere radius. Default is 50.
+	 * @param [widthSegments=8] — number of horizontal segments. Minimum value is 3, and the default is 8.
+	 * @param [heightSegments=6] — number of vertical segments. Minimum value is 2, and the default is 6.
+	 * @param [phiStart=0] — specify horizontal starting angle. Default is 0.
+	 * @param [phiLength=Math.PI * 2] — specify horizontal sweep angle size. Default is Math.PI * 2.
+	 * @param [thetaStart=0] — specify vertical starting angle. Default is 0.
+	 * @param [thetaLength=Math.PI * 2] — specify vertical sweep angle size. Default is Math.PI.
+	 */
+	constructor(
+		radius?: number,
+		widthSegments?: number,
+		heightSegments?: number,
+		phiStart?: number,
+		phiLength?: number,
+		thetaStart?: number,
+		thetaLength?: number
+	);
+
+	/**
+	 * @default 'SphereBufferGeometry'
+	 */
+	type: string;
+
+	parameters: {
+		radius: number;
+		widthSegments: number;
+		heightSegments: number;
+		phiStart: number;
+		phiLength: number;
+		thetaStart: number;
+		thetaLength: number;
+	};
+
+}

Some files were not shown because too many files changed in this diff