shadow start
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "../ecs/components/HydraRenderableComponent.h"
|
||||
#include "../ecs/components/HydraMaterialComponent.h"
|
||||
#include "../ecs/components/HydraLightComponent.h"
|
||||
#include "../ecs/components/HydraShadowSourceComponent.h"
|
||||
|
||||
#include "../buffer/HydraLightBufferManager.h"
|
||||
#include "../buffer/HydraLightBuffer.h"
|
||||
@@ -20,23 +21,19 @@ void HydraDirectionalLightActor::InitialiseComponents()
|
||||
HydraLightComponent light_comp = {};
|
||||
HydraECS *ecs = GetEngine()->ECS();
|
||||
|
||||
// HydraLightBuffer light = {};
|
||||
// light.light_colour = glm::vec3(1,1,1);
|
||||
// light.light_direction = glm::vec3(0,0,0);
|
||||
// light.light_intensity = 1;
|
||||
// light.light_type = static_cast<uint32_t>(HYDRA_LIGHT_TYPE::HYDRA_LIGHT_DIRECTIONAL);
|
||||
|
||||
//light_comp.light_id = GetEngine()->LightBufferManager()->CreateLight(light);
|
||||
|
||||
|
||||
light_comp.diffuse = glm::vec4(1,1,1,1);
|
||||
light_comp.intensity = 1.0f;
|
||||
light_comp.intensity = 1000.0f;
|
||||
light_comp.light_type = static_cast<uint32_t>(HYDRA_LIGHT_TYPE::HYDRA_LIGHT_DIRECTIONAL);
|
||||
light_comp.entity_id = GetID();
|
||||
|
||||
ecs->AddComponent<HydraLightComponent>(GetID(), light_comp);
|
||||
|
||||
HydraPositionComponent position_component;
|
||||
HydraPositionComponent position_component = {};
|
||||
ecs->AddComponent<HydraPositionComponent>(GetID(), position_component);
|
||||
|
||||
HydraShadowSourceComponent shadow_component = {};
|
||||
ecs->AddComponent<HydraShadowSourceComponent>(GetID(), shadow_component);
|
||||
}
|
||||
|
||||
void HydraDirectionalLightActor::Destroy()
|
||||
|
||||
@@ -24,6 +24,7 @@ void HydraOutputActor::_CreateMaterial()
|
||||
GL_RGBA8,
|
||||
GL_NEAREST,
|
||||
GL_NEAREST);
|
||||
|
||||
HydraID depth = engine->TextureBufferManager()->CreateTexture("deferred_depth",
|
||||
render_settings.DisplayWidth,
|
||||
render_settings.DisplayHeight,
|
||||
@@ -52,6 +53,7 @@ void HydraOutputActor::_CreateMaterial()
|
||||
GL_NEAREST,
|
||||
GL_NEAREST);
|
||||
|
||||
|
||||
// engine->TextureBufferManager()->BindTexture(depth);
|
||||
// engine->TextureBufferManager()->BindTexture(buffer_0);
|
||||
texture_buffers.resize(16);
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
#ifndef HYDRAECSSHADOWCOMPONENT
|
||||
#define HYDRAECSSHADOWCOMPONENT
|
||||
//#include "../helper/VulkanHelper.h"
|
||||
//#include "../buffer/HydraShadowMapTransform.h"
|
||||
|
||||
struct HydrahadowComponent
|
||||
{
|
||||
// HydraID shadow_map_id; //4
|
||||
// HydraID shadow_map_index; //8
|
||||
// float padding0; //12
|
||||
// float padding1; //16
|
||||
// HydraShadowMapTransform shadow_transforms[6]; //880 (144*6)
|
||||
// float padding[20]; //960
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif /* HYDRAECSSHADOWCOMPONENT */
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef HYDRASOURCECOMPONENT
|
||||
#define HYDRASOURCECOMPONENT
|
||||
|
||||
#include "../../engine/HydraEngine.h"
|
||||
|
||||
struct HydraShadowSourceComponent
|
||||
{
|
||||
uint32_t entity_id;
|
||||
uint32_t cascade_count;
|
||||
uint32_t shadow_texture_id;
|
||||
uint32_t padding0;
|
||||
float near_plane[8];
|
||||
float far_plane[8];
|
||||
glm::mat4 projection[6];
|
||||
};
|
||||
|
||||
#endif /* HYDRACASTERCOMPONENT */
|
||||
@@ -0,0 +1,9 @@
|
||||
#include "HydraShadowSourceSystem.h"
|
||||
|
||||
void HydraShadowSourceSystem::Initialise()
|
||||
{
|
||||
}
|
||||
|
||||
void HydraShadowSourceSystem::InitialiseComponent(HydraID entity_id)
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef HYDRASHADOWSOURCESYSTEM
|
||||
#define HYDRASHADOWSOURCESYSTEM
|
||||
#include "../../engine/HydraObject.h"
|
||||
#include "../HydraSystem.h"
|
||||
#include <GLMIncludes.h>
|
||||
#include <queue>
|
||||
|
||||
class HydraShadowSourceSystem : public HydraSystem
|
||||
{
|
||||
public:
|
||||
virtual void Initialise() override;
|
||||
protected:
|
||||
virtual void InitialiseComponent(HydraID entity_id) override;
|
||||
void UpdateSystem(float delta_t_seconds) override {}
|
||||
};
|
||||
|
||||
#endif /* HYDRASHADOWCASTERSYSTEM */
|
||||
@@ -20,13 +20,14 @@
|
||||
#include "../ecs/systems/HydraRenderSystem.h"
|
||||
#include "../ecs/systems/HydraMaterialSystem.h"
|
||||
#include "../ecs/systems/HydraLightSystem.h"
|
||||
|
||||
#include "../ecs/systems/HydraShadowSourceSystem.h"
|
||||
#include "../ecs/components/HydraPositionComponent.h"
|
||||
#include "../ecs/components/HydraMeshComponent.h"
|
||||
#include "../ecs/components/HydraRenderableComponent.h"
|
||||
#include "../ecs/components/HydraTextureComponent.h"
|
||||
#include "../ecs/components/HydraMaterialComponent.h"
|
||||
#include "../ecs/components/HydraLightComponent.h"
|
||||
#include "../ecs/components/HydraShadowSourceComponent.h"
|
||||
|
||||
|
||||
#include "../camera/HydraCamera.h"
|
||||
@@ -210,24 +211,34 @@ void HydraEngine::_InitialiseSystems()
|
||||
m_ecs->RegisterComponentType<HydraTextureComponent>();
|
||||
m_ecs->RegisterComponentType<HydraMaterialComponent>();
|
||||
m_ecs->RegisterComponentType<HydraLightComponent>();
|
||||
m_ecs->RegisterComponentType<HydraShadowSourceComponent>();
|
||||
|
||||
m_mesh_system = m_ecs->RegisterSystem<HydraMeshSystem>();
|
||||
m_transform_system = m_ecs->RegisterSystem<HydraTransformSystem>();
|
||||
m_render_system = m_ecs->RegisterSystem<HydraRenderSystem>();
|
||||
m_material_system = m_ecs->RegisterSystem<HydraMaterialSystem>();
|
||||
m_light_system = m_ecs->RegisterSystem<HydraLightSystem>();
|
||||
m_shadow_system = m_ecs->RegisterSystem<HydraShadowSourceSystem>();
|
||||
|
||||
HydraSignature mesh_sig;
|
||||
HydraSignature trans_sig;
|
||||
HydraSignature render_sig;
|
||||
HydraSignature material_sig;
|
||||
HydraSignature light_sig;
|
||||
HydraSignature shadow_sig;
|
||||
|
||||
mesh_sig.set(m_ecs->GetComponentType<HydraMeshComponent>(),true);
|
||||
trans_sig.set(m_ecs->GetComponentType<HydraPositionComponent>(),true);
|
||||
render_sig.set(m_ecs->GetComponentType<HydraRenderableComponent>(),true);
|
||||
material_sig.set(m_ecs->GetComponentType<HydraMaterialComponent>(),true);
|
||||
|
||||
light_sig.set(m_ecs->GetComponentType<HydraLightComponent>(), true);
|
||||
light_sig.set(m_ecs->GetComponentType<HydraPositionComponent>(), true);
|
||||
|
||||
shadow_sig.set(m_ecs->GetComponentType<HydraLightComponent>(), true);
|
||||
shadow_sig.set(m_ecs->GetComponentType<HydraPositionComponent>(), true);
|
||||
shadow_sig.set(m_ecs->GetComponentType<HydraShadowSourceComponent>(), true);
|
||||
|
||||
|
||||
m_ecs->SetSystemSignature<HydraMeshSystem>(mesh_sig);
|
||||
m_ecs->SetSystemSignature<HydraTransformSystem>(trans_sig);
|
||||
|
||||
@@ -25,6 +25,7 @@ class HydraTextureBufferManager;
|
||||
class HydraMaterialBufferManager;
|
||||
class HydraLightBufferManager;
|
||||
class HydraLightSystem;
|
||||
class HydraShadowSourceSystem;
|
||||
|
||||
class CLASS_DEFINE HydraEngine : public HydraObject
|
||||
{
|
||||
@@ -91,6 +92,7 @@ private:
|
||||
std::shared_ptr<HydraRenderSystem> m_render_system;
|
||||
std::shared_ptr<HydraMaterialSystem> m_material_system;
|
||||
std::shared_ptr<HydraLightSystem> m_light_system;
|
||||
std::shared_ptr<HydraShadowSourceSystem> m_shadow_system;
|
||||
|
||||
bool m_running = true;
|
||||
float m_delta_t = 0.0f;
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
#ifndef HYDRASHADOWPIPELINE
|
||||
#define HYDRASHADOWPIPELINE
|
||||
|
||||
#include "../engine/HydraObject.h"
|
||||
#include "../windowmanager/HydraRenderSettings.h"
|
||||
#include "HydraPipeline.h"
|
||||
#include "HydraRenderStage.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class HydraRenderStage;
|
||||
|
||||
class HydraShadowPipeline : public HydraPipeline
|
||||
{
|
||||
public:
|
||||
void Initialise() override;
|
||||
void Shutdown() override;
|
||||
void Render() override;
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
#endif /* HYDRADEFERREDPIPELINE */
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user