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
|
@@ -7,11 +7,7 @@ import {
|
|
|
7
7
|
LinearEncoding,
|
|
8
8
|
LinearFilter,
|
|
9
9
|
Loader,
|
|
10
|
-
|
|
11
|
-
RGBAFormat,
|
|
12
|
-
RGBEEncoding,
|
|
13
|
-
RGBFormat,
|
|
14
|
-
UnsignedByteType
|
|
10
|
+
RGBFormat
|
|
15
11
|
} from 'three';
|
|
16
12
|
import { RGBELoader } from '../loaders/RGBELoader.js';
|
|
17
13
|
|
|
@@ -47,15 +43,6 @@ class HDRCubeTextureLoader extends Loader {
|
|
|
47
43
|
|
|
48
44
|
switch ( texture.type ) {
|
|
49
45
|
|
|
50
|
-
case UnsignedByteType:
|
|
51
|
-
|
|
52
|
-
texture.encoding = RGBEEncoding;
|
|
53
|
-
texture.format = RGBAFormat;
|
|
54
|
-
texture.minFilter = NearestFilter;
|
|
55
|
-
texture.magFilter = NearestFilter;
|
|
56
|
-
texture.generateMipmaps = false;
|
|
57
|
-
break;
|
|
58
|
-
|
|
59
46
|
case FloatType:
|
|
60
47
|
|
|
61
48
|
texture.encoding = LinearEncoding;
|
|
@@ -94,6 +94,14 @@ class KTX2Loader extends Loader {
|
|
|
94
94
|
|| renderer.extensions.has( 'WEBKIT_WEBGL_compressed_texture_pvrtc' )
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
+
|
|
98
|
+
if ( renderer.capabilities.isWebGL2 ) {
|
|
99
|
+
|
|
100
|
+
// https://github.com/mrdoob/three.js/pull/22928
|
|
101
|
+
this.workerConfig.etc1Supported = false;
|
|
102
|
+
|
|
103
|
+
}
|
|
104
|
+
|
|
97
105
|
return this;
|
|
98
106
|
|
|
99
107
|
}
|
|
@@ -169,7 +177,7 @@ class KTX2Loader extends Loader {
|
|
|
169
177
|
|
|
170
178
|
}
|
|
171
179
|
|
|
172
|
-
_activeLoaders++;
|
|
180
|
+
_activeLoaders ++;
|
|
173
181
|
|
|
174
182
|
}
|
|
175
183
|
|
|
@@ -265,7 +273,7 @@ class KTX2Loader extends Loader {
|
|
|
265
273
|
URL.revokeObjectURL( this.workerSourceURL );
|
|
266
274
|
this.workerPool.dispose();
|
|
267
275
|
|
|
268
|
-
_activeLoaders--;
|
|
276
|
+
_activeLoaders --;
|
|
269
277
|
|
|
270
278
|
return this;
|
|
271
279
|
|
|
@@ -519,8 +527,8 @@ KTX2Loader.BasisWorker = function () {
|
|
|
519
527
|
{
|
|
520
528
|
if: 'etc1Supported',
|
|
521
529
|
basisFormat: [ BasisFormat.ETC1S, BasisFormat.UASTC_4x4 ],
|
|
522
|
-
transcoderFormat: [ TranscoderFormat.ETC1
|
|
523
|
-
engineFormat: [ EngineFormat.RGB_ETC1_Format
|
|
530
|
+
transcoderFormat: [ TranscoderFormat.ETC1 ],
|
|
531
|
+
engineFormat: [ EngineFormat.RGB_ETC1_Format ],
|
|
524
532
|
priorityETC1S: 2,
|
|
525
533
|
priorityUASTC: 4,
|
|
526
534
|
needsPowerOfTwo: false,
|
|
@@ -560,6 +568,7 @@ KTX2Loader.BasisWorker = function () {
|
|
|
560
568
|
|
|
561
569
|
if ( ! config[ opt.if ] ) continue;
|
|
562
570
|
if ( ! opt.basisFormat.includes( basisFormat ) ) continue;
|
|
571
|
+
if ( hasAlpha && opt.transcoderFormat.length < 2 ) continue;
|
|
563
572
|
if ( opt.needsPowerOfTwo && ! ( isPowerOfTwo( width ) && isPowerOfTwo( height ) ) ) continue;
|
|
564
573
|
|
|
565
574
|
transcoderFormat = opt.transcoderFormat[ hasAlpha ? 1 : 0 ];
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
* for description see https://www.khronos.org/opengles/sdk/tools/KTX/
|
|
7
7
|
* for file layout see https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/
|
|
8
8
|
*
|
|
9
|
-
* ported from https://github.com/BabylonJS/Babylon.js/blob/master/src/
|
|
9
|
+
* ported from https://github.com/BabylonJS/Babylon.js/blob/master/src/Misc/khronosTextureContainer.ts
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
Loader,
|
|
10
10
|
Matrix4,
|
|
11
11
|
Mesh,
|
|
12
|
-
MeshPhongMaterial,
|
|
13
12
|
MeshStandardMaterial,
|
|
14
13
|
ShaderMaterial,
|
|
15
14
|
UniformsLib,
|
|
@@ -967,13 +966,15 @@ class LDrawLoader extends Loader {
|
|
|
967
966
|
mainEdgeColourCode: parentScope ? parentScope.mainEdgeColourCode : '24',
|
|
968
967
|
currentMatrix: new Matrix4(),
|
|
969
968
|
matrix: new Matrix4(),
|
|
969
|
+
type: 'Model',
|
|
970
|
+
groupObject: null,
|
|
970
971
|
|
|
971
972
|
// If false, it is a root material scope previous to parse
|
|
972
973
|
isFromParse: true,
|
|
973
974
|
|
|
974
|
-
faces:
|
|
975
|
-
lineSegments:
|
|
976
|
-
conditionalSegments:
|
|
975
|
+
faces: [],
|
|
976
|
+
lineSegments: [],
|
|
977
|
+
conditionalSegments: [],
|
|
977
978
|
totalFaces: 0,
|
|
978
979
|
|
|
979
980
|
// If true, this object is the start of a construction step
|
|
@@ -1200,14 +1201,8 @@ class LDrawLoader extends Loader {
|
|
|
1200
1201
|
|
|
1201
1202
|
case FINISH_TYPE_PEARLESCENT:
|
|
1202
1203
|
|
|
1203
|
-
// Try to imitate pearlescency by
|
|
1204
|
-
|
|
1205
|
-
const hsl = specular.getHSL( { h: 0, s: 0, l: 0 } );
|
|
1206
|
-
hsl.h = ( hsl.h + 0.5 ) % 1;
|
|
1207
|
-
hsl.l = Math.min( 1, hsl.l + ( 1 - hsl.l ) * 0.7 );
|
|
1208
|
-
specular.setHSL( hsl.h, hsl.s, hsl.l );
|
|
1209
|
-
|
|
1210
|
-
material = new MeshPhongMaterial( { color: colour, specular: specular, shininess: 10, reflectivity: 0.3 } );
|
|
1204
|
+
// Try to imitate pearlescency by making the surface glossy
|
|
1205
|
+
material = new MeshStandardMaterial( { color: colour, roughness: 0.3, metalness: 0.25 } );
|
|
1211
1206
|
break;
|
|
1212
1207
|
|
|
1213
1208
|
case FINISH_TYPE_CHROME:
|
|
@@ -1443,20 +1438,8 @@ class LDrawLoader extends Loader {
|
|
|
1443
1438
|
|
|
1444
1439
|
type = lp.getToken();
|
|
1445
1440
|
|
|
1446
|
-
currentParseScope.faces = [];
|
|
1447
|
-
currentParseScope.lineSegments = [];
|
|
1448
|
-
currentParseScope.conditionalSegments = [];
|
|
1449
1441
|
currentParseScope.type = type;
|
|
1450
1442
|
|
|
1451
|
-
const isRoot = ! parentParseScope.isFromParse;
|
|
1452
|
-
if ( isRoot || scope.separateObjects && ! isPrimitiveType( type ) ) {
|
|
1453
|
-
|
|
1454
|
-
currentParseScope.groupObject = new Group();
|
|
1455
|
-
|
|
1456
|
-
currentParseScope.groupObject.userData.startingConstructionStep = currentParseScope.startingConstructionStep;
|
|
1457
|
-
|
|
1458
|
-
}
|
|
1459
|
-
|
|
1460
1443
|
// If the scale of the object is negated then the triangle winding order
|
|
1461
1444
|
// needs to be flipped.
|
|
1462
1445
|
if (
|
|
@@ -1826,6 +1809,14 @@ class LDrawLoader extends Loader {
|
|
|
1826
1809
|
currentParseScope.numSubobjects = subobjects.length;
|
|
1827
1810
|
currentParseScope.subobjectIndex = 0;
|
|
1828
1811
|
|
|
1812
|
+
const isRoot = ! parentParseScope.isFromParse;
|
|
1813
|
+
if ( isRoot || scope.separateObjects && ! isPrimitiveType( type ) ) {
|
|
1814
|
+
|
|
1815
|
+
currentParseScope.groupObject = new Group();
|
|
1816
|
+
currentParseScope.groupObject.userData.startingConstructionStep = currentParseScope.startingConstructionStep;
|
|
1817
|
+
|
|
1818
|
+
}
|
|
1819
|
+
|
|
1829
1820
|
}
|
|
1830
1821
|
|
|
1831
1822
|
computeConstructionSteps( model ) {
|
|
@@ -1856,6 +1847,13 @@ class LDrawLoader extends Loader {
|
|
|
1856
1847
|
|
|
1857
1848
|
finalizeObject( subobjectParseScope ) {
|
|
1858
1849
|
|
|
1850
|
+
// fail gracefully if an object could not be loaded
|
|
1851
|
+
if ( subobjectParseScope === null ) {
|
|
1852
|
+
|
|
1853
|
+
return;
|
|
1854
|
+
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1859
1857
|
const parentParseScope = subobjectParseScope.parentScope;
|
|
1860
1858
|
|
|
1861
1859
|
// Smooth the normals if this is a part or if this is a case where the subpart
|
|
@@ -2045,6 +2043,7 @@ class LDrawLoader extends Loader {
|
|
|
2045
2043
|
} ).catch( function () {
|
|
2046
2044
|
|
|
2047
2045
|
console.warn( 'LDrawLoader: Subobject "' + subobject.fileName + '" could not be found.' );
|
|
2046
|
+
return null;
|
|
2048
2047
|
|
|
2049
2048
|
} );
|
|
2050
2049
|
|
|
@@ -118,6 +118,7 @@ export class LUT3dlLoader extends Loader {
|
|
|
118
118
|
texture.wrapS = ClampToEdgeWrapping;
|
|
119
119
|
texture.wrapT = ClampToEdgeWrapping;
|
|
120
120
|
texture.generateMipmaps = false;
|
|
121
|
+
texture.needsUpdate = true;
|
|
121
122
|
|
|
122
123
|
const texture3D = new DataTexture3D();
|
|
123
124
|
texture3D.image.data = data;
|
|
@@ -132,6 +133,7 @@ export class LUT3dlLoader extends Loader {
|
|
|
132
133
|
texture3D.wrapT = ClampToEdgeWrapping;
|
|
133
134
|
texture3D.wrapR = ClampToEdgeWrapping;
|
|
134
135
|
texture3D.generateMipmaps = false;
|
|
136
|
+
texture3D.needsUpdate = true;
|
|
135
137
|
|
|
136
138
|
return {
|
|
137
139
|
size,
|
|
@@ -124,6 +124,7 @@ export class LUTCubeLoader extends Loader {
|
|
|
124
124
|
texture.wrapS = ClampToEdgeWrapping;
|
|
125
125
|
texture.wrapT = ClampToEdgeWrapping;
|
|
126
126
|
texture.generateMipmaps = false;
|
|
127
|
+
texture.needsUpdate = true;
|
|
127
128
|
|
|
128
129
|
const texture3D = new DataTexture3D();
|
|
129
130
|
texture3D.image.data = data;
|
|
@@ -138,6 +139,7 @@ export class LUTCubeLoader extends Loader {
|
|
|
138
139
|
texture3D.wrapT = ClampToEdgeWrapping;
|
|
139
140
|
texture3D.wrapR = ClampToEdgeWrapping;
|
|
140
141
|
texture3D.generateMipmaps = false;
|
|
142
|
+
texture3D.needsUpdate = true;
|
|
141
143
|
|
|
142
144
|
return {
|
|
143
145
|
title,
|
|
@@ -357,7 +357,6 @@ class MMDLoader extends Loader {
|
|
|
357
357
|
/*
|
|
358
358
|
* base64 encoded defalut toon textures toon00.bmp - toon10.bmp.
|
|
359
359
|
* We don't need to request external toon image files.
|
|
360
|
-
* This idea is from http://www20.atpages.jp/katwat/three.js_r58/examples/mytest37/mmd.three.js
|
|
361
360
|
*/
|
|
362
361
|
const DEFAULT_TOON_TEXTURES = [
|
|
363
362
|
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAL0lEQVRYR+3QQREAAAzCsOFfNJPBJ1XQS9r2hsUAAQIECBAgQIAAAQIECBAgsBZ4MUx/ofm2I/kAAAAASUVORK5CYII=',
|
|
@@ -208,7 +208,11 @@ class NRRDLoader extends Loader {
|
|
|
208
208
|
if ( ! headerObject.vectors ) {
|
|
209
209
|
|
|
210
210
|
//if no space direction is set, let's use the identity
|
|
211
|
-
headerObject.vectors = [
|
|
211
|
+
headerObject.vectors = [ ];
|
|
212
|
+
headerObject.vectors.push( [ 1, 0, 0 ] );
|
|
213
|
+
headerObject.vectors.push( [ 0, 1, 0 ] );
|
|
214
|
+
headerObject.vectors.push( [ 0, 0, 1 ] );
|
|
215
|
+
|
|
212
216
|
//apply spacing if defined
|
|
213
217
|
if ( headerObject.spacings ) {
|
|
214
218
|
|
|
@@ -216,7 +220,11 @@ class NRRDLoader extends Loader {
|
|
|
216
220
|
|
|
217
221
|
if ( ! isNaN( headerObject.spacings[ i ] ) ) {
|
|
218
222
|
|
|
219
|
-
|
|
223
|
+
for ( let j = 0; j <= 2; j ++ ) {
|
|
224
|
+
|
|
225
|
+
headerObject.vectors[ i ][ j ] *= headerObject.spacings[ i ];
|
|
226
|
+
|
|
227
|
+
}
|
|
220
228
|
|
|
221
229
|
}
|
|
222
230
|
|
|
@@ -684,8 +684,6 @@ class OBJLoader extends Loader {
|
|
|
684
684
|
|
|
685
685
|
/*
|
|
686
686
|
* http://paulbourke.net/dataformats/obj/
|
|
687
|
-
* or
|
|
688
|
-
* http://www.cs.utah.edu/~boulos/cs3505/obj_spec.pdf
|
|
689
687
|
*
|
|
690
688
|
* From chapter "Grouping" Syntax explanation "s group_number":
|
|
691
689
|
* "group_number is the smoothing group number. To turn off smoothing groups, use a value of 0 or off.
|
|
@@ -88,7 +88,7 @@ class PLYLoader extends Loader {
|
|
|
88
88
|
|
|
89
89
|
function parseHeader( data ) {
|
|
90
90
|
|
|
91
|
-
const patternHeader =
|
|
91
|
+
const patternHeader = /^ply([\s\S]*)end_header\r?\n/;
|
|
92
92
|
let headerText = '';
|
|
93
93
|
let headerLength = 0;
|
|
94
94
|
const result = patternHeader.exec( data );
|
|
@@ -5,11 +5,7 @@ import {
|
|
|
5
5
|
HalfFloatType,
|
|
6
6
|
LinearEncoding,
|
|
7
7
|
LinearFilter,
|
|
8
|
-
NearestFilter,
|
|
9
|
-
RGBEEncoding,
|
|
10
|
-
RGBEFormat,
|
|
11
8
|
RGBFormat,
|
|
12
|
-
UnsignedByteType
|
|
13
9
|
} from 'three';
|
|
14
10
|
|
|
15
11
|
// https://github.com/mrdoob/three.js/issues/5552
|
|
@@ -378,13 +374,6 @@ class RGBELoader extends DataTextureLoader {
|
|
|
378
374
|
|
|
379
375
|
switch ( this.type ) {
|
|
380
376
|
|
|
381
|
-
case UnsignedByteType:
|
|
382
|
-
|
|
383
|
-
data = image_rgba_data;
|
|
384
|
-
format = RGBEFormat; // handled as THREE.RGBAFormat in shaders
|
|
385
|
-
type = UnsignedByteType;
|
|
386
|
-
break;
|
|
387
|
-
|
|
388
377
|
case FloatType:
|
|
389
378
|
|
|
390
379
|
numElements = image_rgba_data.length / 4;
|
|
@@ -455,15 +444,6 @@ class RGBELoader extends DataTextureLoader {
|
|
|
455
444
|
|
|
456
445
|
switch ( texture.type ) {
|
|
457
446
|
|
|
458
|
-
case UnsignedByteType:
|
|
459
|
-
|
|
460
|
-
texture.encoding = RGBEEncoding;
|
|
461
|
-
texture.minFilter = NearestFilter;
|
|
462
|
-
texture.magFilter = NearestFilter;
|
|
463
|
-
texture.generateMipmaps = false;
|
|
464
|
-
texture.flipY = true;
|
|
465
|
-
break;
|
|
466
|
-
|
|
467
447
|
case FloatType:
|
|
468
448
|
|
|
469
449
|
texture.encoding = LinearEncoding;
|
|
@@ -1,14 +1,37 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DataTextureLoader,
|
|
3
|
-
UnsignedByteType,
|
|
4
3
|
RGBAFormat,
|
|
5
4
|
LinearFilter,
|
|
6
5
|
CubeTexture,
|
|
7
|
-
|
|
6
|
+
HalfFloatType,
|
|
7
|
+
DataUtils
|
|
8
8
|
} from 'three';
|
|
9
9
|
|
|
10
10
|
class RGBMLoader extends DataTextureLoader {
|
|
11
11
|
|
|
12
|
+
constructor( manager ) {
|
|
13
|
+
|
|
14
|
+
super( manager );
|
|
15
|
+
|
|
16
|
+
this.type = HalfFloatType;
|
|
17
|
+
this.maxRange = 7; // more information about this property at https://iwasbeingirony.blogspot.com/2010/06/difference-between-rgbm-and-rgbd.html
|
|
18
|
+
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
setDataType( value ) {
|
|
22
|
+
|
|
23
|
+
this.type = value;
|
|
24
|
+
return this;
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
setMaxRange( value ) {
|
|
29
|
+
|
|
30
|
+
this.maxRange = value;
|
|
31
|
+
return this;
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
12
35
|
loadCubemap( urls, onLoad, onProgress, onError ) {
|
|
13
36
|
|
|
14
37
|
const texture = new CubeTexture();
|
|
@@ -43,7 +66,7 @@ class RGBMLoader extends DataTextureLoader {
|
|
|
43
66
|
|
|
44
67
|
}
|
|
45
68
|
|
|
46
|
-
texture.
|
|
69
|
+
texture.type = this.type;
|
|
47
70
|
texture.format = RGBAFormat;
|
|
48
71
|
texture.minFilter = LinearFilter;
|
|
49
72
|
texture.generateMipmaps = false;
|
|
@@ -57,14 +80,45 @@ class RGBMLoader extends DataTextureLoader {
|
|
|
57
80
|
const img = UPNG.decode( buffer );
|
|
58
81
|
const rgba = UPNG.toRGBA8( img )[ 0 ];
|
|
59
82
|
|
|
83
|
+
const data = new Uint8Array( rgba );
|
|
84
|
+
const size = img.width * img.height * 4;
|
|
85
|
+
|
|
86
|
+
const output = ( this.type === HalfFloatType ) ? new Uint16Array( size ) : new Float32Array( size );
|
|
87
|
+
|
|
88
|
+
// decode RGBM
|
|
89
|
+
|
|
90
|
+
for ( let i = 0; i < data.length; i += 4 ) {
|
|
91
|
+
|
|
92
|
+
const r = data[ i + 0 ] / 255;
|
|
93
|
+
const g = data[ i + 1 ] / 255;
|
|
94
|
+
const b = data[ i + 2 ] / 255;
|
|
95
|
+
const a = data[ i + 3 ] / 255;
|
|
96
|
+
|
|
97
|
+
if ( this.type === HalfFloatType ) {
|
|
98
|
+
|
|
99
|
+
output[ i + 0 ] = DataUtils.toHalfFloat( Math.min( r * a * this.maxRange, 65504 ) );
|
|
100
|
+
output[ i + 1 ] = DataUtils.toHalfFloat( Math.min( g * a * this.maxRange, 65504 ) );
|
|
101
|
+
output[ i + 2 ] = DataUtils.toHalfFloat( Math.min( b * a * this.maxRange, 65504 ) );
|
|
102
|
+
output[ i + 3 ] = DataUtils.toHalfFloat( 1 );
|
|
103
|
+
|
|
104
|
+
} else {
|
|
105
|
+
|
|
106
|
+
output[ i + 0 ] = r * a * this.maxRange;
|
|
107
|
+
output[ i + 1 ] = g * a * this.maxRange;
|
|
108
|
+
output[ i + 2 ] = b * a * this.maxRange;
|
|
109
|
+
output[ i + 3 ] = 1;
|
|
110
|
+
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
}
|
|
114
|
+
|
|
60
115
|
return {
|
|
61
116
|
width: img.width,
|
|
62
117
|
height: img.height,
|
|
63
|
-
data:
|
|
118
|
+
data: output,
|
|
64
119
|
format: RGBAFormat,
|
|
65
|
-
type:
|
|
66
|
-
flipY: true
|
|
67
|
-
encoding: RGBM7Encoding
|
|
120
|
+
type: this.type,
|
|
121
|
+
flipY: true
|
|
68
122
|
};
|
|
69
123
|
|
|
70
124
|
}
|
|
@@ -248,7 +248,7 @@ class SVGLoader extends Loader {
|
|
|
248
248
|
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
-
if ( j === 0
|
|
251
|
+
if ( j === 0 ) firstPoint.copy( point );
|
|
252
252
|
|
|
253
253
|
}
|
|
254
254
|
|
|
@@ -440,7 +440,7 @@ class SVGLoader extends Loader {
|
|
|
440
440
|
|
|
441
441
|
}
|
|
442
442
|
|
|
443
|
-
if ( j === 0
|
|
443
|
+
if ( j === 0 ) firstPoint.copy( point );
|
|
444
444
|
|
|
445
445
|
}
|
|
446
446
|
|
|
@@ -140,7 +140,7 @@ class TDSLoader extends Loader {
|
|
|
140
140
|
|
|
141
141
|
} else {
|
|
142
142
|
|
|
143
|
-
this.debugMessage( 'Unknown main chunk: ' + next.hexId);
|
|
143
|
+
this.debugMessage( 'Unknown main chunk: ' + next.hexId );
|
|
144
144
|
|
|
145
145
|
}
|
|
146
146
|
|
|
@@ -218,7 +218,9 @@ class TDSLoader extends Loader {
|
|
|
218
218
|
const mesh = this.readMesh( next );
|
|
219
219
|
mesh.name = name;
|
|
220
220
|
this.meshes.push( mesh );
|
|
221
|
+
|
|
221
222
|
} else {
|
|
223
|
+
|
|
222
224
|
this.debugMessage( 'Unknown named object chunk: ' + next.hexId );
|
|
223
225
|
|
|
224
226
|
}
|
|
@@ -239,7 +241,7 @@ class TDSLoader extends Loader {
|
|
|
239
241
|
readMaterialEntry( chunk, path ) {
|
|
240
242
|
|
|
241
243
|
let next = chunk.readChunk();
|
|
242
|
-
|
|
244
|
+
const material = new MeshPhongMaterial();
|
|
243
245
|
|
|
244
246
|
while ( next ) {
|
|
245
247
|
|
|
@@ -485,7 +487,7 @@ class TDSLoader extends Loader {
|
|
|
485
487
|
let materialIndex = 0;
|
|
486
488
|
let start = 0;
|
|
487
489
|
|
|
488
|
-
while ( !chunk.endOfChunk ) {
|
|
490
|
+
while ( ! chunk.endOfChunk ) {
|
|
489
491
|
|
|
490
492
|
const subchunk = chunk.readChunk( );
|
|
491
493
|
|
|
@@ -696,11 +698,13 @@ class TDSLoader extends Loader {
|
|
|
696
698
|
}
|
|
697
699
|
|
|
698
700
|
}
|
|
701
|
+
|
|
699
702
|
}
|
|
700
703
|
|
|
701
704
|
|
|
702
705
|
/** Read data/sub-chunks from chunk */
|
|
703
706
|
class Chunk {
|
|
707
|
+
|
|
704
708
|
/**
|
|
705
709
|
* Create a new chunk
|
|
706
710
|
*
|
|
@@ -709,7 +713,8 @@ class Chunk {
|
|
|
709
713
|
* @param {Number} position in data.
|
|
710
714
|
* @param {Function} debugMessage logging callback.
|
|
711
715
|
*/
|
|
712
|
-
constructor(data, position, debugMessage) {
|
|
716
|
+
constructor( data, position, debugMessage ) {
|
|
717
|
+
|
|
713
718
|
this.data = data;
|
|
714
719
|
// the offset to the begin of this chunk
|
|
715
720
|
this.offset = position;
|
|
@@ -717,17 +722,22 @@ class Chunk {
|
|
|
717
722
|
this.position = position;
|
|
718
723
|
this.debugMessage = debugMessage;
|
|
719
724
|
|
|
720
|
-
if (this.debugMessage instanceof Function) {
|
|
721
|
-
|
|
725
|
+
if ( this.debugMessage instanceof Function ) {
|
|
726
|
+
|
|
727
|
+
this.debugMessage = function () {};
|
|
728
|
+
|
|
722
729
|
}
|
|
723
730
|
|
|
724
731
|
this.id = this.readWord();
|
|
725
732
|
this.size = this.readDWord();
|
|
726
733
|
this.end = this.offset + this.size;
|
|
727
734
|
|
|
728
|
-
if (this.end > data.byteLength) {
|
|
735
|
+
if ( this.end > data.byteLength ) {
|
|
736
|
+
|
|
729
737
|
this.debugMessage( 'Bad chunk size for chunk at ' + position );
|
|
738
|
+
|
|
730
739
|
}
|
|
740
|
+
|
|
731
741
|
}
|
|
732
742
|
|
|
733
743
|
/**
|
|
@@ -736,18 +746,22 @@ class Chunk {
|
|
|
736
746
|
* @method readChunk
|
|
737
747
|
* @return {Chunk | null} next sub chunk
|
|
738
748
|
*/
|
|
739
|
-
readChunk
|
|
749
|
+
readChunk() {
|
|
740
750
|
|
|
741
751
|
if ( this.endOfChunk ) {
|
|
752
|
+
|
|
742
753
|
return null;
|
|
754
|
+
|
|
743
755
|
}
|
|
744
756
|
|
|
745
757
|
try {
|
|
746
|
-
|
|
758
|
+
|
|
759
|
+
const next = new Chunk( this.data, this.position, this.debugMessage );
|
|
747
760
|
this.position += next.size;
|
|
748
761
|
return next;
|
|
749
762
|
|
|
750
763
|
} catch ( e ) {
|
|
764
|
+
|
|
751
765
|
this.debugMessage( 'Unable to read chunk at ' + this.position );
|
|
752
766
|
return null;
|
|
753
767
|
|
|
@@ -762,11 +776,15 @@ class Chunk {
|
|
|
762
776
|
* @return {String} hex-string of id
|
|
763
777
|
*/
|
|
764
778
|
get hexId() {
|
|
779
|
+
|
|
765
780
|
return this.id.toString( 16 );
|
|
781
|
+
|
|
766
782
|
}
|
|
767
783
|
|
|
768
784
|
get endOfChunk() {
|
|
785
|
+
|
|
769
786
|
return this.position >= this.end;
|
|
787
|
+
|
|
770
788
|
}
|
|
771
789
|
|
|
772
790
|
/**
|
|
@@ -873,11 +891,14 @@ class Chunk {
|
|
|
873
891
|
let s = '';
|
|
874
892
|
let c = this.readByte();
|
|
875
893
|
while ( c ) {
|
|
894
|
+
|
|
876
895
|
s += String.fromCharCode( c );
|
|
877
896
|
c = this.readByte();
|
|
897
|
+
|
|
878
898
|
}
|
|
879
899
|
|
|
880
900
|
return s;
|
|
901
|
+
|
|
881
902
|
}
|
|
882
903
|
|
|
883
904
|
}
|
|
@@ -192,7 +192,7 @@ class VRMLLoader extends Loader {
|
|
|
192
192
|
|
|
193
193
|
//
|
|
194
194
|
|
|
195
|
-
const StringLiteral = createToken( { name: 'StringLiteral', pattern: /"(
|
|
195
|
+
const StringLiteral = createToken( { name: 'StringLiteral', pattern: /"(?:[^\\"\n\r]|\\[bfnrtv"\\/]|\\u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])*"/ } );
|
|
196
196
|
const HexLiteral = createToken( { name: 'HexLiteral', pattern: /0[xX][0-9a-fA-F]+/ } );
|
|
197
197
|
const NumberLiteral = createToken( { name: 'NumberLiteral', pattern: /[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/ } );
|
|
198
198
|
const TrueLiteral = createToken( { name: 'TrueLiteral', pattern: /TRUE/ } );
|
|
@@ -1382,6 +1382,7 @@ class VRMLLoader extends Loader {
|
|
|
1382
1382
|
}
|
|
1383
1383
|
|
|
1384
1384
|
texture = new DataTexture( data, width, height, ( useAlpha === true ) ? RGBAFormat : RGBFormat );
|
|
1385
|
+
texture.needsUpdate = true;
|
|
1385
1386
|
texture.__type = textureType; // needed for material modifications
|
|
1386
1387
|
break;
|
|
1387
1388
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// https://cs.nyu.edu/~perlin/noise/
|
|
2
2
|
|
|
3
3
|
const _p = [ 151, 160, 137, 91, 90, 15, 131, 13, 201, 95, 96, 53, 194, 233, 7, 225, 140, 36, 103, 30, 69, 142, 8, 99, 37, 240, 21, 10,
|
|
4
4
|
23, 190, 6, 148, 247, 120, 234, 75, 0, 26, 197, 62, 94, 252, 219, 203, 117, 35, 11, 32, 57, 177, 33, 88, 237, 149, 56, 87,
|
|
@@ -345,7 +345,9 @@ class GPUComputationRenderer {
|
|
|
345
345
|
this.createTexture = function () {
|
|
346
346
|
|
|
347
347
|
const data = new Float32Array( sizeX * sizeY * 4 );
|
|
348
|
-
|
|
348
|
+
const texture = new DataTexture( data, sizeX, sizeY, RGBAFormat, FloatType );
|
|
349
|
+
texture.needsUpdate = true;
|
|
350
|
+
return texture;
|
|
349
351
|
|
|
350
352
|
};
|
|
351
353
|
|
|
@@ -20,30 +20,31 @@ import { NormalEditor } from './accessors/NormalEditor.js';
|
|
|
20
20
|
import { TimerEditor } from './utils/TimerEditor.js';
|
|
21
21
|
import { OscillatorEditor } from './utils/OscillatorEditor.js';
|
|
22
22
|
import { CheckerEditor } from './procedural/CheckerEditor.js';
|
|
23
|
+
|
|
23
24
|
import { EventDispatcher } from 'three';
|
|
24
25
|
|
|
25
26
|
export const ClassLib = {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
27
|
+
StandardMaterialEditor,
|
|
28
|
+
OperatorEditor,
|
|
29
|
+
NormalizeEditor,
|
|
30
|
+
InvertEditor,
|
|
31
|
+
LimiterEditor,
|
|
32
|
+
DotEditor,
|
|
33
|
+
PowerEditor,
|
|
34
|
+
TrigonometryEditor,
|
|
35
|
+
FloatEditor,
|
|
36
|
+
Vector2Editor,
|
|
37
|
+
Vector3Editor,
|
|
38
|
+
Vector4Editor,
|
|
39
|
+
SliderEditor,
|
|
40
|
+
ColorEditor,
|
|
41
|
+
BlendEditor,
|
|
42
|
+
UVEditor,
|
|
43
|
+
PositionEditor,
|
|
44
|
+
NormalEditor,
|
|
45
|
+
TimerEditor,
|
|
46
|
+
OscillatorEditor,
|
|
47
|
+
CheckerEditor
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
export class NodeEditor extends EventDispatcher {
|
|
@@ -258,7 +259,7 @@ export class NodeEditor extends EventDispatcher {
|
|
|
258
259
|
const context = new ContextMenu( this.domElement );
|
|
259
260
|
|
|
260
261
|
let isContext = false;
|
|
261
|
-
|
|
262
|
+
const contextPosition = {};
|
|
262
263
|
|
|
263
264
|
const add = ( node ) => {
|
|
264
265
|
|