9 Commits

Author SHA1 Message Date
cd0b35b465 update physfs and use supplied cmake, since it got fixed 2024-09-08 17:07:53 +02:00
c051d36a64 update stb to latest master 2024-09-08 16:55:58 +02:00
202ba31d79 update glm to 1.0.0 2024-01-26 12:40:28 +01:00
df949a5afc add (very) fake halation to the bloom extraction shader 2023-10-31 17:17:59 +01:00
9b173c64a6 add pkg-config fallback and imported target to sdl find module 2023-10-31 17:06:11 +01:00
3a885ee250 update entt to v3.12.2 2023-09-07 01:51:33 +02:00
00e48f9967 update spdlog to v1.12.0 2023-09-05 11:56:50 +02:00
c791f4c6a1 fix print formatter 2023-09-04 23:46:12 +02:00
7a3823db78 update ImGui to v1.89.9
and reenable obsolte bc of text editor (temp, will be replaced)
2023-09-04 20:57:00 +02:00
15 changed files with 114 additions and 322 deletions

View File

@@ -14,7 +14,7 @@ env:
jobs: jobs:
linux: linux:
timeout-minutes: 10 timeout-minutes: 15
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage. # You can convert this to a matrix build if you need cross-platform coverage.

View File

@@ -105,7 +105,7 @@
if(NOT EMSCRIPTEN) if(NOT EMSCRIPTEN)
FIND_PATH(SDL2_INCLUDE_DIR SDL.h FIND_PATH(SDL2_INCLUDE_DIR_TEMP SDL.h
HINTS HINTS
$ENV{SDL2} $ENV{SDL2}
PATH_SUFFIXES include/SDL2 include SDL2 PATH_SUFFIXES include/SDL2 include SDL2
@@ -153,7 +153,7 @@ ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8) ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
IF(NOT SDL2_BUILDING_LIBRARY) IF(NOT SDL2_BUILDING_LIBRARY)
IF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework") IF(NOT "${SDL2_INCLUDE_DIR_TEMP}" MATCHES ".framework")
# Non-OS X framework versions expect you to also dynamically link to # Non-OS X framework versions expect you to also dynamically link to
# SDL2main. This is mainly for Windows and OS X. Other (Unix) platforms # SDL2main. This is mainly for Windows and OS X. Other (Unix) platforms
# seem to provide SDL2main for compatibility even though they don't # seem to provide SDL2main for compatibility even though they don't
@@ -189,7 +189,7 @@ IF(NOT SDL2_BUILDING_LIBRARY)
/opt /opt
) )
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8) ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
ENDIF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework") ENDIF(NOT "${SDL2_INCLUDE_DIR_TEMP}" MATCHES ".framework")
ENDIF(NOT SDL2_BUILDING_LIBRARY) ENDIF(NOT SDL2_BUILDING_LIBRARY)
# SDL2 may require threads on your system. # SDL2 may require threads on your system.
@@ -208,7 +208,7 @@ IF(MINGW)
ENDIF(MINGW) ENDIF(MINGW)
SET(SDL2_FOUND "NO") SET(SDL2_FOUND "NO")
IF(SDL2_LIBRARY_TEMP) IF(SDL2_LIBRARY_TEMP)
# For SDL2main # For SDL2main
IF(NOT SDL2_BUILDING_LIBRARY) IF(NOT SDL2_BUILDING_LIBRARY)
IF(SDL2MAIN_LIBRARY) IF(SDL2MAIN_LIBRARY)
@@ -243,23 +243,32 @@ SET(SDL2_FOUND "NO")
# Set the temp variable to INTERNAL so it is not seen in the CMake GUI # Set the temp variable to INTERNAL so it is not seen in the CMake GUI
SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "") SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "")
############add_library(SDL UNKNOWN IMPORTED) set(SDL2_INCLUDE_DIR ${SDL2_INCLUDE_DIR_TEMP} CACHE STRING "Where the SDL2 Headers can be found")
#target_link_libraries(SDL INTERFACE ${SDL2_LIBRARY}) SET(SDL2_INCLUDE_DIR_TEMP "${SDL2_INCLUDE_DIR_TEMP}" CACHE INTERNAL "")
#target_include_directories(SDL INTERFACE ${SDL2_INCLUDE_DIR})
#set_target_properties(SDL PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES "${SDL2_LIBRARY}")
#set_target_properties(SDL PROPERTIES
#INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}")
#set_target_properties(SDL PROPERTIES
#IMPORTED_LINK_INTERFACE_LANGUAGES "C"
#IMPORTED_LINK_INTERFACE_LIBRARIES "${SDL2_LIBRARY}"
#LINK_INTERFACE_LIBRARIES "${SDL2_LIBRARY}")
#IMPORTED_LOCATION "${SDL2_LIBRARY}")
SET(SDL2_FOUND "YES") SET(SDL2_FOUND "YES")
else() # SDL2_LIBRARY_TEMP
# try to pkg-config fallback
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(PKG_C_SDL2 QUIET sdl2)
if (PKG_C_SDL2_FOUND)
SET(SDL2_LIBRARY_TEMP ${PKG_C_SDL2_LIBRARIES})
SET(SDL2_INCLUDE_DIR_TEMP ${PKG_C_SDL2_INCLUDE_DIRS})
# Set the final string here so the GUI reflects the final state.
SET(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL2 Library can be found")
# Set the temp variable to INTERNAL so it is not seen in the CMake GUI
SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "")
set(SDL2_INCLUDE_DIR ${SDL2_INCLUDE_DIR_TEMP} CACHE STRING "Where the SDL2 Headers can be found")
SET(SDL2_INCLUDE_DIR_TEMP "${SDL2_INCLUDE_DIR_TEMP}" CACHE INTERNAL "")
#message("II set include dir to ${SDL2_INCLUDE_DIR}")
SET(SDL2_FOUND "YES")
endif()
endif()
ENDIF(SDL2_LIBRARY_TEMP) ENDIF(SDL2_LIBRARY_TEMP)
else() #emsripten else() #emsripten
@@ -288,4 +297,11 @@ INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR) FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR)
if (SDL2_FOUND)
if (NOT TARGET SDL2::SDL2)
add_library(SDL2::SDL2 INTERFACE IMPORTED)
target_include_directories(SDL2::SDL2 INTERFACE ${SDL2_INCLUDE_DIR})
target_link_libraries(SDL2::SDL2 INTERFACE ${SDL2_LIBRARY})
endif()
endif()

View File

@@ -21,7 +21,6 @@ set(JSON_BuildTests OFF CACHE INTERNAL "")
set(JSON_MultipleHeaders ON CACHE INTERNAL "") set(JSON_MultipleHeaders ON CACHE INTERNAL "")
add_subdirectory("json") # link with "nlohmann_json::nlohmann_json" add_subdirectory("json") # link with "nlohmann_json::nlohmann_json"
set(PHYSFS_BUILD_SHARED FALSE CACHE INTERNAL "")
add_subdirectory("physfs") add_subdirectory("physfs")
if(NOT MM_HEADLESS) if(NOT MM_HEADLESS)

2
external/entt vendored

2
external/glm vendored

View File

@@ -41,7 +41,7 @@ target_include_directories(imgui PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
#target_include_directories(imgui PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/imgui") #target_include_directories(imgui PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/imgui")
target_include_directories(imgui PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/imgui") # im sad target_include_directories(imgui PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/imgui") # im sad
target_compile_definitions(imgui PUBLIC IMGUI_DISABLE_OBSOLETE_FUNCTIONS=1) #target_compile_definitions(imgui PUBLIC IMGUI_DISABLE_OBSOLETE_FUNCTIONS=1) # more sad
if(EMSCRIPTEN) if(EMSCRIPTEN)
target_compile_options(imgui PUBLIC -sUSE_SDL=2) target_compile_options(imgui PUBLIC -sUSE_SDL=2)

View File

@@ -1,235 +1,6 @@
# file taken from offical physfs repo and modified
# PhysicsFS; a portable, flexible file i/o abstraction.
#
# Please see the file LICENSE.txt in the source's root directory.
# The CMake project file is meant to get this compiling on all sorts of
# platforms quickly, and serve as the way Unix platforms and Linux distros
# package up official builds, but you don't _need_ to use this; we have
# built PhysicsFS to (hopefully) be able to drop into your project and
# compile, using preprocessor checks for platform-specific bits instead of
# testing in here.
cmake_minimum_required(VERSION 3.9 FATAL_ERROR) cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
project(PhysicsFS) set(PHYSFS_BUILD_SHARED FALSE CACHE INTERNAL "")
set(PHYSFS_VERSION 3.1.0) set(PHYSFS_BUILD_TEST FALSE CACHE INTERNAL "")
add_subdirectory("physfs")
# Increment this if/when we break backwards compatibility.
set(PHYSFS_SOVERSION 1)
# I hate that they define "WIN32" ... we're about to move to Win64...I hope!
if(WIN32 AND NOT WINDOWS)
set(WINDOWS TRUE)
endif()
if(APPLE)
set(PHYSFS_M_SRCS physfs/src/physfs_platform_apple.m)
endif()
if(CMAKE_COMPILER_IS_GNUCC)
# Don't use -rpath.
set(CMAKE_SKIP_RPATH ON CACHE BOOL "Skip RPATH" FORCE)
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "SunPro")
add_definitions(-erroff=E_EMPTY_TRANSLATION_UNIT)
add_definitions(-xldscope=hidden)
endif()
if(HAIKU)
# We add this explicitly, since we don't want CMake to think this
# is a C++ project unless we're on Haiku.
set(PHYSFS_CPP_SRCS physfs/src/physfs_platform_haiku.cpp)
find_library(BE_LIBRARY be)
find_library(ROOT_LIBRARY root)
set(OPTIONAL_LIBRARY_LIBS ${OPTIONAL_LIBRARY_LIBS} ${BE_LIBRARY} ${ROOT_LIBRARY})
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
set(WINRT TRUE)
endif()
if(WINRT)
set(PHYSFS_CPP_SRCS physfs/src/physfs_platform_winrt.cpp)
endif()
if(UNIX AND NOT WINDOWS AND NOT APPLE) # (MingW and such might be UNIX _and_ WINDOWS!)
find_library(PTHREAD_LIBRARY pthread)
if(PTHREAD_LIBRARY)
set(OPTIONAL_LIBRARY_LIBS ${OPTIONAL_LIBRARY_LIBS} ${PTHREAD_LIBRARY})
endif()
endif()
# Almost everything is "compiled" here, but things that don't apply to the
# build are #ifdef'd out. This is to make it easy to embed PhysicsFS into
# another project or bring up a new build system: just compile all the source
# code and #define the things you want.
set(PHYSFS_SRCS
physfs/src/physfs.c
physfs/src/physfs_byteorder.c
physfs/src/physfs_unicode.c
physfs/src/physfs_platform_posix.c
physfs/src/physfs_platform_unix.c
physfs/src/physfs_platform_windows.c
physfs/src/physfs_platform_os2.c
physfs/src/physfs_platform_qnx.c
physfs/src/physfs_platform_android.c
physfs/src/physfs_archiver_dir.c
physfs/src/physfs_archiver_unpacked.c
physfs/src/physfs_archiver_grp.c
physfs/src/physfs_archiver_hog.c
physfs/src/physfs_archiver_7z.c
physfs/src/physfs_archiver_mvl.c
physfs/src/physfs_archiver_qpak.c
physfs/src/physfs_archiver_wad.c
physfs/src/physfs_archiver_zip.c
physfs/src/physfs_archiver_slb.c
physfs/src/physfs_archiver_iso9660.c
physfs/src/physfs_archiver_vdf.c
physfs/src/physfs.h
physfs/src/physfs_casefolding.h
physfs/src/physfs_internal.h
physfs/src/physfs_lzmasdk.h
physfs/src/physfs_miniz.h
physfs/src/physfs_platforms.h
${PHYSFS_CPP_SRCS}
${PHYSFS_M_SRCS}
)
# Archivers ...
# These are (mostly) on by default now, so these options are only useful for
# disabling them.
option(PHYSFS_ARCHIVE_ZIP "Enable ZIP support" TRUE)
if(NOT PHYSFS_ARCHIVE_ZIP)
add_definitions(-DPHYSFS_SUPPORTS_ZIP=0)
endif()
option(PHYSFS_ARCHIVE_7Z "Enable 7zip support" TRUE)
if(NOT PHYSFS_ARCHIVE_7Z)
add_definitions(-DPHYSFS_SUPPORTS_7Z=0)
endif()
option(PHYSFS_ARCHIVE_GRP "Enable Build Engine GRP support" TRUE)
if(NOT PHYSFS_ARCHIVE_GRP)
add_definitions(-DPHYSFS_SUPPORTS_GRP=0)
endif()
option(PHYSFS_ARCHIVE_WAD "Enable Doom WAD support" TRUE)
if(NOT PHYSFS_ARCHIVE_WAD)
add_definitions(-DPHYSFS_SUPPORTS_WAD=0)
endif()
option(PHYSFS_ARCHIVE_HOG "Enable Descent I/II HOG support" TRUE)
if(NOT PHYSFS_ARCHIVE_HOG)
add_definitions(-DPHYSFS_SUPPORTS_HOG=0)
endif()
option(PHYSFS_ARCHIVE_MVL "Enable Descent I/II MVL support" TRUE)
if(NOT PHYSFS_ARCHIVE_MVL)
add_definitions(-DPHYSFS_SUPPORTS_MVL=0)
endif()
option(PHYSFS_ARCHIVE_QPAK "Enable Quake I/II QPAK support" TRUE)
if(NOT PHYSFS_ARCHIVE_QPAK)
add_definitions(-DPHYSFS_SUPPORTS_QPAK=0)
endif()
option(PHYSFS_ARCHIVE_SLB "Enable I-War / Independence War SLB support" TRUE)
if(NOT PHYSFS_ARCHIVE_SLB)
add_definitions(-DPHYSFS_SUPPORTS_SLB=0)
endif()
option(PHYSFS_ARCHIVE_ISO9660 "Enable ISO9660 support" TRUE)
if(NOT PHYSFS_ARCHIVE_ISO9660)
add_definitions(-DPHYSFS_SUPPORTS_ISO9660=0)
endif()
option(PHYSFS_ARCHIVE_VDF "Enable Gothic I/II VDF archive support" TRUE)
if(NOT PHYSFS_ARCHIVE_VDF)
add_definitions(-DPHYSFS_SUPPORTS_VDF=0)
endif()
option(PHYSFS_BUILD_STATIC "Build static library" TRUE)
if(PHYSFS_BUILD_STATIC)
add_library(physfs-static STATIC ${PHYSFS_SRCS})
# Don't rename this on Windows, since DLLs will also produce an import
# library named "physfs.lib" which would conflict; Unix tend to like the
# same library name with a different extension for static libs, but
# Windows can just have a separate name.
if(NOT MSVC)
set_target_properties(physfs-static PROPERTIES OUTPUT_NAME "physfs")
endif()
if(WINRT)
# Ignore LNK4264 warnings; we don't author any WinRT components, just consume them, so we're okay in a static library.
set_target_properties(physfs-static PROPERTIES VS_WINRT_COMPONENT True)
set_target_properties(physfs-static PROPERTIES STATIC_LIBRARY_FLAGS "/ignore:4264")
endif()
if(APPLE)
target_link_libraries(physfs-static PUBLIC "-framework IOKit")
target_link_libraries(physfs-static PUBLIC "-framework Foundation") # do i need this?
endif()
target_include_directories(physfs-static PUBLIC "physfs/src")
set(PHYSFS_LIB_TARGET physfs-static)
set(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs-static")
endif()
if(NOT PHYSFS_BUILD_STATIC)
message(FATAL "static libraries are disabled!")
endif()
# CMake FAQ says I need this...
if(PHYSFS_BUILD_STATIC AND NOT WINDOWS)
set_target_properties(physfs-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
endif()
if(NOT MSVC)
configure_file(
"physfs/extras/physfs.pc.in"
"physfs/extras/physfs.pc"
@ONLY
)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/extras/physfs.pc"
DESTINATION "lib${LIB_SUFFIX}/pkgconfig"
)
endif()
macro(message_bool_option _NAME _VALUE)
if(${_VALUE})
message(STATUS " ${_NAME}: enabled")
else()
message(STATUS " ${_NAME}: disabled")
endif()
endmacro()
message(STATUS "PhysicsFS will build with the following options:")
message_bool_option("ZIP support" PHYSFS_ARCHIVE_ZIP)
message_bool_option("7zip support" PHYSFS_ARCHIVE_7Z)
message_bool_option("GRP support" PHYSFS_ARCHIVE_GRP)
message_bool_option("WAD support" PHYSFS_ARCHIVE_WAD)
message_bool_option("HOG support" PHYSFS_ARCHIVE_HOG)
message_bool_option("MVL support" PHYSFS_ARCHIVE_MVL)
message_bool_option("QPAK support" PHYSFS_ARCHIVE_QPAK)
message_bool_option("SLB support" PHYSFS_ARCHIVE_SLB)
message_bool_option("VDF support" PHYSFS_ARCHIVE_VDF)
message_bool_option("ISO9660 support" PHYSFS_ARCHIVE_ISO9660)
message_bool_option("Build static library" PHYSFS_BUILD_STATIC)
message_bool_option("Build shared library" PHYSFS_BUILD_SHARED)
message_bool_option("Build stdio test program" PHYSFS_BUILD_TEST)
if(PHYSFS_BUILD_TEST)
message_bool_option(" Use readline in test program" HAVE_SYSTEM_READLINE)
endif()
# end of CMakeLists.txt ...

View File

@@ -134,10 +134,10 @@ public:
e = registry.create(); e = registry.create();
// create a copy of an entity component by component // create a copy of an entity component by component
for (auto &&curr: registry.storage()) { for(auto &&curr: registry.storage()) {
if (auto &storage = curr.second; storage.contains(old_e)) { if(auto &storage = curr.second; storage.contains(old_e)) {
// TODO: do something with the return value. returns false on failure. // TODO: do something with the return value. returns false on failure.
storage.emplace(e, storage.get(old_e)); storage.push(e, storage.value(old_e));
} }
} }
} }
@@ -237,11 +237,11 @@ public:
if (comp_list.empty()) { if (comp_list.empty()) {
ImGui::Text("Orphans:"); ImGui::Text("Orphans:");
registry.each([&registry](auto e){ for (EntityType e : registry.template storage<EntityType>()) {
if (registry.orphan(e)) { if (registry.orphan(e)) {
MM_IEEE_ENTITY_WIDGET(e, registry, false); MM_IEEE_ENTITY_WIDGET(e, registry, false);
} }
}); }
} else { } else {
entt::runtime_view view{}; entt::runtime_view view{};
for (const auto type : comp_list) { for (const auto type : comp_list) {
@@ -264,17 +264,6 @@ public:
} }
} }
[[deprecated("Use renderEditor() instead. And manage the window yourself.")]]
void render(Registry& registry, EntityType& e)
{
if (show_window) {
if (ImGui::Begin("Entity Editor", &show_window)) {
renderEditor(registry, e);
}
ImGui::End();
}
}
// displays both, editor and list // displays both, editor and list
// uses static internally, use only as a quick way to get going! // uses static internally, use only as a quick way to get going!
void renderSimpleCombo(Registry& registry, EntityType& e) void renderSimpleCombo(Registry& registry, EntityType& e)

View File

@@ -4,6 +4,7 @@
#include <imgui.h> #include <imgui.h>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <imgui/misc/cpp/imgui_stdlib.h> #include <imgui/misc/cpp/imgui_stdlib.h>
#include <cinttypes>
namespace MM::ImGuiWidgets { namespace MM::ImGuiWidgets {
@@ -55,16 +56,16 @@ void JsonViewerSimple(const char* name, const JsonObjectType& json) {
} }
break; break;
case JsonObjectType::value_t::number_integer: case JsonObjectType::value_t::number_integer:
ImGui::TextColored(int_color, "%ld", json.template get<int64_t>()); ImGui::TextColored(int_color, "%" PRId64, json.template get<int64_t>());
break; break;
case JsonObjectType::value_t::number_unsigned: case JsonObjectType::value_t::number_unsigned:
ImGui::TextColored(unsigned_color, "%lu", json.template get<uint64_t>()); ImGui::TextColored(unsigned_color, "%" PRIu64, json.template get<uint64_t>());
break; break;
case JsonObjectType::value_t::number_float: case JsonObjectType::value_t::number_float:
ImGui::TextColored(float_color, "%f", json.template get<float>()); ImGui::TextColored(float_color, "%f", json.template get<float>());
break; break;
case JsonObjectType::value_t::object: case JsonObjectType::value_t::object:
ImGui::TextDisabled("{%d}", json.size()); ImGui::TextDisabled("{%zu}", json.size());
ImGui::Indent(); ImGui::Indent();
for (auto& [key, value] : json.items()) { for (auto& [key, value] : json.items()) {
@@ -74,7 +75,7 @@ void JsonViewerSimple(const char* name, const JsonObjectType& json) {
break; break;
case JsonObjectType::value_t::array: case JsonObjectType::value_t::array:
ImGui::TextDisabled("[%d]", json.size()); ImGui::TextDisabled("[%zu]", json.size());
ImGui::Indent(); ImGui::Indent();
for (auto& [key, value] : json.items()) { for (auto& [key, value] : json.items()) {
@@ -103,9 +104,9 @@ void JsonViewerTree(const char* name, const JsonObjectType& json) {
ImGui::SameLine(); ImGui::SameLine();
if (json.is_object()) { if (json.is_object()) {
ImGui::TextDisabled("{%d}", json.size()); ImGui::TextDisabled("{%zu}", json.size());
} else { // is_array() } else { // is_array()
ImGui::TextDisabled("[%d]", json.size()); ImGui::TextDisabled("[%zu]", json.size());
} }
if (tree_open) { if (tree_open) {
@@ -143,10 +144,10 @@ void JsonViewerTree(const char* name, const JsonObjectType& json) {
} }
break; break;
case JsonObjectType::value_t::number_integer: case JsonObjectType::value_t::number_integer:
ImGui::TextColored(int_color, "%ld", json.template get<int64_t>()); ImGui::TextColored(int_color, "%" PRId64, json.template get<int64_t>());
break; break;
case JsonObjectType::value_t::number_unsigned: case JsonObjectType::value_t::number_unsigned:
ImGui::TextColored(unsigned_color, "%lu", json.template get<uint64_t>()); ImGui::TextColored(unsigned_color, "%" PRIu64, json.template get<uint64_t>());
break; break;
case JsonObjectType::value_t::number_float: case JsonObjectType::value_t::number_float:
ImGui::TextColored(float_color, "%f", json.template get<float>()); ImGui::TextColored(float_color, "%f", json.template get<float>());
@@ -200,9 +201,9 @@ void JsonEditor(const char* name, JsonObjectType& json) {
ImGui::SameLine(); ImGui::SameLine();
if (json.is_object()) { if (json.is_object()) {
ImGui::TextDisabled("{%d}", json.size()); ImGui::TextDisabled("{%zu}", json.size());
} else { // is_array() } else { // is_array()
ImGui::TextDisabled("[%d]", json.size()); ImGui::TextDisabled("[%zu]", json.size());
} }
if (tree_open) { if (tree_open) {

View File

@@ -1,4 +1,5 @@
#include "./scene_tools.hpp" #include "./scene_tools.hpp"
#include "mm/engine_fwd.hpp"
#include <mm/engine.hpp> #include <mm/engine.hpp>
@@ -109,17 +110,20 @@ namespace MM::Services {
if (_show_scene_metrics) { if (_show_scene_metrics) {
if (ImGui::Begin("Scene Metrics##ImGuiSceneToolsService", &_show_scene_metrics)) { if (ImGui::Begin("Scene Metrics##ImGuiSceneToolsService", &_show_scene_metrics)) {
ImGui::Text("capacity: %lu", scene.capacity()); ImGui::Text("capacity: %zu", scene.storage<::MM::Entity>().capacity());
ImGui::Text("size: %lu", scene.size()); ImGui::Text("size: %zu", scene.storage<::MM::Entity>().size());
ImGui::Text("alive: %lu", scene.alive()); ImGui::Text("alive: %zu", scene.storage<::MM::Entity>().in_use());
if (ImGui::CollapsingHeader("orphans")) {
// iterating all entities is expensive
size_t orphans = 0; size_t orphans = 0;
scene.each([&orphans, &scene](auto entity) { for (const auto it : scene.storage<MM::Entity>().each()) {
if (scene.orphan(entity)) { if (scene.orphan(std::get<0>(it))) {
orphans++; orphans++;
} }
}); }
ImGui::Text("orphans: %lu", orphans); ImGui::Text("orphans: %lu", orphans);
} }
}
ImGui::End(); ImGui::End();
} }

View File

@@ -102,6 +102,9 @@ in vec2 _uv;
out vec3 _out_color; out vec3 _out_color;
// global config, keep it constant
const float fake_halation_strenth = 1.0;
void main() { void main() {
vec3 color = texture(color_tex, _uv).rgb; vec3 color = texture(color_tex, _uv).rgb;
@@ -114,7 +117,16 @@ void main() {
//step(vec3(0.0), color) //step(vec3(0.0), color)
//); //);
const vec3 fake_halation_base = vec3(0.03, 0.01, 0.0) * vec3(fake_halation_strenth);
const vec3 fake_halation_extraction_offset = vec3(1.0) - fake_halation_base;
const vec3 fake_halation_bloom_fact = vec3(1.0) + fake_halation_base;
if (fake_halation_strenth <= 0.001) {
_out_color = max(min(color, vec3(0.0)), color - vec3(1.0)); _out_color = max(min(color, vec3(0.0)), color - vec3(1.0));
} else {
_out_color = max(min(color, vec3(0.0)), color - fake_halation_extraction_offset) * fake_halation_bloom_fact;
//_out_color = max(min(color, vec3(0.0)), color - vec3(0.95, 0.97, 1.0)) * vec3(1.10, 1.05, 1.0);
}
})") })")
} }