@carbonenginejs/runtime 0.1.0-alpha.6 → 0.1.0-alpha.7
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.
Potentially problematic release.
This version of @carbonenginejs/runtime might be problematic. Click here for more details.
- package/dist/global/consts/effectPaths.js +4 -1
- package/dist/global/consts/effectPaths.js.map +1 -1
- package/dist/global/consts/index.js +1 -1
- package/dist/global/index.js +1 -1
- package/dist/index.js +3 -3
- package/dist/resource/format/carbonEffect/carbonEffectBackendBlock.js +19 -2
- package/dist/resource/format/carbonEffect/carbonEffectBackendBlock.js.map +1 -1
- package/dist/resource/format/index.js +1 -1
- package/dist/resource/formats/hlsl/core/carbonTypedViews.js +121 -65
- package/dist/resource/formats/hlsl/core/carbonTypedViews.js.map +1 -1
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js +10 -7
- package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -1
- package/dist/resource/formats/webgpu/core/effectBackendBodySet.js +3 -1
- package/dist/resource/formats/webgpu/core/effectBackendBodySet.js.map +1 -1
- package/dist/resource/formats/webgpu/core/packageEffect.js +5 -0
- package/dist/resource/formats/webgpu/core/packageEffect.js.map +1 -1
- package/dist/resource/formats/webgpu/core/wgsl/emitWgsl.js +20 -0
- package/dist/resource/formats/webgpu/core/wgsl/emitWgsl.js.map +1 -1
- package/dist/resource/formats/webgpu/core/wgsl/emulatedAddressing.js +93 -4
- package/dist/resource/formats/webgpu/core/wgsl/emulatedAddressing.js.map +1 -1
- package/dist/resource/formats/webgpu/core/wgsl/lowerBindingLayout.js +74 -64
- package/dist/resource/formats/webgpu/core/wgsl/lowerBindingLayout.js.map +1 -1
- package/dist/resource/formats/webgpu/core/wgsl/lowerFragmentProgram.js +16 -7
- package/dist/resource/formats/webgpu/core/wgsl/lowerFragmentProgram.js.map +1 -1
- package/dist/resource/formats/webgpu/core/wgsl/wgslTypedViews.js +69 -27
- package/dist/resource/formats/webgpu/core/wgsl/wgslTypedViews.js.map +1 -1
- package/dist/resource/geometry/registerGeometryResources.js +10 -1
- package/dist/resource/geometry/registerGeometryResources.js.map +1 -1
- package/dist/sof/EveSOFDNA.js +4 -2
- package/dist/sof/EveSOFDNA.js.map +1 -1
- package/dist/sof/EveSOFDataMgr.js +83 -69
- package/dist/sof/EveSOFDataMgr.js.map +1 -1
- package/dist/trinity/core/Tr2Denoiser.js +6 -1
- package/dist/trinity/core/Tr2Denoiser.js.map +1 -1
- package/dist/trinity/core/Tr2ShadowMap.js +7 -2
- package/dist/trinity/core/Tr2ShadowMap.js.map +1 -1
- package/dist/trinity/core/context/Tr2RenderContext.js +43 -0
- package/dist/trinity/core/context/Tr2RenderContext.js.map +1 -1
- package/dist/trinity/core/device/Tr2GpuStructuredBuffer.js +134 -0
- package/dist/trinity/core/device/Tr2GpuStructuredBuffer.js.map +1 -0
- package/dist/trinity/core/index.js +1 -0
- package/dist/trinity/core/index.js.map +1 -1
- package/dist/trinity/core/lighting/Tr2LightManager.js +410 -124
- package/dist/trinity/core/lighting/Tr2LightManager.js.map +1 -1
- package/dist/trinity/eve/effect/lensflare/EveLensflare.js +303 -312
- package/dist/trinity/eve/effect/lensflare/EveLensflare.js.map +1 -1
- package/dist/trinity/eve/effect/lensflare/EveOccluder.js +117 -0
- package/dist/trinity/eve/effect/lensflare/EveOccluder.js.map +1 -0
- package/dist/trinity/eve/index.js +1 -0
- package/dist/trinity/eve/index.js.map +1 -1
- package/dist/trinity/eve/scene/EveSpaceScene.js +286 -6
- package/dist/trinity/eve/scene/EveSpaceScene.js.map +1 -1
- package/dist/trinity/eve/scene/EveSpaceSceneRenderDriver.js +212 -32
- package/dist/trinity/eve/scene/EveSpaceSceneRenderDriver.js.map +1 -1
- package/dist/trinity/generated/eve/effect/index.js +0 -1
- package/dist/trinity/generated/eve/effect/index.js.map +1 -1
- package/dist/trinity/generated/eve/index.js +0 -1
- package/dist/trinity/generated/eve/index.js.map +1 -1
- package/dist/trinity/generated/index.js +0 -2
- package/dist/trinity/generated/index.js.map +1 -1
- package/dist/trinity/generated/trinityCore/index.js +0 -1
- package/dist/trinity/generated/trinityCore/index.js.map +1 -1
- package/dist/trinity/index.js +2 -2
- package/dist/trinity/postProcess/Tr2PostProcessRenderer.js +4 -1
- package/dist/trinity/postProcess/Tr2PostProcessRenderer.js.map +1 -1
- package/dist/trinity/postProcess/Tr2SSAO.js +282 -21
- package/dist/trinity/postProcess/Tr2SSAO.js.map +1 -1
- package/dist/trinity/shader/parameter/Tr2RuntimeTextureParameter.js +71 -53
- package/dist/trinity/shader/parameter/Tr2RuntimeTextureParameter.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuRenderContextAL.js +81 -18
- package/dist/trinityal/webgpu/CjsWebgpuRenderContextAL.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuResourceSetAL.js +46 -4
- package/dist/trinityal/webgpu/CjsWebgpuResourceSetAL.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuShaderAL.js +32 -1
- package/dist/trinityal/webgpu/CjsWebgpuShaderAL.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuShaderProgramAL.js +27 -0
- package/dist/trinityal/webgpu/CjsWebgpuShaderProgramAL.js.map +1 -1
- package/dist/trinityal/webgpu/CjsWebgpuTextureAL.js +29 -4
- package/dist/trinityal/webgpu/CjsWebgpuTextureAL.js.map +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuPsoDescription.js +32 -2
- package/dist/trinityal/webgpu/core/CjsWebgpuPsoDescription.js.map +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuUtils.js +57 -5
- package/dist/trinityal/webgpu/core/CjsWebgpuUtils.js.map +1 -1
- package/dist/trinityal/webgpu/core/CjsWebgpuWorkQueue.js +111 -5
- package/dist/trinityal/webgpu/core/CjsWebgpuWorkQueue.js.map +1 -1
- package/docs/trinity/reference/classes/generated.md +20 -20
- package/docs/trinity/reference/classes/post-process.md +1 -1
- package/package.json +1 -1
- package/dist/trinity/generated/eve/effect/EveOccluder.js +0 -38
- package/dist/trinity/generated/eve/effect/EveOccluder.js.map +0 -1
- package/dist/trinity/generated/trinityCore/Tr2GpuStructuredBuffer.js +0 -48
- package/dist/trinity/generated/trinityCore/Tr2GpuStructuredBuffer.js.map +0 -1
|
@@ -1,15 +1,39 @@
|
|
|
1
|
-
import { CARBON_VIEW_FORMATS } from '../../../hlsl/core/carbonTypedViews.js';
|
|
1
|
+
import { CARBON_VIEW_FORMATS, unboundUavRegistersFor } from '../../../hlsl/core/carbonTypedViews.js';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
3
|
+
/**
|
|
4
|
+
* The shader program without the UAVs Carbon never binds
|
|
5
|
+
* (`CARBON_UNBOUND_UAVS`): their bindings leave the binding list, and
|
|
6
|
+
* `unboundUavRegisters` names their registers, whose stores then lower to
|
|
7
|
+
* nothing, as D3D11 drops a write to an empty UAV slot. The instructions and
|
|
8
|
+
* blocks are untouched, so every position the program records still holds.
|
|
9
|
+
*
|
|
10
|
+
* @param {object} program Frozen CJS shader IR.
|
|
11
|
+
* @param {object[]} semanticBindings The stage's effect-description bindings.
|
|
12
|
+
* @returns {object} The program, or a copy without those UAVs.
|
|
13
|
+
*/
|
|
14
|
+
function withoutUnboundUavs(program, semanticBindings) {
|
|
15
|
+
const registers = unboundUavRegistersFor(semanticBindings);
|
|
16
|
+
if (!registers.length) return program;
|
|
17
|
+
const unbound = new Set(registers);
|
|
18
|
+
const bindings = program.bindings.filter(binding => !(binding.resourceKind === "storage-resource" && (binding.range?.registerSpace ?? 0) === 0 && unbound.has(binding.range?.lowerBound ?? binding.registerIndex)));
|
|
19
|
+
return Object.freeze({
|
|
20
|
+
...program,
|
|
21
|
+
bindings: Object.freeze(bindings),
|
|
22
|
+
unboundUavRegisters: Object.freeze(registers)
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* What each Carbon view format (`hlsl/core/carbonTypedViews.js`) means to WGSL:
|
|
28
|
+
* the storage element, the WebGPU storage-texture format, and the
|
|
29
|
+
* four-component value D3D11 returns for an in-bounds element (missing
|
|
30
|
+
* channels 0, alpha 1). The two single-channel 32-bit formats are ones WebGPU
|
|
31
|
+
* allows as read-write storage textures; a `writeOnly` format is a write-only
|
|
32
|
+
* storage texture and never a typed buffer.
|
|
33
|
+
*
|
|
34
|
+
* A uint view applies to render stages only: compute already reads uint
|
|
35
|
+
* buffers as raw words and writes uint UAVs atomically, in the audited
|
|
36
|
+
* histogram profiles among others, and those layouts stay as they are.
|
|
13
37
|
*/
|
|
14
38
|
const TYPED_VIEW_FORMATS = Object.freeze({
|
|
15
39
|
R32_FLOAT: Object.freeze({
|
|
@@ -25,6 +49,24 @@ const TYPED_VIEW_FORMATS = Object.freeze({
|
|
|
25
49
|
storageTextureFormat: "r32uint",
|
|
26
50
|
renderStagesOnly: true,
|
|
27
51
|
expand: value => `vec4<u32>(${value}, 0u, 0u, 1u)`
|
|
52
|
+
}),
|
|
53
|
+
R32_SINT: Object.freeze({
|
|
54
|
+
returnType: CARBON_VIEW_FORMATS.R32_SINT.componentClass,
|
|
55
|
+
element: "i32",
|
|
56
|
+
storageTextureFormat: "r32sint",
|
|
57
|
+
renderStagesOnly: true,
|
|
58
|
+
expand: value => `vec4<i32>(${value}, 0i, 0i, 1i)`
|
|
59
|
+
}),
|
|
60
|
+
// Four channels: a write-only storage texture and nothing else. Core
|
|
61
|
+
// WebGPU has no read-write rgba8snorm, and no typed buffer takes it, since
|
|
62
|
+
// an array element cannot hold four packed snorm bytes.
|
|
63
|
+
R8G8B8A8_SNORM: Object.freeze({
|
|
64
|
+
returnType: CARBON_VIEW_FORMATS.R8G8B8A8_SNORM.componentClass,
|
|
65
|
+
element: "f32",
|
|
66
|
+
storageTextureFormat: "rgba8snorm",
|
|
67
|
+
renderStagesOnly: false,
|
|
68
|
+
writeOnly: true,
|
|
69
|
+
expand: value => value
|
|
28
70
|
})
|
|
29
71
|
});
|
|
30
72
|
const SCALAR_EXPANSION = Object.freeze({
|
|
@@ -33,21 +75,21 @@ const SCALAR_EXPANSION = Object.freeze({
|
|
|
33
75
|
i32: value => `vec4<i32>(${value}, 0i, 0i, 1i)`
|
|
34
76
|
});
|
|
35
77
|
|
|
36
|
-
/**
|
|
37
|
-
* A typed-buffer `ld` from a storage array of `element`, zero out of bounds.
|
|
38
|
-
*
|
|
39
|
-
* D3D's `ld` always returns four components, so a scalar element (a
|
|
40
|
-
* single-channel buffer, such as the R32_UINT histogram a compute program
|
|
41
|
-
* reads) widens as a single-channel format does - missing channels 0, alpha 1
|
|
42
|
-
* - and the instruction's swizzle then applies to a vector, as it must.
|
|
43
|
-
* Without the widening a `.x` landed on a scalar: "cannot index into
|
|
44
|
-
* expression of type 'u32'". A vector element is returned as it is.
|
|
45
|
-
*
|
|
46
|
-
* @param {string} element The array's element type, e.g. `u32` or `vec4<f32>`.
|
|
47
|
-
* @param {string} symbol The storage array's name.
|
|
48
|
-
* @param {string} address The element index expression.
|
|
49
|
-
* @param {string} length The array-length expression.
|
|
50
|
-
* @returns {string} A four-component WGSL expression.
|
|
78
|
+
/**
|
|
79
|
+
* A typed-buffer `ld` from a storage array of `element`, zero out of bounds.
|
|
80
|
+
*
|
|
81
|
+
* D3D's `ld` always returns four components, so a scalar element (a
|
|
82
|
+
* single-channel buffer, such as the R32_UINT histogram a compute program
|
|
83
|
+
* reads) widens as a single-channel format does - missing channels 0, alpha 1
|
|
84
|
+
* - and the instruction's swizzle then applies to a vector, as it must.
|
|
85
|
+
* Without the widening a `.x` landed on a scalar: "cannot index into
|
|
86
|
+
* expression of type 'u32'". A vector element is returned as it is.
|
|
87
|
+
*
|
|
88
|
+
* @param {string} element The array's element type, e.g. `u32` or `vec4<f32>`.
|
|
89
|
+
* @param {string} symbol The storage array's name.
|
|
90
|
+
* @param {string} address The element index expression.
|
|
91
|
+
* @param {string} length The array-length expression.
|
|
92
|
+
* @returns {string} A four-component WGSL expression.
|
|
51
93
|
*/
|
|
52
94
|
function typedBufferLoad(element, symbol, address, length) {
|
|
53
95
|
const expand = SCALAR_EXPANSION[element];
|
|
@@ -55,5 +97,5 @@ function typedBufferLoad(element, symbol, address, length) {
|
|
|
55
97
|
return expand ? `select(vec4<${element}>(), ${expand(clamped)}, ${address} < ${length})` : `select(${element}(), ${clamped}, ${address} < ${length})`;
|
|
56
98
|
}
|
|
57
99
|
|
|
58
|
-
export { TYPED_VIEW_FORMATS, typedBufferLoad };
|
|
100
|
+
export { TYPED_VIEW_FORMATS, typedBufferLoad, withoutUnboundUavs };
|
|
59
101
|
//# sourceMappingURL=wgslTypedViews.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wgslTypedViews.js","sources":["../../../../../../../src/resource/formats/webgpu/core/wgsl/wgslTypedViews.js"],"sourcesContent":["import { CARBON_VIEW_FORMATS } from \"../../../hlsl/core/carbonTypedViews.js\";\n\n/**\n * What each Carbon view format (`hlsl/core/carbonTypedViews.js`) means to WGSL:\n * the storage element, the WebGPU storage-texture format, and the\n * four-component value D3D11 returns for an in-bounds element (missing\n * channels 0, alpha 1).
|
|
1
|
+
{"version":3,"file":"wgslTypedViews.js","sources":["../../../../../../../src/resource/formats/webgpu/core/wgsl/wgslTypedViews.js"],"sourcesContent":["import { CARBON_VIEW_FORMATS, unboundUavRegistersFor } from \"../../../hlsl/core/carbonTypedViews.js\";\r\n\r\n/**\r\n * The shader program without the UAVs Carbon never binds\r\n * (`CARBON_UNBOUND_UAVS`): their bindings leave the binding list, and\r\n * `unboundUavRegisters` names their registers, whose stores then lower to\r\n * nothing, as D3D11 drops a write to an empty UAV slot. The instructions and\r\n * blocks are untouched, so every position the program records still holds.\r\n *\r\n * @param {object} program Frozen CJS shader IR.\r\n * @param {object[]} semanticBindings The stage's effect-description bindings.\r\n * @returns {object} The program, or a copy without those UAVs.\r\n */\r\nexport function withoutUnboundUavs(program, semanticBindings)\r\n{\r\n const registers = unboundUavRegistersFor(semanticBindings);\r\n if (!registers.length) return program;\r\n\r\n const unbound = new Set(registers);\r\n const bindings = program.bindings.filter((binding) => !(binding.resourceKind === \"storage-resource\"\r\n && (binding.range?.registerSpace ?? 0) === 0\r\n && unbound.has(binding.range?.lowerBound ?? binding.registerIndex)));\r\n\r\n return Object.freeze({\r\n ...program,\r\n bindings: Object.freeze(bindings),\r\n unboundUavRegisters: Object.freeze(registers)\r\n });\r\n}\r\n\r\n/**\r\n * What each Carbon view format (`hlsl/core/carbonTypedViews.js`) means to WGSL:\r\n * the storage element, the WebGPU storage-texture format, and the\r\n * four-component value D3D11 returns for an in-bounds element (missing\r\n * channels 0, alpha 1). The two single-channel 32-bit formats are ones WebGPU\r\n * allows as read-write storage textures; a `writeOnly` format is a write-only\r\n * storage texture and never a typed buffer.\r\n *\r\n * A uint view applies to render stages only: compute already reads uint\r\n * buffers as raw words and writes uint UAVs atomically, in the audited\r\n * histogram profiles among others, and those layouts stay as they are.\r\n */\r\nexport const TYPED_VIEW_FORMATS = Object.freeze({\r\n R32_FLOAT: Object.freeze({\r\n returnType: CARBON_VIEW_FORMATS.R32_FLOAT.componentClass,\r\n element: \"f32\",\r\n storageTextureFormat: \"r32float\",\r\n renderStagesOnly: false,\r\n expand: (value) => `vec4<f32>(${value}, 0.0, 0.0, 1.0)`\r\n }),\r\n R32_UINT: Object.freeze({\r\n returnType: CARBON_VIEW_FORMATS.R32_UINT.componentClass,\r\n element: \"u32\",\r\n storageTextureFormat: \"r32uint\",\r\n renderStagesOnly: true,\r\n expand: (value) => `vec4<u32>(${value}, 0u, 0u, 1u)`\r\n }),\r\n R32_SINT: Object.freeze({\r\n returnType: CARBON_VIEW_FORMATS.R32_SINT.componentClass,\r\n element: \"i32\",\r\n storageTextureFormat: \"r32sint\",\r\n renderStagesOnly: true,\r\n expand: (value) => `vec4<i32>(${value}, 0i, 0i, 1i)`\r\n }),\r\n // Four channels: a write-only storage texture and nothing else. Core\r\n // WebGPU has no read-write rgba8snorm, and no typed buffer takes it, since\r\n // an array element cannot hold four packed snorm bytes.\r\n R8G8B8A8_SNORM: Object.freeze({\r\n returnType: CARBON_VIEW_FORMATS.R8G8B8A8_SNORM.componentClass,\r\n element: \"f32\",\r\n storageTextureFormat: \"rgba8snorm\",\r\n renderStagesOnly: false,\r\n writeOnly: true,\r\n expand: (value) => value\r\n })\r\n});\r\n\r\nconst SCALAR_EXPANSION = Object.freeze({\r\n f32: (value) => `vec4<f32>(${value}, 0.0, 0.0, 1.0)`,\r\n u32: (value) => `vec4<u32>(${value}, 0u, 0u, 1u)`,\r\n i32: (value) => `vec4<i32>(${value}, 0i, 0i, 1i)`\r\n});\r\n\r\n/**\r\n * A typed-buffer `ld` from a storage array of `element`, zero out of bounds.\r\n *\r\n * D3D's `ld` always returns four components, so a scalar element (a\r\n * single-channel buffer, such as the R32_UINT histogram a compute program\r\n * reads) widens as a single-channel format does - missing channels 0, alpha 1\r\n * - and the instruction's swizzle then applies to a vector, as it must.\r\n * Without the widening a `.x` landed on a scalar: \"cannot index into\r\n * expression of type 'u32'\". A vector element is returned as it is.\r\n *\r\n * @param {string} element The array's element type, e.g. `u32` or `vec4<f32>`.\r\n * @param {string} symbol The storage array's name.\r\n * @param {string} address The element index expression.\r\n * @param {string} length The array-length expression.\r\n * @returns {string} A four-component WGSL expression.\r\n */\r\nexport function typedBufferLoad(element, symbol, address, length)\r\n{\r\n const expand = SCALAR_EXPANSION[element];\r\n const clamped = `${symbol}[min(${address}, ${length} - 1u)]`;\r\n\r\n return expand\r\n ? `select(vec4<${element}>(), ${expand(clamped)}, ${address} < ${length})`\r\n : `select(${element}(), ${clamped}, ${address} < ${length})`;\r\n}\r\n"],"names":["withoutUnboundUavs","program","semanticBindings","registers","unboundUavRegistersFor","length","unbound","Set","bindings","filter","binding","resourceKind","range","registerSpace","has","lowerBound","registerIndex","Object","freeze","unboundUavRegisters","TYPED_VIEW_FORMATS","R32_FLOAT","returnType","CARBON_VIEW_FORMATS","componentClass","element","storageTextureFormat","renderStagesOnly","expand","value","R32_UINT","R32_SINT","R8G8B8A8_SNORM","writeOnly","SCALAR_EXPANSION","f32","u32","i32","typedBufferLoad","symbol","address","clamped"],"mappings":"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"}
|
|
@@ -27,7 +27,16 @@ function RegisterGeometryResources(resourceManager) {
|
|
|
27
27
|
if (typeof resourceManager?.RegisterExtension !== "function" || typeof resourceManager?.RegisterObjectLoader !== "function") {
|
|
28
28
|
throw new TypeError("RegisterGeometryResources requires a CjsResMan.");
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
|
|
31
|
+
// BOUNDS FROM THE VERTICES. A granny file carries no mesh-level box, and
|
|
32
|
+
// Carbon's TriGeometryRes::SetupModels starts each mesh's box empty and
|
|
33
|
+
// accumulates it from the vertices (TriGeometryRes.cpp:1016-1017). Without
|
|
34
|
+
// the rebuild every mesh read as a zero box, a zero-radius sphere and zero
|
|
35
|
+
// pixels on screen, so EveTransform culled it: the lens-flare occluder
|
|
36
|
+
// sprites (zsprite.gr2) never drew, and the flare shone through hulls.
|
|
37
|
+
const loader = bytes => CjsCmfFormat.loadShared(CjsGr2Format.read(bytes, {
|
|
38
|
+
rebuildMissingBounds: true
|
|
39
|
+
}));
|
|
31
40
|
for (const extension of GeometryResourceExtensions) {
|
|
32
41
|
resourceManager.RegisterObjectLoader(extension, loader);
|
|
33
42
|
resourceManager.RegisterExtension(extension, TriGeometryRes);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerGeometryResources.js","sources":["../../../../src/resource/geometry/registerGeometryResources.js"],"sourcesContent":["// REGISTERS THE GEOMETRY RESOURCE ROUTE: `.gr2` -> TriGeometryRes, the resource\n// a Tr2Mesh asks the manager for (`Tr2Mesh.Initialize`, requirement GEOMETRY).\n// Beside RegisterTextureResources and RegisterShaderResources, and for the same\n// reason: the manager knows no resource type until composition registers one,\n// and without this a SOF-built ship's mesh stayed a failed resource.\n//\n// The payload is the CMF projection of the granny file: `CjsGr2Format.read`\n// gives shared geometry and `CjsCmfFormat.loadShared` projects it to the\n// meshes/areas/declaration graph TriGeometryRes and the mesh draw path read.\n// Both are the formats' public one-shot readers; nothing format-internal is\n// reached from here.\nimport { CjsGr2Format } from \"../formats/gr2/index.js\";\nimport { CjsCmfFormat } from \"../formats/cmf/index.js\";\nimport { TriGeometryRes } from \"./TriGeometryRes.js\";\n\n/** The extensions Carbon loads as geometry resources. */\nexport const GeometryResourceExtensions = Object.freeze([ \"gr2\" ]);\n\n/**\n * Routes granny geometry files to TriGeometryRes on a resource manager.\n *\n * @param {object} resourceManager A CjsResMan.\n * @returns {object} The same manager, for chaining.\n */\nexport function RegisterGeometryResources(resourceManager)\n{\n if (typeof resourceManager?.RegisterExtension !== \"function\"\n || typeof resourceManager?.RegisterObjectLoader !== \"function\")\n {\n throw new TypeError(\"RegisterGeometryResources requires a CjsResMan.\");\n }\n\n const loader = bytes => CjsCmfFormat.loadShared(CjsGr2Format.read(bytes));\n\n for (const extension of GeometryResourceExtensions)\n {\n resourceManager.RegisterObjectLoader(extension, loader);\n resourceManager.RegisterExtension(extension, TriGeometryRes);\n }\n\n return resourceManager;\n}\n"],"names":["GeometryResourceExtensions","Object","freeze","RegisterGeometryResources","resourceManager","RegisterExtension","RegisterObjectLoader","TypeError","loader","bytes","CjsCmfFormat","loadShared","CjsGr2Format","read","extension","TriGeometryRes"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACO,MAAMA,0BAA0B,GAAGC,MAAM,CAACC,MAAM,CAAC,CAAE,KAAK,CAAE;;AAEjE;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,yBAAyBA,CAACC,eAAe,EACzD;AACE,EAAA,IAAI,OAAOA,eAAe,EAAEC,iBAAiB,KAAK,UAAU,IACvD,OAAOD,eAAe,EAAEE,oBAAoB,KAAK,UAAU,EAChE;AACE,IAAA,MAAM,IAAIC,SAAS,CAAC,iDAAiD,CAAC;AACxE,EAAA;
|
|
1
|
+
{"version":3,"file":"registerGeometryResources.js","sources":["../../../../src/resource/geometry/registerGeometryResources.js"],"sourcesContent":["// REGISTERS THE GEOMETRY RESOURCE ROUTE: `.gr2` -> TriGeometryRes, the resource\n// a Tr2Mesh asks the manager for (`Tr2Mesh.Initialize`, requirement GEOMETRY).\n// Beside RegisterTextureResources and RegisterShaderResources, and for the same\n// reason: the manager knows no resource type until composition registers one,\n// and without this a SOF-built ship's mesh stayed a failed resource.\n//\n// The payload is the CMF projection of the granny file: `CjsGr2Format.read`\n// gives shared geometry and `CjsCmfFormat.loadShared` projects it to the\n// meshes/areas/declaration graph TriGeometryRes and the mesh draw path read.\n// Both are the formats' public one-shot readers; nothing format-internal is\n// reached from here.\nimport { CjsGr2Format } from \"../formats/gr2/index.js\";\nimport { CjsCmfFormat } from \"../formats/cmf/index.js\";\nimport { TriGeometryRes } from \"./TriGeometryRes.js\";\n\n/** The extensions Carbon loads as geometry resources. */\nexport const GeometryResourceExtensions = Object.freeze([ \"gr2\" ]);\n\n/**\n * Routes granny geometry files to TriGeometryRes on a resource manager.\n *\n * @param {object} resourceManager A CjsResMan.\n * @returns {object} The same manager, for chaining.\n */\nexport function RegisterGeometryResources(resourceManager)\n{\n if (typeof resourceManager?.RegisterExtension !== \"function\"\n || typeof resourceManager?.RegisterObjectLoader !== \"function\")\n {\n throw new TypeError(\"RegisterGeometryResources requires a CjsResMan.\");\n }\n\n // BOUNDS FROM THE VERTICES. A granny file carries no mesh-level box, and\n // Carbon's TriGeometryRes::SetupModels starts each mesh's box empty and\n // accumulates it from the vertices (TriGeometryRes.cpp:1016-1017). Without\n // the rebuild every mesh read as a zero box, a zero-radius sphere and zero\n // pixels on screen, so EveTransform culled it: the lens-flare occluder\n // sprites (zsprite.gr2) never drew, and the flare shone through hulls.\n const loader = bytes => CjsCmfFormat.loadShared(CjsGr2Format.read(bytes, { rebuildMissingBounds: true }));\n\n for (const extension of GeometryResourceExtensions)\n {\n resourceManager.RegisterObjectLoader(extension, loader);\n resourceManager.RegisterExtension(extension, TriGeometryRes);\n }\n\n return resourceManager;\n}\n"],"names":["GeometryResourceExtensions","Object","freeze","RegisterGeometryResources","resourceManager","RegisterExtension","RegisterObjectLoader","TypeError","loader","bytes","CjsCmfFormat","loadShared","CjsGr2Format","read","rebuildMissingBounds","extension","TriGeometryRes"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACO,MAAMA,0BAA0B,GAAGC,MAAM,CAACC,MAAM,CAAC,CAAE,KAAK,CAAE;;AAEjE;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,yBAAyBA,CAACC,eAAe,EACzD;AACE,EAAA,IAAI,OAAOA,eAAe,EAAEC,iBAAiB,KAAK,UAAU,IACvD,OAAOD,eAAe,EAAEE,oBAAoB,KAAK,UAAU,EAChE;AACE,IAAA,MAAM,IAAIC,SAAS,CAAC,iDAAiD,CAAC;AACxE,EAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,EAAA,MAAMC,MAAM,GAAGC,KAAK,IAAIC,YAAY,CAACC,UAAU,CAACC,YAAY,CAACC,IAAI,CAACJ,KAAK,EAAE;AAAEK,IAAAA,oBAAoB,EAAE;AAAK,GAAC,CAAC,CAAC;AAEzG,EAAA,KAAK,MAAMC,SAAS,IAAIf,0BAA0B,EAClD;AACEI,IAAAA,eAAe,CAACE,oBAAoB,CAACS,SAAS,EAAEP,MAAM,CAAC;AACvDJ,IAAAA,eAAe,CAACC,iBAAiB,CAACU,SAAS,EAAEC,cAAc,CAAC;AAC9D,EAAA;AAEA,EAAA,OAAOZ,eAAe;AACxB;;;;"}
|
package/dist/sof/EveSOFDNA.js
CHANGED
|
@@ -860,7 +860,9 @@ new class extends _identity {
|
|
|
860
860
|
|
|
861
861
|
/** Reports whether the first selected hull is authored to cast shadows. */
|
|
862
862
|
CastShadow() {
|
|
863
|
-
|
|
863
|
+
// EveSOFDataHull defaults m_castShadow to true (EveSOFData.cpp:347), and a
|
|
864
|
+
// .black record omits a field at its default: absent means true.
|
|
865
|
+
return this.hullDatas[0]?.castShadow !== false;
|
|
864
866
|
}
|
|
865
867
|
|
|
866
868
|
/**
|
|
@@ -1126,7 +1128,7 @@ function createCustomHullData(source, variant) {
|
|
|
1126
1128
|
isSkinned: source?.isSkinned === true,
|
|
1127
1129
|
isUsingDecalSets: false,
|
|
1128
1130
|
enableDynamicBoundingSphere: source?.enableDynamicBoundingSphere === true,
|
|
1129
|
-
castShadow: source?.castShadow
|
|
1131
|
+
castShadow: source?.castShadow !== false,
|
|
1130
1132
|
sof6: false,
|
|
1131
1133
|
audioPosition: copyArrayValue(source?.audioPosition, [0, 0, 0]),
|
|
1132
1134
|
spriteSets: [],
|