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

WebGLTextures: Make .clampToMaxSize() more robust #13586

Merged
merged 3 commits into from
Mar 14, 2018
Merged

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Mar 14, 2018

see #13454

@mrdoob
Copy link
Owner

mrdoob commented Mar 14, 2018

I would do this instead:

function clampToMaxSize( image, maxSize ) {

	if ( image.width > maxSize || image.height > maxSize ) {

		if ( 'data' in image ) {

			console.warn( 'THREE.WebGLRenderer: image in DataTexture is too big (' + image.width + 'x' + image.height + ').' );
			return;

		}

		// Warning: Scaling through the canvas will only work with images that use
		// premultiplied alpha.

@mrdoob mrdoob added this to the r91 milestone Mar 14, 2018
@mrdoob mrdoob merged commit d40d310 into mrdoob:dev Mar 14, 2018
@mrdoob
Copy link
Owner

mrdoob commented Mar 14, 2018

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants