EXRLoader: fix flipped unsigned byte texture

上级 352a3250
...@@ -2257,7 +2257,7 @@ THREE.EXRLoader.prototype = Object.assign( Object.create( THREE.DataTextureLoade ...@@ -2257,7 +2257,7 @@ THREE.EXRLoader.prototype = Object.assign( Object.create( THREE.DataTextureLoade
if ( this.type === THREE.UnsignedByteType ) { if ( this.type === THREE.UnsignedByteType ) {
let v, i, j; let v, i;
const size = byteArray.length; const size = byteArray.length;
const RGBEArray = new Uint8Array( size ); const RGBEArray = new Uint8Array( size );
...@@ -2266,11 +2266,10 @@ THREE.EXRLoader.prototype = Object.assign( Object.create( THREE.DataTextureLoade ...@@ -2266,11 +2266,10 @@ THREE.EXRLoader.prototype = Object.assign( Object.create( THREE.DataTextureLoade
for ( let w = 0; w < width; ++ w ) { for ( let w = 0; w < width; ++ w ) {
i = h * width * 4 + w * 4; i = h * width * 4 + w * 4;
j = ( height - 1 - h ) * width * 4 + w * 4;
const red = byteArray[ j ]; const red = byteArray[ i ];
const green = byteArray[ j + 1 ]; const green = byteArray[ i + 1 ];
const blue = byteArray[ j + 2 ]; const blue = byteArray[ i + 2 ];
v = ( red > green ) ? red : green; v = ( red > green ) ? red : green;
v = ( blue > v ) ? blue : v; v = ( blue > v ) ? blue : v;
...@@ -2331,7 +2330,7 @@ THREE.EXRLoader.prototype = Object.assign( Object.create( THREE.DataTextureLoade ...@@ -2331,7 +2330,7 @@ THREE.EXRLoader.prototype = Object.assign( Object.create( THREE.DataTextureLoade
texture.minFilter = THREE.NearestFilter; texture.minFilter = THREE.NearestFilter;
texture.magFilter = THREE.NearestFilter; texture.magFilter = THREE.NearestFilter;
texture.generateMipmaps = false; texture.generateMipmaps = false;
texture.flipY = true; texture.flipY = false;
break; break;
case THREE.FloatType: case THREE.FloatType:
......
...@@ -2271,7 +2271,7 @@ EXRLoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype ...@@ -2271,7 +2271,7 @@ EXRLoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype
if ( this.type === UnsignedByteType ) { if ( this.type === UnsignedByteType ) {
let v, i, j; let v, i;
const size = byteArray.length; const size = byteArray.length;
const RGBEArray = new Uint8Array( size ); const RGBEArray = new Uint8Array( size );
...@@ -2280,11 +2280,10 @@ EXRLoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype ...@@ -2280,11 +2280,10 @@ EXRLoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype
for ( let w = 0; w < width; ++ w ) { for ( let w = 0; w < width; ++ w ) {
i = h * width * 4 + w * 4; i = h * width * 4 + w * 4;
j = ( height - 1 - h ) * width * 4 + w * 4;
const red = byteArray[ j ]; const red = byteArray[ i ];
const green = byteArray[ j + 1 ]; const green = byteArray[ i + 1 ];
const blue = byteArray[ j + 2 ]; const blue = byteArray[ i + 2 ];
v = ( red > green ) ? red : green; v = ( red > green ) ? red : green;
v = ( blue > v ) ? blue : v; v = ( blue > v ) ? blue : v;
...@@ -2345,7 +2344,7 @@ EXRLoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype ...@@ -2345,7 +2344,7 @@ EXRLoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype
texture.minFilter = NearestFilter; texture.minFilter = NearestFilter;
texture.magFilter = NearestFilter; texture.magFilter = NearestFilter;
texture.generateMipmaps = false; texture.generateMipmaps = false;
texture.flipY = true; texture.flipY = false;
break; break;
case FloatType: case FloatType:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册