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 | Static Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
cqsp::client::systems::SysStarSystemRenderer Class Reference

#include <starsystemview.h>

Public Member Functions

 SysStarSystemRenderer (cqsp::common::Universe &, cqsp::engine::Application &)
 
void Initialize ()
 
void OnTick ()
 
void Render (float deltaTime)
 
void SeeStarSystem ()
 
void SeeEntity ()
 
void Update (float deltaTime)
 
void SeePlanet (entt::entity)
 
void DoUI (float deltaTime)
 
glm::vec3 GetMouseIntersectionOnObject (int mouse_x, int mouse_y)
 
double GetDivider ()
 
entt::entity GetMouseOnObject (int mouse_x, int mouse_y)
 
void DrawAllOrbits ()
 
void DrawOrbit (const entt::entity &entity)
 
void OrbitEditor ()
 
 ~SysStarSystemRenderer ()
 

Static Public Member Functions

static bool IsFoundingCity (common::Universe &universe)
 

Public Attributes

float view_x = 0
 
float view_y = 0
 
double previous_mouseX
 
double previous_mouseY
 
double scroll = 10
 
double min_zoom = 1
 
double max_zoom = 9.4605284e15
 
glm::vec3 view_center
 

Private Member Functions

void DrawStars ()
 
void DrawBodies ()
 
void DrawShips ()
 
void DrawSkybox ()
 
void DrawModels ()
 
void DrawEntityName (glm::vec3 &object_pos, entt::entity ent_id)
 
void DrawPlanetIcon (glm::vec3 &object_pos)
 
void DrawPlanetBillboards (const entt::entity &ent_id, const glm::vec3 &object_pos)
 
void DrawShipIcon (const glm::vec3 &object_pos)
 
void DrawCityIcon (const glm::vec3 &object_pos)
 
void DrawAllCities (auto &bodies)
 
void DrawAllPlanets (auto &bodies)
 
void DrawAllPlanetBillboards (auto &bodies)
 
void DrawTexturedPlanet (const glm::vec3 &object_pos, const entt::entity entity)
 
void GetPlanetTexture (const entt::entity entity, bool &have_normal, bool &have_roughness, bool &have_province)
 
void DrawTerrainlessPlanet (const entt::entity &entity, glm::vec3 &object_pos)
 
void DrawStar (const entt::entity &entity, glm::vec3 &object_pos)
 
void RenderCities (glm::vec3 &object_pos, const entt::entity &body_entity)
 
bool CityIsVisible (glm::vec3 city_pos, glm::vec3 planet_pos, glm::vec3 cam_pos)
 
void CalculateCityPositions ()
 
void CalculateScroll ()
 
void LoadPlanetTextures ()
 
void InitializeFramebuffers ()
 
void LoadProvinceMap ()
 
void InitializeMeshes ()
 
void GenerateOrbit (entt::entity body)
 
glm::quat GetBodyRotation (double axial, double rotation, double day_offset)
 Gets the quaternion to calculate the planet's rotation from the axial rotation and the rotation period More...
 
void FocusCityView ()
 
glm::vec3 CalculateObjectPos (const entt::entity &)
 
glm::vec3 CalculateCenteredObject (const entt::entity &)
 
glm::vec3 CalculateCenteredObject (const glm::vec3 &)
 
glm::vec3 TranslateToNormalized (const glm::vec3 &)
 
glm::vec3 ConvertPoint (const glm::vec3 &)
 
glm::vec4 CalculateGLPosition (const glm::vec3 &object_pos)
 Calculates the GL position for a log renderbuffer. More...
 
bool GLPositionNotInBounds (const glm::vec4 &gl_Position, const glm::vec3 &pos)
 Check if the GL position is within the window More...
 
glm::mat4 GetBillboardMatrix (const glm::vec3 &pos)
 
glm::vec3 GetBillboardPosition (const glm::vec3 &object_pos)
 
void SetBillboardProjection (cqsp::asset::ShaderProgram_t &shader, glm::mat4 mat)
 
void CenterCameraOnCity ()
 
void CalculateCamera ()
 
void MoveCamera (double deltaTime)
 
void CheckResourceDistRender ()
 
glm::vec3 CalculateMouseRay (const glm::vec3 &ray_nds)
 
void CalculateViewChange (double deltaX, double deltaY)
 
void FoundCity ()
 
void SelectCountry ()
 
void FocusOnEntity (entt::entity ent)
 
float GetWindowRatio ()
 
void GenerateOrbitLines ()
 
void RenderInformationWindow (double deltaTime)
 
void RenderSelectedObjectInformation ()
 
glm::vec3 GetMouseOnObject ()
 
common::components::types::SurfaceCoordinate GetMouseSurfaceIntersection ()
 
void CityDetection ()
 

Private Attributes

entt::entity m_viewing_entity = entt::null
 
entt::entity terrain_displaying = entt::null
 
cqsp::common::Universem_universe
 
cqsp::engine::Applicationm_app
 
cqsp::engine::Renderable planet
 
cqsp::engine::Renderable textured_planet
 
cqsp::engine::Renderable sky
 
cqsp::engine::Renderable planet_circle
 
cqsp::engine::Renderable ship_overlay
 
cqsp::engine::Renderable city
 
cqsp::engine::Renderable sun
 
cqsp::asset::Modeliss_model
 
cqsp::asset::ShaderProgram_t model_shader
 
cqsp::asset::ShaderProgram_t orbit_shader
 
cqsp::asset::ShaderProgram_t near_shader
 
cqsp::asset::ShaderProgram_t vis_shader
 
glm::vec3 cam_pos
 
glm::vec3 cam_up = glm::vec3(0.0f, 1.0f, 0.0f)
 
glm::mat4 camera_matrix
 
glm::mat4 projection
 
glm::vec4 viewport
 
float circle_size = 0.01f
 
const double divider = 0.01
 
float window_ratio
 
glm::vec3 sun_position
 
glm::vec3 sun_color
 
engine::LayerRenderer renderer
 
int ship_icon_layer
 
int planet_icon_layer
 
int physical_layer
 
int skybox_layer
 
bool is_founding_city = false
 
bool is_rendering_founding_city = false
 
glm::vec3 mouse_on_object
 
entt::entity on_planet
 
float view_scale = 10.f
 
entt::entity selected_city = entt::null
 
int tex_x
 Debugging mouse position More...
 
int tex_y
 
int tex_r
 Debugging colors More...
 
int tex_g
 
int tex_b
 
int province_height = 0
 
int province_width = 0
 
glm::vec3 selected_province_color
 
glm::vec3 selected_country_color
 
entt::entity hovering_province
 
entt::entity selected_province
 
int orbits_generated = 0
 
const int sphere_resolution = 64
 

Constructor & Destructor Documentation

◆ SysStarSystemRenderer()

cqsp::client::systems::SysStarSystemRenderer::SysStarSystemRenderer ( cqsp::common::Universe _u,
cqsp::engine::Application _a 
)

◆ ~SysStarSystemRenderer()

cqsp::client::systems::SysStarSystemRenderer::~SysStarSystemRenderer ( )
default

Member Function Documentation

◆ CalculateCamera()

void cqsp::client::systems::SysStarSystemRenderer::CalculateCamera ( )
private

◆ CalculateCenteredObject() [1/2]

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

◆ CalculateCenteredObject() [2/2]

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

◆ CalculateCityPositions()

void cqsp::client::systems::SysStarSystemRenderer::CalculateCityPositions ( )
private

◆ CalculateGLPosition()

glm::vec4 cqsp::client::systems::SysStarSystemRenderer::CalculateGLPosition ( const glm::vec3 &  object_pos)
private

Calculates the GL position for a log renderbuffer.

◆ CalculateMouseRay()

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

◆ CalculateObjectPos()

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

◆ CalculateScroll()

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

◆ CalculateViewChange()

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

◆ CenterCameraOnCity()

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

◆ CheckResourceDistRender()

void cqsp::client::systems::SysStarSystemRenderer::CheckResourceDistRender ( )
private

◆ CityDetection()

void cqsp::client::systems::SysStarSystemRenderer::CityDetection ( )
private

◆ CityIsVisible()

bool cqsp::client::systems::SysStarSystemRenderer::CityIsVisible ( glm::vec3  city_pos,
glm::vec3  planet_pos,
glm::vec3  cam_pos 
)
private

◆ ConvertPoint()

glm::vec3 cqsp::client::systems::SysStarSystemRenderer::ConvertPoint ( const glm::vec3 &  pos)
private

◆ DoUI()

void cqsp::client::systems::SysStarSystemRenderer::DoUI ( float  deltaTime)

◆ DrawAllCities()

void cqsp::client::systems::SysStarSystemRenderer::DrawAllCities ( auto &  bodies)
private

◆ DrawAllOrbits()

void cqsp::client::systems::SysStarSystemRenderer::DrawAllOrbits ( )

◆ DrawAllPlanetBillboards()

void cqsp::client::systems::SysStarSystemRenderer::DrawAllPlanetBillboards ( auto &  bodies)
private

◆ DrawAllPlanets()

void cqsp::client::systems::SysStarSystemRenderer::DrawAllPlanets ( auto &  bodies)
private

◆ DrawBodies()

void cqsp::client::systems::SysStarSystemRenderer::DrawBodies ( )
private

◆ DrawCityIcon()

void cqsp::client::systems::SysStarSystemRenderer::DrawCityIcon ( const glm::vec3 &  object_pos)
private

◆ DrawEntityName()

void cqsp::client::systems::SysStarSystemRenderer::DrawEntityName ( glm::vec3 &  object_pos,
entt::entity  ent_id 
)
private

◆ DrawModels()

void cqsp::client::systems::SysStarSystemRenderer::DrawModels ( )
private

◆ DrawOrbit()

void cqsp::client::systems::SysStarSystemRenderer::DrawOrbit ( const entt::entity &  entity)

◆ DrawPlanetBillboards()

void cqsp::client::systems::SysStarSystemRenderer::DrawPlanetBillboards ( const entt::entity &  ent_id,
const glm::vec3 &  object_pos 
)
private

◆ DrawPlanetIcon()

void cqsp::client::systems::SysStarSystemRenderer::DrawPlanetIcon ( glm::vec3 &  object_pos)
private

◆ DrawShipIcon()

void cqsp::client::systems::SysStarSystemRenderer::DrawShipIcon ( const glm::vec3 &  object_pos)
private

◆ DrawShips()

void cqsp::client::systems::SysStarSystemRenderer::DrawShips ( )
private

◆ DrawSkybox()

void cqsp::client::systems::SysStarSystemRenderer::DrawSkybox ( )
private

◆ DrawStar()

void cqsp::client::systems::SysStarSystemRenderer::DrawStar ( const entt::entity &  entity,
glm::vec3 &  object_pos 
)
private

◆ DrawStars()

void cqsp::client::systems::SysStarSystemRenderer::DrawStars ( )
private

◆ DrawTerrainlessPlanet()

void cqsp::client::systems::SysStarSystemRenderer::DrawTerrainlessPlanet ( const entt::entity &  entity,
glm::vec3 &  object_pos 
)
private

◆ DrawTexturedPlanet()

void cqsp::client::systems::SysStarSystemRenderer::DrawTexturedPlanet ( const glm::vec3 &  object_pos,
const entt::entity  entity 
)
private

◆ FocusCityView()

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

◆ FocusOnEntity()

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

◆ FoundCity()

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

◆ GenerateOrbit()

void cqsp::client::systems::SysStarSystemRenderer::GenerateOrbit ( entt::entity  body)
private

◆ GenerateOrbitLines()

void cqsp::client::systems::SysStarSystemRenderer::GenerateOrbitLines ( )
private

◆ GetBillboardMatrix()

glm::mat4 cqsp::client::systems::SysStarSystemRenderer::GetBillboardMatrix ( const glm::vec3 &  pos)
private

◆ GetBillboardPosition()

glm::vec3 cqsp::client::systems::SysStarSystemRenderer::GetBillboardPosition ( const glm::vec3 &  object_pos)
private

◆ GetBodyRotation()

glm::quat cqsp::client::systems::SysStarSystemRenderer::GetBodyRotation ( double  axial,
double  rotation,
double  day_offset 
)
private

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

◆ GetDivider()

double cqsp::client::systems::SysStarSystemRenderer::GetDivider ( )
inline

◆ GetMouseIntersectionOnObject()

glm::vec3 cqsp::client::systems::SysStarSystemRenderer::GetMouseIntersectionOnObject ( int  mouse_x,
int  mouse_y 
)

◆ GetMouseOnObject() [1/2]

glm::vec3 cqsp::client::systems::SysStarSystemRenderer::GetMouseOnObject ( )
inlineprivate

◆ GetMouseOnObject() [2/2]

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

◆ GetMouseSurfaceIntersection()

common::components::types::SurfaceCoordinate cqsp::client::systems::SysStarSystemRenderer::GetMouseSurfaceIntersection ( )
private

◆ GetPlanetTexture()

void cqsp::client::systems::SysStarSystemRenderer::GetPlanetTexture ( const entt::entity  entity,
bool &  have_normal,
bool &  have_roughness,
bool &  have_province 
)
private

◆ GetWindowRatio()

float cqsp::client::systems::SysStarSystemRenderer::GetWindowRatio ( )
private

◆ GLPositionNotInBounds()

bool cqsp::client::systems::SysStarSystemRenderer::GLPositionNotInBounds ( const glm::vec4 &  gl_Position,
const glm::vec3 &  pos 
)
private

Check if the GL position is within the window

◆ Initialize()

void cqsp::client::systems::SysStarSystemRenderer::Initialize ( )

◆ InitializeFramebuffers()

void cqsp::client::systems::SysStarSystemRenderer::InitializeFramebuffers ( )
private

◆ InitializeMeshes()

void cqsp::client::systems::SysStarSystemRenderer::InitializeMeshes ( )
private

◆ IsFoundingCity()

bool cqsp::client::systems::SysStarSystemRenderer::IsFoundingCity ( common::Universe universe)
static

◆ LoadPlanetTextures()

void cqsp::client::systems::SysStarSystemRenderer::LoadPlanetTextures ( )
private

◆ LoadProvinceMap()

void cqsp::client::systems::SysStarSystemRenderer::LoadProvinceMap ( )
private

◆ MoveCamera()

void cqsp::client::systems::SysStarSystemRenderer::MoveCamera ( double  deltaTime)
private

◆ OnTick()

void cqsp::client::systems::SysStarSystemRenderer::OnTick ( )

◆ OrbitEditor()

void cqsp::client::systems::SysStarSystemRenderer::OrbitEditor ( )

◆ Render()

void cqsp::client::systems::SysStarSystemRenderer::Render ( float  deltaTime)

◆ RenderCities()

void cqsp::client::systems::SysStarSystemRenderer::RenderCities ( glm::vec3 &  object_pos,
const entt::entity &  body_entity 
)
private

◆ RenderInformationWindow()

void cqsp::client::systems::SysStarSystemRenderer::RenderInformationWindow ( double  deltaTime)
private

◆ RenderSelectedObjectInformation()

void cqsp::client::systems::SysStarSystemRenderer::RenderSelectedObjectInformation ( )
private

◆ SeeEntity()

void cqsp::client::systems::SysStarSystemRenderer::SeeEntity ( )

◆ SeePlanet()

void cqsp::client::systems::SysStarSystemRenderer::SeePlanet ( entt::entity  ent)

◆ SeeStarSystem()

void cqsp::client::systems::SysStarSystemRenderer::SeeStarSystem ( )

◆ SelectCountry()

void cqsp::client::systems::SysStarSystemRenderer::SelectCountry ( )
private

◆ SetBillboardProjection()

void cqsp::client::systems::SysStarSystemRenderer::SetBillboardProjection ( cqsp::asset::ShaderProgram_t shader,
glm::mat4  mat 
)
private

◆ TranslateToNormalized()

glm::vec3 cqsp::client::systems::SysStarSystemRenderer::TranslateToNormalized ( const glm::vec3 &  pos)
private

◆ Update()

void cqsp::client::systems::SysStarSystemRenderer::Update ( float  deltaTime)

Member Data Documentation

◆ cam_pos

glm::vec3 cqsp::client::systems::SysStarSystemRenderer::cam_pos
private

◆ cam_up

glm::vec3 cqsp::client::systems::SysStarSystemRenderer::cam_up = glm::vec3(0.0f, 1.0f, 0.0f)
private

◆ camera_matrix

glm::mat4 cqsp::client::systems::SysStarSystemRenderer::camera_matrix
private

◆ circle_size

float cqsp::client::systems::SysStarSystemRenderer::circle_size = 0.01f
private

◆ city

cqsp::engine::Renderable cqsp::client::systems::SysStarSystemRenderer::city
private

◆ divider

const double cqsp::client::systems::SysStarSystemRenderer::divider = 0.01
private

◆ hovering_province

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

◆ is_founding_city

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

◆ is_rendering_founding_city

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

◆ iss_model

cqsp::asset::Model* cqsp::client::systems::SysStarSystemRenderer::iss_model
private

◆ m_app

cqsp::engine::Application& cqsp::client::systems::SysStarSystemRenderer::m_app
private

◆ m_universe

cqsp::common::Universe& cqsp::client::systems::SysStarSystemRenderer::m_universe
private

◆ m_viewing_entity

entt::entity cqsp::client::systems::SysStarSystemRenderer::m_viewing_entity = entt::null
private

◆ max_zoom

double cqsp::client::systems::SysStarSystemRenderer::max_zoom = 9.4605284e15

◆ min_zoom

double cqsp::client::systems::SysStarSystemRenderer::min_zoom = 1

◆ model_shader

cqsp::asset::ShaderProgram_t cqsp::client::systems::SysStarSystemRenderer::model_shader
private

◆ mouse_on_object

glm::vec3 cqsp::client::systems::SysStarSystemRenderer::mouse_on_object
private

◆ near_shader

cqsp::asset::ShaderProgram_t cqsp::client::systems::SysStarSystemRenderer::near_shader
private

◆ on_planet

entt::entity cqsp::client::systems::SysStarSystemRenderer::on_planet
private

◆ orbit_shader

cqsp::asset::ShaderProgram_t cqsp::client::systems::SysStarSystemRenderer::orbit_shader
private

◆ orbits_generated

int cqsp::client::systems::SysStarSystemRenderer::orbits_generated = 0
private

◆ physical_layer

int cqsp::client::systems::SysStarSystemRenderer::physical_layer
private

◆ planet

cqsp::engine::Renderable cqsp::client::systems::SysStarSystemRenderer::planet
private

◆ planet_circle

cqsp::engine::Renderable cqsp::client::systems::SysStarSystemRenderer::planet_circle
private

◆ planet_icon_layer

int cqsp::client::systems::SysStarSystemRenderer::planet_icon_layer
private

◆ previous_mouseX

double cqsp::client::systems::SysStarSystemRenderer::previous_mouseX

◆ previous_mouseY

double cqsp::client::systems::SysStarSystemRenderer::previous_mouseY

◆ projection

glm::mat4 cqsp::client::systems::SysStarSystemRenderer::projection
private

◆ province_height

int cqsp::client::systems::SysStarSystemRenderer::province_height = 0
private

◆ province_width

int cqsp::client::systems::SysStarSystemRenderer::province_width = 0
private

◆ renderer

engine::LayerRenderer cqsp::client::systems::SysStarSystemRenderer::renderer
private

◆ scroll

double cqsp::client::systems::SysStarSystemRenderer::scroll = 10

◆ selected_city

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

◆ selected_country_color

glm::vec3 cqsp::client::systems::SysStarSystemRenderer::selected_country_color
private

◆ selected_province

entt::entity cqsp::client::systems::SysStarSystemRenderer::selected_province
private

◆ selected_province_color

glm::vec3 cqsp::client::systems::SysStarSystemRenderer::selected_province_color
private

◆ ship_icon_layer

int cqsp::client::systems::SysStarSystemRenderer::ship_icon_layer
private

◆ ship_overlay

cqsp::engine::Renderable cqsp::client::systems::SysStarSystemRenderer::ship_overlay
private

◆ sky

cqsp::engine::Renderable cqsp::client::systems::SysStarSystemRenderer::sky
private

◆ skybox_layer

int cqsp::client::systems::SysStarSystemRenderer::skybox_layer
private

◆ sphere_resolution

const int cqsp::client::systems::SysStarSystemRenderer::sphere_resolution = 64
private

◆ sun

cqsp::engine::Renderable cqsp::client::systems::SysStarSystemRenderer::sun
private

◆ sun_color

glm::vec3 cqsp::client::systems::SysStarSystemRenderer::sun_color
private

◆ sun_position

glm::vec3 cqsp::client::systems::SysStarSystemRenderer::sun_position
private

◆ terrain_displaying

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

◆ tex_b

int cqsp::client::systems::SysStarSystemRenderer::tex_b
private

◆ tex_g

int cqsp::client::systems::SysStarSystemRenderer::tex_g
private

◆ tex_r

int cqsp::client::systems::SysStarSystemRenderer::tex_r
private

Debugging colors

◆ tex_x

int cqsp::client::systems::SysStarSystemRenderer::tex_x
private

Debugging mouse position

◆ tex_y

int cqsp::client::systems::SysStarSystemRenderer::tex_y
private

◆ textured_planet

cqsp::engine::Renderable cqsp::client::systems::SysStarSystemRenderer::textured_planet
private

◆ view_center

glm::vec3 cqsp::client::systems::SysStarSystemRenderer::view_center

◆ view_scale

float cqsp::client::systems::SysStarSystemRenderer::view_scale = 10.f
private

◆ view_x

float cqsp::client::systems::SysStarSystemRenderer::view_x = 0

◆ view_y

float cqsp::client::systems::SysStarSystemRenderer::view_y = 0

◆ viewport

glm::vec4 cqsp::client::systems::SysStarSystemRenderer::viewport
private

◆ vis_shader

cqsp::asset::ShaderProgram_t cqsp::client::systems::SysStarSystemRenderer::vis_shader
private

◆ window_ratio

float cqsp::client::systems::SysStarSystemRenderer::window_ratio
private

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