rayzee 10.0.0 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +252 -44
- package/dist/ActiveColor-YvuQq44O.js +13 -0
- package/dist/ArchiveImporter-BRQvLggb.js +4300 -0
- package/dist/AssetConfig-DSEntE65.js +30 -0
- package/dist/BidirectionalIntegrator-9lZQxFVH.js +934 -0
- package/dist/BufferLayout-D_IBo2ci.js +150 -0
- package/dist/ColorManagement-oeEk7oSu.js +1488 -0
- package/dist/EngineEvents-Ci8dVWCP.js +73 -0
- package/dist/EngineIssues-CIZnXHsF.js +72 -0
- package/dist/FileFormats-sPGJeCRc.js +102 -0
- package/dist/Logger-dDDGj9Av.js +97 -0
- package/dist/{NeuralRetouch-CYgkQY8Z.js → NeuralRetouch-BCXylThH.js} +8 -6
- package/dist/{NeuralSuperRes-PkgDLQcD.js → NeuralSuperRes-sZAeS142.js} +55 -120
- package/dist/PathTracer-CQPW06Mm.js +29971 -0
- package/dist/PhysicalSky-BvqCw_dy.js +1219 -0
- package/dist/RayzeeRenderer-COpwotpU.js +3551 -0
- package/dist/SolarLimb-CPaeZVwz.js +721 -0
- package/dist/ToneMapGPU-CjU3osDd.js +177 -0
- package/dist/ViewTransforms-CYN7bq2w.js +255 -0
- package/dist/WorkingMatrix-C6y233hT.js +27 -0
- package/dist/ZipReader-gDSWr0I5.js +98 -0
- package/dist/addons/archives.es.js +3 -0
- package/dist/addons/bidirectional.es.js +2 -0
- package/dist/addons/color.es.js +3 -0
- package/dist/addons/formats.es.js +2 -0
- package/dist/addons/physical-sky.es.js +2 -0
- package/dist/addons/storage.es.js +3 -0
- package/dist/archiveFormats-BZw7TiDp.js +75 -0
- package/dist/identity-DrQsGT2o.js +39 -0
- package/dist/openStorage-DwcBRUj7.js +820 -0
- package/dist/rayzee-core.es.js +12 -0
- package/dist/rayzee.es.js +2551 -44024
- package/dist/rayzee.umd.js +528 -487
- package/dist/sceneCachePolicy-BSSsKY98.js +443 -0
- package/dist/shared-BGBcSxBQ.js +17 -0
- package/package.json +23 -2
- package/src/Color/ActiveColor.js +34 -0
- package/src/Color/BasicColor.js +147 -0
- package/src/Color/ColorManagement.js +7 -31
- package/src/Color/ViewTransforms.js +5 -1
- package/src/EngineDefaults.js +62 -1029
- package/src/EngineEvents.js +2 -0
- package/src/EngineIssues.js +2 -0
- package/src/Headless.js +6 -5
- package/src/Passes/AIUpscaler.js +58 -141
- package/src/Passes/OIDNDenoiser.js +92 -65
- package/src/Passes/OIDNTemporalHistory.js +1 -1
- package/src/PathTracerApp.js +620 -4026
- package/src/Pipeline/PipelineContext.js +0 -4
- package/src/Platform.js +36 -0
- package/src/Processor/ArchiveCache.js +1 -1
- package/src/Processor/ArchiveImporter.js +1259 -0
- package/src/Processor/AssetLoader.js +327 -1763
- package/src/Processor/AtmosphereModel.js +1 -2
- package/src/Processor/BVHBuilder.js +14 -126
- package/src/Processor/BVHLeafFold.js +4 -6
- package/src/Processor/BVHRefitter.js +67 -46
- package/src/Processor/BufferLayout.js +291 -0
- package/src/Processor/EmissiveTriangleBuilder.js +1 -1
- package/src/Processor/EnvironmentExactTable.js +187 -0
- package/src/Processor/EquirectHDRInfo.js +30 -223
- package/src/Processor/FileFormats.js +116 -0
- package/src/Processor/GLTFDecoders.js +85 -0
- package/src/Processor/GLTFDiffuseTransmission.js +63 -0
- package/src/Processor/GeometryExtractor.js +15 -5
- package/src/Processor/HostMemory.js +7 -1
- package/src/Processor/IESParser.js +47 -35
- package/src/Processor/InstanceTable.js +1 -1
- package/src/Processor/KernelManager.js +35 -2
- package/src/Processor/MaterialPacking.js +10 -8
- package/src/Processor/PBRT/PBRTMaterials.js +129 -41
- package/src/Processor/PBRT/PBRTParser.js +30 -17
- package/src/Processor/PBRT/PBRTSceneBuilder.js +548 -37
- package/src/Processor/PBRT/PBRTTextureBake.js +154 -0
- package/src/Processor/PBRT/PFM.js +59 -0
- package/src/Processor/PackedRayBuffer.js +116 -9
- package/src/Processor/ParallelBVHBuilder.js +3 -6
- package/src/Processor/PhysicalSky.js +5 -4
- package/src/Processor/PlatformImageLoader.js +50 -6
- package/src/Processor/QueueManager.js +39 -5
- package/src/Processor/ReinsertionOptimizer.js +2 -2
- package/src/Processor/SceneProcessor.js +53 -62
- package/src/Processor/ShaderBuilder.js +6 -16
- package/src/Processor/SimpleSky.js +1 -62
- package/src/Processor/SolarLimb.js +3 -0
- package/src/Processor/SplitBLAS.js +1 -1
- package/src/Processor/StorageTexturePool.js +22 -1
- package/src/Processor/TLASBuilder.js +1 -3
- package/src/Processor/TextureBuckets.js +237 -0
- package/src/Processor/TextureCreator.js +181 -8
- package/src/Processor/ToneMapGPU.js +64 -15
- package/src/Processor/Workers/BVHRefitWorker.js +5 -2
- package/src/Processor/Workers/BVHSubtreeWorker.js +1 -34
- package/src/Processor/Workers/BVHWorker.js +5 -18
- package/src/Processor/Workers/CDFWorker.js +6 -183
- package/src/Processor/Workers/TexturesWorker.js +103 -18
- package/src/Processor/archiveFormats.js +7 -0
- package/src/Processor/utils.js +2 -1
- package/src/RayzeeRenderer.js +3899 -0
- package/src/RenderSettings.js +68 -62
- package/src/Stages/ASVGF.js +13 -14
- package/src/Stages/AutoExposure.js +17 -17
- package/src/Stages/BilateralFilter.js +2 -1
- package/src/Stages/Compositor.js +8 -23
- package/src/Stages/DenoiserSettings.js +182 -0
- package/src/Stages/EdgeFilter.js +2 -1
- package/src/Stages/MotionVector.js +1 -1
- package/src/Stages/NRD.js +11 -5
- package/src/Stages/NormalDepth.js +12 -8
- package/src/Stages/PathTracer.js +338 -43
- package/src/Stages/PathTracerStage.js +69 -66
- package/src/Stages/Variance.js +1 -1
- package/src/Storage/BLASCache.js +1 -1
- package/src/Storage/CDFCache.js +18 -17
- package/src/Storage/DownloadCache.js +1 -1
- package/src/Storage/SceneGraphCodec.js +46 -3
- package/src/Storage/SpillStore.js +1 -1
- package/src/Storage/StorageManager.js +45 -9
- package/src/Storage/areas.js +4 -0
- package/src/TSL/BVHTraversal.js +50 -25
- package/src/TSL/Bidirectional.js +204 -0
- package/src/TSL/BidirectionalLamps.js +132 -0
- package/src/TSL/Clearcoat.js +15 -6
- package/src/TSL/Common.js +20 -15
- package/src/TSL/ConnectKernel.js +147 -0
- package/src/TSL/Debugger.js +1 -1
- package/src/TSL/Displacement.js +4 -3
- package/src/TSL/EmissiveSampling.js +65 -18
- package/src/TSL/Environment.js +77 -106
- package/src/TSL/EnvironmentCDF.js +85 -39
- package/src/TSL/ExtendKernel.js +8 -3
- package/src/TSL/FinalWriteKernel.js +4 -4
- package/src/TSL/GenerateKernel.js +18 -4
- package/src/TSL/HitFacet.js +35 -5
- package/src/TSL/LightBVHSampling.js +40 -9
- package/src/TSL/LightGenerateKernel.js +293 -0
- package/src/TSL/LightGuide.js +198 -0
- package/src/TSL/LightSplatKernel.js +165 -0
- package/src/TSL/LightVisibility.js +111 -0
- package/src/TSL/LightsCore.js +13 -38
- package/src/TSL/LightsDirect.js +28 -29
- package/src/TSL/LightsIndirect.js +3 -1
- package/src/TSL/LightsSampling.js +239 -51
- package/src/TSL/MaterialEvaluation.js +113 -31
- package/src/TSL/MaterialProperties.js +44 -17
- package/src/TSL/MaterialTransmission.js +52 -47
- package/src/TSL/MergeKernel.js +218 -0
- package/src/TSL/PathTracerCore.js +65 -29
- package/src/TSL/Random.js +5 -1
- package/src/TSL/SceneResources.js +51 -0
- package/src/TSL/ShadeKernel.js +964 -101
- package/src/TSL/Struct.js +10 -0
- package/src/TSL/Sun.js +1 -1
- package/src/TSL/TextureSampling.js +66 -61
- package/src/addons/archives.js +14 -0
- package/src/addons/bidirectional.js +13 -0
- package/src/addons/color.js +32 -0
- package/src/addons/formats.js +16 -0
- package/src/addons/physicalSky.js +14 -0
- package/src/addons/storage.js +19 -0
- package/src/core.js +31 -0
- package/src/index.js +13 -23
- package/src/integrators/BidirectionalIntegrator.js +833 -0
- package/src/managers/AnimationManager.js +88 -6
- package/src/managers/CameraManager.js +103 -46
- package/src/managers/DenoisingManager.js +14 -10
- package/src/managers/EnvironmentManager.js +125 -103
- package/src/managers/GoboManager.js +9 -0
- package/src/managers/MaterialDataManager.js +48 -37
- package/src/managers/UniformManager.js +32 -10
- package/dist/ToneMapGPU-B6XIe3DU.js +0 -544
- package/dist/rolldown-runtime-CAFD8bLK.js +0 -11
- package/src/Processor/TreeletOptimizer.js +0 -574
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { l as e, s as t } from "./ViewTransforms-CYN7bq2w.js";
|
|
2
|
+
//#region src/Processor/ToneMapGPU.js
|
|
3
|
+
var n = 0, r = 3;
|
|
4
|
+
function i() {
|
|
5
|
+
let { wgsl: i, bindings: a } = t({
|
|
6
|
+
group: n,
|
|
7
|
+
firstBinding: r
|
|
8
|
+
});
|
|
9
|
+
return {
|
|
10
|
+
wgsl: i,
|
|
11
|
+
bindings: a,
|
|
12
|
+
version: e()
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
i().wgsl;
|
|
16
|
+
var a = {
|
|
17
|
+
packed: "\n@group(0) @binding(0) var<storage, read> src: array<u32>;\n\nfn rayzee_source( x: u32, y: u32 ) -> vec4<f32> {\n let a = ( y * params.width + x ) * 2u;\n return vec4<f32>( unpack2x16float( src[ a ] ), unpack2x16float( src[ a + 1u ] ) );\n}",
|
|
18
|
+
texture: "\n@group(0) @binding(0) var src: texture_2d<f32>;\n\nfn rayzee_source( x: u32, y: u32 ) -> vec4<f32> {\n return textureLoad( src, vec2<u32>( x, y ), 0 );\n}"
|
|
19
|
+
}, o = {
|
|
20
|
+
rgba8: "\n@group(0) @binding(1) var<storage, read_write> dst: array<u32>;\n\nfn rayzee_store( i: u32, linear: vec4<f32>, mapped: vec3<f32> ) {\n let b8 = rayzee_to_u8( rayzee_encode( mapped, params.mode ) );\n var a8 = 255u;\n if ( params.alpha == 1u ) { a8 = rayzee_to_u8( vec3<f32>( linear.a ) ).x; }\n dst[ i ] = b8.x | ( b8.y << 8u ) | ( b8.z << 16u ) | ( a8 << 24u );\n}",
|
|
21
|
+
planar: "\n@group(0) @binding(1) var<storage, read_write> dst: array<f32>;\n\nfn rayzee_store( i: u32, linear: vec4<f32>, mapped: vec3<f32> ) {\n var c = clamp( mapped, vec3<f32>( 0.0 ), vec3<f32>( 1.0 ) );\n if ( ! rayzee_output_encoded( params.mode ) ) {\n let m = max( mapped, vec3<f32>( 0.0 ) );\n c = select( pow( m, vec3<f32>( 1.0 / 2.2 ) ), vec3<f32>( 0.0 ), m <= vec3<f32>( 0.0 ) );\n }\n let n = params.width * params.height;\n dst[ i ] = c.r;\n dst[ n + i ] = c.g;\n dst[ 2u * n + i ] = c.b;\n dst[ 3u * n + i ] = linear.a;\n}"
|
|
22
|
+
}, s = {
|
|
23
|
+
rgba8: 4,
|
|
24
|
+
planar: 16
|
|
25
|
+
}, c = (e, t, n) => `
|
|
26
|
+
struct Params {
|
|
27
|
+
width: u32,
|
|
28
|
+
height: u32,
|
|
29
|
+
mode: u32,
|
|
30
|
+
flipY: u32,
|
|
31
|
+
exposure: f32,
|
|
32
|
+
saturation: f32,
|
|
33
|
+
alpha: u32,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
@group(0) @binding(2) var<uniform> params: Params;
|
|
37
|
+
${a[t]}
|
|
38
|
+
|
|
39
|
+
${e}
|
|
40
|
+
${o[n]}
|
|
41
|
+
|
|
42
|
+
@compute @workgroup_size(8, 8)
|
|
43
|
+
fn main( @builtin(global_invocation_id) gid: vec3<u32> ) {
|
|
44
|
+
if ( gid.x >= params.width || gid.y >= params.height ) { return; }
|
|
45
|
+
|
|
46
|
+
var srcY = gid.y;
|
|
47
|
+
if ( params.flipY == 1u ) { srcY = params.height - 1u - gid.y; }
|
|
48
|
+
|
|
49
|
+
let linear = rayzee_source( gid.x, srcY );
|
|
50
|
+
rayzee_store( gid.y * params.width + gid.x, linear, rayzee_tone_map( linear.rgb, params.mode, params.exposure, params.saturation ) );
|
|
51
|
+
}
|
|
52
|
+
`, l = 32, u = class {
|
|
53
|
+
constructor(e, t = "rayzee:tonemap", { input: n = "packed", output: r = "rgba8" } = {}) {
|
|
54
|
+
this.device = e, this.label = t, this.input = n, this.output = r, this.width = 0, this.height = 0, this._pipeline = null, this._storage = null, this._map = null, this._params = null, this._paramData = new ArrayBuffer(l), this._paramU32 = new Uint32Array(this._paramData), this._paramF32 = new Float32Array(this._paramData), this._shaderVersion = -1, this._bindings = [], this._tables = /* @__PURE__ */ new Map(), this.disposed = !1;
|
|
55
|
+
}
|
|
56
|
+
_ensurePipeline() {
|
|
57
|
+
let { wgsl: e, bindings: t, version: n } = i();
|
|
58
|
+
this._pipeline && this._shaderVersion === n || (this._bindings = t, this._shaderVersion = n, this._pipeline = this.device.createComputePipeline({
|
|
59
|
+
label: this.label,
|
|
60
|
+
layout: "auto",
|
|
61
|
+
compute: {
|
|
62
|
+
module: this.device.createShaderModule({
|
|
63
|
+
label: this.label,
|
|
64
|
+
code: c(e, this.input, this.output)
|
|
65
|
+
}),
|
|
66
|
+
entryPoint: "main"
|
|
67
|
+
}
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
70
|
+
_ensureTables() {
|
|
71
|
+
let e = /* @__PURE__ */ new Set();
|
|
72
|
+
for (let { index: t, transform: n } of this._bindings) {
|
|
73
|
+
let { data: r, size: i } = n.table;
|
|
74
|
+
e.add(t);
|
|
75
|
+
let a = this._tables.get(t);
|
|
76
|
+
if (a && a.data === r) continue;
|
|
77
|
+
a?.texture.destroy();
|
|
78
|
+
let o = this.device.createTexture({
|
|
79
|
+
label: `${this.label}-${n.wgslConst}`,
|
|
80
|
+
size: [
|
|
81
|
+
i,
|
|
82
|
+
i,
|
|
83
|
+
i
|
|
84
|
+
],
|
|
85
|
+
dimension: "3d",
|
|
86
|
+
format: "rgba16float",
|
|
87
|
+
usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST
|
|
88
|
+
});
|
|
89
|
+
this.device.queue.writeTexture({ texture: o }, r, {
|
|
90
|
+
bytesPerRow: i * 8,
|
|
91
|
+
rowsPerImage: i
|
|
92
|
+
}, [
|
|
93
|
+
i,
|
|
94
|
+
i,
|
|
95
|
+
i
|
|
96
|
+
]), this._tables.set(t, {
|
|
97
|
+
texture: o,
|
|
98
|
+
data: r,
|
|
99
|
+
view: o.createView()
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
for (let [t, n] of this._tables) e.has(t) || (n.texture.destroy(), this._tables.delete(t));
|
|
103
|
+
}
|
|
104
|
+
ensureSize(e, t) {
|
|
105
|
+
if (this._ensurePipeline(), this._ensureTables(), this.width === e && this.height === t && this._storage) return;
|
|
106
|
+
this._releaseBuffers();
|
|
107
|
+
let n = e * t * s[this.output];
|
|
108
|
+
this._storage = this.device.createBuffer({
|
|
109
|
+
label: `${this.label}-out`,
|
|
110
|
+
size: n,
|
|
111
|
+
usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC
|
|
112
|
+
}), this._map = this.device.createBuffer({
|
|
113
|
+
label: `${this.label}-map`,
|
|
114
|
+
size: n,
|
|
115
|
+
usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ
|
|
116
|
+
}), this._params = this.device.createBuffer({
|
|
117
|
+
label: `${this.label}-params`,
|
|
118
|
+
size: l,
|
|
119
|
+
usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST
|
|
120
|
+
}), this.width = e, this.height = t;
|
|
121
|
+
}
|
|
122
|
+
async toRGBA8(e, t) {
|
|
123
|
+
return new Uint8ClampedArray(await this._run(e, t));
|
|
124
|
+
}
|
|
125
|
+
async toPlanar(e, t) {
|
|
126
|
+
return new Float32Array(await this._run(e, t));
|
|
127
|
+
}
|
|
128
|
+
async _run(e, { exposure: t = 1, toneMapping: n = 0, saturation: r = 1, flipY: i = !1, preserveAlpha: a = !1 } = {}) {
|
|
129
|
+
if (this.disposed) throw Error("PackedToneMapper: disposed");
|
|
130
|
+
if (!this._storage) throw Error("PackedToneMapper: call ensureSize() first");
|
|
131
|
+
this._ensurePipeline(), this._ensureTables();
|
|
132
|
+
let { width: o, height: c } = this, l = o * c * s[this.output];
|
|
133
|
+
this._paramU32[0] = o, this._paramU32[1] = c, this._paramU32[2] = n >>> 0, this._paramU32[3] = +!!i, this._paramF32[4] = t, this._paramF32[5] = r, this._paramU32[6] = +!!a, this.device.queue.writeBuffer(this._params, 0, this._paramData);
|
|
134
|
+
let u = [...this._tables.entries()].map(([e, t]) => ({
|
|
135
|
+
binding: e,
|
|
136
|
+
resource: t.view
|
|
137
|
+
})), d = this.device.createBindGroup({
|
|
138
|
+
layout: this._pipeline.getBindGroupLayout(0),
|
|
139
|
+
entries: [
|
|
140
|
+
...u,
|
|
141
|
+
{
|
|
142
|
+
binding: 0,
|
|
143
|
+
resource: this.input === "texture" ? e.createView() : {
|
|
144
|
+
buffer: e,
|
|
145
|
+
size: o * c * 8
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
binding: 1,
|
|
150
|
+
resource: { buffer: this._storage }
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
binding: 2,
|
|
154
|
+
resource: { buffer: this._params }
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
}), f = this.device.createCommandEncoder({ label: this.label }), p = f.beginComputePass();
|
|
158
|
+
p.setPipeline(this._pipeline), p.setBindGroup(0, d), p.dispatchWorkgroups(Math.ceil(o / 8), Math.ceil(c / 8)), p.end(), f.copyBufferToBuffer(this._storage, 0, this._map, 0, l), this.device.queue.submit([f.finish()]), await this._map.mapAsync(GPUMapMode.READ);
|
|
159
|
+
let m = this._map.getMappedRange().slice(0);
|
|
160
|
+
return this._map.unmap(), m;
|
|
161
|
+
}
|
|
162
|
+
release() {
|
|
163
|
+
this._releaseBuffers(), this.width = this.height = 0;
|
|
164
|
+
}
|
|
165
|
+
_releaseBuffers() {
|
|
166
|
+
this._storage?.destroy(), this._map?.destroy(), this._params?.destroy(), this._storage = null, this._map = null, this._params = null;
|
|
167
|
+
}
|
|
168
|
+
dispose() {
|
|
169
|
+
if (!this.disposed) {
|
|
170
|
+
this.disposed = !0, this._releaseBuffers();
|
|
171
|
+
for (let e of this._tables.values()) e.texture.destroy();
|
|
172
|
+
this._tables.clear(), this._pipeline = null;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
//#endregion
|
|
177
|
+
export { u as t };
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { ACESFilmicToneMapping as e, AgXToneMapping as t, CineonToneMapping as n, LinearToneMapping as r, NeutralToneMapping as i, NoToneMapping as a, ReinhardToneMapping as o } from "three";
|
|
2
|
+
//#region src/Color/BuiltinViews.js
|
|
3
|
+
var s = (e) => Math.min(Math.max(e, 0), 1);
|
|
4
|
+
function c(e, t, n, r, i) {
|
|
5
|
+
i[0] = s(e), i[1] = s(t), i[2] = s(n);
|
|
6
|
+
}
|
|
7
|
+
function l(e, t, n, r, i) {
|
|
8
|
+
i[0] = s(e * r), i[1] = s(t * r), i[2] = s(n * r);
|
|
9
|
+
}
|
|
10
|
+
function u(e, t, n, r, i) {
|
|
11
|
+
e *= r, t *= r, n *= r, i[0] = s(e / (e + 1)), i[1] = s(t / (t + 1)), i[2] = s(n / (n + 1));
|
|
12
|
+
}
|
|
13
|
+
function d(e, t, n, r, i) {
|
|
14
|
+
e = Math.max(e * r - .004, 0), t = Math.max(t * r - .004, 0), n = Math.max(n * r - .004, 0);
|
|
15
|
+
let a = (e) => (e * (6.2 * e + .5) / (e * (6.2 * e + 1.7) + .06)) ** 2.2;
|
|
16
|
+
i[0] = a(e), i[1] = a(t), i[2] = a(n);
|
|
17
|
+
}
|
|
18
|
+
function f(e, t, n, r, i) {
|
|
19
|
+
e = e * r / .6, t = t * r / .6, n = n * r / .6;
|
|
20
|
+
let a = .59719 * e + .35458 * t + .04823 * n, o = .076 * e + .90834 * t + .01566 * n, c = .0284 * e + .13383 * t + .83777 * n, l = (e) => (e * (e + .0245786) - 90537e-9) / (e * (.983729 * e + .432951) + .238081);
|
|
21
|
+
a = l(a), o = l(o), c = l(c), i[0] = s(1.60475 * a - .53108 * o - .07367 * c), i[1] = s(-.10208 * a + 1.10813 * o - .00605 * c), i[2] = s(-.00327 * a - .07276 * o + 1.07602 * c);
|
|
22
|
+
}
|
|
23
|
+
function p(e, t, n, r, i) {
|
|
24
|
+
e *= r, t *= r, n *= r;
|
|
25
|
+
let a = .6274 * e + .3293 * t + .0433 * n, o = .0691 * e + .9195 * t + .0113 * n, c = .0164 * e + .088 * t + .8956 * n, l = .856627153315983 * a + .0951212405381588 * o + .0482516061458583 * c, u = .137318972929847 * a + .761241990602591 * o + .101439036467562 * c, d = .11189821299995 * a + .0767994186031903 * o + .811302368396859 * c, f = -12.47393, p = 4.026069 - f;
|
|
26
|
+
l = s((Math.log2(Math.max(l, 1e-10)) - f) / p), u = s((Math.log2(Math.max(u, 1e-10)) - f) / p), d = s((Math.log2(Math.max(d, 1e-10)) - f) / p);
|
|
27
|
+
let m = (e) => {
|
|
28
|
+
let t = e * e, n = t * t;
|
|
29
|
+
return 15.5 * n * t - 40.14 * n * e + 31.96 * n - 6.868 * t * e + .4298 * t + .1191 * e - .00232;
|
|
30
|
+
};
|
|
31
|
+
l = m(l), u = m(u), d = m(d);
|
|
32
|
+
let h = 1.1271005818144368 * l - .11060664309660323 * u - .016493938717834573 * d, g = -.1413297634984383 * l + 1.157823702216272 * u - .016493938717834257 * d, _ = -.14132976349843826 * l - .11060664309660294 * u + 1.2519364065950405 * d;
|
|
33
|
+
h = Math.max(0, h) ** 2.2, g = Math.max(0, g) ** 2.2, _ = Math.max(0, _) ** 2.2, i[0] = s(1.6605 * h - .5876 * g - .0728 * _), i[1] = s(-.1246 * h + 1.1329 * g - .0083 * _), i[2] = s(-.0182 * h - .1006 * g + 1.1187 * _);
|
|
34
|
+
}
|
|
35
|
+
function m(e, t, n, r, i) {
|
|
36
|
+
let a = .76;
|
|
37
|
+
e *= r, t *= r, n *= r;
|
|
38
|
+
let o = Math.min(e, Math.min(t, n)), s = o < .08 ? o - 6.25 * o * o : .04;
|
|
39
|
+
e -= s, t -= s, n -= s;
|
|
40
|
+
let c = Math.max(e, Math.max(t, n));
|
|
41
|
+
if (c < a) {
|
|
42
|
+
i[0] = e, i[1] = t, i[2] = n;
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
let l = 1 - a, u = 1 - l * l / (c + l - a), d = u / c;
|
|
46
|
+
e *= d, t *= d, n *= d;
|
|
47
|
+
let f = 1 - 1 / (.15 * (c - u) + 1);
|
|
48
|
+
i[0] = e + (u - e) * f, i[1] = t + (u - t) * f, i[2] = n + (u - n) * f;
|
|
49
|
+
}
|
|
50
|
+
var h = [
|
|
51
|
+
{
|
|
52
|
+
id: a,
|
|
53
|
+
name: "None",
|
|
54
|
+
wgslConst: "TM_NONE",
|
|
55
|
+
cpu: c,
|
|
56
|
+
wgsl: null,
|
|
57
|
+
call: null,
|
|
58
|
+
appliesExposure: !1
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: r,
|
|
62
|
+
name: "Linear",
|
|
63
|
+
wgslConst: "TM_LINEAR",
|
|
64
|
+
cpu: l,
|
|
65
|
+
wgsl: null,
|
|
66
|
+
call: null
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: o,
|
|
70
|
+
name: "Reinhard",
|
|
71
|
+
wgslConst: "TM_REINHARD",
|
|
72
|
+
cpu: u,
|
|
73
|
+
wgsl: "\nfn tm_reinhard( c: vec3<f32> ) -> vec3<f32> {\n return clamp( c / ( c + vec3<f32>( 1.0 ) ), vec3<f32>( 0.0 ), vec3<f32>( 1.0 ) );\n}\n",
|
|
74
|
+
call: "tm_reinhard( c )"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: n,
|
|
78
|
+
name: "Cineon",
|
|
79
|
+
wgslConst: "TM_CINEON",
|
|
80
|
+
cpu: d,
|
|
81
|
+
wgsl: "\nfn tm_cineon( c0: vec3<f32> ) -> vec3<f32> {\n let c = max( c0 - vec3<f32>( 0.004 ), vec3<f32>( 0.0 ) );\n let v = ( c * ( 6.2 * c + vec3<f32>( 0.5 ) ) ) / ( c * ( 6.2 * c + vec3<f32>( 1.7 ) ) + vec3<f32>( 0.06 ) );\n return pow( max( v, vec3<f32>( 0.0 ) ), vec3<f32>( 2.2 ) );\n}\n",
|
|
82
|
+
call: "tm_cineon( c )"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: e,
|
|
86
|
+
name: "ACES Filmic",
|
|
87
|
+
wgslConst: "TM_ACES",
|
|
88
|
+
cpu: f,
|
|
89
|
+
wgsl: "\nfn tm_aces( c0: vec3<f32> ) -> vec3<f32> {\n let c = c0 / 0.6;\n let m_in = mat3x3<f32>(\n vec3<f32>( 0.59719, 0.07600, 0.02840 ),\n vec3<f32>( 0.35458, 0.90834, 0.13383 ),\n vec3<f32>( 0.04823, 0.01566, 0.83777 ) );\n let v = m_in * c;\n let a = v * ( v + vec3<f32>( 0.0245786 ) ) - vec3<f32>( 0.000090537 );\n let b = v * ( 0.983729 * v + vec3<f32>( 0.4329510 ) ) + vec3<f32>( 0.238081 );\n let m_out = mat3x3<f32>(\n vec3<f32>( 1.60475, -0.10208, -0.00327 ),\n vec3<f32>( -0.53108, 1.10813, -0.07276 ),\n vec3<f32>( -0.07367, -0.00605, 1.07602 ) );\n return clamp( m_out * ( a / b ), vec3<f32>( 0.0 ), vec3<f32>( 1.0 ) );\n}\n",
|
|
90
|
+
call: "tm_aces( c )"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: t,
|
|
94
|
+
name: "AgX",
|
|
95
|
+
wgslConst: "TM_AGX",
|
|
96
|
+
cpu: p,
|
|
97
|
+
wgsl: "\nfn tm_agx( c0: vec3<f32> ) -> vec3<f32> {\n let m_in = mat3x3<f32>(\n vec3<f32>( 0.6274, 0.0691, 0.0164 ),\n vec3<f32>( 0.3293, 0.9195, 0.0880 ),\n vec3<f32>( 0.0433, 0.0113, 0.8956 ) );\n let m_agx = mat3x3<f32>(\n vec3<f32>( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n vec3<f32>( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n vec3<f32>( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) );\n\n var v = m_agx * ( m_in * c0 );\n\n let minEv = -12.47393;\n let maxEv = 4.026069;\n v = clamp( ( log2( max( v, vec3<f32>( 1e-10 ) ) ) - vec3<f32>( minEv ) ) / ( maxEv - minEv ),\n vec3<f32>( 0.0 ), vec3<f32>( 1.0 ) );\n\n let x2 = v * v;\n let x4 = x2 * x2;\n v = 15.5 * x4 * x2 - 40.14 * x4 * v + 31.96 * x4 - 6.868 * x2 * v + 0.4298 * x2 + 0.1191 * v\n - vec3<f32>( 0.00232 );\n\n let m_out = mat3x3<f32>(\n vec3<f32>( 1.1271005818144368, -0.1413297634984383, -0.14132976349843826 ),\n vec3<f32>( -0.11060664309660323, 1.157823702216272, -0.11060664309660294 ),\n vec3<f32>( -0.016493938717834573, -0.016493938717834257, 1.2519364065950405 ) );\n let o = pow( max( m_out * v, vec3<f32>( 0.0 ) ), vec3<f32>( 2.2 ) );\n\n let m_srgb = mat3x3<f32>(\n vec3<f32>( 1.6605, -0.1246, -0.0182 ),\n vec3<f32>( -0.5876, 1.1329, -0.1006 ),\n vec3<f32>( -0.0728, -0.0083, 1.1187 ) );\n return clamp( m_srgb * o, vec3<f32>( 0.0 ), vec3<f32>( 1.0 ) );\n}\n",
|
|
98
|
+
call: "tm_agx( c )"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
id: i,
|
|
102
|
+
name: "Neutral",
|
|
103
|
+
wgslConst: "TM_NEUTRAL",
|
|
104
|
+
cpu: m,
|
|
105
|
+
wgsl: "\nfn tm_neutral( c0: vec3<f32> ) -> vec3<f32> {\n let startCompression = 0.8 - 0.04;\n let desaturation = 0.15;\n\n let x = min( c0.r, min( c0.g, c0.b ) );\n var offset = 0.04;\n if ( x < 0.08 ) { offset = x - 6.25 * x * x; }\n var c = c0 - vec3<f32>( offset );\n\n let peak = max( c.r, max( c.g, c.b ) );\n if ( peak < startCompression ) { return c; }\n\n let d = 1.0 - startCompression;\n let newPeak = 1.0 - d * d / ( peak + d - startCompression );\n c = c * ( newPeak / peak );\n let gFactor = 1.0 - 1.0 / ( desaturation * ( peak - newPeak ) + 1.0 );\n return mix( c, vec3<f32>( newPeak ), gFactor );\n}\n",
|
|
106
|
+
call: "tm_neutral( c )"
|
|
107
|
+
}
|
|
108
|
+
].map((e) => ({
|
|
109
|
+
source: "builtin",
|
|
110
|
+
outputEncoded: !1,
|
|
111
|
+
appliesExposure: !0,
|
|
112
|
+
...e
|
|
113
|
+
})), g = 200, _ = 12, v = [...h], y = new Map(v.map((e) => [e.id, e])), b = 1, x = /* @__PURE__ */ new Set();
|
|
114
|
+
function S() {
|
|
115
|
+
b++;
|
|
116
|
+
for (let e of x) e();
|
|
117
|
+
}
|
|
118
|
+
var C = y;
|
|
119
|
+
function w() {
|
|
120
|
+
return b;
|
|
121
|
+
}
|
|
122
|
+
function T(e) {
|
|
123
|
+
return x.add(e), () => x.delete(e);
|
|
124
|
+
}
|
|
125
|
+
function E(e) {
|
|
126
|
+
return y.get(e) ?? null;
|
|
127
|
+
}
|
|
128
|
+
function D() {
|
|
129
|
+
return v.map((e) => ({
|
|
130
|
+
id: e.id,
|
|
131
|
+
name: e.name,
|
|
132
|
+
source: e.source,
|
|
133
|
+
display: e.ocio?.display ?? null,
|
|
134
|
+
view: e.ocio?.view ?? null,
|
|
135
|
+
look: e.ocio?.look ?? null
|
|
136
|
+
}));
|
|
137
|
+
}
|
|
138
|
+
function O() {
|
|
139
|
+
return v.filter((e) => e.table).length;
|
|
140
|
+
}
|
|
141
|
+
function k() {
|
|
142
|
+
let e = 200;
|
|
143
|
+
for (; y.has(e);) e++;
|
|
144
|
+
return e;
|
|
145
|
+
}
|
|
146
|
+
function A(e) {
|
|
147
|
+
if (typeof e?.id != "number") throw Error("view transform needs a numeric id");
|
|
148
|
+
if (typeof e.cpu != "function") throw Error(`view transform ${e.id} needs a cpu function`);
|
|
149
|
+
if (!e.name) throw Error(`view transform ${e.id} needs a name`);
|
|
150
|
+
if (!/^TM_[A-Z0-9_]+$/.test(e.wgslConst ?? "")) throw Error(`view transform ${e.id} needs a wgslConst like TM_SOMETHING`);
|
|
151
|
+
let t = y.get(e.id);
|
|
152
|
+
if (!t && e.table && O() >= 12) throw Error(`cannot register "${e.name}": 12 table-backed view transforms already registered, and WebGPU only guarantees 16 sampled textures per stage. Remove one first.`);
|
|
153
|
+
let n = {
|
|
154
|
+
source: "custom",
|
|
155
|
+
outputEncoded: !1,
|
|
156
|
+
appliesExposure: !0,
|
|
157
|
+
...e
|
|
158
|
+
};
|
|
159
|
+
return t ? v[v.indexOf(t)] = n : v.push(n), y.set(n.id, n), S(), n;
|
|
160
|
+
}
|
|
161
|
+
function j(e) {
|
|
162
|
+
let t = y.get(e);
|
|
163
|
+
return t ? (v.splice(v.indexOf(t), 1), y.delete(e), S(), !0) : !1;
|
|
164
|
+
}
|
|
165
|
+
function M(e = null) {
|
|
166
|
+
let t = v.filter((t) => t.source === "ocio" && !e?.has(t.id)).map((e) => e.id);
|
|
167
|
+
if (t.length === 0) return 0;
|
|
168
|
+
for (let e of t) {
|
|
169
|
+
let t = y.get(e);
|
|
170
|
+
v.splice(v.indexOf(t), 1), y.delete(e);
|
|
171
|
+
}
|
|
172
|
+
return S(), t.length;
|
|
173
|
+
}
|
|
174
|
+
function N(e) {
|
|
175
|
+
let t = e?.library;
|
|
176
|
+
if (!t?.addToneMapping) return 0;
|
|
177
|
+
let n = 0;
|
|
178
|
+
for (let e of v) e.tsl && (t.toneMappingNodes?.delete(e.id), t.addToneMapping(e.tsl, e.id), n++);
|
|
179
|
+
return n;
|
|
180
|
+
}
|
|
181
|
+
function P({ group: e = 0, firstBinding: t = 3 } = {}) {
|
|
182
|
+
let n = [], r = t, i = [], a = [];
|
|
183
|
+
for (let t of v) {
|
|
184
|
+
if (t.table) {
|
|
185
|
+
let a = `${t.wgslConst.toLowerCase()}_tex`;
|
|
186
|
+
i.push(`@group(${e}) @binding(${r}) var ${a}: texture_3d<f32>;`), n.push({
|
|
187
|
+
index: r,
|
|
188
|
+
transform: t,
|
|
189
|
+
texName: a
|
|
190
|
+
}), r += 1;
|
|
191
|
+
}
|
|
192
|
+
t.wgsl && a.push(t.wgsl);
|
|
193
|
+
}
|
|
194
|
+
let o = v.map((e) => `const ${e.wgslConst}: u32 = ${e.id}u;`).join("\n"), s = v.filter((e) => e.call).map((e) => `\tif ( mode == ${e.wgslConst} ) { return ${e.call}; }`).join("\n"), c = v.filter((e) => e.outputEncoded).map((e) => e.wgslConst), l = c.length ? c.map((e) => `mode == ${e}`).join(" || ") : "false", u = v.filter((e) => !e.appliesExposure).map((e) => e.wgslConst), d = u.length ? u.map((e) => `mode == ${e}`).join(" || ") : "false";
|
|
195
|
+
return {
|
|
196
|
+
wgsl: `
|
|
197
|
+
${o}
|
|
198
|
+
|
|
199
|
+
${i.join("\n")}
|
|
200
|
+
|
|
201
|
+
${a.join("\n")}
|
|
202
|
+
|
|
203
|
+
// Three.js clamps the fragment output with max(0) before tone mapping, so the curves never see a
|
|
204
|
+
// negative channel. The saturation grade drives channels below zero on much of a typical frame,
|
|
205
|
+
// and AgX/Neutral mix negatives across channels instead of clipping them.
|
|
206
|
+
fn rayzee_tone_curve( color: vec3<f32>, mode: u32 ) -> vec3<f32> {
|
|
207
|
+
let c = max( color, vec3<f32>( 0.0 ) );
|
|
208
|
+
${s}
|
|
209
|
+
return clamp( c, vec3<f32>( 0.0 ), vec3<f32>( 1.0 ) );
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** True when the curve already returned display-encoded colour. */
|
|
213
|
+
fn rayzee_output_encoded( mode: u32 ) -> bool {
|
|
214
|
+
return ${l};
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
fn rayzee_tone_map( linearRGB: vec3<f32>, mode: u32, exposure: f32, saturation: f32 ) -> vec3<f32> {
|
|
218
|
+
// Three.js returns early for NoToneMapping without applying exposure, so a readback that
|
|
219
|
+
// applied it would paint brighter than the viewport it replaces.
|
|
220
|
+
var c = linearRGB * select( exposure, 1.0, ${d} );
|
|
221
|
+
if ( saturation != 1.0 ) {
|
|
222
|
+
let luma = vec3<f32>( dot( c, vec3<f32>( 0.2126, 0.7152, 0.0722 ) ) );
|
|
223
|
+
c = luma + ( c - luma ) * saturation;
|
|
224
|
+
}
|
|
225
|
+
return rayzee_tone_curve( c, mode );
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
fn rayzee_linear_to_srgb( c: vec3<f32> ) -> vec3<f32> {
|
|
229
|
+
return select(
|
|
230
|
+
1.055 * pow( max( c, vec3<f32>( 0.0 ) ), vec3<f32>( 1.0 / 2.4 ) ) - vec3<f32>( 0.055 ),
|
|
231
|
+
12.92 * c,
|
|
232
|
+
c <= vec3<f32>( 0.0031308 ) );
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/** The transfer step, skipped for a curve that already encoded its own output. */
|
|
236
|
+
fn rayzee_encode( mapped: vec3<f32>, mode: u32 ) -> vec3<f32> {
|
|
237
|
+
if ( rayzee_output_encoded( mode ) ) { return clamp( mapped, vec3<f32>( 0.0 ), vec3<f32>( 1.0 ) ); }
|
|
238
|
+
return rayzee_linear_to_srgb( mapped );
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
fn rayzee_to_u8( srgb: vec3<f32> ) -> vec3<u32> {
|
|
242
|
+
return vec3<u32>( clamp( round( srgb * 255.0 + vec3<f32>( 0.5 ) ), vec3<f32>( 0.0 ), vec3<f32>( 255.0 ) ) );
|
|
243
|
+
}
|
|
244
|
+
`,
|
|
245
|
+
bindings: n
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
function F() {
|
|
249
|
+
v.length = 0, v.push(...h), y.clear();
|
|
250
|
+
for (let e of v) y.set(e.id, e);
|
|
251
|
+
S();
|
|
252
|
+
}
|
|
253
|
+
var I = a, L = t;
|
|
254
|
+
//#endregion
|
|
255
|
+
export { F as _, C as a, O as c, D as d, k as f, j as g, M as h, g as i, w as l, N as m, I as n, A as o, T as p, _ as r, P as s, L as t, E as u };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//#region src/Color/WorkingMatrix.js
|
|
2
|
+
var e = null, t = null;
|
|
3
|
+
function n(n, r = null) {
|
|
4
|
+
e = n, t = n ? r : null;
|
|
5
|
+
}
|
|
6
|
+
function r() {
|
|
7
|
+
return e;
|
|
8
|
+
}
|
|
9
|
+
function i() {
|
|
10
|
+
return t;
|
|
11
|
+
}
|
|
12
|
+
function a(t) {
|
|
13
|
+
if (!e) return !1;
|
|
14
|
+
let n = t[0], r = t[1], i = t[2];
|
|
15
|
+
return t[0] = e[0] * n + e[1] * r + e[2] * i, t[1] = e[3] * n + e[4] * r + e[5] * i, t[2] = e[6] * n + e[7] * r + e[8] * i, !0;
|
|
16
|
+
}
|
|
17
|
+
function o(t, n, r) {
|
|
18
|
+
if (!e || r.length === 0) return 0;
|
|
19
|
+
let i = 0;
|
|
20
|
+
for (let a = 0; a + n <= t.length; a += n) for (let n of r) {
|
|
21
|
+
let r = a + n, o = t[r], s = t[r + 1], c = t[r + 2];
|
|
22
|
+
t[r] = e[0] * o + e[1] * s + e[2] * c, t[r + 1] = e[3] * o + e[4] * s + e[5] * c, t[r + 2] = e[6] * o + e[7] * s + e[8] * c, i++;
|
|
23
|
+
}
|
|
24
|
+
return i;
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { n as a, i, o as n, r, a as t };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { inflateSync as e } from "three/addons/libs/fflate.module.js";
|
|
2
|
+
//#region src/Processor/ZipReader.js
|
|
3
|
+
var t = 101010256, n = 117853008, r = 101075792, i = 33639248, a = 67324752, o = 65557, s = new TextDecoder();
|
|
4
|
+
async function c(e, t, n) {
|
|
5
|
+
return new Uint8Array(await e.slice(t, n).arrayBuffer());
|
|
6
|
+
}
|
|
7
|
+
function l(e, t) {
|
|
8
|
+
return e.getUint32(t + 4, !0) * 4294967296 + e.getUint32(t, !0);
|
|
9
|
+
}
|
|
10
|
+
function u(e) {
|
|
11
|
+
let t = "";
|
|
12
|
+
for (let n = 0; n < e.length; n += 8192) t += String.fromCharCode(...e.subarray(n, n + 8192));
|
|
13
|
+
return t;
|
|
14
|
+
}
|
|
15
|
+
async function d(e) {
|
|
16
|
+
let a = e.size, d = await c(e, Math.max(0, a - o - 20), a), f = new DataView(d.buffer), p = -1;
|
|
17
|
+
for (let e = d.length - 22; e >= 0; e--) if (f.getUint32(e, !0) === t) {
|
|
18
|
+
p = e;
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
if (p < 0) throw Error("zip: end of central directory not found");
|
|
22
|
+
let m = f.getUint16(p + 10, !0), h = f.getUint32(p + 12, !0), g = f.getUint32(p + 16, !0);
|
|
23
|
+
if (m === 65535 || h === 4294967295 || g === 4294967295) {
|
|
24
|
+
let t = p - 20;
|
|
25
|
+
if (t < 0 || f.getUint32(t, !0) !== n) throw Error("zip: ZIP64 locator missing");
|
|
26
|
+
let i = l(f, t + 8), a = new DataView((await c(e, i, i + 56)).buffer);
|
|
27
|
+
if (a.getUint32(0, !0) !== r) throw Error("zip: ZIP64 end record missing");
|
|
28
|
+
m = l(a, 32), h = l(a, 40), g = l(a, 48);
|
|
29
|
+
}
|
|
30
|
+
let _ = await c(e, g, g + h), v = new DataView(_.buffer), y = [], b = 0;
|
|
31
|
+
for (let e = 0; e < m && b + 46 <= _.length; e++) {
|
|
32
|
+
if (v.getUint32(b, !0) !== i) throw Error("zip: corrupt central directory");
|
|
33
|
+
let e = v.getUint16(b + 8, !0), t = v.getUint16(b + 10, !0), n = v.getUint32(b + 20, !0), r = v.getUint32(b + 24, !0), a = v.getUint16(b + 28, !0), o = v.getUint16(b + 30, !0), c = v.getUint16(b + 32, !0), d = v.getUint32(b + 42, !0), f = _.subarray(b + 46, b + 46 + a), p = e & 2048 ? s.decode(f) : u(f);
|
|
34
|
+
for (let e = b + 46 + a, t = e + o; e + 4 <= t;) {
|
|
35
|
+
let t = v.getUint16(e, !0), i = v.getUint16(e + 2, !0);
|
|
36
|
+
if (t === 1) {
|
|
37
|
+
let t = e + 4;
|
|
38
|
+
r === 4294967295 && (r = l(v, t), t += 8), n === 4294967295 && (n = l(v, t), t += 8), d === 4294967295 && (d = l(v, t));
|
|
39
|
+
}
|
|
40
|
+
e += 4 + i;
|
|
41
|
+
}
|
|
42
|
+
p.endsWith("/") || y.push({
|
|
43
|
+
name: p,
|
|
44
|
+
size: r,
|
|
45
|
+
compSize: n,
|
|
46
|
+
method: t,
|
|
47
|
+
local: d,
|
|
48
|
+
encrypted: (e & 1) != 0
|
|
49
|
+
}), b += 46 + a + o + c;
|
|
50
|
+
}
|
|
51
|
+
return y;
|
|
52
|
+
}
|
|
53
|
+
async function f(e, t) {
|
|
54
|
+
if (t.encrypted) throw Error(`zip: "${t.name}" is encrypted`);
|
|
55
|
+
let n = new DataView((await c(e, t.local, t.local + 30)).buffer);
|
|
56
|
+
if (n.getUint32(0, !0) !== a) throw Error(`zip: bad local header for "${t.name}"`);
|
|
57
|
+
return t.local + 30 + n.getUint16(26, !0) + n.getUint16(28, !0);
|
|
58
|
+
}
|
|
59
|
+
async function p(t, n) {
|
|
60
|
+
let r = await f(t, n), i = await c(t, r, r + n.compSize);
|
|
61
|
+
if (n.method === 0) return i;
|
|
62
|
+
if (n.method === 8) return n.size === 0 ? new Uint8Array() : e(i, { out: new Uint8Array(n.size) });
|
|
63
|
+
throw Error(`zip: "${n.name}" uses compression method ${n.method}, which is not supported`);
|
|
64
|
+
}
|
|
65
|
+
async function m(e, { filter: t = null } = {}) {
|
|
66
|
+
let n = await d(e), r = /* @__PURE__ */ new Map(), i = n.map((e) => t && !t(e.name, e.size) ? {
|
|
67
|
+
path: e.name,
|
|
68
|
+
size: e.size
|
|
69
|
+
} : (r.set(e.name, e), {
|
|
70
|
+
path: e.name,
|
|
71
|
+
size: e.size,
|
|
72
|
+
offset: e.local
|
|
73
|
+
})), a = async (t) => {
|
|
74
|
+
let n = r.get(t);
|
|
75
|
+
return n ? p(e, n) : null;
|
|
76
|
+
}, o = async (t) => {
|
|
77
|
+
let n = r.get(t);
|
|
78
|
+
if (!n) return null;
|
|
79
|
+
if (n.method !== 0) return new Blob([await p(e, n)]);
|
|
80
|
+
let i = await f(e, n);
|
|
81
|
+
return e.slice(i, i + n.compSize);
|
|
82
|
+
};
|
|
83
|
+
return {
|
|
84
|
+
entries: Object.create(null),
|
|
85
|
+
listing: i,
|
|
86
|
+
read: a,
|
|
87
|
+
readHead: async (e, t) => {
|
|
88
|
+
let n = await o(e);
|
|
89
|
+
return n ? new Uint8Array(await n.slice(0, t).arrayBuffer()) : null;
|
|
90
|
+
},
|
|
91
|
+
slice: o,
|
|
92
|
+
retainedBytes: 0,
|
|
93
|
+
truncated: !1,
|
|
94
|
+
indexed: r.size
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
//#endregion
|
|
98
|
+
export { d as n, m as t };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { i as e, r as t, t as n } from "../ActiveColor-YvuQq44O.js";
|
|
2
|
+
import { A as r, C as i, D as a, E as o, O as s, S as c, T as l, _ as u, a as d, b as f, c as p, d as m, f as h, g, h as _, i as v, k as y, l as b, m as x, n as S, o as C, p as w, r as T, s as E, t as D, u as O, v as k, w as A, x as j, y as M } from "../ColorManagement-oeEk7oSu.js";
|
|
3
|
+
export { D as ColorManagement, h as DEFAULT_LUT_SIZE, w as DEFAULT_MAX_EV, x as DEFAULT_MIN_EV, n as DEFAULT_WORKING_SPACE, _ as addAllOcioViews, g as addOcioView, j as applyMatrixRGBA8, k as bakeLut, u as buildOcioView, S as canvasColorSpaceFor, d as clearInputOverrides, c as convertColor, i as convertEncodedRGBA8, A as convertPixelsF32, r as displayCanvasFit, l as extractMatrix, T as findNativeLinearSpace, t as getActiveColorManagement, o as hasColorSpace, v as isColorManaged, a as isDataSpace, C as isDataTexture, s as linearToSrgb, E as listFileRules, p as listInputOverrides, M as makeCpuSampler, f as measureBakeError, b as resolveInputSpace, e as setActiveColorManagement, O as setInputOverride, y as srgbToLinear, m as textureInputSpace };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { i as e, r as t } from "../shared-BGBcSxBQ.js";
|
|
2
|
+
import { a as n, c as r, i, l as a, n as o, o as s, r as c, s as l, t as u } from "../openStorage-DwcBRUj7.js";
|
|
3
|
+
export { t as ENGINE_AREAS, c as EntryWriter, e as STORAGE_KIND, i as StorageArea, n as StorageEntry, s as StorageManager, r as acquireLock, u as acquireSharedStorage, a as heldLockNames, l as openInlineStorage, o as openStorage };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
//#region src/Processor/SceneMetadata.js
|
|
2
|
+
var e = [
|
|
3
|
+
"sourceFile",
|
|
4
|
+
"url",
|
|
5
|
+
"file"
|
|
6
|
+
];
|
|
7
|
+
function t(e) {
|
|
8
|
+
if (typeof e == "string") try {
|
|
9
|
+
let t = JSON.parse(e);
|
|
10
|
+
return t && typeof t == "object" ? t : null;
|
|
11
|
+
} catch {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
return e && typeof e == "object" ? e : null;
|
|
15
|
+
}
|
|
16
|
+
function n(e) {
|
|
17
|
+
let t = typeof e == "string" ? parseFloat(e) : e;
|
|
18
|
+
return Number.isFinite(t) ? t : void 0;
|
|
19
|
+
}
|
|
20
|
+
function r(e) {
|
|
21
|
+
let n = t(e);
|
|
22
|
+
if (!n) return null;
|
|
23
|
+
let r = t(n.rayzee);
|
|
24
|
+
return r && r.environment !== void 0 ? r : n.environment === void 0 ? null : n;
|
|
25
|
+
}
|
|
26
|
+
function i(r) {
|
|
27
|
+
let i = t(r);
|
|
28
|
+
if (!i) return null;
|
|
29
|
+
let a = e.map((e) => i[e]).find((e) => typeof e == "string" && e.trim());
|
|
30
|
+
if (!a) return null;
|
|
31
|
+
let o = n(i.rotation), s = n(i.intensity), c = { sourceFile: a.trim() };
|
|
32
|
+
return o !== void 0 && (c.rotation = o), s !== void 0 && (c.intensity = Math.max(0, s)), c;
|
|
33
|
+
}
|
|
34
|
+
function a(e) {
|
|
35
|
+
let t = r(e);
|
|
36
|
+
if (!t) return null;
|
|
37
|
+
let n = i(t.environment);
|
|
38
|
+
return n ? { environment: n } : null;
|
|
39
|
+
}
|
|
40
|
+
function o(e) {
|
|
41
|
+
if (!e) return null;
|
|
42
|
+
let t = [
|
|
43
|
+
e.userData,
|
|
44
|
+
e.asset?.extras,
|
|
45
|
+
e.scene?.userData
|
|
46
|
+
];
|
|
47
|
+
Array.isArray(e.scenes) && t.push(...e.scenes.map((e) => e?.userData));
|
|
48
|
+
for (let e of t) {
|
|
49
|
+
let t = a(e);
|
|
50
|
+
if (t) return t;
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/Processor/archiveFormats.js
|
|
56
|
+
var s = Object.freeze({
|
|
57
|
+
zip: {
|
|
58
|
+
type: "archive",
|
|
59
|
+
name: "ZIP Archive"
|
|
60
|
+
},
|
|
61
|
+
gz: {
|
|
62
|
+
type: "archive",
|
|
63
|
+
name: "Gzipped TAR Archive"
|
|
64
|
+
},
|
|
65
|
+
tgz: {
|
|
66
|
+
type: "archive",
|
|
67
|
+
name: "Gzipped TAR Archive"
|
|
68
|
+
},
|
|
69
|
+
tar: {
|
|
70
|
+
type: "archive",
|
|
71
|
+
name: "TAR Archive"
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
//#endregion
|
|
75
|
+
export { o as n, a as r, s as t };
|