Mr.doob 5 rokov pred
rodič
commit
8fcc7b8dab
1 zmenil súbory, kde vykonal 43 pridanie a 7 odobranie
  1. 43 7
      examples/jsm/loaders/EXRLoader.js

+ 43 - 7
examples/jsm/loaders/EXRLoader.js

@@ -12,6 +12,8 @@ import {
 	DataTextureLoader,
 	FloatType,
 	HalfFloatType,
+	LinearEncoding,
+	LinearFilter,
 	RGBAFormat,
 	RGBFormat
 } from "../../../build/three.module.js";
@@ -93,13 +95,6 @@ EXRLoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype
 
 	constructor: EXRLoader,
 
-	setDataType: function ( value ) {
-
-		this.type = value;
-		return this;
-
-	},
-
 	parse: function ( buffer ) {
 
 		const USHORT_RANGE = ( 1 << 16 );
@@ -1239,6 +1234,47 @@ EXRLoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype
 			type: this.type
 		};
 
+	},
+
+	setDataType: function ( value ) {
+
+		this.type = value;
+		return this;
+
+	},
+
+	load: function ( url, onLoad, onProgress, onError ) {
+
+		function onLoadCallback( texture, texData ) {
+
+			switch ( texture.type ) {
+
+				case FloatType:
+
+					texture.encoding = LinearEncoding;
+					texture.minFilter = LinearFilter;
+					texture.magFilter = LinearFilter;
+					texture.generateMipmaps = false;
+					texture.flipY = false;
+					break;
+
+				case HalfFloatType:
+
+					texture.encoding = LinearEncoding;
+					texture.minFilter = LinearFilter;
+					texture.magFilter = LinearFilter;
+					texture.generateMipmaps = false;
+					texture.flipY = false;
+					break;
+
+			}
+
+			if ( onLoad ) onLoad( texture, texData );
+
+		}
+
+		return DataTextureLoader.prototype.load.call( this, url, onLoadCallback, onProgress, onError );
+
 	}
 
 } );