Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop using legacy three.js classes #364

Closed
marcofugaro opened this issue Apr 19, 2022 · 2 comments
Closed

Stop using legacy three.js classes #364

marcofugaro opened this issue Apr 19, 2022 · 2 comments
Labels
enhancement Enhancement of existing functionality

Comments

@marcofugaro
Copy link
Member

Is your feature request related to a problem?

If a user is using a custom build of three.js which doesn't include src/Three.Legacy.js, this error happens when including postprocessing:

Screenshot 2022-04-19 at 10 53 13

This is because postprocessing is still using legacy classes which I think it's wrong.

Describe the solution you'd like

The three.js peerDependency should be updated to support three.js versions with the new classes only (>= 0.138.0).

"three": ">= 0.107.0 < 0.140.0"

More precisely, DataTexture3D has been renamed to Data3DTexture in mrdoob/three.js#23498 and released in r138.

WebGLMultisampleRenderTarget has been removed in mrdoob/three.js#23455 and released in r138.

I can make a PR if this is agreed upon.

Describe alternatives you've considered

Including the legacy code in my three.js custom build.

@marcofugaro marcofugaro added the feature request New feature request label Apr 19, 2022
@vanruesc
Copy link
Member

Postprocessing relies on these legacy classes to ensure backward-compatibility with older vesions of three. Dropping this code and raising the peer dependency would be a breaking change because the library would then crash for people who are still using r137 or older.

Under normal circumstances, I would just release a new major version, but I think that people expect the next major version to include most of the changes outlined in the roadmap and dropping the use of legacy code is not a pressing issue so it'll have to wait a bit longer.

As a temporary solution, you could include the required legacy classes in your custom three bundle:

// @todo Remove when postprocessing v7 lands.
export class DataTexture3D extends Data3DTexture {

	constructor( data, width, height, depth ) {

		super( data, width, height, depth );

	}

}

// @todo Remove when postprocessing v7 lands.
export class WebGLMultisampleRenderTarget extends WebGLRenderTarget {

	constructor( width, height, options ) {

		super( width, height, options );
		this.samples = 4;

	}

}

@marcofugaro
Copy link
Member Author

Right, didn't understand you needed to publish a major version when bumping the minimum required three.js version.

I'll wait for the next major release in that case.

@vanruesc vanruesc added enhancement Enhancement of existing functionality and removed feature request New feature request labels Apr 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement of existing functionality
Projects
None yet
Development

No branches or pull requests

2 participants