3 Commits

Author SHA1 Message Date
c0a560a16e change default cam pos 2025-08-01 13:40:11 +02:00
50a6caf82e add multisampling 2025-08-01 13:39:32 +02:00
31bb0198fc add vsync 2025-08-01 13:38:00 +02:00
2 changed files with 15 additions and 1 deletions

View File

@@ -111,7 +111,7 @@ int main(int argc, char** argv) {
renderer.AddRenderer<td::render::EntityRenderer>(cam, w); renderer.AddRenderer<td::render::EntityRenderer>(cam, w);
renderer.AddRenderer<td::render::TowerRenderer>(cam, w); renderer.AddRenderer<td::render::TowerRenderer>(cam, w);
cam.SetCamPos({77, 10, 13}); cam.SetCamPos({77, 7, 13});
cam.UpdatePerspective(display.GetAspectRatio()); cam.UpdatePerspective(display.GetAspectRatio());
td::sim::RealTimeSimulation simulation(w, 50); td::sim::RealTimeSimulation simulation(w, 50);

View File

@@ -38,6 +38,9 @@ Display::Display(int a_Width, int a_Height, const std::string& a_Title) :
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 8);
m_GLContext = SDL_GL_CreateContext(m_Window); m_GLContext = SDL_GL_CreateContext(m_Window);
if (!m_GLContext) { if (!m_GLContext) {
@@ -46,6 +49,8 @@ Display::Display(int a_Width, int a_Height, const std::string& a_Title) :
int major, minor, mask; int major, minor, mask;
int r, g, b, a, depth; int r, g, b, a, depth;
int mBuffers, mSamples;
SDL_GL_GetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, &mask); SDL_GL_GetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, &mask);
SDL_GL_GetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, &major); SDL_GL_GetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, &major);
SDL_GL_GetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, &minor); SDL_GL_GetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, &minor);
@@ -57,6 +62,9 @@ Display::Display(int a_Width, int a_Height, const std::string& a_Title) :
SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &depth); SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &depth);
SDL_GL_GetAttribute(SDL_GL_MULTISAMPLEBUFFERS, &mBuffers);
SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &mSamples);
const char* mask_desc; const char* mask_desc;
if (mask & SDL_GL_CONTEXT_PROFILE_CORE) { if (mask & SDL_GL_CONTEXT_PROFILE_CORE) {
@@ -72,6 +80,9 @@ Display::Display(int a_Width, int a_Height, const std::string& a_Title) :
utils::LOG(utils::Format( utils::LOG(utils::Format(
"GL Context : %i.%i %s, Color : R:%i G:%i B:%i A:%i, Depth bits : %i", major, minor, mask_desc, r, g, b, a, depth)); "GL Context : %i.%i %s, Color : R:%i G:%i B:%i A:%i, Depth bits : %i", major, minor, mask_desc, r, g, b, a, depth));
utils::LOG(utils::Format(
"MultiSamples : Buffers : %i, Samples : %i", mBuffers, mSamples));
SDL_GL_MakeCurrent(m_Window, m_GLContext); SDL_GL_MakeCurrent(m_Window, m_GLContext);
GLenum error = glewInit(); GLenum error = glewInit();
@@ -81,6 +92,9 @@ Display::Display(int a_Width, int a_Height, const std::string& a_Title) :
// WindowResizeEvent(WindowWidth, WindowHeight); // WindowResizeEvent(WindowWidth, WindowHeight);
// vsync
SDL_GL_SetSwapInterval(1);
// Setup Dear ImGui context // Setup Dear ImGui context
IMGUI_CHECKVERSION(); IMGUI_CHECKVERSION();
ImGui::CreateContext(); ImGui::CreateContext();