Skip to content

Commit

Permalink
only rescale vertices once for grid meshing
Browse files Browse the repository at this point in the history
  • Loading branch information
tebben committed Jan 26, 2024
1 parent c119055 commit f27bbb9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def process(self, cog_request: CogRequest) -> tuple:
cartesian = to_ecef(rescaled, ellipsoid=self.ellipsoid)
normals = calculate_normals(cartesian, triangles_new) if cog_request.generate_normals else None

return (vertices_new, triangles_new, normals)
return (vertices_new, triangles_new, normals, rescaled)

def _load_settings(self, request: web.RequestHandler):
"""Parse the config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def generate(self, terrain_request: TerrainRequest) -> bytes:
quantized_empty_tile = generate_empty_tile(main_cog.tms, main_cog.z, main_cog.x, main_cog.y)
return quantized_empty_tile

vertices, triangles, normals = main_cog.processed_data
vertices, triangles, normals, rescaled = main_cog.processed_data

n = terrain_request.get_neighbour_file(Direction.NORTH)
ne = terrain_request.get_neighbour_file(Direction.NORTHEAST)
Expand Down Expand Up @@ -67,9 +67,7 @@ def generate(self, terrain_request: TerrainRequest) -> bytes:
]
normals[i] = np.average(np.concatenate((duplicated_normals, normals[i].reshape(1, 3)), axis=0), axis=0)

# Rescale the vertices to the tile bounds and create quantized mesh
rescaled_vertices = rescale_positions(vertices, main_cog.tile_bounds, flip_y=False)
quantized = quantize(rescaled_vertices, triangles, normals)
quantized = quantize(rescaled, triangles, normals)

return quantized

Expand Down

0 comments on commit f27bbb9

Please sign in to comment.