Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(LayeredMaterial): migrate to TypeScript #2477

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

HoloTheDrunk
Copy link
Contributor

Description

Converted the LayeredMaterial class and eponymous file to TypeScript.
Took this opportunity to do some internal cleanup and refactoring of things like the way the layers (or more precisely RasterTiles) were stored, the uniforms and defines, etc... This means the internal API for the material has changed since we now keep RasterColorTiles and the one RasterElevationTile separate internally. A convenience getLayer method has been provided matching the previous API for cases where the exact type of RasterTile is not important.
Whether we should rename the "layer" fields to "tile" to match the actual data type is up for debate. I'm all for it, but I'm not aware of how dependent people might be on those names.

Also planning on making the new uniforms/defines convenience TS-specific functions available to the PointsMaterial class and nuking src/Renderer/CommonMaterial.js out of existence in a coming PR.

Motivation and Context

This PR fits into the larger motion to migrate iTowns to TypeScript.

Tested on Ubuntu 22.04.5 LTS x86_64 using Firefox 126.0.1 (64-bit)

@HoloTheDrunk HoloTheDrunk force-pushed the layered-material-typescript branch 4 times, most recently from 3821cc2 to c4d4b46 Compare December 17, 2024 16:12
fix(tests): add new empty methods to mock Material
refactor: use interface where possible
@HoloTheDrunk HoloTheDrunk force-pushed the layered-material-typescript branch from c4d4b46 to d283702 Compare December 17, 2024 16:14
@jailln
Copy link
Contributor

jailln commented Dec 20, 2024

Thanks for this PR :) It really makes this material clearer!

I would be down for renaming layer to tile since using layer is really confusing with itowns layers and I think no one is using this API outside of itowns.

I noticed a few bugs though:

  • terrain is not displayed anymore: see view_3d_map.html for instance. Also, it seems that now you only let the possibility to have one elevation layer. Even if multiple elevation layers support was not totally implemented (especially when having tiles at the same zoom level or because sometimes we used the first elevation layer by default), it was possible to have two elevation layers.
  • debug tiles are always displayed:
    image
  • zoom is broken:
LayeredMaterial.mp4

@jailln jailln self-assigned this Dec 20, 2024
@HoloTheDrunk
Copy link
Contributor Author

HoloTheDrunk commented Dec 20, 2024

Hi, yes this is still a WIP and I'm tracking down the source of these issues.
I'll be on holiday until early January though so this isn't gonna move much until then.
Happy holidays!

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.

2 participants