@babylonjs/core 7.21.4 → 7.22.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/Audio/analyser.js +3 -3
- package/Audio/analyser.js.map +1 -1
- package/Audio/audioSceneComponent.js +7 -7
- package/Audio/audioSceneComponent.js.map +1 -1
- package/Audio/sound.js +55 -50
- package/Audio/sound.js.map +1 -1
- package/Audio/soundTrack.js +11 -11
- package/Audio/soundTrack.js.map +1 -1
- package/Cameras/flyCamera.js +2 -2
- package/Cameras/flyCamera.js.map +1 -1
- package/Cameras/freeCamera.js +2 -2
- package/Cameras/freeCamera.js.map +1 -1
- package/Collisions/collisionCoordinator.js +2 -2
- package/Collisions/collisionCoordinator.js.map +1 -1
- package/Debug/debugLayer.js +2 -2
- package/Debug/debugLayer.js.map +1 -1
- package/Engines/AbstractEngine/abstractEngine.cubeTexture.js +25 -28
- package/Engines/AbstractEngine/abstractEngine.cubeTexture.js.map +1 -1
- package/Engines/abstractEngine.d.ts +18 -3
- package/Engines/abstractEngine.js +32 -13
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/engine.d.ts +0 -7
- package/Engines/engine.js +0 -13
- package/Engines/engine.js.map +1 -1
- package/Engines/nativeEngine.js +3 -9
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/thinEngine.d.ts +0 -37
- package/Engines/thinEngine.js +2 -40
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +1 -2
- package/Engines/webgpuEngine.js.map +1 -1
- package/Gamepads/gamepadManager.js +2 -2
- package/Gamepads/gamepadManager.js.map +1 -1
- package/Loading/sceneLoader.d.ts +2 -2
- package/Loading/sceneLoader.js +3 -3
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.d.ts +3 -3
- package/Materials/Textures/Loaders/EXR/exrLoader.compression.d.ts +31 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.compression.huf.d.ts +9 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.compression.huf.js +454 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.compression.huf.js.map +1 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.compression.js +147 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.compression.js.map +1 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.compression.rle.d.ts +7 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.compression.rle.js +91 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.compression.rle.js.map +1 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.configuration.d.ts +17 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.configuration.js +19 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.configuration.js.map +1 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.core.d.ts +130 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.core.js +452 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.core.js.map +1 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.decoder.d.ts +25 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.decoder.js +284 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.decoder.js.map +1 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.header.d.ts +9 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.header.js +112 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.header.js.map +1 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.interfaces.d.ts +75 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.interfaces.js +16 -0
- package/Materials/Textures/Loaders/EXR/exrLoader.interfaces.js.map +1 -0
- package/Materials/Textures/Loaders/EXR/index.d.ts +7 -0
- package/Materials/Textures/Loaders/EXR/index.js +8 -0
- package/Materials/Textures/Loaders/EXR/index.js.map +1 -0
- package/Materials/Textures/Loaders/basisTextureLoader.d.ts +1 -7
- package/Materials/Textures/Loaders/basisTextureLoader.js +0 -11
- package/Materials/Textures/Loaders/basisTextureLoader.js.map +1 -1
- package/Materials/Textures/Loaders/ddsTextureLoader.d.ts +1 -7
- package/Materials/Textures/Loaders/ddsTextureLoader.js +0 -11
- package/Materials/Textures/Loaders/ddsTextureLoader.js.map +1 -1
- package/Materials/Textures/Loaders/envTextureLoader.d.ts +1 -7
- package/Materials/Textures/Loaders/envTextureLoader.js +0 -11
- package/Materials/Textures/Loaders/envTextureLoader.js.map +1 -1
- package/Materials/Textures/Loaders/exrTextureLoader.d.ts +37 -0
- package/Materials/Textures/Loaders/exrTextureLoader.js +122 -0
- package/Materials/Textures/Loaders/exrTextureLoader.js.map +1 -0
- package/Materials/Textures/Loaders/hdrTextureLoader.d.ts +1 -7
- package/Materials/Textures/Loaders/hdrTextureLoader.js +0 -11
- package/Materials/Textures/Loaders/hdrTextureLoader.js.map +1 -1
- package/Materials/Textures/Loaders/index.d.ts +4 -0
- package/Materials/Textures/Loaders/index.js +5 -0
- package/Materials/Textures/Loaders/index.js.map +1 -1
- package/Materials/Textures/{internalTextureLoader.d.ts → Loaders/internalTextureLoader.d.ts} +2 -9
- package/Materials/Textures/Loaders/internalTextureLoader.js.map +1 -0
- package/Materials/Textures/Loaders/ktxTextureLoader.d.ts +1 -8
- package/Materials/Textures/Loaders/ktxTextureLoader.js +0 -13
- package/Materials/Textures/Loaders/ktxTextureLoader.js.map +1 -1
- package/Materials/Textures/Loaders/textureLoaderManager.d.ts +9 -0
- package/Materials/Textures/Loaders/textureLoaderManager.js +32 -0
- package/Materials/Textures/Loaders/textureLoaderManager.js.map +1 -0
- package/Materials/Textures/Loaders/tgaTextureLoader.d.ts +1 -7
- package/Materials/Textures/Loaders/tgaTextureLoader.js +0 -11
- package/Materials/Textures/Loaders/tgaTextureLoader.js.map +1 -1
- package/Materials/Textures/Packer/packer.js +2 -2
- package/Materials/Textures/Packer/packer.js.map +1 -1
- package/Materials/Textures/index.d.ts +0 -1
- package/Materials/Textures/index.js +0 -1
- package/Materials/Textures/index.js.map +1 -1
- package/Materials/fresnelParameters.js +2 -2
- package/Materials/fresnelParameters.js.map +1 -1
- package/Materials/materialFlags.js +24 -24
- package/Materials/materialFlags.js.map +1 -1
- package/Meshes/Node/nodeGeometry.js +2 -2
- package/Meshes/Node/nodeGeometry.js.map +1 -1
- package/Meshes/abstractMesh.js +2 -2
- package/Meshes/abstractMesh.js.map +1 -1
- package/Misc/fileTools.d.ts +13 -0
- package/Misc/fileTools.js +16 -0
- package/Misc/fileTools.js.map +1 -1
- package/Offline/database.js +2 -2
- package/Offline/database.js.map +1 -1
- package/Rendering/boundingBoxRenderer.d.ts +2 -2
- package/Rendering/boundingBoxRenderer.js +2 -2
- package/Rendering/boundingBoxRenderer.js.map +1 -1
- package/Rendering/edgesRenderer.d.ts +7 -2
- package/Rendering/edgesRenderer.js +23 -6
- package/Rendering/edgesRenderer.js.map +1 -1
- package/Rendering/index.d.ts +12 -4
- package/Rendering/index.js +14 -4
- package/Rendering/index.js.map +1 -1
- package/Rendering/outlineRenderer.d.ts +7 -2
- package/Rendering/outlineRenderer.js +64 -11
- package/Rendering/outlineRenderer.js.map +1 -1
- package/ShadersWGSL/line.fragment.d.ts +9 -0
- package/ShadersWGSL/line.fragment.js +24 -0
- package/ShadersWGSL/line.fragment.js.map +1 -0
- package/ShadersWGSL/line.vertex.d.ts +13 -0
- package/ShadersWGSL/line.vertex.js +36 -0
- package/ShadersWGSL/line.vertex.js.map +1 -0
- package/ShadersWGSL/outline.fragment.d.ts +9 -0
- package/ShadersWGSL/outline.fragment.js +30 -0
- package/ShadersWGSL/outline.fragment.js.map +1 -0
- package/ShadersWGSL/outline.vertex.d.ts +19 -0
- package/ShadersWGSL/outline.vertex.js +66 -0
- package/ShadersWGSL/outline.vertex.js.map +1 -0
- package/Sprites/spriteMap.js +4 -4
- package/Sprites/spriteMap.js.map +1 -1
- package/XR/features/WebXRDepthSensing.js +2 -3
- package/XR/features/WebXRDepthSensing.js.map +1 -1
- package/XR/webXRExperienceHelper.js +2 -2
- package/XR/webXRExperienceHelper.js.map +1 -1
- package/package.json +1 -1
- package/scene.js +2 -3
- package/scene.js.map +1 -1
- package/Materials/Textures/internalTextureLoader.js.map +0 -1
- /package/Materials/Textures/{internalTextureLoader.js → Loaders/internalTextureLoader.js} +0 -0
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { CompressionCodes, DecodeFloat32, ParseFloat16, ParseFloat32, ParseInt32, ParseInt64, ParseUint16, ParseUint32 } from "./exrLoader.core.js";
|
|
2
|
+
import { UncompressPIZ, UncompressPXR, UncompressRAW, UncompressRLE, UncompressZIP } from "./exrLoader.compression.js";
|
|
3
|
+
import { FLOAT32_SIZE, INT16_SIZE } from "./exrLoader.interfaces.js";
|
|
4
|
+
|
|
5
|
+
import { Tools } from "../../../../Misc/tools.js";
|
|
6
|
+
import { ExrLoaderGlobalConfiguration, EXROutputType } from "./exrLoader.configuration.js";
|
|
7
|
+
/**
|
|
8
|
+
* Inspired by https://github.com/sciecode/three.js/blob/dev/examples/jsm/loaders/EXRLoader.js
|
|
9
|
+
* Referred to the original Industrial Light & Magic OpenEXR implementation and the TinyEXR / Syoyo Fujita
|
|
10
|
+
* implementation.
|
|
11
|
+
*/
|
|
12
|
+
// /*
|
|
13
|
+
// Copyright (c) 2014 - 2017, Syoyo Fujita
|
|
14
|
+
// All rights reserved.
|
|
15
|
+
// Redistribution and use in source and binary forms, with or without
|
|
16
|
+
// modification, are permitted provided that the following conditions are met:
|
|
17
|
+
// * Redistributions of source code must retain the above copyright
|
|
18
|
+
// notice, this list of conditions and the following disclaimer.
|
|
19
|
+
// * Redistributions in binary form must reproduce the above copyright
|
|
20
|
+
// notice, this list of conditions and the following disclaimer in the
|
|
21
|
+
// documentation and/or other materials provided with the distribution.
|
|
22
|
+
// * Neither the name of the Syoyo Fujita nor the
|
|
23
|
+
// names of its contributors may be used to endorse or promote products
|
|
24
|
+
// derived from this software without specific prior written permission.
|
|
25
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
26
|
+
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
27
|
+
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
28
|
+
// DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
|
29
|
+
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
30
|
+
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
31
|
+
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
32
|
+
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
33
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
34
|
+
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
35
|
+
// */
|
|
36
|
+
// // TinyEXR contains some OpenEXR code, which is licensed under ------------
|
|
37
|
+
// ///////////////////////////////////////////////////////////////////////////
|
|
38
|
+
// //
|
|
39
|
+
// // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
|
40
|
+
// // Digital Ltd. LLC
|
|
41
|
+
// //
|
|
42
|
+
// // All rights reserved.
|
|
43
|
+
// //
|
|
44
|
+
// // Redistribution and use in source and binary forms, with or without
|
|
45
|
+
// // modification, are permitted provided that the following conditions are
|
|
46
|
+
// // met:
|
|
47
|
+
// // * Redistributions of source code must retain the above copyright
|
|
48
|
+
// // notice, this list of conditions and the following disclaimer.
|
|
49
|
+
// // * Redistributions in binary form must reproduce the above
|
|
50
|
+
// // copyright notice, this list of conditions and the following disclaimer
|
|
51
|
+
// // in the documentation and/or other materials provided with the
|
|
52
|
+
// // distribution.
|
|
53
|
+
// // * Neither the name of Industrial Light & Magic nor the names of
|
|
54
|
+
// // its contributors may be used to endorse or promote products derived
|
|
55
|
+
// // from this software without specific prior written permission.
|
|
56
|
+
// //
|
|
57
|
+
// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
58
|
+
// // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
59
|
+
// // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
60
|
+
// // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
61
|
+
// // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
62
|
+
// // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
63
|
+
// // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
64
|
+
// // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
65
|
+
// // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
66
|
+
// // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
67
|
+
// // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
68
|
+
// //
|
|
69
|
+
// ///////////////////////////////////////////////////////////////////////////
|
|
70
|
+
// // End of OpenEXR license -------------------------------------------------
|
|
71
|
+
/**
|
|
72
|
+
* Create a decoder for the exr file
|
|
73
|
+
* @param header header of the exr file
|
|
74
|
+
* @param dataView dataview of the exr file
|
|
75
|
+
* @param offset current offset
|
|
76
|
+
* @param outputType expected output type (float or half float)
|
|
77
|
+
* @returns a promise that resolves with the decoder
|
|
78
|
+
*/
|
|
79
|
+
export async function CreateDecoderAsync(header, dataView, offset, outputType) {
|
|
80
|
+
const decoder = {
|
|
81
|
+
size: 0,
|
|
82
|
+
viewer: dataView,
|
|
83
|
+
array: new Uint8Array(dataView.buffer),
|
|
84
|
+
offset: offset,
|
|
85
|
+
width: header.dataWindow.xMax - header.dataWindow.xMin + 1,
|
|
86
|
+
height: header.dataWindow.yMax - header.dataWindow.yMin + 1,
|
|
87
|
+
channels: header.channels.length,
|
|
88
|
+
channelLineOffsets: {},
|
|
89
|
+
scanOrder: () => 0,
|
|
90
|
+
bytesPerLine: 0,
|
|
91
|
+
outLineWidth: 0,
|
|
92
|
+
lines: 0,
|
|
93
|
+
scanlineBlockSize: 0,
|
|
94
|
+
inputSize: null,
|
|
95
|
+
type: 0,
|
|
96
|
+
uncompress: null,
|
|
97
|
+
getter: () => 0,
|
|
98
|
+
format: 5,
|
|
99
|
+
outputChannels: 0,
|
|
100
|
+
decodeChannels: {},
|
|
101
|
+
blockCount: null,
|
|
102
|
+
byteArray: null,
|
|
103
|
+
linearSpace: false,
|
|
104
|
+
textureType: 0,
|
|
105
|
+
};
|
|
106
|
+
switch (header.compression) {
|
|
107
|
+
case CompressionCodes.NO_COMPRESSION:
|
|
108
|
+
decoder.lines = 1;
|
|
109
|
+
decoder.uncompress = UncompressRAW;
|
|
110
|
+
break;
|
|
111
|
+
case CompressionCodes.RLE_COMPRESSION:
|
|
112
|
+
decoder.lines = 1;
|
|
113
|
+
decoder.uncompress = UncompressRLE;
|
|
114
|
+
break;
|
|
115
|
+
case CompressionCodes.ZIPS_COMPRESSION:
|
|
116
|
+
decoder.lines = 1;
|
|
117
|
+
decoder.uncompress = UncompressZIP;
|
|
118
|
+
await Tools.LoadScriptAsync(ExrLoaderGlobalConfiguration.FFLATEUrl);
|
|
119
|
+
break;
|
|
120
|
+
case CompressionCodes.ZIP_COMPRESSION:
|
|
121
|
+
decoder.lines = 16;
|
|
122
|
+
decoder.uncompress = UncompressZIP;
|
|
123
|
+
await Tools.LoadScriptAsync(ExrLoaderGlobalConfiguration.FFLATEUrl);
|
|
124
|
+
break;
|
|
125
|
+
case CompressionCodes.PIZ_COMPRESSION:
|
|
126
|
+
decoder.lines = 32;
|
|
127
|
+
decoder.uncompress = UncompressPIZ;
|
|
128
|
+
break;
|
|
129
|
+
case CompressionCodes.PXR24_COMPRESSION:
|
|
130
|
+
decoder.lines = 16;
|
|
131
|
+
decoder.uncompress = UncompressPXR;
|
|
132
|
+
await Tools.LoadScriptAsync(ExrLoaderGlobalConfiguration.FFLATEUrl);
|
|
133
|
+
break;
|
|
134
|
+
default:
|
|
135
|
+
throw new Error(CompressionCodes[header.compression] + " is unsupported");
|
|
136
|
+
}
|
|
137
|
+
decoder.scanlineBlockSize = decoder.lines;
|
|
138
|
+
const channels = {};
|
|
139
|
+
for (const channel of header.channels) {
|
|
140
|
+
switch (channel.name) {
|
|
141
|
+
case "Y":
|
|
142
|
+
case "R":
|
|
143
|
+
case "G":
|
|
144
|
+
case "B":
|
|
145
|
+
case "A":
|
|
146
|
+
channels[channel.name] = true;
|
|
147
|
+
decoder.type = channel.pixelType;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
// RGB images will be converted to RGBA format, preventing software emulation in select devices.
|
|
151
|
+
let fillAlpha = false;
|
|
152
|
+
if (channels.R && channels.G && channels.B) {
|
|
153
|
+
fillAlpha = !channels.A;
|
|
154
|
+
decoder.outputChannels = 4;
|
|
155
|
+
decoder.decodeChannels = { R: 0, G: 1, B: 2, A: 3 };
|
|
156
|
+
}
|
|
157
|
+
else if (channels.Y) {
|
|
158
|
+
decoder.outputChannels = 1;
|
|
159
|
+
decoder.decodeChannels = { Y: 0 };
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
throw new Error("EXRLoader.parse: file contains unsupported data channels.");
|
|
163
|
+
}
|
|
164
|
+
if (decoder.type === 1) {
|
|
165
|
+
// half
|
|
166
|
+
switch (outputType) {
|
|
167
|
+
case EXROutputType.Float:
|
|
168
|
+
decoder.getter = ParseFloat16;
|
|
169
|
+
decoder.inputSize = INT16_SIZE;
|
|
170
|
+
break;
|
|
171
|
+
case EXROutputType.HalfFloat:
|
|
172
|
+
decoder.getter = ParseUint16;
|
|
173
|
+
decoder.inputSize = INT16_SIZE;
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
else if (decoder.type === 2) {
|
|
178
|
+
// float
|
|
179
|
+
switch (outputType) {
|
|
180
|
+
case EXROutputType.Float:
|
|
181
|
+
decoder.getter = ParseFloat32;
|
|
182
|
+
decoder.inputSize = FLOAT32_SIZE;
|
|
183
|
+
break;
|
|
184
|
+
case EXROutputType.HalfFloat:
|
|
185
|
+
decoder.getter = DecodeFloat32;
|
|
186
|
+
decoder.inputSize = FLOAT32_SIZE;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
throw new Error("Unsupported pixelType " + decoder.type + " for " + header.compression);
|
|
191
|
+
}
|
|
192
|
+
decoder.blockCount = decoder.height / decoder.scanlineBlockSize;
|
|
193
|
+
for (let i = 0; i < decoder.blockCount; i++) {
|
|
194
|
+
ParseInt64(dataView, offset); // scanlineOffset
|
|
195
|
+
}
|
|
196
|
+
// we should be passed the scanline offset table, ready to start reading pixel data.
|
|
197
|
+
const size = decoder.width * decoder.height * decoder.outputChannels;
|
|
198
|
+
switch (outputType) {
|
|
199
|
+
case EXROutputType.Float:
|
|
200
|
+
decoder.byteArray = new Float32Array(size);
|
|
201
|
+
decoder.textureType = 1;
|
|
202
|
+
// Fill initially with 1s for the alpha value if the texture is not RGBA, RGB values will be overwritten
|
|
203
|
+
if (fillAlpha) {
|
|
204
|
+
decoder.byteArray.fill(1, 0, size);
|
|
205
|
+
}
|
|
206
|
+
break;
|
|
207
|
+
case EXROutputType.HalfFloat:
|
|
208
|
+
decoder.byteArray = new Uint16Array(size);
|
|
209
|
+
decoder.textureType = 2;
|
|
210
|
+
if (fillAlpha) {
|
|
211
|
+
decoder.byteArray.fill(0x3c00, 0, size); // Uint16Array holds half float data, 0x3C00 is 1
|
|
212
|
+
}
|
|
213
|
+
break;
|
|
214
|
+
default:
|
|
215
|
+
throw new Error("Unsupported type: " + outputType);
|
|
216
|
+
}
|
|
217
|
+
let byteOffset = 0;
|
|
218
|
+
for (const channel of header.channels) {
|
|
219
|
+
if (decoder.decodeChannels[channel.name] !== undefined) {
|
|
220
|
+
decoder.channelLineOffsets[channel.name] = byteOffset * decoder.width;
|
|
221
|
+
}
|
|
222
|
+
byteOffset += channel.pixelType * 2;
|
|
223
|
+
}
|
|
224
|
+
decoder.bytesPerLine = decoder.width * byteOffset;
|
|
225
|
+
decoder.outLineWidth = decoder.width * decoder.outputChannels;
|
|
226
|
+
if (header.lineOrder === "INCREASING_Y") {
|
|
227
|
+
decoder.scanOrder = (y) => y;
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
decoder.scanOrder = (y) => decoder.height - 1 - y;
|
|
231
|
+
}
|
|
232
|
+
if (decoder.outputChannels == 4) {
|
|
233
|
+
decoder.format = 5;
|
|
234
|
+
decoder.linearSpace = true;
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
decoder.format = 6;
|
|
238
|
+
decoder.linearSpace = false;
|
|
239
|
+
}
|
|
240
|
+
return decoder;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Scan the data of the exr file
|
|
244
|
+
* @param decoder decoder to use
|
|
245
|
+
* @param header header of the exr file
|
|
246
|
+
* @param dataView dataview of the exr file
|
|
247
|
+
* @param offset current offset
|
|
248
|
+
*/
|
|
249
|
+
export function ScanData(decoder, header, dataView, offset) {
|
|
250
|
+
const tmpOffset = { value: 0 };
|
|
251
|
+
for (let scanlineBlockIdx = 0; scanlineBlockIdx < decoder.height / decoder.scanlineBlockSize; scanlineBlockIdx++) {
|
|
252
|
+
const line = ParseInt32(dataView, offset) - header.dataWindow.yMin; // line_no
|
|
253
|
+
decoder.size = ParseUint32(dataView, offset); // data_len
|
|
254
|
+
decoder.lines = line + decoder.scanlineBlockSize > decoder.height ? decoder.height - line : decoder.scanlineBlockSize;
|
|
255
|
+
const isCompressed = decoder.size < decoder.lines * decoder.bytesPerLine;
|
|
256
|
+
const viewer = isCompressed && decoder.uncompress ? decoder.uncompress(decoder) : UncompressRAW(decoder);
|
|
257
|
+
offset.value += decoder.size;
|
|
258
|
+
for (let line_y = 0; line_y < decoder.scanlineBlockSize; line_y++) {
|
|
259
|
+
const scan_y = scanlineBlockIdx * decoder.scanlineBlockSize;
|
|
260
|
+
const true_y = line_y + decoder.scanOrder(scan_y);
|
|
261
|
+
if (true_y >= decoder.height) {
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
const lineOffset = line_y * decoder.bytesPerLine;
|
|
265
|
+
const outLineOffset = (decoder.height - 1 - true_y) * decoder.outLineWidth;
|
|
266
|
+
for (let channelID = 0; channelID < decoder.channels; channelID++) {
|
|
267
|
+
const name = header.channels[channelID].name;
|
|
268
|
+
const lOff = decoder.channelLineOffsets[name];
|
|
269
|
+
const cOff = decoder.decodeChannels[name];
|
|
270
|
+
if (cOff === undefined) {
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
273
|
+
tmpOffset.value = lineOffset + lOff;
|
|
274
|
+
for (let x = 0; x < decoder.width; x++) {
|
|
275
|
+
const outIndex = outLineOffset + x * decoder.outputChannels + cOff;
|
|
276
|
+
if (decoder.byteArray) {
|
|
277
|
+
decoder.byteArray[outIndex] = decoder.getter(viewer, tmpOffset);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
//# sourceMappingURL=exrLoader.decoder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exrLoader.decoder.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Materials/Textures/Loaders/EXR/exrLoader.decoder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,a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AAG,OAAO,CAAC,YAAY,CAAC;YACjD,MAAM,aAAa,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC;YAE3E,KAAK,IAAI,SAAS,GAAG,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,QAAQ,EAAE,SAAS,EAAE,EAAE;gBAC/D,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC;gBAC7C,MAAM,IAAI,GAAG,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;gBAC9C,MAAM,IAAI,GAAG,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;gBAE1C,IAAI,IAAI,KAAK,SAAS,EAAE;oBACpB,SAAS;iBACZ;gBAED,SAAS,CAAC,KAAK,GAAG,UAAU,GAAG,IAAI,CAAC;gBAEpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;oBACpC,MAAM,QAAQ,GAAG,aAAa,GAAG,CAAC,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;oBACnE,IAAI,OAAO,CAAC,SAAS,EAAE;wBACnB,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;qBACnE;iBACJ;aACJ;SACJ;KACJ;AACL,CAAC","sourcesContent":["import type { DataCursor } from \"./exrLoader.core\";\r\nimport { CompressionCodes, DecodeFloat32, ParseFloat16, ParseFloat32, ParseInt32, ParseInt64, ParseUint16, ParseUint32 } from \"./exrLoader.core\";\r\nimport { UncompressPIZ, UncompressPXR, UncompressRAW, UncompressRLE, UncompressZIP } from \"./exrLoader.compression\";\r\nimport { FLOAT32_SIZE, INT16_SIZE, type IEXRDecoder, type IEXRHeader } from \"./exrLoader.interfaces\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { Tools } from \"core/Misc/tools\";\r\nimport { ExrLoaderGlobalConfiguration, EXROutputType } from \"./exrLoader.configuration\";\r\n\r\n/**\r\n * Inspired by https://github.com/sciecode/three.js/blob/dev/examples/jsm/loaders/EXRLoader.js\r\n * Referred to the original Industrial Light & Magic OpenEXR implementation and the TinyEXR / Syoyo Fujita\r\n * implementation.\r\n */\r\n\r\n// /*\r\n// Copyright (c) 2014 - 2017, Syoyo Fujita\r\n// All rights reserved.\r\n\r\n// Redistribution and use in source and binary forms, with or without\r\n// modification, are permitted provided that the following conditions are met:\r\n// * Redistributions of source code must retain the above copyright\r\n// notice, this list of conditions and the following disclaimer.\r\n// * Redistributions in binary form must reproduce the above copyright\r\n// notice, this list of conditions and the following disclaimer in the\r\n// documentation and/or other materials provided with the distribution.\r\n// * Neither the name of the Syoyo Fujita nor the\r\n// names of its contributors may be used to endorse or promote products\r\n// derived from this software without specific prior written permission.\r\n\r\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\r\n// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r\n// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r\n// DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY\r\n// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r\n// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\r\n// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r\n// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n// */\r\n\r\n// // TinyEXR contains some OpenEXR code, which is licensed under ------------\r\n\r\n// ///////////////////////////////////////////////////////////////////////////\r\n// //\r\n// // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas\r\n// // Digital Ltd. LLC\r\n// //\r\n// // All rights reserved.\r\n// //\r\n// // Redistribution and use in source and binary forms, with or without\r\n// // modification, are permitted provided that the following conditions are\r\n// // met:\r\n// // * Redistributions of source code must retain the above copyright\r\n// // notice, this list of conditions and the following disclaimer.\r\n// // * Redistributions in binary form must reproduce the above\r\n// // copyright notice, this list of conditions and the following disclaimer\r\n// // in the documentation and/or other materials provided with the\r\n// // distribution.\r\n// // * Neither the name of Industrial Light & Magic nor the names of\r\n// // its contributors may be used to endorse or promote products derived\r\n// // from this software without specific prior written permission.\r\n// //\r\n// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n// // \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n// // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n// // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n// // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n// // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n// // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n// // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n// // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n// // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n// // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n// //\r\n// ///////////////////////////////////////////////////////////////////////////\r\n\r\n// // End of OpenEXR license -------------------------------------------------\r\n\r\n/**\r\n * Create a decoder for the exr file\r\n * @param header header of the exr file\r\n * @param dataView dataview of the exr file\r\n * @param offset current offset\r\n * @param outputType expected output type (float or half float)\r\n * @returns a promise that resolves with the decoder\r\n */\r\nexport async function CreateDecoderAsync(header: IEXRHeader, dataView: DataView, offset: DataCursor, outputType: EXROutputType): Promise<IEXRDecoder> {\r\n const decoder: IEXRDecoder = {\r\n size: 0,\r\n viewer: dataView,\r\n array: new Uint8Array(dataView.buffer),\r\n offset: offset,\r\n width: header.dataWindow.xMax - header.dataWindow.xMin + 1,\r\n height: header.dataWindow.yMax - header.dataWindow.yMin + 1,\r\n channels: header.channels.length,\r\n channelLineOffsets: {},\r\n scanOrder: () => 0,\r\n bytesPerLine: 0,\r\n outLineWidth: 0,\r\n lines: 0,\r\n scanlineBlockSize: 0,\r\n inputSize: null,\r\n type: 0,\r\n uncompress: null,\r\n getter: () => 0,\r\n format: Constants.TEXTUREFORMAT_RGBA,\r\n outputChannels: 0,\r\n decodeChannels: {},\r\n blockCount: null,\r\n byteArray: null,\r\n linearSpace: false,\r\n textureType: 0,\r\n };\r\n\r\n switch (header.compression) {\r\n case CompressionCodes.NO_COMPRESSION:\r\n decoder.lines = 1;\r\n decoder.uncompress = UncompressRAW;\r\n break;\r\n\r\n case CompressionCodes.RLE_COMPRESSION:\r\n decoder.lines = 1;\r\n decoder.uncompress = UncompressRLE;\r\n break;\r\n\r\n case CompressionCodes.ZIPS_COMPRESSION:\r\n decoder.lines = 1;\r\n decoder.uncompress = UncompressZIP;\r\n await Tools.LoadScriptAsync(ExrLoaderGlobalConfiguration.FFLATEUrl);\r\n break;\r\n\r\n case CompressionCodes.ZIP_COMPRESSION:\r\n decoder.lines = 16;\r\n decoder.uncompress = UncompressZIP;\r\n await Tools.LoadScriptAsync(ExrLoaderGlobalConfiguration.FFLATEUrl);\r\n break;\r\n\r\n case CompressionCodes.PIZ_COMPRESSION:\r\n decoder.lines = 32;\r\n decoder.uncompress = UncompressPIZ;\r\n break;\r\n\r\n case CompressionCodes.PXR24_COMPRESSION:\r\n decoder.lines = 16;\r\n decoder.uncompress = UncompressPXR;\r\n await Tools.LoadScriptAsync(ExrLoaderGlobalConfiguration.FFLATEUrl);\r\n break;\r\n\r\n default:\r\n throw new Error(CompressionCodes[header.compression] + \" is unsupported\");\r\n }\r\n\r\n decoder.scanlineBlockSize = decoder.lines;\r\n\r\n const channels: {\r\n [key: string]: boolean;\r\n } = {};\r\n for (const channel of header.channels) {\r\n switch (channel.name) {\r\n case \"Y\":\r\n case \"R\":\r\n case \"G\":\r\n case \"B\":\r\n case \"A\":\r\n channels[channel.name] = true;\r\n decoder.type = channel.pixelType;\r\n }\r\n }\r\n\r\n // RGB images will be converted to RGBA format, preventing software emulation in select devices.\r\n let fillAlpha = false;\r\n\r\n if (channels.R && channels.G && channels.B) {\r\n fillAlpha = !channels.A;\r\n decoder.outputChannels = 4;\r\n decoder.decodeChannels = { R: 0, G: 1, B: 2, A: 3 };\r\n } else if (channels.Y) {\r\n decoder.outputChannels = 1;\r\n decoder.decodeChannels = { Y: 0 };\r\n } else {\r\n throw new Error(\"EXRLoader.parse: file contains unsupported data channels.\");\r\n }\r\n\r\n if (decoder.type === 1) {\r\n // half\r\n switch (outputType) {\r\n case EXROutputType.Float:\r\n decoder.getter = ParseFloat16;\r\n decoder.inputSize = INT16_SIZE;\r\n break;\r\n\r\n case EXROutputType.HalfFloat:\r\n decoder.getter = ParseUint16;\r\n decoder.inputSize = INT16_SIZE;\r\n break;\r\n }\r\n } else if (decoder.type === 2) {\r\n // float\r\n switch (outputType) {\r\n case EXROutputType.Float:\r\n decoder.getter = ParseFloat32;\r\n decoder.inputSize = FLOAT32_SIZE;\r\n break;\r\n\r\n case EXROutputType.HalfFloat:\r\n decoder.getter = DecodeFloat32;\r\n decoder.inputSize = FLOAT32_SIZE;\r\n }\r\n } else {\r\n throw new Error(\"Unsupported pixelType \" + decoder.type + \" for \" + header.compression);\r\n }\r\n\r\n decoder.blockCount = decoder.height / decoder.scanlineBlockSize;\r\n\r\n for (let i = 0; i < decoder.blockCount; i++) {\r\n ParseInt64(dataView, offset); // scanlineOffset\r\n }\r\n\r\n // we should be passed the scanline offset table, ready to start reading pixel data.\r\n const size = decoder.width * decoder.height * decoder.outputChannels;\r\n\r\n switch (outputType) {\r\n case EXROutputType.Float:\r\n decoder.byteArray = new Float32Array(size);\r\n decoder.textureType = Constants.TEXTURETYPE_FLOAT;\r\n\r\n // Fill initially with 1s for the alpha value if the texture is not RGBA, RGB values will be overwritten\r\n if (fillAlpha) {\r\n decoder.byteArray.fill(1, 0, size);\r\n }\r\n\r\n break;\r\n\r\n case EXROutputType.HalfFloat:\r\n decoder.byteArray = new Uint16Array(size);\r\n decoder.textureType = Constants.TEXTURETYPE_HALF_FLOAT;\r\n\r\n if (fillAlpha) {\r\n decoder.byteArray.fill(0x3c00, 0, size); // Uint16Array holds half float data, 0x3C00 is 1\r\n }\r\n\r\n break;\r\n\r\n default:\r\n throw new Error(\"Unsupported type: \" + outputType);\r\n }\r\n\r\n let byteOffset = 0;\r\n for (const channel of header.channels) {\r\n if (decoder.decodeChannels[channel.name] !== undefined) {\r\n decoder.channelLineOffsets[channel.name] = byteOffset * decoder.width;\r\n }\r\n\r\n byteOffset += channel.pixelType * 2;\r\n }\r\n\r\n decoder.bytesPerLine = decoder.width * byteOffset;\r\n decoder.outLineWidth = decoder.width * decoder.outputChannels;\r\n\r\n if (header.lineOrder === \"INCREASING_Y\") {\r\n decoder.scanOrder = (y) => y;\r\n } else {\r\n decoder.scanOrder = (y) => decoder.height - 1 - y;\r\n }\r\n\r\n if (decoder.outputChannels == 4) {\r\n decoder.format = Constants.TEXTUREFORMAT_RGBA;\r\n decoder.linearSpace = true;\r\n } else {\r\n decoder.format = Constants.TEXTUREFORMAT_R;\r\n decoder.linearSpace = false;\r\n }\r\n\r\n return decoder;\r\n}\r\n\r\n/**\r\n * Scan the data of the exr file\r\n * @param decoder decoder to use\r\n * @param header header of the exr file\r\n * @param dataView dataview of the exr file\r\n * @param offset current offset\r\n */\r\nexport function ScanData(decoder: IEXRDecoder, header: IEXRHeader, dataView: DataView, offset: DataCursor): void {\r\n const tmpOffset = { value: 0 };\r\n\r\n for (let scanlineBlockIdx = 0; scanlineBlockIdx < decoder.height / decoder.scanlineBlockSize; scanlineBlockIdx++) {\r\n const line = ParseInt32(dataView, offset) - header.dataWindow.yMin; // line_no\r\n decoder.size = ParseUint32(dataView, offset); // data_len\r\n decoder.lines = line + decoder.scanlineBlockSize > decoder.height ? decoder.height - line : decoder.scanlineBlockSize;\r\n\r\n const isCompressed = decoder.size < decoder.lines * decoder.bytesPerLine;\r\n const viewer = isCompressed && decoder.uncompress ? decoder.uncompress(decoder) : UncompressRAW(decoder);\r\n\r\n offset.value += decoder.size;\r\n\r\n for (let line_y = 0; line_y < decoder.scanlineBlockSize; line_y++) {\r\n const scan_y = scanlineBlockIdx * decoder.scanlineBlockSize;\r\n const true_y = line_y + decoder.scanOrder(scan_y);\r\n if (true_y >= decoder.height) {\r\n continue;\r\n }\r\n\r\n const lineOffset = line_y * decoder.bytesPerLine;\r\n const outLineOffset = (decoder.height - 1 - true_y) * decoder.outLineWidth;\r\n\r\n for (let channelID = 0; channelID < decoder.channels; channelID++) {\r\n const name = header.channels[channelID].name;\r\n const lOff = decoder.channelLineOffsets[name];\r\n const cOff = decoder.decodeChannels[name];\r\n\r\n if (cOff === undefined) {\r\n continue;\r\n }\r\n\r\n tmpOffset.value = lineOffset + lOff;\r\n\r\n for (let x = 0; x < decoder.width; x++) {\r\n const outIndex = outLineOffset + x * decoder.outputChannels + cOff;\r\n if (decoder.byteArray) {\r\n decoder.byteArray[outIndex] = decoder.getter(viewer, tmpOffset);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DataCursor } from "./exrLoader.core";
|
|
2
|
+
import type { IEXRHeader } from "./exrLoader.interfaces";
|
|
3
|
+
/**
|
|
4
|
+
* Gets the EXR header
|
|
5
|
+
* @param dataView defines the data view to read from
|
|
6
|
+
* @param offset defines the offset to start reading from
|
|
7
|
+
* @returns the header
|
|
8
|
+
*/
|
|
9
|
+
export declare function GetExrHeader(dataView: DataView, offset: DataCursor): IEXRHeader;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
+
import { Logger } from "../../../../Misc/logger.js";
|
|
3
|
+
import { ParseNullTerminatedString, ParseUint32, ParseValue } from "./exrLoader.core.js";
|
|
4
|
+
/**
|
|
5
|
+
* Inspired by https://github.com/sciecode/three.js/blob/dev/examples/jsm/loaders/EXRLoader.js
|
|
6
|
+
* Referred to the original Industrial Light & Magic OpenEXR implementation and the TinyEXR / Syoyo Fujita
|
|
7
|
+
* implementation.
|
|
8
|
+
*/
|
|
9
|
+
// /*
|
|
10
|
+
// Copyright (c) 2014 - 2017, Syoyo Fujita
|
|
11
|
+
// All rights reserved.
|
|
12
|
+
// Redistribution and use in source and binary forms, with or without
|
|
13
|
+
// modification, are permitted provided that the following conditions are met:
|
|
14
|
+
// * Redistributions of source code must retain the above copyright
|
|
15
|
+
// notice, this list of conditions and the following disclaimer.
|
|
16
|
+
// * Redistributions in binary form must reproduce the above copyright
|
|
17
|
+
// notice, this list of conditions and the following disclaimer in the
|
|
18
|
+
// documentation and/or other materials provided with the distribution.
|
|
19
|
+
// * Neither the name of the Syoyo Fujita nor the
|
|
20
|
+
// names of its contributors may be used to endorse or promote products
|
|
21
|
+
// derived from this software without specific prior written permission.
|
|
22
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
23
|
+
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
24
|
+
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
25
|
+
// DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
|
26
|
+
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
27
|
+
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
28
|
+
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
29
|
+
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
30
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
31
|
+
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
32
|
+
// */
|
|
33
|
+
// // TinyEXR contains some OpenEXR code, which is licensed under ------------
|
|
34
|
+
// ///////////////////////////////////////////////////////////////////////////
|
|
35
|
+
// //
|
|
36
|
+
// // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
|
|
37
|
+
// // Digital Ltd. LLC
|
|
38
|
+
// //
|
|
39
|
+
// // All rights reserved.
|
|
40
|
+
// //
|
|
41
|
+
// // Redistribution and use in source and binary forms, with or without
|
|
42
|
+
// // modification, are permitted provided that the following conditions are
|
|
43
|
+
// // met:
|
|
44
|
+
// // * Redistributions of source code must retain the above copyright
|
|
45
|
+
// // notice, this list of conditions and the following disclaimer.
|
|
46
|
+
// // * Redistributions in binary form must reproduce the above
|
|
47
|
+
// // copyright notice, this list of conditions and the following disclaimer
|
|
48
|
+
// // in the documentation and/or other materials provided with the
|
|
49
|
+
// // distribution.
|
|
50
|
+
// // * Neither the name of Industrial Light & Magic nor the names of
|
|
51
|
+
// // its contributors may be used to endorse or promote products derived
|
|
52
|
+
// // from this software without specific prior written permission.
|
|
53
|
+
// //
|
|
54
|
+
// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
55
|
+
// // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
56
|
+
// // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
57
|
+
// // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
58
|
+
// // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
59
|
+
// // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
60
|
+
// // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
61
|
+
// // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
62
|
+
// // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
63
|
+
// // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
64
|
+
// // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
65
|
+
// //
|
|
66
|
+
// ///////////////////////////////////////////////////////////////////////////
|
|
67
|
+
// // End of OpenEXR license -------------------------------------------------
|
|
68
|
+
const EXR_MAGIC = 20000630;
|
|
69
|
+
/**
|
|
70
|
+
* Gets the EXR header
|
|
71
|
+
* @param dataView defines the data view to read from
|
|
72
|
+
* @param offset defines the offset to start reading from
|
|
73
|
+
* @returns the header
|
|
74
|
+
*/
|
|
75
|
+
export function GetExrHeader(dataView, offset) {
|
|
76
|
+
if (dataView.getUint32(0, true) != EXR_MAGIC) {
|
|
77
|
+
throw new Error("Incorrect OpenEXR format");
|
|
78
|
+
}
|
|
79
|
+
const version = dataView.getUint8(4);
|
|
80
|
+
const specData = dataView.getUint8(5); // fullMask
|
|
81
|
+
const spec = {
|
|
82
|
+
singleTile: !!(specData & 2),
|
|
83
|
+
longName: !!(specData & 4),
|
|
84
|
+
deepFormat: !!(specData & 8),
|
|
85
|
+
multiPart: !!(specData & 16),
|
|
86
|
+
};
|
|
87
|
+
offset.value = 8;
|
|
88
|
+
const headerData = {};
|
|
89
|
+
let keepReading = true;
|
|
90
|
+
while (keepReading) {
|
|
91
|
+
const attributeName = ParseNullTerminatedString(dataView.buffer, offset);
|
|
92
|
+
if (!attributeName) {
|
|
93
|
+
keepReading = false;
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
const attributeType = ParseNullTerminatedString(dataView.buffer, offset);
|
|
97
|
+
const attributeSize = ParseUint32(dataView, offset);
|
|
98
|
+
const attributeValue = ParseValue(dataView, offset, attributeType, attributeSize);
|
|
99
|
+
if (attributeValue === undefined) {
|
|
100
|
+
Logger.Warn(`Unknown header attribute type ${attributeType}'.`);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
headerData[attributeName] = attributeValue;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if ((specData & ~0x04) != 0) {
|
|
108
|
+
throw new Error("Unsupported file format");
|
|
109
|
+
}
|
|
110
|
+
return { version: version, spec: spec, ...headerData };
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=exrLoader.header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exrLoader.header.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Materials/Textures/Loaders/EXR/exrLoader.header.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,OAAO,EAAE,MAAM,EAAE,mCAAyB;AAE1C,OAAO,EAAE,yBAAyB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGtF;;;;GAIG;AAEH,KAAK;AACL,0CAA0C;AAC1C,uBAAuB;AAEv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eslint/naming-convention */\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport type { DataCursor } from \"./exrLoader.core\";\r\nimport { ParseNullTerminatedString, ParseUint32, ParseValue } from \"./exrLoader.core\";\r\nimport type { IEXRHeader } from \"./exrLoader.interfaces\";\r\n\r\n/**\r\n * Inspired by https://github.com/sciecode/three.js/blob/dev/examples/jsm/loaders/EXRLoader.js\r\n * Referred to the original Industrial Light & Magic OpenEXR implementation and the TinyEXR / Syoyo Fujita\r\n * implementation.\r\n */\r\n\r\n// /*\r\n// Copyright (c) 2014 - 2017, Syoyo Fujita\r\n// All rights reserved.\r\n\r\n// Redistribution and use in source and binary forms, with or without\r\n// modification, are permitted provided that the following conditions are met:\r\n// * Redistributions of source code must retain the above copyright\r\n// notice, this list of conditions and the following disclaimer.\r\n// * Redistributions in binary form must reproduce the above copyright\r\n// notice, this list of conditions and the following disclaimer in the\r\n// documentation and/or other materials provided with the distribution.\r\n// * Neither the name of the Syoyo Fujita nor the\r\n// names of its contributors may be used to endorse or promote products\r\n// derived from this software without specific prior written permission.\r\n\r\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\r\n// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r\n// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r\n// DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY\r\n// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r\n// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\r\n// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r\n// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n// */\r\n\r\n// // TinyEXR contains some OpenEXR code, which is licensed under ------------\r\n\r\n// ///////////////////////////////////////////////////////////////////////////\r\n// //\r\n// // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas\r\n// // Digital Ltd. LLC\r\n// //\r\n// // All rights reserved.\r\n// //\r\n// // Redistribution and use in source and binary forms, with or without\r\n// // modification, are permitted provided that the following conditions are\r\n// // met:\r\n// // * Redistributions of source code must retain the above copyright\r\n// // notice, this list of conditions and the following disclaimer.\r\n// // * Redistributions in binary form must reproduce the above\r\n// // copyright notice, this list of conditions and the following disclaimer\r\n// // in the documentation and/or other materials provided with the\r\n// // distribution.\r\n// // * Neither the name of Industrial Light & Magic nor the names of\r\n// // its contributors may be used to endorse or promote products derived\r\n// // from this software without specific prior written permission.\r\n// //\r\n// // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n// // \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n// // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r\n// // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r\n// // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r\n// // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r\n// // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r\n// // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r\n// // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n// // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r\n// // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n// //\r\n// ///////////////////////////////////////////////////////////////////////////\r\n\r\n// // End of OpenEXR license -------------------------------------------------\r\n\r\nconst EXR_MAGIC = 20000630;\r\n\r\n/**\r\n * Gets the EXR header\r\n * @param dataView defines the data view to read from\r\n * @param offset defines the offset to start reading from\r\n * @returns the header\r\n */\r\nexport function GetExrHeader(dataView: DataView, offset: DataCursor): IEXRHeader {\r\n if (dataView.getUint32(0, true) != EXR_MAGIC) {\r\n throw new Error(\"Incorrect OpenEXR format\");\r\n }\r\n\r\n const version = dataView.getUint8(4);\r\n\r\n const specData = dataView.getUint8(5); // fullMask\r\n const spec = {\r\n singleTile: !!(specData & 2),\r\n longName: !!(specData & 4),\r\n deepFormat: !!(specData & 8),\r\n multiPart: !!(specData & 16),\r\n };\r\n\r\n offset.value = 8;\r\n\r\n const headerData: any = {};\r\n\r\n let keepReading = true;\r\n\r\n while (keepReading) {\r\n const attributeName = ParseNullTerminatedString(dataView.buffer, offset);\r\n\r\n if (!attributeName) {\r\n keepReading = false;\r\n } else {\r\n const attributeType = ParseNullTerminatedString(dataView.buffer, offset);\r\n const attributeSize = ParseUint32(dataView, offset);\r\n const attributeValue = ParseValue(dataView, offset, attributeType, attributeSize);\r\n\r\n if (attributeValue === undefined) {\r\n Logger.Warn(`Unknown header attribute type ${attributeType}'.`);\r\n } else {\r\n headerData[attributeName] = attributeValue;\r\n }\r\n }\r\n }\r\n\r\n if ((specData & ~0x04) != 0) {\r\n throw new Error(\"Unsupported file format\");\r\n }\r\n\r\n return { version: version, spec: spec, ...headerData };\r\n}\r\n"]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { Nullable } from "../../../../types.js";
|
|
2
|
+
import type { DataCursor } from "./exrLoader.core";
|
|
3
|
+
export declare const INT32_SIZE = 4;
|
|
4
|
+
export declare const FLOAT32_SIZE = 4;
|
|
5
|
+
export declare const INT8_SIZE = 1;
|
|
6
|
+
export declare const INT16_SIZE = 2;
|
|
7
|
+
export declare const ULONG_SIZE = 8;
|
|
8
|
+
export declare const USHORT_RANGE: number;
|
|
9
|
+
export declare const BITMAP_SIZE: number;
|
|
10
|
+
export declare const HUF_ENCBITS = 16;
|
|
11
|
+
export declare const HUF_DECBITS = 14;
|
|
12
|
+
export declare const HUF_ENCSIZE: number;
|
|
13
|
+
export declare const HUF_DECSIZE: number;
|
|
14
|
+
export declare const HUF_DECMASK: number;
|
|
15
|
+
export declare const SHORT_ZEROCODE_RUN = 59;
|
|
16
|
+
export declare const LONG_ZEROCODE_RUN = 63;
|
|
17
|
+
export declare const SHORTEST_LONG_RUN: number;
|
|
18
|
+
export interface IEXRCHannel {
|
|
19
|
+
name: string;
|
|
20
|
+
pixelType: number;
|
|
21
|
+
}
|
|
22
|
+
export interface IDecodeChannel {
|
|
23
|
+
[name: string]: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Interface used to define the EXR header
|
|
27
|
+
*/
|
|
28
|
+
export interface IEXRHeader {
|
|
29
|
+
/** Version */
|
|
30
|
+
version: number;
|
|
31
|
+
/** Specifications */
|
|
32
|
+
spec: {
|
|
33
|
+
singleTile: boolean;
|
|
34
|
+
longName: boolean;
|
|
35
|
+
deepFormat: boolean;
|
|
36
|
+
multiPart: boolean;
|
|
37
|
+
};
|
|
38
|
+
/** Data window */
|
|
39
|
+
dataWindow: {
|
|
40
|
+
xMin: number;
|
|
41
|
+
xMax: number;
|
|
42
|
+
yMin: number;
|
|
43
|
+
yMax: number;
|
|
44
|
+
};
|
|
45
|
+
/** Channels */
|
|
46
|
+
channels: IEXRCHannel[];
|
|
47
|
+
/** Extra data */
|
|
48
|
+
[name: string]: any;
|
|
49
|
+
}
|
|
50
|
+
export interface IEXRDecoder {
|
|
51
|
+
size: number;
|
|
52
|
+
viewer: DataView;
|
|
53
|
+
array: Uint8Array;
|
|
54
|
+
byteArray: Nullable<Float32Array | Uint16Array>;
|
|
55
|
+
offset: DataCursor;
|
|
56
|
+
width: number;
|
|
57
|
+
height: number;
|
|
58
|
+
channels: number;
|
|
59
|
+
channelLineOffsets: IDecodeChannel;
|
|
60
|
+
scanOrder: (value: number) => number;
|
|
61
|
+
bytesPerLine: number;
|
|
62
|
+
outLineWidth: number;
|
|
63
|
+
lines: number;
|
|
64
|
+
scanlineBlockSize: number;
|
|
65
|
+
inputSize: Nullable<number>;
|
|
66
|
+
type: number;
|
|
67
|
+
uncompress: Nullable<(decoder: IEXRDecoder) => DataView>;
|
|
68
|
+
getter: (dataView: DataView, offset: DataCursor) => number;
|
|
69
|
+
format: number;
|
|
70
|
+
outputChannels: number;
|
|
71
|
+
decodeChannels: IDecodeChannel;
|
|
72
|
+
blockCount: Nullable<number>;
|
|
73
|
+
linearSpace: boolean;
|
|
74
|
+
textureType: number;
|
|
75
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const INT32_SIZE = 4;
|
|
2
|
+
export const FLOAT32_SIZE = 4;
|
|
3
|
+
export const INT8_SIZE = 1;
|
|
4
|
+
export const INT16_SIZE = 2;
|
|
5
|
+
export const ULONG_SIZE = 8;
|
|
6
|
+
export const USHORT_RANGE = 1 << 16;
|
|
7
|
+
export const BITMAP_SIZE = USHORT_RANGE >> 3;
|
|
8
|
+
export const HUF_ENCBITS = 16;
|
|
9
|
+
export const HUF_DECBITS = 14;
|
|
10
|
+
export const HUF_ENCSIZE = (1 << HUF_ENCBITS) + 1;
|
|
11
|
+
export const HUF_DECSIZE = 1 << HUF_DECBITS;
|
|
12
|
+
export const HUF_DECMASK = HUF_DECSIZE - 1;
|
|
13
|
+
export const SHORT_ZEROCODE_RUN = 59;
|
|
14
|
+
export const LONG_ZEROCODE_RUN = 63;
|
|
15
|
+
export const SHORTEST_LONG_RUN = 2 + LONG_ZEROCODE_RUN - SHORT_ZEROCODE_RUN;
|
|
16
|
+
//# sourceMappingURL=exrLoader.interfaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exrLoader.interfaces.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Materials/Textures/Loaders/EXR/exrLoader.interfaces.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC;AAC5B,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC;AAC9B,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC;AAC3B,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC;AAC5B,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC;AAC5B,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,CAAC;AACpC,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,IAAI,CAAC,CAAC;AAC7C,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAC9B,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAC9B,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,IAAI,WAAW,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAI,WAAW,CAAC;AAC5C,MAAM,CAAC,MAAM,WAAW,GAAG,WAAW,GAAG,CAAC,CAAC;AAC3C,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AACrC,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AACpC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,GAAG,iBAAiB,GAAG,kBAAkB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport type { DataCursor } from \"./exrLoader.core\";\r\n\r\nexport const INT32_SIZE = 4;\r\nexport const FLOAT32_SIZE = 4;\r\nexport const INT8_SIZE = 1;\r\nexport const INT16_SIZE = 2;\r\nexport const ULONG_SIZE = 8;\r\nexport const USHORT_RANGE = 1 << 16;\r\nexport const BITMAP_SIZE = USHORT_RANGE >> 3;\r\nexport const HUF_ENCBITS = 16;\r\nexport const HUF_DECBITS = 14;\r\nexport const HUF_ENCSIZE = (1 << HUF_ENCBITS) + 1;\r\nexport const HUF_DECSIZE = 1 << HUF_DECBITS;\r\nexport const HUF_DECMASK = HUF_DECSIZE - 1;\r\nexport const SHORT_ZEROCODE_RUN = 59;\r\nexport const LONG_ZEROCODE_RUN = 63;\r\nexport const SHORTEST_LONG_RUN = 2 + LONG_ZEROCODE_RUN - SHORT_ZEROCODE_RUN;\r\n\r\nexport interface IEXRCHannel {\r\n name: string;\r\n pixelType: number;\r\n}\r\n\r\nexport interface IDecodeChannel {\r\n [name: string]: number;\r\n}\r\n\r\n/**\r\n * Interface used to define the EXR header\r\n */\r\nexport interface IEXRHeader {\r\n /** Version */\r\n version: number;\r\n /** Specifications */\r\n spec: {\r\n singleTile: boolean;\r\n longName: boolean;\r\n deepFormat: boolean;\r\n multiPart: boolean;\r\n };\r\n /** Data window */\r\n dataWindow: {\r\n xMin: number;\r\n xMax: number;\r\n yMin: number;\r\n yMax: number;\r\n };\r\n /** Channels */\r\n channels: IEXRCHannel[];\r\n /** Extra data */\r\n [name: string]: any;\r\n}\r\n\r\nexport interface IEXRDecoder {\r\n size: number;\r\n viewer: DataView;\r\n array: Uint8Array;\r\n byteArray: Nullable<Float32Array | Uint16Array>;\r\n offset: DataCursor;\r\n width: number;\r\n height: number;\r\n channels: number;\r\n channelLineOffsets: IDecodeChannel;\r\n scanOrder: (value: number) => number;\r\n bytesPerLine: number;\r\n outLineWidth: number;\r\n lines: number;\r\n scanlineBlockSize: number;\r\n inputSize: Nullable<number>;\r\n type: number;\r\n uncompress: Nullable<(decoder: IEXRDecoder) => DataView>;\r\n getter: (dataView: DataView, offset: DataCursor) => number;\r\n format: number;\r\n outputChannels: number;\r\n decodeChannels: IDecodeChannel;\r\n blockCount: Nullable<number>;\r\n linearSpace: boolean;\r\n textureType: number;\r\n}\r\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./exrLoader.compression";
|
|
2
|
+
export * from "./exrLoader.compression.huf";
|
|
3
|
+
export * from "./exrLoader.compression.rle";
|
|
4
|
+
export * from "./exrLoader.configuration";
|
|
5
|
+
export * from "./exrLoader.core";
|
|
6
|
+
export * from "./exrLoader.decoder";
|
|
7
|
+
export * from "./exrLoader.header";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./exrLoader.compression.js";
|
|
2
|
+
export * from "./exrLoader.compression.huf.js";
|
|
3
|
+
export * from "./exrLoader.compression.rle.js";
|
|
4
|
+
export * from "./exrLoader.configuration.js";
|
|
5
|
+
export * from "./exrLoader.core.js";
|
|
6
|
+
export * from "./exrLoader.decoder.js";
|
|
7
|
+
export * from "./exrLoader.header.js";
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Materials/Textures/Loaders/EXR/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC","sourcesContent":["export * from \"./exrLoader.compression\";\r\nexport * from \"./exrLoader.compression.huf\";\r\nexport * from \"./exrLoader.compression.rle\";\r\nexport * from \"./exrLoader.configuration\";\r\nexport * from \"./exrLoader.core\";\r\nexport * from \"./exrLoader.decoder\";\r\nexport * from \"./exrLoader.header\";\r\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Nullable } from "../../../types";
|
|
2
2
|
import type { InternalTexture } from "../../../Materials/Textures/internalTexture";
|
|
3
|
-
import type { IInternalTextureLoader } from "
|
|
3
|
+
import type { IInternalTextureLoader } from "./internalTextureLoader";
|
|
4
4
|
import "../../../Engines/Extensions/engine.cubeTexture";
|
|
5
5
|
/**
|
|
6
6
|
* Loader for .basis file format
|
|
@@ -10,12 +10,6 @@ export declare class _BasisTextureLoader implements IInternalTextureLoader {
|
|
|
10
10
|
* Defines whether the loader supports cascade loading the different faces.
|
|
11
11
|
*/
|
|
12
12
|
readonly supportCascades = false;
|
|
13
|
-
/**
|
|
14
|
-
* This returns if the loader support the current file information.
|
|
15
|
-
* @param extension defines the file extension of the file being loaded
|
|
16
|
-
* @returns true if the loader can load the specified file
|
|
17
|
-
*/
|
|
18
|
-
canLoad(extension: string): boolean;
|
|
19
13
|
/**
|
|
20
14
|
* Uploads the cube texture data to the WebGL texture. It has already been bound.
|
|
21
15
|
* @param data contains the texture data
|