-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
Commit
* WebGPURenderer: Fix NodeLibrary after minification * add warning * fix missing materials * fix depthmaterial, thanks e2e tests * some minifier moves type as property
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -7,6 +7,20 @@ let _materialId = 0; | |||||
|
||||||
class Material extends EventDispatcher { | ||||||
|
||||||
static get type() { | ||||||
|
||||||
return 'Material'; | ||||||
|
||||||
} | ||||||
|
||||||
get type() { | ||||||
|
||||||
return this.constructor.type; | ||||||
|
||||||
} | ||||||
|
||||||
set type( _value ) { /* */ } | ||||||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Mugen87
Collaborator
|
const shaderID = shaderIDs[ material.type ]; |
const shaderID = shaderIDs[ material.type ]; |
I'm glad you have found a workaround to make things work again in your project.
@RenaudRohlinger Could we fix this by keeping the static type
property for NodeLibrary
but restore the previous type
property? I guess this should not interfere with node materials and the use case of @FarazzShaikh will work again.
This comment has been minimized.
This comment has been minimized.
Sorry, something went wrong.
FarazzShaikh
Nov 1, 2024
Contributor
Thanks for the resolution guys. Please let me know if we decide not to revert, I will put out a message to troika
maintainers and other folk I know who use this property.
Cheers! 🙌
This comment has been minimized.
This comment has been minimized.
Sorry, something went wrong.
lojjic
Nov 2, 2024
Contributor
@FarazzShaikh Thanks for your analysis, you were exactly correct and my quick fix/workaround in troika-three-utils 0.50.3 was exactly the same as yours.
This wasn't an issue of attempting to change the type property, but expecting it to behave as a simple instance property when prototype-chaining, which was no longer the case because it was given a dependency on a new static that wasn't accounted for. 🤷
Anyway, it looks like it's being reverted, which will unbreak older versions.
Hello @RenaudRohlinger @Mugen87 (sorry for the ping)
This looks like a big breaking change to me. Some libraries like my
three-custom-shader-material
set the type manually so their custom onBeforeCompile wrappers remain transparent to ThreeJS' internals.I am sure other libs in the eco system do the same. I am already seeing erros that may be related to this with
troika-three-text
using r170This change is not mentioned in the migration guide and is very hard to spot