Closed EricBoix closed 1 year ago
This PR allows to load a tileset and its content in memory by using the TilesetReader
class:
reader = TilesetReader()
tileset = reader.read_tileset("path/to/tileset/")
It returns a Tileset
instance. It is possible to read the triangles, uvs, material indexes and batch ids from the content of each tile by using the from_glTF
method of the TriangleSoup
class.
all_tiles = tileset.get_root_tile().get_children()
for tile in all_tiles:
gltf = tile.get_content().body.glTF
triangle_soup = TriangleSoup.from_glTF(gltf)
triangles = triangle_soup.triangles[0]
vertex_ids = triangle_soup.triangles[1]
mat_indexes = triangle_soup.triangles[2]
uvs = [] if len(triangle_soup.triangles) <= 3 else triangle_soup.triangles[3]
On py3dtilers, there is a Tileset Reader (using py3dtiles' TilesetReader) which can read/write a tileset by keeping:
Loading a tileset and its geometries in py3dtilers allows to access the Tilers transformation methods like:
This issue was split in three parts
User story/Use caser
Having a reader at hand would allow:
Up to now, only writing a tileset is possible. Provide such a tileset reader
Notes
Concerning the breakdown parsing system
In order to validate the json produced out of an in memory tileset (prior to writing a tileset) we a use a break down system provided by the jsonschema library: refer to the code of schema_validator and register_schema_with_sample. We must find a equivalent mechanism for reading and breaking down a json hierarchy with a delegation process. Such a mechanism must be provided by some library since deserialisation is a common business...