Point light working

This commit is contained in:
Confideo-IOM
2026-08-16 13:47:11 +01:00
parent f9b696f9e8
commit 98ff54c106
50 changed files with 1187 additions and 357 deletions
+16 -9
View File
@@ -9,19 +9,20 @@ bool HydraGame::Initialise()
// GetEngine()->ActorManager()->SetOrientation(m_sun_light_id, -0.5f, 0.0f, 0.0f);
// GetEngine()->ActorManager()->SetPosition(m_sun_light_id, glm::dvec3(0.0f, 4.0f, 10.0f));
// m_sun_light_id = GetEngine()->ActorManager()->CreateActor<HydraDirectionalLightActor>();
// GetEngine()->ActorManager()->InitialiseActor(m_sun_light_id);
// GetEngine()->ActorManager()->SetOrientation(m_sun_light_id, -0.5f, -0.2f, 0.0f);
m_sun_light_id = GetEngine()->ActorManager()->CreateActor<HydraDirectionalLightActor>();
GetEngine()->ActorManager()->InitialiseActor(m_sun_light_id);
GetEngine()->ActorManager()->SetOrientation(m_sun_light_id, -0.5f, -0.2f, 0.0f);
m_other_light_id = GetEngine()->ActorManager()->CreateActor<HydraPointLightActor>();
GetEngine()->ActorManager()->InitialiseActor(m_other_light_id);
// GetEngine()->ActorManager()->SetOrientation(m_other_light_id, -0.7f, 0.0f, 0.0f);
GetEngine()->ActorManager()->SetPosition(m_other_light_id, glm::dvec3(0.0f, 4.0f, 5.0f));
GetEngine()->ActorManager()->InitialiseActor(m_other_light_id);
GetEngine()->ActorManager()->SetPosition(m_other_light_id, glm::dvec3(0.0f, 1.0f, 5.0f));
m_spot_light_id = GetEngine()->ActorManager()->CreateActor<HydraSpotLightActor>();
GetEngine()->ActorManager()->InitialiseActor(m_spot_light_id);
GetEngine()->ActorManager()->SetOrientation(m_spot_light_id, -0.5f, -0.2f, 0.0f);
GetEngine()->ActorManager()->SetPosition(m_spot_light_id, glm::dvec3(0.0f, 4.0f, 5.0f));
// m_other_light_id = GetEngine()->ActorManager()->CreateActor<HydraDirectionalLightActor>();
// GetEngine()->ActorManager()->InitialiseActor(m_other_light_id);
// GetEngine()->ActorManager()->SetOrientation(m_other_light_id, 0.4f, 0.5f, 0.0f);
// //1.570796327f
// //3.141592654f
@@ -34,6 +35,10 @@ bool HydraGame::Initialise()
GetEngine()->ActorManager()->InitialiseActor(m_plane_actor_id);
GetEngine()->ActorManager()->SetPosition(m_plane_actor_id, glm::dvec3(0, 0, 0));
// m_plane_actor_id1 = GetEngine()->ActorManager()->CreateActor<HydraPlaneActor>();
// GetEngine()->ActorManager()->InitialiseActor(m_plane_actor_id1);
// GetEngine()->ActorManager()->SetPosition(m_plane_actor_id1, glm::dvec3(0, 10, 0));
// m_cube_actor_id = GetEngine()->ActorManager()->CreateActor<HydraPlaneActor>();
// GetEngine()->ActorManager()->InitialiseActor(m_cube_actor_id);
// GetEngine()->ActorManager()->SetPosition(m_cube_actor_id, glm::dvec3(0, -2, 0));
@@ -54,6 +59,8 @@ bool HydraGame::Initialise()
GetEngine()->PossessPlayer(m_player_actor_id);
GetEngine()->Camera()->AttachToActor(m_player_actor_id);
//GetEngine()->ActorManager()->SetRelationship(m_player_actor_id, m_other_light_id);
return false;
}
+3
View File
@@ -10,10 +10,13 @@ class HydraGame : public HydraGameProxy
{
private:
HydraID m_plane_actor_id = INVALID_HYDRA_ID;
HydraID m_plane_actor_id1 = INVALID_HYDRA_ID;
HydraID m_player_actor_id = INVALID_HYDRA_ID;
HydraID m_cube_actor_id = INVALID_HYDRA_ID;
HydraID m_sun_light_id = INVALID_HYDRA_ID;
HydraID m_other_light_id = INVALID_HYDRA_ID;
HydraID m_spot_light_id = INVALID_HYDRA_ID;
HydraID m_gltf_id = INVALID_HYDRA_ID;
HydraID m_gltf_id1 = INVALID_HYDRA_ID;
float m_time = 0;
+2 -1
View File
@@ -43,7 +43,8 @@ const uint32_t MAX_ACTORS = 10000;
const uint32_t MAX_LIGHTS = 500;
const uint32_t MAX_DIRECTIONAL_SHADOWS = 10;
const uint32_t MAX_SPOT_SHADOWS = 10;
const uint32_t SHADOW_MAP_SIZE = 4096;
const uint32_t MAX_POINT_SHADOWS = 10;
const uint32_t SHADOW_MAP_SIZE = 1024;
enum class HYDRA_RENDERABLE_TYPE
@@ -2,7 +2,7 @@
#version 460 core
#extension GL_ARB_bindless_texture : require
#extension GL_ARB_gpu_shader5 : enable
uint INVALID_HYDRA_ID = 4294967295;
uint DEPTH_TEXTURE_ID = 0;
@@ -59,6 +59,21 @@ struct SpotShadowMapSet
mat4 light_space_view;
};
struct PointShadowMapSet
{
uint entity_id;
uint shadow_id;
uint shadow_texture_id;
uint frame_buffer_id;
float near_plane;
float far_plane;
uint padding[2];
mat4 light_space_proj;
mat4 light_space_view[6];
};
uniform samplerCube depth_map;
layout(binding = 0) uniform uniform_per_frame
{
mat4 view;
@@ -96,6 +111,12 @@ layout (std430, binding = 6) readonly buffer spot_shadow_map_sets
{
SpotShadowMapSet spot_shadows[];
};
layout (std430, binding = 7) readonly buffer point_shadow_map_sets
{
PointShadowMapSet point_shadows[];
};
layout (location=0) in VS_OUT
{
vec2 vsUV;
@@ -224,14 +245,16 @@ vec3 PointShading(vec3 normal,
float light_linear,
float light_quadratic,
vec3 world_pos,
vec3 view_pos)
vec3 view_pos,
float shadow_val)
{
float distance = length(light_pos - world_pos);
float attenuation = 1.0;
attenuation = light_intensity / (light_constant + (light_linear * distance) + (light_quadratic * distance * distance));
vec3 radiance = diffuse * attenuation;
vec3 light_dir = normalize(light_pos - world_pos);
vec3 radiance = diffuse * attenuation * (1.0-shadow_val);
vec3 light_dir = normalize(light_pos - world_pos);
vec3 Lo = CalculatePBR(normal, view_pos, world_pos, light_dir, diffuse, radiance, roughness, metallic);
return Lo;
@@ -415,6 +438,56 @@ float CalculateSpotShadow(vec4 world_pos, uint shadow_idx, vec3 normal, vec3 lig
return shadow;
}
float SampleCubemapShadow(vec3 frag_to_light, float far_plane, float view_distance, samplerCube sampler_shadow_map)
{
vec3 sample_offset_directions[20] = vec3[]
(
vec3( 1, 1, 1), vec3( 1, -1, 1), vec3(-1, -1, 1), vec3(-1, 1, 1),
vec3( 1, 1, -1), vec3( 1, -1, -1), vec3(-1, -1, -1), vec3(-1, 1, -1),
vec3( 1, 1, 0), vec3( 1, -1, 0), vec3(-1, -1, 0), vec3(-1, 1, 0),
vec3( 1, 0, 1), vec3(-1, 0, 1), vec3( 1, 0, -1), vec3(-1, 0, -1),
vec3( 0, 1, 1), vec3( 0, -1, 1), vec3( 0, -1, -1), vec3( 0, 1, -1)
);
float shadow = 0.0;
float bias = 0.01;
int samples = 20;
float disk_radius = (1.0 + (view_distance / far_plane)) / 50.0;
float frag_depth = length(frag_to_light);
for(int i = 0; i < samples; ++i)
{
//float closest_depth = texture(sampler_shadow_map, frag_to_light).r;
float closest_depth = texture(sampler_shadow_map, frag_to_light + sample_offset_directions[i] * disk_radius).r;
closest_depth *= far_plane; // undo mapping [0;1]
if(frag_depth - bias > closest_depth)
shadow += 1.0;
}
shadow /= float(samples);
return shadow;
// float frag_depth = length(frag_to_light);
// closest_depth = closest_depth * far_plane;
// float bias = 0.05f;
// float shadow = (frag_depth - bias) > closest_depth ? 1.0 : 0.0;
// return shadow;
}
float CalculatePointShadow(vec3 world_pos, uint shadow_idx, float view_distance, vec3 light_position)
{
vec3 frag_to_light = light_position - world_pos;
uvec2 shadow_handle = textures[point_shadows[shadow_idx].shadow_texture_id];
float far_plane = point_shadows[shadow_idx].far_plane;
return SampleCubemapShadow(frag_to_light, far_plane, view_distance, samplerCube(shadow_handle));
}
void main()
{
uvec2 diffuse_handle = textures[texture_ids[DIFFUSE_TEXTURE_ID]];
@@ -431,6 +504,7 @@ void main()
vec3 normal = texture(sampler2D(normal_handle), vs_out.vsUV.xy).xyz;
vec3 metal_rough = texture(sampler2D(metal_rough_handle), vs_out.vsUV.xy).xyz;
vec3 world_pos = texture(sampler2D(world_pos_handle), vs_out.vsUV.xy).xyz;
float rough = metal_rough[1];
float metal = metal_rough[2];
float ao = 1;
@@ -448,14 +522,19 @@ void main()
Lo += DirectionalShading(normal, diffuse.xyz, rough, metal, lights[i].intensity, light_direction, light_pos, world_pos, ubo_per_frame.viewer_pos);
if(lights[i].shadow_caster == 1)
{
vec3 shadow = CalculateDirectionalShadow(vec4(world_pos, 1.0), lights[i].shadow_map_id, normal, light_direction, ubo_per_frame.viewer_pos);
//Lo = Lo * vec3(shadow);
vec3 shadow = CalculateDirectionalShadow(vec4(world_pos, 1.0), lights[i].shadow_map_id, normal, light_direction, ubo_per_frame.viewer_pos);
Lo = Lo * shadow;
}
}
else if(lights[i].light_type == HYDRA_LIGHT_POINT)
{
float shadow = 0;
if(lights[i].shadow_caster == 1)
{
float view_to_frag = length(light_pos - ubo_per_frame.viewer_pos );
shadow = CalculatePointShadow(world_pos, i, view_to_frag, light_pos);
}
Lo += PointShading(normal,
diffuse.xyz,
rough,
@@ -466,14 +545,16 @@ void main()
lights[i].linear,
lights[i].quadratic,
world_pos,
ubo_per_frame.viewer_pos);
ubo_per_frame.viewer_pos,
shadow);
}
else if(lights[i].light_type == HYDRA_LIGHT_SPOT)
{
float shadow = 0;
if(lights[i].shadow_caster == 1)
if(lights[i].shadow_caster == 1)
{
float distance = length(light_pos - world_pos);
// float distance = length(light_pos - world_pos);
shadow = CalculateSpotShadow(vec4(world_pos, 1.0),
lights[i].shadow_map_id,
normal,
@@ -0,0 +1,84 @@
//*PIXEL*
#version 460
#extension GL_ARB_bindless_texture : require
const uint DIRECTIONAL_LIGHT = 1;
const uint POINT_LIGHT = 2;
const uint SPOT_LIGHT = 3;
uint INVALID_HYDRA_ID = 4294967295;
struct MaterialStore
{
vec4 diffuse_colour;
vec4 matalic_rough;
uint diffuse_texture_id;
uint metallic_rough_texture_id;
uint normal_texture_id;
uint padding[1];
};
struct PointShadowMapSet
{
uint entity_id;
uint shadow_id;
uint shadow_texture_id;
uint frame_buffer_id;
float near_plane;
float far_plane;
uint padding[2];
mat4 light_space_proj;
mat4 light_space_view[6];
};
layout(std430, binding = 2) readonly buffer material_buffer
{
MaterialStore materials[1000];
};
layout(std430, binding = 3) readonly buffer texture_buffer
{
uvec2 textures[1000];
};
layout (std430, binding = 7) readonly buffer point_shadow_map_sets
{
PointShadowMapSet point_shadows[];
};
layout (location=0) in GEOM_OUT
{
vec2 vsUV;
flat uint vsMaterialID;
vec4 frag_pos;
flat uint shad_idx;
flat vec3 light_pos;
}geom_out;
layout (location=0) out vec4 output_colour;
void main()
{
MaterialStore mat = materials[geom_out.vsMaterialID];
vec4 diffuse_val = mat.diffuse_colour;
if(mat.diffuse_texture_id != INVALID_HYDRA_ID)
{
uvec2 diffuse_handle = textures[mat.diffuse_texture_id];
diffuse_val = diffuse_val * texture(sampler2D(diffuse_handle), geom_out.vsUV.xy);
}
if(diffuse_val[3] < 1.0)
{
discard;
}
float light_distance = length(geom_out.frag_pos.xyz - geom_out.light_pos);
// map to [0;1] range by dividing by far_plane
light_distance = light_distance / point_shadows[geom_out.shad_idx].far_plane;
// write this as modified depth
gl_FragDepth = light_distance;
}
@@ -0,0 +1,74 @@
#version 450
layout(triangles, invocations = 6) in;
layout(triangle_strip, max_vertices = 3) out;
struct PointShadowMapSet
{
uint entity_id;
uint shadow_id;
uint shadow_texture_id;
uint frame_buffer_id;
float near_plane;
float far_plane;
uint padding[2];
mat4 light_space_proj;
mat4 light_space_view[6];
};
//Push constants updated for each light
layout(binding = 0) uniform shadow_per_frame
{
vec3 camera_pos;
uint shadow_idxs;
};
layout (std430, binding = 7) readonly buffer point_shadow_map_sets
{
PointShadowMapSet point_shadows[];
};
layout (location=0) in VS_OUT
{
vec2 vsUV;
flat uint vsMaterialID;
}vs_in[];
layout (location=0) out GEOM_OUT
{
vec2 vsUV;
flat uint vsMaterialID;
vec4 frag_pos;
flat uint shad_idx;
flat vec3 light_pos;
}geom_out;
void main()
{
mat4 view = point_shadows[shadow_idxs].light_space_view[gl_InvocationID];
mat4 proj = point_shadows[shadow_idxs].light_space_proj;
mat3 rot_mat = mat3(view);
vec3 d = vec3(view[3]); // Column-major translation column
vec3 light_pos = -d * rot_mat;
for (int i = 0; i < 3; ++i)
{
geom_out.light_pos = light_pos;
geom_out.shad_idx = shadow_idxs;
geom_out.frag_pos = gl_in[i].gl_Position;
gl_Layer = gl_InvocationID;
vec4 clip_space_pos = proj * view * gl_in[i].gl_Position;
gl_Position = clip_space_pos;
geom_out.vsMaterialID = vs_in[gl_InvocationID].vsMaterialID;
geom_out.vsUV = vs_in[gl_InvocationID].vsUV;
EmitVertex();
}
EndPrimitive();
}
@@ -0,0 +1,71 @@
//*VERTEX*
#version 460
struct ShadowMapSet
{
uint entity_id;
uint shadow_id;
uint shadow_texture_id;
uint frame_buffer_id;
float near_plane[8];
float far_plane[8];
mat4 light_space_proj[6];
mat4 light_space_view[6];
};
struct SpotShadowMapSet
{
uint entity_id;
uint shadow_id;
uint shadow_texture_id;
uint frame_buffer_id;
float far_plane;
uint padding[3];
mat4 light_space_proj;
mat4 light_space_view;
};
struct PointShadowMapSet
{
uint entity_id;
uint shadow_id;
uint shadow_texture_id;
uint frame_buffer_id;
float near_plane;
float far_plane;
uint padding[2];
mat4 light_space_proj[6];
mat4 light_space_view;
};
layout(binding = 1) readonly buffer positions_buffer
{
mat4 model_matrix[];
};
layout (location = 0) in vec3 inPos; //12 bytes : 0
layout (location = 1) in vec2 inUV; //8 Bytes : 12
layout (location = 2) in uvec3 inChunkID; //12 Bytes : 20
layout (location = 3) in vec3 inNormal; //8 Bytes : 12
layout (location = 4) in vec3 inBiTangent;
layout (location = 5) in vec3 inTangent;
layout (location=0) out VS_OUT
{
vec2 vsUV;
flat uint vsMaterialID;
}vs_out;
void main()
{
uint chunkid = inChunkID[0];
mat4 model = model_matrix[chunkid];
gl_Position = model * vec4(inPos, 1.0);
vs_out.vsUV = inUV;
vs_out.vsMaterialID = inChunkID[1];
}
@@ -34,30 +34,19 @@ layout (location=0) in VS_OUT
flat uint vsMaterialID;
}vs_out;
layout (location=0) out vec4 output_colour;
void main()
{
MaterialStore mat = materials[vs_out.vsMaterialID];
vec4 diffuse_val = mat.diffuse_colour;
output_colour = vec4(1,0,0,1);
if(mat.diffuse_texture_id != INVALID_HYDRA_ID)
{
output_colour = vec4(0,1,0,1);
uvec2 diffuse_handle = textures[mat.diffuse_texture_id];
diffuse_val = diffuse_val * texture(sampler2D(diffuse_handle), vs_out.vsUV.xy);
if(mat.diffuse_texture_id== 10)
{
output_colour = vec4(0,0,1,1);
}
}
if(diffuse_val[3] < 1.0)
{
discard;
output_colour = vec4(0,1,1,1);
}
}
@@ -7,14 +7,12 @@
#include "../ecs/components/HydraMeshComponent.h"
#include "../ecs/components/HydraRenderableComponent.h"
#include "../ecs/components/HydraMaterialComponent.h"
#include "../ecs/components/HydraPointShadowSourceComponent.h"
#include "../ecs/components/HydraLightComponent.h"
#include "../buffer/HydraLightBufferManager.h"
#include "../buffer/HydraLightBuffer.h"
void HydraPointLightActor::InitialiseComponents()
{
HydraLightComponent light_comp = {};
@@ -29,6 +27,9 @@ void HydraPointLightActor::InitialiseComponents()
HydraPositionComponent position_component;
ecs->AddComponent<HydraPositionComponent>(GetID(), position_component);
HydraPointShadowSourceComponent shadow_component = {};
ecs->AddComponent<HydraPointShadowSourceComponent>(GetID(), shadow_component);
}
void HydraPointLightActor::Destroy()
@@ -18,9 +18,14 @@ void HydraShadowBufferManager::Initialise()
{
m_available_spot.push(i);
}
for(uint32_t i = 0; i < MAX_POINT_SHADOWS; i++)
{
m_available_point.push(i);
}
m_directional_shadow_buffer.resize(MAX_DIRECTIONAL_SHADOWS);
m_spot_shadow_buffer.resize(MAX_SPOT_SHADOWS);
m_point_shadow_buffer.resize(MAX_POINT_SHADOWS);
uint32_t buffer_size = (MAX_DIRECTIONAL_SHADOWS * sizeof(HydraDirectionalShadowSourceComponent));
@@ -35,10 +40,17 @@ void HydraShadowBufferManager::Initialise()
HydraCreateGPUBufferTask *spot_task = static_cast<HydraCreateGPUBufferTask *>(task_scheduler->GetTask(create_gpu_buffer_task_id));
spot_task->Intialise("SpotShadowBuffer", 1, buffer_size, &m_spot_shadow_buffer_id, HYDRA_BUFFER_TYPE::HYDRA_SSBO_BUFFER);
task_scheduler->WaitForTask(create_gpu_buffer_task_id);
buffer_size = (MAX_POINT_SHADOWS * sizeof(HydraPointShadowSourceComponent));
create_gpu_buffer_task_id = task_scheduler->CreateTask<HydraCreateGPUBufferTask>(HydraThreadAffinity::Render);
HydraCreateGPUBufferTask *point_task = static_cast<HydraCreateGPUBufferTask *>(task_scheduler->GetTask(create_gpu_buffer_task_id));
point_task->Intialise("PointShadowBuffer", 1, buffer_size, &m_point_shadow_buffer_id, HYDRA_BUFFER_TYPE::HYDRA_SSBO_BUFFER);
task_scheduler->WaitForTask(create_gpu_buffer_task_id);
}
void HydraShadowBufferManager::Shutdown()
{
}
HydraID HydraShadowBufferManager::AddDirectionalShadow(HydraDirectionalShadowSourceComponent shadow)
{
@@ -66,6 +78,19 @@ HydraID HydraShadowBufferManager::AddSpotShadow(HydraSpotShadowSourceComponent s
return shadow_id;
}
HydraID HydraShadowBufferManager::AddPointShadow(HydraPointShadowSourceComponent shadow)
{
std::lock_guard<std::mutex> lock(m_mutex);
if(m_available_point.size() == 0)
{
return INVALID_HYDRA_ID;
}
HydraID shadow_id = m_available_point.front();
m_point_shadow_buffer[shadow_id] = shadow;
return shadow_id;
}
void HydraShadowBufferManager::UpdateDirectionalShadow(HydraID shadow_id, HydraDirectionalShadowSourceComponent shadow)
{
std::lock_guard<std::mutex> lock(m_mutex);
@@ -84,6 +109,15 @@ void HydraShadowBufferManager::UpdateSpotShadow(HydraID shadow_id, HydraSpotShad
}
}
void HydraShadowBufferManager::UpdatePointShadow(HydraID shadow_id, HydraPointShadowSourceComponent shadow)
{
std::lock_guard<std::mutex> lock(m_mutex);
if(shadow_id < MAX_SPOT_SHADOWS)
{
m_point_shadow_buffer[shadow_id] = shadow;
}
}
void HydraShadowBufferManager::RemoveDirectionalShadow(HydraID shadow_id)
{
@@ -93,6 +127,10 @@ void HydraShadowBufferManager::RemoveSpotShadow(HydraID shadow_id)
}
void HydraShadowBufferManager::RemovePointShadow(HydraID shadow_id)
{
}
void HydraShadowBufferManager::UpdateShadowBuffer()
{
HydraEngine *engine = GetEngine();
@@ -112,4 +150,11 @@ void HydraShadowBufferManager::UpdateShadowBuffer()
HydraUpdateWholeGPUBufferTask *spot_task = static_cast<HydraUpdateWholeGPUBufferTask *>(task_scheduler->GetTask(update_buffer_task_id));
spot_task->Intialise(m_spot_shadow_buffer_id, spot_buffer);
task_scheduler->WaitForTask(update_buffer_task_id);
void *point_buffer = static_cast<void *>(m_point_shadow_buffer.data());
update_buffer_task_id = task_scheduler->CreateTask<HydraUpdateWholeGPUBufferTask>(HydraThreadAffinity::Render);
HydraUpdateWholeGPUBufferTask *point_task = static_cast<HydraUpdateWholeGPUBufferTask *>(task_scheduler->GetTask(update_buffer_task_id));
point_task->Intialise(m_point_shadow_buffer_id, point_buffer);
task_scheduler->WaitForTask(update_buffer_task_id);
}
@@ -5,6 +5,7 @@
#include "HydraShadowBuffer.h"
#include "../ecs/components/HydraDirectionalShadowSourceComponent.h"
#include "../ecs/components/HydraSpotShadowSourceComponent.h"
#include "../ecs/components/HydraPointShadowSourceComponent.h"
#include <queue>
#include <mutex>
@@ -16,18 +17,27 @@ class HydraShadowBufferManager : public HydraObject
void Shutdown();
HydraID AddDirectionalShadow(HydraDirectionalShadowSourceComponent shadow);
HydraID AddSpotShadow(HydraSpotShadowSourceComponent shadow);
HydraID AddPointShadow(HydraPointShadowSourceComponent shadow);
void UpdateDirectionalShadow(HydraID shadow_id, HydraDirectionalShadowSourceComponent shadow);
void UpdateSpotShadow(HydraID shadow_id, HydraSpotShadowSourceComponent shadow);
void UpdatePointShadow(HydraID shadow_id, HydraPointShadowSourceComponent shadow);
void RemoveDirectionalShadow(HydraID shadow_id);
void RemoveSpotShadow(HydraID shadow_id);
void RemovePointShadow(HydraID shadow_id);
void UpdateShadowBuffer();
private:
std::vector<HydraDirectionalShadowSourceComponent> m_directional_shadow_buffer;
std::vector<HydraSpotShadowSourceComponent> m_spot_shadow_buffer;
std::vector<HydraPointShadowSourceComponent> m_point_shadow_buffer;
std::queue<HydraID> m_available_dir;
std::queue<HydraID> m_available_spot;
std::queue<HydraID> m_available_point;
uint32_t m_directional_shadow_buffer_id;
uint32_t m_spot_shadow_buffer_id;
uint32_t m_point_shadow_buffer_id;
std::mutex m_mutex;
};
@@ -116,12 +116,10 @@ HydraID HydraTextureBufferManager::CreateTextureArray(std::string texture_name,
)
{
uint32_t gl_tex_id = 0;
glCreateTextures(GL_TEXTURE_2D_ARRAY, 1, &gl_tex_id);
glCreateTextures(GL_TEXTURE_2D_ARRAY,1, &gl_tex_id);
glBindTexture(GL_TEXTURE_2D_ARRAY, gl_tex_id);
glTextureStorage3D(gl_tex_id, 1, internal_format, width, height, levels);
glTextureParameteri(gl_tex_id, GL_TEXTURE_MIN_FILTER, min_filter);
glTextureParameteri(gl_tex_id, GL_TEXTURE_MAG_FILTER, mag_filter);
@@ -144,6 +142,44 @@ HydraID HydraTextureBufferManager::CreateTextureArray(std::string texture_name,
return texture_id;
}
HydraID HydraTextureBufferManager::CreateCubemapTexture(std::string texture_name, uint32_t width, uint32_t height, uint32_t internal_format, uint32_t min_filter, uint32_t mag_filter)
{
uint32_t gl_tex_id = 0;
glGenTextures(1, &gl_tex_id);
glBindTexture(GL_TEXTURE_CUBE_MAP, gl_tex_id);
for(uint32_t i = 0; i < 6; i++)
{
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, internal_format, SHADOW_MAP_SIZE, SHADOW_MAP_SIZE, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);
}
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, min_filter);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, mag_filter);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
HydraTextureBuffer texture_buffer = {};
HydraID texture_id = _GetTextureID();
texture_buffer.texture_id = texture_id;
texture_buffer.format = 0;
texture_buffer.internal_format = internal_format;
texture_buffer.width = width;
texture_buffer.height = height;
texture_buffer.gl_tex_id = gl_tex_id;
texture_buffer.mag_filter = mag_filter;
texture_buffer.min_filter = min_filter;
m_textures[texture_id] = texture_buffer;
m_texture_lookup.insert(std::pair<std::string, HydraID>(texture_name, texture_id));
return texture_id;
}
HydraID HydraTextureBufferManager::CreateTexture(std::string texture_name,
uint32_t width,
uint32_t height,
@@ -206,10 +242,11 @@ void HydraTextureBufferManager::BindTexture(HydraID texture_id, uint32_t target)
}
HydraTextureBuffer texture = m_textures[texture_id];
glBindTexture(target, texture.gl_tex_id);
glTextureParameteri(texture.gl_tex_id, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTextureParameteri(texture.gl_tex_id, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTextureParameteri(texture.gl_tex_id, GL_TEXTURE_MIN_FILTER, texture.min_filter);
glTextureParameteri(texture.gl_tex_id, GL_TEXTURE_MAG_FILTER, texture.mag_filter);
// glTextureParameteri(texture.gl_tex_id, GL_TEXTURE_WRAP_S, GL_REPEAT);
// glTextureParameteri(texture.gl_tex_id, GL_TEXTURE_WRAP_T, GL_REPEAT);
// glTextureParameteri(texture.gl_tex_id, GL_TEXTURE_MIN_FILTER, texture.min_filter);
// glTextureParameteri(texture.gl_tex_id, GL_TEXTURE_MAG_FILTER, texture.mag_filter);
texture.texture_binding = glGetTextureHandleARB(texture.gl_tex_id);
glMakeTextureHandleResidentARB(texture.texture_binding);
@@ -30,7 +30,14 @@ class HydraTextureBufferManager : public HydraObject
uint32_t min_filter,
uint32_t mag_filter,
uint32_t levels);
HydraID CreateCubemapTexture(std::string texture_name,
uint32_t width,
uint32_t height,
uint32_t internal_format,
uint32_t min_filter,
uint32_t mag_filter);
void BindTexture(HydraID texture_id, uint32_t target);
void UnbindTexture(HydraID texture_id);
void DeleteTexture(HydraID texture_id);
HydraID LoadTexture(std::string texture_filename);
@@ -0,0 +1,18 @@
#ifndef HYDRAPOINTSHADOWSOUCECOMPONENT
#define HYDRAPOINTSHADOWSOUCECOMPONENT
#include "../../engine/HydraEngine.h"
struct HydraPointShadowSourceComponent
{
uint32_t entity_id;
uint32_t shadow_id;
uint32_t shadow_texture_id;
uint32_t frame_buffer_id;
float near_plane;
float far_plane;
uint32_t padding[2];
glm::mat4 light_space_proj;
glm::mat4 light_space_view[6];
};
#endif /* HYDRAPOINTSHADOWSOUCECOMPONENT */
@@ -0,0 +1,114 @@
#include "HydraPointShadowSourceSystem.h"
#include "../../engine/HydraEngine.h"
#include "../../camera/HydraCamera.h"
#include "../HydraECS.h"
#include "../components/HydraPointShadowSourceComponent.h"
#include "../components/HydraPositionComponent.h"
#include "../components/HydraLightComponent.h"
#include "../../buffer/HydraShadowBuffer.h"
#include "../../buffer/HydraTextureBufferManager.h"
#include "../../buffer/HydraShadowBufferManager.h"
#include "../../scheduler/HydraTaskScheduler.h"
#include "../../task/buffer/HydraCreateGPUBufferTask.hpp"
#include "../../task/buffer/HydraUpdateWholeGPUBufferTask.hpp"
#include "../../task/buffer/HydraUpdatePartialGPUBufferTask.hpp"
#include "../../task/buffer/HydraCreateUnBoundTextureTask.hpp"
#include "../../task/renderer/HydraCreateCubemapShadowFrameBuffer.hpp"
#include "../../task/renderer/HydraCreateShadowFrameBuffer.hpp"
#include "../../actor/HydraActorManager.h"
void HydraPointShadowSourceSystem::Initialise()
{
}
void HydraPointShadowSourceSystem::InitialiseComponent(HydraID entity_id)
{
HydraEngine *engine = GetEngine();
HydraECS *ecs = engine->ECS();
HydraLightComponent &light_comp = ecs->GetComponent<HydraLightComponent>(entity_id);
HydraPointShadowSourceComponent& shadow_comp = ecs->GetComponent<HydraPointShadowSourceComponent>(entity_id);
HydraID shadow_id = GetEngine()->ShadowBufferManager()->AddPointShadow(shadow_comp);
assert(shadow_id != INVALID_HYDRA_ID && "Add point Shadow - out of shadows!");
light_comp.shadow_map_id = shadow_id;
light_comp.shadow_caster = 1;
shadow_comp.shadow_id = shadow_id;
_InitialiseShadowMap(entity_id);
}
void HydraPointShadowSourceSystem::UpdateSystem(float delta_t_seconds)
{
for (HydraID entity_id : Entities)
{
_UpdateShadowMap(entity_id);
}
}
void HydraPointShadowSourceSystem::_UpdateShadowMap(HydraID entity_id)
{
HydraEngine *engine = GetEngine();
HydraECS *ecs = engine->ECS();
HydraPositionComponent pos_comp = ecs->GetComponent<HydraPositionComponent>(entity_id);
HydraPointShadowSourceComponent &shad_comp = ecs->GetComponent<HydraPointShadowSourceComponent>(entity_id);
float view_size = 4.0f;
float view_near = 0.1f;
float view_far = 100.0f;
glm::vec3 camera_pos = GetEngine()->Camera()->GetPosition();
float aspect = (float)SHADOW_MAP_SIZE/(float)SHADOW_MAP_SIZE;
float width = SHADOW_MAP_SIZE;
float fov = glm::radians(90.0f);
glm::mat4 shadow_proj = glm::perspectiveFovLH<float>(fov, width, width, view_near, view_far);
//glm::mat4 shadow_proj = glm::perspective<float>(fov, 1.0f, view_near, view_far);
glm::vec3 light_pos = pos_comp.position;
//GL_TEXTURE_CUBE_MAP_POSITIVE_X - left
shad_comp.light_space_view[0] = glm::lookAt(light_pos, light_pos + glm::vec3(1.0, 0.0, 0.0), glm::vec3(0.0, 1.0, 0.0));
//GL_TEXTURE_CUBE_MAP_NEGATIVE_X - right
shad_comp.light_space_view[1] = glm::lookAt(light_pos, light_pos + glm::vec3(-1.0, 0.0, 0.0), glm::vec3(0.0, 1.0, 0.0));
//GL_TEXTURE_CUBE_MAP_POSITIVE_Y - Up
shad_comp.light_space_view[2] = glm::lookAt(light_pos, light_pos + glm::vec3(0.0, 1.0, 0.0), glm::vec3(0.0, 0.0, 1.0));
//GL_TEXTURE_CUBE_MAP_NEGATIVE_Y - down
shad_comp.light_space_view[3] = glm::lookAt(light_pos, light_pos + glm::vec3(0.0, -1.0, 0.0), glm::vec3(0.0, 0.0, 1.0));
//GL_TEXTURE_CUBE_MAP_POSITIVE_Z - back
shad_comp.light_space_view[4] = glm::lookAt(light_pos, light_pos + glm::vec3(0.0, 0.0, 1.0), glm::vec3(0.0, 1.0, 0.0));
//GL_TEXTURE_CUBE_MAP_NEGATIVE_Z - forward
shad_comp.light_space_view[5] = glm::lookAt(light_pos, light_pos + glm::vec3(0.0, 0.0, -1.0), glm::vec3(0.0, 1.0, 0.0));
shad_comp.light_space_proj = shadow_proj;
shad_comp.far_plane = view_far;
GetEngine()->ShadowBufferManager()->UpdatePointShadow(shad_comp.shadow_id, shad_comp);
}
void HydraPointShadowSourceSystem::_InitialiseShadowMap(HydraID entity_id)
{
HydraEngine *engine = GetEngine();
HydraECS *ecs = engine->ECS();
HydraTextureBufferManager *tex_man = engine->TextureBufferManager();
HydraPointShadowSourceComponent &shad_comp = ecs->GetComponent<HydraPointShadowSourceComponent>(entity_id);
HydraLightComponent &light_comp = ecs->GetComponent<HydraLightComponent>(entity_id);
shad_comp.entity_id = entity_id;
HydraTaskScheduler *task_scheduler = GetEngine()->TaskScheduler();
uint32_t depth_texture_id = 0;
HydraID create_framebuffer_task_id = task_scheduler->CreateTask<HydraCreateCubemapShadowFrameBuffer>(HydraThreadAffinity::Render);
HydraCreateCubemapShadowFrameBuffer *fb_task = static_cast<HydraCreateCubemapShadowFrameBuffer *>(task_scheduler->GetTask(create_framebuffer_task_id));
fb_task->Initialise(&shad_comp.shadow_texture_id, &depth_texture_id, &shad_comp.frame_buffer_id);
task_scheduler->WaitForTask(create_framebuffer_task_id);
shad_comp.shadow_texture_id = depth_texture_id;
}
@@ -0,0 +1,26 @@
#ifndef HYDRAPOINTSHADOWSOURCESYSTEM
#define HYDRAPOINTSHADOWSOURCESYSTEM
#include "../../engine/HydraObject.h"
#include "../HydraSystem.h"
#include "../components/HydraPointShadowSourceComponent.h"
#include <GLMIncludes.h>
#include <queue>
#include <vector>
#include <mutex>
class HydraPointShadowSourceSystem : public HydraSystem
{
public:
virtual void Initialise() override;
protected:
void InitialiseComponent(HydraID entity_id) override;
void UpdateSystem(float delta_t_seconds) override;
private:
void _UpdateShadowMap(HydraID entity_id);
void _InitialiseShadowMap(HydraID entity_id);
std::mutex m_mutex;
};
#endif /* HYDRAPOINTSHADOWSOURCESYSTEM */
+17
View File
@@ -23,6 +23,7 @@
#include "../ecs/systems/HydraLightSystem.h"
#include "../ecs/systems/HydraDirectionalShadowSourceSystem.h"
#include "../ecs/systems/HydraSpotShadowSourceSystem.h"
#include "../ecs/systems/HydraPointShadowSourceSystem.h"
#include "../ecs/components/HydraPositionComponent.h"
#include "../ecs/components/HydraMeshComponent.h"
@@ -32,6 +33,7 @@
#include "../ecs/components/HydraLightComponent.h"
#include "../ecs/components/HydraDirectionalShadowSourceComponent.h"
#include "../ecs/components/HydraSpotShadowSourceComponent.h"
#include "../ecs/components/HydraPointShadowSourceComponent.h"
#include "../camera/HydraCamera.h"
@@ -231,6 +233,7 @@ void HydraEngine::_InitialiseSystems()
m_ecs->RegisterComponentType<HydraLightComponent>();
m_ecs->RegisterComponentType<HydraDirectionalShadowSourceComponent>();
m_ecs->RegisterComponentType<HydraSpotShadowSourceComponent>();
m_ecs->RegisterComponentType<HydraPointShadowSourceComponent>();
m_mesh_system = m_ecs->RegisterSystem<HydraMeshSystem>();
m_transform_system = m_ecs->RegisterSystem<HydraTransformSystem>();
@@ -239,6 +242,8 @@ void HydraEngine::_InitialiseSystems()
m_light_system = m_ecs->RegisterSystem<HydraLightSystem>();
m_directional_shadow_system = m_ecs->RegisterSystem<HydraDirectionalShadowSourceSystem>();
m_spot_shadow_system = m_ecs->RegisterSystem<HydraSpotShadowSourceSystem>();
m_point_shadow_system = m_ecs->RegisterSystem<HydraPointShadowSourceSystem>();
HydraSignature mesh_sig;
HydraSignature trans_sig;
@@ -247,6 +252,7 @@ void HydraEngine::_InitialiseSystems()
HydraSignature light_sig;
HydraSignature directional_shadow_sig;
HydraSignature spot_shadow_sig;
HydraSignature point_shadow_sig;
mesh_sig.set(m_ecs->GetComponentType<HydraMeshComponent>(),true);
trans_sig.set(m_ecs->GetComponentType<HydraPositionComponent>(),true);
@@ -264,6 +270,10 @@ void HydraEngine::_InitialiseSystems()
spot_shadow_sig.set(m_ecs->GetComponentType<HydraPositionComponent>(), true);
spot_shadow_sig.set(m_ecs->GetComponentType<HydraSpotShadowSourceComponent>(), true);
point_shadow_sig.set(m_ecs->GetComponentType<HydraLightComponent>(), true);
point_shadow_sig.set(m_ecs->GetComponentType<HydraPositionComponent>(), true);
point_shadow_sig.set(m_ecs->GetComponentType<HydraPointShadowSourceComponent>(), true);
m_ecs->SetSystemSignature<HydraMeshSystem>(mesh_sig);
m_ecs->SetSystemSignature<HydraTransformSystem>(trans_sig);
m_ecs->SetSystemSignature<HydraRenderSystem>(render_sig);
@@ -271,6 +281,7 @@ void HydraEngine::_InitialiseSystems()
m_ecs->SetSystemSignature<HydraLightSystem>(light_sig);
m_ecs->SetSystemSignature<HydraDirectionalShadowSourceSystem>(directional_shadow_sig);
m_ecs->SetSystemSignature<HydraSpotShadowSourceSystem>(spot_shadow_sig);
m_ecs->SetSystemSignature<HydraPointShadowSourceSystem>(point_shadow_sig);
}
@@ -305,9 +316,15 @@ void HydraEngine::_InitialiseSystems()
HydraID update_spot_shadow_id = m_task_scheduler->CreateTask<HydraUpdateSystemTask>(HydraThreadAffinity::General, shadow_barrier);
HydraUpdateSystemTask* update_spot_shadow_task = static_cast<HydraUpdateSystemTask*>(m_task_scheduler->GetTask(update_spot_shadow_id));
update_spot_shadow_task->Initialise(m_delta_t, m_spot_shadow_system);
HydraID update_point_shadow_id = m_task_scheduler->CreateTask<HydraUpdateSystemTask>(HydraThreadAffinity::General, shadow_barrier);
HydraUpdateSystemTask* update_point_shadow_task = static_cast<HydraUpdateSystemTask*>(m_task_scheduler->GetTask(update_point_shadow_id));
update_point_shadow_task->Initialise(m_delta_t, m_point_shadow_system);
m_task_scheduler->StartTask(update_shadow_id);
m_task_scheduler->StartTask(update_spot_shadow_id);
m_task_scheduler->StartTask(update_point_shadow_id);
m_task_scheduler->WaitForBarrier(shadow_barrier);
m_shadow_buffer_manager->UpdateShadowBuffer();
+2 -1
View File
@@ -28,6 +28,7 @@ class HydraLightSystem;
class HydraDirectionalShadowSourceSystem;
class HydraSpotShadowSourceSystem;
class HydraShadowBufferManager;
class HydraPointShadowSourceSystem;
class CLASS_DEFINE HydraEngine : public HydraObject
{
@@ -98,7 +99,7 @@ private:
std::shared_ptr<HydraLightSystem> m_light_system;
std::shared_ptr<HydraDirectionalShadowSourceSystem> m_directional_shadow_system;
std::shared_ptr<HydraSpotShadowSourceSystem> m_spot_shadow_system;
std::shared_ptr<HydraPointShadowSourceSystem> m_point_shadow_system;
bool m_running = true;
float m_delta_t = 0.0f;
@@ -14,7 +14,9 @@
#include "../ecs/systems/HydraDirectionalShadowSourceSystem.h"
#include "../ecs/components/HydraDirectionalShadowSourceComponent.h"
#include "../ecs/systems/HydraSpotShadowSourceSystem.h"
#include "../ecs/systems/HydraPointShadowSourceSystem.h"
#include "../ecs/components/HydraSpotShadowSourceComponent.h"
#include "../ecs/components/HydraPointShadowSourceComponent.h"
#include "../mesh/StandardVertex.h"
#include "../actor/HydraActorManager.h"
#include "../actor/HydraOutputActor.h"
@@ -237,6 +239,7 @@ void HydraDeferredPipeline::_CreateOutputRenderStage()
HydraID light_buffer_id = buffer_manager->FindBuffer("LightBuffer");
HydraID directional_shadow_buffer_id = buffer_manager->FindBuffer("DirectionalShadowBuffer");
HydraID spot_shadow_buffer_id = buffer_manager->FindBuffer("SpotShadowBuffer");
HydraID point_shadow_buffer_id = buffer_manager->FindBuffer("PointShadowBuffer");
HydraShaderBinding shader_binding = {};
shader_binding.block_name.push_back("position_buffer");
@@ -274,6 +277,11 @@ void HydraDeferredPipeline::_CreateOutputRenderStage()
shader_binding.buffer_id.push_back(spot_shadow_buffer_id);
shader_binding.buffer_type.push_back(HYDRA_BUFFER_TYPE::HYDRA_SSBO_BUFFER);
shader_binding.block_name.push_back("point_shadow_map_sets");
shader_binding.binding_point.push_back(7);
shader_binding.buffer_id.push_back(point_shadow_buffer_id);
shader_binding.buffer_type.push_back(HYDRA_BUFFER_TYPE::HYDRA_SSBO_BUFFER);
render_stage->Initialise(shader_path + "deferred_output_shader.vert",
shader_path + "deferred_output_shader.frag", "",
shader_binding,
@@ -288,7 +296,7 @@ void HydraDeferredPipeline::_CreateOutputRenderStage()
void HydraDeferredPipeline::_CreateTextureDebugOutputStage()
{
HydraRenderStage* render_stage = new HydraRenderStage();
HydraRenderStage* render_stage = new HydraRenderStage();
std::string shader_path = std::string(shader_base);
HydraBufferManager* buffer_manager = GetEngine()->BufferManager();
@@ -13,6 +13,7 @@
#include "../ecs/systems/HydraRenderSystem.h"
#include "../ecs/systems/HydraDirectionalShadowSourceSystem.h"
#include "../ecs/systems/HydraSpotShadowSourceSystem.h"
#include "../ecs/systems/HydraPointShadowSourceSystem.h"
#include "../ecs/components/HydraLightComponent.h"
#include "../mesh/StandardVertex.h"
#include "../actor/HydraActorManager.h"
@@ -20,10 +21,11 @@
void HydraShadowPipeline::Initialise()
{
m_render_stages.resize(2);
m_render_stages.resize(3);
_CreateUBOs();
_CreateDirectionalRenderStage();
_CreateSpotRenderStage();
_CreatePointRenderStage();
}
void HydraShadowPipeline::Shutdown()
@@ -40,9 +42,33 @@ void HydraShadowPipeline::Render()
_RenderDirectionalShadowMaps();
_RenderSpotShadowMaps();
_RenderPointShadowMaps();
}
void HydraShadowPipeline::_RenderPointShadowMaps()
{
HydraECS *ecs = GetEngine()->ECS();
std::shared_ptr<HydraRenderSystem> render_system = ecs->GetSystem<HydraRenderSystem>();
std::shared_ptr<HydraPointShadowSourceSystem> shadow_system = ecs->GetSystem<HydraPointShadowSourceSystem>();
for (HydraID entity_id : shadow_system->Entities)
{
HydraPointShadowSourceComponent shad_comp = GetEngine()->ECS()->GetComponent<HydraPointShadowSourceComponent>(entity_id);
HydraLightComponent light_comp = GetEngine()->ECS()->GetComponent<HydraLightComponent>(entity_id);
_UpdateUBO(light_comp.shadow_map_id);
glBindFramebuffer(GL_FRAMEBUFFER, shad_comp.frame_buffer_id);
float depth_value = 1.0f;
glClear(GL_DEPTH_BUFFER_BIT);
m_render_stages[POINT_RENDER_STAGE]->Render(render_system->Entities, INVALID_HYDRA_ID);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
}
void HydraShadowPipeline::_RenderDirectionalShadowMaps()
{
HydraECS *ecs = GetEngine()->ECS();
@@ -58,9 +84,7 @@ void HydraShadowPipeline::_RenderDirectionalShadowMaps()
glBindFramebuffer(GL_FRAMEBUFFER, shad_comp.frame_buffer_id);
float depth_value = 1.0f;
float clear_colour[] = {0,0,0};
glClearNamedFramebufferfv(shad_comp.frame_buffer_id, GL_DEPTH, 0, &depth_value);
glClearNamedFramebufferfv(shad_comp.frame_buffer_id, GL_COLOR, 0, clear_colour);
m_render_stages[DIRECTIONAL_RENDER_STAGE]->Render(render_system->Entities, INVALID_HYDRA_ID);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
@@ -81,14 +105,66 @@ void HydraShadowPipeline::_RenderSpotShadowMaps()
glBindFramebuffer(GL_FRAMEBUFFER, shad_comp.frame_buffer_id);
float depth_value = 1.0f;
float clear_colour[] = {0,0,0};
glClearNamedFramebufferfv(shad_comp.frame_buffer_id, GL_DEPTH, 0, &depth_value);
glClearNamedFramebufferfv(shad_comp.frame_buffer_id, GL_COLOR, 0, clear_colour);
m_render_stages[SPOT_RENDER_STAGE]->Render(render_system->Entities, INVALID_HYDRA_ID);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
}
void HydraShadowPipeline::_CreatePointRenderStage()
{
HydraRenderStage *render_stage = new HydraRenderStage();
std::string shader_path = std::string(shader_base);
HydraBufferManager *buffer_manager = GetEngine()->BufferManager();
HydraID pos_buffer_id = buffer_manager->FindBuffer("PositionsBuffer");
HydraID mat_buffer_id = buffer_manager->FindBuffer("MaterialBuffer");
HydraID tex_buffer_id = buffer_manager->FindBuffer("TextureBuffer");
HydraID shadow_buffer_id = buffer_manager->FindBuffer("PointShadowBuffer");
HydraID per_frame_buffer_id = buffer_manager->FindBuffer("ShadowPerFrameUBO");
HydraShaderBinding shader_binding = {};
shader_binding.block_name.push_back("positions_buffer");
shader_binding.binding_point.push_back(1);
shader_binding.buffer_id.push_back(pos_buffer_id);
shader_binding.buffer_type.push_back(HYDRA_BUFFER_TYPE::HYDRA_SSBO_BUFFER);
shader_binding.block_name.push_back("material_buffer");
shader_binding.binding_point.push_back(2);
shader_binding.buffer_id.push_back(mat_buffer_id);
shader_binding.buffer_type.push_back(HYDRA_BUFFER_TYPE::HYDRA_SSBO_BUFFER);
shader_binding.block_name.push_back("texture_buffer");
shader_binding.binding_point.push_back(3);
shader_binding.buffer_id.push_back(tex_buffer_id);
shader_binding.buffer_type.push_back(HYDRA_BUFFER_TYPE::HYDRA_SSBO_BUFFER);
shader_binding.block_name.push_back("point_shadow_map_sets");
shader_binding.binding_point.push_back(7);
shader_binding.buffer_id.push_back(shadow_buffer_id);
shader_binding.buffer_type.push_back(HYDRA_BUFFER_TYPE::HYDRA_SSBO_BUFFER);
shader_binding.block_name.push_back("shadow_per_frame");
shader_binding.binding_point.push_back(1);
shader_binding.buffer_id.push_back(per_frame_buffer_id);
shader_binding.buffer_type.push_back(HYDRA_BUFFER_TYPE::HYDRA_UBO_BUFFER);
std::vector<uint32_t> textures;
render_stage->Initialise(shader_path + "shadow_point_shader.vert",
shader_path + "shadow_point_shader.frag",
shader_path + "shadow_point_shader.geom",
shader_binding,
0,
textures,
true,
GL_BACK,
true,
HYDRA_RENDERABLE_TYPE::HYDRA_COLOUR);
m_render_stages[POINT_RENDER_STAGE] = render_stage;
}
void HydraShadowPipeline::_CreateDirectionalRenderStage()
{
HydraRenderStage *render_stage = new HydraRenderStage();
@@ -137,7 +213,7 @@ void HydraShadowPipeline::_CreateDirectionalRenderStage()
0,
textures,
true,
GL_FRONT,
GL_BACK,
true,
HYDRA_RENDERABLE_TYPE::HYDRA_COLOUR);
m_render_stages[DIRECTIONAL_RENDER_STAGE] = render_stage;
@@ -191,7 +267,7 @@ void HydraShadowPipeline::_CreateSpotRenderStage()
0,
textures,
true,
GL_FRONT,
GL_BACK,
true,
HYDRA_RENDERABLE_TYPE::HYDRA_COLOUR);
m_render_stages[SPOT_RENDER_STAGE] = render_stage;
@@ -20,14 +20,17 @@ class HydraShadowPipeline : public HydraPipeline
void _CreateUBOs();
void _CreateSpotRenderStage();
void _CreateDirectionalRenderStage();
void _CreatePointRenderStage();
void _UpdateUBO(uint32_t shadow_idx);
void _BindFrameBufferAttachments(HydraID entity_id);
void _RenderDirectionalShadowMaps();
void _RenderPointShadowMaps();
void _RenderSpotShadowMaps();
HydraID m_per_frame_ubo = INVALID_HYDRA_ID;
const uint32_t DIRECTIONAL_RENDER_STAGE = 0;
const uint32_t SPOT_RENDER_STAGE = 1;
const uint32_t POINT_RENDER_STAGE = 2;
};
@@ -0,0 +1,61 @@
#ifndef HYDRACREATECUBEMAPSHADOWFRAMEBUFFER
#define HYDRACREATECUBEMAPSHADOWFRAMEBUFFER
#include "../HydraTask.h"
#include "../../engine/HydraEngine.h"
#include "../../renderer/HydraRenderer.h"
#include <GLMIncludes.h>
#include "../../GlewIncludes.h"
#include "../../buffer/HydraTextureBufferManager.h"
class HydraCreateCubemapShadowFrameBuffer : public HydraTask
{
private:
uint32_t *m_texture_id = 0;
uint32_t *m_depth_texture_id = 0;
uint32_t *m_frame_buffer_id = nullptr;
protected:
public:
void Process() override
{
HydraEngine *engine = GetEngine();
HydraTextureBufferManager *tex_buffer_manager = engine->TextureBufferManager();
HydraRenderSettings render_settings = engine->RenderSettings();
HydraTextureBuffer texture = tex_buffer_manager->GetTexture(*m_texture_id);
*m_depth_texture_id = tex_buffer_manager->CreateCubemapTexture("shadow_depth_buffer",
SHADOW_MAP_SIZE, SHADOW_MAP_SIZE,
GL_DEPTH_COMPONENT32F,
GL_NEAREST,
GL_NEAREST);
HydraTextureBuffer depth_texture = tex_buffer_manager->GetTexture(*m_depth_texture_id);
glCreateFramebuffers(1, m_frame_buffer_id);
glBindFramebuffer(GL_FRAMEBUFFER, *m_frame_buffer_id);
glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, depth_texture.gl_tex_id, 0);
glDrawBuffer(GL_NONE);
glReadBuffer(GL_NONE);
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE)
{
std::cout << "Framebuffer error: " << status << std::endl;
}
glBindFramebuffer(GL_FRAMEBUFFER, 0);
tex_buffer_manager->BindTexture(*m_depth_texture_id, GL_TEXTURE_CUBE_MAP);
}
void Initialise(uint32_t *texture_id, uint32_t *depth_texture_id, uint32_t *frame_buffer_id)
{
m_texture_id = texture_id;
m_frame_buffer_id = frame_buffer_id;
m_depth_texture_id = depth_texture_id;
}
};
#endif /* HYDRACREATECUBEMAPSHADOWFRAMEBUFFER */
@@ -25,14 +25,14 @@ public:
HydraTextureBufferManager *tex_buffer_manager = engine->TextureBufferManager();
HydraRenderSettings render_settings = engine->RenderSettings();
*m_texture_id = tex_buffer_manager->CreateTexture("shadow_FB",
SHADOW_MAP_SIZE, SHADOW_MAP_SIZE,
GL_RGBA8,
GL_NEAREST,
GL_NEAREST,
1);
// *m_texture_id = tex_buffer_manager->CreateTexture("shadow_FB",
// SHADOW_MAP_SIZE, SHADOW_MAP_SIZE,
// GL_RGBA8,
// GL_NEAREST,
// GL_NEAREST,
// 1);
HydraTextureBuffer texture = tex_buffer_manager->GetTexture(*m_texture_id);
// HydraTextureBuffer texture = tex_buffer_manager->GetTexture(*m_texture_id);
*m_depth_texture_id = tex_buffer_manager->CreateTexture("shadow_depth_buffer",
SHADOW_MAP_SIZE, SHADOW_MAP_SIZE,
@@ -45,8 +45,8 @@ public:
glGenFramebuffers(1, m_frame_buffer_id);
glBindFramebuffer(GL_FRAMEBUFFER, *m_frame_buffer_id);
glTextureParameteri(texture.gl_tex_id, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTextureParameteri(texture.gl_tex_id, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
// glTextureParameteri(texture.gl_tex_id, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
// glTextureParameteri(texture.gl_tex_id, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
// FIX 1: Set explicit filters for the depth texture to prevent incomplete attachment
glTextureParameteri(depth_texture.gl_tex_id, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
@@ -58,14 +58,14 @@ public:
glTextureParameteri(depth_texture.gl_tex_id, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
glTextureParameterfv(depth_texture.gl_tex_id, GL_TEXTURE_BORDER_COLOR, &border[0]);
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texture.gl_tex_id, 0);
//glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texture.gl_tex_id, 0);
glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, depth_texture.gl_tex_id, 0);
glNamedFramebufferDrawBuffer(*m_frame_buffer_id, GL_COLOR_ATTACHMENT0);
glNamedFramebufferReadBuffer(*m_frame_buffer_id, GL_COLOR_ATTACHMENT0);
// glNamedFramebufferDrawBuffer(*m_frame_buffer_id, GL_COLOR_ATTACHMENT0);
// glNamedFramebufferReadBuffer(*m_frame_buffer_id, GL_COLOR_ATTACHMENT0);
GLenum draw_buffers[] = {GL_COLOR_ATTACHMENT0};
glNamedFramebufferDrawBuffers(*m_frame_buffer_id, 1, draw_buffers);
// GLenum draw_buffers[] = {GL_COLOR_ATTACHMENT0};
glNamedFramebufferDrawBuffers(*m_frame_buffer_id, 0, nullptr);
GLenum status = glCheckNamedFramebufferStatus(*m_frame_buffer_id, GL_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE)
@@ -161,7 +161,7 @@
{
"directoryIndex" : 0,
"id" : "ALL_BUILD::@6890427a1f51a3e7e1df",
"jsonFile" : "target-ALL_BUILD-Debug-79cb89fa590649c6cd6a.json",
"jsonFile" : "target-ALL_BUILD-Debug-1b3c50ca02e96d15a11f.json",
"name" : "ALL_BUILD",
"projectIndex" : 0
},
@@ -182,7 +182,7 @@
{
"directoryIndex" : 1,
"id" : "HydraEngine::@fafd37b19aacd4c483ed",
"jsonFile" : "target-HydraEngine-Debug-c5670bbc5edcb254f4f2.json",
"jsonFile" : "target-HydraEngine-Debug-83a9a5954d1e93fe25f7.json",
"name" : "HydraEngine",
"projectIndex" : 1
},
@@ -355,7 +355,7 @@
{
"directoryIndex" : 0,
"id" : "ALL_BUILD::@6890427a1f51a3e7e1df",
"jsonFile" : "target-ALL_BUILD-Release-79cb89fa590649c6cd6a.json",
"jsonFile" : "target-ALL_BUILD-Release-1b3c50ca02e96d15a11f.json",
"name" : "ALL_BUILD",
"projectIndex" : 0
},
@@ -376,7 +376,7 @@
{
"directoryIndex" : 1,
"id" : "HydraEngine::@fafd37b19aacd4c483ed",
"jsonFile" : "target-HydraEngine-Release-88bc84ff8a06c001fb0b.json",
"jsonFile" : "target-HydraEngine-Release-fd732da53ad87180e5c2.json",
"name" : "HydraEngine",
"projectIndex" : 1
},
@@ -549,7 +549,7 @@
{
"directoryIndex" : 0,
"id" : "ALL_BUILD::@6890427a1f51a3e7e1df",
"jsonFile" : "target-ALL_BUILD-MinSizeRel-79cb89fa590649c6cd6a.json",
"jsonFile" : "target-ALL_BUILD-MinSizeRel-1b3c50ca02e96d15a11f.json",
"name" : "ALL_BUILD",
"projectIndex" : 0
},
@@ -570,7 +570,7 @@
{
"directoryIndex" : 1,
"id" : "HydraEngine::@fafd37b19aacd4c483ed",
"jsonFile" : "target-HydraEngine-MinSizeRel-3f820b7fb6c0cca80b22.json",
"jsonFile" : "target-HydraEngine-MinSizeRel-c9a2609fa141f4bef8ca.json",
"name" : "HydraEngine",
"projectIndex" : 1
},
@@ -743,7 +743,7 @@
{
"directoryIndex" : 0,
"id" : "ALL_BUILD::@6890427a1f51a3e7e1df",
"jsonFile" : "target-ALL_BUILD-RelWithDebInfo-79cb89fa590649c6cd6a.json",
"jsonFile" : "target-ALL_BUILD-RelWithDebInfo-1b3c50ca02e96d15a11f.json",
"name" : "ALL_BUILD",
"projectIndex" : 0
},
@@ -764,7 +764,7 @@
{
"directoryIndex" : 1,
"id" : "HydraEngine::@fafd37b19aacd4c483ed",
"jsonFile" : "target-HydraEngine-RelWithDebInfo-6380502de83523fc2633.json",
"jsonFile" : "target-HydraEngine-RelWithDebInfo-297d246892e18b3f6177.json",
"name" : "HydraEngine",
"projectIndex" : 1
},
@@ -27,7 +27,7 @@
"objects" :
[
{
"jsonFile" : "codemodel-v2-096b8a8b347f4803f005.json",
"jsonFile" : "codemodel-v2-5bd18c6e9c2d6656f777.json",
"kind" : "codemodel",
"version" :
{
@@ -100,7 +100,7 @@
}
},
{
"jsonFile" : "codemodel-v2-096b8a8b347f4803f005.json",
"jsonFile" : "codemodel-v2-5bd18c6e9c2d6656f777.json",
"kind" : "codemodel",
"version" :
{
@@ -22,10 +22,10 @@
"dependencies" :
[
{
"id" : "HydraClient::@6890427a1f51a3e7e1df"
"id" : "ZERO_CHECK::@6890427a1f51a3e7e1df"
},
{
"id" : "ZERO_CHECK::@6890427a1f51a3e7e1df"
"id" : "HydraClient::@6890427a1f51a3e7e1df"
},
{
"id" : "HydraEngine::@fafd37b19aacd4c483ed"
@@ -22,10 +22,10 @@
"dependencies" :
[
{
"id" : "HydraClient::@6890427a1f51a3e7e1df"
"id" : "ZERO_CHECK::@6890427a1f51a3e7e1df"
},
{
"id" : "ZERO_CHECK::@6890427a1f51a3e7e1df"
"id" : "HydraClient::@6890427a1f51a3e7e1df"
},
{
"id" : "HydraEngine::@fafd37b19aacd4c483ed"
@@ -22,10 +22,10 @@
"dependencies" :
[
{
"id" : "HydraClient::@6890427a1f51a3e7e1df"
"id" : "ZERO_CHECK::@6890427a1f51a3e7e1df"
},
{
"id" : "ZERO_CHECK::@6890427a1f51a3e7e1df"
"id" : "HydraClient::@6890427a1f51a3e7e1df"
},
{
"id" : "HydraEngine::@fafd37b19aacd4c483ed"
@@ -22,10 +22,10 @@
"dependencies" :
[
{
"id" : "HydraClient::@6890427a1f51a3e7e1df"
"id" : "ZERO_CHECK::@6890427a1f51a3e7e1df"
},
{
"id" : "ZERO_CHECK::@6890427a1f51a3e7e1df"
"id" : "HydraClient::@6890427a1f51a3e7e1df"
},
{
"id" : "HydraEngine::@fafd37b19aacd4c483ed"
@@ -212,30 +212,31 @@
49,
53,
55,
66,
68,
70,
72,
74,
76,
78,
80,
82,
84,
86,
88,
67,
69,
71,
73,
75,
77,
79,
81,
83,
85,
87,
89,
91,
94,
96,
98,
100,
102,
104,
106,
108,
110,
112,
116
97,
99,
101,
103,
105,
107,
109,
111,
113,
115,
119
]
}
],
@@ -335,30 +336,31 @@
49,
53,
55,
66,
68,
70,
72,
74,
76,
78,
80,
82,
84,
86,
88,
67,
69,
71,
73,
75,
77,
79,
81,
83,
85,
87,
89,
91,
94,
96,
98,
100,
102,
104,
106,
108,
110,
112,
116
97,
99,
101,
103,
105,
107,
109,
111,
113,
115,
119
]
},
{
@@ -409,34 +411,36 @@
63,
64,
65,
67,
69,
71,
73,
75,
77,
79,
81,
83,
85,
87,
89,
66,
68,
70,
72,
74,
76,
78,
80,
82,
84,
86,
88,
90,
92,
93,
95,
97,
99,
101,
103,
105,
107,
109,
111,
113,
96,
98,
100,
102,
104,
106,
108,
110,
112,
114,
115,
117
116,
117,
118,
120
]
}
],
@@ -774,6 +778,11 @@
"path" : "HydraEngine/source/ecs/components/HydraPhysicsComponent.h",
"sourceGroupIndex" : 1
},
{
"backtrace" : 1,
"path" : "HydraEngine/source/ecs/components/HydraPointShadowSourceComponent.h",
"sourceGroupIndex" : 1
},
{
"backtrace" : 1,
"path" : "HydraEngine/source/ecs/components/HydraPositionComponent.h",
@@ -838,6 +847,17 @@
"path" : "HydraEngine/source/ecs/systems/HydraMeshSystem.h",
"sourceGroupIndex" : 1
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "HydraEngine/source/ecs/systems/HydraPointShadowSourceSystem.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"path" : "HydraEngine/source/ecs/systems/HydraPointShadowSourceSystem.h",
"sourceGroupIndex" : 1
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
@@ -212,30 +212,31 @@
49,
53,
55,
66,
68,
70,
72,
74,
76,
78,
80,
82,
84,
86,
88,
67,
69,
71,
73,
75,
77,
79,
81,
83,
85,
87,
89,
91,
94,
96,
98,
100,
102,
104,
106,
108,
110,
112,
116
97,
99,
101,
103,
105,
107,
109,
111,
113,
115,
119
]
}
],
@@ -335,30 +336,31 @@
49,
53,
55,
66,
68,
70,
72,
74,
76,
78,
80,
82,
84,
86,
88,
67,
69,
71,
73,
75,
77,
79,
81,
83,
85,
87,
89,
91,
94,
96,
98,
100,
102,
104,
106,
108,
110,
112,
116
97,
99,
101,
103,
105,
107,
109,
111,
113,
115,
119
]
},
{
@@ -409,34 +411,36 @@
63,
64,
65,
67,
69,
71,
73,
75,
77,
79,
81,
83,
85,
87,
89,
66,
68,
70,
72,
74,
76,
78,
80,
82,
84,
86,
88,
90,
92,
93,
95,
97,
99,
101,
103,
105,
107,
109,
111,
113,
96,
98,
100,
102,
104,
106,
108,
110,
112,
114,
115,
117
116,
117,
118,
120
]
}
],
@@ -774,6 +778,11 @@
"path" : "HydraEngine/source/ecs/components/HydraPhysicsComponent.h",
"sourceGroupIndex" : 1
},
{
"backtrace" : 1,
"path" : "HydraEngine/source/ecs/components/HydraPointShadowSourceComponent.h",
"sourceGroupIndex" : 1
},
{
"backtrace" : 1,
"path" : "HydraEngine/source/ecs/components/HydraPositionComponent.h",
@@ -838,6 +847,17 @@
"path" : "HydraEngine/source/ecs/systems/HydraMeshSystem.h",
"sourceGroupIndex" : 1
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "HydraEngine/source/ecs/systems/HydraPointShadowSourceSystem.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"path" : "HydraEngine/source/ecs/systems/HydraPointShadowSourceSystem.h",
"sourceGroupIndex" : 1
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
@@ -212,30 +212,31 @@
49,
53,
55,
66,
68,
70,
72,
74,
76,
78,
80,
82,
84,
86,
88,
67,
69,
71,
73,
75,
77,
79,
81,
83,
85,
87,
89,
91,
94,
96,
98,
100,
102,
104,
106,
108,
110,
112,
116
97,
99,
101,
103,
105,
107,
109,
111,
113,
115,
119
]
}
],
@@ -335,30 +336,31 @@
49,
53,
55,
66,
68,
70,
72,
74,
76,
78,
80,
82,
84,
86,
88,
67,
69,
71,
73,
75,
77,
79,
81,
83,
85,
87,
89,
91,
94,
96,
98,
100,
102,
104,
106,
108,
110,
112,
116
97,
99,
101,
103,
105,
107,
109,
111,
113,
115,
119
]
},
{
@@ -409,34 +411,36 @@
63,
64,
65,
67,
69,
71,
73,
75,
77,
79,
81,
83,
85,
87,
89,
66,
68,
70,
72,
74,
76,
78,
80,
82,
84,
86,
88,
90,
92,
93,
95,
97,
99,
101,
103,
105,
107,
109,
111,
113,
96,
98,
100,
102,
104,
106,
108,
110,
112,
114,
115,
117
116,
117,
118,
120
]
}
],
@@ -774,6 +778,11 @@
"path" : "HydraEngine/source/ecs/components/HydraPhysicsComponent.h",
"sourceGroupIndex" : 1
},
{
"backtrace" : 1,
"path" : "HydraEngine/source/ecs/components/HydraPointShadowSourceComponent.h",
"sourceGroupIndex" : 1
},
{
"backtrace" : 1,
"path" : "HydraEngine/source/ecs/components/HydraPositionComponent.h",
@@ -838,6 +847,17 @@
"path" : "HydraEngine/source/ecs/systems/HydraMeshSystem.h",
"sourceGroupIndex" : 1
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "HydraEngine/source/ecs/systems/HydraPointShadowSourceSystem.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"path" : "HydraEngine/source/ecs/systems/HydraPointShadowSourceSystem.h",
"sourceGroupIndex" : 1
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
@@ -212,30 +212,31 @@
49,
53,
55,
66,
68,
70,
72,
74,
76,
78,
80,
82,
84,
86,
88,
67,
69,
71,
73,
75,
77,
79,
81,
83,
85,
87,
89,
91,
94,
96,
98,
100,
102,
104,
106,
108,
110,
112,
116
97,
99,
101,
103,
105,
107,
109,
111,
113,
115,
119
]
}
],
@@ -335,30 +336,31 @@
49,
53,
55,
66,
68,
70,
72,
74,
76,
78,
80,
82,
84,
86,
88,
67,
69,
71,
73,
75,
77,
79,
81,
83,
85,
87,
89,
91,
94,
96,
98,
100,
102,
104,
106,
108,
110,
112,
116
97,
99,
101,
103,
105,
107,
109,
111,
113,
115,
119
]
},
{
@@ -409,34 +411,36 @@
63,
64,
65,
67,
69,
71,
73,
75,
77,
79,
81,
83,
85,
87,
89,
66,
68,
70,
72,
74,
76,
78,
80,
82,
84,
86,
88,
90,
92,
93,
95,
97,
99,
101,
103,
105,
107,
109,
111,
113,
96,
98,
100,
102,
104,
106,
108,
110,
112,
114,
115,
117
116,
117,
118,
120
]
}
],
@@ -774,6 +778,11 @@
"path" : "HydraEngine/source/ecs/components/HydraPhysicsComponent.h",
"sourceGroupIndex" : 1
},
{
"backtrace" : 1,
"path" : "HydraEngine/source/ecs/components/HydraPointShadowSourceComponent.h",
"sourceGroupIndex" : 1
},
{
"backtrace" : 1,
"path" : "HydraEngine/source/ecs/components/HydraPositionComponent.h",
@@ -838,6 +847,17 @@
"path" : "HydraEngine/source/ecs/systems/HydraMeshSystem.h",
"sourceGroupIndex" : 1
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "HydraEngine/source/ecs/systems/HydraPointShadowSourceSystem.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"path" : "HydraEngine/source/ecs/systems/HydraPointShadowSourceSystem.h",
"sourceGroupIndex" : 1
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -24,6 +24,7 @@ C:\Code\HydraV3\HydraEngine\source\ecs\systems\HydraDirectionalShadowSourceSyste
C:\Code\HydraV3\HydraEngine\source\ecs\systems\HydraLightSystem.cpp;C:\Code\HydraV3\build\HydraEngine\HydraEngine.dir\Debug\HydraLightSystem.obj
C:\Code\HydraV3\HydraEngine\source\ecs\systems\HydraMaterialSystem.cpp;C:\Code\HydraV3\build\HydraEngine\HydraEngine.dir\Debug\HydraMaterialSystem.obj
C:\Code\HydraV3\HydraEngine\source\ecs\systems\HydraMeshSystem.cpp;C:\Code\HydraV3\build\HydraEngine\HydraEngine.dir\Debug\HydraMeshSystem.obj
C:\Code\HydraV3\HydraEngine\source\ecs\systems\HydraPointShadowSourceSystem.cpp;C:\Code\HydraV3\build\HydraEngine\HydraEngine.dir\Debug\HydraPointShadowSourceSystem.obj
C:\Code\HydraV3\HydraEngine\source\ecs\systems\HydraRenderSystem.cpp;C:\Code\HydraV3\build\HydraEngine\HydraEngine.dir\Debug\HydraRenderSystem.obj
C:\Code\HydraV3\HydraEngine\source\ecs\systems\HydraSpotShadowSourceSystem.cpp;C:\Code\HydraV3\build\HydraEngine\HydraEngine.dir\Debug\HydraSpotShadowSourceSystem.obj
C:\Code\HydraV3\HydraEngine\source\ecs\systems\HydraTransformSystem.cpp;C:\Code\HydraV3\build\HydraEngine\HydraEngine.dir\Debug\HydraTransformSystem.obj
@@ -1,4 +1,4 @@
^C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\CMAKECXXCOMPILERID.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAACTOR.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAACTORMANAGER.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRABUFFERMANAGER.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRACAMERA.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRADEFERREDPIPELINE.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRADIRECTIONALLIGHTACTOR.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRADIRECTIONALSHADOWSOURCESYSTEM.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAECS.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAENGINE.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAFORWARDPIPELINE.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAGAMEPROXY.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAGLTFACTOR.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAGLTFLOADER.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAINPUTMANAGER.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRALIGHTBUFFERMANAGER.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRALIGHTSYSTEM.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAMATERIALBUFFERMANAGER.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAMATERIALSYSTEM.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAMESHMANAGER.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAMESHSYSTEM.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAOBJECT.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAOUTPUTACTOR.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAPIPELINE.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAPLANEACTOR.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAPLAYERACTOR.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAPOINTLIGHTACTOR.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRARENDERER.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRARENDERSTAGE.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRARENDERSYSTEM.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRASHADOWBUFFERMANAGER.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRASHADOWPIPELINE.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRASPOTLIGHTACTOR.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRASPOTSHADOWSOURCESYSTEM.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRASYSTEM.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRASYSTEMMANAGER.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRATASK.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRATASKBARRIER.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRATASKSCHEDULER.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRATESTCUBEACTOR.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRATEXTUREBUFFERMANAGER.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRATEXTUREDEBUGACTOR.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRATHREAD.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRATRANSFORMSYSTEM.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAVERTEXBUFFERMANAGER.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAWINDOWMANAGER.OBJ
^C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\CMAKECXXCOMPILERID.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAACTOR.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAACTORMANAGER.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRABUFFERMANAGER.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRACAMERA.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRADEFERREDPIPELINE.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRADIRECTIONALLIGHTACTOR.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRADIRECTIONALSHADOWSOURCESYSTEM.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAECS.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAENGINE.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAFORWARDPIPELINE.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAGAMEPROXY.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAGLTFACTOR.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAGLTFLOADER.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAINPUTMANAGER.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRALIGHTBUFFERMANAGER.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRALIGHTSYSTEM.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAMATERIALBUFFERMANAGER.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAMATERIALSYSTEM.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAMESHMANAGER.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAMESHSYSTEM.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAOBJECT.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAOUTPUTACTOR.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAPIPELINE.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAPLANEACTOR.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAPLAYERACTOR.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAPOINTLIGHTACTOR.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAPOINTSHADOWSOURCESYSTEM.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRARENDERER.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRARENDERSTAGE.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRARENDERSYSTEM.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRASHADOWBUFFERMANAGER.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRASHADOWPIPELINE.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRASPOTLIGHTACTOR.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRASPOTSHADOWSOURCESYSTEM.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRASYSTEM.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRASYSTEMMANAGER.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRATASK.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRATASKBARRIER.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRATASKSCHEDULER.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRATESTCUBEACTOR.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRATEXTUREBUFFERMANAGER.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRATEXTUREDEBUGACTOR.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRATHREAD.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRATRANSFORMSYSTEM.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAVERTEXBUFFERMANAGER.OBJ|C:\CODE\HYDRAV3\BUILD\HYDRAENGINE\HYDRAENGINE.DIR\DEBUG\HYDRAWINDOWMANAGER.OBJ
C:\Code\HydraV3\build\HydraEngine\Debug\HydraEngine.lib
C:\Code\HydraV3\build\HydraEngine\Debug\HydraEngine.EXP
C:\Code\HydraV3\build\HydraEngine\HydraEngine.dir\Debug\HydraEngine.ilk
Binary file not shown.
+3
View File
@@ -487,6 +487,7 @@ if %errorlevel% neq 0 goto :VCEnd</Command>
<ClInclude Include="C:\Code\HydraV3\HydraEngine\source\ecs\components\HydraMaterialComponent.h" />
<ClInclude Include="C:\Code\HydraV3\HydraEngine\source\ecs\components\HydraMeshComponent.h" />
<ClInclude Include="C:\Code\HydraV3\HydraEngine\source\ecs\components\HydraPhysicsComponent.h" />
<ClInclude Include="C:\Code\HydraV3\HydraEngine\source\ecs\components\HydraPointShadowSourceComponent.h" />
<ClInclude Include="C:\Code\HydraV3\HydraEngine\source\ecs\components\HydraPositionComponent.h" />
<ClInclude Include="C:\Code\HydraV3\HydraEngine\source\ecs\components\HydraRenderableComponent.h" />
<ClInclude Include="C:\Code\HydraV3\HydraEngine\source\ecs\components\HydraSpotShadowSourceComponent.h" />
@@ -499,6 +500,8 @@ if %errorlevel% neq 0 goto :VCEnd</Command>
<ClInclude Include="C:\Code\HydraV3\HydraEngine\source\ecs\systems\HydraMaterialSystem.h" />
<ClCompile Include="C:\Code\HydraV3\HydraEngine\source\ecs\systems\HydraMeshSystem.cpp" />
<ClInclude Include="C:\Code\HydraV3\HydraEngine\source\ecs\systems\HydraMeshSystem.h" />
<ClCompile Include="C:\Code\HydraV3\HydraEngine\source\ecs\systems\HydraPointShadowSourceSystem.cpp" />
<ClInclude Include="C:\Code\HydraV3\HydraEngine\source\ecs\systems\HydraPointShadowSourceSystem.h" />
<ClCompile Include="C:\Code\HydraV3\HydraEngine\source\ecs\systems\HydraRenderSystem.cpp" />
<ClInclude Include="C:\Code\HydraV3\HydraEngine\source\ecs\systems\HydraRenderSystem.h" />
<ClCompile Include="C:\Code\HydraV3\HydraEngine\source\ecs\systems\HydraSpotShadowSourceSystem.cpp" />
@@ -79,6 +79,9 @@
<ClCompile Include="C:\Code\HydraV3\HydraEngine\source\ecs\systems\HydraMeshSystem.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="C:\Code\HydraV3\HydraEngine\source\ecs\systems\HydraPointShadowSourceSystem.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="C:\Code\HydraV3\HydraEngine\source\ecs\systems\HydraRenderSystem.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -261,6 +264,9 @@
<ClInclude Include="C:\Code\HydraV3\HydraEngine\source\ecs\components\HydraPhysicsComponent.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="C:\Code\HydraV3\HydraEngine\source\ecs\components\HydraPointShadowSourceComponent.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="C:\Code\HydraV3\HydraEngine\source\ecs\components\HydraPositionComponent.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -285,6 +291,9 @@
<ClInclude Include="C:\Code\HydraV3\HydraEngine\source\ecs\systems\HydraMeshSystem.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="C:\Code\HydraV3\HydraEngine\source\ecs\systems\HydraPointShadowSourceSystem.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="C:\Code\HydraV3\HydraEngine\source\ecs\systems\HydraRenderSystem.h">
<Filter>Header Files</Filter>
</ClInclude>
+7 -4
View File
@@ -1,8 +1,11 @@
================================================================================
Linker Errors
Generated: 2026-08-05T19:16:34.773Z
Total Errors: 1
Generated: 2026-08-15T14:34:09.799Z
Total Errors: 2
================================================================================
[LNK1168] (MSVC)
cannot open C:\Code\HydraV3\build\Debug\HydraClient.exe for writing [C:\Code\HydraV3\build\HydraClient.vcxproj]
[LNK2019] (MSVC)
unresolved external symbol "public: unsigned int __cdecl HydraTextureBufferManager::CreateCubemapTexture(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,unsigned int,unsigned int,unsigned int,unsigned int,unsigned int)" (?CreateCubemapTexture@HydraTextureBufferManager@@QEAAIV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IIIII@Z) referenced in function "public: virtual void __cdecl HydraCreateCubemapShadowFrameBuffer::Process(void)" (?Process@HydraCreateCubemapShadowFrameBuffer@@UEAAXXZ) [C:\Code\HydraV3\build\HydraEngine\HydraEngine.vcxproj]
[LNK1120] (MSVC)
1 unresolved externals [C:\Code\HydraV3\build\HydraEngine\HydraEngine.vcxproj]