@luma.gl/engine 9.0.0-alpha.16 → 9.0.0-alpha.19

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 (188) hide show
  1. package/dist/animation/key-frames.d.ts +1 -1
  2. package/dist/animation/key-frames.d.ts.map +1 -1
  3. package/dist/animation/key-frames.js +55 -54
  4. package/dist/animation/key-frames.js.map +1 -0
  5. package/dist/animation/timeline.d.ts +4 -4
  6. package/dist/animation/timeline.d.ts.map +1 -1
  7. package/dist/animation/timeline.js +101 -94
  8. package/dist/animation/timeline.js.map +1 -0
  9. package/dist/animation-loop/animation-loop.d.ts +4 -2
  10. package/dist/animation-loop/animation-loop.d.ts.map +1 -1
  11. package/dist/animation-loop/animation-loop.js +358 -414
  12. package/dist/animation-loop/animation-loop.js.map +1 -0
  13. package/dist/animation-loop/animation-props.d.ts +3 -1
  14. package/dist/animation-loop/animation-props.d.ts.map +1 -1
  15. package/dist/animation-loop/animation-props.js +1 -0
  16. package/dist/animation-loop/animation-props.js.map +1 -0
  17. package/dist/animation-loop/make-animation-loop.d.ts +1 -1
  18. package/dist/animation-loop/make-animation-loop.d.ts.map +1 -1
  19. package/dist/animation-loop/make-animation-loop.js +25 -26
  20. package/dist/animation-loop/make-animation-loop.js.map +1 -0
  21. package/dist/animation-loop/render-loop.js +5 -17
  22. package/dist/animation-loop/render-loop.js.map +1 -0
  23. package/dist/dist.dev.js +12517 -0
  24. package/dist/geometries/cone-geometry.d.ts +1 -1
  25. package/dist/geometries/cone-geometry.d.ts.map +1 -1
  26. package/dist/geometries/cone-geometry.js +18 -12
  27. package/dist/geometries/cone-geometry.js.map +1 -0
  28. package/dist/geometries/cube-geometry.d.ts +1 -1
  29. package/dist/geometries/cube-geometry.d.ts.map +1 -1
  30. package/dist/geometries/cube-geometry.js +60 -187
  31. package/dist/geometries/cube-geometry.js.map +1 -0
  32. package/dist/geometries/cylinder-geometry.d.ts +1 -1
  33. package/dist/geometries/cylinder-geometry.d.ts.map +1 -1
  34. package/dist/geometries/cylinder-geometry.js +15 -10
  35. package/dist/geometries/cylinder-geometry.js.map +1 -0
  36. package/dist/geometries/ico-sphere-geometry.d.ts +1 -1
  37. package/dist/geometries/ico-sphere-geometry.d.ts.map +1 -1
  38. package/dist/geometries/ico-sphere-geometry.js +160 -141
  39. package/dist/geometries/ico-sphere-geometry.js.map +1 -0
  40. package/dist/geometries/plane-geometry.d.ts +1 -1
  41. package/dist/geometries/plane-geometry.d.ts.map +1 -1
  42. package/dist/geometries/plane-geometry.js +111 -93
  43. package/dist/geometries/plane-geometry.js.map +1 -0
  44. package/dist/geometries/sphere-geometry.d.ts +1 -1
  45. package/dist/geometries/sphere-geometry.d.ts.map +1 -1
  46. package/dist/geometries/sphere-geometry.js +95 -76
  47. package/dist/geometries/sphere-geometry.js.map +1 -0
  48. package/dist/geometries/truncated-cone-geometry.d.ts +1 -1
  49. package/dist/geometries/truncated-cone-geometry.d.ts.map +1 -1
  50. package/dist/geometries/truncated-cone-geometry.js +126 -105
  51. package/dist/geometries/truncated-cone-geometry.js.map +1 -0
  52. package/dist/geometry/geometry-table.d.ts +1 -1
  53. package/dist/geometry/geometry-table.d.ts.map +1 -1
  54. package/dist/geometry/geometry-table.js +1 -0
  55. package/dist/geometry/geometry-table.js.map +1 -0
  56. package/dist/geometry/geometry-utils.js +32 -22
  57. package/dist/geometry/geometry-utils.js.map +1 -0
  58. package/dist/geometry/geometry.d.ts +4 -4
  59. package/dist/geometry/geometry.d.ts.map +1 -1
  60. package/dist/geometry/geometry.js +109 -96
  61. package/dist/geometry/geometry.js.map +1 -0
  62. package/dist/geometry/primitive-utils.js +1 -30
  63. package/dist/geometry/primitive-utils.js.map +1 -0
  64. package/dist/index.cjs +2268 -0
  65. package/dist/index.d.ts +1 -0
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +17 -20
  68. package/dist/index.js.map +1 -0
  69. package/dist/lib/clip-space.d.ts +8 -0
  70. package/dist/lib/clip-space.d.ts.map +1 -1
  71. package/dist/lib/clip-space.js +32 -45
  72. package/dist/lib/clip-space.js.map +1 -0
  73. package/dist/lib/model-utils.js +28 -101
  74. package/dist/lib/model-utils.js.map +1 -0
  75. package/dist/lib/model.d.ts +1 -1
  76. package/dist/lib/model.d.ts.map +1 -1
  77. package/dist/lib/model.js +129 -121
  78. package/dist/lib/model.js.map +1 -0
  79. package/dist/lib/pipeline-factory.d.ts +3 -3
  80. package/dist/lib/pipeline-factory.d.ts.map +1 -1
  81. package/dist/lib/pipeline-factory.js +165 -136
  82. package/dist/lib/pipeline-factory.js.map +1 -0
  83. package/dist.min.js +295 -0
  84. package/package.json +22 -13
  85. package/src/animation/timeline.ts +1 -1
  86. package/src/animation-loop/animation-loop.ts +5 -5
  87. package/src/animation-loop/make-animation-loop.ts +2 -1
  88. package/src/geometry/geometry.ts +2 -2
  89. package/src/index.ts +1 -1
  90. package/src/lib/clip-space.ts +14 -11
  91. package/src/lib/pipeline-factory.ts +1 -1
  92. package/dist/bundle.d.ts +0 -2
  93. package/dist/bundle.d.ts.map +0 -1
  94. package/dist/bundle.js +0 -5
  95. package/dist/dist.min.js +0 -31
  96. package/dist/es5/animation/key-frames.js +0 -84
  97. package/dist/es5/animation/key-frames.js.map +0 -1
  98. package/dist/es5/animation/timeline.js +0 -183
  99. package/dist/es5/animation/timeline.js.map +0 -1
  100. package/dist/es5/animation-loop/animation-loop.js +0 -534
  101. package/dist/es5/animation-loop/animation-loop.js.map +0 -1
  102. package/dist/es5/animation-loop/animation-props.js +0 -2
  103. package/dist/es5/animation-loop/animation-props.js.map +0 -1
  104. package/dist/es5/animation-loop/make-animation-loop.js +0 -53
  105. package/dist/es5/animation-loop/make-animation-loop.js.map +0 -1
  106. package/dist/es5/animation-loop/render-loop.js +0 -39
  107. package/dist/es5/animation-loop/render-loop.js.map +0 -1
  108. package/dist/es5/bundle.js +0 -6
  109. package/dist/es5/bundle.js.map +0 -1
  110. package/dist/es5/geometries/cone-geometry.js +0 -43
  111. package/dist/es5/geometries/cone-geometry.js.map +0 -1
  112. package/dist/es5/geometries/cube-geometry.js +0 -84
  113. package/dist/es5/geometries/cube-geometry.js.map +0 -1
  114. package/dist/es5/geometries/cylinder-geometry.js +0 -39
  115. package/dist/es5/geometries/cylinder-geometry.js.map +0 -1
  116. package/dist/es5/geometries/ico-sphere-geometry.js +0 -185
  117. package/dist/es5/geometries/ico-sphere-geometry.js.map +0 -1
  118. package/dist/es5/geometries/plane-geometry.js +0 -137
  119. package/dist/es5/geometries/plane-geometry.js.map +0 -1
  120. package/dist/es5/geometries/sphere-geometry.js +0 -120
  121. package/dist/es5/geometries/sphere-geometry.js.map +0 -1
  122. package/dist/es5/geometries/truncated-cone-geometry.js +0 -160
  123. package/dist/es5/geometries/truncated-cone-geometry.js.map +0 -1
  124. package/dist/es5/geometry/geometry-table.js +0 -2
  125. package/dist/es5/geometry/geometry-table.js.map +0 -1
  126. package/dist/es5/geometry/geometry-utils.js +0 -39
  127. package/dist/es5/geometry/geometry-utils.js.map +0 -1
  128. package/dist/es5/geometry/geometry.js +0 -150
  129. package/dist/es5/geometry/geometry.js.map +0 -1
  130. package/dist/es5/geometry/primitive-utils.js +0 -2
  131. package/dist/es5/geometry/primitive-utils.js.map +0 -1
  132. package/dist/es5/index.js +0 -112
  133. package/dist/es5/index.js.map +0 -1
  134. package/dist/es5/lib/clip-space.js +0 -2
  135. package/dist/es5/lib/clip-space.js.map +0 -1
  136. package/dist/es5/lib/model-utils.js +0 -52
  137. package/dist/es5/lib/model-utils.js.map +0 -1
  138. package/dist/es5/lib/model.js +0 -173
  139. package/dist/es5/lib/model.js.map +0 -1
  140. package/dist/es5/lib/pipeline-factory.js +0 -244
  141. package/dist/es5/lib/pipeline-factory.js.map +0 -1
  142. package/dist/esm/animation/key-frames.js +0 -57
  143. package/dist/esm/animation/key-frames.js.map +0 -1
  144. package/dist/esm/animation/timeline.js +0 -113
  145. package/dist/esm/animation/timeline.js.map +0 -1
  146. package/dist/esm/animation-loop/animation-loop.js +0 -367
  147. package/dist/esm/animation-loop/animation-loop.js.map +0 -1
  148. package/dist/esm/animation-loop/animation-props.js +0 -2
  149. package/dist/esm/animation-loop/animation-props.js.map +0 -1
  150. package/dist/esm/animation-loop/make-animation-loop.js +0 -28
  151. package/dist/esm/animation-loop/make-animation-loop.js.map +0 -1
  152. package/dist/esm/animation-loop/render-loop.js +0 -7
  153. package/dist/esm/animation-loop/render-loop.js.map +0 -1
  154. package/dist/esm/bundle.js +0 -4
  155. package/dist/esm/bundle.js.map +0 -1
  156. package/dist/esm/geometries/cone-geometry.js +0 -21
  157. package/dist/esm/geometries/cone-geometry.js.map +0 -1
  158. package/dist/esm/geometries/cube-geometry.js +0 -67
  159. package/dist/esm/geometries/cube-geometry.js.map +0 -1
  160. package/dist/esm/geometries/cylinder-geometry.js +0 -18
  161. package/dist/esm/geometries/cylinder-geometry.js.map +0 -1
  162. package/dist/esm/geometries/ico-sphere-geometry.js +0 -170
  163. package/dist/esm/geometries/ico-sphere-geometry.js.map +0 -1
  164. package/dist/esm/geometries/plane-geometry.js +0 -119
  165. package/dist/esm/geometries/plane-geometry.js.map +0 -1
  166. package/dist/esm/geometries/sphere-geometry.js +0 -102
  167. package/dist/esm/geometries/sphere-geometry.js.map +0 -1
  168. package/dist/esm/geometries/truncated-cone-geometry.js +0 -136
  169. package/dist/esm/geometries/truncated-cone-geometry.js.map +0 -1
  170. package/dist/esm/geometry/geometry-table.js +0 -2
  171. package/dist/esm/geometry/geometry-table.js.map +0 -1
  172. package/dist/esm/geometry/geometry-utils.js +0 -37
  173. package/dist/esm/geometry/geometry-utils.js.map +0 -1
  174. package/dist/esm/geometry/geometry.js +0 -119
  175. package/dist/esm/geometry/geometry.js.map +0 -1
  176. package/dist/esm/geometry/primitive-utils.js +0 -2
  177. package/dist/esm/geometry/primitive-utils.js.map +0 -1
  178. package/dist/esm/index.js +0 -16
  179. package/dist/esm/index.js.map +0 -1
  180. package/dist/esm/lib/clip-space.js +0 -2
  181. package/dist/esm/lib/clip-space.js.map +0 -1
  182. package/dist/esm/lib/model-utils.js +0 -40
  183. package/dist/esm/lib/model-utils.js.map +0 -1
  184. package/dist/esm/lib/model.js +0 -146
  185. package/dist/esm/lib/model.js.map +0 -1
  186. package/dist/esm/lib/pipeline-factory.js +0 -180
  187. package/dist/esm/lib/pipeline-factory.js.map +0 -1
  188. package/src/bundle.ts +0 -4
@@ -1,151 +1,170 @@
1
1
  import { uid } from '@luma.gl/api';
2
2
  import { Vector3 } from '@math.gl/core';
3
- import Geometry from '../geometry/geometry.js';
4
- /* eslint-disable comma-spacing, max-statements, complexity */
3
+ import Geometry from "../geometry/geometry.js";
5
4
  const ICO_POSITIONS = [-1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 1, 0, -1, 0, 1, 0, 0];
6
5
  const ICO_INDICES = [3, 4, 5, 3, 5, 1, 3, 1, 0, 3, 0, 4, 4, 0, 2, 4, 2, 5, 2, 0, 1, 5, 2, 1];
7
6
  export class IcoSphereGeometry extends Geometry {
8
- constructor(props = {}) {
9
- const { id = uid('ico-sphere-geometry') } = props;
10
- const { indices, attributes } = tesselateIcosaHedron(props);
11
- super({
12
- ...props,
13
- id,
14
- indices,
15
- attributes: { ...attributes, ...props.attributes }
16
- });
17
- }
7
+ constructor() {
8
+ let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
9
+ const {
10
+ id = uid('ico-sphere-geometry')
11
+ } = props;
12
+ const {
13
+ indices,
14
+ attributes
15
+ } = tesselateIcosaHedron(props);
16
+ super({
17
+ ...props,
18
+ id,
19
+ indices,
20
+ attributes: {
21
+ ...attributes,
22
+ ...props.attributes
23
+ }
24
+ });
25
+ }
18
26
  }
19
27
  function tesselateIcosaHedron(props) {
20
- const { iterations = 0 } = props;
21
- const PI = Math.PI;
22
- const PI2 = PI * 2;
23
- const positions = [...ICO_POSITIONS];
24
- let indices = [...ICO_INDICES];
25
- positions.push();
26
- indices.push();
27
- const getMiddlePoint = (() => {
28
- const pointMemo = {};
29
- return (i1, i2) => {
30
- i1 *= 3;
31
- i2 *= 3;
32
- const mini = i1 < i2 ? i1 : i2;
33
- const maxi = i1 > i2 ? i1 : i2;
34
- const key = `${mini}|${maxi}`;
35
- if (key in pointMemo) {
36
- return pointMemo[key];
37
- }
38
- const x1 = positions[i1];
39
- const y1 = positions[i1 + 1];
40
- const z1 = positions[i1 + 2];
41
- const x2 = positions[i2];
42
- const y2 = positions[i2 + 1];
43
- const z2 = positions[i2 + 2];
44
- let xm = (x1 + x2) / 2;
45
- let ym = (y1 + y2) / 2;
46
- let zm = (z1 + z2) / 2;
47
- const len = Math.sqrt(xm * xm + ym * ym + zm * zm);
48
- xm /= len;
49
- ym /= len;
50
- zm /= len;
51
- positions.push(xm, ym, zm);
52
- return (pointMemo[key] = positions.length / 3 - 1);
53
- };
54
- })();
55
- for (let i = 0; i < iterations; i++) {
56
- const indices2 = [];
57
- for (let j = 0; j < indices.length; j += 3) {
58
- const a = getMiddlePoint(indices[j + 0], indices[j + 1]);
59
- const b = getMiddlePoint(indices[j + 1], indices[j + 2]);
60
- const c = getMiddlePoint(indices[j + 2], indices[j + 0]);
61
- indices2.push(c, indices[j + 0], a, a, indices[j + 1], b, b, indices[j + 2], c, a, b, c);
62
- }
63
- indices = indices2;
28
+ const {
29
+ iterations = 0
30
+ } = props;
31
+ const PI = Math.PI;
32
+ const PI2 = PI * 2;
33
+ const positions = [...ICO_POSITIONS];
34
+ let indices = [...ICO_INDICES];
35
+ positions.push();
36
+ indices.push();
37
+ const getMiddlePoint = (() => {
38
+ const pointMemo = {};
39
+ return (i1, i2) => {
40
+ i1 *= 3;
41
+ i2 *= 3;
42
+ const mini = i1 < i2 ? i1 : i2;
43
+ const maxi = i1 > i2 ? i1 : i2;
44
+ const key = "".concat(mini, "|").concat(maxi);
45
+ if (key in pointMemo) {
46
+ return pointMemo[key];
47
+ }
48
+ const x1 = positions[i1];
49
+ const y1 = positions[i1 + 1];
50
+ const z1 = positions[i1 + 2];
51
+ const x2 = positions[i2];
52
+ const y2 = positions[i2 + 1];
53
+ const z2 = positions[i2 + 2];
54
+ let xm = (x1 + x2) / 2;
55
+ let ym = (y1 + y2) / 2;
56
+ let zm = (z1 + z2) / 2;
57
+ const len = Math.sqrt(xm * xm + ym * ym + zm * zm);
58
+ xm /= len;
59
+ ym /= len;
60
+ zm /= len;
61
+ positions.push(xm, ym, zm);
62
+ return pointMemo[key] = positions.length / 3 - 1;
63
+ };
64
+ })();
65
+ for (let i = 0; i < iterations; i++) {
66
+ const indices2 = [];
67
+ for (let j = 0; j < indices.length; j += 3) {
68
+ const a = getMiddlePoint(indices[j + 0], indices[j + 1]);
69
+ const b = getMiddlePoint(indices[j + 1], indices[j + 2]);
70
+ const c = getMiddlePoint(indices[j + 2], indices[j + 0]);
71
+ indices2.push(c, indices[j + 0], a, a, indices[j + 1], b, b, indices[j + 2], c, a, b, c);
64
72
  }
65
- // Calculate texCoords and normals
66
- const normals = new Array(positions.length);
67
- const texCoords = new Array((positions.length / 3) * 2);
68
- const l = indices.length;
69
- for (let i = l - 3; i >= 0; i -= 3) {
70
- const i1 = indices[i + 0];
71
- const i2 = indices[i + 1];
72
- const i3 = indices[i + 2];
73
- const in1 = i1 * 3;
74
- const in2 = i2 * 3;
75
- const in3 = i3 * 3;
76
- const iu1 = i1 * 2;
77
- const iu2 = i2 * 2;
78
- const iu3 = i3 * 2;
79
- const x1 = positions[in1 + 0];
80
- const y1 = positions[in1 + 1];
81
- const z1 = positions[in1 + 2];
82
- const theta1 = Math.acos(z1 / Math.sqrt(x1 * x1 + y1 * y1 + z1 * z1));
83
- const phi1 = Math.atan2(y1, x1) + PI;
84
- const v1 = theta1 / PI;
85
- const u1 = 1 - phi1 / PI2;
86
- const x2 = positions[in2 + 0];
87
- const y2 = positions[in2 + 1];
88
- const z2 = positions[in2 + 2];
89
- const theta2 = Math.acos(z2 / Math.sqrt(x2 * x2 + y2 * y2 + z2 * z2));
90
- const phi2 = Math.atan2(y2, x2) + PI;
91
- const v2 = theta2 / PI;
92
- const u2 = 1 - phi2 / PI2;
93
- const x3 = positions[in3 + 0];
94
- const y3 = positions[in3 + 1];
95
- const z3 = positions[in3 + 2];
96
- const theta3 = Math.acos(z3 / Math.sqrt(x3 * x3 + y3 * y3 + z3 * z3));
97
- const phi3 = Math.atan2(y3, x3) + PI;
98
- const v3 = theta3 / PI;
99
- const u3 = 1 - phi3 / PI2;
100
- const vec1 = [x3 - x2, y3 - y2, z3 - z2];
101
- const vec2 = [x1 - x2, y1 - y2, z1 - z2];
102
- const normal = new Vector3(vec1).cross(vec2).normalize();
103
- let newIndex;
104
- if ((u1 === 0 || u2 === 0 || u3 === 0) &&
105
- (u1 === 0 || u1 > 0.5) &&
106
- (u2 === 0 || u2 > 0.5) &&
107
- (u3 === 0 || u3 > 0.5)) {
108
- positions.push(positions[in1 + 0], positions[in1 + 1], positions[in1 + 2]);
109
- newIndex = positions.length / 3 - 1;
110
- indices.push(newIndex);
111
- texCoords[newIndex * 2 + 0] = 1;
112
- texCoords[newIndex * 2 + 1] = v1;
113
- normals[newIndex * 3 + 0] = normal.x;
114
- normals[newIndex * 3 + 1] = normal.y;
115
- normals[newIndex * 3 + 2] = normal.z;
116
- positions.push(positions[in2 + 0], positions[in2 + 1], positions[in2 + 2]);
117
- newIndex = positions.length / 3 - 1;
118
- indices.push(newIndex);
119
- texCoords[newIndex * 2 + 0] = 1;
120
- texCoords[newIndex * 2 + 1] = v2;
121
- normals[newIndex * 3 + 0] = normal.x;
122
- normals[newIndex * 3 + 1] = normal.y;
123
- normals[newIndex * 3 + 2] = normal.z;
124
- positions.push(positions[in3 + 0], positions[in3 + 1], positions[in3 + 2]);
125
- newIndex = positions.length / 3 - 1;
126
- indices.push(newIndex);
127
- texCoords[newIndex * 2 + 0] = 1;
128
- texCoords[newIndex * 2 + 1] = v3;
129
- normals[newIndex * 3 + 0] = normal.x;
130
- normals[newIndex * 3 + 1] = normal.y;
131
- normals[newIndex * 3 + 2] = normal.z;
132
- }
133
- normals[in1 + 0] = normals[in2 + 0] = normals[in3 + 0] = normal.x;
134
- normals[in1 + 1] = normals[in2 + 1] = normals[in3 + 1] = normal.y;
135
- normals[in1 + 2] = normals[in2 + 2] = normals[in3 + 2] = normal.z;
136
- texCoords[iu1 + 0] = u1;
137
- texCoords[iu1 + 1] = v1;
138
- texCoords[iu2 + 0] = u2;
139
- texCoords[iu2 + 1] = v2;
140
- texCoords[iu3 + 0] = u3;
141
- texCoords[iu3 + 1] = v3;
73
+ indices = indices2;
74
+ }
75
+ const normals = new Array(positions.length);
76
+ const texCoords = new Array(positions.length / 3 * 2);
77
+ const l = indices.length;
78
+ for (let i = l - 3; i >= 0; i -= 3) {
79
+ const i1 = indices[i + 0];
80
+ const i2 = indices[i + 1];
81
+ const i3 = indices[i + 2];
82
+ const in1 = i1 * 3;
83
+ const in2 = i2 * 3;
84
+ const in3 = i3 * 3;
85
+ const iu1 = i1 * 2;
86
+ const iu2 = i2 * 2;
87
+ const iu3 = i3 * 2;
88
+ const x1 = positions[in1 + 0];
89
+ const y1 = positions[in1 + 1];
90
+ const z1 = positions[in1 + 2];
91
+ const theta1 = Math.acos(z1 / Math.sqrt(x1 * x1 + y1 * y1 + z1 * z1));
92
+ const phi1 = Math.atan2(y1, x1) + PI;
93
+ const v1 = theta1 / PI;
94
+ const u1 = 1 - phi1 / PI2;
95
+ const x2 = positions[in2 + 0];
96
+ const y2 = positions[in2 + 1];
97
+ const z2 = positions[in2 + 2];
98
+ const theta2 = Math.acos(z2 / Math.sqrt(x2 * x2 + y2 * y2 + z2 * z2));
99
+ const phi2 = Math.atan2(y2, x2) + PI;
100
+ const v2 = theta2 / PI;
101
+ const u2 = 1 - phi2 / PI2;
102
+ const x3 = positions[in3 + 0];
103
+ const y3 = positions[in3 + 1];
104
+ const z3 = positions[in3 + 2];
105
+ const theta3 = Math.acos(z3 / Math.sqrt(x3 * x3 + y3 * y3 + z3 * z3));
106
+ const phi3 = Math.atan2(y3, x3) + PI;
107
+ const v3 = theta3 / PI;
108
+ const u3 = 1 - phi3 / PI2;
109
+ const vec1 = [x3 - x2, y3 - y2, z3 - z2];
110
+ const vec2 = [x1 - x2, y1 - y2, z1 - z2];
111
+ const normal = new Vector3(vec1).cross(vec2).normalize();
112
+ let newIndex;
113
+ if ((u1 === 0 || u2 === 0 || u3 === 0) && (u1 === 0 || u1 > 0.5) && (u2 === 0 || u2 > 0.5) && (u3 === 0 || u3 > 0.5)) {
114
+ positions.push(positions[in1 + 0], positions[in1 + 1], positions[in1 + 2]);
115
+ newIndex = positions.length / 3 - 1;
116
+ indices.push(newIndex);
117
+ texCoords[newIndex * 2 + 0] = 1;
118
+ texCoords[newIndex * 2 + 1] = v1;
119
+ normals[newIndex * 3 + 0] = normal.x;
120
+ normals[newIndex * 3 + 1] = normal.y;
121
+ normals[newIndex * 3 + 2] = normal.z;
122
+ positions.push(positions[in2 + 0], positions[in2 + 1], positions[in2 + 2]);
123
+ newIndex = positions.length / 3 - 1;
124
+ indices.push(newIndex);
125
+ texCoords[newIndex * 2 + 0] = 1;
126
+ texCoords[newIndex * 2 + 1] = v2;
127
+ normals[newIndex * 3 + 0] = normal.x;
128
+ normals[newIndex * 3 + 1] = normal.y;
129
+ normals[newIndex * 3 + 2] = normal.z;
130
+ positions.push(positions[in3 + 0], positions[in3 + 1], positions[in3 + 2]);
131
+ newIndex = positions.length / 3 - 1;
132
+ indices.push(newIndex);
133
+ texCoords[newIndex * 2 + 0] = 1;
134
+ texCoords[newIndex * 2 + 1] = v3;
135
+ normals[newIndex * 3 + 0] = normal.x;
136
+ normals[newIndex * 3 + 1] = normal.y;
137
+ normals[newIndex * 3 + 2] = normal.z;
142
138
  }
143
- return {
144
- indices: { size: 1, value: new Uint16Array(indices) },
145
- attributes: {
146
- POSITION: { size: 3, value: new Float32Array(positions) },
147
- NORMAL: { size: 3, value: new Float32Array(normals) },
148
- TEXCOORD_0: { size: 2, value: new Float32Array(texCoords) }
149
- }
150
- };
139
+ normals[in1 + 0] = normals[in2 + 0] = normals[in3 + 0] = normal.x;
140
+ normals[in1 + 1] = normals[in2 + 1] = normals[in3 + 1] = normal.y;
141
+ normals[in1 + 2] = normals[in2 + 2] = normals[in3 + 2] = normal.z;
142
+ texCoords[iu1 + 0] = u1;
143
+ texCoords[iu1 + 1] = v1;
144
+ texCoords[iu2 + 0] = u2;
145
+ texCoords[iu2 + 1] = v2;
146
+ texCoords[iu3 + 0] = u3;
147
+ texCoords[iu3 + 1] = v3;
148
+ }
149
+ return {
150
+ indices: {
151
+ size: 1,
152
+ value: new Uint16Array(indices)
153
+ },
154
+ attributes: {
155
+ POSITION: {
156
+ size: 3,
157
+ value: new Float32Array(positions)
158
+ },
159
+ NORMAL: {
160
+ size: 3,
161
+ value: new Float32Array(normals)
162
+ },
163
+ TEXCOORD_0: {
164
+ size: 2,
165
+ value: new Float32Array(texCoords)
166
+ }
167
+ }
168
+ };
151
169
  }
170
+ //# sourceMappingURL=ico-sphere-geometry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ico-sphere-geometry.js","names":["uid","Vector3","Geometry","ICO_POSITIONS","ICO_INDICES","IcoSphereGeometry","constructor","props","arguments","length","undefined","id","indices","attributes","tesselateIcosaHedron","iterations","PI","Math","PI2","positions","push","getMiddlePoint","pointMemo","i1","i2","mini","maxi","key","concat","x1","y1","z1","x2","y2","z2","xm","ym","zm","len","sqrt","i","indices2","j","a","b","c","normals","Array","texCoords","l","i3","in1","in2","in3","iu1","iu2","iu3","theta1","acos","phi1","atan2","v1","u1","theta2","phi2","v2","u2","x3","y3","z3","theta3","phi3","v3","u3","vec1","vec2","normal","cross","normalize","newIndex","x","y","z","size","value","Uint16Array","POSITION","Float32Array","NORMAL","TEXCOORD_0"],"sources":["../../src/geometries/ico-sphere-geometry.ts"],"sourcesContent":["import {uid} from '@luma.gl/api';\nimport {Vector3} from '@math.gl/core';\nimport Geometry from '../geometry/geometry';\n\n/* eslint-disable comma-spacing, max-statements, complexity */\n\nconst ICO_POSITIONS = [-1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 1, 0, -1, 0, 1, 0, 0];\nconst ICO_INDICES = [3, 4, 5, 3, 5, 1, 3, 1, 0, 3, 0, 4, 4, 0, 2, 4, 2, 5, 2, 0, 1, 5, 2, 1];\n\nexport type IcoSphereGeometryProps = {\n id?: string;\n radius?: number;\n iterations?: number;\n attributes?: any\n};\n\nexport class IcoSphereGeometry extends Geometry {\n constructor(props: IcoSphereGeometryProps = {}) {\n const {id = uid('ico-sphere-geometry')} = props;\n const {indices, attributes} = tesselateIcosaHedron(props);\n super({\n ...props,\n id,\n indices,\n attributes: {...attributes, ...props.attributes}\n });\n }\n}\n\nfunction tesselateIcosaHedron(props: IcoSphereGeometryProps) {\n const {iterations = 0} = props;\n\n const PI = Math.PI;\n const PI2 = PI * 2;\n\n const positions = [...ICO_POSITIONS];\n let indices = [...ICO_INDICES];\n\n positions.push();\n indices.push();\n\n const getMiddlePoint = (() => {\n const pointMemo: Record<string, number> = {};\n\n return (i1: number, i2: number) => {\n i1 *= 3;\n i2 *= 3;\n const mini = i1 < i2 ? i1 : i2;\n const maxi = i1 > i2 ? i1 : i2;\n const key = `${mini}|${maxi}`;\n\n if (key in pointMemo) {\n return pointMemo[key];\n }\n\n const x1 = positions[i1];\n const y1 = positions[i1 + 1];\n const z1 = positions[i1 + 2];\n const x2 = positions[i2];\n const y2 = positions[i2 + 1];\n const z2 = positions[i2 + 2];\n let xm = (x1 + x2) / 2;\n let ym = (y1 + y2) / 2;\n let zm = (z1 + z2) / 2;\n const len = Math.sqrt(xm * xm + ym * ym + zm * zm);\n\n xm /= len;\n ym /= len;\n zm /= len;\n\n positions.push(xm, ym, zm);\n\n return (pointMemo[key] = positions.length / 3 - 1);\n };\n })();\n\n for (let i = 0; i < iterations; i++) {\n const indices2: number[] = [];\n for (let j = 0; j < indices.length; j += 3) {\n const a = getMiddlePoint(indices[j + 0], indices[j + 1]);\n const b = getMiddlePoint(indices[j + 1], indices[j + 2]);\n const c = getMiddlePoint(indices[j + 2], indices[j + 0]);\n\n indices2.push(c, indices[j + 0], a, a, indices[j + 1], b, b, indices[j + 2], c, a, b, c);\n }\n indices = indices2;\n }\n\n // Calculate texCoords and normals\n const normals = new Array(positions.length);\n const texCoords = new Array((positions.length / 3) * 2);\n\n const l = indices.length;\n for (let i = l - 3; i >= 0; i -= 3) {\n const i1 = indices[i + 0];\n const i2 = indices[i + 1];\n const i3 = indices[i + 2];\n const in1 = i1 * 3;\n const in2 = i2 * 3;\n const in3 = i3 * 3;\n const iu1 = i1 * 2;\n const iu2 = i2 * 2;\n const iu3 = i3 * 2;\n const x1 = positions[in1 + 0];\n const y1 = positions[in1 + 1];\n const z1 = positions[in1 + 2];\n const theta1 = Math.acos(z1 / Math.sqrt(x1 * x1 + y1 * y1 + z1 * z1));\n const phi1 = Math.atan2(y1, x1) + PI;\n const v1 = theta1 / PI;\n const u1 = 1 - phi1 / PI2;\n const x2 = positions[in2 + 0];\n const y2 = positions[in2 + 1];\n const z2 = positions[in2 + 2];\n const theta2 = Math.acos(z2 / Math.sqrt(x2 * x2 + y2 * y2 + z2 * z2));\n const phi2 = Math.atan2(y2, x2) + PI;\n const v2 = theta2 / PI;\n const u2 = 1 - phi2 / PI2;\n const x3 = positions[in3 + 0];\n const y3 = positions[in3 + 1];\n const z3 = positions[in3 + 2];\n const theta3 = Math.acos(z3 / Math.sqrt(x3 * x3 + y3 * y3 + z3 * z3));\n const phi3 = Math.atan2(y3, x3) + PI;\n const v3 = theta3 / PI;\n const u3 = 1 - phi3 / PI2;\n const vec1 = [x3 - x2, y3 - y2, z3 - z2];\n const vec2 = [x1 - x2, y1 - y2, z1 - z2];\n const normal = new Vector3(vec1).cross(vec2).normalize();\n let newIndex;\n\n if (\n (u1 === 0 || u2 === 0 || u3 === 0) &&\n (u1 === 0 || u1 > 0.5) &&\n (u2 === 0 || u2 > 0.5) &&\n (u3 === 0 || u3 > 0.5)\n ) {\n positions.push(positions[in1 + 0], positions[in1 + 1], positions[in1 + 2]);\n newIndex = positions.length / 3 - 1;\n indices.push(newIndex);\n texCoords[newIndex * 2 + 0] = 1;\n texCoords[newIndex * 2 + 1] = v1;\n normals[newIndex * 3 + 0] = normal.x;\n normals[newIndex * 3 + 1] = normal.y;\n normals[newIndex * 3 + 2] = normal.z;\n\n positions.push(positions[in2 + 0], positions[in2 + 1], positions[in2 + 2]);\n newIndex = positions.length / 3 - 1;\n indices.push(newIndex);\n texCoords[newIndex * 2 + 0] = 1;\n texCoords[newIndex * 2 + 1] = v2;\n normals[newIndex * 3 + 0] = normal.x;\n normals[newIndex * 3 + 1] = normal.y;\n normals[newIndex * 3 + 2] = normal.z;\n\n positions.push(positions[in3 + 0], positions[in3 + 1], positions[in3 + 2]);\n newIndex = positions.length / 3 - 1;\n indices.push(newIndex);\n texCoords[newIndex * 2 + 0] = 1;\n texCoords[newIndex * 2 + 1] = v3;\n normals[newIndex * 3 + 0] = normal.x;\n normals[newIndex * 3 + 1] = normal.y;\n normals[newIndex * 3 + 2] = normal.z;\n }\n\n normals[in1 + 0] = normals[in2 + 0] = normals[in3 + 0] = normal.x;\n normals[in1 + 1] = normals[in2 + 1] = normals[in3 + 1] = normal.y;\n normals[in1 + 2] = normals[in2 + 2] = normals[in3 + 2] = normal.z;\n\n texCoords[iu1 + 0] = u1;\n texCoords[iu1 + 1] = v1;\n\n texCoords[iu2 + 0] = u2;\n texCoords[iu2 + 1] = v2;\n\n texCoords[iu3 + 0] = u3;\n texCoords[iu3 + 1] = v3;\n }\n\n return {\n indices: {size: 1, value: new Uint16Array(indices)},\n attributes: {\n POSITION: {size: 3, value: new Float32Array(positions)},\n NORMAL: {size: 3, value: new Float32Array(normals)},\n TEXCOORD_0: {size: 2, value: new Float32Array(texCoords)}\n }\n };\n}\n"],"mappings":"AAAA,SAAQA,GAAG,QAAO,cAAc;AAChC,SAAQC,OAAO,QAAO,eAAe;AAAC,OAC/BC,QAAQ;AAIf,MAAMC,aAAa,GAAG,CAAC,CAA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;MAACuE,IAAI,EAAE,CAAC;MAAEC,KAAK,EAAE,IAAIC,WAAW,CAACzE,OAAO;IAAC,CAAC;IACnDC,UAAU,EAAE;MACVyE,QAAQ,EAAE;QAACH,IAAI,EAAE,CAAC;QAAEC,KAAK,EAAE,IAAIG,YAAY,CAACpE,SAAS;MAAC,CAAC;MACvDqE,MAAM,EAAE;QAACL,IAAI,EAAE,CAAC;QAAEC,KAAK,EAAE,IAAIG,YAAY,CAACzC,OAAO;MAAC,CAAC;MACnD2C,UAAU,EAAE;QAACN,IAAI,EAAE,CAAC;QAAEC,KAAK,EAAE,IAAIG,YAAY,CAACvC,SAAS;MAAC;IAC1D;EACF,CAAC;AACH"}
@@ -1,5 +1,5 @@
1
1
  import Geometry from '../geometry/geometry';
2
- export type PlaneGeometryProps = {
2
+ export declare type PlaneGeometryProps = {
3
3
  id?: string;
4
4
  radius?: number;
5
5
  attributes?: any;
@@ -1 +1 @@
1
- {"version":3,"file":"plane-geometry.d.ts","sourceRoot":"","sources":["../../src/geometries/plane-geometry.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAG5C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,GAAG,CAAA;CACjB,CAAC;AAKF,qBAAa,aAAc,SAAQ,QAAQ;gBAC7B,KAAK,GAAE,kBAAuB;CAW3C"}
1
+ {"version":3,"file":"plane-geometry.d.ts","sourceRoot":"","sources":["../../src/geometries/plane-geometry.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAG5C,oBAAY,kBAAkB,GAAG;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,GAAG,CAAA;CACjB,CAAC;AAKF,qBAAa,aAAc,SAAQ,QAAQ;gBAC7B,KAAK,GAAE,kBAAuB;CAW3C"}
@@ -1,101 +1,119 @@
1
1
  import { uid } from '@luma.gl/api';
2
- import Geometry from '../geometry/geometry.js';
3
- import { unpackIndexedGeometry } from '../geometry/geometry-utils.js';
4
- // Primitives inspired by TDL http://code.google.com/p/webglsamples/,
5
- // copyright 2011 Google Inc. new BSD License
6
- // (http://www.opensource.org/licenses/bsd-license.php).
2
+ import Geometry from "../geometry/geometry.js";
3
+ import { unpackIndexedGeometry } from "../geometry/geometry-utils.js";
7
4
  export class PlaneGeometry extends Geometry {
8
- constructor(props = {}) {
9
- const { id = uid('plane-geometry') } = props;
10
- const { indices, attributes } = tesselatePlane(props);
11
- super({
12
- ...props,
13
- id,
14
- indices,
15
- attributes: { ...attributes, ...props.attributes }
16
- });
17
- }
5
+ constructor() {
6
+ let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
+ const {
8
+ id = uid('plane-geometry')
9
+ } = props;
10
+ const {
11
+ indices,
12
+ attributes
13
+ } = tesselatePlane(props);
14
+ super({
15
+ ...props,
16
+ id,
17
+ indices,
18
+ attributes: {
19
+ ...attributes,
20
+ ...props.attributes
21
+ }
22
+ });
23
+ }
18
24
  }
19
- /* eslint-disable complexity, max-statements */
20
25
  function tesselatePlane(props) {
21
- const { type = 'x,y', offset = 0, flipCull = false, unpack = false } = props;
22
- const coords = type.split(',');
23
- // width, height
24
- let c1len = props[`${coords[0]}len`] || 1;
25
- const c2len = props[`${coords[1]}len`] || 1;
26
- // subdivisionsWidth, subdivisionsDepth
27
- const subdivisions1 = props[`n${coords[0]}`] || 1;
28
- const subdivisions2 = props[`n${coords[1]}`] || 1;
29
- const numVertices = (subdivisions1 + 1) * (subdivisions2 + 1);
30
- const positions = new Float32Array(numVertices * 3);
31
- const normals = new Float32Array(numVertices * 3);
32
- const texCoords = new Float32Array(numVertices * 2);
33
- if (flipCull) {
34
- c1len = -c1len;
26
+ const {
27
+ type = 'x,y',
28
+ offset = 0,
29
+ flipCull = false,
30
+ unpack = false
31
+ } = props;
32
+ const coords = type.split(',');
33
+ let c1len = props["".concat(coords[0], "len")] || 1;
34
+ const c2len = props["".concat(coords[1], "len")] || 1;
35
+ const subdivisions1 = props["n".concat(coords[0])] || 1;
36
+ const subdivisions2 = props["n".concat(coords[1])] || 1;
37
+ const numVertices = (subdivisions1 + 1) * (subdivisions2 + 1);
38
+ const positions = new Float32Array(numVertices * 3);
39
+ const normals = new Float32Array(numVertices * 3);
40
+ const texCoords = new Float32Array(numVertices * 2);
41
+ if (flipCull) {
42
+ c1len = -c1len;
43
+ }
44
+ let i2 = 0;
45
+ let i3 = 0;
46
+ for (let z = 0; z <= subdivisions2; z++) {
47
+ for (let x = 0; x <= subdivisions1; x++) {
48
+ const u = x / subdivisions1;
49
+ const v = z / subdivisions2;
50
+ texCoords[i2 + 0] = flipCull ? 1 - u : u;
51
+ texCoords[i2 + 1] = v;
52
+ switch (type) {
53
+ case 'x,y':
54
+ positions[i3 + 0] = c1len * u - c1len * 0.5;
55
+ positions[i3 + 1] = c2len * v - c2len * 0.5;
56
+ positions[i3 + 2] = offset;
57
+ normals[i3 + 0] = 0;
58
+ normals[i3 + 1] = 0;
59
+ normals[i3 + 2] = flipCull ? 1 : -1;
60
+ break;
61
+ case 'x,z':
62
+ positions[i3 + 0] = c1len * u - c1len * 0.5;
63
+ positions[i3 + 1] = offset;
64
+ positions[i3 + 2] = c2len * v - c2len * 0.5;
65
+ normals[i3 + 0] = 0;
66
+ normals[i3 + 1] = flipCull ? 1 : -1;
67
+ normals[i3 + 2] = 0;
68
+ break;
69
+ case 'y,z':
70
+ positions[i3 + 0] = offset;
71
+ positions[i3 + 1] = c1len * u - c1len * 0.5;
72
+ positions[i3 + 2] = c2len * v - c2len * 0.5;
73
+ normals[i3 + 0] = flipCull ? 1 : -1;
74
+ normals[i3 + 1] = 0;
75
+ normals[i3 + 2] = 0;
76
+ break;
77
+ default:
78
+ throw new Error('PlaneGeometry: unknown type');
79
+ }
80
+ i2 += 2;
81
+ i3 += 3;
35
82
  }
36
- let i2 = 0;
37
- let i3 = 0;
38
- for (let z = 0; z <= subdivisions2; z++) {
39
- for (let x = 0; x <= subdivisions1; x++) {
40
- const u = x / subdivisions1;
41
- const v = z / subdivisions2;
42
- texCoords[i2 + 0] = flipCull ? 1 - u : u;
43
- texCoords[i2 + 1] = v;
44
- switch (type) {
45
- case 'x,y':
46
- positions[i3 + 0] = c1len * u - c1len * 0.5;
47
- positions[i3 + 1] = c2len * v - c2len * 0.5;
48
- positions[i3 + 2] = offset;
49
- normals[i3 + 0] = 0;
50
- normals[i3 + 1] = 0;
51
- normals[i3 + 2] = flipCull ? 1 : -1;
52
- break;
53
- case 'x,z':
54
- positions[i3 + 0] = c1len * u - c1len * 0.5;
55
- positions[i3 + 1] = offset;
56
- positions[i3 + 2] = c2len * v - c2len * 0.5;
57
- normals[i3 + 0] = 0;
58
- normals[i3 + 1] = flipCull ? 1 : -1;
59
- normals[i3 + 2] = 0;
60
- break;
61
- case 'y,z':
62
- positions[i3 + 0] = offset;
63
- positions[i3 + 1] = c1len * u - c1len * 0.5;
64
- positions[i3 + 2] = c2len * v - c2len * 0.5;
65
- normals[i3 + 0] = flipCull ? 1 : -1;
66
- normals[i3 + 1] = 0;
67
- normals[i3 + 2] = 0;
68
- break;
69
- default:
70
- throw new Error('PlaneGeometry: unknown type');
71
- }
72
- i2 += 2;
73
- i3 += 3;
74
- }
83
+ }
84
+ const numVertsAcross = subdivisions1 + 1;
85
+ const indices = new Uint16Array(subdivisions1 * subdivisions2 * 6);
86
+ for (let z = 0; z < subdivisions2; z++) {
87
+ for (let x = 0; x < subdivisions1; x++) {
88
+ const index = (z * subdivisions1 + x) * 6;
89
+ indices[index + 0] = (z + 0) * numVertsAcross + x;
90
+ indices[index + 1] = (z + 1) * numVertsAcross + x;
91
+ indices[index + 2] = (z + 0) * numVertsAcross + x + 1;
92
+ indices[index + 3] = (z + 1) * numVertsAcross + x;
93
+ indices[index + 4] = (z + 1) * numVertsAcross + x + 1;
94
+ indices[index + 5] = (z + 0) * numVertsAcross + x + 1;
75
95
  }
76
- const numVertsAcross = subdivisions1 + 1;
77
- const indices = new Uint16Array(subdivisions1 * subdivisions2 * 6);
78
- for (let z = 0; z < subdivisions2; z++) {
79
- for (let x = 0; x < subdivisions1; x++) {
80
- const index = (z * subdivisions1 + x) * 6;
81
- // Make triangle 1 of quad.
82
- indices[index + 0] = (z + 0) * numVertsAcross + x;
83
- indices[index + 1] = (z + 1) * numVertsAcross + x;
84
- indices[index + 2] = (z + 0) * numVertsAcross + x + 1;
85
- // Make triangle 2 of quad.
86
- indices[index + 3] = (z + 1) * numVertsAcross + x;
87
- indices[index + 4] = (z + 1) * numVertsAcross + x + 1;
88
- indices[index + 5] = (z + 0) * numVertsAcross + x + 1;
89
- }
96
+ }
97
+ const geometry = {
98
+ indices: {
99
+ size: 1,
100
+ value: indices
101
+ },
102
+ attributes: {
103
+ POSITION: {
104
+ size: 3,
105
+ value: positions
106
+ },
107
+ NORMAL: {
108
+ size: 3,
109
+ value: normals
110
+ },
111
+ TEXCOORD_0: {
112
+ size: 2,
113
+ value: texCoords
114
+ }
90
115
  }
91
- const geometry = {
92
- indices: { size: 1, value: indices },
93
- attributes: {
94
- POSITION: { size: 3, value: positions },
95
- NORMAL: { size: 3, value: normals },
96
- TEXCOORD_0: { size: 2, value: texCoords }
97
- }
98
- };
99
- // Optionally, unpack indexed geometry
100
- return unpack ? unpackIndexedGeometry(geometry) : geometry;
116
+ };
117
+ return unpack ? unpackIndexedGeometry(geometry) : geometry;
101
118
  }
119
+ //# sourceMappingURL=plane-geometry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plane-geometry.js","names":["uid","Geometry","unpackIndexedGeometry","PlaneGeometry","constructor","props","arguments","length","undefined","id","indices","attributes","tesselatePlane","type","offset","flipCull","unpack","coords","split","c1len","concat","c2len","subdivisions1","subdivisions2","numVertices","positions","Float32Array","normals","texCoords","i2","i3","z","x","u","v","Error","numVertsAcross","Uint16Array","index","geometry","size","value","POSITION","NORMAL","TEXCOORD_0"],"sources":["../../src/geometries/plane-geometry.ts"],"sourcesContent":["import {uid} from '@luma.gl/api';\nimport Geometry from '../geometry/geometry';\nimport {unpackIndexedGeometry} from '../geometry/geometry-utils';\n\nexport type PlaneGeometryProps = {\n id?: string;\n radius?: number;\n attributes?: any\n};\n\n// Primitives inspired by TDL http://code.google.com/p/webglsamples/,\n// copyright 2011 Google Inc. new BSD License\n// (http://www.opensource.org/licenses/bsd-license.php).\nexport class PlaneGeometry extends Geometry {\n constructor(props: PlaneGeometryProps = {}) {\n const {id = uid('plane-geometry')} = props;\n\n const {indices, attributes} = tesselatePlane(props);\n super({\n ...props,\n id,\n indices,\n attributes: {...attributes, ...props.attributes}\n });\n }\n}\n\n/* eslint-disable complexity, max-statements */\nfunction tesselatePlane(props: any) {\n const {type = 'x,y', offset = 0, flipCull = false, unpack = false} = props;\n\n const coords = type.split(',');\n // width, height\n let c1len = props[`${coords[0]}len`] || 1;\n const c2len = props[`${coords[1]}len`] || 1;\n // subdivisionsWidth, subdivisionsDepth\n const subdivisions1 = props[`n${coords[0]}`] || 1;\n const subdivisions2 = props[`n${coords[1]}`] || 1;\n const numVertices = (subdivisions1 + 1) * (subdivisions2 + 1);\n\n const positions = new Float32Array(numVertices * 3);\n const normals = new Float32Array(numVertices * 3);\n const texCoords = new Float32Array(numVertices * 2);\n\n if (flipCull) {\n c1len = -c1len;\n }\n\n let i2 = 0;\n let i3 = 0;\n for (let z = 0; z <= subdivisions2; z++) {\n for (let x = 0; x <= subdivisions1; x++) {\n const u = x / subdivisions1;\n const v = z / subdivisions2;\n texCoords[i2 + 0] = flipCull ? 1 - u : u;\n texCoords[i2 + 1] = v;\n\n switch (type) {\n case 'x,y':\n positions[i3 + 0] = c1len * u - c1len * 0.5;\n positions[i3 + 1] = c2len * v - c2len * 0.5;\n positions[i3 + 2] = offset;\n\n normals[i3 + 0] = 0;\n normals[i3 + 1] = 0;\n normals[i3 + 2] = flipCull ? 1 : -1;\n break;\n\n case 'x,z':\n positions[i3 + 0] = c1len * u - c1len * 0.5;\n positions[i3 + 1] = offset;\n positions[i3 + 2] = c2len * v - c2len * 0.5;\n\n normals[i3 + 0] = 0;\n normals[i3 + 1] = flipCull ? 1 : -1;\n normals[i3 + 2] = 0;\n break;\n\n case 'y,z':\n positions[i3 + 0] = offset;\n positions[i3 + 1] = c1len * u - c1len * 0.5;\n positions[i3 + 2] = c2len * v - c2len * 0.5;\n\n normals[i3 + 0] = flipCull ? 1 : -1;\n normals[i3 + 1] = 0;\n normals[i3 + 2] = 0;\n break;\n\n default:\n throw new Error('PlaneGeometry: unknown type');\n }\n\n i2 += 2;\n i3 += 3;\n }\n }\n\n const numVertsAcross = subdivisions1 + 1;\n const indices = new Uint16Array(subdivisions1 * subdivisions2 * 6);\n\n for (let z = 0; z < subdivisions2; z++) {\n for (let x = 0; x < subdivisions1; x++) {\n const index = (z * subdivisions1 + x) * 6;\n // Make triangle 1 of quad.\n indices[index + 0] = (z + 0) * numVertsAcross + x;\n indices[index + 1] = (z + 1) * numVertsAcross + x;\n indices[index + 2] = (z + 0) * numVertsAcross + x + 1;\n\n // Make triangle 2 of quad.\n indices[index + 3] = (z + 1) * numVertsAcross + x;\n indices[index + 4] = (z + 1) * numVertsAcross + x + 1;\n indices[index + 5] = (z + 0) * numVertsAcross + x + 1;\n }\n }\n\n const geometry = {\n indices: {size: 1, value: indices},\n attributes: {\n POSITION: {size: 3, value: positions},\n NORMAL: {size: 3, value: normals},\n TEXCOORD_0: {size: 2, value: texCoords}\n }\n };\n\n // Optionally, unpack indexed geometry\n return unpack ? unpackIndexedGeometry(geometry) : geometry;\n}\n"],"mappings":"AAAA,SAAQA,GAAG,QAAO,cAAc;AAAC,OAC1BC,QAAQ;AAAA,SACPC,qBAAqB;AAW7B,OAAO,MAAMC,aAAa,SAASF,QAAQ,CAAC;EAC1CG,WAAWA,CAAA,EAAiC;IAAA,IAAhCC,KAAyB,GAAA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1,5 @@
1
1
  import Geometry from '../geometry/geometry';
2
- export type SphereGeometryProps = {
2
+ export declare type SphereGeometryProps = {
3
3
  id?: string;
4
4
  radius?: number;
5
5
  nlat?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"sphere-geometry.d.ts","sourceRoot":"","sources":["../../src/geometries/sphere-geometry.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAE5C,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,GAAG,CAAA;CACjB,CAAC;AAKF,qBAAa,cAAe,SAAQ,QAAQ;gBAC9B,KAAK,GAAE,mBAAwB;CAU5C"}
1
+ {"version":3,"file":"sphere-geometry.d.ts","sourceRoot":"","sources":["../../src/geometries/sphere-geometry.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAE5C,oBAAY,mBAAmB,GAAG;IAChC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,GAAG,CAAA;CACjB,CAAC;AAKF,qBAAa,cAAe,SAAQ,QAAQ;gBAC9B,KAAK,GAAE,mBAAwB;CAU5C"}