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"
|
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;
|
2022-03-19 22:45:30 +01:00
|
|
|
//Vector4 positionVS;
|
2020-09-30 13:48:41 +02:00
|
|
|
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();
|
2022-01-12 14:40:26 +01:00
|
|
|
void start();
|
2022-04-15 23:45:44 +02:00
|
|
|
void beginUpdate(double deltaTime);
|
|
|
|
|
void commitUpdate();
|
2020-05-05 01:51:13 +02:00
|
|
|
void addActor(PActor actor);
|
|
|
|
|
void addPrimitiveComponent(PPrimitiveComponent comp);
|
|
|
|
|
|
2022-01-12 14:40:26 +01:00
|
|
|
const std::vector<PPrimitiveComponent>& getPrimitives() const { return primitives; }
|
|
|
|
|
const std::vector<StaticMeshBatch>& getStaticMeshes() const { return staticMeshes; }
|
2022-02-24 22:38:26 +01:00
|
|
|
LightEnv& getLightBuffer() { return lightEnv; }
|
2020-04-15 02:03:56 +02:00
|
|
|
private:
|
2022-01-12 14:40:26 +01:00
|
|
|
std::vector<StaticMeshBatch> staticMeshes;
|
|
|
|
|
std::vector<PActor> rootActors;
|
|
|
|
|
std::vector<PPrimitiveComponent> primitives;
|
2020-09-30 13:48:41 +02:00
|
|
|
LightEnv lightEnv;
|
2020-09-19 14:36:50 +02:00
|
|
|
Gfx::PGraphics graphics;
|
2020-04-15 02:03:56 +02:00
|
|
|
};
|
2020-05-05 01:51:13 +02:00
|
|
|
} // namespace Seele
|