From e8f03c4d6a94aa16b3587bdce525cf0cf7c6c6c3 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Tue, 14 Jan 2025 14:38:52 +0100 Subject: next commit --- extractor/gnd_format.gd | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'extractor/gnd_format.gd') 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 -- cgit v1.2.3