Now About Social Code
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--models/alien.blendbin1260080 -> 1265600 bytes
-rw-r--r--models/floor_tile.pngbin0 -> 699 bytes
-rw-r--r--models/floor_tile.png.import34
-rw-r--r--models/floor_tile.xcfbin0 -> 3601 bytes
-rw-r--r--models/wall.blendbin0 -> 937788 bytes
-rw-r--r--models/wall.blend.import63
-rw-r--r--models/wall.tres41
-rw-r--r--models/wall_panel.pngbin0 -> 753 bytes
-rw-r--r--models/wall_panel.png.import34
-rw-r--r--models/wall_panel.xcfbin0 -> 4326 bytes
-rw-r--r--prefabs/bsp_level_generator.tscn2
-rw-r--r--project.godot7
-rw-r--r--scripts/bsp_level_generator.gd22
13 files changed, 197 insertions, 6 deletions
diff --git a/models/alien.blend b/models/alien.blend
index 409591b..9c72178 100644
--- a/models/alien.blend
+++ b/models/alien.blend
Binary files differ
diff --git a/models/floor_tile.png b/models/floor_tile.png
new file mode 100644
index 0000000..b996bac
--- /dev/null
+++ b/models/floor_tile.png
Binary files differ
diff --git a/models/floor_tile.png.import b/models/floor_tile.png.import
new file mode 100644
index 0000000..976c452
--- /dev/null
+++ b/models/floor_tile.png.import
@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://b6br2axpaqxla"
+path="res://.godot/imported/floor_tile.png-25bca761fb1d0b6da32ff556d940ba4b.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://models/floor_tile.png"
+dest_files=["res://.godot/imported/floor_tile.png-25bca761fb1d0b6da32ff556d940ba4b.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=0
diff --git a/models/floor_tile.xcf b/models/floor_tile.xcf
new file mode 100644
index 0000000..802900d
--- /dev/null
+++ b/models/floor_tile.xcf
Binary files differ
diff --git a/models/wall.blend b/models/wall.blend
new file mode 100644
index 0000000..06e99f6
--- /dev/null
+++ b/models/wall.blend
Binary files differ
diff --git a/models/wall.blend.import b/models/wall.blend.import
new file mode 100644
index 0000000..47175e1
--- /dev/null
+++ b/models/wall.blend.import
@@ -0,0 +1,63 @@
+[remap]
+
+importer="scene"
+importer_version=1
+type="PackedScene"
+uid="uid://rbul5d7a3qjx"
+path="res://.godot/imported/wall.blend-834e19a679a0d9a7bfc9d9791801db4d.scn"
+
+[deps]
+
+source_file="res://models/wall.blend"
+dest_files=["res://.godot/imported/wall.blend-834e19a679a0d9a7bfc9d9791801db4d.scn"]
+
+[params]
+
+nodes/root_type=""
+nodes/root_name=""
+nodes/apply_root_scale=true
+nodes/root_scale=1.0
+nodes/import_as_skeleton_bones=false
+meshes/ensure_tangents=true
+meshes/generate_lods=true
+meshes/create_shadow_meshes=true
+meshes/light_baking=1
+meshes/lightmap_texel_size=0.2
+meshes/force_disable_compression=false
+skins/use_named_skins=true
+animation/import=true
+animation/fps=30
+animation/trimming=false
+animation/remove_immutable_tracks=true
+animation/import_rest_as_RESET=false
+import_script/path=""
+_subresources={
+"meshes": {
+"wall_Cube": {
+"generate/lightmap_uv": 0,
+"generate/lods": 0,
+"generate/shadow_meshes": 0,
+"lods/normal_merge_angle": 60.0,
+"lods/normal_split_angle": 25.0,
+"save_to_file/enabled": true,
+"save_to_file/path": "res://models/wall.tres"
+}
+}
+}
+blender/nodes/visible=0
+blender/nodes/active_collection_only=false
+blender/nodes/punctual_lights=true
+blender/nodes/cameras=true
+blender/nodes/custom_properties=true
+blender/nodes/modifiers=1
+blender/meshes/colors=false
+blender/meshes/uvs=true
+blender/meshes/normals=true
+blender/meshes/tangents=true
+blender/meshes/skins=2
+blender/meshes/export_bones_deforming_mesh_only=false
+blender/materials/unpack_enabled=true
+blender/materials/export_materials=1
+blender/animation/limit_playback=true
+blender/animation/always_sample=true
+blender/animation/group_tracks=true
diff --git a/models/wall.tres b/models/wall.tres
new file mode 100644
index 0000000..3408dca
--- /dev/null
+++ b/models/wall.tres
@@ -0,0 +1,41 @@
+[gd_resource type="ArrayMesh" load_steps=4 format=4 uid="uid://do51kw6o3nu1v"]
+
+[ext_resource type="Texture2D" uid="uid://cn3wok1och2k0" path="res://models/wall_panel.png" id="1_2twoe"]
+
+[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_7oodk"]
+resource_name = "Material"
+cull_mode = 2
+albedo_texture = ExtResource("1_2twoe")
+texture_filter = 2
+
+[sub_resource type="ArrayMesh" id="ArrayMesh_lkndq"]
+_surfaces = [{
+"aabb": AABB(0, 0, 0, 1, 2, 1),
+"format": 34896613377,
+"index_count": 36,
+"index_data": PackedByteArray("AAAGAAQAAAACAAYAAwAGAAIAAwAHAAYABwAEAAYABwAFAAQABQADAAEABQAHAAMAAQACAAAAAQADAAIABQAAAAQABQABAAAA"),
+"name": "Material",
+"primitive": 3,
+"uv_scale": Vector4(0, 0, 0, 0),
+"vertex_count": 8,
+"vertex_data": PackedByteArray("/////wAAAAD//wAAAAAAAP///////wAA//8AAP//AAAAAP//AAAAAAAAAAAAAAAAAAD/////AAAAAAAA//8AAA==")
+}]
+blend_shape_mode = 0
+
+[resource]
+resource_name = "wall_Cube"
+_surfaces = [{
+"aabb": AABB(0, 0, 0, 1, 2, 1),
+"attribute_data": PackedByteArray("AAAAAP//AAD//wAA//8AAAAA/v////7///8AAP///v8AAAAA///+/////v8AAP//AAAAAP7/AAAAAAAAAAD+/wAAAAD//////v8AAAAAAAAAAP///////wAA//8AAP//"),
+"format": 34896613399,
+"index_count": 36,
+"index_data": PackedByteArray("AQAUAA4AAQAHABQACgATAAYACgAXABMAFQAMABIAFQAPAAwAEAAJAAMAEAAWAAkABQAIAAIABQALAAgAEQAAAA0AEQAEAAAA"),
+"material": SubResource("StandardMaterial3D_7oodk"),
+"name": "Material",
+"primitive": 3,
+"uv_scale": Vector4(0, 0, 0, 0),
+"vertex_count": 24,
+"vertex_data": PackedByteArray("/////wAA////////AAD/v/////8AAP+///8AAAAA/z///wAAAAD/////AAAAAP+/////////AID/////////v/////////+///8AAP///z///wAA//8AgP//AAD///+/AAD//wAA/78AAP//AAD//wAA//8AAP+/AAAAAAAA/78AAAAAAAD/PwAAAAAAAP//AAD//////78AAP////8AgAAA//////+/AAAAAP///78AAAAA////PwAAAAD//wCA/3///////3//fwAAAAD/f/9/////fwAA/3///////3//fwAAAAD/f/9/////fwAA/3////9///////9//3///wAA/3//f////3////9///////9//3///wAA/3//f///")
+}]
+blend_shape_mode = 0
+shadow_mesh = SubResource("ArrayMesh_lkndq")
diff --git a/models/wall_panel.png b/models/wall_panel.png
new file mode 100644
index 0000000..7f4f5c8
--- /dev/null
+++ b/models/wall_panel.png
Binary files differ
diff --git a/models/wall_panel.png.import b/models/wall_panel.png.import
new file mode 100644
index 0000000..302fcca
--- /dev/null
+++ b/models/wall_panel.png.import
@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://cn3wok1och2k0"
+path="res://.godot/imported/wall_panel.png-196d8e116073b7ce9439ba654f15d82d.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://models/wall_panel.png"
+dest_files=["res://.godot/imported/wall_panel.png-196d8e116073b7ce9439ba654f15d82d.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=true
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=0
diff --git a/models/wall_panel.xcf b/models/wall_panel.xcf
new file mode 100644
index 0000000..6162798
--- /dev/null
+++ b/models/wall_panel.xcf
Binary files differ
diff --git a/prefabs/bsp_level_generator.tscn b/prefabs/bsp_level_generator.tscn
index 94a8c4c..f52880d 100644
--- a/prefabs/bsp_level_generator.tscn
+++ b/prefabs/bsp_level_generator.tscn
@@ -11,8 +11,6 @@ region_min_size = 1.0
[node name="BspLevelGenerator" type="Node3D"]
script = ExtResource("1_6jn1x")
-[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
-
[node name="NavigationRegion3D" type="NavigationRegion3D" parent="."]
navigation_mesh = SubResource("NavigationMesh_q1fo6")
diff --git a/project.godot b/project.godot
index 568104f..34a0654 100644
--- a/project.godot
+++ b/project.godot
@@ -23,6 +23,12 @@ Tile="*res://scripts/tile.gd"
gdscript/warnings/integer_division=0
+[importer_defaults]
+
+texture={
+"detect_3d/compress_to": 0
+}
+
[input]
left={
@@ -66,5 +72,6 @@ attack={
[rendering]
+textures/canvas_textures/default_texture_filter=0
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"
diff --git a/scripts/bsp_level_generator.gd b/scripts/bsp_level_generator.gd
index 664b7a5..f8b850d 100644
--- a/scripts/bsp_level_generator.gd
+++ b/scripts/bsp_level_generator.gd
@@ -9,7 +9,9 @@ extends Node3D
## Geometry generation config
@export var wall_thickness: float = 1
-@onready var mesh: MeshInstance3D = $MeshInstance3D
+var wall_inst = preload("res://models/wall.blend")
+var level_geo: Node3D
+
enum Direction {LEFT, RIGHT}
signal grid_generated(grid: Array[Tile], p_grid_width: int, p_grid_height: int)
@@ -148,11 +150,22 @@ func generate_geo(grid: Array[Tile.Tile], array: Array) -> void:
if tile == Tile.Tile.FLOOR or tile == Tile.Tile.DOOR:
generate_plane(array, Vector3(x, 0, y), [Vector3(1, 0, 0), Vector3(0, 0, 1)], Vector3.UP)
+ var floor_tile: Node3D = level_geo.get_node("./Floor").duplicate()
+ floor_tile.position = Vector3(x, 0, y)
+ add_child(floor_tile)
+
+ var ciel_tile: Node3D = level_geo.get_node("./Floor").duplicate()
+ ciel_tile.rotate_z(deg_to_rad(180))
+ ciel_tile.position = Vector3(x+1, 2, y)
+ add_child(ciel_tile)
elif tile == Tile.Tile.WALL:
generate_plane(array, Vector3(x, 2, y), [Vector3(0, 0, 1), Vector3(0, -2, 0)], Vector3.LEFT)
generate_plane(array, Vector3(x, 2, y+1), [Vector3(1, 0, 0), Vector3(0, -2, 0)], Vector3.BACK)
generate_plane(array, Vector3(x+1, 2, y+1), [Vector3(0, 0, -1), Vector3(0, -2, 0)], Vector3.RIGHT)
generate_plane(array, Vector3(x+1, 2, y), [Vector3(-1, 0, 0), Vector3(0, -2, 0)], Vector3.FORWARD)
+ var wall: Node3D = level_geo.get_node("./Wall").duplicate()
+ wall.position = Vector3(x, 0, y)
+ add_child(wall)
func _ready() -> void:
var starting_axis = randi_range(0, 1)
@@ -172,11 +185,12 @@ func _ready() -> void:
generate_grid(map, grid)
grid_generated.emit(grid, grid_width, grid_height)
+ level_geo = wall_inst.instantiate()
generate_geo(grid, surface_array)
- mesh.mesh = ArrayMesh.new()
- mesh.mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, surface_array)
- var tri_mesh = mesh.mesh.create_trimesh_shape()
+ var mesh = ArrayMesh.new()
+ mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, surface_array)
+ var tri_mesh = mesh.create_trimesh_shape()
$NavigationRegion3D/StaticBody3D/CollisionShape3D.shape = tri_mesh
#$NavigationRegion3D.navigation_mesh = NavigationMesh.new()
#$NavigationRegion3D.navigation_mesh.radius