Apply sand texture to starter island
This commit is contained in:
parent
9e473656b6
commit
b9bc1ca39f
5 changed files with 94 additions and 0 deletions
BIN
art/exported/environment/textures/sand.png
Normal file
BIN
art/exported/environment/textures/sand.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.1 KiB |
41
art/exported/environment/textures/sand.png.import
Normal file
41
art/exported/environment/textures/sand.png.import
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bnje415gq85nn"
|
||||||
|
path.s3tc="res://.godot/imported/sand.png-41fc96c392119deeba43c2d4e49d88a5.s3tc.ctex"
|
||||||
|
metadata={
|
||||||
|
"imported_formats": ["s3tc_bptc"],
|
||||||
|
"vram_texture": true
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://art/exported/environment/textures/sand.png"
|
||||||
|
dest_files=["res://.godot/imported/sand.png-41fc96c392119deeba43c2d4e49d88a5.s3tc.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=2
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
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/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
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
|
||||||
10
world/materials/starter_island_sand.tres
Normal file
10
world/materials/starter_island_sand.tres
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
[gd_resource type="StandardMaterial3D" load_steps=2 format=3]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" path="res://art/exported/environment/textures/sand.png" id="1_texture"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
resource_name = "Starter Island Sand"
|
||||||
|
texture_filter = 4
|
||||||
|
albedo_texture = ExtResource("1_texture")
|
||||||
|
roughness = 1.0
|
||||||
|
uv1_scale = Vector3(21.406, 21.406, 21.406)
|
||||||
|
|
@ -6,6 +6,7 @@ const FishingShopInteractionType = preload(
|
||||||
"res://world/fishing_shop_interaction.gd"
|
"res://world/fishing_shop_interaction.gd"
|
||||||
)
|
)
|
||||||
const GRASS_SURFACE_NAME: String = "grass_lite"
|
const GRASS_SURFACE_NAME: String = "grass_lite"
|
||||||
|
const SAND_SURFACE_NAME: String = "sand"
|
||||||
|
|
||||||
@export_group("Owned Nodes")
|
@export_group("Owned Nodes")
|
||||||
@export_node_path("MeshInstance3D")
|
@export_node_path("MeshInstance3D")
|
||||||
|
|
@ -31,9 +32,14 @@ var pelican_landmark_path: NodePath = (
|
||||||
@export var grass_material: Material
|
@export var grass_material: Material
|
||||||
@export_range(0, 16, 1) var grass_surface_index: int = 0
|
@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
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
_apply_grass_material()
|
_apply_grass_material()
|
||||||
|
_apply_sand_material()
|
||||||
_build_terrain_collision()
|
_build_terrain_collision()
|
||||||
if Engine.is_editor_hint():
|
if Engine.is_editor_hint():
|
||||||
update_configuration_warnings()
|
update_configuration_warnings()
|
||||||
|
|
@ -84,6 +90,31 @@ func _apply_grass_material() -> void:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
func _apply_sand_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 sand_material == null:
|
||||||
|
push_error("Starter island sand material is unavailable.")
|
||||||
|
return
|
||||||
|
if sand_surface_index >= visual_mesh.mesh.get_surface_count():
|
||||||
|
push_error("Starter island sand surface index is invalid.")
|
||||||
|
return
|
||||||
|
if (
|
||||||
|
visual_mesh.mesh.surface_get_name(sand_surface_index)
|
||||||
|
!= SAND_SURFACE_NAME
|
||||||
|
):
|
||||||
|
push_error("Starter island sand surface name does not match.")
|
||||||
|
return
|
||||||
|
visual_mesh.set_surface_override_material(
|
||||||
|
sand_surface_index,
|
||||||
|
sand_material
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
func _build_terrain_collision() -> void:
|
func _build_terrain_collision() -> void:
|
||||||
var visual_mesh: MeshInstance3D = (
|
var visual_mesh: MeshInstance3D = (
|
||||||
get_node_or_null(visual_mesh_path) as MeshInstance3D
|
get_node_or_null(visual_mesh_path) as MeshInstance3D
|
||||||
|
|
@ -120,6 +151,16 @@ func _get_configuration_warnings() -> PackedStringArray:
|
||||||
warnings.append("Grass surface index must identify the grass surface.")
|
warnings.append("Grass surface index must identify the grass surface.")
|
||||||
if grass_material == null:
|
if grass_material == null:
|
||||||
warnings.append("Assign the starter-island grass material.")
|
warnings.append("Assign the starter-island grass material.")
|
||||||
|
if visual_mesh != null and visual_mesh.mesh != null:
|
||||||
|
if sand_surface_index >= visual_mesh.mesh.get_surface_count():
|
||||||
|
warnings.append("Sand surface index is outside the terrain mesh.")
|
||||||
|
elif (
|
||||||
|
visual_mesh.mesh.surface_get_name(sand_surface_index)
|
||||||
|
!= 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 get_node_or_null(terrain_collision_shape_path) == null:
|
if get_node_or_null(terrain_collision_shape_path) == null:
|
||||||
warnings.append("Terrain/Collision must provide a collision shape.")
|
warnings.append("Terrain/Collision must provide a collision shape.")
|
||||||
if get_node_or_null(player_spawn_path) == null:
|
if get_node_or_null(player_spawn_path) == null:
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue