From 00fa9485976981c5136d2e44b0742f77ae097426 Mon Sep 17 00:00:00 2001 From: Quentin Bazin Date: Sun, 22 Oct 2023 13:25:32 +0200 Subject: [PATCH] Removed most references to OpenGL. --- source/client/CMakeLists.txt | 1 - source/client/core/Vertex.hpp | 14 ++++++-------- source/client/graphics/ChunkRenderer.cpp | 2 +- source/client/graphics/TextureAtlas.cpp | 1 - source/client/hud/BlockCursor.cpp | 4 ++-- source/client/states/GameState.cpp | 1 - source/client/states/TitleScreenState.cpp | 2 -- source/common/CMakeLists.txt | 2 -- source/server/CMakeLists.txt | 2 -- 9 files changed, 9 insertions(+), 20 deletions(-) diff --git a/source/client/CMakeLists.txt b/source/client/CMakeLists.txt index 66f739fa..813f0b62 100644 --- a/source/client/CMakeLists.txt +++ b/source/client/CMakeLists.txt @@ -35,7 +35,6 @@ if (NOT MSVC) target_compile_options(${PROJECT_NAME} PRIVATE ${CLANG_FLAGS}) endif () -target_compile_options(${PROJECT_NAME} PRIVATE -DGLM_FORCE_RADIANS) target_compile_options(${PROJECT_NAME} PRIVATE -D_USE_MATH_DEFINES) target_compile_options(${PROJECT_NAME} PRIVATE -DSOL_CHECK_ARGUMENTS -DSOL_PRINT_ERRORS=0) diff --git a/source/client/core/Vertex.hpp b/source/client/core/Vertex.hpp index 6d0fda35..d7b67576 100644 --- a/source/client/core/Vertex.hpp +++ b/source/client/core/Vertex.hpp @@ -27,15 +27,13 @@ #ifndef VERTEX_HPP_ #define VERTEX_HPP_ -#include - struct Vertex { - GLfloat coord3d[4] = {0, 0, 0, 1}; - GLfloat texCoord[2] = {-1, -1}; - GLfloat color[4] = {0, 0, 0, 1}; - GLfloat normal[3] = {0, 0, 0}; - GLfloat lightValue[2] = {-1, -1}; - GLfloat ambientOcclusion = 4; + float coord3d[4] = {0, 0, 0, 1}; + float texCoord[2] = {-1, -1}; + float color[4] = {0, 0, 0, 1}; + float normal[3] = {0, 0, 0}; + float lightValue[2] = {-1, -1}; + float ambientOcclusion = 4; }; #endif // VERTEX_HPP_ diff --git a/source/client/graphics/ChunkRenderer.cpp b/source/client/graphics/ChunkRenderer.cpp index dbf41154..66d6f532 100644 --- a/source/client/graphics/ChunkRenderer.cpp +++ b/source/client/graphics/ChunkRenderer.cpp @@ -80,7 +80,7 @@ static bool fullyOutside(const glm::vec3 &v1, const glm::vec3 &v2, const glm::ve void ChunkRenderer::draw(RenderTarget &target, RenderStates states, const ChunkMap &chunks, Camera &camera, const Sky *currentSky) const { // Changing the values sent to the GPU to double precision is suicidal, // performance wise, if possible at all. Therefore we want to keep the - // GL rendering numbers in single precision format. But that introduces + // BGFX rendering numbers in single precision format. But that introduces // an issue at larger coordinates, because the precision of floats // quickly degrades as the numbers grow, with a random wobbling being // very noticeable at e.g. coordinates >= 65536 or so, and the waving diff --git a/source/client/graphics/TextureAtlas.cpp b/source/client/graphics/TextureAtlas.cpp index 7c730149..e819ff40 100644 --- a/source/client/graphics/TextureAtlas.cpp +++ b/source/client/graphics/TextureAtlas.cpp @@ -26,7 +26,6 @@ */ #include #include -#include #include "Registry.hpp" #include "TextureAtlas.hpp" diff --git a/source/client/hud/BlockCursor.cpp b/source/client/hud/BlockCursor.cpp index 5317c316..d9271a0f 100644 --- a/source/client/hud/BlockCursor.cpp +++ b/source/client/hud/BlockCursor.cpp @@ -287,10 +287,10 @@ void BlockCursor::updateAnimationVertexBuffer(const BlockState &blockState, u8f Vertex vertices[nFaces][nVertsPerFace]; updateVBOCoords(vertices, blockState, -2, orientation); - GLfloat color[4] = {1, 1, 1, 0.5}; + float color[4] = {1, 1, 1, 0.5}; for (u8f f = 0; f < nFaces; ++f) for (u8f v = 0; v < nVertsPerFace; ++v) - memcpy(&vertices[f][v].color, &color[0], 4 * sizeof(GLfloat)); + memcpy(&vertices[f][v].color, &color[0], 4 * sizeof(float)); if (animationPos != -1) { glm::vec4 blockTexCoords{0.1f * (float)animationPos, 0.0f, 0.1f + 0.1f * (float)animationPos, 1.0f}; diff --git a/source/client/states/GameState.cpp b/source/client/states/GameState.cpp index 3beac9fa..344504bb 100644 --- a/source/client/states/GameState.cpp +++ b/source/client/states/GameState.cpp @@ -33,7 +33,6 @@ #include #include #include -#include #include #include "ApplicationStateStack.hpp" diff --git a/source/client/states/TitleScreenState.cpp b/source/client/states/TitleScreenState.cpp index 87b23873..6e836432 100644 --- a/source/client/states/TitleScreenState.cpp +++ b/source/client/states/TitleScreenState.cpp @@ -38,8 +38,6 @@ #include "ServerApplication.hpp" // For ServerOnlineEvent TitleScreenState::TitleScreenState(u16 port) : m_port(port) { - glClearColor(0.0, 0.0, 0.0, 1.0); - m_menuWidget.setScale(Config::guiScale, Config::guiScale); m_menuWidget.addButton("Singleplayer", [this] (TextButton &) { diff --git a/source/common/CMakeLists.txt b/source/common/CMakeLists.txt index 4c65da50..4c23ca5f 100644 --- a/source/common/CMakeLists.txt +++ b/source/common/CMakeLists.txt @@ -42,7 +42,6 @@ if (NOT MSVC) target_compile_options(${PROJECT_NAME} PRIVATE ${CLANG_FLAGS}) endif () -target_compile_options(${PROJECT_NAME} PRIVATE -DGLM_FORCE_RADIANS) target_compile_options(${PROJECT_NAME} PRIVATE -D_USE_MATH_DEFINES) target_compile_options(${PROJECT_NAME} PRIVATE -DSOL_CHECK_ARGUMENTS -DSOL_PRINT_ERRORS=0) @@ -60,7 +59,6 @@ target_link_libraries(${PROJECT_NAME} PUBLIC gamekit zlib EnTT - ${OPENGL_LIBRARIES} ${UNIX_LIBS} ) diff --git a/source/server/CMakeLists.txt b/source/server/CMakeLists.txt index e35b96f6..c5ab173e 100644 --- a/source/server/CMakeLists.txt +++ b/source/server/CMakeLists.txt @@ -46,11 +46,9 @@ if (NOT MSVC) target_compile_options(${PROJECT_NAME} PRIVATE ${CLANG_FLAGS}) endif () -target_compile_options(${PROJECT_NAME}_lib PRIVATE -DGLM_FORCE_RADIANS) target_compile_options(${PROJECT_NAME}_lib PRIVATE -D_USE_MATH_DEFINES) target_compile_options(${PROJECT_NAME}_lib PRIVATE -DSOL_CHECK_ARGUMENTS -DSOL_PRINT_ERRORS=0) -target_compile_options(${PROJECT_NAME} PRIVATE -DGLM_FORCE_RADIANS) target_compile_options(${PROJECT_NAME} PRIVATE -D_USE_MATH_DEFINES) target_compile_options(${PROJECT_NAME} PRIVATE -DSOL_CHECK_ARGUMENTS -DSOL_PRINT_ERRORS=0)