Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLTFLoader: Remove support for MSFT_texture_dds. #21271

Merged
merged 1 commit into from
Feb 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions docs/examples/en/loaders/GLTFLoader.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ <h2>Extensions</h2>
<li>KHR_texture_transform<sup>2</sup></li>
<li>EXT_texture_webp</li>
<li>EXT_meshopt_compression</li>
<li>MSFT_texture_dds</li>
</ul>

<p>
Expand Down Expand Up @@ -205,12 +204,6 @@ <h3>[method:null setDRACOLoader]( [param:DRACOLoader dracoLoader] )</h3>
Refer to this [link:https://github.com/mrdoob/three.js/tree/dev/examples/js/libs/draco#readme readme] for the details of Draco and its decoder.
</p>


<h3>[method:null setDDSLoader]( [param:DDSLoader ddsLoader] )</h3>
<p>
[page:DDSLoader ddsLoader] — Instance of THREE.DDSLoader, to be used for loading compressed textures with the MSFT_TEXTURE_DDS extension.
</p>

<h3>[method:null setKTX2Loader]( [param:KTX2Loader ktx2Loader] )</h3>
<p>
[page:KTX2Loader ktx2Loader] — Instance of THREE.KTX2Loader, to be used for loading KTX2 compressed textures.
Expand Down
6 changes: 0 additions & 6 deletions docs/examples/zh/loaders/GLTFLoader.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ <h2>扩展</h2>
<li>KHR_texture_transform<sup>2</sup></li>
<li>EXT_texture_webp</li>
<li>EXT_meshopt_compression</li>
<li>MSFT_texture_dds</li>
</ul>

<p><i>
Expand Down Expand Up @@ -188,11 +187,6 @@ <h3>[method:null setDRACOLoader]( [param:DRACOLoader dracoLoader] )</h3>
请参阅[link:https://github.com/mrdoob/three.js/tree/dev/examples/js/libs/draco#readme readme]来了解Draco及其解码器的详细信息。
</p>

<h3>[method:null setDDSLoader]( [param:DDSLoader ddsLoader] )</h3>
<p>
[page:DDSLoader ddsLoader] — THREE.DDSLoader的实例,用于加载使用MSFT_TEXTURE_DDS扩展压缩过的纹理。
</p>

<h3>[method:null parse]( [param:ArrayBuffer data], [param:String path], [param:Function onLoad], [param:Function onError] )</h3>
<p>
[page:ArrayBuffer data] — 需要解析的glTF文件,值为一个ArrayBuffer或<em>JSON</em>字符串。<br />
Expand Down
50 changes: 9 additions & 41 deletions examples/js/loaders/GLTFLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ THREE.GLTFLoader = ( function () {
THREE.Loader.call( this, manager );

this.dracoLoader = null;
this.ddsLoader = null;
this.ktx2Loader = null;
this.meshoptDecoder = null;

Expand Down Expand Up @@ -131,10 +130,13 @@ THREE.GLTFLoader = ( function () {

},

setDDSLoader: function ( ddsLoader ) {
setDDSLoader: function () {

this.ddsLoader = ddsLoader;
return this;
throw new Error(

'THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".'

);

},

Expand Down Expand Up @@ -268,10 +270,6 @@ THREE.GLTFLoader = ( function () {
extensions[ extensionName ] = new GLTFDracoMeshCompressionExtension( json, this.dracoLoader );
break;

case EXTENSIONS.MSFT_TEXTURE_DDS:
extensions[ extensionName ] = new GLTFTextureDDSExtension( this.ddsLoader );
break;

case EXTENSIONS.KHR_TEXTURE_TRANSFORM:
extensions[ extensionName ] = new GLTFTextureTransformExtension();
break;
Expand Down Expand Up @@ -354,29 +352,9 @@ THREE.GLTFLoader = ( function () {
KHR_TEXTURE_TRANSFORM: 'KHR_texture_transform',
KHR_MESH_QUANTIZATION: 'KHR_mesh_quantization',
EXT_TEXTURE_WEBP: 'EXT_texture_webp',
EXT_MESHOPT_COMPRESSION: 'EXT_meshopt_compression',
MSFT_TEXTURE_DDS: 'MSFT_texture_dds'
EXT_MESHOPT_COMPRESSION: 'EXT_meshopt_compression'
};

/**
* DDS Texture Extension
*
* Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_texture_dds
*
*/
function GLTFTextureDDSExtension( ddsLoader ) {

if ( ! ddsLoader ) {

throw new Error( 'THREE.GLTFLoader: Attempting to load .dds texture without importing THREE.DDSLoader' );

}

this.name = EXTENSIONS.MSFT_TEXTURE_DDS;
this.ddsLoader = ddsLoader;

}

/**
* Punctual Lights Extension
*
Expand Down Expand Up @@ -2387,15 +2365,7 @@ THREE.GLTFLoader = ( function () {

var source;

if ( textureExtensions[ EXTENSIONS.MSFT_TEXTURE_DDS ] ) {

source = json.images[ textureExtensions[ EXTENSIONS.MSFT_TEXTURE_DDS ].source ];

} else {

source = json.images[ textureDef.source ];

}
source = json.images[ textureDef.source ];

var loader;

Expand All @@ -2407,9 +2377,7 @@ THREE.GLTFLoader = ( function () {

if ( ! loader ) {

loader = textureExtensions[ EXTENSIONS.MSFT_TEXTURE_DDS ]
? parser.extensions[ EXTENSIONS.MSFT_TEXTURE_DDS ].ddsLoader
: this.textureLoader;
loader = this.textureLoader;

}

Expand Down
52 changes: 10 additions & 42 deletions examples/jsm/loaders/GLTFLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ var GLTFLoader = ( function () {
Loader.call( this, manager );

this.dracoLoader = null;
this.ddsLoader = null;
this.ktx2Loader = null;
this.meshoptDecoder = null;

Expand Down Expand Up @@ -196,10 +195,13 @@ var GLTFLoader = ( function () {

},

setDDSLoader: function ( ddsLoader ) {
setDDSLoader: function () {

this.ddsLoader = ddsLoader;
return this;
throw new Error(

'THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".'

);

},

Expand Down Expand Up @@ -333,10 +335,6 @@ var GLTFLoader = ( function () {
extensions[ extensionName ] = new GLTFDracoMeshCompressionExtension( json, this.dracoLoader );
break;

case EXTENSIONS.MSFT_TEXTURE_DDS:
extensions[ extensionName ] = new GLTFTextureDDSExtension( this.ddsLoader );
break;

case EXTENSIONS.KHR_TEXTURE_TRANSFORM:
extensions[ extensionName ] = new GLTFTextureTransformExtension();
break;
Expand Down Expand Up @@ -419,29 +417,9 @@ var GLTFLoader = ( function () {
KHR_TEXTURE_TRANSFORM: 'KHR_texture_transform',
KHR_MESH_QUANTIZATION: 'KHR_mesh_quantization',
EXT_TEXTURE_WEBP: 'EXT_texture_webp',
EXT_MESHOPT_COMPRESSION: 'EXT_meshopt_compression',
MSFT_TEXTURE_DDS: 'MSFT_texture_dds'
EXT_MESHOPT_COMPRESSION: 'EXT_meshopt_compression'
};

/**
* DDS Texture Extension
*
* Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_texture_dds
*
*/
function GLTFTextureDDSExtension( ddsLoader ) {

if ( ! ddsLoader ) {

throw new Error( 'THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader' );

}

this.name = EXTENSIONS.MSFT_TEXTURE_DDS;
this.ddsLoader = ddsLoader;

}

/**
* Punctual Lights Extension
*
Expand Down Expand Up @@ -2452,15 +2430,7 @@ var GLTFLoader = ( function () {

var source;

if ( textureExtensions[ EXTENSIONS.MSFT_TEXTURE_DDS ] ) {

source = json.images[ textureExtensions[ EXTENSIONS.MSFT_TEXTURE_DDS ].source ];

} else {

source = json.images[ textureDef.source ];

}
source = json.images[ textureDef.source ];

var loader;

Expand All @@ -2472,9 +2442,7 @@ var GLTFLoader = ( function () {

if ( ! loader ) {

loader = textureExtensions[ EXTENSIONS.MSFT_TEXTURE_DDS ]
? parser.extensions[ EXTENSIONS.MSFT_TEXTURE_DDS ].ddsLoader
: this.textureLoader;
loader = this.textureLoader;

}

Expand Down Expand Up @@ -2631,7 +2599,7 @@ var GLTFLoader = ( function () {
* Assigns final material to a Mesh, Line, or Points instance. The instance
* already has a material (generated from the glTF material options alone)
* but reuse of the same glTF material may require multiple threejs materials
* to accomodate different primitive types, defines, etc. New materials will
* to accommodate different primitive types, defines, etc. New materials will
* be created if necessary, and reused from a cache.
* @param {Object3D} mesh Mesh, Line, or Points instance.
*/
Expand Down
Binary file removed examples/models/gltf/BoomBox/glTF-dds/BoomBox.bin
Binary file not shown.
Loading