未验证 提交 f7efa14b 编写于 作者: M Michael Herzog 提交者: GitHub

Merge pull request #16983 from WestLangley/dev_setDataType_loaders

EXRLoader, HDRCubeTextureLoader, RGBELoader: setType() -> setDataType()
......@@ -82,13 +82,21 @@ THREE.EXRLoader = function ( manager ) {
THREE.EXRLoader.prototype = Object.create( THREE.DataTextureLoader.prototype );
THREE.EXRLoader.prototype.setType = function ( value ) {
THREE.EXRLoader.prototype.setDataType = function ( value ) {
this.type = value;
return this;
};
THREE.EXRLoader.prototype.setType = function ( value ) {
console.warn( 'THREE.EXRLoader: .setType() has been renamed to .setDataType().' );
return this.setDataType( value );
};
THREE.EXRLoader.prototype._parser = function ( buffer ) {
const USHORT_RANGE = ( 1 << 16 );
......
......@@ -15,9 +15,9 @@ THREE.HDRCubeTextureLoader.prototype.load = function ( urls, onLoad, onProgress,
if ( ! Array.isArray( urls ) ) {
console.warn( 'THREE.HDRCubeTextureLoader signature has changed. Use .setType() instead.' );
console.warn( 'THREE.HDRCubeTextureLoader signature has changed. Use .setDataType() instead.' );
this.setType( urls );
this.setDataType( urls );
urls = onLoad;
onLoad = onProgress;
......@@ -121,10 +121,18 @@ THREE.HDRCubeTextureLoader.prototype.setPath = function ( value ) {
};
THREE.HDRCubeTextureLoader.prototype.setType = function ( value ) {
THREE.HDRCubeTextureLoader.prototype.setDataType = function ( value ) {
this.type = value;
this.hdrLoader.setType( value );
this.hdrLoader.setDataType( value );
return this;
};
THREE.HDRCubeTextureLoader.prototype.setType = function ( value ) {
console.warn( 'THREE.HDRCubeTextureLoader: .setType() has been renamed to .setDataType().' );
return this.setDataType( value );
};
......@@ -470,13 +470,21 @@ THREE.RGBELoader.prototype._parser = function ( buffer ) {
};
THREE.RGBELoader.prototype.setType = function ( value ) {
THREE.RGBELoader.prototype.setDataType = function ( value ) {
this.type = value;
return this;
};
THREE.RGBELoader.prototype.setType = function ( value ) {
console.warn( 'THREE.RGBELoader: .setType() has been renamed to .setDataType().' );
return this.setDataType( value );
};
THREE.RGBELoader.prototype.load = function ( url, onLoad, onProgress, onError ) {
function onLoadCallback( texture, texData ) {
......
......@@ -19,5 +19,5 @@ export class EXRLoader extends DataTextureLoader {
type: TextureDataType;
_parser(buffer: ArrayBuffer) : EXR;
setType(type: TextureDataType): this;
setDataType(type: TextureDataType): this;
}
......@@ -91,13 +91,21 @@ var EXRLoader = function ( manager ) {
EXRLoader.prototype = Object.create( DataTextureLoader.prototype );
EXRLoader.prototype.setType = function ( value ) {
EXRLoader.prototype.setDataType = function ( value ) {
this.type = value;
return this;
};
EXRLoader.prototype.setType = function ( value ) {
console.warn( 'THREE.EXRLoader: .setType() has been renamed to .setDataType().' );
return this.setDataType( value );
};
EXRLoader.prototype._parser = function ( buffer ) {
const USHORT_RANGE = ( 1 << 16 );
......
......@@ -15,5 +15,5 @@ export class HDRCubeTextureLoader {
load(url: string, onLoad: (texture: CubeTexture) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void;
setPath(value: string): this;
setType(type: TextureDataType): this;
setDataType(type: TextureDataType): this;
}
......@@ -32,9 +32,9 @@ HDRCubeTextureLoader.prototype.load = function ( urls, onLoad, onProgress, onErr
if ( ! Array.isArray( urls ) ) {
console.warn( 'THREE.HDRCubeTextureLoader signature has changed. Use .setType() instead.' );
console.warn( 'THREE.HDRCubeTextureLoader signature has changed. Use .setDataType() instead.' );
this.setType( urls );
this.setDataType( urls );
urls = onLoad;
onLoad = onProgress;
......@@ -138,12 +138,20 @@ HDRCubeTextureLoader.prototype.setPath = function ( value ) {
};
HDRCubeTextureLoader.prototype.setType = function ( value ) {
HDRCubeTextureLoader.prototype.setDataType = function ( value ) {
this.type = value;
this.hdrLoader.setType( value );
this.hdrLoader.setDataType( value );
return this;
};
HDRCubeTextureLoader.prototype.setType = function ( value ) {
console.warn( 'THREE.HDRCubeTextureLoader: .setType() has been renamed to .setDataType().' );
return this.setDataType( value );
};
export { HDRCubeTextureLoader };
......@@ -21,5 +21,5 @@ export class RGBELoader extends DataTextureLoader {
type: TextureDataType;
_parser(buffer: ArrayBuffer): RGBE;
setType(type: TextureDataType): this;
setDataType(type: TextureDataType): this;
}
......@@ -484,13 +484,21 @@ RGBELoader.prototype._parser = function ( buffer ) {
};
RGBELoader.prototype.setType = function ( value ) {
RGBELoader.prototype.setDataType = function ( value ) {
this.type = value;
return this;
};
RGBELoader.prototype.setType = function ( value ) {
console.warn( 'THREE.RGBELoader: .setType() has been renamed to .setDataType().' );
return this.setDataType( value );
};
RGBELoader.prototype.load = function ( url, onLoad, onProgress, onError ) {
function onLoadCallback( texture, texData ) {
......
......@@ -45,7 +45,7 @@
scene = new THREE.Scene();
new RGBELoader()
.setType( THREE.UnsignedByteType )
.setDataType( THREE.UnsignedByteType )
.setPath( 'textures/equirectangular/' )
.load( 'pedestrian_overpass_2k.hdr', function ( texture ) {
......
......@@ -155,7 +155,7 @@
// Load background and generate envMap
new RGBELoader()
.setType( THREE.UnsignedByteType )
.setDataType( THREE.UnsignedByteType )
.setPath( 'textures/equirectangular/' )
.load( 'venice_sunset_2k.hdr', function ( texture ) {
......
......@@ -48,7 +48,7 @@
camera = new THREE.OrthographicCamera( - aspect, aspect, 1, - 1, 0, 1 );
new EXRLoader()
.setType( THREE.FloatType )
.setDataType( THREE.FloatType )
.load( 'textures/memorial.exr', function ( texture, textureData ) {
//console.log( textureData );
......
......@@ -48,7 +48,7 @@
camera = new THREE.OrthographicCamera( - aspect, aspect, 1, - 1, 0, 1 );
new RGBELoader()
.setType( THREE.UnsignedByteType ) // alt: FloatType, HalfFloatType
.setDataType( THREE.UnsignedByteType ) // alt: FloatType, HalfFloatType
.load( 'textures/memorial.hdr', function ( texture, textureData ) {
//console.log( textureData );
......
......@@ -75,7 +75,7 @@
scene.add( planeMesh );
new EXRLoader()
.setType( THREE.FloatType )
.setDataType( THREE.FloatType )
.load( 'textures/piz_compressed.exr', function ( texture ) {
texture.minFilter = THREE.NearestFilter;
......
......@@ -82,7 +82,7 @@
hdrCubeMap = new HDRCubeTextureLoader()
.setPath( './textures/cube/pisaHDR/' )
.setType( THREE.UnsignedByteType )
.setDataType( THREE.UnsignedByteType )
.load( hdrUrls, function () {
var pmremGenerator = new PMREMGenerator( hdrCubeMap );
......
......@@ -106,7 +106,7 @@
var hdrUrls = [ 'px.hdr', 'nx.hdr', 'py.hdr', 'ny.hdr', 'pz.hdr', 'nz.hdr' ];
hdrCubeMap = new HDRCubeTextureLoader()
.setPath( './textures/cube/pisaHDR/' )
.setType( THREE.UnsignedByteType )
.setDataType( THREE.UnsignedByteType )
.load( hdrUrls, function () {
var pmremGenerator = new PMREMGenerator( hdrCubeMap );
......
......@@ -132,7 +132,7 @@
var hdrUrls = [ 'px.hdr', 'nx.hdr', 'py.hdr', 'ny.hdr', 'pz.hdr', 'nz.hdr' ];
hdrCubeMap = new HDRCubeTextureLoader()
.setPath( './textures/cube/pisaHDR/' )
.setType( THREE.UnsignedByteType )
.setDataType( THREE.UnsignedByteType )
.load( hdrUrls, function () {
generate( params.textureSize );
......
......@@ -126,7 +126,7 @@
var hdrUrls = genCubeUrls( "./textures/cube/pisaHDR/", ".hdr" );
new HDRCubeTextureLoader()
.setType( THREE.UnsignedByteType )
.setDataType( THREE.UnsignedByteType )
.load( hdrUrls, function ( hdrCubeMap ) {
var pmremGenerator = new PMREMGenerator( hdrCubeMap );
......
......@@ -62,7 +62,7 @@
var hdrCubeRenderTarget = null;
new HDRCubeTextureLoader()
.setType( THREE.UnsignedByteType )
.setDataType( THREE.UnsignedByteType )
.load( hdrUrls, function ( hdrCubeMap ) {
var pmremGenerator = new PMREMGenerator( hdrCubeMap );
......
......@@ -68,7 +68,7 @@
imgTexture = null;
new HDRCubeTextureLoader()
.setType( THREE.UnsignedByteType )
.setDataType( THREE.UnsignedByteType )
.load( hdrUrls, function ( hdrCubeMap ) {
var pmremGenerator = new PMREMGenerator( hdrCubeMap );
......
......@@ -143,7 +143,7 @@
];
new HDRCubeTextureLoader()
.setType( THREE.UnsignedByteType )
.setDataType( THREE.UnsignedByteType )
.load( hdrUrls, function ( hdrCubeMap ) {
var pmremGenerator = new PMREMGenerator( hdrCubeMap );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册