@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tr2LightManager.js","sources":["../../../../../src/trinity/core/lighting/Tr2LightManager.js"],"sourcesContent":["// Source: trinity/trinity/Tr2LightManager.h + Tr2LightManager.cpp\n//\n// The local-light manager: collects per-light records from every\n// ITr2LightOwner during the scene gather, culls and premultiplies them,\n// selects the volumetric set, and owns the PACKED light buffer bytes the\n// abstraction layer uploads. Description-building throughout - under the\n// engine-means-AL vocabulary (docs c5a4b66) everything here is Trinity's;\n// only realizing LightBuffer/LightIndexBuffer into device objects, the\n// tiling compute dispatch, the shadow atlas textures and the raytraced\n// path are the AL's, and all of those are deferred below.\n//\n// SHIPPING BEHAVIOUR PIN: Carbon ships with g_useDynamicLightsShadows =\n// false (cpp:21-22, a TRI_REGISTER_SETTING - runtime-mutable, hence the\n// static below rather than a constant). With it false, ResolveLightData\n// returns after the volumetric pass (cpp:568-571) and AddLight always\n// strips FLAG_CASTS_SHADOWS (cpp:359-365). The caster/atlas CPU half IS\n// ported (settings derivation, guillotine packer, five-pass fit, packed\n// 10-bit offsets) and sits behind the same setting; only its GPU\n// realization (the pooled D32 atlas texture, cpp:703-706) stays the\n// abstraction layer's.\n//\n// Carbon's thread-local gather vectors (safe under Tr2ParallelFor,\n// EveSpaceScene.cpp:1410) collapse to one array: the JS gather is\n// sequential. Carbon's file-static singleton (GetOrCreateInstance) is NOT\n// ported - the runtime injects a manager into GatherLights, which is the\n// shape every call site and test already has.\n//\n// docs/contracts/carbon-light-data.md owns the PerLightData layout, the\n// packed flag word, the premultiply and the fade band; the packing below\n// cites it rather than re-deriving it.\n\nimport { CjsModel } from \"#model\";\nimport { carbon, impl, type } from \"#schema\";\nimport { num } from \"#math/num\";\nimport { vec3 } from \"#math/vec3\";\nimport { ShadowQuality } from \"../../generated/trinityCore/enums.js\";\nimport { Tr2TextureArray } from \"../Tr2TextureArray/index.js\";\n\n// Tr2LightManager.cpp:30-48 - copied verbatim; the buffer sizes are the ABI\n// the AL uploads against.\nconst LIGHT_BUFFER_SIZE = 1024;\nconst CUTOFF_PIXEL_SIZE = 7;\nconst FADE_SIZE = 5;\nconst MAX_NUM_VOLUMETRIC_LIGHTS = 16;\nconst MAX_NUM_SHADOWCASTING_LIGHTS = 16;\nconst HIGH_QUALITY_ATLAS_SIZE_LOG2 = 14;\nconst HIGH_QUALITY_ATLAS_ENTRY_MAX_SIZE = 1 << 13;\nconst INFINITE_SIZE_CLAMP = 1 << 14; // 1 << HIGH_QUALITY_ATLAS_SIZE_LOG2\nconst FLOATS_PER_LIGHT = 12; // 48 bytes / 3 RGBA32 texels\n\n/** CCP_ALIGN: round up to a power-of-two alignment. */\nfunction align(value, alignment)\n{\n return (value + alignment - 1) & ~(alignment - 1);\n}\n\n/**\n * Carbon's anonymous-namespace CalculateShadowMapAtlasSettings (cpp:92-122).\n *\n * Ported branch for branch, including the SHADOW_RAYTRACED quirk: it zeroes\n * with SHADOW_DISABLED but then re-enters the != DISABLED block, so\n * `entryMinSizeLog2 = 0 - 10` wraps unsigned (4294967286) and\n * `1 << entryMinSizeLog2` shifts by that count. MSVC x86 masks the shift\n * count by 31 and SO DOES JavaScript's << - writing the arithmetic plainly\n * reproduces Carbon's shipping behaviour exactly (entryMinSize 1<<22,\n * entryMaxSize 8192 >> 14 = 0).\n *\n * @param {number} shadowQuality ShadowQuality ordinal.\n * @returns {object} ShadowMapAtlasSettings (actualTextureSize starts 0).\n */\nfunction calculateShadowMapAtlasSettings(shadowQuality)\n{\n const settings = {\n actualTextureSize: 0,\n sizeLog2: 0,\n size: 0,\n entryMinSizeLog2: 0,\n entryMinSize: 0,\n entryInverseScaleFactorLog2: 0,\n entryMaxSize: 0\n };\n switch (shadowQuality)\n {\n case ShadowQuality.SHADOW_DISABLED:\n case ShadowQuality.SHADOW_RAYTRACED:\n break;\n case ShadowQuality.SHADOW_LOW:\n settings.sizeLog2 = HIGH_QUALITY_ATLAS_SIZE_LOG2 - 2;\n break;\n case ShadowQuality.SHADOW_HIGH:\n settings.sizeLog2 = HIGH_QUALITY_ATLAS_SIZE_LOG2;\n break;\n }\n if (shadowQuality !== ShadowQuality.SHADOW_DISABLED)\n {\n settings.size = 1 << settings.sizeLog2;\n settings.entryMinSizeLog2 = (settings.sizeLog2 - 10) >>> 0;\n settings.entryMinSize = 1 << settings.entryMinSizeLog2;\n settings.entryInverseScaleFactorLog2 = HIGH_QUALITY_ATLAS_SIZE_LOG2 - settings.sizeLog2;\n settings.entryMaxSize = HIGH_QUALITY_ATLAS_ENTRY_MAX_SIZE >> settings.entryInverseScaleFactorLog2;\n }\n return settings;\n}\n\n// Carbon packs these halves through Float_16(...) (Tr2LightManager.cpp:297,\n// :328-329), which rounds to nearest. num.toHalfFloat is the runtime's one\n// half codec and rounds identically for every in-range value; an earlier\n// file-local encoder here TRUNCATED, a 1-ulp divergence from Carbon,\n// removed 2026-09-08.\nconst toHalf = num.toHalfFloat;\n\n/** Owns the frame's local-light records, their selection, and the packed light-buffer bytes the abstraction layer uploads. */\n@type.define({ className: \"Tr2LightManager\", family: \"trinityCore\" })\nexport class Tr2LightManager extends CjsModel\n{\n\n // Carbon m_lightData after the TLS flatten: the frame's accepted records,\n // plain-object copies (every producer reuses a static scratch record, so\n // AddLight copies by value exactly as std::vector::push_back does).\n #records = [];\n\n // Carbon m_volumetricLights / m_shadowCastingLights: indices into #records.\n #volumetricLights = [];\n\n #shadowCastingLights = [];\n\n // Carbon m_frustum, by reference (SetFrustum copies by value in C++; the\n // stamped frame frustum is not mutated during the gather, so a reference\n // carries the same guarantee here).\n #frustum = null;\n\n // Carbon m_adjustedCutoff (cpp:249-252).\n #adjustedCutoff = CUTOFF_PIXEL_SIZE;\n\n // Carbon m_currentSpaceSceneShadowQuality (h:197).\n #currentSpaceSceneShadowQuality = ShadowQuality.SHADOW_DISABLED;\n\n // Carbon nextFrameShadowQuality (h:196) - a bitmask collecting every\n // scene's requested quality during the current frame.\n #nextFrameShadowQuality = 0;\n\n // Carbon m_currentFrameCounter (h:198; ctor sets -1, cpp:164).\n #currentFrameCounter = -1;\n\n // Carbon's anonymous m_ShadowMap block (h:200-205): the atlas settings,\n // the guillotine node tree, and the quality the atlas was last sized for.\n #shadowMap = {\n atlasSettings: calculateShadowMapAtlasSettings(ShadowQuality.SHADOW_DISABLED),\n atlasNodes: [],\n qualityUsedByAtlas: ShadowQuality.SHADOW_DISABLED\n };\n\n // Non-Carbon: profile-object -> slice index, assigned on first sight. The\n // slot registry is description-side (Carbon assigns slices through the\n // manager-owned Tr2TextureArray, cpp:682-686, whose realization is AL).\n #profileSlots = new Map();\n\n // The packed PerLightData buffer (contract: 48 bytes / 3 RGBA32 texels per\n // light), built by ResolveLightData, uploaded by the AL.\n #packed = new Float32Array(LIGHT_BUFFER_SIZE * FLOATS_PER_LIGHT);\n\n #packedBits = new Uint32Array(this.#packed.buffer);\n\n #packedCount = 0;\n\n // Non-Carbon: bumped by ResolveLightData so the AL can skip re-uploads.\n #revision = 0;\n\n /** Tr2LightManager.h:100-105 - the light flag bits, Carbon's raw uint16 spelling. */\n static Flags = Object.freeze({\n AFFECTS_SURFACES: 1,\n AFFECTS_PARTICLES: 1 << 1,\n CASTS_SHADOWS: 1 << 2,\n IS_VOLUMETRIC: 1 << 3,\n DEFAULT: 1\n });\n\n /** The variable-store names the AL binds the packed buffers under\n * (Tr2LightManager.h:46-47; both isAutoregister). The NAMES are Trinity's\n * contract; the variables are the AL's to create. */\n static LIGHT_BUFFER_NAME = \"LightBuffer\";\n\n static LIGHT_INDEX_BUFFER_NAME = \"LightIndexBuffer\";\n\n /**\n * Carbon g_useDynamicLightsShadows (cpp:21-22) - a TRI_REGISTER_SETTING,\n * i.e. a runtime-mutable setting rather than a compile constant, shipped\n * FALSE. The whole shadow-caster/atlas half sits behind it; flipping it\n * exercises the ported path (the tests do), and shipping behaviour is\n * unchanged while it stays false.\n */\n static useDynamicLightsShadows = false;\n\n /** The atlas-settings derivation, exposed for tests (Carbon cpp:92-122). */\n static calculateShadowMapAtlasSettings = calculateShadowMapAtlasSettings;\n\n /**\n * Carbon Tr2LightManager::AreLightFlagsValid (cpp:677-680): a light must\n * affect surfaces or particles to exist at all.\n */\n @carbon.method\n @impl.implemented\n static areLightFlagsValid(flags)\n {\n return (flags & (Tr2LightManager.Flags.AFFECTS_SURFACES | Tr2LightManager.Flags.AFFECTS_PARTICLES)) !== 0;\n }\n\n /**\n * Carbon SetShadowQuality (cpp:262-295), the full body: record the\n * scene's quality, collapse the previous frame's quality bitmask into\n * qualityUsedByAtlas on a frame change (HIGH beats LOW beats DISABLED),\n * and recompute the atlas settings for min(requested, atlas quality)\n * with actualTextureSize taken from the atlas quality - multiple scenes\n * may request different qualities in one frame and the texture must fit\n * the largest.\n */\n @carbon.method\n @impl.implemented\n SetShadowQuality(quality, frameCounter = 0)\n {\n const shadowQuality = Number(quality) || 0;\n this.#currentSpaceSceneShadowQuality = shadowQuality;\n\n if (this.#currentFrameCounter !== frameCounter)\n {\n if (!Tr2LightManager.useDynamicLightsShadows)\n {\n this.#nextFrameShadowQuality = 0;\n }\n\n if (this.#nextFrameShadowQuality & (1 << ShadowQuality.SHADOW_HIGH))\n {\n this.#shadowMap.qualityUsedByAtlas = ShadowQuality.SHADOW_HIGH;\n }\n else if (this.#nextFrameShadowQuality & (1 << ShadowQuality.SHADOW_LOW))\n {\n this.#shadowMap.qualityUsedByAtlas = ShadowQuality.SHADOW_LOW;\n }\n else\n {\n this.#shadowMap.qualityUsedByAtlas = ShadowQuality.SHADOW_DISABLED;\n }\n this.#nextFrameShadowQuality = 1 << shadowQuality;\n this.#currentFrameCounter = frameCounter;\n }\n\n this.#nextFrameShadowQuality |= 1 << shadowQuality;\n\n const clamped = Math.min(shadowQuality, this.#shadowMap.qualityUsedByAtlas);\n this.#shadowMap.atlasSettings = calculateShadowMapAtlasSettings(clamped);\n this.#shadowMap.atlasSettings.actualTextureSize =\n calculateShadowMapAtlasSettings(this.#shadowMap.qualityUsedByAtlas).size;\n }\n\n /** Carbon GetShadowMapAtlasSettings (cpp:708-711). */\n @carbon.method\n @impl.implemented\n GetShadowMapAtlasSettings()\n {\n return this.#shadowMap.atlasSettings;\n }\n\n /**\n * Carbon GetUnpackedShadowMapData (cpp:810-815): the packed 10-bit\n * offsets/scale back into texels via the entry-min-size shift.\n *\n * @param {object} record A light record carrying the packed fields.\n * @param {object} [out] Receives scale/offsetX/offsetY.\n * @returns {object} out\n */\n @carbon.method\n @impl.implemented\n GetUnpackedShadowMapData(record, out = {})\n {\n const shift = this.#shadowMap.atlasSettings.entryMinSizeLog2;\n out.shadowMapScale = (record.shadowMapScale ?? 0) << shift;\n out.shadowMapOffsetX = (record.shadowMapOffsetX ?? 0) << shift;\n out.shadowMapOffsetY = (record.shadowMapOffsetY ?? 0) << shift;\n return out;\n }\n\n /**\n * Carbon Clear (cpp:220-242), the CPU half: drops the frame's records and\n * selections. The index-buffer UAV clear (cpp:224) is device work the AL\n * performs when it consumes the frame.\n */\n @carbon.method\n @impl.adapted\n @impl.reason(\"ClearLightIndices' UAV clear is AL realization; the vector clears are ported. The render-context parameter is accepted for signature parity and unused.\")\n Clear(_renderContext = null)\n {\n this.#records.length = 0;\n this.#volumetricLights.length = 0;\n this.#shadowCastingLights.length = 0;\n }\n\n /** Carbon SetFrustum (cpp:244-247). */\n @carbon.method\n @impl.implemented\n SetFrustum(frustum)\n {\n this.#frustum = frustum ?? null;\n }\n\n /** Carbon AdjustLightCutoff (cpp:249-252): the cull threshold is 7px * lodFactor. */\n @carbon.method\n @impl.implemented\n AdjustLightCutoff(lodFactor)\n {\n this.#adjustedCutoff = CUTOFF_PIXEL_SIZE * (Number(lodFactor) || 0);\n }\n\n /**\n * Carbon AddPointLight (cpp:297-332): authors a record from scratch, in\n * Carbon's exact order - flags gate, brightness gate, frustum cull, pixel\n * cutoff, premultiply+fade, defaults for everything a caller cannot\n * supply. The direction default is (1,0,0), never zero - a zero direction\n * is a legal bit pattern the shader normalises into NaN (contract §\"third\n * texel\").\n */\n @carbon.method\n @impl.implemented\n AddPointLight(position, radius, color, innerRadius = 0, flags = Tr2LightManager.Flags.DEFAULT)\n {\n if (!Tr2LightManager.areLightFlagsValid(flags)) return;\n\n const brightness = Math.max(color[0], color[1], color[2]);\n if (!(brightness > 0)) return;\n\n const dimming = this.#CullAndDim(position, radius);\n if (dimming <= 0) return;\n\n const scale = radius * dimming;\n this.#records.push({\n owner: null,\n lightData: null,\n lightProfile: null,\n lightType: 0,\n position: vec3.fromValues(position[0], position[1], position[2]),\n direction: vec3.fromValues(1, 0, 0),\n color: vec3.fromValues(color[0] * scale, color[1] * scale, color[2] * scale),\n radius,\n innerRadius,\n flags,\n outerAngle: 0,\n innerAngle: 0,\n projectionPlaneDistance: 0\n });\n }\n\n /**\n * Carbon AddLight (cpp:334-368): takes a caller-built record, applies the\n * same gates, premultiplies, and - faithfully - MUTATES the caller's\n * record in place where Carbon does (the shadow-flag strip on the non-const\n * reference, cpp:359-365; always taken under the shipping pin). The stored\n * record is a by-value copy: every producer reuses a static scratch record,\n * exactly as Carbon's std::vector push copies.\n */\n @carbon.method\n @impl.implemented\n AddLight(record)\n {\n if (!Tr2LightManager.areLightFlagsValid(record.flags)) return;\n\n const brightness = Math.max(record.color[0], record.color[1], record.color[2]);\n if (!(brightness > 0) || !(record.radius > 0)) return;\n\n const dimming = this.#CullAndDim(record.position, record.radius);\n if (dimming <= 0) return;\n\n // Carbon's conditional strip (cpp:359-365): shadows survive only when\n // the setting is on, the scene quality is not DISABLED, and a shadow-map\n // quality has an atlas actually sized for it (qualityUsedByAtlas lags a\n // frame behind). Always taken under the shipping default.\n const usingShadowMap = this.#currentSpaceSceneShadowQuality === ShadowQuality.SHADOW_LOW\n || this.#currentSpaceSceneShadowQuality === ShadowQuality.SHADOW_HIGH;\n if (this.#currentSpaceSceneShadowQuality === ShadowQuality.SHADOW_DISABLED\n || (usingShadowMap && this.#shadowMap.qualityUsedByAtlas === ShadowQuality.SHADOW_DISABLED)\n || !Tr2LightManager.useDynamicLightsShadows)\n {\n record.flags &= ~Tr2LightManager.Flags.CASTS_SHADOWS;\n }\n\n const scale = record.radius * dimming;\n this.#records.push({\n owner: record.owner ?? null,\n lightData: record.lightData ?? null,\n lightProfile: record.lightProfile ?? null,\n lightType: record.lightType ?? 0,\n position: vec3.fromValues(record.position[0], record.position[1], record.position[2]),\n direction: vec3.fromValues(record.direction[0], record.direction[1], record.direction[2]),\n color: vec3.fromValues(record.color[0] * scale, record.color[1] * scale, record.color[2] * scale),\n radius: record.radius,\n innerRadius: record.innerRadius ?? 0,\n flags: record.flags,\n outerAngle: record.outerAngle ?? 0,\n innerAngle: record.innerAngle ?? 0,\n projectionPlaneDistance: record.projectionPlaneDistance ?? 0\n });\n }\n\n /**\n * Carbon ResolveLightData (cpp:520-620): the TLS flatten is a no-op here\n * (one array), the volumetric top-16 selection runs exactly as Carbon's -\n * including clearing IS_VOLUMETRIC on the losers so shader and CPU agree -\n * then the shadow-caster half (ported in full, gated by the same\n * useDynamicLightsShadows setting Carbon ships false), then the packed\n * buffer: byte layout per the contract, profile slots biased by one into\n * flag bits 4-15, the shadow union in word 11.\n */\n @carbon.method\n @impl.implemented\n ResolveLightData()\n {\n const volumetric = [];\n for (let i = 0; i < this.#records.length; i++)\n {\n if (this.#records[i].flags & Tr2LightManager.Flags.IS_VOLUMETRIC)\n {\n const size = this.#ScreenSize(this.#records[i]);\n volumetric.push([ i, Math.min(size, INFINITE_SIZE_CLAMP) ]);\n }\n }\n volumetric.sort((a, b) => b[1] - a[1]);\n\n this.#volumetricLights.length = 0;\n for (let i = 0; i < volumetric.length; i++)\n {\n if (i < MAX_NUM_VOLUMETRIC_LIGHTS) this.#volumetricLights.push(volumetric[i][0]);\n else this.#records[volumetric[i][0]].flags &= ~Tr2LightManager.Flags.IS_VOLUMETRIC;\n }\n\n this.#ResolveShadowCasters();\n\n this.#Pack();\n this.#revision += 1;\n }\n\n /**\n * Carbon's shadow-caster half of ResolveLightData (cpp:568-620): the\n * useDynamicLightsShadows/DISABLED early-out (Carbon ships with the\n * setting FALSE - it is a TRI_REGISTER_SETTING, hence a mutable static\n * here rather than a constant), then filter casters by flag, estimate\n * screen size (Carbon's FLT_MAX inside-the-sphere sentinel clamps to the\n * high-quality atlas size), sort descending, keep the largest sixteen,\n * strip FLAG_CASTS_SHADOWS from the losers, assign raytracing masks by\n * rank under SHADOW_RAYTRACED, and pack the atlas for LOW/HIGH.\n */\n #ResolveShadowCasters()\n {\n this.#shadowCastingLights.length = 0;\n if (!Tr2LightManager.useDynamicLightsShadows\n || this.#currentSpaceSceneShadowQuality === ShadowQuality.SHADOW_DISABLED)\n {\n return;\n }\n\n const lightTuples = [];\n for (let i = 0; i < this.#records.length; i++)\n {\n if ((this.#records[i].flags & Tr2LightManager.Flags.CASTS_SHADOWS) !== 0)\n {\n let sizeAcross = this.#frustum\n ? this.#frustum.GetPixelSizeAccrossEst(this.#records[i].position, this.#records[i].radius)\n : 0;\n if (!Number.isFinite(sizeAcross)) sizeAcross = 1 << HIGH_QUALITY_ATLAS_SIZE_LOG2;\n lightTuples.push({ lightIndex: i, sizeAcross });\n }\n }\n\n lightTuples.sort((a, b) => b.sizeAcross - a.sizeAcross);\n\n const raytraced = this.#currentSpaceSceneShadowQuality === ShadowQuality.SHADOW_RAYTRACED;\n const numShadowCastingLights = Math.min(MAX_NUM_SHADOWCASTING_LIGHTS, lightTuples.length);\n let i = 0;\n for (; i < numShadowCastingLights; i++)\n {\n this.#shadowCastingLights.push(lightTuples[i].lightIndex);\n if (raytraced)\n {\n this.#records[lightTuples[i].lightIndex].raytracingShadowMask = 1 << i;\n }\n }\n for (; i < lightTuples.length; i++)\n {\n const record = this.#records[lightTuples[i].lightIndex];\n record.flags &= ~Tr2LightManager.Flags.CASTS_SHADOWS;\n if (raytraced)\n {\n record.raytracingShadowMask = 0;\n }\n }\n\n if (this.#currentSpaceSceneShadowQuality === ShadowQuality.SHADOW_LOW\n || this.#currentSpaceSceneShadowQuality === ShadowQuality.SHADOW_HIGH)\n {\n this.#CreateShadowMapAtlas(numShadowCastingLights, lightTuples);\n }\n }\n\n /**\n * Carbon CreateShadowMapAtlas (cpp:442-508): five fitting passes, each\n * halving entryMaxSize and incrementing the inverse-scale shift; entry\n * MIN size never scales. A failing pass still inserts every remaining\n * light before retrying. Point lights (innerAngle <= 0) take a 3x2\n * cube-cross, spots a square. Successful entries pack their offsets and\n * scale in entry-min-size units into the record's 10-bit fields; failures\n * zero them.\n */\n #CreateShadowMapAtlas(numShadowCastingLights, lightTuples)\n {\n const settings = this.#shadowMap.atlasSettings;\n const entry = { x: 0, y: 0 };\n let everythingFit = false;\n for (let j = 0; j < 5 && !everythingFit; j++)\n {\n everythingFit = true;\n const entryInverseScaleFactorLog2 = settings.entryInverseScaleFactorLog2 + j;\n const entryMaxSize = settings.entryMaxSize >> j;\n\n this.#shadowMap.atlasNodes.length = 0;\n this.#shadowMap.atlasNodes.push({\n children: [ -1, -1 ],\n lightIndex: -1,\n x: 0,\n y: 0,\n width: settings.size,\n height: settings.size\n });\n\n for (let i = 0; i < numShadowCastingLights; i++)\n {\n const lightIndex = lightTuples[i].lightIndex;\n const record = this.#records[lightIndex];\n\n let size = (lightTuples[i].sizeAcross >>> 0) >>> entryInverseScaleFactorLog2;\n size = Math.min(Math.max(size, settings.entryMinSize), entryMaxSize);\n size = align(size, settings.entryMinSize);\n\n let width, height;\n if (record.innerAngle <= 0)\n {\n // pointlight: a 3x2 cube-face cross\n width = 3 * size;\n height = 2 * size;\n }\n else\n {\n // spotlight\n width = size;\n height = size;\n }\n\n if (this.#GetShadowMapAtlasEntry(lightIndex, width, height, entry))\n {\n record.shadowMapOffsetX = entry.x >>> settings.entryMinSizeLog2;\n record.shadowMapOffsetY = entry.y >>> settings.entryMinSizeLog2;\n record.shadowMapScale = size >>> settings.entryMinSizeLog2;\n }\n else\n {\n record.shadowMapOffsetX = 0;\n record.shadowMapOffsetY = 0;\n record.shadowMapScale = 0;\n everythingFit = false;\n }\n }\n }\n }\n\n /**\n * Carbon GetShadowMapAtlasEntry (cpp:790-808): align the request to the\n * entry min size, insert from the root, and report position ONLY on\n * success - the out object is untouched on failure, exactly as Carbon\n * leaves its out-references.\n */\n #GetShadowMapAtlasEntry(lightIndex, width, height, out)\n {\n const settings = this.#shadowMap.atlasSettings;\n width = align(width, settings.entryMinSize);\n height = align(height, settings.entryMinSize);\n\n const nodeId = this.#InsertAtlasNode(this.#shadowMap.atlasNodes, 0, lightIndex, width, height);\n if (nodeId !== -1)\n {\n out.x = this.#shadowMap.atlasNodes[nodeId].x;\n out.y = this.#shadowMap.atlasNodes[nodeId].y;\n }\n return nodeId !== -1;\n }\n\n /**\n * Carbon InsertAtlasNode (cpp:718-788) - the blackpawn.com guillotine\n * packer, ported branch for branch: descend into split nodes (first\n * child, then second), reject occupied or too-small leaves, claim exact\n * fits, otherwise split along the larger remainder axis and recurse into\n * the first child.\n */\n #InsertAtlasNode(atlasNodes, nodeId, lightIndex, width, height)\n {\n const node = atlasNodes[nodeId];\n if (node.children[0] !== -1 || node.children[1] !== -1)\n {\n const newNode = this.#InsertAtlasNode(atlasNodes, node.children[0], lightIndex, width, height);\n if (newNode !== -1)\n {\n return newNode;\n }\n return this.#InsertAtlasNode(atlasNodes, node.children[1], lightIndex, width, height);\n }\n\n if (node.lightIndex !== -1)\n {\n return -1;\n }\n if (node.width < width || node.height < height)\n {\n return -1;\n }\n if (node.width === width && node.height === height)\n {\n node.lightIndex = lightIndex;\n return nodeId;\n }\n\n const child0 = { children: [ -1, -1 ], lightIndex: -1, x: 0, y: 0, width: 0, height: 0 };\n const child1 = { children: [ -1, -1 ], lightIndex: -1, x: 0, y: 0, width: 0, height: 0 };\n atlasNodes.push(child0, child1);\n node.children[0] = atlasNodes.length - 2;\n node.children[1] = atlasNodes.length - 1;\n\n const deltaWidth = node.width - width;\n const deltaHeight = node.height - height;\n\n if (deltaWidth > deltaHeight)\n {\n child0.x = node.x;\n child0.y = node.y;\n child0.width = width;\n child0.height = node.height;\n child1.x = node.x + width;\n child1.y = node.y;\n child1.width = node.width - width;\n child1.height = node.height;\n }\n else\n {\n child0.x = node.x;\n child0.y = node.y;\n child0.width = node.width;\n child0.height = height;\n child1.x = node.x;\n child1.y = node.y + height;\n child1.width = node.width;\n child1.height = node.height - height;\n }\n\n return this.#InsertAtlasNode(atlasNodes, node.children[0], lightIndex, width, height);\n }\n\n /** Carbon GetCurrentSpaceSceneShadowQuality (cpp:713-716): a bare field read; every record producer asks it before building. */\n @carbon.method\n @impl.implemented\n GetCurrentSpaceSceneShadowQuality()\n {\n return this.#currentSpaceSceneShadowQuality;\n }\n\n /** Carbon GetLightData (cpp:695-698): the frame's resolved records, borrowed. */\n @carbon.method\n @impl.implemented\n GetLightData()\n {\n return this.#records;\n }\n\n /** Carbon GetVolumetricLights (cpp:707-710): indices into GetLightData, borrowed. */\n @carbon.method\n @impl.implemented\n GetVolumetricLights()\n {\n return this.#volumetricLights;\n }\n\n /** Carbon GetShadowCastingLights (cpp:688-691): empty under the shipping pin, kept for signature parity. */\n @carbon.method\n @impl.implemented\n GetShadowCastingLights()\n {\n return this.#shadowCastingLights;\n }\n\n // The frame clock used to be threaded through here, as a non-Carbon seam:\n // the packed sets needed it for curve sampling and the manager was the one\n // object every GetLights implementation already received. Carbon's sets read\n // the renderer's clock, which is `gTriDev->GetAnimationTime()`, and they do\n // that here now. Nothing in src ever called the setter, so the five readers\n // had been sampling a constant zero.\n\n /** The packed PerLightData bytes for the AL to upload, borrowed (contract layout, 3 RGBA32 texels per light). */\n @impl.custom\n @impl.reason(\"AL seam: Trinity owns the packed description bytes; the AL realizes LightBuffer from this view. Carbon has no such seam; Tr2DataTextureManager now writes its own texture, so this has no precedent.\")\n GetLightBufferData()\n {\n return this.#packed.subarray(0, this.#packedCount * FLOATS_PER_LIGHT);\n }\n\n /** The number of packed lights in GetLightBufferData. */\n @impl.custom\n @impl.reason(\"AL seam companion to GetLightBufferData.\")\n GetLightCount()\n {\n return this.#packedCount;\n }\n\n /** Monotonic revision of the packed data, bumped by ResolveLightData, so the AL can skip unchanged re-uploads. */\n @impl.custom\n @impl.reason(\"Non-Carbon extension: cheaper than the AL diffing a typed array; Carbon re-uploads unconditionally.\")\n GetDataRevision()\n {\n return this.#revision;\n }\n\n /** Frustum cull + pixel-size cutoff, returning the fade-band dimming factor (0 = rejected). Cull applies only when a frustum was set. */\n #CullAndDim(position, radius)\n {\n if (!this.#frustum) return 1;\n if (!this.#frustum.IsSphereVisible(position, radius)) return 0;\n const size = this.#frustum.GetPixelSizeAccross(position, radius);\n if (!(size > this.#adjustedCutoff)) return 0;\n // Contract §\"Colour carries the radius\": the fade band sits ABOVE the\n // cutoff - absent at the cutoff, full brightness FADE_SIZE above it.\n return Math.min((size - this.#adjustedCutoff) / FADE_SIZE, 1);\n }\n\n /**\n * Returns the light's projected pixel size, or its radius when no frustum is\n * set.\n */\n #ScreenSize(record)\n {\n if (!this.#frustum) return record.radius;\n return this.#frustum.GetPixelSizeAccross(record.position, record.radius);\n }\n\n /**\n * The slice a profile occupies, +1 biased so 0 means \"no profile\"\n * (Tr2Light.cpp:137: `m_lightProfile ? GetTextureIndex() + 1 : 0`).\n *\n * The index comes from the RESOURCE (`GetTextureIndex`, the texture-array\n * slice - stable, shared across managers, reused after release), never\n * from an invented per-manager counter: Carbon assigns slices through the\n * process-wide light profile array (cpp:682-686), and a manager-local\n * numbering diverges from what the shader samples the moment two managers\n * or a released slot exist. A profile carrying a baked payload but no\n * slice yet is registered here - Carbon does this in the resource's\n * DoPrepare (Tr2LightProfileRes.cpp:95-99), which the layering forbids\n * (resource cannot import trinity), so the manager performs it at the\n * first pack instead; same array, same first-fit slot, one seam later.\n * The first-sight map remains only for foreign profile objects that\n * expose no GetTextureIndex.\n */\n #ProfileSlot(profile)\n {\n if (!profile) return 0;\n if (typeof profile.GetTextureIndex === \"function\")\n {\n let index = profile.GetTextureIndex();\n if (index < 0 && typeof profile.RegisterProfileElement === \"function\")\n {\n // Carbon hands the profile's m_bitmap to the array (Tr2LightProfileRes.cpp:95-99).\n const bitmap = profile.GetBitmap();\n if (bitmap.IsValid())\n {\n const element = Tr2LightManager.getLightProfileArray().AddElement(bitmap);\n if (element.IsValid())\n {\n profile.RegisterProfileElement(element);\n index = element.GetElementIndex();\n }\n }\n }\n return index >= 0 ? index + 1 : 0;\n }\n let slot = this.#profileSlots.get(profile);\n if (slot === undefined)\n {\n slot = this.#profileSlots.size;\n this.#profileSlots.set(profile, slot);\n }\n return slot + 1;\n }\n\n /**\n * The process-wide light profile array (Tr2LightManager.cpp:682-686).\n *\n * Carbon's is a function-local static that deliberately survives manager\n * destruction (ResetVariableStore re-registers the SAME live array,\n * cpp:186) - so under instance-per-scene managers this stays a class\n * static: two scenes share slices, and a profile's texture index means\n * the same thing everywhere. Realizing it as a GPU texture array is the\n * abstraction layer's job; consumers poll GetRevision or subscribe via\n * OnTextureChange.\n *\n * @returns {Tr2TextureArray} The shared profile array.\n */\n static getLightProfileArray()\n {\n if (!Tr2LightManager.#lightProfileArray)\n {\n Tr2LightManager.#lightProfileArray = new Tr2TextureArray();\n }\n return Tr2LightManager.#lightProfileArray;\n }\n\n static #lightProfileArray = null;\n\n /** Packs #records into the 48-byte-per-light buffer per the contract layout. */\n #Pack()\n {\n const count = Math.min(this.#records.length, LIGHT_BUFFER_SIZE);\n for (let i = 0; i < count; i++)\n {\n const record = this.#records[i];\n const f = i * FLOATS_PER_LIGHT;\n\n // Texel 0: position + radius, four f32.\n this.#packed[f] = record.position[0];\n this.#packed[f + 1] = record.position[1];\n this.#packed[f + 2] = record.position[2];\n this.#packed[f + 3] = record.radius;\n\n // Texel 1: colour (premultiplied at Add time) + the packed word -\n // innerRadius f16 low, flags u16 high with the biased profile slot in\n // bits 4-15 (contract §\"The packed flag word\").\n this.#packed[f + 4] = record.color[0];\n this.#packed[f + 5] = record.color[1];\n this.#packed[f + 6] = record.color[2];\n const flagsWord = (record.flags & 0xF) | (this.#ProfileSlot(record.lightProfile) << 4);\n this.#packedBits[f + 7] = toHalf(record.innerRadius) | ((flagsWord & 0xFFFF) << 16);\n\n // Texel 2: direction as three f16, projectionPlaneDistance, the two\n // angles, then the shadow union (h:70-84, MSVC low-bit-first layout:\n // bits 0-1 padding, 2-11 scale, 12-21 offsetX, 22-31 offsetY; the\n // raytraced mask shares the word - the paths are exclusive by\n // quality). All zeros under the shipping pin, exactly as before.\n this.#packedBits[f + 8] = toHalf(record.direction[0]) | (toHalf(record.direction[1]) << 16);\n this.#packedBits[f + 9] = toHalf(record.direction[2]) | (toHalf(record.projectionPlaneDistance) << 16);\n this.#packedBits[f + 10] = toHalf(record.outerAngle) | (toHalf(record.innerAngle) << 16);\n this.#packedBits[f + 11] = this.#currentSpaceSceneShadowQuality === ShadowQuality.SHADOW_RAYTRACED\n ? (record.raytracingShadowMask ?? 0) & 0xFFFF\n : (((record.shadowMapScale ?? 0) & 0x3FF) << 2)\n | (((record.shadowMapOffsetX ?? 0) & 0x3FF) << 12)\n | (((record.shadowMapOffsetY ?? 0) & 0x3FF) << 22);\n }\n this.#packedCount = count;\n }\n}\n"],"names":["LIGHT_BUFFER_SIZE","CUTOFF_PIXEL_SIZE","FADE_SIZE","MAX_NUM_VOLUMETRIC_LIGHTS","MAX_NUM_SHADOWCASTING_LIGHTS","HIGH_QUALITY_ATLAS_SIZE_LOG2","HIGH_QUALITY_ATLAS_ENTRY_MAX_SIZE","INFINITE_SIZE_CLAMP","FLOATS_PER_LIGHT","align","value","alignment","calculateShadowMapAtlasSettings","shadowQuality","settings","actualTextureSize","sizeLog2","size","entryMinSizeLog2","entryMinSize","entryInverseScaleFactorLog2","entryMaxSize","ShadowQuality","SHADOW_DISABLED","SHADOW_RAYTRACED","SHADOW_LOW","SHADOW_HIGH","toHalf","num","toHalfFloat","_Tr2LightManager","_identity","Tr2LightManager","CjsModel","e","_initProto","_initStatic","c","_initClass","_applyDecs","type","define","className","family","carbon","method","impl","implemented","adapted","reason","custom","atlasSettings","atlasNodes","qualityUsedByAtlas","Map","Float32Array","Uint32Array","buffer","areLightFlagsValid","flags","Flags","AFFECTS_SURFACES","AFFECTS_PARTICLES","SetShadowQuality","quality","frameCounter","Number","useDynamicLightsShadows","clamped","Math","min","GetShadowMapAtlasSettings","GetUnpackedShadowMapData","record","out","shift","shadowMapScale","shadowMapOffsetX","shadowMapOffsetY","Clear","_renderContext","length","SetFrustum","frustum","AdjustLightCutoff","lodFactor","AddPointLight","position","radius","color","innerRadius","DEFAULT","brightness","max","dimming","scale","push","owner","lightData","lightProfile","lightType","vec3","fromValues","direction","outerAngle","innerAngle","projectionPlaneDistance","AddLight","usingShadowMap","CASTS_SHADOWS","ResolveLightData","volumetric","i","IS_VOLUMETRIC","sort","a","b","#ResolveShadowCasters","lightTuples","sizeAcross","GetPixelSizeAccrossEst","isFinite","lightIndex","raytraced","numShadowCastingLights","raytracingShadowMask","#CreateShadowMapAtlas","entry","x","y","everythingFit","j","children","width","height","#GetShadowMapAtlasEntry","nodeId","#InsertAtlasNode","node","newNode","child0","child1","deltaWidth","deltaHeight","GetCurrentSpaceSceneShadowQuality","GetLightData","GetVolumetricLights","GetShadowCastingLights","GetLightBufferData","subarray","GetLightCount","GetDataRevision","#CullAndDim","IsSphereVisible","GetPixelSizeAccross","#ScreenSize","#ProfileSlot","profile","GetTextureIndex","index","RegisterProfileElement","bitmap","GetBitmap","IsValid","element","getLightProfileArray","AddElement","GetElementIndex","slot","get","undefined","set","Tr2TextureArray","#Pack","count","f","flagsWord","Object","freeze","LIGHT_BUFFER_NAME","LIGHT_INDEX_BUFFER_NAME","constructor"],"mappings":";;;;;;;;;;AAsCA;AACA;AACA,MAAMA,iBAAiB,GAAG,IAAI;AAC9B,MAAMC,iBAAiB,GAAG,CAAC;AAC3B,MAAMC,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,CAAC8C,MAAM,CAACgC,UAAU,CAAC,IAAI,EAAG;AACxF,QAAA,IAAI,CAAC,WAAW,CAACsE,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,+BAA+B,KAAKzJ,aAAa,CAACE,gBAAgB,GAC9F,CAACiD,MAAM,CAACoD,oBAAoB,IAAI,CAAC,IAAI,MAAM,GAC1C,CAAC,CAACpD,MAAM,CAACG,cAAc,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,GACzC,CAAC,CAACH,MAAM,CAACI,gBAAgB,IAAI,CAAC,IAAI,KAAK,KAAK,EAAG,GAC/C,CAAC,CAACJ,MAAM,CAACK,gBAAgB,IAAI,CAAC,IAAI,KAAK,KAAK,EAAG;AACxD,MAAA;AACA,MAAA,IAAI,CAAC,YAAY,GAAGgG,KAAK;AAC3B,IAAA;GACD;AAhrBQlH,EAAAA,KAAK,GAAGqH,MAAM,CAACC,MAAM,CAAC;AAC3BrH,IAAAA,gBAAgB,EAAE,CAAC;IACnBC,iBAAiB,EAAE,CAAC,IAAI,CAAC;IACzB+C,aAAa,EAAE,CAAC,IAAI,CAAC;IACrBI,aAAa,EAAE,CAAC,IAAI,CAAC;AACrBtB,IAAAA,OAAO,EAAE;AACX,GAAC,CAAC;AAKKwF,EAAAA,iBAAiB,GAAG,aAAa;AAEjCC,EAAAA,uBAAuB,GAAG,kBAAkB;AAS5CjH,EAAAA,uBAAuB,GAAG,KAAK;AAG/BvD,EAAAA,+BAA+B,GAAGA,+BAA+B;EA6mBjE,kBAAkB,GAAG,IAAI;EAACyK,WAAAA,GAAA;IAAA,KAAA,CAAAvJ,gBAAA,GAAAQ,UAAA,EAAA;AAAA,EAAA;AAAA,CAAA,EAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"Tr2LightManager.js","sources":["../../../../../src/trinity/core/lighting/Tr2LightManager.js"],"sourcesContent":["// Source: trinity/trinity/Tr2LightManager.h + Tr2LightManager.cpp\n//\n// The local-light manager: collects per-light records from every\n// ITr2LightOwner during the scene gather, culls and premultiplies them,\n// selects the volumetric set, packs the light buffer, and uploads it with\n// the light lists into the LightBuffer/LightIndexBuffer globals. The lists\n// are built on the CPU (DoUpdateLists) until computelightlists translates;\n// the shadow atlas texture and the raytraced path are not made.\n//\n// SHIPPING BEHAVIOUR PIN: Carbon ships with g_useDynamicLightsShadows =\n// false (cpp:21-22, a TRI_REGISTER_SETTING - runtime-mutable, hence the\n// static below rather than a constant). With it false, ResolveLightData\n// returns after the volumetric pass (cpp:568-571) and AddLight always\n// strips FLAG_CASTS_SHADOWS (cpp:359-365). The caster/atlas CPU half IS\n// ported (settings derivation, guillotine packer, five-pass fit, packed\n// 10-bit offsets) and sits behind the same setting; only its GPU\n// realization (the pooled D32 atlas texture, cpp:703-706) stays the\n// abstraction layer's.\n//\n// Carbon's thread-local gather vectors (safe under Tr2ParallelFor,\n// EveSpaceScene.cpp:1410) collapse to one array: the JS gather is\n// sequential. The file-static singleton is getOrCreateInstance; a manager\n// can still be constructed directly for CPU-only use and tests.\n//\n// docs/contracts/carbon-light-data.md owns the PerLightData layout, the\n// packed flag word, the premultiply and the fade band; the packing below\n// cites it rather than re-deriving it.\n\nimport { CjsModel } from \"#model\";\nimport { carbon, impl, type } from \"#schema\";\nimport { num } from \"#math/num\";\nimport { vec3 } from \"#math/vec3\";\nimport { ShadowQuality } from \"../../generated/trinityCore/enums.js\";\nimport { Tr2TextureArray } from \"../Tr2TextureArray/index.js\";\nimport { Tr2GpuStructuredBuffer } from \"../device/Tr2GpuStructuredBuffer.js\";\nimport { TriDevice } from \"../device/TriDevice.js\";\nimport { Tr2Renderer } from \"../Tr2Renderer.js\";\nimport { Tr2RenderContext_GetMainThreadRenderContext } from \"../context/Tr2RenderContext.js\";\nimport { Tr2VariableStore } from \"../variable/Tr2VariableStore.js\";\nimport { Succeeded } from \"#trinityal\";\n\n// Tr2LightManager.cpp:30-48 - copied verbatim; the buffer sizes are the ABI\n// the AL uploads against.\nconst LIGHT_BUFFER_SIZE = 1024;\nconst CUTOFF_PIXEL_SIZE = 7;\nconst FADE_SIZE = 5;\nconst MAX_NUM_VOLUMETRIC_LIGHTS = 16;\nconst MAX_NUM_SHADOWCASTING_LIGHTS = 16;\nconst HIGH_QUALITY_ATLAS_SIZE_LOG2 = 14;\nconst HIGH_QUALITY_ATLAS_ENTRY_MAX_SIZE = 1 << 13;\nconst INFINITE_SIZE_CLAMP = 1 << 14; // 1 << HIGH_QUALITY_ATLAS_SIZE_LOG2\nconst FLOATS_PER_LIGHT = 12; // 48 bytes / 3 RGBA32 texels\nconst BYTES_PER_LIGHT = FLOATS_PER_LIGHT * 4;\n// Tr2LightManager.cpp:39-40 - the light-list tiles, 16x16 pixels.\nconst TILE_WIDTH = 16;\nconst TILE_HEIGHT = 16;\n// Header words per tile: list0 head, list1 head, particle-list head\n// (computelightlists writes all three; the hull shaders read +0).\nconst HEADER_WORDS_PER_TILE = 3;\n\n/** CCP_ALIGN: round up to a power-of-two alignment. */\nfunction align(value, alignment)\n{\n return (value + alignment - 1) & ~(alignment - 1);\n}\n\n/**\n * Carbon's anonymous-namespace CalculateShadowMapAtlasSettings (cpp:92-122).\n *\n * Ported branch for branch, including the SHADOW_RAYTRACED quirk: it zeroes\n * with SHADOW_DISABLED but then re-enters the != DISABLED block, so\n * `entryMinSizeLog2 = 0 - 10` wraps unsigned (4294967286) and\n * `1 << entryMinSizeLog2` shifts by that count. MSVC x86 masks the shift\n * count by 31 and SO DOES JavaScript's << - writing the arithmetic plainly\n * reproduces Carbon's shipping behaviour exactly (entryMinSize 1<<22,\n * entryMaxSize 8192 >> 14 = 0).\n *\n * @param {number} shadowQuality ShadowQuality ordinal.\n * @returns {object} ShadowMapAtlasSettings (actualTextureSize starts 0).\n */\nfunction calculateShadowMapAtlasSettings(shadowQuality)\n{\n const settings = {\n actualTextureSize: 0,\n sizeLog2: 0,\n size: 0,\n entryMinSizeLog2: 0,\n entryMinSize: 0,\n entryInverseScaleFactorLog2: 0,\n entryMaxSize: 0\n };\n switch (shadowQuality)\n {\n case ShadowQuality.SHADOW_DISABLED:\n case ShadowQuality.SHADOW_RAYTRACED:\n break;\n case ShadowQuality.SHADOW_LOW:\n settings.sizeLog2 = HIGH_QUALITY_ATLAS_SIZE_LOG2 - 2;\n break;\n case ShadowQuality.SHADOW_HIGH:\n settings.sizeLog2 = HIGH_QUALITY_ATLAS_SIZE_LOG2;\n break;\n }\n if (shadowQuality !== ShadowQuality.SHADOW_DISABLED)\n {\n settings.size = 1 << settings.sizeLog2;\n settings.entryMinSizeLog2 = (settings.sizeLog2 - 10) >>> 0;\n settings.entryMinSize = 1 << settings.entryMinSizeLog2;\n settings.entryInverseScaleFactorLog2 = HIGH_QUALITY_ATLAS_SIZE_LOG2 - settings.sizeLog2;\n settings.entryMaxSize = HIGH_QUALITY_ATLAS_ENTRY_MAX_SIZE >> settings.entryInverseScaleFactorLog2;\n }\n return settings;\n}\n\n// Carbon packs these halves through Float_16(...) (Tr2LightManager.cpp:297,\n// :328-329), which rounds to nearest. num.toHalfFloat is the runtime's one\n// half codec and rounds identically for every in-range value; an earlier\n// file-local encoder here TRUNCATED, a 1-ulp divergence from Carbon,\n// removed 2026-09-08.\nconst toHalf = num.toHalfFloat;\n\n/** Owns the frame's local-light records, their selection, and the packed light-buffer bytes the abstraction layer uploads. */\n@type.define({ className: \"Tr2LightManager\", family: \"trinityCore\" })\nexport class Tr2LightManager extends CjsModel\n{\n\n // Carbon m_lightData after the TLS flatten: the frame's accepted records,\n // plain-object copies (every producer reuses a static scratch record, so\n // AddLight copies by value exactly as std::vector::push_back does).\n _records = [];\n\n // Carbon m_volumetricLights / m_shadowCastingLights: indices into _records.\n _volumetricLights = [];\n\n _shadowCastingLights = [];\n\n // Carbon m_frustum, by reference (SetFrustum copies by value in C++; the\n // stamped frame frustum is not mutated during the gather, so a reference\n // carries the same guarantee here).\n _frustum = null;\n\n // Carbon m_adjustedCutoff (cpp:249-252).\n _adjustedCutoff = CUTOFF_PIXEL_SIZE;\n\n // Carbon m_currentSpaceSceneShadowQuality (h:197).\n _currentSpaceSceneShadowQuality = ShadowQuality.SHADOW_DISABLED;\n\n // Carbon nextFrameShadowQuality (h:196) - a bitmask collecting every\n // scene's requested quality during the current frame.\n _nextFrameShadowQuality = 0;\n\n // Carbon m_currentFrameCounter (h:198; ctor sets -1, cpp:164).\n _currentFrameCounter = -1;\n\n // Carbon's anonymous m_ShadowMap block (h:200-205): the atlas settings,\n // the guillotine node tree, and the quality the atlas was last sized for.\n _shadowMap = {\n atlasSettings: calculateShadowMapAtlasSettings(ShadowQuality.SHADOW_DISABLED),\n atlasNodes: [],\n qualityUsedByAtlas: ShadowQuality.SHADOW_DISABLED\n };\n\n // Non-Carbon: profile-object -> slice index, assigned on first sight. The\n // slot registry is description-side (Carbon assigns slices through the\n // manager-owned Tr2TextureArray, cpp:682-686, whose realization is AL).\n _profileSlots = new Map();\n\n // The packed PerLightData buffer (contract: 48 bytes / 3 RGBA32 texels per\n // light), built by ResolveLightData, uploaded by the AL.\n _packed = new Float32Array(LIGHT_BUFFER_SIZE * FLOATS_PER_LIGHT);\n\n _packedBits = new Uint32Array(this._packed.buffer);\n\n _packedCount = 0;\n\n // Non-Carbon: bumped by ResolveLightData so the AL can skip re-uploads.\n _revision = 0;\n\n /** Tr2LightManager.h:100-105 - the light flag bits, Carbon's raw uint16 spelling. */\n static Flags = Object.freeze({\n AFFECTS_SURFACES: 1,\n AFFECTS_PARTICLES: 1 << 1,\n CASTS_SHADOWS: 1 << 2,\n IS_VOLUMETRIC: 1 << 3,\n DEFAULT: 1\n });\n\n /** The variable-store names the AL binds the packed buffers under\n * (Tr2LightManager.h:46-47; both isAutoregister). The NAMES are Trinity's\n * contract; the variables are the AL's to create. */\n static LIGHT_BUFFER_NAME = \"LightBuffer\";\n\n static LIGHT_INDEX_BUFFER_NAME = \"LightIndexBuffer\";\n\n /**\n * Carbon g_useDynamicLightsShadows (cpp:21-22) - a TRI_REGISTER_SETTING,\n * i.e. a runtime-mutable setting rather than a compile constant, shipped\n * FALSE. The whole shadow-caster/atlas half sits behind it; flipping it\n * exercises the ported path (the tests do), and shipping behaviour is\n * unchanged while it stays false.\n */\n static useDynamicLightsShadows = false;\n\n /** The atlas-settings derivation, exposed for tests (Carbon cpp:92-122). */\n static calculateShadowMapAtlasSettings = calculateShadowMapAtlasSettings;\n\n /**\n * Carbon Tr2LightManager::AreLightFlagsValid (cpp:677-680): a light must\n * affect surfaces or particles to exist at all.\n */\n @carbon.method\n @impl.implemented\n static areLightFlagsValid(flags)\n {\n return (flags & (Tr2LightManager.Flags.AFFECTS_SURFACES | Tr2LightManager.Flags.AFFECTS_PARTICLES)) !== 0;\n }\n\n /**\n * Carbon SetShadowQuality (cpp:262-295), the full body: record the\n * scene's quality, collapse the previous frame's quality bitmask into\n * qualityUsedByAtlas on a frame change (HIGH beats LOW beats DISABLED),\n * and recompute the atlas settings for min(requested, atlas quality)\n * with actualTextureSize taken from the atlas quality - multiple scenes\n * may request different qualities in one frame and the texture must fit\n * the largest.\n */\n @carbon.method\n @impl.implemented\n SetShadowQuality(quality, frameCounter = 0)\n {\n const shadowQuality = Number(quality) || 0;\n this._currentSpaceSceneShadowQuality = shadowQuality;\n\n if (this._currentFrameCounter !== frameCounter)\n {\n if (!Tr2LightManager.useDynamicLightsShadows)\n {\n this._nextFrameShadowQuality = 0;\n }\n\n if (this._nextFrameShadowQuality & (1 << ShadowQuality.SHADOW_HIGH))\n {\n this._shadowMap.qualityUsedByAtlas = ShadowQuality.SHADOW_HIGH;\n }\n else if (this._nextFrameShadowQuality & (1 << ShadowQuality.SHADOW_LOW))\n {\n this._shadowMap.qualityUsedByAtlas = ShadowQuality.SHADOW_LOW;\n }\n else\n {\n this._shadowMap.qualityUsedByAtlas = ShadowQuality.SHADOW_DISABLED;\n }\n this._nextFrameShadowQuality = 1 << shadowQuality;\n this._currentFrameCounter = frameCounter;\n }\n\n this._nextFrameShadowQuality |= 1 << shadowQuality;\n\n const clamped = Math.min(shadowQuality, this._shadowMap.qualityUsedByAtlas);\n this._shadowMap.atlasSettings = calculateShadowMapAtlasSettings(clamped);\n this._shadowMap.atlasSettings.actualTextureSize =\n calculateShadowMapAtlasSettings(this._shadowMap.qualityUsedByAtlas).size;\n }\n\n /** Carbon GetShadowMapAtlasSettings (cpp:708-711). */\n @carbon.method\n @impl.implemented\n GetShadowMapAtlasSettings()\n {\n return this._shadowMap.atlasSettings;\n }\n\n /**\n * Carbon GetUnpackedShadowMapData (cpp:810-815): the packed 10-bit\n * offsets/scale back into texels via the entry-min-size shift.\n *\n * @param {object} record A light record carrying the packed fields.\n * @param {object} [out] Receives scale/offsetX/offsetY.\n * @returns {object} out\n */\n @carbon.method\n @impl.implemented\n GetUnpackedShadowMapData(record, out = {})\n {\n const shift = this._shadowMap.atlasSettings.entryMinSizeLog2;\n out.shadowMapScale = (record.shadowMapScale ?? 0) << shift;\n out.shadowMapOffsetX = (record.shadowMapOffsetX ?? 0) << shift;\n out.shadowMapOffsetY = (record.shadowMapOffsetY ?? 0) << shift;\n return out;\n }\n\n /**\n * Carbon Clear (cpp:220-242): re-points the light-buffer globals, clears\n * the light indices, drops the frame's records and selections, and resets\n * the atlas to one empty root node.\n *\n * Without a render context (a CPU-only caller) the index clear is skipped;\n * there is no buffer to clear then.\n */\n @carbon.method\n @impl.implemented\n Clear(renderContext = null)\n {\n this.SetVariableStore();\n if (renderContext) this.ClearLightIndices(renderContext);\n\n this._records.length = 0;\n this._volumetricLights.length = 0;\n this._shadowCastingLights.length = 0;\n\n const size = this._shadowMap.atlasSettings.size;\n this._shadowMap.atlasNodes.length = 0;\n this._shadowMap.atlasNodes.push({ children: [ -1, -1 ], lightIndex: -1, x: 0, y: 0, width: size, height: size });\n }\n\n /** Carbon SetFrustum (cpp:244-247). */\n @carbon.method\n @impl.implemented\n SetFrustum(frustum)\n {\n this._frustum = frustum ?? null;\n }\n\n /** Carbon AdjustLightCutoff (cpp:249-252): the cull threshold is 7px * lodFactor. */\n @carbon.method\n @impl.implemented\n AdjustLightCutoff(lodFactor)\n {\n this._adjustedCutoff = CUTOFF_PIXEL_SIZE * (Number(lodFactor) || 0);\n }\n\n /**\n * Carbon AddPointLight (cpp:297-332): authors a record from scratch, in\n * Carbon's exact order - flags gate, brightness gate, frustum cull, pixel\n * cutoff, premultiply+fade, defaults for everything a caller cannot\n * supply. The direction default is (1,0,0), never zero - a zero direction\n * is a legal bit pattern the shader normalises into NaN (contract §\"third\n * texel\").\n */\n @carbon.method\n @impl.implemented\n AddPointLight(position, radius, color, innerRadius = 0, flags = Tr2LightManager.Flags.DEFAULT)\n {\n if (!Tr2LightManager.areLightFlagsValid(flags)) return;\n\n const brightness = Math.max(color[0], color[1], color[2]);\n if (!(brightness > 0)) return;\n\n const dimming = this._CullAndDim(position, radius);\n if (dimming <= 0) return;\n\n const scale = radius * dimming;\n this._records.push({\n owner: null,\n lightData: null,\n lightProfile: null,\n lightType: 0,\n position: vec3.fromValues(position[0], position[1], position[2]),\n direction: vec3.fromValues(1, 0, 0),\n color: vec3.fromValues(color[0] * scale, color[1] * scale, color[2] * scale),\n radius,\n innerRadius,\n flags,\n outerAngle: 0,\n innerAngle: 0,\n projectionPlaneDistance: 0\n });\n }\n\n /**\n * Carbon AddLight (cpp:334-368): takes a caller-built record, applies the\n * same gates, premultiplies, and - faithfully - MUTATES the caller's\n * record in place where Carbon does (the shadow-flag strip on the non-const\n * reference, cpp:359-365; always taken under the shipping pin). The stored\n * record is a by-value copy: every producer reuses a static scratch record,\n * exactly as Carbon's std::vector push copies.\n */\n @carbon.method\n @impl.implemented\n AddLight(record)\n {\n if (!Tr2LightManager.areLightFlagsValid(record.flags)) return;\n\n const brightness = Math.max(record.color[0], record.color[1], record.color[2]);\n if (!(brightness > 0) || !(record.radius > 0)) return;\n\n const dimming = this._CullAndDim(record.position, record.radius);\n if (dimming <= 0) return;\n\n // Carbon's conditional strip (cpp:359-365): shadows survive only when\n // the setting is on, the scene quality is not DISABLED, and a shadow-map\n // quality has an atlas actually sized for it (qualityUsedByAtlas lags a\n // frame behind). Always taken under the shipping default.\n const usingShadowMap = this._currentSpaceSceneShadowQuality === ShadowQuality.SHADOW_LOW\n || this._currentSpaceSceneShadowQuality === ShadowQuality.SHADOW_HIGH;\n if (this._currentSpaceSceneShadowQuality === ShadowQuality.SHADOW_DISABLED\n || (usingShadowMap && this._shadowMap.qualityUsedByAtlas === ShadowQuality.SHADOW_DISABLED)\n || !Tr2LightManager.useDynamicLightsShadows)\n {\n record.flags &= ~Tr2LightManager.Flags.CASTS_SHADOWS;\n }\n\n const scale = record.radius * dimming;\n this._records.push({\n owner: record.owner ?? null,\n lightData: record.lightData ?? null,\n lightProfile: record.lightProfile ?? null,\n lightType: record.lightType ?? 0,\n position: vec3.fromValues(record.position[0], record.position[1], record.position[2]),\n direction: vec3.fromValues(record.direction[0], record.direction[1], record.direction[2]),\n color: vec3.fromValues(record.color[0] * scale, record.color[1] * scale, record.color[2] * scale),\n radius: record.radius,\n innerRadius: record.innerRadius ?? 0,\n flags: record.flags,\n outerAngle: record.outerAngle ?? 0,\n innerAngle: record.innerAngle ?? 0,\n projectionPlaneDistance: record.projectionPlaneDistance ?? 0\n });\n }\n\n /**\n * Carbon ResolveLightData (cpp:520-620): the TLS flatten is a no-op here\n * (one array), the volumetric top-16 selection runs exactly as Carbon's -\n * including clearing IS_VOLUMETRIC on the losers so shader and CPU agree -\n * then the shadow-caster half (ported in full, gated by the same\n * useDynamicLightsShadows setting Carbon ships false), then the packed\n * buffer: byte layout per the contract, profile slots biased by one into\n * flag bits 4-15, the shadow union in word 11.\n */\n @carbon.method\n @impl.implemented\n ResolveLightData()\n {\n const volumetric = [];\n for (let i = 0; i < this._records.length; i++)\n {\n if (this._records[i].flags & Tr2LightManager.Flags.IS_VOLUMETRIC)\n {\n const size = this._ScreenSize(this._records[i]);\n volumetric.push([ i, Math.min(size, INFINITE_SIZE_CLAMP) ]);\n }\n }\n volumetric.sort((a, b) => b[1] - a[1]);\n\n this._volumetricLights.length = 0;\n for (let i = 0; i < volumetric.length; i++)\n {\n if (i < MAX_NUM_VOLUMETRIC_LIGHTS) this._volumetricLights.push(volumetric[i][0]);\n else this._records[volumetric[i][0]].flags &= ~Tr2LightManager.Flags.IS_VOLUMETRIC;\n }\n\n this._ResolveShadowCasters();\n\n this._Pack();\n this._revision += 1;\n }\n\n /**\n * Carbon's shadow-caster half of ResolveLightData (cpp:568-620): the\n * useDynamicLightsShadows/DISABLED early-out (Carbon ships with the\n * setting FALSE - it is a TRI_REGISTER_SETTING, hence a mutable static\n * here rather than a constant), then filter casters by flag, estimate\n * screen size (Carbon's FLT_MAX inside-the-sphere sentinel clamps to the\n * high-quality atlas size), sort descending, keep the largest sixteen,\n * strip FLAG_CASTS_SHADOWS from the losers, assign raytracing masks by\n * rank under SHADOW_RAYTRACED, and pack the atlas for LOW/HIGH.\n */\n _ResolveShadowCasters()\n {\n this._shadowCastingLights.length = 0;\n if (!Tr2LightManager.useDynamicLightsShadows\n || this._currentSpaceSceneShadowQuality === ShadowQuality.SHADOW_DISABLED)\n {\n return;\n }\n\n const lightTuples = [];\n for (let i = 0; i < this._records.length; i++)\n {\n if ((this._records[i].flags & Tr2LightManager.Flags.CASTS_SHADOWS) !== 0)\n {\n let sizeAcross = this._frustum\n ? this._frustum.GetPixelSizeAccrossEst(this._records[i].position, this._records[i].radius)\n : 0;\n if (!Number.isFinite(sizeAcross)) sizeAcross = 1 << HIGH_QUALITY_ATLAS_SIZE_LOG2;\n lightTuples.push({ lightIndex: i, sizeAcross });\n }\n }\n\n lightTuples.sort((a, b) => b.sizeAcross - a.sizeAcross);\n\n const raytraced = this._currentSpaceSceneShadowQuality === ShadowQuality.SHADOW_RAYTRACED;\n const numShadowCastingLights = Math.min(MAX_NUM_SHADOWCASTING_LIGHTS, lightTuples.length);\n let i = 0;\n for (; i < numShadowCastingLights; i++)\n {\n this._shadowCastingLights.push(lightTuples[i].lightIndex);\n if (raytraced)\n {\n this._records[lightTuples[i].lightIndex].raytracingShadowMask = 1 << i;\n }\n }\n for (; i < lightTuples.length; i++)\n {\n const record = this._records[lightTuples[i].lightIndex];\n record.flags &= ~Tr2LightManager.Flags.CASTS_SHADOWS;\n if (raytraced)\n {\n record.raytracingShadowMask = 0;\n }\n }\n\n if (this._currentSpaceSceneShadowQuality === ShadowQuality.SHADOW_LOW\n || this._currentSpaceSceneShadowQuality === ShadowQuality.SHADOW_HIGH)\n {\n this._CreateShadowMapAtlas(numShadowCastingLights, lightTuples);\n }\n }\n\n /**\n * Carbon CreateShadowMapAtlas (cpp:442-508): five fitting passes, each\n * halving entryMaxSize and incrementing the inverse-scale shift; entry\n * MIN size never scales. A failing pass still inserts every remaining\n * light before retrying. Point lights (innerAngle <= 0) take a 3x2\n * cube-cross, spots a square. Successful entries pack their offsets and\n * scale in entry-min-size units into the record's 10-bit fields; failures\n * zero them.\n */\n _CreateShadowMapAtlas(numShadowCastingLights, lightTuples)\n {\n const settings = this._shadowMap.atlasSettings;\n const entry = { x: 0, y: 0 };\n let everythingFit = false;\n for (let j = 0; j < 5 && !everythingFit; j++)\n {\n everythingFit = true;\n const entryInverseScaleFactorLog2 = settings.entryInverseScaleFactorLog2 + j;\n const entryMaxSize = settings.entryMaxSize >> j;\n\n this._shadowMap.atlasNodes.length = 0;\n this._shadowMap.atlasNodes.push({\n children: [ -1, -1 ],\n lightIndex: -1,\n x: 0,\n y: 0,\n width: settings.size,\n height: settings.size\n });\n\n for (let i = 0; i < numShadowCastingLights; i++)\n {\n const lightIndex = lightTuples[i].lightIndex;\n const record = this._records[lightIndex];\n\n let size = (lightTuples[i].sizeAcross >>> 0) >>> entryInverseScaleFactorLog2;\n size = Math.min(Math.max(size, settings.entryMinSize), entryMaxSize);\n size = align(size, settings.entryMinSize);\n\n let width, height;\n if (record.innerAngle <= 0)\n {\n // pointlight: a 3x2 cube-face cross\n width = 3 * size;\n height = 2 * size;\n }\n else\n {\n // spotlight\n width = size;\n height = size;\n }\n\n if (this._GetShadowMapAtlasEntry(lightIndex, width, height, entry))\n {\n record.shadowMapOffsetX = entry.x >>> settings.entryMinSizeLog2;\n record.shadowMapOffsetY = entry.y >>> settings.entryMinSizeLog2;\n record.shadowMapScale = size >>> settings.entryMinSizeLog2;\n }\n else\n {\n record.shadowMapOffsetX = 0;\n record.shadowMapOffsetY = 0;\n record.shadowMapScale = 0;\n everythingFit = false;\n }\n }\n }\n }\n\n /**\n * Carbon GetShadowMapAtlasEntry (cpp:790-808): align the request to the\n * entry min size, insert from the root, and report position ONLY on\n * success - the out object is untouched on failure, exactly as Carbon\n * leaves its out-references.\n */\n _GetShadowMapAtlasEntry(lightIndex, width, height, out)\n {\n const settings = this._shadowMap.atlasSettings;\n width = align(width, settings.entryMinSize);\n height = align(height, settings.entryMinSize);\n\n const nodeId = this._InsertAtlasNode(this._shadowMap.atlasNodes, 0, lightIndex, width, height);\n if (nodeId !== -1)\n {\n out.x = this._shadowMap.atlasNodes[nodeId].x;\n out.y = this._shadowMap.atlasNodes[nodeId].y;\n }\n return nodeId !== -1;\n }\n\n /**\n * Carbon InsertAtlasNode (cpp:718-788) - the blackpawn.com guillotine\n * packer, ported branch for branch: descend into split nodes (first\n * child, then second), reject occupied or too-small leaves, claim exact\n * fits, otherwise split along the larger remainder axis and recurse into\n * the first child.\n */\n _InsertAtlasNode(atlasNodes, nodeId, lightIndex, width, height)\n {\n const node = atlasNodes[nodeId];\n if (node.children[0] !== -1 || node.children[1] !== -1)\n {\n const newNode = this._InsertAtlasNode(atlasNodes, node.children[0], lightIndex, width, height);\n if (newNode !== -1)\n {\n return newNode;\n }\n return this._InsertAtlasNode(atlasNodes, node.children[1], lightIndex, width, height);\n }\n\n if (node.lightIndex !== -1)\n {\n return -1;\n }\n if (node.width < width || node.height < height)\n {\n return -1;\n }\n if (node.width === width && node.height === height)\n {\n node.lightIndex = lightIndex;\n return nodeId;\n }\n\n const child0 = { children: [ -1, -1 ], lightIndex: -1, x: 0, y: 0, width: 0, height: 0 };\n const child1 = { children: [ -1, -1 ], lightIndex: -1, x: 0, y: 0, width: 0, height: 0 };\n atlasNodes.push(child0, child1);\n node.children[0] = atlasNodes.length - 2;\n node.children[1] = atlasNodes.length - 1;\n\n const deltaWidth = node.width - width;\n const deltaHeight = node.height - height;\n\n if (deltaWidth > deltaHeight)\n {\n child0.x = node.x;\n child0.y = node.y;\n child0.width = width;\n child0.height = node.height;\n child1.x = node.x + width;\n child1.y = node.y;\n child1.width = node.width - width;\n child1.height = node.height;\n }\n else\n {\n child0.x = node.x;\n child0.y = node.y;\n child0.width = node.width;\n child0.height = height;\n child1.x = node.x;\n child1.y = node.y + height;\n child1.width = node.width;\n child1.height = node.height - height;\n }\n\n return this._InsertAtlasNode(atlasNodes, node.children[0], lightIndex, width, height);\n }\n\n /** Carbon GetCurrentSpaceSceneShadowQuality (cpp:713-716): a bare field read; every record producer asks it before building. */\n @carbon.method\n @impl.implemented\n GetCurrentSpaceSceneShadowQuality()\n {\n return this._currentSpaceSceneShadowQuality;\n }\n\n /** Carbon GetLightData (cpp:695-698): the frame's resolved records, borrowed. */\n @carbon.method\n @impl.implemented\n GetLightData()\n {\n return this._records;\n }\n\n /** Carbon GetVolumetricLights (cpp:707-710): indices into GetLightData, borrowed. */\n @carbon.method\n @impl.implemented\n GetVolumetricLights()\n {\n return this._volumetricLights;\n }\n\n /** Carbon GetShadowCastingLights (cpp:688-691): empty under the shipping pin, kept for signature parity. */\n @carbon.method\n @impl.implemented\n GetShadowCastingLights()\n {\n return this._shadowCastingLights;\n }\n\n // The frame clock used to be threaded through here, as a non-Carbon seam:\n // the packed sets needed it for curve sampling and the manager was the one\n // object every GetLights implementation already received. Carbon's sets read\n // the renderer's clock, which is `gTriDev->GetAnimationTime()`, and they do\n // that here now. Nothing in src ever called the setter, so the five readers\n // had been sampling a constant zero.\n\n /** Carbon m_effect's path, computelightlists (EveSpaceScene.cpp:1380). */\n _effectPath = \"\";\n\n /** m_lightBuffer (Tr2GpuStructuredBufferPtr): one PerLightData per light. */\n _lightBuffer = new Tr2GpuStructuredBuffer();\n\n /** m_indexBuffer (Tr2GpuStructuredBufferPtr): tile headers, then list nodes. */\n _indexBuffer = new Tr2GpuStructuredBuffer();\n\n /** m_lightBufferVariable / m_indexBufferVariable (TriVariableHandle). */\n _lightBufferVariable = null;\n\n _indexBufferVariable = null;\n\n /** The CPU-built index list, reused across frames (see DoUpdateLists). */\n _indexList = new Uint32Array(0);\n\n /**\n * Carbon's constructor half that makes this a device resource and\n * publishes the globals (cpp:145-176): LightBuffer and LightIndexBuffer are\n * registered once and pointed at the buffers, and the buffers are made\n * when a device allows it. Carbon also publishes LightProfileArray; the JS\n * texture array is not yet a texture provider, so it is not registered.\n * Profile-less lights, most of them, never sample it.\n *\n * @param {string} effectPath The light-list compute effect.\n * @returns {Tr2LightManager} This manager.\n */\n _InitializeDevice(effectPath)\n {\n this._effectPath = String(effectPath ?? \"\");\n const store = Tr2VariableStore.GlobalStore();\n this._lightBufferVariable = store.RegisterVariable(Tr2LightManager.LIGHT_BUFFER_NAME, this._lightBuffer);\n this._indexBufferVariable = store.RegisterVariable(Tr2LightManager.LIGHT_INDEX_BUFFER_NAME, this._indexBuffer);\n TriDevice.RegisterResource(this);\n this.PrepareResources();\n return this;\n }\n\n /** Carbon GetOrCreateInstance (cpp:192-200): the process-wide manager. */\n @carbon.method\n @impl.implemented\n static getOrCreateInstance(effectPath)\n {\n Tr2LightManager._instance ??= new Tr2LightManager()._InitializeDevice(effectPath);\n return Tr2LightManager._instance;\n }\n\n /** Carbon GetInstance (cpp:202-205): the manager, or null when none exists. */\n @carbon.method\n @impl.implemented\n static getInstance()\n {\n return Tr2LightManager._instance;\n }\n\n /**\n * Carbon DeleteInstance (cpp:207-212). The destructor's ResetVariableStore\n * (cpp:174-190) republishes empty buffers, so the globals stop naming this\n * manager's.\n *\n * Adapted: JavaScript has no destructor, so the manager unregisters from\n * the device and resets the variable store here. ResetVariableStore's\n * LightProfileArray and ShadowMapAtlas re-registrations are not made; the\n * manager does not publish either.\n */\n @carbon.method\n @impl.adapted\n static deleteInstance()\n {\n const instance = Tr2LightManager._instance;\n if (!instance) return;\n Tr2LightManager._instance = null;\n TriDevice.UnregisterResource(instance);\n const store = Tr2VariableStore.GlobalStore();\n store.RegisterVariable(Tr2LightManager.LIGHT_BUFFER_NAME, new Tr2GpuStructuredBuffer());\n store.RegisterVariable(Tr2LightManager.LIGHT_INDEX_BUFFER_NAME, new Tr2GpuStructuredBuffer());\n }\n\n static _instance = null;\n\n /** Carbon SetVariableStore (cpp:214-218): the globals name this manager's buffers. */\n @carbon.method\n @impl.implemented\n SetVariableStore()\n {\n this._lightBufferVariable?.SetValue(this._lightBuffer);\n this._indexBufferVariable?.SetValue(this._indexBuffer);\n }\n\n /** Carbon Tr2DeviceResource::PrepareResources (Tr2DeviceResource.cpp:21-32). */\n @carbon.method\n @impl.implemented\n PrepareResources()\n {\n if (Tr2Renderer.IsResourceCreationAllowed())\n {\n if (!this.OnPrepareResources()) return false;\n }\n return true;\n }\n\n /**\n * Carbon OnPrepareResources (cpp:657-675): the light buffer, and the index\n * buffer.\n *\n * The index buffer is sized by UpdateLists to what the CPU list needs, and\n * created CPU-writable; see DoUpdateLists. Carbon makes it 8M elements,\n * GPU-writable, for the compute kernel's allocator. The counter and the\n * per-frame constants belong to that kernel and are not made.\n *\n * Adapted: the light lists are filled on the CPU, not by\n * computelightlists, so the index buffer is CPU-writable and sized per\n * screen.\n */\n @carbon.method\n @impl.adapted\n OnPrepareResources()\n {\n const renderContext = Tr2RenderContext_GetMainThreadRenderContext();\n const { CPU_WRITABLE } = Tr2GpuStructuredBuffer.CreationFlag;\n this._lightBuffer.Create(LIGHT_BUFFER_SIZE, BYTES_PER_LIGHT, CPU_WRITABLE, renderContext);\n this._lightBuffer.SetName(\"Light buffer\");\n this._indexBuffer.SetName(\"Light indices\");\n this.ClearLightIndices(renderContext);\n return true;\n }\n\n /** Carbon ReleaseResources (cpp:641-655): nothing of the light lists is released. */\n @carbon.method\n @impl.implemented\n ReleaseResources(_storage)\n {\n }\n\n /**\n * Carbon ClearLightIndices (cpp:370-378): zero indices, so every tile head\n * reads \"no lights\".\n *\n * Adapted: Carbon clears the whole buffer as a UAV; the CPU-written buffer\n * is zeroed through a map.\n *\n * @param {Tr2RenderContext} renderContext The context to write through.\n * @returns {boolean} Whether the clear was written.\n */\n @carbon.method\n @impl.adapted\n ClearLightIndices(renderContext)\n {\n const buffer = this._indexBuffer.GetGpuBuffer(0);\n if (!buffer) return true;\n this._indexList.fill(0);\n return Tr2LightManager._WriteMapped(buffer, null, renderContext);\n }\n\n /**\n * Carbon UpdateLightBuffer (cpp:380-399): grows the light buffer to the\n * frame's light count, then uploads the packed records.\n *\n * @param {Tr2RenderContext} renderContext The context to write through.\n * @returns {boolean} Whether the upload succeeded.\n */\n @carbon.method\n @impl.implemented\n UpdateLightBuffer(renderContext)\n {\n const count = this._packedCount;\n if (this._lightBuffer.GetCount() < count)\n {\n const grown = Math.max(this._lightBuffer.GetCount() + 1024, count);\n this._lightBuffer.Create(grown, BYTES_PER_LIGHT, Tr2GpuStructuredBuffer.CreationFlag.CPU_WRITABLE, renderContext);\n this._lightBuffer.SetName(\"Light buffer\");\n }\n const buffer = this._lightBuffer.GetGpuBuffer(0);\n if (!buffer) return false;\n // cpp:393-396: a WRITE_OFTEN buffer is written through a map.\n return Tr2LightManager._WriteMapped(buffer, this.GetLightBufferData(), renderContext);\n }\n\n /**\n * Carbon UpdateLists (cpp:622-639): the globals name the buffers, then the\n * lists are built - or cleared when there are no lights or the build fails.\n *\n * @param {object} depthMap The scene depth, the render target's size.\n * @param {Tr2RenderContext} renderContext The frame's context.\n * @returns {boolean} Whether the lists were built.\n */\n @carbon.method\n @impl.implemented\n UpdateLists(depthMap, renderContext)\n {\n this.SetVariableStore();\n if (this._packedCount === 0)\n {\n this.ClearLightIndices(renderContext);\n return true;\n }\n const built = this.DoUpdateLists(depthMap, renderContext);\n if (!built) this.ClearLightIndices(renderContext);\n return built;\n }\n\n /**\n * Carbon DoUpdateLists (cpp:401-440) builds each 16x16 tile's light lists\n * on the GPU with computelightlists. Here they are built on the CPU, in\n * the kernel's own layout (decoded from build 3498825): three header words\n * per tile - list0 head, list1 head, particle-list head - then\n * [lightIndex, next] nodes, 0-based light indices, 0 ending a list.\n *\n * Every tile's heads point at one shared chain instead of a tile-culled\n * one. The hull shaders test each light per pixel (dist < radius and\n * FLAG_AFFECTS_SURFACES), so the picture is the same; only the tile cull's\n * saving is lost. The particle list holds the lights flagged\n * AFFECTS_PARTICLES.\n *\n * The tile count follows the render target, as the kernel's does; the\n * depth map is that size.\n *\n * Adapted: computelightlists does not translate to WebGPU yet (its UAV\n * shapes), so the CPU builds the lists.\n *\n * @param {object} depthMap The scene depth.\n * @param {Tr2RenderContext} renderContext The frame's context.\n * @returns {boolean} Whether the lists were written.\n */\n @carbon.method\n @impl.adapted\n DoUpdateLists(depthMap, renderContext)\n {\n if (!this.UpdateLightBuffer(renderContext)) return false;\n\n const width = depthMap ? depthMap.GetWidth() : 0;\n const height = depthMap ? depthMap.GetHeight() : 0;\n if (!width || !height) return false;\n\n const tiles = Math.ceil(width / TILE_WIDTH) * Math.ceil(height / TILE_HEIGHT);\n const headerWords = tiles * HEADER_WORDS_PER_TILE;\n const count = this._packedCount;\n\n let particleCount = 0;\n for (let index = 0; index < count; index++)\n {\n if (this._LightFlags(index) & Tr2LightManager.Flags.AFFECTS_PARTICLES) particleCount++;\n }\n const words = headerWords + 2 * (count + particleCount);\n\n if (this._indexList.length < words) this._indexList = new Uint32Array(words);\n if (this._indexBuffer.GetCount() < words)\n {\n this._indexBuffer.Create(words, 4, Tr2GpuStructuredBuffer.CreationFlag.CPU_WRITABLE, renderContext);\n this._indexBuffer.SetName(\"Light indices\");\n this.SetVariableStore();\n }\n const list = this._indexList;\n list.fill(0);\n\n // The shared chain of every light, then the chain of particle lights.\n let node = headerWords;\n const surfaceHead = node;\n for (let index = 0; index < count; index++, node += 2)\n {\n list[node] = index;\n list[node + 1] = index + 1 < count ? node + 2 : 0;\n }\n const particleHead = particleCount ? node : 0;\n for (let index = 0, seen = 0; index < count; index++)\n {\n if (!(this._LightFlags(index) & Tr2LightManager.Flags.AFFECTS_PARTICLES)) continue;\n seen++;\n list[node] = index;\n list[node + 1] = seen < particleCount ? node + 2 : 0;\n node += 2;\n }\n\n for (let tile = 0; tile < tiles; tile++)\n {\n const header = tile * HEADER_WORDS_PER_TILE;\n list[header] = surfaceHead;\n list[header + 1] = surfaceHead;\n list[header + 2] = particleHead;\n }\n\n const buffer = this._indexBuffer.GetGpuBuffer(0);\n if (!buffer) return false;\n return Tr2LightManager._WriteMapped(buffer, list.subarray(0, words), renderContext);\n }\n\n /**\n * MapForWriting, copy, UnmapForWriting - Carbon's upload for a\n * CPU_WRITABLE (WRITE_OFTEN) buffer, which UpdateBuffer refuses. A null\n * source zeroes the mapping.\n */\n static _WriteMapped(buffer, source, renderContext)\n {\n const { result, data } = buffer.MapForWriting(renderContext);\n if (!Succeeded(result)) return false;\n if (source) data.set(new Uint8Array(source.buffer, source.byteOffset, source.byteLength));\n else data.fill(0);\n buffer.UnmapForWriting(renderContext);\n return true;\n }\n\n /** The packed flags of light `index`: the high 16 bits of row 1's w (contract). */\n _LightFlags(index)\n {\n return this._packedBits[index * FLOATS_PER_LIGHT + 7] >>> 16;\n }\n\n /** The packed PerLightData bytes for the AL to upload, borrowed (contract layout, 3 RGBA32 texels per light). */\n @impl.custom\n @impl.reason(\"AL seam: Trinity owns the packed description bytes; the AL realizes LightBuffer from this view. Carbon has no such seam; Tr2DataTextureManager now writes its own texture, so this has no precedent.\")\n GetLightBufferData()\n {\n return this._packed.subarray(0, this._packedCount * FLOATS_PER_LIGHT);\n }\n\n /** The number of packed lights in GetLightBufferData. */\n @impl.custom\n @impl.reason(\"AL seam companion to GetLightBufferData.\")\n GetLightCount()\n {\n return this._packedCount;\n }\n\n /** Monotonic revision of the packed data, bumped by ResolveLightData, so the AL can skip unchanged re-uploads. */\n @impl.custom\n @impl.reason(\"Non-Carbon extension: cheaper than the AL diffing a typed array; Carbon re-uploads unconditionally.\")\n GetDataRevision()\n {\n return this._revision;\n }\n\n /** Frustum cull + pixel-size cutoff, returning the fade-band dimming factor (0 = rejected). Cull applies only when a frustum was set. */\n _CullAndDim(position, radius)\n {\n if (!this._frustum) return 1;\n if (!this._frustum.IsSphereVisible(position, radius)) return 0;\n const size = this._frustum.GetPixelSizeAccross(position, radius);\n if (!(size > this._adjustedCutoff)) return 0;\n // Contract §\"Colour carries the radius\": the fade band sits ABOVE the\n // cutoff - absent at the cutoff, full brightness FADE_SIZE above it.\n return Math.min((size - this._adjustedCutoff) / FADE_SIZE, 1);\n }\n\n /**\n * Returns the light's projected pixel size, or its radius when no frustum is\n * set.\n */\n _ScreenSize(record)\n {\n if (!this._frustum) return record.radius;\n return this._frustum.GetPixelSizeAccross(record.position, record.radius);\n }\n\n /**\n * The slice a profile occupies, +1 biased so 0 means \"no profile\"\n * (Tr2Light.cpp:137: `m_lightProfile ? GetTextureIndex() + 1 : 0`).\n *\n * The index comes from the RESOURCE (`GetTextureIndex`, the texture-array\n * slice - stable, shared across managers, reused after release), never\n * from an invented per-manager counter: Carbon assigns slices through the\n * process-wide light profile array (cpp:682-686), and a manager-local\n * numbering diverges from what the shader samples the moment two managers\n * or a released slot exist. A profile carrying a baked payload but no\n * slice yet is registered here - Carbon does this in the resource's\n * DoPrepare (Tr2LightProfileRes.cpp:95-99), which the layering forbids\n * (resource cannot import trinity), so the manager performs it at the\n * first pack instead; same array, same first-fit slot, one seam later.\n * The first-sight map remains only for foreign profile objects that\n * expose no GetTextureIndex.\n */\n _ProfileSlot(profile)\n {\n if (!profile) return 0;\n if (typeof profile.GetTextureIndex === \"function\")\n {\n let index = profile.GetTextureIndex();\n if (index < 0 && typeof profile.RegisterProfileElement === \"function\")\n {\n // Carbon hands the profile's m_bitmap to the array (Tr2LightProfileRes.cpp:95-99).\n const bitmap = profile.GetBitmap();\n if (bitmap.IsValid())\n {\n const element = Tr2LightManager.getLightProfileArray().AddElement(bitmap);\n if (element.IsValid())\n {\n profile.RegisterProfileElement(element);\n index = element.GetElementIndex();\n }\n }\n }\n return index >= 0 ? index + 1 : 0;\n }\n let slot = this._profileSlots.get(profile);\n if (slot === undefined)\n {\n slot = this._profileSlots.size;\n this._profileSlots.set(profile, slot);\n }\n return slot + 1;\n }\n\n /**\n * The process-wide light profile array (Tr2LightManager.cpp:682-686).\n *\n * Carbon's is a function-local static that deliberately survives manager\n * destruction (ResetVariableStore re-registers the SAME live array,\n * cpp:186) - so under instance-per-scene managers this stays a class\n * static: two scenes share slices, and a profile's texture index means\n * the same thing everywhere. Realizing it as a GPU texture array is the\n * abstraction layer's job; consumers poll GetRevision or subscribe via\n * OnTextureChange.\n *\n * @returns {Tr2TextureArray} The shared profile array.\n */\n static getLightProfileArray()\n {\n if (!Tr2LightManager._lightProfileArray)\n {\n Tr2LightManager._lightProfileArray = new Tr2TextureArray();\n }\n return Tr2LightManager._lightProfileArray;\n }\n\n static _lightProfileArray = null;\n\n /** Packs _records into the 48-byte-per-light buffer per the contract layout. */\n _Pack()\n {\n const count = Math.min(this._records.length, LIGHT_BUFFER_SIZE);\n for (let i = 0; i < count; i++)\n {\n const record = this._records[i];\n const f = i * FLOATS_PER_LIGHT;\n\n // Texel 0: position + radius, four f32.\n this._packed[f] = record.position[0];\n this._packed[f + 1] = record.position[1];\n this._packed[f + 2] = record.position[2];\n this._packed[f + 3] = record.radius;\n\n // Texel 1: colour (premultiplied at Add time) + the packed word -\n // innerRadius f16 low, flags u16 high with the biased profile slot in\n // bits 4-15 (contract §\"The packed flag word\").\n this._packed[f + 4] = record.color[0];\n this._packed[f + 5] = record.color[1];\n this._packed[f + 6] = record.color[2];\n const flagsWord = (record.flags & 0xF) | (this._ProfileSlot(record.lightProfile) << 4);\n this._packedBits[f + 7] = toHalf(record.innerRadius) | ((flagsWord & 0xFFFF) << 16);\n\n // Texel 2: direction as three f16, projectionPlaneDistance, the two\n // angles, then the shadow union (h:70-84, MSVC low-bit-first layout:\n // bits 0-1 padding, 2-11 scale, 12-21 offsetX, 22-31 offsetY; the\n // raytraced mask shares the word - the paths are exclusive by\n // quality). All zeros under the shipping pin, exactly as before.\n this._packedBits[f + 8] = toHalf(record.direction[0]) | (toHalf(record.direction[1]) << 16);\n this._packedBits[f + 9] = toHalf(record.direction[2]) | (toHalf(record.projectionPlaneDistance) << 16);\n this._packedBits[f + 10] = toHalf(record.outerAngle) | (toHalf(record.innerAngle) << 16);\n this._packedBits[f + 11] = this._currentSpaceSceneShadowQuality === ShadowQuality.SHADOW_RAYTRACED\n ? (record.raytracingShadowMask ?? 0) & 0xFFFF\n : (((record.shadowMapScale ?? 0) & 0x3FF) << 2)\n | (((record.shadowMapOffsetX ?? 0) & 0x3FF) << 12)\n | (((record.shadowMapOffsetY ?? 0) & 0x3FF) << 22);\n }\n this._packedCount = count;\n }\n}\n"],"names":["LIGHT_BUFFER_SIZE","CUTOFF_PIXEL_SIZE","FADE_SIZE","MAX_NUM_VOLUMETRIC_LIGHTS","MAX_NUM_SHADOWCASTING_LIGHTS","HIGH_QUALITY_ATLAS_SIZE_LOG2","HIGH_QUALITY_ATLAS_ENTRY_MAX_SIZE","INFINITE_SIZE_CLAMP","FLOATS_PER_LIGHT","BYTES_PER_LIGHT","TILE_WIDTH","TILE_HEIGHT","HEADER_WORDS_PER_TILE","align","value","alignment","calculateShadowMapAtlasSettings","shadowQuality","settings","actualTextureSize","sizeLog2","size","entryMinSizeLog2","entryMinSize","entryInverseScaleFactorLog2","entryMaxSize","ShadowQuality","SHADOW_DISABLED","SHADOW_RAYTRACED","SHADOW_LOW","SHADOW_HIGH","toHalf","num","toHalfFloat","_Tr2LightManager","_identity","Tr2LightManager","CjsModel","e","_initProto","_initStatic","c","_initClass","_applyDecs","type","define","className","family","carbon","method","impl","implemented","adapted","custom","reason","_records","_volumetricLights","_shadowCastingLights","_frustum","_adjustedCutoff","_currentSpaceSceneShadowQuality","_nextFrameShadowQuality","_currentFrameCounter","_shadowMap","atlasSettings","atlasNodes","qualityUsedByAtlas","_profileSlots","Map","_packed","Float32Array","_packedBits","Uint32Array","buffer","_packedCount","_revision","areLightFlagsValid","flags","Flags","AFFECTS_SURFACES","AFFECTS_PARTICLES","SetShadowQuality","quality","frameCounter","Number","useDynamicLightsShadows","clamped","Math","min","GetShadowMapAtlasSettings","GetUnpackedShadowMapData","record","out","shift","shadowMapScale","shadowMapOffsetX","shadowMapOffsetY","Clear","renderContext","SetVariableStore","ClearLightIndices","length","push","children","lightIndex","x","y","width","height","SetFrustum","frustum","AdjustLightCutoff","lodFactor","AddPointLight","position","radius","color","innerRadius","DEFAULT","brightness","max","dimming","_CullAndDim","scale","owner","lightData","lightProfile","lightType","vec3","fromValues","direction","outerAngle","innerAngle","projectionPlaneDistance","AddLight","usingShadowMap","CASTS_SHADOWS","ResolveLightData","volumetric","i","IS_VOLUMETRIC","_ScreenSize","sort","a","b","_ResolveShadowCasters","_Pack","lightTuples","sizeAcross","GetPixelSizeAccrossEst","isFinite","raytraced","numShadowCastingLights","raytracingShadowMask","_CreateShadowMapAtlas","entry","everythingFit","j","_GetShadowMapAtlasEntry","nodeId","_InsertAtlasNode","node","newNode","child0","child1","deltaWidth","deltaHeight","GetCurrentSpaceSceneShadowQuality","GetLightData","GetVolumetricLights","GetShadowCastingLights","_effectPath","_lightBuffer","Tr2GpuStructuredBuffer","_indexBuffer","_lightBufferVariable","_indexBufferVariable","_indexList","_InitializeDevice","effectPath","String","store","Tr2VariableStore","GlobalStore","RegisterVariable","LIGHT_BUFFER_NAME","LIGHT_INDEX_BUFFER_NAME","TriDevice","RegisterResource","PrepareResources","getOrCreateInstance","_instance","getInstance","deleteInstance","instance","UnregisterResource","SetValue","Tr2Renderer","IsResourceCreationAllowed","OnPrepareResources","Tr2RenderContext_GetMainThreadRenderContext","CPU_WRITABLE","CreationFlag","Create","SetName","ReleaseResources","_storage","GetGpuBuffer","fill","_WriteMapped","UpdateLightBuffer","count","GetCount","grown","GetLightBufferData","UpdateLists","depthMap","built","DoUpdateLists","GetWidth","GetHeight","tiles","ceil","headerWords","particleCount","index","_LightFlags","words","list","surfaceHead","particleHead","seen","tile","header","subarray","source","result","data","MapForWriting","Succeeded","set","Uint8Array","byteOffset","byteLength","UnmapForWriting","GetLightCount","GetDataRevision","IsSphereVisible","GetPixelSizeAccross","_ProfileSlot","profile","GetTextureIndex","RegisterProfileElement","bitmap","GetBitmap","IsValid","element","getLightProfileArray","AddElement","GetElementIndex","slot","get","undefined","_lightProfileArray","Tr2TextureArray","f","flagsWord","Object","freeze","constructor"],"mappings":";;;;;;;;;;;;;;;;AAyCA;AACA;AACA,MAAMA,iBAAiB,GAAG,IAAI;AAC9B,MAAMC,iBAAiB,GAAG,CAAC;AAC3B,MAAMC,SAAS,GAAG,CAAC;AACnB,MAAMC,yBAAyB,GAAG,EAAE;AACpC,MAAMC,4BAA4B,GAAG,EAAE;AACvC,MAAMC,4BAA4B,GAAG,EAAE;AACvC,MAAMC,iCAAiC,GAAG,CAAC,IAAI,EAAE;AACjD,MAAMC,mBAAmB,GAAG,CAAC,IAAI,EAAE,CAAC;AACpC,MAAMC,gBAAgB,GAAG,EAAE,CAAC;AAC5B,MAAMC,eAAe,GAAGD,gBAAgB,GAAG,CAAC;AAC5C;AACA,MAAME,UAAU,GAAG,EAAE;AACrB,MAAMC,WAAW,GAAG,EAAE;AACtB;AACA;AACA,MAAMC,qBAAqB,GAAG,CAAC;;AAE/B;AACA,SAASC,KAAKA,CAACC,KAAK,EAAEC,SAAS,EAC/B;EACE,OAAQD,KAAK,GAAGC,SAAS,GAAG,CAAC,GAAI,EAAEA,SAAS,GAAG,CAAC,CAAC;AACnD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,+BAA+BA,CAACC,aAAa,EACtD;AACE,EAAA,MAAMC,QAAQ,GAAG;AACfC,IAAAA,iBAAiB,EAAE,CAAC;AACpBC,IAAAA,QAAQ,EAAE,CAAC;AACXC,IAAAA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