Skip to content

Commit

Permalink
Update demo & vsproject
Browse files Browse the repository at this point in the history
  • Loading branch information
TokisanGames committed Oct 17, 2023
1 parent 0d7b1b7 commit b422364
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 47 deletions.
10 changes: 10 additions & 0 deletions Terrain3D.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,16 @@
<ClCompile Include="src\util.cpp" />
</ItemGroup>
<ItemGroup>
<None Include=".github\actions\android-deps\action.yml" />
<None Include=".github\actions\base-deps\action.yml" />
<None Include=".github\actions\build-cache\action.yml" />
<None Include=".github\actions\windows-deps\action.yml" />
<None Include=".github\workflows\android.yml" />
<None Include=".github\workflows\build.yml" />
<None Include=".github\workflows\linux.yml" />
<None Include=".github\workflows\macos.yml" />
<None Include=".github\workflows\windows.yml" />
<None Include=".gitignore" />
<None Include="project\addons\terrain_3d\plugin.cfg" />
<None Include="project\addons\terrain_3d\terrain.gdextension" />
<None Include="src\shaders\debug_views.glsl" />
Expand Down
125 changes: 90 additions & 35 deletions Terrain3D.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -1,91 +1,146 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
<Filter Include="2. Shaders">
<UniqueIdentifier>{fa4f3a1c-e2a4-4421-9b19-e15c14fce184}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files">
<Filter Include="3. Headers">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<Filter Include="4. C++">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="1. Project Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\terrain_3d_texture_list.h">
<Filter>Header Files</Filter>
<Filter>3. Headers</Filter>
</ClInclude>
<ClInclude Include="src\geoclipmap.h">
<Filter>Header Files</Filter>
<Filter>3. Headers</Filter>
</ClInclude>
<ClInclude Include="src\register_types.h">
<Filter>Header Files</Filter>
<Filter>3. Headers</Filter>
</ClInclude>
<ClInclude Include="src\terrain_3d.h">
<Filter>Header Files</Filter>
<Filter>3. Headers</Filter>
</ClInclude>
<ClInclude Include="src\terrain_3d_editor.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\terrain_3d_logger.h">
<Filter>Header Files</Filter>
<Filter>3. Headers</Filter>
</ClInclude>
<ClInclude Include="src\terrain_3d_storage.h">
<Filter>Header Files</Filter>
<Filter>3. Headers</Filter>
</ClInclude>
<ClInclude Include="src\terrain_3d_surface.h">
<Filter>Header Files</Filter>
<Filter>3. Headers</Filter>
</ClInclude>
<ClInclude Include="src\terrain_3d_texture.h">
<Filter>Header Files</Filter>
<Filter>3. Headers</Filter>
</ClInclude>
<ClInclude Include="src\terrain_3d_material.h">
<Filter>Header Files</Filter>
<Filter>3. Headers</Filter>
</ClInclude>
<ClInclude Include="src\constants.h">
<Filter>3. Headers</Filter>
</ClInclude>
<ClInclude Include="src\generated_tex.h">
<Filter>3. Headers</Filter>
</ClInclude>
<ClInclude Include="src\generated.h">
<Filter>Header Files</Filter>
<ClInclude Include="src\logger.h">
<Filter>3. Headers</Filter>
</ClInclude>
<ClInclude Include="src\util.h">
<Filter>3. Headers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\geoclipmap.cpp">
<Filter>Source Files</Filter>
<Filter>4. C++</Filter>
</ClCompile>
<ClCompile Include="src\register_types.cpp">
<Filter>Source Files</Filter>
<Filter>4. C++</Filter>
</ClCompile>
<ClCompile Include="src\terrain_3d.cpp">
<Filter>Source Files</Filter>
<Filter>4. C++</Filter>
</ClCompile>
<ClCompile Include="src\terrain_3d_editor.cpp">
<Filter>Source Files</Filter>
<Filter>4. C++</Filter>
</ClCompile>
<ClCompile Include="src\terrain_3d_storage.cpp">
<Filter>Source Files</Filter>
<Filter>4. C++</Filter>
</ClCompile>
<ClCompile Include="src\terrain_3d_surface.cpp">
<Filter>Source Files</Filter>
<Filter>4. C++</Filter>
</ClCompile>
<ClCompile Include="src\terrain_3d_texture.cpp">
<Filter>Source Files</Filter>
<Filter>4. C++</Filter>
</ClCompile>
<ClCompile Include="src\terrain_3d_texture_list.cpp">
<Filter>Source Files</Filter>
<Filter>4. C++</Filter>
</ClCompile>
<ClCompile Include="src\terrain_3d_material.cpp">
<Filter>Source Files</Filter>
<Filter>4. C++</Filter>
</ClCompile>
<ClCompile Include="src\generated_tex.cpp">
<Filter>4. C++</Filter>
</ClCompile>
<ClCompile Include="src\generated.cpp">
<Filter>Source Files</Filter>
<ClCompile Include="src\util.cpp">
<Filter>4. C++</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="src\shaders\world_noise.glsl" />
<None Include="src\shaders\main.glsl" />
<None Include="src\shaders\debug_views.glsl" />
<None Include="project\addons\terrain_3d\plugin.cfg" />
<None Include="project\addons\terrain_3d\terrain.gdextension" />
<None Include=".github\actions\windows-deps\action.yml">
<Filter>1. Project Files</Filter>
</None>
<None Include=".github\actions\build-cache\action.yml">
<Filter>1. Project Files</Filter>
</None>
<None Include=".github\actions\base-deps\action.yml">
<Filter>1. Project Files</Filter>
</None>
<None Include=".github\actions\android-deps\action.yml">
<Filter>1. Project Files</Filter>
</None>
<None Include=".github\workflows\android.yml">
<Filter>1. Project Files</Filter>
</None>
<None Include=".github\workflows\build.yml">
<Filter>1. Project Files</Filter>
</None>
<None Include=".github\workflows\linux.yml">
<Filter>1. Project Files</Filter>
</None>
<None Include=".github\workflows\macos.yml">
<Filter>1. Project Files</Filter>
</None>
<None Include="project\addons\terrain_3d\plugin.cfg">
<Filter>1. Project Files</Filter>
</None>
<None Include=".github\workflows\windows.yml">
<Filter>1. Project Files</Filter>
</None>
<None Include="project\addons\terrain_3d\terrain.gdextension">
<Filter>1. Project Files</Filter>
</None>
<None Include="src\shaders\debug_views.glsl">
<Filter>2. Shaders</Filter>
</None>
<None Include="src\shaders\main.glsl">
<Filter>2. Shaders</Filter>
</None>
<None Include="src\shaders\world_noise.glsl">
<Filter>2. Shaders</Filter>
</None>
<None Include=".gitignore">
<Filter>1. Project Files</Filter>
</None>
<None Include="SConstruct">
<Filter>1. Project Files</Filter>
</None>
</ItemGroup>
</Project>
23 changes: 12 additions & 11 deletions 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 = 20.0
@export var MOVE_SPEED: float = 100.0
@export var JUMP_SPEED: float = 2.0
@export var first_person: bool = false :
set(value):
Expand All @@ -10,7 +10,12 @@ extends CharacterBody3D
else:
$CameraManager/Arm.spring_length = 4.0

@export var gravity_enabled: bool = true
@export var gravity_enabled: bool = true :
set(value):
gravity_enabled = value
if not gravity_enabled:
velocity.y = 0

@export var collision_enabled: bool = true :
set(value):
collision_enabled = value
Expand All @@ -21,10 +26,12 @@ extends CharacterBody3D
func _physics_process(delta) -> void:
var direction: Vector3 = get_camera_relative_input()
var h_veloc: Vector2 = Vector2(direction.x, direction.z) * MOVE_SPEED
if Input.is_action_pressed("sprint"):
h_veloc *= 2
velocity.x = h_veloc.x
velocity.z = h_veloc.y
if gravity_enabled:
velocity.y -= 20 * delta
velocity.y -= 40 * delta
move_and_slide()


Expand All @@ -40,15 +47,9 @@ func get_camera_relative_input() -> Vector3:
if Input.is_action_pressed("backward"):
input_dir += %Camera3D.global_transform.basis.z
if Input.is_action_pressed("up"):
if gravity_enabled:
velocity.y += JUMP_SPEED
else:
velocity.y += MOVE_SPEED*.016
velocity.y += JUMP_SPEED + MOVE_SPEED*.016
if Input.is_action_pressed("down"):
if gravity_enabled:
velocity.y -= JUMP_SPEED
else:
velocity.y -= MOVE_SPEED*.016
velocity.y -= JUMP_SPEED + MOVE_SPEED*.016
if Input.is_key_pressed(KEY_KP_ADD) or Input.is_key_pressed(KEY_EQUAL):
MOVE_SPEED = clamp(MOVE_SPEED + .5, 0, 9999)
if Input.is_key_pressed(KEY_KP_SUBTRACT) or Input.is_key_pressed(KEY_MINUS):
Expand Down
2 changes: 1 addition & 1 deletion project/demo/src/UI.gd
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func _process(delta) -> void:
$Label.text = "FPS: %s\n" % str(Engine.get_frames_per_second())
$Label.text += "Move Speed: %.1f\n" % player.MOVE_SPEED if player else ""
$Label.text += "Position: %.1v\n" % player.global_position if player else ""
$Label.text += "Move: WASDEQ/Mouse\nMove speed: Wheel,+/-\nCamera View: V\n"
$Label.text += "Move: WASDEQ/Shift/Mouse\nMove speed: Wheel,+/-\nCamera View: V\n"
$Label.text += "Gravity toggle: G\nCollision toggle: C\n"
$Label.text += "Full screen: F11\nMouse toggle: Escape\nQuit: F8\n"

Expand Down
5 changes: 5 additions & 0 deletions project/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ down={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":81,"key_label":0,"unicode":113,"echo":false,"script":null)
]
}
sprint={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194325,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}

[layer_names]

Expand Down

0 comments on commit b422364

Please sign in to comment.