2026-07-17 15:30:29 +01:00
|
|
|
#include "HydraGame.h"
|
|
|
|
|
|
|
|
|
|
bool HydraGame::Initialise()
|
|
|
|
|
{
|
|
|
|
|
// m_angle = 0.01f;
|
|
|
|
|
|
2026-08-18 16:23:20 +01:00
|
|
|
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);
|
2026-07-18 18:39:17 +01:00
|
|
|
|
2026-09-04 15:26:37 +01:00
|
|
|
// m_spawner_id = GetEngine()->ActorManager()->CreateActor<HydraLightSpawnerActor>();
|
|
|
|
|
// GetEngine()->ActorManager()->InitialiseActor(m_spawner_id);
|
|
|
|
|
// GetEngine()->ActorManager()->SetPosition(m_spawner_id, glm::dvec3(0, 1.0, 0));
|
|
|
|
|
// HydraLightSpawnerActor* actor = static_cast<HydraLightSpawnerActor*>(GetEngine()->ActorManager()->GetActor(m_spawner_id));
|
|
|
|
|
// 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);
|
2026-08-25 22:10:54 +01:00
|
|
|
|
|
|
|
|
|
2026-08-17 14:12:11 +01:00
|
|
|
// 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));
|
2026-08-03 22:34:52 +01:00
|
|
|
|
2026-08-18 16:23:20 +01:00
|
|
|
// m_point_light_id = GetEngine()->ActorManager()->CreateActor<HydraPointLightActor>();
|
|
|
|
|
// GetEngine()->ActorManager()->InitialiseActor(m_point_light_id);
|
|
|
|
|
// GetEngine()->ActorManager()->SetPosition(m_point_light_id, glm::dvec3(2.0f, 3.0f, 2.0f));
|
2026-07-17 15:30:29 +01:00
|
|
|
|
|
|
|
|
// //1.570796327f
|
|
|
|
|
// //3.141592654f
|
|
|
|
|
|
2026-09-04 15:26:37 +01:00
|
|
|
m_planet_actor_id = GetEngine()->ActorManager()->CreateActor<HydraPlanetActor>();
|
|
|
|
|
GetEngine()->ActorManager()->InitialiseActor(m_planet_actor_id);
|
|
|
|
|
GetEngine()->ActorManager()->SetPosition(m_planet_actor_id, glm::dvec3(0, 0.0, 0));
|
2026-08-17 21:44:00 +01:00
|
|
|
|
2026-08-25 22:10:54 +01:00
|
|
|
// m_cube_actor_id = GetEngine()->ActorManager()->CreateActor<HydraTestCubeActor>();
|
|
|
|
|
// GetEngine()->ActorManager()->InitialiseActor(m_cube_actor_id);
|
|
|
|
|
// GetEngine()->ActorManager()->SetPosition(m_cube_actor_id, glm::dvec3(0, 1.0, 0));
|
2026-08-28 16:36:25 +01:00
|
|
|
// GetEngine()->ActorManager()->SetLinearVelocity(m_cube_actor_id, glm::vec3(0,20,0));
|
2026-08-03 22:34:52 +01:00
|
|
|
|
2026-09-04 15:26:37 +01:00
|
|
|
// m_plane_actor_id = GetEngine()->ActorManager()->CreateActor<HydraPlaneActor>();
|
|
|
|
|
// 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.0f);
|
2026-08-24 20:59:24 +01:00
|
|
|
|
2026-08-18 16:23:20 +01:00
|
|
|
|
2026-08-16 13:47:11 +01:00
|
|
|
// 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));
|
|
|
|
|
|
2026-08-18 16:23:20 +01:00
|
|
|
// m_cube_actor_id = GetEngine()->ActorManager()->CreateActor<HydraPlaneActor>();
|
|
|
|
|
// GetEngine()->ActorManager()->InitialiseActor(m_cube_actor_id);
|
2026-07-17 15:30:29 +01:00
|
|
|
// GetEngine()->ActorManager()->SetPosition(m_cube_actor_id, glm::dvec3(0, -2, 0));
|
|
|
|
|
// GetEngine()->ActorManager()->SetRelationship(m_plane_actor_id, m_cube_actor_id);
|
|
|
|
|
|
2026-08-18 16:23:20 +01:00
|
|
|
// m_gltf_id = GetEngine()->ActorManager()->LoadActor("c:/Code/HydraV3/Media/AntiqueCamera.glb");
|
2026-08-17 21:44:00 +01:00
|
|
|
// GetEngine()->ActorManager()->InitialiseActor(m_gltf_id);
|
|
|
|
|
// GetEngine()->ActorManager()->SetPosition(m_gltf_id, glm::dvec3(0, 0, 0));
|
2026-07-17 15:30:29 +01:00
|
|
|
|
2026-08-18 16:23:20 +01:00
|
|
|
// m_gltf_id1 = GetEngine()->ActorManager()->LoadActor("c:/Code/HydraV3/Media/Tree1.glb");
|
2026-08-04 18:32:37 +01:00
|
|
|
// GetEngine()->ActorManager()->InitialiseActor(m_gltf_id);
|
|
|
|
|
// GetEngine()->ActorManager()->SetPosition(m_gltf_id, glm::dvec3(0, 0, 500));
|
2026-08-03 22:34:52 +01:00
|
|
|
|
2026-07-17 15:30:29 +01:00
|
|
|
m_player_actor_id = GetEngine()->ActorManager()->CreateActor<HydraPlayerActor>();
|
|
|
|
|
GetEngine()->ActorManager()->InitialiseActor(m_player_actor_id);
|
2026-09-05 21:56:45 +01:00
|
|
|
GetEngine()->ActorManager()->SetPosition(m_player_actor_id, glm::dvec3(0, 0, 110000));
|
2026-07-17 15:30:29 +01:00
|
|
|
|
|
|
|
|
GetEngine()->PossessPlayer(m_player_actor_id);
|
|
|
|
|
GetEngine()->Camera()->AttachToActor(m_player_actor_id);
|
|
|
|
|
|
2026-08-18 16:23:20 +01:00
|
|
|
// GetEngine()->ActorManager()->SetRelationship(m_player_actor_id, m_other_light_id);
|
2026-08-16 13:47:11 +01:00
|
|
|
|
2026-07-17 15:30:29 +01:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void HydraGame::Update(float delta_t_seconds)
|
|
|
|
|
{
|
2026-08-24 20:59:24 +01:00
|
|
|
|
2026-07-17 15:30:29 +01:00
|
|
|
// GetEngine()->ActorManager()->SetOrientation(m_sun_light_id, m_angle, 0.4, 0.0f);
|
|
|
|
|
// if(m_angle > (M_PI) - 0.01)
|
|
|
|
|
// {
|
|
|
|
|
// m_angle = 0.01;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
m_angle += m_diff;
|
2026-08-18 16:23:20 +01:00
|
|
|
// GetEngine()->ActorManager()->SetOrientation(m_other_light_id, -0.5f, m_angle, 0);
|
|
|
|
|
// GetEngine()->ActorManager()->SetOrientation(m_gltf_id, 0, m_angle, 0);
|
|
|
|
|
// GetEngine()->ActorManager()->SetOrientation(m_plane_actor_id, 0, m_angle, 0);
|
2026-08-24 20:59:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void HydraGame::FixedUpdate(float delta_t_seconds)
|
|
|
|
|
{
|
|
|
|
|
if (GetEngine()->KeyDown(HYDRA_KEY_CODES::HYDRA_KEY_ESCAPE))
|
|
|
|
|
{
|
|
|
|
|
GetEngine()->Exit();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (GetEngine()->KeyDown(HYDRA_KEY_CODES::HYDRA_KEY_0))
|
|
|
|
|
{
|
|
|
|
|
GetEngine()->ActorManager()->DeleteActor(m_sun_light_id);
|
|
|
|
|
}
|
|
|
|
|
if (GetEngine()->KeyDown(HYDRA_KEY_CODES::HYDRA_KEY_9))
|
|
|
|
|
{
|
|
|
|
|
if (m_spot_light_id == INVALID_HYDRA_ID)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
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));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (GetEngine()->KeyDown(HYDRA_KEY_CODES::HYDRA_KEY_8))
|
|
|
|
|
{
|
|
|
|
|
if (m_point_light_id == INVALID_HYDRA_ID)
|
|
|
|
|
{
|
|
|
|
|
m_point_light_id = GetEngine()->ActorManager()->CreateActor<HydraPointLightActor>();
|
|
|
|
|
GetEngine()->ActorManager()->InitialiseActor(m_point_light_id);
|
|
|
|
|
GetEngine()->ActorManager()->SetPosition(m_point_light_id, glm::dvec3(2.0f, 3.0f, 2.0f));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
GetEngine()->ActorManager()->DeleteActor(m_point_light_id);
|
|
|
|
|
m_point_light_id = INVALID_HYDRA_ID;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|