Skip to content

Commit

Permalink
Editor: Fix usage of TGA textures. (#26316)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 committed Jun 22, 2023
1 parent 0e36538 commit aef2151
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions editor/js/libs/ui.three.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,22 @@ class UITexture extends UISpan {

reader.addEventListener( 'load', function ( event ) {

const canvas = new TGALoader().parse( event.target.result );
const loader = new TGALoader();
loader.load( event.target.result, function ( texture ) {

const texture = new THREE.CanvasTexture( canvas, mapping );
texture.sourceFile = file.name;
texture.colorSpace = THREE.SRGBColorSpace;
texture.sourceFile = file.name;

scope.setValue( texture );

scope.setValue( texture );
if ( scope.onChangeCallback ) scope.onChangeCallback( texture );

if ( scope.onChangeCallback ) scope.onChangeCallback( texture );

} );

}, false );

reader.readAsArrayBuffer( file );
reader.readAsDataURL( file );

} else if ( file.type.match( 'image.*' ) ) {

Expand Down

0 comments on commit aef2151

Please sign in to comment.