Skip to content

Commit

Permalink
Merge pull request #39 from mortennobel/develop
Browse files Browse the repository at this point in the history
1.1.4
  • Loading branch information
mortennobel authored Sep 26, 2018
2 parents 4586afd + b5435c8 commit 1c364aa
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 8 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions examples/14_spinning-primitives-openvr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class SpinningPrimitivesOpenVRExample {
}
}
}

};
r.frameRender = [&](){
render();
Expand All @@ -80,6 +81,7 @@ class SpinningPrimitivesOpenVRExample {
.withFramebuffer(fb)
.withCamera(cam)
.withSkybox(skybox)
.withGUI(false)
.build();
render(renderPass);
};
Expand Down
2 changes: 1 addition & 1 deletion include/sre/Renderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions include/sre/SpriteAtlas.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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",
Expand Down
6 changes: 6 additions & 0 deletions src/sre/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
}
#endif

#include <SDL_events.h>
#include "sre/Log.hpp"
#include "sre/VR.hpp"

Expand Down Expand Up @@ -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);
Expand Down
9 changes: 7 additions & 2 deletions src/sre/SpriteAtlas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,13 @@ std::shared_ptr<SpriteAtlas> 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<double>();
pivot.y = (float)spriteElement.get("pivot").get("y").get<double>();
if (spriteElement.contains("pivot")){
pivot.x = (float)spriteElement.get("pivot").get("x").get<double>();
pivot.y = (float)spriteElement.get("pivot").get("y").get<double>();
} else {
pivot.x = 0.5f;
pivot.y = 0.5f;
}
if (flipAnchorY){
pivot.y = 1.0f - pivot.y;
}
Expand Down
3 changes: 2 additions & 1 deletion submodules/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 <url>'")
message( FATAL_ERROR "Cannot find submodules used in SimpleRenderEngine. Run 'git submodule update --init --recursive' or checkout full project using 'git clone --recurse-submodules <url>'")
endif()

set(EXTRA_SOURCE_FILES ${EXTRA_SOURCE_FILES_} CACHE PATH "" FORCE)
2 changes: 1 addition & 1 deletion submodules/ImGuiColorTextEdit
2 changes: 1 addition & 1 deletion submodules/imgui
Submodule imgui updated 142 files
1 change: 1 addition & 0 deletions version-history.md
Original file line number Diff line number Diff line change
@@ -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().
Expand Down

0 comments on commit 1c364aa

Please sign in to comment.