@galacean/engine-loader 1.4.0-alpha.0 → 1.4.0-alpha.2

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/dist/module.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Utils, ModelMesh, BlendShape, Texture2D, Loader, Entity, AnimationClip, AnimationEvent, AnimationStringCurve, Keyframe, AnimationBoolCurve, AnimationRefCurve, AnimationQuaternionCurve, AnimationColorCurve, AnimationVector4Curve, AnimationVector3Curve, AnimationVector2Curve, AnimationFloatArrayCurve, AnimationArrayCurve, AnimationFloatCurve, ReferResource, Scene, resourceLoader, AssetPromise, AssetType, AnimatorController, AnimatorControllerLayer, AnimatorStateTransition, TextureCube, TextureFilterMode, TextureCubeFace, AmbientLight, DiffuseMode, Font, Animator, IndexFormat, VertexElementFormat, GLCapabilityType, Logger, TextureFormat, request, ContentRestorer, InterpolationType, SkinnedMeshRenderer, Transform, PBRMaterial, BlinnPhongMaterial, PBRSpecularMaterial, TextureCoordinate, RenderFace, VertexElement, Buffer, BufferBindFlag, BufferUsage, Camera, MeshRenderer, Skin, TextureWrapMode as TextureWrapMode$1, AnimatorStateMachine, SystemInfo, Shader, Material, PrimitiveMesh, SpriteAtlas, Sprite, ShaderFactory, ShaderLib, BackgroundMode, DirectLight, PointLight, SpotLight, UnlitMaterial } from '@galacean/engine-core';
1
+ import { Utils, ModelMesh, BlendShape, Texture2D, Loader, Entity, AnimationClip, AnimationEvent, AnimationStringCurve, Keyframe, AnimationBoolCurve, AnimationRefCurve, AnimationQuaternionCurve, AnimationColorCurve, AnimationVector4Curve, AnimationVector3Curve, AnimationVector2Curve, AnimationFloatArrayCurve, AnimationArrayCurve, AnimationFloatCurve, ReferResource, Scene, resourceLoader, AssetPromise, AssetType, AnimatorController, AnimatorControllerLayer, AnimatorStateTransition, AmbientLight, DiffuseMode, TextureCube, TextureFilterMode, TextureCubeFace, request, ContentRestorer, Font, Animator, IndexFormat, VertexElementFormat, GLCapabilityType, Logger, TextureFormat, InterpolationType, SkinnedMeshRenderer, Transform, PBRMaterial, BlinnPhongMaterial, PBRSpecularMaterial, TextureCoordinate, RenderFace, VertexElement, Buffer, BufferBindFlag, BufferUsage, Camera, MeshRenderer, Skin, TextureWrapMode as TextureWrapMode$1, AnimatorStateMachine, SystemInfo, Shader, Material, PrimitiveMesh, SpriteAtlas, Sprite, AudioClip, AudioManager, ShaderFactory, ShaderLib, PhysicsMaterial, BackgroundMode, DirectLight, PointLight, SpotLight, UnlitMaterial } from '@galacean/engine-core';
2
2
  import { Color, Vector4, Vector3, Vector2, Quaternion, SphericalHarmonics3, MathUtil, BoundingBox, Matrix, Rect } from '@galacean/engine-math';
3
3
  import { GLCompressedTextureInternalFormat } from '@galacean/engine-rhi-webgl';
4
4
 
@@ -533,11 +533,7 @@ var ParserType = /*#__PURE__*/ function(ParserType) {
533
533
  return ParserType;
534
534
  }({});
535
535
  /**
536
- * Parser context
537
- * @export
538
- * @class ParserContext
539
- * @template T
540
- * @template I
536
+ * @internal
541
537
  */ var ParserContext = /*#__PURE__*/ function() {
542
538
  function ParserContext(engine, type, resource) {
543
539
  if (type === void 0) type = 1;
@@ -549,13 +545,39 @@ var ParserType = /*#__PURE__*/ function(ParserType) {
549
545
  this.components = new Map();
550
546
  this.rootIds = [];
551
547
  this.strippedIds = [];
548
+ this.componentWaitingMap = new Map();
552
549
  this.resourceManager = engine.resourceManager;
553
550
  }
554
551
  var _proto = ParserContext.prototype;
555
- /**
556
- * Destroy the context.
557
- * @memberof ParserContext
558
- */ _proto.clear = function clear() {
552
+ _proto.addComponent = function addComponent(id, component) {
553
+ this.components.set(id, component);
554
+ var waitingList = this.componentWaitingMap.get(id);
555
+ if (waitingList == null ? void 0 : waitingList.length) {
556
+ waitingList.forEach(function(resolve) {
557
+ return resolve(component);
558
+ });
559
+ this.componentWaitingMap.delete(id);
560
+ }
561
+ };
562
+ _proto.getComponentByRef = function getComponentByRef(ref) {
563
+ var _this = this;
564
+ return new Promise(function(resolve, reject) {
565
+ var component = _this.components.get(ref.componentId);
566
+ if (component) {
567
+ resolve(component);
568
+ } else {
569
+ var resolves = _this.componentWaitingMap.get(ref.componentId);
570
+ if (resolves) {
571
+ resolves.push(resolve);
572
+ } else {
573
+ _this.componentWaitingMap.set(ref.componentId, [
574
+ resolve
575
+ ]);
576
+ }
577
+ }
578
+ });
579
+ };
580
+ _proto.clear = function clear() {
559
581
  this.entityMap.clear();
560
582
  this.components.clear();
561
583
  this.entityConfigMap.clear();
@@ -655,6 +677,8 @@ var ReflectionParser = /*#__PURE__*/ function() {
655
677
  }
656
678
  return resource;
657
679
  });
680
+ } else if (ReflectionParser._isComponentRef(value)) {
681
+ return this._context.getComponentByRef(value);
658
682
  } else if (ReflectionParser._isEntityRef(value)) {
659
683
  // entity reference
660
684
  return Promise.resolve(this._context.entityMap.get(value.entityId));
@@ -716,13 +740,16 @@ var ReflectionParser = /*#__PURE__*/ function() {
716
740
  this.customParseComponentHandles[componentType] = handle;
717
741
  };
718
742
  ReflectionParser._isClass = function _isClass(value) {
719
- return value["class"] != undefined;
743
+ return value["class"] !== undefined;
720
744
  };
721
745
  ReflectionParser._isAssetRef = function _isAssetRef(value) {
722
- return value["refId"] != undefined;
746
+ return value["refId"] !== undefined;
723
747
  };
724
748
  ReflectionParser._isEntityRef = function _isEntityRef(value) {
725
- return value["entityId"] != undefined;
749
+ return value["entityId"] !== undefined;
750
+ };
751
+ ReflectionParser._isComponentRef = function _isComponentRef(value) {
752
+ return value["ownerId"] !== undefined && value["componentId"] !== undefined;
726
753
  };
727
754
  return ReflectionParser;
728
755
  }();
@@ -1079,7 +1106,6 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
1079
1106
  _proto._parseComponents = function _parseComponents() {
1080
1107
  var entitiesConfig = this.data.entities;
1081
1108
  var entityMap = this.context.entityMap;
1082
- var components = this.context.components;
1083
1109
  var promises = [];
1084
1110
  for(var i = 0, l = entitiesConfig.length; i < l; i++){
1085
1111
  var entityConfig = entitiesConfig[i];
@@ -1088,11 +1114,17 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
1088
1114
  var componentConfig = entityConfig.components[i1];
1089
1115
  var key = !componentConfig.refId ? componentConfig.class : componentConfig.refId;
1090
1116
  var component = entity.addComponent(Loader.getClass(key));
1091
- components.set(componentConfig.id, component);
1117
+ this.context.addComponent(componentConfig.id, component);
1092
1118
  var promise = this._reflectionParser.parsePropsAndMethods(component, componentConfig);
1093
1119
  promises.push(promise);
1094
1120
  }
1095
1121
  }
1122
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.context.componentWaitingMap.values()), _step; !(_step = _iterator()).done;){
1123
+ var waitingList = _step.value;
1124
+ waitingList.forEach(function(resolve) {
1125
+ return resolve(null);
1126
+ });
1127
+ }
1096
1128
  return Promise.all(promises);
1097
1129
  };
1098
1130
  _proto._parsePrefabModification = function _parsePrefabModification() {
@@ -1570,32 +1602,18 @@ var EnvLoader = /*#__PURE__*/ function(Loader) {
1570
1602
  var _proto = EnvLoader.prototype;
1571
1603
  _proto.load = function load(item, resourceManager) {
1572
1604
  return new AssetPromise(function(resolve, reject) {
1573
- resourceManager// @ts-ignore
1574
- ._request(item.url, _extends({}, item, {
1605
+ var requestConfig = _extends({}, item, {
1575
1606
  type: "arraybuffer"
1576
- })).then(function(arraybuffer) {
1577
- var _this;
1578
- var shArray = new Float32Array(arraybuffer, 0, 27);
1579
- var shByteLength = 27 * 4;
1580
- var size = (_this = new Uint16Array(arraybuffer, shByteLength, 1)) == null ? void 0 : _this[0];
1581
- var engine = resourceManager.engine;
1582
- var texture = new TextureCube(engine, size);
1583
- texture.filterMode = TextureFilterMode.Trilinear;
1584
- var mipmapCount = texture.mipmapCount;
1585
- var offset = shByteLength + 2;
1586
- for(var mipLevel = 0; mipLevel < mipmapCount; mipLevel++){
1587
- var mipSize = size >> mipLevel;
1588
- for(var face = 0; face < 6; face++){
1589
- var dataSize = mipSize * mipSize * 4;
1590
- var data = new Uint8Array(arraybuffer, offset, dataSize);
1591
- offset += dataSize;
1592
- texture.setPixelBuffer(TextureCubeFace.PositiveX + face, data, mipLevel);
1593
- }
1594
- }
1607
+ });
1608
+ var engine = resourceManager.engine;
1609
+ resourceManager// @ts-ignore
1610
+ ._request(item.url, requestConfig).then(function(arraybuffer) {
1611
+ var texture = EnvLoader._setTextureByBuffer(engine, arraybuffer);
1612
+ engine.resourceManager.addContentRestorer(new EnvContentRestorer(texture, item.url, requestConfig));
1595
1613
  var ambientLight = new AmbientLight(engine);
1596
1614
  var sh = new SphericalHarmonics3();
1597
1615
  ambientLight.diffuseMode = DiffuseMode.SphericalHarmonics;
1598
- sh.copyFromArray(shArray);
1616
+ sh.copyFromArray(new Float32Array(arraybuffer, 0, 27));
1599
1617
  ambientLight.diffuseSphericalHarmonics = sh;
1600
1618
  ambientLight.specularTexture = texture;
1601
1619
  ambientLight.specularTextureDecodeRGBM = true;
@@ -1605,6 +1623,27 @@ var EnvLoader = /*#__PURE__*/ function(Loader) {
1605
1623
  });
1606
1624
  });
1607
1625
  };
1626
+ /**
1627
+ * @internal
1628
+ */ EnvLoader._setTextureByBuffer = function _setTextureByBuffer(engine, buffer, texture) {
1629
+ var _this;
1630
+ var shByteLength = 27 * 4;
1631
+ var size = (_this = new Uint16Array(buffer, shByteLength, 1)) == null ? void 0 : _this[0];
1632
+ texture || (texture = new TextureCube(engine, size));
1633
+ texture.filterMode = TextureFilterMode.Trilinear;
1634
+ var mipmapCount = texture.mipmapCount;
1635
+ var offset = shByteLength + 2;
1636
+ for(var mipLevel = 0; mipLevel < mipmapCount; mipLevel++){
1637
+ var mipSize = size >> mipLevel;
1638
+ for(var face = 0; face < 6; face++){
1639
+ var dataSize = mipSize * mipSize * 4;
1640
+ var data = new Uint8Array(buffer, offset, dataSize);
1641
+ offset += dataSize;
1642
+ texture.setPixelBuffer(TextureCubeFace.PositiveX + face, data, mipLevel);
1643
+ }
1644
+ }
1645
+ return texture;
1646
+ };
1608
1647
  return EnvLoader;
1609
1648
  }(Loader);
1610
1649
  EnvLoader = __decorate([
@@ -1612,6 +1651,27 @@ EnvLoader = __decorate([
1612
1651
  "env"
1613
1652
  ])
1614
1653
  ], EnvLoader);
1654
+ /**
1655
+ * @internal
1656
+ */ var EnvContentRestorer = /*#__PURE__*/ function(ContentRestorer) {
1657
+ _inherits(EnvContentRestorer, ContentRestorer);
1658
+ function EnvContentRestorer(resource, url, requestConfig) {
1659
+ var _this;
1660
+ _this = ContentRestorer.call(this, resource) || this, _this.url = url, _this.requestConfig = requestConfig;
1661
+ return _this;
1662
+ }
1663
+ var _proto = EnvContentRestorer.prototype;
1664
+ _proto.restoreContent = function restoreContent() {
1665
+ var _this = this;
1666
+ return new AssetPromise(function(resolve, reject) {
1667
+ request(_this.url, _this.requestConfig).then(function(buffer) {
1668
+ EnvLoader._setTextureByBuffer(_this.resource.engine, buffer, _this.resource);
1669
+ resolve(_this.resource);
1670
+ }).catch(reject);
1671
+ });
1672
+ };
1673
+ return EnvContentRestorer;
1674
+ }(ContentRestorer);
1615
1675
 
1616
1676
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
1617
1677
  try {
@@ -2029,7 +2089,7 @@ FontLoader = __decorate([
2029
2089
  task.total += 1;
2030
2090
  taskPromise.then(function() {
2031
2091
  _this._setTaskCompleteProgress(++task.loaded, task.total);
2032
- });
2092
+ }, function() {});
2033
2093
  };
2034
2094
  _proto._handleSubAsset = function _handleSubAsset(resource, type, index) {
2035
2095
  var _this = this;
@@ -6319,6 +6379,45 @@ TextureCubeLoader = __decorate([
6319
6379
  ])
6320
6380
  ], TextureCubeLoader);
6321
6381
 
6382
+ var AudioLoader = /*#__PURE__*/ function(Loader) {
6383
+ _inherits(AudioLoader, Loader);
6384
+ function AudioLoader() {
6385
+ return Loader.apply(this, arguments) || this;
6386
+ }
6387
+ var _proto = AudioLoader.prototype;
6388
+ _proto.load = function load(item, resourceManager) {
6389
+ return new AssetPromise(function(resolve, reject) {
6390
+ var url = item.url;
6391
+ var requestConfig = _extends({}, item, {
6392
+ type: "arraybuffer"
6393
+ });
6394
+ // @ts-ignore
6395
+ resourceManager._request(url, requestConfig).then(function(arrayBuffer) {
6396
+ var audioClip = new AudioClip(resourceManager.engine);
6397
+ AudioManager.getContext().decodeAudioData(arrayBuffer).then(function(result) {
6398
+ // @ts-ignore
6399
+ audioClip._setAudioSource(result);
6400
+ if (url.indexOf("data:") !== 0) {
6401
+ var index = url.lastIndexOf("/");
6402
+ audioClip.name = url.substring(index + 1);
6403
+ }
6404
+ resolve(audioClip);
6405
+ }).catch(function(e) {
6406
+ reject(e);
6407
+ });
6408
+ });
6409
+ });
6410
+ };
6411
+ return AudioLoader;
6412
+ }(Loader);
6413
+ AudioLoader = __decorate([
6414
+ resourceLoader(AssetType.Audio, [
6415
+ "mp3",
6416
+ "ogg",
6417
+ "wav"
6418
+ ])
6419
+ ], AudioLoader);
6420
+
6322
6421
  var ShaderChunkLoader = /*#__PURE__*/ function(Loader) {
6323
6422
  _inherits(ShaderChunkLoader, Loader);
6324
6423
  function ShaderChunkLoader() {
@@ -6356,7 +6455,7 @@ var ShaderChunkLoader = /*#__PURE__*/ function(Loader) {
6356
6455
  };
6357
6456
  return ShaderChunkLoader;
6358
6457
  }(Loader);
6359
- ShaderChunkLoader._shaderIncludeRegex = /\s#include\s+"([./][^\\"]+)"/gm;
6458
+ ShaderChunkLoader._shaderIncludeRegex = /#include\s+"([./][^\\"]+)"/gm;
6360
6459
  ShaderChunkLoader = __decorate([
6361
6460
  resourceLoader("ShaderChunk", [
6362
6461
  "glsl"
@@ -6402,6 +6501,34 @@ ShaderLoader = __decorate([
6402
6501
  ])
6403
6502
  ], ShaderLoader);
6404
6503
 
6504
+ var PhysicsMaterialLoader = /*#__PURE__*/ function(Loader) {
6505
+ _inherits(PhysicsMaterialLoader, Loader);
6506
+ function PhysicsMaterialLoader() {
6507
+ return Loader.apply(this, arguments) || this;
6508
+ }
6509
+ var _proto = PhysicsMaterialLoader.prototype;
6510
+ _proto.load = function load(item, resourceManager) {
6511
+ return resourceManager// @ts-ignore
6512
+ ._request(item.url, _extends({}, item, {
6513
+ type: "json"
6514
+ })).then(function(data) {
6515
+ var physicsMaterial = new PhysicsMaterial();
6516
+ physicsMaterial.bounciness = data.bounciness;
6517
+ physicsMaterial.dynamicFriction = data.dynamicFriction;
6518
+ physicsMaterial.staticFriction = data.staticFriction;
6519
+ physicsMaterial.bounceCombine = data.bounceCombine;
6520
+ physicsMaterial.frictionCombine = data.frictionCombine;
6521
+ return physicsMaterial;
6522
+ });
6523
+ };
6524
+ return PhysicsMaterialLoader;
6525
+ }(Loader);
6526
+ PhysicsMaterialLoader = __decorate([
6527
+ resourceLoader(AssetType.PhysicsMaterial, [
6528
+ "mesh"
6529
+ ])
6530
+ ], PhysicsMaterialLoader);
6531
+
6405
6532
  var SceneLoader = /*#__PURE__*/ function(Loader) {
6406
6533
  _inherits(SceneLoader, Loader);
6407
6534
  function SceneLoader() {
@@ -6509,28 +6636,7 @@ var SceneLoader = /*#__PURE__*/ function(Loader) {
6509
6636
  // Post Process
6510
6637
  var postProcessData = data.scene.postProcess;
6511
6638
  if (postProcessData) {
6512
- // @ts-ignore
6513
- var postProcessManager = scene._postProcessManager;
6514
- var bloomEffect = postProcessManager._bloomEffect;
6515
- var tonemappingEffect = postProcessManager._tonemappingEffect;
6516
- postProcessManager.isActive = postProcessData.isActive;
6517
- bloomEffect.enabled = postProcessData.bloom.enabled;
6518
- bloomEffect.downScale = postProcessData.bloom.downScale;
6519
- bloomEffect.threshold = postProcessData.bloom.threshold;
6520
- bloomEffect.scatter = postProcessData.bloom.scatter;
6521
- bloomEffect.intensity = postProcessData.bloom.intensity;
6522
- bloomEffect.tint.copyFrom(postProcessData.bloom.tint);
6523
- bloomEffect.dirtIntensity = postProcessData.bloom.dirtIntensity;
6524
- tonemappingEffect.enabled = postProcessData.tonemapping.enabled;
6525
- tonemappingEffect.mode = postProcessData.tonemapping.mode;
6526
- if (postProcessData.bloom.dirtTexture) {
6527
- // @ts-ignore
6528
- // prettier-ignore
6529
- var dirtTexturePromise = resourceManager.getResourceByRef(postProcessData.bloom.dirtTexture).then(function(texture) {
6530
- bloomEffect.dirtTexture = texture;
6531
- });
6532
- promises.push(dirtTexturePromise);
6533
- }
6639
+ Logger.warn("Post Process is not supported in scene yet, please add PostProcess component in entity instead.");
6534
6640
  }
6535
6641
  return Promise.all(promises).then(function() {
6536
6642
  resolve(scene);
@@ -6694,6 +6800,59 @@ KHR_materials_pbrSpecularGlossiness = __decorate([
6694
6800
  registerGLTFExtension("KHR_materials_pbrSpecularGlossiness", GLTFExtensionMode.CreateAndParse)
6695
6801
  ], KHR_materials_pbrSpecularGlossiness);
6696
6802
 
6803
+ var KHR_materials_sheen = /*#__PURE__*/ function(GLTFExtensionParser) {
6804
+ _inherits(KHR_materials_sheen, GLTFExtensionParser);
6805
+ function KHR_materials_sheen() {
6806
+ return GLTFExtensionParser.apply(this, arguments) || this;
6807
+ }
6808
+ var _proto = KHR_materials_sheen.prototype;
6809
+ _proto.additiveParse = function additiveParse(context, material, schema) {
6810
+ var sheenColorFactor = schema.sheenColorFactor, sheenColorTexture = schema.sheenColorTexture, _schema_sheenRoughnessFactor = schema.sheenRoughnessFactor, sheenRoughnessFactor = _schema_sheenRoughnessFactor === void 0 ? 0 : _schema_sheenRoughnessFactor, sheenRoughnessTexture = schema.sheenRoughnessTexture;
6811
+ if (sheenColorFactor) {
6812
+ material.sheenColor.set(Color.linearToGammaSpace(sheenColorFactor[0]), Color.linearToGammaSpace(sheenColorFactor[1]), Color.linearToGammaSpace(sheenColorFactor[2]), undefined);
6813
+ }
6814
+ material.sheenRoughness = sheenRoughnessFactor;
6815
+ if (sheenColorTexture) {
6816
+ GLTFMaterialParser._checkOtherTextureTransform(sheenColorTexture, "Sheen texture");
6817
+ context.get(GLTFParserType.Texture, sheenColorTexture.index).then(function(texture) {
6818
+ material.sheenColorTexture = texture;
6819
+ });
6820
+ }
6821
+ if (sheenRoughnessTexture) {
6822
+ GLTFMaterialParser._checkOtherTextureTransform(sheenRoughnessTexture, "SheenRoughness texture");
6823
+ context.get(GLTFParserType.Texture, sheenRoughnessTexture.index).then(function(texture) {
6824
+ material.sheenRoughnessTexture = texture;
6825
+ });
6826
+ }
6827
+ };
6828
+ return KHR_materials_sheen;
6829
+ }(GLTFExtensionParser);
6830
+ KHR_materials_sheen = __decorate([
6831
+ registerGLTFExtension("KHR_materials_sheen", GLTFExtensionMode.AdditiveParse)
6832
+ ], KHR_materials_sheen);
6833
+
6834
+ var KHR_materials_transmission = /*#__PURE__*/ function(GLTFExtensionParser) {
6835
+ _inherits(KHR_materials_transmission, GLTFExtensionParser);
6836
+ function KHR_materials_transmission() {
6837
+ return GLTFExtensionParser.apply(this, arguments) || this;
6838
+ }
6839
+ var _proto = KHR_materials_transmission.prototype;
6840
+ _proto.additiveParse = function additiveParse(context, material, schema) {
6841
+ var _schema_transmissionFactor = schema.transmissionFactor, transmissionFactor = _schema_transmissionFactor === void 0 ? 0 : _schema_transmissionFactor, transmissionTexture = schema.transmissionTexture;
6842
+ material.transmission = transmissionFactor;
6843
+ if (transmissionTexture) {
6844
+ GLTFMaterialParser._checkOtherTextureTransform(transmissionTexture, "Transmission texture");
6845
+ context.get(GLTFParserType.Texture, transmissionTexture.index).then(function(texture) {
6846
+ material.transmissionTexture = texture;
6847
+ });
6848
+ }
6849
+ };
6850
+ return KHR_materials_transmission;
6851
+ }(GLTFExtensionParser);
6852
+ KHR_materials_transmission = __decorate([
6853
+ registerGLTFExtension("KHR_materials_transmission", GLTFExtensionMode.AdditiveParse)
6854
+ ], KHR_materials_transmission);
6855
+
6697
6856
  var KHR_materials_unlit = /*#__PURE__*/ function(GLTFExtensionParser) {
6698
6857
  _inherits(KHR_materials_unlit, GLTFExtensionParser);
6699
6858
  function KHR_materials_unlit() {
@@ -6746,6 +6905,32 @@ KHR_materials_variants = __decorate([
6746
6905
  registerGLTFExtension("KHR_materials_variants", GLTFExtensionMode.AdditiveParse)
6747
6906
  ], KHR_materials_variants);
6748
6907
 
6908
+ var KHR_materials_volume = /*#__PURE__*/ function(GLTFExtensionParser) {
6909
+ _inherits(KHR_materials_volume, GLTFExtensionParser);
6910
+ function KHR_materials_volume() {
6911
+ return GLTFExtensionParser.apply(this, arguments) || this;
6912
+ }
6913
+ var _proto = KHR_materials_volume.prototype;
6914
+ _proto.additiveParse = function additiveParse(context, material, schema) {
6915
+ var _schema_thicknessFactor = schema.thicknessFactor, thicknessFactor = _schema_thicknessFactor === void 0 ? 0 : _schema_thicknessFactor, thicknessTexture = schema.thicknessTexture, _schema_attenuationDistance = schema.attenuationDistance, attenuationDistance = _schema_attenuationDistance === void 0 ? Infinity : _schema_attenuationDistance, attenuationColor = schema.attenuationColor;
6916
+ material.thickness = thicknessFactor;
6917
+ material.attenuationDistance = attenuationDistance;
6918
+ if (attenuationColor) {
6919
+ material.attenuationColor.set(Color.linearToGammaSpace(attenuationColor[0]), Color.linearToGammaSpace(attenuationColor[1]), Color.linearToGammaSpace(attenuationColor[2]), undefined);
6920
+ }
6921
+ if (thicknessTexture) {
6922
+ GLTFMaterialParser._checkOtherTextureTransform(thicknessTexture, "Thickness texture");
6923
+ context.get(GLTFParserType.Texture, thicknessTexture.index).then(function(texture) {
6924
+ material.thicknessTexture = texture;
6925
+ });
6926
+ }
6927
+ };
6928
+ return KHR_materials_volume;
6929
+ }(GLTFExtensionParser);
6930
+ KHR_materials_volume = __decorate([
6931
+ registerGLTFExtension("KHR_materials_volume", GLTFExtensionMode.AdditiveParse)
6932
+ ], KHR_materials_volume);
6933
+
6749
6934
  var KHR_mesh_quantization = /*#__PURE__*/ function(GLTFExtensionParser) {
6750
6935
  _inherits(KHR_mesh_quantization, GLTFExtensionParser);
6751
6936
  function KHR_mesh_quantization() {