feat: add forward+ rendering
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user