Skip to content

Commit

Permalink
RGBMLoader: Default to RGBM7Encoding.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 committed Jan 26, 2021
1 parent be9ebd8 commit 8ef494a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
5 changes: 4 additions & 1 deletion examples/jsm/loaders/RGBMLoader.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import {
LoadingManager,
DataTextureLoader,
PixelFormat,
TextureDataType
TextureDataType,
TextureEncoding
} from '../../../src/Three';

export interface RGBM {
Expand All @@ -13,6 +14,8 @@ export interface RGBM {
header: string;
format: PixelFormat;
type: TextureDataType;
flipY: boolean;
encoding: TextureEncoding;
}

export class RGBMLoader extends DataTextureLoader {
Expand Down
6 changes: 4 additions & 2 deletions examples/jsm/loaders/RGBMLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import {
UnsignedByteType,
RGBAFormat,
LinearFilter,
CubeTexture
CubeTexture,
RGBM7Encoding
} from '../../../build/three.module.js';

class RGBMLoader extends DataTextureLoader {
Expand Down Expand Up @@ -61,7 +62,8 @@ class RGBMLoader extends DataTextureLoader {
data: new Uint8Array( rgba ),
format: RGBAFormat,
type: UnsignedByteType,
flipY: true
flipY: true,
encoding: RGBM7Encoding
};

}
Expand Down
6 changes: 6 additions & 0 deletions src/loaders/DataTextureLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ DataTextureLoader.prototype = Object.assign( Object.create( Loader.prototype ),

texture.anisotropy = texData.anisotropy !== undefined ? texData.anisotropy : 1;

if ( texData.encoding !== undefined ) {

texture.encoding = texData.encoding;

}

if ( texData.flipY !== undefined ) {

texture.flipY = texData.flipY;
Expand Down

0 comments on commit 8ef494a

Please sign in to comment.