fix(MeshReflectionMaterial)!: add features/docs, reorganize #377
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Some of
MeshReflectionMaterial
's features – e.g., features related to "blur" – weren't working.Solution
Rewrite
MeshReflectionMaterial
Playground at
/materials/reflection-material
Problem
MeshReflectionMaterial
was undocumented.Solution
Document
MeshReflectionMaterial
at/guide/materials/mesh-reflection-material.html
Problem
blurPass
didn't have a way of disposing its resources, leading to memory leaks.Solution
Add dispose to
blurPass
and dispose it when necessary.Breaking changes
The issue of breaking changes was brought up on the Discord. It was decided that since the material was undocumented up to this point, users probably don't rely on the current implementation, and there was little benefit in avoiding breaking changes.
blurPass
andconvolutionMaterial
move insideMeshReflectionMaterial
and their implementations change. These files were/are undocumented. Their implementations are relatively tightly bound toMeshReflectionMaterial
's implementation, so they're not generally useful as written.MeshReflectionMaterial
. The visual output of the material is much different, for the same props.Related issues
Some
NOTE:
/TODO:
s have been left in the files concerning issues filed against the Tres core.In particular, the Tres core currently doesn't reattach recompiled materials. Some props changes have to trigger a recompile of the material in order to take effect. Some of those are due to
THREE.MeshStandardMaterial
's implementation, so can't be worked around here, while still retaining the desired functionality/reactivity.The material logs warnings if users change props in ways that trigger a recompile specific to this material – e.g., toggling the blur or "depth".
Room for improvement?
The material extends
MeshStandardMaterial
.The material ran into reactivity/recompile issues when "inherited" props/defaults were not written out in
MeshStandardMaterial
.closes #371