Skip to content
Merged
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
21 changes: 13 additions & 8 deletions examples/jsm/loaders/GLTFLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ class GLTFMaterialsUnlitExtension {
*
* Specification: https://github.com/KhronosGroup/glTF/blob/5768b3ce0ef32bc39cdf1bef10b948586635ead3/extensions/2.0/Khronos/KHR_materials_emissive_strength/README.md
*/
class GLTFMaterialsEmissiveStrengthExtension {
class GLTFMaterialsEmissiveStrengthExtension {

constructor( parser ) {

Expand All @@ -670,8 +670,8 @@ class GLTFMaterialsUnlitExtension {

}

const emissiveStrength = materialDef.extensions[this.name].emissiveStrength;
const emissiveStrength = materialDef.extensions[ this.name ].emissiveStrength;

if ( emissiveStrength !== undefined ) {

materialParams.emissiveIntensity = emissiveStrength;
Expand Down Expand Up @@ -2315,14 +2315,19 @@ class GLTFParser {

// Use an ImageBitmapLoader if imageBitmaps are supported. Moves much of the
// expensive work of uploading a texture to the GPU off the main thread.
if ( typeof createImageBitmap !== 'undefined' && /^((?!chrome|android).)*safari/i.test( navigator.userAgent ) === false ) {

this.textureLoader = new ImageBitmapLoader( this.options.manager );
const isSafari = /^((?!chrome|android).)*safari/i.test( navigator.userAgent ) === true;
const isFirefox = navigator.userAgent.indexOf( 'Firefox' ) > - 1;
const firefoxVersion = isFirefox ? navigator.userAgent.match( /Firefox\/([0-9]+)\./ )[ 1 ] : - 1;

} else {
if ( typeof createImageBitmap === 'undefined' || isSafari || ( isFirefox && firefoxVersion < 98 ) ) {

this.textureLoader = new TextureLoader( this.options.manager );

} else {

this.textureLoader = new ImageBitmapLoader( this.options.manager );

}

this.textureLoader.setCrossOrigin( this.options.crossOrigin );
Expand Down Expand Up @@ -2627,9 +2632,9 @@ class GLTFParser {

case 'animation':
dependency = this._invokeOne( function ( ext ) {

return ext.loadAnimation && ext.loadAnimation( index );

} );
break;

Expand Down