@xort/cga 0.0.76 → 0.0.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/dist/app.js +4 -1
  2. package/dist/math/Color.d.ts +7 -9
  3. package/dist/math/Color.js +54 -56
  4. package/package.json +2 -1
  5. package/src/app.ts +4 -1
  6. package/src/index.ts +1 -0
  7. package/src/math/Color.ts +60 -36
  8. package/dist/src/IKanimation/Bone.d.ts +0 -9
  9. package/dist/src/IKanimation/Bone.js +0 -40
  10. package/dist/src/IKanimation/CCDSolver.d.ts +0 -37
  11. package/dist/src/IKanimation/CCDSolver.js +0 -93
  12. package/dist/src/IKanimation/Joint.d.ts +0 -3
  13. package/dist/src/IKanimation/Joint.js +0 -17
  14. package/dist/src/IKanimation/constaint/constraint.d.ts +0 -10
  15. package/dist/src/IKanimation/constaint/constraint.js +0 -25
  16. package/dist/src/IKanimation/constaint/hinge.d.ts +0 -12
  17. package/dist/src/IKanimation/constaint/hinge.js +0 -46
  18. package/dist/src/IKanimation/constaint/slider.d.ts +0 -12
  19. package/dist/src/IKanimation/constaint/slider.js +0 -44
  20. package/dist/src/IKanimation/index.d.ts +0 -0
  21. package/dist/src/IKanimation/index.js +0 -9
  22. package/dist/src/IKanimation/isolver.d.ts +0 -4
  23. package/dist/src/IKanimation/isolver.js +0 -10
  24. package/dist/src/IKanimation/skeleton.d.ts +0 -13
  25. package/dist/src/IKanimation/skeleton.js +0 -31
  26. package/dist/src/alg/common.d.ts +0 -114
  27. package/dist/src/alg/common.js +0 -302
  28. package/dist/src/alg/curve.d.ts +0 -4
  29. package/dist/src/alg/curve.js +0 -11
  30. package/dist/src/alg/delaunator.d.ts +0 -29
  31. package/dist/src/alg/delaunator.js +0 -442
  32. package/dist/src/alg/delaunay.d.ts +0 -20
  33. package/dist/src/alg/delaunay.js +0 -199
  34. package/dist/src/alg/delaunayslow.d.ts +0 -18
  35. package/dist/src/alg/delaunayslow.js +0 -140
  36. package/dist/src/alg/extrude/extrude.d.ts +0 -3
  37. package/dist/src/alg/extrude/extrude.js +0 -17
  38. package/dist/src/alg/extrude.d.ts +0 -199
  39. package/dist/src/alg/extrude.js +0 -731
  40. package/dist/src/alg/offset/index.d.ts +0 -0
  41. package/dist/src/alg/offset/index.js +0 -9
  42. package/dist/src/alg/offset.d.ts +0 -0
  43. package/dist/src/alg/offset.js +0 -472
  44. package/dist/src/alg/pointset.d.ts +0 -94
  45. package/dist/src/alg/pointset.js +0 -223
  46. package/dist/src/alg/recognition.d.ts +0 -14
  47. package/dist/src/alg/recognition.js +0 -37
  48. package/dist/src/alg/result.d.ts +0 -22
  49. package/dist/src/alg/result.js +0 -2
  50. package/dist/src/alg/segmentset.d.ts +0 -11
  51. package/dist/src/alg/segmentset.js +0 -45
  52. package/dist/src/alg/sort.d.ts +0 -2
  53. package/dist/src/alg/sort.js +0 -14
  54. package/dist/src/alg/split.d.ts +0 -8
  55. package/dist/src/alg/split.js +0 -10
  56. package/dist/src/alg/trianglution.d.ts +0 -20
  57. package/dist/src/alg/trianglution.js +0 -77
  58. package/dist/src/alg/vol.d.ts +0 -6
  59. package/dist/src/alg/vol.js +0 -18
  60. package/dist/src/alg/voronoi.d.ts +0 -31
  61. package/dist/src/alg/voronoi.js +0 -418
  62. package/dist/src/app.d.ts +0 -1
  63. package/dist/src/app.js +0 -245
  64. package/dist/src/basic/distance.d.ts +0 -12
  65. package/dist/src/basic/distance.js +0 -42
  66. package/dist/src/csg/bsp.d.ts +0 -9
  67. package/dist/src/csg/bsp.js +0 -22
  68. package/dist/src/csg/node.d.ts +0 -12
  69. package/dist/src/csg/node.js +0 -75
  70. package/dist/src/csg/polygon.d.ts +0 -43
  71. package/dist/src/csg/polygon.js +0 -161
  72. package/dist/src/diamondMaterialShader.d.ts +0 -92
  73. package/dist/src/diamondMaterialShader.js +0 -118
  74. package/dist/src/effect/breath-light.d.ts +0 -4
  75. package/dist/src/effect/breath-light.js +0 -39
  76. package/dist/src/extends/geometryaid.d.ts +0 -28
  77. package/dist/src/extends/geometryaid.js +0 -80
  78. package/dist/src/extends/split.d.ts +0 -3
  79. package/dist/src/extends/split.js +0 -13
  80. package/dist/src/glview.d.ts +0 -112
  81. package/dist/src/glview.js +0 -564
  82. package/dist/src/index.d.ts +0 -36
  83. package/dist/src/index.js +0 -54
  84. package/dist/src/math/Euler.d.ts +0 -47
  85. package/dist/src/math/Euler.js +0 -245
  86. package/dist/src/math/HVec3.d.ts +0 -44
  87. package/dist/src/math/HVec3.js +0 -195
  88. package/dist/src/math/Mat3.d.ts +0 -29
  89. package/dist/src/math/Mat3.js +0 -244
  90. package/dist/src/math/Mat4.d.ts +0 -85
  91. package/dist/src/math/Mat4.js +0 -791
  92. package/dist/src/math/Math.d.ts +0 -130
  93. package/dist/src/math/Math.js +0 -198
  94. package/dist/src/math/Quat.d.ts +0 -83
  95. package/dist/src/math/Quat.js +0 -440
  96. package/dist/src/math/Vec.d.ts +0 -7
  97. package/dist/src/math/Vec.js +0 -43
  98. package/dist/src/math/Vec2.d.ts +0 -68
  99. package/dist/src/math/Vec2.js +0 -347
  100. package/dist/src/math/Vec3.d.ts +0 -232
  101. package/dist/src/math/Vec3.js +0 -1089
  102. package/dist/src/math/Vec4.d.ts +0 -81
  103. package/dist/src/math/Vec4.js +0 -494
  104. package/dist/src/math/vector.d.ts +0 -114
  105. package/dist/src/math/vector.js +0 -373
  106. package/dist/src/render/buffer-attribute.d.ts +0 -100
  107. package/dist/src/render/buffer-attribute.js +0 -340
  108. package/dist/src/render/eventhandler.d.ts +0 -78
  109. package/dist/src/render/eventhandler.js +0 -189
  110. package/dist/src/render/geometry.d.ts +0 -89
  111. package/dist/src/render/geometry.js +0 -775
  112. package/dist/src/render/mesh.d.ts +0 -25
  113. package/dist/src/render/mesh.js +0 -82
  114. package/dist/src/render/thing.d.ts +0 -34
  115. package/dist/src/render/thing.js +0 -196
  116. package/dist/src/render/types.d.ts +0 -2
  117. package/dist/src/render/types.js +0 -8
  118. package/dist/src/robust/plane.d.ts +0 -7
  119. package/dist/src/robust/plane.js +0 -17
  120. package/dist/src/robust/vec.d.ts +0 -15
  121. package/dist/src/robust/vec.js +0 -71
  122. package/dist/src/shape/arc.d.ts +0 -2
  123. package/dist/src/shape/arc.js +0 -14
  124. package/dist/src/struct/3d/Box.d.ts +0 -23
  125. package/dist/src/struct/3d/Box.js +0 -109
  126. package/dist/src/struct/3d/Capsule.d.ts +0 -12
  127. package/dist/src/struct/3d/Capsule.js +0 -36
  128. package/dist/src/struct/3d/Circle.d.ts +0 -34
  129. package/dist/src/struct/3d/Circle.js +0 -80
  130. package/dist/src/struct/3d/Disk.d.ts +0 -10
  131. package/dist/src/struct/3d/Disk.js +0 -22
  132. package/dist/src/struct/3d/Frustum.d.ts +0 -35
  133. package/dist/src/struct/3d/Frustum.js +0 -159
  134. package/dist/src/struct/3d/Line.d.ts +0 -40
  135. package/dist/src/struct/3d/Line.js +0 -339
  136. package/dist/src/struct/3d/Path.d.ts +0 -75
  137. package/dist/src/struct/3d/Path.js +0 -308
  138. package/dist/src/struct/3d/Plane.d.ts +0 -74
  139. package/dist/src/struct/3d/Plane.js +0 -295
  140. package/dist/src/struct/3d/Point.d.ts +0 -4
  141. package/dist/src/struct/3d/Point.js +0 -30
  142. package/dist/src/struct/3d/Polygon.d.ts +0 -8
  143. package/dist/src/struct/3d/Polygon.js +0 -55
  144. package/dist/src/struct/3d/Polyline.d.ts +0 -25
  145. package/dist/src/struct/3d/Polyline.js +0 -109
  146. package/dist/src/struct/3d/Ray.d.ts +0 -21
  147. package/dist/src/struct/3d/Ray.js +0 -262
  148. package/dist/src/struct/3d/Rectangle.d.ts +0 -7
  149. package/dist/src/struct/3d/Rectangle.js +0 -35
  150. package/dist/src/struct/3d/Segment.d.ts +0 -32
  151. package/dist/src/struct/3d/Segment.js +0 -334
  152. package/dist/src/struct/3d/Shape.d.ts +0 -4
  153. package/dist/src/struct/3d/Shape.js +0 -27
  154. package/dist/src/struct/3d/Sphere.d.ts +0 -11
  155. package/dist/src/struct/3d/Sphere.js +0 -30
  156. package/dist/src/struct/3d/Triangle.d.ts +0 -8
  157. package/dist/src/struct/3d/Triangle.js +0 -53
  158. package/dist/src/struct/data/ArrayList.d.ts +0 -42
  159. package/dist/src/struct/data/ArrayList.js +0 -172
  160. package/dist/src/struct/data/ArrayObject.d.ts +0 -30
  161. package/dist/src/struct/data/ArrayObject.js +0 -131
  162. package/dist/src/struct/data/type.d.ts +0 -13
  163. package/dist/src/struct/data/type.js +0 -18
  164. package/dist/src/utils/array.d.ts +0 -24
  165. package/dist/src/utils/array.js +0 -89
  166. package/dist/src/utils/types.d.ts +0 -24
  167. package/dist/src/utils/types.js +0 -20
  168. package/dist/src-gis/app.d.ts +0 -1
  169. package/dist/src-gis/app.js +0 -4
  170. package/dist/src-gis/core/Cartographic.d.ts +0 -20
  171. package/dist/src-gis/core/Cartographic.js +0 -52
  172. package/dist/src-gis/core/EllipsoidGeodesic.d.ts +0 -14
  173. package/dist/src-gis/core/EllipsoidGeodesic.js +0 -51
  174. package/dist/src-gis/core/EllipsoidTerrainProvider.d.ts +0 -10
  175. package/dist/src-gis/core/EllipsoidTerrainProvider.js +0 -29
  176. package/dist/src-gis/core/HeightmapTerrainData.d.ts +0 -3
  177. package/dist/src-gis/core/HeightmapTerrainData.js +0 -9
  178. package/dist/src-gis/core/Rectangle.d.ts +0 -45
  179. package/dist/src-gis/core/Rectangle.js +0 -127
  180. package/dist/src-gis/core/TaskProcessor.d.ts +0 -35
  181. package/dist/src-gis/core/TaskProcessor.js +0 -183
  182. package/dist/src-gis/gis.d.ts +0 -5
  183. package/dist/src-gis/gis.js +0 -12
  184. package/dist/src-gis/globe.d.ts +0 -12
  185. package/dist/src-gis/globe.js +0 -61
  186. package/dist/src-gis/math/Cartographic.d.ts +0 -8
  187. package/dist/src-gis/math/Cartographic.js +0 -26
  188. package/dist/src-gis/math/GVec3.d.ts +0 -12
  189. package/dist/src-gis/math/GVec3.js +0 -69
  190. package/dist/src-gis/math/ellipsoid.d.ts +0 -8
  191. package/dist/src-gis/math/ellipsoid.js +0 -14
  192. package/dist/src-gis/provider/DcTerrainProvider.d.ts +0 -15
  193. package/dist/src-gis/provider/DcTerrainProvider.js +0 -19
  194. package/dist/src-gis/provider/TerrainProvider.d.ts +0 -3
  195. package/dist/src-gis/provider/TerrainProvider.js +0 -17
  196. package/dist/src-gis/scene/DcImageryProvider.d.ts +0 -6
  197. package/dist/src-gis/scene/DcImageryProvider.js +0 -35
  198. package/dist/src-gis/scene/GeographicTilingScheme.d.ts +0 -21
  199. package/dist/src-gis/scene/GeographicTilingScheme.js +0 -46
  200. package/dist/src-gis/scene/Globe.d.ts +0 -34
  201. package/dist/src-gis/scene/Globe.js +0 -62
  202. package/dist/src-gis/scene/GlobeSurfaceShaderSet.d.ts +0 -6
  203. package/dist/src-gis/scene/GlobeSurfaceShaderSet.js +0 -11
  204. package/dist/src-gis/scene/GlobeSurfaceTileProvider.d.ts +0 -21
  205. package/dist/src-gis/scene/GlobeSurfaceTileProvider.js +0 -15
  206. package/dist/src-gis/scene/ImageryLayerCollection.d.ts +0 -21
  207. package/dist/src-gis/scene/ImageryLayerCollection.js +0 -87
  208. package/dist/src-gis/scene/ImageryProvider.d.ts +0 -4
  209. package/dist/src-gis/scene/ImageryProvider.js +0 -28
  210. package/dist/src-gis/scene/QuadtreeTile.d.ts +0 -48
  211. package/dist/src-gis/scene/QuadtreeTile.js +0 -137
  212. package/dist/src-gis/scene/UrlTemplateImageryProvider.d.ts +0 -9
  213. package/dist/src-gis/scene/UrlTemplateImageryProvider.js +0 -29
  214. package/dist/src-gis/scene/quadtree_primitive.d.ts +0 -14
  215. package/dist/src-gis/scene/quadtree_primitive.js +0 -50
@@ -1,340 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.Float64BufferAttribute = exports.Float32BufferAttribute = exports.Uint32BufferAttribute = exports.Int32BufferAttribute = exports.Uint16BufferAttribute = exports.Int16BufferAttribute = exports.Uint8ClampedBufferAttribute = exports.Uint8BufferAttribute = exports.Int8BufferAttribute = exports.BufferAttribute = void 0;
19
- var Vec2_1 = require("../math/Vec2");
20
- var Vec3_1 = require("../math/Vec3");
21
- var Vec4_1 = require("../math/Vec4");
22
- var _vector = new Vec3_1.Vec3();
23
- var BufferAttribute = /** @class */ (function () {
24
- /**
25
- *
26
- * @param array {BufferArray} Buffer数据
27
- * @param itemSize 单元长度,vec3是3,vec4是4
28
- * @param normalized
29
- */
30
- function BufferAttribute(array, itemSize, normalized) {
31
- this.isBufferAttribute = true;
32
- this.name = '';
33
- this.array = array;
34
- this.itemSize = itemSize;
35
- this.count = array !== undefined ? array.length / itemSize : 0;
36
- this.normalized = normalized === true;
37
- // this.usage = StaticDrawUsage;
38
- this.updateRange = { offset: 0, count: -1 };
39
- this.version = 0;
40
- }
41
- Object.defineProperty(BufferAttribute.prototype, "needsUpdate", {
42
- set: function (value) {
43
- if (value === true)
44
- this.version++;
45
- },
46
- enumerable: false,
47
- configurable: true
48
- });
49
- BufferAttribute.prototype.onUpload = function (callback) {
50
- this.onUploadCallback = callback;
51
- return this;
52
- };
53
- BufferAttribute.prototype.setUsage = function (usage) {
54
- return this;
55
- };
56
- BufferAttribute.prototype.copy = function (source) {
57
- this.name = source.name;
58
- this.array = new source.array.constructor(source.array);
59
- this.itemSize = source.itemSize;
60
- this.count = source.count;
61
- this.normalized = source.normalized;
62
- // this.usage = source.usage;
63
- return this;
64
- };
65
- BufferAttribute.prototype.copyAt = function (index1, attribute, index2) {
66
- index1 *= this.itemSize;
67
- index2 *= attribute.itemSize;
68
- for (var i = 0, l = this.itemSize; i < l; i++) {
69
- this.array[index1 + i] = attribute.array[index2 + i];
70
- }
71
- return this;
72
- };
73
- BufferAttribute.prototype.copyArray = function (array) {
74
- this.array.set(array);
75
- return this;
76
- };
77
- BufferAttribute.prototype.copyColorsArray = function (colors) {
78
- var array = this.array, offset = 0;
79
- for (var i = 0, l = colors.length; i < l; i++) {
80
- var color = colors[i];
81
- // if (color === undefined) {
82
- // console.warn('THREE.BufferAttribute.copyColorsArray(): color is undefined', i);
83
- // color = new Color();
84
- // }
85
- // array[offset++] = color.r;
86
- // array[offset++] = color.g;
87
- // array[offset++] = color.b;
88
- }
89
- return this;
90
- };
91
- BufferAttribute.prototype.copyVec2sArray = function (vectors) {
92
- var array = this.array, offset = 0;
93
- for (var i = 0, l = vectors.length; i < l; i++) {
94
- var vector = vectors[i];
95
- if (vector === undefined) {
96
- console.warn('THREE.BufferAttribute.copyVec2sArray(): vector is undefined', i);
97
- vector = new Vec2_1.Vec2();
98
- }
99
- array[offset++] = vector.x;
100
- array[offset++] = vector.y;
101
- }
102
- return this;
103
- };
104
- BufferAttribute.prototype.copyVec3sArray = function (vectors) {
105
- var array = this.array, offset = 0;
106
- for (var i = 0, l = vectors.length; i < l; i++) {
107
- var vector = vectors[i];
108
- if (vector === undefined) {
109
- console.warn('THREE.BufferAttribute.copyVec3sArray(): vector is undefined', i);
110
- vector = new Vec3_1.Vec3();
111
- }
112
- array[offset++] = vector.x;
113
- array[offset++] = vector.y;
114
- array[offset++] = vector.z;
115
- }
116
- return this;
117
- };
118
- BufferAttribute.prototype.copyVec4sArray = function (vectors) {
119
- var array = this.array, offset = 0;
120
- for (var i = 0, l = vectors.length; i < l; i++) {
121
- var vector = vectors[i];
122
- if (vector === undefined) {
123
- console.warn('THREE.BufferAttribute.copyVec4sArray(): vector is undefined', i);
124
- vector = new Vec4_1.Vec4();
125
- }
126
- array[offset++] = vector.x;
127
- array[offset++] = vector.y;
128
- array[offset++] = vector.z;
129
- array[offset++] = vector.w;
130
- }
131
- return this;
132
- };
133
- BufferAttribute.prototype.applyMat3 = function (m) {
134
- for (var i = 0, l = this.count; i < l; i++) {
135
- _vector.x = this.getX(i);
136
- _vector.y = this.getY(i);
137
- _vector.z = this.getZ(i);
138
- _vector.applyMat3(m);
139
- this.setXYZ(i, _vector.x, _vector.y, _vector.z);
140
- }
141
- return this;
142
- };
143
- BufferAttribute.prototype.applyMat4 = function (m) {
144
- for (var i = 0, l = this.count; i < l; i++) {
145
- _vector.x = this.getX(i);
146
- _vector.y = this.getY(i);
147
- _vector.z = this.getZ(i);
148
- _vector.applyMat4(m);
149
- this.setXYZ(i, _vector.x, _vector.y, _vector.z);
150
- }
151
- return this;
152
- };
153
- BufferAttribute.prototype.applyNormalMat = function (m) {
154
- for (var i = 0, l = this.count; i < l; i++) {
155
- _vector.x = this.getX(i);
156
- _vector.y = this.getY(i);
157
- _vector.z = this.getZ(i);
158
- _vector.applyNormalMat(m);
159
- this.setXYZ(i, _vector.x, _vector.y, _vector.z);
160
- }
161
- return this;
162
- };
163
- BufferAttribute.prototype.transformDirection = function (m) {
164
- for (var i = 0, l = this.count; i < l; i++) {
165
- _vector.x = this.getX(i);
166
- _vector.y = this.getY(i);
167
- _vector.z = this.getZ(i);
168
- _vector.transformDirection(m);
169
- this.setXYZ(i, _vector.x, _vector.y, _vector.z);
170
- }
171
- return this;
172
- };
173
- BufferAttribute.prototype.set = function (value, offset) {
174
- if (offset === undefined)
175
- offset = 0;
176
- this.array.set(value, offset);
177
- return this;
178
- };
179
- BufferAttribute.prototype.getX = function (index) {
180
- return this.array[index * this.itemSize];
181
- };
182
- BufferAttribute.prototype.setX = function (index, x) {
183
- this.array[index * this.itemSize] = x;
184
- return this;
185
- };
186
- BufferAttribute.prototype.getY = function (index) {
187
- return this.array[index * this.itemSize + 1];
188
- };
189
- BufferAttribute.prototype.setY = function (index, y) {
190
- this.array[index * this.itemSize + 1] = y;
191
- return this;
192
- };
193
- BufferAttribute.prototype.getZ = function (index) {
194
- return this.array[index * this.itemSize + 2];
195
- };
196
- BufferAttribute.prototype.setZ = function (index, z) {
197
- this.array[index * this.itemSize + 2] = z;
198
- return this;
199
- };
200
- BufferAttribute.prototype.getW = function (index) {
201
- return this.array[index * this.itemSize + 3];
202
- };
203
- BufferAttribute.prototype.setW = function (index, w) {
204
- this.array[index * this.itemSize + 3] = w;
205
- return this;
206
- };
207
- BufferAttribute.prototype.setXY = function (index, x, y) {
208
- index *= this.itemSize;
209
- this.array[index + 0] = x;
210
- this.array[index + 1] = y;
211
- return this;
212
- };
213
- BufferAttribute.prototype.setXYZ = function (index, x, y, z) {
214
- index *= this.itemSize;
215
- this.array[index + 0] = x;
216
- this.array[index + 1] = y;
217
- this.array[index + 2] = z;
218
- return this;
219
- };
220
- BufferAttribute.prototype.setXYZW = function (index, x, y, z, w) {
221
- index *= this.itemSize;
222
- this.array[index + 0] = x;
223
- this.array[index + 1] = y;
224
- this.array[index + 2] = z;
225
- this.array[index + 3] = w;
226
- return this;
227
- };
228
- BufferAttribute.prototype.clone = function () {
229
- return new BufferAttribute(this.array, this.itemSize).copy(this);
230
- };
231
- BufferAttribute.prototype.toJSON = function () {
232
- return {
233
- itemSize: this.itemSize,
234
- type: this.array.constructor.name,
235
- array: Array.prototype.slice.call(this.array),
236
- normalized: this.normalized
237
- };
238
- };
239
- return BufferAttribute;
240
- }());
241
- exports.BufferAttribute = BufferAttribute;
242
- var Int8BufferAttribute = /** @class */ (function (_super) {
243
- __extends(Int8BufferAttribute, _super);
244
- function Int8BufferAttribute(array, itemSize, normalized) {
245
- if (normalized === void 0) { normalized = false; }
246
- if (Array.isArray(array))
247
- array = new Int8Array(array);
248
- return _super.call(this, new Int8Array(array), itemSize, normalized) || this;
249
- }
250
- return Int8BufferAttribute;
251
- }(BufferAttribute));
252
- exports.Int8BufferAttribute = Int8BufferAttribute;
253
- var Uint8BufferAttribute = /** @class */ (function (_super) {
254
- __extends(Uint8BufferAttribute, _super);
255
- function Uint8BufferAttribute(array, itemSize, normalized) {
256
- if (normalized === void 0) { normalized = false; }
257
- if (Array.isArray(array))
258
- array = new Uint8Array(array);
259
- return _super.call(this, array, itemSize, normalized) || this;
260
- }
261
- return Uint8BufferAttribute;
262
- }(BufferAttribute));
263
- exports.Uint8BufferAttribute = Uint8BufferAttribute;
264
- var Uint8ClampedBufferAttribute = /** @class */ (function (_super) {
265
- __extends(Uint8ClampedBufferAttribute, _super);
266
- function Uint8ClampedBufferAttribute(array, itemSize, normalized) {
267
- if (normalized === void 0) { normalized = false; }
268
- if (Array.isArray(array))
269
- array = new Uint8ClampedArray(array);
270
- return _super.call(this, array, itemSize, normalized) || this;
271
- }
272
- return Uint8ClampedBufferAttribute;
273
- }(BufferAttribute));
274
- exports.Uint8ClampedBufferAttribute = Uint8ClampedBufferAttribute;
275
- var Int16BufferAttribute = /** @class */ (function (_super) {
276
- __extends(Int16BufferAttribute, _super);
277
- function Int16BufferAttribute(array, itemSize, normalized) {
278
- if (normalized === void 0) { normalized = false; }
279
- if (Array.isArray(array))
280
- array = new Int16Array(array);
281
- return _super.call(this, array, itemSize, normalized) || this;
282
- }
283
- return Int16BufferAttribute;
284
- }(BufferAttribute));
285
- exports.Int16BufferAttribute = Int16BufferAttribute;
286
- var Uint16BufferAttribute = /** @class */ (function (_super) {
287
- __extends(Uint16BufferAttribute, _super);
288
- function Uint16BufferAttribute(array, itemSize, normalized) {
289
- if (normalized === void 0) { normalized = false; }
290
- if (Array.isArray(array))
291
- array = new Uint16Array(array);
292
- return _super.call(this, array, itemSize) || this;
293
- }
294
- return Uint16BufferAttribute;
295
- }(BufferAttribute));
296
- exports.Uint16BufferAttribute = Uint16BufferAttribute;
297
- var Int32BufferAttribute = /** @class */ (function (_super) {
298
- __extends(Int32BufferAttribute, _super);
299
- function Int32BufferAttribute(array, itemSize, normalized) {
300
- if (normalized === void 0) { normalized = false; }
301
- if (Array.isArray(array))
302
- array = new Int32Array(array);
303
- return _super.call(this, array, itemSize, normalized) || this;
304
- }
305
- return Int32BufferAttribute;
306
- }(BufferAttribute));
307
- exports.Int32BufferAttribute = Int32BufferAttribute;
308
- var Uint32BufferAttribute = /** @class */ (function (_super) {
309
- __extends(Uint32BufferAttribute, _super);
310
- function Uint32BufferAttribute(array, itemSize, normalized) {
311
- if (normalized === void 0) { normalized = false; }
312
- if (Array.isArray(array))
313
- array = new Uint32Array(array);
314
- return _super.call(this, array, itemSize, normalized) || this;
315
- }
316
- return Uint32BufferAttribute;
317
- }(BufferAttribute));
318
- exports.Uint32BufferAttribute = Uint32BufferAttribute;
319
- var Float32BufferAttribute = /** @class */ (function (_super) {
320
- __extends(Float32BufferAttribute, _super);
321
- function Float32BufferAttribute(array, itemSize, normalized) {
322
- if (normalized === void 0) { normalized = false; }
323
- if (Array.isArray(array))
324
- array = new Float32Array(array);
325
- return _super.call(this, array, itemSize, normalized) || this;
326
- }
327
- return Float32BufferAttribute;
328
- }(BufferAttribute));
329
- exports.Float32BufferAttribute = Float32BufferAttribute;
330
- var Float64BufferAttribute = /** @class */ (function (_super) {
331
- __extends(Float64BufferAttribute, _super);
332
- function Float64BufferAttribute(array, itemSize, normalized) {
333
- if (normalized === void 0) { normalized = false; }
334
- if (Array.isArray(array))
335
- array = new Float64Array(array);
336
- return _super.call(this, array, itemSize, normalized) || this;
337
- }
338
- return Float64BufferAttribute;
339
- }(BufferAttribute));
340
- exports.Float64BufferAttribute = Float64BufferAttribute;
@@ -1,78 +0,0 @@
1
- export declare class EventHandler {
2
- private _callbacks;
3
- private _callbackActive;
4
- constructor();
5
- _addCallback(name: string, callback: any, scope: any, once: boolean): void;
6
- /**
7
- * @function
8
- * @name EventHandler#on
9
- * @description Attach an event handler to an event.
10
- * @param {string} name - Name of the event to bind the callback to.
11
- * @param {callbacks.HandleEvent} callback - Function that is called when event is fired. Note the callback is limited to 8 arguments.
12
- * @param {object} [scope] - Object to use as 'this' when the event is fired, defaults to current this.
13
- * @returns {EventHandler} Self for chaining.
14
- * @example
15
- * obj.on('test', function (a, b) {
16
- * console.log(a + b);
17
- * });
18
- * obj.fire('test', 1, 2); // prints 3 to the console
19
- */
20
- on(name: string, callback: any, scope?: any): this;
21
- /**
22
- * @function
23
- * @name EventHandler#off
24
- * @description Detach an event handler from an event. If callback is not provided then all callbacks are unbound from the event,
25
- * if scope is not provided then all events with the callback will be unbound.
26
- * @param {string} [name] - Name of the event to unbind.
27
- * @param {callbacks.HandleEvent} [callback] - Function to be unbound.
28
- * @param {object} [scope] - Scope that was used as the this when the event is fired.
29
- * @returns {EventHandler} Self for chaining.
30
- * @example
31
- * var handler = function () {
32
- * };
33
- * obj.on('test', handler);
34
- *
35
- * obj.off(); // Removes all events
36
- * obj.off('test'); // Removes all events called 'test'
37
- * obj.off('test', handler); // Removes all handler functions, called 'test'
38
- * obj.off('test', handler, this); // Removes all hander functions, called 'test' with scope this
39
- */
40
- off(name: string | number, callback: any, scope: any): this;
41
- /**
42
- * @function
43
- * @name EventHandler#fire
44
- * @description Fire an event, all additional arguments are passed on to the event listener.
45
- * @param {object} name - Name of event to fire.
46
- * @param {*} [args] - arguments that is passed to the event handler.
47
- * obj.fire('test', 'This is the message');
48
- */
49
- fire(name: string | number, ...args: any[]): this;
50
- /**
51
- * @function
52
- * @name EventHandler#once
53
- * @description Attach an event handler to an event. This handler will be removed after being fired once.
54
- * @param {string} name - Name of the event to bind the callback to.
55
- * @param {callbacks.HandleEvent} callback - Function that is called when event is fired. Note the callback is limited to 8 arguments.
56
- * @param {object} [scope] - Object to use as 'this' when the event is fired, defaults to current this.
57
- * @returns {EventHandler} Self for chaining.
58
- * @example
59
- * obj.once('test', function (a, b) {
60
- * console.log(a + b);
61
- * });
62
- * obj.fire('test', 1, 2); // prints 3 to the console
63
- * obj.fire('test', 1, 2); // not going to get handled
64
- */
65
- once(name: string, callback: any, scope: any): this;
66
- /**
67
- * @function
68
- * @name EventHandler#hasEvent
69
- * @description Test if there are any handlers bound to an event name.
70
- * @param {string} name - The name of the event to test.
71
- * @returns {boolean} True if the object has handlers bound to the specified event name.
72
- * @example
73
- * obj.on('test', function () { }); // bind an event to 'test'
74
- * obj.hasEvent('test'); // returns true
75
- * obj.hasEvent('hello'); // returns false
76
- */
77
- hasEvent(name: string | number): any;
78
- }
@@ -1,189 +0,0 @@
1
- "use strict";
2
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
- if (ar || !(i in from)) {
5
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
- ar[i] = from[i];
7
- }
8
- }
9
- return to.concat(ar || Array.prototype.slice.call(from));
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.EventHandler = void 0;
13
- var EventHandler = /** @class */ (function () {
14
- function EventHandler() {
15
- this._callbacks = {};
16
- this._callbackActive = {};
17
- }
18
- EventHandler.prototype._addCallback = function (name, callback, scope, once) {
19
- if (!name || typeof name !== 'string' || !callback)
20
- return;
21
- if (!this._callbacks[name])
22
- this._callbacks[name] = [];
23
- if (this._callbackActive[name] && this._callbackActive[name] === this._callbacks[name])
24
- this._callbackActive[name] = this._callbackActive[name].slice();
25
- this._callbacks[name].push({
26
- callback: callback,
27
- scope: scope || this,
28
- once: once || false
29
- });
30
- };
31
- /**
32
- * @function
33
- * @name EventHandler#on
34
- * @description Attach an event handler to an event.
35
- * @param {string} name - Name of the event to bind the callback to.
36
- * @param {callbacks.HandleEvent} callback - Function that is called when event is fired. Note the callback is limited to 8 arguments.
37
- * @param {object} [scope] - Object to use as 'this' when the event is fired, defaults to current this.
38
- * @returns {EventHandler} Self for chaining.
39
- * @example
40
- * obj.on('test', function (a, b) {
41
- * console.log(a + b);
42
- * });
43
- * obj.fire('test', 1, 2); // prints 3 to the console
44
- */
45
- EventHandler.prototype.on = function (name, callback, scope) {
46
- this._addCallback(name, callback, scope, false);
47
- return this;
48
- };
49
- /**
50
- * @function
51
- * @name EventHandler#off
52
- * @description Detach an event handler from an event. If callback is not provided then all callbacks are unbound from the event,
53
- * if scope is not provided then all events with the callback will be unbound.
54
- * @param {string} [name] - Name of the event to unbind.
55
- * @param {callbacks.HandleEvent} [callback] - Function to be unbound.
56
- * @param {object} [scope] - Scope that was used as the this when the event is fired.
57
- * @returns {EventHandler} Self for chaining.
58
- * @example
59
- * var handler = function () {
60
- * };
61
- * obj.on('test', handler);
62
- *
63
- * obj.off(); // Removes all events
64
- * obj.off('test'); // Removes all events called 'test'
65
- * obj.off('test', handler); // Removes all handler functions, called 'test'
66
- * obj.off('test', handler, this); // Removes all hander functions, called 'test' with scope this
67
- */
68
- EventHandler.prototype.off = function (name, callback, scope) {
69
- if (name) {
70
- if (this._callbackActive[name] && this._callbackActive[name] === this._callbacks[name])
71
- this._callbackActive[name] = this._callbackActive[name].slice();
72
- }
73
- else {
74
- for (var key in this._callbackActive) {
75
- if (!this._callbacks[key])
76
- continue;
77
- if (this._callbacks[key] !== this._callbackActive[key])
78
- continue;
79
- this._callbackActive[key] = this._callbackActive[key].slice();
80
- }
81
- }
82
- if (!name) {
83
- this._callbacks = {};
84
- }
85
- else if (!callback) {
86
- if (this._callbacks[name])
87
- this._callbacks[name] = [];
88
- }
89
- else {
90
- var events = this._callbacks[name];
91
- if (!events)
92
- return this;
93
- var count = events.length;
94
- for (var i = 0; i < count; i++) {
95
- if (events[i].callback !== callback)
96
- continue;
97
- if (scope && events[i].scope !== scope)
98
- continue;
99
- events[i--] = events[--count];
100
- }
101
- events.length = count;
102
- }
103
- return this;
104
- };
105
- // ESLint rule disabled here as documenting arg1, arg2...argN as [...] rest
106
- // arguments is preferable to documenting each one individually.
107
- /* eslint-disable valid-jsdoc */
108
- /**
109
- * @function
110
- * @name EventHandler#fire
111
- * @description Fire an event, all additional arguments are passed on to the event listener.
112
- * @param {object} name - Name of event to fire.
113
- * @param {*} [args] - arguments that is passed to the event handler.
114
- * obj.fire('test', 'This is the message');
115
- */
116
- /* eslint-enable valid-jsdoc */
117
- EventHandler.prototype.fire = function (name) {
118
- var _a;
119
- var args = [];
120
- for (var _i = 1; _i < arguments.length; _i++) {
121
- args[_i - 1] = arguments[_i];
122
- }
123
- if (!name || !this._callbacks[name])
124
- return this;
125
- var callbacks;
126
- if (!this._callbackActive[name]) {
127
- this._callbackActive[name] = this._callbacks[name];
128
- }
129
- else {
130
- if (this._callbackActive[name] === this._callbacks[name])
131
- this._callbackActive[name] = this._callbackActive[name].slice();
132
- callbacks = this._callbacks[name].slice();
133
- }
134
- // TODO: What does callbacks do here?
135
- // In particular this condition check looks wrong: (i < (callbacks || this._callbackActive[name]).length)
136
- // Because callbacks is not an integer
137
- // eslint-disable-next-line no-unmodified-loop-condition
138
- for (var i = 0; (callbacks || this._callbackActive[name]) && (i < (callbacks || this._callbackActive[name]).length); i++) {
139
- var evt = (callbacks || this._callbackActive[name])[i];
140
- (_a = evt.callback).call.apply(_a, __spreadArray([evt.scope], args, false));
141
- if (evt.once) {
142
- var ind = this._callbacks[name].indexOf(evt);
143
- if (ind !== -1) {
144
- if (this._callbackActive[name] === this._callbacks[name])
145
- this._callbackActive[name] = this._callbackActive[name].slice();
146
- this._callbacks[name].splice(ind, 1);
147
- }
148
- }
149
- }
150
- if (!callbacks)
151
- this._callbackActive[name] = null;
152
- return this;
153
- };
154
- /**
155
- * @function
156
- * @name EventHandler#once
157
- * @description Attach an event handler to an event. This handler will be removed after being fired once.
158
- * @param {string} name - Name of the event to bind the callback to.
159
- * @param {callbacks.HandleEvent} callback - Function that is called when event is fired. Note the callback is limited to 8 arguments.
160
- * @param {object} [scope] - Object to use as 'this' when the event is fired, defaults to current this.
161
- * @returns {EventHandler} Self for chaining.
162
- * @example
163
- * obj.once('test', function (a, b) {
164
- * console.log(a + b);
165
- * });
166
- * obj.fire('test', 1, 2); // prints 3 to the console
167
- * obj.fire('test', 1, 2); // not going to get handled
168
- */
169
- EventHandler.prototype.once = function (name, callback, scope) {
170
- this._addCallback(name, callback, scope, true);
171
- return this;
172
- };
173
- /**
174
- * @function
175
- * @name EventHandler#hasEvent
176
- * @description Test if there are any handlers bound to an event name.
177
- * @param {string} name - The name of the event to test.
178
- * @returns {boolean} True if the object has handlers bound to the specified event name.
179
- * @example
180
- * obj.on('test', function () { }); // bind an event to 'test'
181
- * obj.hasEvent('test'); // returns true
182
- * obj.hasEvent('hello'); // returns false
183
- */
184
- EventHandler.prototype.hasEvent = function (name) {
185
- return (this._callbacks[name] && this._callbacks[name].length !== 0) || false;
186
- };
187
- return EventHandler;
188
- }());
189
- exports.EventHandler = EventHandler;
@@ -1,89 +0,0 @@
1
- import { Mat4 } from "../math/Mat4";
2
- import { Vec3 } from "../math/Vec3";
3
- import { Box } from "../struct/3d/Box";
4
- import { Sphere } from "../struct/3d/Sphere";
5
- import { BufferAttribute } from "./buffer-attribute";
6
- import { TypedArray } from "./types";
7
- import { Vec2 } from "../math/Vec2";
8
- import { Vec4 } from "../math/Vec4";
9
- export interface IGeometry {
10
- position: number[];
11
- normal?: number[];
12
- index?: number[];
13
- uv?: number[];
14
- uv2?: number[];
15
- tangent?: number[];
16
- }
17
- export interface IBufferGeometry {
18
- position: Float32Array | undefined;
19
- index?: Uint32Array | Uint16Array;
20
- normal?: Float32Array;
21
- uv?: Float32Array;
22
- uv2?: Float32Array;
23
- tangent?: Float32Array;
24
- }
25
- /**
26
- * BufferType 几何体,用于独立计算几何体
27
- */
28
- export declare class BufferGeometry {
29
- name: string;
30
- index: BufferAttribute | undefined;
31
- morphAttributes: any;
32
- morphTargetsRelative: boolean;
33
- groups: {
34
- start: number;
35
- count: number;
36
- materialIndex?: number;
37
- }[];
38
- boundingBox: Box | undefined;
39
- boundingSphere: Sphere | undefined;
40
- drawRange: {
41
- start: number;
42
- count: number;
43
- };
44
- attributes: {
45
- [key: string]: BufferAttribute;
46
- };
47
- parameters: any;
48
- readonly isBufferGeometry: true;
49
- uuid: string;
50
- type: string;
51
- constructor();
52
- /**
53
- * 转化成BufferArray来计算
54
- * @param geo
55
- */
56
- setFromGeometry(geo: IGeometry): this;
57
- getIndex(): BufferAttribute | undefined;
58
- setIndex(index: BufferAttribute | TypedArray | number[]): void;
59
- getAttribute(name: string): BufferAttribute;
60
- setAttribute(name: string, attribute: BufferAttribute): this;
61
- addAttribute(name: string, attribute: BufferAttribute | TypedArray | Array<number | Vec2 | Vec3 | Vec4>, itemSize?: number): this;
62
- deleteAttribute(name: string): this;
63
- addGroup(start: number, count: number, materialIndex?: number): void;
64
- clearGroups(): void;
65
- setDrawRange(start: number, count: number): void;
66
- applyMat4(matrix: Mat4): this;
67
- rotateX(angle: number): this;
68
- rotateY(angle: number): this;
69
- rotateZ(angle: number): this;
70
- translate(x: number, y: number, z: number): this;
71
- scale(x: number, y: number, z: number): this;
72
- lookAt(vector: Vec3): this;
73
- center(): this;
74
- setFromObject(object: any): this;
75
- setFromPoints(points: Vec3[]): this;
76
- updateFromObject(object: any): this;
77
- computeBoundingBox(): void;
78
- computeBoundingSphere(): void;
79
- computeFaceNormals(): void;
80
- computeVertexNormals(): void;
81
- merge(geometry: BufferGeometry, offset: number): this | undefined;
82
- normalizeNormals(): void;
83
- toFlat(): BufferGeometry;
84
- toNonIndexed(): BufferGeometry;
85
- toJSON(): any;
86
- userData(userData: any): void;
87
- clone(): BufferGeometry;
88
- copy(source: BufferGeometry): this;
89
- }