@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.

Files changed (92) hide show
  1. package/dist/global/consts/effectPaths.js +4 -1
  2. package/dist/global/consts/effectPaths.js.map +1 -1
  3. package/dist/global/consts/index.js +1 -1
  4. package/dist/global/index.js +1 -1
  5. package/dist/index.js +3 -3
  6. package/dist/resource/format/carbonEffect/carbonEffectBackendBlock.js +19 -2
  7. package/dist/resource/format/carbonEffect/carbonEffectBackendBlock.js.map +1 -1
  8. package/dist/resource/format/index.js +1 -1
  9. package/dist/resource/formats/hlsl/core/carbonTypedViews.js +121 -65
  10. package/dist/resource/formats/hlsl/core/carbonTypedViews.js.map +1 -1
  11. package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js +10 -7
  12. package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -1
  13. package/dist/resource/formats/webgpu/core/effectBackendBodySet.js +3 -1
  14. package/dist/resource/formats/webgpu/core/effectBackendBodySet.js.map +1 -1
  15. package/dist/resource/formats/webgpu/core/packageEffect.js +5 -0
  16. package/dist/resource/formats/webgpu/core/packageEffect.js.map +1 -1
  17. package/dist/resource/formats/webgpu/core/wgsl/emitWgsl.js +20 -0
  18. package/dist/resource/formats/webgpu/core/wgsl/emitWgsl.js.map +1 -1
  19. package/dist/resource/formats/webgpu/core/wgsl/emulatedAddressing.js +93 -4
  20. package/dist/resource/formats/webgpu/core/wgsl/emulatedAddressing.js.map +1 -1
  21. package/dist/resource/formats/webgpu/core/wgsl/lowerBindingLayout.js +74 -64
  22. package/dist/resource/formats/webgpu/core/wgsl/lowerBindingLayout.js.map +1 -1
  23. package/dist/resource/formats/webgpu/core/wgsl/lowerFragmentProgram.js +16 -7
  24. package/dist/resource/formats/webgpu/core/wgsl/lowerFragmentProgram.js.map +1 -1
  25. package/dist/resource/formats/webgpu/core/wgsl/wgslTypedViews.js +69 -27
  26. package/dist/resource/formats/webgpu/core/wgsl/wgslTypedViews.js.map +1 -1
  27. package/dist/resource/geometry/registerGeometryResources.js +10 -1
  28. package/dist/resource/geometry/registerGeometryResources.js.map +1 -1
  29. package/dist/sof/EveSOFDNA.js +4 -2
  30. package/dist/sof/EveSOFDNA.js.map +1 -1
  31. package/dist/sof/EveSOFDataMgr.js +83 -69
  32. package/dist/sof/EveSOFDataMgr.js.map +1 -1
  33. package/dist/trinity/core/Tr2Denoiser.js +6 -1
  34. package/dist/trinity/core/Tr2Denoiser.js.map +1 -1
  35. package/dist/trinity/core/Tr2ShadowMap.js +7 -2
  36. package/dist/trinity/core/Tr2ShadowMap.js.map +1 -1
  37. package/dist/trinity/core/context/Tr2RenderContext.js +43 -0
  38. package/dist/trinity/core/context/Tr2RenderContext.js.map +1 -1
  39. package/dist/trinity/core/device/Tr2GpuStructuredBuffer.js +134 -0
  40. package/dist/trinity/core/device/Tr2GpuStructuredBuffer.js.map +1 -0
  41. package/dist/trinity/core/index.js +1 -0
  42. package/dist/trinity/core/index.js.map +1 -1
  43. package/dist/trinity/core/lighting/Tr2LightManager.js +410 -124
  44. package/dist/trinity/core/lighting/Tr2LightManager.js.map +1 -1
  45. package/dist/trinity/eve/effect/lensflare/EveLensflare.js +303 -312
  46. package/dist/trinity/eve/effect/lensflare/EveLensflare.js.map +1 -1
  47. package/dist/trinity/eve/effect/lensflare/EveOccluder.js +117 -0
  48. package/dist/trinity/eve/effect/lensflare/EveOccluder.js.map +1 -0
  49. package/dist/trinity/eve/index.js +1 -0
  50. package/dist/trinity/eve/index.js.map +1 -1
  51. package/dist/trinity/eve/scene/EveSpaceScene.js +286 -6
  52. package/dist/trinity/eve/scene/EveSpaceScene.js.map +1 -1
  53. package/dist/trinity/eve/scene/EveSpaceSceneRenderDriver.js +212 -32
  54. package/dist/trinity/eve/scene/EveSpaceSceneRenderDriver.js.map +1 -1
  55. package/dist/trinity/generated/eve/effect/index.js +0 -1
  56. package/dist/trinity/generated/eve/effect/index.js.map +1 -1
  57. package/dist/trinity/generated/eve/index.js +0 -1
  58. package/dist/trinity/generated/eve/index.js.map +1 -1
  59. package/dist/trinity/generated/index.js +0 -2
  60. package/dist/trinity/generated/index.js.map +1 -1
  61. package/dist/trinity/generated/trinityCore/index.js +0 -1
  62. package/dist/trinity/generated/trinityCore/index.js.map +1 -1
  63. package/dist/trinity/index.js +2 -2
  64. package/dist/trinity/postProcess/Tr2PostProcessRenderer.js +4 -1
  65. package/dist/trinity/postProcess/Tr2PostProcessRenderer.js.map +1 -1
  66. package/dist/trinity/postProcess/Tr2SSAO.js +282 -21
  67. package/dist/trinity/postProcess/Tr2SSAO.js.map +1 -1
  68. package/dist/trinity/shader/parameter/Tr2RuntimeTextureParameter.js +71 -53
  69. package/dist/trinity/shader/parameter/Tr2RuntimeTextureParameter.js.map +1 -1
  70. package/dist/trinityal/webgpu/CjsWebgpuRenderContextAL.js +81 -18
  71. package/dist/trinityal/webgpu/CjsWebgpuRenderContextAL.js.map +1 -1
  72. package/dist/trinityal/webgpu/CjsWebgpuResourceSetAL.js +46 -4
  73. package/dist/trinityal/webgpu/CjsWebgpuResourceSetAL.js.map +1 -1
  74. package/dist/trinityal/webgpu/CjsWebgpuShaderAL.js +32 -1
  75. package/dist/trinityal/webgpu/CjsWebgpuShaderAL.js.map +1 -1
  76. package/dist/trinityal/webgpu/CjsWebgpuShaderProgramAL.js +27 -0
  77. package/dist/trinityal/webgpu/CjsWebgpuShaderProgramAL.js.map +1 -1
  78. package/dist/trinityal/webgpu/CjsWebgpuTextureAL.js +29 -4
  79. package/dist/trinityal/webgpu/CjsWebgpuTextureAL.js.map +1 -1
  80. package/dist/trinityal/webgpu/core/CjsWebgpuPsoDescription.js +32 -2
  81. package/dist/trinityal/webgpu/core/CjsWebgpuPsoDescription.js.map +1 -1
  82. package/dist/trinityal/webgpu/core/CjsWebgpuUtils.js +57 -5
  83. package/dist/trinityal/webgpu/core/CjsWebgpuUtils.js.map +1 -1
  84. package/dist/trinityal/webgpu/core/CjsWebgpuWorkQueue.js +111 -5
  85. package/dist/trinityal/webgpu/core/CjsWebgpuWorkQueue.js.map +1 -1
  86. package/docs/trinity/reference/classes/generated.md +20 -20
  87. package/docs/trinity/reference/classes/post-process.md +1 -1
  88. package/package.json +1 -1
  89. package/dist/trinity/generated/eve/effect/EveOccluder.js +0 -38
  90. package/dist/trinity/generated/eve/effect/EveOccluder.js.map +0 -1
  91. package/dist/trinity/generated/trinityCore/Tr2GpuStructuredBuffer.js +0 -48
  92. package/dist/trinity/generated/trinityCore/Tr2GpuStructuredBuffer.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { identity as _identity, applyDecs2311 as _applyDecs2311 } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
1
+ import { applyDecs2311 as _applyDecs2311 } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
2
2
  import { edit, type, carbon, impl } from '#schema';
3
3
  import { CjsModel } from '#model';
4
4
  import { mat4 } from '#math/mat4';
@@ -18,340 +18,331 @@ const bitsAsFloat = value => new Float32Array(new Uint32Array([value >>> 0]).buf
18
18
 
19
19
  /** Represents a lens-flare graph with CPU-side visibility and controller state. */
20
20
  let _EveLensflare;
21
- new class extends _identity {
22
- static [class EveLensflare extends CjsModel {
23
- static {
24
- ({
25
- e: [_init_translationCurve, _init_extra_translationCurve, _init_mesh, _init_extra_mesh, _init_name, _init_extra_name, _init_backgroundOccluders, _init_extra_backgroundOccluders, _init_occluders, _init_extra_occluders, _init_curveSets, _init_extra_curveSets, _init_distanceToEdgeCurves, _init_extra_distanceToEdgeCurves, _init_distanceToCenterCurves, _init_extra_distanceToCenterCurves, _init_radialAngleCurves, _init_extra_radialAngleCurves, _init_xDistanceToCenter, _init_extra_xDistanceToCenter, _init_yDistanceToCenter, _init_extra_yDistanceToCenter, _init_controllers, _init_extra_controllers, _init_bindings, _init_extra_bindings, _init_cameraFactor, _init_extra_cameraFactor, _init_position, _init_extra_position, _init_flares, _init_extra_flares, _init_update, _init_extra_update, _init_display, _init_extra_display, _initProto],
26
- c: [_EveLensflare, _initClass]
27
- } = _applyDecs2311(this, [type.define({
28
- className: "EveLensflare",
29
- family: "eve/effect"
30
- }), carbon.inherit(ITr2Renderable)], [[[edit, edit.readwrite, void 0, type.objectRef("ITriVectorFunction")], 16, "translationCurve"], [[edit, edit.readwrite, edit, edit.persist, void 0, type.model("Tr2Mesh")], 16, "mesh"], [[edit, edit.readwrite, edit, edit.persist, type, type.string], 16, "name"], [[edit, edit.read, edit, edit.persist, void 0, type.list("EveOccluder")], 16, "backgroundOccluders"], [[edit, edit.read, edit, edit.persist, void 0, type.list("EveOccluder")], 16, "occluders"], [[edit, edit.read, edit, edit.persist, void 0, type.list("TriCurveSet")], 16, "curveSets"], [[edit, edit.read, edit, edit.persist, void 0, type.list("ITriFunction")], 16, "distanceToEdgeCurves"], [[edit, edit.read, edit, edit.persist, void 0, type.list("ITriFunction")], 16, "distanceToCenterCurves"], [[edit, edit.read, edit, edit.persist, void 0, type.list("ITriFunction")], 16, "radialAngleCurves"], [[edit, edit.read, edit, edit.persist, void 0, type.list("ITriFunction")], 16, "xDistanceToCenter"], [[edit, edit.read, edit, edit.persist, void 0, type.list("ITriFunction")], 16, "yDistanceToCenter"], [[edit, edit.read, edit, edit.persist, void 0, type.list("ITr2Controller")], 16, "controllers"], [[edit, edit.read, edit, edit.persist, void 0, type.list("ITr2ValueBinding")], 16, "bindings"], [[edit, edit.readwrite, edit, edit.persist, type, type.float32], 16, "cameraFactor"], [[edit, edit.readwrite, edit, edit.persist, type, type.vec3], 16, "position"], [[edit, edit.read, edit, edit.persist, void 0, type.list("EveTransform")], 16, "flares"], [[edit, edit.readwrite, edit, edit.persist, type, type.boolean], 16, "update"], [[edit, edit.readwrite, edit, edit.persist, type, type.boolean], 16, "display"], [[carbon, carbon.method, impl, impl.implemented], 18, "Update"], [[carbon, carbon.method, impl, impl.implemented], 18, "UpdateVisibility"], [[carbon, carbon.method, impl, impl.adapted], 18, "RunOcclusionQueries"], [[carbon, carbon.method, impl, impl.adapted], 18, "RunBackgroundOcclusionQueries"], [[carbon, carbon.method, impl, impl.implemented], 18, "SetControllerVariable"], [[carbon, carbon.method, impl, impl.implemented], 18, "HandleControllerEvent"], [[carbon, carbon.method, impl, impl.implemented], 18, "StartControllers"], [[carbon, carbon.method, impl, impl.adapted], 18, "PrepareRender"], [[carbon, carbon.method, impl, impl.implemented], 18, "GetRenderables"], [[carbon, carbon.method, impl, impl.implemented], 18, "GetBatches"], [[carbon, carbon.method, impl, impl.implemented], 18, "HasTransparentBatches"], [[carbon, carbon.method, impl, impl.implemented], 18, "GetSortValue"], [[carbon, carbon.method, impl, impl.implemented], 18, "GetPerObjectData"]], 0, void 0, CjsModel));
31
- }
32
- #controllerVariables = (_initProto(this), new Map());
21
+ class EveLensflare extends CjsModel {
22
+ static {
23
+ ({
24
+ e: [_init_translationCurve, _init_extra_translationCurve, _init_mesh, _init_extra_mesh, _init_name, _init_extra_name, _init_backgroundOccluders, _init_extra_backgroundOccluders, _init_occluders, _init_extra_occluders, _init_curveSets, _init_extra_curveSets, _init_distanceToEdgeCurves, _init_extra_distanceToEdgeCurves, _init_distanceToCenterCurves, _init_extra_distanceToCenterCurves, _init_radialAngleCurves, _init_extra_radialAngleCurves, _init_xDistanceToCenter, _init_extra_xDistanceToCenter, _init_yDistanceToCenter, _init_extra_yDistanceToCenter, _init_controllers, _init_extra_controllers, _init_bindings, _init_extra_bindings, _init_cameraFactor, _init_extra_cameraFactor, _init_position, _init_extra_position, _init_flares, _init_extra_flares, _init_update, _init_extra_update, _init_display, _init_extra_display, _initProto],
25
+ c: [_EveLensflare, _initClass]
26
+ } = _applyDecs2311(this, [type.define({
27
+ className: "EveLensflare",
28
+ family: "eve/effect"
29
+ }), carbon.inherit(ITr2Renderable)], [[[edit, edit.readwrite, void 0, type.objectRef("ITriVectorFunction")], 16, "translationCurve"], [[edit, edit.readwrite, edit, edit.persist, void 0, type.model("Tr2Mesh")], 16, "mesh"], [[edit, edit.readwrite, edit, edit.persist, type, type.string], 16, "name"], [[edit, edit.read, edit, edit.persist, void 0, type.list("EveOccluder")], 16, "backgroundOccluders"], [[edit, edit.read, edit, edit.persist, void 0, type.list("EveOccluder")], 16, "occluders"], [[edit, edit.read, edit, edit.persist, void 0, type.list("TriCurveSet")], 16, "curveSets"], [[edit, edit.read, edit, edit.persist, void 0, type.list("ITriFunction")], 16, "distanceToEdgeCurves"], [[edit, edit.read, edit, edit.persist, void 0, type.list("ITriFunction")], 16, "distanceToCenterCurves"], [[edit, edit.read, edit, edit.persist, void 0, type.list("ITriFunction")], 16, "radialAngleCurves"], [[edit, edit.read, edit, edit.persist, void 0, type.list("ITriFunction")], 16, "xDistanceToCenter"], [[edit, edit.read, edit, edit.persist, void 0, type.list("ITriFunction")], 16, "yDistanceToCenter"], [[edit, edit.read, edit, edit.persist, void 0, type.list("ITr2Controller")], 16, "controllers"], [[edit, edit.read, edit, edit.persist, void 0, type.list("ITr2ValueBinding")], 16, "bindings"], [[edit, edit.readwrite, edit, edit.persist, type, type.float32], 16, "cameraFactor"], [[edit, edit.readwrite, edit, edit.persist, type, type.vec3], 16, "position"], [[edit, edit.read, edit, edit.persist, void 0, type.list("EveTransform")], 16, "flares"], [[edit, edit.readwrite, edit, edit.persist, type, type.boolean], 16, "update"], [[edit, edit.readwrite, edit, edit.persist, type, type.boolean], 16, "display"], [[carbon, carbon.method, impl, impl.implemented], 18, "Update"], [[carbon, carbon.method, impl, impl.implemented], 18, "UpdateVisibility"], [[carbon, carbon.method, impl, impl.implemented], 18, "RunOcclusionQueries"], [[carbon, carbon.method, impl, impl.implemented], 18, "RunBackgroundOcclusionQueries"], [[carbon, carbon.method, impl, impl.implemented], 18, "SetControllerVariable"], [[carbon, carbon.method, impl, impl.implemented], 18, "HandleControllerEvent"], [[carbon, carbon.method, impl, impl.implemented], 18, "StartControllers"], [[carbon, carbon.method, impl, impl.adapted], 18, "PrepareRender"], [[carbon, carbon.method, impl, impl.implemented], 18, "GetRenderables"], [[carbon, carbon.method, impl, impl.implemented], 18, "GetBatches"], [[carbon, carbon.method, impl, impl.implemented], 18, "HasTransparentBatches"], [[carbon, carbon.method, impl, impl.implemented], 18, "GetSortValue"], [[carbon, carbon.method, impl, impl.implemented], 18, "GetPerObjectData"]], 0, void 0, CjsModel));
30
+ }
31
+ #controllerVariables = (_initProto(this), new Map());
33
32
 
34
- /** m_translationCurve (ITriVectorFunctionPtr) [READWRITE] */
35
- translationCurve = _init_translationCurve(this, null);
33
+ /** m_translationCurve (ITriVectorFunctionPtr) [READWRITE] */
34
+ translationCurve = _init_translationCurve(this, null);
36
35
 
37
- /** m_mesh (Tr2MeshPtr) [READWRITE, PERSIST] */
38
- mesh = (_init_extra_translationCurve(this), _init_mesh(this, null));
39
-
40
- /** m_name (std::string) [READWRITE, PERSIST] */
41
- name = (_init_extra_mesh(this), _init_name(this, ""));
42
-
43
- /** m_backgroundOccluders (PEveOccluderVector) [READ, PERSIST] */
44
- backgroundOccluders = (_init_extra_name(this), _init_backgroundOccluders(this, []));
45
-
46
- /** m_occluders (PEveOccluderVector) [READ, PERSIST] */
47
- occluders = (_init_extra_backgroundOccluders(this), _init_occluders(this, []));
48
-
49
- /** m_curveSets (PTriCurveSetVector) [READ, PERSIST] */
50
- curveSets = (_init_extra_occluders(this), _init_curveSets(this, []));
51
-
52
- /** m_distanceToEdgeCurves (PITriFunctionVector) [READ, PERSIST] */
53
- distanceToEdgeCurves = (_init_extra_curveSets(this), _init_distanceToEdgeCurves(this, []));
54
-
55
- /** m_distanceToCenterCurves (PITriFunctionVector) [READ, PERSIST] */
56
- distanceToCenterCurves = (_init_extra_distanceToEdgeCurves(this), _init_distanceToCenterCurves(this, []));
57
-
58
- /** m_radialAngleCurves (PITriFunctionVector) [READ, PERSIST] */
59
- radialAngleCurves = (_init_extra_distanceToCenterCurves(this), _init_radialAngleCurves(this, []));
60
-
61
- /** m_xDistanceToCenter (PITriFunctionVector) [READ, PERSIST] */
62
- xDistanceToCenter = (_init_extra_radialAngleCurves(this), _init_xDistanceToCenter(this, []));
63
-
64
- /** m_yDistanceToCenter (PITriFunctionVector) [READ, PERSIST] */
65
- yDistanceToCenter = (_init_extra_xDistanceToCenter(this), _init_yDistanceToCenter(this, []));
66
-
67
- /** m_controllers (PITr2ControllerVector) [READ, PERSIST] */
68
- controllers = (_init_extra_yDistanceToCenter(this), _init_controllers(this, []));
69
-
70
- /** m_bindings (PITr2ValueBindingVector) [READ, PERSIST] */
71
- bindings = (_init_extra_controllers(this), _init_bindings(this, []));
72
-
73
- /** m_cameraFactor (float) [READWRITE, PERSIST] */
74
- cameraFactor = (_init_extra_bindings(this), _init_cameraFactor(this, 20));
75
-
76
- /** m_position (Vector3) [READWRITE, PERSIST] */
77
- position = (_init_extra_cameraFactor(this), _init_position(this, vec3.create()));
78
-
79
- /** m_flares (PEveTransformVector) [READ, PERSIST] */
80
- flares = (_init_extra_position(this), _init_flares(this, []));
81
-
82
- /** m_update (bool) [READWRITE, PERSIST] */
83
- update = (_init_extra_flares(this), _init_update(this, true));
84
-
85
- /** m_display (bool) [READWRITE, PERSIST] */
86
- display = (_init_extra_update(this), _init_display(this, true));
87
-
88
- /** m_isVisible (EveLensflare.h:95; ctor false, cpp:68) - runtime state,
89
- * not persisted. */
90
- isVisible = (_init_extra_display(this), false);
91
-
92
- /** m_direction (EveLensflare.h:106) - zero until PrepareRender stamps
93
- * Normalize(-position); the first-frame zero direction dots to 0, which
94
- * counts as VISIBLE (the >= comparison) - deliberate Carbon behavior. */
95
- direction = vec3.create();
96
-
97
- /** m_sunSize (EveLensflare.h:107; ctor 0, cpp:71) - computed by Carbon's
98
- * Update from the distance-to-center falloff (cpp:161-165); PrepareRender
99
- * consumes it but does not produce it. Runtime state, not persisted. */
100
- sunSize = 0;
101
-
102
- /** m_occlusionOffset / m_backgroundOcclusionOffset (EveLensflare.h:140-141) -
103
- * Tr2OcclusionBuffer slots this lensflare allocates on its first occlusion
104
- * query (RunOcclusionQueries, cpp:330-337). null until then; Carbon's null
105
- * case uploads 0. */
106
- occlusionOffset = null;
107
- backgroundOcclusionOffset = null;
108
-
109
- /** m_directionVar: the global "LensflareFxDirectionScale" (cpp:72). */
110
- #directionVar = _Tr2VariableStore.GlobalStore().RegisterVariable("LensflareFxDirectionScale", [0, 0, 0, 1]);
111
-
112
- /**
113
- * m_occScaleVar: the global "LensflareFxOccScale" (cpp:73), (1, 0, 0, 0)
114
- * until the first Update. x and y carry the foreground and background slot
115
- * bases as float BITS; the god rays read FlareOcclusionBuffer at y.
116
- */
117
- #occScaleVar = _Tr2VariableStore.GlobalStore().RegisterVariable("LensflareFxOccScale", [1, 0, 0, 0]);
118
-
119
- /** m_transform (EveLensflare.h:102; ctor identity, cpp:74) - stamped by
120
- * PrepareRender, forwarded to the flare children as their parent. */
121
- transform = mat4.create();
122
-
123
- /** Carbon EveLensflare::Update (EveLensflare.cpp:145-182): position from the
124
- * translation curve, the sun-size curve of very old magic numbers
125
- * (1.5 / ln(d_AU + 2.71), 0.1495978707e12 metres per AU; no curve means
126
- * sunSize 1, not the constructed 0), then curve sets and controllers.
127
- * Then Carbon's occlusion upload (cpp:168-171): the slot bases bit-cast into
128
- * the global LensflareFxOccScale. It is not a duplicate of the per-object
129
- * indices GetPerObjectData ships: the flare mesh reads those, but the god
130
- * rays read this GLOBAL, and until 2026-09-26 it was never written. The curve is
131
- * called out-last (Update(simTime, position)) per the org convention -
132
- * Carbon's is out-first. */
133
- Update(realTime, simTime) {
134
- if (!this.update) return;
135
- if (this.translationCurve) {
136
- this.translationCurve.Update(simTime, this.position);
137
- const distanceToCenter = vec3.length(this.position) / 0.1495978707e12;
138
- this.sunSize = 1.5 / Math.log(distanceToCenter + 2.71);
139
- } else {
140
- this.sunSize = 1;
141
- }
142
- this.#occScaleVar.SetValue([bitsAsFloat(this.occlusionOffset ?? 0), bitsAsFloat(this.backgroundOcclusionOffset ?? 0), 0, 0]);
143
- for (const curveSet of this.curveSets) {
144
- curveSet?.Update(realTime, simTime);
145
- }
146
- for (const controller of this.controllers) {
147
- controller?.Update(0.5);
148
- }
36
+ /** m_mesh (Tr2MeshPtr) [READWRITE, PERSIST] */
37
+ mesh = (_init_extra_translationCurve(this), _init_mesh(this, null));
38
+
39
+ /** m_name (std::string) [READWRITE, PERSIST] */
40
+ name = (_init_extra_mesh(this), _init_name(this, ""));
41
+
42
+ /** m_backgroundOccluders (PEveOccluderVector) [READ, PERSIST] */
43
+ backgroundOccluders = (_init_extra_name(this), _init_backgroundOccluders(this, []));
44
+
45
+ /** m_occluders (PEveOccluderVector) [READ, PERSIST] */
46
+ occluders = (_init_extra_backgroundOccluders(this), _init_occluders(this, []));
47
+
48
+ /** m_curveSets (PTriCurveSetVector) [READ, PERSIST] */
49
+ curveSets = (_init_extra_occluders(this), _init_curveSets(this, []));
50
+
51
+ /** m_distanceToEdgeCurves (PITriFunctionVector) [READ, PERSIST] */
52
+ distanceToEdgeCurves = (_init_extra_curveSets(this), _init_distanceToEdgeCurves(this, []));
53
+
54
+ /** m_distanceToCenterCurves (PITriFunctionVector) [READ, PERSIST] */
55
+ distanceToCenterCurves = (_init_extra_distanceToEdgeCurves(this), _init_distanceToCenterCurves(this, []));
56
+
57
+ /** m_radialAngleCurves (PITriFunctionVector) [READ, PERSIST] */
58
+ radialAngleCurves = (_init_extra_distanceToCenterCurves(this), _init_radialAngleCurves(this, []));
59
+
60
+ /** m_xDistanceToCenter (PITriFunctionVector) [READ, PERSIST] */
61
+ xDistanceToCenter = (_init_extra_radialAngleCurves(this), _init_xDistanceToCenter(this, []));
62
+
63
+ /** m_yDistanceToCenter (PITriFunctionVector) [READ, PERSIST] */
64
+ yDistanceToCenter = (_init_extra_xDistanceToCenter(this), _init_yDistanceToCenter(this, []));
65
+
66
+ /** m_controllers (PITr2ControllerVector) [READ, PERSIST] */
67
+ controllers = (_init_extra_yDistanceToCenter(this), _init_controllers(this, []));
68
+
69
+ /** m_bindings (PITr2ValueBindingVector) [READ, PERSIST] */
70
+ bindings = (_init_extra_controllers(this), _init_bindings(this, []));
71
+
72
+ /** m_cameraFactor (float) [READWRITE, PERSIST] */
73
+ cameraFactor = (_init_extra_bindings(this), _init_cameraFactor(this, 20));
74
+
75
+ /** m_position (Vector3) [READWRITE, PERSIST] */
76
+ position = (_init_extra_cameraFactor(this), _init_position(this, vec3.create()));
77
+
78
+ /** m_flares (PEveTransformVector) [READ, PERSIST] */
79
+ flares = (_init_extra_position(this), _init_flares(this, []));
80
+
81
+ /** m_update (bool) [READWRITE, PERSIST] */
82
+ update = (_init_extra_flares(this), _init_update(this, true));
83
+
84
+ /** m_display (bool) [READWRITE, PERSIST] */
85
+ display = (_init_extra_update(this), _init_display(this, true));
86
+
87
+ /** m_isVisible (EveLensflare.h:95; ctor false, cpp:68) - runtime state,
88
+ * not persisted. */
89
+ isVisible = (_init_extra_display(this), false);
90
+
91
+ /** m_direction (EveLensflare.h:106) - zero until PrepareRender stamps
92
+ * Normalize(-position); the first-frame zero direction dots to 0, which
93
+ * counts as VISIBLE (the >= comparison) - deliberate Carbon behavior. */
94
+ direction = vec3.create();
95
+
96
+ /** m_sunSize (EveLensflare.h:107; ctor 0, cpp:71) - computed by Carbon's
97
+ * Update from the distance-to-center falloff (cpp:161-165); PrepareRender
98
+ * consumes it but does not produce it. Runtime state, not persisted. */
99
+ sunSize = 0;
100
+
101
+ /** m_occlusionOffset / m_backgroundOcclusionOffset (EveLensflare.h:140-141) -
102
+ * Tr2OcclusionBuffer slots this lensflare allocates on its first occlusion
103
+ * query (RunOcclusionQueries, cpp:330-337). null until then; Carbon's null
104
+ * case uploads 0. */
105
+ occlusionOffset = null;
106
+ backgroundOcclusionOffset = null;
107
+
108
+ /** m_directionVar: the global "LensflareFxDirectionScale" (cpp:72). */
109
+ #directionVar = _Tr2VariableStore.GlobalStore().RegisterVariable("LensflareFxDirectionScale", [0, 0, 0, 1]);
110
+
111
+ /**
112
+ * m_occScaleVar: the global "LensflareFxOccScale" (cpp:73), (1, 0, 0, 0)
113
+ * until the first Update. x and y carry the foreground and background slot
114
+ * bases as float BITS; the god rays read FlareOcclusionBuffer at y.
115
+ */
116
+ #occScaleVar = _Tr2VariableStore.GlobalStore().RegisterVariable("LensflareFxOccScale", [1, 0, 0, 0]);
117
+
118
+ /** m_transform (EveLensflare.h:102; ctor identity, cpp:74) - stamped by
119
+ * PrepareRender, forwarded to the flare children as their parent. */
120
+ transform = mat4.create();
121
+
122
+ /** Carbon EveLensflare::Update (EveLensflare.cpp:145-182): position from the
123
+ * translation curve, the sun-size curve of very old magic numbers
124
+ * (1.5 / ln(d_AU + 2.71), 0.1495978707e12 metres per AU; no curve means
125
+ * sunSize 1, not the constructed 0), then curve sets and controllers.
126
+ * Then Carbon's occlusion upload (cpp:168-171): the slot bases bit-cast into
127
+ * the global LensflareFxOccScale. It is not a duplicate of the per-object
128
+ * indices GetPerObjectData ships: the flare mesh reads those, but the god
129
+ * rays read this GLOBAL, and until 2026-09-26 it was never written. The curve is
130
+ * called out-last (Update(simTime, position)) per the org convention -
131
+ * Carbon's is out-first. */
132
+ Update(realTime, simTime) {
133
+ if (!this.update) return;
134
+ if (this.translationCurve) {
135
+ this.translationCurve.Update(simTime, this.position);
136
+ const distanceToCenter = vec3.length(this.position) / 0.1495978707e12;
137
+ this.sunSize = 1.5 / Math.log(distanceToCenter + 2.71);
138
+ } else {
139
+ this.sunSize = 1;
149
140
  }
150
-
151
- /** Carbon EveLensflare::UpdateVisibility (EveLensflare.cpp:298-311): the
152
- * viewDir dot test - visible iff dot(frustum.viewDir, direction) >= 0
153
- * (a sun exactly perpendicular to the view IS visible), then every flare
154
- * child updates its visibility under this lensflare's transform. NO display
155
- * gate (the display || isVisible gate lives in GetRenderables, cpp:281).
156
- * ONE-FRAME LATENCY is contract: within a Carbon frame this runs before
157
- * PrepareRender, so the dot uses the PREVIOUS frame's direction and
158
- * forwards the previous frame's transform - do not "fix" the order. Scene
159
- * call site: EveSpaceScene.cpp:1462-1466 (sequential, single-lensflare). */
160
- UpdateVisibility(updateContext) {
161
- this.isVisible = false;
162
- const frustum = updateContext?.GetFrustum?.() ?? updateContext?.frustum;
163
- const viewDir = frustum?.viewDir ?? frustum?.m_viewDir;
164
- const viewDotDir = viewDir ? vec3.dot(viewDir, this.direction) : 0;
165
- this.isVisible = viewDotDir >= 0;
166
- for (const flare of this.flares) {
167
- flare?.UpdateVisibility(updateContext, this.transform);
168
- }
141
+ this.#occScaleVar.SetValue([bitsAsFloat(this.occlusionOffset ?? 0), bitsAsFloat(this.backgroundOcclusionOffset ?? 0), 0, 0]);
142
+ for (const curveSet of this.curveSets) {
143
+ curveSet?.Update(realTime, simTime);
169
144
  }
170
-
171
- /**
172
- * Carbon RunOcclusionQueries (cpp:323-347): allocates this lensflare's
173
- * foreground and background slots on first call - a new slot is Cleared to
174
- * visibility 1.0 - then runs each foreground occluder's query into its
175
- * counters.
176
- *
177
- * PARTIAL: EveOccluder.RunQuery (EveOccluder.cpp:150-185) is not ported, so
178
- * the occluders do not run and the slots keep visibility 1.0 - the flare
179
- * reads unoccluded. That is reported once rather than skipped silently.
180
- *
181
- * @param {Tr2RenderContext} renderContext The frame's context.
182
- * @param {EveUpdateContext} _updateContext The occluders' context.
183
- * @returns {void}
184
- */
185
- RunOcclusionQueries(renderContext, _updateContext) {
186
- if (!this.display) return;
187
- const occlusionBuffer = _Tr2OcclusionBuffer.getInstance();
188
- if (this.occlusionOffset === null) this.occlusionOffset = occlusionBuffer.AllocateOffset(renderContext);
189
- if (this.backgroundOcclusionOffset === null) this.backgroundOcclusionOffset = occlusionBuffer.AllocateOffset(renderContext);
190
- if (this.occluders.length) _EveLensflare.#WarnOccludersUnported();
145
+ for (const controller of this.controllers) {
146
+ controller?.Update(0.5);
191
147
  }
148
+ }
192
149
 
193
- /**
194
- * Carbon RunBackgroundOcclusionQueries (cpp:359-379): the background slot,
195
- * then the background occluders. Carbon calls it from the background pass,
196
- * only for scenes with planets (EveSpaceScene.cpp:2153-2170). PARTIAL for the
197
- * same reason as RunOcclusionQueries.
198
- *
199
- * @param {Tr2RenderContext} renderContext The frame's context.
200
- * @param {EveUpdateContext} _updateContext The occluders' context.
201
- * @returns {void}
202
- */
203
- RunBackgroundOcclusionQueries(renderContext, _updateContext) {
204
- if (!this.display) return;
205
- if (this.backgroundOcclusionOffset === null) {
206
- this.backgroundOcclusionOffset = _Tr2OcclusionBuffer.getInstance().AllocateOffset(renderContext);
207
- }
208
- if (this.backgroundOccluders.length) _EveLensflare.#WarnOccludersUnported();
150
+ /** Carbon EveLensflare::UpdateVisibility (EveLensflare.cpp:298-311): the
151
+ * viewDir dot test - visible iff dot(frustum.viewDir, direction) >= 0
152
+ * (a sun exactly perpendicular to the view IS visible), then every flare
153
+ * child updates its visibility under this lensflare's transform. NO display
154
+ * gate (the display || isVisible gate lives in GetRenderables, cpp:281).
155
+ * ONE-FRAME LATENCY is contract: within a Carbon frame this runs before
156
+ * PrepareRender, so the dot uses the PREVIOUS frame's direction and
157
+ * forwards the previous frame's transform - do not "fix" the order. Scene
158
+ * call site: EveSpaceScene.cpp:1462-1466 (sequential, single-lensflare). */
159
+ UpdateVisibility(updateContext) {
160
+ this.isVisible = false;
161
+ const frustum = updateContext?.GetFrustum?.() ?? updateContext?.frustum;
162
+ const viewDir = frustum?.viewDir ?? frustum?.m_viewDir;
163
+ const viewDotDir = viewDir ? vec3.dot(viewDir, this.direction) : 0;
164
+ this.isVisible = viewDotDir >= 0;
165
+ for (const flare of this.flares) {
166
+ flare?.UpdateVisibility(updateContext, this.transform);
209
167
  }
168
+ }
210
169
 
211
- /** Carbon method SetControllerVariable (MAP_METHOD_AND_WRAP). */
212
- SetControllerVariable(name, value) {
213
- const key = String(name);
214
- const next = Number(value);
215
- this.#controllerVariables.set(key, next);
216
- for (const controller of this.controllers) controller?.SetVariable(key, next);
170
+ /**
171
+ * Carbon RunOcclusionQueries (cpp:323-347): allocates this lensflare's
172
+ * foreground and background slots on first call - a new slot is Cleared to
173
+ * visibility 1.0 - then runs each foreground occluder's query into its
174
+ * counters, with fog weight 1.
175
+ *
176
+ * @param {Tr2RenderContext} renderContext The frame's context.
177
+ * @param {EveUpdateContext} updateContext The occluders' context.
178
+ * @returns {void}
179
+ */
180
+ RunOcclusionQueries(renderContext, updateContext) {
181
+ if (!this.display) return;
182
+ const occlusionBuffer = _Tr2OcclusionBuffer.getInstance();
183
+ if (this.occlusionOffset === null) this.occlusionOffset = occlusionBuffer.AllocateOffset(renderContext);
184
+ if (this.backgroundOcclusionOffset === null) this.backgroundOcclusionOffset = occlusionBuffer.AllocateOffset(renderContext);
185
+ let index = 0;
186
+ for (const occluder of this.occluders) {
187
+ occluder.RunQuery(renderContext, updateContext, this.transform, _Tr2OcclusionBuffer.getOccluderOffset(this.occlusionOffset, index++), 1);
217
188
  }
189
+ }
218
190
 
219
- /**
220
- * Carbon EveLensflare::HandleControllerEvent (cpp:497-503).
221
- *
222
- * MISSING UNTIL 2026-09-05. Carbon declares it beside SetControllerVariable
223
- * and StartControllers, both of which were ported; this one was not, and the
224
- * hedge at every call site meant a lens flare silently ignored every
225
- * controller event rather than failing.
226
- */
227
- HandleControllerEvent(name) {
228
- const key = String(name);
229
- for (const controller of this.controllers) controller?.HandleEvent(key);
191
+ /**
192
+ * Carbon RunBackgroundOcclusionQueries (cpp:359-379): the background slot,
193
+ * then the background occluders. Carbon calls it from the background pass,
194
+ * only for scenes with planets (EveSpaceScene.cpp:2153-2170). Fog weight 0.
195
+ *
196
+ * @param {Tr2RenderContext} renderContext The frame's context.
197
+ * @param {EveUpdateContext} updateContext The occluders' context.
198
+ * @returns {void}
199
+ */
200
+ RunBackgroundOcclusionQueries(renderContext, updateContext) {
201
+ if (!this.display) return;
202
+ if (this.backgroundOcclusionOffset === null) {
203
+ this.backgroundOcclusionOffset = _Tr2OcclusionBuffer.getInstance().AllocateOffset(renderContext);
230
204
  }
231
-
232
- /** Carbon method StartControllers (MAP_METHOD_AND_WRAP). */
233
- StartControllers() {
234
- for (const controller of this.controllers) controller?.Start();
205
+ let index = 0;
206
+ for (const occluder of this.backgroundOccluders) {
207
+ occluder.RunQuery(renderContext, updateContext, this.transform, _Tr2OcclusionBuffer.getOccluderOffset(this.backgroundOcclusionOffset, index++), 0);
235
208
  }
209
+ }
236
210
 
237
- /**
238
- * Carbon PrepareRender (cpp:192-266): the per-frame placement that needs
239
- * this frame's frustum. The direction to the sun (from the camera when the
240
- * flare has no position), a transform that turns the flare geometry toward
241
- * it and parks it `cameraFactor` in front of the camera, the
242
- * LensflareFxDirectionScale global, and the sun's screen position driving
243
- * the edge, centre, angle and x/y curves before the bindings copy.
244
- *
245
- * Carbon's row-vector `Transform( v, M )` over a row-major matrix is
246
- * gl-matrix `transformMat4` over the same bytes.
247
- *
248
- * The render context is an ADDED argument: Carbon reads the view from
249
- * Tr2Renderer::GetViewTransform, a static this runtime keeps on the context.
250
- *
251
- * @param {TriFrustum} frustum This frame's frustum.
252
- * @param {Tr2RenderContext} renderContext The frame's context.
253
- * @returns {void}
254
- */
255
- PrepareRender(frustum, renderContext) {
256
- if (!this.display) return;
257
- if (vec3.squaredLength(this.position) === 0) vec3.normalize(this.direction, vec3.negate(prepareScratch, frustum.viewPos));else vec3.normalize(this.direction, vec3.negate(prepareScratch, this.position));
258
- const cameraSpacePos = vec3.scaleAndAdd(vec3.create(), frustum.viewPos, frustum.viewDir, -this.cameraFactor);
259
- mat4.arcFromForward(this.transform, vec3.negate(prepareScratch, this.direction));
260
- this.transform[12] = cameraSpacePos[0];
261
- this.transform[13] = cameraSpacePos[1];
262
- this.transform[14] = cameraSpacePos[2];
263
- this.transform[15] = 1;
264
- this.#directionVar.SetValue([this.direction[0], this.direction[1], this.direction[2], this.sunSize]);
265
- const direction = vec4.fromValues(this.direction[0], this.direction[1], this.direction[2], 0);
266
- vec4.transformMat4(direction, direction, renderContext.GetViewTransform());
267
- vec4.transformMat4(direction, direction, frustum.projectionMatrix);
268
- direction[0] /= direction[3];
269
- direction[1] /= direction[3];
270
- const distanceToEdge = 1 - Math.min(1 - Math.abs(direction[0]), 1 - Math.abs(direction[1]));
271
- const distanceToCenter = Math.hypot(direction[0], direction[1]);
272
- const radialAngle = Math.atan2(direction[1], direction[0]) + Math.PI;
273
- for (const curve of this.distanceToEdgeCurves) curve.UpdateValue(distanceToEdge);
274
- for (const curve of this.distanceToCenterCurves) curve.UpdateValue(distanceToCenter);
275
- for (const curve of this.radialAngleCurves) curve.UpdateValue(radialAngle);
276
- for (const curve of this.xDistanceToCenter) curve.UpdateValue(direction[0] + 10);
277
- for (const curve of this.yDistanceToCenter) curve.UpdateValue(direction[1] + 10);
278
- for (const binding of this.bindings) binding.CopyValue();
279
- }
211
+ /** Carbon method SetControllerVariable (MAP_METHOD_AND_WRAP). */
212
+ SetControllerVariable(name, value) {
213
+ const key = String(name);
214
+ const next = Number(value);
215
+ this.#controllerVariables.set(key, next);
216
+ for (const controller of this.controllers) controller?.SetVariable(key, next);
217
+ }
280
218
 
281
- /**
282
- * Carbon GetRenderables (cpp:278-296): nothing unless displayed and visible;
283
- * each flare child's renderables, then this lensflare itself for its mesh.
284
- *
285
- * @param {TriFrustum} _frustum This frame's frustum (unused, as in Carbon).
286
- * @param {Array} renderables Out: the renderables.
287
- * @returns {Array} `renderables`.
288
- */
289
- GetRenderables(_frustum, renderables = []) {
290
- if (!this.display || !this.isVisible) return renderables;
291
- for (const flare of this.flares) flare.GetRenderables(renderables, null);
292
- if (this.mesh) renderables.push(this);
293
- return renderables;
294
- }
219
+ /**
220
+ * Carbon EveLensflare::HandleControllerEvent (cpp:497-503).
221
+ *
222
+ * MISSING UNTIL 2026-09-05. Carbon declares it beside SetControllerVariable
223
+ * and StartControllers, both of which were ported; this one was not, and the
224
+ * hedge at every call site meant a lens flare silently ignored every
225
+ * controller event rather than failing.
226
+ */
227
+ HandleControllerEvent(name) {
228
+ const key = String(name);
229
+ for (const controller of this.controllers) controller?.HandleEvent(key);
230
+ }
295
231
 
296
- /** Carbon EveLensflare::GetBatches delegates the selected mesh areas (cpp:381-387). */
297
- GetBatches(batches, batchType, perObjectData, _reason) {
298
- if (this.mesh) {
299
- this.mesh.GetBatches?.(batches, this.mesh.GetAreas(batchType), perObjectData);
300
- }
301
- }
232
+ /** Carbon method StartControllers (MAP_METHOD_AND_WRAP). */
233
+ StartControllers() {
234
+ for (const controller of this.controllers) controller?.Start();
235
+ }
302
236
 
303
- /** Carbon EveLensflare::HasTransparentBatches is always false (cpp:389-392). */
304
- HasTransparentBatches() {
305
- return false;
306
- }
237
+ /**
238
+ * Carbon PrepareRender (cpp:192-266): the per-frame placement that needs
239
+ * this frame's frustum. The direction to the sun (from the camera when the
240
+ * flare has no position), a transform that turns the flare geometry toward
241
+ * it and parks it `cameraFactor` in front of the camera, the
242
+ * LensflareFxDirectionScale global, and the sun's screen position driving
243
+ * the edge, centre, angle and x/y curves before the bindings copy.
244
+ *
245
+ * Carbon's row-vector `Transform( v, M )` over a row-major matrix is
246
+ * gl-matrix `transformMat4` over the same bytes.
247
+ *
248
+ * The render context is an ADDED argument: Carbon reads the view from
249
+ * Tr2Renderer::GetViewTransform, a static this runtime keeps on the context.
250
+ *
251
+ * @param {TriFrustum} frustum This frame's frustum.
252
+ * @param {Tr2RenderContext} renderContext The frame's context.
253
+ * @returns {void}
254
+ */
255
+ PrepareRender(frustum, renderContext) {
256
+ if (!this.display) return;
257
+ if (vec3.squaredLength(this.position) === 0) vec3.normalize(this.direction, vec3.negate(prepareScratch, frustum.viewPos));else vec3.normalize(this.direction, vec3.negate(prepareScratch, this.position));
258
+ const cameraSpacePos = vec3.scaleAndAdd(vec3.create(), frustum.viewPos, frustum.viewDir, -this.cameraFactor);
259
+ mat4.arcFromForward(this.transform, vec3.negate(prepareScratch, this.direction));
260
+ this.transform[12] = cameraSpacePos[0];
261
+ this.transform[13] = cameraSpacePos[1];
262
+ this.transform[14] = cameraSpacePos[2];
263
+ this.transform[15] = 1;
264
+ this.#directionVar.SetValue([this.direction[0], this.direction[1], this.direction[2], this.sunSize]);
265
+ const direction = vec4.fromValues(this.direction[0], this.direction[1], this.direction[2], 0);
266
+ vec4.transformMat4(direction, direction, renderContext.GetViewTransform());
267
+ vec4.transformMat4(direction, direction, frustum.projectionMatrix);
268
+ direction[0] /= direction[3];
269
+ direction[1] /= direction[3];
270
+ const distanceToEdge = 1 - Math.min(1 - Math.abs(direction[0]), 1 - Math.abs(direction[1]));
271
+ const distanceToCenter = Math.hypot(direction[0], direction[1]);
272
+ const radialAngle = Math.atan2(direction[1], direction[0]) + Math.PI;
273
+ for (const curve of this.distanceToEdgeCurves) curve.UpdateValue(distanceToEdge);
274
+ for (const curve of this.distanceToCenterCurves) curve.UpdateValue(distanceToCenter);
275
+ for (const curve of this.radialAngleCurves) curve.UpdateValue(radialAngle);
276
+ for (const curve of this.xDistanceToCenter) curve.UpdateValue(direction[0] + 10);
277
+ for (const curve of this.yDistanceToCenter) curve.UpdateValue(direction[1] + 10);
278
+ for (const binding of this.bindings) binding.CopyValue();
279
+ }
307
280
 
308
- /** Carbon EveLensflare::GetSortValue is the constant one (cpp:394-397). */
309
- GetSortValue() {
310
- return 1;
311
- }
281
+ /**
282
+ * Carbon GetRenderables (cpp:278-296): nothing unless displayed and visible;
283
+ * each flare child's renderables, then this lensflare itself for its mesh.
284
+ *
285
+ * @param {TriFrustum} _frustum This frame's frustum (unused, as in Carbon).
286
+ * @param {Array} renderables Out: the renderables.
287
+ * @returns {Array} `renderables`.
288
+ */
289
+ GetRenderables(_frustum, renderables = []) {
290
+ if (!this.display || !this.isVisible) return renderables;
291
+ for (const flare of this.flares) flare.GetRenderables(renderables, null);
292
+ if (this.mesh) renderables.push(this);
293
+ return renderables;
294
+ }
312
295
 
313
- /** Carbon EveLensflare::GetPerObjectData (cpp:399-410): directionScale =
314
- * (direction, sunSize); indices[0]/[1] from the optional occlusion offsets
315
- * (null uploads 0). indices[2] and [3] are NEVER written in Carbon - the
316
- * per-element writes keep that arena-garbage parity. The struct registers
317
- * with stages ["vs", "ps"]: one payload, same bytes bound to both slots
318
- * (cpp:24-38). */
319
- GetPerObjectData(accumulator) {
320
- const data = accumulator.Alloc("EveLensflarePerObjectData");
321
- data.Set("directionScale", [this.direction[0], this.direction[1], this.direction[2], this.sunSize]);
322
- data.SetIndex("indices", 0, [this.occlusionOffset ?? 0]);
323
- data.SetIndex("indices", 1, [this.backgroundOcclusionOffset ?? 0]);
324
- return data;
296
+ /** Carbon EveLensflare::GetBatches delegates the selected mesh areas (cpp:381-387). */
297
+ GetBatches(batches, batchType, perObjectData, _reason) {
298
+ if (this.mesh) {
299
+ this.mesh.GetBatches?.(batches, this.mesh.GetAreas(batchType), perObjectData);
325
300
  }
301
+ }
326
302
 
327
- /**
328
- * Returns this lensflare's occlusion-buffer slots. Carbon holds them as
329
- * Tr2OcclusionBuffer::Offset shared_ptrs whose deleter frees the slot when
330
- * the lensflare is destroyed (EveOccluder.cpp:36, 70-74); JavaScript has no
331
- * destructor, so the owner removing a lensflare calls this.
332
- *
333
- * @returns {void}
334
- */
335
- Destroy() {
336
- const occlusionBuffer = _Tr2OcclusionBuffer.getInstance();
337
- occlusionBuffer.DestroyOffset(this.occlusionOffset);
338
- occlusionBuffer.DestroyOffset(this.backgroundOcclusionOffset);
339
- this.occlusionOffset = null;
340
- this.backgroundOcclusionOffset = null;
341
- }
303
+ /** Carbon EveLensflare::HasTransparentBatches is always false (cpp:389-392). */
304
+ HasTransparentBatches() {
305
+ return false;
306
+ }
307
+
308
+ /** Carbon EveLensflare::GetSortValue is the constant one (cpp:394-397). */
309
+ GetSortValue() {
310
+ return 1;
311
+ }
312
+
313
+ /** Carbon EveLensflare::GetPerObjectData (cpp:399-410): directionScale =
314
+ * (direction, sunSize); indices[0]/[1] from the optional occlusion offsets
315
+ * (null uploads 0). indices[2] and [3] are NEVER written in Carbon - the
316
+ * per-element writes keep that arena-garbage parity. The struct registers
317
+ * with stages ["vs", "ps"]: one payload, same bytes bound to both slots
318
+ * (cpp:24-38). */
319
+ GetPerObjectData(accumulator) {
320
+ const data = accumulator.Alloc("EveLensflarePerObjectData");
321
+ data.Set("directionScale", [this.direction[0], this.direction[1], this.direction[2], this.sunSize]);
322
+ data.SetIndex("indices", 0, [this.occlusionOffset ?? 0]);
323
+ data.SetIndex("indices", 1, [this.backgroundOcclusionOffset ?? 0]);
324
+ return data;
325
+ }
342
326
 
343
- /** Reports, once per page, that occluders are present but EveOccluder.RunQuery is not ported. */
344
- }];
345
- #WarnOccludersUnported() {
346
- if (_EveLensflare.#occludersWarned) return;
347
- _EveLensflare.#occludersWarned = true;
348
- console.warn("EveLensflare: EveOccluder.RunQuery is not ported; lens flares read unoccluded (visibility 1.0).");
327
+ /**
328
+ * Returns this lensflare's occlusion-buffer slots. Carbon holds them as
329
+ * Tr2OcclusionBuffer::Offset shared_ptrs whose deleter frees the slot when
330
+ * the lensflare is destroyed (EveOccluder.cpp:36, 70-74); JavaScript has no
331
+ * destructor, so the owner removing a lensflare calls this.
332
+ *
333
+ * @returns {void}
334
+ */
335
+ Destroy() {
336
+ const occlusionBuffer = _Tr2OcclusionBuffer.getInstance();
337
+ occlusionBuffer.DestroyOffset(this.occlusionOffset);
338
+ occlusionBuffer.DestroyOffset(this.backgroundOcclusionOffset);
339
+ this.occlusionOffset = null;
340
+ this.backgroundOcclusionOffset = null;
349
341
  }
350
- #occludersWarned = false;
351
- constructor() {
352
- super(_EveLensflare), _initClass();
342
+ static {
343
+ _initClass();
353
344
  }
354
- }();
345
+ }
355
346
 
356
347
  export { _EveLensflare as EveLensflare };
357
348
  //# sourceMappingURL=EveLensflare.js.map