Island modelling rework with vertex fixes
This commit is contained in:
parent
9557989d7c
commit
2f30691808
30 changed files with 652 additions and 71 deletions
15
world/materials/starter_island_sandstone.tres
Normal file
15
world/materials/starter_island_sandstone.tres
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
[gd_resource type="ShaderMaterial" load_steps=3 format=3]
|
||||
|
||||
[ext_resource type="Texture2D" path="res://art/exported/environment/textures/sandstone_heavy.png" id="1_texture"]
|
||||
[ext_resource type="Shader" path="res://world/materials/terrain_surface_projection.gdshader" id="2_shader"]
|
||||
|
||||
[resource]
|
||||
resource_name = "Starter Island Sandstone"
|
||||
shader = ExtResource("2_shader")
|
||||
shader_parameter/albedo_texture = ExtResource("1_texture")
|
||||
shader_parameter/albedo_tint = Color(1, 1, 1, 1)
|
||||
shader_parameter/tile_world_size = 2.5
|
||||
shader_parameter/blend_sharpness = 6.0
|
||||
shader_parameter/top_projection_bias = 2.0
|
||||
shader_parameter/roughness = 1.0
|
||||
shader_parameter/specular = 0.0
|
||||
|
|
@ -7,6 +7,7 @@ const FishingShopInteractionType = preload(
|
|||
)
|
||||
const GRASS_SURFACE_NAME: String = "grass_lite"
|
||||
const SAND_SURFACE_NAME: String = "sand"
|
||||
const SANDSTONE_SURFACE_NAME: String = "sandstone_heavy"
|
||||
|
||||
@export_group("Owned Nodes")
|
||||
@export_node_path("MeshInstance3D")
|
||||
|
|
@ -31,17 +32,24 @@ var pelican_landmark_path: NodePath = (
|
|||
)
|
||||
|
||||
@export_group("Grass Surface")
|
||||
@export var apply_surface_overrides: bool = true
|
||||
@export var grass_material: Material
|
||||
@export_range(0, 16, 1) var grass_surface_index: int = 0
|
||||
|
||||
@export_group("Sand Surface")
|
||||
@export var sand_material: Material
|
||||
@export_range(0, 16, 1) var sand_surface_index: int = 2
|
||||
@export_range(0, 16, 1) var sand_surface_index: int = 4
|
||||
|
||||
@export_group("Sandstone Surface")
|
||||
@export var sandstone_material: Material
|
||||
@export_range(0, 16, 1) var sandstone_surface_index: int = 5
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_apply_grass_material()
|
||||
_apply_sand_material()
|
||||
if apply_surface_overrides:
|
||||
_apply_grass_material()
|
||||
_apply_sand_material()
|
||||
_apply_sandstone_material()
|
||||
_build_terrain_collision()
|
||||
if Engine.is_editor_hint():
|
||||
update_configuration_warnings()
|
||||
|
|
@ -121,6 +129,31 @@ func _apply_sand_material() -> void:
|
|||
)
|
||||
|
||||
|
||||
func _apply_sandstone_material() -> void:
|
||||
var visual_mesh: MeshInstance3D = (
|
||||
get_node_or_null(visual_mesh_path) as MeshInstance3D
|
||||
)
|
||||
if visual_mesh == null or visual_mesh.mesh == null:
|
||||
push_error("Starter island visual mesh is unavailable.")
|
||||
return
|
||||
if sandstone_material == null:
|
||||
push_error("Starter island sandstone material is unavailable.")
|
||||
return
|
||||
if sandstone_surface_index >= visual_mesh.mesh.get_surface_count():
|
||||
push_error("Starter island sandstone surface index is invalid.")
|
||||
return
|
||||
if (
|
||||
visual_mesh.mesh.surface_get_name(sandstone_surface_index)
|
||||
!= SANDSTONE_SURFACE_NAME
|
||||
):
|
||||
push_error("Starter island sandstone surface name does not match.")
|
||||
return
|
||||
visual_mesh.set_surface_override_material(
|
||||
sandstone_surface_index,
|
||||
sandstone_material
|
||||
)
|
||||
|
||||
|
||||
func _build_terrain_collision() -> void:
|
||||
var terrain_root: Node = get_node_or_null(terrain_visual_root_path)
|
||||
if terrain_root == null:
|
||||
|
|
@ -183,16 +216,19 @@ func _get_configuration_warnings() -> PackedStringArray:
|
|||
return warnings
|
||||
if visual_mesh == null or visual_mesh.mesh == null:
|
||||
warnings.append("Terrain/Visual must provide the island mesh.")
|
||||
elif grass_surface_index >= visual_mesh.mesh.get_surface_count():
|
||||
warnings.append("Grass surface index is outside the terrain mesh.")
|
||||
elif (
|
||||
visual_mesh.mesh.surface_get_name(grass_surface_index)
|
||||
!= GRASS_SURFACE_NAME
|
||||
):
|
||||
warnings.append("Grass surface index must identify the grass surface.")
|
||||
if grass_material == null:
|
||||
warnings.append("Assign the starter-island grass material.")
|
||||
if visual_mesh != null and visual_mesh.mesh != null:
|
||||
return warnings
|
||||
|
||||
if apply_surface_overrides:
|
||||
if grass_surface_index >= visual_mesh.mesh.get_surface_count():
|
||||
warnings.append("Grass surface index is outside the terrain mesh.")
|
||||
elif (
|
||||
visual_mesh.mesh.surface_get_name(grass_surface_index)
|
||||
!= GRASS_SURFACE_NAME
|
||||
):
|
||||
warnings.append("Grass surface index must identify the grass surface.")
|
||||
if grass_material == null:
|
||||
warnings.append("Assign the starter-island grass material.")
|
||||
|
||||
if sand_surface_index >= visual_mesh.mesh.get_surface_count():
|
||||
warnings.append("Sand surface index is outside the terrain mesh.")
|
||||
elif (
|
||||
|
|
@ -200,8 +236,21 @@ func _get_configuration_warnings() -> PackedStringArray:
|
|||
!= SAND_SURFACE_NAME
|
||||
):
|
||||
warnings.append("Sand surface index must identify the sand surface.")
|
||||
if sand_material == null:
|
||||
warnings.append("Assign the starter-island sand material.")
|
||||
if sand_material == null:
|
||||
warnings.append("Assign the starter-island sand material.")
|
||||
if sandstone_surface_index >= visual_mesh.mesh.get_surface_count():
|
||||
warnings.append(
|
||||
"Sandstone surface index is outside the terrain mesh."
|
||||
)
|
||||
elif (
|
||||
visual_mesh.mesh.surface_get_name(sandstone_surface_index)
|
||||
!= SANDSTONE_SURFACE_NAME
|
||||
):
|
||||
warnings.append(
|
||||
"Sandstone surface index must identify the sandstone surface."
|
||||
)
|
||||
if sandstone_material == null:
|
||||
warnings.append("Assign the starter-island sandstone material.")
|
||||
if get_node_or_null(terrain_collision_shape_path) == null:
|
||||
warnings.append("Terrain/Collision must provide a collision shape.")
|
||||
if get_node_or_null(terrain_visual_root_path) == null:
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
[ext_resource type="Material" path="res://world/materials/starter_island_grass.tres" id="9_grass"]
|
||||
[ext_resource type="Script" uid="uid://dtcgnxl1kmdu1" path="res://world/water_body_authoring.gd" id="10_water_body"]
|
||||
[ext_resource type="Material" path="res://world/materials/starter_island_sand.tres" id="11_sand"]
|
||||
[ext_resource type="Material" path="res://world/materials/starter_island_sandstone.tres" id="20_sandstone"]
|
||||
[ext_resource type="Material" path="res://world/materials/stylized_water.tres" id="13_water"]
|
||||
[ext_resource type="Script" path="res://world/water/shoreline_ribbon_baker.gd" id="14_shoreline_baker"]
|
||||
[ext_resource type="Script" path="res://world/water/shoreline_ribbon_config.gd" id="15_shoreline_config"]
|
||||
|
|
@ -91,8 +92,12 @@ output_resource_path = "res://world/generated/shorelines/starter_ocean_shoreline
|
|||
|
||||
[node name="StarterIslandRegion" type="Node3D" unique_id=1830415700]
|
||||
script = ExtResource("1_region")
|
||||
apply_surface_overrides = true
|
||||
grass_material = ExtResource("9_grass")
|
||||
sand_surface_index = 4
|
||||
sand_material = ExtResource("11_sand")
|
||||
sandstone_material = ExtResource("20_sandstone")
|
||||
sandstone_surface_index = 5
|
||||
region_id = &"starter_island"
|
||||
fishable_water_root = NodePath("WaterBodies")
|
||||
water_recovery_root = NodePath("WaterBodies")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue