diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-01-27 05:19:49 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-01-27 05:19:49 +0000 |
| commit | 1a528cdfc47aa142295876a780696cdf24bd09eb (patch) | |
| tree | d8d645101a530792faf9e338ac3ec8c04a4d07d7 /unityplugin/GhostCubeScene | |
| parent | Update README.md (diff) | |
| download | DiligentEngine-1a528cdfc47aa142295876a780696cdf24bd09eb.tar.gz DiligentEngine-1a528cdfc47aa142295876a780696cdf24bd09eb.zip | |
Enabled MacOS support
Diffstat (limited to 'unityplugin/GhostCubeScene')
| -rw-r--r-- | unityplugin/GhostCubeScene/CMakeLists.txt | 28 | ||||
| -rw-r--r-- | unityplugin/GhostCubeScene/assets/shaders/Mirror.vsh | 25 |
2 files changed, 37 insertions, 16 deletions
diff --git a/unityplugin/GhostCubeScene/CMakeLists.txt b/unityplugin/GhostCubeScene/CMakeLists.txt index c361734..6ff47b3 100644 --- a/unityplugin/GhostCubeScene/CMakeLists.txt +++ b/unityplugin/GhostCubeScene/CMakeLists.txt @@ -83,8 +83,30 @@ elseif(PLATFORM_LINUX) list(APPEND SOURCE src/LoadPluginFunctions.cpp) add_executable(GhostCubeScene ${SOURCE} ${INCLUDE} ${ASSETS}) -#elseif(APPLE) - #add_executable(GhostCubeScene MACOSX_BUNDLE Main.cpp) +elseif(PLATFORM_MACOS) + list(APPEND SOURCE src/LoadPluginFunctions.cpp) + get_emulator_macos_source(MAC_SOURCE MAC_INCLUDE MAC_RESOURCES MAC_INFO_PLIST MAC_INCLUDE_DIRS) + add_executable(GhostCubeScene MACOSX_BUNDLE ${SOURCE} ${MAC_SOURCE} ${INCLUDE} ${MAC_INCLUDE} ${ASSETS} ${SHADERS} ${MAC_RESOURCES}) + set_target_properties(GhostCubeScene PROPERTIES + MACOSX_BUNDLE_GUI_IDENTIFIER "com.diligentengine.unityemulator.GhostCubeScene" + MACOSX_BUNDLE_INFO_PLIST "${MAC_INFO_PLIST}" + RESOURCE "${MAC_RESOURCES}" + ) + set_source_files_properties(${SHADERS} PROPERTIES + MACOSX_PACKAGE_LOCATION "Resources/shaders" + ) + + source_group("MacOS" FILES ${MAC_SOURCE}) + source_group("MacOS" FILES ${MAC_INCLUDE}) + source_group("Resources" FILES ${MAC_RESOURCES}) + target_include_directories(GhostCubeScene PRIVATE ${MAC_INCLUDE_DIRS}) + find_package(OpenGL REQUIRED) + + find_library(CORE_VIDEO CoreVideo) + if (NOT CORE_VIDEO) + message(FATAL_ERROR "CoreVideo not found") + endif() + target_link_libraries(GhostCubeScene PRIVATE ${OPENGL_LIBRARY} ${CORE_VIDEO}) else() message(FATAL_ERROR "Unknown platform") endif() @@ -115,6 +137,8 @@ if(PLATFORM_ANDROID) target_link_libraries(GhostCubeScene PRIVATE GhostCubePlugin-shared) elseif (PLATFORM_LINUX) target_link_libraries(GhostCubeScene PRIVATE GhostCubePlugin-shared GL X11) +elseif (PLATFORM_MACOS) + target_link_libraries(GhostCubeScene PRIVATE GhostCubePlugin-shared) endif() set_common_target_properties(GhostCubeScene) diff --git a/unityplugin/GhostCubeScene/assets/shaders/Mirror.vsh b/unityplugin/GhostCubeScene/assets/shaders/Mirror.vsh index bdeaaca..1e33134 100644 --- a/unityplugin/GhostCubeScene/assets/shaders/Mirror.vsh +++ b/unityplugin/GhostCubeScene/assets/shaders/Mirror.vsh @@ -11,20 +11,17 @@ struct PSInput PSInput main(uint VertId : SV_VertexID) { - float4 Pos[] = - { - float4(-0.5, +0.5, 0.0, 1.0), - float4(-0.5, -0.5, 0.0, 1.0), - float4(+0.5, +0.5, 0.0, 1.0), - float4(+0.5, -0.5, 0.0, 1.0) - }; - float2 UV[] = - { - float2(0.0, 1.0), - float2(0.0, 0.0), - float2(1.0, 1.0), - float2(1.0, 0.0) - }; + float4 Pos[4]; + Pos[0] = float4(-0.5, +0.5, 0.0, 1.0); + Pos[1] = float4(-0.5, -0.5, 0.0, 1.0); + Pos[2] = float4(+0.5, +0.5, 0.0, 1.0); + Pos[3] = float4(+0.5, -0.5, 0.0, 1.0); + + float2 UV[4]; + UV[0] = float2(0.0, 1.0); + UV[1] = float2(0.0, 0.0); + UV[2] = float2(1.0, 1.0); + UV[3] = float2(1.0, 0.0); PSInput ps; ps.Pos = mul( Pos[VertId], g_WorldViewProj); |
