Hey Smari! I see your code, good job! But I have to explain something first.
Your code works fine, but not optimally, because of:
1) traversing tree second time is not necessary
2) no need second requestAnimationFrame
3) every time you creates texture, which is heavy thing.
I suggest to replace all logic inside applyMaterial method. Just debug applyMaterial inside CanvasTiles. The key is that each frame you already have visible nodes(*), and each frame each node try appllyMaterial.
(*) Check globus.planet.renderedNodes
Like this:
applyMaterial(material) {
if (material.isReady) {
if (material.layer.animated) {
requestAnimationFrame(() => {
this.drawTile(material,
function (canvas) {
material.applyImage(canvas);
});
});
}
return [0, 0, 1, 1];
....
But, it work slow(but much better) too because of 3. If you check profiler you will see that createTexture takes a lot. In this case I strongly recommend use GeoTexture2D for wind animation etc, but this is shader deal always.