Skip to content

Commit

Permalink
fix(render): fix uniform for HiDPI monitors
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerDTZ committed Sep 16, 2023
1 parent 3d06617 commit 4984431
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -t install
rm -f ${{github.workspace}}/install/README.md
# Maintaining file permissions
chmod +x ${{github.workspace}}/install/shadertoy.app/Contents/MacOS/shadertoy
# chmod +x ${{github.workspace}}/install/shadertoy.app/Contents/MacOS/shadertoy
mv ${{github.workspace}}/install ${{github.workspace}}/shadertoy-macos-x86_64
tar -zcvf ${{github.workspace}}/shadertoy-macos-x86_64.tar.gz --directory ${{github.workspace}} shadertoy-macos-x86_64
Expand Down Expand Up @@ -69,4 +69,4 @@ jobs:
name: build-macos-arm64
path: ${{github.workspace}}/shadertoy-macos-arm64.tar.gz
if-no-files-found: error


2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set(CMAKE_CXX_EXTENSIONS OFF)
SET(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
SET(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)

project(shadertoy VERSION 0.1.1 HOMEPAGE_URL "https://github.com/dtcxzyw/shadertoy")
project(shadertoy VERSION 0.1.2 HOMEPAGE_URL "https://github.com/dtcxzyw/shadertoy")

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Supported build types: Debug Release" FORCE)
Expand Down
18 changes: 9 additions & 9 deletions shadertoy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ target_include_directories(shadertoy PRIVATE ${Stb_INCLUDE_DIR} ${CPP_BASE64_INC
if(APPLE)
find_library(AppleSecurityLib Security)
target_link_libraries(shadertoy PRIVATE ${AppleSecurityLib})
set_target_properties(shadertoy PROPERTIES
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_BUNDLE_NAME "Shadertoy live viewer"
MACOSX_BUNDLE_BUNDLE_VERSION ${CMAKE_PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${CMAKE_PROJECT_VERSION}
MACOSX_BUNDLE_COPYRIGHT "Copyright 2023 Yingwei Zheng"
MACOSX_BUNDLE_GUI_IDENTIFIER "com.dtcxzyw.shadertoy"
MACOSX_FRAMEWORK_IDENTIFIER "com.dtcxzyw.shadertoy"
)
# set_target_properties(shadertoy PROPERTIES
# MACOSX_BUNDLE TRUE
# MACOSX_BUNDLE_BUNDLE_NAME "Shadertoy live viewer"
# MACOSX_BUNDLE_BUNDLE_VERSION ${CMAKE_PROJECT_VERSION}
# MACOSX_BUNDLE_SHORT_VERSION_STRING ${CMAKE_PROJECT_VERSION}
# MACOSX_BUNDLE_COPYRIGHT "Copyright 2023 Yingwei Zheng"
# MACOSX_BUNDLE_GUI_IDENTIFIER "com.dtcxzyw.shadertoy"
# MACOSX_FRAMEWORK_IDENTIFIER "com.dtcxzyw.shadertoy"
# )
endif(APPLE)

set(SHADERTOY_BACKGROUND_IMG ${CMAKE_CURRENT_LIST_DIR}/thirdparty/imgui-node-editor/examples/blueprints-example/data/BlueprintBackground.png )
Expand Down
2 changes: 1 addition & 1 deletion shadertoy/Config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

// NOLINTNEXTLINE
#define SHADERTOY_MAKE_VERSION(MAJOR, MINOR, PATCH) #MAJOR "." #MINOR "." #PATCH
#define SHADERTOY_VERSION SHADERTOY_MAKE_VERSION(0, 1, 1)
#define SHADERTOY_VERSION SHADERTOY_MAKE_VERSION(0, 1, 2)
#define SHADERTOY_URL "https://github.com/dtcxzyw/shadertoy"

#define SHADERTOY_NAMESPACE_BEGIN namespace ShaderToy {
Expand Down
2 changes: 1 addition & 1 deletion shadertoy/NodeEditor/PipelineEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1592,7 +1592,7 @@ void PipelineEditor::updateNodeType() {

std::unordered_map<uintptr_t, ed::PinId> graph;
for(auto link : mLinks) {
assert(!graph.contains(link.endPinId.Get()));
assert(!graph.count(link.endPinId.Get()));
graph.emplace(link.endPinId.Get(), link.startPinId);
}
for(const auto& node : mNodes) {
Expand Down
12 changes: 6 additions & 6 deletions shadertoy/OpenGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,9 @@ class RenderPass final {
if(mType == NodeType::Image) {
std::array vertices{
Vertex{ ImVec2{ base.x, base.y + size.y }, ImVec2{ 0.0, 0.0 } }, // left-bottom
Vertex{ ImVec2{ base.x, base.y }, ImVec2{ 0.0, size.y } }, // left-top
Vertex{ ImVec2{ base.x + size.x, base.y }, ImVec2{ size.x, size.y } }, // right-top
Vertex{ ImVec2{ base.x + size.x, base.y + size.y }, ImVec2{ size.x, 0.0 } }, // right-bottom
Vertex{ ImVec2{ base.x, base.y }, ImVec2{ 0.0, uniformSize.y } }, // left-top
Vertex{ ImVec2{ base.x + size.x, base.y }, ImVec2{ uniformSize.x, uniformSize.y } }, // right-top
Vertex{ ImVec2{ base.x + size.x, base.y + size.y }, ImVec2{ uniformSize.x, 0.0 } }, // right-bottom
};
for(auto& [pos, coord] : vertices) {
pos.x = pos.x / fbSize.x * 2.0f - 1.0f;
Expand All @@ -375,11 +375,11 @@ class RenderPass final {
std::array vertices{
VertexCubeMap{ ImVec2{ base.x, base.y + size.y }, ImVec2{ 0.0, 0.0 },
cubeMapVertexPos[cubeMapVertexIndex[idx][0]] }, // left-bottom
VertexCubeMap{ ImVec2{ base.x, base.y }, ImVec2{ 0.0, size.y },
VertexCubeMap{ ImVec2{ base.x, base.y }, ImVec2{ 0.0, uniformSize.y },
cubeMapVertexPos[cubeMapVertexIndex[idx][1]] }, // left-top
VertexCubeMap{ ImVec2{ base.x + size.x, base.y }, ImVec2{ size.x, size.y },
VertexCubeMap{ ImVec2{ base.x + size.x, base.y }, ImVec2{ uniformSize.x, uniformSize.y },
cubeMapVertexPos[cubeMapVertexIndex[idx][2]] }, // right-top
VertexCubeMap{ ImVec2{ base.x + size.x, base.y + size.y }, ImVec2{ size.x, 0.0 },
VertexCubeMap{ ImVec2{ base.x + size.x, base.y + size.y }, ImVec2{ uniformSize.x, 0.0 },
cubeMapVertexPos[cubeMapVertexIndex[idx][3]] }, // right-bottom
};
for(auto& [pos, coord, point] : vertices) {
Expand Down

0 comments on commit 4984431

Please sign in to comment.