Files
Seele/src/Engine/Scene/Scene.h
T

71 lines
1.6 KiB
C++
Raw Normal View History

2020-05-05 01:51:13 +02:00
#pragma once
#include <entt/entt.hpp>
2020-04-15 02:03:56 +02:00
#include "MinimalEngine.h"
2020-05-05 01:51:13 +02:00
#include "Graphics/GraphicsResources.h"
2020-06-02 11:46:18 +02:00
#include "Graphics/MeshBatch.h"
2020-04-15 02:03:56 +02:00
namespace Seele
{
2021-04-01 16:40:14 +02:00
DECLARE_REF(Material)
DECLARE_REF(Entity)
2020-05-05 01:51:13 +02:00
struct DirectionalLight
{
Math::Vector4 color;
Math::Vector4 direction;
Math::Vector4 intensity;
};
struct PointLight
{
Math::Vector4 positionWS;
2022-03-19 22:45:30 +01:00
//Vector4 positionVS;
Math::Vector4 colorRange;
};
#define MAX_DIRECTIONAL_LIGHTS 4
#define MAX_POINT_LIGHTS 256
struct LightEnv
{
DirectionalLight directionalLights[MAX_DIRECTIONAL_LIGHTS];
PointLight pointLights[MAX_POINT_LIGHTS];
2021-01-19 15:30:00 +01:00
uint32 numDirectionalLights;
uint32 numPointLights;
};
2020-04-15 02:03:56 +02:00
class Scene
{
public:
2020-09-19 14:36:50 +02:00
Scene(Gfx::PGraphics graphics);
2020-04-15 02:03:56 +02:00
~Scene();
2022-01-12 14:40:26 +01:00
void start();
2022-04-15 23:45:44 +02:00
void beginUpdate(double deltaTime);
void commitUpdate();
entt::entity createEntity()
{
return registry.create();
}
template<typename Component, typename... Args>
Component& attachComponent(entt::entity entity, Args... args)
{
return registry.emplace<Component>(entity, args...);
}
template<typename Component>
Component& accessComponent(entt::entity entity)
{
return registry.get<Component>(entity);
}
template<typename Component>
const Component& accessComponent(entt::entity entity) const
{
return registry.get<Component>(entity);
}
Array<StaticMeshBatch> getStaticMeshes();
LightEnv getLightBuffer() const;
entt::registry registry;
2020-04-15 02:03:56 +02:00
private:
2020-09-19 14:36:50 +02:00
Gfx::PGraphics graphics;
2020-04-15 02:03:56 +02:00
};
DEFINE_REF(Scene)
2020-05-05 01:51:13 +02:00
} // namespace Seele