diff --git a/CMakeLists.txt b/CMakeLists.txt index 668ad500..dce63ef3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,7 @@ set(SRE_INCLUDE_DIRS ${SDL2_INCLUDE_DIR}) # FIND OPENGL ######################################################### IF(APPLE) + add_definitions(-DGL_SILENCE_DEPRECATION) list(APPEND SRE_INCLUDE_DIRS /System/Library/Frameworks) FIND_LIBRARY(OpenGL_LIBRARY OpenGL ) MARK_AS_ADVANCED (OpenGL_LIBRARY) diff --git a/examples/14_spinning-primitives-openvr.cpp b/examples/14_spinning-primitives-openvr.cpp index bd00bbb4..e9389303 100644 --- a/examples/14_spinning-primitives-openvr.cpp +++ b/examples/14_spinning-primitives-openvr.cpp @@ -65,6 +65,7 @@ class SpinningPrimitivesOpenVRExample { } } } + }; r.frameRender = [&](){ render(); @@ -80,6 +81,7 @@ class SpinningPrimitivesOpenVRExample { .withFramebuffer(fb) .withCamera(cam) .withSkybox(skybox) + .withGUI(false) .build(); render(renderPass); }; diff --git a/include/sre/Renderer.hpp b/include/sre/Renderer.hpp index b98420d3..ad0c0e38 100755 --- a/include/sre/Renderer.hpp +++ b/include/sre/Renderer.hpp @@ -71,7 +71,7 @@ namespace sre { ~Renderer(); static constexpr int sre_version_major = 1; static constexpr int sre_version_minor = 1; - static constexpr int sre_version_point = 3; + static constexpr int sre_version_point = 4; glm::ivec2 getWindowSize(); // Return the current size of the window diff --git a/include/sre/SpriteAtlas.hpp b/include/sre/SpriteAtlas.hpp index 8ea94a54..dd921023 100644 --- a/include/sre/SpriteAtlas.hpp +++ b/include/sre/SpriteAtlas.hpp @@ -21,7 +21,6 @@ // Data Format: JSON (Array) // Layout - Size constraints: POT (Power of 2) // Allow rotation: false -// Include pivot information (double click on a single sprite and check 'enable pivot points' // // The json layout is as follows // {"frames": [ // sprites must be defined as an array with the name frames @@ -32,7 +31,7 @@ // "trimmed": false, // trimmed must be true or false // "spriteSourceSize": {"x":0,"y":0,"w":100,"h":100}, // not used // "sourceSize": {"w":100,"h":100}, // not used -// "pivot": {"x":0.5,"y":0.5} // pivot point relative to frame. (Normalized values [0.0,1.0]) +// "pivot": {"x":0.5,"y":0.5} // pivot point relative to frame. (Normalized values [0.0,1.0]) (optional - default {0.5,0.5}) // }, // { // add as many sprites as needed // "filename": "berry.png", diff --git a/src/sre/Renderer.cpp b/src/sre/Renderer.cpp index 68804b95..7ae59b65 100755 --- a/src/sre/Renderer.cpp +++ b/src/sre/Renderer.cpp @@ -14,6 +14,7 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; } #endif +#include #include "sre/Log.hpp" #include "sre/VR.hpp" @@ -46,6 +47,11 @@ namespace sre { instance = this; glcontext = SDL_GL_CreateContext(window); +#if __APPLE__ + SDL_PumpEvents(); + auto winSize = getWindowSize(); + SDL_SetWindowSize(window, winSize.x, winSize.y); +#endif if (!glcontext) { int major, minor; bool supported = getMaximumOpenGLSupport(&major, &minor); diff --git a/src/sre/SpriteAtlas.cpp b/src/sre/SpriteAtlas.cpp index dd8474c9..46c81695 100644 --- a/src/sre/SpriteAtlas.cpp +++ b/src/sre/SpriteAtlas.cpp @@ -87,8 +87,13 @@ std::shared_ptr SpriteAtlas::create(std::string jsonFile, std::shar sourceSize = size; } pos.y = texture->getHeight()-pos.y-size.y; - pivot.x = (float)spriteElement.get("pivot").get("x").get(); - pivot.y = (float)spriteElement.get("pivot").get("y").get(); + if (spriteElement.contains("pivot")){ + pivot.x = (float)spriteElement.get("pivot").get("x").get(); + pivot.y = (float)spriteElement.get("pivot").get("y").get(); + } else { + pivot.x = 0.5f; + pivot.y = 0.5f; + } if (flipAnchorY){ pivot.y = 1.0f - pivot.y; } diff --git a/submodules/CMakeLists.txt b/submodules/CMakeLists.txt index ccec1611..41a14a51 100644 --- a/submodules/CMakeLists.txt +++ b/submodules/CMakeLists.txt @@ -4,10 +4,11 @@ file(GLOB EXTRA_SOURCE_FILES_ "ImGuiColorTextEdit/TextEditor.cpp" "imgui/imgui.cpp" "imgui/imgui_draw.cpp" + "imgui/imgui_widgets.cpp" ) if (NOT EXTRA_SOURCE_FILES_) - message( FATAL_ERROR "Cannot find submodules used in SimpleRenderEngine. Run 'git submodule update --init' or checkout full project using 'git clone --recurse-submodules '") + message( FATAL_ERROR "Cannot find submodules used in SimpleRenderEngine. Run 'git submodule update --init --recursive' or checkout full project using 'git clone --recurse-submodules '") endif() set(EXTRA_SOURCE_FILES ${EXTRA_SOURCE_FILES_} CACHE PATH "" FORCE) \ No newline at end of file diff --git a/submodules/ImGuiColorTextEdit b/submodules/ImGuiColorTextEdit index 3211b175..0ef8c9f4 160000 --- a/submodules/ImGuiColorTextEdit +++ b/submodules/ImGuiColorTextEdit @@ -1 +1 @@ -Subproject commit 3211b1756a942064bab5a340f1d6b59bae0812b5 +Subproject commit 0ef8c9f4b8b9dd0949ccf1a793abd8a054cd4c69 diff --git a/submodules/imgui b/submodules/imgui index 00418d13..e0cab566 160000 --- a/submodules/imgui +++ b/submodules/imgui @@ -1 +1 @@ -Subproject commit 00418d13e369bf53cc4b8f817eb10b8ce65f0904 +Subproject commit e0cab5664adf02c030f9cf2a05d2c334638a85f8 diff --git a/version-history.md b/version-history.md index 81c8f7b2..0ac8f067 100644 --- a/version-history.md +++ b/version-history.md @@ -1,5 +1,6 @@ ## Version history + * 1.1.4 ImGUI 1.65. Sprite atlas. Make pivot point optional in JSON. Fix Mojave black screen issue (OpenGL) * 1.1.3 Fix sprite atlas bug (Windows). * 1.1.2 Maintain uniforms on shader recompile. Add ImGui_RenderTexture(). Add SDLRenderer::setWindowIcon(). More strict resource management for shader code. * 1.1.1 Libraries as submodules. Mesh::MeshBuilder::recomputeNormals(). Mesh::MeshBuilder::recomputeTangents().