Skip to content

Commit

Permalink
Merge pull request #7 from Team-Fennec/feat/engine-tools
Browse files Browse the repository at this point in the history
Feat/engine tools
  • Loading branch information
ashifolfi authored Apr 15, 2024
2 parents 6177328 + 63195c0 commit 34648ce
Show file tree
Hide file tree
Showing 108 changed files with 4,113 additions and 2,149 deletions.
8 changes: 8 additions & 0 deletions Branding/LogoB.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Game/engine/resource/ToolsScheme.res
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@
"SliderGrab" "IcyTrans"
"SliderGrabActive" "Icy"
}
}
}
Binary file added Game/engine/resource/tools/splash_base.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Game/engine/resource/tools/splash_yield.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions Game/engine/shaders/UnlitTextured.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ void main()
{
// joint/weight reference:
// https://github.khronos.org/glTF-Tutorials/gltfTutorial/gltfTutorial_020_Skins.html
/*mat4 skinMat =
mat4 skinMat =
v_Weight.x * Joints[int(v_Joint.x)] +
v_Weight.y * Joints[int(v_Joint.y)] +
v_Weight.z * Joints[int(v_Joint.z)] +
v_Weight.w * Joints[int(v_Joint.w)];

vec4 worldPosition = World * skinMat * vec4(v_Pos, 1);*/
vec4 worldPosition = World * vec4(v_Pos, 1);
vec4 worldPosition = World * skinMat * vec4(v_Pos, 1);
vec4 viewPosition = View * worldPosition;
gl_Position = Projection * viewPosition;
fsin_texCoords = v_Uv;
Expand Down
2 changes: 1 addition & 1 deletion Game/engine/shaders/include/Buffers.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ layout(set = 0, binding = 2) uniform WorldBuffer

layout(set = 0, binding = 3) uniform JointBuffer
{
mat4 Joints;
mat4 Joints[32];
};
6 changes: 4 additions & 2 deletions Game/enginetools.vdf
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"EngineTools"
{
// no tools currently
}
"dll" "console"
"dll" "modeleditor"
"dll" "materialeditor"
}
3 changes: 2 additions & 1 deletion Game/testgame/gameinfo.gi
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
// engine is loaded automatically
ResourcePaths {
"dir" "testgame"
//"vpk" "{gameinfo_dir}/test_content.vpk"
}

SupportedLanguages
{
"english" "1"
Expand Down
File renamed without changes.
Binary file removed Game/testgame/materials/skies/sky_thz.png
Binary file not shown.
Binary file removed Game/testgame/models/fruit/strawberry.glb
Binary file not shown.
Binary file removed Game/testgame/models/gort.iqm
Binary file not shown.
9 changes: 6 additions & 3 deletions Game/testgame/resource/testgame_english.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
"Lang" {
"Lang"
{
"Language" "english"
"tokens" {
// none: for now
"tokens"
{
"GameMenu_StartTest" "Start Test Scene"
"GameMenu_Quit" "Quit"
}
}
9 changes: 8 additions & 1 deletion LibVpk/LibVPK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,18 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
<ContentWithTargetPath Include="libvpkeditc.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>libvpkeditc.dll</TargetPath>
</ContentWithTargetPath>
</ItemGroup>

<ItemGroup Condition="$([MSBuild]::IsOSPlatform('Linux'))">
<ContentWithTargetPath Include="libvpkeditc.so">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>libvpkeditc.so</TargetPath>
</ContentWithTargetPath>
</ItemGroup>

</Project>
Binary file added LibVpk/libvpkeditc.so
Binary file not shown.
54 changes: 22 additions & 32 deletions Source/Engine/Core/ConCmd.cs
Original file line number Diff line number Diff line change
@@ -1,32 +1,22 @@
using System;
using System.Diagnostics;

namespace WinterEngine.Core;

[Flags]
public enum CmdFlags
{
None,
Cheat,
Development,
Debug
}

#if HAS_MACROS
//#macro ConsoleCommand(name, desc, fn) internal sealed class nameConCommand : ConCmd {\
public override string Command => "name";\
public override string Description => desc;\
public override CmdFlags Flags => CmdFlags.None;\
public override void Exec(string[] args)\
fn\
}
#endif

public abstract class ConCmd
{
public abstract string Command { get; }
public abstract string Description { get; }
public abstract CmdFlags Flags { get; }

public abstract void Exec(string[] args);
}
using System;
using System.Diagnostics;

namespace WinterEngine.Core;

[Flags]
public enum CmdFlags
{
None,
Cheat,
Development,
Debug
}

public abstract class ConCmd
{
public abstract string Command { get; }
public abstract string Description { get; }
public abstract CmdFlags Flags { get; }

public abstract void Exec(string[] args);
}
120 changes: 120 additions & 0 deletions Source/Engine/Core/Config.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
using System.IO;
using ValveKeyValue;
using Veldrid;

namespace WinterEngine.Core;

public struct ConVar
{
public string Key { get; }
public Type Type { get; }
public object Value;
public object DefaultValue { get; }

public ConVar(string key, object value)
{
Key = key;
Type = value.GetType();
Value = value;
DefaultValue = value;
}
}

public static class ConfigManager
{
private static readonly ILog m_Log = LogManager.GetLogger("Config");

private static List<ConVar> m_ConVars = new List<ConVar>();
private static Dictionary<string, ConVar> m_CVars = new Dictionary<string, ConVar>();

public static void Init()
{
m_Log.Info("Initializing ConfigManager");
}

public static void SaveConfig()
{
string path = Path.Combine(Engine.GameDir, "cfg", "config.cfg");
Datamodel.Datamodel configDmx = new Datamodel.Datamodel("config", 1);
configDmx.Root = new Datamodel.Element(configDmx, "DmeConfig");

foreach (string key in m_CVars.Keys)
{
//configDmx.Root.Add(key, m_CVars[])
}
}

public static void RegisterCVar(string key, object value)
{
if (m_ConVars.Where(i => i.Key == key).ToList().Count > 0)
{
m_Log.Error($"Convar {key} aready exists!");
}
else
{
m_ConVars.Add(new ConVar(key, value));
}
}

public static ConVar? GetCVar(string key)
{
foreach (ConVar cvar in m_ConVars)
{
if (cvar.Key == key)
{
return cvar;
}
}

m_Log.Error($"No convar by key {key}");
return null;
}

public static void SetValue(string key, object value)
{
// no you can't null check this variable, it's typed. (CS0019,CS0037)
// you also can't make it nullable, that makes it readonly. (CS0200)
ConVar cvar = m_ConVars.Where(i => i.Key == key).First();
try
{
cvar.Value = value;
}
catch
{
m_Log.Error($"No convar by key {key}");
}
}

public static void SetValue<T>(string key, T value)
{
// no you can't null check this variable, it's typed. (CS0019,CS0037)
// you also can't make it nullable, that makes it readonly. (CS0200)
ConVar cvar = m_ConVars.Where(i => i.Key == key).First();
try
{
if (cvar.Type == typeof(T))
cvar.Value = value;
else
m_Log.Error($"Convar {key} is not of type {typeof(T)}");
}
catch
{
m_Log.Error($"No convar by key {key}");
}
}

public static object? GetValue(string key)
{
foreach (ConVar cvar in m_ConVars)
{
if (cvar.Key == key)
{
return cvar.Value;
}
}

m_Log.Error($"No convar by key {key}");
return null;
}
public static T? GetValue<T>(string key) => (T)GetValue(key);
}
Loading

0 comments on commit 34648ce

Please sign in to comment.