@carbonenginejs/runtime 0.1.0-alpha.2 → 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.
Files changed (45) hide show
  1. package/dist/global/model/CjsModel.js +3 -1
  2. package/dist/global/model/CjsModel.js.map +1 -1
  3. package/dist/global/model/document/CjsDocumentHydrator.js +5 -1
  4. package/dist/global/model/document/CjsDocumentHydrator.js.map +1 -1
  5. package/dist/global/schema/CjsSchema.js +98 -18
  6. package/dist/global/schema/CjsSchema.js.map +1 -1
  7. package/dist/global/schema/hydration.js +10 -8
  8. package/dist/global/schema/hydration.js.map +1 -1
  9. package/dist/index.js +2 -0
  10. package/dist/index.js.map +1 -1
  11. package/dist/resource/CjsResMan.js +177 -4
  12. package/dist/resource/CjsResMan.js.map +1 -1
  13. package/dist/resource/format/CjsBlueReader.js +8 -1
  14. package/dist/resource/format/CjsBlueReader.js.map +1 -1
  15. package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js +7 -1
  16. package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -1
  17. package/dist/resource/index.js +2 -0
  18. package/dist/resource/index.js.map +1 -1
  19. package/dist/resource/texture/SolidColorTextureConstructor.js +46 -0
  20. package/dist/resource/texture/SolidColorTextureConstructor.js.map +1 -0
  21. package/dist/resource/texture/TriTextureRes.js +43 -0
  22. package/dist/resource/texture/TriTextureRes.js.map +1 -1
  23. package/dist/resource/texture/index.js +2 -0
  24. package/dist/resource/texture/index.js.map +1 -1
  25. package/dist/resource/texture/solidColorTexture.js +111 -0
  26. package/dist/resource/texture/solidColorTexture.js.map +1 -0
  27. package/dist/trinity/eve/attachment/decal/EveSpaceObjectDecal.js +19 -8
  28. package/dist/trinity/eve/attachment/decal/EveSpaceObjectDecal.js.map +1 -1
  29. package/dist/trinity/eve/child/EveChildMesh.js +17 -3
  30. package/dist/trinity/eve/child/EveChildMesh.js.map +1 -1
  31. package/dist/trinity/eve/locator/EveLocatorSets.js +12 -3
  32. package/dist/trinity/eve/locator/EveLocatorSets.js.map +1 -1
  33. package/dist/trinity/eve/spaceObject/EveSpaceObject2.js +15 -2
  34. package/dist/trinity/eve/spaceObject/EveSpaceObject2.js.map +1 -1
  35. package/dist/trinity/eve/spaceObject/IEveSpaceObject2ParentData.js +44 -52
  36. package/dist/trinity/eve/spaceObject/IEveSpaceObject2ParentData.js.map +1 -1
  37. package/docs/resource/concepts/resource-lifecycle.md +10 -8
  38. package/docs/resource/formats/geometry-interchange.md +50 -0
  39. package/docs/resource/formats/webgl/decl-io.md +241 -397
  40. package/docs/resource/formats/webgl/memory-structured.md +91 -128
  41. package/docs/resource/formats/webgl/texture-sample.md +306 -469
  42. package/docs/resource/reference/classes/texture.md +11 -1
  43. package/docs/resource/reference/motherlode-cache.md +24 -11
  44. package/docs/resource/reference/queues.md +23 -1
  45. package/package.json +1 -1
@@ -47,6 +47,7 @@ export { Tr2SamplerSetup } from './shader/sampler/Tr2SamplerSetup.js';
47
47
  export { RegisterShaderResources, ShaderResourceExtensions } from './shader/registerShaderResources.js';
48
48
  export { CjsTextureArrayRes } from './texture/CjsTextureArrayRes.js';
49
49
  export { CjsTextureArrayResParameterProxy } from './texture/CjsTextureArrayResParameterProxy.js';
50
+ export { RegisterSolidColorTexture, SolidColorTextureConstructor } from './texture/SolidColorTextureConstructor.js';
50
51
  export { Tr2ImageRes } from './texture/Tr2ImageRes.js';
51
52
  export { Tr2TextureLodManager } from './texture/Tr2TextureLodManager.js';
52
53
  export { Tr2TextureLodUpdateRequest } from './texture/Tr2TextureLodUpdateRequest.js';
@@ -59,6 +60,7 @@ export { Tr2TexturePipelineStepLimitSize } from './texture/Tr2TexturePipelineSte
59
60
  export { Tr2TexturePipelineStepLoad } from './texture/Tr2TexturePipelineStepLoad.js';
60
61
  export { Tr2TexturePipelineStepPack } from './texture/Tr2TexturePipelineStepPack.js';
61
62
  export { TriTextureRes } from './texture/TriTextureRes.js';
63
+ export { ColorPrefix, IsSolidColorTexturePath, ParseColor, RasterizeSolidColor } from './texture/solidColorTexture.js';
62
64
  export { CjsResourceProbe } from './format/CjsResourceProbe.js';
63
65
  export { ResourcePayloadType, ResourcePayloadValues, validateAudioPayload, validateRgbaPayload, validateTexturePayload, validateVideoPayload } from './format/payloadContract.js';
64
66
  export { CjsFormat, CjsFormatOutputRole, CjsFormatReadMode } from './format/CjsFormat.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,46 @@
1
+ import { TriTextureRes } from './TriTextureRes.js';
2
+ import { ColorPrefix } from './solidColorTexture.js';
3
+
4
+ // Source: trinity/trinity/Resources/Procedural/SolidColorTexture.cpp
5
+ //
6
+ // Carbon registers this constructor at static-initialisation time, inside its
7
+ // own translation unit (SolidColorTexture.cpp:17-32). As with
8
+ // RegisterShaderResources, we do not self-register at module scope: a module
9
+ // side effect fires on import rather than on composition and cannot be tested in
10
+ // isolation. Whoever composes a manager calls RegisterSolidColorTexture.
11
+
12
+ /**
13
+ * Carbon's `SolidColorTextureConstructor`: builds the texture a
14
+ * `dynamic:/color/<query>` path names. TriTextureRes.Initialize recognises the
15
+ * prefix and rasterizes the colour itself.
16
+ */
17
+ class SolidColorTextureConstructor {
18
+ /**
19
+ * `IBlueDynamicResourceConstructor::GetResource` (SolidColorTexture.cpp:23-29).
20
+ *
21
+ * @param {string} query Text after `dynamic:/color/`.
22
+ * @returns {TriTextureRes} The texture resource.
23
+ */
24
+ GetResource(query) {
25
+ const texture = new TriTextureRes();
26
+ texture.Initialize(ColorPrefix + query, "");
27
+ return texture;
28
+ }
29
+ }
30
+
31
+ /**
32
+ * Registers the `color` dynamic constructor on one manager.
33
+ *
34
+ * @param {object} resourceManager Manager to register on.
35
+ * @returns {object} The same manager, for chaining.
36
+ */
37
+ function RegisterSolidColorTexture(resourceManager) {
38
+ if (typeof resourceManager?.RegisterResourceConstructor !== "function") {
39
+ throw new TypeError("RegisterSolidColorTexture requires a CjsResMan.");
40
+ }
41
+ resourceManager.RegisterResourceConstructor("color", new SolidColorTextureConstructor());
42
+ return resourceManager;
43
+ }
44
+
45
+ export { RegisterSolidColorTexture, SolidColorTextureConstructor };
46
+ //# sourceMappingURL=SolidColorTextureConstructor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SolidColorTextureConstructor.js","sources":["../../../../src/resource/texture/SolidColorTextureConstructor.js"],"sourcesContent":["// Source: trinity/trinity/Resources/Procedural/SolidColorTexture.cpp\n//\n// Carbon registers this constructor at static-initialisation time, inside its\n// own translation unit (SolidColorTexture.cpp:17-32). As with\n// RegisterShaderResources, we do not self-register at module scope: a module\n// side effect fires on import rather than on composition and cannot be tested in\n// isolation. Whoever composes a manager calls RegisterSolidColorTexture.\nimport { TriTextureRes } from \"./TriTextureRes.js\";\nimport { ColorPrefix } from \"./solidColorTexture.js\";\n\n/**\n * Carbon's `SolidColorTextureConstructor`: builds the texture a\n * `dynamic:/color/<query>` path names. TriTextureRes.Initialize recognises the\n * prefix and rasterizes the colour itself.\n */\nexport class SolidColorTextureConstructor\n{\n /**\n * `IBlueDynamicResourceConstructor::GetResource` (SolidColorTexture.cpp:23-29).\n *\n * @param {string} query Text after `dynamic:/color/`.\n * @returns {TriTextureRes} The texture resource.\n */\n GetResource(query)\n {\n const texture = new TriTextureRes();\n texture.Initialize(ColorPrefix + query, \"\");\n return texture;\n }\n}\n\n/**\n * Registers the `color` dynamic constructor on one manager.\n *\n * @param {object} resourceManager Manager to register on.\n * @returns {object} The same manager, for chaining.\n */\nexport function RegisterSolidColorTexture(resourceManager)\n{\n if (typeof resourceManager?.RegisterResourceConstructor !== \"function\")\n {\n throw new TypeError(\"RegisterSolidColorTexture requires a CjsResMan.\");\n }\n resourceManager.RegisterResourceConstructor(\"color\", new SolidColorTextureConstructor());\n return resourceManager;\n}\n"],"names":["SolidColorTextureConstructor","GetResource","query","texture","TriTextureRes","Initialize","ColorPrefix","RegisterSolidColorTexture","resourceManager","RegisterResourceConstructor","TypeError"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACO,MAAMA,4BAA4B,CACzC;AACE;AACF;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAACC,KAAK,EACjB;AACE,IAAA,MAAMC,OAAO,GAAG,IAAIC,aAAa,EAAE;IACnCD,OAAO,CAACE,UAAU,CAACC,WAAW,GAAGJ,KAAK,EAAE,EAAE,CAAC;AAC3C,IAAA,OAAOC,OAAO;AAChB,EAAA;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASI,yBAAyBA,CAACC,eAAe,EACzD;AACE,EAAA,IAAI,OAAOA,eAAe,EAAEC,2BAA2B,KAAK,UAAU,EACtE;AACE,IAAA,MAAM,IAAIC,SAAS,CAAC,iDAAiD,CAAC;AACxE,EAAA;EACAF,eAAe,CAACC,2BAA2B,CAAC,OAAO,EAAE,IAAIT,4BAA4B,EAAE,CAAC;AACxF,EAAA,OAAOQ,eAAe;AACxB;;;;"}
@@ -1,5 +1,6 @@
1
1
  import { CjsSchema, carbon, impl, type, io } from '#schema';
2
2
  import { CjsResource } from '../CjsResource.js';
3
+ import { IsSolidColorTexturePath, RasterizeSolidColor } from './solidColorTexture.js';
3
4
  import { ResourceRequirement } from '../ResourceRequirement.js';
4
5
  import { validateVideoPayload, validateTexturePayload, validateRgbaPayload, ResourcePayloadType } from '../format/payloadContract.js';
5
6
  import { resourcePayloadError, validateResourcePayload, resourceFormatRequiredError, resourceBoundaryError } from '../resourceBoundary.js';
@@ -48,6 +49,47 @@ class TriTextureRes extends CjsResource {
48
49
  });
49
50
  }
50
51
 
52
+ /**
53
+ * Carbon's Initialize, with its procedural branch (TriTextureRes.cpp:223-236):
54
+ * a `dynamic:/color/` path is rasterized here rather than loaded from source.
55
+ * The `dynamic:/gradient_1d/` branch Carbon checks first is not ported yet.
56
+ *
57
+ * @param {string} path Resource path.
58
+ * @param {string|null} [ext] Extension override.
59
+ * @param {string} [requirement] Semantic requirement.
60
+ * @returns {TriTextureRes} This resource.
61
+ */
62
+ Initialize(path, ext = null, requirement = "") {
63
+ super.Initialize(path, ext, requirement);
64
+ if (IsSolidColorTexturePath(this.path)) this.#RasterizeProceduralTexture(RasterizeSolidColor);
65
+ return this;
66
+ }
67
+
68
+ /**
69
+ * `RasterizeProceduralTexture` (TriTextureRes.cpp:181-212). Carbon creates the
70
+ * GPU texture from the bitmap here; this layer cannot reach a render context,
71
+ * so it publishes the bitmap as the payload and Trinity makes the texture at
72
+ * first bind, as it does for every other texture.
73
+ *
74
+ * @param {Function} rasterize `(path) => payload | null`.
75
+ * @returns {void}
76
+ */
77
+ #RasterizeProceduralTexture(rasterize) {
78
+ this.MarkLoading();
79
+ const payload = rasterize(this.path);
80
+ if (!payload) {
81
+ // Carbon: "Failed to parse dynamic:/color/%s texture path", and the
82
+ // texture is never prepared.
83
+ const error = new Error(`Failed to parse ${this.path} texture path`);
84
+ error.code = "CJS_TEXTURE_PROCEDURAL_PATH_INVALID";
85
+ error.path = this.path;
86
+ this.SetError(error);
87
+ return;
88
+ }
89
+ this.SetPayload(payload);
90
+ this.MarkPrepared();
91
+ }
92
+
51
93
  /**
52
94
  * m_texture: the live `Tr2TextureAL`, or null until an engine makes one.
53
95
  *
@@ -405,6 +447,7 @@ CjsSchema.define(TriTextureRes, {
405
447
  cutoutY: [type.float32, io.readwrite]
406
448
  },
407
449
  methods: {
450
+ Initialize: [carbon.method, impl.adapted, impl.reason("Carbon rasterizes a procedural path into a half-float HostBitmap and creates the GPU texture inside Initialize; this resource cannot reach a render context, so it publishes the half-float-quantized colour as an rgba32float payload. The gradient_1d branch is not ported.")],
408
451
  GetMipCount: [carbon.method, impl.adapted],
409
452
  GetMsaaType: [carbon.method, impl.adapted],
410
453
  GetMsaaQuality: [carbon.method, impl.adapted],
@@ -1 +1 @@
1
- {"version":3,"file":"TriTextureRes.js","sources":["../../../../src/resource/texture/TriTextureRes.js"],"sourcesContent":["// Source: trinity/trinity/Resources/TriTextureRes.h\n// Source: trinity/trinity/Resources/TriTextureRes.cpp\n// Source: trinity/trinity/Resources/TriTextureRes_Blue.cpp\nimport { CjsSchema, carbon, impl, io, type } from \"#schema\";\nimport { CjsResource } from \"../CjsResource.js\";\nimport { ResourceRequirement } from \"../ResourceRequirement.js\";\nimport {\n ResourcePayloadType,\n validateRgbaPayload,\n validateTexturePayload,\n validateVideoPayload\n} from \"../format/payloadContract.js\";\nimport {\n resourceBoundaryError,\n resourceFormatRequiredError,\n resourcePayloadError,\n validateResourcePayload\n} from \"../resourceBoundary.js\";\n\n/**\n * Resource record that owns Carbon-style texture identity and validated\n * texture, RGBA, or video payload facts with mirrored dimension/format\n * metadata, while engine packages decide what those facts become on a device.\n *\n * The resource never CREATES a backend texture - it cannot reach a render\n * context - but it RETAINS the one Trinity makes for it, as Carbon's does\n * (`m_texture`), so every parameter sharing the resource binds one texture.\n */\nexport class TriTextureRes extends CjsResource\n{\n format = null;\n type = null;\n averageColor = [0, 0, 0, 0];\n depth = 0;\n cutoutHeight = 1;\n height = 0;\n lodEnabled = false;\n hadLodRequests = false;\n cpuMip = 0;\n gpuMip = 0;\n wrappedRenderTarget = null;\n originalResolution = 0;\n originalMemoryUsage = 0;\n name = \"\";\n arraySize = 0;\n cutoutWidth = 1;\n width = 0;\n cutoutX = 0;\n cutoutY = 0;\n\n /** Creates a TriTextureRes with caller-provided initial state. */\n constructor(values = null) {\n super();\n this.SetValues(values || {}, {\n markDirty: false,\n skipUpdate: true,\n skipEvents: true\n });\n }\n\n /**\n * m_texture: the live `Tr2TextureAL`, or null until an engine makes one.\n *\n * Carbon creates it in `DoPrepare` through the main-thread context and\n * stores it here (`TriTextureRes.cpp:690-704`). This layer cannot reach a\n * render context, so Trinity creates it at first bind and stores it here,\n * where every parameter sharing the resource finds the one texture.\n */\n texture = null;\n\n /**\n * The live texture, or null while there is none - Carbon returns nullptr\n * until the load finishes and the parameter substitutes the fallback\n * (`TriTextureRes.cpp:394-405`).\n *\n * @returns {object|null} A `Tr2TextureAL`.\n */\n GetTexture() {\n return this.texture && this.texture.IsValid() ? this.texture : null;\n }\n\n /**\n * Adopts a texture as this resource's (`TriTextureRes.cpp:1159-1195`).\n *\n * @param {object|null} texture A `Tr2TextureAL`, or null to drop it.\n * @returns {TriTextureRes} This resource.\n */\n SetTexture(texture) {\n if (this.texture && this.texture !== texture) this.texture.Destroy();\n this.texture = texture ?? null;\n return this;\n }\n\n /**\n * Attach a plain texture, RGBA, or video payload and mirror Carbon-exposed\n * metadata. Invalid payloads are rejected before replacing the current one.\n *\n * @param {object|null} payload\n * @param {object|null} options\n * @returns {TriTextureRes}\n */\n SetPayload(payload = null, options = null) {\n if (payload === null) {\n // The bytes are gone; so is the texture made from them.\n this.SetTexture(null);\n super.SetPayload(null);\n return this;\n }\n\n const validator = {\n [ResourcePayloadType.RGBA]: validateRgbaPayload,\n [ResourcePayloadType.TEXTURE]: validateTexturePayload,\n [ResourcePayloadType.VIDEO]: validateVideoPayload\n }[payload?.payloadType];\n if (!validator) {\n throw resourcePayloadError(\n \"TriTextureRes\",\n 'Expected payloadType \"rgba\", \"texture\", or \"video\".',\n \"payloadType\"\n );\n }\n validateResourcePayload(\"TriTextureRes\", payload, validator);\n\n const values = { ...(options || {}) };\n if (payload.pixelFormat !== undefined || payload.format !== undefined) values.format = payload.pixelFormat || payload.format;\n if (payload.width !== undefined) values.width = payload.width;\n if (payload.height !== undefined) values.height = payload.height;\n if (payload.depth !== undefined) values.depth = payload.depth;\n if (payload.arraySize !== undefined) values.arraySize = payload.arraySize;\n else if (Array.isArray(payload.faces)) values.arraySize = payload.faces.length;\n if (payload.mipCount !== undefined) values.cpuMip = payload.mipCount;\n else if (payload.payloadType === ResourcePayloadType.RGBA) values.cpuMip = 1;\n if (payload.hadLodRequests !== undefined) values.hadLodRequests = !!payload.hadLodRequests;\n values.originalMemoryUsage = getPayloadMemoryUsage(payload);\n values.originalResolution = Math.max(payload.width || 0, payload.height || 0, this.originalResolution || 0);\n\n super.SetPayload(payload);\n this.SetValues(values);\n return this;\n }\n\n /**\n * Turn source bytes into this texture.\n *\n * This is the family the route design exists for. One `.dds` is readable as a\n * compressed `texture` or decoded `rgba`, and six formats — dds, png, jpeg,\n * tga, gif, webp — populate this same resource. Which reader and which\n * representation is a registration decision, so neither is written here.\n *\n * The resource imports none of them. A texture resource that imported its\n * formats would drag all six into anything that touches a texture, which is\n * the whole reason the store exists.\n *\n * @param {ArrayBuffer|ArrayBufferView|object} data Source bytes, or a payload already read.\n * @param {object|null} [options] `{ format, read, output }` plus values applied after the read.\n * @returns {TriTextureRes} This resource.\n */\n DoLoad(data, options = null) {\n const { format = null, read = null, output = null, ...values } = options || {};\n\n // Already a payload: the manager read it, and there is nothing to route.\n if (data?.payloadType !== undefined) return this.SetPayload(data, values);\n\n const route = this.ResolveFormat(data, format ? { format, read, output } : { output });\n if (!route) throw resourceFormatRequiredError(\"TriTextureRes\", this.ext, output);\n return this.SetPayload(route.Read(data), values);\n }\n\n /**\n * Return the number of mip levels known to this texture resource.\n *\n * @returns {number}\n */\n GetMipCount() {\n return this.GetPayload()?.mipCount || this.cpuMip || 0;\n }\n\n /**\n * Return the multisample type for this texture.\n *\n * @returns {number}\n */\n GetMsaaType() {\n const payload = this.GetPayload();\n return payload?.multiSampleType ?? payload?.msaaType ?? payload?.samples ?? 1;\n }\n\n /**\n * Return the multisample quality for this texture.\n *\n * @returns {number}\n */\n GetMsaaQuality() {\n const payload = this.GetPayload();\n return payload?.multiSampleQuality ?? payload?.msaaQuality ?? 0;\n }\n\n /**\n * Return true if this texture has received LOD requests.\n *\n * @returns {boolean}\n */\n HadLodRequests() {\n return this.hadLodRequests;\n }\n\n /**\n * Return the shader-resource-view heap index when a backend owns one.\n *\n * @returns {number}\n */\n GetSrvIndexInHeap() {\n throw resourceBoundaryError(\"TriTextureRes\", \"GetSrvIndexInHeap\", \"Runtime-resource does not own descriptor heaps.\");\n }\n\n /**\n * Save this texture asynchronously.\n *\n * @param {string} path\n * @returns {boolean}\n */\n SaveAsync(path = \"\") {\n throw resourceBoundaryError(\n \"TriTextureRes\",\n \"SaveAsync\",\n `Use a format writer and caller-owned destination to save texture payloads${path ? ` (${path})` : \"\"}.`\n );\n }\n\n /**\n * Save this texture synchronously.\n *\n * @param {string} path\n * @returns {boolean}\n */\n Save(path = \"\") {\n throw resourceBoundaryError(\n \"TriTextureRes\",\n \"Save\",\n `Use a format writer and caller-owned destination to save texture payloads${path ? ` (${path})` : \"\"}.`\n );\n }\n\n /**\n * Return true if an asynchronous save is active.\n *\n * @returns {boolean}\n */\n IsSaving() {\n return false;\n }\n\n /**\n * Return true if the asynchronous save operation has completed.\n *\n * @returns {boolean}\n */\n IsSaveCompleted() {\n return true;\n }\n\n /**\n * Return true if the asynchronous save operation succeeded.\n *\n * @returns {boolean}\n */\n IsSaveSucceeded() {\n return false;\n }\n\n /**\n * Wait for an asynchronous save operation.\n *\n * @returns {boolean}\n */\n WaitForSave() {\n return this.IsSaveCompleted();\n }\n\n /**\n * Device texture allocation belongs to engine-gpu.\n *\n * @throws {Error}\n */\n CreateEmptyTexture() {\n throw resourceBoundaryError(\"TriTextureRes\", \"CreateEmptyTexture\", \"Use engine-gpu to allocate device textures.\");\n }\n\n /**\n * Render-target wrapping belongs to engine-gpu.\n *\n * @throws {Error}\n */\n SetFromRenderTarget() {\n throw resourceBoundaryError(\"TriTextureRes\", \"SetFromRenderTarget\", \"Runtime-resource does not own render targets.\");\n }\n\n /**\n * Create a texture copy from a render target.\n *\n * @throws {Error}\n */\n CreateAndCopyFromRenderTarget() {\n throw resourceBoundaryError(\"TriTextureRes\", \"CreateAndCopyFromRenderTarget\", \"Runtime-resource does not own render targets.\");\n }\n\n /**\n * Create a device texture from a host bitmap.\n *\n * @throws {Error}\n */\n CreateFromHostBitmap() {\n throw resourceBoundaryError(\"TriTextureRes\", \"CreateFromHostBitmap\", \"Use engine-gpu to allocate and upload texture data.\");\n }\n\n /**\n * Create this texture from another texture resource.\n *\n * @throws {Error}\n */\n CreateFromTexture() {\n throw resourceBoundaryError(\"TriTextureRes\", \"CreateFromTexture\", \"Use engine-gpu to copy device textures.\");\n }\n\n /**\n * Return true if this texture owns a backend allocation object.\n *\n * @param {string|number} type\n * @param {string|number} object\n * @returns {boolean}\n */\n HasALObject(type, object) {\n return this.HasAdapterResource(`${type}:${object}`);\n }\n\n /**\n * Return an engine-owned texture pipeline object when attached.\n *\n * @returns {*}\n */\n GetPipeline() {\n return this.GetAdapterResource(\"pipeline\");\n }\n\n /**\n * Return memory size for the original non-LODed texture.\n *\n * @returns {number}\n */\n GetOriginalMemoryUsage() {\n return this.originalMemoryUsage || getPayloadMemoryUsage(this.GetPayload());\n }\n\n /**\n * Store the average color reported by decoded texture data.\n *\n * @param {number} red\n * @param {number} green\n * @param {number} blue\n * @param {number} alpha\n * @returns {TriTextureRes}\n */\n SetAverageColor(red = 0, green = 0, blue = 0, alpha = 0) {\n this.averageColor = [red, green, blue, alpha];\n return this;\n }\n\n /**\n * Update a texture subresource.\n *\n * @throws {Error}\n */\n UpdateSubresource() {\n throw resourceBoundaryError(\"TriTextureRes\", \"UpdateSubresource\", \"Use engine-gpu to upload texture bytes.\");\n }\n\n /**\n * Resource preparation does not decide device upload policy.\n *\n * @returns {boolean}\n */\n PrepareResources() {\n return this.IsPrepared();\n }\n\n static payload = ResourceRequirement.TEXTURE;\n}\n\nfunction getPayloadMemoryUsage(payload)\n{\n if (!payload || typeof payload !== \"object\") return 0;\n if (Number.isSafeInteger(payload.originalMemoryUsage) && payload.originalMemoryUsage >= 0)\n {\n return payload.originalMemoryUsage;\n }\n return ArrayBuffer.isView(payload.data) || payload.data instanceof ArrayBuffer\n ? payload.data.byteLength\n : 0;\n}\n\n// Declared as data rather than with decorators, so the resource tree loads from\n// source without a transform. Field order is key order, and GetValues() exports\n// in that order.\nCjsSchema.define(TriTextureRes, {\n className: \"TriTextureRes\",\n family: \"resources\",\n fields: {\n format: [ type.unknown, io.read ],\n type: [ type.unknown, io.persist ],\n averageColor: [ type.color, io.read ],\n depth: [ type.uint32, io.read ],\n cutoutHeight: [ type.float32, io.readwrite ],\n height: [ type.uint32, io.read ],\n lodEnabled: [ type.boolean, io.read ],\n hadLodRequests: [ type.boolean, io.read ],\n cpuMip: [ type.uint32, io.read ],\n gpuMip: [ type.uint32, io.read ],\n wrappedRenderTarget: [ type.unknown, io.read ],\n originalResolution: [ type.uint32, io.read ],\n originalMemoryUsage: [ type.uint64, io.read ],\n name: [ type.string, io.readwrite ],\n arraySize: [ type.uint32, io.read ],\n cutoutWidth: [ type.float32, io.readwrite ],\n width: [ type.uint32, io.read ],\n cutoutX: [ type.float32, io.readwrite ],\n cutoutY: [ type.float32, io.readwrite ]\n },\n methods: {\n GetMipCount: [ carbon.method, impl.adapted ],\n GetMsaaType: [ carbon.method, impl.adapted ],\n GetMsaaQuality: [ carbon.method, impl.adapted ],\n HadLodRequests: [ carbon.method, impl.adapted ],\n GetSrvIndexInHeap: [ carbon.method, impl.notSupported ],\n GetTexture: [ carbon.method, impl.implemented ],\n SetTexture: [ carbon.method, impl.adapted, impl.reason(\"Carbon also copies the texture's dimensions onto the resource and fires m_onTextureChange; the payload already carries the dimensions here, and the binding parameter arms the resource's completion instead.\") ],\n SaveAsync: [ carbon.method, impl.notSupported ],\n Save: [ carbon.method, impl.notSupported ],\n IsSaving: [ carbon.method, impl.noop ],\n IsSaveCompleted: [ carbon.method, impl.noop ],\n IsSaveSucceeded: [ carbon.method, impl.noop ],\n WaitForSave: [ carbon.method, impl.noop ],\n CreateEmptyTexture: [ carbon.method, impl.notSupported ],\n SetFromRenderTarget: [ carbon.method, impl.notSupported ],\n CreateAndCopyFromRenderTarget: [ carbon.method, impl.notSupported ],\n CreateFromHostBitmap: [ carbon.method, impl.notSupported ],\n CreateFromTexture: [ carbon.method, impl.notSupported ],\n HasALObject: [ carbon.method, impl.adapted ],\n GetPipeline: [ carbon.method, impl.adapted ],\n GetOriginalMemoryUsage: [ carbon.method, impl.adapted ],\n SetAverageColor: [ carbon.method, impl.adapted ],\n UpdateSubresource: [ carbon.method, impl.notSupported ],\n PrepareResources: [ carbon.method, impl.adapted ]\n }\n});\n"],"names":["TriTextureRes","CjsResource","format","type","averageColor","depth","cutoutHeight","height","lodEnabled","hadLodRequests","cpuMip","gpuMip","wrappedRenderTarget","originalResolution","originalMemoryUsage","name","arraySize","cutoutWidth","width","cutoutX","cutoutY","constructor","values","SetValues","markDirty","skipUpdate","skipEvents","texture","GetTexture","IsValid","SetTexture","Destroy","SetPayload","payload","options","validator","ResourcePayloadType","RGBA","validateRgbaPayload","TEXTURE","validateTexturePayload","VIDEO","validateVideoPayload","payloadType","resourcePayloadError","validateResourcePayload","pixelFormat","undefined","Array","isArray","faces","length","mipCount","getPayloadMemoryUsage","Math","max","DoLoad","data","read","output","route","ResolveFormat","resourceFormatRequiredError","ext","Read","GetMipCount","GetPayload","GetMsaaType","multiSampleType","msaaType","samples","GetMsaaQuality","multiSampleQuality","msaaQuality","HadLodRequests","GetSrvIndexInHeap","resourceBoundaryError","SaveAsync","path","Save","IsSaving","IsSaveCompleted","IsSaveSucceeded","WaitForSave","CreateEmptyTexture","SetFromRenderTarget","CreateAndCopyFromRenderTarget","CreateFromHostBitmap","CreateFromTexture","HasALObject","object","HasAdapterResource","GetPipeline","GetAdapterResource","GetOriginalMemoryUsage","SetAverageColor","red","green","blue","alpha","UpdateSubresource","PrepareResources","IsPrepared","ResourceRequirement","Number","isSafeInteger","ArrayBuffer","isView","byteLength","CjsSchema","define","className","family","fields","unknown","io","persist","color","uint32","float32","readwrite","boolean","uint64","string","methods","carbon","method","impl","adapted","notSupported","implemented","reason","noop"],"mappings":";;;;;;AAAA;AACA;AACA;;AAiBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,aAAa,SAASC,WAAW,CAC9C;AACEC,EAAAA,MAAM,GAAG,IAAI;AACbC,EAAAA,IAAI,GAAG,IAAI;EACXC,YAAY,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAC3BC,EAAAA,KAAK,GAAG,CAAC;AACTC,EAAAA,YAAY,GAAG,CAAC;AAChBC,EAAAA,MAAM,GAAG,CAAC;AACVC,EAAAA,UAAU,GAAG,KAAK;AAClBC,EAAAA,cAAc,GAAG,KAAK;AACtBC,EAAAA,MAAM,GAAG,CAAC;AACVC,EAAAA,MAAM,GAAG,CAAC;AACVC,EAAAA,mBAAmB,GAAG,IAAI;AAC1BC,EAAAA,kBAAkB,GAAG,CAAC;AACtBC,EAAAA,mBAAmB,GAAG,CAAC;AACvBC,EAAAA,IAAI,GAAG,EAAE;AACTC,EAAAA,SAAS,GAAG,CAAC;AACbC,EAAAA,WAAW,GAAG,CAAC;AACfC,EAAAA,KAAK,GAAG,CAAC;AACTC,EAAAA,OAAO,GAAG,CAAC;AACXC,EAAAA,OAAO,GAAG,CAAC;;AAEX;AACAC,EAAAA,WAAWA,CAACC,MAAM,GAAG,IAAI,EAAE;AACzB,IAAA,KAAK,EAAE;AACP,IAAA,IAAI,CAACC,SAAS,CAACD,MAAM,IAAI,EAAE,EAAE;AAC3BE,MAAAA,SAAS,EAAE,KAAK;AAChBC,MAAAA,UAAU,EAAE,IAAI;AAChBC,MAAAA,UAAU,EAAE;AACd,KAAC,CAAC;AACJ,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACEC,EAAAA,OAAO,GAAG,IAAI;;AAEd;AACF;AACA;AACA;AACA;AACA;AACA;AACEC,EAAAA,UAAUA,GAAG;AACX,IAAA,OAAO,IAAI,CAACD,OAA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TextureRes.js"],"sourcesContent":["// Source: trinity/trinity/Resources/TriTextureRes.h\n// Source: trinity/trinity/Resources/TriTextureRes.cpp\n// Source: trinity/trinity/Resources/TriTextureRes_Blue.cpp\nimport { CjsSchema, carbon, impl, io, type } from \"#schema\";\nimport { CjsResource } from \"../CjsResource.js\";\nimport { IsSolidColorTexturePath, RasterizeSolidColor } from \"./solidColorTexture.js\";\nimport { ResourceRequirement } from \"../ResourceRequirement.js\";\nimport {\n ResourcePayloadType,\n validateRgbaPayload,\n validateTexturePayload,\n validateVideoPayload\n} from \"../format/payloadContract.js\";\nimport {\n resourceBoundaryError,\n resourceFormatRequiredError,\n resourcePayloadError,\n validateResourcePayload\n} from \"../resourceBoundary.js\";\n\n/**\n * Resource record that owns Carbon-style texture identity and validated\n * texture, RGBA, or video payload facts with mirrored dimension/format\n * metadata, while engine packages decide what those facts become on a device.\n *\n * The resource never CREATES a backend texture - it cannot reach a render\n * context - but it RETAINS the one Trinity makes for it, as Carbon's does\n * (`m_texture`), so every parameter sharing the resource binds one texture.\n */\nexport class TriTextureRes extends CjsResource\n{\n format = null;\n type = null;\n averageColor = [0, 0, 0, 0];\n depth = 0;\n cutoutHeight = 1;\n height = 0;\n lodEnabled = false;\n hadLodRequests = false;\n cpuMip = 0;\n gpuMip = 0;\n wrappedRenderTarget = null;\n originalResolution = 0;\n originalMemoryUsage = 0;\n name = \"\";\n arraySize = 0;\n cutoutWidth = 1;\n width = 0;\n cutoutX = 0;\n cutoutY = 0;\n\n /** Creates a TriTextureRes with caller-provided initial state. */\n constructor(values = null) {\n super();\n this.SetValues(values || {}, {\n markDirty: false,\n skipUpdate: true,\n skipEvents: true\n });\n }\n\n /**\n * Carbon's Initialize, with its procedural branch (TriTextureRes.cpp:223-236):\n * a `dynamic:/color/` path is rasterized here rather than loaded from source.\n * The `dynamic:/gradient_1d/` branch Carbon checks first is not ported yet.\n *\n * @param {string} path Resource path.\n * @param {string|null} [ext] Extension override.\n * @param {string} [requirement] Semantic requirement.\n * @returns {TriTextureRes} This resource.\n */\n Initialize(path, ext = null, requirement = \"\") {\n super.Initialize(path, ext, requirement);\n if (IsSolidColorTexturePath(this.path)) this.#RasterizeProceduralTexture(RasterizeSolidColor);\n return this;\n }\n\n /**\n * `RasterizeProceduralTexture` (TriTextureRes.cpp:181-212). Carbon creates the\n * GPU texture from the bitmap here; this layer cannot reach a render context,\n * so it publishes the bitmap as the payload and Trinity makes the texture at\n * first bind, as it does for every other texture.\n *\n * @param {Function} rasterize `(path) => payload | null`.\n * @returns {void}\n */\n #RasterizeProceduralTexture(rasterize) {\n this.MarkLoading();\n const payload = rasterize(this.path);\n if (!payload) {\n // Carbon: \"Failed to parse dynamic:/color/%s texture path\", and the\n // texture is never prepared.\n const error = new Error(`Failed to parse ${this.path} texture path`);\n error.code = \"CJS_TEXTURE_PROCEDURAL_PATH_INVALID\";\n error.path = this.path;\n this.SetError(error);\n return;\n }\n this.SetPayload(payload);\n this.MarkPrepared();\n }\n\n /**\n * m_texture: the live `Tr2TextureAL`, or null until an engine makes one.\n *\n * Carbon creates it in `DoPrepare` through the main-thread context and\n * stores it here (`TriTextureRes.cpp:690-704`). This layer cannot reach a\n * render context, so Trinity creates it at first bind and stores it here,\n * where every parameter sharing the resource finds the one texture.\n */\n texture = null;\n\n /**\n * The live texture, or null while there is none - Carbon returns nullptr\n * until the load finishes and the parameter substitutes the fallback\n * (`TriTextureRes.cpp:394-405`).\n *\n * @returns {object|null} A `Tr2TextureAL`.\n */\n GetTexture() {\n return this.texture && this.texture.IsValid() ? this.texture : null;\n }\n\n /**\n * Adopts a texture as this resource's (`TriTextureRes.cpp:1159-1195`).\n *\n * @param {object|null} texture A `Tr2TextureAL`, or null to drop it.\n * @returns {TriTextureRes} This resource.\n */\n SetTexture(texture) {\n if (this.texture && this.texture !== texture) this.texture.Destroy();\n this.texture = texture ?? null;\n return this;\n }\n\n /**\n * Attach a plain texture, RGBA, or video payload and mirror Carbon-exposed\n * metadata. Invalid payloads are rejected before replacing the current one.\n *\n * @param {object|null} payload\n * @param {object|null} options\n * @returns {TriTextureRes}\n */\n SetPayload(payload = null, options = null) {\n if (payload === null) {\n // The bytes are gone; so is the texture made from them.\n this.SetTexture(null);\n super.SetPayload(null);\n return this;\n }\n\n const validator = {\n [ResourcePayloadType.RGBA]: validateRgbaPayload,\n [ResourcePayloadType.TEXTURE]: validateTexturePayload,\n [ResourcePayloadType.VIDEO]: validateVideoPayload\n }[payload?.payloadType];\n if (!validator) {\n throw resourcePayloadError(\n \"TriTextureRes\",\n 'Expected payloadType \"rgba\", \"texture\", or \"video\".',\n \"payloadType\"\n );\n }\n validateResourcePayload(\"TriTextureRes\", payload, validator);\n\n const values = { ...(options || {}) };\n if (payload.pixelFormat !== undefined || payload.format !== undefined) values.format = payload.pixelFormat || payload.format;\n if (payload.width !== undefined) values.width = payload.width;\n if (payload.height !== undefined) values.height = payload.height;\n if (payload.depth !== undefined) values.depth = payload.depth;\n if (payload.arraySize !== undefined) values.arraySize = payload.arraySize;\n else if (Array.isArray(payload.faces)) values.arraySize = payload.faces.length;\n if (payload.mipCount !== undefined) values.cpuMip = payload.mipCount;\n else if (payload.payloadType === ResourcePayloadType.RGBA) values.cpuMip = 1;\n if (payload.hadLodRequests !== undefined) values.hadLodRequests = !!payload.hadLodRequests;\n values.originalMemoryUsage = getPayloadMemoryUsage(payload);\n values.originalResolution = Math.max(payload.width || 0, payload.height || 0, this.originalResolution || 0);\n\n super.SetPayload(payload);\n this.SetValues(values);\n return this;\n }\n\n /**\n * Turn source bytes into this texture.\n *\n * This is the family the route design exists for. One `.dds` is readable as a\n * compressed `texture` or decoded `rgba`, and six formats — dds, png, jpeg,\n * tga, gif, webp — populate this same resource. Which reader and which\n * representation is a registration decision, so neither is written here.\n *\n * The resource imports none of them. A texture resource that imported its\n * formats would drag all six into anything that touches a texture, which is\n * the whole reason the store exists.\n *\n * @param {ArrayBuffer|ArrayBufferView|object} data Source bytes, or a payload already read.\n * @param {object|null} [options] `{ format, read, output }` plus values applied after the read.\n * @returns {TriTextureRes} This resource.\n */\n DoLoad(data, options = null) {\n const { format = null, read = null, output = null, ...values } = options || {};\n\n // Already a payload: the manager read it, and there is nothing to route.\n if (data?.payloadType !== undefined) return this.SetPayload(data, values);\n\n const route = this.ResolveFormat(data, format ? { format, read, output } : { output });\n if (!route) throw resourceFormatRequiredError(\"TriTextureRes\", this.ext, output);\n return this.SetPayload(route.Read(data), values);\n }\n\n /**\n * Return the number of mip levels known to this texture resource.\n *\n * @returns {number}\n */\n GetMipCount() {\n return this.GetPayload()?.mipCount || this.cpuMip || 0;\n }\n\n /**\n * Return the multisample type for this texture.\n *\n * @returns {number}\n */\n GetMsaaType() {\n const payload = this.GetPayload();\n return payload?.multiSampleType ?? payload?.msaaType ?? payload?.samples ?? 1;\n }\n\n /**\n * Return the multisample quality for this texture.\n *\n * @returns {number}\n */\n GetMsaaQuality() {\n const payload = this.GetPayload();\n return payload?.multiSampleQuality ?? payload?.msaaQuality ?? 0;\n }\n\n /**\n * Return true if this texture has received LOD requests.\n *\n * @returns {boolean}\n */\n HadLodRequests() {\n return this.hadLodRequests;\n }\n\n /**\n * Return the shader-resource-view heap index when a backend owns one.\n *\n * @returns {number}\n */\n GetSrvIndexInHeap() {\n throw resourceBoundaryError(\"TriTextureRes\", \"GetSrvIndexInHeap\", \"Runtime-resource does not own descriptor heaps.\");\n }\n\n /**\n * Save this texture asynchronously.\n *\n * @param {string} path\n * @returns {boolean}\n */\n SaveAsync(path = \"\") {\n throw resourceBoundaryError(\n \"TriTextureRes\",\n \"SaveAsync\",\n `Use a format writer and caller-owned destination to save texture payloads${path ? ` (${path})` : \"\"}.`\n );\n }\n\n /**\n * Save this texture synchronously.\n *\n * @param {string} path\n * @returns {boolean}\n */\n Save(path = \"\") {\n throw resourceBoundaryError(\n \"TriTextureRes\",\n \"Save\",\n `Use a format writer and caller-owned destination to save texture payloads${path ? ` (${path})` : \"\"}.`\n );\n }\n\n /**\n * Return true if an asynchronous save is active.\n *\n * @returns {boolean}\n */\n IsSaving() {\n return false;\n }\n\n /**\n * Return true if the asynchronous save operation has completed.\n *\n * @returns {boolean}\n */\n IsSaveCompleted() {\n return true;\n }\n\n /**\n * Return true if the asynchronous save operation succeeded.\n *\n * @returns {boolean}\n */\n IsSaveSucceeded() {\n return false;\n }\n\n /**\n * Wait for an asynchronous save operation.\n *\n * @returns {boolean}\n */\n WaitForSave() {\n return this.IsSaveCompleted();\n }\n\n /**\n * Device texture allocation belongs to engine-gpu.\n *\n * @throws {Error}\n */\n CreateEmptyTexture() {\n throw resourceBoundaryError(\"TriTextureRes\", \"CreateEmptyTexture\", \"Use engine-gpu to allocate device textures.\");\n }\n\n /**\n * Render-target wrapping belongs to engine-gpu.\n *\n * @throws {Error}\n */\n SetFromRenderTarget() {\n throw resourceBoundaryError(\"TriTextureRes\", \"SetFromRenderTarget\", \"Runtime-resource does not own render targets.\");\n }\n\n /**\n * Create a texture copy from a render target.\n *\n * @throws {Error}\n */\n CreateAndCopyFromRenderTarget() {\n throw resourceBoundaryError(\"TriTextureRes\", \"CreateAndCopyFromRenderTarget\", \"Runtime-resource does not own render targets.\");\n }\n\n /**\n * Create a device texture from a host bitmap.\n *\n * @throws {Error}\n */\n CreateFromHostBitmap() {\n throw resourceBoundaryError(\"TriTextureRes\", \"CreateFromHostBitmap\", \"Use engine-gpu to allocate and upload texture data.\");\n }\n\n /**\n * Create this texture from another texture resource.\n *\n * @throws {Error}\n */\n CreateFromTexture() {\n throw resourceBoundaryError(\"TriTextureRes\", \"CreateFromTexture\", \"Use engine-gpu to copy device textures.\");\n }\n\n /**\n * Return true if this texture owns a backend allocation object.\n *\n * @param {string|number} type\n * @param {string|number} object\n * @returns {boolean}\n */\n HasALObject(type, object) {\n return this.HasAdapterResource(`${type}:${object}`);\n }\n\n /**\n * Return an engine-owned texture pipeline object when attached.\n *\n * @returns {*}\n */\n GetPipeline() {\n return this.GetAdapterResource(\"pipeline\");\n }\n\n /**\n * Return memory size for the original non-LODed texture.\n *\n * @returns {number}\n */\n GetOriginalMemoryUsage() {\n return this.originalMemoryUsage || getPayloadMemoryUsage(this.GetPayload());\n }\n\n /**\n * Store the average color reported by decoded texture data.\n *\n * @param {number} red\n * @param {number} green\n * @param {number} blue\n * @param {number} alpha\n * @returns {TriTextureRes}\n */\n SetAverageColor(red = 0, green = 0, blue = 0, alpha = 0) {\n this.averageColor = [red, green, blue, alpha];\n return this;\n }\n\n /**\n * Update a texture subresource.\n *\n * @throws {Error}\n */\n UpdateSubresource() {\n throw resourceBoundaryError(\"TriTextureRes\", \"UpdateSubresource\", \"Use engine-gpu to upload texture bytes.\");\n }\n\n /**\n * Resource preparation does not decide device upload policy.\n *\n * @returns {boolean}\n */\n PrepareResources() {\n return this.IsPrepared();\n }\n\n static payload = ResourceRequirement.TEXTURE;\n}\n\nfunction getPayloadMemoryUsage(payload)\n{\n if (!payload || typeof payload !== \"object\") return 0;\n if (Number.isSafeInteger(payload.originalMemoryUsage) && payload.originalMemoryUsage >= 0)\n {\n return payload.originalMemoryUsage;\n }\n return ArrayBuffer.isView(payload.data) || payload.data instanceof ArrayBuffer\n ? payload.data.byteLength\n : 0;\n}\n\n// Declared as data rather than with decorators, so the resource tree loads from\n// source without a transform. Field order is key order, and GetValues() exports\n// in that order.\nCjsSchema.define(TriTextureRes, {\n className: \"TriTextureRes\",\n family: \"resources\",\n fields: {\n format: [ type.unknown, io.read ],\n type: [ type.unknown, io.persist ],\n averageColor: [ type.color, io.read ],\n depth: [ type.uint32, io.read ],\n cutoutHeight: [ type.float32, io.readwrite ],\n height: [ type.uint32, io.read ],\n lodEnabled: [ type.boolean, io.read ],\n hadLodRequests: [ type.boolean, io.read ],\n cpuMip: [ type.uint32, io.read ],\n gpuMip: [ type.uint32, io.read ],\n wrappedRenderTarget: [ type.unknown, io.read ],\n originalResolution: [ type.uint32, io.read ],\n originalMemoryUsage: [ type.uint64, io.read ],\n name: [ type.string, io.readwrite ],\n arraySize: [ type.uint32, io.read ],\n cutoutWidth: [ type.float32, io.readwrite ],\n width: [ type.uint32, io.read ],\n cutoutX: [ type.float32, io.readwrite ],\n cutoutY: [ type.float32, io.readwrite ]\n },\n methods: {\n Initialize: [ carbon.method, impl.adapted, impl.reason(\"Carbon rasterizes a procedural path into a half-float HostBitmap and creates the GPU texture inside Initialize; this resource cannot reach a render context, so it publishes the half-float-quantized colour as an rgba32float payload. The gradient_1d branch is not ported.\") ],\n GetMipCount: [ carbon.method, impl.adapted ],\n GetMsaaType: [ carbon.method, impl.adapted ],\n GetMsaaQuality: [ carbon.method, impl.adapted ],\n HadLodRequests: [ carbon.method, impl.adapted ],\n GetSrvIndexInHeap: [ carbon.method, impl.notSupported ],\n GetTexture: [ carbon.method, impl.implemented ],\n SetTexture: [ carbon.method, impl.adapted, impl.reason(\"Carbon also copies the texture's dimensions onto the resource and fires m_onTextureChange; the payload already carries the dimensions here, and the binding parameter arms the resource's completion instead.\") ],\n SaveAsync: [ carbon.method, impl.notSupported ],\n Save: [ carbon.method, impl.notSupported ],\n IsSaving: [ carbon.method, impl.noop ],\n IsSaveCompleted: [ carbon.method, impl.noop ],\n IsSaveSucceeded: [ carbon.method, impl.noop ],\n WaitForSave: [ carbon.method, impl.noop ],\n CreateEmptyTexture: [ carbon.method, impl.notSupported ],\n SetFromRenderTarget: [ carbon.method, impl.notSupported ],\n CreateAndCopyFromRenderTarget: [ carbon.method, impl.notSupported ],\n CreateFromHostBitmap: [ carbon.method, impl.notSupported ],\n CreateFromTexture: [ carbon.method, impl.notSupported ],\n HasALObject: [ carbon.method, impl.adapted ],\n GetPipeline: [ carbon.method, impl.adapted ],\n GetOriginalMemoryUsage: [ carbon.method, impl.adapted ],\n SetAverageColor: [ carbon.method, impl.adapted ],\n UpdateSubresource: [ carbon.method, impl.notSupported ],\n PrepareResources: [ carbon.method, impl.adapted ]\n }\n});\n"],"names":["TriTextureRes","CjsResource","format","type","averageColor","depth","cutoutHeight","height","lodEnabled","hadLodRequests","cpuMip","gpuMip","wrappedRenderTarget","originalResolution","originalMemoryUsage","name","arraySize","cutoutWidth","width","cutoutX","cutoutY","constructor","values","SetValues","markDirty","skipUpdate","skipEvents","Initialize","path","ext","requirement","IsSolidColorTexturePath","RasterizeSolidColor","#RasterizeProceduralTexture","rasterize","MarkLoading","payload","error","Error","code","SetError","SetPayload","MarkPrepared","texture","GetTexture","IsValid","SetTexture","Destroy","options","validator","ResourcePayloadType","RGBA","validateRgbaPayload","TEXTURE","validateTexturePayload","VIDEO","validateVideoPayload","payloadType","resourcePayloadError","validateResourcePayload","pixelFormat","undefined","Array","isArray","faces","length","mipCount","getPayloadMemoryUsage","Math","max","DoLoad","data","read","output","route","ResolveFormat","resourceFormatRequiredError","Read","GetMipCount","GetPayload","GetMsaaType","multiSampleType","msaaType","samples","GetMsaaQuality","multiSampleQuality","msaaQuality","HadLodRequests","GetSrvIndexInHeap","resourceBoundaryError","SaveAsync","Save","IsSaving","IsSaveCompleted","IsSaveSucceeded","WaitForSave","CreateEmptyTexture","SetFromRenderTarget","CreateAndCopyFromRenderTarget","CreateFromHostBitmap","CreateFromTexture","HasALObject","object","HasAdapterResource","GetPipeline","GetAdapterResource","GetOriginalMemoryUsage","SetAverageColor","red","green","blue","alpha","UpdateSubresource","PrepareResources","IsPrepared","ResourceRequirement","Number","isSafeInteger","ArrayBuffer","isView","byteLength","CjsSchema","define","className","family","fields","unknown","io","persist","color","uint32","float32","readwrite","boolean","uint64","string","methods","carbon","method","impl","adapted","reason","notSupported","implemented","noop"],"mappings":";;;;;;;AAAA;AACA;AACA;;AAkBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,aAAa,SAASC,WAAW,CAC9C;AACEC,EAAAA,MAAM,GAAG,IAAI;AACbC,EAAAA,IAAI,GAAG,IAAI;EACXC,YAAY,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAC3BC,EAAAA,KAAK,GAAG,CAAC;AACTC,EAAAA,YAAY,GAAG,CAAC;A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,CAACC,MAAM,EAAEC,IAAI,CAACG,YAAY,CAAE;IACnE3C,oBAAoB,EAAE,CAAEsC,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACG,YAAY,CAAE;IAC1D1C,iBAAiB,EAAE,CAAEqC,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACG,YAAY,CAAE;IACvDzC,WAAW,EAAE,CAAEoC,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,CAAE;IAC5CpC,WAAW,EAAE,CAAEiC,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,CAAE;IAC5ClC,sBAAsB,EAAE,CAAE+B,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,CAAE;IACvDjC,eAAe,EAAE,CAAE8B,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO,CAAE;IAChD5B,iBAAiB,EAAE,CAAEyB,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACG,YAAY,CAAE;IACvD7B,gBAAgB,EAAE,CAAEwB,MAAM,CAACC,MAAM,EAAEC,IAAI,CAACC,OAAO;AACjD;AACF,CAAC,CAAC;;;;"}
@@ -1,5 +1,6 @@
1
1
  export { CjsTextureArrayRes } from './CjsTextureArrayRes.js';
2
2
  export { CjsTextureArrayResParameterProxy } from './CjsTextureArrayResParameterProxy.js';
3
+ export { RegisterSolidColorTexture, SolidColorTextureConstructor } from './SolidColorTextureConstructor.js';
3
4
  export { Tr2ImageRes } from './Tr2ImageRes.js';
4
5
  export { Tr2TextureLodManager } from './Tr2TextureLodManager.js';
5
6
  export { Tr2TextureLodUpdateRequest } from './Tr2TextureLodUpdateRequest.js';
@@ -12,4 +13,5 @@ export { Tr2TexturePipelineStepLimitSize } from './Tr2TexturePipelineStepLimitSi
12
13
  export { Tr2TexturePipelineStepLoad } from './Tr2TexturePipelineStepLoad.js';
13
14
  export { Tr2TexturePipelineStepPack } from './Tr2TexturePipelineStepPack.js';
14
15
  export { TriTextureRes } from './TriTextureRes.js';
16
+ export { ColorPrefix, IsSolidColorTexturePath, ParseColor, RasterizeSolidColor } from './solidColorTexture.js';
15
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
@@ -0,0 +1,111 @@
1
+ import { num } from '#math/num';
2
+
3
+ // Source: trinity/trinity/Resources/Procedural/SolidColorTexture.h
4
+ // Source: trinity/trinity/Resources/Procedural/SolidColorTexture.cpp
5
+ //
6
+ // The free functions of Carbon's solid colour texture: a `dynamic:/color/r,g,b,a`
7
+ // path names a 1x1 texture of that colour. They live apart from
8
+ // SolidColorTextureConstructor because TriTextureRes.Initialize calls them, and
9
+ // the constructor builds a TriTextureRes - one module holding both would be an
10
+ // import cycle.
11
+ //
12
+ // Not ported, for want of a consumer: ColorPathToColor and ColorToColorPath.
13
+
14
+ /** `colorPrefix` (SolidColorTexture.cpp:13). */
15
+ const ColorPrefix = "dynamic:/color/";
16
+
17
+ // One `stream >> float` extraction under `std::locale( "C" )`: leading
18
+ // whitespace, an optional sign, digits with an optional fraction, and an
19
+ // optional exponent.
20
+ const FLOAT_EXTRACTION = /^\s*[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?/u;
21
+
22
+ // `stream >> coma` skips whitespace, then reads one character.
23
+ const COMMA_EXTRACTION = /^\s*,/u;
24
+
25
+ /**
26
+ * Parses `r,g,b,a` exactly as Carbon's `ParseColor` does
27
+ * (SolidColorTexture.cpp:34-70), or returns null where Carbon logs and returns
28
+ * an empty optional.
29
+ *
30
+ * quirk: the alpha extraction is followed only by `stream.eof()`. When nothing
31
+ * but whitespace follows the third comma, `stream >> color.a` fails AT the end
32
+ * of the stream, which sets eofbit, and C++11 `num_get` stores 0 on failure - so
33
+ * Carbon accepts `1,1,1,` as alpha 0. Reproduced, not corrected: a port never
34
+ * silently fixes Carbon.
35
+ *
36
+ * @param {string} query Text after `dynamic:/color/`.
37
+ * @returns {number[]|null} `[r, g, b, a]`, or null when Carbon would reject it.
38
+ */
39
+ function ParseColor(query) {
40
+ let rest = String(query);
41
+ const color = [];
42
+ for (let index = 0; index < 4; index++) {
43
+ const extraction = FLOAT_EXTRACTION.exec(rest);
44
+ if (!extraction) {
45
+ // Only the last component can fail at the end of the stream and still
46
+ // pass the eof test; a failed r/g/b leaves the stream in a fail state and
47
+ // the following comma is never read.
48
+ if (index === 3 && /^\s*$/u.test(rest)) {
49
+ color.push(0);
50
+ return color;
51
+ }
52
+ return null;
53
+ }
54
+ color.push(Number(extraction[0]));
55
+ rest = rest.slice(extraction[0].length);
56
+ if (index < 3) {
57
+ const comma = COMMA_EXTRACTION.exec(rest);
58
+ if (!comma) return null;
59
+ rest = rest.slice(comma[0].length);
60
+ }
61
+ }
62
+ // `stream.eof()`: the alpha extraction must have reached the end of the query.
63
+ return rest.length === 0 ? color : null;
64
+ }
65
+
66
+ /**
67
+ * Whether a path names a solid colour texture (SolidColorTexture.cpp:72-75).
68
+ *
69
+ * @param {string} path Resource path.
70
+ * @returns {boolean}
71
+ */
72
+ function IsSolidColorTexturePath(path) {
73
+ return String(path).startsWith(ColorPrefix);
74
+ }
75
+
76
+ /**
77
+ * Carbon's `RasterizeSolidColor` (SolidColorTexture.cpp:104-126): a 1x1 bitmap of
78
+ * the parsed colour, or null where Carbon leaves the bitmap invalid.
79
+ *
80
+ * Carbon writes `PIXEL_FORMAT_R16G16B16A16_FLOAT`. The resource payload contract
81
+ * carries float colour as `rgba32float` only, so each component is quantized
82
+ * through the half-float codec first - the stored values are Carbon's, in a
83
+ * wider container.
84
+ *
85
+ * @param {string} path `dynamic:/color/...` path.
86
+ * @returns {object|null} An `rgba` payload.
87
+ */
88
+ function RasterizeSolidColor(path) {
89
+ if (!IsSolidColorTexturePath(path)) return null;
90
+ const color = ParseColor(String(path).slice(ColorPrefix.length));
91
+ if (!color) return null;
92
+ const data = new Float32Array(4);
93
+ for (let index = 0; index < 4; index++) {
94
+ data[index] = num.fromHalfFloat(num.toHalfFloat(color[index]));
95
+ }
96
+ return {
97
+ payloadType: "rgba",
98
+ sourceFormat: "dynamic-color",
99
+ width: 1,
100
+ height: 1,
101
+ pixelFormat: "rgba32float",
102
+ data,
103
+ strideBytes: 16,
104
+ origin: "top-left",
105
+ colorSpace: "linear",
106
+ alphaMode: "straight"
107
+ };
108
+ }
109
+
110
+ export { ColorPrefix, IsSolidColorTexturePath, ParseColor, RasterizeSolidColor };
111
+ //# sourceMappingURL=solidColorTexture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solidColorTexture.js","sources":["../../../../src/resource/texture/solidColorTexture.js"],"sourcesContent":["// Source: trinity/trinity/Resources/Procedural/SolidColorTexture.h\n// Source: trinity/trinity/Resources/Procedural/SolidColorTexture.cpp\n//\n// The free functions of Carbon's solid colour texture: a `dynamic:/color/r,g,b,a`\n// path names a 1x1 texture of that colour. They live apart from\n// SolidColorTextureConstructor because TriTextureRes.Initialize calls them, and\n// the constructor builds a TriTextureRes - one module holding both would be an\n// import cycle.\n//\n// Not ported, for want of a consumer: ColorPathToColor and ColorToColorPath.\nimport { num } from \"#math/num\";\n\n/** `colorPrefix` (SolidColorTexture.cpp:13). */\nexport const ColorPrefix = \"dynamic:/color/\";\n\n// One `stream >> float` extraction under `std::locale( \"C\" )`: leading\n// whitespace, an optional sign, digits with an optional fraction, and an\n// optional exponent.\nconst FLOAT_EXTRACTION = /^\\s*[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?/u;\n\n// `stream >> coma` skips whitespace, then reads one character.\nconst COMMA_EXTRACTION = /^\\s*,/u;\n\n/**\n * Parses `r,g,b,a` exactly as Carbon's `ParseColor` does\n * (SolidColorTexture.cpp:34-70), or returns null where Carbon logs and returns\n * an empty optional.\n *\n * quirk: the alpha extraction is followed only by `stream.eof()`. When nothing\n * but whitespace follows the third comma, `stream >> color.a` fails AT the end\n * of the stream, which sets eofbit, and C++11 `num_get` stores 0 on failure - so\n * Carbon accepts `1,1,1,` as alpha 0. Reproduced, not corrected: a port never\n * silently fixes Carbon.\n *\n * @param {string} query Text after `dynamic:/color/`.\n * @returns {number[]|null} `[r, g, b, a]`, or null when Carbon would reject it.\n */\nexport function ParseColor(query)\n{\n let rest = String(query);\n const color = [];\n for (let index = 0; index < 4; index++)\n {\n const extraction = FLOAT_EXTRACTION.exec(rest);\n if (!extraction)\n {\n // Only the last component can fail at the end of the stream and still\n // pass the eof test; a failed r/g/b leaves the stream in a fail state and\n // the following comma is never read.\n if (index === 3 && /^\\s*$/u.test(rest))\n {\n color.push(0);\n return color;\n }\n return null;\n }\n color.push(Number(extraction[0]));\n rest = rest.slice(extraction[0].length);\n if (index < 3)\n {\n const comma = COMMA_EXTRACTION.exec(rest);\n if (!comma) return null;\n rest = rest.slice(comma[0].length);\n }\n }\n // `stream.eof()`: the alpha extraction must have reached the end of the query.\n return rest.length === 0 ? color : null;\n}\n\n/**\n * Whether a path names a solid colour texture (SolidColorTexture.cpp:72-75).\n *\n * @param {string} path Resource path.\n * @returns {boolean}\n */\nexport function IsSolidColorTexturePath(path)\n{\n return String(path).startsWith(ColorPrefix);\n}\n\n/**\n * Carbon's `RasterizeSolidColor` (SolidColorTexture.cpp:104-126): a 1x1 bitmap of\n * the parsed colour, or null where Carbon leaves the bitmap invalid.\n *\n * Carbon writes `PIXEL_FORMAT_R16G16B16A16_FLOAT`. The resource payload contract\n * carries float colour as `rgba32float` only, so each component is quantized\n * through the half-float codec first - the stored values are Carbon's, in a\n * wider container.\n *\n * @param {string} path `dynamic:/color/...` path.\n * @returns {object|null} An `rgba` payload.\n */\nexport function RasterizeSolidColor(path)\n{\n if (!IsSolidColorTexturePath(path)) return null;\n const color = ParseColor(String(path).slice(ColorPrefix.length));\n if (!color) return null;\n\n const data = new Float32Array(4);\n for (let index = 0; index < 4; index++)\n {\n data[index] = num.fromHalfFloat(num.toHalfFloat(color[index]));\n }\n return {\n payloadType: \"rgba\",\n sourceFormat: \"dynamic-color\",\n width: 1,\n height: 1,\n pixelFormat: \"rgba32float\",\n data,\n strideBytes: 16,\n origin: \"top-left\",\n colorSpace: \"linear\",\n alphaMode: \"straight\"\n };\n}\n"],"names":["ColorPrefix","FLOAT_EXTRACTION","COMMA_EXTRACTION","ParseColor","query","rest","String","color","index","extraction","exec","test","push","Number","slice","length","comma","IsSolidColorTexturePath","path","startsWith","RasterizeSolidColor","data","Float32Array","num","fromHalfFloat","toHalfFloat","payloadType","sourceFormat","width","height","pixelFormat","strideBytes","origin","colorSpace","alphaMode"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACO,MAAMA,WAAW,GAAG;;AAE3B;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG,oDAAoD;;AAE7E;AACA,MAAMC,gBAAgB,GAAG,QAAQ;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,UAAUA,CAACC,KAAK,EAChC;AACE,EAAA,IAAIC,IAAI,GAAGC,MAAM,CAACF,KAAK,CAAC;EACxB,MAAMG,KAAK,GAAG,EAAE;EAChB,KAAK,IAAIC,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAG,CAAC,EAAEA,KAAK,EAAE,EACtC;AACE,IAAA,MAAMC,UAAU,GAAGR,gBAAgB,CAACS,IAAI,CAACL,IAAI,CAAC;IAC9C,IAAI,CAACI,UAAU,EACf;AACE;AACA;AACA;MACA,IAAID,KAAK,KAAK,CAAC,IAAI,QAAQ,CAACG,IAAI,CAACN,IAAI,CAAC,EACtC;AACEE,QAAAA,KAAK,CAACK,IAAI,CAAC,CAAC,CAAC;AACb,QAAA,OAAOL,KAAK;AACd,MAAA;AACA,MAAA,OAAO,IAAI;AACb,IAAA;IACAA,KAAK,CAACK,IAAI,CAACC,MAAM,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CAAC;AAChE,EAAA;EACA,OAAO;AACLkB,IAAAA,WAAW,EAAE,MAAM;AACnBC,IAAAA,YAAY,EAAE,eAAe;AAC7BC,IAAAA,KAAK,EAAE,CAAC;AACRC,IAAAA,MAAM,EAAE,CAAC;AACTC,IAAAA,WAAW,EAAE,aAAa;IAC1BT,IAAI;AACJU,IAAAA,WAAW,EAAE,EAAE;AACfC,IAAAA,MAAM,EAAE,UAAU;AAClBC,IAAAA,UAAU,EAAE,QAAQ;AACpBC,IAAAA,SAAS,EAAE;GACZ;AACH;;;;"}
@@ -3,9 +3,10 @@ import { box3 } from '#math/box3';
3
3
  import { mat4 } from '#math/mat4';
4
4
  import { quat } from '#math/quat';
5
5
  import { vec3 } from '#math/vec3';
6
+ import { vec4 } from '#math/vec4';
6
7
  import { CjsModel } from '#model';
7
8
  import { io, type, carbon, impl } from '#schema';
8
- import { IEveSpaceObject2ParentData as _IEveSpaceObject2Pare } from '../../spaceObject/IEveSpaceObject2ParentData.js';
9
+ import { IEveSpaceObject2ParentData } from '../../spaceObject/IEveSpaceObject2ParentData.js';
9
10
  import { TriBatchType } from '#consts/graphics';
10
11
  import { withITr2Renderable } from '../../../core/ITr2Renderable.js';
11
12
  import { BuildStaticDecalGeometry, BuildDecalGeometry } from './decalIndices.js';
@@ -72,7 +73,7 @@ new class extends _identity {
72
73
  /** m_parentData (EveSpaceObjectDecal.h:178) - copied by value from the
73
74
  * owning space object each frame; zeroed with an identity transform by
74
75
  * Carbon's constructor (cpp:56-57). Runtime state, never persisted. */
75
- #parentData = new _IEveSpaceObject2Pare();
76
+ #parentData = new IEveSpaceObject2ParentData();
76
77
 
77
78
  /** m_parentBoneMatrix (h:190) - the animated parent bone this decal rides,
78
79
  * identity until SetBoneMatrix supplies one. */
@@ -96,7 +97,7 @@ new class extends _identity {
96
97
  * value the shader sees is recomputed per fill (cpp:366), so this port keeps
97
98
  * no member for it. */
98
99
  #inverseParentBoneMatrix = mat4.create();
99
- #shLightingScratch = new Float32Array(_IEveSpaceObject2Pare.SH_COEFFICIENT_COUNT * 4);
100
+ #shLightingScratch = new Float32Array(IEveSpaceObject2ParentData.SH_COEFFICIENT_COUNT * 4);
100
101
 
101
102
  /**
102
103
  * Property form of HasStaticIndexBuffers: whether any LOD carries decal
@@ -329,12 +330,22 @@ new class extends _identity {
329
330
  }
330
331
 
331
332
  /** Carbon copies the parent data by value at the two points UpdateVisibility
332
- * accepts the decal (cpp:145, cpp:178). shLighting is a borrowed pointer into
333
- * the parent's own PS data, so it is carried by reference exactly as Carbon
334
- * carries the pointer. */
333
+ * accepts the decal (cpp:145, cpp:178): `m_parentData = *parentData`. Member
334
+ * by member is that struct copy - no export, no allocation, on a per-decal
335
+ * per-frame path. shLighting is a borrowed pointer into the parent's own PS
336
+ * data, so it is carried by reference exactly as Carbon carries the pointer. */
335
337
  #CopyParentData(parentData) {
336
- if (this.#parentData.SetValues) this.#parentData.SetValues(parentData);else Object.assign(this.#parentData, parentData);
337
- this.#parentData.shLighting = parentData.shLighting ?? null;
338
+ const own = this.#parentData;
339
+ mat4.copy(own.transform, parentData.transform);
340
+ own.killCount = parentData.killCount;
341
+ vec4.copy(own.shipData, parentData.shipData);
342
+ vec3.copy(own.clipSphereCenter, parentData.clipSphereCenter);
343
+ own.clipRadiusSq = parentData.clipRadiusSq;
344
+ own.clipRadius2Sq = parentData.clipRadius2Sq;
345
+ own.clipFactor = parentData.clipFactor;
346
+ own.clipFactor2 = parentData.clipFactor2;
347
+ own.shLighting = parentData.shLighting;
348
+ vec4.copy(own.customData, parentData.customData);
338
349
  }
339
350
 
340
351
  /**