Circular dependency in WebGLCubeRenderTarget.fromEquirectangularTexture
See original GitHub issueThe last circular dependency in the library is:
WebGLCubeRenderTarget -> CubeCamera -> WebGLCubeRenderTarget
This is caused by WebGLCubeRenderTarget.fromEquirectangularTexture
, which was added in #16671 following discussion in https://github.com/mrdoob/three.js/pull/15331#issuecomment-442908452.
This is the last blocker for closing #6241.
To remove this, we could extract .fromEquirectangularTexture
to an external utility (or maybe move it to CubeTexture
?). I’m not sure if it’s worth doing so just to avoid a circular dependency though.
@WestLangley, @Mugen87 and @mrdoob - you guys were involved in adding this method. Do you think we need to fix this circular dependency? If not, then we can probably just mark as “won’t fix” and close #6241.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (1 by maintainers)
Top Results From Across the Web
WebGLCubeRenderTarget#fromEquirectangularTexture
Use this method if you want to convert an equirectangular panorama to the cubemap format. # .clear ( renderer : WebGLRenderer, color :...
Read more >How to Eliminate Circular Dependencies from Your JavaScript ...
Circular dependencies (also known as cyclic dependencies) occur when two or more modules reference each other.
Read more >NG0200: Circular dependency in DI detected while ... - Angular
A cyclic dependency exists when a dependency of a service directly or indirectly depends on the service itself. For example, if UserService depends...
Read more >Circular Dependency - A progressive Node.js framework
A circular dependency occurs when two classes depend on each other. For example, class A needs class B, and class B also needs...
Read more >Circular Dependencies in Spring - Baeldung
A quick writeup on dealing with circular dependencies in Spring: how they occur and several ways to work around them.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If @mrdoob approves (and consider no other objections), I can make a PR with the change.
As far as I understand, this circular dependency is not harmful. However, circular dependency is always an indicator that something with the class design is not right. This issue can only be solved by refactoring.
I’ve already though about this in the past and my preferred option is to inject the internal render target of
CubeCamera
to solve this issue. So instead of:we do this:
I like latter one since the last two parameters of
CubeCamera
are obviously intended forWebGLCubeRenderTarget
. And since users usually usecubeCamera.renderTarget
to access the internal render target, they could instead refer to the variable created on app level (so justrenderTarget
).