소스 검색

Merge pull request #6457 from TrevorDev/basisSafariSupport

support basis in safari
David Catuhe 6 년 전
부모
커밋
cf6a95cd22
3개의 변경된 파일5개의 추가작업 그리고 3개의 파일을 삭제
  1. 1 1
      dist/preview release/what's new.md
  2. 2 1
      src/Materials/Textures/Loaders/basisTextureLoader.ts
  3. 2 1
      src/Materials/Textures/texture.ts

+ 1 - 1
dist/preview release/what's new.md

@@ -4,7 +4,7 @@
 - WIP: Node Material (NEED DOC AND SAMPLES) ([Deltakosh](https://github.com/deltakosh/))
 - WIP: Node material editor (NEED DOC AND VIDEOS) ([Deltakosh](https://github.com/deltakosh/)/[TrevorDev](https://github.com/TrevorDev))
 - WIP: WebGPU support (NEED DOC AND SAMPLES) ([Sebavan](https://github.com/sebavan/)
-- WIP: .basis texture file format support (mipmaps, web worker) [Demo](https://www.babylonjs-playground.com/#4RN0VF) ([TrevorDev](https://github.com/TrevorDev))
+- WIP: .basis texture file format support (mipmaps, web worker, webGL 1) [Demo](https://www.babylonjs-playground.com/#4RN0VF) ([TrevorDev](https://github.com/TrevorDev))
 
 ## Optimizations
 

+ 2 - 1
src/Materials/Textures/Loaders/basisTextureLoader.ts

@@ -83,7 +83,7 @@ export class _BasisTextureLoader implements IInternalTextureLoader {
         BasisTools.TranscodeAsync(data, transcodeConfig).then((result) => {
             var rootImage = result.fileInfo.images[0].levels[0];
             callback(rootImage.width, rootImage.height, false, true, () => {
-                texture._invertVScale = true;
+                texture._invertVScale = texture.invertY;
                 if (result.format === -1) {
                     // No compatable compressed format found, fallback to RGB
                     texture.type = Engine.TEXTURETYPE_UNSIGNED_SHORT_5_6_5;
@@ -117,6 +117,7 @@ export class _BasisTextureLoader implements IInternalTextureLoader {
                     if (texture.getEngine().webGLVersion < 2 && (Scalar.Log2(texture.width) % 1 !== 0 || Scalar.Log2(texture.height) % 1 !== 0)) {
                         Tools.Warn("Loaded .basis texture width and height are not a power of two. Texture wrapping will be set to Texture.CLAMP_ADDRESSMODE as other modes are not supported with non power of two dimensions in webGL 1.");
                         texture._cachedWrapU = Texture.CLAMP_ADDRESSMODE;
+                        texture._cachedWrapV = Texture.CLAMP_ADDRESSMODE;
                     }
 
                 }

+ 2 - 1
src/Materials/Textures/texture.ts

@@ -291,7 +291,8 @@ export class Texture extends BaseTexture {
         let load = () => {
             if (this._texture) {
                 if (this._texture._invertVScale) {
-                    this.vScale = -1;
+                    this.vScale *= -1;
+                    this.vOffset += 1;
                 }
 
                 // Update texutre to match internal texture's wrapping