2020-05-05 01:51:13 +02:00
|
|
|
#pragma once
|
2020-04-15 02:03:56 +02:00
|
|
|
#include "MinimalEngine.h"
|
|
|
|
|
#include "Actor/Actor.h"
|
2020-05-05 01:51:13 +02:00
|
|
|
#include "Graphics/GraphicsResources.h"
|
|
|
|
|
#include "Components/PrimitiveComponent.h"
|
2020-06-02 11:46:18 +02:00
|
|
|
#include "Graphics/MeshBatch.h"
|
|
|
|
|
#include "Material/Material.h"
|
2021-05-06 17:02:10 +02:00
|
|
|
#include "SceneUpdater.h"
|
2020-04-15 02:03:56 +02:00
|
|
|
|
|
|
|
|
namespace Seele
|
|
|
|
|
{
|
2021-04-01 16:40:14 +02:00
|
|
|
DECLARE_REF(Material)
|
2020-05-05 01:51:13 +02:00
|
|
|
|
2020-09-30 13:48:41 +02:00
|
|
|
struct DirectionalLight
|
|
|
|
|
{
|
|
|
|
|
Vector4 color;
|
|
|
|
|
Vector4 direction;
|
|
|
|
|
Vector4 intensity;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct PointLight
|
|
|
|
|
{
|
|
|
|
|
Vector4 positionWS;
|
|
|
|
|
Vector4 positionVS;
|
|
|
|
|
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;
|
2020-09-30 13:48:41 +02:00
|
|
|
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();
|
2021-04-25 23:43:40 +02:00
|
|
|
void tick(double deltaTime);
|
2020-05-05 01:51:13 +02:00
|
|
|
void addActor(PActor actor);
|
|
|
|
|
void addPrimitiveComponent(PPrimitiveComponent comp);
|
|
|
|
|
|
2020-08-06 00:54:43 +02:00
|
|
|
const Array<PPrimitiveComponent>& getPrimitives() const { return primitives; }
|
2020-09-19 14:36:50 +02:00
|
|
|
const Array<MeshBatch>& getStaticMeshes() const { return staticMeshes; }
|
2021-05-10 23:57:55 +02:00
|
|
|
const Gfx::PStructuredBuffer& getLightBuffer() const { return lightBuffer; }
|
2021-05-06 17:02:10 +02:00
|
|
|
UPSceneUpdater& getSceneUpdater() { return updater; }
|
2020-04-15 02:03:56 +02:00
|
|
|
private:
|
2020-09-19 14:36:50 +02:00
|
|
|
Array<MeshBatch> staticMeshes;
|
2020-04-15 02:03:56 +02:00
|
|
|
Array<PActor> rootActors;
|
2020-05-05 01:51:13 +02:00
|
|
|
Array<PPrimitiveComponent> primitives;
|
2020-09-30 13:48:41 +02:00
|
|
|
LightEnv lightEnv;
|
2021-05-10 23:57:55 +02:00
|
|
|
Gfx::PStructuredBuffer lightBuffer;
|
2020-09-19 14:36:50 +02:00
|
|
|
Gfx::PGraphics graphics;
|
2021-05-06 17:02:10 +02:00
|
|
|
UPSceneUpdater updater;
|
2020-04-15 02:03:56 +02:00
|
|
|
};
|
2020-05-05 01:51:13 +02:00
|
|
|
} // namespace Seele
|