@galacean/engine-loader 1.6.5 → 1.6.7

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, AssetPromise, AnimationClip, AnimationEvent, Loader, AnimationStringCurve, Keyframe, AnimationBoolCurve, AnimationRefCurve, AnimationQuaternionCurve, AnimationColorCurve, AnimationVector4Curve, AnimationVector3Curve, AnimationVector2Curve, AnimationFloatArrayCurve, AnimationArrayCurve, AnimationFloatCurve, ModelMesh, BlendShape, Entity, Transform, Texture2D, ReferResource, resourceLoader, ContentRestorer, DiffuseMode, BackgroundMode, AssetType, AnimatorController, AnimatorControllerLayer, AnimatorStateTransition, AmbientLight, TextureCube, TextureFilterMode, TextureCubeFace, Font, SystemInfo, Animator, Logger, IndexFormat, VertexElementFormat, GLCapabilityType, TextureFormat, request, InterpolationType, SkinnedMeshRenderer, PBRMaterial, TextureCoordinate, RenderFace, VertexElement, Buffer, BufferBindFlag, BufferUsage, Camera, MeshRenderer, Skin, TextureWrapMode as TextureWrapMode$1, AnimatorStateMachine, Shader, Material, PrimitiveMesh, SpriteAtlas, Sprite, TextureUtils, AudioClip, AudioManager, ShaderFactory, ShaderLib, PhysicsMaterial, Scene, DirectLight, PointLight, SpotLight, UnlitMaterial } from '@galacean/engine-core';
1
+ import { Utils, AssetPromise, AnimationClip, AnimationEvent, Loader, AnimationStringCurve, Keyframe, AnimationBoolCurve, AnimationRefCurve, AnimationQuaternionCurve, AnimationColorCurve, AnimationVector4Curve, AnimationVector3Curve, AnimationVector2Curve, AnimationFloatArrayCurve, AnimationArrayCurve, AnimationFloatCurve, ModelMesh, BlendShape, Entity, Transform, Texture2D, ReferResource, resourceLoader, ContentRestorer, DiffuseMode, BackgroundMode, AssetType, AnimatorController, AnimatorControllerLayer, AnimatorStateTransition, AmbientLight, TextureCube, TextureFilterMode, TextureCubeFace, Font, SystemInfo, Animator, Logger, IndexFormat, VertexElementFormat, GLCapabilityType, TextureFormat, request, InterpolationType, SkinnedMeshRenderer, PBRMaterial, TextureCoordinate, RenderFace, VertexElement, Buffer, BufferBindFlag, BufferUsage, Camera, MeshRenderer, Skin, TextureWrapMode as TextureWrapMode$1, TextureUtils, AnimatorStateMachine, Shader, Material, PrimitiveMesh, SpriteAtlas, Sprite, AudioClip, AudioManager, ShaderFactory, ShaderLib, PhysicsMaterial, Scene, DirectLight, PointLight, SpotLight, UnlitMaterial } from '@galacean/engine-core';
2
2
  import { Quaternion, Vector4, Color, Vector3, Vector2, SphericalHarmonics3, MathUtil, BoundingBox, Matrix, Rect } from '@galacean/engine-math';
3
3
  import { GLCompressedTextureInternalFormat } from '@galacean/engine-rhi-webgl';
4
4
 
@@ -5062,7 +5062,11 @@ var GLTFTextureParser = /*#__PURE__*/ function(GLTFParser1) {
5062
5062
  var buffer = buffers[bufferView.buffer];
5063
5063
  var imageBuffer = new Uint8Array(buffer, bufferView.byteOffset, bufferView.byteLength);
5064
5064
  return GLTFUtils.loadImageBuffer(imageBuffer, mimeType).then(function(image) {
5065
- var texture = new Texture2D(engine, image.width, image.height, undefined, samplerInfo == null ? void 0 : samplerInfo.mipmap, isSRGBColorSpace);
5065
+ var width = image.width, height = image.height;
5066
+ var format = TextureFormat.R8G8B8A8;
5067
+ var _samplerInfo_mipmap;
5068
+ var generateMipmap = TextureUtils.supportGenerateMipmapsWithCorrection(engine, width, height, format, (_samplerInfo_mipmap = samplerInfo == null ? void 0 : samplerInfo.mipmap) != null ? _samplerInfo_mipmap : true, isSRGBColorSpace);
5069
+ var texture = new Texture2D(engine, width, height, format, generateMipmap, isSRGBColorSpace);
5066
5070
  texture.setImageSource(image);
5067
5071
  texture.generateMipmaps();
5068
5072
  texture.name = textureName || imageName || "texture_" + textureIndex;
@@ -6391,10 +6395,9 @@ var Texture2DLoader = /*#__PURE__*/ function(Loader) {
6391
6395
  var _item_params;
6392
6396
  var _ref = (_item_params = item.params) != null ? _item_params : {}, _ref_format = _ref.format, format = _ref_format === void 0 ? TextureFormat.R8G8B8A8 : _ref_format, anisoLevel = _ref.anisoLevel, wrapModeU = _ref.wrapModeU, wrapModeV = _ref.wrapModeV, filterMode = _ref.filterMode, _ref_isSRGBColorSpace = _ref.isSRGBColorSpace, isSRGBColorSpace = _ref_isSRGBColorSpace === void 0 ? true : _ref_isSRGBColorSpace, _ref_mipmap = _ref.mipmap, mipmap = _ref_mipmap === void 0 ? true : _ref_mipmap;
6393
6397
  var width = image.width, height = image.height;
6394
- // @ts-ignore
6395
- var isWebGL2 = resourceManager.engine._hardwareRenderer._isWebGL2;
6396
- var generateMipmap = TextureUtils.supportGenerateMipmapsWithCorrection(width, height, format, mipmap, isSRGBColorSpace, isWebGL2);
6397
- var texture = new Texture2D(resourceManager.engine, width, height, format, generateMipmap, isSRGBColorSpace);
6398
+ var engine = resourceManager.engine;
6399
+ var generateMipmap = TextureUtils.supportGenerateMipmapsWithCorrection(engine, width, height, format, mipmap, isSRGBColorSpace);
6400
+ var texture = new Texture2D(engine, width, height, format, generateMipmap, isSRGBColorSpace);
6398
6401
  texture.anisoLevel = anisoLevel != null ? anisoLevel : texture.anisoLevel;
6399
6402
  texture.filterMode = filterMode != null ? filterMode : texture.filterMode;
6400
6403
  texture.wrapModeU = wrapModeU != null ? wrapModeU : texture.wrapModeU;
@@ -6472,14 +6475,13 @@ var TextureCubeLoader = /*#__PURE__*/ function(Loader) {
6472
6475
  var _item_params;
6473
6476
  var _ref = (_item_params = item.params) != null ? _item_params : {}, _ref_format = _ref.format, format = _ref_format === void 0 ? TextureFormat.R8G8B8A8 : _ref_format, anisoLevel = _ref.anisoLevel, wrapModeU = _ref.wrapModeU, wrapModeV = _ref.wrapModeV, filterMode = _ref.filterMode, _ref_isSRGBColorSpace = _ref.isSRGBColorSpace, isSRGBColorSpace = _ref_isSRGBColorSpace === void 0 ? true : _ref_isSRGBColorSpace, _ref_mipmap = _ref.mipmap, mipmap = _ref_mipmap === void 0 ? true : _ref_mipmap;
6474
6477
  var _images_ = images[0], width = _images_.width, height = _images_.height;
6475
- // @ts-ignore
6476
- var isWebGL2 = resourceManager.engine._hardwareRenderer._isWebGL2;
6477
6478
  if (width !== height) {
6478
6479
  console.error("The cube texture must have the same width and height");
6479
6480
  return;
6480
6481
  }
6481
- var generateMipmap = TextureUtils.supportGenerateMipmapsWithCorrection(width, height, format, mipmap, isSRGBColorSpace, isWebGL2);
6482
- var texture = new TextureCube(resourceManager.engine, width, format, generateMipmap, isSRGBColorSpace);
6482
+ var engine = resourceManager.engine;
6483
+ var generateMipmap = TextureUtils.supportGenerateMipmapsWithCorrection(engine, width, height, format, mipmap, isSRGBColorSpace);
6484
+ var texture = new TextureCube(engine, width, format, generateMipmap, isSRGBColorSpace);
6483
6485
  texture.anisoLevel = anisoLevel != null ? anisoLevel : texture.anisoLevel;
6484
6486
  texture.filterMode = filterMode != null ? filterMode : texture.filterMode;
6485
6487
  texture.wrapModeU = wrapModeU != null ? wrapModeU : texture.wrapModeU;