super-three 0.135.0 → 0.136.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/build/three.js +527 -332
- package/build/three.min.js +1 -1
- package/build/three.module.js +752 -370
- package/examples/fonts/tabler-icons/fonts/tabler-icons.svg +3966 -0
- package/examples/js/animation/CCDIKSolver.js +0 -1
- package/examples/js/animation/MMDPhysics.js +1 -3
- package/examples/js/controls/ArcballControls.js +38 -52
- package/examples/js/controls/TransformControls.js +24 -1
- package/examples/js/curves/CurveExtras.js +0 -2
- package/examples/js/effects/AsciiEffect.js +2 -9
- package/examples/js/exporters/GLTFExporter.js +1 -1
- package/examples/js/geometries/TeapotGeometry.js +0 -1
- package/examples/js/interactive/SelectionBox.js +2 -0
- package/examples/js/interactive/SelectionHelper.js +22 -7
- package/examples/js/lights/RectAreaLightUniformsLib.js +4 -0
- package/examples/js/loaders/AMFLoader.js +0 -2
- package/examples/js/loaders/ColladaLoader.js +1 -2
- package/examples/js/loaders/EXRLoader.js +185 -262
- package/examples/js/loaders/FBXLoader.js +3 -4
- package/examples/js/loaders/GLTFLoader.js +2 -2
- package/examples/js/loaders/HDRCubeTextureLoader.js +0 -8
- package/examples/js/loaders/KTX2Loader.js +11 -2
- package/examples/js/loaders/KTXLoader.js +1 -1
- package/examples/js/loaders/LDrawLoader.js +26 -30
- package/examples/js/loaders/LUT3dlLoader.js +2 -0
- package/examples/js/loaders/LUTCubeLoader.js +2 -0
- package/examples/js/loaders/MMDLoader.js +0 -1
- package/examples/js/loaders/NRRDLoader.js +9 -2
- package/examples/js/loaders/OBJLoader.js +0 -2
- package/examples/js/loaders/PLYLoader.js +1 -1
- package/examples/js/loaders/RGBELoader.js +0 -15
- package/examples/js/loaders/RGBMLoader.js +55 -5
- package/examples/js/loaders/SVGLoader.js +2 -2
- package/examples/js/loaders/VOXLoader.js +1 -0
- package/examples/js/loaders/VRMLLoader.js +2 -1
- package/examples/js/math/ImprovedNoise.js +1 -1
- package/examples/js/misc/GPUComputationRenderer.js +3 -1
- package/examples/js/objects/Lensflare.js +2 -10
- package/examples/js/objects/Reflector.js +7 -0
- package/examples/js/objects/Refractor.js +7 -0
- package/examples/js/objects/Sky.js +1 -1
- package/examples/js/objects/Water.js +2 -2
- package/examples/js/objects/Water2.js +4 -7
- package/examples/js/postprocessing/GlitchPass.js +3 -1
- package/examples/js/postprocessing/SSAOPass.js +1 -0
- package/examples/js/shaders/ConvolutionShader.js +0 -1
- package/examples/js/shaders/FXAAShader.js +1 -1
- package/examples/js/shaders/FilmShader.js +1 -1
- package/examples/js/shaders/GammaCorrectionShader.js +1 -1
- package/examples/js/shaders/HorizontalBlurShader.js +1 -2
- package/examples/js/shaders/SSRShader.js +1 -1
- package/examples/js/shaders/SSRrShader.js +1 -1
- package/examples/js/shaders/VerticalBlurShader.js +1 -2
- package/examples/js/utils/GeometryUtils.js +1 -1
- package/examples/js/utils/RoughnessMipmapper.js +18 -29
- package/examples/jsm/animation/CCDIKSolver.js +0 -1
- package/examples/jsm/animation/MMDPhysics.js +0 -2
- package/examples/jsm/controls/ArcballControls.js +27 -56
- package/examples/jsm/controls/TransformControls.js +24 -1
- package/examples/jsm/curves/CurveExtras.js +0 -2
- package/examples/jsm/effects/AsciiEffect.js +2 -9
- package/examples/jsm/exporters/GLTFExporter.js +1 -1
- package/examples/jsm/geometries/TeapotGeometry.js +0 -1
- package/examples/jsm/interactive/SelectionBox.js +1 -0
- package/examples/jsm/interactive/SelectionHelper.js +19 -7
- package/examples/jsm/libs/flow.module.js +256 -136
- package/examples/jsm/lights/RectAreaLightUniformsLib.js +7 -0
- package/examples/jsm/loaders/AMFLoader.js +0 -2
- package/examples/jsm/loaders/ColladaLoader.js +1 -2
- package/examples/jsm/loaders/EXRLoader.js +184 -293
- package/examples/jsm/loaders/FBXLoader.js +3 -4
- package/examples/jsm/loaders/GLTFLoader.js +2 -2
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +1 -14
- package/examples/jsm/loaders/KTX2Loader.js +13 -4
- package/examples/jsm/loaders/KTXLoader.js +1 -1
- package/examples/jsm/loaders/LDrawLoader.js +23 -24
- package/examples/jsm/loaders/LUT3dlLoader.js +2 -0
- package/examples/jsm/loaders/LUTCubeLoader.js +2 -0
- package/examples/jsm/loaders/MMDLoader.js +0 -1
- package/examples/jsm/loaders/NRRDLoader.js +10 -2
- package/examples/jsm/loaders/OBJLoader.js +0 -2
- package/examples/jsm/loaders/PLYLoader.js +1 -1
- package/examples/jsm/loaders/RGBELoader.js +0 -20
- package/examples/jsm/loaders/RGBMLoader.js +61 -7
- package/examples/jsm/loaders/SVGLoader.js +2 -2
- package/examples/jsm/loaders/TDSLoader.js +30 -9
- package/examples/jsm/loaders/VOXLoader.js +1 -0
- package/examples/jsm/loaders/VRMLLoader.js +2 -1
- package/examples/jsm/math/ImprovedNoise.js +1 -1
- package/examples/jsm/misc/GPUComputationRenderer.js +3 -1
- package/examples/jsm/node-editor/NodeEditor.js +23 -22
- package/examples/jsm/node-editor/examples/rim.json +1 -1
- package/examples/jsm/node-editor/materials/StandardMaterialEditor.js +48 -9
- package/examples/jsm/node-editor/utils/OscillatorEditor.js +1 -1
- package/examples/jsm/nodes/core/NodeBuilder.js +2 -2
- package/examples/jsm/nodes/materials/nodes/StandardNode.js +1 -0
- package/examples/jsm/nodes/math/MathNode.js +12 -0
- package/examples/jsm/nodes/misc/BumpMapNode.js +1 -1
- package/examples/jsm/nodes/misc/TextureCubeUVNode.js +1 -4
- package/examples/jsm/nodes/utils/ColorSpaceNode.js +1 -116
- package/examples/jsm/objects/Lensflare.js +3 -14
- package/examples/jsm/objects/Reflector.js +7 -0
- package/examples/jsm/objects/Refractor.js +7 -0
- package/examples/jsm/objects/Sky.js +1 -1
- package/examples/jsm/objects/Water.js +2 -2
- package/examples/jsm/objects/Water2.js +4 -8
- package/examples/jsm/postprocessing/GlitchPass.js +3 -1
- package/examples/jsm/postprocessing/SAOPass.js +1 -1
- package/examples/jsm/postprocessing/SSAOPass.js +1 -0
- package/examples/jsm/renderers/nodes/Nodes.js +1 -0
- package/examples/jsm/renderers/nodes/ShaderNode.js +7 -6
- package/examples/jsm/renderers/nodes/core/InputNode.js +1 -1
- package/examples/jsm/renderers/nodes/core/NodeBuilder.js +1 -1
- package/examples/jsm/renderers/nodes/display/ColorSpaceNode.js +26 -31
- package/examples/jsm/renderers/nodes/functions/BSDFs.js +2 -2
- package/examples/jsm/renderers/nodes/functions/PhysicalMaterialFunctions.js +27 -0
- package/examples/jsm/renderers/nodes/inputs/TextureNode.js +1 -1
- package/examples/jsm/renderers/nodes/math/MathNode.js +5 -3
- package/examples/jsm/renderers/nodes/math/OperatorNode.js +2 -2
- package/examples/jsm/renderers/nodes/utils/TimerNode.js +1 -1
- package/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.js +14 -14
- package/examples/jsm/renderers/webgpu/WebGPUBindings.js +7 -6
- package/examples/jsm/renderers/webgpu/WebGPURenderPipeline.js +1 -1
- package/examples/jsm/renderers/webgpu/WebGPURenderPipelines.js +42 -61
- package/examples/jsm/renderers/webgpu/WebGPURenderer.js +2 -2
- package/examples/jsm/renderers/webgpu/WebGPUTextureUtils.js +0 -1
- package/examples/jsm/renderers/webgpu/nodes/WebGPUNodeBuilder.js +30 -4
- package/examples/jsm/shaders/ConvolutionShader.js +0 -1
- package/examples/jsm/shaders/FXAAShader.js +1 -1
- package/examples/jsm/shaders/FilmShader.js +1 -1
- package/examples/jsm/shaders/GammaCorrectionShader.js +1 -1
- package/examples/jsm/shaders/HorizontalBlurShader.js +1 -2
- package/examples/jsm/shaders/SSRShader.js +1 -1
- package/examples/jsm/shaders/SSRrShader.js +1 -1
- package/examples/jsm/shaders/VerticalBlurShader.js +1 -2
- package/examples/jsm/utils/GeometryUtils.js +1 -1
- package/examples/jsm/utils/RoughnessMipmapper.js +19 -32
- package/examples/jsm/utils/WorkerPool.js +11 -11
- package/package.json +15 -9
- package/src/Three.Legacy.js +12 -0
- package/src/Three.js +1 -2
- package/src/constants.js +1 -7
- package/src/core/Object3D.js +1 -1
- package/src/extras/PMREMGenerator.js +19 -110
- package/src/extras/core/Interpolations.js +1 -1
- package/src/geometries/LatheGeometry.js +70 -47
- package/src/helpers/CameraHelper.js +1 -1
- package/src/loaders/FileLoader.js +23 -6
- package/src/math/Color.js +0 -38
- package/src/math/Ray.js +2 -2
- package/src/math/Sphere.js +10 -1
- package/src/objects/Skeleton.js +1 -0
- package/src/renderers/WebGLRenderer.js +23 -16
- package/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +2 -24
- package/src/renderers/shaders/ShaderChunk/encodings_pars_fragment.glsl.js +0 -47
- package/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +27 -1
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +10 -0
- package/src/renderers/webgl/WebGLCapabilities.js +0 -2
- package/src/renderers/webgl/WebGLMorphtargets.js +1 -0
- package/src/renderers/webgl/WebGLProgram.js +2 -19
- package/src/renderers/webgl/WebGLPrograms.js +191 -35
- package/src/renderers/webgl/WebGLRenderLists.js +4 -14
- package/src/renderers/webgl/WebGLShaderCache.js +120 -0
- package/src/renderers/webgl/WebGLState.js +45 -0
- package/src/renderers/webgl/WebGLTextures.js +195 -26
- package/src/renderers/webxr/WebXRManager.js +10 -3
- package/src/scenes/Scene.js +1 -1
- package/src/textures/DataTexture.js +0 -2
- package/src/textures/DataTexture2DArray.js +0 -2
- package/src/textures/DataTexture3D.js +0 -2
- package/src/textures/FramebufferTexture.js +25 -0
- package/src/utils.js +1 -37
|
@@ -106,39 +106,6 @@
|
|
|
106
106
|
const LOSSY_DCT = 1;
|
|
107
107
|
const RLE = 2;
|
|
108
108
|
const logBase = Math.pow( 2.7182818, 2.2 );
|
|
109
|
-
var tmpDataView = new DataView( new ArrayBuffer( 8 ) );
|
|
110
|
-
|
|
111
|
-
function frexp( value ) {
|
|
112
|
-
|
|
113
|
-
if ( value === 0 ) return [ value, 0 ];
|
|
114
|
-
tmpDataView.setFloat64( 0, value );
|
|
115
|
-
var bits = tmpDataView.getUint32( 0 ) >>> 20 & 0x7FF;
|
|
116
|
-
|
|
117
|
-
if ( bits === 0 ) {
|
|
118
|
-
|
|
119
|
-
// denormal
|
|
120
|
-
tmpDataView.setFloat64( 0, value * Math.pow( 2, 64 ) ); // exp + 64
|
|
121
|
-
|
|
122
|
-
bits = ( tmpDataView.getUint32( 0 ) >>> 20 & 0x7FF ) - 64;
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
var exponent = bits - 1022;
|
|
127
|
-
var mantissa = ldexp( value, - exponent );
|
|
128
|
-
return [ mantissa, exponent ];
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function ldexp( mantissa, exponent ) {
|
|
133
|
-
|
|
134
|
-
var steps = Math.min( 3, Math.ceil( Math.abs( exponent ) / 1023 ) );
|
|
135
|
-
var result = mantissa;
|
|
136
|
-
|
|
137
|
-
for ( var i = 0; i < steps; i ++ ) result *= Math.pow( 2, Math.floor( ( exponent + i ) / steps ) );
|
|
138
|
-
|
|
139
|
-
return result;
|
|
140
|
-
|
|
141
|
-
}
|
|
142
109
|
|
|
143
110
|
function reverseLutFromBitmap( bitmap, lut ) {
|
|
144
111
|
|
|
@@ -1207,8 +1174,7 @@
|
|
|
1207
1174
|
var inOffset = {
|
|
1208
1175
|
value: info.offset.value
|
|
1209
1176
|
};
|
|
1210
|
-
var
|
|
1211
|
-
var outBuffer = new Uint16Array( tmpBufSize );
|
|
1177
|
+
var outBuffer = new Uint16Array( info.width * info.scanlineBlockSize * ( info.channels * info.type ) );
|
|
1212
1178
|
var bitmap = new Uint8Array( BITMAP_SIZE ); // Setup channel info
|
|
1213
1179
|
|
|
1214
1180
|
var outBufferEnd = 0;
|
|
@@ -1365,7 +1331,7 @@
|
|
|
1365
1331
|
var inOffset = {
|
|
1366
1332
|
value: info.offset.value
|
|
1367
1333
|
};
|
|
1368
|
-
var outBuffer = new Uint8Array( info.width * info.lines * (
|
|
1334
|
+
var outBuffer = new Uint8Array( info.width * info.lines * ( info.channels * info.type * INT16_SIZE ) ); // Read compression header information
|
|
1369
1335
|
|
|
1370
1336
|
var dwaHeader = {
|
|
1371
1337
|
version: parseInt64( inDataView, inOffset ),
|
|
@@ -1592,14 +1558,6 @@
|
|
|
1592
1558
|
|
|
1593
1559
|
}
|
|
1594
1560
|
|
|
1595
|
-
function parseUlong( dataView, offset ) {
|
|
1596
|
-
|
|
1597
|
-
var uLong = dataView.getUint32( 0, true );
|
|
1598
|
-
offset.value = offset.value + ULONG_SIZE;
|
|
1599
|
-
return uLong;
|
|
1600
|
-
|
|
1601
|
-
}
|
|
1602
|
-
|
|
1603
1561
|
function parseRational( dataView, offset ) {
|
|
1604
1562
|
|
|
1605
1563
|
var x = parseInt32( dataView, offset );
|
|
@@ -1857,283 +1815,266 @@
|
|
|
1857
1815
|
|
|
1858
1816
|
}
|
|
1859
1817
|
|
|
1860
|
-
|
|
1861
|
-
var uInt8Array = new Uint8Array( buffer );
|
|
1862
|
-
var EXRHeader = {};
|
|
1863
|
-
bufferDataView.getUint32( 0, true ); // magic
|
|
1864
|
-
|
|
1865
|
-
bufferDataView.getUint8( 4, true ); // versionByteZero
|
|
1866
|
-
|
|
1867
|
-
bufferDataView.getUint8( 5, true ); // fullMask
|
|
1868
|
-
// start of header
|
|
1869
|
-
|
|
1870
|
-
var offset = {
|
|
1871
|
-
value: 8
|
|
1872
|
-
}; // start at 8, after magic stuff
|
|
1873
|
-
|
|
1874
|
-
var keepReading = true;
|
|
1818
|
+
function parseHeader( dataView, buffer, offset ) {
|
|
1875
1819
|
|
|
1876
|
-
|
|
1820
|
+
const EXRHeader = {};
|
|
1821
|
+
if ( dataView.getUint32( 0, true ) != 20000630 ) // magic
|
|
1822
|
+
throw 'THREE.EXRLoader: provided file doesn\'t appear to be in OpenEXR format.';
|
|
1823
|
+
EXRHeader.version = dataView.getUint8( 4, true );
|
|
1824
|
+
const spec = dataView.getUint8( 5, true ); // fullMask
|
|
1877
1825
|
|
|
1878
|
-
|
|
1826
|
+
EXRHeader.spec = {
|
|
1827
|
+
singleTile: !! ( spec & 1 ),
|
|
1828
|
+
longName: !! ( spec & 2 ),
|
|
1829
|
+
deepFormat: !! ( spec & 4 ),
|
|
1830
|
+
multiPart: !! ( spec & 8 )
|
|
1831
|
+
}; // start of header
|
|
1879
1832
|
|
|
1880
|
-
|
|
1833
|
+
offset.value = 8; // start at 8 - after pre-amble
|
|
1881
1834
|
|
|
1882
|
-
|
|
1835
|
+
var keepReading = true;
|
|
1883
1836
|
|
|
1884
|
-
|
|
1837
|
+
while ( keepReading ) {
|
|
1885
1838
|
|
|
1886
|
-
var
|
|
1887
|
-
var attributeSize = parseUint32( bufferDataView, offset );
|
|
1888
|
-
var attributeValue = parseValue( bufferDataView, buffer, offset, attributeType, attributeSize );
|
|
1839
|
+
var attributeName = parseNullTerminatedString( buffer, offset );
|
|
1889
1840
|
|
|
1890
|
-
if (
|
|
1841
|
+
if ( attributeName == 0 ) {
|
|
1891
1842
|
|
|
1892
|
-
|
|
1843
|
+
keepReading = false;
|
|
1893
1844
|
|
|
1894
1845
|
} else {
|
|
1895
1846
|
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
}
|
|
1901
|
-
|
|
1902
|
-
} // offsets
|
|
1847
|
+
var attributeType = parseNullTerminatedString( buffer, offset );
|
|
1848
|
+
var attributeSize = parseUint32( dataView, offset );
|
|
1849
|
+
var attributeValue = parseValue( dataView, buffer, offset, attributeType, attributeSize );
|
|
1903
1850
|
|
|
1851
|
+
if ( attributeValue === undefined ) {
|
|
1904
1852
|
|
|
1905
|
-
|
|
1906
|
-
var uncompress;
|
|
1907
|
-
var scanlineBlockSize;
|
|
1853
|
+
console.warn( `EXRLoader.parse: skipped unknown header attribute type \'${attributeType}\'.` );
|
|
1908
1854
|
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
case 'NO_COMPRESSION':
|
|
1912
|
-
scanlineBlockSize = 1;
|
|
1913
|
-
uncompress = uncompressRAW;
|
|
1914
|
-
break;
|
|
1855
|
+
} else {
|
|
1915
1856
|
|
|
1916
|
-
|
|
1917
|
-
scanlineBlockSize = 1;
|
|
1918
|
-
uncompress = uncompressRLE;
|
|
1919
|
-
break;
|
|
1857
|
+
EXRHeader[ attributeName ] = attributeValue;
|
|
1920
1858
|
|
|
1921
|
-
|
|
1922
|
-
scanlineBlockSize = 1;
|
|
1923
|
-
uncompress = uncompressZIP;
|
|
1924
|
-
break;
|
|
1859
|
+
}
|
|
1925
1860
|
|
|
1926
|
-
|
|
1927
|
-
scanlineBlockSize = 16;
|
|
1928
|
-
uncompress = uncompressZIP;
|
|
1929
|
-
break;
|
|
1861
|
+
}
|
|
1930
1862
|
|
|
1931
|
-
|
|
1932
|
-
scanlineBlockSize = 32;
|
|
1933
|
-
uncompress = uncompressPIZ;
|
|
1934
|
-
break;
|
|
1863
|
+
}
|
|
1935
1864
|
|
|
1936
|
-
|
|
1937
|
-
scanlineBlockSize = 16;
|
|
1938
|
-
uncompress = uncompressPXR;
|
|
1939
|
-
break;
|
|
1865
|
+
if ( spec != 0 ) {
|
|
1940
1866
|
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
uncompress = uncompressDWA;
|
|
1944
|
-
break;
|
|
1867
|
+
console.error( 'EXRHeader:', EXRHeader );
|
|
1868
|
+
throw 'THREE.EXRLoader: provided file is currently unsupported.';
|
|
1945
1869
|
|
|
1946
|
-
|
|
1947
|
-
scanlineBlockSize = 256;
|
|
1948
|
-
uncompress = uncompressDWA;
|
|
1949
|
-
break;
|
|
1870
|
+
}
|
|
1950
1871
|
|
|
1951
|
-
|
|
1952
|
-
throw 'EXRLoader.parse: ' + EXRHeader.compression + ' is unsupported';
|
|
1872
|
+
return EXRHeader;
|
|
1953
1873
|
|
|
1954
1874
|
}
|
|
1955
1875
|
|
|
1956
|
-
|
|
1957
|
-
var getValue; // mixed pixelType not supported
|
|
1876
|
+
function setupDecoder( EXRHeader, dataView, uInt8Array, offset, outputType ) {
|
|
1958
1877
|
|
|
1959
|
-
|
|
1878
|
+
const EXRDecoder = {
|
|
1879
|
+
size: 0,
|
|
1880
|
+
viewer: dataView,
|
|
1881
|
+
array: uInt8Array,
|
|
1882
|
+
offset: offset,
|
|
1883
|
+
width: EXRHeader.dataWindow.xMax - EXRHeader.dataWindow.xMin + 1,
|
|
1884
|
+
height: EXRHeader.dataWindow.yMax - EXRHeader.dataWindow.yMin + 1,
|
|
1885
|
+
channels: EXRHeader.channels.length,
|
|
1886
|
+
bytesPerLine: null,
|
|
1887
|
+
lines: null,
|
|
1888
|
+
inputSize: null,
|
|
1889
|
+
type: EXRHeader.channels[ 0 ].pixelType,
|
|
1890
|
+
uncompress: null,
|
|
1891
|
+
getter: null,
|
|
1892
|
+
format: null,
|
|
1893
|
+
encoding: null
|
|
1894
|
+
};
|
|
1960
1895
|
|
|
1961
|
-
|
|
1896
|
+
switch ( EXRHeader.compression ) {
|
|
1962
1897
|
|
|
1963
|
-
|
|
1964
|
-
|
|
1898
|
+
case 'NO_COMPRESSION':
|
|
1899
|
+
EXRDecoder.lines = 1;
|
|
1900
|
+
EXRDecoder.uncompress = uncompressRAW;
|
|
1901
|
+
break;
|
|
1965
1902
|
|
|
1966
|
-
case
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
size_t = INT16_SIZE;
|
|
1903
|
+
case 'RLE_COMPRESSION':
|
|
1904
|
+
EXRDecoder.lines = 1;
|
|
1905
|
+
EXRDecoder.uncompress = uncompressRLE;
|
|
1970
1906
|
break;
|
|
1971
1907
|
|
|
1972
|
-
case
|
|
1973
|
-
|
|
1974
|
-
|
|
1908
|
+
case 'ZIPS_COMPRESSION':
|
|
1909
|
+
EXRDecoder.lines = 1;
|
|
1910
|
+
EXRDecoder.uncompress = uncompressZIP;
|
|
1975
1911
|
break;
|
|
1976
1912
|
|
|
1977
|
-
|
|
1913
|
+
case 'ZIP_COMPRESSION':
|
|
1914
|
+
EXRDecoder.lines = 16;
|
|
1915
|
+
EXRDecoder.uncompress = uncompressZIP;
|
|
1916
|
+
break;
|
|
1978
1917
|
|
|
1979
|
-
|
|
1918
|
+
case 'PIZ_COMPRESSION':
|
|
1919
|
+
EXRDecoder.lines = 32;
|
|
1920
|
+
EXRDecoder.uncompress = uncompressPIZ;
|
|
1921
|
+
break;
|
|
1980
1922
|
|
|
1981
|
-
|
|
1982
|
-
|
|
1923
|
+
case 'PXR24_COMPRESSION':
|
|
1924
|
+
EXRDecoder.lines = 16;
|
|
1925
|
+
EXRDecoder.uncompress = uncompressPXR;
|
|
1926
|
+
break;
|
|
1983
1927
|
|
|
1984
|
-
case
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
size_t = FLOAT32_SIZE;
|
|
1928
|
+
case 'DWAA_COMPRESSION':
|
|
1929
|
+
EXRDecoder.lines = 32;
|
|
1930
|
+
EXRDecoder.uncompress = uncompressDWA;
|
|
1988
1931
|
break;
|
|
1989
1932
|
|
|
1990
|
-
case
|
|
1991
|
-
|
|
1992
|
-
|
|
1933
|
+
case 'DWAB_COMPRESSION':
|
|
1934
|
+
EXRDecoder.lines = 256;
|
|
1935
|
+
EXRDecoder.uncompress = uncompressDWA;
|
|
1936
|
+
break;
|
|
1937
|
+
|
|
1938
|
+
default:
|
|
1939
|
+
throw 'EXRLoader.parse: ' + EXRHeader.compression + ' is unsupported';
|
|
1993
1940
|
|
|
1994
1941
|
}
|
|
1995
1942
|
|
|
1996
|
-
|
|
1943
|
+
EXRDecoder.scanlineBlockSize = EXRDecoder.lines;
|
|
1997
1944
|
|
|
1998
|
-
|
|
1945
|
+
if ( EXRDecoder.type == 1 ) {
|
|
1999
1946
|
|
|
2000
|
-
|
|
1947
|
+
// half
|
|
1948
|
+
switch ( outputType ) {
|
|
2001
1949
|
|
|
2002
|
-
|
|
1950
|
+
case THREE.FloatType:
|
|
1951
|
+
EXRDecoder.getter = parseFloat16;
|
|
1952
|
+
EXRDecoder.inputSize = INT16_SIZE;
|
|
1953
|
+
break;
|
|
2003
1954
|
|
|
2004
|
-
|
|
1955
|
+
case THREE.HalfFloatType:
|
|
1956
|
+
EXRDecoder.getter = parseUint16;
|
|
1957
|
+
EXRDecoder.inputSize = INT16_SIZE;
|
|
1958
|
+
break;
|
|
2005
1959
|
|
|
2006
|
-
|
|
1960
|
+
}
|
|
2007
1961
|
|
|
2008
|
-
|
|
1962
|
+
} else if ( EXRDecoder.type == 2 ) {
|
|
2009
1963
|
|
|
1964
|
+
// float
|
|
1965
|
+
switch ( outputType ) {
|
|
2010
1966
|
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
1967
|
+
case THREE.FloatType:
|
|
1968
|
+
EXRDecoder.getter = parseFloat32;
|
|
1969
|
+
EXRDecoder.inputSize = FLOAT32_SIZE;
|
|
1970
|
+
break;
|
|
2014
1971
|
|
|
2015
|
-
|
|
2016
|
-
|
|
1972
|
+
case THREE.HalfFloatType:
|
|
1973
|
+
EXRDecoder.getter = decodeFloat32;
|
|
1974
|
+
EXRDecoder.inputSize = FLOAT32_SIZE;
|
|
2017
1975
|
|
|
2018
|
-
|
|
1976
|
+
}
|
|
2019
1977
|
|
|
2020
|
-
|
|
2021
|
-
case THREE.FloatType:
|
|
2022
|
-
var byteArray = new Float32Array( size );
|
|
1978
|
+
} else {
|
|
2023
1979
|
|
|
2024
|
-
|
|
1980
|
+
throw 'EXRLoader.parse: unsupported pixelType ' + EXRDecoder.type + ' for ' + EXRHeader.compression + '.';
|
|
2025
1981
|
|
|
2026
|
-
|
|
1982
|
+
}
|
|
2027
1983
|
|
|
2028
|
-
|
|
1984
|
+
EXRDecoder.blockCount = ( EXRHeader.dataWindow.yMax + 1 ) / EXRDecoder.scanlineBlockSize;
|
|
2029
1985
|
|
|
2030
|
-
|
|
1986
|
+
for ( var i = 0; i < EXRDecoder.blockCount; i ++ ) parseInt64( dataView, offset ); // scanlineOffset
|
|
1987
|
+
// we should be passed the scanline offset table, ready to start reading pixel data.
|
|
1988
|
+
// RGB images will be converted to RGBA format, preventing software emulation in select devices.
|
|
2031
1989
|
|
|
2032
|
-
case THREE.HalfFloatType:
|
|
2033
|
-
var byteArray = new Uint16Array( size );
|
|
2034
1990
|
|
|
2035
|
-
|
|
1991
|
+
EXRDecoder.outputChannels = EXRDecoder.channels == 3 ? 4 : EXRDecoder.channels;
|
|
1992
|
+
const size = EXRDecoder.width * EXRDecoder.height * EXRDecoder.outputChannels;
|
|
2036
1993
|
|
|
2037
|
-
|
|
1994
|
+
switch ( outputType ) {
|
|
2038
1995
|
|
|
2039
|
-
|
|
1996
|
+
case THREE.FloatType:
|
|
1997
|
+
EXRDecoder.byteArray = new Float32Array( size ); // Fill initially with 1s for the alpha value if the texture is not RGBA, RGB values will be overwritten
|
|
2040
1998
|
|
|
2041
|
-
|
|
1999
|
+
if ( EXRDecoder.channels < EXRDecoder.outputChannels ) EXRDecoder.byteArray.fill( 1, 0, size );
|
|
2000
|
+
break;
|
|
2042
2001
|
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2002
|
+
case THREE.HalfFloatType:
|
|
2003
|
+
EXRDecoder.byteArray = new Uint16Array( size );
|
|
2004
|
+
if ( EXRDecoder.channels < EXRDecoder.outputChannels ) EXRDecoder.byteArray.fill( 0x3C00, 0, size ); // Uint16Array holds half float data, 0x3C00 is 1
|
|
2046
2005
|
|
|
2047
|
-
|
|
2006
|
+
break;
|
|
2048
2007
|
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
B: 2,
|
|
2053
|
-
A: 3
|
|
2054
|
-
};
|
|
2055
|
-
var compressionInfo = {
|
|
2056
|
-
size: 0,
|
|
2057
|
-
width: width,
|
|
2058
|
-
lines: scanlineBlockSize,
|
|
2059
|
-
offset: offset,
|
|
2060
|
-
array: uInt8Array,
|
|
2061
|
-
viewer: bufferDataView,
|
|
2062
|
-
type: pixelType,
|
|
2063
|
-
channels: EXRHeader.channels.length
|
|
2064
|
-
};
|
|
2065
|
-
var line;
|
|
2066
|
-
var size;
|
|
2067
|
-
var viewer;
|
|
2068
|
-
var tmpOffset = {
|
|
2069
|
-
value: 0
|
|
2070
|
-
};
|
|
2008
|
+
default:
|
|
2009
|
+
console.error( 'THREE.EXRLoader: unsupported type: ', outputType );
|
|
2010
|
+
break;
|
|
2071
2011
|
|
|
2072
|
-
|
|
2012
|
+
}
|
|
2073
2013
|
|
|
2074
|
-
|
|
2014
|
+
EXRDecoder.bytesPerLine = EXRDecoder.width * EXRDecoder.inputSize * EXRDecoder.channels;
|
|
2075
2015
|
|
|
2076
|
-
|
|
2016
|
+
if ( EXRDecoder.outputChannels == 4 ) {
|
|
2077
2017
|
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
compressionInfo.size = size;
|
|
2081
|
-
viewer = uncompress( compressionInfo );
|
|
2082
|
-
offset.value += size;
|
|
2018
|
+
EXRDecoder.format = THREE.RGBAFormat;
|
|
2019
|
+
EXRDecoder.encoding = THREE.LinearEncoding;
|
|
2083
2020
|
|
|
2084
|
-
|
|
2021
|
+
} else {
|
|
2085
2022
|
|
|
2086
|
-
|
|
2087
|
-
|
|
2023
|
+
EXRDecoder.format = THREE.RedFormat;
|
|
2024
|
+
EXRDecoder.encoding = THREE.LinearEncoding;
|
|
2088
2025
|
|
|
2089
|
-
|
|
2026
|
+
}
|
|
2090
2027
|
|
|
2091
|
-
|
|
2028
|
+
return EXRDecoder;
|
|
2092
2029
|
|
|
2093
|
-
|
|
2030
|
+
} // start parsing file [START]
|
|
2094
2031
|
|
|
2095
|
-
var idx = line_y * ( EXRHeader.channels.length * width ) + channelID * width + x;
|
|
2096
|
-
tmpOffset.value = idx * size_t;
|
|
2097
|
-
var val = getValue( viewer, tmpOffset );
|
|
2098
|
-
byteArray[ ( height - 1 - true_y ) * ( width * numChannels ) + x * numChannels + cOff ] = val;
|
|
2099
2032
|
|
|
2100
|
-
|
|
2033
|
+
const bufferDataView = new DataView( buffer );
|
|
2034
|
+
const uInt8Array = new Uint8Array( buffer );
|
|
2035
|
+
const offset = {
|
|
2036
|
+
value: 0
|
|
2037
|
+
}; // get header information and validate format.
|
|
2101
2038
|
|
|
2102
|
-
|
|
2039
|
+
const EXRHeader = parseHeader( bufferDataView, buffer, offset ); // get input compression information and prepare decoding.
|
|
2103
2040
|
|
|
2104
|
-
|
|
2041
|
+
const EXRDecoder = setupDecoder( EXRHeader, bufferDataView, uInt8Array, offset, this.type );
|
|
2042
|
+
const tmpOffset = {
|
|
2043
|
+
value: 0
|
|
2044
|
+
};
|
|
2045
|
+
const channelOffsets = {
|
|
2046
|
+
R: 0,
|
|
2047
|
+
G: 1,
|
|
2048
|
+
B: 2,
|
|
2049
|
+
A: 3,
|
|
2050
|
+
Y: 0
|
|
2051
|
+
};
|
|
2105
2052
|
|
|
2106
|
-
|
|
2053
|
+
for ( let scanlineBlockIdx = 0; scanlineBlockIdx < EXRDecoder.height / EXRDecoder.scanlineBlockSize; scanlineBlockIdx ++ ) {
|
|
2107
2054
|
|
|
2108
|
-
|
|
2055
|
+
const line = parseUint32( bufferDataView, offset ); // line_no
|
|
2109
2056
|
|
|
2110
|
-
|
|
2111
|
-
const size = byteArray.length;
|
|
2112
|
-
const RGBEArray = new Uint8Array( size );
|
|
2057
|
+
EXRDecoder.size = parseUint32( bufferDataView, offset ); // data_len
|
|
2113
2058
|
|
|
2114
|
-
|
|
2059
|
+
EXRDecoder.lines = line + EXRDecoder.scanlineBlockSize > EXRDecoder.height ? EXRDecoder.height - line : EXRDecoder.scanlineBlockSize;
|
|
2060
|
+
const isCompressed = EXRDecoder.size < EXRDecoder.lines * EXRDecoder.bytesPerLine;
|
|
2061
|
+
const viewer = isCompressed ? EXRDecoder.uncompress( EXRDecoder ) : uncompressRAW( EXRDecoder );
|
|
2062
|
+
offset.value += EXRDecoder.size;
|
|
2115
2063
|
|
|
2116
|
-
|
|
2064
|
+
for ( let line_y = 0; line_y < EXRDecoder.scanlineBlockSize; line_y ++ ) {
|
|
2117
2065
|
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
const green = byteArray[ i + 1 ];
|
|
2121
|
-
const blue = byteArray[ i + 2 ];
|
|
2122
|
-
v = red > green ? red : green;
|
|
2123
|
-
v = blue > v ? blue : v;
|
|
2066
|
+
const true_y = line_y + scanlineBlockIdx * EXRDecoder.scanlineBlockSize;
|
|
2067
|
+
if ( true_y >= EXRDecoder.height ) break;
|
|
2124
2068
|
|
|
2125
|
-
|
|
2069
|
+
for ( let channelID = 0; channelID < EXRDecoder.channels; channelID ++ ) {
|
|
2126
2070
|
|
|
2127
|
-
|
|
2071
|
+
const cOff = channelOffsets[ EXRHeader.channels[ channelID ].name ];
|
|
2128
2072
|
|
|
2129
|
-
|
|
2073
|
+
for ( let x = 0; x < EXRDecoder.width; x ++ ) {
|
|
2130
2074
|
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
RGBEArray[ i + 1 ] = green * v;
|
|
2135
|
-
RGBEArray[ i + 2 ] = blue * v;
|
|
2136
|
-
RGBEArray[ i + 3 ] = res[ 1 ] + 128;
|
|
2075
|
+
tmpOffset.value = ( line_y * ( EXRDecoder.channels * EXRDecoder.width ) + channelID * EXRDecoder.width + x ) * EXRDecoder.inputSize;
|
|
2076
|
+
const outIndex = ( EXRDecoder.height - 1 - true_y ) * ( EXRDecoder.width * EXRDecoder.outputChannels ) + x * EXRDecoder.outputChannels + cOff;
|
|
2077
|
+
EXRDecoder.byteArray[ outIndex ] = EXRDecoder.getter( viewer, tmpOffset );
|
|
2137
2078
|
|
|
2138
2079
|
}
|
|
2139
2080
|
|
|
@@ -2141,17 +2082,15 @@
|
|
|
2141
2082
|
|
|
2142
2083
|
}
|
|
2143
2084
|
|
|
2144
|
-
byteArray = RGBEArray;
|
|
2145
|
-
|
|
2146
2085
|
}
|
|
2147
2086
|
|
|
2148
|
-
const format = this.type === THREE.UnsignedByteType ? THREE.RGBEFormat : numChannels === 4 ? THREE.RGBAFormat : THREE.RGBFormat;
|
|
2149
2087
|
return {
|
|
2150
2088
|
header: EXRHeader,
|
|
2151
|
-
width: width,
|
|
2152
|
-
height: height,
|
|
2153
|
-
data: byteArray,
|
|
2154
|
-
format: format,
|
|
2089
|
+
width: EXRDecoder.width,
|
|
2090
|
+
height: EXRDecoder.height,
|
|
2091
|
+
data: EXRDecoder.byteArray,
|
|
2092
|
+
format: EXRDecoder.format,
|
|
2093
|
+
encoding: EXRDecoder.encoding,
|
|
2155
2094
|
type: this.type
|
|
2156
2095
|
};
|
|
2157
2096
|
|
|
@@ -2168,27 +2107,11 @@
|
|
|
2168
2107
|
|
|
2169
2108
|
function onLoadCallback( texture, texData ) {
|
|
2170
2109
|
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
texture.magFilter = THREE.NearestFilter;
|
|
2177
|
-
texture.generateMipmaps = false;
|
|
2178
|
-
texture.flipY = false;
|
|
2179
|
-
break;
|
|
2180
|
-
|
|
2181
|
-
case THREE.FloatType:
|
|
2182
|
-
case THREE.HalfFloatType:
|
|
2183
|
-
texture.encoding = THREE.LinearEncoding;
|
|
2184
|
-
texture.minFilter = THREE.LinearFilter;
|
|
2185
|
-
texture.magFilter = THREE.LinearFilter;
|
|
2186
|
-
texture.generateMipmaps = false;
|
|
2187
|
-
texture.flipY = false;
|
|
2188
|
-
break;
|
|
2189
|
-
|
|
2190
|
-
}
|
|
2191
|
-
|
|
2110
|
+
texture.encoding = texData.encoding;
|
|
2111
|
+
texture.minFilter = THREE.LinearFilter;
|
|
2112
|
+
texture.magFilter = THREE.LinearFilter;
|
|
2113
|
+
texture.generateMipmaps = false;
|
|
2114
|
+
texture.flipY = false;
|
|
2192
2115
|
if ( onLoad ) onLoad( texture, texData );
|
|
2193
2116
|
|
|
2194
2117
|
}
|
|
@@ -9,11 +9,10 @@
|
|
|
9
9
|
* Morph normals / blend shape normals
|
|
10
10
|
*
|
|
11
11
|
* FBX format references:
|
|
12
|
-
* https://
|
|
13
|
-
* http://help.autodesk.com/view/FBX/2017/ENU/?guid=__cpp_ref_index_html (C++ SDK reference)
|
|
12
|
+
* https://help.autodesk.com/view/FBX/2017/ENU/?guid=__cpp_ref_index_html (C++ SDK reference)
|
|
14
13
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* Binary format specification:
|
|
15
|
+
* https://code.blender.org/2013/08/fbx-binary-file-format-specification/
|
|
17
16
|
*/
|
|
18
17
|
|
|
19
18
|
let fbxTree;
|
|
@@ -1310,7 +1310,7 @@
|
|
|
1310
1310
|
/**
|
|
1311
1311
|
* Specular-Glossiness Extension
|
|
1312
1312
|
*
|
|
1313
|
-
* Specification: https://github.com/KhronosGroup/glTF/tree/
|
|
1313
|
+
* Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Archived/KHR_materials_pbrSpecularGlossiness
|
|
1314
1314
|
*/
|
|
1315
1315
|
|
|
1316
1316
|
/**
|
|
@@ -2006,7 +2006,7 @@
|
|
|
2006
2006
|
this.nodeNamesUsed = {}; // Use an THREE.ImageBitmapLoader if imageBitmaps are supported. Moves much of the
|
|
2007
2007
|
// expensive work of uploading a texture to the GPU off the main thread.
|
|
2008
2008
|
|
|
2009
|
-
if ( typeof createImageBitmap !== 'undefined' && /Firefox/.test( navigator.userAgent ) === false ) {
|
|
2009
|
+
if ( typeof createImageBitmap !== 'undefined' && /Firefox|Safari/.test( navigator.userAgent ) === false ) {
|
|
2010
2010
|
|
|
2011
2011
|
this.textureLoader = new THREE.ImageBitmapLoader( this.options.manager );
|
|
2012
2012
|
|
|
@@ -28,14 +28,6 @@
|
|
|
28
28
|
|
|
29
29
|
switch ( texture.type ) {
|
|
30
30
|
|
|
31
|
-
case THREE.UnsignedByteType:
|
|
32
|
-
texture.encoding = THREE.RGBEEncoding;
|
|
33
|
-
texture.format = THREE.RGBAFormat;
|
|
34
|
-
texture.minFilter = THREE.NearestFilter;
|
|
35
|
-
texture.magFilter = THREE.NearestFilter;
|
|
36
|
-
texture.generateMipmaps = false;
|
|
37
|
-
break;
|
|
38
|
-
|
|
39
31
|
case THREE.FloatType:
|
|
40
32
|
texture.encoding = THREE.LinearEncoding;
|
|
41
33
|
texture.format = THREE.RGBFormat;
|
|
@@ -63,6 +63,14 @@
|
|
|
63
63
|
bptcSupported: renderer.extensions.has( 'EXT_texture_compression_bptc' ),
|
|
64
64
|
pvrtcSupported: renderer.extensions.has( 'WEBGL_compressed_texture_pvrtc' ) || renderer.extensions.has( 'WEBKIT_WEBGL_compressed_texture_pvrtc' )
|
|
65
65
|
};
|
|
66
|
+
|
|
67
|
+
if ( renderer.capabilities.isWebGL2 ) {
|
|
68
|
+
|
|
69
|
+
// https://github.com/mrdoob/three.js/pull/22928
|
|
70
|
+
this.workerConfig.etc1Supported = false;
|
|
71
|
+
|
|
72
|
+
}
|
|
73
|
+
|
|
66
74
|
return this;
|
|
67
75
|
|
|
68
76
|
}
|
|
@@ -487,8 +495,8 @@
|
|
|
487
495
|
}, {
|
|
488
496
|
if: 'etc1Supported',
|
|
489
497
|
basisFormat: [ BasisFormat.ETC1S, BasisFormat.UASTC_4x4 ],
|
|
490
|
-
transcoderFormat: [ TranscoderFormat.ETC1
|
|
491
|
-
engineFormat: [ EngineFormat.RGB_ETC1_Format
|
|
498
|
+
transcoderFormat: [ TranscoderFormat.ETC1 ],
|
|
499
|
+
engineFormat: [ EngineFormat.RGB_ETC1_Format ],
|
|
492
500
|
priorityETC1S: 2,
|
|
493
501
|
priorityUASTC: 4,
|
|
494
502
|
needsPowerOfTwo: false
|
|
@@ -523,6 +531,7 @@
|
|
|
523
531
|
const opt = options[ i ];
|
|
524
532
|
if ( ! config[ opt.if ] ) continue;
|
|
525
533
|
if ( ! opt.basisFormat.includes( basisFormat ) ) continue;
|
|
534
|
+
if ( hasAlpha && opt.transcoderFormat.length < 2 ) continue;
|
|
526
535
|
if ( opt.needsPowerOfTwo && ! ( isPowerOfTwo( width ) && isPowerOfTwo( height ) ) ) continue;
|
|
527
536
|
transcoderFormat = opt.transcoderFormat[ hasAlpha ? 1 : 0 ];
|
|
528
537
|
engineFormat = opt.engineFormat[ hasAlpha ? 1 : 0 ];
|