Skip to content

Commit

Permalink
Add NavigationDemo, tweak other demos; Add *.res to git-lfs
Browse files Browse the repository at this point in the history
  • Loading branch information
TokisanGames committed Dec 1, 2023
1 parent 7cc07cb commit b53fb70
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf
*.res filter=lfs diff=lfs merge=lfs -text
1 change: 1 addition & 0 deletions project/demo/CodeGenerated.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ player = NodePath("../Player")
[node name="RunThisSceneLabel3D" type="Label3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 100, 30)
pixel_size = 1.0
billboard = 1
text = "Run This Scene"
27 changes: 22 additions & 5 deletions project/demo/Demo.tscn
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
[gd_scene load_steps=14 format=3]
[gd_scene load_steps=17 format=3 uid="uid://dyt8c2xqmddo2"]

[ext_resource type="Script" path="res://demo/src/DemoScene.gd" id="1_k7qca"]
[ext_resource type="PackedScene" path="res://demo/components/World.tscn" id="2_2yeq8"]
[ext_resource type="PackedScene" uid="uid://bb2lp50sjndus" path="res://demo/components/World.tscn" id="2_2yeq8"]
[ext_resource type="PackedScene" path="res://demo/components/Borders.tscn" id="3_cw38j"]
[ext_resource type="PackedScene" path="res://demo/components/Player.tscn" id="3_ht63y"]
[ext_resource type="PackedScene" path="res://demo/components/UI.tscn" id="4_gk532"]
[ext_resource type="Terrain3DStorage" path="res://demo/data/terrain_storage.res" id="5_sl43a"]
[ext_resource type="Terrain3DStorage" uid="uid://lalq1xnmbjdl" path="res://demo/data/terrain_storage.res" id="5_sl43a"]
[ext_resource type="Texture2D" path="res://demo/textures/ground037_alb_ht.dds" id="7_hqga3"]
[ext_resource type="Texture2D" path="res://demo/textures/ground037_nrm_rgh.dds" id="8_pd4vo"]
[ext_resource type="Texture2D" path="res://demo/textures/rock028_alb_ht.dds" id="9_rm006"]
[ext_resource type="Texture2D" path="res://demo/textures/rock028_nrm_rgh.dds" id="10_i3tb8"]

[sub_resource type="FastNoiseLite" id="FastNoiseLite_20lj2"]
noise_type = 0

[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_rl0jm"]
generate_mipmaps = false
seamless = true
noise = SubResource("FastNoiseLite_20lj2")

[sub_resource type="Terrain3DMaterial" id="Terrain3DMaterial_dljqs"]
_shader_parameters = {
"blend_sharpness": 0.87,
"height_blending": true,
"noise_scale": 0.1,
"noise_texture": SubResource("NoiseTexture2D_rl0jm")
}

[sub_resource type="Terrain3DTexture" id="Terrain3DTexture_56fwf"]
name = "Grass"
albedo_color = Color(0.784314, 0.8, 0.776471, 1)
Expand All @@ -30,6 +46,8 @@ textures = Array[Terrain3DTexture]([SubResource("Terrain3DTexture_56fwf"), SubRe
[node name="Demo" type="Node"]
script = ExtResource("1_k7qca")

[node name="UI" parent="." instance=ExtResource("4_gk532")]

[node name="World" parent="." instance=ExtResource("2_2yeq8")]

[node name="Borders" parent="." instance=ExtResource("3_cw38j")]
Expand All @@ -38,9 +56,8 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 512, 0, 512)
[node name="Player" parent="." instance=ExtResource("3_ht63y")]
transform = Transform3D(0.0774673, 0, -0.996995, 0, 1, 0, 0.996995, 0, 0.0774673, 253.094, 115.487, -1838.16)

[node name="UI" parent="." instance=ExtResource("4_gk532")]

[node name="Terrain3D" type="Terrain3D" parent="."]
storage = ExtResource("5_sl43a")
material = SubResource("Terrain3DMaterial_dljqs")
texture_list = SubResource("Terrain3DTextureList_6biym")
collision_mask = 3
72 changes: 72 additions & 0 deletions project/demo/NavigationDemo.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
[gd_scene load_steps=19 format=3 uid="uid://x34e4v60vdmy"]

[ext_resource type="Script" path="res://demo/src/DemoScene.gd" id="1_po4vw"]
[ext_resource type="PackedScene" uid="uid://bb2lp50sjndus" path="res://demo/components/World.tscn" id="2_i74wg"]
[ext_resource type="PackedScene" path="res://demo/components/Borders.tscn" id="3_3upu0"]
[ext_resource type="PackedScene" path="res://demo/components/Player.tscn" id="4_fk3ul"]
[ext_resource type="PackedScene" path="res://demo/components/UI.tscn" id="5_rc7e2"]
[ext_resource type="Terrain3DStorage" uid="uid://lalq1xnmbjdl" path="res://demo/data/terrain_storage.res" id="7_d7eri"]
[ext_resource type="NavigationMesh" uid="uid://yf3fu23666k8" path="res://demo/data/navmesh.res" id="7_jmtvv"]
[ext_resource type="Texture2D" path="res://demo/textures/ground037_alb_ht.dds" id="8_qnmu8"]
[ext_resource type="Texture2D" path="res://demo/textures/ground037_nrm_rgh.dds" id="9_glb8t"]
[ext_resource type="Texture2D" path="res://demo/textures/rock028_alb_ht.dds" id="10_cggtx"]
[ext_resource type="Texture2D" path="res://demo/textures/rock028_nrm_rgh.dds" id="11_irxj1"]
[ext_resource type="PackedScene" uid="uid://di5fovhcyd7re" path="res://demo/components/Enemy.tscn" id="12_b2xl8"]

[sub_resource type="FastNoiseLite" id="FastNoiseLite_i4tyq"]
noise_type = 0

[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_8x4ho"]
generate_mipmaps = false
seamless = true
noise = SubResource("FastNoiseLite_i4tyq")

[sub_resource type="Terrain3DMaterial" id="Terrain3DMaterial_5dxhb"]
_shader_parameters = {
"blend_sharpness": 0.87,
"height_blending": true,
"noise_scale": 0.1,
"noise_texture": SubResource("NoiseTexture2D_8x4ho")
}

[sub_resource type="Terrain3DTexture" id="Terrain3DTexture_56fwf"]
name = "Grass"
albedo_color = Color(0.784314, 0.8, 0.776471, 1)
albedo_texture = ExtResource("8_qnmu8")
normal_texture = ExtResource("9_glb8t")

[sub_resource type="Terrain3DTexture" id="Terrain3DTexture_x74kb"]
name = "Rock"
texture_id = 1
albedo_color = Color(0.815686, 0.815686, 0.815686, 1)
albedo_texture = ExtResource("10_cggtx")
normal_texture = ExtResource("11_irxj1")

[sub_resource type="Terrain3DTextureList" id="Terrain3DTextureList_6biym"]
textures = Array[Terrain3DTexture]([SubResource("Terrain3DTexture_56fwf"), SubResource("Terrain3DTexture_x74kb")])

[node name="Demo" type="Node"]
script = ExtResource("1_po4vw")

[node name="UI" parent="." instance=ExtResource("5_rc7e2")]

[node name="World" parent="." instance=ExtResource("2_i74wg")]

[node name="Borders" parent="." instance=ExtResource("3_3upu0")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 512, 0, 512)

[node name="Player" parent="." instance=ExtResource("4_fk3ul")]
transform = Transform3D(0.0774673, 0, -0.996995, 0, 1, 0, 0.996995, 0, 0.0774673, 253.094, 115.487, -1838.16)

[node name="Enemy" parent="." node_paths=PackedStringArray("target") instance=ExtResource("12_b2xl8")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 192.727, 105.171, -1787.81)
target = NodePath("../Player")

[node name="NavigationRegion3D" type="NavigationRegion3D" parent="."]
navigation_mesh = ExtResource("7_jmtvv")

[node name="Terrain3D" type="Terrain3D" parent="NavigationRegion3D"]
storage = ExtResource("7_d7eri")
material = SubResource("Terrain3DMaterial_5dxhb")
texture_list = SubResource("Terrain3DTextureList_6biym")
collision_mask = 3
3 changes: 3 additions & 0 deletions project/demo/data/navmesh.res
Git LFS file not shown
Binary file modified project/demo/data/terrain_storage.res
Binary file not shown.
2 changes: 1 addition & 1 deletion project/demo/src/CodeGenerated.gd
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func _ready():
var img: Image = Image.create(2048, 2048, false, Image.FORMAT_RF)
for x in 2048:
for y in 2048:
img.set_pixel(x, y, Color(noise.get_noise_2d(x, y), 0., 0., 1.))
img.set_pixel(x, y, Color(noise.get_noise_2d(x, y)*0.5, 0., 0., 1.))
terrain.storage.import_images([img, null, null], Vector3(-1024, 0, -1024), 0.0, 300.0)

# Enable collision. Enable the first if you wish to see it with Debug/Visible Collision Shapes
Expand Down
2 changes: 1 addition & 1 deletion project/demo/src/Player.gd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
extends CharacterBody3D

@export var MOVE_SPEED: float = 100.0
@export var MOVE_SPEED: float = 50.0
@export var JUMP_SPEED: float = 2.0
@export var first_person: bool = false :
set(p_value):
Expand Down

0 comments on commit b53fb70

Please sign in to comment.