diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2025-01-14 14:38:52 +0100 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2025-01-14 14:38:52 +0100 |
commit | e8f03c4d6a94aa16b3587bdce525cf0cf7c6c6c3 (patch) | |
tree | d8d5a78a0872b86c3b40089e465120883669542b /extractor/gnd_format.gd | |
parent | b75cc72c4e10bd652330b6d2bd99f3fd9129a3b3 (diff) |
next commit
Diffstat (limited to 'extractor/gnd_format.gd')
-rw-r--r-- | extractor/gnd_format.gd | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/extractor/gnd_format.gd b/extractor/gnd_format.gd index 65635cf..faad9ae 100644 --- a/extractor/gnd_format.gd +++ b/extractor/gnd_format.gd @@ -124,6 +124,8 @@ static func from_bytes(bytes: ByteStream) -> GNDFormat: func get_cubes() -> Array: + # TODO: return custom type with helper functions for getting neighboring cubes and building a full cube + var cubes := [] for cube in ground_mesh_cubes: cubes.append({ @@ -163,6 +165,9 @@ func convert(data_path: String) -> GridMap: for x in width: for y in height: var cube = cubes[x + y * width] + + # TODO: get all sides of a cube and add that mesh to the library + # TODO: so a single mesh per cube for surface_type in [Vector3(0, 1, 0)]: var mesh: ArrayMesh = cube[surface_type].mesh var material := StandardMaterial3D.new() @@ -300,8 +305,6 @@ class Surface: var uvs = get_uvs() var color = get_vertex_color() - var tiles_per_surface := 2 * 2 - surface_tool.add_triangle_fan( PackedVector3Array([ vertices[Vector2(0, 0)], @@ -309,9 +312,9 @@ class Surface: vertices[Vector2(1, 1)], ]), PackedVector2Array([ - uvs[Vector2(0, 0)] * tiles_per_surface, - uvs[Vector2(1, 0)] * tiles_per_surface, - uvs[Vector2(1, 1)] * tiles_per_surface, + uvs[Vector2(0, 0)], + uvs[Vector2(1, 0)], + uvs[Vector2(1, 1)], ]), PackedColorArray([ color, color, color, @@ -324,9 +327,9 @@ class Surface: vertices[Vector2(0, 1)], ]), PackedVector2Array([ - uvs[Vector2(0, 0)] * tiles_per_surface, - uvs[Vector2(1, 1)] * tiles_per_surface, - uvs[Vector2(0, 1)] * tiles_per_surface, + uvs[Vector2(0, 0)], + uvs[Vector2(1, 1)], + uvs[Vector2(0, 1)], ]), PackedColorArray([ color, color, color, @@ -420,3 +423,5 @@ class GroundMeshCube: #print(inst_to_dict(mesh)) return mesh + + # TODO: convert function to build cube mesh? or at least with neighbor input build full cube struct |