feat: add forward+ rendering

This commit is contained in:
2026-10-11 00:12:23 +02:00
parent c96b2282fb
commit 4bf87bd91b
26 changed files with 1346 additions and 191 deletions
+36
View File
@@ -22,6 +22,7 @@
#include <destrum/Components/Physics/BoxCollider.h>
#include <destrum/Components/Physics/Collider.h>
#include <destrum/Components/Animator.h>
#include <destrum/Components/LightComponent.h>
#include <destrum/Components/Physics/Rigidbody.h>
#include <destrum/Graphics/Material.h>
#include <destrum/Graphics/Managers/LineRenderingManager.h>
@@ -171,6 +172,7 @@ namespace {
const char* canonicalNames[] = {
"MeshRendererComponent",
"LightComponent",
"Rotator",
"Spinner",
"OrbitAndSpin",
@@ -447,6 +449,39 @@ namespace {
"Animator scene data must not embed animation keyframes");
}
void testLightComponentRoundTrip()
{
GameObject object{"light"};
auto* light = object.AddComponent<LightComponent>(LightType::Spot);
light->SetColor(glm::vec3{1.0f, 0.5f, 0.25f});
light->SetIntensity(4.0f);
light->SetRange(7.5f);
light->SetConeAngles(0.2f, 0.4f);
const auto data = light->Serialize();
GameObject loadedObject{"loaded light"};
auto* loaded = loadedObject.AddComponent<LightComponent>();
loaded->Deserialize(data);
check(loaded->GetType() == LightType::Spot,
"LightComponent must round-trip its type");
check(loaded->GetColor() == glm::vec3{1.0f, 0.5f, 0.25f},
"LightComponent must round-trip its color");
check(loaded->GetIntensity() == 4.0f && loaded->GetRange() == 7.5f,
"LightComponent must round-trip intensity and range");
check(loaded->GetInnerConeAngle() == 0.2f && loaded->GetOuterConeAngle() == 0.4f,
"LightComponent must round-trip its cone angles");
loaded->SetConeAngles(0.5f, 0.1f);
check(loaded->GetOuterConeAngle() >= loaded->GetInnerConeAngle(),
"LightComponent outer cone must never be smaller than the inner cone");
loaded->SetRange(0.0f);
check(loaded->GetRange() > 0.0f,
"LightComponent range must stay positive");
}
void testSimpleColorMaterial()
{
const auto material = Material::SimpleColor(
@@ -561,6 +596,7 @@ int main()
testJoltSphereCollisions();
testSceneJoltSphereCollisions();
testAnimatorAssetReferences();
testLightComponentRoundTrip();
testSimpleColorMaterial();
testAssetReferenceCacheKeys();
testTriggerZone();