Point lights
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
#include "../ecs/components/HydraRenderableComponent.h"
|
||||
#include "../ecs/components/HydraMaterialComponent.h"
|
||||
#include "../ecs/components/HydraPhysicsComponent.h"
|
||||
#include "../ecs/components/HydraShadowCasterComponent.h"
|
||||
#include "../ecs/components/HydraLightComponent.h"
|
||||
#include "../buffer/HydraMaterialBufferManager.h"
|
||||
#include "../buffer/HydraTextureBufferManager.h"
|
||||
#include "../buffer/HydraMaterialBuffer.h"
|
||||
@@ -24,6 +26,7 @@ void HydraTestCubeActor::InitialiseComponents()
|
||||
_CreateMaterial();
|
||||
_CreateMesh();
|
||||
_CreateRenderableComponent();
|
||||
_CreateLightComponent();
|
||||
}
|
||||
|
||||
void HydraTestCubeActor::DeferredInitialiseComponents()
|
||||
@@ -174,7 +177,8 @@ void HydraTestCubeActor::_CreateMaterial()
|
||||
|
||||
material.diffuse_texture_id = tex_id;
|
||||
material.diffuse_colour = glm::vec4(1, 1, 1, 1);
|
||||
material.metalic_rough = glm::vec4(0, 0.5, 0.3, 1);
|
||||
material.emmissive_metalic_rough = glm::vec4(0.0f, 0.5f, 0.3f, 1.0f);
|
||||
|
||||
HydraID mat_id = engine->MaterialBufferManager()->CreateMaterial(material);
|
||||
|
||||
HydraMaterialComponent mat_comp = {};
|
||||
@@ -199,7 +203,23 @@ void HydraTestCubeActor::_CreatePhysics()
|
||||
void HydraTestCubeActor::_CreateRenderableComponent()
|
||||
{
|
||||
HydraRenderableComponent render_comp;
|
||||
HydraShadowCasterComponent shad_caster;
|
||||
HydraECS *ecs = GetEngine()->ECS();
|
||||
render_comp.renderable_types.set((uint32_t)HYDRA_RENDERABLE_TYPE::HYDRA_COLOUR, true);
|
||||
render_comp.renderable_types.set((uint32_t)HYDRA_RENDERABLE_TYPE::HYDRA_SHADOW_CASTER, true);
|
||||
ecs->AddComponent<HydraRenderableComponent>(GetID(), render_comp);
|
||||
ecs->AddComponent<HydraShadowCasterComponent>(GetID(), shad_caster);
|
||||
|
||||
}
|
||||
void HydraTestCubeActor::_CreateLightComponent()
|
||||
{
|
||||
HydraLightComponent light_comp = {};
|
||||
HydraECS *ecs = GetEngine()->ECS();
|
||||
|
||||
light_comp.diffuse = glm::vec4(1,1,1,1);
|
||||
light_comp.intensity = 1000.0f;
|
||||
light_comp.light_type = static_cast<uint32_t>(HYDRA_LIGHT_TYPE::HYDRA_LIGHT_POINT);
|
||||
light_comp.entity_id = GetID();
|
||||
|
||||
ecs->AddComponent<HydraLightComponent>(GetID(), light_comp);
|
||||
}
|
||||
Reference in New Issue
Block a user