使用Three.js SceneLoader加载DDS纹理

时间:2014-10-28 15:11:05

标签: three.js

我在尝试使用SceneLoader加载dds纹理时遇到问题。 我目前正在使用three.js的第69版。我已经尝试修改SceneLoader以使用THREE.DDSLoader但我的页面停顿并且没有产生任何错误。

修饰:                 var isCompressed = fullUrl.toLowerCase()。endsWith(“。dds”); //必须添加原型endsWith                 //console.warn(isCompressed);

            if ( isCompressed) {
                var loader = new THREE.DDSLoader();
                console.log(fullUrl);
                var texture = loader.load(fullUrl);         
            }
            else{

               var loader = THREE.Loader.Handlers.get( fullUrl );

               if ( loader !== null ) {

                   texture = loader.load( fullUrl, textureCallback );

               } else {

                   texture = new THREE.Texture();
                   loader = new THREE.ImageLoader();

                   ( function ( texture ) {

                       loader.load( fullUrl, function ( image ) {

                           texture.image = image;
                           texture.needsUpdate = true;

                           textureCallback();

                       } );

                   } )( texture )


               }
            }

1 个答案:

答案 0 :(得分:0)

没关系,我明白了。 我需要用texture = loader.load(fullUrl,textureCallback)替换var texture = loader.load(fullUrl);

相关问题