Starting on parts system
This commit is contained in:
BIN
adept/assets/models/car/Textures/colormap.png
Normal file
BIN
adept/assets/models/car/Textures/colormap.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
41
adept/assets/models/car/Textures/colormap.png.import
Normal file
41
adept/assets/models/car/Textures/colormap.png.import
Normal file
@@ -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
|
||||
BIN
adept/assets/models/car/hatchback-sports.glb
Normal file
BIN
adept/assets/models/car/hatchback-sports.glb
Normal file
Binary file not shown.
42
adept/assets/models/car/hatchback-sports.glb.import
Normal file
42
adept/assets/models/car/hatchback-sports.glb.import
Normal file
@@ -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
|
||||
@@ -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"
|
||||
|
||||
|
||||
31
adept/scenes/main.tscn
Normal file
31
adept/scenes/main.tscn
Normal file
@@ -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)
|
||||
@@ -1,11 +1,26 @@
|
||||
using ADEPT.PartsSystem;
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
namespace ADEPT;
|
||||
|
||||
public sealed class ADEPT
|
||||
{
|
||||
private ADEPT() {}
|
||||
private static readonly Lazy<ADEPT> _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()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
18
adept/src/scripts/ADEPTError.cs
Normal file
18
adept/src/scripts/ADEPTError.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
|
||||
namespace ADEPT;
|
||||
|
||||
public sealed class ADEPTError<T>
|
||||
{
|
||||
|
||||
private T _value;
|
||||
public T Value => _value;
|
||||
|
||||
private string _message = "";
|
||||
public string Message => _message;
|
||||
|
||||
public ADEPTError(T data, string message = "")
|
||||
{
|
||||
_message = message;
|
||||
}
|
||||
}
|
||||
1
adept/src/scripts/ADEPTError.cs.uid
Normal file
1
adept/src/scripts/ADEPTError.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://ddxtkgnkxsbc
|
||||
23
adept/src/scripts/Main.cs
Normal file
23
adept/src/scripts/Main.cs
Normal file
@@ -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)
|
||||
{
|
||||
}
|
||||
}
|
||||
1
adept/src/scripts/Main.cs.uid
Normal file
1
adept/src/scripts/Main.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://4u2ome238wbq
|
||||
10
adept/src/scripts/PartsSystem/Part.cs
Normal file
10
adept/src/scripts/PartsSystem/Part.cs
Normal file
@@ -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;
|
||||
}
|
||||
1
adept/src/scripts/PartsSystem/Part.cs.uid
Normal file
1
adept/src/scripts/PartsSystem/Part.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://by6wvwbkri2vp
|
||||
57
adept/src/scripts/PartsSystem/PartsList.cs
Normal file
57
adept/src/scripts/PartsSystem/PartsList.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Godot;
|
||||
|
||||
namespace ADEPT.PartsSystem;
|
||||
|
||||
public class PartsList
|
||||
{
|
||||
public Dictionary<string, Part> Parts = new();
|
||||
|
||||
public ADEPTError<bool> 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<bool> 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<Part> 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<bool> 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);
|
||||
}
|
||||
}
|
||||
1
adept/src/scripts/PartsSystem/PartsList.cs.uid
Normal file
1
adept/src/scripts/PartsSystem/PartsList.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bh8vu0obpd62d
|
||||
Reference in New Issue
Block a user