diff --git a/adept/assets/models/car/Textures/colormap.png b/adept/assets/models/car/Textures/colormap.png new file mode 100644 index 0000000..5c4b185 Binary files /dev/null and b/adept/assets/models/car/Textures/colormap.png differ diff --git a/adept/assets/models/car/Textures/colormap.png.import b/adept/assets/models/car/Textures/colormap.png.import new file mode 100644 index 0000000..0eb11fd --- /dev/null +++ b/adept/assets/models/car/Textures/colormap.png.import @@ -0,0 +1,41 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bp8id5rw0n16c" +path.s3tc="res://.godot/imported/colormap.png-9e44d5abfbbe7530ae1b965897f095de.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://assets/models/car/Textures/colormap.png" +dest_files=["res://.godot/imported/colormap.png-9e44d5abfbbe7530ae1b965897f095de.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 diff --git a/adept/assets/models/car/hatchback-sports.glb b/adept/assets/models/car/hatchback-sports.glb new file mode 100644 index 0000000..964c4db Binary files /dev/null and b/adept/assets/models/car/hatchback-sports.glb differ diff --git a/adept/assets/models/car/hatchback-sports.glb.import b/adept/assets/models/car/hatchback-sports.glb.import new file mode 100644 index 0000000..fa2f0ec --- /dev/null +++ b/adept/assets/models/car/hatchback-sports.glb.import @@ -0,0 +1,42 @@ +[remap] + +importer="scene" +importer_version=1 +type="PackedScene" +uid="uid://d1kk88npp13co" +path="res://.godot/imported/hatchback-sports.glb-fa30709e41da6de76695446908506dc5.scn" + +[deps] + +source_file="res://assets/models/car/hatchback-sports.glb" +dest_files=["res://.godot/imported/hatchback-sports.glb-fa30709e41da6de76695446908506dc5.scn"] + +[params] + +nodes/root_type="" +nodes/root_name="" +nodes/root_script=null +nodes/apply_root_scale=true +nodes/root_scale=1.0 +nodes/import_as_skeleton_bones=false +nodes/use_name_suffixes=true +nodes/use_node_type_suffixes=true +meshes/ensure_tangents=true +meshes/generate_lods=true +meshes/create_shadow_meshes=true +meshes/light_baking=1 +meshes/lightmap_texel_size=0.2 +meshes/force_disable_compression=false +skins/use_named_skins=true +animation/import=true +animation/fps=30 +animation/trimming=false +animation/remove_immutable_tracks=true +animation/import_rest_as_RESET=false +import_script/path="" +materials/extract=0 +materials/extract_format=0 +materials/extract_path="" +_subresources={} +gltf/naming_version=2 +gltf/embedded_image_handling=1 diff --git a/adept/project.godot b/adept/project.godot index d7b02a0..90c6008 100644 --- a/adept/project.godot +++ b/adept/project.godot @@ -11,6 +11,7 @@ config_version=5 [application] config/name="ADEPT" +run/main_scene="uid://cpqovsoo4n8xu" config/features=PackedStringArray("4.6", "C#", "GL Compatibility") config/icon="res://icon.svg" diff --git a/adept/scenes/main.tscn b/adept/scenes/main.tscn new file mode 100644 index 0000000..46ee5e6 --- /dev/null +++ b/adept/scenes/main.tscn @@ -0,0 +1,31 @@ +[gd_scene format=3 uid="uid://cpqovsoo4n8xu"] + +[ext_resource type="Script" uid="uid://4u2ome238wbq" path="res://src/scripts/Main.cs" id="1_o5qli"] +[ext_resource type="PackedScene" uid="uid://d1kk88npp13co" path="res://assets/models/car/hatchback-sports.glb" id="2_0wfyh"] + +[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_0wfyh"] +sky_horizon_color = Color(0.66224277, 0.6717428, 0.6867428, 1) +ground_horizon_color = Color(0.66224277, 0.6717428, 0.6867428, 1) + +[sub_resource type="Sky" id="Sky_sugp2"] +sky_material = SubResource("ProceduralSkyMaterial_0wfyh") + +[sub_resource type="Environment" id="Environment_jyhfs"] +background_mode = 2 +sky = SubResource("Sky_sugp2") +tonemap_mode = 2 + +[node name="Main" type="Node3D" unique_id=1905788834] +script = ExtResource("1_o5qli") + +[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=145682166] +environment = SubResource("Environment_jyhfs") + +[node name="DirectionalLight3D" type="DirectionalLight3D" parent="." unique_id=415894162] +transform = Transform3D(-0.8660254, -0.43301278, 0.25, 0, 0.49999997, 0.86602545, -0.50000006, 0.75, -0.43301266, 0, 0, 0) +shadow_enabled = true + +[node name="hatchback-sports" parent="." unique_id=602574537 instance=ExtResource("2_0wfyh")] + +[node name="Camera3D" type="Camera3D" parent="." unique_id=130456096] +transform = Transform3D(1, 0, 0, 0, 0.8660254, 0.5, 0, -0.5, 0.8660254, 0, 1.5814024, 2.4225156) diff --git a/adept/src/scripts/ADEPT.cs b/adept/src/scripts/ADEPT.cs index 2b1f9ef..fc1db57 100644 --- a/adept/src/scripts/ADEPT.cs +++ b/adept/src/scripts/ADEPT.cs @@ -1,11 +1,26 @@ +using ADEPT.PartsSystem; using Godot; using System; +namespace ADEPT; + public sealed class ADEPT { - private ADEPT() {} private static readonly Lazy _instance = new(() => new ADEPT()); public static ADEPT Instance => _instance.Value; - + private PartsList _partsList = new(); + public PartsList PartsList => _partsList; + + private Node _mainNode; + public Node Main + { + get { return _mainNode; } + set { _mainNode ??= value; } + } + + private ADEPT() + { + + } } diff --git a/adept/src/scripts/ADEPTError.cs b/adept/src/scripts/ADEPTError.cs new file mode 100644 index 0000000..2fb145c --- /dev/null +++ b/adept/src/scripts/ADEPTError.cs @@ -0,0 +1,18 @@ +using System; + +namespace ADEPT; + +public sealed class ADEPTError +{ + + private T _value; + public T Value => _value; + + private string _message = ""; + public string Message => _message; + + public ADEPTError(T data, string message = "") + { + _message = message; + } +} \ No newline at end of file diff --git a/adept/src/scripts/ADEPTError.cs.uid b/adept/src/scripts/ADEPTError.cs.uid new file mode 100644 index 0000000..3289fac --- /dev/null +++ b/adept/src/scripts/ADEPTError.cs.uid @@ -0,0 +1 @@ +uid://ddxtkgnkxsbc diff --git a/adept/src/scripts/Main.cs b/adept/src/scripts/Main.cs new file mode 100644 index 0000000..fccd54c --- /dev/null +++ b/adept/src/scripts/Main.cs @@ -0,0 +1,23 @@ +using Godot; +using System; + +namespace ADEPT; + +public partial class Main : Node +{ + public override void _Ready() + { + ADEPT.Instance.Main = this; + ADEPT.Instance.PartsList.GeneratePartsList(this); + + foreach (var thing in ADEPT.Instance.PartsList.Parts) + { + GD.Print(thing.Key); + } + } + + + public override void _Process(double delta) + { + } +} diff --git a/adept/src/scripts/Main.cs.uid b/adept/src/scripts/Main.cs.uid new file mode 100644 index 0000000..65bbac3 --- /dev/null +++ b/adept/src/scripts/Main.cs.uid @@ -0,0 +1 @@ +uid://4u2ome238wbq diff --git a/adept/src/scripts/PartsSystem/Part.cs b/adept/src/scripts/PartsSystem/Part.cs new file mode 100644 index 0000000..613ba30 --- /dev/null +++ b/adept/src/scripts/PartsSystem/Part.cs @@ -0,0 +1,10 @@ +using System; +using Godot; + +namespace ADEPT.PartsSystem; + +public class Part(string name, Node node) +{ + public string Name = name; + public Node Node = node; +} \ No newline at end of file diff --git a/adept/src/scripts/PartsSystem/Part.cs.uid b/adept/src/scripts/PartsSystem/Part.cs.uid new file mode 100644 index 0000000..2ed56d5 --- /dev/null +++ b/adept/src/scripts/PartsSystem/Part.cs.uid @@ -0,0 +1 @@ +uid://by6wvwbkri2vp diff --git a/adept/src/scripts/PartsSystem/PartsList.cs b/adept/src/scripts/PartsSystem/PartsList.cs new file mode 100644 index 0000000..d90ac27 --- /dev/null +++ b/adept/src/scripts/PartsSystem/PartsList.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using Godot; + +namespace ADEPT.PartsSystem; + +public class PartsList +{ + public Dictionary Parts = new(); + + public ADEPTError AddPart(Part part) + { + var result = Parts.TryAdd(part.Name, part); + return result ? new(true) : new(false, $"Can't add part: Part with name '{part.Name}' already exists"); + } + + public ADEPTError RemovePart(string partName) + { + var result = Parts.Remove(partName); + return result ? new(true) : new(false, $"Can't delete part: Part with name '{partName}' doesn't exist"); + } + + public ADEPTError GetPart(string partName) + { + if (Parts.TryGetValue(partName, out Part part)) + { + return new(part); + } + + return new(null, $"Could not get part: Part with name '{partName}' does not exist"); + } + + public ADEPTError GeneratePartsList(Node node) +{ + if (node is null) return new(false, "Could not generate parts list, the input node was NULL"); + + foreach (Node child in node.GetChildren()) + { + var newPart = new Part(child.Name.ToString().Replace(" ", "_"), child); + var result = AddPart(newPart); + + if (!result.Value) + { + GD.PushError(result.Message); + return result; + } + + var conversionResult = GeneratePartsList(child); + if (!conversionResult.Value) + { + return conversionResult; + } + } + + return new(true); +} +} \ No newline at end of file diff --git a/adept/src/scripts/PartsSystem/PartsList.cs.uid b/adept/src/scripts/PartsSystem/PartsList.cs.uid new file mode 100644 index 0000000..f7aa5b1 --- /dev/null +++ b/adept/src/scripts/PartsSystem/PartsList.cs.uid @@ -0,0 +1 @@ +uid://bh8vu0obpd62d