Skip to content

Commit

Permalink
v.10.12
Browse files Browse the repository at this point in the history
  • Loading branch information
Klemmbaustein committed Jun 9, 2024
1 parent cb6e4bb commit b9b27b8
Show file tree
Hide file tree
Showing 28 changed files with 412 additions and 332 deletions.
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changes

## Version 1.10.12

### Changes

- Brought over `UIBox::SizeMode::AspectRelative` and `UIBox::SizeMode::PixelRelative` from KlemmUI.
- Changed the way text wrapping works.

## Version 1.10.11

### Changes
Expand Down
41 changes: 24 additions & 17 deletions CSharp/Engine/NativeFunction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,39 @@ public static void RegisterNativeFunction(string Name, IntPtr FunctionPtr)
{
LoadedNativeFunctions.Add(Name, FunctionPtr);
}
public static object CallNativeFunction(string Name, Type del, object[] Args)

private static void NativeFunctionError(string Message)
{
Log.Print(Message, Log.Severity.Error);
Log.Print("------------------------ Native functions: ------------------------", Log.Severity.Error);
foreach (var i in LoadedNativeFunctions)
{
Log.Print(i.Key, Log.Severity.Error);
}
}

public static object CallNativeFunction(string Name, Type DelegateType, object[] Args)
{
if (!LoadedNativeFunctions.TryGetValue(Name, out nint Value))
if (!DelegateType.IsSubclassOf(typeof(Delegate)))
{
Log.Print($"Attempted to call a native function but the given type doesn't derive from Delegate. Type: {DelegateType}", Log.Severity.Error);
return null;
}

if (!LoadedNativeFunctions.TryGetValue(Name, out IntPtr FunctionPointer))
{
Log.Print("Failed to call native function: " + Name, Log.Severity.Error);
Log.Print("------------------------ Native functions: ------------------------", Log.Severity.Error);
foreach (var i in LoadedNativeFunctions)
{
Log.Print(i.Key, Log.Severity.Error);
}
NativeFunctionError($"Failed to call native function: {Name}");
return null;
}

var NewDel = Marshal.GetDelegateForFunctionPointer(Value, del);
Delegate PointerDelegate = Marshal.GetDelegateForFunctionPointer(FunctionPointer, DelegateType);

if (NewDel == null)
if (PointerDelegate == null)
{
Log.Print("Failed to get delegate for native function: " + Name, Log.Severity.Error);
Log.Print("------------------------ Native functions: ------------------------", Log.Severity.Error);
foreach (var i in LoadedNativeFunctions)
{
Log.Print(i.Key, Log.Severity.Error);
}
NativeFunctionError($"Failed to get delegate for native function: {Name}");
return null;
}

return NewDel.DynamicInvoke(Args);
return PointerDelegate.DynamicInvoke(Args);
}
}
2 changes: 1 addition & 1 deletion EngineSource/Engine/EngineProperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Project
void OnLaunch();
extern const char* ProjectName;
}
#define VERSION_STRING "1.10.11"
#define VERSION_STRING "1.10.12"
#define OPENGL_MIN_REQUIRED_VERSION "GL_VERSION_4_2"

/**
Expand Down
5 changes: 2 additions & 3 deletions EngineSource/Engine/OS.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "OS.h"
#if _WIN32
//Include Windows Headers
#include <Windows.h>
#include <Shlobj.h>
#include <shobjidl.h>
Expand All @@ -13,11 +12,11 @@
#include <unistd.h>
#include <ios>
#include <iostream>
#endif

#include <fstream>
#include <string>
#include <Engine/Utility/StringUtility.h>
#endif

#include <Engine/Log.h>

namespace OS
Expand Down
4 changes: 2 additions & 2 deletions EngineSource/Rendering/Framebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ void FramebufferObject::Draw()
glEnable(GL_CULL_FACE);
glDisable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
glClearColor(0.f, 0.f, 0.f, 1.f); //Clear color black
glClearColor(0.f, 0.f, 0.f, 1.f);
glViewport(0, 0, Graphics::ShadowResolution, Graphics::ShadowResolution);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
CSM::UpdateMatricesUBO(FramebufferCamera);

if (Graphics::RenderShadows && Graphics::ShadowResolution > 0 && !Graphics::RenderFullbright)
if (Graphics::RenderShadows && Graphics::ShadowResolution > 0 && !Graphics::RenderFullBright)
{
glBindFramebuffer(GL_FRAMEBUFFER, CSM::LightFBO);
glClear(GL_DEPTH_BUFFER_BIT);
Expand Down
2 changes: 1 addition & 1 deletion EngineSource/Rendering/Graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ bool Graphics::VSync = true;
bool Graphics::Bloom = true;
bool Graphics::IsWireframe = false;
bool Graphics::RenderAntiAlias = true;
bool Graphics::RenderFullbright = false;
bool Graphics::RenderFullBright = false;
Graphics::Sun Graphics::WorldSun;
Graphics::Fog Graphics::WorldFog;
const int Graphics::MAX_LIGHTS = 8;
Expand Down
2 changes: 1 addition & 1 deletion EngineSource/Rendering/Graphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Graphics : public Subsystem
static bool IsWireframe;
static int ShadowResolution;
static bool Bloom;
static bool RenderFullbright;
static bool RenderFullBright;
static float Gamma;

static const int MAX_LIGHTS;
Expand Down
2 changes: 1 addition & 1 deletion EngineSource/Rendering/RenderSubsystem/PostProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ PostProcess::PostProcess()
AddEffect(AntiAliasEffect);

Console::ConsoleSystem->RegisterConVar(Console::Variable("post_process", NativeType::Bool, &RenderPostProcess, nullptr));
Console::ConsoleSystem->RegisterConVar(Console::Variable("full_bright", NativeType::Bool, &Graphics::RenderFullbright, nullptr));
Console::ConsoleSystem->RegisterConVar(Console::Variable("full_bright", NativeType::Bool, &Graphics::RenderFullBright, nullptr));
Console::ConsoleSystem->RegisterConVar(Console::Variable("aa_enabled", NativeType::Bool, &Graphics::RenderAntiAlias, []() {
Graphics::SetWindowResolution(Graphics::WindowResolution, true);
}));
Expand Down
2 changes: 1 addition & 1 deletion EngineSource/Rendering/Renderable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void Renderable::ApplyDefaultUniformsToShader(Shader* ShaderToApply, bool MainFr

ShaderToApply->SetVector3("u_directionallight.Direction", Vector3::GetForwardVector(Graphics::WorldSun.Rotation));

const Graphics::Sun& UsedSun = Graphics::RenderFullbright ? FullbrightSun : Graphics::WorldSun;
const Graphics::Sun& UsedSun = Graphics::RenderFullBright ? FullbrightSun : Graphics::WorldSun;

ShaderToApply->SetFloat("u_directionallight.Intensity", UsedSun.Intensity);
ShaderToApply->SetFloat("u_directionallight.AmbientIntensity", UsedSun.AmbientIntensity);
Expand Down
Loading

0 comments on commit b9b27b8

Please sign in to comment.