Skip to content

Conversation

@deepkolos
Copy link

@deepkolos deepkolos commented May 8, 2022

Fixed #24017

Description

clean RGBELoader unused code

  1. unused switch case
  2. unused format variable

@WestLangley WestLangley added this to the r141 milestone May 8, 2022
@Mugen87 Mugen87 changed the title fix #24017 : clean RGBELoader code RGBELoader: Simplify texture configuration. May 8, 2022
@mrdoob
Copy link
Owner

mrdoob commented May 9, 2022

Without studying the code in depth... Wouldn't this break this if texture.type ==== UnsignedByteType?

@deepkolos
Copy link
Author

@mrdoob RGBELoader support Float or HalfFloat only

image

@mrdoob
Copy link
Owner

mrdoob commented May 9, 2022

I see...

How about this clean up then?

switch ( texture.type ) {

	case FloatType:
	case HalfFloatType:

		texture.encoding = LinearEncoding;
		texture.minFilter = LinearFilter;
		texture.magFilter = LinearFilter;
		texture.generateMipmaps = false;
		texture.flipY = true;

		break;

}

@deepkolos
Copy link
Author

@mrdoob the current clean up will remove switch check too, because of the type check already in the parse function

image

@mrdoob
Copy link
Owner

mrdoob commented May 9, 2022

Right, but my suggestion would only change the properties in the cases we know that need to be changed.
I think it makes the code more readable and more future proof, wouldn't you agree?

@deepkolos
Copy link
Author

@mrdoob 👌🏻

@mrdoob mrdoob merged commit 5c67b6f into mrdoob:dev May 9, 2022
@mrdoob
Copy link
Owner

mrdoob commented May 9, 2022

Thanks!

abernier pushed a commit to abernier/three.js that referenced this pull request Sep 16, 2022
* fix mrdoob#24017 : clean RGBELoader code

* [misc]: RGBELoader code clean

Co-authored-by: ouyanghaozhu <[email protected]>
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.

[misc] code redundancy of RGBELoader

4 participants