Former-commit-id: 63e1cac538c577a1f1aafa71fa7eef69a6d4daab [formerly b2d8769fd02a0e7d9c476d4ad7be1988a1fd6789] [formerly 636b5cb79bcb8da44d9aa45ba1023565bcf29f0d [formerly a2361ec2b8679d4d4ba096e543b5d4b91825dd62]] Former-commit-id: d402d35477f9db0135c553d55c401939426bf62d [formerly 607336ea0f42731e4604f3a8c2df06f3aecfc401] Former-commit-id: 69e23cd6c06723486de5e4641ce810012dac66da
44 lines
2.0 KiB
C++
44 lines
2.0 KiB
C++
#include <NDK/Systems/RenderSystem.hpp>
|
|
#include <NDK/World.hpp>
|
|
#include <NDK/Components/CameraComponent.hpp>
|
|
#include <NDK/Components/GraphicsComponent.hpp>
|
|
#include <NDK/Components/LightComponent.hpp>
|
|
#include <NDK/Components/NodeComponent.hpp>
|
|
#include <NDK/Components/ParticleGroupComponent.hpp>
|
|
#include <Nazara/Graphics/Sprite.hpp>
|
|
#include <Catch/catch.hpp>
|
|
|
|
SCENARIO("RenderSystem", "[NDK][RenderSystem]")
|
|
{
|
|
GIVEN("A world with a camera, a drawable, a light and some particles")
|
|
{
|
|
Ndk::World world;
|
|
const Ndk::EntityHandle& cameraEntity = world.CreateEntity();
|
|
Ndk::CameraComponent& cameraComponentCamera = cameraEntity->AddComponent<Ndk::CameraComponent>();
|
|
Ndk::NodeComponent& nodeComponentCamera = cameraEntity->AddComponent<Ndk::NodeComponent>();
|
|
|
|
const Ndk::EntityHandle& drawableEntity = world.CreateEntity();
|
|
Ndk::GraphicsComponent& graphicsComponentDrawable = drawableEntity->AddComponent<Ndk::GraphicsComponent>();
|
|
Nz::SpriteRef sprite = Nz::Sprite::New();
|
|
graphicsComponentDrawable.Attach(sprite);
|
|
Ndk::NodeComponent& nodeComponentDrawable = drawableEntity->AddComponent<Ndk::NodeComponent>();
|
|
|
|
const Ndk::EntityHandle& lightEntity = world.CreateEntity();
|
|
Ndk::LightComponent& lightComponentLight = lightEntity->AddComponent<Ndk::LightComponent>();
|
|
Ndk::NodeComponent& nodeComponentLight = lightEntity->AddComponent<Ndk::NodeComponent>();
|
|
|
|
const Ndk::EntityHandle& particlesEntity = world.CreateEntity();
|
|
Ndk::ParticleGroupComponent& particleGroupComponentParticles = particlesEntity->AddComponent<Ndk::ParticleGroupComponent>(1, Nz::ParticleLayout_Sprite);
|
|
|
|
WHEN("We change the render technique to ForwardRenderTechnique")
|
|
{
|
|
Ndk::RenderSystem& renderSystem = world.GetSystem<Ndk::RenderSystem>();
|
|
renderSystem.ChangeRenderTechnique<Nz::ForwardRenderTechnique>();
|
|
|
|
THEN("The render system should be ForwardRenderTechnique")
|
|
{
|
|
REQUIRE(renderSystem.GetRenderTechnique().GetType() == Nz::RenderTechniqueType_BasicForward);
|
|
}
|
|
}
|
|
}
|
|
} |