@@ -21,11 +21,14 @@ export class TextureParser {
2121 let sourceIndex = source , isTextureData = false ;
2222
2323 if ( params . extensions ) {
24- const { KHR_texture_basisu } = params . extensions ;
24+ const { KHR_texture_basisu, MSFT_texture_dds } = params . extensions ;
2525
2626 if ( KHR_texture_basisu ) {
2727 sourceIndex = KHR_texture_basisu . source ;
2828 isTextureData = true ;
29+ } else if ( MSFT_texture_dds ) {
30+ sourceIndex = MSFT_texture_dds . source ;
31+ isTextureData = true ;
2932 } else if ( Object . values ( params . extensions ) . length && Object . values ( params . extensions ) [ 0 ] . hasOwnProperty ( 'source' ) ) {
3033 sourceIndex = Object . values ( params . extensions ) [ 0 ] . source ;
3134 } else {
@@ -61,7 +64,7 @@ export class TextureParser {
6164 texture . name = textureName || texture . image . __name || `texture_${ index } ` ;
6265 texture . flipY = false ;
6366
64- const { mimeType, uri } = gltf . images [ sourceIndex ] ;
67+ const { mimeType, uri = '' } = gltf . images [ sourceIndex ] ;
6568 texture . userData . mimeType = mimeType || getImageURIMimeType ( uri ) ;
6669
6770 const samplers = gltf . samplers || { } ;
@@ -82,8 +85,8 @@ export class TextureParser {
8285function parseSampler ( texture , sampler = { } ) {
8386 const { magFilter, minFilter, wrapS, wrapT } = sampler ;
8487
85- texture . magFilter = WEBGL_FILTERS [ magFilter ] || TEXTURE_FILTER . LINEAR ;
86- texture . minFilter = WEBGL_FILTERS [ minFilter ] || TEXTURE_FILTER . LINEAR_MIPMAP_LINEAR ;
88+ texture . magFilter = WEBGL_FILTERS [ magFilter ] || texture . magFilter || TEXTURE_FILTER . LINEAR ;
89+ texture . minFilter = WEBGL_FILTERS [ minFilter ] || texture . minFilter || TEXTURE_FILTER . LINEAR_MIPMAP_LINEAR ;
8790 texture . wrapS = WEBGL_WRAPPINGS [ wrapS ] || TEXTURE_WRAP . REPEAT ;
8891 texture . wrapT = WEBGL_WRAPPINGS [ wrapT ] || TEXTURE_WRAP . REPEAT ;
8992}
@@ -98,6 +101,7 @@ function getImageURIMimeType(uri) {
98101 } else {
99102 if ( uri . search ( / \. j p e ? g ( $ | \? ) / i) > 0 ) return 'image/jpeg' ;
100103 if ( uri . search ( / \. w e b p ( $ | \? ) / i) > 0 ) return 'image/webp' ;
104+ if ( uri . search ( / \. d d s ( $ | \? ) / i) > 0 ) return 'image/vnd-ms.dds' ;
101105 return 'image/png' ;
102106 }
103107}
0 commit comments