|
@@ -61,7 +61,6 @@ import {
|
|
|
Skeleton,
|
|
|
SkinnedMesh,
|
|
|
SpotLight,
|
|
|
- Texture,
|
|
|
TextureLoader,
|
|
|
TriangleFanDrawMode,
|
|
|
TriangleStripDrawMode,
|
|
@@ -78,6 +77,7 @@ var GLTFLoader = ( function () {
|
|
|
|
|
|
this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;
|
|
|
this.dracoLoader = null;
|
|
|
+ this.ddsLoader = null;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -190,6 +190,13 @@ var GLTFLoader = ( function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
+ setDDSLoader: function ( ddsLoader ) {
|
|
|
+
|
|
|
+ this.ddsLoader = ddsLoader;
|
|
|
+ return this;
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
parse: function ( data, path, onLoad, onError ) {
|
|
|
|
|
|
var content;
|
|
@@ -261,7 +268,7 @@ var GLTFLoader = ( function () {
|
|
|
break;
|
|
|
|
|
|
case EXTENSIONS.MSFT_TEXTURE_DDS:
|
|
|
- extensions[ EXTENSIONS.MSFT_TEXTURE_DDS ] = new GLTFTextureDDSExtension();
|
|
|
+ extensions[ EXTENSIONS.MSFT_TEXTURE_DDS ] = new GLTFTextureDDSExtension( this.ddsLoader );
|
|
|
break;
|
|
|
|
|
|
case EXTENSIONS.KHR_TEXTURE_TRANSFORM:
|
|
@@ -353,16 +360,16 @@ var GLTFLoader = ( function () {
|
|
|
* https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_texture_dds
|
|
|
*
|
|
|
*/
|
|
|
- function GLTFTextureDDSExtension() {
|
|
|
+ function GLTFTextureDDSExtension( ddsLoader ) {
|
|
|
|
|
|
- if ( ! THREE.DDSLoader ) {
|
|
|
+ if ( ! ddsLoader ) {
|
|
|
|
|
|
- throw new Error( 'THREE.GLTFLoader: Attempting to load .dds texture without importing THREE.DDSLoader' );
|
|
|
+ throw new Error( 'THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader' );
|
|
|
|
|
|
}
|
|
|
|
|
|
this.name = EXTENSIONS.MSFT_TEXTURE_DDS;
|
|
|
- this.ddsLoader = new THREE.DDSLoader();
|
|
|
+ this.ddsLoader = ddsLoader;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -921,7 +928,7 @@ var GLTFLoader = ( function () {
|
|
|
},
|
|
|
|
|
|
// Here's based on refreshUniformsCommon() and refreshUniformsStandard() in WebGLRenderer.
|
|
|
- refreshUniforms: function ( renderer, scene, camera, geometry, material, group ) {
|
|
|
+ refreshUniforms: function ( renderer, scene, camera, geometry, material ) {
|
|
|
|
|
|
if ( material.isGLTFSpecularGlossinessMaterial !== true ) {
|
|
|
|
|
@@ -1719,7 +1726,7 @@ var GLTFLoader = ( function () {
|
|
|
* Requests the specified dependency asynchronously, with caching.
|
|
|
* @param {string} type
|
|
|
* @param {number} index
|
|
|
- * @return {Promise<Object3D|Material|Texture|AnimationClip|ArrayBuffer|Object>}
|
|
|
+ * @return {Promise<Object3D|Material|THREE.Texture|AnimationClip|ArrayBuffer|Object>}
|
|
|
*/
|
|
|
GLTFParser.prototype.getDependency = function ( type, index ) {
|
|
|
|
|
@@ -2008,7 +2015,7 @@ var GLTFLoader = ( function () {
|
|
|
/**
|
|
|
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures
|
|
|
* @param {number} textureIndex
|
|
|
- * @return {Promise<Texture>}
|
|
|
+ * @return {Promise<THREE.Texture>}
|
|
|
*/
|
|
|
GLTFParser.prototype.loadTexture = function ( textureIndex ) {
|
|
|
|
|
@@ -2615,7 +2622,7 @@ var GLTFLoader = ( function () {
|
|
|
? new SkinnedMesh( geometry, material )
|
|
|
: new Mesh( geometry, material );
|
|
|
|
|
|
- if ( mesh.isSkinnedMesh === true && !mesh.geometry.attributes.skinWeight.normalized ) {
|
|
|
+ if ( mesh.isSkinnedMesh === true && ! mesh.geometry.attributes.skinWeight.normalized ) {
|
|
|
|
|
|
// we normalize floating point skin weight array to fix malformed assets (see #15319)
|
|
|
// it's important to skip this for non-float32 data since normalizeSkinWeights assumes non-normalized inputs
|
|
@@ -2903,7 +2910,7 @@ var GLTFLoader = ( function () {
|
|
|
|
|
|
for ( var j = 0, jl = outputArray.length; j < jl; j ++ ) {
|
|
|
|
|
|
- scaled[j] = outputArray[j] * scale;
|
|
|
+ scaled[ j ] = outputArray[ j ] * scale;
|
|
|
|
|
|
}
|
|
|
|