commit 252d52c86fd8a62bc506d4e3eb24256ee122c49e Author: trashbyte Date: Sun Aug 20 18:43:22 2023 -0700 it spin diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8ad74f7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Normalize EOL for all files that Git considers text files. +* text=auto eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..44153f6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +# Godot 4+ specific ignores +.godot/ + +.vs/ \ No newline at end of file diff --git a/Planetside/Environment/Floor.blend1 b/Planetside/Environment/Floor.blend1 new file mode 100644 index 0000000..3abdaad Binary files /dev/null and b/Planetside/Environment/Floor.blend1 differ diff --git a/Planetside/Environment/M_TestGrid.tres b/Planetside/Environment/M_TestGrid.tres new file mode 100644 index 0000000..84815bb --- /dev/null +++ b/Planetside/Environment/M_TestGrid.tres @@ -0,0 +1,6 @@ +[gd_resource type="StandardMaterial3D" load_steps=2 format=3 uid="uid://bts702ltutin6"] + +[ext_resource type="Texture2D" uid="uid://cywlxpcb22pgp" path="res://Environment/T_TestGrid.png" id="1_uabna"] + +[resource] +albedo_texture = ExtResource("1_uabna") diff --git a/Planetside/Environment/S_TestGrid.gdshader b/Planetside/Environment/S_TestGrid.gdshader new file mode 100644 index 0000000..6a42e01 --- /dev/null +++ b/Planetside/Environment/S_TestGrid.gdshader @@ -0,0 +1,17 @@ +shader_type spatial; +render_mode skip_vertex_transform; + +varying vec3 world_pos; + +uniform sampler2D albedo : source_color,filter_nearest_mipmap_anisotropic; + +void vertex() { + world_pos = (MODEL_MATRIX * vec4(VERTEX, 1.0)).xyz; + + VERTEX = (MODELVIEW_MATRIX * vec4(VERTEX, 1.0)).xyz; + NORMAL = normalize((MODELVIEW_MATRIX * vec4(NORMAL, 0.0)).xyz); +} + +void fragment() { + ALBEDO = texture(albedo, world_pos.xz).xyz; +} diff --git a/Planetside/Environment/T_TestGrid.png b/Planetside/Environment/T_TestGrid.png new file mode 100644 index 0000000..74d5ca2 Binary files /dev/null and b/Planetside/Environment/T_TestGrid.png differ diff --git a/Planetside/Environment/T_TestGrid.png.import b/Planetside/Environment/T_TestGrid.png.import new file mode 100644 index 0000000..875aef3 --- /dev/null +++ b/Planetside/Environment/T_TestGrid.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cywlxpcb22pgp" +path="res://.godot/imported/T_TestGrid.png-ebd533d215a8ac8ec541cf0294a0054c.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Planetside/Environment/T_TestGrid.png" +dest_files=["res://.godot/imported/T_TestGrid.png-ebd533d215a8ac8ec541cf0294a0054c.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/Planetside/PlanetTest.tscn b/Planetside/PlanetTest.tscn new file mode 100644 index 0000000..70a1fe8 --- /dev/null +++ b/Planetside/PlanetTest.tscn @@ -0,0 +1,12 @@ +[gd_scene load_steps=3 format=3 uid="uid://88bfgalc6tw1"] + +[ext_resource type="Material" uid="uid://bx3q1wj2uqb4i" path="res://Environment/M_TestGrid.tres" id="1_hbgop"] + +[sub_resource type="PlaneMesh" id="PlaneMesh_1shdn"] + +[node name="Node3D" type="Node3D"] + +[node name="MeshInstance3D" type="MeshInstance3D" parent="."] +transform = Transform3D(50, 0, 0, 0, 50, 0, 0, 0, 50, 0, 0, 0) +mesh = SubResource("PlaneMesh_1shdn") +surface_material_override/0 = ExtResource("1_hbgop") diff --git a/Spaceflight/Environment/SM_SpaceSkybox.blend b/Spaceflight/Environment/SM_SpaceSkybox.blend new file mode 100644 index 0000000..0a7a6be Binary files /dev/null and b/Spaceflight/Environment/SM_SpaceSkybox.blend differ diff --git a/Spaceflight/Environment/SM_SpaceSkybox.blend.import b/Spaceflight/Environment/SM_SpaceSkybox.blend.import new file mode 100644 index 0000000..abb00be --- /dev/null +++ b/Spaceflight/Environment/SM_SpaceSkybox.blend.import @@ -0,0 +1,48 @@ +[remap] + +importer="scene" +importer_version=1 +type="PackedScene" +uid="uid://bgqhmlshc8pu" +path="res://.godot/imported/SM_SpaceSkybox.blend-8cda7be617369dd216b30ba0cefd9362.scn" + +[deps] + +source_file="res://Spaceflight/Environment/SM_SpaceSkybox.blend" +dest_files=["res://.godot/imported/SM_SpaceSkybox.blend-8cda7be617369dd216b30ba0cefd9362.scn"] + +[params] + +nodes/root_type="Node3D" +nodes/root_name="Scene Root" +nodes/apply_root_scale=true +nodes/root_scale=1.0 +meshes/ensure_tangents=true +meshes/generate_lods=true +meshes/create_shadow_meshes=true +meshes/light_baking=1 +meshes/lightmap_texel_size=0.2 +skins/use_named_skins=true +animation/import=true +animation/fps=30 +animation/trimming=false +animation/remove_immutable_tracks=true +import_script/path="" +_subresources={} +gltf/embedded_image_handling=1 +blender/nodes/visible=0 +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/Spaceflight/Environment/SM_SpaceSkybox.blend1 b/Spaceflight/Environment/SM_SpaceSkybox.blend1 new file mode 100644 index 0000000..51355c9 Binary files /dev/null and b/Spaceflight/Environment/SM_SpaceSkybox.blend1 differ diff --git a/Spaceflight/Environment/T_StarsTemp.png b/Spaceflight/Environment/T_StarsTemp.png new file mode 100644 index 0000000..315cdd8 Binary files /dev/null and b/Spaceflight/Environment/T_StarsTemp.png differ diff --git a/Spaceflight/Environment/T_StarsTemp.png.import b/Spaceflight/Environment/T_StarsTemp.png.import new file mode 100644 index 0000000..7cb011e --- /dev/null +++ b/Spaceflight/Environment/T_StarsTemp.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b4yiqwschhsb7" +path.s3tc="res://.godot/imported/T_StarsTemp.png-c796aeeb6d0259f4c571d9a727a7ddbb.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://Spaceflight/Environment/T_StarsTemp.png" +dest_files=["res://.godot/imported/T_StarsTemp.png-c796aeeb6d0259f4c571d9a727a7ddbb.s3tc.ctex"] + +[params] + +compress/mode=2 +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/Spaceflight/Prefabs/SpacePlayer.tscn b/Spaceflight/Prefabs/SpacePlayer.tscn new file mode 100644 index 0000000..c9e412e --- /dev/null +++ b/Spaceflight/Prefabs/SpacePlayer.tscn @@ -0,0 +1,8 @@ +[gd_scene load_steps=2 format=3 uid="uid://mffl7glgme2h"] + +[ext_resource type="Script" path="res://Spaceflight/Scripts/FlightController.cs" id="1_t3b02"] + +[node name="SpacePlayer" type="Node3D"] +script = ExtResource("1_t3b02") + +[node name="MainCamera" type="Camera3D" parent="."] diff --git a/Spaceflight/Scripts/FlightController.cs b/Spaceflight/Scripts/FlightController.cs new file mode 100644 index 0000000..b24e1f3 --- /dev/null +++ b/Spaceflight/Scripts/FlightController.cs @@ -0,0 +1,52 @@ +using Godot; +using System; + +public partial class FlightController : Node3D { + Camera3D PlayerCam; + Vector3 AngularVelocity; + + + public override void _Ready() { + this.PlayerCam = this.GetNode("MainCamera"); + this.PlayerCam.Current = true; + Input.MouseMode = Input.MouseModeEnum.Hidden; + } + + + public override void _Process(double deltaSeconds) { + Vector2 currentMousePos = GetViewport().GetMousePosition(); + Vector2I center = GetViewport().GetWindow().Size / 2; + Vector2 centerFloat = new(center.X, center.Y); + Vector2 delta = (currentMousePos - centerFloat) * (float)deltaSeconds; + Input.WarpMouse(center); + + if (delta != Vector2.Zero) { + Quaternion quat = new Quaternion(this.GlobalTransform.Basis); + Vector3 LocalAccel = new Vector3(delta.Y, delta.X, 0f) * 3f * (float)deltaSeconds; + if (quat.GetAxis().LengthSquared() != 0f) { + this.AngularVelocity -= LocalAccel.Rotated(quat.GetAxis().Normalized(), quat.GetAngle()); + } + else { + this.AngularVelocity -= LocalAccel; + } + } + this.AngularVelocity *= (float)(1.0 - deltaSeconds * 2.0); + if (this.AngularVelocity.Length() > 0f) { + Quaternion rotationThisFrame = Quaternion.FromEuler(this.AngularVelocity * (float)deltaSeconds); + if (rotationThisFrame.GetAxis().Normalized().LengthSquared() != 0f) { + this.GlobalRotate(rotationThisFrame.GetAxis().Normalized(), rotationThisFrame.GetAngle()); + } + } + } + + + public override void _Input(InputEvent @event) { + base._Input(@event); + if (@event is InputEventKey keyEvent) { + if (keyEvent.Keycode == Key.Escape) { + GetTree().Root.PropagateNotification((int)NotificationWMCloseRequest); + GetTree().Quit(); + } + } + } +} diff --git a/Spaceflight/SpaceTest.tscn b/Spaceflight/SpaceTest.tscn new file mode 100644 index 0000000..dbe67af --- /dev/null +++ b/Spaceflight/SpaceTest.tscn @@ -0,0 +1,16 @@ +[gd_scene load_steps=4 format=3 uid="uid://681x341bmq7u"] + +[ext_resource type="PackedScene" uid="uid://mffl7glgme2h" path="res://Spaceflight/Prefabs/SpacePlayer.tscn" id="1_cwxy4"] +[ext_resource type="PackedScene" uid="uid://bgqhmlshc8pu" path="res://Spaceflight/Environment/SM_SpaceSkybox.blend" id="2_3sifq"] + +[sub_resource type="Environment" id="Environment_owpo5"] + +[node name="SpaceTest" type="Node3D"] + +[node name="SpacePlayer" parent="." instance=ExtResource("1_cwxy4")] + +[node name="WorldEnvironment" type="WorldEnvironment" parent="."] +environment = SubResource("Environment_owpo5") + +[node name="SM_SpaceSkybox" parent="." instance=ExtResource("2_3sifq")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.221079, 0, 0.640379) diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..2393c25 --- /dev/null +++ b/project.godot @@ -0,0 +1,19 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=5 + +[application] + +config/name="spes" +run/main_scene="res://Spaceflight/SpaceTest.tscn" +config/features=PackedStringArray("4.1", "C#", "Forward Plus") + +[dotnet] + +project/assembly_name="spes" diff --git a/spes.csproj b/spes.csproj new file mode 100644 index 0000000..8ee8c44 --- /dev/null +++ b/spes.csproj @@ -0,0 +1,6 @@ + + + net6.0 + true + + \ No newline at end of file diff --git a/spes.sln b/spes.sln new file mode 100644 index 0000000..4fbc3b6 --- /dev/null +++ b/spes.sln @@ -0,0 +1,19 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "spes", "spes.csproj", "{AFC9987A-26DA-4E87-8A0F-9D4086123DFB}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + ExportDebug|Any CPU = ExportDebug|Any CPU + ExportRelease|Any CPU = ExportRelease|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AFC9987A-26DA-4E87-8A0F-9D4086123DFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AFC9987A-26DA-4E87-8A0F-9D4086123DFB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AFC9987A-26DA-4E87-8A0F-9D4086123DFB}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU + {AFC9987A-26DA-4E87-8A0F-9D4086123DFB}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU + {AFC9987A-26DA-4E87-8A0F-9D4086123DFB}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU + {AFC9987A-26DA-4E87-8A0F-9D4086123DFB}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU + EndGlobalSection +EndGlobal