@loaders.gl/math 4.0.0-alpha.4 → 4.0.0-alpha.5
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.
- package/dist/geometry/attributes/compute-bounding-box.d.ts +10 -0
- package/dist/geometry/attributes/compute-bounding-box.d.ts.map +1 -0
- package/dist/geometry/attributes/compute-bounding-sphere.d.ts +29 -0
- package/dist/geometry/attributes/compute-bounding-sphere.d.ts.map +1 -0
- package/dist/geometry/attributes/compute-tangents.d.ts +1 -0
- package/dist/geometry/attributes/compute-tangents.d.ts.map +1 -0
- package/dist/geometry/attributes/compute-vertex-normals.d.ts +17 -0
- package/dist/geometry/attributes/compute-vertex-normals.d.ts.map +1 -0
- package/dist/geometry/attributes/convert-to-non-indexed.d.ts +11 -0
- package/dist/geometry/attributes/convert-to-non-indexed.d.ts.map +1 -0
- package/dist/geometry/attributes/get-attribute-from-geometry.d.ts +8 -0
- package/dist/geometry/attributes/get-attribute-from-geometry.d.ts.map +1 -0
- package/dist/geometry/attributes/normalize.d.ts +8 -0
- package/dist/geometry/attributes/normalize.d.ts.map +1 -0
- package/dist/geometry/colors/rgb565.d.ts +14 -0
- package/dist/geometry/colors/rgb565.d.ts.map +1 -0
- package/dist/geometry/compression/attribute-compression.d.ts +160 -0
- package/dist/geometry/compression/attribute-compression.d.ts.map +1 -0
- package/dist/geometry/constants.d.ts +44 -0
- package/dist/geometry/constants.d.ts.map +1 -0
- package/dist/geometry/gl/gl-type.d.ts +38 -0
- package/dist/geometry/gl/gl-type.d.ts.map +1 -0
- package/dist/geometry/is-geometry.d.ts +6 -0
- package/dist/geometry/is-geometry.d.ts.map +1 -0
- package/dist/geometry/iterators/attribute-iterator.d.ts +7 -0
- package/dist/geometry/iterators/attribute-iterator.d.ts.map +1 -0
- package/dist/geometry/iterators/primitive-iterator.d.ts +16 -0
- package/dist/geometry/iterators/primitive-iterator.d.ts.map +1 -0
- package/dist/geometry/primitives/modes.d.ts +22 -0
- package/dist/geometry/primitives/modes.d.ts.map +1 -0
- package/dist/geometry/typed-arrays/typed-array-utils.d.ts +7 -0
- package/dist/geometry/typed-arrays/typed-array-utils.d.ts.map +1 -0
- package/dist/geometry/types.d.ts +13 -0
- package/dist/geometry/types.d.ts.map +1 -0
- package/dist/geometry/utils/assert.d.ts +7 -0
- package/dist/geometry/utils/assert.d.ts.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/utils/assert.d.ts +2 -0
- package/dist/utils/assert.d.ts.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Getting bounding box geometry according to positions parameters
|
|
3
|
+
* @param positions
|
|
4
|
+
* @returns Bounding Box
|
|
5
|
+
*/
|
|
6
|
+
export declare function computeBoundingBox(positions?: any): {
|
|
7
|
+
min: number[];
|
|
8
|
+
max: number[];
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=compute-bounding-box.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compute-bounding-box.d.ts","sourceRoot":"","sources":["../../../src/geometry/attributes/compute-bounding-box.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,GAAE,GAAQ;;;EAqBrD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
import {getPositions} from './get-attribute-from-geometry';
|
|
3
|
+
|
|
4
|
+
export function computeBoundingSphere(geometry: any, boundingBox: object, vector: Vector3 ) {
|
|
5
|
+
const positions = getPositions(geometry);
|
|
6
|
+
|
|
7
|
+
const center = getBoundingBox(center);
|
|
8
|
+
box.setFromBufferAttribute(position);
|
|
9
|
+
box.getCenter(center);
|
|
10
|
+
|
|
11
|
+
// hoping to find a boundingSphere with a radius smaller than the
|
|
12
|
+
// boundingSphere of the boundingBox: sqrt(3) smaller in the best case
|
|
13
|
+
|
|
14
|
+
var maxRadiusSq = 0;
|
|
15
|
+
|
|
16
|
+
for (const position of makeAttributeIterator(positions)) {
|
|
17
|
+
vector.x = position[0];
|
|
18
|
+
vector.y = position[1];
|
|
19
|
+
vector.z = position[2];
|
|
20
|
+
maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(vector));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const radius = Math.sqrt(maxRadiusSq);
|
|
24
|
+
assert(Number.isFinite(radius));
|
|
25
|
+
|
|
26
|
+
return {center, radius};
|
|
27
|
+
}
|
|
28
|
+
*/
|
|
29
|
+
//# sourceMappingURL=compute-bounding-sphere.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compute-bounding-sphere.d.ts","sourceRoot":"","sources":["../../../src/geometry/attributes/compute-bounding-sphere.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=compute-tangents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compute-tangents.d.ts","sourceRoot":"","sources":["../../../src/geometry/attributes/compute-tangents.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TypedArray } from '../types';
|
|
2
|
+
declare type Geometry = {
|
|
3
|
+
mode: any;
|
|
4
|
+
indices?: {
|
|
5
|
+
size: number;
|
|
6
|
+
values: TypedArray;
|
|
7
|
+
};
|
|
8
|
+
attributes?: {};
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Computes vertex normals for a geometry
|
|
12
|
+
* @param param0
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
export declare function computeVertexNormals(geometry: Geometry): Float32Array;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=compute-vertex-normals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compute-vertex-normals.d.ts","sourceRoot":"","sources":["../../../src/geometry/attributes/compute-vertex-normals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAQzC,aAAK,QAAQ,GAAG;IACd,IAAI,EAAE,GAAG,CAAC;IACV,OAAO,CAAC,EAAE;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,UAAU,CAAA;KAAC,CAAC;IAC7C,UAAU,CAAC,EAAE,EAAE,CAAC;CACjB,CAAC;AACF;;;;GAIG;AAEH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,GAAG,YAAY,CAyCrE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts indices of geometry.
|
|
3
|
+
*
|
|
4
|
+
* @param param0
|
|
5
|
+
* @returns no indexed geometry
|
|
6
|
+
*/
|
|
7
|
+
export declare function convertBuffersToNonIndexed({ indices, attributes }: {
|
|
8
|
+
indices: any;
|
|
9
|
+
attributes: any;
|
|
10
|
+
}): any;
|
|
11
|
+
//# sourceMappingURL=convert-to-non-indexed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert-to-non-indexed.d.ts","sourceRoot":"","sources":["../../../src/geometry/attributes/convert-to-non-indexed.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,EAAC,OAAO,EAAE,UAAU,EAAC;;;CAAA,GAAG,GAAG,CA2BrE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-attribute-from-geometry.d.ts","sourceRoot":"","sources":["../../../src/geometry/attributes/get-attribute-from-geometry.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AAEH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,GAAG,OAqBzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../src/geometry/attributes/normalize.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AAEtC;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,OAAO,KAAU,EAAE,MAAM,EAAE,OAAO,QAU3D"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decode color values
|
|
3
|
+
* @param rgb565
|
|
4
|
+
* @param target
|
|
5
|
+
* @returns target
|
|
6
|
+
*/
|
|
7
|
+
export declare function decodeRGB565(rgb565: number, target?: number[]): number[];
|
|
8
|
+
/**
|
|
9
|
+
* Encode color values
|
|
10
|
+
* @param rgb
|
|
11
|
+
* @returns color
|
|
12
|
+
*/
|
|
13
|
+
export declare function encodeRGB565(rgb: number[]): number;
|
|
14
|
+
//# sourceMappingURL=rgb565.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rgb565.d.ts","sourceRoot":"","sources":["../../../src/geometry/colors/rgb565.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,EAAc,GAAG,MAAM,EAAE,CAUnF;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,CAKlD"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { Vector2, Vector3 } from '@math.gl/core';
|
|
2
|
+
import { Vector4 } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Encodes a normalized vector into 2 SNORM values in the range of [0-rangeMax] following the 'oct' encoding.
|
|
5
|
+
*
|
|
6
|
+
* Oct encoding is a compact representation of unit length vectors.
|
|
7
|
+
* The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors",
|
|
8
|
+
* Cigolle et al 2014: {@link http://jcgt.org/published/0003/02/01/}
|
|
9
|
+
*
|
|
10
|
+
* @param vector The normalized vector to be compressed into 2 component 'oct' encoding.
|
|
11
|
+
* @param result The 2 component oct-encoded unit length vector.
|
|
12
|
+
* @param rangeMax The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits.
|
|
13
|
+
* @returns The 2 component oct-encoded unit length vector.
|
|
14
|
+
*
|
|
15
|
+
* @exception vector must be normalized.
|
|
16
|
+
*
|
|
17
|
+
* @see octDecodeInRange
|
|
18
|
+
*/
|
|
19
|
+
export declare function octEncodeInRange(vector: Vector3, rangeMax: number, result: Vector2): Vector2;
|
|
20
|
+
/**
|
|
21
|
+
* Encodes a normalized vector into 2 SNORM values in the range of [0-255] following the 'oct' encoding.
|
|
22
|
+
*
|
|
23
|
+
* @param vector The normalized vector to be compressed into 2 byte 'oct' encoding.
|
|
24
|
+
* @param result The 2 byte oct-encoded unit length vector.
|
|
25
|
+
* @returns he 2 byte oct-encoded unit length vector.
|
|
26
|
+
*
|
|
27
|
+
* @exception vector must be normalized.
|
|
28
|
+
*
|
|
29
|
+
* @see octEncodeInRange
|
|
30
|
+
* @see octDecode
|
|
31
|
+
*/
|
|
32
|
+
export declare function octEncode(vector: Vector3, result: Vector2): Vector2;
|
|
33
|
+
/**
|
|
34
|
+
* Encodes a normalized vector into 4-byte vector
|
|
35
|
+
* @param vector The normalized vector to be compressed into 4 byte 'oct' encoding.
|
|
36
|
+
* @param result The 4 byte oct-encoded unit length vector.
|
|
37
|
+
* @returns The 4 byte oct-encoded unit length vector.
|
|
38
|
+
*
|
|
39
|
+
* @exception vector must be normalized.
|
|
40
|
+
*
|
|
41
|
+
* @see octEncodeInRange
|
|
42
|
+
* @see octDecodeFromVector4
|
|
43
|
+
*/
|
|
44
|
+
export declare function octEncodeToVector4(vector: Vector3, result: Vector4): Vector4;
|
|
45
|
+
/**
|
|
46
|
+
* Decodes a unit-length vector in 'oct' encoding to a normalized 3-component vector.
|
|
47
|
+
*
|
|
48
|
+
* @param x The x component of the oct-encoded unit length vector.
|
|
49
|
+
* @param y The y component of the oct-encoded unit length vector.
|
|
50
|
+
* @param rangeMax The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits.
|
|
51
|
+
* @param result The decoded and normalized vector
|
|
52
|
+
* @returns The decoded and normalized vector.
|
|
53
|
+
*
|
|
54
|
+
* @exception x and y must be unsigned normalized integers between 0 and rangeMax.
|
|
55
|
+
*
|
|
56
|
+
* @see octEncodeInRange
|
|
57
|
+
*/
|
|
58
|
+
export declare function octDecodeInRange(x: number, y: number, rangeMax: number, result: Vector3): Vector3;
|
|
59
|
+
/**
|
|
60
|
+
* Decodes a unit-length vector in 2 byte 'oct' encoding to a normalized 3-component vector.
|
|
61
|
+
*
|
|
62
|
+
* @param x The x component of the oct-encoded unit length vector.
|
|
63
|
+
* @param y The y component of the oct-encoded unit length vector.
|
|
64
|
+
* @param result The decoded and normalized vector.
|
|
65
|
+
* @returns he decoded and normalized vector.
|
|
66
|
+
*
|
|
67
|
+
* @exception x and y must be an unsigned normalized integer between 0 and 255.
|
|
68
|
+
*
|
|
69
|
+
* @see octDecodeInRange
|
|
70
|
+
*/
|
|
71
|
+
export declare function octDecode(x: number, y: number, result: Vector3): Vector3;
|
|
72
|
+
/**
|
|
73
|
+
* Decodes a unit-length vector in 4 byte 'oct' encoding to a normalized 3-component vector.
|
|
74
|
+
*
|
|
75
|
+
* @param encoded The oct-encoded unit length vector.
|
|
76
|
+
* @param esult The decoded and normalized vector.
|
|
77
|
+
* @returns The decoded and normalized vector.
|
|
78
|
+
*
|
|
79
|
+
* @exception x, y, z, and w must be unsigned normalized integers between 0 and 255.
|
|
80
|
+
*
|
|
81
|
+
* @see octDecodeInRange
|
|
82
|
+
* @see octEncodeToVector4
|
|
83
|
+
*/
|
|
84
|
+
export declare function octDecodeFromVector4(encoded: Vector4, result: Vector3): Vector3;
|
|
85
|
+
/**
|
|
86
|
+
* Packs an oct encoded vector into a single floating-point number.
|
|
87
|
+
*
|
|
88
|
+
* @param encoded The oct encoded vector.
|
|
89
|
+
* @returns The oct encoded vector packed into a single float.
|
|
90
|
+
*
|
|
91
|
+
*/
|
|
92
|
+
export declare function octPackFloat(encoded: Vector2): number;
|
|
93
|
+
/**
|
|
94
|
+
* Encodes a normalized vector into 2 SNORM values in the range of [0-255] following the 'oct' encoding and
|
|
95
|
+
* stores those values in a single float-point number.
|
|
96
|
+
*
|
|
97
|
+
* @param vector The normalized vector to be compressed into 2 byte 'oct' encoding.
|
|
98
|
+
* @returns The 2 byte oct-encoded unit length vector.
|
|
99
|
+
*
|
|
100
|
+
* @exception vector must be normalized.
|
|
101
|
+
*/
|
|
102
|
+
export declare function octEncodeFloat(vector: Vector3): number;
|
|
103
|
+
/**
|
|
104
|
+
* Decodes a unit-length vector in 'oct' encoding packed in a floating-point number to a normalized 3-component vector.
|
|
105
|
+
*
|
|
106
|
+
* @param value The oct-encoded unit length vector stored as a single floating-point number.
|
|
107
|
+
* @param result The decoded and normalized vector
|
|
108
|
+
* @returns The decoded and normalized vector.
|
|
109
|
+
*
|
|
110
|
+
*/
|
|
111
|
+
export declare function octDecodeFloat(value: number, result: Vector3): Vector3;
|
|
112
|
+
/**
|
|
113
|
+
* Encodes three normalized vectors into 6 SNORM values in the range of [0-255] following the 'oct' encoding and
|
|
114
|
+
* packs those into two floating-point numbers.
|
|
115
|
+
*
|
|
116
|
+
* @param v1 A normalized vector to be compressed.
|
|
117
|
+
* @param v2 A normalized vector to be compressed.
|
|
118
|
+
* @param v3 A normalized vector to be compressed.
|
|
119
|
+
* @param result The 'oct' encoded vectors packed into two floating-point numbers.
|
|
120
|
+
* @returns The 'oct' encoded vectors packed into two floating-point numbers.
|
|
121
|
+
*
|
|
122
|
+
*/
|
|
123
|
+
export declare function octPack(v1: Vector3, v2: Vector3, v3: Vector3, result: Vector2): Vector2;
|
|
124
|
+
/**
|
|
125
|
+
* Decodes three unit-length vectors in 'oct' encoding packed into a floating-point number to a normalized 3-component vector.
|
|
126
|
+
*
|
|
127
|
+
* @param packed The three oct-encoded unit length vectors stored as two floating-point number.
|
|
128
|
+
* @param v1 One decoded and normalized vector.
|
|
129
|
+
* @param v2 One decoded and normalized vector.
|
|
130
|
+
* @param v3 One decoded and normalized vector.
|
|
131
|
+
*/
|
|
132
|
+
export declare function octUnpack(packed: Vector2, v1: Vector3, v2: Vector3, v3: Vector3): void;
|
|
133
|
+
/**
|
|
134
|
+
* Pack texture coordinates into a single float. The texture coordinates will only preserve 12 bits of precision.
|
|
135
|
+
*
|
|
136
|
+
* @param textureCoordinates The texture coordinates to compress. Both coordinates must be in the range 0.0-1.0.
|
|
137
|
+
* @returns The packed texture coordinates.
|
|
138
|
+
*
|
|
139
|
+
*/
|
|
140
|
+
export declare function compressTextureCoordinates(textureCoordinates: Vector2): number;
|
|
141
|
+
/**
|
|
142
|
+
* Decompresses texture coordinates that were packed into a single float.
|
|
143
|
+
*
|
|
144
|
+
* @param compressed The compressed texture coordinates.
|
|
145
|
+
* @param result The decompressed texture coordinates.
|
|
146
|
+
* @returns The modified result parameter.
|
|
147
|
+
*
|
|
148
|
+
*/
|
|
149
|
+
export declare function decompressTextureCoordinates(compressed: number, result: Vector2): Vector2;
|
|
150
|
+
/**
|
|
151
|
+
* Decodes delta and ZigZag encoded vertices. This modifies the buffers in place.
|
|
152
|
+
*
|
|
153
|
+
* @param uBuffer The buffer view of u values.
|
|
154
|
+
* @param vBuffer The buffer view of v values.
|
|
155
|
+
* @param [heightBuffer] The buffer view of height values.
|
|
156
|
+
*
|
|
157
|
+
* @link https://github.com/AnalyticalGraphicsInc/quantized-mesh|quantized-mesh-1.0 terrain format
|
|
158
|
+
*/
|
|
159
|
+
export declare function zigZagDeltaDecode(uBuffer: Uint16Array, vBuffer: Uint16Array, heightBuffer?: Uint16Array | number[]): void;
|
|
160
|
+
//# sourceMappingURL=attribute-compression.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attribute-compression.d.ts","sourceRoot":"","sources":["../../../src/geometry/compression/attribute-compression.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,OAAO,EAAE,OAAO,EAAoB,MAAM,eAAe,CAAC;AAClE,OAAO,EAAC,OAAO,EAAC,MAAM,UAAU,CAAC;AA8DjC;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAsB5F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAEnE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAO5E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAiBjG;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAExE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAe/E;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAGrD;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAGtD;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAQtE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,OAAO,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAavF;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,GAAG,IAAI,CAYtF;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,kBAAkB,EAAE,OAAO,GAAG,MAAM,CAK9E;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAMzF;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,WAAW,EACpB,YAAY,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE,QA6BtC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export declare const GL_PRIMITIVE: {
|
|
2
|
+
POINTS: number;
|
|
3
|
+
LINES: number;
|
|
4
|
+
TRIANGLES: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const GL_PRIMITIVE_MODE: {
|
|
7
|
+
POINTS: number;
|
|
8
|
+
LINES: number;
|
|
9
|
+
LINE_LOOP: number;
|
|
10
|
+
LINE_STRIP: number;
|
|
11
|
+
TRIANGLES: number;
|
|
12
|
+
TRIANGLE_STRIP: number;
|
|
13
|
+
TRIANGLE_FAN: number;
|
|
14
|
+
};
|
|
15
|
+
declare type glType = {
|
|
16
|
+
BYTE: number;
|
|
17
|
+
UNSIGNED_BYTE: number;
|
|
18
|
+
SHORT: number;
|
|
19
|
+
UNSIGNED_SHORT: number;
|
|
20
|
+
INT: number;
|
|
21
|
+
UNSIGNED_INT: number;
|
|
22
|
+
FLOAT: number;
|
|
23
|
+
DOUBLE: number;
|
|
24
|
+
};
|
|
25
|
+
export declare const GL_TYPE: glType;
|
|
26
|
+
export declare const GL: {
|
|
27
|
+
BYTE: number;
|
|
28
|
+
UNSIGNED_BYTE: number;
|
|
29
|
+
SHORT: number;
|
|
30
|
+
UNSIGNED_SHORT: number;
|
|
31
|
+
INT: number;
|
|
32
|
+
UNSIGNED_INT: number;
|
|
33
|
+
FLOAT: number;
|
|
34
|
+
DOUBLE: number;
|
|
35
|
+
POINTS: number;
|
|
36
|
+
LINES: number;
|
|
37
|
+
LINE_LOOP: number;
|
|
38
|
+
LINE_STRIP: number;
|
|
39
|
+
TRIANGLES: number;
|
|
40
|
+
TRIANGLE_STRIP: number;
|
|
41
|
+
TRIANGLE_FAN: number;
|
|
42
|
+
};
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/geometry/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY;;;;CAIxB,CAAC;AAGF,eAAO,MAAM,iBAAiB;;;;;;;;CAS7B,CAAC;AAEF,aAAK,MAAM,GAAG;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,MASrB,CAAC;AAEF,eAAO,MAAM,EAAE;UArBP,MAAM;mBACG,MAAM;WACd,MAAM;oBACG,MAAM;SACjB,MAAM;kBACG,MAAM;WACb,MAAM;YACL,MAAM;;;;;;;;CAiBf,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { TypedArray } from '../types';
|
|
2
|
+
export default class GLType {
|
|
3
|
+
/**
|
|
4
|
+
* Returns the size, in bytes, of the corresponding datatype
|
|
5
|
+
* @param arrayOrType
|
|
6
|
+
* @returns glType a a string
|
|
7
|
+
*/
|
|
8
|
+
static fromTypedArray(arrayOrType: TypedArray | Function): string;
|
|
9
|
+
/**
|
|
10
|
+
* Extracts name for glType from array NAME_TO_GL_TYPE
|
|
11
|
+
* @param name
|
|
12
|
+
* @returns glType as a number
|
|
13
|
+
*/
|
|
14
|
+
static fromName(name: string): number;
|
|
15
|
+
static getArrayType(glType: number): Float64ArrayConstructor | Float32ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | Uint8ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor | Int32ArrayConstructor;
|
|
16
|
+
/**
|
|
17
|
+
* Returns the size in bytes of one element of the provided WebGL type
|
|
18
|
+
* @param glType
|
|
19
|
+
* @returns size of glType
|
|
20
|
+
*/
|
|
21
|
+
static getByteSize(glType: number): number;
|
|
22
|
+
/**
|
|
23
|
+
* Returns `true` if `glType` is a valid WebGL data type.
|
|
24
|
+
* @param glType
|
|
25
|
+
* @returns boolean
|
|
26
|
+
*/
|
|
27
|
+
static validate(glType: number): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Creates a typed view of an array of bytes
|
|
30
|
+
* @param glType The type of typed array (ArrayBuffer view) to create
|
|
31
|
+
* @param buffer The buffer storage to use for the view.
|
|
32
|
+
* @param byteOffset The offset, in bytes, to the first element in the view
|
|
33
|
+
* @param length The number of elements in the view. Defaults to buffer length
|
|
34
|
+
* @returns A typed array view of the buffer
|
|
35
|
+
*/
|
|
36
|
+
static createTypedArray(glType: number, buffer: TypedArray, byteOffset?: number, length?: number): TypedArray;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=gl-type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gl-type.d.ts","sourceRoot":"","sources":["../../../src/geometry/gl/gl-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AA6BpC,MAAM,CAAC,OAAO,OAAO,MAAM;IAGzB;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE,UAAU,GAAG,QAAQ,GAAG,MAAM;IAWjE;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IASrC,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM;IAmBlC;;;;OAIG;IACH,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAI1C;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAGxC;;;;;;;OAOG;IACH,MAAM,CAAC,gBAAgB,CACrB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,UAAU,EAClB,UAAU,GAAE,MAAU,EACtB,MAAM,CAAC,EAAE,MAAM,GACd,UAAU;CAOd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-geometry.d.ts","sourceRoot":"","sources":["../../src/geometry/is-geometry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,QAAQ,EAAE,GAAG,GAAG,OAAO,CAQzD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Iterates over a single attribute
|
|
3
|
+
* NOTE: For performance, re-yields the same modified element
|
|
4
|
+
* @param param0
|
|
5
|
+
*/
|
|
6
|
+
export declare function makeAttributeIterator(values: any, size: number): Iterable<any>;
|
|
7
|
+
//# sourceMappingURL=attribute-iterator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attribute-iterator.d.ts","sourceRoot":"","sources":["../../../src/geometry/iterators/attribute-iterator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAiB,qBAAqB,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,CAS/E"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Will iterate over each primitive, expanding (dereferencing) indices
|
|
3
|
+
* @param indices
|
|
4
|
+
* @param attributes
|
|
5
|
+
* @param mode
|
|
6
|
+
* @param start
|
|
7
|
+
* @param end
|
|
8
|
+
*/
|
|
9
|
+
export declare function makePrimitiveIterator(indices?: any, attributes?: object, mode?: number, start?: number, end?: number): Iterable<{
|
|
10
|
+
attributes: object;
|
|
11
|
+
type: number;
|
|
12
|
+
i1: number;
|
|
13
|
+
i2: number;
|
|
14
|
+
i3: number;
|
|
15
|
+
}>;
|
|
16
|
+
//# sourceMappingURL=primitive-iterator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primitive-iterator.d.ts","sourceRoot":"","sources":["../../../src/geometry/iterators/primitive-iterator.ts"],"names":[],"mappings":"AAeA;;;;;;;GAOG;AAEH,wBAAiB,qBAAqB,CACpC,OAAO,CAAC,EAAE,GAAG,EACb,UAAU,GAAE,MAAW,EACvB,IAAI,CAAC,EAAE,MAAM,EACb,KAAK,SAAI,EACT,GAAG,CAAC,EAAE,MAAM,GACX,QAAQ,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAC,CAAC,CA4ElF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Different methods of working with geometries depending on glType
|
|
3
|
+
/**
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param mode
|
|
7
|
+
* @returns draw points | lines | triangles
|
|
8
|
+
*/
|
|
9
|
+
export declare function getPrimitiveModeType(mode?: number): number;
|
|
10
|
+
/**
|
|
11
|
+
* @param mode
|
|
12
|
+
* @returns true | false
|
|
13
|
+
*/
|
|
14
|
+
export declare function isPrimitiveModeExpandable(mode: number): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Returns new length depends on glType
|
|
17
|
+
* @param mode
|
|
18
|
+
* @param length
|
|
19
|
+
* @returns new length
|
|
20
|
+
*/
|
|
21
|
+
export declare function getPrimitiveModeExpandedLength(mode: number, length: number): number;
|
|
22
|
+
//# sourceMappingURL=modes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modes.d.ts","sourceRoot":"","sources":["../../../src/geometry/primitives/modes.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAe1D;AACD;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAU/D;AACD;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAkBnF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typed-array-utils.d.ts","sourceRoot":"","sources":["../../../src/geometry/typed-arrays/typed-array-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,GAAE,GAAQ,GAAG,UAAU,CAgB9D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type for encoding to Vector4
|
|
3
|
+
*/
|
|
4
|
+
export declare type Vector4 = {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
z: number;
|
|
8
|
+
w: number;
|
|
9
|
+
};
|
|
10
|
+
export declare type TypedIntArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Int32Array | Uint32Array;
|
|
11
|
+
export declare type TypedFloatArray = Uint16Array | Float32Array | Float64Array;
|
|
12
|
+
export declare type TypedArray = TypedIntArray | TypedFloatArray;
|
|
13
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/geometry/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,OAAO,GAAG;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAGF,oBAAY,aAAa,GACrB,SAAS,GACT,UAAU,GACV,iBAAiB,GACjB,UAAU,GACV,WAAW,GACX,UAAU,GACV,WAAW,GACX,UAAU,GACV,WAAW,CAAC;AAEhB,oBAAY,eAAe,GAAG,WAAW,GAAG,YAAY,GAAG,YAAY,CAAC;AAExE,oBAAY,UAAU,GAAG,aAAa,GAAG,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../../src/geometry/utils/assert.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,SAAS,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,IAAI,CAI1D"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { GL } from './geometry/constants';
|
|
2
|
+
export { GL_TYPE } from './geometry/constants';
|
|
3
|
+
export { default as GLType } from './geometry/gl/gl-type';
|
|
4
|
+
export { default as isGeometry } from './geometry/is-geometry';
|
|
5
|
+
export { makeAttributeIterator } from './geometry/iterators/attribute-iterator';
|
|
6
|
+
export { makePrimitiveIterator } from './geometry/iterators/primitive-iterator';
|
|
7
|
+
export { computeVertexNormals } from './geometry/attributes/compute-vertex-normals';
|
|
8
|
+
export { encodeRGB565, decodeRGB565 } from './geometry/colors/rgb565';
|
|
9
|
+
export { concatTypedArrays } from './geometry/typed-arrays/typed-array-utils';
|
|
10
|
+
export { octEncodeInRange, octEncode, octEncodeToVector4, octDecodeInRange, octDecode, octDecodeFromVector4, octPackFloat, octEncodeFloat, octDecodeFloat, octPack, octUnpack, compressTextureCoordinates, decompressTextureCoordinates, zigZagDeltaDecode } from './geometry/compression/attribute-compression';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,EAAE,EAAC,MAAM,sBAAsB,CAAC;AAGxC,OAAO,EAAC,OAAO,EAAC,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAC,OAAO,IAAI,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAGxD,OAAO,EAAC,OAAO,IAAI,UAAU,EAAC,MAAM,wBAAwB,CAAC;AAG7D,OAAO,EAAC,qBAAqB,EAAC,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAC,qBAAqB,EAAC,MAAM,yCAAyC,CAAC;AAG9E,OAAO,EAAC,oBAAoB,EAAC,MAAM,8CAA8C,CAAC;AAElF,OAAO,EAAC,YAAY,EAAE,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAGpE,OAAO,EAAC,iBAAiB,EAAC,MAAM,2CAA2C,CAAC;AAG5E,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,kBAAkB,EAClB,gBAAgB,EAChB,SAAS,EACT,oBAAoB,EACpB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,OAAO,EACP,SAAS,EACT,0BAA0B,EAC1B,4BAA4B,EAC5B,iBAAiB,EAClB,MAAM,8CAA8C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../src/utils/assert.ts"],"names":[],"mappings":"AAGA,wBAAgB,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAIjE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/math",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.5",
|
|
4
4
|
"description": "Experimental math classes for loaders.gl",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"GLB",
|
|
18
18
|
"glTF"
|
|
19
19
|
],
|
|
20
|
-
"types": "
|
|
20
|
+
"types": "dist/index.d.ts",
|
|
21
21
|
"main": "dist/index.js",
|
|
22
22
|
"module": "dist/index.js",
|
|
23
23
|
"sideEffects": false,
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"pre-build": "echo \"Nothing to build in @loaders.gl/math\""
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@loaders.gl/images": "4.0.0-alpha.
|
|
35
|
-
"@loaders.gl/loader-utils": "4.0.0-alpha.
|
|
34
|
+
"@loaders.gl/images": "4.0.0-alpha.5",
|
|
35
|
+
"@loaders.gl/loader-utils": "4.0.0-alpha.5",
|
|
36
36
|
"@math.gl/core": "^3.5.1"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "7a71a54bdf1ddf985cc3af3db90b82e7fa97d025"
|
|
39
39
|
}
|