diff --git a/HydraClient/source/HydraGame.cpp b/HydraClient/source/HydraGame.cpp index 4770b31..aa058e0 100644 --- a/HydraClient/source/HydraGame.cpp +++ b/HydraClient/source/HydraGame.cpp @@ -12,7 +12,7 @@ bool HydraGame::Initialise() GetEngine()->ActorManager()->InitialiseActor(m_spawner_id); GetEngine()->ActorManager()->SetPosition(m_spawner_id, glm::dvec3(0, 1.0, 0)); HydraLightSpawnerActor* actor = static_cast(GetEngine()->ActorManager()->GetActor(m_spawner_id)); - actor->SpawnSettings(2.0f, glm::vec3(0.0f, 2.0f, 0.0f), glm::vec3(0.0f, 0.0f, 0.0f), 10.0f, 0.0f, 20.0f); + actor->SpawnSettings(3.0f, glm::vec3(0.0f, 1.0f, 0.0f), glm::vec3(0.0f, 0.0f, 0.0f), 15.0f, 0.0f, 50.0f); actor->SetEnabled(true); @@ -35,12 +35,12 @@ bool HydraGame::Initialise() // m_cube_actor_id = GetEngine()->ActorManager()->CreateActor(); // GetEngine()->ActorManager()->InitialiseActor(m_cube_actor_id); // GetEngine()->ActorManager()->SetPosition(m_cube_actor_id, glm::dvec3(0, 1.0, 0)); - // GetEngine()->ActorManager()->SetLinearVelocity(m_cube_actor_id, glm::dvec3(0, 10.0, 0)); + // GetEngine()->ActorManager()->SetLinearVelocity(m_cube_actor_id, glm::vec3(0,20,0)); m_plane_actor_id = GetEngine()->ActorManager()->CreateActor(); GetEngine()->ActorManager()->InitialiseActor(m_plane_actor_id); GetEngine()->ActorManager()->SetPosition(m_plane_actor_id, glm::dvec3(0, 0, 0)); - GetEngine()->ActorManager()->SetOrientation(m_plane_actor_id, 0.0f, 0.0f, 0.2f); + GetEngine()->ActorManager()->SetOrientation(m_plane_actor_id, 0.0f, 0.0f, 0.0f); // m_plane_actor_id1 = GetEngine()->ActorManager()->CreateActor(); diff --git a/HydraEngine/source/HydraDefines.h b/HydraEngine/source/HydraDefines.h index e603018..2e8c260 100644 --- a/HydraEngine/source/HydraDefines.h +++ b/HydraEngine/source/HydraDefines.h @@ -45,7 +45,7 @@ const uint32_t MAX_DIRECTIONAL_SHADOWS = 10; const uint32_t MAX_SPOT_SHADOWS = 10; const uint32_t MAX_POINT_SHADOWS = 10; //const uint32_t SHADOW_MAP_SIZE = 1024; -const uint32_t DIRECTIONAL_SHADOW_MAP_SIZE = 4096; +const uint32_t DIRECTIONAL_SHADOW_MAP_SIZE = 2048; const uint32_t SPOT_SHADOW_MAP_SIZE = 1024; const uint32_t POINT_SHADOW_MAP_SIZE = 2048; @@ -65,7 +65,7 @@ enum class HYDRA_PHYSICS_SHAPE enum class HYDRA_RENDERABLE_TYPE { HYDRA_COLOUR = 1, - HYDRA_SHADOW, + HYDRA_SHADOW_CASTER, HYDRA_TRANSPARENT, HYDRA_LIGHTING, HYDRA_OUTPUT, diff --git a/HydraEngine/source/ShaderFiles/deferred_output_shader.frag b/HydraEngine/source/ShaderFiles/deferred_output_shader.frag index 4e09eb3..adb285e 100644 --- a/HydraEngine/source/ShaderFiles/deferred_output_shader.frag +++ b/HydraEngine/source/ShaderFiles/deferred_output_shader.frag @@ -232,7 +232,7 @@ vec3 DirectionalShading(vec3 normal, { float distance = length(light_pos - world_pos); - float attenuation = 1.0; + float attenuation = 3.5; vec3 radiance = diffuse * attenuation; @@ -251,10 +251,12 @@ vec3 PointShading(vec3 normal, float light_constant, float light_linear, float light_quadratic, + vec3 light_colour, vec3 world_pos, vec3 view_pos, float shadow_val) { + float distance = length(light_pos - world_pos); float attenuation = 1.0; @@ -263,7 +265,7 @@ vec3 PointShading(vec3 normal, vec3 light_dir = normalize(light_pos - world_pos); vec3 Lo = CalculatePBR(normal, view_pos, world_pos, light_dir, diffuse, radiance, roughness, metallic); - + Lo = Lo * light_colour; return Lo; } vec3 SpotShading(vec3 normal, @@ -339,9 +341,17 @@ float SampleCascadeShadow(vec4 frag_clip_space, sampler2DArray sampler_shadow_ma // check whether current frag pos is in shadow // float shadow = currentDepth - bias > closestDepth ? 1.0 : 0.0; // PCF - if(shadow_trans_idx < 3) + if(shadow_trans_idx < 1) { - bias = 0.00001; + bias = 0.0000005; + } + if(shadow_trans_idx < 2) + { + bias = 0.00005; + } + else if(shadow_trans_idx < 3) + { + bias = 0.00005; } else if(shadow_trans_idx == 3) { @@ -351,9 +361,6 @@ float SampleCascadeShadow(vec4 frag_clip_space, sampler2DArray sampler_shadow_ma { bias = 0.0005; } - - - float shadow = 0.0; vec2 texel_size = 1.0 / textureSize(sampler_shadow_map, 0).xy; if((frag_light_space.x >= 0.0)&&(frag_light_space.y >= 0.0) @@ -418,6 +425,12 @@ vec3 CalculateDirectionalShadow(vec4 world_pos, uint shadow_idx, vec3 normal, ve //measure the distance of the fragment from the light float frag_distance = abs(length(viewer_pos - world_pos.xyz)); + float back_face = dot(normal, light_dir); + if(back_face < 0) + { + return vec3(1); + } + uint shadow_trans_idx = 5; uint ignore_shadow = 0; //Work out which shadowmap is appropriate for this distance @@ -548,14 +561,22 @@ void main() float ao = 1; vec3 ambient = vec3(0.05) * diffuse.xyz * ao; vec3 Lo = ambient; + if(metal_rough[0] > 0) + { + uFragColor = vec4(diffuse.xyz * metal_rough[0], diffuse.a); + } + else + { for(int i = 0; i < ubo_per_frame.light_count; i ++) { mat4 model = model_matrix[lights[i].entity_id]; mat3 rot_mat = GetRotationOnlyMatrix(model); vec3 light_direction = normalize(rot_mat * vec3(0,0,1)); - - vec3 light_pos = GetPositionFromView(model); - light_pos = model[3].xyx; + vec4 light_pos_model_space = vec4(0,0,0,1); + light_pos_model_space = model * light_pos_model_space; + vec3 light_pos = light_pos_model_space.xyz; + //vec3 light_pos = GetPositionFromView(model); + //light_pos = model[3].xyx; if(lights[i].light_type == HYDRA_LIGHT_DIRECTIONAL) { Lo += DirectionalShading(normal, diffuse.xyz, rough, metal, lights[i].intensity, light_direction, light_pos, world_pos, ubo_per_frame.viewer_pos); @@ -563,6 +584,7 @@ void main() 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 * shadow; } @@ -586,6 +608,7 @@ void main() lights[i].constant, lights[i].linear, lights[i].quadratic, + lights[i].diffuse.xyz, world_pos, ubo_per_frame.viewer_pos, shadow); @@ -626,11 +649,13 @@ void main() vec3 output_color = Lo; // HDR tonemapping - output_color = output_color / (output_color + vec3(1.0)); - // gamma correct - output_color = pow(output_color, vec3(1.0/2.1)); - - uFragColor = vec4(output_color, 1.0); + output_color = output_color / (output_color + vec3(1.0)); + // gamma correct + output_color = pow(output_color, vec3(1.0/2.1)); + uFragColor = vec4(output_color, 1.0); + } + + // float light = dot(lights[0].light_direction, normal); // uFragColor = vec4(diffuse.xyz * light,1); diff --git a/HydraEngine/source/ShaderFiles/deferred_shader.frag b/HydraEngine/source/ShaderFiles/deferred_shader.frag index 1194fe9..a698216 100644 --- a/HydraEngine/source/ShaderFiles/deferred_shader.frag +++ b/HydraEngine/source/ShaderFiles/deferred_shader.frag @@ -73,7 +73,7 @@ void main() } diffuse_out = diffuse_val; - metalic_rough_out = mat_rough_val; + metalic_rough_out = mat_rough_val; normal_out = vec4(normal_val,1); position_out = vs_out.vsWorldPos; } \ No newline at end of file diff --git a/HydraEngine/source/actor/HydraActor.cpp b/HydraEngine/source/actor/HydraActor.cpp index 094ad03..978dd74 100644 --- a/HydraEngine/source/actor/HydraActor.cpp +++ b/HydraEngine/source/actor/HydraActor.cpp @@ -2,8 +2,3 @@ #include "HydraActorManager.h" #include "../engine/HydraEngine.h" #include "../ecs/HydraECS.h" -void HydraActor::Delete() -{ - GetEngine()->ECS()->DestroyEntity(GetID()); - -} diff --git a/HydraEngine/source/actor/HydraActor.h b/HydraEngine/source/actor/HydraActor.h index dabae14..91f36ce 100644 --- a/HydraEngine/source/actor/HydraActor.h +++ b/HydraEngine/source/actor/HydraActor.h @@ -16,7 +16,7 @@ class CLASS_DEFINE HydraActor : public HydraObject std::vector m_children; std::vector m_component_types; uint32_t m_components_waiting = 0; - void Delete(); + friend class HydraActorManager; friend class HydraDeleteActorTask; protected: diff --git a/HydraEngine/source/actor/HydraActorManager.cpp b/HydraEngine/source/actor/HydraActorManager.cpp index 7339a53..92ce924 100644 --- a/HydraEngine/source/actor/HydraActorManager.cpp +++ b/HydraEngine/source/actor/HydraActorManager.cpp @@ -35,7 +35,7 @@ void HydraActorManager::DeleteActor(HydraID actorID) if(m_actors[actorID] != nullptr) { - m_actors[actorID]->Delete(); + GetEngine()->ECS()->DestroyEntity(actorID); _SetActorDeleted(actorID); } @@ -194,15 +194,22 @@ void HydraActorManager::SetLinearVelocity(HydraID actor_id, glm::vec3 velocity) void HydraActorManager::SetPositionAndOrientation(HydraID actorID, glm::dvec3 position, glm::vec3 euler_angles, bool ignore_physics) { HydraECS *ecs = GetEngine()->ECS(); - - HydraPositionComponent &pos_comp = ecs->GetComponent(actorID); - pos_comp.position = position; - pos_comp.orientation = glm::vec3(euler_angles.x,euler_angles.y,euler_angles.z); - - if(!pos_comp.needs_update) + if(ecs->HasComponent(actorID)) { - ecs->GetSystem()->UpdateTransform(actorID, ignore_physics); + HydraPositionComponent &pos_comp = ecs->GetComponent(actorID); + pos_comp.position = position; + pos_comp.orientation = glm::vec3(euler_angles.x,euler_angles.y,euler_angles.z); + + if(!pos_comp.needs_update) + { + ecs->GetSystem()->UpdateTransform(actorID, ignore_physics); + } } + else + { + std::cout << "HERE"; + } + } void HydraActorManager::SetScale(HydraID actor_id, glm::dvec3 scaling) diff --git a/HydraEngine/source/actor/HydraDirectionalLightActor.cpp b/HydraEngine/source/actor/HydraDirectionalLightActor.cpp index 5585387..c295f93 100644 --- a/HydraEngine/source/actor/HydraDirectionalLightActor.cpp +++ b/HydraEngine/source/actor/HydraDirectionalLightActor.cpp @@ -21,8 +21,8 @@ void HydraDirectionalLightActor::InitialiseComponents() HydraLightComponent light_comp = {}; HydraECS *ecs = GetEngine()->ECS(); - light_comp.diffuse = glm::vec4(1.0,0.8,0.6,1); - light_comp.intensity = 100000.0f; + light_comp.diffuse = glm::vec4(1.0f, 1.0f, 1.0f ,1.0f); + light_comp.intensity = 1000.0f; light_comp.light_type = static_cast(HYDRA_LIGHT_TYPE::HYDRA_LIGHT_DIRECTIONAL); light_comp.entity_id = GetID(); light_comp.shadow_caster =1; diff --git a/HydraEngine/source/actor/HydraPlaneActor.cpp b/HydraEngine/source/actor/HydraPlaneActor.cpp index f36e7e9..1f9d2d3 100644 --- a/HydraEngine/source/actor/HydraPlaneActor.cpp +++ b/HydraEngine/source/actor/HydraPlaneActor.cpp @@ -175,7 +175,7 @@ void HydraPlaneActor::_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, 0.5, 0.3, 1); HydraID mat_id = engine->MaterialBufferManager()->CreateMaterial(material); HydraMaterialComponent mat_comp = {}; diff --git a/HydraEngine/source/actor/HydraPlayerActor.cpp b/HydraEngine/source/actor/HydraPlayerActor.cpp index 0db88b0..7e4337b 100644 --- a/HydraEngine/source/actor/HydraPlayerActor.cpp +++ b/HydraEngine/source/actor/HydraPlayerActor.cpp @@ -47,7 +47,7 @@ void HydraPlayerActor::HandleInput(float delta_t) bool move_right = GetEngine()->KeyPressed(HYDRA_KEY_CODES::HYDRA_KEY_D); HydraRenderSettings render_settings = GetEngine()->RenderSettings(); - float scale = 0.2f; + float scale = 1.0f; float x_angle = (change.x / render_settings.DisplayWidth) * -500 * delta_t * scale; float y_angle = (change.y / render_settings.DisplayHeight) * -500 * delta_t * scale; diff --git a/HydraEngine/source/actor/HydraTestCubeActor.cpp b/HydraEngine/source/actor/HydraTestCubeActor.cpp index ffbb4c3..c9672c0 100644 --- a/HydraEngine/source/actor/HydraTestCubeActor.cpp +++ b/HydraEngine/source/actor/HydraTestCubeActor.cpp @@ -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(GetID(), render_comp); + ecs->AddComponent(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(HYDRA_LIGHT_TYPE::HYDRA_LIGHT_POINT); + light_comp.entity_id = GetID(); + + ecs->AddComponent(GetID(), light_comp); +} \ No newline at end of file diff --git a/HydraEngine/source/actor/HydraTestCubeActor.h b/HydraEngine/source/actor/HydraTestCubeActor.h index c2bba56..a77b277 100644 --- a/HydraEngine/source/actor/HydraTestCubeActor.h +++ b/HydraEngine/source/actor/HydraTestCubeActor.h @@ -18,6 +18,7 @@ class CLASS_DEFINE HydraTestCubeActor : public HydraActor void _CreateMaterial(); void _CreatePhysics(); void _CreateRenderableComponent(); + void _CreateLightComponent(); public: virtual void InitialiseComponents(); virtual void DeferredInitialiseComponents(); diff --git a/HydraEngine/source/actor/HydraTestLightActor.cpp b/HydraEngine/source/actor/HydraTestLightActor.cpp index f109ff1..906b579 100644 --- a/HydraEngine/source/actor/HydraTestLightActor.cpp +++ b/HydraEngine/source/actor/HydraTestLightActor.cpp @@ -7,6 +7,7 @@ #include "../ecs/components/HydraMeshComponent.h" #include "../ecs/components/HydraRenderableComponent.h" #include "../ecs/components/HydraMaterialComponent.h" +#include "../ecs/components/HydraLightComponent.h" #include "../buffer/HydraMaterialBufferManager.h" #include "../buffer/HydraTextureBufferManager.h" #include "../buffer/HydraMaterialBuffer.h" @@ -23,6 +24,7 @@ void HydraTestLightActor::InitialiseComponents() _CreateMaterial(); _CreateMesh(); _CreateRenderableComponent(); + } void HydraTestLightActor::DeferredInitialiseComponents() @@ -173,7 +175,7 @@ void HydraTestLightActor::_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, 0.5, 0.3, 1); HydraID mat_id = engine->MaterialBufferManager()->CreateMaterial(material); HydraMaterialComponent mat_comp = {}; @@ -181,7 +183,6 @@ void HydraTestLightActor::_CreateMaterial() engine->ECS()->AddComponent(GetID(), mat_comp); } - void HydraTestLightActor::_CreateRenderableComponent() { HydraRenderableComponent render_comp; @@ -189,3 +190,4 @@ void HydraTestLightActor::_CreateRenderableComponent() render_comp.renderable_types.set((uint32_t)HYDRA_RENDERABLE_TYPE::HYDRA_COLOUR, true); ecs->AddComponent(GetID(), render_comp); } + diff --git a/HydraEngine/source/actor/HydraTestLightActor.h b/HydraEngine/source/actor/HydraTestLightActor.h index 97a2ab1..3a89e9d 100644 --- a/HydraEngine/source/actor/HydraTestLightActor.h +++ b/HydraEngine/source/actor/HydraTestLightActor.h @@ -18,6 +18,7 @@ class CLASS_DEFINE HydraTestLightActor : public HydraActor void _CreateMesh(); void _CreateMaterial(); void _CreateRenderableComponent(); + public: virtual void InitialiseComponents(); virtual void DeferredInitialiseComponents(); diff --git a/HydraEngine/source/actor/LightSpawner/HydraLightSpawnerActor.cpp b/HydraEngine/source/actor/LightSpawner/HydraLightSpawnerActor.cpp index 2305943..e034ef2 100644 --- a/HydraEngine/source/actor/LightSpawner/HydraLightSpawnerActor.cpp +++ b/HydraEngine/source/actor/LightSpawner/HydraLightSpawnerActor.cpp @@ -24,11 +24,26 @@ void HydraLightSpawnerActor::FixedTick(float delta_t) actor_manager->InitialiseActor(actor_id); actor_manager->SetPosition(actor_id, pos_comp.position); actor_manager->SetLinearVelocity(actor_id, m_spawn_direction * m_spawn_velocity); - m_last_tick = current_tick; - + SpawnedActor actor = {}; + actor.actor_id = actor_id; + actor.spawned_time = current_tick; + m_spawned_actors.push(actor); + m_last_tick = current_tick; + + } + if(m_spawned_actors.size() > 0) + { + SpawnedActor actor = m_spawned_actors.front(); + long actor_spawned_time_ms = std::chrono::duration_cast(current_tick - actor.spawned_time).count(); + if(actor_spawned_time_ms > (m_spawn_duration * 1000.0f )) + { + GetEngine()->ActorManager()->DeleteActor(actor.actor_id); + m_spawned_actors.pop(); + } } - } + + } void HydraLightSpawnerActor::_CreatePosition() diff --git a/HydraEngine/source/actor/LightSpawner/HydraLightSpawnerActor.h b/HydraEngine/source/actor/LightSpawner/HydraLightSpawnerActor.h index 86de710..35b1a30 100644 --- a/HydraEngine/source/actor/LightSpawner/HydraLightSpawnerActor.h +++ b/HydraEngine/source/actor/LightSpawner/HydraLightSpawnerActor.h @@ -5,6 +5,13 @@ #include #include #include + +struct SpawnedActor +{ + HydraID actor_id; + std::chrono::time_point spawned_time; +}; + class CLASS_DEFINE HydraLightSpawnerActor : public HydraActor { public: @@ -30,7 +37,7 @@ class CLASS_DEFINE HydraLightSpawnerActor : public HydraActor float m_interval = 0.0f; bool m_enabled = false; std::chrono::time_point m_last_tick; - std::queue m_spawned_actors; + std::queue m_spawned_actors; }; diff --git a/HydraEngine/source/actor/LightSpawner/HydraSpawnedLightActor.cpp b/HydraEngine/source/actor/LightSpawner/HydraSpawnedLightActor.cpp index a4391ff..1d55cac 100644 --- a/HydraEngine/source/actor/LightSpawner/HydraSpawnedLightActor.cpp +++ b/HydraEngine/source/actor/LightSpawner/HydraSpawnedLightActor.cpp @@ -8,6 +8,7 @@ #include "../../ecs/components/HydraRenderableComponent.h" #include "../../ecs/components/HydraMaterialComponent.h" #include "../../ecs/components/HydraPhysicsComponent.h" +#include "../../ecs/components/HydraLightComponent.h" #include "../../buffer/HydraMaterialBufferManager.h" #include "../../buffer/HydraTextureBufferManager.h" #include "../../buffer/HydraMaterialBuffer.h" @@ -22,6 +23,7 @@ void HydraSpawnedLightActor::InitialiseComponents() _CreateMaterial(); _CreateMesh(); _CreateRenderableComponent(); + _CreateLightComponent(); } void HydraSpawnedLightActor::DeferredInitialiseComponents() @@ -46,9 +48,9 @@ void HydraSpawnedLightActor::_CreateMesh() mesh->vertexes.resize(24); mesh->indexes.resize(36); - float scale_x = 0.3f; - float scale_y = 0.3f; - float scale_z = 0.3f; + float scale_x = 0.1f; + float scale_y = 0.1f; + float scale_z = 0.1f; float min_x = -0.5f * scale_x; float min_y = -0.5f * scale_y; @@ -158,26 +160,41 @@ void HydraSpawnedLightActor::_CreateMesh() mesh_comp.mesh_state = HYDRA_STATE::Waiting; ecs->AddComponent(GetID(), mesh_comp); + } void HydraSpawnedLightActor::_CreateMaterial() { HydraEngine *engine = GetEngine(); - std::string filename = std::string(texture_base) + std::string("/DesignArea/DesignArea_Albedo.png"); + //std::string filename = std::string(texture_base) + std::string("/DesignArea/DesignArea_Albedo.png"); - HydraID tex_id = engine->TextureBufferManager()->LoadTexture(filename); + //HydraID tex_id = engine->TextureBufferManager()->LoadTexture(filename); HydraMaterialBuffer material = {}; + std::srand(std::time({})); // use current time as seed for random generator + const float red = static_cast(std::rand() % 2) + 0.1f; + const float green = static_cast(std::rand() % 2)+ 0.1f; + const float blue = static_cast(std::rand() % 2)+ 0.1f; - 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.diffuse_texture_id = tex_id; + material.diffuse_colour = glm::vec4(glm::normalize(glm::vec3(red, green, blue)), 1) * 10.0f; + material.emmissive_metalic_rough = glm::vec4(10.0f, 0.5f, 0.2f, 1.0f); HydraID mat_id = engine->MaterialBufferManager()->CreateMaterial(material); HydraMaterialComponent mat_comp = {}; mat_comp.material_id = mat_id; engine->ECS()->AddComponent(GetID(), mat_comp); + HydraLightComponent light_comp = {}; + HydraECS *ecs = GetEngine()->ECS(); + + light_comp.diffuse = glm::vec4(glm::normalize(glm::vec3(red, green, blue)), 1); + light_comp.intensity = 100.0f; + light_comp.light_type = static_cast(HYDRA_LIGHT_TYPE::HYDRA_LIGHT_POINT); + light_comp.entity_id = GetID(); + + ecs->AddComponent(GetID(), light_comp); } void HydraSpawnedLightActor::_CreatePhysics() @@ -188,9 +205,9 @@ void HydraSpawnedLightActor::_CreatePhysics() phys_comp.phyics_type = HYDRA_PHYSICS_TYPE::HYDRA_RIGID_BODY; phys_comp.physics_shape = HYDRA_PHYSICS_SHAPE::HYDRA_PHYSICS_BOX; - phys_comp.depth = 0.3f; - phys_comp.height = 0.3f; - phys_comp.width = 0.3f; + phys_comp.depth = 0.1f; + phys_comp.height = 0.1f; + phys_comp.width = 0.1f; engine->ECS()->AddComponent(GetID(), phys_comp); } @@ -198,6 +215,12 @@ void HydraSpawnedLightActor::_CreateRenderableComponent() { HydraRenderableComponent render_comp; 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_COLOUR, true); ecs->AddComponent(GetID(), render_comp); } + +void HydraSpawnedLightActor::_CreateLightComponent() +{ + +} + diff --git a/HydraEngine/source/actor/LightSpawner/HydraSpawnedLightActor.h b/HydraEngine/source/actor/LightSpawner/HydraSpawnedLightActor.h index 3f59c0b..4925db2 100644 --- a/HydraEngine/source/actor/LightSpawner/HydraSpawnedLightActor.h +++ b/HydraEngine/source/actor/LightSpawner/HydraSpawnedLightActor.h @@ -16,6 +16,7 @@ class CLASS_DEFINE HydraSpawnedLightActor : public HydraActor void _CreateMaterial(); void _CreatePhysics(); void _CreateRenderableComponent(); + void _CreateLightComponent(); public: void InitialiseComponents() override; void DeferredInitialiseComponents() override; diff --git a/HydraEngine/source/actor/PlanetActor/HydraPlanetActor.cpp b/HydraEngine/source/actor/PlanetActor/HydraPlanetActor.cpp index 8a41851..5afb400 100644 --- a/HydraEngine/source/actor/PlanetActor/HydraPlanetActor.cpp +++ b/HydraEngine/source/actor/PlanetActor/HydraPlanetActor.cpp @@ -174,7 +174,7 @@ void HydraPlanetActor::_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, 0.5, 0.3, 1); HydraID mat_id = engine->MaterialBufferManager()->CreateMaterial(material); HydraMaterialComponent mat_comp = {}; diff --git a/HydraEngine/source/actor/PlanetActor/HydraPlanetQuadActor.cpp b/HydraEngine/source/actor/PlanetActor/HydraPlanetQuadActor.cpp index a5c7657..8803b18 100644 --- a/HydraEngine/source/actor/PlanetActor/HydraPlanetQuadActor.cpp +++ b/HydraEngine/source/actor/PlanetActor/HydraPlanetQuadActor.cpp @@ -173,7 +173,7 @@ void HydraPlanetQuadActor::_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, 0.5, 0.3, 1); HydraID mat_id = engine->MaterialBufferManager()->CreateMaterial(material); HydraMaterialComponent mat_comp = {}; diff --git a/HydraEngine/source/buffer/HydraLightBufferManager.cpp b/HydraEngine/source/buffer/HydraLightBufferManager.cpp index 0ea2da4..70ebf13 100644 --- a/HydraEngine/source/buffer/HydraLightBufferManager.cpp +++ b/HydraEngine/source/buffer/HydraLightBufferManager.cpp @@ -50,7 +50,6 @@ void HydraLightBufferManager::AddLight(HydraLightComponent light) { return; } - auto it = std::find(m_light_lookup.begin(), m_light_lookup.end(), light.entity_id); if(it == m_light_lookup.end()) diff --git a/HydraEngine/source/buffer/HydraMaterialBuffer.h b/HydraEngine/source/buffer/HydraMaterialBuffer.h index e8f5911..f845de3 100644 --- a/HydraEngine/source/buffer/HydraMaterialBuffer.h +++ b/HydraEngine/source/buffer/HydraMaterialBuffer.h @@ -7,7 +7,7 @@ struct HydraMaterialBuffer { glm::vec4 diffuse_colour = {0, 0, 0, 0}; //0 - 16 - glm::vec4 metalic_rough = {0, 0, 0, 0}; //28 - 12 + glm::vec4 emmissive_metalic_rough = {0, 0, 0, 0}; //28 - 12 uint32_t diffuse_texture_id = INVALID_HYDRA_ID; //32 - 4 uint32_t metallic_rough_texture_id = INVALID_HYDRA_ID; //36 - 4 uint32_t normal_texture_id = INVALID_HYDRA_ID; //40 - 4 diff --git a/HydraEngine/source/buffer/HydraMaterialBufferManager.cpp b/HydraEngine/source/buffer/HydraMaterialBufferManager.cpp index 069af1d..c7b1bc1 100644 --- a/HydraEngine/source/buffer/HydraMaterialBufferManager.cpp +++ b/HydraEngine/source/buffer/HydraMaterialBufferManager.cpp @@ -1,4 +1,16 @@ #include "HydraMaterialBufferManager.h" +#include "../engine/HydraEngine.h" +#include "../ecs/HydraECS.h" +#include "../ecs/components/HydraMaterialComponent.h" + +#include "../buffer/HydraMaterialBufferManager.h" +#include "../buffer/HydraTextureBufferManager.h" + +#include "../scheduler/HydraTaskScheduler.h" +#include "../task/buffer/HydraCreateGPUBufferTask.hpp" +#include "../task/buffer/HydraDeleteGPUBufferTask.hpp" +#include "../task/buffer/HydraUpdateWholeGPUBufferTask.hpp" +#include "../actor/HydraActorManager.h" void HydraMaterialBufferManager::Intialise() { @@ -7,10 +19,33 @@ void HydraMaterialBufferManager::Intialise() { m_available_material_ids.push(mat_idx); } + + HydraTaskScheduler *task_scheduler = GetEngine()->TaskScheduler(); + + HydraID create_gpu_buffer_task_id = task_scheduler->CreateTask(HydraThreadAffinity::Render); + HydraCreateGPUBufferTask *task = static_cast(task_scheduler->GetTask(create_gpu_buffer_task_id)); + task->Intialise("MaterialBuffer", 1, MAX_MATERIALS * sizeof(HydraMaterialBuffer), &m_material_buffer_id, HYDRA_BUFFER_TYPE::HYDRA_SSBO_BUFFER); + task_scheduler->WaitForTask(create_gpu_buffer_task_id); + + create_gpu_buffer_task_id = task_scheduler->CreateTask(HydraThreadAffinity::Render); + task = static_cast(task_scheduler->GetTask(create_gpu_buffer_task_id)); + task->Intialise("TextureBuffer", 1, MAX_TEXTURES * sizeof(uint64_t), &m_texture_buffer_id, HYDRA_BUFFER_TYPE::HYDRA_SSBO_BUFFER); + task_scheduler->WaitForTask(create_gpu_buffer_task_id); } void HydraMaterialBufferManager::Shutdown() { + HydraTaskScheduler *task_scheduler = GetEngine()->TaskScheduler(); + + HydraID delete_gpu_buffer_task_id = task_scheduler->CreateTask(HydraThreadAffinity::Render); + HydraDeleteGPUBufferTask *task = static_cast(task_scheduler->GetTask(delete_gpu_buffer_task_id)); + task->Intialise(m_material_buffer_id); + task_scheduler->WaitForTask(delete_gpu_buffer_task_id); + + delete_gpu_buffer_task_id = task_scheduler->CreateTask(HydraThreadAffinity::Render); + task = static_cast(task_scheduler->GetTask(delete_gpu_buffer_task_id)); + task->Intialise(m_texture_buffer_id); + task_scheduler->WaitForTask(delete_gpu_buffer_task_id); } HydraID HydraMaterialBufferManager::CreateMaterial(const HydraMaterialBuffer &material) @@ -26,10 +61,35 @@ HydraID HydraMaterialBufferManager::CreateMaterial(const HydraMaterialBuffer &ma return mat_id; } - - +void HydraMaterialBufferManager::DeleteMaterial(HydraID material_id) +{ + std::lock_guard lock(m_mutex); + if(material_id < MAX_MATERIALS) + { + m_material[material_id] = {}; + m_available_material_ids.push(material_id); + } +} void *HydraMaterialBufferManager::GetMaterialBuffer() { return &m_material[0]; } + +void HydraMaterialBufferManager::UpdateBuffer() +{ + void* buffer = GetEngine()->MaterialBufferManager()->GetMaterialBuffer(); + + HydraTaskScheduler *task_scheduler = GetEngine()->TaskScheduler(); + + HydraID update_buffer_task_id = task_scheduler->CreateTask(HydraThreadAffinity::Render); + HydraUpdateWholeGPUBufferTask *task = static_cast(task_scheduler->GetTask(update_buffer_task_id)); + task->Intialise(m_material_buffer_id, buffer); + task_scheduler->WaitForTask(update_buffer_task_id); + + buffer = GetEngine()->TextureBufferManager()->GetTextureBuffer(); + update_buffer_task_id = task_scheduler->CreateTask(HydraThreadAffinity::Render); + task = static_cast(task_scheduler->GetTask(update_buffer_task_id)); + task->Intialise(m_texture_buffer_id, buffer); + task_scheduler->WaitForTask(update_buffer_task_id); +} diff --git a/HydraEngine/source/buffer/HydraMaterialBufferManager.h b/HydraEngine/source/buffer/HydraMaterialBufferManager.h index edd7cd5..f856e10 100644 --- a/HydraEngine/source/buffer/HydraMaterialBufferManager.h +++ b/HydraEngine/source/buffer/HydraMaterialBufferManager.h @@ -19,9 +19,12 @@ class HydraMaterialBufferManager : public HydraObject void Intialise(); void Shutdown(); HydraID CreateMaterial(const HydraMaterialBuffer& material); + void DeleteMaterial(HydraID material_id); void* GetMaterialBuffer(); - + void UpdateBuffer(); private: + uint32_t m_material_buffer_id =0; + uint32_t m_texture_buffer_id =0; std::mutex m_mutex; std::queue m_available_material_ids; std::vector m_material; diff --git a/HydraEngine/source/ecs/HydraComponentArray.h b/HydraEngine/source/ecs/HydraComponentArray.h index 0280117..0a750a5 100644 --- a/HydraEngine/source/ecs/HydraComponentArray.h +++ b/HydraEngine/source/ecs/HydraComponentArray.h @@ -15,7 +15,7 @@ class IHydraComponentArray }; template -class HydraComponentArray : public IHydraComponentArray +class HydraComponentArray : public IHydraComponentArray, HydraObject { private: std::array m_components; @@ -28,11 +28,12 @@ class HydraComponentArray : public IHydraComponentArray void RemoveComponent(HydraID entity_id) { std::lock_guard lock(m_mutex); + if(m_entity_to_component.find(entity_id) == m_entity_to_component.end()) { return; } - + DebugLog("COMPONENT DELETED:" + std::to_string(entity_id) + "\n"); HydraID component_index = m_entity_to_component[entity_id]; HydraID last_component_index = m_component_count -1; HydraID last_entity_id = m_component_to_entity[last_component_index]; @@ -41,15 +42,21 @@ class HydraComponentArray : public IHydraComponentArray { m_components[component_index] = m_components[last_component_index]; m_entity_to_component[last_entity_id] = component_index; + m_component_to_entity.erase(last_component_index); + m_component_to_entity[component_index] = last_entity_id; m_components[last_component_index] = {}; + DebugLog("COMPONENT MOVED:" + std::to_string(last_entity_id) + "\n"); } else { - m_components[component_index] = {}; + m_components[last_component_index] = {}; + m_entity_to_component.erase(entity_id); + m_component_to_entity.erase(last_component_index); } - m_entity_to_component.erase(entity_id); - m_component_to_entity.erase(component_index); + + + m_component_count--; } @@ -85,6 +92,10 @@ class HydraComponentArray : public IHydraComponentArray { RemoveComponent(entity_id); } + T const * const GetComponents() + { + return &m_components[0]; + } }; #endif /* HYDRACOMPONENTARRAY */ diff --git a/HydraEngine/source/ecs/HydraComponentManager.h b/HydraEngine/source/ecs/HydraComponentManager.h index ebc404b..1e8cfd6 100644 --- a/HydraEngine/source/ecs/HydraComponentManager.h +++ b/HydraEngine/source/ecs/HydraComponentManager.h @@ -19,12 +19,14 @@ class HydraComponentManager :public HydraObject std::shared_ptr> _GetComponentArray() { std::string type_name = std::string(typeid(T).name()); - + if(m_component_types.find(type_name) == m_component_types.end()) + { + std::cout << "Error"; + } assert(m_component_types.find(type_name) != m_component_types.end() && "Component type does not exist"); return std::static_pointer_cast>(m_component_arrays[type_name]); } public: - template ComponentTypeID RegisterComponentType() { @@ -58,7 +60,13 @@ class HydraComponentManager :public HydraObject { return _GetComponentArray()->GetComponent(entity_id); } - + template + T const * const GetComponents() + { + return _GetComponentArray()->GetComponents(); + } + + template bool HasComponent(HydraID entity_id) { diff --git a/HydraEngine/source/ecs/HydraECS.h b/HydraEngine/source/ecs/HydraECS.h index 9fe5fd6..f99b920 100644 --- a/HydraEngine/source/ecs/HydraECS.h +++ b/HydraEngine/source/ecs/HydraECS.h @@ -59,7 +59,7 @@ public: { // Remove the component from the entity m_component_manager->RemoveComponent(entity_id); - + std::string(typeid(T).name()); // Get the current signature, remove the component from it and update auto signature = m_entity_manager->GetSignature(entity_id); signature.set(m_component_manager->GetComponentTypeID(), false); @@ -79,6 +79,11 @@ public: { return m_component_manager->GetComponent(entity_id); } + template + T &GetComponents() + { + return m_component_manager->GetComponents(); + } template std::shared_ptr RegisterSystem() @@ -100,6 +105,10 @@ public: { m_system_manager->InitialiseComponents(); } + void DeleteComponents() + { + m_system_manager->DeleteComponents(); + } }; #endif /* HYDRAECS */ diff --git a/HydraEngine/source/ecs/HydraSystem.cpp b/HydraEngine/source/ecs/HydraSystem.cpp index 7889904..4fc950e 100644 --- a/HydraEngine/source/ecs/HydraSystem.cpp +++ b/HydraEngine/source/ecs/HydraSystem.cpp @@ -6,11 +6,12 @@ void HydraSystem::Update(float delta_t_seconds) UpdateSystem(delta_t_seconds); } + void HydraSystem::Shutdown() { for(HydraID entity_id : Entities) { - DestroyComponents(entity_id); + DestroyComponent(entity_id); } FreeSystemResources(); } @@ -23,13 +24,20 @@ void HydraSystem::InitialiseComponents() } EntitiesToCreate.clear(); } - -void HydraSystem::DestroyComponents(HydraID actor_id) +void HydraSystem::DeleteComponents() { - auto it = std::find(Entities.begin(), Entities.end(), actor_id); - if(it == Entities.end()) + for(auto it = EntitiesToDelete.begin(); it != EntitiesToDelete.end(); ++it) { - return; + HydraID actor_id = *it; + DestroyComponent(actor_id); + } + EntitiesToDelete.clear(); +} + +void HydraSystem::DeleteComponent(HydraID actor_id) +{ + if(std::find(Entities.begin(), Entities.end(), actor_id)!= Entities.end()) + { + DestroyComponent(actor_id); } - DestroyComponent(actor_id); } diff --git a/HydraEngine/source/ecs/HydraSystem.h b/HydraEngine/source/ecs/HydraSystem.h index f2381a3..e31a8aa 100644 --- a/HydraEngine/source/ecs/HydraSystem.h +++ b/HydraEngine/source/ecs/HydraSystem.h @@ -10,17 +10,19 @@ class HydraSystem : public HydraObject public: std::set Entities; std::set EntitiesToCreate; + std::set EntitiesToDelete; void Update(float delta_t_seconds); - void InitialiseComponents(); + void InitialiseComponents(); + void DeleteComponents(); + void DeleteComponent(HydraID actor_id); virtual void InitialiseComponent(HydraID actor_id) {}; - void DestroyComponents(HydraID actor_id); + virtual void Shutdown(); virtual void Initialise(){}; protected: - virtual void UpdateSystem(float delta_t_seconds) = 0; - + virtual void UpdateSystem(float delta_t_seconds) = 0; virtual void DestroyComponent(HydraID actor_id) {}; virtual void FreeSystemResources(){}; }; diff --git a/HydraEngine/source/ecs/HydraSystemManager.h b/HydraEngine/source/ecs/HydraSystemManager.h index defd7b2..dc5a32b 100644 --- a/HydraEngine/source/ecs/HydraSystemManager.h +++ b/HydraEngine/source/ecs/HydraSystemManager.h @@ -75,7 +75,8 @@ public: // Entity signature does not match system signature - erase from set else { - system->DestroyComponents(entity_id); + //system->DestroyComponents(entity_id); + //system->DeleteComponent(entity_id); system->Entities.erase(entity_id); system->EntitiesToCreate.erase(entity_id); } @@ -87,11 +88,20 @@ public: for (auto const& pair : m_systems) { auto const& system = pair.second; - system->DestroyComponents(entity_id); + system->DeleteComponent(entity_id); + //system->EntitiesToDelete.insert(entity_id); system->Entities.erase(entity_id); system->EntitiesToCreate.erase(entity_id); } } + void DeleteComponents() + { + for (auto const& pair : m_systems) + { + auto const& system = pair.second; + system->DeleteComponents(); + } + } void InitialiseComponents() { for (auto const& pair : m_systems) diff --git a/HydraEngine/source/ecs/components/HydraShadowCasterComponent.h b/HydraEngine/source/ecs/components/HydraShadowCasterComponent.h new file mode 100644 index 0000000..e1273c2 --- /dev/null +++ b/HydraEngine/source/ecs/components/HydraShadowCasterComponent.h @@ -0,0 +1,9 @@ +#ifndef HYDRASHADOWCASTERCOMPONENT +#define HYDRASHADOWCASTERCOMPONENT +#include "../../engine/HydraEngine.h" + +struct HydraShadowCasterComponent +{ + +}; +#endif /* HYDRASHADOWCASTERCOMPONENT */ diff --git a/HydraEngine/source/ecs/systems/HydraMaterialSystem.cpp b/HydraEngine/source/ecs/systems/HydraMaterialSystem.cpp index c213900..0235aae 100644 --- a/HydraEngine/source/ecs/systems/HydraMaterialSystem.cpp +++ b/HydraEngine/source/ecs/systems/HydraMaterialSystem.cpp @@ -16,58 +16,22 @@ void HydraMaterialSystem::Initialise() { - HydraTaskScheduler *task_scheduler = GetEngine()->TaskScheduler(); - HydraID create_gpu_buffer_task_id = task_scheduler->CreateTask(HydraThreadAffinity::Render); - HydraCreateGPUBufferTask *task = static_cast(task_scheduler->GetTask(create_gpu_buffer_task_id)); - task->Intialise("MaterialBuffer", 1, MAX_MATERIALS * sizeof(HydraMaterialBuffer), &m_material_buffer_id, HYDRA_BUFFER_TYPE::HYDRA_SSBO_BUFFER); - task_scheduler->WaitForTask(create_gpu_buffer_task_id); - - create_gpu_buffer_task_id = task_scheduler->CreateTask(HydraThreadAffinity::Render); - task = static_cast(task_scheduler->GetTask(create_gpu_buffer_task_id)); - task->Intialise("TextureBuffer", 1, MAX_TEXTURES * sizeof(uint64_t), &m_texture_buffer_id, HYDRA_BUFFER_TYPE::HYDRA_SSBO_BUFFER); - task_scheduler->WaitForTask(create_gpu_buffer_task_id); } void HydraMaterialSystem::InitialiseComponent(HydraID entity_id) { } -void HydraMaterialSystem::FreeSystemResources() -{ - HydraTaskScheduler *task_scheduler = GetEngine()->TaskScheduler(); - - HydraID delete_gpu_buffer_task_id = task_scheduler->CreateTask(HydraThreadAffinity::Render); - HydraDeleteGPUBufferTask *task = static_cast(task_scheduler->GetTask(delete_gpu_buffer_task_id)); - task->Intialise(m_material_buffer_id); - task_scheduler->WaitForTask(delete_gpu_buffer_task_id); - - delete_gpu_buffer_task_id = task_scheduler->CreateTask(HydraThreadAffinity::Render); - task = static_cast(task_scheduler->GetTask(delete_gpu_buffer_task_id)); - task->Intialise(m_texture_buffer_id); - task_scheduler->WaitForTask(delete_gpu_buffer_task_id); -} void HydraMaterialSystem::UpdateSystem(float delta_t_seconds) { - _WriteToGPU(); + GetEngine()->MaterialBufferManager()->UpdateBuffer(); } - -void HydraMaterialSystem::_WriteToGPU() +void HydraMaterialSystem::DestroyComponent(HydraID entity_id) { - void* buffer = GetEngine()->MaterialBufferManager()->GetMaterialBuffer(); - - HydraTaskScheduler *task_scheduler = GetEngine()->TaskScheduler(); - - HydraID update_buffer_task_id = task_scheduler->CreateTask(HydraThreadAffinity::Render); - HydraUpdateWholeGPUBufferTask *task = static_cast(task_scheduler->GetTask(update_buffer_task_id)); - task->Intialise(m_material_buffer_id, buffer); - task_scheduler->WaitForTask(update_buffer_task_id); - - buffer = GetEngine()->TextureBufferManager()->GetTextureBuffer(); - update_buffer_task_id = task_scheduler->CreateTask(HydraThreadAffinity::Render); - task = static_cast(task_scheduler->GetTask(update_buffer_task_id)); - task->Intialise(m_texture_buffer_id, buffer); - task_scheduler->WaitForTask(update_buffer_task_id); + HydraMaterialComponent mat_comp = GetEngine()->ECS()->GetComponent(entity_id); + GetEngine()->MaterialBufferManager()->DeleteMaterial(mat_comp.material_id); } + diff --git a/HydraEngine/source/ecs/systems/HydraMaterialSystem.h b/HydraEngine/source/ecs/systems/HydraMaterialSystem.h index 99b39f4..fa8030a 100644 --- a/HydraEngine/source/ecs/systems/HydraMaterialSystem.h +++ b/HydraEngine/source/ecs/systems/HydraMaterialSystem.h @@ -14,9 +14,11 @@ class HydraMaterialSystem : public HydraSystem public: void Initialise() override; void InitialiseComponent(HydraID entity_id) override; + protected: - void FreeSystemResources() override; + virtual void UpdateSystem(float delta_t_seconds); + void DestroyComponent(HydraID entity_id) override; private: void _WriteToGPU(); HydraID m_material_buffer_id = INVALID_HYDRA_ID; diff --git a/HydraEngine/source/ecs/systems/HydraPhysicsSystem.cpp b/HydraEngine/source/ecs/systems/HydraPhysicsSystem.cpp index cd923fe..b55fcdd 100644 --- a/HydraEngine/source/ecs/systems/HydraPhysicsSystem.cpp +++ b/HydraEngine/source/ecs/systems/HydraPhysicsSystem.cpp @@ -8,6 +8,7 @@ #include "../../task/physics/HydraGetPhysicsUpdatesTask.hpp" #include "../../task/physics/HydraStepPhysicsTask.h" #include "../../task/physics/HydraSetPhysicsLinearVelocity.hpp" +#include "../../task/physics/HydraDeletePhysicsObjectTask.h" #include "../../ecs/HydraECS.h" #include "../../ecs/components/HydraPhysicsComponent.h" #include "../../ecs/components/HydraPositionComponent.h" @@ -86,12 +87,27 @@ void HydraPhysicsSystem::InitialiseComponent(HydraID entity_id) set_task->Initialise(body_id, pos_comp.position, glm::quat(pos_comp.orientation)); task_scheduler->WaitForTask(task_id); phys_comp.initialised = true; + DebugLog("PHYSICS CREATED:" + std::to_string(entity_id) + "\n"); } void HydraPhysicsSystem::DestroyComponent(HydraID entity_id) { - + HydraTaskScheduler *task_scheduler = GetEngine()->TaskScheduler(); + HydraPhysicsComponent& phys_comp = GetEngine()->ECS()->GetComponent(entity_id); + + if(phys_comp.initialised) + { + HydraID task_id = task_scheduler->CreateTask(HydraThreadAffinity::Physics); + HydraDeletePhysicsObjectTask *task = static_cast(task_scheduler->GetTask(task_id)); + task->Initialise(phys_comp.body_id); + task_scheduler->WaitForTask(task_id); + } + else + { + std::cout << "here"; + } + DebugLog("PHYSICS DELETED:" + std::to_string(entity_id) + "\n"); } void HydraPhysicsSystem::UpdateSystem(float delta_t_seconds) @@ -101,6 +117,7 @@ void HydraPhysicsSystem::UpdateSystem(float delta_t_seconds) { HydraID entity_id = m_bodies_to_set_transform.front(); m_bodies_to_set_transform.pop(); + HydraPhysicsComponent& phys_comp = GetEngine()->ECS()->GetComponent(entity_id); HydraPositionComponent& pos_comp = GetEngine()->ECS()->GetComponent(entity_id); diff --git a/HydraEngine/source/ecs/systems/HydraPointShadowSourceSystem.cpp b/HydraEngine/source/ecs/systems/HydraPointShadowSourceSystem.cpp index 54f3d6f..7ed5f0f 100644 --- a/HydraEngine/source/ecs/systems/HydraPointShadowSourceSystem.cpp +++ b/HydraEngine/source/ecs/systems/HydraPointShadowSourceSystem.cpp @@ -68,7 +68,6 @@ void HydraPointShadowSourceSystem::_UpdateShadowMap(HydraID entity_id) float view_size = 4.0f; float view_near = 0.1f; float view_far = 100.0f; - glm::vec3 camera_pos = GetEngine()->Camera()->GetPosition(); diff --git a/HydraEngine/source/ecs/systems/HydraShadowCasterSystem.h b/HydraEngine/source/ecs/systems/HydraShadowCasterSystem.h new file mode 100644 index 0000000..ece0b35 --- /dev/null +++ b/HydraEngine/source/ecs/systems/HydraShadowCasterSystem.h @@ -0,0 +1,16 @@ +#ifndef HYDRASHADOWCASTERSYSTEM +#define HYDRASHADOWCASTERSYSTEM + +#include "../../engine/HydraObject.h" +#include "../HydraSystem.h" +#include +#include + +class HydraShadowCasterSystem : public HydraSystem +{ + public: + + protected: + void UpdateSystem(float delta_t_seconds) override {} +}; +#endif /* HYDRASHADOWCASTERSYSTEM */ diff --git a/HydraEngine/source/engine/HydraEngine.cpp b/HydraEngine/source/engine/HydraEngine.cpp index f1adb32..18f7421 100644 --- a/HydraEngine/source/engine/HydraEngine.cpp +++ b/HydraEngine/source/engine/HydraEngine.cpp @@ -26,6 +26,7 @@ #include "../ecs/systems/HydraPointShadowSourceSystem.h" #include "../ecs/systems/HydraPhysicsSystem.h" #include "../ecs/systems/HydraTickActorsSystem.h" +#include "../ecs/systems/HydraShadowCasterSystem.h" #include "../ecs/components/HydraPositionComponent.h" #include "../ecs/components/HydraMeshComponent.h" @@ -38,6 +39,7 @@ #include "../ecs/components/HydraPointShadowSourceComponent.h" #include "../ecs/components/HydraPhysicsComponent.h" #include "../ecs/components/HydraTickComponent.h" +#include "../ecs/components/HydraShadowCasterComponent.h" #include "../camera/HydraCamera.h" #include "../actor/HydraActorManager.h" @@ -58,6 +60,7 @@ #include "../task/ecs/HydraUpdateSystemTask.hpp" #include "../task/ecs/HydraInitialiseComponentsTask.hpp" +#include "../task/ecs/HydraDeleteComponentsTask.hpp" #include "../task/buffer/HydraShutdownBufferManagerTask.hpp" #include "../task/buffer/HydraInitialiseTextureManagerTask.hpp" #include "../task/buffer/HydraInitialiseShadowBufferTask.hpp" @@ -210,7 +213,7 @@ void HydraEngine::_CreateManagers() void HydraEngine::_InitialiseManagers() { - m_task_scheduler->Initialise(1); + m_task_scheduler->Initialise(4); HydraID create_window_task_id = m_task_scheduler->CreateTask(HydraThreadAffinity::Render); m_task_scheduler->WaitForTask(create_window_task_id); @@ -245,6 +248,7 @@ void HydraEngine::_InitialiseSystems() m_ecs->RegisterComponentType(); m_ecs->RegisterComponentType(); m_ecs->RegisterComponentType(); + m_ecs->RegisterComponentType(); m_mesh_system = m_ecs->RegisterSystem(); m_transform_system = m_ecs->RegisterSystem(); @@ -256,6 +260,7 @@ void HydraEngine::_InitialiseSystems() m_point_shadow_system = m_ecs->RegisterSystem(); m_physics_system = m_ecs->RegisterSystem(); m_tick_system = m_ecs->RegisterSystem(); + m_shadow_caster_system = m_ecs->RegisterSystem(); HydraSignature mesh_sig; HydraSignature trans_sig; @@ -267,6 +272,7 @@ void HydraEngine::_InitialiseSystems() HydraSignature point_shadow_sig; HydraSignature physics_sig; HydraSignature tick_sig; + HydraSignature shadow_caster_sig; mesh_sig.set(m_ecs->GetComponentType(),true); trans_sig.set(m_ecs->GetComponentType(),true); @@ -293,6 +299,8 @@ void HydraEngine::_InitialiseSystems() tick_sig.set(m_ecs->GetComponentType(), true); + shadow_caster_sig.set(m_ecs->GetComponentType(), true); + m_ecs->SetSystemSignature(mesh_sig); m_ecs->SetSystemSignature(trans_sig); m_ecs->SetSystemSignature(render_sig); @@ -303,9 +311,10 @@ void HydraEngine::_InitialiseSystems() m_ecs->SetSystemSignature(point_shadow_sig); m_ecs->SetSystemSignature(physics_sig); m_ecs->SetSystemSignature(tick_sig); + m_ecs->SetSystemSignature(shadow_caster_sig); } - void HydraEngine::_UpdateSystems() + void HydraEngine::_UpdateSystems(bool fixed_update) { //Update physics system with any changes from the transform system @@ -350,8 +359,10 @@ void HydraEngine::_InitialiseSystems() m_task_scheduler->StartTask(update_spot_shadow_id); m_task_scheduler->StartTask(update_point_shadow_id); m_task_scheduler->WaitForBarrier(shadow_barrier); - - m_tick_system->FixedUpdate(m_fixed_delta_t); + if(fixed_update) + { + m_tick_system->FixedUpdate(m_fixed_delta_t); + } m_shadow_buffer_manager->UpdateShadowBuffer(); } @@ -426,6 +437,9 @@ void HydraEngine::_GameLoop() fpsFrameCount++; + HydraID delete_components_id = m_task_scheduler->CreateTask(HydraThreadAffinity::General); + m_task_scheduler->WaitForTask(delete_components_id); + HydraID processInputID = m_task_scheduler->CreateTask(HydraThreadAffinity::Render, barrierID); HydraProcessInputTask* m_input_task = static_cast(m_task_scheduler->GetTask(processInputID)); m_input_task->Initialise(fixed_tick); @@ -441,11 +455,13 @@ void HydraEngine::_GameLoop() if(fixed_tick) { + m_game->FixedUpdate(m_delta_t); + } m_game->Update(m_delta_t); - _UpdateSystems(); + _UpdateSystems(fixed_tick); diff --git a/HydraEngine/source/engine/HydraEngine.h b/HydraEngine/source/engine/HydraEngine.h index be490b2..ab57a53 100644 --- a/HydraEngine/source/engine/HydraEngine.h +++ b/HydraEngine/source/engine/HydraEngine.h @@ -31,6 +31,7 @@ class HydraShadowBufferManager; class HydraPointShadowSourceSystem; class HydraPhysicsSystem; class HydraTickActorsSystem; +class HydraShadowCasterSystem; class CLASS_DEFINE HydraEngine : public HydraObject { @@ -74,7 +75,7 @@ private: void _CreateManagers(); void _InitialiseManagers(); void _InitialiseSystems(); - void _UpdateSystems(); + void _UpdateSystems(bool fixed_update); void _GameLoop(); void _Shutdown(); @@ -108,6 +109,7 @@ private: std::shared_ptr m_point_shadow_system; std::shared_ptr m_physics_system; std::shared_ptr m_tick_system; + std::shared_ptr m_shadow_caster_system; bool m_running = true; float m_delta_t = 0.0f; float m_fixed_delta_t = 0.0f; diff --git a/HydraEngine/source/engine/HydraObject.cpp b/HydraEngine/source/engine/HydraObject.cpp index 7fc1a5e..7369e0e 100644 --- a/HydraEngine/source/engine/HydraObject.cpp +++ b/HydraEngine/source/engine/HydraObject.cpp @@ -8,7 +8,14 @@ HydraEngine *const HydraObject::GetEngine() void HydraObject::DebugLog(std::string log_entry) { - std::cout << log_entry + "\r\n"; + + +#ifdef __unix__ /* __unix__ is usually defined by compilers targeting Unix systems */ + std::cout << log_entry + "\r\n"; +#elif defined(_WIN32) || defined(WIN32) /* _Win32 is usually defined by compilers targeting 32 or 64 bit Windows systems */ + OutputDebugString(log_entry.c_str()); +#endif + } void HydraObject::ClearLog() diff --git a/HydraEngine/source/pipeline/HydraShadowPipeline.cpp b/HydraEngine/source/pipeline/HydraShadowPipeline.cpp index 401f157..d387cc5 100644 --- a/HydraEngine/source/pipeline/HydraShadowPipeline.cpp +++ b/HydraEngine/source/pipeline/HydraShadowPipeline.cpp @@ -14,7 +14,9 @@ #include "../ecs/systems/HydraDirectionalShadowSourceSystem.h" #include "../ecs/systems/HydraSpotShadowSourceSystem.h" #include "../ecs/systems/HydraPointShadowSourceSystem.h" +#include "../ecs/systems/HydraShadowCasterSystem.h" #include "../ecs/components/HydraLightComponent.h" +#include "../ecs/components/HydraRenderableComponent.h" #include "../mesh/StandardVertex.h" #include "../actor/HydraActorManager.h" #include "../actor/HydraOutputActor.h" @@ -34,74 +36,75 @@ void HydraShadowPipeline::Shutdown() void HydraShadowPipeline::Render() { - - + glEnable(GL_DEPTH_TEST); // Depth testing must be active glDepthMask(GL_TRUE); // Depth buffer must be writable glDepthFunc(GL_LESS); - + _RenderDirectionalShadowMaps(); _RenderSpotShadowMaps(); _RenderPointShadowMaps(); - } void HydraShadowPipeline::_RenderPointShadowMaps() { - HydraECS *ecs = GetEngine()->ECS(); - std::shared_ptr render_system = ecs->GetSystem(); + HydraECS *ecs = GetEngine()->ECS(); + std::shared_ptr render_system = ecs->GetSystem(); std::shared_ptr shadow_system = ecs->GetSystem(); glViewport(0, 0, POINT_SHADOW_MAP_SIZE, POINT_SHADOW_MAP_SIZE); + for (HydraID entity_id : shadow_system->Entities) { - HydraPointShadowSourceComponent shad_comp = GetEngine()->ECS()->GetComponent(entity_id); - HydraLightComponent light_comp = GetEngine()->ECS()->GetComponent(entity_id); - - _UpdateUBO(light_comp.shadow_map_id); - glBindFramebuffer(GL_FRAMEBUFFER, shad_comp.frame_buffer_id); + HydraPointShadowSourceComponent shad_comp = GetEngine()->ECS()->GetComponent(entity_id); + HydraLightComponent light_comp = GetEngine()->ECS()->GetComponent(entity_id); - float depth_value = 1.0f; - glClear(GL_DEPTH_BUFFER_BIT); + _UpdateUBO(light_comp.shadow_map_id); + glBindFramebuffer(GL_FRAMEBUFFER, shad_comp.frame_buffer_id); - m_render_stages[POINT_RENDER_STAGE]->Render(render_system->Entities, INVALID_HYDRA_ID); - glBindFramebuffer(GL_FRAMEBUFFER, 0); + 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(); - std::shared_ptr render_system = ecs->GetSystem(); + HydraECS *ecs = GetEngine()->ECS(); + std::shared_ptr render_system = ecs->GetSystem(); std::shared_ptr shadow_system = ecs->GetSystem(); glViewport(0, 0, DIRECTIONAL_SHADOW_MAP_SIZE, DIRECTIONAL_SHADOW_MAP_SIZE); + for (HydraID entity_id : shadow_system->Entities) { - HydraDirectionalShadowSourceComponent shad_comp = GetEngine()->ECS()->GetComponent(entity_id); - HydraLightComponent light_comp = GetEngine()->ECS()->GetComponent(entity_id); - _UpdateUBO(light_comp.shadow_map_id); - - glBindFramebuffer(GL_FRAMEBUFFER, shad_comp.frame_buffer_id); + HydraDirectionalShadowSourceComponent shad_comp = GetEngine()->ECS()->GetComponent(entity_id); + HydraLightComponent light_comp = GetEngine()->ECS()->GetComponent(entity_id); + _UpdateUBO(light_comp.shadow_map_id); - float depth_value = 1.0f; - glClearNamedFramebufferfv(shad_comp.frame_buffer_id, GL_DEPTH, 0, &depth_value); - m_render_stages[DIRECTIONAL_RENDER_STAGE]->Render(render_system->Entities, INVALID_HYDRA_ID); - glBindFramebuffer(GL_FRAMEBUFFER, 0); + glBindFramebuffer(GL_FRAMEBUFFER, shad_comp.frame_buffer_id); + + float depth_value = 1.0f; + glClearNamedFramebufferfv(shad_comp.frame_buffer_id, GL_DEPTH, 0, &depth_value); + + m_render_stages[DIRECTIONAL_RENDER_STAGE]->Render(render_system->Entities, INVALID_HYDRA_ID); + glBindFramebuffer(GL_FRAMEBUFFER, 0); } } void HydraShadowPipeline::_RenderSpotShadowMaps() { - HydraECS *ecs = GetEngine()->ECS(); - std::shared_ptr render_system = ecs->GetSystem(); + HydraECS *ecs = GetEngine()->ECS(); + std::shared_ptr render_system = ecs->GetSystem(); std::shared_ptr shadow_system = ecs->GetSystem(); glViewport(0, 0, SPOT_SHADOW_MAP_SIZE, SPOT_SHADOW_MAP_SIZE); + for (HydraID entity_id : shadow_system->Entities) { HydraSpotShadowSourceComponent shad_comp = GetEngine()->ECS()->GetComponent(entity_id); HydraLightComponent light_comp = GetEngine()->ECS()->GetComponent(entity_id); _UpdateUBO(light_comp.shadow_map_id); - + glBindFramebuffer(GL_FRAMEBUFFER, shad_comp.frame_buffer_id); float depth_value = 1.0f; @@ -273,7 +276,6 @@ void HydraShadowPipeline::_CreateSpotRenderStage() m_render_stages[SPOT_RENDER_STAGE] = render_stage; } - void HydraShadowPipeline::_UpdateUBO(uint32_t shadow_idx) { HydraBufferManager *buffer_manager = GetEngine()->BufferManager(); @@ -288,7 +290,6 @@ void HydraShadowPipeline::_BindFrameBufferAttachments(HydraID entity_id) glBindTextureUnit(0, 0); } - void HydraShadowPipeline::_CreateUBOs() { HydraBufferManager *buffer_manager = GetEngine()->BufferManager(); diff --git a/HydraEngine/source/renderer/HydraRenderer.cpp b/HydraEngine/source/renderer/HydraRenderer.cpp index 3730916..e048017 100644 --- a/HydraEngine/source/renderer/HydraRenderer.cpp +++ b/HydraEngine/source/renderer/HydraRenderer.cpp @@ -26,8 +26,8 @@ void HydraRenderer::Initialise(HydraRenderSettings render_settings) glEnable(GL_DEPTH_TEST); glEnable(GL_DEBUG_OUTPUT); - glfwSwapInterval(1); - glDebugMessageCallback(MessageCallback, 0); + glfwSwapInterval(0); + // glDebugMessageCallback(MessageCallback, 0); } } diff --git a/HydraEngine/source/task/ecs/HydraDeleteComponentsTask.hpp b/HydraEngine/source/task/ecs/HydraDeleteComponentsTask.hpp new file mode 100644 index 0000000..47ebfe7 --- /dev/null +++ b/HydraEngine/source/task/ecs/HydraDeleteComponentsTask.hpp @@ -0,0 +1,27 @@ +#ifndef HYDRADELETECOMPONENTSTASK +#define HYDRADELETECOMPONENTSTASK + + +#include "../HydraTask.h" +#include "../../engine/HydraEngine.h" +#include "../../ecs/HydraECS.h" +#include + + +class HydraDeleteComponentsTask : public HydraTask +{ + private: + + protected: + public: + virtual void Process() override + { + + // GetEngine()->ECS()->DeleteComponents(); + } + + +}; + + +#endif /* HYDRADELETECOMPONENTSTASK */ diff --git a/HydraEngine/source/task/ecs/HydraInitialiseComponentsTask.hpp b/HydraEngine/source/task/ecs/HydraInitialiseComponentsTask.hpp index a3ab3ad..44105ad 100644 --- a/HydraEngine/source/task/ecs/HydraInitialiseComponentsTask.hpp +++ b/HydraEngine/source/task/ecs/HydraInitialiseComponentsTask.hpp @@ -14,6 +14,7 @@ class HydraInitialiseComponentsTask : public HydraTask public: virtual void Process() override { + GetEngine()->ECS()->InitialiseComponents(); } diff --git a/HydraEngine/source/task/physics/HydraCreatePhysicsObjectTask.hpp b/HydraEngine/source/task/physics/HydraCreatePhysicsObjectTask.hpp index 775df52..c0e071e 100644 --- a/HydraEngine/source/task/physics/HydraCreatePhysicsObjectTask.hpp +++ b/HydraEngine/source/task/physics/HydraCreatePhysicsObjectTask.hpp @@ -57,9 +57,10 @@ public: b3Pos pos = {}; shapeDef.density = 1.0f; - shapeDef.baseMaterial.restitution = 0.4f; + shapeDef.baseMaterial.restitution = 0.6f; b3CreateHullShape(*m_body_id, &shapeDef, &box.base ); + DebugLog("B3LOG " + std::to_string(m_entity_id) + " BODY " + std::to_string(m_body_id->index1) + "\n"); } void Initialise(b3WorldId world_id, HydraPhysicsComponent physics_comp, b3BodyId* body_id, HydraID entity_id) diff --git a/HydraEngine/source/task/physics/HydraDeletePhysicsObjectTask.h b/HydraEngine/source/task/physics/HydraDeletePhysicsObjectTask.h index 8e68d7e..4a912a6 100644 --- a/HydraEngine/source/task/physics/HydraDeletePhysicsObjectTask.h +++ b/HydraEngine/source/task/physics/HydraDeletePhysicsObjectTask.h @@ -20,6 +20,7 @@ public: void Process() override { b3DestroyBody(m_body_id); + DebugLog("B3 DELETE " + std::to_string(m_body_id.index1) + "\n"); } void Initialise(b3BodyId body_id) diff --git a/HydraEngine/source/task/physics/HydraInitialisePhysicsWorldTask.hpp b/HydraEngine/source/task/physics/HydraInitialisePhysicsWorldTask.hpp index 6fe27c9..a59a693 100644 --- a/HydraEngine/source/task/physics/HydraInitialisePhysicsWorldTask.hpp +++ b/HydraEngine/source/task/physics/HydraInitialisePhysicsWorldTask.hpp @@ -20,9 +20,9 @@ public: void Process() override { b3WorldDef world_def = b3DefaultWorldDef(); - world_def.workerCount = 1; + world_def.workerCount = 4; world_def.enableSleep = true; - + world_def.enableContinuous = true; *m_world_id = b3CreateWorld( &world_def ); diff --git a/HydraEngine/source/task/physics/HydraStepPhysicsTask.h b/HydraEngine/source/task/physics/HydraStepPhysicsTask.h index cff4ca3..f1e7cae 100644 --- a/HydraEngine/source/task/physics/HydraStepPhysicsTask.h +++ b/HydraEngine/source/task/physics/HydraStepPhysicsTask.h @@ -24,22 +24,23 @@ public: b3BodyEvents events = b3World_GetBodyEvents(m_world_id); HydraTaskScheduler* task_scheduler = GetEngine()->TaskScheduler(); - HydraID barrier_id = task_scheduler->CreateBarrier(); + // HydraID barrier_id = task_scheduler->CreateBarrier(); for(uint32_t i = 0; i < events.moveCount; i ++) { - HydraID task_id = task_scheduler->CreateTask(HydraThreadAffinity::General, barrier_id); + HydraID task_id = task_scheduler->CreateTask(HydraThreadAffinity::General);//, barrier_id); HydraSetWorldTransformTask *set_task = static_cast(task_scheduler->GetTask(task_id)); glm::dvec3 position = {events.moveEvents[i].transform.p.x, events.moveEvents[i].transform.p.y, events.moveEvents[i].transform.p.z}; glm::quat temp = glm::quat(events.moveEvents[i].transform.q.s, glm::vec3(events.moveEvents[i].transform.q.v.x, events.moveEvents[i].transform.q.v.y, events.moveEvents[i].transform.q.v.z)); glm::vec3 rotation = glm::eulerAngles(temp); HydraID* entity_id = reinterpret_cast(events.moveEvents[i].userData); - + set_task->Initialise(*entity_id, position, rotation); - task_scheduler->StartTask(task_id); + //task_scheduler->StartTask(task_id); + task_scheduler->WaitForTask(task_id); } - task_scheduler->WaitForBarrier(barrier_id); + //task_scheduler->WaitForBarrier(barrier_id); } void Initialise(b3WorldId world_id, float delta_t_seconds) { diff --git a/build/.cmake/api/v1/reply/index-2026-08-25T16-46-16-0515.json b/build/.cmake/api/v1/reply/index-2026-08-28T07-59-00-0219.json similarity index 100% rename from build/.cmake/api/v1/reply/index-2026-08-25T16-46-16-0515.json rename to build/.cmake/api/v1/reply/index-2026-08-28T07-59-00-0219.json diff --git a/build/Debug/HydraClient.pdb b/build/Debug/HydraClient.pdb index ce1a19c..6e30b83 100644 Binary files a/build/Debug/HydraClient.pdb and b/build/Debug/HydraClient.pdb differ diff --git a/build/HydraClient.dir/Debug/HydraClient.ilk b/build/HydraClient.dir/Debug/HydraClient.ilk index 6f6ff80..be31f31 100644 Binary files a/build/HydraClient.dir/Debug/HydraClient.ilk and b/build/HydraClient.dir/Debug/HydraClient.ilk differ diff --git a/build/HydraClient.dir/Debug/HydraClient.tlog/unsuccessfulbuild b/build/HydraClient.dir/Debug/HydraClient.tlog/unsuccessfulbuild new file mode 100644 index 0000000..e69de29 diff --git a/build/HydraClient.dir/Debug/vc143.pdb b/build/HydraClient.dir/Debug/vc143.pdb index 4bdc2c6..a554a2e 100644 Binary files a/build/HydraClient.dir/Debug/vc143.pdb and b/build/HydraClient.dir/Debug/vc143.pdb differ diff --git a/build/HydraEngine/Debug/HydraEngine.exp b/build/HydraEngine/Debug/HydraEngine.exp index cf1673e..96df262 100644 Binary files a/build/HydraEngine/Debug/HydraEngine.exp and b/build/HydraEngine/Debug/HydraEngine.exp differ diff --git a/build/HydraEngine/Debug/HydraEngine.pdb b/build/HydraEngine/Debug/HydraEngine.pdb index d13eac4..0dd7b06 100644 Binary files a/build/HydraEngine/Debug/HydraEngine.pdb and b/build/HydraEngine/Debug/HydraEngine.pdb differ diff --git a/build/HydraEngine/HydraEngine.dir/Debug/HydraEngine.ilk b/build/HydraEngine/HydraEngine.dir/Debug/HydraEngine.ilk index ca6f591..7c993b8 100644 Binary files a/build/HydraEngine/HydraEngine.dir/Debug/HydraEngine.ilk and b/build/HydraEngine/HydraEngine.dir/Debug/HydraEngine.ilk differ diff --git a/build/HydraEngine/HydraEngine.dir/Debug/HydraEngine.tlog/CL.command.1.tlog b/build/HydraEngine/HydraEngine.dir/Debug/HydraEngine.tlog/CL.command.1.tlog index 9b29ffd..64ee36e 100644 Binary files a/build/HydraEngine/HydraEngine.dir/Debug/HydraEngine.tlog/CL.command.1.tlog and b/build/HydraEngine/HydraEngine.dir/Debug/HydraEngine.tlog/CL.command.1.tlog differ diff --git a/build/HydraEngine/HydraEngine.dir/Debug/HydraEngine.tlog/CL.read.1.tlog b/build/HydraEngine/HydraEngine.dir/Debug/HydraEngine.tlog/CL.read.1.tlog index e9a6b39..4e886b9 100644 Binary files a/build/HydraEngine/HydraEngine.dir/Debug/HydraEngine.tlog/CL.read.1.tlog and b/build/HydraEngine/HydraEngine.dir/Debug/HydraEngine.tlog/CL.read.1.tlog differ diff --git a/build/HydraEngine/HydraEngine.dir/Debug/HydraEngine.tlog/CL.write.1.tlog b/build/HydraEngine/HydraEngine.dir/Debug/HydraEngine.tlog/CL.write.1.tlog index 669982d..96b7260 100644 Binary files a/build/HydraEngine/HydraEngine.dir/Debug/HydraEngine.tlog/CL.write.1.tlog and b/build/HydraEngine/HydraEngine.dir/Debug/HydraEngine.tlog/CL.write.1.tlog differ diff --git a/build/HydraEngine/HydraEngine.dir/Debug/vc143.pdb b/build/HydraEngine/HydraEngine.dir/Debug/vc143.pdb index 3b5509e..13190fb 100644 Binary files a/build/HydraEngine/HydraEngine.dir/Debug/vc143.pdb and b/build/HydraEngine/HydraEngine.dir/Debug/vc143.pdb differ diff --git a/build/linkerrors.txt b/build/linkerrors.txt index eb542c1..5994222 100644 --- a/build/linkerrors.txt +++ b/build/linkerrors.txt @@ -1,8 +1,11 @@ ================================================================================ Linker Errors -Generated: 2026-08-23T11:17:59.197Z -Total Errors: 1 +Generated: 2026-08-27T18:38:11.302Z +Total Errors: 2 ================================================================================ -[LNK4098] (MSVC) -defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library [C:\Code\HydraV3\build\HydraEngine\HydraEngine.vcxproj] +[LNK2001] (MSVC) +unresolved external symbol "protected: virtual void __cdecl HydraMaterialSystem::FreeSystemResources(void)" (?FreeSystemResources@HydraMaterialSystem@@MEAAXXZ) [C:\Code\HydraV3\build\HydraEngine\HydraEngine.vcxproj] + +[LNK1120] (MSVC) +1 unresolved externals [C:\Code\HydraV3\build\HydraEngine\HydraEngine.vcxproj]