@carbonenginejs/runtime-utils 0.1.1 → 0.1.3
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/LICENSE +21 -21
- package/NOTICE +23 -23
- package/README.md +69 -69
- package/THIRD-PARTY-NOTICES.md +64 -64
- package/docs/README.md +74 -73
- package/docs/architecture.md +101 -101
- package/docs/concepts/foundation-consolidation.md +85 -85
- package/docs/concepts/model-lifecycle.md +111 -0
- package/docs/const-kb.md +85 -87
- package/docs/core-types/DECORATOR-TODOS.md +25 -25
- package/docs/core-types/README.md +229 -168
- package/docs/reference/api.md +105 -102
- package/docs/reference/classes/README.md +135 -135
- package/package.json +139 -139
- package/src/arrays.js +5 -5
- package/src/audio/audioFormats.js +34 -34
- package/src/audio/index.js +1 -1
- package/src/box3.js +331 -331
- package/src/bytes.js +56 -56
- package/src/compression.js +56 -56
- package/src/constants/index.js +7 -7
- package/src/constants/trinity.js +13 -13
- package/src/constants.js +15 -15
- package/src/curve.js +79 -79
- package/src/d3d/dxgiFormats.js +46 -46
- package/src/d3d/index.js +2 -2
- package/src/d3d/primitiveTopology.js +11 -11
- package/src/document/CjsCarbonDocument.js +212 -212
- package/src/document/CjsClassRegistry.js +373 -373
- package/src/document/CjsDocumentDehydrator.js +142 -142
- package/src/document/CjsDocumentHydrator.js +156 -156
- package/src/document/CjsStructRegistry.js +348 -348
- package/src/document/hydrationAdapter.js +129 -129
- package/src/document/index.js +6 -6
- package/src/errors/CjsError.js +286 -286
- package/src/errors/index.js +5 -5
- package/src/geometry/box.js +22 -22
- package/src/geometry/cylinder.js +22 -22
- package/src/geometry/helpers/earcut.js +1 -1
- package/src/geometry/helpers/misc.js +3 -3
- package/src/geometry/index.js +8 -8
- package/src/geometry/json.js +67 -67
- package/src/geometry/lathe.js +44 -44
- package/src/geometry/plane.js +14 -14
- package/src/geometry/shape.js +4 -4
- package/src/geometry/sphere.js +24 -24
- package/src/geometry/torus.js +14 -14
- package/src/graphics/colorSpaces.js +22 -22
- package/src/graphics/index.js +4 -4
- package/src/graphics/pixelFormats.js +158 -158
- package/src/graphics/textureDimensions.js +22 -22
- package/src/graphics/trinityEnums.js +87 -87
- package/src/index.js +62 -62
- package/src/is.js +108 -46
- package/src/json.js +23 -23
- package/src/lifecycle/CjsLifecycleState.js +77 -77
- package/src/lifecycle/index.js +1 -1
- package/src/lne3.js +70 -70
- package/src/lookup.js +48 -48
- package/src/mat3.js +51 -51
- package/src/mat4.js +699 -699
- package/src/math/index.js +25 -25
- package/src/math/scalar.js +63 -63
- package/src/media/index.js +1 -1
- package/src/media/mediaTypes.js +50 -50
- package/src/mesh.js +424 -424
- package/src/model/CjsEventEmitter.js +333 -333
- package/src/model/CjsModel.js +1589 -1544
- package/src/model/CjsModelState.js +72 -72
- package/src/model/index.js +4 -4
- package/src/model/sourceRecordUtils.js +54 -54
- package/src/noise.js +310 -310
- package/src/num.js +827 -827
- package/src/object.js +39 -39
- package/src/path.js +53 -53
- package/src/pln.js +125 -125
- package/src/pool.js +9 -9
- package/src/quat.js +144 -144
- package/src/ray3.js +188 -188
- package/src/renderContext/formats.js +145 -145
- package/src/renderContext/index.js +5 -5
- package/src/renderContext/presentation.js +125 -125
- package/src/renderContext/resources.js +27 -27
- package/src/renderContext/upscaling.js +22 -22
- package/src/renderContext/window.js +20 -20
- package/src/runtime/CjsRuntimeState.js +50 -50
- package/src/schema/CjsSchema.js +555 -318
- package/src/schema/index.js +4 -4
- package/src/shader/index.js +1 -1
- package/src/shader/shaderStages.js +37 -37
- package/src/sph3.js +181 -181
- package/src/tangent.js +288 -288
- package/src/text.js +40 -40
- package/src/tri3.js +98 -98
- package/src/types/carbonTypes.js +635 -635
- package/src/types/index.js +2 -2
- package/src/utils.js +58 -58
- package/src/validation.js +46 -46
- package/src/vec2.js +229 -229
- package/src/vec3.js +1188 -1172
- package/src/vec4.js +347 -347
- package/src/vertex.js +108 -108
- package/src/webgpu/index.js +1 -1
- package/src/webgpu/textureFormats.js +121 -121
package/src/lookup.js
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
/** Compares string representations by stable Unicode code-unit order. */
|
|
2
|
-
export function compareCodeUnits(left, right)
|
|
3
|
-
{
|
|
4
|
-
const a = String(left);
|
|
5
|
-
const b = String(right);
|
|
6
|
-
|
|
7
|
-
return a < b ? -1 : a > b ? 1 : 0;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/** Returns a new string array in stable Unicode code-unit order. */
|
|
11
|
-
export function sortStrings(values)
|
|
12
|
-
{
|
|
13
|
-
return Array.from(values, String).sort(compareCodeUnits);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/** Builds a Map and rejects duplicate keys instead of silently overwriting. */
|
|
17
|
-
export function indexBy(values, keySelector, options = {})
|
|
18
|
-
{
|
|
19
|
-
if (typeof keySelector !== "function")
|
|
20
|
-
{
|
|
21
|
-
throw new TypeError("indexBy keySelector must be a function.");
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const result = new Map();
|
|
25
|
-
const label = options.label ?? "value";
|
|
26
|
-
let index = 0;
|
|
27
|
-
|
|
28
|
-
for (const value of values)
|
|
29
|
-
{
|
|
30
|
-
const key = keySelector(value, index++);
|
|
31
|
-
|
|
32
|
-
if (result.has(key))
|
|
33
|
-
{
|
|
34
|
-
throw new Error(`Duplicate ${label} key ${formatKey(key)}.`);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
result.set(key, value);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return result;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function formatKey(value)
|
|
44
|
-
{
|
|
45
|
-
const json = JSON.stringify(value);
|
|
46
|
-
|
|
47
|
-
return json === undefined ? String(value) : json;
|
|
48
|
-
}
|
|
1
|
+
/** Compares string representations by stable Unicode code-unit order. */
|
|
2
|
+
export function compareCodeUnits(left, right)
|
|
3
|
+
{
|
|
4
|
+
const a = String(left);
|
|
5
|
+
const b = String(right);
|
|
6
|
+
|
|
7
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** Returns a new string array in stable Unicode code-unit order. */
|
|
11
|
+
export function sortStrings(values)
|
|
12
|
+
{
|
|
13
|
+
return Array.from(values, String).sort(compareCodeUnits);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Builds a Map and rejects duplicate keys instead of silently overwriting. */
|
|
17
|
+
export function indexBy(values, keySelector, options = {})
|
|
18
|
+
{
|
|
19
|
+
if (typeof keySelector !== "function")
|
|
20
|
+
{
|
|
21
|
+
throw new TypeError("indexBy keySelector must be a function.");
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const result = new Map();
|
|
25
|
+
const label = options.label ?? "value";
|
|
26
|
+
let index = 0;
|
|
27
|
+
|
|
28
|
+
for (const value of values)
|
|
29
|
+
{
|
|
30
|
+
const key = keySelector(value, index++);
|
|
31
|
+
|
|
32
|
+
if (result.has(key))
|
|
33
|
+
{
|
|
34
|
+
throw new Error(`Duplicate ${label} key ${formatKey(key)}.`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
result.set(key, value);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function formatKey(value)
|
|
44
|
+
{
|
|
45
|
+
const json = JSON.stringify(value);
|
|
46
|
+
|
|
47
|
+
return json === undefined ? String(value) : json;
|
|
48
|
+
}
|
package/src/mat3.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as glMat3 from "gl-matrix/esm/mat3.js";
|
|
2
|
-
import { pool } from "./pool.js";
|
|
3
|
-
|
|
4
|
-
const mat3 = { ...glMat3 };
|
|
5
|
-
|
|
6
|
-
export { mat3 };
|
|
1
|
+
import * as glMat3 from "gl-matrix/esm/mat3.js";
|
|
2
|
+
import { pool } from "./pool.js";
|
|
3
|
+
|
|
4
|
+
const mat3 = { ...glMat3 };
|
|
5
|
+
|
|
6
|
+
export { mat3 };
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Allocates a pooled mat3
|
|
@@ -75,8 +75,8 @@ mat3.setArray = function(out, arr, index = 0)
|
|
|
75
75
|
* @param {number} [index=0]
|
|
76
76
|
* @returns {mat3} a
|
|
77
77
|
*/
|
|
78
|
-
mat3.toArray = function(a, arr, index = 0)
|
|
79
|
-
{
|
|
78
|
+
mat3.toArray = function(a, arr, index = 0)
|
|
79
|
+
{
|
|
80
80
|
arr[index] = a[0];
|
|
81
81
|
arr[index + 1] = a[1];
|
|
82
82
|
arr[index + 2] = a[2];
|
|
@@ -85,47 +85,47 @@ mat3.toArray = function(a, arr, index = 0)
|
|
|
85
85
|
arr[index + 5] = a[5];
|
|
86
86
|
arr[index + 6] = a[6];
|
|
87
87
|
arr[index + 7] = a[7];
|
|
88
|
-
arr[index + 8] = a[8];
|
|
89
|
-
return a;
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export const {
|
|
93
|
-
add,
|
|
94
|
-
adjoint,
|
|
95
|
-
clone,
|
|
96
|
-
copy,
|
|
97
|
-
create,
|
|
98
|
-
determinant,
|
|
99
|
-
equals,
|
|
100
|
-
exactEquals,
|
|
101
|
-
frob,
|
|
102
|
-
fromMat2d,
|
|
103
|
-
fromMat4,
|
|
104
|
-
fromQuat,
|
|
105
|
-
fromRotation,
|
|
106
|
-
fromScaling,
|
|
107
|
-
fromTranslation,
|
|
108
|
-
fromValues,
|
|
109
|
-
identity,
|
|
110
|
-
invert,
|
|
111
|
-
mul,
|
|
112
|
-
multiply,
|
|
113
|
-
multiplyScalar,
|
|
114
|
-
multiplyScalarAndAdd,
|
|
115
|
-
normalFromMat4,
|
|
116
|
-
projection,
|
|
117
|
-
rotate,
|
|
118
|
-
scale,
|
|
119
|
-
set,
|
|
120
|
-
str,
|
|
121
|
-
sub,
|
|
122
|
-
subtract,
|
|
123
|
-
translate,
|
|
124
|
-
transpose,
|
|
125
|
-
alloc,
|
|
126
|
-
unalloc,
|
|
127
|
-
fromArray,
|
|
128
|
-
setArray,
|
|
129
|
-
toArray
|
|
130
|
-
} = mat3;
|
|
88
|
+
arr[index + 8] = a[8];
|
|
89
|
+
return a;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export const {
|
|
93
|
+
add,
|
|
94
|
+
adjoint,
|
|
95
|
+
clone,
|
|
96
|
+
copy,
|
|
97
|
+
create,
|
|
98
|
+
determinant,
|
|
99
|
+
equals,
|
|
100
|
+
exactEquals,
|
|
101
|
+
frob,
|
|
102
|
+
fromMat2d,
|
|
103
|
+
fromMat4,
|
|
104
|
+
fromQuat,
|
|
105
|
+
fromRotation,
|
|
106
|
+
fromScaling,
|
|
107
|
+
fromTranslation,
|
|
108
|
+
fromValues,
|
|
109
|
+
identity,
|
|
110
|
+
invert,
|
|
111
|
+
mul,
|
|
112
|
+
multiply,
|
|
113
|
+
multiplyScalar,
|
|
114
|
+
multiplyScalarAndAdd,
|
|
115
|
+
normalFromMat4,
|
|
116
|
+
projection,
|
|
117
|
+
rotate,
|
|
118
|
+
scale,
|
|
119
|
+
set,
|
|
120
|
+
str,
|
|
121
|
+
sub,
|
|
122
|
+
subtract,
|
|
123
|
+
translate,
|
|
124
|
+
transpose,
|
|
125
|
+
alloc,
|
|
126
|
+
unalloc,
|
|
127
|
+
fromArray,
|
|
128
|
+
setArray,
|
|
129
|
+
toArray
|
|
130
|
+
} = mat3;
|
|
131
131
|
|