@loaders.gl/math 4.0.0-alpha.4 → 4.0.0-alpha.6
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/es5/geometry/attributes/compute-bounding-box.js +46 -0
- package/dist/es5/geometry/attributes/compute-bounding-box.js.map +1 -0
- package/dist/es5/geometry/attributes/compute-bounding-sphere.js +2 -0
- package/dist/es5/geometry/attributes/compute-bounding-sphere.js.map +1 -0
- package/dist/es5/geometry/attributes/compute-tangents.js +2 -0
- package/dist/es5/geometry/attributes/compute-tangents.js.map +1 -0
- package/dist/es5/geometry/attributes/compute-vertex-normals.js +56 -0
- package/dist/es5/geometry/attributes/compute-vertex-normals.js.map +1 -0
- package/dist/es5/geometry/attributes/convert-to-non-indexed.js +43 -0
- package/dist/es5/geometry/attributes/convert-to-non-indexed.js.map +1 -0
- package/dist/es5/geometry/attributes/get-attribute-from-geometry.js +29 -0
- package/dist/es5/geometry/attributes/get-attribute-from-geometry.js.map +1 -0
- package/dist/es5/geometry/attributes/normalize.js +19 -0
- package/dist/es5/geometry/attributes/normalize.js.map +1 -0
- package/dist/es5/geometry/colors/rgb565.js +24 -0
- package/dist/es5/geometry/colors/rgb565.js.map +1 -0
- package/dist/es5/geometry/compression/attribute-compression.js +178 -0
- package/dist/es5/geometry/compression/attribute-compression.js.map +1 -0
- package/dist/es5/geometry/constants.js +40 -0
- package/dist/es5/geometry/constants.js.map +1 -0
- package/dist/es5/geometry/gl/gl-type.js +92 -0
- package/dist/es5/geometry/gl/gl-type.js.map +1 -0
- package/dist/es5/geometry/is-geometry.js +12 -0
- package/dist/es5/geometry/is-geometry.js.map +1 -0
- package/dist/es5/geometry/iterators/attribute-iterator.js +38 -0
- package/dist/es5/geometry/iterators/attribute-iterator.js.map +1 -0
- package/dist/es5/geometry/iterators/primitive-iterator.js +102 -0
- package/dist/es5/geometry/iterators/primitive-iterator.js.map +1 -0
- package/dist/es5/geometry/primitives/modes.js +56 -0
- package/dist/es5/geometry/primitives/modes.js.map +1 -0
- package/dist/es5/geometry/typed-arrays/typed-array-utils.js +24 -0
- package/dist/es5/geometry/typed-arrays/typed-array-utils.js.map +1 -0
- package/dist/es5/geometry/utils/assert.js +12 -0
- package/dist/es5/geometry/utils/assert.js.map +1 -0
- package/dist/es5/index.js +160 -0
- package/dist/es5/index.js.map +1 -0
- package/dist/es5/utils/assert.js +12 -0
- package/dist/es5/utils/assert.js.map +1 -0
- package/dist/esm/geometry/attributes/compute-bounding-box.js +28 -0
- package/dist/esm/geometry/attributes/compute-bounding-box.js.map +1 -0
- package/dist/esm/geometry/attributes/compute-bounding-sphere.js +2 -0
- package/dist/esm/geometry/attributes/compute-bounding-sphere.js.map +1 -0
- package/dist/esm/geometry/attributes/compute-tangents.js +2 -0
- package/dist/esm/geometry/attributes/compute-tangents.js.map +1 -0
- package/dist/esm/geometry/attributes/compute-vertex-normals.js +41 -0
- package/dist/esm/geometry/attributes/compute-vertex-normals.js.map +1 -0
- package/dist/esm/geometry/attributes/convert-to-non-indexed.js +27 -0
- package/dist/esm/geometry/attributes/convert-to-non-indexed.js.map +1 -0
- package/dist/esm/geometry/attributes/get-attribute-from-geometry.js +24 -0
- package/dist/esm/geometry/attributes/get-attribute-from-geometry.js.map +1 -0
- package/dist/esm/geometry/attributes/normalize.js +13 -0
- package/dist/esm/geometry/attributes/normalize.js.map +1 -0
- package/dist/esm/geometry/colors/rgb565.js +17 -0
- package/dist/esm/geometry/colors/rgb565.js.map +1 -0
- package/dist/esm/geometry/compression/attribute-compression.js +159 -0
- package/dist/esm/geometry/compression/attribute-compression.js.map +1 -0
- package/dist/esm/geometry/constants.js +29 -0
- package/dist/esm/geometry/constants.js.map +1 -0
- package/dist/esm/geometry/gl/gl-type.js +72 -0
- package/dist/esm/geometry/gl/gl-type.js.map +1 -0
- package/dist/esm/geometry/is-geometry.js +4 -0
- package/dist/esm/geometry/is-geometry.js.map +1 -0
- package/dist/esm/geometry/iterators/attribute-iterator.js +11 -0
- package/dist/esm/geometry/iterators/attribute-iterator.js.map +1 -0
- package/dist/esm/geometry/iterators/primitive-iterator.js +76 -0
- package/dist/esm/geometry/iterators/primitive-iterator.js.map +1 -0
- package/dist/esm/geometry/primitives/modes.js +48 -0
- package/dist/esm/geometry/primitives/modes.js.map +1 -0
- package/dist/esm/geometry/typed-arrays/typed-array-utils.js +18 -0
- package/dist/esm/geometry/typed-arrays/typed-array-utils.js.map +1 -0
- package/dist/esm/geometry/utils/assert.js +6 -0
- package/dist/esm/geometry/utils/assert.js.map +1 -0
- package/dist/esm/index.js +11 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/utils/assert.js +6 -0
- package/dist/esm/utils/assert.js.map +1 -0
- 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-box.js +41 -27
- 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-bounding-sphere.js +29 -1
- 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-tangents.js +145 -1
- 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/compute-vertex-normals.js +47 -42
- 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/convert-to-non-indexed.js +31 -30
- 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/get-attribute-from-geometry.js +33 -26
- package/dist/geometry/attributes/normalize.d.ts +8 -0
- package/dist/geometry/attributes/normalize.d.ts.map +1 -0
- package/dist/geometry/attributes/normalize.js +19 -11
- package/dist/geometry/colors/rgb565.d.ts +14 -0
- package/dist/geometry/colors/rgb565.d.ts.map +1 -0
- package/dist/geometry/colors/rgb565.js +29 -14
- package/dist/geometry/compression/attribute-compression.d.ts +166 -0
- package/dist/geometry/compression/attribute-compression.d.ts.map +1 -0
- package/dist/geometry/compression/attribute-compression.js +339 -162
- package/dist/geometry/constants.d.ts +44 -0
- package/dist/geometry/constants.d.ts.map +1 -0
- package/dist/geometry/constants.js +30 -24
- package/dist/geometry/gl/gl-type.d.ts +38 -0
- package/dist/geometry/gl/gl-type.d.ts.map +1 -0
- package/dist/geometry/gl/gl-type.js +101 -74
- package/dist/geometry/is-geometry.d.ts +6 -0
- package/dist/geometry/is-geometry.d.ts.map +1 -0
- package/dist/geometry/is-geometry.js +13 -3
- 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/attribute-iterator.js +17 -11
- package/dist/geometry/iterators/primitive-iterator.d.ts +16 -0
- package/dist/geometry/iterators/primitive-iterator.d.ts.map +1 -0
- package/dist/geometry/iterators/primitive-iterator.js +85 -79
- package/dist/geometry/primitives/modes.d.ts +22 -0
- package/dist/geometry/primitives/modes.d.ts.map +1 -0
- package/dist/geometry/primitives/modes.js +67 -54
- 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/typed-arrays/typed-array-utils.js +23 -20
- package/dist/geometry/utils/assert.d.ts +7 -0
- package/dist/geometry/utils/assert.d.ts.map +1 -0
- package/dist/geometry/utils/assert.js +13 -5
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +46 -11
- package/dist/utils/assert.d.ts +2 -0
- package/dist/utils/assert.d.ts.map +1 -0
- package/dist/utils/assert.js +11 -5
- package/package.json +7 -7
- package/src/geometry/attributes/compute-vertex-normals.ts +1 -1
- package/src/geometry/compression/attribute-compression.ts +7 -1
- package/src/geometry/gl/gl-type.ts +1 -1
- package/src/index.ts +12 -0
- package/dist/geometry/attributes/compute-bounding-box.js.map +0 -1
- package/dist/geometry/attributes/compute-bounding-sphere.js.map +0 -1
- package/dist/geometry/attributes/compute-tangents.js.map +0 -1
- package/dist/geometry/attributes/compute-vertex-normals.js.map +0 -1
- package/dist/geometry/attributes/convert-to-non-indexed.js.map +0 -1
- package/dist/geometry/attributes/get-attribute-from-geometry.js.map +0 -1
- package/dist/geometry/attributes/normalize.js.map +0 -1
- package/dist/geometry/colors/rgb565.js.map +0 -1
- package/dist/geometry/compression/attribute-compression.js.map +0 -1
- package/dist/geometry/constants.js.map +0 -1
- package/dist/geometry/gl/gl-type.js.map +0 -1
- package/dist/geometry/is-geometry.js.map +0 -1
- package/dist/geometry/iterators/attribute-iterator.js.map +0 -1
- package/dist/geometry/iterators/primitive-iterator.js.map +0 -1
- package/dist/geometry/primitives/modes.js.map +0 -1
- package/dist/geometry/typed-arrays/typed-array-utils.js.map +0 -1
- package/dist/geometry/types.js +0 -2
- package/dist/geometry/types.js.map +0 -1
- package/dist/geometry/utils/assert.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/utils/assert.js.map +0 -1
- package/src/geometry/types.ts +0 -25
|
@@ -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"}
|
|
@@ -1,27 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getPositions = void 0;
|
|
7
|
+
const is_geometry_1 = __importDefault(require("../is-geometry"));
|
|
8
|
+
const assert_1 = require("../utils/assert");
|
|
9
|
+
/**
|
|
10
|
+
* analyze positions of geometry
|
|
11
|
+
*
|
|
12
|
+
* @param geometry
|
|
13
|
+
* @returns Position| New geometry |assert
|
|
14
|
+
*/
|
|
15
|
+
function getPositions(geometry) {
|
|
16
|
+
// If geometry, extract positions
|
|
17
|
+
if ((0, is_geometry_1.default)(geometry)) {
|
|
18
|
+
const { attributes } = geometry;
|
|
19
|
+
const position = attributes.POSITION || attributes.positions;
|
|
20
|
+
(0, assert_1.assert)(position);
|
|
21
|
+
return position;
|
|
22
|
+
}
|
|
23
|
+
// If arraybuffer, assume 3 components
|
|
24
|
+
if (ArrayBuffer.isView(geometry)) {
|
|
25
|
+
return { values: geometry, size: 3 };
|
|
26
|
+
}
|
|
27
|
+
// Else assume accessor object
|
|
28
|
+
if (geometry) {
|
|
29
|
+
(0, assert_1.assert)(geometry.values);
|
|
30
|
+
return geometry;
|
|
31
|
+
}
|
|
32
|
+
return (0, assert_1.assert)(false);
|
|
26
33
|
}
|
|
27
|
-
|
|
34
|
+
exports.getPositions = getPositions;
|
|
@@ -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"}
|
|
@@ -1,12 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalize = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Setting X, Y, Z for Vector
|
|
6
|
+
* @param normals
|
|
7
|
+
* @param vector
|
|
8
|
+
*/
|
|
9
|
+
function normalize(normals = {}, vector) {
|
|
10
|
+
//@ts-ignore
|
|
11
|
+
normals = this.attributes.normal;
|
|
12
|
+
for (let i = 0, il = normals.count; i < il; i++) {
|
|
13
|
+
vector.x = normals.getX(i);
|
|
14
|
+
vector.y = normals.getY(i);
|
|
15
|
+
vector.z = normals.getZ(i);
|
|
16
|
+
vector.normalize();
|
|
17
|
+
normals.setXYZ(i, vector.x, vector.y, vector.z);
|
|
18
|
+
}
|
|
11
19
|
}
|
|
12
|
-
|
|
20
|
+
exports.normalize = normalize;
|
|
@@ -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"}
|
|
@@ -1,16 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.encodeRGB565 = exports.decodeRGB565 = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Decode color values
|
|
6
|
+
* @param rgb565
|
|
7
|
+
* @param target
|
|
8
|
+
* @returns target
|
|
9
|
+
*/
|
|
10
|
+
function decodeRGB565(rgb565, target = [0, 0, 0]) {
|
|
11
|
+
const r5 = (rgb565 >> 11) & 31;
|
|
12
|
+
const g6 = (rgb565 >> 5) & 63;
|
|
13
|
+
const b5 = rgb565 & 31;
|
|
14
|
+
target[0] = r5 << 3;
|
|
15
|
+
target[1] = g6 << 2;
|
|
16
|
+
target[2] = b5 << 3;
|
|
17
|
+
return target;
|
|
9
18
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
19
|
+
exports.decodeRGB565 = decodeRGB565;
|
|
20
|
+
/**
|
|
21
|
+
* Encode color values
|
|
22
|
+
* @param rgb
|
|
23
|
+
* @returns color
|
|
24
|
+
*/
|
|
25
|
+
function encodeRGB565(rgb) {
|
|
26
|
+
const r5 = Math.floor(rgb[0] / 8) + 4;
|
|
27
|
+
const g6 = Math.floor(rgb[1] / 4) + 2;
|
|
28
|
+
const b5 = Math.floor(rgb[2] / 8) + 4;
|
|
29
|
+
return r5 + (g6 << 5) + (b5 << 11);
|
|
15
30
|
}
|
|
16
|
-
|
|
31
|
+
exports.encodeRGB565 = encodeRGB565;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { Vector2, Vector3 } from '@math.gl/core';
|
|
2
|
+
type Vector4 = {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
z: number;
|
|
6
|
+
w: number;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Encodes a normalized vector into 2 SNORM values in the range of [0-rangeMax] following the 'oct' encoding.
|
|
10
|
+
*
|
|
11
|
+
* Oct encoding is a compact representation of unit length vectors.
|
|
12
|
+
* The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors",
|
|
13
|
+
* Cigolle et al 2014: {@link http://jcgt.org/published/0003/02/01/}
|
|
14
|
+
*
|
|
15
|
+
* @param vector The normalized vector to be compressed into 2 component 'oct' encoding.
|
|
16
|
+
* @param result The 2 component oct-encoded unit length vector.
|
|
17
|
+
* @param rangeMax The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits.
|
|
18
|
+
* @returns The 2 component oct-encoded unit length vector.
|
|
19
|
+
*
|
|
20
|
+
* @exception vector must be normalized.
|
|
21
|
+
*
|
|
22
|
+
* @see octDecodeInRange
|
|
23
|
+
*/
|
|
24
|
+
export declare function octEncodeInRange(vector: Vector3, rangeMax: number, result: Vector2): Vector2;
|
|
25
|
+
/**
|
|
26
|
+
* Encodes a normalized vector into 2 SNORM values in the range of [0-255] following the 'oct' encoding.
|
|
27
|
+
*
|
|
28
|
+
* @param vector The normalized vector to be compressed into 2 byte 'oct' encoding.
|
|
29
|
+
* @param result The 2 byte oct-encoded unit length vector.
|
|
30
|
+
* @returns he 2 byte oct-encoded unit length vector.
|
|
31
|
+
*
|
|
32
|
+
* @exception vector must be normalized.
|
|
33
|
+
*
|
|
34
|
+
* @see octEncodeInRange
|
|
35
|
+
* @see octDecode
|
|
36
|
+
*/
|
|
37
|
+
export declare function octEncode(vector: Vector3, result: Vector2): Vector2;
|
|
38
|
+
/**
|
|
39
|
+
* Encodes a normalized vector into 4-byte vector
|
|
40
|
+
* @param vector The normalized vector to be compressed into 4 byte 'oct' encoding.
|
|
41
|
+
* @param result The 4 byte oct-encoded unit length vector.
|
|
42
|
+
* @returns The 4 byte oct-encoded unit length vector.
|
|
43
|
+
*
|
|
44
|
+
* @exception vector must be normalized.
|
|
45
|
+
*
|
|
46
|
+
* @see octEncodeInRange
|
|
47
|
+
* @see octDecodeFromVector4
|
|
48
|
+
*/
|
|
49
|
+
export declare function octEncodeToVector4(vector: Vector3, result: Vector4): Vector4;
|
|
50
|
+
/**
|
|
51
|
+
* Decodes a unit-length vector in 'oct' encoding to a normalized 3-component vector.
|
|
52
|
+
*
|
|
53
|
+
* @param x The x component of the oct-encoded unit length vector.
|
|
54
|
+
* @param y The y component of the oct-encoded unit length vector.
|
|
55
|
+
* @param rangeMax The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits.
|
|
56
|
+
* @param result The decoded and normalized vector
|
|
57
|
+
* @returns The decoded and normalized vector.
|
|
58
|
+
*
|
|
59
|
+
* @exception x and y must be unsigned normalized integers between 0 and rangeMax.
|
|
60
|
+
*
|
|
61
|
+
* @see octEncodeInRange
|
|
62
|
+
*/
|
|
63
|
+
export declare function octDecodeInRange(x: number, y: number, rangeMax: number, result: Vector3): Vector3;
|
|
64
|
+
/**
|
|
65
|
+
* Decodes a unit-length vector in 2 byte 'oct' encoding to a normalized 3-component vector.
|
|
66
|
+
*
|
|
67
|
+
* @param x The x component of the oct-encoded unit length vector.
|
|
68
|
+
* @param y The y component of the oct-encoded unit length vector.
|
|
69
|
+
* @param result The decoded and normalized vector.
|
|
70
|
+
* @returns he decoded and normalized vector.
|
|
71
|
+
*
|
|
72
|
+
* @exception x and y must be an unsigned normalized integer between 0 and 255.
|
|
73
|
+
*
|
|
74
|
+
* @see octDecodeInRange
|
|
75
|
+
*/
|
|
76
|
+
export declare function octDecode(x: number, y: number, result: Vector3): Vector3;
|
|
77
|
+
/**
|
|
78
|
+
* Decodes a unit-length vector in 4 byte 'oct' encoding to a normalized 3-component vector.
|
|
79
|
+
*
|
|
80
|
+
* @param encoded The oct-encoded unit length vector.
|
|
81
|
+
* @param esult The decoded and normalized vector.
|
|
82
|
+
* @returns The decoded and normalized vector.
|
|
83
|
+
*
|
|
84
|
+
* @exception x, y, z, and w must be unsigned normalized integers between 0 and 255.
|
|
85
|
+
*
|
|
86
|
+
* @see octDecodeInRange
|
|
87
|
+
* @see octEncodeToVector4
|
|
88
|
+
*/
|
|
89
|
+
export declare function octDecodeFromVector4(encoded: Vector4, result: Vector3): Vector3;
|
|
90
|
+
/**
|
|
91
|
+
* Packs an oct encoded vector into a single floating-point number.
|
|
92
|
+
*
|
|
93
|
+
* @param encoded The oct encoded vector.
|
|
94
|
+
* @returns The oct encoded vector packed into a single float.
|
|
95
|
+
*
|
|
96
|
+
*/
|
|
97
|
+
export declare function octPackFloat(encoded: Vector2): number;
|
|
98
|
+
/**
|
|
99
|
+
* Encodes a normalized vector into 2 SNORM values in the range of [0-255] following the 'oct' encoding and
|
|
100
|
+
* stores those values in a single float-point number.
|
|
101
|
+
*
|
|
102
|
+
* @param vector The normalized vector to be compressed into 2 byte 'oct' encoding.
|
|
103
|
+
* @returns The 2 byte oct-encoded unit length vector.
|
|
104
|
+
*
|
|
105
|
+
* @exception vector must be normalized.
|
|
106
|
+
*/
|
|
107
|
+
export declare function octEncodeFloat(vector: Vector3): number;
|
|
108
|
+
/**
|
|
109
|
+
* Decodes a unit-length vector in 'oct' encoding packed in a floating-point number to a normalized 3-component vector.
|
|
110
|
+
*
|
|
111
|
+
* @param value The oct-encoded unit length vector stored as a single floating-point number.
|
|
112
|
+
* @param result The decoded and normalized vector
|
|
113
|
+
* @returns The decoded and normalized vector.
|
|
114
|
+
*
|
|
115
|
+
*/
|
|
116
|
+
export declare function octDecodeFloat(value: number, result: Vector3): Vector3;
|
|
117
|
+
/**
|
|
118
|
+
* Encodes three normalized vectors into 6 SNORM values in the range of [0-255] following the 'oct' encoding and
|
|
119
|
+
* packs those into two floating-point numbers.
|
|
120
|
+
*
|
|
121
|
+
* @param v1 A normalized vector to be compressed.
|
|
122
|
+
* @param v2 A normalized vector to be compressed.
|
|
123
|
+
* @param v3 A normalized vector to be compressed.
|
|
124
|
+
* @param result The 'oct' encoded vectors packed into two floating-point numbers.
|
|
125
|
+
* @returns The 'oct' encoded vectors packed into two floating-point numbers.
|
|
126
|
+
*
|
|
127
|
+
*/
|
|
128
|
+
export declare function octPack(v1: Vector3, v2: Vector3, v3: Vector3, result: Vector2): Vector2;
|
|
129
|
+
/**
|
|
130
|
+
* Decodes three unit-length vectors in 'oct' encoding packed into a floating-point number to a normalized 3-component vector.
|
|
131
|
+
*
|
|
132
|
+
* @param packed The three oct-encoded unit length vectors stored as two floating-point number.
|
|
133
|
+
* @param v1 One decoded and normalized vector.
|
|
134
|
+
* @param v2 One decoded and normalized vector.
|
|
135
|
+
* @param v3 One decoded and normalized vector.
|
|
136
|
+
*/
|
|
137
|
+
export declare function octUnpack(packed: Vector2, v1: Vector3, v2: Vector3, v3: Vector3): void;
|
|
138
|
+
/**
|
|
139
|
+
* Pack texture coordinates into a single float. The texture coordinates will only preserve 12 bits of precision.
|
|
140
|
+
*
|
|
141
|
+
* @param textureCoordinates The texture coordinates to compress. Both coordinates must be in the range 0.0-1.0.
|
|
142
|
+
* @returns The packed texture coordinates.
|
|
143
|
+
*
|
|
144
|
+
*/
|
|
145
|
+
export declare function compressTextureCoordinates(textureCoordinates: Vector2): number;
|
|
146
|
+
/**
|
|
147
|
+
* Decompresses texture coordinates that were packed into a single float.
|
|
148
|
+
*
|
|
149
|
+
* @param compressed The compressed texture coordinates.
|
|
150
|
+
* @param result The decompressed texture coordinates.
|
|
151
|
+
* @returns The modified result parameter.
|
|
152
|
+
*
|
|
153
|
+
*/
|
|
154
|
+
export declare function decompressTextureCoordinates(compressed: number, result: Vector2): Vector2;
|
|
155
|
+
/**
|
|
156
|
+
* Decodes delta and ZigZag encoded vertices. This modifies the buffers in place.
|
|
157
|
+
*
|
|
158
|
+
* @param uBuffer The buffer view of u values.
|
|
159
|
+
* @param vBuffer The buffer view of v values.
|
|
160
|
+
* @param [heightBuffer] The buffer view of height values.
|
|
161
|
+
*
|
|
162
|
+
* @link https://github.com/AnalyticalGraphicsInc/quantized-mesh|quantized-mesh-1.0 terrain format
|
|
163
|
+
*/
|
|
164
|
+
export declare function zigZagDeltaDecode(uBuffer: Uint16Array, vBuffer: Uint16Array, heightBuffer?: Uint16Array | number[]): void;
|
|
165
|
+
export {};
|
|
166
|
+
//# 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;AAGlE,KAAK,OAAO,GAAG;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA6DF;;;;;;;;;;;;;;;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"}
|