From 573b2761160da889c418be9b88584269a9ff520f Mon Sep 17 00:00:00 2001 From: Green Sky Date: Mon, 14 Jun 2021 17:44:59 +0200 Subject: [PATCH] trying to fix some warnings (had side effects) --- external/soloud/CMakeLists.txt | 2 +- external/stb/CMakeLists.txt | 2 +- framework/imgui/src/mm/imgui/widgets/texture.cpp | 4 ++-- framework/imgui/src/mm/imgui/widgets/texture.hpp | 4 ++-- .../src/mm/imgui/widgets/texture_resource_manager.cpp | 2 +- .../src/mm/opengl/components/texture.hpp | 2 +- framework/opengl_primitives/src/mm/opengl/spritesheet.hpp | 2 +- framework/opengl_primitives/src/mm/opengl/texture.cpp | 8 ++++---- framework/opengl_primitives/src/mm/opengl/texture.hpp | 6 +++--- .../src/mm/opengl/render_tasks/batched_spritesheet.cpp | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/external/soloud/CMakeLists.txt b/external/soloud/CMakeLists.txt index 7a958e6..41e2840 100644 --- a/external/soloud/CMakeLists.txt +++ b/external/soloud/CMakeLists.txt @@ -159,7 +159,7 @@ target_compile_definitions(soloud PRIVATE WITH_NULL) #target_compile_definitions(soloud PRIVATE WITH_SDL2) target_compile_definitions(soloud PRIVATE WITH_SDL2_STATIC) -target_include_directories(soloud PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/soloud/include") +target_include_directories(soloud SYSTEM PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/soloud/include") #target_include_directories(soloud PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/imgui") #if not android or emscripten diff --git a/external/stb/CMakeLists.txt b/external/stb/CMakeLists.txt index 9766945..dda4405 100644 --- a/external/stb/CMakeLists.txt +++ b/external/stb/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.2 FATAL_ERROR) project(stb CXX) add_library(stb INTERFACE) -target_include_directories(stb INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}") +target_include_directories(stb SYSTEM INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}") add_library(stb_image "stb/stb_image.h" "stb_image.cpp") target_link_libraries(stb_image stb) diff --git a/framework/imgui/src/mm/imgui/widgets/texture.cpp b/framework/imgui/src/mm/imgui/widgets/texture.cpp index f15b3b3..463c9ca 100644 --- a/framework/imgui/src/mm/imgui/widgets/texture.cpp +++ b/framework/imgui/src/mm/imgui/widgets/texture.cpp @@ -8,7 +8,7 @@ namespace MM::ImGuiWidgets { // TODO: fix formating -void Texture(MM::OpenGL::Texture::handle& texture, bool dropTarget) { +void Texture(MM::OpenGL::Texture::handle_t& texture, bool dropTarget) { const float s_sz = ImGui::GetFrameHeight(); //const float w_all = ImGui::CalcItemWidth(); //const char* lable_display_end = ImGui::FindRenderedTextEnd(label); @@ -58,7 +58,7 @@ void Texture(MM::OpenGL::Texture::handle& texture, bool dropTarget) { ImGui::EndGroup(); } -void LabelTexture(const char* label, MM::OpenGL::Texture::handle& texture, bool dropTarget) { +void LabelTexture(const char* label, MM::OpenGL::Texture::handle_t& texture, bool dropTarget) { const float s_sz = ImGui::GetFrameHeight(); const float w_all = ImGui::CalcItemWidth(); const char* lable_display_end = ImGui::FindRenderedTextEnd(label); diff --git a/framework/imgui/src/mm/imgui/widgets/texture.hpp b/framework/imgui/src/mm/imgui/widgets/texture.hpp index 9fa69da..a2502ae 100644 --- a/framework/imgui/src/mm/imgui/widgets/texture.hpp +++ b/framework/imgui/src/mm/imgui/widgets/texture.hpp @@ -6,8 +6,8 @@ namespace MM::ImGuiWidgets { #define IMGUI_PAYLOAD_TYPE_MM_REND_TEXTURE "MM_REND_TEXTURE" -void Texture(MM::OpenGL::Texture::handle& texture, bool dropTarget = true); -void LabelTexture(const char* label, MM::OpenGL::Texture::handle& texture, bool dropTarget = true); +void Texture(MM::OpenGL::Texture::handle_t& texture, bool dropTarget = true); +void LabelTexture(const char* label, MM::OpenGL::Texture::handle_t& texture, bool dropTarget = true); } diff --git a/framework/imgui/src/mm/imgui/widgets/texture_resource_manager.cpp b/framework/imgui/src/mm/imgui/widgets/texture_resource_manager.cpp index 6e708c4..75169a9 100644 --- a/framework/imgui/src/mm/imgui/widgets/texture_resource_manager.cpp +++ b/framework/imgui/src/mm/imgui/widgets/texture_resource_manager.cpp @@ -32,7 +32,7 @@ void TextureResourceManagerList(void) { void TextureResourceManagerLoader(MM::Engine& engine) { using namespace entt::literals; auto& rm = MM::ResourceManager::ref(); - static MM::OpenGL::Texture::handle texture = rm.get("default"_hs); + static MM::OpenGL::Texture::handle_t texture = rm.get("default"_hs); static std::string path = ""; diff --git a/framework/opengl_primitives/src/mm/opengl/components/texture.hpp b/framework/opengl_primitives/src/mm/opengl/components/texture.hpp index 6096bdb..b309d76 100644 --- a/framework/opengl_primitives/src/mm/opengl/components/texture.hpp +++ b/framework/opengl_primitives/src/mm/opengl/components/texture.hpp @@ -5,7 +5,7 @@ namespace MM::Components::OpenGL { struct Texture { - MM::OpenGL::Texture::handle tex; + MM::OpenGL::Texture::handle_t tex; }; } // MM::Components::OpenGL diff --git a/framework/opengl_primitives/src/mm/opengl/spritesheet.hpp b/framework/opengl_primitives/src/mm/opengl/spritesheet.hpp index d330c7d..383f3e3 100644 --- a/framework/opengl_primitives/src/mm/opengl/spritesheet.hpp +++ b/framework/opengl_primitives/src/mm/opengl/spritesheet.hpp @@ -6,7 +6,7 @@ namespace MM::OpenGL { // a SpriteSheet is a texture divided evenly into a Grid struct SpriteSheet { - MM::OpenGL::Texture::handle tex = nullptr; + MM::OpenGL::Texture::handle_t tex = nullptr; struct { uint32_t x = 1; uint32_t y = 1; diff --git a/framework/opengl_primitives/src/mm/opengl/texture.cpp b/framework/opengl_primitives/src/mm/opengl/texture.cpp index e0c8026..57bfa7f 100644 --- a/framework/opengl_primitives/src/mm/opengl/texture.cpp +++ b/framework/opengl_primitives/src/mm/opengl/texture.cpp @@ -15,9 +15,9 @@ uint32_t Texture::getHandle(void) const { Texture::Texture( uint32_t handle, - int32_t width, int32_t height, + int32_t width_, int32_t height_, int32_t internalFormat, int32_t format, int32_t type -) : _handle(handle), width(width), height(height), +) : _handle(handle), width(width_), height(height_), _internalFormat(internalFormat), _format(format), _type(type) {} Texture::~Texture(void) { @@ -44,7 +44,7 @@ void Texture::resize(int32_t new_width, int32_t new_height) { *(const_cast(&height)) = new_height; } -Texture::handle Texture::createEmpty(int32_t internalFormat, int32_t width, int32_t height, int32_t format, int32_t type) { +Texture::handle_t Texture::createEmpty(int32_t internalFormat, int32_t width, int32_t height, int32_t format, int32_t type) { uint32_t id; glGenTextures(1, &id); glBindTexture(GL_TEXTURE_2D, id); @@ -54,7 +54,7 @@ Texture::handle Texture::createEmpty(int32_t internalFormat, int32_t width, int3 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glBindTexture(GL_TEXTURE_2D, 0); - return handle(new Texture(id, width, height, internalFormat, format, type)); + return handle_t(new Texture(id, width, height, internalFormat, format, type)); } } // MM::OpenGL diff --git a/framework/opengl_primitives/src/mm/opengl/texture.hpp b/framework/opengl_primitives/src/mm/opengl/texture.hpp index e7e06d8..b27c8d5 100644 --- a/framework/opengl_primitives/src/mm/opengl/texture.hpp +++ b/framework/opengl_primitives/src/mm/opengl/texture.hpp @@ -19,12 +19,12 @@ namespace MM::OpenGL { Texture( uint32_t handle, - int32_t width, int32_t height, + int32_t width_, int32_t height_, int32_t internalFormat, int32_t format, int32_t type ); public: - using handle = std::shared_ptr; + using handle_t = std::shared_ptr; int32_t const width; int32_t const height; @@ -44,7 +44,7 @@ namespace MM::OpenGL { void resize(int32_t new_width, int32_t new_height); - static handle createEmpty(int32_t internalFormat, int32_t width, int32_t height, int32_t format, int32_t type); + static handle_t createEmpty(int32_t internalFormat, int32_t width, int32_t height, int32_t format, int32_t type); }; } // MM::OpenGL diff --git a/framework/opengl_renderer/src/mm/opengl/render_tasks/batched_spritesheet.cpp b/framework/opengl_renderer/src/mm/opengl/render_tasks/batched_spritesheet.cpp index 3c2bc6e..786f825 100644 --- a/framework/opengl_renderer/src/mm/opengl/render_tasks/batched_spritesheet.cpp +++ b/framework/opengl_renderer/src/mm/opengl/render_tasks/batched_spritesheet.cpp @@ -85,7 +85,7 @@ void BatchedSpriteSheet::render(Services::OpenGLRenderer& rs, Engine& engine) { std::vector instances; }; // HACK: assume same sp for same texture - std::unordered_map batch_map; + std::unordered_map batch_map; auto view = scene.view();