Skip to content

Commit

Permalink
Core: Remove deprecated code. (mrdoob#30621)
Browse files Browse the repository at this point in the history
* Core: Remove deprecated code.

* Tests: Clean up.
  • Loading branch information
Mugen87 authored Feb 27, 2025
1 parent 2ed77d2 commit e26f94f
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 92 deletions.
44 changes: 0 additions & 44 deletions src/loaders/LoaderUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,6 @@
*/
class LoaderUtils {

/**
* The function takes a stream of bytes as input and returns a string
* representation.
*
* @deprecated since r165. Use the native `TextDecoder` API instead.
* @param {TypedArray} array - A stream of bytes as a typed array.
* @return {string} The decoded text.
*/
static decodeText( array ) { // @deprecated, r165

console.warn( 'THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead.' );

if ( typeof TextDecoder !== 'undefined' ) {

return new TextDecoder().decode( array );

}

// Avoid the String.fromCharCode.apply(null, array) shortcut, which
// throws a "maximum call stack size exceeded" error for large arrays.

let s = '';

for ( let i = 0, il = array.length; i < il; i ++ ) {

// Implicitly assumes little-endian.
s += String.fromCharCode( array[ i ] );

}

try {

// merges multi-byte utf-8 characters.

return decodeURIComponent( escape( s ) );

} catch ( e ) { // see #16358

return s;

}

}

/**
* Extracts the base URL from the given URL.
*
Expand Down
39 changes: 0 additions & 39 deletions src/renderers/WebGLRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2558,17 +2558,6 @@ class WebGLRenderer {

this.copyFramebufferToTexture = function ( texture, position = null, level = 0 ) {

// support previous signature with position first
if ( texture.isTexture !== true ) {

// @deprecated, r165
warnOnce( 'WebGLRenderer: copyFramebufferToTexture function signature has changed.' );

position = arguments[ 0 ] || null;
texture = arguments[ 1 ];

}

const levelScale = Math.pow( 2, - level );
const width = Math.floor( texture.image.width * levelScale );
const height = Math.floor( texture.image.height * levelScale );
Expand All @@ -2588,20 +2577,6 @@ class WebGLRenderer {
const _dstFramebuffer = _gl.createFramebuffer();
this.copyTextureToTexture = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, srcLevel = 0, dstLevel = null ) {

// support previous signature with dstPosition first
if ( srcTexture.isTexture !== true ) {

// @deprecated, r165
warnOnce( 'WebGLRenderer: copyTextureToTexture function signature has changed.' );

dstPosition = arguments[ 0 ] || null;
srcTexture = arguments[ 1 ];
dstTexture = arguments[ 2 ];
dstLevel = arguments[ 3 ] || 0;
srcRegion = null;

}

// support the previous signature with just a single dst mipmap level
if ( dstLevel === null ) {

Expand Down Expand Up @@ -2854,20 +2829,6 @@ class WebGLRenderer {

this.copyTextureToTexture3D = function ( srcTexture, dstTexture, srcRegion = null, dstPosition = null, level = 0 ) {

// support previous signature with source box first
if ( srcTexture.isTexture !== true ) {

// @deprecated, r165
warnOnce( 'WebGLRenderer: copyTextureToTexture3D function signature has changed.' );

srcRegion = arguments[ 0 ] || null;
dstPosition = arguments[ 1 ] || null;
srcTexture = arguments[ 2 ];
dstTexture = arguments[ 3 ];
level = arguments[ 4 ] || 0;

}

// @deprecated, r170
warnOnce( 'WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.' );

Expand Down
9 changes: 0 additions & 9 deletions test/unit/src/loaders/LoaderUtils.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@ export default QUnit.module( 'Loaders', () => {
QUnit.module( 'LoaderUtils', () => {

// STATIC
QUnit.test( 'decodeText', ( assert ) => {

const jsonArray = new Uint8Array( [ 123, 34, 106, 115, 111, 110, 34, 58, 32, 116, 114, 117, 101, 125 ] );
assert.equal( '{"json": true}', LoaderUtils.decodeText( jsonArray ) );

const multibyteArray = new Uint8Array( [ 230, 151, 165, 230, 156, 172, 229, 155, 189 ] );
assert.equal( '日本国', LoaderUtils.decodeText( multibyteArray ) );

} );

QUnit.test( 'extractUrlBase', ( assert ) => {

Expand Down

0 comments on commit e26f94f

Please sign in to comment.