Conquer Space 0.0.0
A space themed grand strategy game set in the near future, with realistic orbital mechanics, and an emphasis on economics and politics.
Public Member Functions | Public Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
cqsp::client::systems::StarSystemController Class Reference

#include <starsystemcontroller.h>

Public Member Functions

 StarSystemController (core::Universe &, engine::Application &, StarSystemCamera &, SysStarSystemRenderer &)
 
void Update (float delta_time)
 
glm::vec3 GetMouseOnObjectPosition ()
 
glm::quat GetBodyRotation (double axial, double rotation, double day_offset) const
 Gets the quaternion to calculate the planet's rotation from the axial rotation and the rotation period More...
 
glm::quat GetBodyRotation (const core::components::bodies::Body &body) const
 
bool ShouldDrawCityPrototype ()
 
glm::vec3 CalculateCenteredObject (const entt::entity &)
 
glm::vec3 CalculateCenteredObject (const glm::vec3 &)
 
glm::vec3 CalculateObjectPos (const entt::entity &ent)
 
void FocusOnProvince (entt::entity province)
 
void FocusOnProvinceListener (const ctx::ViewProvince &province)
 
void PreRender ()
 
glm::vec3 CalculateFuturePosition (const entt::entity entity)
 
glm::vec3 CalculateFutureCenteredPosition (const entt::entity entity)
 
entt::entity GetSelectedCountry ()
 

Public Attributes

entt::entity m_viewing_entity = entt::null
 

Private Types

enum  CameraState { FreeCamera , PlanetIntertial , PlanetFixed }
 

Private Member Functions

void SeeEntity ()
 
void CenterCameraOnCity ()
 
void MoveCamera (double delta_time)
 
void FocusOnEntity (entt::entity ent)
 
void SeePlanet (entt::entity ent)
 
void CalculateScroll ()
 
float GetScrollValue ()
 
void FocusPlanetView ()
 
void FocusCityView ()
 
void HandleCameraMovement (float delta_time)
 
void CalculateCityPositions (entt::entity entity)
 Calculate offset for all cities on planet if they exist. More...
 
void CenterCameraOnPoint ()
 
void SetCameraToPlanetReferenceFrame ()
 
void SetCameraToSolarSystemReferenceFrame ()
 
void FoundCity ()
 
bool IsFoundingCity ()
 
void UpdateMapMode ()
 
glm::vec3 CalculateMouseRay (const glm::vec3 &ray_nds)
 
entt::entity GetMouseOnObject (int mouse_x, int mouse_y)
 
void CalculateViewChange (double deltaX, double deltaY)
 
core::components::types::SurfaceCoordinate GetMouseSurfaceIntersection ()
 
glm::vec3 GetMouseInScreenSpace (int mouse_x, int mouse_y)
 
std::optional< glm::vec3 > CheckIntersection (const glm::vec3 &object_pos, const glm::vec3 &ray_wor, float radius)
 
void SetCountryProvincesColor (entt::entity country)
 
void SetCountryProvincesToProvinceColor (entt::entity country)
 
void HandleProvinceHoverColor ()
 
glm::vec4 GetCountryProvinceColor (entt::entity province)
 
glm::vec4 ColonizationTargetProvinceColor (entt::entity province)
 
void SelectProvince ()
 
void ResetProvinceColor (entt::entity province)
 
void SelectForeignProvince (entt::entity province)
 
void SelectDomesticProvince (entt::entity province)
 
void HandleHoverTooltip ()
 
bool MouseOverObjectBillboard (glm::vec3 object_pos)
 
std::optional< glm::vec3 > IsMouseOverEntity (entt::entity entity, glm::vec3 ray_wor, double radius)
 
void CheckHoveringEntity ()
 
entt::entity SurfaceCoordinateToProvince (core::components::types::SurfaceCoordinate coordinate, entt::entity planet)
 
glm::vec4 CountryColorToVec4 (const glm::vec3 &color)
 
glm::vec4 CountryColorToVec4 (const core::components::ProvinceColor &color)
 
glm::vec4 CountryColorToVec4 (const entt::entity province)
 
glm::vec4 GetCountrySelectionColor (const glm::vec3 &country_color)
 
glm::vec3 MixScale (float amount)
 
core::components::types::SurfaceCoordinate GetCameraOverCoordinate ()
 

Private Attributes

core::Universeuniverse
 
engine::Applicationapp
 
StarSystemCameracamera
 
SysStarSystemRendererrenderer
 
entt::entity terrain_displaying = entt::null
 
entt::entity selected_city = entt::null
 
double previous_mouseX = 0
 
double previous_mouseY = 0
 
int tex_x = 0
 Debugging mouse position More...
 
int tex_y = 0
 
int tex_r = 0
 Debugging colors More...
 
int tex_g = 0
 
int tex_b = 0
 
entt::entity hovering_province
 
entt::entity hovering_planet = entt::null
 
entt::entity hovering_country = entt::null
 
entt::entity selected_province = entt::null
 
entt::entity selected_country = entt::null
 
glm::vec3 mouse_on_object_position = glm::vec3(0)
 
bool is_rendering_founding_city = false
 
bool is_founding_city = false
 
bool focus_on_city = false
 
bool planet_frame_scroll = false
 
const float CAMERA_MOVEMENT_SPEED = 30.f / 40.f
 
const float PAN_SPEED = 2.0f
 
const float SCROLL_SENSITIVITY = 3.f / 33.f
 
const float DEFAULT_PROVINCE_APLHA = 0.65f
 
core::components::types::SurfaceCoordinate target_surface_coordinate
 
friend StarSystemViewUI
 
const glm::vec4 selected_province_color = glm::vec4(1.f, 0.f, 0.f, 0.35f)
 
ctx::MapMode last_map_mode = ctx::MapMode::NoMapMode
 
entt::entity focused_planet = entt::null
 
entt::entity last_focused_planet = entt::null
 
entt::entity last_hovered_province = entt::null
 
CameraState camera_state = CameraState::FreeCamera
 

Member Enumeration Documentation

◆ CameraState

Enumerator
FreeCamera 
PlanetIntertial 
PlanetFixed 

Constructor & Destructor Documentation

◆ StarSystemController()

cqsp::client::systems::StarSystemController::StarSystemController ( core::Universe _u,
engine::Application _a,
StarSystemCamera _c,
SysStarSystemRenderer _r 
)

Member Function Documentation

◆ CalculateCenteredObject() [1/2]

glm::vec3 cqsp::client::systems::StarSystemController::CalculateCenteredObject ( const entt::entity &  ent)

◆ CalculateCenteredObject() [2/2]

glm::vec3 cqsp::client::systems::StarSystemController::CalculateCenteredObject ( const glm::vec3 &  vec)

◆ CalculateCityPositions()

void cqsp::client::systems::StarSystemController::CalculateCityPositions ( entt::entity  entity)
private

Calculate offset for all cities on planet if they exist.

◆ CalculateFutureCenteredPosition()

glm::vec3 cqsp::client::systems::StarSystemController::CalculateFutureCenteredPosition ( const entt::entity  entity)

Calculates interpolated position with respect with the camera center.

◆ CalculateFuturePosition()

glm::vec3 cqsp::client::systems::StarSystemController::CalculateFuturePosition ( const entt::entity  entity)

◆ CalculateMouseRay()

glm::vec3 cqsp::client::systems::StarSystemController::CalculateMouseRay ( const glm::vec3 &  ray_nds)
private

◆ CalculateObjectPos()

glm::vec3 cqsp::client::systems::StarSystemController::CalculateObjectPos ( const entt::entity &  ent)

◆ CalculateScroll()

void cqsp::client::systems::StarSystemController::CalculateScroll ( )
private

◆ CalculateViewChange()

void cqsp::client::systems::StarSystemController::CalculateViewChange ( double  deltaX,
double  deltaY 
)
private

◆ CenterCameraOnCity()

void cqsp::client::systems::StarSystemController::CenterCameraOnCity ( )
private

◆ CenterCameraOnPoint()

void cqsp::client::systems::StarSystemController::CenterCameraOnPoint ( )
private

◆ CheckHoveringEntity()

void cqsp::client::systems::StarSystemController::CheckHoveringEntity ( )
private

◆ CheckIntersection()

std::optional< glm::vec3 > cqsp::client::systems::StarSystemController::CheckIntersection ( const glm::vec3 &  object_pos,
const glm::vec3 &  ray_wor,
float  radius 
)
private

◆ ColonizationTargetProvinceColor()

glm::vec4 cqsp::client::systems::StarSystemController::ColonizationTargetProvinceColor ( entt::entity  province)
private

◆ CountryColorToVec4() [1/3]

glm::vec4 cqsp::client::systems::StarSystemController::CountryColorToVec4 ( const core::components::ProvinceColor color)
private

◆ CountryColorToVec4() [2/3]

glm::vec4 cqsp::client::systems::StarSystemController::CountryColorToVec4 ( const entt::entity  province)
private

◆ CountryColorToVec4() [3/3]

glm::vec4 cqsp::client::systems::StarSystemController::CountryColorToVec4 ( const glm::vec3 &  color)
private

◆ FocusCityView()

void cqsp::client::systems::StarSystemController::FocusCityView ( )
private

◆ FocusOnEntity()

void cqsp::client::systems::StarSystemController::FocusOnEntity ( entt::entity  ent)
private

◆ FocusOnProvince()

void cqsp::client::systems::StarSystemController::FocusOnProvince ( entt::entity  province)

◆ FocusOnProvinceListener()

void cqsp::client::systems::StarSystemController::FocusOnProvinceListener ( const ctx::ViewProvince province)

◆ FocusPlanetView()

void cqsp::client::systems::StarSystemController::FocusPlanetView ( )
private

◆ FoundCity()

void cqsp::client::systems::StarSystemController::FoundCity ( )
private

◆ GetBodyRotation() [1/2]

glm::quat cqsp::client::systems::StarSystemController::GetBodyRotation ( const core::components::bodies::Body body) const

◆ GetBodyRotation() [2/2]

glm::quat cqsp::client::systems::StarSystemController::GetBodyRotation ( double  axial,
double  rotation,
double  day_offset 
) const

Gets the quaternion to calculate the planet's rotation from the axial rotation and the rotation period

Parameters
axialAxial rotation in radians
rotationRotation period in seconds

◆ GetCameraOverCoordinate()

core::components::types::SurfaceCoordinate cqsp::client::systems::StarSystemController::GetCameraOverCoordinate ( )
private

◆ GetCountryProvinceColor()

glm::vec4 cqsp::client::systems::StarSystemController::GetCountryProvinceColor ( entt::entity  province)
private

◆ GetCountrySelectionColor()

glm::vec4 cqsp::client::systems::StarSystemController::GetCountrySelectionColor ( const glm::vec3 &  country_color)
private

◆ GetMouseInScreenSpace()

glm::vec3 cqsp::client::systems::StarSystemController::GetMouseInScreenSpace ( int  mouse_x,
int  mouse_y 
)
private

◆ GetMouseOnObject()

entt::entity cqsp::client::systems::StarSystemController::GetMouseOnObject ( int  mouse_x,
int  mouse_y 
)
private

Computes a ray sphere intersection to verify which objects the mouse is currently on

◆ GetMouseOnObjectPosition()

glm::vec3 cqsp::client::systems::StarSystemController::GetMouseOnObjectPosition ( )
inline

◆ GetMouseSurfaceIntersection()

SurfaceCoordinate cqsp::client::systems::StarSystemController::GetMouseSurfaceIntersection ( )
private

Get the surface coordinate, or Geoditic Coordinate System point of the mouse.

◆ GetScrollValue()

float cqsp::client::systems::StarSystemController::GetScrollValue ( )
private

◆ GetSelectedCountry()

entt::entity cqsp::client::systems::StarSystemController::GetSelectedCountry ( )
inline

◆ HandleCameraMovement()

void cqsp::client::systems::StarSystemController::HandleCameraMovement ( float  delta_time)
private

◆ HandleHoverTooltip()

void cqsp::client::systems::StarSystemController::HandleHoverTooltip ( )
private

Handles all screenspace tooltips

◆ HandleProvinceHoverColor()

void cqsp::client::systems::StarSystemController::HandleProvinceHoverColor ( )
private

Sets the province color after the mouse hovers on a province. This would be making the province color lighter compared to the original color, especially if it has a color.

◆ IsFoundingCity()

bool cqsp::client::systems::StarSystemController::IsFoundingCity ( )
private

◆ IsMouseOverEntity()

std::optional< glm::vec3 > cqsp::client::systems::StarSystemController::IsMouseOverEntity ( entt::entity  entity,
glm::vec3  ray_wor,
double  radius 
)
private

◆ MixScale()

glm::vec3 cqsp::client::systems::StarSystemController::MixScale ( float  amount)
private

◆ MouseOverObjectBillboard()

bool cqsp::client::systems::StarSystemController::MouseOverObjectBillboard ( glm::vec3  object_pos)
private

◆ MoveCamera()

void cqsp::client::systems::StarSystemController::MoveCamera ( double  delta_time)
private

◆ PreRender()

void cqsp::client::systems::StarSystemController::PreRender ( )

◆ ResetProvinceColor()

void cqsp::client::systems::StarSystemController::ResetProvinceColor ( entt::entity  province)
private

◆ SeeEntity()

void cqsp::client::systems::StarSystemController::SeeEntity ( )
private

◆ SeePlanet()

void cqsp::client::systems::StarSystemController::SeePlanet ( entt::entity  ent)
private

◆ SelectDomesticProvince()

void cqsp::client::systems::StarSystemController::SelectDomesticProvince ( entt::entity  province)
private

◆ SelectForeignProvince()

void cqsp::client::systems::StarSystemController::SelectForeignProvince ( entt::entity  province)
private

◆ SelectProvince()

void cqsp::client::systems::StarSystemController::SelectProvince ( )
private

Selects a province. Triggers when mouse clicks on a province/focus on entity is activated.

◆ SetCameraToPlanetReferenceFrame()

void cqsp::client::systems::StarSystemController::SetCameraToPlanetReferenceFrame ( )
private

◆ SetCameraToSolarSystemReferenceFrame()

void cqsp::client::systems::StarSystemController::SetCameraToSolarSystemReferenceFrame ( )
private

◆ SetCountryProvincesColor()

void cqsp::client::systems::StarSystemController::SetCountryProvincesColor ( entt::entity  country)
private

◆ SetCountryProvincesToProvinceColor()

void cqsp::client::systems::StarSystemController::SetCountryProvincesToProvinceColor ( entt::entity  country)
private

◆ ShouldDrawCityPrototype()

bool cqsp::client::systems::StarSystemController::ShouldDrawCityPrototype ( )

◆ SurfaceCoordinateToProvince()

entt::entity cqsp::client::systems::StarSystemController::SurfaceCoordinateToProvince ( core::components::types::SurfaceCoordinate  coordinate,
entt::entity  planet 
)
private

◆ Update()

void cqsp::client::systems::StarSystemController::Update ( float  delta_time)

◆ UpdateMapMode()

void cqsp::client::systems::StarSystemController::UpdateMapMode ( )
private

Member Data Documentation

◆ app

engine::Application& cqsp::client::systems::StarSystemController::app
private

◆ camera

StarSystemCamera& cqsp::client::systems::StarSystemController::camera
private

◆ CAMERA_MOVEMENT_SPEED

const float cqsp::client::systems::StarSystemController::CAMERA_MOVEMENT_SPEED = 30.f / 40.f
private

◆ camera_state

CameraState cqsp::client::systems::StarSystemController::camera_state = CameraState::FreeCamera
private

◆ DEFAULT_PROVINCE_APLHA

const float cqsp::client::systems::StarSystemController::DEFAULT_PROVINCE_APLHA = 0.65f
private

◆ focus_on_city

bool cqsp::client::systems::StarSystemController::focus_on_city = false
private

◆ focused_planet

entt::entity cqsp::client::systems::StarSystemController::focused_planet = entt::null
private

◆ hovering_country

entt::entity cqsp::client::systems::StarSystemController::hovering_country = entt::null
private

◆ hovering_planet

entt::entity cqsp::client::systems::StarSystemController::hovering_planet = entt::null
private

The planet the mouse is currently hovering on.

◆ hovering_province

entt::entity cqsp::client::systems::StarSystemController::hovering_province
private

◆ is_founding_city

bool cqsp::client::systems::StarSystemController::is_founding_city = false
private

◆ is_rendering_founding_city

bool cqsp::client::systems::StarSystemController::is_rendering_founding_city = false
private

◆ last_focused_planet

entt::entity cqsp::client::systems::StarSystemController::last_focused_planet = entt::null
private

◆ last_hovered_province

entt::entity cqsp::client::systems::StarSystemController::last_hovered_province = entt::null
private

◆ last_map_mode

ctx::MapMode cqsp::client::systems::StarSystemController::last_map_mode = ctx::MapMode::NoMapMode
private

◆ m_viewing_entity

entt::entity cqsp::client::systems::StarSystemController::m_viewing_entity = entt::null

◆ mouse_on_object_position

glm::vec3 cqsp::client::systems::StarSystemController::mouse_on_object_position = glm::vec3(0)
private

Screen space mouse to planet/sphere intersection point.

◆ PAN_SPEED

const float cqsp::client::systems::StarSystemController::PAN_SPEED = 2.0f
private

◆ planet_frame_scroll

bool cqsp::client::systems::StarSystemController::planet_frame_scroll = false
private

◆ previous_mouseX

double cqsp::client::systems::StarSystemController::previous_mouseX = 0
private

◆ previous_mouseY

double cqsp::client::systems::StarSystemController::previous_mouseY = 0
private

◆ renderer

SysStarSystemRenderer& cqsp::client::systems::StarSystemController::renderer
private

◆ SCROLL_SENSITIVITY

const float cqsp::client::systems::StarSystemController::SCROLL_SENSITIVITY = 3.f / 33.f
private

◆ selected_city

entt::entity cqsp::client::systems::StarSystemController::selected_city = entt::null
private

◆ selected_country

entt::entity cqsp::client::systems::StarSystemController::selected_country = entt::null
private

◆ selected_province

entt::entity cqsp::client::systems::StarSystemController::selected_province = entt::null
private

◆ selected_province_color

const glm::vec4 cqsp::client::systems::StarSystemController::selected_province_color = glm::vec4(1.f, 0.f, 0.f, 0.35f)
private

◆ StarSystemViewUI

friend cqsp::client::systems::StarSystemController::StarSystemViewUI
private

◆ target_surface_coordinate

core::components::types::SurfaceCoordinate cqsp::client::systems::StarSystemController::target_surface_coordinate
private
Initial value:
=
core::components::types::SurfaceCoordinate(0, 0)

◆ terrain_displaying

entt::entity cqsp::client::systems::StarSystemController::terrain_displaying = entt::null
private

◆ tex_b

int cqsp::client::systems::StarSystemController::tex_b = 0
private

◆ tex_g

int cqsp::client::systems::StarSystemController::tex_g = 0
private

◆ tex_r

int cqsp::client::systems::StarSystemController::tex_r = 0
private

Debugging colors

◆ tex_x

int cqsp::client::systems::StarSystemController::tex_x = 0
private

Debugging mouse position

◆ tex_y

int cqsp::client::systems::StarSystemController::tex_y = 0
private

◆ universe

core::Universe& cqsp::client::systems::StarSystemController::universe
private

The documentation for this class was generated from the following files: