|
|
@@ -7343,6 +7343,54 @@ class Texture extends EventDispatcher {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Sets this texture's properties based on `values`.
|
|
|
+ * @param {Object} values - A container with texture parameters.
|
|
|
+ */
|
|
|
+ setValues( values ) {
|
|
|
+
|
|
|
+ for ( const key in values ) {
|
|
|
+
|
|
|
+ const newValue = values[ key ];
|
|
|
+
|
|
|
+ if ( newValue === undefined ) {
|
|
|
+
|
|
|
+ console.warn( `THREE.Texture.setValues(): parameter '${ key }' has value of undefined.` );
|
|
|
+ continue;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ const currentValue = this[ key ];
|
|
|
+
|
|
|
+ if ( currentValue === undefined ) {
|
|
|
+
|
|
|
+ console.warn( `THREE.Texture.setValues(): property '${ key }' does not exist.` );
|
|
|
+ continue;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if ( ( currentValue && newValue ) && ( currentValue.isVector2 && newValue.isVector2 ) ) {
|
|
|
+
|
|
|
+ currentValue.copy( newValue );
|
|
|
+
|
|
|
+ } else if ( ( currentValue && newValue ) && ( currentValue.isVector3 && newValue.isVector3 ) ) {
|
|
|
+
|
|
|
+ currentValue.copy( newValue );
|
|
|
+
|
|
|
+ } else if ( ( currentValue && newValue ) && ( currentValue.isMatrix3 && newValue.isMatrix3 ) ) {
|
|
|
+
|
|
|
+ currentValue.copy( newValue );
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ this[ key ] = newValue;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Serializes the texture into JSON.
|
|
|
*
|
|
|
@@ -8765,11 +8813,7 @@ class RenderTarget extends EventDispatcher {
|
|
|
|
|
|
const image = { width: width, height: height, depth: options.depth };
|
|
|
|
|
|
- const texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );
|
|
|
-
|
|
|
- texture.flipY = false;
|
|
|
- texture.generateMipmaps = options.generateMipmaps;
|
|
|
- texture.internalFormat = options.internalFormat;
|
|
|
+ const texture = new Texture( image );
|
|
|
|
|
|
/**
|
|
|
* An array of textures. Each color attachment is represented as a separate texture.
|
|
|
@@ -8788,6 +8832,8 @@ class RenderTarget extends EventDispatcher {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ this._setTextureOptions( options );
|
|
|
+
|
|
|
/**
|
|
|
* Whether to allocate a depth buffer or not.
|
|
|
*
|
|
|
@@ -8843,6 +8889,38 @@ class RenderTarget extends EventDispatcher {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ _setTextureOptions( options = {} ) {
|
|
|
+
|
|
|
+ const values = {
|
|
|
+ minFilter: LinearFilter,
|
|
|
+ generateMipmaps: false,
|
|
|
+ flipY: false,
|
|
|
+ internalFormat: null
|
|
|
+ };
|
|
|
+
|
|
|
+ if ( options.mapping !== undefined ) values.mapping = options.mapping;
|
|
|
+ if ( options.wrapS !== undefined ) values.wrapS = options.wrapS;
|
|
|
+ if ( options.wrapT !== undefined ) values.wrapT = options.wrapT;
|
|
|
+ if ( options.wrapR !== undefined ) values.wrapR = options.wrapR;
|
|
|
+ if ( options.magFilter !== undefined ) values.magFilter = options.magFilter;
|
|
|
+ if ( options.minFilter !== undefined ) values.minFilter = options.minFilter;
|
|
|
+ if ( options.format !== undefined ) values.format = options.format;
|
|
|
+ if ( options.type !== undefined ) values.type = options.type;
|
|
|
+ if ( options.anisotropy !== undefined ) values.anisotropy = options.anisotropy;
|
|
|
+ if ( options.colorSpace !== undefined ) values.colorSpace = options.colorSpace;
|
|
|
+ if ( options.flipY !== undefined ) values.flipY = options.flipY;
|
|
|
+ if ( options.generateMipmaps !== undefined ) values.generateMipmaps = options.generateMipmaps;
|
|
|
+ if ( options.internalFormat !== undefined ) values.internalFormat = options.internalFormat;
|
|
|
+
|
|
|
+ for ( let i = 0; i < this.textures.length; i ++ ) {
|
|
|
+
|
|
|
+ const texture = this.textures[ i ];
|
|
|
+ texture.setValues( values );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* The texture representing the default color attachment.
|
|
|
*
|
|
|
@@ -8903,12 +8981,7 @@ class RenderTarget extends EventDispatcher {
|
|
|
this.textures[ i ].image.width = width;
|
|
|
this.textures[ i ].image.height = height;
|
|
|
this.textures[ i ].image.depth = depth;
|
|
|
-
|
|
|
- if ( this.textures[ i ].image.depth > 1 ) {
|
|
|
-
|
|
|
- this.textures[ i ].isArrayTexture = true;
|
|
|
-
|
|
|
- }
|
|
|
+ this.textures[ i ].isArrayTexture = this.textures[ i ].image.depth > 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -9191,6 +9264,7 @@ class WebGLArrayRenderTarget extends WebGLRenderTarget {
|
|
|
* @type {DataArrayTexture}
|
|
|
*/
|
|
|
this.texture = new DataArrayTexture( null, width, height, depth );
|
|
|
+ this._setTextureOptions( options );
|
|
|
|
|
|
this.texture.isRenderTargetTexture = true;
|
|
|
|
|
|
@@ -9342,6 +9416,7 @@ class WebGL3DRenderTarget extends WebGLRenderTarget {
|
|
|
* @type {Data3DTexture}
|
|
|
*/
|
|
|
this.texture = new Data3DTexture( null, width, height, depth );
|
|
|
+ this._setTextureOptions( options );
|
|
|
|
|
|
this.texture.isRenderTargetTexture = true;
|
|
|
|
|
|
@@ -22106,7 +22181,8 @@ class WebGLCubeRenderTarget extends WebGLRenderTarget {
|
|
|
*
|
|
|
* @type {DataArrayTexture}
|
|
|
*/
|
|
|
- this.texture = new CubeTexture( images, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );
|
|
|
+ this.texture = new CubeTexture( images );
|
|
|
+ this._setTextureOptions( options );
|
|
|
|
|
|
// By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js)
|
|
|
// in a coordinate system in which positive-x is to the right when looking up the positive-z axis -- in other words,
|
|
|
@@ -22118,9 +22194,6 @@ class WebGLCubeRenderTarget extends WebGLRenderTarget {
|
|
|
|
|
|
this.texture.isRenderTargetTexture = true;
|
|
|
|
|
|
- this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;
|
|
|
- this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -53807,6 +53880,7 @@ class RenderTarget3D extends RenderTarget {
|
|
|
* @type {Data3DTexture}
|
|
|
*/
|
|
|
this.texture = new Data3DTexture( null, width, height, depth );
|
|
|
+ this._setTextureOptions( options );
|
|
|
|
|
|
this.texture.isRenderTargetTexture = true;
|
|
|
|
|
|
@@ -55708,7 +55782,7 @@ class SkeletonHelper extends LineSegments {
|
|
|
this.root = object;
|
|
|
|
|
|
/**
|
|
|
- * he list of bones that the helper visualizes.
|
|
|
+ * The list of bones that the helper visualizes.
|
|
|
*
|
|
|
* @type {Array<Bone>}
|
|
|
*/
|