|
|
@@ -7557,6 +7557,15 @@ class Texture extends EventDispatcher {
|
|
|
*/
|
|
|
this.pmremVersion = 0;
|
|
|
|
|
|
+ /**
|
|
|
+ * Whether the texture should use one of the 16 bit integer formats which are normalized
|
|
|
+ * to [0, 1] or [-1, 1] (depending on signed/unsigned) when sampled.
|
|
|
+ *
|
|
|
+ * @type {boolean}
|
|
|
+ * @default false
|
|
|
+ */
|
|
|
+ this.normalized = false;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -7672,6 +7681,7 @@ class Texture extends EventDispatcher {
|
|
|
this.format = source.format;
|
|
|
this.internalFormat = source.internalFormat;
|
|
|
this.type = source.type;
|
|
|
+ this.normalized = source.normalized;
|
|
|
|
|
|
this.offset.copy( source.offset );
|
|
|
this.repeat.copy( source.repeat );
|
|
|
@@ -7790,6 +7800,7 @@ class Texture extends EventDispatcher {
|
|
|
format: this.format,
|
|
|
internalFormat: this.internalFormat,
|
|
|
type: this.type,
|
|
|
+ normalized: this.normalized,
|
|
|
colorSpace: this.colorSpace,
|
|
|
|
|
|
minFilter: this.minFilter,
|
|
|
@@ -16653,7 +16664,7 @@ let _id$3 = 0;
|
|
|
* When working with vector-like data, the `fromBufferAttribute( attribute, index )`
|
|
|
* helper methods on vector and color class might be helpful. E.g. {@link Vector3#fromBufferAttribute}.
|
|
|
*/
|
|
|
-class BufferAttribute {
|
|
|
+class BufferAttribute extends EventDispatcher {
|
|
|
|
|
|
/**
|
|
|
* Constructs a new buffer attribute.
|
|
|
@@ -16664,6 +16675,8 @@ class BufferAttribute {
|
|
|
*/
|
|
|
constructor( array, itemSize, normalized = false ) {
|
|
|
|
|
|
+ super();
|
|
|
+
|
|
|
if ( Array.isArray( array ) ) {
|
|
|
|
|
|
throw new TypeError( 'THREE.BufferAttribute: array should be a Typed Array.' );
|
|
|
@@ -17310,6 +17323,15 @@ class BufferAttribute {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Disposes of the buffer attribute. Available only in {@link WebGPURenderer}.
|
|
|
+ */
|
|
|
+ dispose() {
|
|
|
+
|
|
|
+ this.dispatchEvent( { type: 'dispose' } );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -24694,7 +24716,7 @@ class InstancedMesh extends Mesh {
|
|
|
|
|
|
/**
|
|
|
* Sets the given local transformation matrix to the defined instance. Make sure you set the `needsUpdate` flag of
|
|
|
- * {@link InstancedMesh#instanceMatrix} to `true` after updating all the colors.
|
|
|
+ * {@link InstancedMesh#instanceMatrix} to `true` after updating all the matrices.
|
|
|
*
|
|
|
* @param {number} index - The instance index.
|
|
|
* @param {Matrix4} matrix - The local transformation.
|
|
|
@@ -48804,6 +48826,7 @@ class ObjectLoader extends Loader {
|
|
|
if ( data.premultiplyAlpha !== undefined ) texture.premultiplyAlpha = data.premultiplyAlpha;
|
|
|
if ( data.unpackAlignment !== undefined ) texture.unpackAlignment = data.unpackAlignment;
|
|
|
if ( data.compareFunction !== undefined ) texture.compareFunction = data.compareFunction;
|
|
|
+ if ( data.normalized !== undefined ) texture.normalized = data.normalized;
|
|
|
|
|
|
if ( data.userData !== undefined ) texture.userData = data.userData;
|
|
|
|
|
|
@@ -55842,7 +55865,7 @@ class Clock {
|
|
|
*/
|
|
|
this.running = false;
|
|
|
|
|
|
- warn( 'THREE.Clock: This module has been deprecated. Please use THREE.Timer instead.' ); // @deprecated, r183
|
|
|
+ warn( 'Clock: This module has been deprecated. Please use THREE.Timer instead.' ); // @deprecated, r183
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -70668,7 +70691,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
}
|
|
|
|
|
|
- function getInternalFormat( internalFormatName, glFormat, glType, colorSpace, forceLinearTransfer = false ) {
|
|
|
+ function getInternalFormat( internalFormatName, glFormat, glType, normalized, colorSpace, forceLinearTransfer = false ) {
|
|
|
|
|
|
if ( internalFormatName !== null ) {
|
|
|
|
|
|
@@ -70678,6 +70701,20 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
}
|
|
|
|
|
|
+ let ext_texture_norm16;
|
|
|
+
|
|
|
+ if ( normalized ) {
|
|
|
+
|
|
|
+ ext_texture_norm16 = extensions.get( 'EXT_texture_norm16' );
|
|
|
+
|
|
|
+ if ( ! ext_texture_norm16 ) {
|
|
|
+
|
|
|
+ warn( 'WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension' );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
let internalFormat = glFormat;
|
|
|
|
|
|
if ( glFormat === _gl.RED ) {
|
|
|
@@ -70685,6 +70722,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
if ( glType === _gl.FLOAT ) internalFormat = _gl.R32F;
|
|
|
if ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.R16F;
|
|
|
if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.R8;
|
|
|
+ if ( glType === _gl.UNSIGNED_SHORT && ext_texture_norm16 ) internalFormat = ext_texture_norm16.R16_EXT;
|
|
|
+ if ( glType === _gl.SHORT && ext_texture_norm16 ) internalFormat = ext_texture_norm16.R16_SNORM_EXT;
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -70704,6 +70743,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
if ( glType === _gl.FLOAT ) internalFormat = _gl.RG32F;
|
|
|
if ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.RG16F;
|
|
|
if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RG8;
|
|
|
+ if ( glType === _gl.UNSIGNED_SHORT && ext_texture_norm16 ) internalFormat = ext_texture_norm16.RG16_EXT;
|
|
|
+ if ( glType === _gl.SHORT && ext_texture_norm16 ) internalFormat = ext_texture_norm16.RG16_SNORM_EXT;
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -70742,6 +70783,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
if ( glFormat === _gl.RGB ) {
|
|
|
|
|
|
+ if ( glType === _gl.UNSIGNED_SHORT && ext_texture_norm16 ) internalFormat = ext_texture_norm16.RGB16_EXT;
|
|
|
+ if ( glType === _gl.SHORT && ext_texture_norm16 ) internalFormat = ext_texture_norm16.RGB16_SNORM_EXT;
|
|
|
if ( glType === _gl.UNSIGNED_INT_5_9_9_9_REV ) internalFormat = _gl.RGB9_E5;
|
|
|
if ( glType === _gl.UNSIGNED_INT_10F_11F_11F_REV ) internalFormat = _gl.R11F_G11F_B10F;
|
|
|
|
|
|
@@ -70754,6 +70797,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
if ( glType === _gl.FLOAT ) internalFormat = _gl.RGBA32F;
|
|
|
if ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.RGBA16F;
|
|
|
if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = ( transfer === SRGBTransfer ) ? _gl.SRGB8_ALPHA8 : _gl.RGBA8;
|
|
|
+ if ( glType === _gl.UNSIGNED_SHORT && ext_texture_norm16 ) internalFormat = ext_texture_norm16.RGBA16_EXT;
|
|
|
+ if ( glType === _gl.SHORT && ext_texture_norm16 ) internalFormat = ext_texture_norm16.RGBA16_SNORM_EXT;
|
|
|
if ( glType === _gl.UNSIGNED_SHORT_4_4_4_4 ) internalFormat = _gl.RGBA4;
|
|
|
if ( glType === _gl.UNSIGNED_SHORT_5_5_5_1 ) internalFormat = _gl.RGB5_A1;
|
|
|
|
|
|
@@ -71451,7 +71496,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
const glFormat = utils.convert( texture.format, texture.colorSpace );
|
|
|
|
|
|
const glType = utils.convert( texture.type );
|
|
|
- let glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace, texture.isVideoTexture );
|
|
|
+ let glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace, texture.isVideoTexture );
|
|
|
|
|
|
setTextureParameters( textureType, texture );
|
|
|
|
|
|
@@ -71900,7 +71945,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
const image = cubeImage[ 0 ],
|
|
|
glFormat = utils.convert( texture.format, texture.colorSpace ),
|
|
|
glType = utils.convert( texture.type ),
|
|
|
- glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );
|
|
|
+ glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace );
|
|
|
|
|
|
const useTexStorage = ( texture.isVideoTexture !== true );
|
|
|
const allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );
|
|
|
@@ -72096,7 +72141,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
const glFormat = utils.convert( texture.format, texture.colorSpace );
|
|
|
const glType = utils.convert( texture.type );
|
|
|
- const glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );
|
|
|
+ const glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace );
|
|
|
const renderTargetProperties = properties.get( renderTarget );
|
|
|
const textureProperties = properties.get( texture );
|
|
|
|
|
|
@@ -72175,7 +72220,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
const glFormat = utils.convert( texture.format, texture.colorSpace );
|
|
|
const glType = utils.convert( texture.type );
|
|
|
- const glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );
|
|
|
+ const glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace );
|
|
|
|
|
|
if ( useMultisampledRTT( renderTarget ) ) {
|
|
|
|
|
|
@@ -72565,7 +72610,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
const glFormat = utils.convert( texture.format, texture.colorSpace );
|
|
|
const glType = utils.convert( texture.type );
|
|
|
- const glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace, renderTarget.isXRRenderTarget === true );
|
|
|
+ const glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.normalized, texture.colorSpace, renderTarget.isXRRenderTarget === true );
|
|
|
const samples = getRenderTargetSamples( renderTarget );
|
|
|
_gl.renderbufferStorageMultisample( _gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height );
|
|
|
|