@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/main.js +245 -60
- package/dist/main.js.map +1 -1
- package/dist/module.js +246 -61
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
- package/types/AudioLoader.d.ts +1 -0
- package/types/GLTFContentRestorer.d.ts +1 -2
- package/types/PhysicsMaterialLoader.d.ts +1 -0
- package/types/Texture2DContentRestorer.d.ts +1 -2
- package/types/TextureCubeContentRestorer.d.ts +1 -2
- package/types/gltf/extensions/GLTFExtensionSchema.d.ts +10 -1
- package/types/gltf/extensions/KHR_materials_sheen.d.ts +1 -0
- package/types/gltf/extensions/KHR_materials_transmission.d.ts +1 -0
- package/types/gltf/extensions/KHR_materials_volume.d.ts +1 -0
- package/types/index.d.ts +2 -0
- package/types/resource-deserialize/resources/parser/ParserContext.d.ts +5 -10
- package/types/resource-deserialize/resources/parser/ReflectionParser.d.ts +1 -0
- package/types/resource-deserialize/resources/schema/BasicSchema.d.ts +4 -0
package/dist/main.js
CHANGED
|
@@ -537,11 +537,7 @@ var ParserType = /*#__PURE__*/ function(ParserType) {
|
|
|
537
537
|
return ParserType;
|
|
538
538
|
}({});
|
|
539
539
|
/**
|
|
540
|
-
*
|
|
541
|
-
* @export
|
|
542
|
-
* @class ParserContext
|
|
543
|
-
* @template T
|
|
544
|
-
* @template I
|
|
540
|
+
* @internal
|
|
545
541
|
*/ var ParserContext = /*#__PURE__*/ function() {
|
|
546
542
|
function ParserContext(engine, type, resource) {
|
|
547
543
|
if (type === void 0) type = 1;
|
|
@@ -553,13 +549,39 @@ var ParserType = /*#__PURE__*/ function(ParserType) {
|
|
|
553
549
|
this.components = new Map();
|
|
554
550
|
this.rootIds = [];
|
|
555
551
|
this.strippedIds = [];
|
|
552
|
+
this.componentWaitingMap = new Map();
|
|
556
553
|
this.resourceManager = engine.resourceManager;
|
|
557
554
|
}
|
|
558
555
|
var _proto = ParserContext.prototype;
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
556
|
+
_proto.addComponent = function addComponent(id, component) {
|
|
557
|
+
this.components.set(id, component);
|
|
558
|
+
var waitingList = this.componentWaitingMap.get(id);
|
|
559
|
+
if (waitingList == null ? void 0 : waitingList.length) {
|
|
560
|
+
waitingList.forEach(function(resolve) {
|
|
561
|
+
return resolve(component);
|
|
562
|
+
});
|
|
563
|
+
this.componentWaitingMap.delete(id);
|
|
564
|
+
}
|
|
565
|
+
};
|
|
566
|
+
_proto.getComponentByRef = function getComponentByRef(ref) {
|
|
567
|
+
var _this = this;
|
|
568
|
+
return new Promise(function(resolve, reject) {
|
|
569
|
+
var component = _this.components.get(ref.componentId);
|
|
570
|
+
if (component) {
|
|
571
|
+
resolve(component);
|
|
572
|
+
} else {
|
|
573
|
+
var resolves = _this.componentWaitingMap.get(ref.componentId);
|
|
574
|
+
if (resolves) {
|
|
575
|
+
resolves.push(resolve);
|
|
576
|
+
} else {
|
|
577
|
+
_this.componentWaitingMap.set(ref.componentId, [
|
|
578
|
+
resolve
|
|
579
|
+
]);
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
});
|
|
583
|
+
};
|
|
584
|
+
_proto.clear = function clear() {
|
|
563
585
|
this.entityMap.clear();
|
|
564
586
|
this.components.clear();
|
|
565
587
|
this.entityConfigMap.clear();
|
|
@@ -659,6 +681,8 @@ var ReflectionParser = /*#__PURE__*/ function() {
|
|
|
659
681
|
}
|
|
660
682
|
return resource;
|
|
661
683
|
});
|
|
684
|
+
} else if (ReflectionParser._isComponentRef(value)) {
|
|
685
|
+
return this._context.getComponentByRef(value);
|
|
662
686
|
} else if (ReflectionParser._isEntityRef(value)) {
|
|
663
687
|
// entity reference
|
|
664
688
|
return Promise.resolve(this._context.entityMap.get(value.entityId));
|
|
@@ -720,13 +744,16 @@ var ReflectionParser = /*#__PURE__*/ function() {
|
|
|
720
744
|
this.customParseComponentHandles[componentType] = handle;
|
|
721
745
|
};
|
|
722
746
|
ReflectionParser._isClass = function _isClass(value) {
|
|
723
|
-
return value["class"]
|
|
747
|
+
return value["class"] !== undefined;
|
|
724
748
|
};
|
|
725
749
|
ReflectionParser._isAssetRef = function _isAssetRef(value) {
|
|
726
|
-
return value["refId"]
|
|
750
|
+
return value["refId"] !== undefined;
|
|
727
751
|
};
|
|
728
752
|
ReflectionParser._isEntityRef = function _isEntityRef(value) {
|
|
729
|
-
return value["entityId"]
|
|
753
|
+
return value["entityId"] !== undefined;
|
|
754
|
+
};
|
|
755
|
+
ReflectionParser._isComponentRef = function _isComponentRef(value) {
|
|
756
|
+
return value["ownerId"] !== undefined && value["componentId"] !== undefined;
|
|
730
757
|
};
|
|
731
758
|
return ReflectionParser;
|
|
732
759
|
}();
|
|
@@ -1083,7 +1110,6 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
|
1083
1110
|
_proto._parseComponents = function _parseComponents() {
|
|
1084
1111
|
var entitiesConfig = this.data.entities;
|
|
1085
1112
|
var entityMap = this.context.entityMap;
|
|
1086
|
-
var components = this.context.components;
|
|
1087
1113
|
var promises = [];
|
|
1088
1114
|
for(var i = 0, l = entitiesConfig.length; i < l; i++){
|
|
1089
1115
|
var entityConfig = entitiesConfig[i];
|
|
@@ -1092,11 +1118,17 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
|
1092
1118
|
var componentConfig = entityConfig.components[i1];
|
|
1093
1119
|
var key = !componentConfig.refId ? componentConfig.class : componentConfig.refId;
|
|
1094
1120
|
var component = entity.addComponent(engineCore.Loader.getClass(key));
|
|
1095
|
-
|
|
1121
|
+
this.context.addComponent(componentConfig.id, component);
|
|
1096
1122
|
var promise = this._reflectionParser.parsePropsAndMethods(component, componentConfig);
|
|
1097
1123
|
promises.push(promise);
|
|
1098
1124
|
}
|
|
1099
1125
|
}
|
|
1126
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.context.componentWaitingMap.values()), _step; !(_step = _iterator()).done;){
|
|
1127
|
+
var waitingList = _step.value;
|
|
1128
|
+
waitingList.forEach(function(resolve) {
|
|
1129
|
+
return resolve(null);
|
|
1130
|
+
});
|
|
1131
|
+
}
|
|
1100
1132
|
return Promise.all(promises);
|
|
1101
1133
|
};
|
|
1102
1134
|
_proto._parsePrefabModification = function _parsePrefabModification() {
|
|
@@ -1574,32 +1606,18 @@ var EnvLoader = /*#__PURE__*/ function(Loader) {
|
|
|
1574
1606
|
var _proto = EnvLoader.prototype;
|
|
1575
1607
|
_proto.load = function load(item, resourceManager) {
|
|
1576
1608
|
return new engineCore.AssetPromise(function(resolve, reject) {
|
|
1577
|
-
|
|
1578
|
-
._request(item.url, _extends({}, item, {
|
|
1609
|
+
var requestConfig = _extends({}, item, {
|
|
1579
1610
|
type: "arraybuffer"
|
|
1580
|
-
})
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
var
|
|
1585
|
-
|
|
1586
|
-
var texture = new engineCore.TextureCube(engine, size);
|
|
1587
|
-
texture.filterMode = engineCore.TextureFilterMode.Trilinear;
|
|
1588
|
-
var mipmapCount = texture.mipmapCount;
|
|
1589
|
-
var offset = shByteLength + 2;
|
|
1590
|
-
for(var mipLevel = 0; mipLevel < mipmapCount; mipLevel++){
|
|
1591
|
-
var mipSize = size >> mipLevel;
|
|
1592
|
-
for(var face = 0; face < 6; face++){
|
|
1593
|
-
var dataSize = mipSize * mipSize * 4;
|
|
1594
|
-
var data = new Uint8Array(arraybuffer, offset, dataSize);
|
|
1595
|
-
offset += dataSize;
|
|
1596
|
-
texture.setPixelBuffer(engineCore.TextureCubeFace.PositiveX + face, data, mipLevel);
|
|
1597
|
-
}
|
|
1598
|
-
}
|
|
1611
|
+
});
|
|
1612
|
+
var engine = resourceManager.engine;
|
|
1613
|
+
resourceManager// @ts-ignore
|
|
1614
|
+
._request(item.url, requestConfig).then(function(arraybuffer) {
|
|
1615
|
+
var texture = EnvLoader._setTextureByBuffer(engine, arraybuffer);
|
|
1616
|
+
engine.resourceManager.addContentRestorer(new EnvContentRestorer(texture, item.url, requestConfig));
|
|
1599
1617
|
var ambientLight = new engineCore.AmbientLight(engine);
|
|
1600
1618
|
var sh = new engineMath.SphericalHarmonics3();
|
|
1601
1619
|
ambientLight.diffuseMode = engineCore.DiffuseMode.SphericalHarmonics;
|
|
1602
|
-
sh.copyFromArray(
|
|
1620
|
+
sh.copyFromArray(new Float32Array(arraybuffer, 0, 27));
|
|
1603
1621
|
ambientLight.diffuseSphericalHarmonics = sh;
|
|
1604
1622
|
ambientLight.specularTexture = texture;
|
|
1605
1623
|
ambientLight.specularTextureDecodeRGBM = true;
|
|
@@ -1609,6 +1627,27 @@ var EnvLoader = /*#__PURE__*/ function(Loader) {
|
|
|
1609
1627
|
});
|
|
1610
1628
|
});
|
|
1611
1629
|
};
|
|
1630
|
+
/**
|
|
1631
|
+
* @internal
|
|
1632
|
+
*/ EnvLoader._setTextureByBuffer = function _setTextureByBuffer(engine, buffer, texture) {
|
|
1633
|
+
var _this;
|
|
1634
|
+
var shByteLength = 27 * 4;
|
|
1635
|
+
var size = (_this = new Uint16Array(buffer, shByteLength, 1)) == null ? void 0 : _this[0];
|
|
1636
|
+
texture || (texture = new engineCore.TextureCube(engine, size));
|
|
1637
|
+
texture.filterMode = engineCore.TextureFilterMode.Trilinear;
|
|
1638
|
+
var mipmapCount = texture.mipmapCount;
|
|
1639
|
+
var offset = shByteLength + 2;
|
|
1640
|
+
for(var mipLevel = 0; mipLevel < mipmapCount; mipLevel++){
|
|
1641
|
+
var mipSize = size >> mipLevel;
|
|
1642
|
+
for(var face = 0; face < 6; face++){
|
|
1643
|
+
var dataSize = mipSize * mipSize * 4;
|
|
1644
|
+
var data = new Uint8Array(buffer, offset, dataSize);
|
|
1645
|
+
offset += dataSize;
|
|
1646
|
+
texture.setPixelBuffer(engineCore.TextureCubeFace.PositiveX + face, data, mipLevel);
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
return texture;
|
|
1650
|
+
};
|
|
1612
1651
|
return EnvLoader;
|
|
1613
1652
|
}(engineCore.Loader);
|
|
1614
1653
|
EnvLoader = __decorate([
|
|
@@ -1616,6 +1655,27 @@ EnvLoader = __decorate([
|
|
|
1616
1655
|
"env"
|
|
1617
1656
|
])
|
|
1618
1657
|
], EnvLoader);
|
|
1658
|
+
/**
|
|
1659
|
+
* @internal
|
|
1660
|
+
*/ var EnvContentRestorer = /*#__PURE__*/ function(ContentRestorer) {
|
|
1661
|
+
_inherits(EnvContentRestorer, ContentRestorer);
|
|
1662
|
+
function EnvContentRestorer(resource, url, requestConfig) {
|
|
1663
|
+
var _this;
|
|
1664
|
+
_this = ContentRestorer.call(this, resource) || this, _this.url = url, _this.requestConfig = requestConfig;
|
|
1665
|
+
return _this;
|
|
1666
|
+
}
|
|
1667
|
+
var _proto = EnvContentRestorer.prototype;
|
|
1668
|
+
_proto.restoreContent = function restoreContent() {
|
|
1669
|
+
var _this = this;
|
|
1670
|
+
return new engineCore.AssetPromise(function(resolve, reject) {
|
|
1671
|
+
engineCore.request(_this.url, _this.requestConfig).then(function(buffer) {
|
|
1672
|
+
EnvLoader._setTextureByBuffer(_this.resource.engine, buffer, _this.resource);
|
|
1673
|
+
resolve(_this.resource);
|
|
1674
|
+
}).catch(reject);
|
|
1675
|
+
});
|
|
1676
|
+
};
|
|
1677
|
+
return EnvContentRestorer;
|
|
1678
|
+
}(engineCore.ContentRestorer);
|
|
1619
1679
|
|
|
1620
1680
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1621
1681
|
try {
|
|
@@ -2033,7 +2093,7 @@ FontLoader = __decorate([
|
|
|
2033
2093
|
task.total += 1;
|
|
2034
2094
|
taskPromise.then(function() {
|
|
2035
2095
|
_this._setTaskCompleteProgress(++task.loaded, task.total);
|
|
2036
|
-
});
|
|
2096
|
+
}, function() {});
|
|
2037
2097
|
};
|
|
2038
2098
|
_proto._handleSubAsset = function _handleSubAsset(resource, type, index) {
|
|
2039
2099
|
var _this = this;
|
|
@@ -6323,6 +6383,45 @@ TextureCubeLoader = __decorate([
|
|
|
6323
6383
|
])
|
|
6324
6384
|
], TextureCubeLoader);
|
|
6325
6385
|
|
|
6386
|
+
var AudioLoader = /*#__PURE__*/ function(Loader) {
|
|
6387
|
+
_inherits(AudioLoader, Loader);
|
|
6388
|
+
function AudioLoader() {
|
|
6389
|
+
return Loader.apply(this, arguments) || this;
|
|
6390
|
+
}
|
|
6391
|
+
var _proto = AudioLoader.prototype;
|
|
6392
|
+
_proto.load = function load(item, resourceManager) {
|
|
6393
|
+
return new engineCore.AssetPromise(function(resolve, reject) {
|
|
6394
|
+
var url = item.url;
|
|
6395
|
+
var requestConfig = _extends({}, item, {
|
|
6396
|
+
type: "arraybuffer"
|
|
6397
|
+
});
|
|
6398
|
+
// @ts-ignore
|
|
6399
|
+
resourceManager._request(url, requestConfig).then(function(arrayBuffer) {
|
|
6400
|
+
var audioClip = new engineCore.AudioClip(resourceManager.engine);
|
|
6401
|
+
engineCore.AudioManager.getContext().decodeAudioData(arrayBuffer).then(function(result) {
|
|
6402
|
+
// @ts-ignore
|
|
6403
|
+
audioClip._setAudioSource(result);
|
|
6404
|
+
if (url.indexOf("data:") !== 0) {
|
|
6405
|
+
var index = url.lastIndexOf("/");
|
|
6406
|
+
audioClip.name = url.substring(index + 1);
|
|
6407
|
+
}
|
|
6408
|
+
resolve(audioClip);
|
|
6409
|
+
}).catch(function(e) {
|
|
6410
|
+
reject(e);
|
|
6411
|
+
});
|
|
6412
|
+
});
|
|
6413
|
+
});
|
|
6414
|
+
};
|
|
6415
|
+
return AudioLoader;
|
|
6416
|
+
}(engineCore.Loader);
|
|
6417
|
+
AudioLoader = __decorate([
|
|
6418
|
+
engineCore.resourceLoader(engineCore.AssetType.Audio, [
|
|
6419
|
+
"mp3",
|
|
6420
|
+
"ogg",
|
|
6421
|
+
"wav"
|
|
6422
|
+
])
|
|
6423
|
+
], AudioLoader);
|
|
6424
|
+
|
|
6326
6425
|
var ShaderChunkLoader = /*#__PURE__*/ function(Loader) {
|
|
6327
6426
|
_inherits(ShaderChunkLoader, Loader);
|
|
6328
6427
|
function ShaderChunkLoader() {
|
|
@@ -6360,7 +6459,7 @@ var ShaderChunkLoader = /*#__PURE__*/ function(Loader) {
|
|
|
6360
6459
|
};
|
|
6361
6460
|
return ShaderChunkLoader;
|
|
6362
6461
|
}(engineCore.Loader);
|
|
6363
|
-
ShaderChunkLoader._shaderIncludeRegex =
|
|
6462
|
+
ShaderChunkLoader._shaderIncludeRegex = /#include\s+"([./][^\\"]+)"/gm;
|
|
6364
6463
|
ShaderChunkLoader = __decorate([
|
|
6365
6464
|
engineCore.resourceLoader("ShaderChunk", [
|
|
6366
6465
|
"glsl"
|
|
@@ -6406,6 +6505,34 @@ ShaderLoader = __decorate([
|
|
|
6406
6505
|
])
|
|
6407
6506
|
], ShaderLoader);
|
|
6408
6507
|
|
|
6508
|
+
var PhysicsMaterialLoader = /*#__PURE__*/ function(Loader) {
|
|
6509
|
+
_inherits(PhysicsMaterialLoader, Loader);
|
|
6510
|
+
function PhysicsMaterialLoader() {
|
|
6511
|
+
return Loader.apply(this, arguments) || this;
|
|
6512
|
+
}
|
|
6513
|
+
var _proto = PhysicsMaterialLoader.prototype;
|
|
6514
|
+
_proto.load = function load(item, resourceManager) {
|
|
6515
|
+
return resourceManager// @ts-ignore
|
|
6516
|
+
._request(item.url, _extends({}, item, {
|
|
6517
|
+
type: "json"
|
|
6518
|
+
})).then(function(data) {
|
|
6519
|
+
var physicsMaterial = new engineCore.PhysicsMaterial();
|
|
6520
|
+
physicsMaterial.bounciness = data.bounciness;
|
|
6521
|
+
physicsMaterial.dynamicFriction = data.dynamicFriction;
|
|
6522
|
+
physicsMaterial.staticFriction = data.staticFriction;
|
|
6523
|
+
physicsMaterial.bounceCombine = data.bounceCombine;
|
|
6524
|
+
physicsMaterial.frictionCombine = data.frictionCombine;
|
|
6525
|
+
return physicsMaterial;
|
|
6526
|
+
});
|
|
6527
|
+
};
|
|
6528
|
+
return PhysicsMaterialLoader;
|
|
6529
|
+
}(engineCore.Loader);
|
|
6530
|
+
PhysicsMaterialLoader = __decorate([
|
|
6531
|
+
engineCore.resourceLoader(engineCore.AssetType.PhysicsMaterial, [
|
|
6532
|
+
"mesh"
|
|
6533
|
+
])
|
|
6534
|
+
], PhysicsMaterialLoader);
|
|
6535
|
+
|
|
6409
6536
|
var SceneLoader = /*#__PURE__*/ function(Loader) {
|
|
6410
6537
|
_inherits(SceneLoader, Loader);
|
|
6411
6538
|
function SceneLoader() {
|
|
@@ -6513,28 +6640,7 @@ var SceneLoader = /*#__PURE__*/ function(Loader) {
|
|
|
6513
6640
|
// Post Process
|
|
6514
6641
|
var postProcessData = data.scene.postProcess;
|
|
6515
6642
|
if (postProcessData) {
|
|
6516
|
-
|
|
6517
|
-
var postProcessManager = scene._postProcessManager;
|
|
6518
|
-
var bloomEffect = postProcessManager._bloomEffect;
|
|
6519
|
-
var tonemappingEffect = postProcessManager._tonemappingEffect;
|
|
6520
|
-
postProcessManager.isActive = postProcessData.isActive;
|
|
6521
|
-
bloomEffect.enabled = postProcessData.bloom.enabled;
|
|
6522
|
-
bloomEffect.downScale = postProcessData.bloom.downScale;
|
|
6523
|
-
bloomEffect.threshold = postProcessData.bloom.threshold;
|
|
6524
|
-
bloomEffect.scatter = postProcessData.bloom.scatter;
|
|
6525
|
-
bloomEffect.intensity = postProcessData.bloom.intensity;
|
|
6526
|
-
bloomEffect.tint.copyFrom(postProcessData.bloom.tint);
|
|
6527
|
-
bloomEffect.dirtIntensity = postProcessData.bloom.dirtIntensity;
|
|
6528
|
-
tonemappingEffect.enabled = postProcessData.tonemapping.enabled;
|
|
6529
|
-
tonemappingEffect.mode = postProcessData.tonemapping.mode;
|
|
6530
|
-
if (postProcessData.bloom.dirtTexture) {
|
|
6531
|
-
// @ts-ignore
|
|
6532
|
-
// prettier-ignore
|
|
6533
|
-
var dirtTexturePromise = resourceManager.getResourceByRef(postProcessData.bloom.dirtTexture).then(function(texture) {
|
|
6534
|
-
bloomEffect.dirtTexture = texture;
|
|
6535
|
-
});
|
|
6536
|
-
promises.push(dirtTexturePromise);
|
|
6537
|
-
}
|
|
6643
|
+
engineCore.Logger.warn("Post Process is not supported in scene yet, please add PostProcess component in entity instead.");
|
|
6538
6644
|
}
|
|
6539
6645
|
return Promise.all(promises).then(function() {
|
|
6540
6646
|
resolve(scene);
|
|
@@ -6698,6 +6804,59 @@ KHR_materials_pbrSpecularGlossiness = __decorate([
|
|
|
6698
6804
|
registerGLTFExtension("KHR_materials_pbrSpecularGlossiness", GLTFExtensionMode.CreateAndParse)
|
|
6699
6805
|
], KHR_materials_pbrSpecularGlossiness);
|
|
6700
6806
|
|
|
6807
|
+
var KHR_materials_sheen = /*#__PURE__*/ function(GLTFExtensionParser) {
|
|
6808
|
+
_inherits(KHR_materials_sheen, GLTFExtensionParser);
|
|
6809
|
+
function KHR_materials_sheen() {
|
|
6810
|
+
return GLTFExtensionParser.apply(this, arguments) || this;
|
|
6811
|
+
}
|
|
6812
|
+
var _proto = KHR_materials_sheen.prototype;
|
|
6813
|
+
_proto.additiveParse = function additiveParse(context, material, schema) {
|
|
6814
|
+
var sheenColorFactor = schema.sheenColorFactor, sheenColorTexture = schema.sheenColorTexture, _schema_sheenRoughnessFactor = schema.sheenRoughnessFactor, sheenRoughnessFactor = _schema_sheenRoughnessFactor === void 0 ? 0 : _schema_sheenRoughnessFactor, sheenRoughnessTexture = schema.sheenRoughnessTexture;
|
|
6815
|
+
if (sheenColorFactor) {
|
|
6816
|
+
material.sheenColor.set(engineMath.Color.linearToGammaSpace(sheenColorFactor[0]), engineMath.Color.linearToGammaSpace(sheenColorFactor[1]), engineMath.Color.linearToGammaSpace(sheenColorFactor[2]), undefined);
|
|
6817
|
+
}
|
|
6818
|
+
material.sheenRoughness = sheenRoughnessFactor;
|
|
6819
|
+
if (sheenColorTexture) {
|
|
6820
|
+
exports.GLTFMaterialParser._checkOtherTextureTransform(sheenColorTexture, "Sheen texture");
|
|
6821
|
+
context.get(GLTFParserType.Texture, sheenColorTexture.index).then(function(texture) {
|
|
6822
|
+
material.sheenColorTexture = texture;
|
|
6823
|
+
});
|
|
6824
|
+
}
|
|
6825
|
+
if (sheenRoughnessTexture) {
|
|
6826
|
+
exports.GLTFMaterialParser._checkOtherTextureTransform(sheenRoughnessTexture, "SheenRoughness texture");
|
|
6827
|
+
context.get(GLTFParserType.Texture, sheenRoughnessTexture.index).then(function(texture) {
|
|
6828
|
+
material.sheenRoughnessTexture = texture;
|
|
6829
|
+
});
|
|
6830
|
+
}
|
|
6831
|
+
};
|
|
6832
|
+
return KHR_materials_sheen;
|
|
6833
|
+
}(GLTFExtensionParser);
|
|
6834
|
+
KHR_materials_sheen = __decorate([
|
|
6835
|
+
registerGLTFExtension("KHR_materials_sheen", GLTFExtensionMode.AdditiveParse)
|
|
6836
|
+
], KHR_materials_sheen);
|
|
6837
|
+
|
|
6838
|
+
var KHR_materials_transmission = /*#__PURE__*/ function(GLTFExtensionParser) {
|
|
6839
|
+
_inherits(KHR_materials_transmission, GLTFExtensionParser);
|
|
6840
|
+
function KHR_materials_transmission() {
|
|
6841
|
+
return GLTFExtensionParser.apply(this, arguments) || this;
|
|
6842
|
+
}
|
|
6843
|
+
var _proto = KHR_materials_transmission.prototype;
|
|
6844
|
+
_proto.additiveParse = function additiveParse(context, material, schema) {
|
|
6845
|
+
var _schema_transmissionFactor = schema.transmissionFactor, transmissionFactor = _schema_transmissionFactor === void 0 ? 0 : _schema_transmissionFactor, transmissionTexture = schema.transmissionTexture;
|
|
6846
|
+
material.transmission = transmissionFactor;
|
|
6847
|
+
if (transmissionTexture) {
|
|
6848
|
+
exports.GLTFMaterialParser._checkOtherTextureTransform(transmissionTexture, "Transmission texture");
|
|
6849
|
+
context.get(GLTFParserType.Texture, transmissionTexture.index).then(function(texture) {
|
|
6850
|
+
material.transmissionTexture = texture;
|
|
6851
|
+
});
|
|
6852
|
+
}
|
|
6853
|
+
};
|
|
6854
|
+
return KHR_materials_transmission;
|
|
6855
|
+
}(GLTFExtensionParser);
|
|
6856
|
+
KHR_materials_transmission = __decorate([
|
|
6857
|
+
registerGLTFExtension("KHR_materials_transmission", GLTFExtensionMode.AdditiveParse)
|
|
6858
|
+
], KHR_materials_transmission);
|
|
6859
|
+
|
|
6701
6860
|
var KHR_materials_unlit = /*#__PURE__*/ function(GLTFExtensionParser) {
|
|
6702
6861
|
_inherits(KHR_materials_unlit, GLTFExtensionParser);
|
|
6703
6862
|
function KHR_materials_unlit() {
|
|
@@ -6750,6 +6909,32 @@ KHR_materials_variants = __decorate([
|
|
|
6750
6909
|
registerGLTFExtension("KHR_materials_variants", GLTFExtensionMode.AdditiveParse)
|
|
6751
6910
|
], KHR_materials_variants);
|
|
6752
6911
|
|
|
6912
|
+
var KHR_materials_volume = /*#__PURE__*/ function(GLTFExtensionParser) {
|
|
6913
|
+
_inherits(KHR_materials_volume, GLTFExtensionParser);
|
|
6914
|
+
function KHR_materials_volume() {
|
|
6915
|
+
return GLTFExtensionParser.apply(this, arguments) || this;
|
|
6916
|
+
}
|
|
6917
|
+
var _proto = KHR_materials_volume.prototype;
|
|
6918
|
+
_proto.additiveParse = function additiveParse(context, material, schema) {
|
|
6919
|
+
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;
|
|
6920
|
+
material.thickness = thicknessFactor;
|
|
6921
|
+
material.attenuationDistance = attenuationDistance;
|
|
6922
|
+
if (attenuationColor) {
|
|
6923
|
+
material.attenuationColor.set(engineMath.Color.linearToGammaSpace(attenuationColor[0]), engineMath.Color.linearToGammaSpace(attenuationColor[1]), engineMath.Color.linearToGammaSpace(attenuationColor[2]), undefined);
|
|
6924
|
+
}
|
|
6925
|
+
if (thicknessTexture) {
|
|
6926
|
+
exports.GLTFMaterialParser._checkOtherTextureTransform(thicknessTexture, "Thickness texture");
|
|
6927
|
+
context.get(GLTFParserType.Texture, thicknessTexture.index).then(function(texture) {
|
|
6928
|
+
material.thicknessTexture = texture;
|
|
6929
|
+
});
|
|
6930
|
+
}
|
|
6931
|
+
};
|
|
6932
|
+
return KHR_materials_volume;
|
|
6933
|
+
}(GLTFExtensionParser);
|
|
6934
|
+
KHR_materials_volume = __decorate([
|
|
6935
|
+
registerGLTFExtension("KHR_materials_volume", GLTFExtensionMode.AdditiveParse)
|
|
6936
|
+
], KHR_materials_volume);
|
|
6937
|
+
|
|
6753
6938
|
var KHR_mesh_quantization = /*#__PURE__*/ function(GLTFExtensionParser) {
|
|
6754
6939
|
_inherits(KHR_mesh_quantization, GLTFExtensionParser);
|
|
6755
6940
|
function KHR_mesh_quantization() {
|