@carbonenginejs/runtime 0.1.0-alpha.1 → 0.1.0-alpha.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/dist/global/model/CjsModel.js +3 -1
- package/dist/global/model/CjsModel.js.map +1 -1
- package/dist/global/model/document/CjsDocumentHydrator.js +5 -1
- package/dist/global/model/document/CjsDocumentHydrator.js.map +1 -1
- package/dist/global/schema/CjsSchema.js +100 -2
- package/dist/global/schema/CjsSchema.js.map +1 -1
- package/dist/global/schema/hydration.js +16 -0
- package/dist/global/schema/hydration.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/resource/CjsResMan.js +177 -4
- package/dist/resource/CjsResMan.js.map +1 -1
- package/dist/resource/format/CjsBlueReader.js +8 -1
- package/dist/resource/format/CjsBlueReader.js.map +1 -1
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js +23 -5
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -1
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js +12 -3
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js.map +1 -1
- package/dist/resource/index.js +2 -0
- package/dist/resource/index.js.map +1 -1
- package/dist/resource/texture/SolidColorTextureConstructor.js +46 -0
- package/dist/resource/texture/SolidColorTextureConstructor.js.map +1 -0
- package/dist/resource/texture/TriTextureRes.js +43 -0
- package/dist/resource/texture/TriTextureRes.js.map +1 -1
- package/dist/resource/texture/index.js +2 -0
- package/dist/resource/texture/index.js.map +1 -1
- package/dist/resource/texture/solidColorTexture.js +111 -0
- package/dist/resource/texture/solidColorTexture.js.map +1 -0
- package/dist/trinity/eve/attachment/decal/EveSpaceObjectDecal.js +19 -8
- package/dist/trinity/eve/attachment/decal/EveSpaceObjectDecal.js.map +1 -1
- package/dist/trinity/eve/child/EveChildMesh.js +17 -3
- package/dist/trinity/eve/child/EveChildMesh.js.map +1 -1
- package/dist/trinity/eve/locator/EveLocatorSets.js +12 -3
- package/dist/trinity/eve/locator/EveLocatorSets.js.map +1 -1
- package/dist/trinity/eve/spaceObject/EveSpaceObject2.js +15 -2
- package/dist/trinity/eve/spaceObject/EveSpaceObject2.js.map +1 -1
- package/dist/trinity/eve/spaceObject/IEveSpaceObject2ParentData.js +44 -52
- package/dist/trinity/eve/spaceObject/IEveSpaceObject2ParentData.js.map +1 -1
- package/docs/resource/concepts/resource-lifecycle.md +10 -8
- package/docs/resource/formats/geometry-interchange.md +50 -0
- package/docs/resource/formats/webgl/decl-io.md +241 -397
- package/docs/resource/formats/webgl/memory-structured.md +91 -128
- package/docs/resource/formats/webgl/texture-sample.md +306 -469
- package/docs/resource/formats/webgpu/reference/wgsl-compatibility.md +54 -85
- package/docs/resource/reference/classes/texture.md +11 -1
- package/docs/resource/reference/motherlode-cache.md +24 -11
- package/docs/resource/reference/queues.md +23 -1
- package/docs/trinityal/reference/classes/dropped.md +11 -1
- package/package.json +1 -1
|
@@ -1,70 +1,62 @@
|
|
|
1
|
-
import { identity as _identity, applyDecs2311 as _applyDecs2311 } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import { CjsModel } from '#model';
|
|
3
1
|
import { mat4 } from '#math/mat4';
|
|
4
|
-
import { type } from '#schema';
|
|
5
2
|
import { vec3 } from '#math/vec3';
|
|
6
3
|
import { vec4 } from '#math/vec4';
|
|
7
4
|
|
|
8
|
-
|
|
5
|
+
// Source: trinity/trinity/Eve/IEveSpaceObject2.h (IEveSpaceObject2::ParentData)
|
|
6
|
+
// Hand-maintained. Carbon nests this struct inside the IEveSpaceObject2
|
|
7
|
+
// interface; the JS identity concatenates owner and inner name
|
|
8
|
+
// (IEveSpaceObject2 + ParentData) because a bare inner name is not unique
|
|
9
|
+
// across the corpus - fifteen inner names are claimed by several owners and
|
|
10
|
+
// thirteen collide with a top-level class.
|
|
11
|
+
//
|
|
12
|
+
// A plain class, not a model: it is internal per-frame data, filled by the
|
|
13
|
+
// owner's update pass (GetParentData) and copied member by member by the
|
|
14
|
+
// consumer, exactly as Carbon passes and copies the struct. Nothing hydrates
|
|
15
|
+
// it or edits it from a UI; if something ever needs to, compose values onto
|
|
16
|
+
// it rather than giving it the model base.
|
|
9
17
|
|
|
10
18
|
/** The per-frame parent state a space object hands to its attachments. */
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
static {
|
|
15
|
-
({
|
|
16
|
-
e: [_init_transform, _init_extra_transform, _init_killCount, _init_extra_killCount, _init_shipData, _init_extra_shipData, _init_clipSphereCenter, _init_extra_clipSphereCenter, _init_clipRadiusSq, _init_extra_clipRadiusSq, _init_clipRadius2Sq, _init_extra_clipRadius2Sq, _init_clipFactor, _init_extra_clipFactor, _init_clipFactor2, _init_extra_clipFactor2, _init_customData, _init_extra_customData],
|
|
17
|
-
c: [_IEveSpaceObject2Pare, _initClass]
|
|
18
|
-
} = _applyDecs2311(this, [type.define({
|
|
19
|
-
className: "IEveSpaceObject2ParentData",
|
|
20
|
-
family: "eve/spaceObject"
|
|
21
|
-
})], [[[type, type.mat4], 16, "transform"], [[type, type.uint32], 16, "killCount"], [[type, type.vec4], 16, "shipData"], [[type, type.vec3], 16, "clipSphereCenter"], [[type, type.float32], 16, "clipRadiusSq"], [[type, type.float32], 16, "clipRadius2Sq"], [[type, type.float32], 16, "clipFactor"], [[type, type.float32], 16, "clipFactor2"], [[type, type.vec4], 16, "customData"]], 0, void 0, CjsModel));
|
|
22
|
-
}
|
|
23
|
-
/** transform (Matrix) - the parent's world transform. */
|
|
24
|
-
transform = _init_transform(this, mat4.create());
|
|
19
|
+
class IEveSpaceObject2ParentData {
|
|
20
|
+
/** transform (Matrix) - the parent's world transform. */
|
|
21
|
+
transform = mat4.create();
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
/** killCount (uint32_t) - EveSpaceObject2::GetParentData never assigns it,
|
|
24
|
+
* so it stays zero through that path (EveSpaceObject2.cpp:1874). */
|
|
25
|
+
killCount = 0;
|
|
29
26
|
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
/** shipData (Vector4) - m_spaceObjectShipData. */
|
|
28
|
+
shipData = vec4.create();
|
|
32
29
|
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
/** clipSphereCenter (Vector3). */
|
|
31
|
+
clipSphereCenter = vec3.create();
|
|
35
32
|
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
/** clipRadiusSq (float). */
|
|
34
|
+
clipRadiusSq = 0;
|
|
38
35
|
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
/** clipRadius2Sq (float). */
|
|
37
|
+
clipRadius2Sq = 0;
|
|
41
38
|
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
/** clipFactor (float) - the parent's clipSphereFactor. */
|
|
40
|
+
clipFactor = 0;
|
|
44
41
|
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
/** clipFactor2 (float) - the parent's clipSphereFactor2. */
|
|
43
|
+
clipFactor2 = 0;
|
|
47
44
|
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
/** customData (Vector4). */
|
|
46
|
+
customData = vec4.create();
|
|
50
47
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
shLighting = (_init_extra_customData(this), null);
|
|
48
|
+
/**
|
|
49
|
+
* shLighting (const Vector4*) - Carbon borrows a pointer to the parent's
|
|
50
|
+
* seven packed spherical-harmonic coefficients and copies them at fill time,
|
|
51
|
+
* zeroing when the pointer is null (EveSpaceObjectDecal.cpp:376-383). The
|
|
52
|
+
* port holds the parent's array by reference with the same null contract.
|
|
53
|
+
*/
|
|
54
|
+
shLighting = null;
|
|
59
55
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
constructor() {
|
|
65
|
-
super(_IEveSpaceObject2Pare), _initClass();
|
|
66
|
-
}
|
|
67
|
-
}();
|
|
56
|
+
/** Carbon's packed spherical-harmonic coefficient count
|
|
57
|
+
* (Tr2ShLightingManager::PACKED_COEFFICIENT_COUNT). */
|
|
58
|
+
static SH_COEFFICIENT_COUNT = 7;
|
|
59
|
+
}
|
|
68
60
|
|
|
69
|
-
export {
|
|
61
|
+
export { IEveSpaceObject2ParentData };
|
|
70
62
|
//# sourceMappingURL=IEveSpaceObject2ParentData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IEveSpaceObject2ParentData.js","sources":["../../../../../src/trinity/eve/spaceObject/IEveSpaceObject2ParentData.js"],"sourcesContent":["// Source: trinity/trinity/Eve/IEveSpaceObject2.h (IEveSpaceObject2::ParentData)\
|
|
1
|
+
{"version":3,"file":"IEveSpaceObject2ParentData.js","sources":["../../../../../src/trinity/eve/spaceObject/IEveSpaceObject2ParentData.js"],"sourcesContent":["// Source: trinity/trinity/Eve/IEveSpaceObject2.h (IEveSpaceObject2::ParentData)\n// Hand-maintained. Carbon nests this struct inside the IEveSpaceObject2\n// interface; the JS identity concatenates owner and inner name\n// (IEveSpaceObject2 + ParentData) because a bare inner name is not unique\n// across the corpus - fifteen inner names are claimed by several owners and\n// thirteen collide with a top-level class.\n//\n// A plain class, not a model: it is internal per-frame data, filled by the\n// owner's update pass (GetParentData) and copied member by member by the\n// consumer, exactly as Carbon passes and copies the struct. Nothing hydrates\n// it or edits it from a UI; if something ever needs to, compose values onto\n// it rather than giving it the model base.\nimport { mat4 } from \"#math/mat4\";\nimport { vec3 } from \"#math/vec3\";\nimport { vec4 } from \"#math/vec4\";\n\n\n/** The per-frame parent state a space object hands to its attachments. */\nexport class IEveSpaceObject2ParentData\n{\n\n /** transform (Matrix) - the parent's world transform. */\n transform = mat4.create();\n\n /** killCount (uint32_t) - EveSpaceObject2::GetParentData never assigns it,\n * so it stays zero through that path (EveSpaceObject2.cpp:1874). */\n killCount = 0;\n\n /** shipData (Vector4) - m_spaceObjectShipData. */\n shipData = vec4.create();\n\n /** clipSphereCenter (Vector3). */\n clipSphereCenter = vec3.create();\n\n /** clipRadiusSq (float). */\n clipRadiusSq = 0;\n\n /** clipRadius2Sq (float). */\n clipRadius2Sq = 0;\n\n /** clipFactor (float) - the parent's clipSphereFactor. */\n clipFactor = 0;\n\n /** clipFactor2 (float) - the parent's clipSphereFactor2. */\n clipFactor2 = 0;\n\n /** customData (Vector4). */\n customData = vec4.create();\n\n /**\n * shLighting (const Vector4*) - Carbon borrows a pointer to the parent's\n * seven packed spherical-harmonic coefficients and copies them at fill time,\n * zeroing when the pointer is null (EveSpaceObjectDecal.cpp:376-383). The\n * port holds the parent's array by reference with the same null contract.\n */\n shLighting = null;\n\n /** Carbon's packed spherical-harmonic coefficient count\n * (Tr2ShLightingManager::PACKED_COEFFICIENT_COUNT). */\n static SH_COEFFICIENT_COUNT = 7;\n\n}\n"],"names":["IEveSpaceObject2ParentData","transform","mat4","create","killCount","shipData","vec4","clipSphereCenter","vec3","clipRadiusSq","clipRadius2Sq","clipFactor","clipFactor2","customData","shLighting","SH_COEFFICIENT_COUNT"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACO,MAAMA,0BAA0B,CACvC;AAEE;AACAC,EAAAA,SAAS,GAAGC,IAAI,CAACC,MAAM,EAAE;;AAEzB;AACF;AACEC,EAAAA,SAAS,GAAG,CAAC;;AAEb;AACAC,EAAAA,QAAQ,GAAGC,IAAI,CAACH,MAAM,EAAE;;AAExB;AACAI,EAAAA,gBAAgB,GAAGC,IAAI,CAACL,MAAM,EAAE;;AAEhC;AACAM,EAAAA,YAAY,GAAG,CAAC;;AAEhB;AACAC,EAAAA,aAAa,GAAG,CAAC;;AAEjB;AACAC,EAAAA,UAAU,GAAG,CAAC;;AAEd;AACAC,EAAAA,WAAW,GAAG,CAAC;;AAEf;AACAC,EAAAA,UAAU,GAAGP,IAAI,CAACH,MAAM,EAAE;;AAE1B;AACF;AACA;AACA;AACA;AACA;AACEW,EAAAA,UAAU,GAAG,IAAI;;AAEjB;AACF;EACE,OAAOC,oBAAoB,GAAG,CAAC;AAEjC;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Resource lifecycle
|
|
2
2
|
|
|
3
3
|
Status: Evolving
|
|
4
|
-
Scope: `@carbonenginejs/runtime/resource`
|
|
4
|
+
Scope: `@carbonenginejs/runtime/resource`
|
|
5
5
|
Audience: Users and integrators
|
|
6
6
|
Summary: Explains resource states, the load/prepare split, and how a resource request flows from path to published CPU payload.
|
|
7
7
|
|
|
@@ -34,7 +34,7 @@ keeps; see [architecture](../architecture.md).
|
|
|
34
34
|
## CarbonEngineJS states
|
|
35
35
|
|
|
36
36
|
```text
|
|
37
|
-
EMPTY -> REQUESTED/LOADING -> LOADED (resource layer)
|
|
37
|
+
EMPTY -> REQUESTED/LOADING -> LOADED (resource layer)
|
|
38
38
|
LOADED -> PREPARING -> PREPARED (engine adapters)
|
|
39
39
|
```
|
|
40
40
|
|
|
@@ -56,8 +56,10 @@ LOADED -> PREPARING -> PREPARED (engine adapters)
|
|
|
56
56
|
per source/path and limits active source operations with
|
|
57
57
|
`maxConcurrentLoads`. After bytes arrive, object construction is split into
|
|
58
58
|
separate main-queue items (`reader/format conversion -> publish`). Publication
|
|
59
|
-
moves the resource to `
|
|
60
|
-
|
|
59
|
+
moves the resource to `PREPARED`: the published value is already the reader or
|
|
60
|
+
converter outcome, so no CPU preparation remains. ResMan never performs backend
|
|
61
|
+
realization. A route that hydrates a `Target` builds a new object for each
|
|
62
|
+
caller from the retained decoded values, as Carbon's `LoadObject` does. See
|
|
61
63
|
[reference/queues.md](../reference/queues.md) for the queue contract and
|
|
62
64
|
[reference/motherlode-cache.md](../reference/motherlode-cache.md) for
|
|
63
65
|
identity, retention, and release behavior.
|
|
@@ -212,10 +214,10 @@ device memory are different budgets. Retention therefore distinguishes:
|
|
|
212
214
|
typed arrays;
|
|
213
215
|
- adapter payload: WebGL/WebGPU textures, buffers, shader modules, pipelines.
|
|
214
216
|
|
|
215
|
-
Identity and lightweight metadata remain resident while CPU and adapter
|
|
216
|
-
payloads release independently. Engine adapters own adapter-resource destruction;
|
|
217
|
-
the resource layer supplies lifecycle hooks and opaque adapter slots. See
|
|
218
|
-
[reference/motherlode-cache.md](../reference/motherlode-cache.md).
|
|
217
|
+
Identity and lightweight metadata remain resident while CPU and adapter
|
|
218
|
+
payloads release independently. Engine adapters own adapter-resource destruction;
|
|
219
|
+
the resource layer supplies lifecycle hooks and opaque adapter slots. See
|
|
220
|
+
[reference/motherlode-cache.md](../reference/motherlode-cache.md).
|
|
219
221
|
|
|
220
222
|
## Related documentation
|
|
221
223
|
|
|
@@ -25,6 +25,51 @@ particular, it does not require normalized skin-weight sums or finite mesh
|
|
|
25
25
|
bounds and UV densities. Destination writers may impose stricter requirements
|
|
26
26
|
when their target format needs them.
|
|
27
27
|
|
|
28
|
+
## glTF import contract
|
|
29
|
+
|
|
30
|
+
`CjsGltfFormat` defaults to `emit: "shared"`; `emit: "cmf"` uses the same
|
|
31
|
+
canonical CMF builder. JSON and `gltfJson` are explicit projections, not the
|
|
32
|
+
conversion boundary.
|
|
33
|
+
|
|
34
|
+
- **Vertex channels:** glTF `TANGENT` is XYZ plus handedness, not an EVE packed
|
|
35
|
+
tangent frame. Import produces separate tangent and binormal vectors from
|
|
36
|
+
the matching normal and handedness; a tangent without a matching normal channel is
|
|
37
|
+
rejected. Invalid direction vectors use the exporter's fixed fallbacks.
|
|
38
|
+
Indexed UV/color channels retain their usage indices and three/four-component
|
|
39
|
+
color width. Optional tangent packing is applied independently to every LOD.
|
|
40
|
+
- **Skinning:** `JOINTS_0` stays relative to the mesh's palette. Positive-weight
|
|
41
|
+
indices must address that palette; zero-weight indices become zero. Skins
|
|
42
|
+
sharing `skin.skeleton` share the full skeleton, including unused bones;
|
|
43
|
+
skins without it remain separate. `inverseBindMatrices` must be FLOAT MAT4,
|
|
44
|
+
one per joint, and map by joint-node identity without transpose. Conflicting
|
|
45
|
+
matrices for a shared bone reject; an absent accessor means identity.
|
|
46
|
+
- **Morphs:** CMF buffers are absolute. Deltas are added to each LOD's own base;
|
|
47
|
+
omitted components copy that base, and authored absolute targets stay
|
|
48
|
+
absolute. Non-empty morph declarations include Position and are subsets of
|
|
49
|
+
the base declaration. Displacement is measured against the base and aggregated
|
|
50
|
+
across LODs. Weight animations become scalar MorphTarget channels:
|
|
51
|
+
`FooShape` maps to `Foo`. Carbon's exporter omits original target names, so
|
|
52
|
+
unnamed exported targets become `target_n`, not reconstructed original names.
|
|
53
|
+
- **Animation:** missing TRS channels stay absent. Explicit one-key identity
|
|
54
|
+
channels retain `preserveIdentity`, since they may override a non-identity
|
|
55
|
+
rest pose. Track groups follow shared skeleton identity rather than duplicating
|
|
56
|
+
channels per mesh. Matrix decomposition is checked by recomposition; rotation
|
|
57
|
+
and reflected scale survive, but shear is rejected.
|
|
58
|
+
- **Scene and LOD:** when scenes exist, import uses mesh nodes reachable from
|
|
59
|
+
the default scene and reconstructs lower LODs through `MSFT_lod.ids`.
|
|
60
|
+
Coverage `[c0, c1, ..., sentinel]` becomes thresholds
|
|
61
|
+
`[0xffffffff, round(c0 * 2048), round(c1 * 2048), ...]`, strictly descending;
|
|
62
|
+
the sentinel creates no LOD. Export-clamped thresholds above 2048 are not
|
|
63
|
+
recoverable. LODs must agree on topology, declaration, material-area count,
|
|
64
|
+
joint palette, and morph declarations/names.
|
|
65
|
+
- **Topology:** non-indexed POINTS become PointList without an index buffer;
|
|
66
|
+
strips and fans are triangulated. CMF construction fills UV densities through
|
|
67
|
+
the highest TexCoord usage index, leaving missing usage indices zero.
|
|
68
|
+
|
|
69
|
+
Carbon's exporter loses source declarations, packed-frame storage, bounds,
|
|
70
|
+
metadata, morph names and some LOD information. Round trips are comparisons of
|
|
71
|
+
representable geometry/animation semantics, not byte-exact recovery.
|
|
72
|
+
|
|
28
73
|
## FBX compatibility modes
|
|
29
74
|
|
|
30
75
|
FBX reads accept `compatibility: "source" | "carbon"`. The default is
|
|
@@ -94,6 +139,11 @@ subdivision limit, not silent reinterpretation of cubic controls.
|
|
|
94
139
|
|
|
95
140
|
The following inputs remain hard errors rather than lossy conversions:
|
|
96
141
|
|
|
142
|
+
- glTF `JOINTS_n`/`WEIGHTS_n` above zero, pending an explicit influence-reduction
|
|
143
|
+
policy;
|
|
144
|
+
- indexed glTF POINTS, pending coordinated unindexing of base and morph channels;
|
|
145
|
+
- non-identity glTF mesh-node transforms, pending a complete bake through
|
|
146
|
+
geometry, morphs, bounds, directions and skinning;
|
|
97
147
|
- multiple or weighted FBX animation layers and FBX cubic tangent semantics;
|
|
98
148
|
Carbon delegates these to `ufbx_bake_anim`, and the runtime has no equivalent
|
|
99
149
|
evaluator;
|