Browse Source

Merge pull request #1 from AtomicGameEngine/JME-NEWBUILD

New Build System
JoshEngebretson 11 years ago
parent
commit
f5aa1e291f
100 changed files with 275 additions and 10232 deletions
  1. 5 0
      .gitignore
  2. 0 1082
      CMake/Modules/Atomic-CMake-common.cmake
  3. 0 147
      CMake/Modules/FindAtomic.cmake
  4. 0 64
      CMake/Modules/FindBCM_VC.cmake
  5. 0 82
      CMake/Modules/FindDirect3D.cmake
  6. 0 53
      CMake/Modules/GetAtomicRevision.cmake
  7. 1 1
      CMake/Modules/MacOSXBundleInfo.plist.template
  8. 0 1804
      CMake/Modules/iOSBundleInfo.plist.template
  9. 0 80
      CMake/Toolchains/mingw.toolchain.cmake
  10. 0 70
      CMake/Toolchains/raspberrypi.toolchain.cmake
  11. 61 160
      CMakeLists.txt
  12. 0 1
      Notes.txt
  13. 0 1
      Source/Atomic/.soversion
  14. 88 0
      Source/Atomic/Atomic.h
  15. 0 23
      Source/Atomic/Atomic.h.in
  16. 0 38
      Source/Atomic/Atomic.pc.in
  17. 1 1
      Source/Atomic/Audio/Audio.cpp
  18. 54 329
      Source/Atomic/CMakeLists.txt
  19. 1 1
      Source/Atomic/Core/ProcessUtils.cpp
  20. 0 4
      Source/Atomic/Environment/CMakeLists.txt
  21. 1 1
      Source/Atomic/Graphics/Direct3D9/D3D9Graphics.cpp
  22. 1 1
      Source/Atomic/Graphics/Direct3D9/D3D9GraphicsImpl.h
  23. 1 1
      Source/Atomic/Graphics/OpenGL/OGLGraphicsImpl.h
  24. 1 1
      Source/Atomic/IO/FileSystem.cpp
  25. 1 1
      Source/Atomic/IO/RWOpsWrapper.h
  26. 1 1
      Source/Atomic/Input/Input.cpp
  27. 4 4
      Source/Atomic/Input/InputEvents.h
  28. 0 5
      Source/Atomic/Javascript/CMakeLists.txt
  29. 4 4
      Source/Atomic/Navigation/NavigationMesh.cpp
  30. 1 1
      Source/Atomic/Network/Connection.cpp
  31. 2 2
      Source/Atomic/Network/Connection.h
  32. 1 1
      Source/Atomic/Network/HttpRequest.cpp
  33. 1 1
      Source/Atomic/Network/Network.cpp
  34. 2 2
      Source/Atomic/Network/Network.h
  35. 13 13
      Source/Atomic/Physics/CollisionShape.cpp
  36. 5 5
      Source/Atomic/Physics/Constraint.cpp
  37. 2 2
      Source/Atomic/Physics/PhysicsUtils.h
  38. 8 8
      Source/Atomic/Physics/PhysicsWorld.cpp
  39. 1 1
      Source/Atomic/Physics/PhysicsWorld.h
  40. 3 3
      Source/Atomic/Physics/RigidBody.cpp
  41. 1 1
      Source/Atomic/Physics/RigidBody.h
  42. 1 1
      Source/Atomic/Resource/Image.cpp
  43. 1 1
      Source/Atomic/Resource/XMLElement.cpp
  44. 1 1
      Source/Atomic/Resource/XMLFile.cpp
  45. 1 1
      Source/Atomic/UI/Cursor.h
  46. 1 1
      Source/Atomic/UI/UI.cpp
  47. 1 0
      Source/Atomic/librevision.h
  48. 0 198
      Source/CMake/Modules/FindUrho3D.cmake
  49. 0 203
      Source/CMake/Toolchains/emscripten.toolchain.cmake
  50. 4 116
      Source/CMakeLists.txt
  51. 0 33
      Source/Samples/01_HelloWorld/CMakeLists.txt
  52. 0 90
      Source/Samples/01_HelloWorld/HelloWorld.cpp
  53. 0 60
      Source/Samples/01_HelloWorld/HelloWorld.h
  54. 0 33
      Source/Samples/02_HelloGUI/CMakeLists.txt
  55. 0 225
      Source/Samples/02_HelloGUI/HelloGUI.cpp
  56. 0 90
      Source/Samples/02_HelloGUI/HelloGUI.h
  57. 0 33
      Source/Samples/03_Sprites/CMakeLists.txt
  58. 0 151
      Source/Samples/03_Sprites/Sprites.cpp
  59. 0 66
      Source/Samples/03_Sprites/Sprites.h
  60. 0 33
      Source/Samples/04_StaticScene/CMakeLists.txt
  61. 0 202
      Source/Samples/04_StaticScene/StaticScene.cpp
  62. 0 64
      Source/Samples/04_StaticScene/StaticScene.h
  63. 0 202
      Source/Samples/05_AnimatingScene/AnimatingScene.cpp
  64. 0 64
      Source/Samples/05_AnimatingScene/AnimatingScene.h
  65. 0 33
      Source/Samples/05_AnimatingScene/CMakeLists.txt
  66. 0 50
      Source/Samples/05_AnimatingScene/Rotator.cpp
  67. 0 50
      Source/Samples/05_AnimatingScene/Rotator.h
  68. 0 33
      Source/Samples/06_SkeletalAnimation/CMakeLists.txt
  69. 0 67
      Source/Samples/06_SkeletalAnimation/Mover.cpp
  70. 0 57
      Source/Samples/06_SkeletalAnimation/Mover.h
  71. 0 255
      Source/Samples/06_SkeletalAnimation/SkeletalAnimation.cpp
  72. 0 86
      Source/Samples/06_SkeletalAnimation/SkeletalAnimation.h
  73. 0 336
      Source/Samples/07_Billboards/Billboards.cpp
  74. 0 86
      Source/Samples/07_Billboards/Billboards.h
  75. 0 33
      Source/Samples/07_Billboards/CMakeLists.txt
  76. 0 33
      Source/Samples/08_Decals/CMakeLists.txt
  77. 0 324
      Source/Samples/08_Decals/Decals.cpp
  78. 0 98
      Source/Samples/08_Decals/Decals.h
  79. 0 33
      Source/Samples/09_MultipleViewports/CMakeLists.txt
  80. 0 289
      Source/Samples/09_MultipleViewports/MultipleViewports.cpp
  81. 0 117
      Source/Samples/09_MultipleViewports/MultipleViewports.h
  82. 0 33
      Source/Samples/10_RenderToTexture/CMakeLists.txt
  83. 0 285
      Source/Samples/10_RenderToTexture/RenderToTexture.cpp
  84. 0 68
      Source/Samples/10_RenderToTexture/RenderToTexture.h
  85. 0 50
      Source/Samples/10_RenderToTexture/Rotator.cpp
  86. 0 50
      Source/Samples/10_RenderToTexture/Rotator.h
  87. 0 33
      Source/Samples/11_Physics/CMakeLists.txt
  88. 0 316
      Source/Samples/11_Physics/Physics.cpp
  89. 0 95
      Source/Samples/11_Physics/Physics.h
  90. 0 33
      Source/Samples/12_PhysicsStressTest/CMakeLists.txt
  91. 0 320
      Source/Samples/12_PhysicsStressTest/PhysicsStressTest.cpp
  92. 0 94
      Source/Samples/12_PhysicsStressTest/PhysicsStressTest.h
  93. 0 33
      Source/Samples/13_Ragdolls/CMakeLists.txt
  94. 0 177
      Source/Samples/13_Ragdolls/CreateRagdoll.cpp
  95. 0 50
      Source/Samples/13_Ragdolls/CreateRagdoll.h
  96. 0 314
      Source/Samples/13_Ragdolls/Ragdolls.cpp
  97. 0 94
      Source/Samples/13_Ragdolls/Ragdolls.h
  98. 0 33
      Source/Samples/14_SoundEffects/CMakeLists.txt
  99. 0 223
      Source/Samples/14_SoundEffects/SoundEffects.cpp
  100. 0 83
      Source/Samples/14_SoundEffects/SoundEffects.h

+ 5 - 0
.gitignore

@@ -0,0 +1,5 @@
+
+*.user
+Bin/Atomic.d.ts
+Source/Atomic/Javascript/Modules/*
+AtomicEditor/*

+ 0 - 1082
CMake/Modules/Atomic-CMake-common.cmake

@@ -1,1082 +0,0 @@
-#
-# Copyright (c) 2008-2014 the Urho3D project.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-
-# Limit the supported build configurations
-set (ATOMIC_BUILD_CONFIGURATIONS Release RelWithDebInfo Debug)
-set (DOC_STRING "Choose the build configuration, possible options are: ${ATOMIC_BUILD_CONFIGURATIONS}")
-if (CMAKE_CONFIGURATION_TYPES)
-    # For multi-configurations generator, such as VS and Xcode
-    set (CMAKE_CONFIGURATION_TYPES ${ATOMIC_BUILD_CONFIGURATIONS} CACHE STRING "${DOC_STRING}" FORCE)
-else ()
-    # For single-configuration generator, such as Unix Makefile generator
-    if (CMAKE_BUILD_TYPE STREQUAL "")
-        # If not specified then default to Release
-        set (CMAKE_BUILD_TYPE Release)
-    endif ()
-    set (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "${DOC_STRING}" FORCE)
-endif ()
-
-# Define other useful variables not defined by CMake
-if (CMAKE_GENERATOR STREQUAL Xcode)
-    set (XCODE TRUE)
-endif ()
-
-# Define all supported build options
-include (CMakeDependentOption)
-cmake_dependent_option (IOS "Setup build for iOS platform" FALSE "XCODE" FALSE)
-if (NOT MSVC AND NOT DEFINED ATOMIC_DEFAULT_64BIT)  # Only do this once in the initial configure step
-    # On non-MSVC compiler, default to build 64-bit when the host system has a 64-bit build environment
-    execute_process (COMMAND echo COMMAND ${CMAKE_C_COMPILER} -E -dM - OUTPUT_VARIABLE PREDEFINED_MACROS ERROR_QUIET)
-    string (REGEX MATCH "#define +__(x86_64|aarch64)__ +1" matched "${PREDEFINED_MACROS}")
-    if (matched)
-        set (ATOMIC_DEFAULT_64BIT TRUE)
-    else ()
-        set (ATOMIC_DEFAULT_64BIT FALSE)
-    endif ()
-    set (ATOMIC_DEFAULT_64BIT ${ATOMIC_DEFAULT_64BIT} CACHE INTERNAL "Default value for ATOMIC_64BIT build option")
-    # The 'ANDROID' CMake variable is already set by android.toolchain.cmake when it is being used for cross-compiling Android
-    # The other arm platform that Atomic supports that is not Android is Raspberry Pi at the moment
-    if (NOT ANDROID)
-        string (REGEX MATCH "#define +__arm__ +1" matched "${PREDEFINED_MACROS}")
-        if (matched)
-            # Set the CMake variable here instead of in raspberrypi.toolchain.cmake because Raspberry Pi can be built natively too on the Raspberry-Pi device itself
-            set (RPI TRUE CACHE INTERNAL "Setup build for Raspberry Pi platform")
-        endif ()
-    endif ()
-endif ()
-if (ANDROID OR RPI)
-    # This build option is not available on Android and Raspberry-Pi platforms as its value is preset by the chosen toolchain in the build tree
-    set (ATOMIC_64BIT ${ATOMIC_DEFAULT_64BIT})
-else ()
-    option (ATOMIC_64BIT "Enable 64-bit build" ${ATOMIC_DEFAULT_64BIT})
-endif ()
-option (ATOMIC_ANGELSCRIPT "Enable AngelScript scripting support" TRUE)
-option (ATOMIC_LUA "Enable additional Lua scripting support")
-option (ATOMIC_LUAJIT "Enable Lua scripting support using LuaJIT (check LuaJIT's CMakeLists.txt for more options)")
-option (ATOMIC_NAVIGATION "Enable navigation support" TRUE)
-option (ATOMIC_NETWORK "Enable networking support" TRUE)
-option (ATOMIC_PHYSICS "Enable physics support" TRUE)
-option (ATOMIC_ATOMIC2D "Enable 2D graphics and physics support" TRUE)
-if (MINGW AND NOT DEFINED ATOMIC_SSE)
-    # Certain MinGW versions fail to compile SSE code. This is the initial guess for known "bad" version range, and can be tightened later
-    execute_process (COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION ERROR_QUIET)
-    if (GCC_VERSION VERSION_LESS 4.9.1)
-        message (WARNING "Disabling SSE by default due to MinGW version. It is recommended to upgrade to MinGW with GCC >= 4.9.1. You can also try to re-enable SSE with CMake option -DATOMIC_SSE=1, but this may result in compile errors.")
-    else ()
-        set (ATOMIC_DEFAULT_SSE TRUE)
-    endif ()
-else ()
-    set (ATOMIC_DEFAULT_SSE TRUE)
-endif ()
-option (ATOMIC_SSE "Enable SSE instruction set" ${ATOMIC_DEFAULT_SSE})
-if (CMAKE_PROJECT_NAME STREQUAL Atomic)
-    cmake_dependent_option (ATOMIC_LUAJIT_AMALG "Enable LuaJIT amalgamated build (LuaJIT only)" FALSE "ATOMIC_LUAJIT" FALSE)
-    cmake_dependent_option (ATOMIC_SAFE_LUA "Enable Lua C++ wrapper safety checks (Lua scripting only)" FALSE "ATOMIC_LUA OR ATOMIC_LUAJIT" FALSE)
-    option (ATOMIC_SAMPLES "Build sample applications")
-    cmake_dependent_option (ATOMIC_TOOLS "Build tools (native and RPI only)" TRUE "NOT IOS AND NOT ANDROID" FALSE)
-    cmake_dependent_option (ATOMIC_EXTRAS "Build extras (native and RPI only)" FALSE "NOT IOS AND NOT ANDROID" FALSE)
-    option (ATOMIC_DOCS "Generate documentation as part of normal build")
-    option (ATOMIC_DOCS_QUIET "Generate documentation as part of normal build, suppress generation process from sending anything to stdout")
-    cmake_dependent_option (ATOMIC_MINIDUMPS "Enable minidumps on crash (VS only)" TRUE "MSVC" FALSE)
-    option (ATOMIC_FILEWATCHER "Enable filewatcher support" TRUE)
-    if (CPACK_SYSTEM_NAME STREQUAL Linux)
-        cmake_dependent_option (ATOMIC_USE_LIB64_RPM "Enable 64-bit RPM CPack generator using /usr/lib64 and disable all other generators (Debian-based host only)" FALSE "ATOMIC_64BIT AND NOT HAS_LIB64" FALSE)
-        cmake_dependent_option (ATOMIC_USE_LIB_DEB "Enable 64-bit DEB CPack generator using /usr/lib and disable all other generators (Redhat-based host only)" FALSE "ATOMIC_64BIT AND HAS_LIB64" FALSE)
-    endif ()
-else ()
-    set (ATOMIC_HOME "" CACHE PATH "Path to Atomic build tree or SDK installation location (external project only)")
-endif ()
-option (ATOMIC_PROFILING "Enable profiling support" TRUE)
-option (ATOMIC_LOGGING "Enable logging support" TRUE)
-option (ATOMIC_TESTING "Enable testing support")
-if (ATOMIC_TESTING)
-    set (ATOMIC_TEST_TIME_OUT 5 CACHE STRING "Number of seconds to test run the executables")
-else ()
-    unset (ATOMIC_TEST_TIME_OUT CACHE)
-endif ()
-# The ATOMIC_OPENGL option is not defined on non-Windows platforms as they should always use OpenGL
-if (MSVC)
-    # On MSVC compiler, default to false (i.e. prefers Direct3D)
-    # OpenGL can be manually enabled with -DATOMIC_OPENGL=1, but Windows graphics card drivers are usually better optimized for Direct3D
-    option (ATOMIC_OPENGL "Use OpenGL instead of Direct3D (Windows platform only)")
-elseif (WIN32)
-    # On non-MSVC compiler on Windows platform, default to true to enable use of OpenGL instead of Direct3D
-    # Direct3D can be manually enabled with -DATOMIC_OPENGL=0, but it is likely to fail unless the MinGW-w64 distribution is used due to dependency to Direct3D headers and libs
-    option (ATOMIC_OPENGL "Use OpenGL instead of Direct3D (Windows platform only)" TRUE)
-endif ()
-if (CMAKE_HOST_WIN32 AND NOT DEFINED ATOMIC_MKLINK)
-    # Test whether the host system is capable of setting up symbolic link
-    execute_process (COMMAND cmd /C mklink test-link CMakeCache.txt RESULT_VARIABLE MKLINK_EXIT_CODE OUTPUT_QUIET ERROR_QUIET)
-    if (MKLINK_EXIT_CODE EQUAL 0)
-        set (ATOMIC_MKLINK TRUE)
-        file (REMOVE ${CMAKE_BINARY_DIR}/test-link)
-    else ()
-        set (ATOMIC_MKLINK FALSE)
-    endif ()
-    set (ATOMIC_MKLINK ${ATOMIC_MKLINK} CACHE INTERNAL "MKLINK capability on the Windows host system")
-endif ()
-cmake_dependent_option (ATOMIC_STATIC_RUNTIME "Use static C/C++ runtime libraries and eliminate the need for runtime DLLs installation (VS only)" FALSE "MSVC" FALSE)
-cmake_dependent_option (ATOMIC_WIN32_CONSOLE "Use console main() as entry point when setting up Windows executable targets (Windows platform only)" FALSE "WIN32" FALSE)
-option (ATOMIC_MACOSX_BUNDLE "Use MACOSX_BUNDLE when setting up Mac OS X executable targets" FALSE)
-set (ATOMIC_LIB_TYPE STATIC CACHE STRING "Specify Atomic library type, possible values are STATIC (default) and SHARED")
-if (CMAKE_CROSSCOMPILING AND NOT ANDROID)
-    set (ATOMIC_SCP_TO_TARGET "" CACHE STRING "Use scp to transfer executables to target system (non-Android cross-compiling build only), SSH digital key must be setup first for this to work, typical value has a pattern of usr@tgt:remote-loc")
-else ()
-    unset (ATOMIC_SCP_TO_TARGET CACHE)
-endif ()
-if (ANDROID)
-    set (ANDROID TRUE CACHE INTERNAL "Setup build for Android platform")
-    cmake_dependent_option (ANDROID_NDK_GDB "Enable ndk-gdb for debugging (Android build only)" FALSE "CMAKE_BUILD_TYPE STREQUAL Debug" FALSE)
-else ()
-    unset (ANDROID_NDK_GDB CACHE)
-endif ()
-if (MINGW AND CMAKE_CROSSCOMPILING)
-    set (MINGW_PREFIX "" CACHE STRING "Prefix path to MinGW cross-compiler tools (MinGW cross-compiling build only)")
-    set (MINGW_SYSROOT "" CACHE PATH "Path to MinGW system root (MinGW cross-compiling build only)")
-endif ()
-if (RPI AND CMAKE_CROSSCOMPILING)
-    set (RPI_PREFIX "" CACHE STRING "Prefix path to Raspberry Pi cross-compiler tools (RPI cross-compiling build only)")
-    set (RPI_SYSROOT "" CACHE PATH "Path to Raspberry Pi system root (RPI cross-compiling build only)")
-endif ()
-# Constrain the build option values in cmake-gui, if applicable
-if (CMAKE_VERSION VERSION_GREATER 2.8 OR CMAKE_VERSION VERSION_EQUAL 2.8)
-    set_property (CACHE ATOMIC_LIB_TYPE PROPERTY STRINGS STATIC SHARED)
-    if (NOT CMAKE_CONFIGURATION_TYPES)
-        set_property (CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${ATOMIC_BUILD_CONFIGURATIONS})
-    endif ()
-endif()
-
-# Enable testing
-if (ATOMIC_TESTING)
-    enable_testing ()
-    add_definitions (-DATOMIC_TESTING)
-endif ()
-
-# Enable SSE instruction set. Requires Pentium III or Athlon XP processor at minimum.
-if (ATOMIC_SSE)
-    add_definitions (-DATOMIC_SSE)
-endif ()
-
-# Enable structured exception handling and minidumps on MSVC only.
-if (MSVC AND ATOMIC_MINIDUMPS)
-    add_definitions (-DATOMIC_MINIDUMPS)
-endif ()
-
-# By default use the MSVC dynamic runtime. To eliminate the need to distribute the runtime installer,
-# this can be switched off if not using Atomic as a shared library.
-if (MSVC)
-    if (ATOMIC_STATIC_RUNTIME)
-        set (RELEASE_RUNTIME /MT)
-        set (DEBUG_RUNTIME /MTd)
-    else ()
-        set (RELEASE_RUNTIME "")
-        set (DEBUG_RUNTIME "")
-    endif ()
-endif ()
-
-# By default Windows platform setups main executable as Windows application with WinMain() as entry point
-# this build option overrides the default to set the main executable as console application with main() as entry point instead
-if (ATOMIC_WIN32_CONSOLE)
-    add_definitions (-DATOMIC_WIN32_CONSOLE)
-endif ()
-
-# Enable file watcher support for automatic resource reloads by default.
-if (ATOMIC_FILEWATCHER)
-    add_definitions (-DATOMIC_FILEWATCHER)
-endif ()
-
-# Enable profiling by default. If disabled, autoprofileblocks become no-ops and the Profiler subsystem is not instantiated.
-if (ATOMIC_PROFILING)
-    add_definitions (-DATOMIC_PROFILING)
-endif ()
-
-# Enable logging by default. If disabled, LOGXXXX macros become no-ops and the Log subsystem is not instantiated.
-if (ATOMIC_LOGGING)
-    add_definitions (-DATOMIC_LOGGING)
-endif ()
-
-# If not on Windows platform, enable Unix mode for kNet library and OpenGL graphic back-end
-if (NOT WIN32)
-    add_definitions (-DUNIX)
-    set (ATOMIC_OPENGL 1)
-endif ()
-
-# Add definition for OpenGL
-if (ATOMIC_OPENGL)
-    add_definitions (-DATOMIC_OPENGL)
-endif ()
-
-# Add definitions for GLEW
-if (NOT IOS AND NOT ANDROID AND NOT RPI AND ATOMIC_OPENGL)
-    add_definitions (-DGLEW_STATIC -DGLEW_NO_GLU)
-endif ()
-
-# Add definition for AngelScript
-if (ATOMIC_ANGELSCRIPT)
-    add_definitions (-DATOMIC_ANGELSCRIPT)
-endif ()
-
-# Add definition for Lua and LuaJIT
-if (ATOMIC_LUAJIT)
-    add_definitions (-DATOMIC_LUAJIT)
-    set (JIT JIT)
-    # Implied ATOMIC_LUA
-    set (ATOMIC_LUA 1)
-endif ()
-if (ATOMIC_LUA)
-    add_definitions (-DATOMIC_LUA)
-    # Optionally enable Lua / C++ wrapper safety checks
-    if (NOT ATOMIC_SAFE_LUA)
-        add_definitions (-DTOLUA_RELEASE)
-    endif ()
-endif ()
-
-if (ATOMIC_JAVASCRIPT)
-    add_definitions (-DATOMIC_JAVASCRIPT)
-endif ()
-
-# Add definition for Navigation
-if (ATOMIC_NAVIGATION)
-    add_definitions (-DATOMIC_NAVIGATION)
-endif ()
-
-# Add definition for Network
-if (ATOMIC_NETWORK)
-    add_definitions (-DATOMIC_NETWORK)
-endif ()
-
-# Add definition for Physics
-if (ATOMIC_PHYSICS)
-    add_definitions (-DATOMIC_PHYSICS)
-endif ()
-
-# Add definition for Atomic2D
-if (ATOMIC_ATOMIC2D)
-    add_definitions (-DATOMIC_ATOMIC2D)
-endif ()
-
-# Default library type is STATIC
-if (ATOMIC_LIB_TYPE)
-    string (TOUPPER ${ATOMIC_LIB_TYPE} ATOMIC_LIB_TYPE)
-endif ()
-if (NOT ATOMIC_LIB_TYPE STREQUAL SHARED)
-    set (ATOMIC_LIB_TYPE STATIC)
-    add_definitions (-DATOMIC_STATIC_DEFINE)
-endif ()
-
-# Find DirectX SDK include & library directories for Visual Studio. It is also possible to compile
-# without if a recent Windows SDK is installed. The SDK is not searched for with MinGW as it is
-# incompatible; rather, it is assumed that MinGW itself comes with the necessary headers & libraries.
-if (WIN32 AND NOT ATOMIC_OPENGL)
-    find_package (Direct3D)
-    if (DIRECT3D_FOUND)
-        include_directories (${DIRECT3D_INCLUDE_DIRS})
-    endif ()
-endif ()
-
-# For Raspbery Pi, find Broadcom VideoCore IV firmware
-if (RPI)
-    find_package (BCM_VC REQUIRED)
-    include_directories (${BCM_VC_INCLUDE_DIRS})
-endif ()
-
-# Platform and compiler specific options
-if (IOS)
-    # IOS-specific setup
-    add_definitions (-DIOS)
-    if (ATOMIC_64BIT)
-        set (CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD_INCLUDING_64_BIT))
-    else ()
-        set (CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD_32_BIT))
-    endif ()
-    set (CMAKE_XCODE_EFFECTIVE_PLATFORMS -iphoneos -iphonesimulator)
-    set (CMAKE_OSX_SYSROOT iphoneos)    # Set Base SDK to "Latest iOS"
-    execute_process (COMMAND xcodebuild -version -sdk ${CMAKE_OSX_SYSROOT} Path OUTPUT_VARIABLE IOS_SYSROOT OUTPUT_STRIP_TRAILING_WHITESPACE)   # Obtain iOS sysroot path
-    set (CMAKE_FIND_ROOT_PATH ${IOS_SYSROOT})
-elseif (XCODE)
-    # MacOSX-Xcode-specific setup
-    if (NOT ATOMIC_64BIT)
-        set (CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD_32_BIT))
-    endif ()
-    set (CMAKE_OSX_SYSROOT macosx)	# Set Base SDK to "Latest OS X"
-    if (NOT CMAKE_OSX_DEPLOYMENT_TARGET)
-        # If not set, set to current running build system OS version by default
-        execute_process (COMMAND sw_vers -productVersion OUTPUT_VARIABLE CURRENT_OSX_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
-        string (REGEX REPLACE ^\([^.]+\\.[^.]+\).* \\1 CMAKE_OSX_DEPLOYMENT_TARGET ${CURRENT_OSX_VERSION})
-    endif ()
-endif ()
-if (IOS OR ATOMIC_MACOSX_BUNDLE)
-    # Common MacOSX and iOS bundle setup
-    if (NOT MACOSX_BUNDLE_GUI_IDENTIFIER)
-        set (MACOSX_BUNDLE_GUI_IDENTIFIER com.github.urho3d.\${PRODUCT_NAME:bundleIdentifier:lower})
-    endif ()
-    if (NOT MACOSX_BUNDLE_BUNDLE_NAME)
-        set (MACOSX_BUNDLE_BUNDLE_NAME \${PRODUCT_NAME})
-    endif ()
-endif ()
-if (MSVC)
-    # Visual Studio-specific setup
-    add_definitions (-D_CRT_SECURE_NO_WARNINGS)
-    # Note: All CMAKE_xxx_FLAGS variables are not in list context (although they should be)
-    set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${DEBUG_RUNTIME}")
-    set (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE} ${RELEASE_RUNTIME} /fp:fast /Zi /GS-")
-    set (CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELWITHDEBINFO})
-    set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DEBUG_RUNTIME}")
-    set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} ${RELEASE_RUNTIME} /fp:fast /Zi /GS- /D _SECURE_SCL=0")
-    set (CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
-    # SSE flag is redundant if already compiling as 64bit
-    if (ATOMIC_SSE AND NOT ATOMIC_64BIT)
-        set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:SSE")
-        set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE")
-    endif ()
-    set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /OPT:REF /OPT:ICF /DEBUG")
-    set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /OPT:REF /OPT:ICF")
-else ()
-    # GCC/Clang-specific setup
-    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-offsetof -std=gnu++0x")
-    if (ANDROID)
-        # Most of the flags are already setup in android.toolchain.cmake module
-        set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector")
-        set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector")
-    else ()
-        if (RPI)
-            add_definitions (-DRPI)
-            set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pipe -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -Wno-psabi")
-            set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pipe -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -Wno-psabi")
-        else ()
-            #set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffast-math")
-            #set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math")
-            if (ATOMIC_64BIT)
-                set (DASH_MBIT -m64)    # This variable is intentionally not defined on Android and RPI platform
-            else ()
-                set (DASH_MBIT -m32)
-                if (ATOMIC_SSE)
-                    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse")
-                    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse")
-                endif ()
-            endif ()
-            set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${DASH_MBIT}")
-            set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DASH_MBIT}")
-            set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${DASH_MBIT}")
-        endif ()
-        # MinGW-specific setup
-        if (MINGW)
-            set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static -static-libgcc -fno-keep-inline-dllexport")
-            set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static -static-libstdc++ -static-libgcc -fno-keep-inline-dllexport")
-            set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static")
-            # Additional compiler flags for Windows ports of GCC
-            set (CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG")
-            set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG")
-            # Reduce GCC optimization level from -O3 to -O2 for stability in RELEASE build configuration
-            set (CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
-            set (CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
-        endif ()
-        set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG -D_DEBUG")
-        set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -D_DEBUG")
-    endif ()
-    if (CMAKE_CXX_COMPILER_ID STREQUAL Clang)
-        if (CMAKE_GENERATOR STREQUAL Ninja)
-            set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcolor-diagnostics")
-            set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics")
-        endif ()
-        # Temporary workaround for Travis CI VM as Ubuntu 12.04 LTS still uses old glibc header files that do not have the necessary patch for Clang to work correctly
-        # TODO: Remove this workaround when Travis CI VM has been migrated to Ubuntu 14.04 LTS (or hopefully it will be CentOS :)
-        if (DEFINED ENV{CI} AND "$ENV{LINUX}" STREQUAL 1)
-            add_definitions (-D__extern_always_inline=inline)
-        endif ()
-    endif ()
-endif ()
-
-# Macro for setting common output directories
-macro (set_output_directories OUTPUT_PATH)
-    foreach (TYPE ${ARGN})
-        set (CMAKE_${TYPE}_OUTPUT_DIRECTORY ${OUTPUT_PATH})
-        foreach (CONFIG ${CMAKE_CONFIGURATION_TYPES})
-            string (TOUPPER ${CONFIG} CONFIG)
-            set (CMAKE_${TYPE}_OUTPUT_DIRECTORY_${CONFIG} ${OUTPUT_PATH})
-        endforeach ()
-    endforeach ()
-endmacro ()
-
-# Set common binary output directory for all platforms
-set_output_directories (${CMAKE_BINARY_DIR}/bin RUNTIME PDB)
-
-# Macro for setting symbolic link on platform that supports it
-macro (create_symlink SOURCE DESTINATION)
-    if (CMAKE_HOST_WIN32)
-        if (IS_DIRECTORY ${SOURCE})
-            set (SLASH_D /D)
-        else ()
-            unset (SLASH_D)
-        endif ()
-        if (ATOMIC_MKLINK)
-            if (NOT EXISTS ${DESTINATION})
-                # Have to use string-REPLACE as file-TO_NATIVE_PATH does not work as expected with MinGW on "backward host" system
-                string (REPLACE / \\ BACKWARD_DESTINATION ${DESTINATION})
-                string (REPLACE / \\ BACKWARD_SOURCE ${SOURCE})
-                execute_process (COMMAND cmd /C mklink ${SLASH_D} ${BACKWARD_DESTINATION} ${BACKWARD_SOURCE} OUTPUT_QUIET ERROR_QUIET)
-            endif ()
-        elseif (${ARGN} STREQUAL FALLBACK_TO_COPY)
-            if (NOT IS_ABSOLUTE ${SOURCE})
-                get_filename_component (PATH ${DESTINATION} PATH)
-                set (SOURCE ${PATH}/${SOURCE})
-            endif ()
-            if (SLASH_D)
-                set (COMMAND COMMAND ${CMAKE_COMMAND} -E copy_directory ${SOURCE} ${DESTINATION})
-            else ()
-                set (COMMAND COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SOURCE} ${DESTINATION})
-            endif ()
-            if (TARGET ${TARGET_NAME})
-                # Fallback to copy everytime the target is built
-                add_custom_command (TARGET ${TARGET_NAME} POST_BUILD ${COMMAND} WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
-            else ()
-                # Fallback to copy only one time
-                execute_process (${COMMAND})
-            endif ()
-        else ()
-            message (WARNING "Unable to create symbolic link on this host system, you may need to manually copy file/dir from \"${SOURCE}\" to \"${DESTINATION}\"")
-        endif ()
-    else ()
-        execute_process (COMMAND ${CMAKE_COMMAND} -E create_symlink ${SOURCE} ${DESTINATION})
-    endif ()
-endmacro ()
-
-# Set common project structure for Android platform
-if (ANDROID)
-    # Enable Android ndk-gdb
-    if (ANDROID_NDK_GDB)
-        set (NDK_GDB_SOLIB_PATH ${CMAKE_BINARY_DIR}/obj/local/${ANDROID_NDK_ABI_NAME}/)
-        file (MAKE_DIRECTORY ${NDK_GDB_SOLIB_PATH})
-        set (NDK_GDB_JNI ${CMAKE_BINARY_DIR}/jni)
-        set (NDK_GDB_MK "# This is a generated file. DO NOT EDIT!\n\nAPP_ABI := ${ANDROID_NDK_ABI_NAME}\n")
-        foreach (MK Android.mk Application.mk)
-            if (NOT EXISTS ${NDK_GDB_JNI}/${MK})
-                file (WRITE ${NDK_GDB_JNI}/${MK} ${NDK_GDB_MK})
-            endif ()
-        endforeach ()
-        get_directory_property (INCLUDE_DIRECTORIES DIRECTORY ${PROJECT_SOURCE_DIR} INCLUDE_DIRECTORIES)
-        string (REPLACE ";" " " INCLUDE_DIRECTORIES "${INCLUDE_DIRECTORIES}")   # Note: need to always "stringify" a variable in list context for replace to work correctly
-        set (NDK_GDB_SETUP "# This is a generated file. DO NOT EDIT!\n\nset solib-search-path ${NDK_GDB_SOLIB_PATH}\ndirectory ${INCLUDE_DIRECTORIES}\n")
-        file (WRITE ${ANDROID_LIBRARY_OUTPUT_PATH}/gdb.setup ${NDK_GDB_SETUP})
-        file (COPY ${ANDROID_NDK}/prebuilt/android-${ANDROID_ARCH_NAME}/gdbserver/gdbserver DESTINATION ${ANDROID_LIBRARY_OUTPUT_PATH})
-    else ()
-        file (REMOVE ${ANDROID_LIBRARY_OUTPUT_PATH}/gdbserver)
-    endif ()
-    # Create symbolic links in the build tree
-    foreach (I CoreData Data)
-        if (NOT EXISTS ${CMAKE_SOURCE_DIR}/Android/assets/${I})
-            create_symlink (${CMAKE_SOURCE_DIR}/bin/${I} ${CMAKE_SOURCE_DIR}/Android/assets/${I} FALLBACK_TO_COPY)
-        endif ()
-    endforeach ()
-    foreach (I AndroidManifest.xml build.xml src res assets jni)
-        if (EXISTS ${CMAKE_SOURCE_DIR}/Android/${I} AND NOT EXISTS ${CMAKE_BINARY_DIR}/${I})    # No-ops when 'Android' is used as build tree
-            create_symlink (${CMAKE_SOURCE_DIR}/Android/${I} ${CMAKE_BINARY_DIR}/${I} FALLBACK_TO_COPY)
-        endif ()
-    endforeach ()
-endif ()
-
-# Include CMake builtin module for building shared library support
-include (GenerateExportHeader)
-
-# Override builtin macro and function to suit our need, always generate header file regardless of target type...
-macro (_DO_SET_MACRO_VALUES TARGET_LIBRARY)
-    set (DEFINE_DEPRECATED)
-    set (DEFINE_EXPORT)
-    set (DEFINE_IMPORT)
-    set (DEFINE_NO_EXPORT)
-
-    if (COMPILER_HAS_DEPRECATED_ATTR)
-        set (DEFINE_DEPRECATED "__attribute__ ((__deprecated__))")
-    elseif (COMPILER_HAS_DEPRECATED)
-        set (DEFINE_DEPRECATED "__declspec(deprecated)")
-    endif ()
-
-    get_property (type TARGET ${TARGET_LIBRARY} PROPERTY TYPE)
-
-    if (type MATCHES "STATIC|SHARED")
-        if (WIN32)
-            set (DEFINE_EXPORT "__declspec(dllexport)")
-            set (DEFINE_IMPORT "__declspec(dllimport)")
-        elseif (COMPILER_HAS_HIDDEN_VISIBILITY AND USE_COMPILER_HIDDEN_VISIBILITY)
-            set (DEFINE_EXPORT "__attribute__((visibility(\"default\")))")
-            set (DEFINE_IMPORT "__attribute__((visibility(\"default\")))")
-            set (DEFINE_NO_EXPORT "__attribute__((visibility(\"hidden\")))")
-        endif ()
-    endif ()
-endmacro ()
-# ... except, when target is a module library type
-function (GENERATE_EXPORT_HEADER TARGET_LIBRARY)
-    get_property (type TARGET ${TARGET_LIBRARY} PROPERTY TYPE)
-    if (${type} MATCHES MODULE)
-        message (WARNING "This macro should not be used with libraries of type MODULE")
-        return ()
-    endif ()
-    _test_compiler_hidden_visibility ()
-    _test_compiler_has_deprecated ()
-    _do_set_macro_values (${TARGET_LIBRARY})
-    _do_generate_export_header (${TARGET_LIBRARY} ${ARGN})
-endfunction ()
-
-# Override builtin function to suit our need, takes care of C flags as well as CXX flags
-function (add_compiler_export_flags)
-    if (NOT ANDROID AND NOT MSVC AND NOT DEFINED USE_COMPILER_HIDDEN_VISIBILITY AND NOT DEFINED COMPILER_HAS_DEPRECATED)
-        message (STATUS "Following tests check whether compiler installed in this system has export/import and deprecated attributes support")
-        message (STATUS "CMake will generate a suitable export header file for this system based on the test result")
-        message (STATUS "It is OK to proceed to build Atomic regardless of the test result")
-    endif ()
-    _test_compiler_hidden_visibility ()
-    _test_compiler_has_deprecated ()
-
-    if (NOT (USE_COMPILER_HIDDEN_VISIBILITY AND COMPILER_HAS_HIDDEN_VISIBILITY))
-        # Just return if there are no flags to add.
-        return ()
-    endif ()
-
-    set (EXTRA_FLAGS "-fvisibility=hidden")
-    # Either return the extra flags needed in the supplied argument, or to the
-    # CMAKE_C_FLAGS if no argument is supplied.
-    if (ARGV1)
-        set (${ARGV1} "${EXTRA_FLAGS}" PARENT_SCOPE)
-    else ()
-        set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_FLAGS}" PARENT_SCOPE)
-    endif ()
-
-    if (COMPILER_HAS_HIDDEN_INLINE_VISIBILITY)
-        set (EXTRA_FLAGS "${EXTRA_FLAGS} -fvisibility-inlines-hidden")
-    endif ()
-
-    # Either return the extra flags needed in the supplied argument, or to the
-    # CMAKE_CXX_FLAGS if no argument is supplied.
-    if (ARGV0)
-        set (${ARGV0} "${EXTRA_FLAGS}" PARENT_SCOPE)
-    else ()
-        set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_FLAGS}" PARENT_SCOPE)
-    endif ()
-endfunction ()
-
-# Macro for precompiled headers
-macro (enable_pch)
-    if (MSVC)
-        foreach (FILE ${SOURCE_FILES})
-            if (FILE MATCHES \\.cpp$)
-                if (FILE MATCHES Precompiled\\.cpp$)
-                    set_source_files_properties (${FILE} PROPERTIES COMPILE_FLAGS "/YcPrecompiled.h")
-                else ()
-                    set_source_files_properties (${FILE} PROPERTIES COMPILE_FLAGS "/YuPrecompiled.h")
-                endif ()
-            endif ()
-        endforeach ()
-    else ()
-        # TODO: to enable usage of precompiled header in GCC, for now just make sure the correct Precompiled.h is found in the search
-        foreach (FILE ${SOURCE_FILES})
-            if (FILE MATCHES Precompiled\\.h$)
-                get_filename_component (PATH ${FILE} PATH)
-                include_directories (${PATH})
-                break ()
-            endif ()
-        endforeach ()
-    endif ()
-endmacro ()
-
-# Macro for setting up dependency lib for compilation and linking of a target
-macro (setup_target)
-    # Include directories
-    include_directories (${INCLUDE_DIRS})
-    # Link libraries
-    define_dependency_libs (${TARGET_NAME})
-    target_link_libraries (${TARGET_NAME} ${ABSOLUTE_PATH_LIBS} ${LIBS})
-
-    # CMake does not support IPHONEOS_DEPLOYMENT_TARGET the same manner as it supports CMAKE_OSX_DEPLOYMENT_TARGET
-    # The iOS deployment target is set using the corresponding Xcode attribute as target property instead
-    if (IOS AND IPHONEOS_DEPLOYMENT_TARGET)
-        set_target_properties (${TARGET_NAME} PROPERTIES XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET ${IPHONEOS_DEPLOYMENT_TARGET})
-    endif ()
-
-    # Workaround CMake/Xcode generator bug where it always appends '/build' path element to SYMROOT attribute and as such the items in Products are always rendered as red as if they are not yet built
-    if (XCODE)
-        file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/build)
-        get_target_property (LOCATION ${TARGET_NAME} LOCATION)
-        string (REGEX REPLACE "^.*\\$\\(CONFIGURATION\\)" $(CONFIGURATION) SYMLINK ${LOCATION})
-        get_filename_component (DIRECTORY ${SYMLINK} PATH)
-        add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
-            COMMAND mkdir -p ${DIRECTORY} && ln -s -f $<TARGET_FILE:${TARGET_NAME}> ${DIRECTORY}/$<TARGET_FILE_NAME:${TARGET_NAME}>
-            WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/build)
-    endif ()
-endmacro ()
-
-# Macro for checking the SOURCE_FILES variable is properly initialized
-macro (check_source_files)
-    if (NOT SOURCE_FILES)
-        message (FATAL_ERROR "Could not configure and generate the project file because no source files have been defined yet. "
-            "You can define the source files explicitly by setting the SOURCE_FILES variable in your CMakeLists.txt; or "
-            "by calling the define_source_files() macro which would by default glob all the C++ source files found in the same scope of "
-            "CMakeLists.txt where the macro is being called and the macro would set the SOURCE_FILES variable automatically. "
-            "If your source files are not located in the same directory as the CMakeLists.txt or your source files are "
-            "more than just C++ language then you probably have to pass in extra arguments when calling the macro in order to make it works. "
-            "See the define_source_files() macro definition in the CMake/Modules/Atomic-CMake-common.cmake for more detail.")
-    endif ()
-endmacro ()
-
-# Macro for setting up a library target
-macro (setup_library)
-    check_source_files ()
-    add_library (${TARGET_NAME} ${ARGN} ${SOURCE_FILES})
-    setup_target ()
-
-    if (CMAKE_PROJECT_NAME STREQUAL Atomic)
-        if (NOT ${TARGET_NAME} STREQUAL Atomic)
-            # Only interested in static library type, i.e. exclude shared and module library types
-            get_target_property (LIB_TYPE ${TARGET_NAME} TYPE)
-            if (LIB_TYPE MATCHES STATIC)
-                set (STATIC_LIBRARY_TARGETS ${STATIC_LIBRARY_TARGETS} ${TARGET_NAME} PARENT_SCOPE)
-            endif ()
-        endif ()
-        if (ATOMIC_LIB_TYPE STREQUAL SHARED)
-            set_target_properties (${TARGET_NAME} PROPERTIES COMPILE_DEFINITIONS ATOMIC_EXPORTS)
-        endif ()
-    elseif (ATOMIC_SCP_TO_TARGET)
-        add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND scp $<TARGET_FILE:${TARGET_NAME}> ${ATOMIC_SCP_TO_TARGET} || exit 0
-            COMMENT "Scp-ing ${TARGET_NAME} library to target system")
-    endif ()
-endmacro ()
-
-# Macro for setting up an executable target
-#  NODEPS - setup executable target without defining Atomic dependency libraries
-#  WIN32/MACOSX_BUNDLE/EXCLUDE_FROM_ALL - see CMake help on add_executable command
-macro (setup_executable)
-    # Parse extra arguments
-    cmake_parse_arguments (ARG "NODEPS" "" "" ${ARGN})
-
-    check_source_files ()
-    add_executable (${TARGET_NAME} ${ARG_UNPARSED_ARGUMENTS} ${SOURCE_FILES})
-    if (ARG_NODEPS)
-        define_dependency_libs (Atomic-nodeps)
-    else ()
-        define_dependency_libs (Atomic)
-    endif ()
-    setup_target ()
-    
-    if (ATOMIC_SCP_TO_TARGET)
-        add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND scp $<TARGET_FILE:${TARGET_NAME}> ${ATOMIC_SCP_TO_TARGET} || exit 0
-            COMMENT "Scp-ing ${TARGET_NAME} executable to target system")
-    endif ()
-    if (DEST_RUNTIME_DIR)
-        # Need to check if the destination variable is defined first because this macro could be called by external project that does not wish to install anything
-        install (TARGETS ${TARGET_NAME} RUNTIME DESTINATION ${DEST_RUNTIME_DIR} BUNDLE DESTINATION ${DEST_BUNDLE_DIR})
-    endif ()
-endmacro ()
-
-# Macro for setting up linker flags for Mac OS X desktop build
-macro (setup_macosx_linker_flags LINKER_FLAGS)
-    set (${LINKER_FLAGS} "${${LINKER_FLAGS}} -framework AudioUnit -framework Carbon -framework Cocoa -framework CoreAudio -framework ForceFeedback -framework IOKit -framework OpenGL -framework CoreServices")
-endmacro ()
-
-# Macro for setting up linker flags for IOS build
-macro (setup_ios_linker_flags LINKER_FLAGS)
-    set (${LINKER_FLAGS} "${${LINKER_FLAGS}} -framework AudioToolbox -framework CoreAudio -framework CoreGraphics -framework Foundation -framework OpenGLES -framework QuartzCore -framework UIKit")
-endmacro ()
-
-# Macro for setting up an executable target with resources to copy
-#  NODEPS - setup executable target without defining Atomic dependency libraries
-#  NOBUNDLE - do not use MACOSX_BUNDLE even when ATOMIC_MACOSX_BUNDLE build option is enabled
-#  WIN32/MACOSX_BUNDLE/EXCLUDE_FROM_ALL - see CMake help on add_executable command
-macro (setup_main_executable)
-    # Parse extra arguments
-    cmake_parse_arguments (ARG "NOBUNDLE;MACOSX_BUNDLE;WIN32" "" "" ${ARGN})
-
-    # Define resource files
-    if (XCODE)
-        set (RESOURCE_FILES ${CMAKE_SOURCE_DIR}/bin/CoreData ${CMAKE_SOURCE_DIR}/bin/Data ${CMAKE_SOURCE_DIR}/bin/Data/Textures/UrhoIcon.icns)
-        if (IOS)
-            list (APPEND RESOURCE_FILES ${CMAKE_SOURCE_DIR}/bin/Data/Textures/UrhoIcon.png)
-        endif ()
-        source_group (Resources FILES ${RESOURCE_FILES})
-        set_source_files_properties (${RESOURCE_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
-        list (APPEND SOURCE_FILES ${RESOURCE_FILES})
-    endif ()
-
-    if (ANDROID)
-        # Add SDL native init function, SDL_Main() entry point must be defined by one of the source files in ${SOURCE_FILES}
-        find_file (ANDROID_MAIN_C_PATH SDL_android_main.c
-            HINTS ${ATOMIC_HOME}/include/${PATH_SUFFIX}/ThirdParty/SDL/android ${CMAKE_SOURCE_DIR}/Source/ThirdParty/SDL/src/main/android
-            DOC "Path to SDL_android_main.c" NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
-        mark_as_advanced (ANDROID_MAIN_C_PATH)  # Hide it from cmake-gui in non-advanced mode
-        if (ANDROID_MAIN_C_PATH)
-            list (APPEND SOURCE_FILES ${ANDROID_MAIN_C_PATH})
-        else ()
-            message (FATAL_ERROR
-                "Could not find SDL_android_main.c source file in the Atomic build tree or SDK installation. "
-                "Please reconfigure and rebuild your Atomic build tree; or reinstall the SDK.")
-        endif ()
-        # Setup shared library output path
-        set_output_directories (${ANDROID_LIBRARY_OUTPUT_PATH} LIBRARY)
-        # Setup target as main shared library
-        define_dependency_libs (Atomic)
-        setup_library (SHARED)
-        if (DEST_LIBRARY_DIR)
-            install (TARGETS ${TARGET_NAME} LIBRARY DESTINATION ${DEST_LIBRARY_DIR} ARCHIVE DESTINATION ${DEST_LIBRARY_DIR})
-        endif ()
-        # Copy other dependent shared libraries to Android library output path
-        foreach (FILE ${ABSOLUTE_PATH_LIBS})
-            get_filename_component (EXT ${FILE} EXT)
-            if (EXT STREQUAL .so)
-                get_filename_component (NAME ${FILE} NAME)
-                add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
-                    COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${FILE} ${ANDROID_LIBRARY_OUTPUT_PATH}
-                    COMMENT "Copying ${NAME} to library output directory")
-            endif ()
-        endforeach ()
-        if (ANDROID_NDK_GDB)
-            # Copy the library while it still has debug symbols for ndk-gdb
-            add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
-                COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${TARGET_NAME}> ${NDK_GDB_SOLIB_PATH}
-                COMMENT "Copying lib${TARGET_NAME}.so with debug symbols to ${NDK_GDB_SOLIB_PATH} directory")
-        endif ()
-        # Strip target main shared library
-        add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
-            COMMAND ${CMAKE_STRIP} $<TARGET_FILE:${TARGET_NAME}>
-            COMMENT "Stripping lib${TARGET_NAME}.so in library output directory")
-        # When performing packaging, include the final apk file
-        if (CMAKE_PROJECT_NAME STREQUAL Atomic AND NOT APK_INCLUDED)
-            install (FILES ${LIBRARY_OUTPUT_PATH_ROOT}/bin/Atomic-debug.apk DESTINATION ${DEST_RUNTIME_DIR} OPTIONAL)
-            set (APK_INCLUDED 1)
-        endif ()
-    else ()
-        # Setup target as executable
-        unset (TARGET_PROPERTIES)
-        if (WIN32)
-            if (NOT ATOMIC_WIN32_CONSOLE OR ARG_WIN32)
-                set (EXE_TYPE WIN32)
-            endif ()
-            list (APPEND TARGET_PROPERTIES DEBUG_POSTFIX _d)
-        elseif (IOS)
-            set (EXE_TYPE MACOSX_BUNDLE)
-            list (APPEND TARGET_PROPERTIES XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY 1,2 MACOSX_BUNDLE_INFO_PLIST iOSBundleInfo.plist.template)
-            setup_ios_linker_flags (CMAKE_EXE_LINKER_FLAGS)
-        elseif (APPLE)
-            if ((ATOMIC_MACOSX_BUNDLE OR ARG_MACOSX_BUNDLE) AND NOT ARG_NOBUNDLE)
-                set (EXE_TYPE MACOSX_BUNDLE)
-                list (APPEND TARGET_PROPERTIES MACOSX_BUNDLE_INFO_PLIST MacOSXBundleInfo.plist.template)
-            endif ()
-            setup_macosx_linker_flags (CMAKE_EXE_LINKER_FLAGS)
-        endif ()
-        setup_executable (${EXE_TYPE} ${ARG_UNPARSED_ARGUMENTS})
-        if (TARGET_PROPERTIES)
-            set_target_properties (${TARGET_NAME} PROPERTIES ${TARGET_PROPERTIES})
-        endif ()
-    endif ()
-    
-    if (IOS)
-        # Define a custom target to check for resource modification
-        get_target_property (TARGET_LOC ${TARGET_NAME} LOCATION)
-        string (REGEX REPLACE /Contents/MacOS "" TARGET_LOC ${TARGET_LOC})    # The regex replacement is temporary workaround to correct the wrong location caused by CMake/Xcode generator bug
-        add_custom_target (RESOURCE_CHECK_${TARGET_NAME} ALL
-            \(\( `find ${RESOURCE_FILES} -newer ${TARGET_LOC} 2>/dev/null |wc -l` \)\) && touch -cm ${SOURCE_FILES} || exit 0
-            COMMENT "Checking for changes in the Resource folders")
-        add_dependencies (${TARGET_NAME} RESOURCE_CHECK_${TARGET_NAME})
-    endif ()
-endmacro ()
-
-# Macro for adjusting target output name by dropping _suffix from the target name
-macro (adjust_target_name)
-    string (REGEX REPLACE _.*$ "" OUTPUT_NAME ${TARGET_NAME})
-    set_target_properties (${TARGET_NAME} PROPERTIES OUTPUT_NAME ${OUTPUT_NAME})
-endmacro ()
-
-# Macro for defining external library dependencies
-# The purpose of this macro is emulate CMake to set the external library dependencies transitively
-# It works for both targets setup within Atomic project and outside Atomic project that uses Atomic as external static/shared library
-macro (define_dependency_libs TARGET)
-    # ThirdParty/SDL external dependency
-    if (${TARGET} MATCHES SDL|Atomic)
-        if (WIN32)
-            list (APPEND LIBS user32 gdi32 winmm imm32 ole32 oleaut32 version uuid)
-        elseif (APPLE)
-            list (APPEND LIBS dl pthread)
-        elseif (ANDROID)
-            list (APPEND LIBS dl log android)
-        else ()
-            # Linux
-            list (APPEND LIBS dl pthread rt)
-            if (RPI)
-                list (APPEND ABSOLUTE_PATH_LIBS ${BCM_VC_LIBRARIES})
-            endif ()
-        endif ()
-    endif ()
-
-    # ThirdParty/kNet & ThirdParty/Civetweb external dependency
-    if (${TARGET} MATCHES Civetweb|kNet|Atomic)
-        if (WIN32)
-            list (APPEND LIBS ws2_32)
-        elseif (NOT ANDROID)
-            list (APPEND LIBS pthread)
-        endif ()
-    endif ()
-
-    # Atomic/LuaJIT external dependency
-    if (ATOMIC_LUAJIT AND ${TARGET} MATCHES LuaJIT|Atomic)
-        if (NOT WIN32)
-            list (APPEND LIBS dl m)
-        endif ()
-    endif ()
-
-    # Atomic external dependency
-    if (${TARGET} STREQUAL Atomic)
-        # Core
-        if (WIN32)
-            list (APPEND LIBS winmm)
-            if (ATOMIC_MINIDUMPS)
-                list (APPEND LIBS dbghelp)
-            endif ()
-        elseif (NOT ANDROID)
-            list (APPEND LIBS pthread)
-        endif ()
-
-        # Graphics
-        if (ATOMIC_OPENGL)
-            if (WIN32)
-                list (APPEND LIBS opengl32)
-            elseif (ANDROID)
-                list (APPEND LIBS GLESv1_CM GLESv2)
-            elseif (NOT APPLE AND NOT RPI)
-                list (APPEND LIBS GL)
-            endif ()
-        else ()
-            if (DIRECT3D_FOUND)
-                list (APPEND ABSOLUTE_PATH_LIBS ${DIRECT3D_LIBRARIES})
-            else ()
-                # If SDK not found, assume the libraries are found from default directories
-                list (APPEND LIBS ${DIRECT3D_LIBRARIES})
-            endif ()
-        endif ()
-
-        # This variable value can either be 'Atomic' target or an absolute path to an actual static/shared Atomic library or empty (if we are building the library itself)
-        # The former would cause CMake not only to link against the Atomic library but also to add a dependency to Atomic target
-        if (ATOMIC_LIBRARIES)
-            if (WIN32 AND ATOMIC_LIBRARIES_DBG AND ATOMIC_LIBRARIES_REL AND TARGET ${TARGET_NAME})
-                # Special handling when both debug and release libraries are found
-                target_link_libraries (${TARGET_NAME} debug ${ATOMIC_LIBRARIES_DBG} optimized ${ATOMIC_LIBRARIES_REL})
-            else ()
-                list (APPEND ABSOLUTE_PATH_LIBS ${ATOMIC_LIBRARIES})
-            endif ()
-        endif ()
-    endif ()
-
-    # LuaJIT specific - extra linker flags for linking against LuaJIT (adapted from LuaJIT's original Makefile)
-    if (ATOMIC_LUAJIT AND ${TARGET} MATCHES Atomic)
-        # 64-bit Mac OS X
-        if (ATOMIC_64BIT AND APPLE AND NOT IOS)
-            set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pagezero_size 10000 -image_base 100000000")
-        endif ()
-        # GCC-specific
-        if (NOT WIN32 AND NOT APPLE AND NOT ANDROID)
-            set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-E")
-        endif ()
-    endif ()
-endmacro ()
-
-# Macro for sorting and removing duplicate values
-macro (remove_duplicate LIST_NAME)
-    if (${LIST_NAME})
-        list (SORT ${LIST_NAME})
-        list (REMOVE_DUPLICATES ${LIST_NAME})
-    endif ()
-endmacro ()
-
-# Macro for setting a list from another with option to sort and remove duplicate values
-macro (set_list TO_LIST FROM_LIST)
-    set (${TO_LIST} ${${FROM_LIST}})
-    if (${ARGN} STREQUAL REMOVE_DUPLICATE)
-        remove_duplicate (${TO_LIST})
-    endif ()
-endmacro ()
-
-# Macro for defining source files with optional arguments as follows:
-#  GLOB_CPP_PATTERNS <list> - Use the provided globbing patterns for CPP_FILES instead of the default *.cpp
-#  GLOB_H_PATTERNS <list> - Use the provided globbing patterns for H_FILES instead of the default *.h
-#  EXCLUDE_PATTERNS <list> - Use the provided patterns for excluding matched source files
-#  EXTRA_CPP_FILES <list> - Include the provided list of files into CPP_FILES result
-#  EXTRA_H_FILES <list> - Include the provided list of files into H_FILES result
-#  PCH - Enable precompiled header on the defined source files
-#  PARENT_SCOPE - Glob source files in current directory but set the result in parent-scope's variable ${DIR}_CPP_FILES and ${DIR}_H_FILES instead
-#  RECURSE - Option to glob recursively
-#  GROUP - Option to group source files based on its relative path to the corresponding parent directory (only works when PARENT_SCOPE option is not in use)
-macro (define_source_files)
-    # Parse the arguments
-    cmake_parse_arguments (ARG "PCH;PARENT_SCOPE;RECURSE;GROUP" "" "EXTRA_CPP_FILES;EXTRA_H_FILES;GLOB_CPP_PATTERNS;GLOB_H_PATTERNS;EXCLUDE_PATTERNS" ${ARGN})
-
-    # Source files are defined by globbing source files in current source directory and also by including the extra source files if provided
-    if (NOT ARG_GLOB_CPP_PATTERNS)
-        set (ARG_GLOB_CPP_PATTERNS *.cpp)    # Default glob pattern
-    endif ()
-    if (NOT ARG_GLOB_H_PATTERNS)
-        set (ARG_GLOB_H_PATTERNS *.h)
-    endif ()
-    if (ARG_RECURSE)
-        set (ARG_RECURSE _RECURSE)
-    else ()
-        unset (ARG_RECURSE)
-    endif ()
-    file (GLOB${ARG_RECURSE} CPP_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${ARG_GLOB_CPP_PATTERNS})
-    file (GLOB${ARG_RECURSE} H_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${ARG_GLOB_H_PATTERNS})
-    if (ARG_EXCLUDE_PATTERNS)
-        set (CPP_FILES_WITH_SENTINEL ";${CPP_FILES};")  # Stringify the lists
-        set (H_FILES_WITH_SENTINEL ";${H_FILES};")
-        foreach (PATTERN ${ARG_EXCLUDE_PATTERNS})
-            foreach (LOOP RANGE 1)
-                string (REGEX REPLACE ";${PATTERN};" ";;" CPP_FILES_WITH_SENTINEL "${CPP_FILES_WITH_SENTINEL}")
-                string (REGEX REPLACE ";${PATTERN};" ";;" H_FILES_WITH_SENTINEL "${H_FILES_WITH_SENTINEL}")
-            endforeach ()
-        endforeach ()
-        set (CPP_FILES ${CPP_FILES_WITH_SENTINEL})      # Convert strings back to lists, extra sentinels are harmless
-        set (H_FILES ${H_FILES_WITH_SENTINEL})
-    endif ()
-    list (APPEND CPP_FILES ${ARG_EXTRA_CPP_FILES})
-    list (APPEND H_FILES ${ARG_EXTRA_H_FILES})
-    set (SOURCE_FILES ${CPP_FILES} ${H_FILES})
-    
-    # Optionally enable PCH
-    if (ARG_PCH)
-        enable_pch ()
-    endif ()
-    
-    # Optionally accumulate source files at parent scope
-    if (ARG_PARENT_SCOPE)
-        get_filename_component (NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
-        set (${NAME}_CPP_FILES ${CPP_FILES} PARENT_SCOPE)
-        set (${NAME}_H_FILES ${H_FILES} PARENT_SCOPE)
-    # Optionally put source files into further sub-group (only works when PARENT_SCOPE option is not in use)
-    elseif (ARG_GROUP)
-        foreach (CPP_FILE ${CPP_FILES})
-            get_filename_component (PATH ${CPP_FILE} PATH)
-            if (PATH)
-                string (REPLACE / \\ PATH ${PATH})
-                source_group ("Source Files\\${PATH}" FILES ${CPP_FILE})
-            endif ()
-        endforeach ()
-        foreach (H_FILE ${H_FILES})
-            get_filename_component (PATH ${H_FILE} PATH)
-            if (PATH)
-                string (REPLACE / \\ PATH ${PATH})
-                source_group ("Header Files\\${PATH}" FILES ${H_FILE})
-            endif ()
-        endforeach ()
-    endif ()
-endmacro ()
-
-# Macro for setting up header files installation for the SDK and the build tree (only support subset of install command arguments)
-#  FILES <list> - File list to be installed
-#  DIRECTORY <list> - Directory list to be installed
-#  FILES_MATCHING - Option to perform file pattern matching on DIRECTORY list
-#  USE_FILE_SYMLINK - Option to use file symlinks on the matched files found in the DIRECTORY list
-#  BUILD_TREE_ONLY - Option to install the header files into the build tree only
-#  PATTERN <list> - Pattern list to be used in file pattern matching option
-#  BASE <value> - An absolute base path to be prepended to the destination path when installing to build tree, default to build tree
-#  DESTINATION <value> - A relative destination path to be installed to
-macro (install_header_files)
-    # Parse the arguments for the underlying install command for the SDK
-    cmake_parse_arguments (ARG "FILES_MATCHING;USE_FILE_SYMLINK;BUILD_TREE_ONLY" "BASE;DESTINATION" "FILES;DIRECTORY;PATTERN" ${ARGN})
-    unset (INSTALL_MATCHING)
-    if (ARG_FILES)
-        set (INSTALL_TYPE FILES)
-        set (INSTALL_SOURCES ${ARG_FILES})
-        unset (INSTALL_PERMISSIONS)
-    elseif (ARG_DIRECTORY)
-        set (INSTALL_TYPE DIRECTORY)
-        set (INSTALL_SOURCES ${ARG_DIRECTORY})
-        set (INSTALL_PERMISSIONS ${DEST_PERMISSIONS})
-        if (ARG_FILES_MATCHING)
-            set (INSTALL_MATCHING FILES_MATCHING)
-            # Our macro supports PATTERN <list> but CMake's install command does not, so convert the list to: PATTERN <value1> PATTERN <value2> ...
-            foreach (PATTERN ${ARG_PATTERN})
-                list (APPEND INSTALL_MATCHING PATTERN ${PATTERN})
-            endforeach ()
-        endif ()
-    else ()
-        message (FATAL_ERROR "Couldn't setup install command because the install type is not specified.")
-    endif ()
-    if (NOT ARG_DESTINATION)
-        message (FATAL_ERROR "Couldn't setup install command because the install destination is not specified.")
-    endif ()
-    if (NOT ARG_BUILD_TREE_ONLY AND DEST_INCLUDE_DIR)
-        # Need to check if the destination variable is defined first because this macro could be called by external project that does not wish to install anything
-        install (${INSTALL_TYPE} ${INSTALL_SOURCES} DESTINATION ${ARG_DESTINATION} ${INSTALL_PERMISSIONS} ${INSTALL_MATCHING})
-    endif ()
-
-    # Reparse the arguments for the create_symlink macro to "install" the header files in the build tree
-    if (NOT ARG_BASE)
-        set (ARG_BASE ${CMAKE_BINARY_DIR})  # Use build tree as base path
-    endif ()
-    foreach (INSTALL_SOURCE ${INSTALL_SOURCES})
-        if (NOT IS_ABSOLUTE ${INSTALL_SOURCE})
-            set (INSTALL_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/${INSTALL_SOURCE})
-        endif ()
-        if (INSTALL_SOURCE MATCHES /$)
-            # Source is a directory
-            if (ARG_USE_FILE_SYMLINK)
-                # Use file symlink for each individual files in the source directory
-                set (GLOBBING_EXPRESSION RELATIVE ${INSTALL_SOURCE})
-                if (ARG_FILES_MATCHING)
-                    foreach (PATTERN ${ARG_PATTERN})
-                        list (APPEND GLOBBING_EXPRESSION ${INSTALL_SOURCE}${PATTERN})
-                    endforeach ()
-                else ()
-                    list (APPEND GLOBBING_EXPRESSION ${INSTALL_SOURCE}*)
-                endif ()
-                file (GLOB_RECURSE NAMES ${GLOBBING_EXPRESSION})
-                foreach (NAME ${NAMES})
-                    get_filename_component (PATH ${ARG_DESTINATION}/${NAME} PATH)
-                    # Recreate the source directory structure in the destination path
-                    if (NOT EXISTS ${ARG_BASE}/${PATH})
-                        file (MAKE_DIRECTORY ${ARG_BASE}/${PATH})
-                    endif ()
-                    create_symlink (${INSTALL_SOURCE}${NAME} ${ARG_DESTINATION}/${NAME} FALLBACK_TO_COPY)
-                endforeach ()
-            else ()
-                # Use a single symlink pointing to the source directory
-                create_symlink (${INSTALL_SOURCE} ${ARG_DESTINATION} FALLBACK_TO_COPY)
-            endif ()
-        else ()
-            # Source is a file (it could also be actually a directory to be treated as a "file", i.e. for creating symlink pointing to the directory)
-            get_filename_component (NAME ${INSTALL_SOURCE} NAME)
-            create_symlink (${INSTALL_SOURCE} ${ARG_DESTINATION}/${NAME} FALLBACK_TO_COPY)
-        endif ()
-    endforeach ()
-endmacro ()
-
-# Post-CMake fixes
-if (IOS)
-    # TODO: can be removed when CMake minimum required has reached 2.8.12
-    if (CMAKE_VERSION VERSION_LESS 2.8.12)
-	# Due to a bug in the CMake/Xcode generator (prior to version 2.8.12) where it has wrongly assumed the IOS bundle structure to be the same as MacOSX bundle structure,
-	# below temporary fix is required in order to solve the auto-linking issue when dependent libraries are changed
-	list (APPEND POST_CMAKE_FIXES COMMAND sed -i '' 's/\/Contents\/MacOS//g' ${CMAKE_BINARY_DIR}/CMakeScripts/XCODE_DEPEND_HELPER.make || exit 0)
-    endif ()
-
-    # Due to a bug in the CMake/Xcode generator (still exists in 3.1) that prevents iOS targets (library and bundle) to be installed correctly
-    # (see http://public.kitware.com/Bug/bug_relationship_graph.php?bug_id=12506&graph=dependency),
-    # below temporary fix is required to work around the bug
-    list (APPEND POST_CMAKE_FIXES COMMAND sed -i '' 's/EFFECTIVE_PLATFORM_NAME//g' ${CMAKE_BINARY_DIR}/CMakeScripts/install_postBuildPhase.make* || exit 0)
-endif ()
-if (POST_CMAKE_FIXES)
-    add_custom_target (POST_CMAKE_FIXES ALL ${POST_CMAKE_FIXES} COMMENT "Applying post-cmake fixes")
-endif ()

+ 0 - 147
CMake/Modules/FindAtomic.cmake

@@ -1,147 +0,0 @@
-#
-# Copyright (c) 2008-2014 the Urho3D project.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-
-# Find Atomic include directories and library in source & build tree or installed Atomic SDK.
-#
-#  ATOMIC_FOUND
-#  ATOMIC_INCLUDE_DIRS
-#  ATOMIC_LIBRARIES
-#  ATOMIC_LIBRARIES_REL (WIN32 only)
-#  ATOMIC_LIBRARIES_DBG (WIN32 Only)
-#
-#
-# For internal Atomic project, the Atomic "build tree" path is already known.
-#
-# For external project that attempts to use the Atomic build tree or installed Atomic SDK,
-# use ATOMIC_HOME environment variable or build option to specify the path (not needed when the path is a system-wide default location).
-# When setting ATOMIC_HOME variable, it should be set to a parent directory containing both the "include" or "lib" subdirectories.
-# For example: set ATOMIC_HOME=/home/john/usr/local, if the SDK is installed using DESTDIR=/home/john and CMAKE_INSTALL_PREFIX=/usr/local
-#
-
-if (ATOMIC_FOUND)
-    # All the subprojects should use the same Atomic library, so only need to search on the first (sub)project that requires Atomic library
-    return ()
-endif ()
-
-# If the ATOMIC_LIB_TYPE build option changes then invalidate the found library cache
-if (NOT ATOMIC_LIB_TYPE STREQUAL ATOMIC_FOUND_LIB_TYPE)
-    unset (ATOMIC_LIBRARIES CACHE)
-    set (ATOMIC_FOUND_LIB_TYPE ${ATOMIC_LIB_TYPE} CACHE INTERNAL "Lib type when Atomic library was last found")
-
-    # Atomic prefers static library type by default while CMake prefers shared one, so we need to change CMake preference to agree with Atomic
-    if (NOT ATOMIC_LIB_TYPE STREQUAL SHARED)
-        list (REVERSE CMAKE_FIND_LIBRARY_SUFFIXES)
-    endif ()
-endif ()
-
-set (PATH_SUFFIX Atomic)
-if (CMAKE_PROJECT_NAME STREQUAL Atomic AND TARGET Atomic)
-    # Library location is already known to be in the build tree
-    set (ATOMIC_HOME ${CMAKE_BINARY_DIR})
-    set (ATOMIC_INCLUDE_DIRS ${ATOMIC_HOME}/include ${ATOMIC_HOME}/include/${PATH_SUFFIX}/ThirdParty)
-    if (ATOMIC_PHYSICS)
-        # Bullet library depends on its own include dir to be added in the header search path
-        # This is more practical than patching its header files in many places to make them work with relative path
-        list (APPEND ATOMIC_INCLUDE_DIRS ${ATOMIC_HOME}/include/${PATH_SUFFIX}/ThirdParty/Bullet)
-    endif ()
-    if (ATOMIC_LUA)
-        # ditto for Lua/LuaJIT
-        list (APPEND ATOMIC_INCLUDE_DIRS ${ATOMIC_HOME}/include/${PATH_SUFFIX}/ThirdParty/Lua${JIT})
-    endif ()
-    set (ATOMIC_LIBRARIES Atomic)
-    set (FOUND_MESSAGE "Found Atomic: as CMake target")
-else ()
-    # Library location would be searched (based on ATOMIC_HOME variable if provided and in system-wide default location)
-    if (NOT ATOMIC_HOME AND DEFINED ENV{ATOMIC_HOME})
-        file (TO_CMAKE_PATH "$ENV{ATOMIC_HOME}" ATOMIC_HOME)
-    endif ()
-    # ATOMIC_HOME variable should be an absolute path, so use a non-rooted search even when we are cross-compiling
-    if (ATOMIC_HOME)
-        list (APPEND CMAKE_PREFIX_PATH ${ATOMIC_HOME})
-        set (SEARCH_OPT NO_CMAKE_FIND_ROOT_PATH)
-    endif ()
-    # For Android platform, search in path similar to ANDROID_LIBRARY_OUTPUT_PATH variable
-    if (ANDROID)
-        if (ATOMIC_HOME)
-            set (ATOMIC_LIB_SEARCH_HINT HINTS ${ATOMIC_HOME}/libs/${ANDROID_NDK_ABI_NAME})
-        else ()
-            set (ATOMIC_LIB_SEARCH_HINT HINTS /usr/local/libs/${ANDROID_NDK_ABI_NAME})
-        endif ()
-    endif ()
-    if (NOT ATOMIC_64BIT)
-        # For 32-bit, force to search in 'lib' path even when the host system defaulted to use 'lib64'
-        set_property (GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE)
-    elseif (WIN32)
-        # For 64-bit, force to search in 'lib64' path even when the Windows platform is not defaulted to use it
-        set_property (GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE)
-    endif ()
-    find_path (ATOMIC_INCLUDE_DIRS Atomic.h PATH_SUFFIXES ${PATH_SUFFIX} ${SEARCH_OPT})
-    find_library (ATOMIC_LIBRARIES NAMES Atomic ${ATOMIC_LIB_SEARCH_HINT} PATH_SUFFIXES ${PATH_SUFFIX} ${SEARCH_OPT})
-    if (WIN32)
-        # For Windows platform, give a second chance to search for a debug version of the library
-        find_library (ATOMIC_LIBRARIES_DBG NAMES Urho3D_d ${ATOMIC_LIB_SEARCH_HINT} PATH_SUFFIXES ${PATH_SUFFIX} ${SEARCH_OPT})
-        # If both the non-debug and debug version of the libraries are found then use them both
-        set (ATOMIC_LIBRARIES_REL ${ATOMIC_LIBRARIES})
-        # Otherwise, ATOMIC_LIBRARIES variable should have the path to either one of the version
-        if (ATOMIC_LIBRARIES)
-            if (ATOMIC_LIBRARIES_DBG)
-                list (APPEND ATOMIC_LIBRARIES ${ATOMIC_LIBRARIES_DBG})
-            endif ()
-        else ()
-            set (ATOMIC_LIBRARIES ${ATOMIC_LIBRARIES_DBG})
-        endif ()
-    endif ()
-    if (ATOMIC_INCLUDE_DIRS)
-        get_filename_component (PATH ${ATOMIC_INCLUDE_DIRS} PATH)
-        set (ATOMIC_INCLUDE_DIRS ${PATH} ${ATOMIC_INCLUDE_DIRS}/ThirdParty)
-        if (ATOMIC_PHYSICS)
-            list (APPEND ATOMIC_INCLUDE_DIRS ${ATOMIC_INCLUDE_DIRS}/ThirdParty/Bullet)
-        endif ()
-        if (ATOMIC_LUA)
-            list (APPEND ATOMIC_INCLUDE_DIRS ${ATOMIC_INCLUDE_DIRS}/ThirdParty/Lua${JIT})
-        endif ()
-        if (NOT ATOMIC_HOME)
-            # ATOMIC_HOME is not set when using SDK installed on system-wide default location, so set it now
-            get_filename_component (PATH ${PATH} PATH)
-            set (ATOMIC_HOME ${PATH})
-        endif ()
-    endif ()
-endif ()
-
-if (ATOMIC_INCLUDE_DIRS AND ATOMIC_LIBRARIES)
-    set (ATOMIC_FOUND 1)
-    if (NOT FOUND_MESSAGE)
-        set (FOUND_MESSAGE "Found Atomic: ${ATOMIC_LIBRARIES}")
-    endif ()
-    include (FindPackageMessage)
-    FIND_PACKAGE_MESSAGE (Atomic ${FOUND_MESSAGE} "[${ATOMIC_LIBRARIES}][${ATOMIC_INCLUDE_DIRS}]")
-    set (ATOMIC_HOME ${ATOMIC_HOME} CACHE PATH "Path to Atomic build tree or SDK installation location (external project only)" FORCE)
-elseif (Urho3D_FIND_REQUIRED)
-    if (ANDROID)
-        set (NOT_FOUND_MESSAGE "For Android platform, double check if you have specified to use the same ANDROID_ABI as the Atomic library in the build tree or SDK.")
-    endif ()
-    message (FATAL_ERROR
-        "Could not find Atomic library in Atomic build tree or SDK installation. "
-        "Use ATOMIC_HOME environment variable or build option to specify the location of the build tree or SDK installation. ${NOT_FOUND_MESSAGE}")
-endif ()
-
-mark_as_advanced (ATOMIC_INCLUDE_DIRS ATOMIC_LIBRARIES ATOMIC_LIBRARIES_REL ATOMIC_LIBRARIES_DBG ATOMIC_HOME)

+ 0 - 64
CMake/Modules/FindBCM_VC.cmake

@@ -1,64 +0,0 @@
-#
-# Copyright (c) 2008-2014 the Urho3D project.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-
-# Find Broadcom VideoCore firmware installation
-#
-#  BCM_VC_FOUND
-#  BCM_VC_INCLUDE_DIRS
-#  BCM_VC_LIBRARIES
-#
-
-if (NOT RPI)
-    return ()
-endif ()
-if (BCM_VC_FOUND)
-    return ()
-endif ()
-    
-# Only need to cater for raspbian as they are not in CMAKE_SYSTEM_PATH
-set (BCM_VC_INC_SEARCH_PATH /opt/vc/include)
-set (BCM_VC_LIB_SEARCH_PATH /opt/vc/lib)
-
-# Assume all the other headers are installed at same relative path as bcm_host.h
-find_path (BCM_VC_INCLUDE_DIRS bcm_host.h PATHS ${BCM_VC_INC_SEARCH_PATH} PATH_SUFFIXES vc)
-
-# Assume all the other libs are installed at the same relative path as libbcm_host.so
-find_library (BCM_VC_LIB_BCM_HOST bcm_host PATHS ${BCM_VC_LIB_SEARCH_PATH} PATH_SUFFIXES vc)
-find_library (BCM_VC_LIB_EGL EGL PATHS ${BCM_VC_LIB_SEARCH_PATH} PATH_SUFFIXES vc)
-find_library (BCM_VC_LIB_GLES2 GLESv2 PATHS ${BCM_VC_LIB_SEARCH_PATH} PATH_SUFFIXES vc)
-
-if (BCM_VC_INCLUDE_DIRS AND BCM_VC_LIB_BCM_HOST AND BCM_VC_LIB_EGL AND BCM_VC_LIB_GLES2)
-    list (APPEND BCM_VC_INCLUDE_DIRS ${BCM_VC_INCLUDE_DIRS}/interface/vcos/pthreads)  # Note: variable change to list context after this
-    set (BCM_VC_LIBRARIES ${BCM_VC_LIB_BCM_HOST} ${BCM_VC_LIB_EGL} ${BCM_VC_LIB_GLES2})
-    set (BCM_VC_FOUND 1)
-endif ()
-
-if (BCM_VC_FOUND)
-    include (FindPackageMessage)
-    FIND_PACKAGE_MESSAGE (BCM_VC "Found Broadcom VideoCore firmware: ${BCM_VC_LIBRARIES} ${BCM_VC_INCLUDE_DIRS}" "[${BCM_VC_LIBRARIES}][${BCM_VC_INCLUDE_DIRS}]")
-else ()
-    if (BCM_VC_FIND_REQUIRED)
-        message (FATAL_ERROR "Could not find Broadcom VideoCore firmware")
-    endif ()
-endif ()
-
-mark_as_advanced (BCM_VC_INCLUDE_DIRS BCM_VC_LIBRARIES BCM_VC_LIB_BCM_HOST BCM_VC_LIB_EGL BCM_VC_LIB_GLES2)

+ 0 - 82
CMake/Modules/FindDirect3D.cmake

@@ -1,82 +0,0 @@
-#
-# Copyright (c) 2008-2014 the Urho3D project.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-
-# For MSVC compiler, find Microsoft DirectX installation (need June 2010 SDK or later)
-# For MinGW compiler, assume MinGW not only comes with the necessary headers & libraries but also has the headers & libraries directories in its default search path
-# (use 'echo |gcc -v -E -' and 'gcc -print-search-dirs', respectively, to double check)
-#
-#  DIRECT3D_FOUND
-#  DIRECT3D_INCLUDE_DIRS
-#  DIRECT3D_LIBRARIES
-#
-
-if (NOT WIN32 OR DIRECT3D_FOUND)
-    return ()
-endif ()
-
-if (MSVC)
-    set (DIRECTX_INC_SEARCH_PATH
-        "C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)/Include"
-        "C:/Program Files/Microsoft DirectX SDK (June 2010)/Include"
-        "$ENV{DIRECTX_ROOT}/Include"
-        "$ENV{DXSDK_DIR}/Include")
-    find_path (DIRECT3D_INCLUDE_DIRS NAMES d3dcompiler.h PATHS ${DIRECTX_INC_SEARCH_PATH})
-
-    if (CMAKE_CL_64)
-        set (DIRECTX_LIB_SEARCH_PATH
-            "C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)/Lib/x64"
-            "C:/Program Files/Microsoft DirectX SDK (June 2010)/Lib/x64"
-            "$ENV{DIRECTX_ROOT}/Lib/x64"
-            "$ENV{DXSDK_DIR}/Lib/x64")
-    else ()
-        set (DIRECTX_LIB_SEARCH_PATH
-            "C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)/Lib"
-            "C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)/Lib/x86"
-            "C:/Program Files/Microsoft DirectX SDK (June 2010)/Lib"
-            "C:/Program Files/Microsoft DirectX SDK (June 2010)/Lib/x86"
-            "$ENV{DIRECTX_ROOT}/Lib"
-            "$ENV{DIRECTX_ROOT}/Lib/x86"
-            "$ENV{DXSDK_DIR}/Lib"
-            "$ENV{DXSDK_DIR}/Lib/x86")
-    endif ()
-    find_library (DIRECT3D_LIB_D3D9 NAMES d3d9 PATHS ${DIRECTX_LIB_SEARCH_PATH})
-    find_library (DIRECT3D_LIB_D3DCOMPILER NAMES d3dcompiler PATHS ${DIRECTX_LIB_SEARCH_PATH})
-
-    if (DIRECT3D_INCLUDE_DIRS AND DIRECT3D_LIB_D3D9 AND DIRECT3D_LIB_D3DCOMPILER)
-        set (DIRECT3D_LIBRARIES ${DIRECT3D_LIB_D3D9} ${DIRECT3D_LIB_D3DCOMPILER})
-        set (DIRECT3D_FOUND 1)
-    endif ()
-endif ()
-
-if (DIRECT3D_FOUND)
-    include (FindPackageMessage)
-    FIND_PACKAGE_MESSAGE (Direct3D "Found DirectX SDK: ${DIRECT3D_LIBRARIES} ${DIRECT3D_INCLUDE_DIRS}" "[${DIRECT3D_LIBRARIES}][${DIRECT3D_INCLUDE_DIRS}]")
-else ()
-    set (DIRECT3D_LIBRARIES d3d9 d3dcompiler)
-    if (MSVC)
-        message (STATUS "DirectX SDK not found. This is not fatal if a recent Windows SDK is installed")
-    else ()
-        message (STATUS "DirectX SDK is not being searched for MinGW. It is assumed that MinGW itself comes with the necessary headers & libraries for Direct3D")
-    endif ()
-endif ()
-
-mark_as_advanced (DIRECT3D_INCLUDE_DIRS DIRECT3D_LIBRARIES)

+ 0 - 53
CMake/Modules/GetAtomicRevision.cmake

@@ -1,53 +0,0 @@
-#
-# Copyright (c) 2008-2014 the Urho3D project.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-
-# Get Atomic library revision number
-
-if (DEFINED ENV{TRAVIS_COMMIT})
-    # Use the same commit-ish used by CI server to describe the repository
-    set (ARG $ENV{TRAVIS_COMMIT})
-else ()
-    set (ARG --dirty)
-endif ()
-execute_process (COMMAND git describe ${ARG} RESULT_VARIABLE GIT_EXIT_CODE OUTPUT_VARIABLE LIB_REVISION ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
-if (NOT GIT_EXIT_CODE EQUAL 0)
-    # No GIT command line tool or not a GIT repository
-    set (LIB_REVISION Unversioned)
-endif ()
-if (FILENAME)
-    # Output complete revision number to a file
-    file (WRITE ${FILENAME}.new "const char* revision=\"${LIB_REVISION}\";\n")
-    execute_process (COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FILENAME}.new ${FILENAME})
-    file (REMOVE ${FILENAME}.new)
-else ()
-    # Output just major.minor.patch number to stdout
-    string (REGEX MATCH "[^.]+\\.[^-]+" VERSION ${LIB_REVISION})            # Assume release tag always has major.minor format
-    if (VERSION)
-        string (REGEX MATCH "${VERSION}-([^-]+)" PATCH ${LIB_REVISION})     # Subsequent commits count after a release tag is treated as patch number
-        if (PATCH)
-            set (VERSION ${VERSION}.${CMAKE_MATCH_1})
-        endif ()
-    else ()
-        set (VERSION 0.0)
-    endif ()
-    execute_process (COMMAND ${CMAKE_COMMAND} -E echo ${VERSION})
-endif ()

+ 1 - 1
CMake/Modules/MacOSXBundleInfo.plist.template

@@ -34,7 +34,7 @@
     <string>${MACOSX_BUNDLE_COPYRIGHT}</string>
     <key>LSEnvironment</key>
     <dict>
-        <key>ATOMIC_PREFIX_PATH</key>
+        <key>URHO3D_PREFIX_PATH</key>
         <string>../Resources</string>
     </dict>
 </dict>

+ 0 - 1804
CMake/Modules/iOSBundleInfo.plist.template

@@ -1,1804 +0,0 @@
-# Copyright (c) 2010-2011, Ethan Rublee
-# Copyright (c) 2011-2014, Andrey Kamaev
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# 1.  Redistributions of source code must retain the above copyright notice,
-#     this list of conditions and the following disclaimer.
-#
-# 2.  Redistributions in binary form must reproduce the above copyright notice,
-#     this list of conditions and the following disclaimer in the documentation
-#     and/or other materials provided with the distribution.
-#
-# 3.  Neither the name of the copyright holder nor the names of its
-#     contributors may be used to endorse or promote products derived from this
-#     software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-# ------------------------------------------------------------------------------
-#  Android CMake toolchain file, for use with the Android NDK r5-r10d
-#  Requires cmake 2.6.3 or newer (2.8.5 or newer is recommended).
-#  See home page: https://github.com/taka-no-me/android-cmake
-#
-#  Usage Linux:
-#   $ export ANDROID_NDK=/absolute/path/to/the/android-ndk
-#   $ mkdir build && cd build
-#   $ cmake -DCMAKE_TOOLCHAIN_FILE=path/to/the/android.toolchain.cmake ..
-#   $ make -j8
-#
-#  Usage Linux (using standalone toolchain):
-#   $ export ANDROID_STANDALONE_TOOLCHAIN=/absolute/path/to/android-toolchain
-#   $ mkdir build && cd build
-#   $ cmake -DCMAKE_TOOLCHAIN_FILE=path/to/the/android.toolchain.cmake ..
-#   $ make -j8
-#
-#  Usage Windows:
-#     You need native port of make to build your project.
-#     Android NDK r7 (and newer) already has make.exe on board.
-#     For older NDK you have to install it separately.
-#     For example, this one: http://gnuwin32.sourceforge.net/packages/make.htm
-#
-#   $ SET ANDROID_NDK=C:\absolute\path\to\the\android-ndk
-#   $ mkdir build && cd build
-#   $ cmake.exe -G"MinGW Makefiles"
-#       -DCMAKE_TOOLCHAIN_FILE=path\to\the\android.toolchain.cmake
-#       -DCMAKE_MAKE_PROGRAM="%ANDROID_NDK%\prebuilt\windows\bin\make.exe" ..
-#   $ cmake.exe --build .
-#
-#
-#  Options (can be set as cmake parameters: -D<option_name>=<value>):
-#    ANDROID_NDK=/opt/android-ndk - path to the NDK root.
-#      Can be set as environment variable. Can be set only at first cmake run.
-#
-#    ANDROID_STANDALONE_TOOLCHAIN=/opt/android-toolchain - path to the
-#      standalone toolchain. This option is not used if full NDK is found
-#      (ignored if ANDROID_NDK is set).
-#      Can be set as environment variable. Can be set only at first cmake run.
-#
-#    ANDROID_ABI=armeabi-v7a - specifies the target Application Binary
-#      Interface (ABI). This option nearly matches to the APP_ABI variable
-#      used by ndk-build tool from Android NDK.
-#
-#      Possible targets are:
-#        "armeabi" - ARMv5TE based CPU with software floating point operations
-#        "armeabi-v7a" - ARMv7 based devices with hardware FPU instructions
-#            this ABI target is used by default
-#        "armeabi-v7a with NEON" - same as armeabi-v7a, but
-#            sets NEON as floating-point unit
-#        "armeabi-v7a with VFPV3" - same as armeabi-v7a, but
-#            sets VFPV3 as floating-point unit (has 32 registers instead of 16)
-#        "armeabi-v6 with VFP" - tuned for ARMv6 processors having VFP
-#        "x86" - IA-32 instruction set
-#        "mips" - MIPS32 instruction set
-#
-#      64-bit ABIs for NDK r10 and newer:
-#        "arm64-v8a" - ARMv8 AArch64 instruction set
-#        "x86_64" - Intel64 instruction set (r1)
-#        "mips64" - MIPS64 instruction set (r6)
-#
-#    ANDROID_NATIVE_API_LEVEL=android-8 - level of Android API compile for.
-#      Option is read-only when standalone toolchain is used.
-#      Note: building for "android-L" requires explicit configuration.
-#
-#    ANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.9 - the name of compiler
-#      toolchain to be used. The list of possible values depends on the NDK
-#      version. For NDK r10c the possible values are:
-#
-#        * aarch64-linux-android-4.9
-#        * aarch64-linux-android-clang3.4
-#        * aarch64-linux-android-clang3.5
-#        * arm-linux-androideabi-4.6
-#        * arm-linux-androideabi-4.8
-#        * arm-linux-androideabi-4.9 (default)
-#        * arm-linux-androideabi-clang3.4
-#        * arm-linux-androideabi-clang3.5
-#        * mips64el-linux-android-4.9
-#        * mips64el-linux-android-clang3.4
-#        * mips64el-linux-android-clang3.5
-#        * mipsel-linux-android-4.6
-#        * mipsel-linux-android-4.8
-#        * mipsel-linux-android-4.9
-#        * mipsel-linux-android-clang3.4
-#        * mipsel-linux-android-clang3.5
-#        * x86-4.6
-#        * x86-4.8
-#        * x86-4.9
-#        * x86-clang3.4
-#        * x86-clang3.5
-#        * x86_64-4.9
-#        * x86_64-clang3.4
-#        * x86_64-clang3.5
-#
-#    ANDROID_FORCE_ARM_BUILD=OFF - set ON to generate 32-bit ARM instructions
-#      instead of Thumb. Is not available for "x86" (inapplicable) and
-#      "armeabi-v6 with VFP" (is forced to be ON) ABIs.
-#
-#    ANDROID_NO_UNDEFINED=ON - set ON to show all undefined symbols as linker
-#      errors even if they are not used.
-#
-#    ANDROID_SO_UNDEFINED=OFF - set ON to allow undefined symbols in shared
-#      libraries. Automatically turned for NDK r5x and r6x due to GLESv2
-#      problems.
-#
-#    LIBRARY_OUTPUT_PATH_ROOT=${CMAKE_SOURCE_DIR} - where to output binary
-#      files. See additional details below.
-#
-#    ANDROID_SET_OBSOLETE_VARIABLES=ON - if set, then toolchain defines some
-#      obsolete variables which were used by previous versions of this file for
-#      backward compatibility.
-#
-#    ANDROID_STL=gnustl_static - specify the runtime to use.
-#
-#      Possible values are:
-#        none           -> Do not configure the runtime.
-#        system         -> Use the default minimal system C++ runtime library.
-#                          Implies -fno-rtti -fno-exceptions.
-#                          Is not available for standalone toolchain.
-#        system_re      -> Use the default minimal system C++ runtime library.
-#                          Implies -frtti -fexceptions.
-#                          Is not available for standalone toolchain.
-#        gabi++_static  -> Use the GAbi++ runtime as a static library.
-#                          Implies -frtti -fno-exceptions.
-#                          Available for NDK r7 and newer.
-#                          Is not available for standalone toolchain.
-#        gabi++_shared  -> Use the GAbi++ runtime as a shared library.
-#                          Implies -frtti -fno-exceptions.
-#                          Available for NDK r7 and newer.
-#                          Is not available for standalone toolchain.
-#        stlport_static -> Use the STLport runtime as a static library.
-#                          Implies -fno-rtti -fno-exceptions for NDK before r7.
-#                          Implies -frtti -fno-exceptions for NDK r7 and newer.
-#                          Is not available for standalone toolchain.
-#        stlport_shared -> Use the STLport runtime as a shared library.
-#                          Implies -fno-rtti -fno-exceptions for NDK before r7.
-#                          Implies -frtti -fno-exceptions for NDK r7 and newer.
-#                          Is not available for standalone toolchain.
-#        gnustl_static  -> Use the GNU STL as a static library.
-#                          Implies -frtti -fexceptions.
-#        gnustl_shared  -> Use the GNU STL as a shared library.
-#                          Implies -frtti -fno-exceptions.
-#                          Available for NDK r7b and newer.
-#                          Silently degrades to gnustl_static if not available.
-#
-#    ANDROID_STL_FORCE_FEATURES=ON - turn rtti and exceptions support based on
-#      chosen runtime. If disabled, then the user is responsible for settings
-#      these options.
-#
-#  What?:
-#    android-cmake toolchain searches for NDK/toolchain in the following order:
-#      ANDROID_NDK - cmake parameter
-#      ANDROID_NDK - environment variable
-#      ANDROID_STANDALONE_TOOLCHAIN - cmake parameter
-#      ANDROID_STANDALONE_TOOLCHAIN - environment variable
-#      ANDROID_NDK - default locations
-#      ANDROID_STANDALONE_TOOLCHAIN - default locations
-#
-#    Make sure to do the following in your scripts:
-#      SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${my_cxx_flags}" )
-#      SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${my_cxx_flags}" )
-#    The flags will be prepopulated with critical flags, so don't loose them.
-#    Also be aware that toolchain also sets configuration-specific compiler
-#    flags and linker flags.
-#
-#    ANDROID and BUILD_ANDROID will be set to true, you may test any of these
-#    variables to make necessary Android-specific configuration changes.
-#
-#    Also ARMEABI or ARMEABI_V7A or X86 or MIPS or ARM64_V8A or X86_64 or MIPS64
-#    will be set true, mutually exclusive. NEON option will be set true
-#    if VFP is set to NEON.
-#
-#    LIBRARY_OUTPUT_PATH_ROOT should be set in cache to determine where Android
-#    libraries will be installed.
-#    Default is ${CMAKE_SOURCE_DIR}, and the android libs will always be
-#    under the ${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_ABI_NAME}
-#    (depending on the target ABI). This is convenient for Android packaging.
-#
-# ------------------------------------------------------------------------------
-
-# Modified by Lasse Oorni and Yao Wei Tjong for Atomic
-
-cmake_minimum_required( VERSION 2.6.3 )
-
-# Atomic: on Windows Cygwin-based NDK tools may fail in the linking phase with too long command line. Turn on response files to avoid this
-if( CMAKE_HOST_WIN32 )
- set( CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1 )
- set( CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1 )
-endif()
-
-if( DEFINED CMAKE_CROSSCOMPILING )
- # subsequent toolchain loading is not really needed
- return()
-endif()
-
-if( CMAKE_TOOLCHAIN_FILE )
- # touch toolchain variable to suppress "unused variable" warning
-endif()
-
-# inherit settings in recursive loads
-get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE )
-if( _CMAKE_IN_TRY_COMPILE )
- include( "${CMAKE_CURRENT_SOURCE_DIR}/../android.toolchain.config.cmake" OPTIONAL )
-endif()
-
-# this one is important
-if( CMAKE_VERSION VERSION_GREATER "3.0.99" )
- set( CMAKE_SYSTEM_NAME Android )
-else()
- set( CMAKE_SYSTEM_NAME Linux )
-endif()
-
-# this one not so much
-set( CMAKE_SYSTEM_VERSION 1 )
-
-# rpath makes low sence for Android
-set( CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "" )
-set( CMAKE_SKIP_RPATH TRUE CACHE BOOL "If set, runtime paths are not added when using shared libraries." )
-
-# NDK search paths
-set( ANDROID_SUPPORTED_NDK_VERSIONS ${ANDROID_EXTRA_NDK_VERSIONS} -r10d -r10c -r10b -r10 -r9d -r9c -r9b -r9 -r8e -r8d -r8c -r8b -r8 -r7c -r7b -r7 -r6b -r6 -r5c -r5b -r5 "" )
-if(NOT DEFINED ANDROID_NDK_SEARCH_PATHS)
- if( CMAKE_HOST_WIN32 )
-  file( TO_CMAKE_PATH "$ENV{PROGRAMFILES}" ANDROID_NDK_SEARCH_PATHS )
-  set( ANDROID_NDK_SEARCH_PATHS "${ANDROID_NDK_SEARCH_PATHS}/android-ndk" "$ENV{SystemDrive}/NVPACK/android-ndk" )
- else()
-  file( TO_CMAKE_PATH "$ENV{HOME}" ANDROID_NDK_SEARCH_PATHS )
-  set( ANDROID_NDK_SEARCH_PATHS /opt/android-ndk "${ANDROID_NDK_SEARCH_PATHS}/NVPACK/android-ndk" )
- endif()
-endif()
-if(NOT DEFINED ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH)
- set( ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH /opt/android-toolchain )
-endif()
-
-# known ABIs
-set( ANDROID_SUPPORTED_ABIS_arm "armeabi-v7a;armeabi;armeabi-v7a with NEON;armeabi-v7a with VFPV3;armeabi-v6 with VFP" )
-set( ANDROID_SUPPORTED_ABIS_arm64 "arm64-v8a" )
-set( ANDROID_SUPPORTED_ABIS_x86 "x86" )
-set( ANDROID_SUPPORTED_ABIS_x86_64 "x86_64" )
-set( ANDROID_SUPPORTED_ABIS_mips "mips" )
-set( ANDROID_SUPPORTED_ABIS_mips64 "mips64" )
-
-# API level defaults
-# Atomic: default to API 12
-set( ANDROID_DEFAULT_NDK_API_LEVEL 12 )
-set( ANDROID_DEFAULT_NDK_API_LEVEL_arm64 21 )
-set( ANDROID_DEFAULT_NDK_API_LEVEL_x86 12)
-set( ANDROID_DEFAULT_NDK_API_LEVEL_x86_64 21 )
-set( ANDROID_DEFAULT_NDK_API_LEVEL_mips 12 )
-set( ANDROID_DEFAULT_NDK_API_LEVEL_mips64 21 )
-
-
-macro( __LIST_FILTER listvar regex )
- if( ${listvar} )
-  foreach( __val ${${listvar}} )
-   if( __val MATCHES "${regex}" )
-    list( REMOVE_ITEM ${listvar} "${__val}" )
-   endif()
-  endforeach()
- endif()
-endmacro()
-
-macro( __INIT_VARIABLE var_name )
- set( __test_path 0 )
- foreach( __var ${ARGN} )
-  if( __var STREQUAL "PATH" )
-   set( __test_path 1 )
-   break()
-  endif()
- endforeach()
- if( __test_path AND NOT EXISTS "${${var_name}}" )
-  unset( ${var_name} CACHE )
- endif()
- if( "${${var_name}}" STREQUAL "" )
-  set( __values 0 )
-  foreach( __var ${ARGN} )
-   if( __var STREQUAL "VALUES" )
-    set( __values 1 )
-   elseif( NOT __var STREQUAL "PATH" )
-    set( __obsolete 0 )
-    if( __var MATCHES "^OBSOLETE_.*$" )
-     string( REPLACE "OBSOLETE_" "" __var "${__var}" )
-     set( __obsolete 1 )
-    endif()
-    if( __var MATCHES "^ENV_.*$" )
-     string( REPLACE "ENV_" "" __var "${__var}" )
-     set( __value "$ENV{${__var}}" )
-    elseif( DEFINED ${__var} )
-     set( __value "${${__var}}" )
-    else()
-     if( __values )
-      set( __value "${__var}" )
-     else()
-      set( __value "" )
-     endif()
-    endif()
-    if( NOT "${__value}" STREQUAL "" )
-     if( __test_path )
-      if( EXISTS "${__value}" )
-       file( TO_CMAKE_PATH "${__value}" ${var_name} )
-       if( __obsolete AND NOT _CMAKE_IN_TRY_COMPILE )
-        message( WARNING "Using value of obsolete variable ${__var} as initial value for ${var_name}. Please note, that ${__var} can be completely removed in future versions of the toolchain." )
-       endif()
-       break()
-      endif()
-     else()
-      set( ${var_name} "${__value}" )
-       if( __obsolete AND NOT _CMAKE_IN_TRY_COMPILE )
-        message( WARNING "Using value of obsolete variable ${__var} as initial value for ${var_name}. Please note, that ${__var} can be completely removed in future versions of the toolchain." )
-       endif()
-      break()
-     endif()
-    endif()
-   endif()
-  endforeach()
-  unset( __value )
-  unset( __values )
-  unset( __obsolete )
- elseif( __test_path )
-  file( TO_CMAKE_PATH "${${var_name}}" ${var_name} )
- endif()
- unset( __test_path )
-endmacro()
-
-macro( __DETECT_NATIVE_API_LEVEL _var _path )
- SET( __ndkApiLevelRegex "^[\t ]*#define[\t ]+__ANDROID_API__[\t ]+([0-9]+)[\t ]*.*$" )
- FILE( STRINGS ${_path} __apiFileContent REGEX "${__ndkApiLevelRegex}" )
- if( NOT __apiFileContent )
-  message( SEND_ERROR "Could not get Android native API level. Probably you have specified invalid level value, or your copy of NDK/toolchain is broken." )
- endif()
- string( REGEX REPLACE "${__ndkApiLevelRegex}" "\\1" ${_var} "${__apiFileContent}" )
- unset( __apiFileContent )
- unset( __ndkApiLevelRegex )
-endmacro()
-
-macro( __DETECT_TOOLCHAIN_MACHINE_NAME _var _root )
- if( EXISTS "${_root}" )
-  file( GLOB __gccExePath RELATIVE "${_root}/bin/" "${_root}/bin/*-gcc${TOOL_OS_SUFFIX}" )
-  __LIST_FILTER( __gccExePath "^[.].*" )
-  list( LENGTH __gccExePath __gccExePathsCount )
-  if( NOT __gccExePathsCount EQUAL 1  AND NOT _CMAKE_IN_TRY_COMPILE )
-   message( WARNING "Could not determine machine name for compiler from ${_root}" )
-   set( ${_var} "" )
-  else()
-   get_filename_component( __gccExeName "${__gccExePath}" NAME_WE )
-   string( REPLACE "-gcc" "" ${_var} "${__gccExeName}" )
-  endif()
-  unset( __gccExePath )
-  unset( __gccExePathsCount )
-  unset( __gccExeName )
- else()
-  set( ${_var} "" )
- endif()
-endmacro()
-
-
-# fight against cygwin
-set( ANDROID_FORBID_SYGWIN TRUE CACHE BOOL "Prevent cmake from working under cygwin and using cygwin tools")
-mark_as_advanced( ANDROID_FORBID_SYGWIN )
-if( ANDROID_FORBID_SYGWIN )
- if( CYGWIN )
-  message( FATAL_ERROR "Android NDK and android-cmake toolchain are not welcome Cygwin. It is unlikely that this cmake toolchain will work under cygwin. But if you want to try then you can set cmake variable ANDROID_FORBID_SYGWIN to FALSE and rerun cmake." )
- endif()
-
- if( CMAKE_HOST_WIN32 )
-  # remove cygwin from PATH
-  set( __new_path "$ENV{PATH}")
-  __LIST_FILTER( __new_path "cygwin" )
-  set(ENV{PATH} "${__new_path}")
-  unset(__new_path)
- endif()
-endif()
-
-
-# detect current host platform
-if( NOT DEFINED ANDROID_NDK_HOST_X64 AND (CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "amd64|x86_64|AMD64" OR CMAKE_HOST_APPLE) )
- set( ANDROID_NDK_HOST_X64 1 CACHE BOOL "Try to use 64-bit compiler toolchain" )
- mark_as_advanced( ANDROID_NDK_HOST_X64 )
-endif()
-
-set( TOOL_OS_SUFFIX "" )
-if( CMAKE_HOST_APPLE )
- set( ANDROID_NDK_HOST_SYSTEM_NAME "darwin-x86_64" )
- set( ANDROID_NDK_HOST_SYSTEM_NAME2 "darwin-x86" )
-elseif( CMAKE_HOST_WIN32 )
- set( ANDROID_NDK_HOST_SYSTEM_NAME "windows-x86_64" )
- set( ANDROID_NDK_HOST_SYSTEM_NAME2 "windows" )
- set( TOOL_OS_SUFFIX ".exe" )
-elseif( CMAKE_HOST_UNIX )
- set( ANDROID_NDK_HOST_SYSTEM_NAME "linux-x86_64" )
- set( ANDROID_NDK_HOST_SYSTEM_NAME2 "linux-x86" )
-else()
- message( FATAL_ERROR "Cross-compilation on your platform is not supported by this cmake toolchain" )
-endif()
-
-if( NOT ANDROID_NDK_HOST_X64 )
- set( ANDROID_NDK_HOST_SYSTEM_NAME ${ANDROID_NDK_HOST_SYSTEM_NAME2} )
-endif()
-
-# see if we have path to Android NDK
-__INIT_VARIABLE( ANDROID_NDK PATH ENV_ANDROID_NDK )
-if( NOT ANDROID_NDK )
- # see if we have path to Android standalone toolchain
- __INIT_VARIABLE( ANDROID_STANDALONE_TOOLCHAIN PATH ENV_ANDROID_STANDALONE_TOOLCHAIN OBSOLETE_ANDROID_NDK_TOOLCHAIN_ROOT OBSOLETE_ENV_ANDROID_NDK_TOOLCHAIN_ROOT )
-
- if( NOT ANDROID_STANDALONE_TOOLCHAIN )
-  #try to find Android NDK in one of the the default locations
-  set( __ndkSearchPaths )
-  foreach( __ndkSearchPath ${ANDROID_NDK_SEARCH_PATHS} )
-   foreach( suffix ${ANDROID_SUPPORTED_NDK_VERSIONS} )
-    list( APPEND __ndkSearchPaths "${__ndkSearchPath}${suffix}" )
-   endforeach()
-  endforeach()
-  __INIT_VARIABLE( ANDROID_NDK PATH VALUES ${__ndkSearchPaths} )
-  unset( __ndkSearchPaths )
-
-  if( ANDROID_NDK )
-   message( STATUS "Using default path for Android NDK: ${ANDROID_NDK}" )
-   message( STATUS "  If you prefer to use a different location, please define a cmake or environment variable: ANDROID_NDK" )
-  else()
-   #try to find Android standalone toolchain in one of the the default locations
-   __INIT_VARIABLE( ANDROID_STANDALONE_TOOLCHAIN PATH ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH )
-
-   if( ANDROID_STANDALONE_TOOLCHAIN )
-    message( STATUS "Using default path for standalone toolchain ${ANDROID_STANDALONE_TOOLCHAIN}" )
-    message( STATUS "  If you prefer to use a different location, please define the variable: ANDROID_STANDALONE_TOOLCHAIN" )
-   endif( ANDROID_STANDALONE_TOOLCHAIN )
-  endif( ANDROID_NDK )
- endif( NOT ANDROID_STANDALONE_TOOLCHAIN )
-endif( NOT ANDROID_NDK )
-
-# remember found paths
-if( ANDROID_NDK )
- get_filename_component( ANDROID_NDK "${ANDROID_NDK}" ABSOLUTE )
- set( ANDROID_NDK "${ANDROID_NDK}" CACHE INTERNAL "Path of the Android NDK" FORCE )
- set( BUILD_WITH_ANDROID_NDK True )
- if( EXISTS "${ANDROID_NDK}/RELEASE.TXT" )
-  file( STRINGS "${ANDROID_NDK}/RELEASE.TXT" ANDROID_NDK_RELEASE_FULL LIMIT_COUNT 1 REGEX "r[0-9]+[a-z]?" )
-  string( REGEX MATCH "r([0-9]+)([a-z]?)" ANDROID_NDK_RELEASE "${ANDROID_NDK_RELEASE_FULL}" )
- else()
-  set( ANDROID_NDK_RELEASE "r1x" )
-  set( ANDROID_NDK_RELEASE_FULL "unreleased" )
- endif()
- string( REGEX REPLACE "r([0-9]+)([a-z]?)" "\\1*1000" ANDROID_NDK_RELEASE_NUM "${ANDROID_NDK_RELEASE}" )
- string( FIND " abcdefghijklmnopqastuvwxyz" "${CMAKE_MATCH_2}" __ndkReleaseLetterNum )
- math( EXPR ANDROID_NDK_RELEASE_NUM "${ANDROID_NDK_RELEASE_NUM}+${__ndkReleaseLetterNum}" )
-elseif( ANDROID_STANDALONE_TOOLCHAIN )
- get_filename_component( ANDROID_STANDALONE_TOOLCHAIN "${ANDROID_STANDALONE_TOOLCHAIN}" ABSOLUTE )
- # try to detect change
- if( CMAKE_AR )
-  string( LENGTH "${ANDROID_STANDALONE_TOOLCHAIN}" __length )
-  string( SUBSTRING "${CMAKE_AR}" 0 ${__length} __androidStandaloneToolchainPreviousPath )
-  if( NOT __androidStandaloneToolchainPreviousPath STREQUAL ANDROID_STANDALONE_TOOLCHAIN )
-   message( FATAL_ERROR "It is not possible to change path to the Android standalone toolchain on subsequent run." )
-  endif()
-  unset( __androidStandaloneToolchainPreviousPath )
-  unset( __length )
- endif()
- set( ANDROID_STANDALONE_TOOLCHAIN "${ANDROID_STANDALONE_TOOLCHAIN}" CACHE INTERNAL "Path of the Android standalone toolchain" FORCE )
- set( BUILD_WITH_STANDALONE_TOOLCHAIN True )
-else()
- list(GET ANDROID_NDK_SEARCH_PATHS 0 ANDROID_NDK_SEARCH_PATH)
- message( FATAL_ERROR "Could not find neither Android NDK nor Android standalone toolchain.
-    You should either set an environment variable:
-      export ANDROID_NDK=~/my-android-ndk
-    or
-      export ANDROID_STANDALONE_TOOLCHAIN=~/my-android-toolchain
-    or put the toolchain or NDK in the default path:
-      sudo ln -s ~/my-android-ndk ${ANDROID_NDK_SEARCH_PATH}
-      sudo ln -s ~/my-android-toolchain ${ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH}" )
-endif()
-
-# android NDK layout
-if( BUILD_WITH_ANDROID_NDK )
- if( NOT DEFINED ANDROID_NDK_LAYOUT )
-  # try to automatically detect the layout
-  if( EXISTS "${ANDROID_NDK}/RELEASE.TXT")
-   set( ANDROID_NDK_LAYOUT "RELEASE" )
-  elseif( EXISTS "${ANDROID_NDK}/../../linux-x86/toolchain/" )
-   set( ANDROID_NDK_LAYOUT "LINARO" )
-  elseif( EXISTS "${ANDROID_NDK}/../../gcc/" )
-   set( ANDROID_NDK_LAYOUT "ANDROID" )
-  endif()
- endif()
- set( ANDROID_NDK_LAYOUT "${ANDROID_NDK_LAYOUT}" CACHE STRING "The inner layout of NDK" )
- mark_as_advanced( ANDROID_NDK_LAYOUT )
- if( ANDROID_NDK_LAYOUT STREQUAL "LINARO" )
-  set( ANDROID_NDK_HOST_SYSTEM_NAME ${ANDROID_NDK_HOST_SYSTEM_NAME2} ) # only 32-bit at the moment
-  set( ANDROID_NDK_TOOLCHAINS_PATH "${ANDROID_NDK}/../../${ANDROID_NDK_HOST_SYSTEM_NAME}/toolchain" )
-  set( ANDROID_NDK_TOOLCHAINS_SUBPATH  "" )
-  set( ANDROID_NDK_TOOLCHAINS_SUBPATH2 "" )
- elseif( ANDROID_NDK_LAYOUT STREQUAL "ANDROID" )
-  set( ANDROID_NDK_HOST_SYSTEM_NAME ${ANDROID_NDK_HOST_SYSTEM_NAME2} ) # only 32-bit at the moment
-  set( ANDROID_NDK_TOOLCHAINS_PATH "${ANDROID_NDK}/../../gcc/${ANDROID_NDK_HOST_SYSTEM_NAME}/arm" )
-  set( ANDROID_NDK_TOOLCHAINS_SUBPATH  "" )
-  set( ANDROID_NDK_TOOLCHAINS_SUBPATH2 "" )
- else() # ANDROID_NDK_LAYOUT STREQUAL "RELEASE"
-  set( ANDROID_NDK_TOOLCHAINS_PATH "${ANDROID_NDK}/toolchains" )
-  set( ANDROID_NDK_TOOLCHAINS_SUBPATH  "/prebuilt/${ANDROID_NDK_HOST_SYSTEM_NAME}" )
-  set( ANDROID_NDK_TOOLCHAINS_SUBPATH2 "/prebuilt/${ANDROID_NDK_HOST_SYSTEM_NAME2}" )
- endif()
- get_filename_component( ANDROID_NDK_TOOLCHAINS_PATH "${ANDROID_NDK_TOOLCHAINS_PATH}" ABSOLUTE )
-
- # try to detect change of NDK
- if( CMAKE_AR )
-  string( LENGTH "${ANDROID_NDK_TOOLCHAINS_PATH}" __length )
-  string( SUBSTRING "${CMAKE_AR}" 0 ${__length} __androidNdkPreviousPath )
-  if( NOT __androidNdkPreviousPath STREQUAL ANDROID_NDK_TOOLCHAINS_PATH )
-   message( FATAL_ERROR "It is not possible to change the path to the NDK on subsequent CMake run. You must remove all generated files from your build folder first.
-   " )
-  endif()
-  unset( __androidNdkPreviousPath )
-  unset( __length )
- endif()
-endif()
-
-
-# get all the details about standalone toolchain
-if( BUILD_WITH_STANDALONE_TOOLCHAIN )
- __DETECT_NATIVE_API_LEVEL( ANDROID_SUPPORTED_NATIVE_API_LEVELS "${ANDROID_STANDALONE_TOOLCHAIN}/sysroot/usr/include/android/api-level.h" )
- set( ANDROID_STANDALONE_TOOLCHAIN_API_LEVEL ${ANDROID_SUPPORTED_NATIVE_API_LEVELS} )
- set( __availableToolchains "standalone" )
- __DETECT_TOOLCHAIN_MACHINE_NAME( __availableToolchainMachines "${ANDROID_STANDALONE_TOOLCHAIN}" )
- if( NOT __availableToolchainMachines )
-  message( FATAL_ERROR "Could not determine machine name of your toolchain. Probably your Android standalone toolchain is broken." )
- endif()
- if( __availableToolchainMachines MATCHES x86_64 )
-  set( __availableToolchainArchs "x86_64" )
- elseif( __availableToolchainMachines MATCHES i686 )
-  set( __availableToolchainArchs "x86" )
- elseif( __availableToolchainMachines MATCHES aarch64 )
-  set( __availableToolchainArchs "arm64" )
- elseif( __availableToolchainMachines MATCHES arm )
-  set( __availableToolchainArchs "arm" )
- elseif( __availableToolchainMachines MATCHES mips64el )
-  set( __availableToolchainArchs "mips64" )
- elseif( __availableToolchainMachines MATCHES mipsel )
-  set( __availableToolchainArchs "mips" )
- endif()
- execute_process( COMMAND "${ANDROID_STANDALONE_TOOLCHAIN}/bin/${__availableToolchainMachines}-gcc${TOOL_OS_SUFFIX}" -dumpversion
-                  OUTPUT_VARIABLE __availableToolchainCompilerVersions OUTPUT_STRIP_TRAILING_WHITESPACE )
- string( REGEX MATCH "[0-9]+[.][0-9]+([.][0-9]+)?" __availableToolchainCompilerVersions "${__availableToolchainCompilerVersions}" )
- if( EXISTS "${ANDROID_STANDALONE_TOOLCHAIN}/bin/clang${TOOL_OS_SUFFIX}" )
-  list( APPEND __availableToolchains "standalone-clang" )
-  list( APPEND __availableToolchainMachines ${__availableToolchainMachines} )
-  list( APPEND __availableToolchainArchs ${__availableToolchainArchs} )
-  list( APPEND __availableToolchainCompilerVersions ${__availableToolchainCompilerVersions} )
- endif()
-endif()
-
-macro( __GLOB_NDK_TOOLCHAINS __availableToolchainsVar __availableToolchainsLst __toolchain_subpath )
- foreach( __toolchain ${${__availableToolchainsLst}} )
-  if( "${__toolchain}" MATCHES "-clang3[.][0-9]$" AND NOT EXISTS "${ANDROID_NDK_TOOLCHAINS_PATH}/${__toolchain}${__toolchain_subpath}" )
-   SET( __toolchainVersionRegex "^TOOLCHAIN_VERSION[\t ]+:=[\t ]+(.*)$" )
-   FILE( STRINGS "${ANDROID_NDK_TOOLCHAINS_PATH}/${__toolchain}/setup.mk" __toolchainVersionStr REGEX "${__toolchainVersionRegex}" )
-   if( __toolchainVersionStr )
-    string( REGEX REPLACE "${__toolchainVersionRegex}" "\\1" __toolchainVersionStr "${__toolchainVersionStr}" )
-    string( REGEX REPLACE "-clang3[.][0-9]$" "-${__toolchainVersionStr}" __gcc_toolchain "${__toolchain}" )
-   else()
-    string( REGEX REPLACE "-clang3[.][0-9]$" "-4.6" __gcc_toolchain "${__toolchain}" )
-   endif()
-   unset( __toolchainVersionStr )
-   unset( __toolchainVersionRegex )
-  else()
-   set( __gcc_toolchain "${__toolchain}" )
-  endif()
-  __DETECT_TOOLCHAIN_MACHINE_NAME( __machine "${ANDROID_NDK_TOOLCHAINS_PATH}/${__gcc_toolchain}${__toolchain_subpath}" )
-  if( __machine )
-   string( REGEX MATCH "[0-9]+[.][0-9]+([.][0-9x]+)?$" __version "${__gcc_toolchain}" )
-   if( __machine MATCHES x86_64 )
-    set( __arch "x86_64" )
-   elseif( __machine MATCHES i686 )
-    set( __arch "x86" )
-   elseif( __machine MATCHES aarch64 )
-    set( __arch "arm64" )
-   elseif( __machine MATCHES arm )
-    set( __arch "arm" )
-   elseif( __machine MATCHES mips64el )
-    set( __arch "mips64" )
-   elseif( __machine MATCHES mipsel )
-    set( __arch "mips" )
-   else()
-    set( __arch "" )
-   endif()
-   #message("machine: !${__machine}!\narch: !${__arch}!\nversion: !${__version}!\ntoolchain: !${__toolchain}!\n")
-   if (__arch)
-    list( APPEND __availableToolchainMachines "${__machine}" )
-    list( APPEND __availableToolchainArchs "${__arch}" )
-    list( APPEND __availableToolchainCompilerVersions "${__version}" )
-    list( APPEND ${__availableToolchainsVar} "${__toolchain}" )
-   endif()
-  endif()
-  unset( __gcc_toolchain )
- endforeach()
-endmacro()
-
-# get all the details about NDK
-if( BUILD_WITH_ANDROID_NDK )
- file( GLOB ANDROID_SUPPORTED_NATIVE_API_LEVELS RELATIVE "${ANDROID_NDK}/platforms" "${ANDROID_NDK}/platforms/android-*" )
- string( REPLACE "android-" "" ANDROID_SUPPORTED_NATIVE_API_LEVELS "${ANDROID_SUPPORTED_NATIVE_API_LEVELS}" )
- set( __availableToolchains "" )
- set( __availableToolchainMachines "" )
- set( __availableToolchainArchs "" )
- set( __availableToolchainCompilerVersions "" )
- if( ANDROID_TOOLCHAIN_NAME AND EXISTS "${ANDROID_NDK_TOOLCHAINS_PATH}/${ANDROID_TOOLCHAIN_NAME}/" )
-  # do not go through all toolchains if we know the name
-  set( __availableToolchainsLst "${ANDROID_TOOLCHAIN_NAME}" )
-  __GLOB_NDK_TOOLCHAINS( __availableToolchains __availableToolchainsLst "${ANDROID_NDK_TOOLCHAINS_SUBPATH}" )
-  if( NOT __availableToolchains AND NOT ANDROID_NDK_TOOLCHAINS_SUBPATH STREQUAL ANDROID_NDK_TOOLCHAINS_SUBPATH2 )
-   __GLOB_NDK_TOOLCHAINS( __availableToolchains __availableToolchainsLst "${ANDROID_NDK_TOOLCHAINS_SUBPATH2}" )
-   if( __availableToolchains )
-    set( ANDROID_NDK_TOOLCHAINS_SUBPATH ${ANDROID_NDK_TOOLCHAINS_SUBPATH2} )
-   endif()
-  endif()
- endif()
- if( NOT __availableToolchains )
-  file( GLOB __availableToolchainsLst RELATIVE "${ANDROID_NDK_TOOLCHAINS_PATH}" "${ANDROID_NDK_TOOLCHAINS_PATH}/*" )
-  # Atomic: bug fix - remove redundant if check which prevented the sort to take place
-  list(SORT __availableToolchainsLst) # we need clang to go after gcc
-  __LIST_FILTER( __availableToolchainsLst "^[.]" )
-  __LIST_FILTER( __availableToolchainsLst "llvm" )
-  __LIST_FILTER( __availableToolchainsLst "renderscript" )
-  __GLOB_NDK_TOOLCHAINS( __availableToolchains __availableToolchainsLst "${ANDROID_NDK_TOOLCHAINS_SUBPATH}" )
-  if( NOT __availableToolchains AND NOT ANDROID_NDK_TOOLCHAINS_SUBPATH STREQUAL ANDROID_NDK_TOOLCHAINS_SUBPATH2 )
-   __GLOB_NDK_TOOLCHAINS( __availableToolchains __availableToolchainsLst "${ANDROID_NDK_TOOLCHAINS_SUBPATH2}" )
-   if( __availableToolchains )
-    set( ANDROID_NDK_TOOLCHAINS_SUBPATH ${ANDROID_NDK_TOOLCHAINS_SUBPATH2} )
-   endif()
-  endif()
- endif()
- if( NOT __availableToolchains )
-  message( FATAL_ERROR "Could not find any working toolchain in the NDK. Probably your Android NDK is broken." )
- endif()
-endif()
-
-# build list of available ABIs
-set( ANDROID_SUPPORTED_ABIS "" )
-set( __uniqToolchainArchNames ${__availableToolchainArchs} )
-list( REMOVE_DUPLICATES __uniqToolchainArchNames )
-list( SORT __uniqToolchainArchNames )
-foreach( __arch ${__uniqToolchainArchNames} )
- list( APPEND ANDROID_SUPPORTED_ABIS ${ANDROID_SUPPORTED_ABIS_${__arch}} )
-endforeach()
-unset( __uniqToolchainArchNames )
-if( NOT ANDROID_SUPPORTED_ABIS )
- message( FATAL_ERROR "No one of known Android ABIs is supported by this cmake toolchain." )
-endif()
-
-# choose target ABI
-__INIT_VARIABLE( ANDROID_ABI OBSOLETE_ARM_TARGET OBSOLETE_ARM_TARGETS VALUES ${ANDROID_SUPPORTED_ABIS} )
-# verify that target ABI is supported
-list( FIND ANDROID_SUPPORTED_ABIS "${ANDROID_ABI}" __androidAbiIdx )
-if( __androidAbiIdx EQUAL -1 )
- string( REPLACE ";" "\", \"" PRINTABLE_ANDROID_SUPPORTED_ABIS  "${ANDROID_SUPPORTED_ABIS}" )
- message( FATAL_ERROR "Specified ANDROID_ABI = \"${ANDROID_ABI}\" is not supported by this cmake toolchain or your NDK/toolchain.
-   Supported values are: \"${PRINTABLE_ANDROID_SUPPORTED_ABIS}\"
-   " )
-endif()
-unset( __androidAbiIdx )
-
-# set target ABI options
-if( ANDROID_ABI STREQUAL "x86" )
- set( X86 true )
- set( ANDROID_NDK_ABI_NAME "x86" )
- set( ANDROID_ARCH_NAME "x86" )
- set( ANDROID_LLVM_TRIPLE "i686-none-linux-android" )
- set( CMAKE_SYSTEM_PROCESSOR "i686" )
-elseif( ANDROID_ABI STREQUAL "x86_64" )
- set( X86 true )
- set( X86_64 true )
- set( ANDROID_NDK_ABI_NAME "x86_64" )
- set( ANDROID_ARCH_NAME "x86_64" )
- set( CMAKE_SYSTEM_PROCESSOR "x86_64" )
- set( ANDROID_LLVM_TRIPLE "x86_64-none-linux-android" )
-elseif( ANDROID_ABI STREQUAL "mips64" )
- set( MIPS64 true )
- set( ANDROID_NDK_ABI_NAME "mips64" )
- set( ANDROID_ARCH_NAME "mips64" )
- set( ANDROID_LLVM_TRIPLE "mips64el-none-linux-android" )
- set( CMAKE_SYSTEM_PROCESSOR "mips64" )
-elseif( ANDROID_ABI STREQUAL "mips" )
- set( MIPS true )
- set( ANDROID_NDK_ABI_NAME "mips" )
- set( ANDROID_ARCH_NAME "mips" )
- set( ANDROID_LLVM_TRIPLE "mipsel-none-linux-android" )
- set( CMAKE_SYSTEM_PROCESSOR "mips" )
-elseif( ANDROID_ABI STREQUAL "arm64-v8a" )
- set( ARM64_V8A true )
- set( ANDROID_NDK_ABI_NAME "arm64-v8a" )
- set( ANDROID_ARCH_NAME "arm64" )
- set( ANDROID_LLVM_TRIPLE "aarch64-none-linux-android" )
- set( CMAKE_SYSTEM_PROCESSOR "aarch64" )
- set( VFPV3 true )
- set( NEON true )
-elseif( ANDROID_ABI STREQUAL "armeabi" )
- set( ARMEABI true )
- set( ANDROID_NDK_ABI_NAME "armeabi" )
- set( ANDROID_ARCH_NAME "arm" )
- set( ANDROID_LLVM_TRIPLE "armv5te-none-linux-androideabi" )
- set( CMAKE_SYSTEM_PROCESSOR "armv5te" )
-elseif( ANDROID_ABI STREQUAL "armeabi-v6 with VFP" )
- set( ARMEABI_V6 true )
- set( ANDROID_NDK_ABI_NAME "armeabi" )
- set( ANDROID_ARCH_NAME "arm" )
- set( ANDROID_LLVM_TRIPLE "armv5te-none-linux-androideabi" )
- set( CMAKE_SYSTEM_PROCESSOR "armv6" )
- # need always fallback to older platform
- set( ARMEABI true )
-elseif( ANDROID_ABI STREQUAL "armeabi-v7a")
- set( ARMEABI_V7A true )
- set( ANDROID_NDK_ABI_NAME "armeabi-v7a" )
- set( ANDROID_ARCH_NAME "arm" )
- set( ANDROID_LLVM_TRIPLE "armv7-none-linux-androideabi" )
- set( CMAKE_SYSTEM_PROCESSOR "armv7-a" )
-elseif( ANDROID_ABI STREQUAL "armeabi-v7a with VFPV3" )
- set( ARMEABI_V7A true )
- set( ANDROID_NDK_ABI_NAME "armeabi-v7a" )
- set( ANDROID_ARCH_NAME "arm" )
- set( ANDROID_LLVM_TRIPLE "armv7-none-linux-androideabi" )
- set( CMAKE_SYSTEM_PROCESSOR "armv7-a" )
- set( VFPV3 true )
-elseif( ANDROID_ABI STREQUAL "armeabi-v7a with NEON" )
- set( ARMEABI_V7A true )
- set( ANDROID_NDK_ABI_NAME "armeabi-v7a" )
- set( ANDROID_ARCH_NAME "arm" )
- set( ANDROID_LLVM_TRIPLE "armv7-none-linux-androideabi" )
- set( CMAKE_SYSTEM_PROCESSOR "armv7-a" )
- set( VFPV3 true )
- set( NEON true )
-else()
- message( SEND_ERROR "Unknown ANDROID_ABI=\"${ANDROID_ABI}\" is specified." )
-endif()
-
-if( CMAKE_BINARY_DIR AND EXISTS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeSystem.cmake" )
- # really dirty hack
- # it is not possible to change CMAKE_SYSTEM_PROCESSOR after the first run...
- file( APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeSystem.cmake" "SET(CMAKE_SYSTEM_PROCESSOR \"${CMAKE_SYSTEM_PROCESSOR}\")\n" )
-endif()
-
-if( ANDROID_ARCH_NAME STREQUAL "arm" AND NOT ARMEABI_V6 )
- __INIT_VARIABLE( ANDROID_FORCE_ARM_BUILD OBSOLETE_FORCE_ARM VALUES OFF )
- set( ANDROID_FORCE_ARM_BUILD ${ANDROID_FORCE_ARM_BUILD} CACHE BOOL "Use 32-bit ARM instructions instead of Thumb-1" FORCE )
- mark_as_advanced( ANDROID_FORCE_ARM_BUILD )
-else()
- unset( ANDROID_FORCE_ARM_BUILD CACHE )
-endif()
-
-# choose toolchain
-if( ANDROID_TOOLCHAIN_NAME )
- list( FIND __availableToolchains "${ANDROID_TOOLCHAIN_NAME}" __toolchainIdx )
- if( __toolchainIdx EQUAL -1 )
-  list( SORT __availableToolchains )
-  string( REPLACE ";" "\n  * " toolchains_list "${__availableToolchains}" )
-  set( toolchains_list "  * ${toolchains_list}")
-  message( FATAL_ERROR "Specified toolchain \"${ANDROID_TOOLCHAIN_NAME}\" is missing in your NDK or broken. Please verify that your NDK is working or select another compiler toolchain.
-To configure the toolchain set CMake variable ANDROID_TOOLCHAIN_NAME to one of the following values:\n${toolchains_list}\n" )
- endif()
- list( GET __availableToolchainArchs ${__toolchainIdx} __toolchainArch )
- if( NOT __toolchainArch STREQUAL ANDROID_ARCH_NAME )
-  message( SEND_ERROR "Selected toolchain \"${ANDROID_TOOLCHAIN_NAME}\" is not able to compile binaries for the \"${ANDROID_ARCH_NAME}\" platform." )
- endif()
-else()
- set( __toolchainIdx -1 )
- set( __applicableToolchains "" )
- set( __toolchainMaxVersion "0.0.0" )
- list( LENGTH __availableToolchains __availableToolchainsCount )
- math( EXPR __availableToolchainsCount "${__availableToolchainsCount}-1" )
- foreach( __idx RANGE ${__availableToolchainsCount} )
-  list( GET __availableToolchainArchs ${__idx} __toolchainArch )
-  if( __toolchainArch STREQUAL ANDROID_ARCH_NAME )
-   list( GET __availableToolchainCompilerVersions ${__idx} __toolchainVersion )
-   string( REPLACE "x" "99" __toolchainVersion "${__toolchainVersion}")
-   if( __toolchainVersion VERSION_GREATER __toolchainMaxVersion )
-    set( __toolchainMaxVersion "${__toolchainVersion}" )
-    set( __toolchainIdx ${__idx} )
-   endif()
-  endif()
- endforeach()
- unset( __availableToolchainsCount )
- unset( __toolchainMaxVersion )
- unset( __toolchainVersion )
-endif()
-unset( __toolchainArch )
-if( __toolchainIdx EQUAL -1 )
- message( FATAL_ERROR "No one of available compiler toolchains is able to compile for ${ANDROID_ARCH_NAME} platform." )
-endif()
-list( GET __availableToolchains ${__toolchainIdx} ANDROID_TOOLCHAIN_NAME )
-list( GET __availableToolchainMachines ${__toolchainIdx} ANDROID_TOOLCHAIN_MACHINE_NAME )
-list( GET __availableToolchainCompilerVersions ${__toolchainIdx} ANDROID_COMPILER_VERSION )
-
-unset( __toolchainIdx )
-unset( __availableToolchains )
-unset( __availableToolchainMachines )
-unset( __availableToolchainArchs )
-unset( __availableToolchainCompilerVersions )
-
-# choose native API level
-__INIT_VARIABLE( ANDROID_NATIVE_API_LEVEL ENV_ANDROID_NATIVE_API_LEVEL ANDROID_API_LEVEL ENV_ANDROID_API_LEVEL ANDROID_STANDALONE_TOOLCHAIN_API_LEVEL ANDROID_DEFAULT_NDK_API_LEVEL_${ANDROID_ARCH_NAME} ANDROID_DEFAULT_NDK_API_LEVEL )
-string( REPLACE "android-" "" ANDROID_NATIVE_API_LEVEL "${ANDROID_NATIVE_API_LEVEL}" )
-string( STRIP "${ANDROID_NATIVE_API_LEVEL}" ANDROID_NATIVE_API_LEVEL )
-# adjust API level
-set( __real_api_level ${ANDROID_DEFAULT_NDK_API_LEVEL_${ANDROID_ARCH_NAME}} )
-foreach( __level ${ANDROID_SUPPORTED_NATIVE_API_LEVELS} )
- if( (__level LESS ANDROID_NATIVE_API_LEVEL OR __level STREQUAL ANDROID_NATIVE_API_LEVEL) AND NOT __level LESS __real_api_level )
-  set( __real_api_level ${__level} )
- endif()
-endforeach()
-if( __real_api_level AND NOT ANDROID_NATIVE_API_LEVEL STREQUAL __real_api_level )
- message( STATUS "Adjusting Android API level 'android-${ANDROID_NATIVE_API_LEVEL}' to 'android-${__real_api_level}'")
- set( ANDROID_NATIVE_API_LEVEL ${__real_api_level} )
-endif()
-unset(__real_api_level)
-# validate
-list( FIND ANDROID_SUPPORTED_NATIVE_API_LEVELS "${ANDROID_NATIVE_API_LEVEL}" __levelIdx )
-if( __levelIdx EQUAL -1 )
- message( SEND_ERROR "Specified Android native API level 'android-${ANDROID_NATIVE_API_LEVEL}' is not supported by your NDK/toolchain." )
-else()
- if( BUILD_WITH_ANDROID_NDK )
-  __DETECT_NATIVE_API_LEVEL( __realApiLevel "${ANDROID_NDK}/platforms/android-${ANDROID_NATIVE_API_LEVEL}/arch-${ANDROID_ARCH_NAME}/usr/include/android/api-level.h" )
-  if( NOT __realApiLevel EQUAL ANDROID_NATIVE_API_LEVEL AND NOT __realApiLevel GREATER 9000 )
-   message( SEND_ERROR "Specified Android API level (${ANDROID_NATIVE_API_LEVEL}) does not match to the level found (${__realApiLevel}). Probably your copy of NDK is broken." )
-  endif()
-  unset( __realApiLevel )
- endif()
- set( ANDROID_NATIVE_API_LEVEL "${ANDROID_NATIVE_API_LEVEL}" CACHE STRING "Android API level for native code" FORCE )
- # Atomic: Sort in numerical order instead of alphabetical order
- if( CMAKE_VERSION VERSION_GREATER 2.8 OR CMAKE_VERSION VERSION_EQUAL 2.8 )  # Feature avaiable starting from CMake 2.8
-  string(REGEX REPLACE ";([1-9]);" ";0\\1;" PADDED_ANDROID_SUPPORTED_NATIVE_API_LEVELS ";${ANDROID_SUPPORTED_NATIVE_API_LEVELS};")
-  string(REGEX REPLACE ";([1-9]);" ";0\\1;" PADDED_ANDROID_SUPPORTED_NATIVE_API_LEVELS "${PADDED_ANDROID_SUPPORTED_NATIVE_API_LEVELS}")
-  list( SORT PADDED_ANDROID_SUPPORTED_NATIVE_API_LEVELS )
-  string(REGEX REPLACE ";0([1-9]);" ";\\1;" PADDED_ANDROID_SUPPORTED_NATIVE_API_LEVELS "${PADDED_ANDROID_SUPPORTED_NATIVE_API_LEVELS}")
-  string(REGEX REPLACE ";0([1-9]);" ";\\1;" PADDED_ANDROID_SUPPORTED_NATIVE_API_LEVELS "${PADDED_ANDROID_SUPPORTED_NATIVE_API_LEVELS}")
-  set_property( CACHE ANDROID_NATIVE_API_LEVEL PROPERTY STRINGS ${PADDED_ANDROID_SUPPORTED_NATIVE_API_LEVELS} )
- endif()
-endif()
-unset( __levelIdx )
-
-
-# remember target ABI
-set( ANDROID_ABI "${ANDROID_ABI}" CACHE STRING "The target ABI for Android. If arm, then armeabi-v7a is recommended for hardware floating point." FORCE )
-# Atomic: fix to present the full list of supported ABIs initially
-if( CMAKE_VERSION VERSION_GREATER 2.8 OR CMAKE_VERSION VERSION_EQUAL 2.8 )
- list( SORT ANDROID_SUPPORTED_ABIS )
- set_property( CACHE ANDROID_ABI PROPERTY STRINGS ${ANDROID_SUPPORTED_ABIS} )
-endif()
-
-
-# runtime choice (STL, rtti, exceptions)
-if( NOT ANDROID_STL )
- # honor legacy ANDROID_USE_STLPORT
- if( DEFINED ANDROID_USE_STLPORT )
-  if( ANDROID_USE_STLPORT )
-   set( ANDROID_STL stlport_static )
-  endif()
-  message( WARNING "You are using an obsolete variable ANDROID_USE_STLPORT to select the STL variant. Use -DANDROID_STL=stlport_static instead." )
- endif()
- if( NOT ANDROID_STL )
-  set( ANDROID_STL gnustl_static )
- endif()
-endif()
-set( ANDROID_STL "${ANDROID_STL}" CACHE STRING "C++ runtime" )
-set( ANDROID_STL_FORCE_FEATURES ON CACHE BOOL "automatically configure rtti and exceptions support based on C++ runtime" )
-mark_as_advanced( ANDROID_STL ANDROID_STL_FORCE_FEATURES )
-
-if( BUILD_WITH_ANDROID_NDK )
- if( NOT "${ANDROID_STL}" MATCHES "^(none|system|system_re|gabi\\+\\+_static|gabi\\+\\+_shared|stlport_static|stlport_shared|gnustl_static|gnustl_shared)$")
-  message( FATAL_ERROR "ANDROID_STL is set to invalid value \"${ANDROID_STL}\".
-The possible values are:
-  none           -> Do not configure the runtime.
-  system         -> Use the default minimal system C++ runtime library.
-  system_re      -> Same as system but with rtti and exceptions.
-  gabi++_static  -> Use the GAbi++ runtime as a static library.
-  gabi++_shared  -> Use the GAbi++ runtime as a shared library.
-  stlport_static -> Use the STLport runtime as a static library.
-  stlport_shared -> Use the STLport runtime as a shared library.
-  gnustl_static  -> (default) Use the GNU STL as a static library.
-  gnustl_shared  -> Use the GNU STL as a shared library.
-" )
- endif()
-elseif( BUILD_WITH_STANDALONE_TOOLCHAIN )
- if( NOT "${ANDROID_STL}" MATCHES "^(none|gnustl_static|gnustl_shared)$")
-  message( FATAL_ERROR "ANDROID_STL is set to invalid value \"${ANDROID_STL}\".
-The possible values are:
-  none           -> Do not configure the runtime.
-  gnustl_static  -> (default) Use the GNU STL as a static library.
-  gnustl_shared  -> Use the GNU STL as a shared library.
-" )
- endif()
-endif()
-
-unset( ANDROID_RTTI )
-unset( ANDROID_EXCEPTIONS )
-unset( ANDROID_STL_INCLUDE_DIRS )
-unset( __libstl )
-unset( __libsupcxx )
-
-if( NOT _CMAKE_IN_TRY_COMPILE AND ANDROID_NDK_RELEASE STREQUAL "r7b" AND ARMEABI_V7A AND NOT VFPV3 AND ANDROID_STL MATCHES "gnustl" )
- message( WARNING  "The GNU STL armeabi-v7a binaries from NDK r7b can crash non-NEON devices. The files provided with NDK r7b were not configured properly, resulting in crashes on Tegra2-based devices and others when trying to use certain floating-point functions (e.g., cosf, sinf, expf).
-You are strongly recommended to switch to another NDK release.
-" )
-endif()
-
-if( NOT _CMAKE_IN_TRY_COMPILE AND X86 AND ANDROID_STL MATCHES "gnustl" AND ANDROID_NDK_RELEASE STREQUAL "r6" )
-  message( WARNING  "The x86 system header file from NDK r6 has incorrect definition for ptrdiff_t. You are recommended to upgrade to a newer NDK release or manually patch the header:
-See https://android.googlesource.com/platform/development.git f907f4f9d4e56ccc8093df6fee54454b8bcab6c2
-  diff --git a/ndk/platforms/android-9/arch-x86/include/machine/_types.h b/ndk/platforms/android-9/arch-x86/include/machine/_types.h
-  index 5e28c64..65892a1 100644
-  --- a/ndk/platforms/android-9/arch-x86/include/machine/_types.h
-  +++ b/ndk/platforms/android-9/arch-x86/include/machine/_types.h
-  @@ -51,7 +51,11 @@ typedef long int       ssize_t;
-   #endif
-   #ifndef _PTRDIFF_T
-   #define _PTRDIFF_T
-  -typedef long           ptrdiff_t;
-  +#  ifdef __ANDROID__
-  +     typedef int            ptrdiff_t;
-  +#  else
-  +     typedef long           ptrdiff_t;
-  +#  endif
-   #endif
-" )
-endif()
-
-
-# setup paths and STL for standalone toolchain
-if( BUILD_WITH_STANDALONE_TOOLCHAIN )
- set( ANDROID_TOOLCHAIN_ROOT "${ANDROID_STANDALONE_TOOLCHAIN}" )
- set( ANDROID_CLANG_TOOLCHAIN_ROOT "${ANDROID_STANDALONE_TOOLCHAIN}" )
- set( ANDROID_SYSROOT "${ANDROID_STANDALONE_TOOLCHAIN}/sysroot" )
-
- if( NOT ANDROID_STL STREQUAL "none" )
-  set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_STANDALONE_TOOLCHAIN}/include/c++/${ANDROID_COMPILER_VERSION}" )
-  if( NOT EXISTS "${ANDROID_STL_INCLUDE_DIRS}" )
-   # old location ( pre r8c )
-   set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_STANDALONE_TOOLCHAIN}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/include/c++/${ANDROID_COMPILER_VERSION}" )
-  endif()
-  if( ARMEABI_V7A AND EXISTS "${ANDROID_STL_INCLUDE_DIRS}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/${CMAKE_SYSTEM_PROCESSOR}/bits" )
-   list( APPEND ANDROID_STL_INCLUDE_DIRS "${ANDROID_STL_INCLUDE_DIRS}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/${CMAKE_SYSTEM_PROCESSOR}" )
-  elseif( ARMEABI AND NOT ANDROID_FORCE_ARM_BUILD AND EXISTS "${ANDROID_STL_INCLUDE_DIRS}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/thumb/bits" )
-   list( APPEND ANDROID_STL_INCLUDE_DIRS "${ANDROID_STL_INCLUDE_DIRS}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/thumb" )
-  else()
-   list( APPEND ANDROID_STL_INCLUDE_DIRS "${ANDROID_STL_INCLUDE_DIRS}/${ANDROID_TOOLCHAIN_MACHINE_NAME}" )
-  endif()
-  # always search static GNU STL to get the location of libsupc++.a
-  if( ARMEABI_V7A AND NOT ANDROID_FORCE_ARM_BUILD AND EXISTS "${ANDROID_STANDALONE_TOOLCHAIN}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/${CMAKE_SYSTEM_PROCESSOR}/thumb/libstdc++.a" )
-   set( __libstl "${ANDROID_STANDALONE_TOOLCHAIN}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/${CMAKE_SYSTEM_PROCESSOR}/thumb" )
-  elseif( ARMEABI_V7A AND EXISTS "${ANDROID_STANDALONE_TOOLCHAIN}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/${CMAKE_SYSTEM_PROCESSOR}/libstdc++.a" )
-   set( __libstl "${ANDROID_STANDALONE_TOOLCHAIN}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/${CMAKE_SYSTEM_PROCESSOR}" )
-  elseif( ARMEABI AND NOT ANDROID_FORCE_ARM_BUILD AND EXISTS "${ANDROID_STANDALONE_TOOLCHAIN}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/thumb/libstdc++.a" )
-   set( __libstl "${ANDROID_STANDALONE_TOOLCHAIN}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/thumb" )
-  elseif( EXISTS "${ANDROID_STANDALONE_TOOLCHAIN}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/libstdc++.a" )
-   set( __libstl "${ANDROID_STANDALONE_TOOLCHAIN}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib" )
-  endif()
-  if( __libstl )
-   set( __libsupcxx "${__libstl}/libsupc++.a" )
-   set( __libstl    "${__libstl}/libstdc++.a" )
-  endif()
-  if( NOT EXISTS "${__libsupcxx}" )
-   message( FATAL_ERROR "The required libstdsupc++.a is missing in your standalone toolchain.
- Usually it happens because of bug in make-standalone-toolchain.sh script from NDK r7, r7b and r7c.
- You need to either upgrade to newer NDK or manually copy
-     $ANDROID_NDK/sources/cxx-stl/gnu-libstdc++/libs/${ANDROID_NDK_ABI_NAME}/libsupc++.a
- to
-     ${__libsupcxx}
-   " )
-  endif()
-  if( ANDROID_STL STREQUAL "gnustl_shared" )
-   if( ARMEABI_V7A AND EXISTS "${ANDROID_STANDALONE_TOOLCHAIN}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/${CMAKE_SYSTEM_PROCESSOR}/libgnustl_shared.so" )
-    set( __libstl "${ANDROID_STANDALONE_TOOLCHAIN}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/${CMAKE_SYSTEM_PROCESSOR}/libgnustl_shared.so" )
-   elseif( ARMEABI AND NOT ANDROID_FORCE_ARM_BUILD AND EXISTS "${ANDROID_STANDALONE_TOOLCHAIN}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/thumb/libgnustl_shared.so" )
-    set( __libstl "${ANDROID_STANDALONE_TOOLCHAIN}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/thumb/libgnustl_shared.so" )
-   elseif( EXISTS "${ANDROID_STANDALONE_TOOLCHAIN}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/libgnustl_shared.so" )
-    set( __libstl "${ANDROID_STANDALONE_TOOLCHAIN}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/libgnustl_shared.so" )
-   endif()
-  endif()
- endif()
-endif()
-
-# clang
-if( "${ANDROID_TOOLCHAIN_NAME}" STREQUAL "standalone-clang" )
- set( ANDROID_COMPILER_IS_CLANG 1 )
- execute_process( COMMAND "${ANDROID_CLANG_TOOLCHAIN_ROOT}/bin/clang${TOOL_OS_SUFFIX}" --version OUTPUT_VARIABLE ANDROID_CLANG_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE )
- string( REGEX MATCH "[0-9]+[.][0-9]+" ANDROID_CLANG_VERSION "${ANDROID_CLANG_VERSION}")
-elseif( "${ANDROID_TOOLCHAIN_NAME}" MATCHES "-clang3[.][0-9]?$" )
- string( REGEX MATCH "3[.][0-9]$" ANDROID_CLANG_VERSION "${ANDROID_TOOLCHAIN_NAME}")
- string( REGEX REPLACE "-clang${ANDROID_CLANG_VERSION}$" "-${ANDROID_COMPILER_VERSION}" ANDROID_GCC_TOOLCHAIN_NAME "${ANDROID_TOOLCHAIN_NAME}" )
- if( NOT EXISTS "${ANDROID_NDK_TOOLCHAINS_PATH}/llvm-${ANDROID_CLANG_VERSION}${ANDROID_NDK_TOOLCHAINS_SUBPATH}/bin/clang${TOOL_OS_SUFFIX}" )
-  message( FATAL_ERROR "Could not find the Clang compiler driver" )
- endif()
- set( ANDROID_COMPILER_IS_CLANG 1 )
- set( ANDROID_CLANG_TOOLCHAIN_ROOT "${ANDROID_NDK_TOOLCHAINS_PATH}/llvm-${ANDROID_CLANG_VERSION}${ANDROID_NDK_TOOLCHAINS_SUBPATH}" )
-else()
- set( ANDROID_GCC_TOOLCHAIN_NAME "${ANDROID_TOOLCHAIN_NAME}" )
- unset( ANDROID_COMPILER_IS_CLANG CACHE )
-endif()
-
-string( REPLACE "." "" _clang_name "clang${ANDROID_CLANG_VERSION}" )
-if( NOT EXISTS "${ANDROID_CLANG_TOOLCHAIN_ROOT}/bin/${_clang_name}${TOOL_OS_SUFFIX}" )
- set( _clang_name "clang" )
-endif()
-
-
-# setup paths and STL for NDK
-if( BUILD_WITH_ANDROID_NDK )
- set( ANDROID_TOOLCHAIN_ROOT "${ANDROID_NDK_TOOLCHAINS_PATH}/${ANDROID_GCC_TOOLCHAIN_NAME}${ANDROID_NDK_TOOLCHAINS_SUBPATH}" )
- set( ANDROID_SYSROOT "${ANDROID_NDK}/platforms/android-${ANDROID_NATIVE_API_LEVEL}/arch-${ANDROID_ARCH_NAME}" )
-
- if( ANDROID_STL STREQUAL "none" )
-  # do nothing
- elseif( ANDROID_STL STREQUAL "system" )
-  set( ANDROID_RTTI             OFF )
-  set( ANDROID_EXCEPTIONS       OFF )
-  set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_NDK}/sources/cxx-stl/system/include" )
- elseif( ANDROID_STL STREQUAL "system_re" )
-  set( ANDROID_RTTI             ON )
-  set( ANDROID_EXCEPTIONS       ON )
-  set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_NDK}/sources/cxx-stl/system/include" )
- elseif( ANDROID_STL MATCHES "gabi" )
-  if( ANDROID_NDK_RELEASE_NUM LESS 7000 ) # before r7
-   message( FATAL_ERROR "gabi++ is not awailable in your NDK. You have to upgrade to NDK r7 or newer to use gabi++.")
-  endif()
-  set( ANDROID_RTTI             ON )
-  set( ANDROID_EXCEPTIONS       OFF )
-  set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_NDK}/sources/cxx-stl/gabi++/include" )
-  set( __libstl                 "${ANDROID_NDK}/sources/cxx-stl/gabi++/libs/${ANDROID_NDK_ABI_NAME}/libgabi++_static.a" )
- elseif( ANDROID_STL MATCHES "stlport" )
-  if( NOT ANDROID_NDK_RELEASE_NUM LESS 8004 ) # before r8d
-   set( ANDROID_EXCEPTIONS       ON )
-  else()
-   set( ANDROID_EXCEPTIONS       OFF )
-  endif()
-  if( ANDROID_NDK_RELEASE_NUM LESS 7000 ) # before r7
-   set( ANDROID_RTTI            OFF )
-  else()
-   set( ANDROID_RTTI            ON )
-  endif()
-  set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_NDK}/sources/cxx-stl/stlport/stlport" )
-  set( __libstl                 "${ANDROID_NDK}/sources/cxx-stl/stlport/libs/${ANDROID_NDK_ABI_NAME}/libstlport_static.a" )
- elseif( ANDROID_STL MATCHES "gnustl" )
-  set( ANDROID_EXCEPTIONS       ON )
-  set( ANDROID_RTTI             ON )
-  if( EXISTS "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/${ANDROID_COMPILER_VERSION}" )
-   if( ARMEABI_V7A AND ANDROID_COMPILER_VERSION VERSION_EQUAL "4.7" AND ANDROID_NDK_RELEASE STREQUAL "r8d" )
-    # gnustl binary for 4.7 compiler is buggy :(
-    # TODO: look for right fix
-    set( __libstl                "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/4.6" )
-   else()
-    set( __libstl                "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/${ANDROID_COMPILER_VERSION}" )
-   endif()
-  else()
-   set( __libstl                "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++" )
-  endif()
-  set( ANDROID_STL_INCLUDE_DIRS "${__libstl}/include" "${__libstl}/libs/${ANDROID_NDK_ABI_NAME}/include" "${__libstl}/include/backward" )
-  if( EXISTS "${__libstl}/libs/${ANDROID_NDK_ABI_NAME}/libgnustl_static.a" )
-   set( __libstl                "${__libstl}/libs/${ANDROID_NDK_ABI_NAME}/libgnustl_static.a" )
-  else()
-   set( __libstl                "${__libstl}/libs/${ANDROID_NDK_ABI_NAME}/libstdc++.a" )
-  endif()
- else()
-  message( FATAL_ERROR "Unknown runtime: ${ANDROID_STL}" )
- endif()
- # find libsupc++.a - rtti & exceptions
- if( ANDROID_STL STREQUAL "system_re" OR ANDROID_STL MATCHES "gnustl" )
-  set( __libsupcxx "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/${ANDROID_COMPILER_VERSION}/libs/${ANDROID_NDK_ABI_NAME}/libsupc++.a" ) # r8b or newer
-  if( NOT EXISTS "${__libsupcxx}" )
-   set( __libsupcxx "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/libs/${ANDROID_NDK_ABI_NAME}/libsupc++.a" ) # r7-r8
-  endif()
-  if( NOT EXISTS "${__libsupcxx}" ) # before r7
-   if( ARMEABI_V7A )
-    if( ANDROID_FORCE_ARM_BUILD )
-     set( __libsupcxx "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/${CMAKE_SYSTEM_PROCESSOR}/libsupc++.a" )
-    else()
-     set( __libsupcxx "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/${CMAKE_SYSTEM_PROCESSOR}/thumb/libsupc++.a" )
-    endif()
-   elseif( ARMEABI AND NOT ANDROID_FORCE_ARM_BUILD )
-    set( __libsupcxx "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/thumb/libsupc++.a" )
-   else()
-    set( __libsupcxx "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/libsupc++.a" )
-   endif()
-  endif()
-  if( NOT EXISTS "${__libsupcxx}")
-   message( ERROR "Could not find libsupc++.a for a chosen platform. Either your NDK is not supported or is broken.")
-  endif()
- endif()
-endif()
-
-
-# case of shared STL linkage
-if( ANDROID_STL MATCHES "shared" AND DEFINED __libstl )
- string( REPLACE "_static.a" "_shared.so" __libstl "${__libstl}" )
- # TODO: check if .so file exists before the renaming
-endif()
-
-
-# ccache support
-__INIT_VARIABLE( _ndk_ccache NDK_CCACHE ENV_NDK_CCACHE )
-if( _ndk_ccache )
- if( DEFINED NDK_CCACHE AND NOT EXISTS NDK_CCACHE )
-  unset( NDK_CCACHE CACHE )
- endif()
- find_program( NDK_CCACHE "${_ndk_ccache}" DOC "The path to ccache binary")
-else()
- unset( NDK_CCACHE CACHE )
-endif()
-unset( _ndk_ccache )
-
-
-# setup the cross-compiler
-if( NOT CMAKE_C_COMPILER )
- if( NDK_CCACHE AND NOT ANDROID_SYSROOT MATCHES "[ ;\"]" )
-  set( CMAKE_C_COMPILER   "${NDK_CCACHE}" CACHE PATH "ccache as C compiler" )
-  set( CMAKE_CXX_COMPILER "${NDK_CCACHE}" CACHE PATH "ccache as C++ compiler" )
-  if( ANDROID_COMPILER_IS_CLANG )
-   set( CMAKE_C_COMPILER_ARG1   "${ANDROID_CLANG_TOOLCHAIN_ROOT}/bin/${_clang_name}${TOOL_OS_SUFFIX}"   CACHE PATH "C compiler")
-   set( CMAKE_CXX_COMPILER_ARG1 "${ANDROID_CLANG_TOOLCHAIN_ROOT}/bin/${_clang_name}++${TOOL_OS_SUFFIX}" CACHE PATH "C++ compiler")
-  else()
-   set( CMAKE_C_COMPILER_ARG1   "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-gcc${TOOL_OS_SUFFIX}" CACHE PATH "C compiler")
-   set( CMAKE_CXX_COMPILER_ARG1 "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-g++${TOOL_OS_SUFFIX}" CACHE PATH "C++ compiler")
-  endif()
- else()
-  if( ANDROID_COMPILER_IS_CLANG )
-   set( CMAKE_C_COMPILER   "${ANDROID_CLANG_TOOLCHAIN_ROOT}/bin/${_clang_name}${TOOL_OS_SUFFIX}"   CACHE PATH "C compiler")
-   set( CMAKE_CXX_COMPILER "${ANDROID_CLANG_TOOLCHAIN_ROOT}/bin/${_clang_name}++${TOOL_OS_SUFFIX}" CACHE PATH "C++ compiler")
-  else()
-   set( CMAKE_C_COMPILER   "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-gcc${TOOL_OS_SUFFIX}"    CACHE PATH "C compiler" )
-   set( CMAKE_CXX_COMPILER "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-g++${TOOL_OS_SUFFIX}"    CACHE PATH "C++ compiler" )
-  endif()
- endif()
- set( CMAKE_ASM_COMPILER "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-gcc${TOOL_OS_SUFFIX}"     CACHE PATH "assembler" )
- set( CMAKE_STRIP        "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-strip${TOOL_OS_SUFFIX}"   CACHE PATH "strip" )
- set( CMAKE_AR           "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-ar${TOOL_OS_SUFFIX}"      CACHE PATH "archive" )
- set( CMAKE_LINKER       "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-ld${TOOL_OS_SUFFIX}"      CACHE PATH "linker" )
- set( CMAKE_NM           "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-nm${TOOL_OS_SUFFIX}"      CACHE PATH "nm" )
- set( CMAKE_OBJCOPY      "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-objcopy${TOOL_OS_SUFFIX}" CACHE PATH "objcopy" )
- set( CMAKE_OBJDUMP      "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-objdump${TOOL_OS_SUFFIX}" CACHE PATH "objdump" )
- set( CMAKE_RANLIB       "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-ranlib${TOOL_OS_SUFFIX}"  CACHE PATH "ranlib" )
-endif()
-
-set( _CMAKE_TOOLCHAIN_PREFIX "${ANDROID_TOOLCHAIN_MACHINE_NAME}-" )
-if( CMAKE_VERSION VERSION_LESS 2.8.5 )
- set( CMAKE_ASM_COMPILER_ARG1 "-c" )
-endif()
-if( APPLE )
- find_program( CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool )
- if( NOT CMAKE_INSTALL_NAME_TOOL )
-  message( FATAL_ERROR "Could not find install_name_tool, please check your installation." )
- endif()
- mark_as_advanced( CMAKE_INSTALL_NAME_TOOL )
-endif()
-
-# Force set compilers because standard identification works badly for us
-include( CMakeForceCompiler )
-CMAKE_FORCE_C_COMPILER( "${CMAKE_C_COMPILER}" GNU )
-if( ANDROID_COMPILER_IS_CLANG )
- set( CMAKE_C_COMPILER_ID Clang )
-endif()
-set( CMAKE_C_PLATFORM_ID Linux )
-if( X86_64 OR MIPS64 OR ARM64_V8A )
- set( CMAKE_C_SIZEOF_DATA_PTR 8 )
-else()
- set( CMAKE_C_SIZEOF_DATA_PTR 4 )
-endif()
-set( CMAKE_C_HAS_ISYSROOT 1 )
-set( CMAKE_C_COMPILER_ABI ELF )
-CMAKE_FORCE_CXX_COMPILER( "${CMAKE_CXX_COMPILER}" GNU )
-if( ANDROID_COMPILER_IS_CLANG )
- set( CMAKE_CXX_COMPILER_ID Clang)
-endif()
-set( CMAKE_CXX_PLATFORM_ID Linux )
-set( CMAKE_CXX_SIZEOF_DATA_PTR ${CMAKE_C_SIZEOF_DATA_PTR} )
-set( CMAKE_CXX_HAS_ISYSROOT 1 )
-set( CMAKE_CXX_COMPILER_ABI ELF )
-set( CMAKE_CXX_SOURCE_FILE_EXTENSIONS cc cp cxx cpp CPP c++ C )
-# force ASM compiler (required for CMake < 2.8.5)
-set( CMAKE_ASM_COMPILER_ID_RUN TRUE )
-set( CMAKE_ASM_COMPILER_ID GNU )
-set( CMAKE_ASM_COMPILER_WORKS TRUE )
-set( CMAKE_ASM_COMPILER_FORCED TRUE )
-set( CMAKE_COMPILER_IS_GNUASM 1)
-set( CMAKE_ASM_SOURCE_FILE_EXTENSIONS s S asm )
-
-foreach( lang C CXX ASM )
- if( ANDROID_COMPILER_IS_CLANG )
-  set( CMAKE_${lang}_COMPILER_VERSION ${ANDROID_CLANG_VERSION} )
- else()
-  set( CMAKE_${lang}_COMPILER_VERSION ${ANDROID_COMPILER_VERSION} )
- endif()
-endforeach()
-
-# flags and definitions
-remove_definitions( -DANDROID )
-add_definitions( -DANDROID )
-
-if( ANDROID_SYSROOT MATCHES "[ ;\"]" )
- if( CMAKE_HOST_WIN32 )
-  # try to convert path to 8.3 form
-  file( WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/cvt83.cmd" "@echo %~s1" )
-  execute_process( COMMAND "$ENV{ComSpec}" /c "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/cvt83.cmd" "${ANDROID_SYSROOT}"
-                   OUTPUT_VARIABLE __path OUTPUT_STRIP_TRAILING_WHITESPACE
-                   RESULT_VARIABLE __result ERROR_QUIET )
-  if( __result EQUAL 0 )
-   file( TO_CMAKE_PATH "${__path}" ANDROID_SYSROOT )
-   set( ANDROID_CXX_FLAGS "--sysroot=${ANDROID_SYSROOT}" )
-  else()
-   set( ANDROID_CXX_FLAGS "--sysroot=\"${ANDROID_SYSROOT}\"" )
-  endif()
- else()
-  set( ANDROID_CXX_FLAGS "'--sysroot=${ANDROID_SYSROOT}'" )
- endif()
- if( NOT _CMAKE_IN_TRY_COMPILE )
-  # quotes can break try_compile and compiler identification
-  message(WARNING "Path to your Android NDK (or toolchain) has non-alphanumeric symbols.\nThe build might be broken.\n")
- endif()
-else()
- set( ANDROID_CXX_FLAGS "--sysroot=${ANDROID_SYSROOT}" )
-endif()
-
-# NDK flags
-if (ARM64_V8A )
- set( ANDROID_CXX_FLAGS         "${ANDROID_CXX_FLAGS} -ffunction-sections -funwind-tables" )
- set( ANDROID_CXX_FLAGS_RELEASE "-fomit-frame-pointer -fstrict-aliasing" )
- set( ANDROID_CXX_FLAGS_DEBUG   "-fno-omit-frame-pointer -fno-strict-aliasing" )
- if( NOT ANDROID_COMPILER_IS_CLANG )
-  set( ANDROID_CXX_FLAGS_RELEASE "${ANDROID_CXX_FLAGS_RELEASE} -funswitch-loops -finline-limit=300" )
- endif()
-elseif( ARMEABI OR ARMEABI_V7A)
- set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funwind-tables" )
- if( NOT ANDROID_FORCE_ARM_BUILD AND NOT ARMEABI_V6 )
-  set( ANDROID_CXX_FLAGS_RELEASE "-mthumb -fomit-frame-pointer -fno-strict-aliasing" )
-  set( ANDROID_CXX_FLAGS_DEBUG   "-marm -fno-omit-frame-pointer -fno-strict-aliasing" )
-  if( NOT ANDROID_COMPILER_IS_CLANG )
-   set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -finline-limit=64" )
-  endif()
- else()
-  # always compile ARMEABI_V6 in arm mode; otherwise there is no difference from ARMEABI
-  set( ANDROID_CXX_FLAGS_RELEASE "-marm -fomit-frame-pointer -fstrict-aliasing" )
-  set( ANDROID_CXX_FLAGS_DEBUG   "-marm -fno-omit-frame-pointer -fno-strict-aliasing" )
-  if( NOT ANDROID_COMPILER_IS_CLANG )
-   set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funswitch-loops -finline-limit=300" )
-  endif()
- endif()
-elseif( X86 OR X86_64 )
- set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funwind-tables" )
- if( NOT ANDROID_COMPILER_IS_CLANG )
-  set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funswitch-loops -finline-limit=300" )
- endif()
- set( ANDROID_CXX_FLAGS_RELEASE "-fomit-frame-pointer -fstrict-aliasing" )
- set( ANDROID_CXX_FLAGS_DEBUG   "-fno-omit-frame-pointer -fno-strict-aliasing" )
-elseif( MIPS OR MIPS64 )
- set( ANDROID_CXX_FLAGS         "${ANDROID_CXX_FLAGS} -fno-strict-aliasing -finline-functions -ffunction-sections -funwind-tables -fmessage-length=0" )
- set( ANDROID_CXX_FLAGS_RELEASE "-fomit-frame-pointer" )
- set( ANDROID_CXX_FLAGS_DEBUG   "-fno-omit-frame-pointer" )
- if( NOT ANDROID_COMPILER_IS_CLANG )
-  set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers" )
-  set( ANDROID_CXX_FLAGS_RELEASE "${ANDROID_CXX_FLAGS_RELEASE} -funswitch-loops -finline-limit=300" )
- endif()
-elseif()
- set( ANDROID_CXX_FLAGS_RELEASE "" )
- set( ANDROID_CXX_FLAGS_DEBUG   "" )
-endif()
-
-set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fsigned-char" ) # good/necessary when porting desktop libraries
-
-if( NOT X86 AND NOT ANDROID_COMPILER_IS_CLANG )
- set( ANDROID_CXX_FLAGS "-Wno-psabi ${ANDROID_CXX_FLAGS}" )
-endif()
-
-if( NOT ANDROID_COMPILER_VERSION VERSION_LESS "4.6" )
- set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -no-canonical-prefixes" ) # see https://android-review.googlesource.com/#/c/47564/
-endif()
-
-# ABI-specific flags
-if( ARMEABI_V7A )
- set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -march=armv7-a -mfloat-abi=softfp" )
- if( NEON )
-  set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -mfpu=neon" )
- elseif( VFPV3 )
-  set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -mfpu=vfpv3" )
- else()
-  set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -mfpu=vfpv3-d16" )
- endif()
-elseif( ARMEABI_V6 )
- set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -march=armv6 -mfloat-abi=softfp -mfpu=vfp" ) # vfp == vfpv2
-elseif( ARMEABI )
- set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -march=armv5te -mtune=xscale -msoft-float" )
-# Atomic: merged from gongminmin's PR
-elseif( ARM64_V8A )
- set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -march=armv8-a" )
-endif()
-
-if( ANDROID_STL MATCHES "gnustl" AND (EXISTS "${__libstl}" OR EXISTS "${__libsupcxx}") )
- set( CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" )
- set( CMAKE_CXX_CREATE_SHARED_MODULE  "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" )
- set( CMAKE_CXX_LINK_EXECUTABLE       "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>" )
-else()
- set( CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" )
- set( CMAKE_CXX_CREATE_SHARED_MODULE  "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" )
- set( CMAKE_CXX_LINK_EXECUTABLE       "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>" )
-endif()
-
-# STL
-if( EXISTS "${__libstl}" OR EXISTS "${__libsupcxx}" )
- if( EXISTS "${__libstl}" )
-  set( CMAKE_CXX_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY} \"${__libstl}\"" )
-  set( CMAKE_CXX_CREATE_SHARED_MODULE  "${CMAKE_CXX_CREATE_SHARED_MODULE} \"${__libstl}\"" )
-  set( CMAKE_CXX_LINK_EXECUTABLE       "${CMAKE_CXX_LINK_EXECUTABLE} \"${__libstl}\"" )
- endif()
- if( EXISTS "${__libsupcxx}" )
-  set( CMAKE_CXX_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY} \"${__libsupcxx}\"" )
-  set( CMAKE_CXX_CREATE_SHARED_MODULE  "${CMAKE_CXX_CREATE_SHARED_MODULE} \"${__libsupcxx}\"" )
-  set( CMAKE_CXX_LINK_EXECUTABLE       "${CMAKE_CXX_LINK_EXECUTABLE} \"${__libsupcxx}\"" )
-  # C objects:
-  set( CMAKE_C_CREATE_SHARED_LIBRARY "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_C_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_C_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" )
-  set( CMAKE_C_CREATE_SHARED_MODULE  "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_C_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_C_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" )
-  set( CMAKE_C_LINK_EXECUTABLE       "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>" )
-  set( CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_C_CREATE_SHARED_LIBRARY} \"${__libsupcxx}\"" )
-  set( CMAKE_C_CREATE_SHARED_MODULE  "${CMAKE_C_CREATE_SHARED_MODULE} \"${__libsupcxx}\"" )
-  set( CMAKE_C_LINK_EXECUTABLE       "${CMAKE_C_LINK_EXECUTABLE} \"${__libsupcxx}\"" )
- endif()
- if( ANDROID_STL MATCHES "gnustl" )
-  if( NOT EXISTS "${ANDROID_LIBM_PATH}" )
-   set( ANDROID_LIBM_PATH -lm )
-  endif()
-  set( CMAKE_CXX_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY} ${ANDROID_LIBM_PATH}" )
-  set( CMAKE_CXX_CREATE_SHARED_MODULE  "${CMAKE_CXX_CREATE_SHARED_MODULE} ${ANDROID_LIBM_PATH}" )
-  set( CMAKE_CXX_LINK_EXECUTABLE       "${CMAKE_CXX_LINK_EXECUTABLE} ${ANDROID_LIBM_PATH}" )
- endif()
-endif()
-
-# variables controlling optional build flags
-if( ANDROID_NDK_RELEASE_NUM LESS 7000 ) # before r7
- # libGLESv2.so in NDK's prior to r7 refers to missing external symbols.
- # So this flag option is required for all projects using OpenGL from native.
- __INIT_VARIABLE( ANDROID_SO_UNDEFINED                      VALUES ON )
-else()
- __INIT_VARIABLE( ANDROID_SO_UNDEFINED                      VALUES OFF )
-endif()
-__INIT_VARIABLE( ANDROID_NO_UNDEFINED OBSOLETE_NO_UNDEFINED VALUES ON )
-__INIT_VARIABLE( ANDROID_FUNCTION_LEVEL_LINKING             VALUES ON )
-__INIT_VARIABLE( ANDROID_GOLD_LINKER                        VALUES ON )
-__INIT_VARIABLE( ANDROID_NOEXECSTACK                        VALUES ON )
-__INIT_VARIABLE( ANDROID_RELRO                              VALUES ON )
-
-set( ANDROID_NO_UNDEFINED           ${ANDROID_NO_UNDEFINED}           CACHE BOOL "Show all undefined symbols as linker errors" )
-set( ANDROID_SO_UNDEFINED           ${ANDROID_SO_UNDEFINED}           CACHE BOOL "Allows or disallows undefined symbols in shared libraries" )
-set( ANDROID_FUNCTION_LEVEL_LINKING ${ANDROID_FUNCTION_LEVEL_LINKING} CACHE BOOL "Allows or disallows undefined symbols in shared libraries" )
-set( ANDROID_GOLD_LINKER            ${ANDROID_GOLD_LINKER}            CACHE BOOL "Enables gold linker" )
-set( ANDROID_NOEXECSTACK            ${ANDROID_NOEXECSTACK}            CACHE BOOL "Allows or disallows undefined symbols in shared libraries" )
-set( ANDROID_RELRO                  ${ANDROID_RELRO}                  CACHE BOOL "Enables RELRO - a memory corruption mitigation technique" )
-mark_as_advanced( ANDROID_NO_UNDEFINED ANDROID_SO_UNDEFINED ANDROID_FUNCTION_LEVEL_LINKING ANDROID_GOLD_LINKER ANDROID_NOEXECSTACK ANDROID_RELRO )
-
-# linker flags
-set( ANDROID_LINKER_FLAGS "" )
-
-if( ARMEABI_V7A )
- # this is *required* to use the following linker flags that routes around
- # a CPU bug in some Cortex-A8 implementations:
- set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -Wl,--fix-cortex-a8" )
-endif()
-
-if( ANDROID_NO_UNDEFINED )
- if( MIPS )
-  # there is some sysroot-related problem in mips linker...
-  if( NOT ANDROID_SYSROOT MATCHES "[ ;\"]" )
-   set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -Wl,--no-undefined -Wl,-rpath-link,${ANDROID_SYSROOT}/usr/lib" )
-  endif()
- else()
-  set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -Wl,--no-undefined" )
- endif()
-endif()
-
-if( ANDROID_SO_UNDEFINED )
- set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -Wl,-allow-shlib-undefined" )
-endif()
-
-if( ANDROID_FUNCTION_LEVEL_LINKING )
- set( ANDROID_CXX_FLAGS    "${ANDROID_CXX_FLAGS} -fdata-sections -ffunction-sections" )
- set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -Wl,--gc-sections" )
-endif()
-
-if( ANDROID_COMPILER_VERSION VERSION_EQUAL "4.6" )
- if( ANDROID_GOLD_LINKER AND (CMAKE_HOST_UNIX OR ANDROID_NDK_RELEASE_NUM GREATER 8002) AND (ARMEABI OR ARMEABI_V7A OR X86) )
-  set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -fuse-ld=gold" )
- elseif( ANDROID_NDK_RELEASE_NUM GREATER 8002 ) # after r8b
-  set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -fuse-ld=bfd" )
- elseif( ANDROID_NDK_RELEASE STREQUAL "r8b" AND ARMEABI AND NOT _CMAKE_IN_TRY_COMPILE )
-  message( WARNING "The default bfd linker from arm GCC 4.6 toolchain can fail with 'unresolvable R_ARM_THM_CALL relocation' error message. See https://code.google.com/p/android/issues/detail?id=35342
-  On Linux and OS X host platform you can workaround this problem using gold linker (default).
-  Rerun cmake with -DANDROID_GOLD_LINKER=ON option in case of problems.
-" )
- endif()
-endif() # version 4.6
-
-if( ANDROID_NOEXECSTACK )
- if( ANDROID_COMPILER_IS_CLANG )
-  set( ANDROID_CXX_FLAGS    "${ANDROID_CXX_FLAGS} -Xclang -mnoexecstack" )
- else()
-  set( ANDROID_CXX_FLAGS    "${ANDROID_CXX_FLAGS} -Wa,--noexecstack" )
- endif()
- set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -Wl,-z,noexecstack" )
-endif()
-
-if( ANDROID_RELRO )
- set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -Wl,-z,relro -Wl,-z,now" )
-endif()
-
-if( ANDROID_COMPILER_IS_CLANG )
- set( ANDROID_CXX_FLAGS "-target ${ANDROID_LLVM_TRIPLE} -Qunused-arguments ${ANDROID_CXX_FLAGS}" )
- if( BUILD_WITH_ANDROID_NDK )
-  set( ANDROID_CXX_FLAGS "-gcc-toolchain ${ANDROID_TOOLCHAIN_ROOT} ${ANDROID_CXX_FLAGS}" )
- endif()
-endif()
-
-# cache flags
-set( CMAKE_CXX_FLAGS           ""                        CACHE STRING "c++ flags" )
-set( CMAKE_C_FLAGS             ""                        CACHE STRING "c flags" )
-# Atomic: optimise for size
-set( CMAKE_CXX_FLAGS_RELEASE   "-Os -DNDEBUG"            CACHE STRING "c++ Release flags" )
-set( CMAKE_C_FLAGS_RELEASE     "-Os -DNDEBUG"            CACHE STRING "c Release flags" )
-set( CMAKE_CXX_FLAGS_DEBUG     "-O0 -g -DDEBUG -D_DEBUG" CACHE STRING "c++ Debug flags" )
-set( CMAKE_C_FLAGS_DEBUG       "-O0 -g -DDEBUG -D_DEBUG" CACHE STRING "c Debug flags" )
-set( CMAKE_SHARED_LINKER_FLAGS ""                        CACHE STRING "shared linker flags" )
-set( CMAKE_MODULE_LINKER_FLAGS ""                        CACHE STRING "module linker flags" )
-set( CMAKE_EXE_LINKER_FLAGS    "-Wl,-z,nocopyreloc"      CACHE STRING "executable linker flags" )
-
-# put flags to cache (for debug purpose only)
-set( ANDROID_CXX_FLAGS         "${ANDROID_CXX_FLAGS}"         CACHE INTERNAL "Android specific c/c++ flags" )
-set( ANDROID_CXX_FLAGS_RELEASE "${ANDROID_CXX_FLAGS_RELEASE}" CACHE INTERNAL "Android specific c/c++ Release flags" )
-set( ANDROID_CXX_FLAGS_DEBUG   "${ANDROID_CXX_FLAGS_DEBUG}"   CACHE INTERNAL "Android specific c/c++ Debug flags" )
-set( ANDROID_LINKER_FLAGS      "${ANDROID_LINKER_FLAGS}"      CACHE INTERNAL "Android specific c/c++ linker flags" )
-
-# finish flags
-set( CMAKE_CXX_FLAGS           "${ANDROID_CXX_FLAGS} ${CMAKE_CXX_FLAGS}" )
-set( CMAKE_C_FLAGS             "${ANDROID_CXX_FLAGS} ${CMAKE_C_FLAGS}" )
-set( CMAKE_CXX_FLAGS_RELEASE   "${ANDROID_CXX_FLAGS_RELEASE} ${CMAKE_CXX_FLAGS_RELEASE}" )
-set( CMAKE_C_FLAGS_RELEASE     "${ANDROID_CXX_FLAGS_RELEASE} ${CMAKE_C_FLAGS_RELEASE}" )
-set( CMAKE_CXX_FLAGS_DEBUG     "${ANDROID_CXX_FLAGS_DEBUG} ${CMAKE_CXX_FLAGS_DEBUG}" )
-set( CMAKE_C_FLAGS_DEBUG       "${ANDROID_CXX_FLAGS_DEBUG} ${CMAKE_C_FLAGS_DEBUG}" )
-set( CMAKE_SHARED_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS}" )
-set( CMAKE_MODULE_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} ${CMAKE_MODULE_LINKER_FLAGS}" )
-set( CMAKE_EXE_LINKER_FLAGS    "${ANDROID_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}" )
-
-if( MIPS AND BUILD_WITH_ANDROID_NDK AND ANDROID_NDK_RELEASE STREQUAL "r8" )
- set( CMAKE_SHARED_LINKER_FLAGS "-Wl,-T,${ANDROID_NDK_TOOLCHAINS_PATH}/${ANDROID_GCC_TOOLCHAIN_NAME}/mipself.xsc ${CMAKE_SHARED_LINKER_FLAGS}" )
- set( CMAKE_MODULE_LINKER_FLAGS "-Wl,-T,${ANDROID_NDK_TOOLCHAINS_PATH}/${ANDROID_GCC_TOOLCHAIN_NAME}/mipself.xsc ${CMAKE_MODULE_LINKER_FLAGS}" )
- set( CMAKE_EXE_LINKER_FLAGS    "-Wl,-T,${ANDROID_NDK_TOOLCHAINS_PATH}/${ANDROID_GCC_TOOLCHAIN_NAME}/mipself.x ${CMAKE_EXE_LINKER_FLAGS}" )
-endif()
-
-# pie/pic
-if( NOT (ANDROID_NATIVE_API_LEVEL LESS 16) AND (NOT DEFINED ANDROID_APP_PIE OR ANDROID_APP_PIE) AND (CMAKE_VERSION VERSION_GREATER 2.8.8) )
- set( CMAKE_POSITION_INDEPENDENT_CODE TRUE )
- set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fPIE -pie")
-else()
- set( CMAKE_POSITION_INDEPENDENT_CODE FALSE )
- set( CMAKE_CXX_FLAGS "-fpic ${CMAKE_CXX_FLAGS}" )
- set( CMAKE_C_FLAGS   "-fpic ${CMAKE_C_FLAGS}" )
-endif()
-
-# configure rtti
-if( DEFINED ANDROID_RTTI AND ANDROID_STL_FORCE_FEATURES )
- if( ANDROID_RTTI )
-  set( CMAKE_CXX_FLAGS "-frtti ${CMAKE_CXX_FLAGS}" )
- else()
-  set( CMAKE_CXX_FLAGS "-fno-rtti ${CMAKE_CXX_FLAGS}" )
- endif()
-endif()
-
-# configure exceptios
-if( DEFINED ANDROID_EXCEPTIONS AND ANDROID_STL_FORCE_FEATURES )
- if( ANDROID_EXCEPTIONS )
-  set( CMAKE_CXX_FLAGS "-fexceptions ${CMAKE_CXX_FLAGS}" )
-  set( CMAKE_C_FLAGS "-fexceptions ${CMAKE_C_FLAGS}" )
- else()
-  set( CMAKE_CXX_FLAGS "-fno-exceptions ${CMAKE_CXX_FLAGS}" )
-  set( CMAKE_C_FLAGS "-fno-exceptions ${CMAKE_C_FLAGS}" )
- endif()
-endif()
-
-# global includes and link directories
-include_directories( SYSTEM "${ANDROID_SYSROOT}/usr/include" ${ANDROID_STL_INCLUDE_DIRS} )
-# Atomic: bug fix - the global link directories setup below is an error because:
-# 1) At this point of the script the CMAKE_INSTALL_PREFIX variable may not be defined yet when the build tree is being configured initially
-#    This variable is initialized by the toolchain later, so only during the second CMake configure step onward then below setup becomes valid
-# 2) User may actually install a version of a library there but intended to use another version of the library elsewhere for a particular build tree
-#    Commented out to force user to be more specific on which library to use via target_link_libraries() command
-#
-#get_filename_component(__android_install_path "${CMAKE_INSTALL_PREFIX}/libs/${ANDROID_NDK_ABI_NAME}" ABSOLUTE) # avoid CMP0015 policy warning
-#link_directories( "${__android_install_path}" )
-
-# detect if need link crtbegin_so.o explicitly
-if( NOT DEFINED ANDROID_EXPLICIT_CRT_LINK )
- set( __cmd "${CMAKE_CXX_CREATE_SHARED_LIBRARY}" )
- string( REPLACE "<CMAKE_CXX_COMPILER>" "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1}" __cmd "${__cmd}" )
- string( REPLACE "<CMAKE_C_COMPILER>"   "${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1}"   __cmd "${__cmd}" )
- string( REPLACE "<CMAKE_SHARED_LIBRARY_CXX_FLAGS>" "${CMAKE_CXX_FLAGS}" __cmd "${__cmd}" )
- string( REPLACE "<LANGUAGE_COMPILE_FLAGS>" "" __cmd "${__cmd}" )
- string( REPLACE "<LINK_FLAGS>" "${CMAKE_SHARED_LINKER_FLAGS}" __cmd "${__cmd}" )
- string( REPLACE "<CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS>" "-shared" __cmd "${__cmd}" )
- string( REPLACE "<CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG>" "" __cmd "${__cmd}" )
- string( REPLACE "<TARGET_SONAME>" "" __cmd "${__cmd}" )
- string( REPLACE "<TARGET>" "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/toolchain_crtlink_test.so" __cmd "${__cmd}" )
- string( REPLACE "<OBJECTS>" "\"${ANDROID_SYSROOT}/usr/lib/crtbegin_so.o\"" __cmd "${__cmd}" )
- string( REPLACE "<LINK_LIBRARIES>" "" __cmd "${__cmd}" )
- separate_arguments( __cmd )
- foreach( __var ANDROID_NDK ANDROID_NDK_TOOLCHAINS_PATH ANDROID_STANDALONE_TOOLCHAIN )
-  if( ${__var} )
-   set( __tmp "${${__var}}" )
-   separate_arguments( __tmp )
-   string( REPLACE "${__tmp}" "${${__var}}" __cmd "${__cmd}")
-  endif()
- endforeach()
- string( REPLACE "'" "" __cmd "${__cmd}" )
- string( REPLACE "\"" "" __cmd "${__cmd}" )
- execute_process( COMMAND ${__cmd} RESULT_VARIABLE __cmd_result OUTPUT_QUIET ERROR_QUIET )
- if( __cmd_result EQUAL 0 )
-  set( ANDROID_EXPLICIT_CRT_LINK ON )
- else()
-  set( ANDROID_EXPLICIT_CRT_LINK OFF )
- endif()
-endif()
-
-if( ANDROID_EXPLICIT_CRT_LINK )
- set( CMAKE_CXX_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY} \"${ANDROID_SYSROOT}/usr/lib/crtbegin_so.o\"" )
- set( CMAKE_CXX_CREATE_SHARED_MODULE  "${CMAKE_CXX_CREATE_SHARED_MODULE} \"${ANDROID_SYSROOT}/usr/lib/crtbegin_so.o\"" )
-endif()
-
-# setup output directories
-# Atomic: Prefer binary dir over source dir, which is anyway equal to source dir when not using out-of-source build tree
-set( LIBRARY_OUTPUT_PATH_ROOT ${CMAKE_BINARY_DIR} CACHE PATH "root for library output, set this to change where android libs are installed to" )
-# Atomic: Do not prepend ${ANDROID_TOOLCHAIN_ROOT} to prefix dir on user behalf, let user specify that via DESTDIR; revert CMAKE_INSTALL_PREFIX to CMake's default
-#set( CMAKE_INSTALL_PREFIX "${ANDROID_TOOLCHAIN_ROOT}/user" CACHE STRING "path for installing" )
-
-if(NOT _CMAKE_IN_TRY_COMPILE)
- if( EXISTS "${CMAKE_SOURCE_DIR}/jni/CMakeLists.txt" )
-  set( EXECUTABLE_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/bin/${ANDROID_NDK_ABI_NAME}" CACHE PATH "Output directory for applications" )
- else()
-  set( EXECUTABLE_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/bin" CACHE PATH "Output directory for applications" )
- endif()
- # Atomic: All libraries are first generated in CMake default binary directory and only the main target library is later copied to below output path by Atomic own build script
- set( ANDROID_LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_ABI_NAME}" CACHE PATH "path for android libs" FORCE )
- mark_as_advanced (ANDROID_LIBRARY_OUTPUT_PATH)
-endif()
-
-# Atomic: Copy shared STL library to final Android library output path pointed by ANDROID_LIBRARY_OUTPUT_PATH variable as CMake's LIBRARY_OUTPUT_PATH still points to its default
-# copy shared stl library to build directory
-if( NOT _CMAKE_IN_TRY_COMPILE AND __libstl MATCHES "[.]so$" )
- get_filename_component( __libstlname "${__libstl}" NAME )
- execute_process( COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${__libstl}" "${ANDROID_LIBRARY_OUTPUT_PATH}/${__libstlname}" RESULT_VARIABLE __fileCopyProcess )
- if( NOT __fileCopyProcess EQUAL 0 OR NOT EXISTS "${ANDROID_LIBRARY_OUTPUT_PATH}/${__libstlname}")
-   message( SEND_ERROR "Failed copying of ${__libstl} to the ${ANDROID_LIBRARY_OUTPUT_PATH}/${__libstlname}" )
- endif()
- unset( __fileCopyProcess )
- unset( __libstlname )
-endif()
-
-
-# set these global flags for cmake client scripts to change behavior
-set( ANDROID True )
-set( BUILD_ANDROID True )
-
-# where is the target environment
-# Atomic: bug fix - should just add paths that look like a system root
-set( CMAKE_FIND_ROOT_PATH ${ANDROID_TOOLCHAIN_ROOT} ${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME} ${ANDROID_SYSROOT} )
-
-# only search for libraries and includes in the ndk toolchain
-set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY )
-set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
-set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
-
-
-# macro to find packages on the host OS
-macro( find_host_package )
- set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
- set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER )
- set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER )
- if( CMAKE_HOST_WIN32 )
-  SET( WIN32 1 )
-  SET( UNIX )
- elseif( CMAKE_HOST_APPLE )
-  SET( APPLE 1 )
-  SET( UNIX )
- endif()
- find_package( ${ARGN} )
- SET( WIN32 )
- SET( APPLE )
- SET( UNIX 1 )
- set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY )
- set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
- set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
-endmacro()
-
-
-# macro to find programs on the host OS
-macro( find_host_program )
- set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
- set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER )
- set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER )
- if( CMAKE_HOST_WIN32 )
-  SET( WIN32 1 )
-  SET( UNIX )
- elseif( CMAKE_HOST_APPLE )
-  SET( APPLE 1 )
-  SET( UNIX )
- endif()
- find_program( ${ARGN} )
- SET( WIN32 )
- SET( APPLE )
- SET( UNIX 1 )
- set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY )
- set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
- set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
-endmacro()
-
-
-macro( ANDROID_GET_ABI_RAWNAME TOOLCHAIN_FLAG VAR )
- if( "${TOOLCHAIN_FLAG}" STREQUAL "ARMEABI" )
-  set( ${VAR} "armeabi" )
- elseif( "${TOOLCHAIN_FLAG}" STREQUAL "ARMEABI_V7A" )
-  set( ${VAR} "armeabi-v7a" )
- elseif( "${TOOLCHAIN_FLAG}" STREQUAL "X86" )
-  set( ${VAR} "x86" )
- elseif( "${TOOLCHAIN_FLAG}" STREQUAL "MIPS" )
-  set( ${VAR} "mips" )
-# Atomic: merged from gongminmin's PR
- elseif( "${TOOLCHAIN_FLAG}" STREQUAL "ARM64_V8A" )
-  set( ${VAR} "arm64-v8a" )
- elseif( "${TOOLCHAIN_FLAG}" STREQUAL "X86_64" )
-  set( ${VAR} "x86_64" )
- elseif( "${TOOLCHAIN_FLAG}" STREQUAL "MIPS64" )
-  set( ${VAR} "mips64" )
- else()
-  set( ${VAR} "unknown" )
- endif()
-endmacro()
-
-
-# export toolchain settings for the try_compile() command
-if( NOT PROJECT_NAME STREQUAL "CMAKE_TRY_COMPILE" )
- set( __toolchain_config "")
- foreach( __var NDK_CCACHE  LIBRARY_OUTPUT_PATH_ROOT  ANDROID_FORBID_SYGWIN  ANDROID_SET_OBSOLETE_VARIABLES
-                ANDROID_NDK_HOST_X64
-                ANDROID_NDK
-                ANDROID_NDK_LAYOUT
-                ANDROID_STANDALONE_TOOLCHAIN
-                ANDROID_TOOLCHAIN_NAME
-                ANDROID_ABI
-                ANDROID_NATIVE_API_LEVEL
-                ANDROID_STL
-                ANDROID_STL_FORCE_FEATURES
-                ANDROID_FORCE_ARM_BUILD
-                ANDROID_NO_UNDEFINED
-                ANDROID_SO_UNDEFINED
-                ANDROID_FUNCTION_LEVEL_LINKING
-                ANDROID_GOLD_LINKER
-                ANDROID_NOEXECSTACK
-                ANDROID_RELRO
-                ANDROID_LIBM_PATH
-                ANDROID_EXPLICIT_CRT_LINK
-                ANDROID_APP_PIE
-                )
-  if( DEFINED ${__var} )
-   if( "${__var}" MATCHES " ")
-    set( __toolchain_config "${__toolchain_config}set( ${__var} \"${${__var}}\" CACHE INTERNAL \"\" )\n" )
-   else()
-    set( __toolchain_config "${__toolchain_config}set( ${__var} ${${__var}} CACHE INTERNAL \"\" )\n" )
-   endif()
-  endif()
- endforeach()
- file( WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/android.toolchain.config.cmake" "${__toolchain_config}" )
- unset( __toolchain_config )
-endif()
-
-
-# force cmake to produce / instead of \ in build commands for Ninja generator
-if( CMAKE_GENERATOR MATCHES "Ninja" AND CMAKE_HOST_WIN32 )
- # it is a bad hack after all
- # CMake generates Ninja makefiles with UNIX paths only if it thinks that we are going to build with MinGW
- set( CMAKE_COMPILER_IS_MINGW TRUE ) # tell CMake that we are MinGW
- set( CMAKE_CROSSCOMPILING TRUE )    # stop recursion
- enable_language( C )
- enable_language( CXX )
- # unset( CMAKE_COMPILER_IS_MINGW ) # can't unset because CMake does not convert back-slashes in response files without it
- unset( MINGW )
-endif()
-
-
-# set some obsolete variables for backward compatibility
-set( ANDROID_SET_OBSOLETE_VARIABLES ON CACHE BOOL "Define obsolete Andrid-specific cmake variables" )
-mark_as_advanced( ANDROID_SET_OBSOLETE_VARIABLES )
-if( ANDROID_SET_OBSOLETE_VARIABLES )
- set( ANDROID_API_LEVEL ${ANDROID_NATIVE_API_LEVEL} )
- set( ARM_TARGET "${ANDROID_ABI}" )
- set( ARMEABI_NDK_NAME "${ANDROID_NDK_ABI_NAME}" )
-endif()
-
-
-# Variables controlling behavior or set by cmake toolchain:
-#   ANDROID_ABI : "armeabi-v7a" (default), "armeabi", "armeabi-v7a with NEON", "armeabi-v7a with VFPV3", "armeabi-v6 with VFP", "x86", "mips", "arm64-v8a", "x86_64", "mips64"
-#   ANDROID_NATIVE_API_LEVEL : 3,4,5,8,9,14,15,16,17,18,19,21 (depends on NDK version)
-#   ANDROID_STL : gnustl_static/gnustl_shared/stlport_static/stlport_shared/gabi++_static/gabi++_shared/system_re/system/none
-#   ANDROID_FORBID_SYGWIN : ON/OFF
-#   ANDROID_NO_UNDEFINED : ON/OFF
-#   ANDROID_SO_UNDEFINED : OFF/ON  (default depends on NDK version)
-#   ANDROID_FUNCTION_LEVEL_LINKING : ON/OFF
-#   ANDROID_GOLD_LINKER : ON/OFF
-#   ANDROID_NOEXECSTACK : ON/OFF
-#   ANDROID_RELRO : ON/OFF
-#   ANDROID_FORCE_ARM_BUILD : ON/OFF
-#   ANDROID_STL_FORCE_FEATURES : ON/OFF
-#   ANDROID_SET_OBSOLETE_VARIABLES : ON/OFF
-# Can be set only at the first run:
-#   ANDROID_NDK
-#   ANDROID_STANDALONE_TOOLCHAIN
-#   ANDROID_TOOLCHAIN_NAME : the NDK name of compiler toolchain
-#   ANDROID_NDK_HOST_X64 : try to use x86_64 toolchain (default for x64 host systems)
-#   ANDROID_NDK_LAYOUT : the inner NDK structure (RELEASE, LINARO, ANDROID)
-#   LIBRARY_OUTPUT_PATH_ROOT : <any valid path>
-#   NDK_CCACHE : <path to your ccache executable>
-# Obsolete:
-#   ANDROID_API_LEVEL : superseded by ANDROID_NATIVE_API_LEVEL
-#   ARM_TARGET : superseded by ANDROID_ABI
-#   ARM_TARGETS : superseded by ANDROID_ABI (can be set only)
-#   ANDROID_NDK_TOOLCHAIN_ROOT : superseded by ANDROID_STANDALONE_TOOLCHAIN (can be set only)
-#   ANDROID_USE_STLPORT : superseded by ANDROID_STL=stlport_static
-#   ANDROID_LEVEL : superseded by ANDROID_NATIVE_API_LEVEL (completely removed)
-#
-# Primary read-only variables:
-#   ANDROID : always TRUE
-#   ARMEABI : TRUE for arm v6 and older devices
-#   ARMEABI_V6 : TRUE for arm v6
-#   ARMEABI_V7A : TRUE for arm v7a
-#   ARM64_V8A : TRUE for arm64-v8a
-#   NEON : TRUE if NEON unit is enabled
-#   VFPV3 : TRUE if VFP version 3 is enabled
-#   X86 : TRUE if configured for x86
-#   X86_64 : TRUE if configured for x86_64
-#   MIPS : TRUE if configured for mips
-#   MIPS64 : TRUE if configured for mips64
-#   BUILD_ANDROID : always TRUE
-#   BUILD_WITH_ANDROID_NDK : TRUE if NDK is used
-#   BUILD_WITH_STANDALONE_TOOLCHAIN : TRUE if standalone toolchain is used
-#   ANDROID_NDK_HOST_SYSTEM_NAME : "windows", "linux-x86" or "darwin-x86" depending on host platform
-#   ANDROID_NDK_ABI_NAME : "armeabi", "armeabi-v7a", "x86", "mips", "arm64-v8a", "x86_64", "mips64" depending on ANDROID_ABI
-#   ANDROID_NDK_RELEASE : from r5 to r10d; set only for NDK
-#   ANDROID_NDK_RELEASE_NUM : numeric ANDROID_NDK_RELEASE version (1000*major+minor)
-#   ANDROID_ARCH_NAME : "arm", "x86", "mips", "arm64", "x86_64", "mips64" depending on ANDROID_ABI
-#   ANDROID_SYSROOT : path to the compiler sysroot
-#   TOOL_OS_SUFFIX : "" or ".exe" depending on host platform
-#   ANDROID_COMPILER_IS_CLANG : TRUE if clang compiler is used
-# Obsolete:
-#   ARMEABI_NDK_NAME : superseded by ANDROID_NDK_ABI_NAME
-#
-# Secondary (less stable) read-only variables:
-#   ANDROID_COMPILER_VERSION : GCC version used (not Clang version)
-#   ANDROID_CLANG_VERSION : version of clang compiler if clang is used
-#   ANDROID_CXX_FLAGS : C/C++ compiler flags required by Android platform
-#   ANDROID_SUPPORTED_ABIS : list of currently allowed values for ANDROID_ABI
-#   ANDROID_TOOLCHAIN_MACHINE_NAME : "arm-linux-androideabi", "arm-eabi" or "i686-android-linux"
-#   ANDROID_TOOLCHAIN_ROOT : path to the top level of toolchain (standalone or placed inside NDK)
-#   ANDROID_CLANG_TOOLCHAIN_ROOT : path to clang tools
-#   ANDROID_SUPPORTED_NATIVE_API_LEVELS : list of native API levels found inside NDK
-#   ANDROID_STL_INCLUDE_DIRS : stl include paths
-#   ANDROID_RTTI : if rtti is enabled by the runtime
-#   ANDROID_EXCEPTIONS : if exceptions are enabled by the runtime
-#   ANDROID_GCC_TOOLCHAIN_NAME : read-only, differs from ANDROID_TOOLCHAIN_NAME only if clang is used
-#   ANDROID_LIBM_PATH : path to libm.so (set to something like $(TOP)/out/target/product/<product_name>/obj/lib/libm.so) to workaround unresolved `sincos`
-#
-# Defaults:
-#   ANDROID_DEFAULT_NDK_API_LEVEL
-#   ANDROID_DEFAULT_NDK_API_LEVEL_${ARCH}
-#   ANDROID_NDK_SEARCH_PATHS
-#   ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH
-#   ANDROID_SUPPORTED_ABIS_${ARCH}
-#   ANDROID_SUPPORTED_NDK_VERSIONS

+ 0 - 80
CMake/Toolchains/mingw.toolchain.cmake

@@ -1,80 +0,0 @@
-#
-# Copyright (c) 2008-2014 the Urho3D project.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-
-cmake_minimum_required (VERSION 2.6.3)
-
-if (CMAKE_TOOLCHAIN_FILE)
-    # Reference toolchain variable to suppress "unused variable" warning
-    mark_as_advanced (CMAKE_TOOLCHAIN_FILE)
-endif ()
-
-# this one is important
-set (CMAKE_SYSTEM_NAME Windows)
-#this one not so much
-set (CMAKE_SYSTEM_PROCESSOR x86)
-
-# specify the cross compiler
-if (NOT MINGW_PREFIX AND DEFINED ENV{MINGW_PREFIX})
-    file (TO_CMAKE_PATH $ENV{MINGW_PREFIX} MINGW_PREFIX)
-endif ()
-if (NOT EXISTS ${MINGW_PREFIX}-gcc)
-    message (FATAL_ERROR "Could not find MinGW cross compilation tool. "
-        "Use MINGW_PREFIX environment variable or build option to specify the location of the toolchain.")
-endif ()
-set (CMAKE_C_COMPILER   ${MINGW_PREFIX}-gcc     CACHE PATH "C compiler")
-set (CMAKE_CXX_COMPILER ${MINGW_PREFIX}-g++     CACHE PATH "C++ compiler")
-set (CMAKE_STRIP        ${MINGW_PREFIX}-strip   CACHE PATH "strip")
-set (CMAKE_AR           ${MINGW_PREFIX}-ar      CACHE PATH "archive")
-set (CMAKE_LINKER       ${MINGW_PREFIX}-ld      CACHE PATH "linker")
-set (CMAKE_NM           ${MINGW_PREFIX}-nm      CACHE PATH "nm")
-set (CMAKE_OBJCOPY      ${MINGW_PREFIX}-objcopy CACHE PATH "objcopy")
-set (CMAKE_OBJDUMP      ${MINGW_PREFIX}-objdump CACHE PATH "objdump")
-set (CMAKE_RANLIB       ${MINGW_PREFIX}-ranlib  CACHE PATH "ranlib")
-set (CMAKE_RC_COMPILER  ${MINGW_PREFIX}-windres CACHE PATH "RC compiler")
-
-# specify the system root
-if (NOT MINGW_SYSROOT)
-    if (DEFINED ENV{MINGW_SYSROOT})
-        file (TO_CMAKE_PATH $ENV{MINGW_SYSROOT} MINGW_SYSROOT)
-    else ()
-        get_filename_component (NAME ${MINGW_PREFIX} NAME)
-        if (EXISTS /usr/${NAME}/sys-root)
-            # Redhat based system
-            set (MINGW_SYSROOT /usr/${NAME}/sys-root)
-        else ()
-            # Debian based system
-            set (MINGW_SYSROOT /usr/${NAME})
-        endif ()
-    endif ()
-    if (NOT EXISTS ${MINGW_SYSROOT})
-        message (FATAL_ERROR "Could not find MinGW system root. "
-            "Use MINGW_SYSROOT environment variable or build option to specify the location of system root.")
-    endif ()
-    set (MINGW_PREFIX ${MINGW_PREFIX} CACHE STRING "Prefix path to MinGW cross-compiler tools (MinGW cross-compiling build only)" FORCE)
-    set (MINGW_SYSROOT ${MINGW_SYSROOT} CACHE PATH "Path to MinGW system root (MinGW cross-compiling build only)" FORCE)
-endif ()
-set (CMAKE_FIND_ROOT_PATH ${MINGW_SYSROOT})
-
-# only search libraries and headers in the target directories
-set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

+ 0 - 70
CMake/Toolchains/raspberrypi.toolchain.cmake

@@ -1,70 +0,0 @@
-#
-# Copyright (c) 2008-2014 the Urho3D project.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-
-cmake_minimum_required (VERSION 2.6.3)
-
-if (CMAKE_TOOLCHAIN_FILE)
-    # Reference toolchain variable to suppress "unused variable" warning
-    mark_as_advanced (CMAKE_TOOLCHAIN_FILE)
-endif ()
-
-# this one is important
-set (CMAKE_SYSTEM_NAME Linux)
-#this one not so much
-set (CMAKE_SYSTEM_VERSION 1)
-
-# specify the cross compiler
-if (NOT RPI_PREFIX AND DEFINED ENV{RPI_PREFIX})
-    file (TO_CMAKE_PATH $ENV{RPI_PREFIX} RPI_PREFIX)
-endif ()
-if (NOT EXISTS ${RPI_PREFIX}-gcc)
-    message (FATAL_ERROR "Could not find Raspberry Pi cross compilation tool. "
-        "Use RPI_PREFIX environment variable or build option to specify the location of the toolchain.")
-endif ()
-set (CMAKE_C_COMPILER   ${RPI_PREFIX}-gcc     CACHE PATH "C compiler")
-set (CMAKE_CXX_COMPILER ${RPI_PREFIX}-c++     CACHE PATH "C++ compiler")
-set (CMAKE_STRIP        ${RPI_PREFIX}-strip   CACHE PATH "strip")
-set (CMAKE_AR           ${RPI_PREFIX}-ar      CACHE PATH "archive")
-set (CMAKE_LINKER       ${RPI_PREFIX}-ld      CACHE PATH "linker")
-set (CMAKE_NM           ${RPI_PREFIX}-nm      CACHE PATH "nm")
-set (CMAKE_OBJCOPY      ${RPI_PREFIX}-objcopy CACHE PATH "objcopy")
-set (CMAKE_OBJDUMP      ${RPI_PREFIX}-objdump CACHE PATH "objdump")
-set (CMAKE_RANLIB       ${RPI_PREFIX}-ranlib  CACHE PATH "ranlib")
-
-# specify the system root
-if (NOT RPI_SYSROOT OR NOT BCM_VC_INCLUDE_DIRS OR NOT BCM_VC_LIBRARIES)
-    if (DEFINED ENV{RPI_SYSROOT})
-        file (TO_CMAKE_PATH $ENV{RPI_SYSROOT} RPI_SYSROOT)
-    endif ()
-    if (NOT EXISTS ${RPI_SYSROOT})
-        message (FATAL_ERROR "Could not find Raspberry Pi system root. "
-            "Use RPI_SYSROOT environment variable or build option to specify the location of system root.")
-    endif ()
-    set (RPI_PREFIX ${RPI_PREFIX} CACHE STRING "Prefix path to Raspberry Pi cross-compiler tools (RPI cross-compiling build only)" FORCE)
-    set (RPI_SYSROOT ${RPI_SYSROOT} CACHE PATH "Path to Raspberry Pi system root (RPI cross-compiling build only)" FORCE)
-endif ()
-set (CMAKE_FIND_ROOT_PATH ${RPI_SYSROOT})
-
-# only search programs, libraries, and headers in the target directories
-set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

+ 61 - 160
CMakeLists.txt

@@ -1,171 +1,72 @@
-#
-# Copyright (c) 2008-2014 the Urho3D project.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-
-# Set project name
+
 project (Atomic)
 
-# Set minimum version
 cmake_minimum_required (VERSION 2.8.6)
 
-if (COMMAND cmake_policy)
-    cmake_policy (SET CMP0003 NEW)
-    if (CMAKE_VERSION VERSION_GREATER 2.8.12 OR CMAKE_VERSION VERSION_EQUAL 2.8.12)
-        # INTERFACE_LINK_LIBRARIES defines the link interface
-        cmake_policy (SET CMP0022 NEW)
-    endif ()
-    if (CMAKE_VERSION VERSION_GREATER 3.0.0 OR CMAKE_VERSION VERSION_EQUAL 3.0.0)
-        # Disallow use of the LOCATION target property - therefore we set to OLD as we still need it
-        cmake_policy (SET CMP0026 OLD)
-        # MACOSX_RPATH is enabled by default
-        cmake_policy (SET CMP0042 NEW)
-    endif ()
-endif ()
+include (CMakeDependentOption)
 
-# Set CMake modules search path
 set (CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
 
-# Include Atomic Cmake common module
-include (Atomic-CMake-common)
-
-# Setup SDK install destinations
-if (WIN32)
-    set (SCRIPT_EXT .bat)
-else ()
-    set (SCRIPT_EXT .sh)
-endif ()
-set (PATH_SUFFIX Atomic)
-if (ANDROID)
-    # For Android platform, install to a path similar to ANDROID_LIBRARY_OUTPUT_PATH variable, e.g. libs/armeabi-v7a
-    set (LIB_SUFFIX s/${ANDROID_NDK_ABI_NAME})
-elseif (ATOMIC_64BIT)
-    if (EXISTS /usr/lib64)
-        set (HAS_LIB64 TRUE)
-    endif ()
-    # Install to 'lib64' when one of these conditions is true
-    if (WIN32 OR ATOMIC_USE_LIB64_RPM OR (HAS_LIB64 AND NOT ATOMIC_USE_LIB_DEB))
-        set (LIB_SUFFIX 64)
-    endif ()
-endif ()
-set (DEST_INCLUDE_DIR include/${PATH_SUFFIX})
-set (DEST_SHARE_DIR share/${PATH_SUFFIX})
-set (DEST_RUNTIME_DIR bin)
-set (DEST_BUNDLE_DIR ${DEST_SHARE_DIR}/Applications)
-# Note to package maintainer: ${PATH_SUFFIX} for library could be removed if the extra path is not desired, but if so then the RPATH setting in Source's CMakeLists.txt needs to be adjusted accordingly
-set (DEST_LIBRARY_DIR lib${LIB_SUFFIX}/${PATH_SUFFIX})
-# TODO: Investigate the implication of using CMAKE_SYSROOT variable (available since 3.0.0) instead of our own SYSROOT variable
-set (SYSROOT ${ANDROID_TOOLCHAIN_ROOT} ${RPI_SYSROOT} ${MINGW_SYSROOT} ${IOS_SYSROOT} CACHE INTERNAL "Path to system root of the cross-compiling target")  # SYSROOT is empty for native build
-set (DEST_PKGCONFIG_DIR lib${LIB_SUFFIX}/pkgconfig)
-set (DEST_PERMISSIONS FILE_PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
-# Install application launcher scripts
-file (GLOB APP_SCRIPTS ${CMAKE_SOURCE_DIR}/bin/*${SCRIPT_EXT})
-install (FILES ${APP_SCRIPTS} DESTINATION ${DEST_RUNTIME_DIR} PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)   # 755
-# Install resource directories required by applications built with Atomic library
-install (DIRECTORY ${CMAKE_SOURCE_DIR}/bin/CoreData ${CMAKE_SOURCE_DIR}/bin/Data DESTINATION ${DEST_SHARE_DIR}/Resources ${DEST_PERMISSIONS})
-# Install CMake modules and toolchains provided by and for Atomic
-install (DIRECTORY ${CMAKE_SOURCE_DIR}/CMake/ DESTINATION ${DEST_SHARE_DIR}/CMake ${DEST_PERMISSIONS})    # Note: the trailing slash is significant
-# Install CMake build scripts
-file (GLOB CMAKE_SCRIPTS ${CMAKE_SOURCE_DIR}/*${SCRIPT_EXT})
-install (FILES ${CMAKE_SCRIPTS} DESTINATION ${DEST_SHARE_DIR}/Scripts PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
-
-# Setup package variables
-set (ATOMIC_DESCRIPTION "Atomic is a free lightweight, cross-platform 2D and 3D game engine implemented in C++ and released under the MIT license. Greatly inspired by OGRE (http://www.ogre3d.org) and Horde3D (http://www.horde3d.org).")
-set (CPACK_PACKAGE_DESCRIPTION_SUMMARY ${ATOMIC_DESCRIPTION})
-set (ATOMIC_URL "https://github.com/urho3d/Atomic")
-set (CPACK_PACKAGE_VENDOR ${ATOMIC_URL})
-set (CPACK_PACKAGE_CONTACT ${ATOMIC_URL})
-execute_process (COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/CMake/Modules/GetAtomicRevision.cmake WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE ATOMIC_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
-set (CPACK_PACKAGE_VERSION ${ATOMIC_VERSION})
-string (REGEX MATCH "([^.]+)\\.([^.]+)\\.(.+)" MATCHED ${ATOMIC_VERSION})
-if (MATCHED)
-    set (CPACK_PACKAGE_VERSION_MAJOR ${CMAKE_MATCH_1})
-    set (CPACK_PACKAGE_VERSION_MINOR ${CMAKE_MATCH_2})
-    set (CPACK_PACKAGE_VERSION_PATCH ${CMAKE_MATCH_3})
-endif ()
-set (CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/License.txt)
-set (CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
-set (CPACK_GENERATOR TGZ)
-if (ANDROID)
-    set (CPACK_SYSTEM_NAME Android)
-elseif (IOS)
-    set (CPACK_SYSTEM_NAME iOS)
-elseif (APPLE)
-    set (CPACK_SYSTEM_NAME OSX)
-elseif (WIN32)
-    set (CPACK_GENERATOR ZIP)
-elseif (CPACK_SYSTEM_NAME STREQUAL Linux)
-    if (RPI)
-        set (CPACK_SYSTEM_NAME Raspberry-Pi)
-    endif ()
-    if (NOT ATOMIC_64BIT OR HAS_LIB64)
-        list (APPEND CPACK_GENERATOR RPM)
-    endif ()
-    if (NOT ATOMIC_64BIT OR NOT HAS_LIB64)
-        list (APPEND CPACK_GENERATOR DEB)
-    endif ()
-    if (ATOMIC_64BIT)
-        if (ATOMIC_USE_LIB64_RPM AND NOT HAS_LIB64)
-            set (CPACK_GENERATOR RPM)
-        elseif (ATOMIC_USE_LIB_DEB AND HAS_LIB64)
-            set (CPACK_GENERATOR DEB)
-        endif ()
-    endif ()
-    # Note to package maintainer: comment out below line to revert the prefix from '/usr/local' (default for CMAKE_INSTALL_PREFIX) to '/usr' (default for CPACK_PACKAGING_INSTALL_PREFIX)
-    set (CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
-endif ()
-if (ATOMIC_64BIT)
-    set (CPACK_SYSTEM_NAME ${CPACK_SYSTEM_NAME}-64bit)
-endif ()
-set (CPACK_SYSTEM_NAME ${CPACK_SYSTEM_NAME}-${ATOMIC_LIB_TYPE})
-if (WIN32 AND NOT ATOMIC_OPENGL)
-    set (CPACK_SYSTEM_NAME ${CPACK_SYSTEM_NAME}-D3D)    # Stands for Direct 3D
-elseif (ANDROID AND X86)    # Take advantage of Android toolchain setting X86 variable to true for both 'x86' and 'x86_64' ABIs
-    set (CPACK_SYSTEM_NAME ${CPACK_SYSTEM_NAME}-IA)     # Stands for Intel Architecture
-endif ()
-if (NOT DEFINED ENV{RELEASE_TAG})
-    set (CPACK_SYSTEM_NAME ${CPACK_SYSTEM_NAME}-snapshot)
-endif ()
-include (CPack)
-
-# Setup MacOSX and iOS bundle variables
-if (IOS OR ATOMIC_MACOSX_BUNDLE)
-    if (NOT MACOSX_BUNDLE_ICON_FILE)
-        set (MACOSX_BUNDLE_ICON_FILE UrhoIcon)
-    endif ()
-    if (NOT MACOSX_BUNDLE_BUNDLE_VERSION)
-        set (MACOSX_BUNDLE_BUNDLE_VERSION ${ATOMIC_VERSION})
-    endif ()
-    if (NOT MACOSX_BUNDLE_LONG_VERSION_STRING)
-        set (MACOSX_BUNDLE_LONG_VERSION_STRING ${ATOMIC_VERSION})
-    endif ()
-    if (NOT MACOSX_BUNDLE_SHORT_VERSION_STRING)
-        set (MACOSX_BUNDLE_SHORT_VERSION_STRING ${ATOMIC_VERSION})
+cmake_dependent_option (ATOMIC_STATIC_RUNTIME "Use static C/C++ runtime libraries and eliminate the need for runtime DLLs installation (VS only)" TRUE "MSVC" FALSE)
+
+add_definitions(-DATOMIC_STATIC_DEFINE -DATOMIC_PHYSICS -DATOMIC_NETWORK -DATOMIC_ATOMIC2D -DATOMIC_TBUI)
+
+set (ATOMIC_LINK_LIBRARIES Atomic Box2D Bullet Civetweb Detour Duktape FreeType JO kNet
+                           LibCpuId LZ4 PugiXml Recast SDL SQLite StanHull STB TurboBadger)
+
+if (MSVC)
+
+    set (CMAKE_DEBUG_POSTFIX _d)
+
+    if (ATOMIC_STATIC_RUNTIME)
+        set(CompilerFlags
+            CMAKE_CXX_FLAGS
+            CMAKE_CXX_FLAGS_DEBUG
+            CMAKE_CXX_FLAGS_RELEASE
+            CMAKE_C_FLAGS
+            CMAKE_C_FLAGS_DEBUG
+            CMAKE_C_FLAGS_RELEASE
+        )
+        foreach(CompilerFlag ${CompilerFlags})
+            string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
+        endforeach()
     endif ()
-    if (NOT MACOSX_BUNDLE_COPYRIGHT)
-        set (MACOSX_BUNDLE_COPYRIGHT "Copyright (c) 2008-2014 the Urho3D project.")
+
+    add_definitions (-D_CRT_SECURE_NO_WARNINGS)
+    set (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE} /fp:fast /Zi /GS-")
+    set (CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELWITHDEBINFO})
+    set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} /fp:fast /Zi /GS- /D _SECURE_SCL=0")
+    set (CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
+    # SSE flag is redundant if already compiling as 64bit
+    if (ATOMIC_SSE AND NOT ATOMIC_64BIT)
+        set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:SSE")
+        set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE")
     endif ()
-endif ()
+    set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /OPT:REF /OPT:ICF /DEBUG")
+    set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /OPT:REF /OPT:ICF")
+
+    list (APPEND ATOMIC_LINK_LIBRARIES MojoShader user32 gdi32 winmm imm32 ole32 oleaut32 version uuid d3d9 d3dcompiler)
+
+else()
+
+    add_definitions(-DATOMIC_OPENGL)
+    list (APPEND ATOMIC_LINK_LIBRARIES GLEW)
+    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-offsetof -std=gnu++0x")
+
+endif()
+
+if (APPLE)
+
+    include (BundleUtilities)
+    set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework AudioUnit -framework Carbon -framework Cocoa -framework CoreAudio -framework ForceFeedback -framework IOKit -framework OpenGL -framework CoreServices")
+
+endif()
+
+add_subdirectory(Source)
+
+#if (IS_DIRECTORY ./AtomicEditor)
+
+add_subdirectory(AtomicEditor)
 
-# Setup SDK-like include dir in the build tree for building the Atomic library
-file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty)
+#endif()
 
-# Atomic source
-add_subdirectory (Source)

+ 0 - 1
Notes.txt

@@ -1 +0,0 @@
--DCMAKE_BUILD_TYPE=Debug -DATOMIC_TBUI=1 -DATOMIC_JAVASCRIPT=1 -DATOMIC_TOOLS=0 -DATOMIC_ANGELSCRIPT=0 -DATOMIC_SAMPLES=0 -DATOMIC_MACOSX_BUNDLE=1

+ 0 - 1
Source/Atomic/.soversion

@@ -1 +0,0 @@
-0.0.73

+ 88 - 0
Source/Atomic/Atomic.h

@@ -0,0 +1,88 @@
+
+
+#ifndef ATOMIC_API_H
+#define ATOMIC_API_H
+
+#ifdef _MSC_VER
+
+#pragma warning(disable: 4251)
+#pragma warning(disable: 4275)
+
+#ifdef ATOMIC_STATIC_DEFINE
+#  define ATOMIC_API
+#  define ATOMIC_NO_EXPORT
+#else
+#  ifndef ATOMIC_API
+#    ifdef ATOMIC_EXPORTS
+        /* We are building this library */
+#      define ATOMIC_API __declspec(dllexport)
+#    else
+        /* We are using this library */
+#      define ATOMIC_API __declspec(dllimport)
+#    endif
+#  endif
+
+#  ifndef ATOMIC_NO_EXPORT
+#    define ATOMIC_NO_EXPORT 
+#  endif
+#endif
+
+#ifndef ATOMIC_DEPRECATED
+#  define ATOMIC_DEPRECATED __declspec(deprecated)
+#endif
+
+#ifndef ATOMIC_DEPRECATED_EXPORT
+#  define ATOMIC_DEPRECATED_EXPORT ATOMIC_API ATOMIC_DEPRECATED
+#endif
+
+#ifndef ATOMIC_DEPRECATED_NO_EXPORT
+#  define ATOMIC_DEPRECATED_NO_EXPORT ATOMIC_NO_EXPORT ATOMIC_DEPRECATED
+#endif
+
+#define DEFINE_NO_DEPRECATED 0
+#if DEFINE_NO_DEPRECATED
+# define ATOMIC_NO_DEPRECATED
+#endif
+
+#else
+
+#ifdef ATOMIC_STATIC_DEFINE
+#  define ATOMIC_API
+#  define ATOMIC_NO_EXPORT
+#else
+#  ifndef ATOMIC_API
+#    ifdef ATOMIC_EXPORTS
+        /* We are building this library */
+#      define ATOMIC_API __attribute__((visibility("default")))
+#    else
+        /* We are using this library */
+#      define ATOMIC_API __attribute__((visibility("default")))
+#    endif
+#  endif
+
+#  ifndef ATOMIC_NO_EXPORT
+#    define ATOMIC_NO_EXPORT __attribute__((visibility("hidden")))
+#  endif
+#endif
+
+#ifndef ATOMIC_DEPRECATED
+#  define ATOMIC_DEPRECATED __attribute__ ((__deprecated__))
+#endif
+
+#ifndef ATOMIC_DEPRECATED_EXPORT
+#  define ATOMIC_DEPRECATED_EXPORT ATOMIC_API ATOMIC_DEPRECATED
+#endif
+
+#ifndef ATOMIC_DEPRECATED_NO_EXPORT
+#  define ATOMIC_DEPRECATED_NO_EXPORT ATOMIC_NO_EXPORT ATOMIC_DEPRECATED
+#endif
+
+#define DEFINE_NO_DEPRECATED 0
+#if DEFINE_NO_DEPRECATED
+# define ATOMIC_NO_DEPRECATED
+#endif
+
+#endif
+
+#endif
+

+ 0 - 23
Source/Atomic/Atomic.h.in

@@ -1,23 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-@EXPORT_DEFINE@

+ 0 - 38
Source/Atomic/Atomic.pc.in

@@ -1,38 +0,0 @@
-#
-# Copyright (c) 2008-2014 the Urho3D project.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-
-prefix=@CMAKE_INSTALL_PREFIX@
-exec_prefix=${prefix}
-libdir=${exec_prefix}/@DEST_LIBRARY_DIR@
-includedir=${prefix}/include
-
-# Additional Cflags for various build configurations, which can be accessed as normal pkg-config variable using '--variable' option
-CFLAGS_DEBUG=@CMAKE_CXX_FLAGS_DEBUG@
-CFLAGS_RELEASE=@CMAKE_CXX_FLAGS_RELEASE@
-CFLAGS_RELWITHDEBINFO=@CMAKE_CXX_FLAGS_RELWITHDEBINFO@
-
-Name: Atomic
-Description: @ATOMIC_DESCRIPTION@
-Version: @ATOMIC_VERSION@
-URL: @ATOMIC_URL@
-Libs: @CMAKE_EXE_LINKER_FLAGS@ @ATOMIC_ABS_PATH_LIBS@ @LIB_DIR@ @ATOMIC_LIBS@
-Cflags: @ATOMIC_COMPILE_DEFINITIONS@ @CMAKE_CXX_FLAGS@ @GLOBAL_INCLUDE_DIRS@ @ENGINE_INCLUDE_DIRS@

+ 1 - 1
Source/Atomic/Audio/Audio.cpp

@@ -32,7 +32,7 @@
 #include "../Audio/SoundListener.h"
 #include "../Audio/SoundSource3D.h"
 
-#include <SDL/SDL.h>
+#include <SDL/include/SDL.h>
 
 #include "../DebugNew.h"
 

+ 54 - 329
Source/Atomic/CMakeLists.txt

@@ -1,329 +1,54 @@
-#
-# Copyright (c) 2008-2014 the Urho3D project.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-
-# Define target name
-set (TARGET_NAME Atomic)
-
-if (WIN32)
-    set (CMAKE_DEBUG_POSTFIX _d)
-endif ()
-
-# Define generated source files
-add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/librevision.h
-    COMMAND ${CMAKE_COMMAND} -DFILENAME=${CMAKE_CURRENT_BINARY_DIR}/librevision.h -P CMake/Modules/GetAtomicRevision.cmake
-    DEPENDS ${STATIC_LIBRARY_TARGETS} ${CMAKE_SOURCE_DIR}/CMake/Modules/GetAtomicRevision.cmake
-    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
-    COMMENT "Generating GIT revision number (tag + last commit SHA-1)")
-
-if (ATOMIC_LUA)
-    # The host tool must be built natively
-    if (CMAKE_CROSSCOMPILING OR IOS)
-        # When cross-compiling, build the host tool as external project
-        include (ExternalProject)
-        if (IOS)
-            # For iOS target, its host is MacOSX; Also workaround a known CMake/Xcode generator bug which prevents it from installing binaries correctly
-            set (OSX_HOST -DCMAKE_OSX_SYSROOT=macosx BUILD_COMMAND bash -c "sed -i '' 's/EFFECTIVE_PLATFORM_NAME//g' CMakeScripts/install_postBuildPhase.make*")
-        endif ()
-        ExternalProject_Add(tolua++
-            SOURCE_DIR ${CMAKE_SOURCE_DIR}/Source/ThirdParty/toluapp/src/bin
-            CMAKE_ARGS -DJIT=${JIT} -DDEST_RUNTIME_DIR=${CMAKE_BINARY_DIR}/bin/tool -DBAKED_CMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR} ${OSX_HOST}
-        )
-    else ()
-        # Otherwise, build it internally as per normal
-        add_subdirectory (../ThirdParty/toluapp/src/bin ../ThirdParty/toluapp/src/bin)
-    endif ()
-
-    # Use the host tool to generate source files for tolua++ API binding
-    file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/generated)
-    file (GLOB API_PKG_FILES LuaScript/pkgs/*.pkg)
-    foreach (DIR Navigation Network Physics Atomic2D)
-        string (TOUPPER ATOMIC_${DIR} OPT)
-        if (NOT ${OPT})
-            list (REMOVE_ITEM API_PKG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/pkgs/${DIR}LuaAPI.pkg)
-        endif ()
-    endforeach ()
-    foreach (API_PKG_FILE ${API_PKG_FILES})
-        get_filename_component (NAME ${API_PKG_FILE} NAME)
-        string (REGEX REPLACE LuaAPI\\.pkg$ "" DIR ${NAME})
-        set (GEN_CPP_FILE generated/${DIR}LuaAPI.cpp)
-        list (APPEND GEN_CPP_FILES ${GEN_CPP_FILE})
-        file (GLOB PKG_FILES LuaScript/pkgs/${DIR}/*.pkg)
-        add_custom_command (OUTPUT ${GEN_CPP_FILE}
-            COMMAND ${CMAKE_BINARY_DIR}/bin/tool/tolua++ -L ToCppHook.lua -o ${CMAKE_CURRENT_BINARY_DIR}/${GEN_CPP_FILE} ${NAME}
-            DEPENDS tolua++ ${API_PKG_FILE} ${PKG_FILES} LuaScript/pkgs/ToCppHook.lua
-            WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/LuaScript/pkgs
-            COMMENT "Generating tolua++ DIR binding on the fly for ${DIR}")
-    endforeach ()
-else ()
-    list (APPEND EXCLUDED_SOURCE_DIRS LuaScript)
-endif ()
-
-# Define generated object files
-# This is a hack as it relies on internal working of CMake
-if (MSVC AND ATOMIC_LIB_TYPE STREQUAL SHARED)   # MSVC linker does not have force_load/whole_archive equivalent
-    foreach (TARGET ${STATIC_LIBRARY_TARGETS})
-        get_target_property (SOURCES ${TARGET} SOURCES)
-        get_target_property (INT_DIR ${TARGET} LOCATION)
-        if (INT_DIR)
-            get_filename_component (INT_DIR ${INT_DIR} PATH)
-            if (CMAKE_GENERATOR MATCHES 2008)
-                string (REPLACE /$(OutDir) /${TARGET}.dir/$(ConfigurationName) INT_DIR ${INT_DIR})
-            else ()
-                string (REPLACE /$(Configuration) /${TARGET}.dir/$(ConfigurationName) INT_DIR ${INT_DIR})
-            endif ()
-            foreach (SOURCE ${SOURCES})
-                get_filename_component (NAME ${SOURCE} NAME)
-                if (NAME MATCHES \\.c.*$|\\.mm?$|\\.S$|\\.s$)
-                    string (REGEX REPLACE \\.c.*$|\\.mm?$|\\.S$|\\.s$ "" NAME ${NAME})
-                    list (APPEND OBJ_FILES ${INT_DIR}/${NAME}.obj)
-                elseif (NAME MATCHES \\.o.*$)
-                    list (APPEND OBJ_FILES ${SOURCE})
-                endif ()
-            endforeach ()
-            source_group ("Object Files\\${TARGET}" FILES ${OBJ_FILES})
-            list (APPEND ALL_OBJ_FILES ${OBJ_FILES})
-            unset (OBJ_FILES)
-        endif ()
-    endforeach ()
-endif ()
-
-# Define source files
-if (NOT ATOMIC_ANGELSCRIPT)
-    list (APPEND EXCLUDED_SOURCE_DIRS Script)
-endif ()
-foreach (DIR Navigation Network Physics Atomic2D)
-    string (TOUPPER ATOMIC_${DIR} OPT)
-    if (NOT ${OPT})
-        list (APPEND EXCLUDED_SOURCE_DIRS ${DIR})
-    endif ()
-endforeach ()
-if (ATOMIC_OPENGL)
-    # Exclude the opposite source directory
-    list (APPEND EXCLUDED_SOURCE_DIRS Graphics/Direct3D9)
-else ()
-    list (APPEND EXCLUDED_SOURCE_DIRS Graphics/OpenGL)
-endif ()
-if (APPLE AND NOT IOS)
-    set (GLOB_OBJC_PATTERN *.mm)     # Should only pick up MacFileWatcher.mm for MacOSX platform at the moment
-endif ()
-string (REPLACE ";" "/[^;]+;" EXCLUDE_PATTERNS "${EXCLUDED_SOURCE_DIRS};")
-define_source_files (EXCLUDE_PATTERNS ${EXCLUDE_PATTERNS} GLOB_CPP_PATTERNS *.cpp ${GLOB_OBJC_PATTERN} EXTRA_H_FILES librevision.h RECURSE GROUP PCH)
-list (APPEND SOURCE_FILES ${GEN_CPP_FILES} ${ALL_OBJ_FILES})
-set_source_files_properties (${ALL_OBJ_FILES} PROPERTIES GENERATED TRUE)
-
-# Define dependency libs
-# Add include directories to find the precompiled header, export header, and installed headers from thirdparty libs
-set (INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty)
-if (ATOMIC_PHYSICS)
-    # Bullet library depends on its own include dir to be added in the header search path
-    # This is more practical than patching its header files in many places to make them work with relative path
-    list (APPEND INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty/Bullet)
-endif ()
-if (ATOMIC_LUA)
-    # ditto for Lua/LuaJIT
-    list (APPEND INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${DEST_INCLUDE_DIR}/ThirdParty/Lua${JIT})
-endif ()
-
-# Setup library output path
-if (ANDROID)
-    set (OUTPUT_PATH ${ANDROID_LIBRARY_OUTPUT_PATH})
-else ()
-    set (OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
-endif ()
-set_output_directories (${OUTPUT_PATH} ARCHIVE LIBRARY)
- 
-# Setup target
-setup_library (${ATOMIC_LIB_TYPE})
-if (NOT ANDROID)
-    file (READ .soversion SOVERSION)
-    string (STRIP ${SOVERSION} SOVERSION)
-    string (REGEX MATCH "([^.]+)\\.([^.]+)\\.(.+)" MATCHED ${SOVERSION})
-    if (MATCHED)
-        set_target_properties (${TARGET_NAME} PROPERTIES VERSION ${MATCHED} SOVERSION ${CMAKE_MATCH_1})
-    else ()
-        message (FATAL_ERROR "The .soversion file is corrupted. It should contain a version number with this format major(0xFFFF).minor(0xFF).patch-level(0xFF). e.g.: 0.1.2")
-    endif ()
-endif ()
-install (TARGETS ${TARGET_NAME} RUNTIME DESTINATION ${DEST_RUNTIME_DIR} LIBRARY DESTINATION ${DEST_LIBRARY_DIR} ARCHIVE DESTINATION ${DEST_LIBRARY_DIR})
-if (NOT GIT_EXIT_CODE EQUAL 0)
-    add_dependencies (${TARGET_NAME} ${STATIC_LIBRARY_TARGETS})
-endif ()
-
-# Setup dependency frameworks and libraries
-if (APPLE)
-    if (IOS)
-        setup_ios_linker_flags (LINKER_FLAGS)
-        # Add a custom target to build Mach-O universal binary consisting of iphoneos (universal ARM archs including 'arm64' if 64-bit is enabled) and iphonesimulator (i386 arch and also x86_64 arch if 64-bit is enabled)
-        add_custom_target (${TARGET_NAME}_universal
-            COMMAND lipo -info $<TARGET_FILE:${TARGET_NAME}> |egrep -v 'i386.+armv7' && xcodebuild -target ${TARGET_NAME} -configuration $(CONFIGURATION) -sdk iphonesimulator && mv $<TARGET_FILE:${TARGET_NAME}>{,.iphonesimulator} && xcodebuild -target ${TARGET_NAME} -configuration $(CONFIGURATION) -sdk iphoneos && mv $<TARGET_FILE:${TARGET_NAME}>{,.iphoneos} && lipo -create -output $<TARGET_FILE:${TARGET_NAME}>{,.iphonesimulator,.iphoneos} && rm $<TARGET_FILE:${TARGET_NAME}>{.iphonesimulator,.iphoneos} || echo $<TARGET_FILE:${TARGET_NAME}> is already a Mach-O universal binary consisting of both iphoneos and iphonesimulator archs
-            WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
-            COMMENT "Creating Mach-O universal binary library consisting of both iphoneos and iphonesimulator archs")
-    else ()
-        # Intentionally use built-in CMAKE_EXE_LINKER_FLAGS here although CMake does not use it when building library, but the variable would be used later when configuring Atomic.pc for MacOSX platform
-        setup_macosx_linker_flags (CMAKE_EXE_LINKER_FLAGS)
-        # LuaJIT 64-bit specific - replace EXE linker flags with flags for building shared library (adapted from LuaJIT's original Makefile)
-        string (REPLACE "-pagezero_size 10000 -image_base 100000000" "-image_base 7fff04c4a000" LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS})
-    endif ()
-    set_target_properties (${TARGET_NAME} PROPERTIES LINK_FLAGS ${LINKER_FLAGS})
-    set (FORCE_LOAD -force_load)
-elseif (NOT MSVC)
-    set_property (TARGET ${TARGET_NAME} APPEND PROPERTY LINK_LIBRARIES -Wl,--whole-archive)
-    if (WIN32 AND ATOMIC_LIB_TYPE STREQUAL SHARED)
-        set_target_properties (${TARGET_NAME} PROPERTIES PREFIX "")
-    endif ()
-endif ()
-foreach (TARGET ${STATIC_LIBRARY_TARGETS})
-    get_target_property (ARCHIVE ${TARGET} LOCATION)
-    if (ARCHIVE)
-        if (NOT MSVC)
-            set_property (TARGET ${TARGET_NAME} APPEND PROPERTY LINK_LIBRARIES ${FORCE_LOAD} ${ARCHIVE})    # Only works in Apple (Xcode and Makefile) and GCC while building shared library
-        endif ()
-        if (XCODE OR MSVC)
-            set_property (TARGET ${TARGET_NAME} APPEND_STRING PROPERTY STATIC_LIBRARY_FLAGS " ${ARCHIVE}")  # Only works in Apple (Xcode only) and MSVC while building static library
-        else ()
-            list (APPEND ARCHIVES ${ARCHIVE})
-        endif ()
-    endif ()
-endforeach ()
-if (NOT XCODE AND NOT MSVC)
-    if (NOT APPLE)
-        set_property (TARGET ${TARGET_NAME} APPEND PROPERTY LINK_LIBRARIES -Wl,--no-whole-archive)
-    endif ()
-    if (NOT ATOMIC_LIB_TYPE STREQUAL SHARED)    # GCC ar does not take archives directly as input like Apple libtool, however, it can be scripted to do so
-        if (APPLE)
-            add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
-                COMMAND mv $<TARGET_FILE:${TARGET_NAME}>{,.engine}
-                COMMAND libtool -static $<TARGET_FILE:${TARGET_NAME}>.engine ${ARCHIVES} -o $<TARGET_FILE:${TARGET_NAME}>
-                COMMAND rm $<TARGET_FILE:${TARGET_NAME}>.engine
-                COMMENT "Merging all archives into a single static library using libtool")
-        else ()
-            add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
-                COMMAND ${CMAKE_COMMAND} -E rename $<TARGET_FILE:${TARGET_NAME}> $<TARGET_FILE:${TARGET_NAME}>.engine
-                COMMAND echo CREATE $<TARGET_FILE:${TARGET_NAME}> >script.ar
-                COMMAND echo ADDLIB $<TARGET_FILE:${TARGET_NAME}>.engine >>script.ar)
-            foreach (ARCHIVE ${ARCHIVES})
-                add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND echo ADDLIB ${ARCHIVE} >>script.ar)
-            endforeach ()
-            add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
-                COMMAND echo SAVE >>script.ar
-                COMMAND echo END >>script.ar
-                COMMAND ${CMAKE_AR} -M <script.ar
-                COMMAND ${CMAKE_COMMAND} -E remove $<TARGET_FILE:${TARGET_NAME}>.engine script.ar
-                COMMENT "Merging all archives into a single static library using ar")
-        endif ()
-    endif ()
-endif ()
-# todo This is a deprecated property in CMake version 2.8.12 - Remove below commands when CMake minimum version is 2.8.12
-if (CMAKE_VERSION VERSION_LESS 2.8.12)
-    set_target_properties (${TARGET_NAME} PROPERTIES LINK_INTERFACE_LIBRARIES "")
-    if (ATOMIC_LIB_TYPE STREQUAL SHARED)
-        if (NOT MSVC AND CMAKE_VERSION VERSION_LESS 2.8.11)
-            get_target_property (LINK_LIBRARIES ${TARGET_NAME} LINK_LIBRARIES)
-            target_link_libraries (${TARGET_NAME} LINK_PRIVATE ${LINK_LIBRARIES})
-        endif ()
-    else ()
-        set_target_properties (${TARGET_NAME} PROPERTIES LINK_LIBRARIES "")
-    endif ()
-endif ()
-# end todo
-
-# Generate platform specific export header file automatically
-if (${CMAKE_CURRENT_SOURCE_DIR}/Atomic.h.in IS_NEWER_THAN ${CMAKE_CURRENT_BINARY_DIR}/Atomic.h)
-    set_target_properties (${TARGET_NAME} PROPERTIES DEFINE_SYMBOL ATOMIC_EXPORTS)
-    generate_export_header (${TARGET_NAME} EXPORT_MACRO_NAME ATOMIC_API EXPORT_FILE_NAME Atomic.h)
-    file (READ ${CMAKE_CURRENT_BINARY_DIR}/Atomic.h EXPORT_DEFINE)
-    if (MSVC)
-        string (REPLACE "#define ATOMIC_API_H" "#define ATOMIC_API_H\n\n#pragma warning(disable: 4251)\n#pragma warning(disable: 4275)" EXPORT_DEFINE ${EXPORT_DEFINE})
-    endif ()
-    configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Atomic.h.in ${CMAKE_CURRENT_BINARY_DIR}/Atomic.h)
-endif ()
-
-# Install headers for using the Atomic library
-install_header_files (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${DEST_INCLUDE_DIR} FILES_MATCHING PATTERN *.h USE_FILE_SYMLINK)    # Note: the trailing slash is significant
-install_header_files (FILES ${CMAKE_CURRENT_BINARY_DIR}/librevision.h ${CMAKE_CURRENT_BINARY_DIR}/Atomic.h DESTINATION ${DEST_INCLUDE_DIR})
-
-# Generate platform specific pkg-config file for the benefit of Atomic library users via SDK without CMake
-get_directory_property (ATOMIC_COMPILE_DEFINITIONS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS)
-list (REMOVE_ITEM ATOMIC_COMPILE_DEFINITIONS HAVE_STDINT_H GLEW_STATIC GLEW_NO_GLU)     # Remove those defines that are only used for building the library and not needed by library user
-if (ABSOLUTE_PATH_LIBS)
-    string (REPLACE ";" "\" \"" ATOMIC_ABS_PATH_LIBS "\"${ABSOLUTE_PATH_LIBS}\"")   # Note: need to always "stringify" a variable in list context for replace to work correctly, besides the list could be empty
-    string (REPLACE "${SYSROOT}" "\${pc_sysrootdir}" ATOMIC_ABS_PATH_LIBS "${ATOMIC_ABS_PATH_LIBS}")
-endif ()
-set (LIB_NAME Atomic)
-if (MINGW)
-    if (CMAKE_BUILD_TYPE STREQUAL Debug)
-        set (LIB_NAME ${LIB_NAME}_d)
-    endif ()
-    if (ATOMIC_LIB_TYPE STREQUAL SHARED)
-        set (LIB_NAME ${LIB_NAME}.dll)
-    endif ()
-endif ()
-if (MSVC)
-    # todo: Add a post build command to adjust the LIB_NAME when in Debug configuration (CMake/VS generator is multi-config)
-    set (DASH /)
-    set (LIB_DIR "/LIBPATH:\"\${libdir}\"")
-    string (REPLACE ";" ".lib\" \"" ATOMIC_LIBS "\"${LIB_NAME};${LIBS}.lib\"")
-else ()
-    set (DASH -)
-    set (LIB_DIR "-L\"\${libdir}\"")
-    string (REPLACE ";" " -l" ATOMIC_LIBS "-l${LIB_NAME};${LIBS}")
-endif ()
-string (REPLACE ";" " ${DASH}D" ATOMIC_COMPILE_DEFINITIONS ";${ATOMIC_COMPILE_DEFINITIONS}")
-get_directory_property (GLOBAL_INCLUDE_DIRS DIRECTORY ${CMAKE_SOURCE_DIR} INCLUDE_DIRECTORIES)
-if (GLOBAL_INCLUDE_DIRS)
-    string (REPLACE ";" "\" ${DASH}I\"" GLOBAL_INCLUDE_DIRS "${DASH}I\"${GLOBAL_INCLUDE_DIRS}\"")
-    string (REPLACE "${SYSROOT}" "" GLOBAL_INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS})
-endif ()
-set (ENGINE_INCLUDE_DIRS "${DASH}I\"\${includedir}\" ${DASH}I\"\${includedir}/${PATH_SUFFIX}/ThirdParty\"")
-configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Atomic.pc.in ${CMAKE_CURRENT_BINARY_DIR}/Atomic.pc @ONLY)
-if (ANDROID)
-    set (RENAME RENAME Atomic-${ANDROID_NDK_ABI_NAME}.pc)
-endif ()
-install (FILES ${CMAKE_CURRENT_BINARY_DIR}/Atomic.pc DESTINATION ${DEST_PKGCONFIG_DIR} ${RENAME})
-
-# Setup the compiler flags for building shared library (do this here so that it does not interfere with the pkg-config file generation above)
-if (ATOMIC_LIB_TYPE STREQUAL SHARED)
-    # Hide the symbols that are not explicitly marked for export
-    add_compiler_export_flags ()
-    # Use PIC on platforms that support it (shared library type has this property set to true by default, so we only have to deal with those static ones that the shared library links against)
-    set_target_properties (${STATIC_LIBRARY_TARGETS} PROPERTIES POSITION_INDEPENDENT_CODE true)
-    if (NOT MSVC AND NOT (CMAKE_CROSSCOMPILING AND MINGW) AND CMAKE_VERSION VERSION_LESS 2.8.9)  # todo: Remove this when CMake minimum version is 2.8.9
-        set_property (TARGET ${STATIC_LIBRARY_TARGETS} APPEND PROPERTY COMPILE_FLAGS -fPIC)
-    endif ()
-endif ()
-
-# Define post build steps
-if (ANDROID_NDK_GDB)
-    # Copy the library while it still has debug symbols for ndk-gdb
-    add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${TARGET_NAME}> ${NDK_GDB_SOLIB_PATH}
-        COMMENT "Copying Atomic library with debug symbols to ${NDK_GDB_SOLIB_PATH} directory")
-endif ()
-if (ATOMIC_LIB_TYPE STREQUAL SHARED AND (ANDROID OR RPI OR IOS))
-    # Strip the output shared library for embedded devices
-    add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_STRIP} $<TARGET_FILE:${TARGET_NAME}>
-        COMMENT "Stripping Atomic shared library")
-endif ()
-if (ATOMIC_SCP_TO_TARGET)
-    # Ensure SCP is the last command
-    add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND scp $<TARGET_FILE:${TARGET_NAME}> ${ATOMIC_SCP_TO_TARGET} || exit 0
-        COMMENT "Scp-ing Atomic library to target system")
-endif ()
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/Source/ThirdParty
+                    ${CMAKE_SOURCE_DIR}/Source/ThirdParty/rapidjson/include
+                    ${CMAKE_SOURCE_DIR}/Source/ThirdParty/kNet/include
+                    ${CMAKE_SOURCE_DIR}/Source/ThirdParty/FreeType/include
+                    ${CMAKE_SOURCE_DIR}/Source/ThirdParty/Box2D)
+
+file (GLOB CONTAINER_SOURCE Container/*.cpp Container/*.h)
+file (GLOB CORE_SOURCE Core/*.cpp Core/*.h)
+file (GLOB MATH_SOURCE Math/*.cpp Math/*.h)
+file (GLOB ENGINE_SOURCE Engine/*.cpp Engine/*.h)
+file (GLOB INPUT_SOURCE Input/*.cpp Input/*.h)
+file (GLOB IO_SOURCE IO/*.cpp IO/*.h)
+file (GLOB RESOURCE_SOURCE Resource/*.cpp Resource/*.h)
+file (GLOB AUDIO_SOURCE Audio/*.cpp Audio/*.h)
+file (GLOB PHYSICS_SOURCE Physics/*.cpp Physics/*.h)
+file (GLOB NAVIGATION_SOURCE Navigation/*.cpp Navigation/*.h)
+file (GLOB NETWORK_SOURCE Network/*.cpp Network/*.h)
+file (GLOB ENVIRONMENT_SOURCE Environment/*.cpp Environment/*.h)
+file (GLOB ATOMIC2D_SOURCE Atomic2D/*.cpp Atomic2D/*.h)
+file (GLOB JAVASCRIPT_SOURCE Javascript/*.cpp Javascript/*.h Javascript/Modules/*.cpp  Javascript/Modules/*.h )
+file (GLOB SCENE_SOURCE Scene/*.cpp Scene/*.h)
+file (GLOB UI_SOURCE UI/*.cpp UI/*.h)
+
+file (GLOB GRAPHICS_SOURCE Graphics/*.cpp Graphics/*.h)
+
+if (MSVC)
+    file (GLOB GRAPHICS_IMPL_SOURCE Graphics/Direct3D9/*.cpp Graphics/Direct3D9/*.h)
+else()
+
+# for kNet
+    add_definitions (-DUNIX)
+    file (GLOB GRAPHICS_IMPL_SOURCE Graphics/OpenGL/*.cpp Graphics/OpenGL/*.h)
+
+endif()
+
+if (APPLE)
+    set (PLATFORM_SOURCE IO/MacFileWatcher.mm)
+endif()
+
+
+
+
+set (SOURCE_FILES ${CONTAINER_SOURCE} ${CORE_SOURCE} ${ENGINE_SOURCE} ${INPUT_SOURCE}
+                  ${AUDIO_SOURCE} ${IO_SOURCE} ${MATH_SOURCE} ${NETWORK_SOURCE}
+                  ${RESOURCE_SOURCE}
+                  ${GRAPHICS_SOURCE} ${GRAPHICS_IMPL_SOURCE}
+                  ${PHYSICS_SOURCE} ${NAVIGATION_SOURCE}
+                  ${ATOMIC2D_SOURCE} ${ENVIRONMENT_SOURCE}
+                  ${JAVASCRIPT_SOURCE} ${SCENE_SOURCE} ${UI_SOURCE}
+                  ${PLATFORM_SOURCE})
+
+add_library(Atomic ${SOURCE_FILES})
+

+ 1 - 1
Source/Atomic/Core/ProcessUtils.cpp

@@ -35,7 +35,7 @@
 #if defined(IOS)
 #include <mach/mach_host.h>
 #elif !defined(ANDROID) && !defined(RPI)
-#include <LibCpuId/libcpuid.h>
+#include <LibCpuId/src/libcpuid.h>
 #endif
 
 #ifdef WIN32

+ 0 - 4
Source/Atomic/Environment/CMakeLists.txt

@@ -1,4 +0,0 @@
-
-
-# Define source files
-define_source_files (PARENT_SCOPE)

+ 1 - 1
Source/Atomic/Graphics/Direct3D9/D3D9Graphics.cpp

@@ -58,7 +58,7 @@
 #include "../../Graphics/VertexDeclaration.h"
 #include "../../Graphics/Zone.h"
 
-#include <SDL/SDL_syswm.h>
+#include <SDL/include/SDL_syswm.h>
 
 #include "../../DebugNew.h"
 

+ 1 - 1
Source/Atomic/Graphics/Direct3D9/D3D9GraphicsImpl.h

@@ -25,7 +25,7 @@
 #include "../../Math/Color.h"
 
 #include <d3d9.h>
-#include <SDL/SDL.h>
+#include <SDL/include/SDL.h>
 
 namespace Atomic
 {

+ 1 - 1
Source/Atomic/Graphics/OpenGL/OGLGraphicsImpl.h

@@ -58,7 +58,7 @@
 #define COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8c03
 #endif
 
-#include <SDL/SDL.h>
+#include <SDL/include/SDL.h>
 
 namespace Atomic
 {

+ 1 - 1
Source/Atomic/IO/FileSystem.cpp

@@ -31,7 +31,7 @@
 #include "../IO/Log.h"
 #include "../Core/Thread.h"
 
-#include <SDL/SDL_filesystem.h>
+#include <SDL/include/SDL_filesystem.h>
 
 #include <cstdio>
 #include <cstring>

+ 1 - 1
Source/Atomic/IO/RWOpsWrapper.h

@@ -24,7 +24,7 @@
 
 #include "../IO/File.h"
 
-#include <SDL/SDL_rwops.h>
+#include <SDL/include/SDL_rwops.h>
 
 namespace Atomic
 {

+ 1 - 1
Source/Atomic/Input/Input.cpp

@@ -40,7 +40,7 @@
 
 #include <cstring>
 
-#include <SDL/SDL.h>
+#include <SDL/include/SDL.h>
 
 #include "../DebugNew.h"
 

+ 4 - 4
Source/Atomic/Input/InputEvents.h

@@ -24,10 +24,10 @@
 
 #include "../Core/Object.h"
 
-#include <SDL/SDL_joystick.h>
-#include <SDL/SDL_gamecontroller.h>
-#include <SDL/SDL_keycode.h>
-#include <SDL/SDL_mouse.h>
+#include <SDL/include/SDL_joystick.h>
+#include <SDL/include/SDL_gamecontroller.h>
+#include <SDL/include/SDL_keycode.h>
+#include <SDL/include/SDL_mouse.h>
 
 namespace Atomic
 {

+ 0 - 5
Source/Atomic/Javascript/CMakeLists.txt

@@ -1,5 +0,0 @@
-
-
-define_source_files (GLOB_CPP_PATTERNS *.cpp *.c Modules/*.cpp GLOB_H_PATTERNS *.h PARENT_SCOPE)
-
-

+ 4 - 4
Source/Atomic/Navigation/NavigationMesh.cpp

@@ -41,10 +41,10 @@
 #include "../IO/VectorBuffer.h"
 
 #include <cfloat>
-#include <Detour/DetourNavMesh.h>
-#include <Detour/DetourNavMeshBuilder.h>
-#include <Detour/DetourNavMeshQuery.h>
-#include <Recast/Recast.h>
+#include <Detour/include/DetourNavMesh.h>
+#include <Detour/include/DetourNavMeshBuilder.h>
+#include <Detour/include/DetourNavMeshQuery.h>
+#include <Recast/include/Recast.h>
 
 #include "../DebugNew.h"
 

+ 1 - 1
Source/Atomic/Network/Connection.cpp

@@ -38,7 +38,7 @@
 #include "../Scene/SceneEvents.h"
 #include "../Scene/SmoothedTransform.h"
 
-#include <kNet/kNet.h>
+#include <kNet.h>
 
 #include "../DebugNew.h"
 

+ 2 - 2
Source/Atomic/Network/Connection.h

@@ -29,8 +29,8 @@
 #include "../Core/Timer.h"
 #include "../IO/VectorBuffer.h"
 
-#include <kNet/kNetFwd.h>
-#include <kNet/SharedPtr.h>
+#include <kNet/include/kNetFwd.h>
+#include <kNet/include/kNet/SharedPtr.h>
 
 #ifdef SendMessage
 #undef SendMessage

+ 1 - 1
Source/Atomic/Network/HttpRequest.cpp

@@ -26,7 +26,7 @@
 #include "../Core/Profiler.h"
 #include "../Core/Timer.h"
 
-#include <Civetweb/civetweb.h>
+#include <Civetweb/include/civetweb.h>
 
 #include "../DebugNew.h"
 

+ 1 - 1
Source/Atomic/Network/Network.cpp

@@ -37,7 +37,7 @@
 #include "../Network/Protocol.h"
 #include "../Scene/Scene.h"
 
-#include <kNet/kNet.h>
+#include <kNet.h>
 
 #include "../DebugNew.h"
 

+ 2 - 2
Source/Atomic/Network/Network.h

@@ -27,8 +27,8 @@
 #include "../Core/Object.h"
 #include "../IO/VectorBuffer.h"
 
-#include <kNet/IMessageHandler.h>
-#include <kNet/INetworkServerListener.h>
+#include <kNet/include/kNet/IMessageHandler.h>
+#include <kNet/include/kNet/INetworkServerListener.h>
 
 namespace Atomic
 {

+ 13 - 13
Source/Atomic/Physics/CollisionShape.cpp

@@ -40,19 +40,19 @@
 #include "../Graphics/Terrain.h"
 #include "../Graphics/VertexBuffer.h"
 
-#include <Bullet/BulletCollision/CollisionDispatch/btInternalEdgeUtility.h>
-#include <Bullet/BulletCollision/CollisionShapes/btBoxShape.h>
-#include <Bullet/BulletCollision/CollisionShapes/btCapsuleShape.h>
-#include <Bullet/BulletCollision/CollisionShapes/btCompoundShape.h>
-#include <Bullet/BulletCollision/CollisionShapes/btConeShape.h>
-#include <Bullet/BulletCollision/CollisionShapes/btConvexHullShape.h>
-#include <Bullet/BulletCollision/CollisionShapes/btCylinderShape.h>
-#include <Bullet/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h>
-#include <Bullet/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h>
-#include <Bullet/BulletCollision/CollisionShapes/btSphereShape.h>
-#include <Bullet/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h>
-#include <Bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h>
-#include <Bullet/BulletCollision/CollisionShapes/btStaticPlaneShape.h>
+#include <Bullet/src/BulletCollision/CollisionDispatch/btInternalEdgeUtility.h>
+#include <Bullet/src/BulletCollision/CollisionShapes/btBoxShape.h>
+#include <Bullet/src/BulletCollision/CollisionShapes/btCapsuleShape.h>
+#include <Bullet/src/BulletCollision/CollisionShapes/btCompoundShape.h>
+#include <Bullet/src/BulletCollision/CollisionShapes/btConeShape.h>
+#include <Bullet/src/BulletCollision/CollisionShapes/btConvexHullShape.h>
+#include <Bullet/src/BulletCollision/CollisionShapes/btCylinderShape.h>
+#include <Bullet/src/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h>
+#include <Bullet/src/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h>
+#include <Bullet/src/BulletCollision/CollisionShapes/btSphereShape.h>
+#include <Bullet/src/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h>
+#include <Bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h>
+#include <Bullet/src/BulletCollision/CollisionShapes/btStaticPlaneShape.h>
 #include <StanHull/hull.h>
 
 namespace Atomic

+ 5 - 5
Source/Atomic/Physics/Constraint.cpp

@@ -31,11 +31,11 @@
 #include "../Physics/RigidBody.h"
 #include "../Scene/Scene.h"
 
-#include <Bullet/BulletDynamics/ConstraintSolver/btConeTwistConstraint.h>
-#include <Bullet/BulletDynamics/ConstraintSolver/btHingeConstraint.h>
-#include <Bullet/BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h>
-#include <Bullet/BulletDynamics/ConstraintSolver/btSliderConstraint.h>
-#include <Bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h>
+#include <Bullet/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.h>
+#include <Bullet/src/BulletDynamics/ConstraintSolver/btHingeConstraint.h>
+#include <Bullet/src/BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h>
+#include <Bullet/src/BulletDynamics/ConstraintSolver/btSliderConstraint.h>
+#include <Bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h>
 
 namespace Atomic
 {

+ 2 - 2
Source/Atomic/Physics/PhysicsUtils.h

@@ -25,8 +25,8 @@
 #include "../Math/Quaternion.h"
 #include "../Math/Vector3.h"
 
-#include <Bullet/LinearMath/btVector3.h>
-#include <Bullet/LinearMath/btQuaternion.h>
+#include <Bullet/src/LinearMath/btVector3.h>
+#include <Bullet/src/LinearMath/btQuaternion.h>
 
 namespace Atomic
 {

+ 8 - 8
Source/Atomic/Physics/PhysicsWorld.cpp

@@ -38,14 +38,14 @@
 #include "../Scene/SceneEvents.h"
 #include "../Container/Sort.h"
 
-#include <Bullet/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h>
-#include <Bullet/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h>
-#include <Bullet/BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.h>
-#include <Bullet/BulletCollision/CollisionDispatch/btInternalEdgeUtility.h>
-#include <Bullet/BulletCollision/CollisionShapes/btBoxShape.h>
-#include <Bullet/BulletCollision/CollisionShapes/btSphereShape.h>
-#include <Bullet/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h>
-#include <Bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h>
+#include <Bullet/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h>
+#include <Bullet/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h>
+#include <Bullet/src/BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.h>
+#include <Bullet/src/BulletCollision/CollisionDispatch/btInternalEdgeUtility.h>
+#include <Bullet/src/BulletCollision/CollisionShapes/btBoxShape.h>
+#include <Bullet/src/BulletCollision/CollisionShapes/btSphereShape.h>
+#include <Bullet/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h>
+#include <Bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h>
 
 extern ContactAddedCallback gContactAddedCallback;
 

+ 1 - 1
Source/Atomic/Physics/PhysicsWorld.h

@@ -29,7 +29,7 @@
 #include "../Math/Vector3.h"
 #include "../IO/VectorBuffer.h"
 
-#include <Bullet/LinearMath/btIDebugDraw.h>
+#include <Bullet/src/LinearMath/btIDebugDraw.h>
 
 class btCollisionConfiguration;
 class btCollisionShape;

+ 3 - 3
Source/Atomic/Physics/RigidBody.cpp

@@ -36,9 +36,9 @@
 #include "../Scene/SceneEvents.h"
 #include "../Scene/SmoothedTransform.h"
 
-#include <Bullet/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h>
-#include <Bullet/BulletDynamics/Dynamics/btRigidBody.h>
-#include <Bullet/BulletCollision/CollisionShapes/btCompoundShape.h>
+#include <Bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h>
+#include <Bullet/src/BulletDynamics/Dynamics/btRigidBody.h>
+#include <Bullet/src/BulletCollision/CollisionShapes/btCompoundShape.h>
 
 namespace Atomic
 {

+ 1 - 1
Source/Atomic/Physics/RigidBody.h

@@ -25,7 +25,7 @@
 #include "../Scene/Component.h"
 #include "../IO/VectorBuffer.h"
 
-#include <Bullet/LinearMath/btMotionState.h>
+#include <Bullet/src/LinearMath/btMotionState.h>
 
 class btCompoundShape;
 class btRigidBody;

+ 1 - 1
Source/Atomic/Resource/Image.cpp

@@ -33,7 +33,7 @@
 #include <STB/stb_image.h>
 #include <STB/stb_image_write.h>
 #include <JO/jo_jpeg.h>
-#include <SDL/SDL_surface.h>
+#include <SDL/include/SDL_surface.h>
 
 #include "../DebugNew.h"
 

+ 1 - 1
Source/Atomic/Resource/XMLElement.cpp

@@ -25,7 +25,7 @@
 #include "../IO/Log.h"
 #include "../Resource/XMLFile.h"
 
-#include <PugiXml/pugixml.hpp>
+#include <PugiXml/src/pugixml.hpp>
 
 #include "../DebugNew.h"
 

+ 1 - 1
Source/Atomic/Resource/XMLFile.cpp

@@ -32,7 +32,7 @@
 #include "../IO/VectorBuffer.h"
 #include "../Resource/XMLFile.h"
 
-#include <PugiXml/pugixml.hpp>
+#include <PugiXml/src/pugixml.hpp>
 
 #include "../DebugNew.h"
 

+ 1 - 1
Source/Atomic/UI/Cursor.h

@@ -26,7 +26,7 @@
 #include "../Resource/Image.h"
 #include "../Graphics/Texture.h"
 
-#include <SDL/SDL_mouse.h>
+#include <SDL/include/SDL_mouse.h>
 
 namespace Atomic
 {

+ 1 - 1
Source/Atomic/UI/UI.cpp

@@ -55,7 +55,7 @@
 #include "../UI/Window.h"
 #include "../UI/View3D.h"
 
-#include <SDL/SDL.h>
+#include <SDL/include/SDL.h>
 
 #include "../DebugNew.h"
 

+ 1 - 0
Source/Atomic/librevision.h

@@ -0,0 +1 @@
+const char* revision="Unversioned";

+ 0 - 198
Source/CMake/Modules/FindUrho3D.cmake

@@ -1,198 +0,0 @@
-#
-# Copyright (c) 2008-2014 the Urho3D project.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-
-# Find Atomic library and include directories in the project root tree or installed location
-# For project root tree detection to work, Atomic library must be already been built
-#
-#  ATOMIC_FOUND
-#  ATOMIC_INCLUDE_DIRS
-#  ATOMIC_LIBRARIES
-#  ATOMIC_LIBRARIES_REL
-#  ATOMIC_LIBRARIES_DBG
-#
-
-if (ATOMIC_FOUND)
-    return ()
-endif ()
-
-# If the ATOMIC_LIB_TYPE build option changes then invalidate the found library cache
-if (NOT ATOMIC_LIB_TYPE STREQUAL ATOMIC_FOUND_LIB_TYPE)
-    unset (ATOMIC_LIBRARIES CACHE)
-    set (ATOMIC_FOUND_LIB_TYPE ${ATOMIC_LIB_TYPE} CACHE INTERNAL "Lib type when Atomic library was last found")
-
-    # Atomic prefers static library type by default while CMake prefers shared one, so we need to change CMake preference to agree with Atomic
-    if (NOT ATOMIC_LIB_TYPE STREQUAL SHARED)
-        list (REVERSE CMAKE_FIND_LIBRARY_SUFFIXES)
-    endif ()
-endif ()
-
-set (ATOMIC_LIB_NAMES Atomic)
-if (WIN32)
-    set (ATOMIC_LIB_NAMES_DBG Urho3D_d)
-endif ()
-
-if (CMAKE_PROJECT_NAME STREQUAL Atomic AND PROJECT_ROOT_DIR)
-    set (ATOMIC_HOME ${PROJECT_ROOT_DIR} CACHE PATH "Path to Atomic project root tree" FORCE)
-    set (IS_INTERNAL 1)
-elseif (NOT ATOMIC_HOME AND DEFINED ENV{ATOMIC_HOME})
-    file (TO_CMAKE_PATH "$ENV{ATOMIC_HOME}" ATOMIC_HOME)
-    set (ATOMIC_HOME ${ATOMIC_HOME} CACHE PATH "Path to Atomic project root tree")
-endif ()
-if (ATOMIC_HOME)
-    # Construct source tree paths from ATOMIC_HOME environment variable
-    find_file (ATOMIC_SOURCE_TREE Atomic.h.in ${ATOMIC_HOME}/Source/Engine DOC "Path to Atomic project source tree" NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
-    if (ATOMIC_SOURCE_TREE)
-        get_filename_component (ATOMIC_SOURCE_TREE ${ATOMIC_SOURCE_TREE} PATH)
-        set (ATOMIC_INCLUDE_DIRS ${ATOMIC_SOURCE_TREE})
-        foreach (DIR Audio Container Core Engine Graphics Input IO LuaScript Math Navigation Network Physics Resource Scene Script UI Atomic2D Javascript Environment)
-            list (APPEND ATOMIC_INCLUDE_DIRS ${ATOMIC_SOURCE_TREE}/${DIR})     # Note: variable change to list context after this
-        endforeach ()
-        set (DIRS SDL/include)
-        if (ATOMIC_ANGELSCRIPT)
-            list (APPEND DIRS AngelScript/include)
-        endif ()
-        if (ATOMIC_NETWORK)
-            list (APPEND DIRS kNet/include)
-        endif ()
-        if (ATOMIC_PHYSICS)
-            list (APPEND DIRS Bullet/src)
-        endif ()
-        if (ATOMIC_ATOMIC2D)
-            list (APPEND DIRS Box2D)
-        endif ()
-        if (ATOMIC_JAVASCRIPT)
-            list (APPEND DIRS Duktape)
-        endif ()        
-        if (ATOMIC_TBUI)
-            list (APPEND DIRS TurboBadger)
-        endif ()                                
-        foreach (DIR ${DIRS})
-            list (APPEND ATOMIC_INCLUDE_DIRS ${ATOMIC_HOME}/Source/ThirdParty/${DIR})
-        endforeach ()
-
-        # For non Atomic project using Atomic as external library, Atomic project itself must be built using predefined build directory as per specified in the provided build scripts.
-        if (IS_INTERNAL)
-            set (BINARY_DIR ${CMAKE_BINARY_DIR})
-        elseif (ANDROID AND CMAKE_HOST_WIN32 AND NOT ATOMIC_MKLINK)
-            set (BINARY_DIR ${ATOMIC_HOME}/Source/Android)
-        else ()
-            set (BINARY_DIR ${ATOMIC_HOME}/${PLATFORM_PREFIX}Build)
-        endif () 
-        list (APPEND ATOMIC_INCLUDE_DIRS ${BINARY_DIR}/Engine)
-        if (ANDROID)
-            if (IS_INTERNAL)
-                set (ATOMIC_LIB_SEARCH_PATH ${ANDROID_LIBRARY_OUTPUT_PATH})
-            else ()
-                set (ATOMIC_LIB_SEARCH_PATH ${BINARY_DIR}/libs/${ANDROID_NDK_ABI_NAME})
-            endif ()
-        else ()
-            set (ATOMIC_LIB_SEARCH_PATH ${ATOMIC_HOME}/${PLATFORM_PREFIX}Lib)
-        endif ()
-        if (TARGET Atomic)
-            set (ATOMIC_LIBRARIES Atomic)
-            set (FOUND_MESSAGE "Found Atomic: as CMake target")
-        else ()
-            find_library (ATOMIC_LIBRARIES NAMES ${ATOMIC_LIB_NAMES} PATHS ${ATOMIC_LIB_SEARCH_PATH} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
-            if (WIN32)
-                find_library (ATOMIC_LIBRARIES_DBG NAMES ${ATOMIC_LIB_NAMES_DBG} PATHS ${ATOMIC_LIB_SEARCH_PATH} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
-            endif ()
-        endif ()
-    endif ()
-else ()
-    # If Atomic SDK is not being installed in the default system location, use the CMAKE_PREFIX_PATH environment variable to specify the prefix path to that location
-    # Note that the prefix path should not contain the "/include" or "/lib"
-    # For example on Windows platform: CMAKE_PREFIX_PATH=C:/Users/john/Atomic if the SDK is installed using CMAKE_INSTALL_PREFIX=C:/Users/john/Atomic
-    # For example on Linux platform: CMAKE_PREFIX_PATH=/home/john/usr/local if the SDK is installed using DESTDIR=/home/john and CMAKE_INSTALL_PREFIX=/usr/local
-    if (CMAKE_HOST_WIN32)
-        set (ATOMIC_INC_SEARCH_PATH include)
-        set (ATOMIC_LIB_SEARCH_PATH lib)
-    else ()
-        set (PATH_SUFFIX Atomic)
-        if (IOS)
-            set (CMAKE_LIBRARY_ARCHITECTURE ios)
-        endif ()
-    endif ()
-    # Additional search paths are added by CMake by default which should already include most common platform specific paths
-    find_path (ATOMIC_INCLUDE_DIRS Atomic.h PATHS ${ATOMIC_INC_SEARCH_PATH} PATH_SUFFIXES ${PATH_SUFFIX})
-    find_library (ATOMIC_LIBRARIES NAMES ${ATOMIC_LIB_NAMES} PATHS ${ATOMIC_LIB_SEARCH_PATH} PATH_SUFFIXES ${PATH_SUFFIX})
-    if (WIN32)
-        find_library (ATOMIC_LIBRARIES_DBG NAMES ${ATOMIC_LIB_NAMES_DBG} PATHS ${ATOMIC_LIB_SEARCH_PATH} PATH_SUFFIXES ${PATH_SUFFIX})
-    endif ()
-
-    if (ATOMIC_INCLUDE_DIRS)
-        set (BASE_DIR ${ATOMIC_INCLUDE_DIRS})
-        set (DIRS SDL)
-        if (ATOMIC_ANGELSCRIPT)
-            list (APPEND DIRS AngelScript)
-        endif ()
-        if (ATOMIC_NETWORK)
-            list (APPEND DIRS kNet)
-        endif ()
-        if (ATOMIC_PHYSICS)
-            list (APPEND DIRS Bullet)
-        endif ()
-        if (ATOMIC_ATOMIC2D)
-            list (APPEND DIRS Box2D)
-        endif ()
-        if (ATOMIC_JAVASCRIPT)
-            list (APPEND DIRS Duktape)
-        endif ()                
-        if (ATOMIC_TBUI)
-            list (APPEND DIRS TurboBadger)
-        endif ()                        
-        foreach (DIR ${DIRS})
-            list (APPEND ATOMIC_INCLUDE_DIRS ${BASE_DIR}/${DIR})     # Note: variable change to list context after this, so we need BASE_DIR to remain the same
-        endforeach ()
-    endif ()
-endif ()
-
-if (WIN32)
-    set (ATOMIC_LIBRARIES_REL ${ATOMIC_LIBRARIES})
-    if (ATOMIC_LIBRARIES)
-        if (ATOMIC_LIBRARIES_DBG)
-            list (APPEND ATOMIC_LIBRARIES ${ATOMIC_LIBRARIES_DBG})
-        endif ()
-    else ()
-        set (ATOMIC_LIBRARIES ${ATOMIC_LIBRARIES_DBG})
-    endif ()
-endif ()
-
-if (ATOMIC_INCLUDE_DIRS AND ATOMIC_LIBRARIES)
-    set (ATOMIC_FOUND 1)
-    if (NOT FOUND_MESSAGE)
-        set (FOUND_MESSAGE "Found Atomic: ${ATOMIC_LIBRARIES}")
-    endif ()
-endif ()
-
-if (ATOMIC_FOUND)
-    include (FindPackageMessage)
-    FIND_PACKAGE_MESSAGE (Atomic ${FOUND_MESSAGE} "[${ATOMIC_LIBRARIES}][${ATOMIC_INCLUDE_DIRS}]")
-else ()
-    if (Urho3D_FIND_REQUIRED)
-        message (FATAL_ERROR
-            "Could not find Atomic library in default SDK installation location or Atomic project root tree. "
-            "For searching in a non-default Atomic SDK installation, use 'CMAKE_PREFIX_PATH' environment variable to specify the prefix path of the installation location. "
-            "For searching in a build tree of Atomic project, use 'ATOMIC_HOME' environment variable to specify the Urho3D project root directory. The Atomic library itself must already be built successfully.")
-    endif ()
-endif ()
-
-mark_as_advanced (ATOMIC_INCLUDE_DIRS ATOMIC_LIBRARIES ATOMIC_SOURCE_TREE ATOMIC_HOME)

+ 0 - 203
Source/CMake/Toolchains/emscripten.toolchain.cmake

@@ -1,203 +0,0 @@
-#-------------------------------------------------------------------------------
-#	emscripten.toolchain.cmake
-#	Oryol cmake toolchain file for cross-compiling to emscripten.
-#-------------------------------------------------------------------------------
-
-message("Target Platform: emscripten")
-
-#
-# FIXME FIXME FIXME:
-#
-#   emar currently has trouble using a non-standard .emscripten config
-#   file: https://github.com/kripken/emscripten/issues/2886
-#
-#   once this is fixed, set the CMAKE_AR_FLAGS variable to
-#   use the --em-config like the C/CXX compilers.
-#
-
-# depending on whether the official EMSDK is used or the
-# 'raw' emscripten SDK, OSX and Linux have 2 potential
-# locations for the emscripten SDK and the .emscripten file
-#
-# (NOTE: the 'raw SDK' is not supported on Windows)
-if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
-    set(EMSC_EMSDK_DIRNAME "sdks/windows/emsdk_portable/emscripten/incoming")
-    set(EMSC_RAWSDK_DIRNAME "")
-elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
-    set(EMSC_EMSDK_DIRNAME "sdks/emsdk_portable/emscripten/incoming")
-    set(EMSC_RAWSDK_DIRNAME "sdks/osx/emscripten")
-elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
-    set(EMSC_EMSDK_DIRNAME "sdks/linux/emsdk_portable/emscripten/incoming")
-    set(EMSC_RAWSDK_DIRNAME "sdks/linux/emscripten")
-endif()
-
-set(ORYOL_PLATFORM EMSCRIPTEN)
-set(ORYOL_PLATFORM_NAME "emsc")
-set(ORYOL_EMSCRIPTEN 1)
-set(ORYOL_POSIX 1)
-set(ORYOL_OPENGL 1)
-set(ORYOL_OPENGLES2 1)
-set(ORYOL_PLATFORM_DEFINES " -DORYOL_EMSCRIPTEN=1 -DORYOL_POSIX=1")
-
-# total memory is 128MB for main thread, and 16 MB for worker
-# NOTE: USE_MEMORY_INIT_FILE has/had problems that the script is already starting but the MEM file isn't loaded yet(?)
-# at least I'm having weird startup problems...
-set(EMSCRIPTEN_TOTAL_MEMORY 134217728)
-set(EMSCRIPTEN_TOTAL_MEMORY_WORKER 16777216)
-set(EMSCRIPTEN_USE_MEMORY_INIT_FILE 1)
-set(EMSCRIPTEN_LTO_LEVEL 1)
-set(EMSCRIPTEN_NO_FILESYSTEM 1)
-
-# disable closure for now, as long as ANGLE_instanced_array support is not fully supported in emscripten
-set(EMSCRIPTEN_USE_CLOSURE 0)
-set(EMSCRIPTEN_ASSERTIONS 0)
-set(EMSCRIPTEN_OUTLINING_LIMIT 20000)
-
-if (ORYOL_COMPILE_VERBOSE)
-    set(EMSCRIPTEN_BUILD_VERBOSE 1)
-else()
-    set(EMSCRIPTEN_BUILD_VERBOSE 0)
-endif()
-
-# exceptions on/off?
-if (ORYOL_EXCEPTIONS)
-    message("C++ exceptions are enabled")
-    set(ORYOL_EMSC_EXCEPTION_FLAGS "")
-    set(EMSCRIPTEN_DISABLE_EXCEPTION_CATCHING 0)
-else()
-    message("C++ exceptions are disabled")
-    set(ORYOL_EMSC_EXCEPTION_FLAGS "-fno-exceptions")
-    set(EMSCRIPTEN_DISABLE_EXCEPTION_CATCHING 1)
-endif()
-
-message("EMSCRIPTEN_TOTAL_MEMORY: ${EMSCRIPTEN_TOTAL_MEMORY}")
-message("EMSCRIPTEN_TOTAL_MEMORY_WORKER: ${EMSCRIPTEN_TOTAL_MEMORY_WORKER}")
-message("EMSCRIPTEN_USE_MEMORY_INIT_FILE: ${EMSCRIPTEN_USE_MEMORY_INIT_FILE}")
-message("EMSCRIPTEN_LTO_LEVEL: ${EMSCRIPTEN_LTO_LEVEL}")
-message("EMSCRIPTEN_USE_CLOSURE: ${EMSCRIPTEN_USE_CLOSURE}")
-message("EMSCRIPTEN_ASSERTIONS: ${EMSCRIPTEN_ASSERTIONS}")
-message("EMSCRIPTEN_OUTLINING_LIMIT: ${EMSCRIPTEN_OUTLINING_LIMIT}")
-message("EMSCRIPTEN_DISABLE_EXCEPTION_CATCHING: ${EMSCRIPTEN_DISABLE_EXCEPTION_CATCHING}")
-message("EMSCRIPTEN_NO_FILESYSTEM: ${EMSCRIPTEN_NO_FILESYSTEM}")
-
-set(CMAKE_SYSTEM_NAME Linux)
-set(CMAKE_SYSTEM_VERSION 1)
-set(COMPILING on)
-set(CMAKE_CROSSCOMPILING TRUE)
-
-# find the emscripten SDK and set the "EMSC_HAS_LOCAL_CONFIG" variable
-set(EMSC_HAS_LOCAL_CONFIG 0)
-macro(find_emscripten_sdk)
-    # first check for the official EMSDK, this does not allow to override
-    # the location of the .emscripten config file
-    get_filename_component(EMSCRIPTEN_ROOT_PATH "/Users/josh/Dev/${EMSC_EMSDK_DIRNAME}" ABSOLUTE)
-
-
-    message ("${EMSCRIPTEN_ROOT_PATH}")
-
-    if (EXISTS "${EMSCRIPTEN_ROOT_PATH}/emcc")
-        message("Emscripten SDK found (emsdk): ${EMSCRIPTEN_ROOT_PATH}")
-    else()
-        # check for the RAW SDK (not supported on Windows)
-        get_filename_component(EMSCRIPTEN_ROOT_PATH "${CMAKE_CURRENT_LIST_DIR}/../${EMSC_RAWSDK_DIRNAME}" ABSOLUTE)
-        if (EXISTS "${EMSCRIPTEN_ROOT_PATH}/emcc")
-            message("Emscripten SDK found (raw sdk): ${EMSCRIPTEN_ROOT_PATH}")
-            set(EMSC_HAS_LOCAL_CONFIG 1)
-        else()
-            message(FATAL_ERROR "Could not find emscripten SDK! See BUILD.md for instructions to setup Oryol for emscripten development!")
-        endif()
-    endif()
-endmacro()
-
-# find the emscripten SDK
-find_emscripten_sdk()
-
-# Normalize, convert Windows backslashes to forward slashes or CMake will crash.
-get_filename_component(EMSCRIPTEN_ROOT_PATH "${EMSCRIPTEN_ROOT_PATH}" ABSOLUTE)
-
-# Set the path to .emscripten file
-get_filename_component(EMSCRIPTEN_DOT_FILE "${EMSCRIPTEN_ROOT_PATH}/../.emscripten" ABSOLUTE)
-
-# Set up options that we always want to pass to emscripten
-if (EMSC_HAS_LOCAL_CONFIG)
-    set(EMSCRIPTEN_CONFIG_OPTIONS "--em-config ${EMSCRIPTEN_DOT_FILE}")
-else()
-    set(EMSCRIPTEN_CONFIG_OPTIONS "")    
-endif()
-
-# tool suffic (.bat on windows)
-if (CMAKE_HOST_WIN32)
-    set(EMCC_SUFFIX ".bat")
-else()
-    set(EMCC_SUFFIX "")
-endif()
-
-include(CMakeForceCompiler)
-CMAKE_FORCE_C_COMPILER("${CMAKE_C_COMPILER}" Clang)
-CMAKE_FORCE_CXX_COMPILER("${CMAKE_CXX_COMPILER}" Clang)
-
-# define configurations
-set(CMAKE_CONFIGURATION_TYPES Debug Release)
-
-# specify cross-compilers
-set(CMAKE_C_COMPILER "${EMSCRIPTEN_ROOT_PATH}/emcc${EMCC_SUFFIX}" CACHE PATH "gcc" FORCE)
-set(CMAKE_CXX_COMPILER "${EMSCRIPTEN_ROOT_PATH}/em++${EMCC_SUFFIX}" CACHE PATH "g++" FORCE)
-set(CMAKE_AR "${EMSCRIPTEN_ROOT_PATH}/emar${EMCC_SUFFIX}" CACHE PATH "archive" FORCE)
-set(CMAKE_LINKER "${EMSCRIPTEN_ROOT_PATH}/emcc${EMCC_SUFFIX}" CACHE PATH "linker" FORCE)
-set(CMAKE_RANLIB "${EMSCRIPTEN_ROOT_PATH}/emranlib${EMCC_SUFFIX}" CACHE PATH "ranlib" FORCE)
-
-# only search for libraries and includes in the toolchain
-set(CMAKE_FIND_ROOT_PATH ${EMSCRIPTEN_ROOT_PATH})
-set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
-set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
-
-set(CMAKE_SYSTEM_INCLUDE_PATH "${EMSCRIPTEN_ROOT_PATH}/system/include")
-
-# c++ compiler flags
-set(CMAKE_CXX_FLAGS "${ORYOL_PLATFORM_DEFINES} ${EMSCRIPTEN_CONFIG_OPTIONS} -std=c++11 -stdlib=libc++ ${ORYOL_EMSC_EXCEPTION_FLAGS} -fstrict-aliasing -Wall -Wno-warn-absolute-paths -Wno-multichar -Wextra -Wno-unused-parameter -Wno-unknown-pragmas -Wno-ignored-qualifiers -Wno-long-long -Wno-overloaded-virtual -Wno-deprecated-writable-strings -Wno-unused-volatile-lvalue")
-set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
-set(CMAKE_CXX_FLAGS_DEBUG "-O3 -g -D_DEBUG_ -D_DEBUG -DORYOL_DEBUG=1")
-set(CMAKE_CXX_FLAGS_PROFILING "-O3 --profiling")
-
-# c compiler flags
-set(CMAKE_C_FLAGS "${ORYOL_PLATFORM_DEFINES} ${EMSCRIPTEN_CONFIG_OPTIONS} -fstrict-aliasing -Wall -Wno-warn-absolute-paths -Wextra -Wno-multichar -Wno-unused-parameter -Wno-unknown-pragmas -Wno-ignored-qualifiers -Wno-long-long -Wno-overloaded-virtual -Wno-deprecated-writable-strings -Wno-unused-volatile-lvalue")
-set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")
-set(CMAKE_C_FLAGS_DEBUG "-O3 -g -D_DEBUG_ -D_DEBUG -DORYOL_DEBUG=1")
-set(CMAKE_C_FLAGS_PROFILING "-O3 --profiling")
-
-# linker flags
-set(CMAKE_EXE_LINKER_FLAGS "${EMSCRIPTEN_CONFIG_OPTIONS} --memory-init-file ${EMSCRIPTEN_USE_MEMORY_INIT_FILE} -s WARN_ON_UNDEFINED_SYMBOLS=1 -s TOTAL_MEMORY=${EMSCRIPTEN_TOTAL_MEMORY} -s DISABLE_EXCEPTION_CATCHING=${EMSCRIPTEN_DISABLE_EXCEPTION_CATCHING} -s NO_FILESYSTEM=${EMSCRIPTEN_NO_FILESYSTEM}")
-set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-O3 --llvm-lto ${EMSCRIPTEN_LTO_LEVEL} -s VERBOSE=${EMSCRIPTEN_BUILD_VERBOSE} -s ASM_JS=1 -s ASSERTIONS=${EMSCRIPTEN_ASSERTIONS} -s OUTLINING_LIMIT=${EMSCRIPTEN_OUTLINING_LIMIT} --closure ${EMSCRIPTEN_USE_CLOSURE}")
-set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-O3 -g -s ASM_JS=1 -s VERBOSE=${EMSCRIPTEN_BUILD_VERBOSE}")
-set(CMAKE_EXE_LINKER_FLAGS_PROFILING "--profiling -O3 --llvm-lto ${EMSCRIPTEN_LTO_LEVEL} -s VERBOSE=${EMSCRIPTEN_BUILD_VERBOSE} -s ASM_JS=1 -s ASSERTIONS=${EMSCRIPTEN_ASSERTIONS} -s OUTLINING_LIMIT=${EMSCRIPTEN_OUTLINING_LIMIT}")
-
-# dynamic lib linker flags
-set(CMAKE_SHARED_LINKER_FLAGS "-shared ${EMSCRIPTEN_CONFIG_OPTIONS} --memory-init-file 0 -s WARN_ON_UNDEFINED_SYMBOLS=1 -s TOTAL_MEMORY=${EMSCRIPTEN_TOTAL_MEMORY_WORKER} -s BUILD_AS_WORKER=1 -s EXPORTED_FUNCTIONS=[\\\"_dowork\\\"] -s DISABLE_EXCEPTION_CATCHING=${EMSCRIPTEN_DISABLE_EXCEPTION_CATCHING} -s NO_FILESYSTEM=${EMSCRIPTEN_NO_FILESYSTEM}")
-set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "-O3 --llvm-lto ${EMSCRIPTEN_LTO_LEVEL} -s VERBOSE=${EMSCRIPTEN_BUILD_VERBOSE} -s ASM_JS=1 -s ASSERTIONS=${EMSCRIPTEN_ASSERTIONS} -s OUTLINING_LIMIT=${EMSCRIPTEN_OUTLINING_LIMIT} --closure ${EMSCRIPTEN_USE_CLOSURE}")
-set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "-O3 -g -s ASM_JS=1 -s VERBOSE=${EMSCRIPTEN_BUILD_VERBOSE} --closure 0")
-set(CMAKE_SHARED_LINKER_FLAGS_PROFILING "--profiling -O3 --llvm-lto ${EMSCRIPTEN_LTO_LEVEL} -s VERBOSE=${EMSCRIPTEN_BUILD_VERBOSE} -s ASM_JS=1 -s ASSERTIONS=${EMSCRIPTEN_ASSERTIONS} -s OUTLINING_LIMIT=${EMSCRIPTEN_OUTLINING_LIMIT}")
-
-# update cache variables for cmake gui
-set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Config Type" FORCE)
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "Generic C++ Compiler Flags" FORCE)
-set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING "C++ Debug Compiler Flags" FORCE)
-set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "C++ Release Compiler Flags" FORCE)
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}" CACHE STRING "Generic C Compiler Flags" FORCE)
-set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}" CACHE STRING "C Debug Compiler Flags" FORCE)
-set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}" CACHE STRING "C Release Compiler Flags" FORCE)
-set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}" CACHE STRING "Generic Linker Flags" FORCE)
-set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING "Debug Linker Flags" FORCE)
-set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}" CACHE STRING "Release Linker Flags" FORCE)
-set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}" CACHE STRING "Generic Shared Linker Flags" FORCE)
-set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING "Debug Shared Linker Flags" FORCE)
-set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}" CACHE STRING "Release Shared Linker Flags" FORCE)
-
-# set the build type to use
-if (NOT CMAKE_BUILD_TYPE)
-    set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Compile Type" FORCE)
-endif()
-set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release)
-
-message("Emscripten toolchain configured")

+ 4 - 116
Source/CMakeLists.txt

@@ -1,116 +1,4 @@
-#
-# Copyright (c) 2008-2014 the Urho3D project.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-
-# Check existence of stdint.h for LibCpuId
-include (CheckIncludeFiles)
-CHECK_INCLUDE_FILES (stdint.h HAVE_STDINT_H)
-if (HAVE_STDINT_H)
-    add_definitions (-DHAVE_STDINT_H)
-endif ()
-
-if (ATOMIC_TBUI)
-    add_definitions (-DATOMIC_TBUI)
-endif()
-
-# Setup RPATH settings
-if (ATOMIC_LIB_TYPE STREQUAL SHARED AND NOT WIN32 AND NOT ANDROID AND NOT IOS)
-    # Add RPATH entries when building
-    set (CMAKE_SKIP_BUILD_RPATH FALSE)
-    # But don't set them yet in the build tree
-    set (CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
-    if (APPLE)
-        if (CMAKE_VERSION VERSION_GREATER 2.8.12 OR CMAKE_VERSION VERSION_EQUAL 2.8.12)
-            set (CMAKE_MACOSX_RPATH TRUE)
-        endif ()
-        set (ORIGIN @loader_path)
-    else ()
-        set (ORIGIN $ORIGIN)
-    endif ()
-    # When installing/packaging set the first RPATH entry to the library location relative to the executable
-    set (CMAKE_INSTALL_RPATH ${ORIGIN}/../lib${LIB_SUFFIX}/${PATH_SUFFIX})    # The library location is based on SDK install destination
-    # The second entry to the install destination of the library, if the destination location is not in the system default search path
-    list (FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX} isSystemDir)
-    if (isSystemDir STREQUAL -1)
-        list (APPEND CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${DEST_LIBRARY_DIR})
-    endif ()
-endif ()
-
-# Add targets
-foreach (TARGET FreeType JO LZ4 PugiXml rapidjson SDL StanHull STB TurboBadger Duktape)
-    add_subdirectory (ThirdParty/${TARGET})
-endforeach ()
-
-if (ATOMIC_ANGELSCRIPT)
-    add_subdirectory (ThirdParty/AngelScript)
-endif ()
-
-if (ATOMIC_LUA)
-    add_subdirectory (ThirdParty/Lua${JIT})
-    add_subdirectory (ThirdParty/toluapp/src/lib)
-endif ()
-
-if (ATOMIC_NETWORK)
-    add_subdirectory (ThirdParty/Civetweb)
-    add_subdirectory (ThirdParty/kNet)
-endif ()
-
-if (ATOMIC_NAVIGATION)
-    add_subdirectory (ThirdParty/Detour)
-    add_subdirectory (ThirdParty/Recast)
-endif ()
-
-if (ATOMIC_PHYSICS)
-    add_subdirectory (ThirdParty/Bullet)
-endif ()
-
-if (ATOMIC_ATOMIC2D)
-    add_subdirectory (ThirdParty/Box2D)
-endif ()
-
-if (NOT IOS AND NOT ANDROID AND NOT RPI)
-    if (ATOMIC_OPENGL)
-        add_subdirectory (ThirdParty/GLEW)
-    else ()
-        add_subdirectory (ThirdParty/MojoShader)
-    endif ()
-    add_subdirectory (ThirdParty/LibCpuId)
-    add_subdirectory (ThirdParty/SQLite)
-endif ()
-
-# Atomic game engine library
-add_subdirectory (Atomic)
-
-# Atomic tools
-add_subdirectory (Tools)
-
-# Atomic samples
-# Samples are built on iOS platform too when enabled. Currently there is no available mechanism to package each sample apps into individual *.apk
-# for Android platform, so we deploy all samples into one apk and use a simple list view activity launcher to select the sample to run
-if (ATOMIC_SAMPLES)
-    add_subdirectory (Samples)
-endif ()
-
-# Atomic extras
-# Do not build extras for iOS and Android
-if (NOT IOS AND NOT ANDROID AND ATOMIC_EXTRAS)
-    add_subdirectory (Extras)
-endif ()
+
+add_subdirectory(ThirdParty)
+add_subdirectory(Atomic)
+add_subdirectory(Tools)

+ 0 - 33
Source/Samples/01_HelloWorld/CMakeLists.txt

@@ -1,33 +0,0 @@
-#
-# Copyright (c) 2008-2014 the Urho3D project.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-
-# Define target name
-set (TARGET_NAME 01_HelloWorld)
-
-# Define source files
-define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
-
-# Setup target with resource copying
-setup_main_executable ()
-
-# Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${ATOMIC_TEST_TIME_OUT})

+ 0 - 90
Source/Samples/01_HelloWorld/HelloWorld.cpp

@@ -1,90 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#include <Atomic/Atomic.h>
-
-#include <Atomic/Core/CoreEvents.h>
-#include <Atomic/Engine/Engine.h>
-#include <Atomic/UI/Font.h>
-#include <Atomic/Input/Input.h>
-#include <Atomic/Core/ProcessUtils.h>
-#include <Atomic/UI/Text.h>
-#include <Atomic/UI/UI.h>
-
-#include "HelloWorld.h"
-
-#include <Atomic/DebugNew.h>
-
-// Expands to this example's entry-point
-DEFINE_APPLICATION_MAIN(HelloWorld)
-
-HelloWorld::HelloWorld(Context* context) :
-    Sample(context)
-{
-}
-
-void HelloWorld::Start()
-{
-    // Execute base class startup
-    Sample::Start();
-
-    // Create "Hello World" Text
-    CreateText();
-
-    // Finally subscribe to the update event. Note that by subscribing events at this point we have already missed some events
-    // like the ScreenMode event sent by the Graphics subsystem when opening the application window. To catch those as well we
-    // could subscribe in the constructor instead.
-    SubscribeToEvents();
-}
-
-void HelloWorld::CreateText()
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-
-    // Construct new Text object
-    SharedPtr<Text> helloText(new Text(context_));
-
-    // Set String to display
-    helloText->SetText("Hello World from Atomic!");
-
-    // Set font and text color
-    helloText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 30);
-    helloText->SetColor(Color(0.0f, 1.0f, 0.0f));
-
-    // Align Text center-screen
-    helloText->SetHorizontalAlignment(HA_CENTER);
-    helloText->SetVerticalAlignment(VA_CENTER);
-
-    // Add Text instance to the UI root element
-    GetSubsystem<UI>()->GetRoot()->AddChild(helloText);
-}
-
-void HelloWorld::SubscribeToEvents()
-{
-    // Subscribe HandleUpdate() function for processing update events
-    SubscribeToEvent(E_UPDATE, HANDLER(HelloWorld, HandleUpdate));
-}
-
-void HelloWorld::HandleUpdate(StringHash eventType, VariantMap& eventData)
-{
-    // Do nothing for now, could be extended to eg. animate the display
-}

+ 0 - 60
Source/Samples/01_HelloWorld/HelloWorld.h

@@ -1,60 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#pragma once
-
-#include "Sample.h"
-
-/// This first example, maintaining tradition, prints a "Hello World" message.
-/// Furthermore it shows:
-///     - Using the Sample / Application classes, which initialize the Atomic engine and run the main loop
-///     - Adding a Text element to the graphical user interface
-///     - Subscribing to and handling of update events
-class HelloWorld : public Sample
-{
-    OBJECT(HelloWorld);
-
-public:
-    /// Construct.
-    HelloWorld(Context* context);
-
-    /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
-
-protected:
-    /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
-        "<patch>"
-        "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Hat0']]\">"
-        "        <attribute name=\"Is Visible\" value=\"false\" />"
-        "    </add>"
-        "</patch>";
-    }
-
-private:
-    /// Construct a new Text instance, containing the 'Hello World' String, and add it to the UI root element.
-    void CreateText();
-    /// Subscribe to application-wide logic update events.
-    void SubscribeToEvents();
-    /// Handle the logic update event.
-    void HandleUpdate(StringHash eventType, VariantMap& eventData);
-};

+ 0 - 33
Source/Samples/02_HelloGUI/CMakeLists.txt

@@ -1,33 +0,0 @@
-#
-# Copyright (c) 2008-2014 the Urho3D project.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-
-# Define target name
-set (TARGET_NAME 02_HelloGUI)
-
-# Define source files
-define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
-
-# Setup target with resource copying
-setup_main_executable ()
-
-# Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${ATOMIC_TEST_TIME_OUT})

+ 0 - 225
Source/Samples/02_HelloGUI/HelloGUI.cpp

@@ -1,225 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#include <Atomic/Atomic.h>
-
-#include <Atomic/UI/Button.h>
-#include <Atomic/UI/BorderImage.h>
-#include <Atomic/UI/CheckBox.h>
-#include <Atomic/Core/CoreEvents.h>
-#include <Atomic/Engine/Engine.h>
-#include <Atomic/Graphics/Graphics.h>
-#include <Atomic/Input/Input.h>
-#include <Atomic/UI/LineEdit.h>
-#include <Atomic/Resource/ResourceCache.h>
-#include <Atomic/UI/Text.h>
-#include <Atomic/Graphics/Texture2D.h>
-#include <Atomic/UI/ToolTip.h>
-#include <Atomic/UI/UI.h>
-#include <Atomic/UI/UIElement.h>
-#include <Atomic/UI/UIEvents.h>
-#include <Atomic/UI/Window.h>
-
-#include "HelloGUI.h"
-
-#include <Atomic/DebugNew.h>
-
-DEFINE_APPLICATION_MAIN(HelloGUI)
-
-HelloGUI::HelloGUI(Context* context) :
-    Sample(context),
-    uiRoot_(GetSubsystem<UI>()->GetRoot()),
-    dragBeginPosition_(IntVector2::ZERO)
-{
-}
-
-void HelloGUI::Start()
-{
-    // Execute base class startup
-    Sample::Start();
-
-    // Enable OS cursor
-    GetSubsystem<Input>()->SetMouseVisible(true);
-
-    // Load XML file containing default UI style sheet
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    XMLFile* style = cache->GetResource<XMLFile>("UI/DefaultStyle.xml");
-
-    // Set the loaded style as default style
-    uiRoot_->SetDefaultStyle(style);
-
-    // Initialize Window
-    InitWindow();
-    
-    // Create and add some controls to the Window
-    InitControls();
-
-    // Create a draggable Fish
-    CreateDraggableFish();
-}
-
-void HelloGUI::InitControls()
-{
-    // Create a CheckBox
-    CheckBox* checkBox = new CheckBox(context_);
-    checkBox->SetName("CheckBox");
-
-    // Create a Button
-    Button* button = new Button(context_);
-    button->SetName("Button");
-    button->SetMinHeight(24);
-
-    // Create a LineEdit
-    LineEdit* lineEdit = new LineEdit(context_);
-    lineEdit->SetName("LineEdit");
-    lineEdit->SetMinHeight(24);
-
-    // Add controls to Window
-    window_->AddChild(checkBox);
-    window_->AddChild(button);
-    window_->AddChild(lineEdit);
-
-    // Apply previously set default style
-    checkBox->SetStyleAuto();
-    button->SetStyleAuto();
-    lineEdit->SetStyleAuto();
-}
-
-void HelloGUI::InitWindow()
-{
-    // Create the Window and add it to the UI's root node
-    window_ = new Window(context_);
-    uiRoot_->AddChild(window_);
-
-    // Set Window size and layout settings
-    window_->SetMinSize(384, 192);
-    window_->SetLayout(LM_VERTICAL, 6, IntRect(6, 6, 6, 6));
-    window_->SetAlignment(HA_CENTER, VA_CENTER);
-    window_->SetName("Window");
-
-    // Create Window 'titlebar' container
-    UIElement* titleBar = new UIElement(context_);
-    titleBar->SetMinSize(0, 24);
-    titleBar->SetVerticalAlignment(VA_TOP);
-    titleBar->SetLayoutMode(LM_HORIZONTAL);
-
-    // Create the Window title Text
-    Text* windowTitle = new Text(context_);
-    windowTitle->SetName("WindowTitle");
-    windowTitle->SetText("Hello GUI!");
-
-    // Create the Window's close button
-    Button* buttonClose = new Button(context_);
-    buttonClose->SetName("CloseButton");
-
-    // Add the controls to the title bar
-    titleBar->AddChild(windowTitle);
-    titleBar->AddChild(buttonClose);
-
-    // Add the title bar to the Window
-    window_->AddChild(titleBar);
-
-    // Apply styles
-    window_->SetStyleAuto();
-    windowTitle->SetStyleAuto();
-    buttonClose->SetStyle("CloseButton");
-
-    // Subscribe to buttonClose release (following a 'press') events
-    SubscribeToEvent(buttonClose, E_RELEASED, HANDLER(HelloGUI, HandleClosePressed));
-    
-    // Subscribe also to all UI mouse clicks just to see where we have clicked
-    SubscribeToEvent(E_UIMOUSECLICK, HANDLER(HelloGUI, HandleControlClicked));
-}
-
-void HelloGUI::CreateDraggableFish()
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    Graphics* graphics = GetSubsystem<Graphics>();
-
-    // Create a draggable Fish button
-    Button* draggableFish = new Button(context_);
-    draggableFish->SetTexture(cache->GetResource<Texture2D>("Textures/UrhoDecal.dds")); // Set texture
-    draggableFish->SetBlendMode(BLEND_ADD);
-    draggableFish->SetSize(128, 128);
-    draggableFish->SetPosition((graphics->GetWidth() - draggableFish->GetWidth()) / 2, 200);
-    draggableFish->SetName("Fish");
-    uiRoot_->AddChild(draggableFish);
-
-    // Add a tooltip to Fish button
-    ToolTip* toolTip = new ToolTip(context_);
-    draggableFish->AddChild(toolTip);
-    toolTip->SetPosition(IntVector2(draggableFish->GetWidth() + 5, draggableFish->GetWidth() / 2)); // slightly offset from close button
-    BorderImage* textHolder = new BorderImage(context_);
-    toolTip->AddChild(textHolder);
-    textHolder->SetStyle("ToolTipBorderImage");
-    Text* toolTipText = new Text(context_);
-    textHolder->AddChild(toolTipText);
-    toolTipText->SetStyle("ToolTipText");
-    toolTipText->SetText("Please drag me!");
-
-    // Subscribe draggableFish to Drag Events (in order to make it draggable)
-    // See "Event list" in documentation's Main Page for reference on available Events and their eventData
-    SubscribeToEvent(draggableFish, E_DRAGBEGIN, HANDLER(HelloGUI, HandleDragBegin));
-    SubscribeToEvent(draggableFish, E_DRAGMOVE, HANDLER(HelloGUI, HandleDragMove));
-    SubscribeToEvent(draggableFish, E_DRAGEND, HANDLER(HelloGUI, HandleDragEnd));
-}
-
-void HelloGUI::HandleDragBegin(StringHash eventType, VariantMap& eventData)
-{
-    // Get UIElement relative position where input (touch or click) occured (top-left = IntVector2(0,0))
-    dragBeginPosition_ = IntVector2(eventData["ElementX"].GetInt(), eventData["ElementY"].GetInt());
-}
-
-void HelloGUI::HandleDragMove(StringHash eventType, VariantMap& eventData)
-{
-    IntVector2 dragCurrentPosition = IntVector2(eventData["X"].GetInt(), eventData["Y"].GetInt());
-    UIElement* draggedElement = static_cast<UIElement*>(eventData["Element"].GetPtr());
-    draggedElement->SetPosition(dragCurrentPosition - dragBeginPosition_);
-}
-
-void HelloGUI::HandleDragEnd(StringHash eventType, VariantMap& eventData) // For reference (not used here)
-{
-}
-
-void HelloGUI::HandleClosePressed(StringHash eventType, VariantMap& eventData)
-{
-    engine_->Exit();
-}
-
-void HelloGUI::HandleControlClicked(StringHash eventType, VariantMap& eventData)
-{
-    // Get the Text control acting as the Window's title
-    Text* windowTitle = static_cast<Text*>(window_->GetChild("WindowTitle", true));
-
-    // Get control that was clicked
-    UIElement* clicked = static_cast<UIElement*>(eventData[UIMouseClick::P_ELEMENT].GetPtr());
-
-    String name = "...?";
-    if (clicked)
-    {
-        // Get the name of the control that was clicked
-        name = clicked->GetName();
-    }
-
-    // Update the Window's title text
-    windowTitle->SetText("Hello " + name + "!");
-}

+ 0 - 90
Source/Samples/02_HelloGUI/HelloGUI.h

@@ -1,90 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#pragma once
-
-#include "Sample.h"
-
-namespace Atomic
-{
-
-class Window;
-
-}
-
-/// A simple 'HelloWorld' GUI created purely from code.
-/// This sample demonstrates:
-///     - Creation of controls and building a UI hierarchy
-///     - Loading UI style from XML and applying it to controls
-///     - Handling of global and per-control events
-/// For more advanced users (beginners can skip this section):
-///     - Dragging UIElements
-///     - Displaying tooltips
-///     - Accessing available Events data (eventData)
-class HelloGUI : public Sample
-{
-    OBJECT(HelloGUI);
-
-public:
-    /// Construct.
-    HelloGUI(Context* context);
-
-    /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
-
-protected:
-    /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
-        "<patch>"
-        "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Hat0']]\">"
-        "        <attribute name=\"Is Visible\" value=\"false\" />"
-        "    </add>"
-        "</patch>";
-    }
-
-private:
-    /// Create and initialize a Window control.
-    void InitWindow();
-    /// Create and add various common controls for demonstration purposes.
-    void InitControls();
-    /// Create a draggable fish button.
-    void CreateDraggableFish();
-    /// Handle drag begin for the fish button.
-    void HandleDragBegin(StringHash eventType, VariantMap& eventData);
-    /// Handle drag move for the fish button.
-    void HandleDragMove(StringHash eventType, VariantMap& eventData);
-    /// Handle drag end for the fish button.
-    void HandleDragEnd(StringHash eventType, VariantMap& eventData);
-    /// Handle any UI control being clicked.
-    void HandleControlClicked(StringHash eventType, VariantMap& eventData);
-    /// Handle close button pressed and released.
-    void HandleClosePressed(StringHash eventType, VariantMap& eventData);
-
-    /// The Window.
-    SharedPtr<Window> window_;
-    /// The UI's root UIElement.
-    SharedPtr<UIElement> uiRoot_;
-    /// Remembered drag begin position.
-    IntVector2 dragBeginPosition_;
-};
-
-

+ 0 - 33
Source/Samples/03_Sprites/CMakeLists.txt

@@ -1,33 +0,0 @@
-#
-# Copyright (c) 2008-2014 the Urho3D project.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-
-# Define target name
-set (TARGET_NAME 03_Sprites)
-
-# Define source files
-define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
-
-# Setup target with resource copying
-setup_main_executable ()
-
-# Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${ATOMIC_TEST_TIME_OUT})

+ 0 - 151
Source/Samples/03_Sprites/Sprites.cpp

@@ -1,151 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#include <Atomic/Atomic.h>
-
-#include <Atomic/Core/CoreEvents.h>
-#include <Atomic/Engine/Engine.h>
-#include <Atomic/Graphics/Graphics.h>
-#include <Atomic/Resource/ResourceCache.h>
-#include <Atomic/UI/Sprite.h>
-#include <Atomic/Graphics/Texture2D.h>
-#include <Atomic/UI/UI.h>
-
-#include "Sprites.h"
-
-#include <Atomic/DebugNew.h>
-
-// Number of sprites to draw
-static const unsigned NUM_SPRITES = 100;
-
-// Custom variable identifier for storing sprite velocity within the UI element
-static const StringHash VAR_VELOCITY("Velocity");
-
-DEFINE_APPLICATION_MAIN(Sprites)
-
-Sprites::Sprites(Context* context) :
-    Sample(context)
-{
-}
-
-void Sprites::Start()
-{
-    // Execute base class startup
-    Sample::Start();
-
-    // Create the sprites to the user interface
-    CreateSprites();
-
-    // Hook up to the frame update events
-    SubscribeToEvents();
-}
-
-void Sprites::CreateSprites()
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    Graphics* graphics = GetSubsystem<Graphics>();
-    UI* ui = GetSubsystem<UI>();
-
-    // Get rendering window size as floats
-    float width = (float)graphics->GetWidth();
-    float height = (float)graphics->GetHeight();
-
-    // Get the Atomic fish texture
-    Texture2D* decalTex = cache->GetResource<Texture2D>("Textures/UrhoDecal.dds");
-
-    for (unsigned i = 0; i < NUM_SPRITES; ++i)
-    {
-        // Create a new sprite, set it to use the texture
-        SharedPtr<Sprite> sprite(new Sprite(context_));
-        sprite->SetTexture(decalTex);
-
-        // The UI root element is as big as the rendering window, set random position within it
-        sprite->SetPosition(Vector2(Random() * width, Random() * height));
-
-        // Set sprite size & hotspot in its center
-        sprite->SetSize(IntVector2(128, 128));
-        sprite->SetHotSpot(IntVector2(64, 64));
-
-        // Set random rotation in degrees and random scale
-        sprite->SetRotation(Random() * 360.0f);
-        sprite->SetScale(Random(1.0f) + 0.5f);
-
-        // Set random color and additive blending mode
-        sprite->SetColor(Color(Random(0.5f) + 0.5f, Random(0.5f) + 0.5f, Random(0.5f) + 0.5f));
-        sprite->SetBlendMode(BLEND_ADD);
-
-        // Add as a child of the root UI element
-        ui->GetRoot()->AddChild(sprite);
-
-        // Store sprite's velocity as a custom variable
-        sprite->SetVar(VAR_VELOCITY, Vector2(Random(200.0f) - 100.0f, Random(200.0f) - 100.0f));
-
-        // Store sprites to our own container for easy movement update iteration
-        sprites_.Push(sprite);
-    }
-}
-
-void Sprites::MoveSprites(float timeStep)
-{
-    Graphics* graphics = GetSubsystem<Graphics>();
-    float width = (float)graphics->GetWidth();
-    float height = (float)graphics->GetHeight();
-
-    // Go through all sprites
-    for (unsigned i = 0; i < sprites_.Size(); ++i)
-    {
-        Sprite* sprite = sprites_[i];
-
-        // Rotate
-        float newRot = sprite->GetRotation() + timeStep * 30.0f;
-        sprite->SetRotation(newRot);
-        
-        // Move, wrap around rendering window edges
-        Vector2 newPos = sprite->GetPosition() + sprite->GetVar(VAR_VELOCITY).GetVector2() * timeStep;
-        if (newPos.x_ < 0.0f)
-            newPos.x_ += width;
-        if (newPos.x_ >= width)
-            newPos.x_ -= width;
-        if (newPos.y_ < 0.0f)
-            newPos.y_ += height;
-        if (newPos.y_ >= height)
-            newPos.y_ -= height;
-        sprite->SetPosition(newPos);
-    }
-}
-
-void Sprites::SubscribeToEvents()
-{
-    // Subscribe HandleUpdate() function for processing update events
-    SubscribeToEvent(E_UPDATE, HANDLER(Sprites, HandleUpdate));
-}
-
-void Sprites::HandleUpdate(StringHash eventType, VariantMap& eventData)
-{
-    using namespace Update;
-
-    // Take the frame time step, which is stored as a float
-    float timeStep = eventData[P_TIMESTEP].GetFloat();
-    
-    // Move sprites, scale movement with time step
-    MoveSprites(timeStep);
-}

+ 0 - 66
Source/Samples/03_Sprites/Sprites.h

@@ -1,66 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#pragma once
-
-#include "Sample.h"
-
-/// Moving sprites example.
-/// This sample demonstrates:
-///     - Adding Sprite elements to the UI
-///     - Storing custom data (sprite velocity) inside UI elements
-///     - Handling frame update events in which the sprites are moved
-class Sprites : public Sample
-{
-    // Enable type information.
-    OBJECT(Sprites);
-
-public:
-    /// Construct.
-    Sprites(Context* context);
-
-    /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
-
-protected:
-    /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
-        "<patch>"
-        "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Hat0']]\">"
-        "        <attribute name=\"Is Visible\" value=\"false\" />"
-        "    </add>"
-        "</patch>";
-    }
-
-private:
-    /// Construct the sprites.
-    void CreateSprites();
-    /// Move the sprites using the delta time step given.
-    void MoveSprites(float timeStep);
-    /// Subscribe to application-wide logic update events.
-    void SubscribeToEvents();
-    /// Handle the logic update event.
-    void HandleUpdate(StringHash eventType, VariantMap& eventData);
-
-    /// Vector to store the sprites for iterating through them.
-    Vector<SharedPtr<Sprite> > sprites_;
-};

+ 0 - 33
Source/Samples/04_StaticScene/CMakeLists.txt

@@ -1,33 +0,0 @@
-#
-# Copyright (c) 2008-2014 the Urho3D project.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-
-# Define target name
-set (TARGET_NAME 04_StaticScene)
-
-# Define source files
-define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
-
-# Setup target with resource copying
-setup_main_executable ()
-
-# Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${ATOMIC_TEST_TIME_OUT})

+ 0 - 202
Source/Samples/04_StaticScene/StaticScene.cpp

@@ -1,202 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#include <Atomic/Atomic.h>
-
-#include <Atomic/Graphics/Camera.h>
-#include <Atomic/Core/CoreEvents.h>
-#include <Atomic/Engine/Engine.h>
-#include <Atomic/UI/Font.h>
-#include <Atomic/Graphics/Graphics.h>
-#include <Atomic/Input/Input.h>
-#include <Atomic/Graphics/Material.h>
-#include <Atomic/Graphics/Model.h>
-#include <Atomic/Graphics/Octree.h>
-#include <Atomic/Graphics/Renderer.h>
-#include <Atomic/Resource/ResourceCache.h>
-#include <Atomic/Scene/Scene.h>
-#include <Atomic/Graphics/StaticModel.h>
-#include <Atomic/UI/Text.h>
-#include <Atomic/UI/UI.h>
-
-#include "StaticScene.h"
-
-#include <Atomic/DebugNew.h>
-
-DEFINE_APPLICATION_MAIN(StaticScene)
-
-StaticScene::StaticScene(Context* context) :
-    Sample(context)
-{
-}
-
-void StaticScene::Start()
-{
-    // Execute base class startup
-    Sample::Start();
-
-    // Create the scene content
-    CreateScene();
-
-    // Create the UI content
-    CreateInstructions();
-
-    // Setup the viewport for displaying the scene
-    SetupViewport();
-
-    // Hook up to the frame update events
-    SubscribeToEvents();
-}
-
-void StaticScene::CreateScene()
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-
-    scene_ = new Scene(context_);
-
-    // Create the Octree component to the scene. This is required before adding any drawable components, or else nothing will
-    // show up. The default octree volume will be from (-1000, -1000, -1000) to (1000, 1000, 1000) in world coordinates; it
-    // is also legal to place objects outside the volume but their visibility can then not be checked in a hierarchically
-    // optimizing manner
-    scene_->CreateComponent<Octree>();
-
-    // Create a child scene node (at world origin) and a StaticModel component into it. Set the StaticModel to show a simple
-    // plane mesh with a "stone" material. Note that naming the scene nodes is optional. Scale the scene node larger
-    // (100 x 100 world units)
-    Node* planeNode = scene_->CreateChild("Plane");
-    planeNode->SetScale(Vector3(100.0f, 1.0f, 100.0f));
-    StaticModel* planeObject = planeNode->CreateComponent<StaticModel>();
-    planeObject->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
-    planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
-
-    // Create a directional light to the world so that we can see something. The light scene node's orientation controls the
-    // light direction; we will use the SetDirection() function which calculates the orientation from a forward direction vector.
-    // The light will use default settings (white light, no shadows)
-    Node* lightNode = scene_->CreateChild("DirectionalLight");
-    lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f)); // The direction vector does not need to be normalized
-    Light* light = lightNode->CreateComponent<Light>();
-    light->SetLightType(LIGHT_DIRECTIONAL);
-
-    // Create more StaticModel objects to the scene, randomly positioned, rotated and scaled. For rotation, we construct a
-    // quaternion from Euler angles where the Y angle (rotation about the Y axis) is randomized. The mushroom model contains
-    // LOD levels, so the StaticModel component will automatically select the LOD level according to the view distance (you'll
-    // see the model get simpler as it moves further away). Finally, rendering a large number of the same object with the
-    // same material allows instancing to be used, if the GPU supports it. This reduces the amount of CPU work in rendering the
-    // scene.
-    const unsigned NUM_OBJECTS = 200;
-    for (unsigned i = 0; i < NUM_OBJECTS; ++i)
-    {
-        Node* mushroomNode = scene_->CreateChild("Mushroom");
-        mushroomNode->SetPosition(Vector3(Random(90.0f) - 45.0f, 0.0f, Random(90.0f) - 45.0f));
-        mushroomNode->SetRotation(Quaternion(0.0f, Random(360.0f), 0.0f));
-        mushroomNode->SetScale(0.5f + Random(2.0f));
-        StaticModel* mushroomObject = mushroomNode->CreateComponent<StaticModel>();
-        mushroomObject->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
-        mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
-    }
-
-    // Create a scene node for the camera, which we will move around
-    // The camera will use default settings (1000 far clip distance, 45 degrees FOV, set aspect ratio automatically)
-    cameraNode_ = scene_->CreateChild("Camera");
-    cameraNode_->CreateComponent<Camera>();
-
-    // Set an initial position for the camera scene node above the plane
-    cameraNode_->SetPosition(Vector3(0.0f, 5.0f, 0.0f));
-}
-
-void StaticScene::CreateInstructions()
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
-
-    // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
-    instructionText->SetText("Use WASD keys and mouse/touch to move");
-    instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
-
-    // Position the text relative to the screen center
-    instructionText->SetHorizontalAlignment(HA_CENTER);
-    instructionText->SetVerticalAlignment(VA_CENTER);
-    instructionText->SetPosition(0, ui->GetRoot()->GetHeight() / 4);
-}
-
-void StaticScene::SetupViewport()
-{
-    Renderer* renderer = GetSubsystem<Renderer>();
-
-    // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen. We need to define the scene and the camera
-    // at minimum. Additionally we could configure the viewport screen size and the rendering path (eg. forward / deferred) to
-    // use, but now we just use full screen and default render path configured in the engine command line options
-    SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
-    renderer->SetViewport(0, viewport);
-}
-
-void StaticScene::MoveCamera(float timeStep)
-{
-    // Do not move if the UI has a focused element (the console)
-    if (GetSubsystem<UI>()->GetFocusElement())
-        return;
-
-    Input* input = GetSubsystem<Input>();
-
-    // Movement speed as world units per second
-    const float MOVE_SPEED = 20.0f;
-    // Mouse sensitivity as degrees per pixel
-    const float MOUSE_SENSITIVITY = 0.1f;
-
-    // Use this frame's mouse motion to adjust camera node yaw and pitch. Clamp the pitch between -90 and 90 degrees
-    IntVector2 mouseMove = input->GetMouseMove();
-    yaw_ += MOUSE_SENSITIVITY * mouseMove.x_;
-    pitch_ += MOUSE_SENSITIVITY * mouseMove.y_;
-    pitch_ = Clamp(pitch_, -90.0f, 90.0f);
-
-    // Construct new orientation for the camera scene node from yaw and pitch. Roll is fixed to zero
-    cameraNode_->SetRotation(Quaternion(pitch_, yaw_, 0.0f));
-
-    // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
-    // Use the Translate() function (default local space) to move relative to the node's orientation.
-    if (input->GetKeyDown('W'))
-        cameraNode_->Translate(Vector3::FORWARD * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('S'))
-        cameraNode_->Translate(Vector3::BACK * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('A'))
-        cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('D'))
-        cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
-}
-
-void StaticScene::SubscribeToEvents()
-{
-    // Subscribe HandleUpdate() function for processing update events
-    SubscribeToEvent(E_UPDATE, HANDLER(StaticScene, HandleUpdate));
-}
-
-void StaticScene::HandleUpdate(StringHash eventType, VariantMap& eventData)
-{
-    using namespace Update;
-
-    // Take the frame time step, which is stored as a float
-    float timeStep = eventData[P_TIMESTEP].GetFloat();
-
-    // Move the camera, scale movement with time step
-    MoveCamera(timeStep);
-}

+ 0 - 64
Source/Samples/04_StaticScene/StaticScene.h

@@ -1,64 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#pragma once
-
-#include "Sample.h"
-
-namespace Atomic
-{
-
-class Node;
-class Scene;
-
-}
-
-/// Static 3D scene example.
-/// This sample demonstrates:
-///     - Creating a 3D scene with static content
-///     - Displaying the scene using the Renderer subsystem
-///     - Handling keyboard and mouse input to move a freelook camera
-class StaticScene : public Sample
-{
-    OBJECT(StaticScene);
-
-public:
-    /// Construct.
-    StaticScene(Context* context);
-
-    /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
-
-private:
-    /// Construct the scene content.
-    void CreateScene();
-    /// Construct an instruction text to the UI.
-    void CreateInstructions();
-    /// Set up a viewport for displaying the scene.
-    void SetupViewport();
-    /// Read input and moves the camera.
-    void MoveCamera(float timeStep);
-    /// Subscribe to application-wide logic update events.
-    void SubscribeToEvents();
-    /// Handle the logic update event.
-    void HandleUpdate(StringHash eventType, VariantMap& eventData);
-};

+ 0 - 202
Source/Samples/05_AnimatingScene/AnimatingScene.cpp

@@ -1,202 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#include <Atomic/Atomic.h>
-
-#include <Atomic/Graphics/Camera.h>
-#include <Atomic/Core/CoreEvents.h>
-#include <Atomic/Engine/Engine.h>
-#include <Atomic/UI/Font.h>
-#include <Atomic/Graphics/Graphics.h>
-#include <Atomic/Input/Input.h>
-#include <Atomic/Graphics/Material.h>
-#include <Atomic/Graphics/Model.h>
-#include <Atomic/Graphics/Octree.h>
-#include <Atomic/Graphics/Renderer.h>
-#include <Atomic/Resource/ResourceCache.h>
-#include <Atomic/Scene/Scene.h>
-#include <Atomic/Graphics/StaticModel.h>
-#include <Atomic/UI/Text.h>
-#include <Atomic/UI/UI.h>
-#include <Atomic/Graphics/Zone.h>
-
-#include "AnimatingScene.h"
-#include "Rotator.h"
-
-#include <Atomic/DebugNew.h>
-
-DEFINE_APPLICATION_MAIN(AnimatingScene)
-
-AnimatingScene::AnimatingScene(Context* context) :
-    Sample(context)
-{
-    // Register an object factory for our custom Rotator component so that we can create them to scene nodes
-    context->RegisterFactory<Rotator>();
-}
-
-void AnimatingScene::Start()
-{
-    // Execute base class startup
-    Sample::Start();
-
-    // Create the scene content
-    CreateScene();
-    
-    // Create the UI content
-    CreateInstructions();
-    
-    // Setup the viewport for displaying the scene
-    SetupViewport();
-
-    // Hook up to the frame update events
-    SubscribeToEvents();
-}
-
-void AnimatingScene::CreateScene()
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    
-    scene_ = new Scene(context_);
-    
-    // Create the Octree component to the scene so that drawable objects can be rendered. Use default volume
-    // (-1000, -1000, -1000) to (1000, 1000, 1000)
-    scene_->CreateComponent<Octree>();
-    
-    // Create a Zone component into a child scene node. The Zone controls ambient lighting and fog settings. Like the Octree,
-    // it also defines its volume with a bounding box, but can be rotated (so it does not need to be aligned to the world X, Y
-    // and Z axes.) Drawable objects "pick up" the zone they belong to and use it when rendering; several zones can exist
-    Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
-    // Set same volume as the Octree, set a close bluish fog and some ambient light
-    zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
-    zone->SetAmbientColor(Color(0.05f, 0.1f, 0.15f));
-    zone->SetFogColor(Color(0.1f, 0.2f, 0.3f));
-    zone->SetFogStart(10.0f);
-    zone->SetFogEnd(100.0f);
-    
-    // Create randomly positioned and oriented box StaticModels in the scene
-    const unsigned NUM_OBJECTS = 2000;
-    for (unsigned i = 0; i < NUM_OBJECTS; ++i)
-    {
-        Node* boxNode = scene_->CreateChild("Box");
-        boxNode->SetPosition(Vector3(Random(200.0f) - 100.0f, Random(200.0f) - 100.0f, Random(200.0f) - 100.0f));
-        // Orient using random pitch, yaw and roll Euler angles
-        boxNode->SetRotation(Quaternion(Random(360.0f), Random(360.0f), Random(360.0f)));
-        StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
-        boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
-        boxObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
-        
-        // Add our custom Rotator component which will rotate the scene node each frame, when the scene sends its update event.
-        // The Rotator component derives from the base class LogicComponent, which has convenience functionality to subscribe
-        // to the various update events, and forward them to virtual functions that can be implemented by subclasses. This way
-        // writing logic/update components in C++ becomes similar to scripting.
-        // Now we simply set same rotation speed for all objects
-        Rotator* rotator = boxNode->CreateComponent<Rotator>();
-        rotator->SetRotationSpeed(Vector3(10.0f, 20.0f, 30.0f));
-    }
-    
-    // Create the camera. Let the starting position be at the world origin. As the fog limits maximum visible distance, we can
-    // bring the far clip plane closer for more effective culling of distant objects
-    cameraNode_ = scene_->CreateChild("Camera");
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
-    camera->SetFarClip(100.0f);
-    
-    // Create a point light to the camera scene node
-    Light* light = cameraNode_->CreateComponent<Light>();
-    light->SetLightType(LIGHT_POINT);
-    light->SetRange(30.0f);
-}
-
-void AnimatingScene::CreateInstructions()
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
-    
-    // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
-    instructionText->SetText("Use WASD keys and mouse/touch to move");
-    instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
-    
-    // Position the text relative to the screen center
-    instructionText->SetHorizontalAlignment(HA_CENTER);
-    instructionText->SetVerticalAlignment(VA_CENTER);
-    instructionText->SetPosition(0, ui->GetRoot()->GetHeight() / 4);
-}
-
-void AnimatingScene::SetupViewport()
-{
-    Renderer* renderer = GetSubsystem<Renderer>();
-    
-    // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
-    SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
-    renderer->SetViewport(0, viewport);
-}
-
-void AnimatingScene::SubscribeToEvents()
-{
-    // Subscribe HandleUpdate() function for processing update events
-    SubscribeToEvent(E_UPDATE, HANDLER(AnimatingScene, HandleUpdate));
-}
-
-void AnimatingScene::MoveCamera(float timeStep)
-{
-    // Do not move if the UI has a focused element (the console)
-    if (GetSubsystem<UI>()->GetFocusElement())
-        return;
-    
-    Input* input = GetSubsystem<Input>();
-    
-    // Movement speed as world units per second
-    const float MOVE_SPEED = 20.0f;
-    // Mouse sensitivity as degrees per pixel
-    const float MOUSE_SENSITIVITY = 0.1f;
-    
-    // Use this frame's mouse motion to adjust camera node yaw and pitch. Clamp the pitch between -90 and 90 degrees
-    IntVector2 mouseMove = input->GetMouseMove();
-    yaw_ += MOUSE_SENSITIVITY * mouseMove.x_;
-    pitch_ += MOUSE_SENSITIVITY * mouseMove.y_;
-    pitch_ = Clamp(pitch_, -90.0f, 90.0f);
-    
-    // Construct new orientation for the camera scene node from yaw and pitch. Roll is fixed to zero
-    cameraNode_->SetRotation(Quaternion(pitch_, yaw_, 0.0f));
-    
-    // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
-    if (input->GetKeyDown('W'))
-        cameraNode_->Translate(Vector3::FORWARD * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('S'))
-        cameraNode_->Translate(Vector3::BACK * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('A'))
-        cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('D'))
-        cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
-}
-
-void AnimatingScene::HandleUpdate(StringHash eventType, VariantMap& eventData)
-{
-    using namespace Update;
-
-    // Take the frame time step, which is stored as a float
-    float timeStep = eventData[P_TIMESTEP].GetFloat();
-    
-    // Move the camera, scale movement with time step
-    MoveCamera(timeStep);
-}

+ 0 - 64
Source/Samples/05_AnimatingScene/AnimatingScene.h

@@ -1,64 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#pragma once
-
-#include "Sample.h"
-
-namespace Atomic
-{
-
-class Node;
-class Scene;
-
-}
-
-/// Animating 3D scene example.
-/// This sample demonstrates:
-///     - Creating a 3D scene and using a custom component to animate the objects
-///     - Controlling scene ambience with the Zone component
-///     - Attaching a light to an object (the camera)
-class AnimatingScene : public Sample
-{
-    OBJECT(AnimatingScene);
-
-public:
-    /// Construct.
-    AnimatingScene(Context* context);
-
-    /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
-
-private:
-    /// Construct the scene content.
-    void CreateScene();
-    /// Construct an instruction text to the UI.
-    void CreateInstructions();
-    /// Set up a viewport for displaying the scene.
-    void SetupViewport();
-    /// Subscribe to application-wide logic update events.
-    void SubscribeToEvents();
-    /// Read input and moves the camera.
-    void MoveCamera(float timeStep);
-    /// Handle the logic update event.
-    void HandleUpdate(StringHash eventType, VariantMap& eventData);
-};

+ 0 - 33
Source/Samples/05_AnimatingScene/CMakeLists.txt

@@ -1,33 +0,0 @@
-#
-# Copyright (c) 2008-2014 the Urho3D project.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-
-# Define target name
-set (TARGET_NAME 05_AnimatingScene)
-
-# Define source files
-define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
-
-# Setup target with resource copying
-setup_main_executable ()
-
-# Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${ATOMIC_TEST_TIME_OUT})

+ 0 - 50
Source/Samples/05_AnimatingScene/Rotator.cpp

@@ -1,50 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#include <Atomic/Atomic.h>
-
-#include <Atomic/Scene/Scene.h>
-#include <Atomic/Scene/SceneEvents.h>
-
-#include "Rotator.h"
-
-#include <Atomic/DebugNew.h>
-
-Rotator::Rotator(Context* context) :
-    LogicComponent(context),
-    rotationSpeed_(Vector3::ZERO)
-{
-    // Only the scene update event is needed: unsubscribe from the rest for optimization
-    SetUpdateEventMask(USE_UPDATE);
-}
-
-void Rotator::SetRotationSpeed(const Vector3& speed)
-{
-    rotationSpeed_ = speed;
-}
-
-void Rotator::Update(float timeStep)
-{
-    // Components have their scene node as a member variable for convenient access. Rotate the scene node now: construct a
-    // rotation quaternion from Euler angles, scale rotation speed with the scene update time step
-    node_->Rotate(Quaternion(rotationSpeed_.x_ * timeStep, rotationSpeed_.y_ * timeStep, rotationSpeed_.z_ * timeStep));
-}

+ 0 - 50
Source/Samples/05_AnimatingScene/Rotator.h

@@ -1,50 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#pragma once
-
-#include <Atomic/Scene/LogicComponent.h>
-
-// All Atomic classes reside in namespace Atomic
-using namespace Atomic;
-
-/// Custom logic component for rotating a scene node.
-class Rotator : public LogicComponent
-{
-    OBJECT(Rotator);
-    
-public:
-    /// Construct.
-    Rotator(Context* context);
-    
-    /// Set rotation speed about the Euler axes. Will be scaled with scene update time step.
-    void SetRotationSpeed(const Vector3& speed);
-    /// Handle scene update. Called by LogicComponent base class.
-    virtual void Update(float timeStep);
-    
-    /// Return rotation speed.
-    const Vector3& GetRotationSpeed() const { return rotationSpeed_; }
-    
-private:
-    /// Rotation speed.
-    Vector3 rotationSpeed_;
-};

+ 0 - 33
Source/Samples/06_SkeletalAnimation/CMakeLists.txt

@@ -1,33 +0,0 @@
-#
-# Copyright (c) 2008-2014 the Urho3D project.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-
-# Define target name
-set (TARGET_NAME 06_SkeletalAnimation)
-
-# Define source files
-define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
-
-# Setup target with resource copying
-setup_main_executable ()
-
-# Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${ATOMIC_TEST_TIME_OUT})

+ 0 - 67
Source/Samples/06_SkeletalAnimation/Mover.cpp

@@ -1,67 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#include <Atomic/Atomic.h>
-
-#include <Atomic/Graphics/AnimatedModel.h>
-#include <Atomic/Graphics/AnimationState.h>
-#include <Atomic/Scene/Scene.h>
-#include <Atomic/Scene/SceneEvents.h>
-
-#include "Mover.h"
-
-#include <Atomic/DebugNew.h>
-
-Mover::Mover(Context* context) :
-    LogicComponent(context),
-    moveSpeed_(0.0f),
-    rotationSpeed_(0.0f)
-{
-    // Only the scene update event is needed: unsubscribe from the rest for optimization
-    SetUpdateEventMask(USE_UPDATE);
-}
-
-void Mover::SetParameters(float moveSpeed, float rotationSpeed, const BoundingBox& bounds)
-{
-    moveSpeed_ = moveSpeed;
-    rotationSpeed_ = rotationSpeed;
-    bounds_ = bounds;
-}
-
-void Mover::Update(float timeStep)
-{
-    node_->Translate(Vector3::FORWARD * moveSpeed_ * timeStep);
-    
-    // If in risk of going outside the plane, rotate the model right
-    Vector3 pos = node_->GetPosition();
-    if (pos.x_ < bounds_.min_.x_ || pos.x_ > bounds_.max_.x_ || pos.z_ < bounds_.min_.z_ || pos.z_ > bounds_.max_.z_)
-        node_->Yaw(rotationSpeed_ * timeStep);
-    
-    // Get the model's first (only) animation state and advance its time. Note the convenience accessor to other components
-    // in the same scene node
-    AnimatedModel* model = GetComponent<AnimatedModel>();
-    if (model->GetNumAnimationStates())
-    {
-        AnimationState* state = model->GetAnimationStates()[0];
-        state->AddTime(timeStep);
-    }
-}

+ 0 - 57
Source/Samples/06_SkeletalAnimation/Mover.h

@@ -1,57 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#pragma once
-
-#include <Atomic/Scene/LogicComponent.h>
-
-using namespace Atomic;
-
-/// Custom logic component for moving the animated model and rotating at area edges.
-class Mover : public LogicComponent
-{
-    OBJECT(Mover);
-    
-public:
-    /// Construct.
-    Mover(Context* context);
-    
-    /// Set motion parameters: forward movement speed, rotation speed, and movement boundaries.
-    void SetParameters(float moveSpeed, float rotateSpeed, const BoundingBox& bounds);
-    /// Handle scene update. Called by LogicComponent base class.
-    virtual void Update(float timeStep);
-    
-    /// Return forward movement speed.
-    float GetMoveSpeed() const { return moveSpeed_; }
-    /// Return rotation speed.
-    float GetRotationSpeed() const { return rotationSpeed_; }
-    /// Return movement boundaries.
-    const BoundingBox& GetBounds() const { return bounds_; }
-    
-private:
-    /// Forward movement speed.
-    float moveSpeed_;
-    /// Rotation speed.
-    float rotationSpeed_;
-    /// Movement boundaries.
-    BoundingBox bounds_;
-};

+ 0 - 255
Source/Samples/06_SkeletalAnimation/SkeletalAnimation.cpp

@@ -1,255 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#include <Atomic/Atomic.h>
-
-#include <Atomic/Graphics/Animation.h>
-#include <Atomic/Graphics/AnimatedModel.h>
-#include <Atomic/Graphics/AnimationState.h>
-#include <Atomic/Graphics/Camera.h>
-#include <Atomic/Core/CoreEvents.h>
-#include <Atomic/Graphics/DebugRenderer.h>
-#include <Atomic/Engine/Engine.h>
-#include <Atomic/UI/Font.h>
-#include <Atomic/Graphics/Graphics.h>
-#include <Atomic/Input/Input.h>
-#include <Atomic/Graphics/Light.h>
-#include <Atomic/Graphics/Material.h>
-#include <Atomic/Graphics/Model.h>
-#include <Atomic/Graphics/Octree.h>
-#include <Atomic/Graphics/Renderer.h>
-#include <Atomic/Resource/ResourceCache.h>
-#include <Atomic/Scene/Scene.h>
-#include <Atomic/UI/Text.h>
-#include <Atomic/UI/UI.h>
-#include <Atomic/Graphics/Zone.h>
-
-#include "Mover.h"
-#include "SkeletalAnimation.h"
-
-#include <Atomic/DebugNew.h>
-
-DEFINE_APPLICATION_MAIN(SkeletalAnimation)
-
-SkeletalAnimation::SkeletalAnimation(Context* context) :
-    Sample(context),
-    drawDebug_(false)
-{
-    // Register an object factory for our custom Mover component so that we can create them to scene nodes
-    context->RegisterFactory<Mover>();
-}
-
-void SkeletalAnimation::Start()
-{
-    // Execute base class startup
-    Sample::Start();
-
-    // Create the scene content
-    CreateScene();
-
-    // Create the UI content
-    CreateInstructions();
-
-    // Setup the viewport for displaying the scene
-    SetupViewport();
-
-    // Hook up to the frame update and render post-update events
-    SubscribeToEvents();
-}
-
-void SkeletalAnimation::CreateScene()
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-
-    scene_ = new Scene(context_);
-
-    // Create octree, use default volume (-1000, -1000, -1000) to (1000, 1000, 1000)
-    // Also create a DebugRenderer component so that we can draw debug geometry
-    scene_->CreateComponent<Octree>();
-    scene_->CreateComponent<DebugRenderer>();
-
-    // Create scene node & StaticModel component for showing a static plane
-    Node* planeNode = scene_->CreateChild("Plane");
-    planeNode->SetScale(Vector3(100.0f, 1.0f, 100.0f));
-    StaticModel* planeObject = planeNode->CreateComponent<StaticModel>();
-    planeObject->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
-    planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
-
-    // Create a Zone component for ambient lighting & fog control
-    Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
-    zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
-    zone->SetAmbientColor(Color(0.15f, 0.15f, 0.15f));
-    zone->SetFogColor(Color(0.5f, 0.5f, 0.7f));
-    zone->SetFogStart(100.0f);
-    zone->SetFogEnd(300.0f);
-
-    // Create a directional light to the world. Enable cascaded shadows on it
-    Node* lightNode = scene_->CreateChild("DirectionalLight");
-    lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
-    Light* light = lightNode->CreateComponent<Light>();
-    light->SetLightType(LIGHT_DIRECTIONAL);
-    light->SetCastShadows(true);
-    light->SetShadowBias(BiasParameters(0.00025f, 0.5f));
-    // Set cascade splits at 10, 50 and 200 world units, fade shadows out at 80% of maximum shadow distance
-    light->SetShadowCascade(CascadeParameters(10.0f, 50.0f, 200.0f, 0.0f, 0.8f));
-
-    // Create animated models
-    const unsigned NUM_MODELS = 100;
-    const float MODEL_MOVE_SPEED = 2.0f;
-    const float MODEL_ROTATE_SPEED = 100.0f;
-    const BoundingBox bounds(Vector3(-47.0f, 0.0f, -47.0f), Vector3(47.0f, 0.0f, 47.0f));
-
-    for (unsigned i = 0; i < NUM_MODELS; ++i)
-    {
-        Node* modelNode = scene_->CreateChild("Jack");
-        modelNode->SetPosition(Vector3(Random(90.0f) - 45.0f, 0.0f, Random(90.0f) - 45.0f));
-        modelNode->SetRotation(Quaternion(0.0f, Random(360.0f), 0.0f));
-        AnimatedModel* modelObject = modelNode->CreateComponent<AnimatedModel>();
-        modelObject->SetModel(cache->GetResource<Model>("Models/Jack.mdl"));
-        modelObject->SetMaterial(cache->GetResource<Material>("Materials/Jack.xml"));
-        modelObject->SetCastShadows(true);
-
-        // Create an AnimationState for a walk animation. Its time position will need to be manually updated to advance the
-        // animation, The alternative would be to use an AnimationController component which updates the animation automatically,
-        // but we need to update the model's position manually in any case
-        Animation* walkAnimation = cache->GetResource<Animation>("Models/Jack_Walk.ani");
-        AnimationState* state = modelObject->AddAnimationState(walkAnimation);
-        // The state would fail to create (return null) if the animation was not found
-        if (state)
-        {
-            // Enable full blending weight and looping
-            state->SetWeight(1.0f);
-            state->SetLooped(true);
-        }
-
-        // Create our custom Mover component that will move & animate the model during each frame's update
-        Mover* mover = modelNode->CreateComponent<Mover>();
-        mover->SetParameters(MODEL_MOVE_SPEED, MODEL_ROTATE_SPEED, bounds);
-    }
-
-    // Create the camera. Limit far clip distance to match the fog
-    cameraNode_ = scene_->CreateChild("Camera");
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
-    camera->SetFarClip(300.0f);
-
-    // Set an initial position for the camera scene node above the plane
-    cameraNode_->SetPosition(Vector3(0.0f, 5.0f, 0.0f));
-}
-
-void SkeletalAnimation::CreateInstructions()
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
-
-    // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
-    instructionText->SetText(
-        "Use WASD keys and mouse/touch to move\n"
-        "Space to toggle debug geometry"
-    );
-    instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
-    // The text has multiple rows. Center them in relation to each other
-    instructionText->SetTextAlignment(HA_CENTER);
-
-    // Position the text relative to the screen center
-    instructionText->SetHorizontalAlignment(HA_CENTER);
-    instructionText->SetVerticalAlignment(VA_CENTER);
-    instructionText->SetPosition(0, ui->GetRoot()->GetHeight() / 4);
-}
-
-void SkeletalAnimation::SetupViewport()
-{
-    Renderer* renderer = GetSubsystem<Renderer>();
-
-    // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
-    SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
-    renderer->SetViewport(0, viewport);
-}
-
-void SkeletalAnimation::SubscribeToEvents()
-{
-    // Subscribe HandleUpdate() function for processing update events
-    SubscribeToEvent(E_UPDATE, HANDLER(SkeletalAnimation, HandleUpdate));
-
-    // Subscribe HandlePostRenderUpdate() function for processing the post-render update event, sent after Renderer subsystem is
-    // done with defining the draw calls for the viewports (but before actually executing them.) We will request debug geometry
-    // rendering during that event
-    SubscribeToEvent(E_POSTRENDERUPDATE, HANDLER(SkeletalAnimation, HandlePostRenderUpdate));
-}
-
-void SkeletalAnimation::MoveCamera(float timeStep)
-{
-    // Do not move if the UI has a focused element (the console)
-    if (GetSubsystem<UI>()->GetFocusElement())
-        return;
-
-    Input* input = GetSubsystem<Input>();
-
-    // Movement speed as world units per second
-    const float MOVE_SPEED = 20.0f;
-    // Mouse sensitivity as degrees per pixel
-    const float MOUSE_SENSITIVITY = 0.1f;
-
-    // Use this frame's mouse motion to adjust camera node yaw and pitch. Clamp the pitch between -90 and 90 degrees
-    IntVector2 mouseMove = input->GetMouseMove();
-    yaw_ += MOUSE_SENSITIVITY * mouseMove.x_;
-    pitch_ += MOUSE_SENSITIVITY * mouseMove.y_;
-    pitch_ = Clamp(pitch_, -90.0f, 90.0f);
-
-    // Construct new orientation for the camera scene node from yaw and pitch. Roll is fixed to zero
-    cameraNode_->SetRotation(Quaternion(pitch_, yaw_, 0.0f));
-
-    // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
-    if (input->GetKeyDown('W'))
-        cameraNode_->Translate(Vector3::FORWARD * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('S'))
-        cameraNode_->Translate(Vector3::BACK * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('A'))
-        cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('D'))
-        cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
-
-    // Toggle debug geometry with space
-    if (input->GetKeyPress(KEY_SPACE))
-        drawDebug_ = !drawDebug_;
-}
-
-void SkeletalAnimation::HandleUpdate(StringHash eventType, VariantMap& eventData)
-{
-    using namespace Update;
-
-    // Take the frame time step, which is stored as a float
-    float timeStep = eventData[P_TIMESTEP].GetFloat();
-
-    // Move the camera, scale movement with time step
-    MoveCamera(timeStep);
-}
-
-void SkeletalAnimation::HandlePostRenderUpdate(StringHash eventType, VariantMap& eventData)
-{
-    // If draw debug mode is enabled, draw viewport debug geometry, which will show eg. drawable bounding boxes and skeleton
-    // bones. Note that debug geometry has to be separately requested each frame. Disable depth test so that we can see the
-    // bones properly
-    if (drawDebug_)
-        GetSubsystem<Renderer>()->DrawDebugGeometry(false);
-}

+ 0 - 86
Source/Samples/06_SkeletalAnimation/SkeletalAnimation.h

@@ -1,86 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#pragma once
-
-#include "Sample.h"
-
-namespace Atomic
-{
-
-class Node;
-class Scene;
-
-}
-
-/// Skeletal animation example.
-/// This sample demonstrates:
-///     - Populating a 3D scene with skeletally animated AnimatedModel components;
-///     - Moving the animated models and advancing their animation using a custom component
-///     - Enabling a cascaded shadow map on a directional light, which allows high-quality shadows
-///       over a large area (typically used in outdoor scenes for shadows cast by sunlight)
-///     - Displaying renderer debug geometry
-class SkeletalAnimation : public Sample
-{
-    OBJECT(SkeletalAnimation);
-
-public:
-    /// Construct.
-    SkeletalAnimation(Context* context);
-
-    /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
-
-protected:
-    /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
-        "<patch>"
-        "    <remove sel=\"/element/element[./attribute[@name='Name' and @value='Button1']]/attribute[@name='Is Visible']\" />"
-        "    <replace sel=\"/element/element[./attribute[@name='Name' and @value='Button1']]/element[./attribute[@name='Name' and @value='Label']]/attribute[@name='Text']/@value\">Debug</replace>"
-        "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Button1']]\">"
-        "        <element type=\"Text\">"
-        "            <attribute name=\"Name\" value=\"KeyBinding\" />"
-        "            <attribute name=\"Text\" value=\"SPACE\" />"
-        "        </element>"
-        "    </add>"
-        "</patch>";
-    }
-
-private:
-    /// Construct the scene content.
-    void CreateScene();
-    /// Construct an instruction text to the UI.
-    void CreateInstructions();
-    /// Set up a viewport for displaying the scene.
-    void SetupViewport();
-    /// Subscribe to application-wide logic update and post-render update events.
-    void SubscribeToEvents();
-    /// Read input and moves the camera.
-    void MoveCamera(float timeStep);
-    /// Handle the logic update event.
-    void HandleUpdate(StringHash eventType, VariantMap& eventData);
-    /// Handle the post-render update event.
-    void HandlePostRenderUpdate(StringHash eventType, VariantMap& eventData);
-    
-    /// Flag for drawing debug geometry.
-    bool drawDebug_;
-};

+ 0 - 336
Source/Samples/07_Billboards/Billboards.cpp

@@ -1,336 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#include <Atomic/Atomic.h>
-
-#include <Atomic/Graphics/BillboardSet.h>
-#include <Atomic/Graphics/Camera.h>
-#include <Atomic/Core/CoreEvents.h>
-#include <Atomic/Graphics/DebugRenderer.h>
-#include <Atomic/Engine/Engine.h>
-#include <Atomic/UI/Font.h>
-#include <Atomic/Graphics/Graphics.h>
-#include <Atomic/Input/Input.h>
-#include <Atomic/Graphics/Light.h>
-#include <Atomic/Graphics/Material.h>
-#include <Atomic/Graphics/Model.h>
-#include <Atomic/Graphics/Octree.h>
-#include <Atomic/Graphics/Renderer.h>
-#include <Atomic/Resource/ResourceCache.h>
-#include <Atomic/Scene/Scene.h>
-#include <Atomic/Graphics/StaticModel.h>
-#include <Atomic/UI/Text.h>
-#include <Atomic/UI/UI.h>
-#include <Atomic/Graphics/Zone.h>
-
-#include "Billboards.h"
-
-#include <Atomic/DebugNew.h>
-
-DEFINE_APPLICATION_MAIN(Billboards)
-
-Billboards::Billboards(Context* context) :
-    Sample(context),
-    drawDebug_(false)
-{
-}
-
-void Billboards::Start()
-{
-    // Execute base class startup
-    Sample::Start();
-
-    // Create the scene content
-    CreateScene();
-    
-    // Create the UI content
-    CreateInstructions();
-    
-    // Setup the viewport for displaying the scene
-    SetupViewport();
-
-    // Hook up to the frame update and render post-update events
-    SubscribeToEvents();
-}
-
-void Billboards::CreateScene()
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    
-    scene_ = new Scene(context_);
-    
-    // Create octree, use default volume (-1000, -1000, -1000) to (1000, 1000, 1000)
-    // Also create a DebugRenderer component so that we can draw debug geometry
-    scene_->CreateComponent<Octree>();
-    scene_->CreateComponent<DebugRenderer>();
-    
-    // Create a Zone component for ambient lighting & fog control
-    Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
-    zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
-    zone->SetAmbientColor(Color(0.1f, 0.1f, 0.1f));
-    zone->SetFogStart(100.0f);
-    zone->SetFogEnd(300.0f);
-    
-    // Create a directional light without shadows
-    Node* lightNode = scene_->CreateChild("DirectionalLight");
-    lightNode->SetDirection(Vector3(0.5f, -1.0f, 0.5f));
-    Light* light = lightNode->CreateComponent<Light>();
-    light->SetLightType(LIGHT_DIRECTIONAL);
-    light->SetColor(Color(0.2f, 0.2f, 0.2f));
-    light->SetSpecularIntensity(1.0f);
-    
-    // Create a "floor" consisting of several tiles
-    for (int y = -5; y <= 5; ++y)
-    {
-        for (int x = -5; x <= 5; ++x)
-        {
-            Node* floorNode = scene_->CreateChild("FloorTile");
-            floorNode->SetPosition(Vector3(x * 20.5f, -0.5f, y * 20.5f));
-            floorNode->SetScale(Vector3(20.0f, 1.0f, 20.f));
-            StaticModel* floorObject = floorNode->CreateComponent<StaticModel>();
-            floorObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
-            floorObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
-        }
-    }
-    
-    // Create groups of mushrooms, which act as shadow casters
-    const unsigned NUM_MUSHROOMGROUPS = 25;
-    const unsigned NUM_MUSHROOMS = 25;
-    
-    for (unsigned i = 0; i < NUM_MUSHROOMGROUPS; ++i)
-    {
-        // First create a scene node for the group. The individual mushrooms nodes will be created as children
-        Node* groupNode = scene_->CreateChild("MushroomGroup");
-        groupNode->SetPosition(Vector3(Random(190.0f) - 95.0f, 0.0f, Random(190.0f) - 95.0f));
-        
-        for (unsigned j = 0; j < NUM_MUSHROOMS; ++j)
-        {
-            Node* mushroomNode = groupNode->CreateChild("Mushroom");
-            mushroomNode->SetPosition(Vector3(Random(25.0f) - 12.5f, 0.0f, Random(25.0f) - 12.5f));
-            mushroomNode->SetRotation(Quaternion(0.0f, Random() * 360.0f, 0.0f));
-            mushroomNode->SetScale(1.0f + Random() * 4.0f);
-            StaticModel* mushroomObject = mushroomNode->CreateComponent<StaticModel>();
-            mushroomObject->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
-            mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
-            mushroomObject->SetCastShadows(true);
-        }
-    }
-    
-    // Create billboard sets (floating smoke)
-    const unsigned NUM_BILLBOARDNODES = 25;
-    const unsigned NUM_BILLBOARDS = 10;
-
-    for (unsigned i = 0; i < NUM_BILLBOARDNODES; ++i)
-    {
-        Node* smokeNode = scene_->CreateChild("Smoke");
-        smokeNode->SetPosition(Vector3(Random(200.0f) - 100.0f, Random(20.0f) + 10.0f, Random(200.0f) - 100.0f));
-        
-        BillboardSet* billboardObject = smokeNode->CreateComponent<BillboardSet>();
-        billboardObject->SetNumBillboards(NUM_BILLBOARDS);
-        billboardObject->SetMaterial(cache->GetResource<Material>("Materials/LitSmoke.xml"));
-        billboardObject->SetSorted(true);
-        
-        for (unsigned j = 0; j < NUM_BILLBOARDS; ++j)
-        {
-            Billboard* bb = billboardObject->GetBillboard(j);
-            bb->position_ = Vector3(Random(12.0f) - 6.0f, Random(8.0f) - 4.0f, Random(12.0f) - 6.0f);
-            bb->size_ = Vector2(Random(2.0f) + 3.0f, Random(2.0f) + 3.0f);
-            bb->rotation_ = Random() * 360.0f;
-            bb->enabled_ = true;
-        }
-        
-        // After modifying the billboards, they need to be "commited" so that the BillboardSet updates its internals
-        billboardObject->Commit();
-    }
-    
-    // Create shadow casting spotlights
-    const unsigned NUM_LIGHTS = 9;
-    
-    for (unsigned i = 0; i < NUM_LIGHTS; ++i)
-    {
-        Node* lightNode = scene_->CreateChild("SpotLight");
-        Light* light = lightNode->CreateComponent<Light>();
-        
-        float angle = 0.0f;
-        
-        Vector3 position((i % 3) * 60.0f - 60.0f, 45.0f, (i / 3) * 60.0f - 60.0f);
-        Color color(((i + 1) & 1) * 0.5f + 0.5f, (((i + 1) >> 1) & 1) * 0.5f + 0.5f, (((i + 1) >> 2) & 1) * 0.5f + 0.5f);
-        
-        lightNode->SetPosition(position);
-        lightNode->SetDirection(Vector3(Sin(angle), -1.5f, Cos(angle)));
-        
-        light->SetLightType(LIGHT_SPOT);
-        light->SetRange(90.0f);
-        light->SetRampTexture(cache->GetResource<Texture2D>("Textures/RampExtreme.png"));
-        light->SetFov(45.0f);
-        light->SetColor(color);
-        light->SetSpecularIntensity(1.0f);
-        light->SetCastShadows(true);
-        light->SetShadowBias(BiasParameters(0.00002f, 0.0f));
-        
-        // Configure shadow fading for the lights. When they are far away enough, the lights eventually become unshadowed for
-        // better GPU performance. Note that we could also set the maximum distance for each object to cast shadows
-        light->SetShadowFadeDistance(100.0f); // Fade start distance
-        light->SetShadowDistance(125.0f); // Fade end distance, shadows are disabled
-        // Set half resolution for the shadow maps for increased performance
-        light->SetShadowResolution(0.5f);
-        // The spot lights will not have anything near them, so move the near plane of the shadow camera farther
-        // for better shadow depth resolution
-        light->SetShadowNearFarRatio(0.01f);
-    }
-    
-    // Create the camera. Limit far clip distance to match the fog
-    cameraNode_ = scene_->CreateChild("Camera");
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
-    camera->SetFarClip(300.0f);
-    
-    // Set an initial position for the camera scene node above the plane
-    cameraNode_->SetPosition(Vector3(0.0f, 5.0f, 0.0f));
-}
-
-void Billboards::CreateInstructions()
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
-    
-    // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
-    instructionText->SetText(
-        "Use WASD keys and mouse/touch to move\n"
-        "Space to toggle debug geometry"
-    );
-    instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
-    // The text has multiple rows. Center them in relation to each other
-    instructionText->SetTextAlignment(HA_CENTER);
-    
-    // Position the text relative to the screen center
-    instructionText->SetHorizontalAlignment(HA_CENTER);
-    instructionText->SetVerticalAlignment(VA_CENTER);
-    instructionText->SetPosition(0, ui->GetRoot()->GetHeight() / 4);
-}
-
-void Billboards::SetupViewport()
-{
-    Renderer* renderer = GetSubsystem<Renderer>();
-    
-    // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
-    SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
-    renderer->SetViewport(0, viewport);
-}
-
-void Billboards::SubscribeToEvents()
-{
-    // Subscribe HandleUpdate() function for processing update events
-    SubscribeToEvent(E_UPDATE, HANDLER(Billboards, HandleUpdate));
-    
-    // Subscribe HandlePostRenderUpdate() function for processing the post-render update event, during which we request
-    // debug geometry
-    SubscribeToEvent(E_POSTRENDERUPDATE, HANDLER(Billboards, HandlePostRenderUpdate));
-}
-
-void Billboards::MoveCamera(float timeStep)
-{
-    // Do not move if the UI has a focused element (the console)
-    if (GetSubsystem<UI>()->GetFocusElement())
-        return;
-    
-    Input* input = GetSubsystem<Input>();
-    
-    // Movement speed as world units per second
-    const float MOVE_SPEED = 20.0f;
-    // Mouse sensitivity as degrees per pixel
-    const float MOUSE_SENSITIVITY = 0.1f;
-    
-    // Use this frame's mouse motion to adjust camera node yaw and pitch. Clamp the pitch between -90 and 90 degrees
-    IntVector2 mouseMove = input->GetMouseMove();
-    yaw_ += MOUSE_SENSITIVITY * mouseMove.x_;
-    pitch_ += MOUSE_SENSITIVITY * mouseMove.y_;
-    pitch_ = Clamp(pitch_, -90.0f, 90.0f);
-    
-    // Construct new orientation for the camera scene node from yaw and pitch. Roll is fixed to zero
-    cameraNode_->SetRotation(Quaternion(pitch_, yaw_, 0.0f));
-    
-    // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
-    if (input->GetKeyDown('W'))
-        cameraNode_->Translate(Vector3::FORWARD * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('S'))
-        cameraNode_->Translate(Vector3::BACK * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('A'))
-        cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('D'))
-        cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
-    
-    // Toggle debug geometry with space
-    if (input->GetKeyPress(KEY_SPACE))
-        drawDebug_ = !drawDebug_;
-}
-
-void Billboards::AnimateScene(float timeStep)
-{
-    // Get the light and billboard scene nodes
-    PODVector<Node*> lightNodes;
-    PODVector<Node*> billboardNodes;
-    scene_->GetChildrenWithComponent<Light>(lightNodes);
-    scene_->GetChildrenWithComponent<BillboardSet>(billboardNodes);
-    
-    const float LIGHT_ROTATION_SPEED = 20.0f;
-    const float BILLBOARD_ROTATION_SPEED = 50.0f;
-    
-    // Rotate the lights around the world Y-axis
-    for (unsigned i = 0; i < lightNodes.Size(); ++i)
-        lightNodes[i]->Rotate(Quaternion(0.0f, LIGHT_ROTATION_SPEED * timeStep, 0.0f), TS_WORLD);
-    
-    // Rotate the individual billboards within the billboard sets, then recommit to make the changes visible
-    for (unsigned i = 0; i < billboardNodes.Size(); ++i)
-    {
-        BillboardSet* billboardObject = billboardNodes[i]->GetComponent<BillboardSet>();
-        
-        for (unsigned j = 0; j < billboardObject->GetNumBillboards(); ++j)
-        {
-            Billboard* bb = billboardObject->GetBillboard(j);
-            bb->rotation_ += BILLBOARD_ROTATION_SPEED * timeStep;
-        }
-        
-        billboardObject->Commit();
-    }
-}
-
-void Billboards::HandleUpdate(StringHash eventType, VariantMap& eventData)
-{
-    using namespace Update;
-
-    // Take the frame time step, which is stored as a float
-    float timeStep = eventData[P_TIMESTEP].GetFloat();
-    
-    // Move the camera and animate the scene, scale movement with time step
-    MoveCamera(timeStep);
-    AnimateScene(timeStep);
-}
-
-void Billboards::HandlePostRenderUpdate(StringHash eventType, VariantMap& eventData)
-{
-    // If draw debug mode is enabled, draw viewport debug geometry. This time use depth test, as otherwise the result becomes
-    // hard to interpret due to large object count
-    if (drawDebug_)
-        GetSubsystem<Renderer>()->DrawDebugGeometry(true);
-}

+ 0 - 86
Source/Samples/07_Billboards/Billboards.h

@@ -1,86 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#pragma once
-
-#include "Sample.h"
-
-namespace Atomic
-{
-
-class Node;
-class Scene;
-
-}
-
-/// Billboard example.
-/// This sample demonstrates:
-///     - Populating a 3D scene with billboard sets and several shadow casting spotlights
-///     - Parenting scene nodes to allow more intuitive creation of groups of objects
-///     - Examining rendering performance with a somewhat large object and light count
-class Billboards : public Sample
-{
-    OBJECT(Billboards);
-
-public:
-    /// Construct.
-    Billboards(Context* context);
-
-    /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
-
-protected:
-    /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
-        "<patch>"
-        "    <remove sel=\"/element/element[./attribute[@name='Name' and @value='Button1']]/attribute[@name='Is Visible']\" />"
-        "    <replace sel=\"/element/element[./attribute[@name='Name' and @value='Button1']]/element[./attribute[@name='Name' and @value='Label']]/attribute[@name='Text']/@value\">Debug</replace>"
-        "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Button1']]\">"
-        "        <element type=\"Text\">"
-        "            <attribute name=\"Name\" value=\"KeyBinding\" />"
-        "            <attribute name=\"Text\" value=\"SPACE\" />"
-        "        </element>"
-        "    </add>"
-        "</patch>";
-    }
-
-private:
-    /// Construct the scene content.
-    void CreateScene();
-    /// Construct an instruction text to the UI.
-    void CreateInstructions();
-    /// Set up a viewport for displaying the scene.
-    void SetupViewport();
-    /// Subscribe to application-wide logic update and post-render update events.
-    void SubscribeToEvents();
-    /// Read input and moves the camera.
-    void MoveCamera(float timeStep);
-    /// Animate the scene.
-    void AnimateScene(float timeStep);
-    /// Handle the logic update event.
-    void HandleUpdate(StringHash eventType, VariantMap& eventData);
-    /// Handle the post-render update event.
-    void HandlePostRenderUpdate(StringHash eventType, VariantMap& eventData);
-    
-    /// Flag for drawing debug geometry.
-    bool drawDebug_;
-};

+ 0 - 33
Source/Samples/07_Billboards/CMakeLists.txt

@@ -1,33 +0,0 @@
-#
-# Copyright (c) 2008-2014 the Urho3D project.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-
-# Define target name
-set (TARGET_NAME 07_Billboards)
-
-# Define source files
-define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
-
-# Setup target with resource copying
-setup_main_executable ()
-
-# Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${ATOMIC_TEST_TIME_OUT})

+ 0 - 33
Source/Samples/08_Decals/CMakeLists.txt

@@ -1,33 +0,0 @@
-#
-# Copyright (c) 2008-2014 the Urho3D project.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-
-# Define target name
-set (TARGET_NAME 08_Decals)
-
-# Define source files
-define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
-
-# Setup target with resource copying
-setup_main_executable ()
-
-# Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${ATOMIC_TEST_TIME_OUT})

+ 0 - 324
Source/Samples/08_Decals/Decals.cpp

@@ -1,324 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#include <Atomic/Atomic.h>
-
-#include <Atomic/Graphics/Camera.h>
-#include <Atomic/Core/CoreEvents.h>
-#include <Atomic/UI/Cursor.h>
-#include <Atomic/Graphics/DebugRenderer.h>
-#include <Atomic/Graphics/DecalSet.h>
-#include <Atomic/Engine/Engine.h>
-#include <Atomic/UI/Font.h>
-#include <Atomic/Graphics/Graphics.h>
-#include <Atomic/Input/Input.h>
-#include <Atomic/Graphics/Light.h>
-#include <Atomic/Graphics/Material.h>
-#include <Atomic/Graphics/Model.h>
-#include <Atomic/Graphics/Octree.h>
-#include <Atomic/Graphics/Renderer.h>
-#include <Atomic/Resource/ResourceCache.h>
-#include <Atomic/Scene/Scene.h>
-#include <Atomic/Graphics/StaticModel.h>
-#include <Atomic/UI/Text.h>
-#include <Atomic/UI/UI.h>
-#include <Atomic/Resource/XMLFile.h>
-#include <Atomic/Graphics/Zone.h>
-
-#include "Decals.h"
-
-#include <Atomic/DebugNew.h>
-
-DEFINE_APPLICATION_MAIN(Decals)
-
-Decals::Decals(Context* context) :
-    Sample(context),
-    drawDebug_(false)
-{
-}
-
-void Decals::Start()
-{
-    // Execute base class startup
-    Sample::Start();
-
-    // Create the scene content
-    CreateScene();
-    
-    // Create the UI content
-    CreateUI();
-    
-    // Setup the viewport for displaying the scene
-    SetupViewport();
-
-    // Hook up to the frame update and render post-update events
-    SubscribeToEvents();
-}
-
-void Decals::CreateScene()
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    
-    scene_ = new Scene(context_);
-    
-    // Create octree, use default volume (-1000, -1000, -1000) to (1000, 1000, 1000)
-    // Also create a DebugRenderer component so that we can draw debug geometry
-    scene_->CreateComponent<Octree>();
-    scene_->CreateComponent<DebugRenderer>();
-    
-    // Create scene node & StaticModel component for showing a static plane
-    Node* planeNode = scene_->CreateChild("Plane");
-    planeNode->SetScale(Vector3(100.0f, 1.0f, 100.0f));
-    StaticModel* planeObject = planeNode->CreateComponent<StaticModel>();
-    planeObject->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
-    planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
-    
-    // Create a Zone component for ambient lighting & fog control
-    Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
-    zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
-    zone->SetAmbientColor(Color(0.15f, 0.15f, 0.15f));
-    zone->SetFogColor(Color(0.5f, 0.5f, 0.7f));
-    zone->SetFogStart(100.0f);
-    zone->SetFogEnd(300.0f);
-    
-    // Create a directional light to the world. Enable cascaded shadows on it
-    Node* lightNode = scene_->CreateChild("DirectionalLight");
-    lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
-    Light* light = lightNode->CreateComponent<Light>();
-    light->SetLightType(LIGHT_DIRECTIONAL);
-    light->SetCastShadows(true);
-    light->SetShadowBias(BiasParameters(0.00025f, 0.5f));
-    // Set cascade splits at 10, 50 and 200 world units, fade shadows out at 80% of maximum shadow distance
-    light->SetShadowCascade(CascadeParameters(10.0f, 50.0f, 200.0f, 0.0f, 0.8f));
-
-    // Create some mushrooms
-    const unsigned NUM_MUSHROOMS = 240;
-    for (unsigned i = 0; i < NUM_MUSHROOMS; ++i)
-    {
-        Node* mushroomNode = scene_->CreateChild("Mushroom");
-        mushroomNode->SetPosition(Vector3(Random(90.0f) - 45.0f, 0.0f, Random(90.0f) - 45.0f));
-        mushroomNode->SetRotation(Quaternion(0.0f, Random(360.0f), 0.0f));
-        mushroomNode->SetScale(0.5f + Random(2.0f));
-        StaticModel* mushroomObject = mushroomNode->CreateComponent<StaticModel>();
-        mushroomObject->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
-        mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
-        mushroomObject->SetCastShadows(true);
-    }
-    
-    // Create randomly sized boxes. If boxes are big enough, make them occluders. Occluders will be software rasterized before
-    // rendering to a low-resolution depth-only buffer to test the objects in the view frustum for visibility
-    const unsigned NUM_BOXES = 20;
-    for (unsigned i = 0; i < NUM_BOXES; ++i)
-    {
-        Node* boxNode = scene_->CreateChild("Box");
-        float size = 1.0f + Random(10.0f);
-        boxNode->SetPosition(Vector3(Random(80.0f) - 40.0f, size * 0.5f, Random(80.0f) - 40.0f));
-        boxNode->SetScale(size);
-        StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
-        boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
-        boxObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
-        boxObject->SetCastShadows(true);
-        if (size >= 3.0f)
-            boxObject->SetOccluder(true);
-    }
-    
-    // Create the camera. Limit far clip distance to match the fog
-    cameraNode_ = scene_->CreateChild("Camera");
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
-    camera->SetFarClip(300.0f);
-    
-    // Set an initial position for the camera scene node above the plane
-    cameraNode_->SetPosition(Vector3(0.0f, 5.0f, 0.0f));
-}
-
-void Decals::CreateUI()
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
-    
-    // Create a Cursor UI element because we want to be able to hide and show it at will. When hidden, the mouse cursor will
-    // control the camera, and when visible, it will point the raycast target
-    XMLFile* style = cache->GetResource<XMLFile>("UI/DefaultStyle.xml");
-    SharedPtr<Cursor> cursor(new Cursor(context_));
-    cursor->SetStyleAuto(style);
-    ui->SetCursor(cursor);
-    // Set starting position of the cursor at the rendering window center
-    Graphics* graphics = GetSubsystem<Graphics>();
-    cursor->SetPosition(graphics->GetWidth() / 2, graphics->GetHeight() / 2);
-    
-    // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
-    instructionText->SetText(
-        "Use WASD keys to move\n"
-        "LMB to paint decals, RMB to rotate view\n"
-        "Space to toggle debug geometry\n"
-        "7 to toggle occlusion culling"
-    );
-    instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
-    // The text has multiple rows. Center them in relation to each other
-    instructionText->SetTextAlignment(HA_CENTER);
-    
-    // Position the text relative to the screen center
-    instructionText->SetHorizontalAlignment(HA_CENTER);
-    instructionText->SetVerticalAlignment(VA_CENTER);
-    instructionText->SetPosition(0, ui->GetRoot()->GetHeight() / 4);
-}
-
-void Decals::SetupViewport()
-{
-    Renderer* renderer = GetSubsystem<Renderer>();
-    
-    // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
-    SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
-    renderer->SetViewport(0, viewport);
-}
-
-void Decals::SubscribeToEvents()
-{
-    // Subscribe HandleUpdate() function for processing update events
-    SubscribeToEvent(E_UPDATE, HANDLER(Decals, HandleUpdate));
-    
-    // Subscribe HandlePostRenderUpdate() function for processing the post-render update event, during which we request
-    // debug geometry
-    SubscribeToEvent(E_POSTRENDERUPDATE, HANDLER(Decals, HandlePostRenderUpdate));
-}
-
-void Decals::MoveCamera(float timeStep)
-{
-    // Right mouse button controls mouse cursor visibility: hide when pressed
-    UI* ui = GetSubsystem<UI>();
-    Input* input = GetSubsystem<Input>();
-    ui->GetCursor()->SetVisible(!input->GetMouseButtonDown(MOUSEB_RIGHT));
-    
-    // Do not move if the UI has a focused element (the console)
-    if (ui->GetFocusElement())
-        return;
-    
-    // Movement speed as world units per second
-    const float MOVE_SPEED = 20.0f;
-    // Mouse sensitivity as degrees per pixel
-    const float MOUSE_SENSITIVITY = 0.1f;
-    
-    // Use this frame's mouse motion to adjust camera node yaw and pitch. Clamp the pitch between -90 and 90 degrees
-    // Only move the camera when the cursor is hidden
-    if (!ui->GetCursor()->IsVisible())
-    {
-        IntVector2 mouseMove = input->GetMouseMove();
-        yaw_ += MOUSE_SENSITIVITY * mouseMove.x_;
-        pitch_ += MOUSE_SENSITIVITY * mouseMove.y_;
-        pitch_ = Clamp(pitch_, -90.0f, 90.0f);
-        
-        // Construct new orientation for the camera scene node from yaw and pitch. Roll is fixed to zero
-        cameraNode_->SetRotation(Quaternion(pitch_, yaw_, 0.0f));
-    }
-    
-    // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
-    if (input->GetKeyDown('W'))
-        cameraNode_->Translate(Vector3::FORWARD * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('S'))
-        cameraNode_->Translate(Vector3::BACK * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('A'))
-        cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('D'))
-        cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
-    
-    // Toggle debug geometry with space
-    if (input->GetKeyPress(KEY_SPACE))
-        drawDebug_ = !drawDebug_;
-    
-    // Paint decal with the left mousebutton; cursor must be visible
-    if (ui->GetCursor()->IsVisible() && input->GetMouseButtonPress(MOUSEB_LEFT))
-        PaintDecal();
-}
-
-void Decals::PaintDecal()
-{
-    Vector3 hitPos;
-    Drawable* hitDrawable;
-    
-    if (Raycast(250.0f, hitPos, hitDrawable))
-    {
-        // Check if target scene node already has a DecalSet component. If not, create now
-        Node* targetNode = hitDrawable->GetNode();
-        DecalSet* decal = targetNode->GetComponent<DecalSet>();
-        if (!decal)
-        {
-            ResourceCache* cache = GetSubsystem<ResourceCache>();
-            
-            decal = targetNode->CreateComponent<DecalSet>();
-            decal->SetMaterial(cache->GetResource<Material>("Materials/UrhoDecal.xml"));
-        }
-        // Add a square decal to the decal set using the geometry of the drawable that was hit, orient it to face the camera,
-        // use full texture UV's (0,0) to (1,1). Note that if we create several decals to a large object (such as the ground
-        // plane) over a large area using just one DecalSet component, the decals will all be culled as one unit. If that is
-        // undesirable, it may be necessary to create more than one DecalSet based on the distance
-        decal->AddDecal(hitDrawable, hitPos, cameraNode_->GetRotation(), 0.5f, 1.0f, 1.0f, Vector2::ZERO,
-            Vector2::ONE);
-    }
-}
-
-bool Decals::Raycast(float maxDistance, Vector3& hitPos, Drawable*& hitDrawable)
-{
-    hitDrawable = 0;
-    
-    UI* ui = GetSubsystem<UI>();
-    IntVector2 pos = ui->GetCursorPosition();
-    // Check the cursor is visible and there is no UI element in front of the cursor
-    if (!ui->GetCursor()->IsVisible() || ui->GetElementAt(pos, true))
-        return false;
-    
-    Graphics* graphics = GetSubsystem<Graphics>();
-    Camera* camera = cameraNode_->GetComponent<Camera>();
-    Ray cameraRay = camera->GetScreenRay((float)pos.x_ / graphics->GetWidth(), (float)pos.y_ / graphics->GetHeight());
-    // Pick only geometry objects, not eg. zones or lights, only get the first (closest) hit
-    PODVector<RayQueryResult> results;
-    RayOctreeQuery query(results, cameraRay, RAY_TRIANGLE, maxDistance, DRAWABLE_GEOMETRY);
-    scene_->GetComponent<Octree>()->RaycastSingle(query);
-    if (results.Size())
-    {
-        RayQueryResult& result = results[0];
-        hitPos = result.position_;
-        hitDrawable = result.drawable_;
-        return true;
-    }
-    
-    return false;
-}
-
-void Decals::HandleUpdate(StringHash eventType, VariantMap& eventData)
-{
-    using namespace Update;
-
-    // Take the frame time step, which is stored as a float
-    float timeStep = eventData[P_TIMESTEP].GetFloat();
-    
-    // Move the camera, scale movement with time step
-    MoveCamera(timeStep);
-}
-
-void Decals::HandlePostRenderUpdate(StringHash eventType, VariantMap& eventData)
-{
-    // If draw debug mode is enabled, draw viewport debug geometry. Disable depth test so that we can see the effect of occlusion
-    if (drawDebug_)
-        GetSubsystem<Renderer>()->DrawDebugGeometry(false);
-}

+ 0 - 98
Source/Samples/08_Decals/Decals.h

@@ -1,98 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#pragma once
-
-#include "Sample.h"
-
-namespace Atomic
-{
-
-class Drawable;
-class Node;
-class Scene;
-
-}
-
-/// Decals example.
-/// This sample demonstrates:
-///     - Performing a raycast to the octree and adding a decal to the hit location
-///     - Defining a Cursor UI element which stays inside the window and can be shown/hidden
-///     - Marking suitable (large) objects as occluders for occlusion culling
-///     - Displaying renderer debug geometry to see the effect of occlusion
-class Decals : public Sample
-{
-    OBJECT(Decals);
-
-public:
-    /// Construct.
-    Decals(Context* context);
-
-    /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
-
-protected:
-    /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
-        "<patch>"
-        "    <remove sel=\"/element/element[./attribute[@name='Name' and @value='Button0']]/attribute[@name='Is Visible']\" />"
-        "    <replace sel=\"/element/element[./attribute[@name='Name' and @value='Button0']]/element[./attribute[@name='Name' and @value='Label']]/attribute[@name='Text']/@value\">Paint</replace>"
-        "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Button0']]\">"
-        "        <element type=\"Text\">"
-        "            <attribute name=\"Name\" value=\"MouseButtonBinding\" />"
-        "            <attribute name=\"Text\" value=\"LEFT\" />"
-        "        </element>"
-        "    </add>"
-        "    <remove sel=\"/element/element[./attribute[@name='Name' and @value='Button1']]/attribute[@name='Is Visible']\" />"
-        "    <replace sel=\"/element/element[./attribute[@name='Name' and @value='Button1']]/element[./attribute[@name='Name' and @value='Label']]/attribute[@name='Text']/@value\">Debug</replace>"
-        "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Button1']]\">"
-        "        <element type=\"Text\">"
-        "            <attribute name=\"Name\" value=\"KeyBinding\" />"
-        "            <attribute name=\"Text\" value=\"SPACE\" />"
-        "        </element>"
-        "    </add>"
-        "</patch>";
-    }
-
-private:
-    /// Construct the scene content.
-    void CreateScene();
-    /// Construct user interface elements.
-    void CreateUI();
-    /// Set up a viewport for displaying the scene.
-    void SetupViewport();
-    /// Subscribe to application-wide logic update and post-render update events.
-    void SubscribeToEvents();
-    /// Reads input and moves the camera.
-    void MoveCamera(float timeStep);
-    /// Paint a decal using a ray cast from the mouse cursor.
-    void PaintDecal();
-    /// Utility function to raycast to the cursor position. Return true if hit
-    bool Raycast(float maxDistance, Vector3& hitPos, Drawable*& hitDrawable);
-    /// Handle the logic update event.
-    void HandleUpdate(StringHash eventType, VariantMap& eventData);
-    /// Handle the post-render update event.
-    void HandlePostRenderUpdate(StringHash eventType, VariantMap& eventData);
-    
-    /// Flag for drawing debug geometry.
-    bool drawDebug_;
-};

+ 0 - 33
Source/Samples/09_MultipleViewports/CMakeLists.txt

@@ -1,33 +0,0 @@
-#
-# Copyright (c) 2008-2014 the Urho3D project.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-
-# Define target name
-set (TARGET_NAME 09_MultipleViewports)
-
-# Define source files
-define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
-
-# Setup target with resource copying
-setup_main_executable ()
-
-# Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${ATOMIC_TEST_TIME_OUT})

+ 0 - 289
Source/Samples/09_MultipleViewports/MultipleViewports.cpp

@@ -1,289 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#include <Atomic/Atomic.h>
-
-#include <Atomic/Graphics/Camera.h>
-#include <Atomic/Core/CoreEvents.h>
-#include <Atomic/UI/Cursor.h>
-#include <Atomic/Graphics/DebugRenderer.h>
-#include <Atomic/Engine/Engine.h>
-#include <Atomic/UI/Font.h>
-#include <Atomic/Graphics/Graphics.h>
-#include <Atomic/Input/Input.h>
-#include <Atomic/Graphics/Light.h>
-#include <Atomic/Graphics/Material.h>
-#include <Atomic/Graphics/Model.h>
-#include <Atomic/Graphics/Octree.h>
-#include <Atomic/Graphics/Renderer.h>
-#include <Atomic/Graphics/RenderPath.h>
-#include <Atomic/Resource/ResourceCache.h>
-#include <Atomic/Scene/Scene.h>
-#include <Atomic/Graphics/StaticModel.h>
-#include <Atomic/UI/Text.h>
-#include <Atomic/UI/UI.h>
-#include <Atomic/Resource/XMLFile.h>
-#include <Atomic/Graphics/Zone.h>
-
-#include "MultipleViewports.h"
-
-#include <Atomic/DebugNew.h>
-
-DEFINE_APPLICATION_MAIN(MultipleViewports)
-
-MultipleViewports::MultipleViewports(Context* context) :
-    Sample(context),
-    drawDebug_(false)
-{
-}
-
-void MultipleViewports::Start()
-{
-    // Execute base class startup
-    Sample::Start();
-
-    // Create the scene content
-    CreateScene();
-    
-    // Create the UI content
-    CreateInstructions();
-    
-    // Setup the viewports for displaying the scene
-    SetupViewports();
-
-    // Hook up to the frame update and render post-update events
-    SubscribeToEvents();
-}
-
-void MultipleViewports::CreateScene()
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    
-    scene_ = new Scene(context_);
-    
-    // Create octree, use default volume (-1000, -1000, -1000) to (1000, 1000, 1000)
-    // Also create a DebugRenderer component so that we can draw debug geometry
-    scene_->CreateComponent<Octree>();
-    scene_->CreateComponent<DebugRenderer>();
-    
-    // Create scene node & StaticModel component for showing a static plane
-    Node* planeNode = scene_->CreateChild("Plane");
-    planeNode->SetScale(Vector3(100.0f, 1.0f, 100.0f));
-    StaticModel* planeObject = planeNode->CreateComponent<StaticModel>();
-    planeObject->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
-    planeObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
-    
-    // Create a Zone component for ambient lighting & fog control
-    Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
-    zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
-    zone->SetAmbientColor(Color(0.15f, 0.15f, 0.15f));
-    zone->SetFogColor(Color(0.5f, 0.5f, 0.7f));
-    zone->SetFogStart(100.0f);
-    zone->SetFogEnd(300.0f);
-    
-    // Create a directional light to the world. Enable cascaded shadows on it
-    Node* lightNode = scene_->CreateChild("DirectionalLight");
-    lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
-    Light* light = lightNode->CreateComponent<Light>();
-    light->SetLightType(LIGHT_DIRECTIONAL);
-    light->SetCastShadows(true);
-    light->SetShadowBias(BiasParameters(0.00025f, 0.5f));
-    // Set cascade splits at 10, 50 and 200 world units, fade shadows out at 80% of maximum shadow distance
-    light->SetShadowCascade(CascadeParameters(10.0f, 50.0f, 200.0f, 0.0f, 0.8f));
-
-    // Create some mushrooms
-    const unsigned NUM_MUSHROOMS = 240;
-    for (unsigned i = 0; i < NUM_MUSHROOMS; ++i)
-    {
-        Node* mushroomNode = scene_->CreateChild("Mushroom");
-        mushroomNode->SetPosition(Vector3(Random(90.0f) - 45.0f, 0.0f, Random(90.0f) - 45.0f));
-        mushroomNode->SetRotation(Quaternion(0.0f, Random(360.0f), 0.0f));
-        mushroomNode->SetScale(0.5f + Random(2.0f));
-        StaticModel* mushroomObject = mushroomNode->CreateComponent<StaticModel>();
-        mushroomObject->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
-        mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
-        mushroomObject->SetCastShadows(true);
-    }
-    
-    // Create randomly sized boxes. If boxes are big enough, make them occluders
-    const unsigned NUM_BOXES = 20;
-    for (unsigned i = 0; i < NUM_BOXES; ++i)
-    {
-        Node* boxNode = scene_->CreateChild("Box");
-        float size = 1.0f + Random(10.0f);
-        boxNode->SetPosition(Vector3(Random(80.0f) - 40.0f, size * 0.5f, Random(80.0f) - 40.0f));
-        boxNode->SetScale(size);
-        StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
-        boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
-        boxObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
-        boxObject->SetCastShadows(true);
-        if (size >= 3.0f)
-            boxObject->SetOccluder(true);
-    }
-    
-    // Create the cameras. Limit far clip distance to match the fog
-    cameraNode_ = scene_->CreateChild("Camera");
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
-    camera->SetFarClip(300.0f);
-    
-    // Parent the rear camera node to the front camera node and turn it 180 degrees to face backward
-    // Here, we use the angle-axis constructor for Quaternion instead of the usual Euler angles
-    rearCameraNode_ = cameraNode_->CreateChild("RearCamera");
-    rearCameraNode_->Rotate(Quaternion(180.0f, Vector3::UP));
-    Camera* rearCamera = rearCameraNode_->CreateComponent<Camera>();
-    rearCamera->SetFarClip(300.0f);
-    // Because the rear viewport is rather small, disable occlusion culling from it. Use the camera's
-    // "view override flags" for this. We could also disable eg. shadows or force low material quality
-    // if we wanted
-    rearCamera->SetViewOverrideFlags(VO_DISABLE_OCCLUSION);
-    
-    // Set an initial position for the front camera scene node above the plane
-    cameraNode_->SetPosition(Vector3(0.0f, 5.0f, 0.0f));
-}
-
-void MultipleViewports::CreateInstructions()
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
-    
-    // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
-    instructionText->SetText(
-        "Use WASD keys and mouse/touch to move\n"
-        "B to toggle bloom, F to toggle FXAA\n"
-        "Space to toggle debug geometry\n"
-    );
-    instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
-    // The text has multiple rows. Center them in relation to each other
-    instructionText->SetTextAlignment(HA_CENTER);
-    
-    // Position the text relative to the screen center
-    instructionText->SetHorizontalAlignment(HA_CENTER);
-    instructionText->SetVerticalAlignment(VA_CENTER);
-    instructionText->SetPosition(0, ui->GetRoot()->GetHeight() / 4);
-}
-
-void MultipleViewports::SetupViewports()
-{
-    Graphics* graphics = GetSubsystem<Graphics>();
-    Renderer* renderer = GetSubsystem<Renderer>();
-    
-    renderer->SetNumViewports(2);
-    
-    // Set up the front camera viewport
-    SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
-    renderer->SetViewport(0, viewport);
-    
-    // Clone the default render path so that we do not interfere with the other viewport, then add
-    // bloom and FXAA post process effects to the front viewport. Render path commands can be tagged
-    // for example with the effect name to allow easy toggling on and off. We start with the effects
-    // disabled.
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    SharedPtr<RenderPath> effectRenderPath = viewport->GetRenderPath()->Clone();
-    effectRenderPath->Append(cache->GetResource<XMLFile>("PostProcess/Bloom.xml"));
-    effectRenderPath->Append(cache->GetResource<XMLFile>("PostProcess/FXAA2.xml"));
-    // Make the bloom mixing parameter more pronounced
-    effectRenderPath->SetShaderParameter("BloomMix", Vector2(0.9f, 0.6f));
-    effectRenderPath->SetEnabled("Bloom", false);
-    effectRenderPath->SetEnabled("FXAA2", false);
-    viewport->SetRenderPath(effectRenderPath);
-    
-    // Set up the rear camera viewport on top of the front view ("rear view mirror")
-    // The viewport index must be greater in that case, otherwise the view would be left behind
-    SharedPtr<Viewport> rearViewport(new Viewport(context_, scene_, rearCameraNode_->GetComponent<Camera>(),
-        IntRect(graphics->GetWidth() * 2 / 3, 32, graphics->GetWidth() - 32, graphics->GetHeight() / 3)));
-    renderer->SetViewport(1, rearViewport);
-}
-
-void MultipleViewports::SubscribeToEvents()
-{
-    // Subscribe HandleUpdate() method for processing update events
-    SubscribeToEvent(E_UPDATE, HANDLER(MultipleViewports, HandleUpdate));
-    
-    // Subscribe HandlePostRenderUpdate() method for processing the post-render update event, during which we request
-    // debug geometry
-    SubscribeToEvent(E_POSTRENDERUPDATE, HANDLER(MultipleViewports, HandlePostRenderUpdate));
-}
-
-void MultipleViewports::MoveCamera(float timeStep)
-{
-     // Do not move if the UI has a focused element (the console)
-    if (GetSubsystem<UI>()->GetFocusElement())
-        return;
-    
-    Input* input = GetSubsystem<Input>();
-    
-    // Movement speed as world units per second
-    const float MOVE_SPEED = 20.0f;
-    // Mouse sensitivity as degrees per pixel
-    const float MOUSE_SENSITIVITY = 0.1f;
-    
-    // Use this frame's mouse motion to adjust camera node yaw and pitch. Clamp the pitch between -90 and 90 degrees
-    IntVector2 mouseMove = input->GetMouseMove();
-    yaw_ += MOUSE_SENSITIVITY * mouseMove.x_;
-    pitch_ += MOUSE_SENSITIVITY * mouseMove.y_;
-    pitch_ = Clamp(pitch_, -90.0f, 90.0f);
-    
-    // Construct new orientation for the camera scene node from yaw and pitch. Roll is fixed to zero
-    cameraNode_->SetRotation(Quaternion(pitch_, yaw_, 0.0f));
-    
-    // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
-    if (input->GetKeyDown('W'))
-        cameraNode_->Translate(Vector3::FORWARD * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('S'))
-        cameraNode_->Translate(Vector3::BACK * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('A'))
-        cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('D'))
-        cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
-    
-    // Toggle post processing effects on the front viewport. Note that the rear viewport is unaffected
-    RenderPath* effectRenderPath = GetSubsystem<Renderer>()->GetViewport(0)->GetRenderPath();
-    if (input->GetKeyPress('B'))
-        effectRenderPath->ToggleEnabled("Bloom");
-    if (input->GetKeyPress('F'))
-        effectRenderPath->ToggleEnabled("FXAA2");
-    
-    // Toggle debug geometry with space
-    if (input->GetKeyPress(KEY_SPACE))
-        drawDebug_ = !drawDebug_;
-}
-
-void MultipleViewports::HandleUpdate(StringHash eventType, VariantMap& eventData)
-{
-    using namespace Update;
-
-    // Take the frame time step, which is stored as a float
-    float timeStep = eventData[P_TIMESTEP].GetFloat();
-    
-    // Move the camera, scale movement with time step
-    MoveCamera(timeStep);
-}
-
-void MultipleViewports::HandlePostRenderUpdate(StringHash eventType, VariantMap& eventData)
-{
-    // If draw debug mode is enabled, draw viewport debug geometry, which will show eg. drawable bounding boxes and skeleton
-    // bones. Disable depth test so that we can see the effect of occlusion
-    if (drawDebug_)
-        GetSubsystem<Renderer>()->DrawDebugGeometry(false);
-}

+ 0 - 117
Source/Samples/09_MultipleViewports/MultipleViewports.h

@@ -1,117 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#pragma once
-
-#include "Sample.h"
-
-namespace Atomic
-{
-
-class Node;
-class Scene;
-
-}
-
-/// Multiple viewports example.
-/// This sample demonstrates:
-///     - Setting up two viewports with two separate cameras
-///     - Adding post processing effects to a viewport's render path and toggling them
-class MultipleViewports : public Sample
-{
-    OBJECT(MultipleViewports);
-
-public:
-    /// Construct.
-    MultipleViewports(Context* context);
-
-    /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
-
-protected:
-    /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
-        "<patch>"
-        "    <add sel=\"/element\">"
-        "        <element type=\"Button\">"
-        "            <attribute name=\"Name\" value=\"Button3\" />"
-        "            <attribute name=\"Position\" value=\"-120 -120\" />"
-        "            <attribute name=\"Size\" value=\"96 96\" />"
-        "            <attribute name=\"Horiz Alignment\" value=\"Right\" />"
-        "            <attribute name=\"Vert Alignment\" value=\"Bottom\" />"
-        "            <attribute name=\"Texture\" value=\"Texture2D;Textures/TouchInput.png\" />"
-        "            <attribute name=\"Image Rect\" value=\"96 0 192 96\" />"
-        "            <attribute name=\"Hover Image Offset\" value=\"0 0\" />"
-        "            <attribute name=\"Pressed Image Offset\" value=\"0 0\" />"
-        "            <element type=\"Text\">"
-        "                <attribute name=\"Name\" value=\"Label\" />"
-        "                <attribute name=\"Horiz Alignment\" value=\"Center\" />"
-        "                <attribute name=\"Vert Alignment\" value=\"Center\" />"
-        "                <attribute name=\"Color\" value=\"0 0 0 1\" />"
-        "                <attribute name=\"Text\" value=\"FXAA\" />"
-        "            </element>"
-        "            <element type=\"Text\">"
-        "                <attribute name=\"Name\" value=\"KeyBinding\" />"
-        "                <attribute name=\"Text\" value=\"F\" />"
-        "            </element>"
-        "        </element>"
-        "    </add>"
-        "    <remove sel=\"/element/element[./attribute[@name='Name' and @value='Button0']]/attribute[@name='Is Visible']\" />"
-        "    <replace sel=\"/element/element[./attribute[@name='Name' and @value='Button0']]/element[./attribute[@name='Name' and @value='Label']]/attribute[@name='Text']/@value\">Bloom</replace>"
-        "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Button0']]\">"
-        "        <element type=\"Text\">"
-        "            <attribute name=\"Name\" value=\"KeyBinding\" />"
-        "            <attribute name=\"Text\" value=\"B\" />"
-        "        </element>"
-        "    </add>"
-        "    <remove sel=\"/element/element[./attribute[@name='Name' and @value='Button1']]/attribute[@name='Is Visible']\" />"
-        "    <replace sel=\"/element/element[./attribute[@name='Name' and @value='Button1']]/element[./attribute[@name='Name' and @value='Label']]/attribute[@name='Text']/@value\">Debug</replace>"
-        "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Button1']]\">"
-        "        <element type=\"Text\">"
-        "            <attribute name=\"Name\" value=\"KeyBinding\" />"
-        "            <attribute name=\"Text\" value=\"SPACE\" />"
-        "        </element>"
-        "    </add>"
-        "</patch>";
-    }
-
-private:
-    /// Construct the scene content.
-    void CreateScene();
-    /// Construct an instruction text to the UI.
-    void CreateInstructions();
-    /// Set up viewports.
-    void SetupViewports();
-    /// Subscribe to application-wide logic update and post-render update events.
-    void SubscribeToEvents();
-    /// Read input and moves the camera.
-    void MoveCamera(float timeStep);
-    /// Handle the logic update event.
-    void HandleUpdate(StringHash eventType, VariantMap& eventData);
-    /// Handle the post-render update event.
-    void HandlePostRenderUpdate(StringHash eventType, VariantMap& eventData);
-
-    /// Rear-facing camera scene node.
-    SharedPtr<Node> rearCameraNode_;
-    /// Flag for drawing debug geometry.
-    bool drawDebug_;
-};

+ 0 - 33
Source/Samples/10_RenderToTexture/CMakeLists.txt

@@ -1,33 +0,0 @@
-#
-# Copyright (c) 2008-2014 the Urho3D project.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-
-# Define target name
-set (TARGET_NAME 10_RenderToTexture)
-
-# Define source files
-define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
-
-# Setup target with resource copying
-setup_main_executable ()
-
-# Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${ATOMIC_TEST_TIME_OUT})

+ 0 - 285
Source/Samples/10_RenderToTexture/RenderToTexture.cpp

@@ -1,285 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#include <Atomic/Atomic.h>
-
-#include <Atomic/Graphics/Camera.h>
-#include <Atomic/Core/CoreEvents.h>
-#include <Atomic/Engine/Engine.h>
-#include <Atomic/UI/Font.h>
-#include <Atomic/Graphics/Graphics.h>
-#include <Atomic/Input/Input.h>
-#include <Atomic/Graphics/Material.h>
-#include <Atomic/Graphics/Model.h>
-#include <Atomic/Graphics/Octree.h>
-#include <Atomic/Graphics/Renderer.h>
-#include <Atomic/Graphics/RenderSurface.h>
-#include <Atomic/Resource/ResourceCache.h>
-#include <Atomic/Scene/Scene.h>
-#include <Atomic/Graphics/StaticModel.h>
-#include <Atomic/Graphics/Technique.h>
-#include <Atomic/UI/Text.h>
-#include <Atomic/Graphics/Texture2D.h>
-#include <Atomic/UI/UI.h>
-#include <Atomic/Graphics/Zone.h>
-
-#include "RenderToTexture.h"
-#include "Rotator.h"
-
-#include <Atomic/DebugNew.h>
-
-DEFINE_APPLICATION_MAIN(RenderToTexture)
-
-RenderToTexture::RenderToTexture(Context* context) :
-    Sample(context)
-{
-    // Register an object factory for our custom Rotator component so that we can create them to scene nodes
-    context->RegisterFactory<Rotator>();
-}
-
-void RenderToTexture::Start()
-{
-    // Execute base class startup
-    Sample::Start();
-
-    // Create the scene content
-    CreateScene();
-    
-    // Create the UI content
-    CreateInstructions();
-    
-    // Setup the viewport for displaying the scene
-    SetupViewport();
-
-    // Hook up to the frame update events
-    SubscribeToEvents();
-}
-
-void RenderToTexture::CreateScene()
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    
-    {
-        // Create the scene which will be rendered to a texture
-        rttScene_ = new Scene(context_);
-        
-        // Create octree, use default volume (-1000, -1000, -1000) to (1000, 1000, 1000)
-        rttScene_->CreateComponent<Octree>();
-        
-        // Create a Zone for ambient light & fog control
-        Node* zoneNode = rttScene_->CreateChild("Zone");
-        Zone* zone = zoneNode->CreateComponent<Zone>();
-        // Set same volume as the Octree, set a close bluish fog and some ambient light
-        zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
-        zone->SetAmbientColor(Color(0.05f, 0.1f, 0.15f));
-        zone->SetFogColor(Color(0.1f, 0.2f, 0.3f));
-        zone->SetFogStart(10.0f);
-        zone->SetFogEnd(100.0f);
-        
-        // Create randomly positioned and oriented box StaticModels in the scene
-        const unsigned NUM_OBJECTS = 2000;
-        for (unsigned i = 0; i < NUM_OBJECTS; ++i)
-        {
-            Node* boxNode = rttScene_->CreateChild("Box");
-            boxNode->SetPosition(Vector3(Random(200.0f) - 100.0f, Random(200.0f) - 100.0f, Random(200.0f) - 100.0f));
-            // Orient using random pitch, yaw and roll Euler angles
-            boxNode->SetRotation(Quaternion(Random(360.0f), Random(360.0f), Random(360.0f)));
-            StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
-            boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
-            boxObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
-            
-            // Add our custom Rotator component which will rotate the scene node each frame, when the scene sends its update event.
-            // Simply set same rotation speed for all objects
-            Rotator* rotator = boxNode->CreateComponent<Rotator>();
-            rotator->SetRotationSpeed(Vector3(10.0f, 20.0f, 30.0f));
-        }
-        
-        // Create a camera for the render-to-texture scene. Simply leave it at the world origin and let it observe the scene
-        rttCameraNode_ = rttScene_->CreateChild("Camera");
-        Camera* camera = rttCameraNode_->CreateComponent<Camera>();
-        camera->SetFarClip(100.0f);
-        
-        // Create a point light to the camera scene node
-        Light* light = rttCameraNode_->CreateComponent<Light>();
-        light->SetLightType(LIGHT_POINT);
-        light->SetRange(30.0f);
-    }
-    
-    {
-        // Create the scene in which we move around
-        scene_ = new Scene(context_);
-        
-        // Create octree, use also default volume (-1000, -1000, -1000) to (1000, 1000, 1000)
-        scene_->CreateComponent<Octree>();
-        
-        // Create a Zone component for ambient lighting & fog control
-        Node* zoneNode = scene_->CreateChild("Zone");
-        Zone* zone = zoneNode->CreateComponent<Zone>();
-        zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
-        zone->SetAmbientColor(Color(0.1f, 0.1f, 0.1f));
-        zone->SetFogStart(100.0f);
-        zone->SetFogEnd(300.0f);
-        
-        // Create a directional light without shadows
-        Node* lightNode = scene_->CreateChild("DirectionalLight");
-        lightNode->SetDirection(Vector3(0.5f, -1.0f, 0.5f));
-        Light* light = lightNode->CreateComponent<Light>();
-        light->SetLightType(LIGHT_DIRECTIONAL);
-        light->SetColor(Color(0.2f, 0.2f, 0.2f));
-        light->SetSpecularIntensity(1.0f);
-        
-        // Create a "floor" consisting of several tiles
-        for (int y = -5; y <= 5; ++y)
-        {
-            for (int x = -5; x <= 5; ++x)
-            {
-                Node* floorNode = scene_->CreateChild("FloorTile");
-                floorNode->SetPosition(Vector3(x * 20.5f, -0.5f, y * 20.5f));
-                floorNode->SetScale(Vector3(20.0f, 1.0f, 20.f));
-                StaticModel* floorObject = floorNode->CreateComponent<StaticModel>();
-                floorObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
-                floorObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
-            }
-        }
-        
-        // Create a "screen" like object for viewing the second scene. Construct it from two StaticModels, a box for the frame
-        // and a plane for the actual view
-        {
-            Node* boxNode = scene_->CreateChild("ScreenBox");
-            boxNode->SetPosition(Vector3(0.0f, 10.0f, 0.0f));
-            boxNode->SetScale(Vector3(21.0f, 16.0f, 0.5f));
-            StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
-            boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
-            boxObject->SetMaterial(cache->GetResource<Material>("Materials/Stone.xml"));
-            
-            Node* screenNode = scene_->CreateChild("Screen");
-            screenNode->SetPosition(Vector3(0.0f, 10.0f, -0.27f));
-            screenNode->SetRotation(Quaternion(-90.0f, 0.0f, 0.0f));
-            screenNode->SetScale(Vector3(20.0f, 0.0f, 15.0f));
-            StaticModel* screenObject = screenNode->CreateComponent<StaticModel>();
-            screenObject->SetModel(cache->GetResource<Model>("Models/Plane.mdl"));
-            
-            // Create a renderable texture (1024x768, RGB format), enable bilinear filtering on it
-            SharedPtr<Texture2D> renderTexture(new Texture2D(context_));
-            renderTexture->SetSize(1024, 768, Graphics::GetRGBFormat(), TEXTURE_RENDERTARGET);
-            renderTexture->SetFilterMode(FILTER_BILINEAR);
-            
-            // Create a new material from scratch, use the diffuse unlit technique, assign the render texture
-            // as its diffuse texture, then assign the material to the screen plane object
-            SharedPtr<Material> renderMaterial(new Material(context_));
-            renderMaterial->SetTechnique(0, cache->GetResource<Technique>("Techniques/DiffUnlit.xml"));
-            renderMaterial->SetTexture(TU_DIFFUSE, renderTexture);
-            screenObject->SetMaterial(renderMaterial);
-            
-            // Get the texture's RenderSurface object (exists when the texture has been created in rendertarget mode)
-            // and define the viewport for rendering the second scene, similarly as how backbuffer viewports are defined
-            // to the Renderer subsystem. By default the texture viewport will be updated when the texture is visible
-            // in the main view
-            RenderSurface* surface = renderTexture->GetRenderSurface();
-            SharedPtr<Viewport> rttViewport(new Viewport(context_, rttScene_, rttCameraNode_->GetComponent<Camera>()));
-            surface->SetViewport(0, rttViewport);
-        }
-        
-        // Create the camera which we will move around. Limit far clip distance to match the fog
-        cameraNode_ = scene_->CreateChild("Camera");
-        Camera* camera = cameraNode_->CreateComponent<Camera>();
-        camera->SetFarClip(300.0f);
-        
-        // Set an initial position for the camera scene node above the plane
-        cameraNode_->SetPosition(Vector3(0.0f, 7.0f, -30.0f));
-    }
-}
-
-void RenderToTexture::CreateInstructions()
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
-    
-    // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
-    instructionText->SetText("Use WASD keys and mouse/touch to move");
-    instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
-    
-    // Position the text relative to the screen center
-    instructionText->SetHorizontalAlignment(HA_CENTER);
-    instructionText->SetVerticalAlignment(VA_CENTER);
-    instructionText->SetPosition(0, ui->GetRoot()->GetHeight() / 4);
-}
-
-void RenderToTexture::SetupViewport()
-{
-    Renderer* renderer = GetSubsystem<Renderer>();
-    
-    // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
-    SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
-    renderer->SetViewport(0, viewport);
-}
-
-void RenderToTexture::MoveCamera(float timeStep)
-{
-    // Do not move if the UI has a focused element (the console)
-    if (GetSubsystem<UI>()->GetFocusElement())
-        return;
-    
-    Input* input = GetSubsystem<Input>();
-    
-    // Movement speed as world units per second
-    const float MOVE_SPEED = 20.0f;
-    // Mouse sensitivity as degrees per pixel
-    const float MOUSE_SENSITIVITY = 0.1f;
-    
-    // Use this frame's mouse motion to adjust camera node yaw and pitch. Clamp the pitch between -90 and 90 degrees
-    IntVector2 mouseMove = input->GetMouseMove();
-    yaw_ += MOUSE_SENSITIVITY * mouseMove.x_;
-    pitch_ += MOUSE_SENSITIVITY * mouseMove.y_;
-    pitch_ = Clamp(pitch_, -90.0f, 90.0f);
-    
-    // Construct new orientation for the camera scene node from yaw and pitch. Roll is fixed to zero
-    cameraNode_->SetRotation(Quaternion(pitch_, yaw_, 0.0f));
-    
-    // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
-    if (input->GetKeyDown('W'))
-        cameraNode_->Translate(Vector3::FORWARD * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('S'))
-        cameraNode_->Translate(Vector3::BACK * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('A'))
-        cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('D'))
-        cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
-}
-
-void RenderToTexture::SubscribeToEvents()
-{
-    // Subscribe HandleUpdate() function for processing update events
-    SubscribeToEvent(E_UPDATE, HANDLER(RenderToTexture, HandleUpdate));
-}
-
-void RenderToTexture::HandleUpdate(StringHash eventType, VariantMap& eventData)
-{
-    using namespace Update;
-
-    // Take the frame time step, which is stored as a float
-    float timeStep = eventData[P_TIMESTEP].GetFloat();
-    
-    // Move the camera, scale movement with time step
-    MoveCamera(timeStep);
-}

+ 0 - 68
Source/Samples/10_RenderToTexture/RenderToTexture.h

@@ -1,68 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#pragma once
-
-#include "Sample.h"
-
-namespace Atomic
-{
-
-class Node;
-class Scene;
-
-}
-
-/// Render to texture example
-/// This sample demonstrates:
-///     - Creating two 3D scenes and rendering the other into a texture
-///     - Creating rendertarget texture and material programmatically
-class RenderToTexture : public Sample
-{
-    OBJECT(RenderToTexture);
-
-public:
-    /// Construct.
-    RenderToTexture(Context* context);
-
-    /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
-
-private:
-    /// Construct the scene content.
-    void CreateScene();
-    /// Construct an instruction text to the UI.
-    void CreateInstructions();
-    /// Set up a viewport for displaying the scene.
-    void SetupViewport();
-    /// Subscribe to application-wide logic update events.
-    void SubscribeToEvents();
-    /// Read input and moves the camera.
-    void MoveCamera(float timeStep);
-    /// Handle the logic update event.
-    void HandleUpdate(StringHash eventType, VariantMap& eventData);
-
-    /// Scene that is rendered to a texture.
-    SharedPtr<Scene> rttScene_;
-    /// Camera scene node in the render-to-texture scene.
-    SharedPtr<Node> rttCameraNode_;
-};

+ 0 - 50
Source/Samples/10_RenderToTexture/Rotator.cpp

@@ -1,50 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#include <Atomic/Atomic.h>
-
-#include <Atomic/Scene/Scene.h>
-#include <Atomic/Scene/SceneEvents.h>
-
-#include "Rotator.h"
-
-#include <Atomic/DebugNew.h>
-
-Rotator::Rotator(Context* context) :
-    LogicComponent(context),
-    rotationSpeed_(Vector3::ZERO)
-{
-    // Only the scene update event is needed: unsubscribe from the rest for optimization
-    SetUpdateEventMask(USE_UPDATE);
-}
-
-void Rotator::SetRotationSpeed(const Vector3& speed)
-{
-    rotationSpeed_ = speed;
-}
-
-void Rotator::Update(float timeStep)
-{
-    // Components have their scene node as a member variable for convenient access. Rotate the scene node now: construct a
-    // rotation quaternion from Euler angles, scale rotation speed with the scene update time step
-    node_->Rotate(Quaternion(rotationSpeed_.x_ * timeStep, rotationSpeed_.y_ * timeStep, rotationSpeed_.z_ * timeStep));
-}

+ 0 - 50
Source/Samples/10_RenderToTexture/Rotator.h

@@ -1,50 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#pragma once
-
-#include <Atomic/Scene/LogicComponent.h>
-
-// All Atomic classes reside in namespace Atomic
-using namespace Atomic;
-
-/// Custom logic component for rotating a scene node.
-class Rotator : public LogicComponent
-{
-    OBJECT(Rotator);
-    
-public:
-    /// Construct.
-    Rotator(Context* context);
-    
-    /// Set rotation speed about the Euler axes. Will be scaled with scene update time step.
-    void SetRotationSpeed(const Vector3& speed);
-    /// Handle scene update. Called by LogicComponent base class.
-    virtual void Update(float timeStep);
-    
-    /// Return rotation speed.
-    const Vector3& GetRotationSpeed() const { return rotationSpeed_; }
-    
-private:
-    /// Rotation speed.
-    Vector3 rotationSpeed_;
-};

+ 0 - 33
Source/Samples/11_Physics/CMakeLists.txt

@@ -1,33 +0,0 @@
-#
-# Copyright (c) 2008-2014 the Urho3D project.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-
-# Define target name
-set (TARGET_NAME 11_Physics)
-
-# Define source files
-define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
-
-# Setup target with resource copying
-setup_main_executable ()
-
-# Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${ATOMIC_TEST_TIME_OUT})

+ 0 - 316
Source/Samples/11_Physics/Physics.cpp

@@ -1,316 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#include <Atomic/Atomic.h>
-
-#include <Atomic/Graphics/Camera.h>
-#include <Atomic/Physics/CollisionShape.h>
-#include <Atomic/Core/CoreEvents.h>
-#include <Atomic/Graphics/DebugRenderer.h>
-#include <Atomic/Engine/Engine.h>
-#include <Atomic/IO/File.h>
-#include <Atomic/IO/FileSystem.h>
-#include <Atomic/UI/Font.h>
-#include <Atomic/Graphics/Graphics.h>
-#include <Atomic/Input/Input.h>
-#include <Atomic/Graphics/Light.h>
-#include <Atomic/Graphics/Material.h>
-#include <Atomic/Graphics/Model.h>
-#include <Atomic/Graphics/Octree.h>
-#include <Atomic/Physics/PhysicsWorld.h>
-#include <Atomic/Graphics/Renderer.h>
-#include <Atomic/Resource/ResourceCache.h>
-#include <Atomic/Physics/RigidBody.h>
-#include <Atomic/Scene/Scene.h>
-#include <Atomic/Graphics/Skybox.h>
-#include <Atomic/Graphics/StaticModel.h>
-#include <Atomic/UI/Text.h>
-#include <Atomic/UI/UI.h>
-#include <Atomic/Graphics/Zone.h>
-
-#include "Physics.h"
-
-#include <Atomic/DebugNew.h>
-
-DEFINE_APPLICATION_MAIN(Physics)
-
-Physics::Physics(Context* context) :
-    Sample(context),
-    drawDebug_(false)
-{
-}
-
-void Physics::Start()
-{
-    // Execute base class startup
-    Sample::Start();
-
-    // Create the scene content
-    CreateScene();
-    
-    // Create the UI content
-    CreateInstructions();
-    
-    // Setup the viewport for displaying the scene
-    SetupViewport();
-
-    // Hook up to the frame update and render post-update events
-    SubscribeToEvents();
-}
-
-void Physics::CreateScene()
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    
-    scene_ = new Scene(context_);
-    
-    // Create octree, use default volume (-1000, -1000, -1000) to (1000, 1000, 1000)
-    // Create a physics simulation world with default parameters, which will update at 60fps. Like the Octree must
-    // exist before creating drawable components, the PhysicsWorld must exist before creating physics components.
-    // Finally, create a DebugRenderer component so that we can draw physics debug geometry
-    scene_->CreateComponent<Octree>();
-    scene_->CreateComponent<PhysicsWorld>();
-    scene_->CreateComponent<DebugRenderer>();
-    
-    // Create a Zone component for ambient lighting & fog control
-    Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
-    zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
-    zone->SetAmbientColor(Color(0.15f, 0.15f, 0.15f));
-    zone->SetFogColor(Color(1.0f, 1.0f, 1.0f));
-    zone->SetFogStart(300.0f);
-    zone->SetFogEnd(500.0f);
-    
-    // Create a directional light to the world. Enable cascaded shadows on it
-    Node* lightNode = scene_->CreateChild("DirectionalLight");
-    lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
-    Light* light = lightNode->CreateComponent<Light>();
-    light->SetLightType(LIGHT_DIRECTIONAL);
-    light->SetCastShadows(true);
-    light->SetShadowBias(BiasParameters(0.00025f, 0.5f));
-    // Set cascade splits at 10, 50 and 200 world units, fade shadows out at 80% of maximum shadow distance
-    light->SetShadowCascade(CascadeParameters(10.0f, 50.0f, 200.0f, 0.0f, 0.8f));
-    
-    // Create skybox. The Skybox component is used like StaticModel, but it will be always located at the camera, giving the
-    // illusion of the box planes being far away. Use just the ordinary Box model and a suitable material, whose shader will
-    // generate the necessary 3D texture coordinates for cube mapping
-    Node* skyNode = scene_->CreateChild("Sky");
-    skyNode->SetScale(500.0f); // The scale actually does not matter
-    Skybox* skybox = skyNode->CreateComponent<Skybox>();
-    skybox->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
-    skybox->SetMaterial(cache->GetResource<Material>("Materials/Skybox.xml"));
-    
-    {
-        // Create a floor object, 1000 x 1000 world units. Adjust position so that the ground is at zero Y
-        Node* floorNode = scene_->CreateChild("Floor");
-        floorNode->SetPosition(Vector3(0.0f, -0.5f, 0.0f));
-        floorNode->SetScale(Vector3(1000.0f, 1.0f, 1000.0f));
-        StaticModel* floorObject = floorNode->CreateComponent<StaticModel>();
-        floorObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
-        floorObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
-        
-        // Make the floor physical by adding RigidBody and CollisionShape components. The RigidBody's default
-        // parameters make the object static (zero mass.) Note that a CollisionShape by itself will not participate
-        // in the physics simulation
-        /*RigidBody* body = */floorNode->CreateComponent<RigidBody>();
-        CollisionShape* shape = floorNode->CreateComponent<CollisionShape>();
-        // Set a box shape of size 1 x 1 x 1 for collision. The shape will be scaled with the scene node scale, so the
-        // rendering and physics representation sizes should match (the box model is also 1 x 1 x 1.)
-        shape->SetBox(Vector3::ONE);
-    }
-    
-    {
-        // Create a pyramid of movable physics objects
-        for (int y = 0; y < 8; ++y)
-        {
-            for (int x = -y; x <= y; ++x)
-            {
-                Node* boxNode = scene_->CreateChild("Box");
-                boxNode->SetPosition(Vector3((float)x, -(float)y + 8.0f, 0.0f));
-                StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
-                boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
-                boxObject->SetMaterial(cache->GetResource<Material>("Materials/StoneEnvMapSmall.xml"));
-                boxObject->SetCastShadows(true);
-                
-                // Create RigidBody and CollisionShape components like above. Give the RigidBody mass to make it movable
-                // and also adjust friction. The actual mass is not important; only the mass ratios between colliding 
-                // objects are significant
-                RigidBody* body = boxNode->CreateComponent<RigidBody>();
-                body->SetMass(1.0f);
-                body->SetFriction(0.75f);
-                CollisionShape* shape = boxNode->CreateComponent<CollisionShape>();
-                shape->SetBox(Vector3::ONE);
-            }
-        }
-    }
-    
-    // Create the camera. Set far clip to match the fog. Note: now we actually create the camera node outside the scene, because
-    // we want it to be unaffected by scene load / save
-    cameraNode_ = new Node(context_);
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
-    camera->SetFarClip(500.0f);
-    
-    // Set an initial position for the camera scene node above the floor
-    cameraNode_->SetPosition(Vector3(0.0f, 5.0f, -20.0f));
-}
-
-void Physics::CreateInstructions()
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
-    
-    // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
-    instructionText->SetText(
-        "Use WASD keys and mouse/touch to move\n"
-        "LMB to spawn physics objects\n"
-        "F5 to save scene, F7 to load\n"
-        "Space to toggle physics debug geometry"
-    );
-    instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
-    // The text has multiple rows. Center them in relation to each other
-    instructionText->SetTextAlignment(HA_CENTER);
-    
-    // Position the text relative to the screen center
-    instructionText->SetHorizontalAlignment(HA_CENTER);
-    instructionText->SetVerticalAlignment(VA_CENTER);
-    instructionText->SetPosition(0, ui->GetRoot()->GetHeight() / 4);
-}
-
-void Physics::SetupViewport()
-{
-    Renderer* renderer = GetSubsystem<Renderer>();
-    
-    // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
-    SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
-    renderer->SetViewport(0, viewport);
-}
-
-void Physics::SubscribeToEvents()
-{
-    // Subscribe HandleUpdate() function for processing update events
-    SubscribeToEvent(E_UPDATE, HANDLER(Physics, HandleUpdate));
-    
-    // Subscribe HandlePostRenderUpdate() function for processing the post-render update event, during which we request
-    // debug geometry
-    SubscribeToEvent(E_POSTRENDERUPDATE, HANDLER(Physics, HandlePostRenderUpdate));
-}
-
-void Physics::MoveCamera(float timeStep)
-{
-    // Do not move if the UI has a focused element (the console)
-    if (GetSubsystem<UI>()->GetFocusElement())
-        return;
-    
-    Input* input = GetSubsystem<Input>();
-    
-    // Movement speed as world units per second
-    const float MOVE_SPEED = 20.0f;
-    // Mouse sensitivity as degrees per pixel
-    const float MOUSE_SENSITIVITY = 0.1f;
-    
-    // Use this frame's mouse motion to adjust camera node yaw and pitch. Clamp the pitch between -90 and 90 degrees
-    IntVector2 mouseMove = input->GetMouseMove();
-    yaw_ += MOUSE_SENSITIVITY * mouseMove.x_;
-    pitch_ += MOUSE_SENSITIVITY * mouseMove.y_;
-    pitch_ = Clamp(pitch_, -90.0f, 90.0f);
-    
-    // Construct new orientation for the camera scene node from yaw and pitch. Roll is fixed to zero
-    cameraNode_->SetRotation(Quaternion(pitch_, yaw_, 0.0f));
-    
-    // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
-    if (input->GetKeyDown('W'))
-        cameraNode_->Translate(Vector3::FORWARD * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('S'))
-        cameraNode_->Translate(Vector3::BACK * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('A'))
-        cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('D'))
-        cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
-    
-    // "Shoot" a physics object with left mousebutton
-    if (input->GetMouseButtonPress(MOUSEB_LEFT))
-        SpawnObject();
-    
-    // Check for loading/saving the scene. Save the scene to the file Data/Scenes/Physics.xml relative to the executable
-    // directory
-    if (input->GetKeyPress(KEY_F5))
-    {
-        File saveFile(context_, GetSubsystem<FileSystem>()->GetProgramDir() + "Data/Scenes/Physics.xml", FILE_WRITE);
-        scene_->SaveXML(saveFile);
-    }
-    if (input->GetKeyPress(KEY_F7))
-    {
-        File loadFile(context_, GetSubsystem<FileSystem>()->GetProgramDir() + "Data/Scenes/Physics.xml", FILE_READ);
-        scene_->LoadXML(loadFile);
-    }
-
-    // Toggle physics debug geometry with space
-    if (input->GetKeyPress(KEY_SPACE))
-        drawDebug_ = !drawDebug_;
-}
-
-void Physics::SpawnObject()
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    
-    // Create a smaller box at camera position
-    Node* boxNode = scene_->CreateChild("SmallBox");
-    boxNode->SetPosition(cameraNode_->GetPosition());
-    boxNode->SetRotation(cameraNode_->GetRotation());
-    boxNode->SetScale(0.25f);
-    StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
-    boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
-    boxObject->SetMaterial(cache->GetResource<Material>("Materials/StoneEnvMapSmall.xml"));
-    boxObject->SetCastShadows(true);
-    
-    // Create physics components, use a smaller mass also
-    RigidBody* body = boxNode->CreateComponent<RigidBody>();
-    body->SetMass(0.25f);
-    body->SetFriction(0.75f);
-    CollisionShape* shape = boxNode->CreateComponent<CollisionShape>();
-    shape->SetBox(Vector3::ONE);
-    
-    const float OBJECT_VELOCITY = 10.0f;
-    
-    // Set initial velocity for the RigidBody based on camera forward vector. Add also a slight up component
-    // to overcome gravity better
-    body->SetLinearVelocity(cameraNode_->GetRotation() * Vector3(0.0f, 0.25f, 1.0f) * OBJECT_VELOCITY);
-}
-
-void Physics::HandleUpdate(StringHash eventType, VariantMap& eventData)
-{
-    using namespace Update;
-
-    // Take the frame time step, which is stored as a float
-    float timeStep = eventData[P_TIMESTEP].GetFloat();
-    
-    // Move the camera, scale movement with time step
-    MoveCamera(timeStep);
-}
-
-void Physics::HandlePostRenderUpdate(StringHash eventType, VariantMap& eventData)
-{
-    // If draw debug mode is enabled, draw physics debug geometry. Use depth test to make the result easier to interpret
-    if (drawDebug_)
-        scene_->GetComponent<PhysicsWorld>()->DrawDebugGeometry(true);
-}

+ 0 - 95
Source/Samples/11_Physics/Physics.h

@@ -1,95 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#pragma once
-
-#include "Sample.h"
-
-namespace Atomic
-{
-
-class Node;
-class Scene;
-
-}
-
-/// Physics example.
-/// This sample demonstrates:
-///     - Creating both static and moving physics objects to a scene
-///     - Displaying physics debug geometry
-///     - Using the Skybox component for setting up an unmoving sky
-///     - Saving a scene to a file and loading it to restore a previous state
-class Physics : public Sample
-{
-    OBJECT(Physics);
-
-public:
-    /// Construct.
-    Physics(Context* context);
-
-    /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
-
-protected:
-    /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
-        "<patch>"
-        "    <remove sel=\"/element/element[./attribute[@name='Name' and @value='Button0']]/attribute[@name='Is Visible']\" />"
-        "    <replace sel=\"/element/element[./attribute[@name='Name' and @value='Button0']]/element[./attribute[@name='Name' and @value='Label']]/attribute[@name='Text']/@value\">Spawn</replace>"
-        "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Button0']]\">"
-        "        <element type=\"Text\">"
-        "            <attribute name=\"Name\" value=\"MouseButtonBinding\" />"
-        "            <attribute name=\"Text\" value=\"LEFT\" />"
-        "        </element>"
-        "    </add>"
-        "    <remove sel=\"/element/element[./attribute[@name='Name' and @value='Button1']]/attribute[@name='Is Visible']\" />"
-        "    <replace sel=\"/element/element[./attribute[@name='Name' and @value='Button1']]/element[./attribute[@name='Name' and @value='Label']]/attribute[@name='Text']/@value\">Debug</replace>"
-        "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Button1']]\">"
-        "        <element type=\"Text\">"
-        "            <attribute name=\"Name\" value=\"KeyBinding\" />"
-        "            <attribute name=\"Text\" value=\"SPACE\" />"
-        "        </element>"
-        "    </add>"
-        "</patch>";
-    }
-
-private:
-    /// Construct the scene content.
-    void CreateScene();
-    /// Construct an instruction text to the UI.
-    void CreateInstructions();
-    /// Set up a viewport for displaying the scene.
-    void SetupViewport();
-    /// Subscribe to application-wide logic update and post-render update events.
-    void SubscribeToEvents();
-    /// Read input and moves the camera.
-    void MoveCamera(float timeStep);
-    /// Spawn a physics object from the camera position.
-    void SpawnObject();
-    /// Handle the logic update event.
-    void HandleUpdate(StringHash eventType, VariantMap& eventData);
-    /// Handle the post-render update event.
-    void HandlePostRenderUpdate(StringHash eventType, VariantMap& eventData);
-
-    /// Flag for drawing debug geometry.
-    bool drawDebug_;
-};

+ 0 - 33
Source/Samples/12_PhysicsStressTest/CMakeLists.txt

@@ -1,33 +0,0 @@
-#
-# Copyright (c) 2008-2014 the Urho3D project.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-
-# Define target name
-set (TARGET_NAME 12_PhysicsStressTest)
-
-# Define source files
-define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
-
-# Setup target with resource copying
-setup_main_executable ()
-
-# Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${ATOMIC_TEST_TIME_OUT})

+ 0 - 320
Source/Samples/12_PhysicsStressTest/PhysicsStressTest.cpp

@@ -1,320 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#include <Atomic/Atomic.h>
-
-#include <Atomic/Graphics/Camera.h>
-#include <Atomic/Physics/CollisionShape.h>
-#include <Atomic/Core/CoreEvents.h>
-#include <Atomic/Graphics/DebugRenderer.h>
-#include <Atomic/Engine/Engine.h>
-#include <Atomic/IO/File.h>
-#include <Atomic/IO/FileSystem.h>
-#include <Atomic/UI/Font.h>
-#include <Atomic/Graphics/Graphics.h>
-#include <Atomic/Input/Input.h>
-#include <Atomic/Graphics/Light.h>
-#include <Atomic/Graphics/Material.h>
-#include <Atomic/Graphics/Model.h>
-#include <Atomic/Graphics/Octree.h>
-#include <Atomic/Physics/PhysicsWorld.h>
-#include <Atomic/Graphics/Renderer.h>
-#include <Atomic/Resource/ResourceCache.h>
-#include <Atomic/Physics/RigidBody.h>
-#include <Atomic/Scene/Scene.h>
-#include <Atomic/Graphics/StaticModel.h>
-#include <Atomic/UI/Text.h>
-#include <Atomic/UI/UI.h>
-#include <Atomic/Graphics/Zone.h>
-
-#include "PhysicsStressTest.h"
-
-#include <Atomic/DebugNew.h>
-
-DEFINE_APPLICATION_MAIN(PhysicsStressTest)
-
-PhysicsStressTest::PhysicsStressTest(Context* context) :
-    Sample(context),
-    drawDebug_(false)
-{
-}
-
-void PhysicsStressTest::Start()
-{
-    // Execute base class startup
-    Sample::Start();
-
-    // Create the scene content
-    CreateScene();
-    
-    // Create the UI content
-    CreateInstructions();
-    
-    // Setup the viewport for displaying the scene
-    SetupViewport();
-
-    // Hook up to the frame update and render post-update events
-    SubscribeToEvents();
-}
-
-void PhysicsStressTest::CreateScene()
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    
-    scene_ = new Scene(context_);
-    
-    // Create octree, use default volume (-1000, -1000, -1000) to (1000, 1000, 1000)
-    // Create a physics simulation world with default parameters, which will update at 60fps. Like the Octree must
-    // exist before creating drawable components, the PhysicsWorld must exist before creating physics components.
-    // Finally, create a DebugRenderer component so that we can draw physics debug geometry
-    scene_->CreateComponent<Octree>();
-    scene_->CreateComponent<PhysicsWorld>();
-    scene_->CreateComponent<DebugRenderer>();
-    
-    // Create a Zone component for ambient lighting & fog control
-    Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
-    zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
-    zone->SetAmbientColor(Color(0.15f, 0.15f, 0.15f));
-    zone->SetFogColor(Color(0.5f, 0.5f, 0.7f));
-    zone->SetFogStart(100.0f);
-    zone->SetFogEnd(300.0f);
-    
-    // Create a directional light to the world. Enable cascaded shadows on it
-    Node* lightNode = scene_->CreateChild("DirectionalLight");
-    lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
-    Light* light = lightNode->CreateComponent<Light>();
-    light->SetLightType(LIGHT_DIRECTIONAL);
-    light->SetCastShadows(true);
-    light->SetShadowBias(BiasParameters(0.00025f, 0.5f));
-    // Set cascade splits at 10, 50 and 200 world units, fade shadows out at 80% of maximum shadow distance
-    light->SetShadowCascade(CascadeParameters(10.0f, 50.0f, 200.0f, 0.0f, 0.8f));
-    
-    {
-        // Create a floor object, 500 x 500 world units. Adjust position so that the ground is at zero Y
-        Node* floorNode = scene_->CreateChild("Floor");
-        floorNode->SetPosition(Vector3(0.0f, -0.5f, 0.0f));
-        floorNode->SetScale(Vector3(500.0f, 1.0f, 500.0f));
-        StaticModel* floorObject = floorNode->CreateComponent<StaticModel>();
-        floorObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
-        floorObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
-        
-        // Make the floor physical by adding RigidBody and CollisionShape components
-        /*RigidBody* body = */floorNode->CreateComponent<RigidBody>();
-        CollisionShape* shape = floorNode->CreateComponent<CollisionShape>();
-        shape->SetBox(Vector3::ONE);
-    }
-    
-    {
-        // Create static mushrooms with triangle mesh collision
-        const unsigned NUM_MUSHROOMS = 50;
-        for (unsigned i = 0; i < NUM_MUSHROOMS; ++i)
-        {
-            Node* mushroomNode = scene_->CreateChild("Mushroom");
-            mushroomNode->SetPosition(Vector3(Random(400.0f) - 200.0f, 0.0f, Random(400.0f) - 200.0f));
-            mushroomNode->SetRotation(Quaternion(0.0f, Random(360.0f), 0.0f));
-            mushroomNode->SetScale(5.0f + Random(5.0f));
-            StaticModel* mushroomObject = mushroomNode->CreateComponent<StaticModel>();
-            mushroomObject->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
-            mushroomObject->SetMaterial(cache->GetResource<Material>("Materials/Mushroom.xml"));
-            mushroomObject->SetCastShadows(true);
-
-            /*RigidBody* body = */mushroomNode->CreateComponent<RigidBody>();
-            CollisionShape* shape = mushroomNode->CreateComponent<CollisionShape>();
-            // By default the highest LOD level will be used, the LOD level can be passed as an optional parameter
-            shape->SetTriangleMesh(mushroomObject->GetModel());
-        }
-    }
-    
-    {
-        // Create a large amount of falling physics objects
-        const unsigned NUM_OBJECTS = 1000;
-        for (unsigned i = 0; i < NUM_OBJECTS; ++i)
-        {
-            Node* boxNode = scene_->CreateChild("Box");
-            boxNode->SetPosition(Vector3(0.0f, i * 2.0f + 100.0f, 0.0f));
-            StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
-            boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
-            boxObject->SetMaterial(cache->GetResource<Material>("Materials/StoneSmall.xml"));
-            boxObject->SetCastShadows(true);
-            
-            // Give the RigidBody mass to make it movable and also adjust friction
-            RigidBody* body = boxNode->CreateComponent<RigidBody>();
-            body->SetMass(1.0f);
-            body->SetFriction(1.0f);
-            // Disable collision event signaling to reduce CPU load of the physics simulation
-            body->SetCollisionEventMode(COLLISION_NEVER);
-            CollisionShape* shape = boxNode->CreateComponent<CollisionShape>();
-            shape->SetBox(Vector3::ONE);
-        }
-    }
-    
-    // Create the camera. Limit far clip distance to match the fog. Note: now we actually create the camera node outside
-    // the scene, because we want it to be unaffected by scene load / save
-    cameraNode_ = new Node(context_);
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
-    camera->SetFarClip(300.0f);
-    
-    // Set an initial position for the camera scene node above the floor
-    cameraNode_->SetPosition(Vector3(0.0f, 3.0f, -20.0f));
-}
-
-void PhysicsStressTest::CreateInstructions()
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
-    
-    // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
-    instructionText->SetText(
-        "Use WASD keys and mouse/touch to move\n"
-        "LMB to spawn physics objects\n"
-        "F5 to save scene, F7 to load\n"
-        "Space to toggle physics debug geometry"
-    );
-    instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
-    // The text has multiple rows. Center them in relation to each other
-    instructionText->SetTextAlignment(HA_CENTER);
-    
-    // Position the text relative to the screen center
-    instructionText->SetHorizontalAlignment(HA_CENTER);
-    instructionText->SetVerticalAlignment(VA_CENTER);
-    instructionText->SetPosition(0, ui->GetRoot()->GetHeight() / 4);
-}
-
-void PhysicsStressTest::SetupViewport()
-{
-    Renderer* renderer = GetSubsystem<Renderer>();
-    
-    // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
-    SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
-    renderer->SetViewport(0, viewport);
-}
-
-void PhysicsStressTest::SubscribeToEvents()
-{
-    // Subscribe HandleUpdate() function for processing update events
-    SubscribeToEvent(E_UPDATE, HANDLER(PhysicsStressTest, HandleUpdate));
-    
-    // Subscribe HandlePostRenderUpdate() function for processing the post-render update event, during which we request
-    // debug geometry
-    SubscribeToEvent(E_POSTRENDERUPDATE, HANDLER(PhysicsStressTest, HandlePostRenderUpdate));
-}
-
-void PhysicsStressTest::MoveCamera(float timeStep)
-{
-    // Do not move if the UI has a focused element (the console)
-    if (GetSubsystem<UI>()->GetFocusElement())
-        return;
-    
-    Input* input = GetSubsystem<Input>();
-    
-    // Movement speed as world units per second
-    const float MOVE_SPEED = 20.0f;
-    // Mouse sensitivity as degrees per pixel
-    const float MOUSE_SENSITIVITY = 0.1f;
-    
-    // Use this frame's mouse motion to adjust camera node yaw and pitch. Clamp the pitch between -90 and 90 degrees
-    IntVector2 mouseMove = input->GetMouseMove();
-    yaw_ += MOUSE_SENSITIVITY * mouseMove.x_;
-    pitch_ += MOUSE_SENSITIVITY * mouseMove.y_;
-    pitch_ = Clamp(pitch_, -90.0f, 90.0f);
-    
-    // Construct new orientation for the camera scene node from yaw and pitch. Roll is fixed to zero
-    cameraNode_->SetRotation(Quaternion(pitch_, yaw_, 0.0f));
-    
-    // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
-    if (input->GetKeyDown('W'))
-        cameraNode_->Translate(Vector3::FORWARD * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('S'))
-        cameraNode_->Translate(Vector3::BACK * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('A'))
-        cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('D'))
-        cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
-    
-    // "Shoot" a physics object with left mousebutton
-    if (input->GetMouseButtonPress(MOUSEB_LEFT))
-        SpawnObject();
-
-    // Check for loading / saving the scene
-    if (input->GetKeyPress(KEY_F5))
-    {
-        File saveFile(context_, GetSubsystem<FileSystem>()->GetProgramDir() + "Data/Scenes/PhysicsStressTest.xml", FILE_WRITE);
-        scene_->SaveXML(saveFile);
-    }
-    if (input->GetKeyPress(KEY_F7))
-    {
-        File loadFile(context_, GetSubsystem<FileSystem>()->GetProgramDir() + "Data/Scenes/PhysicsStressTest.xml", FILE_READ);
-        scene_->LoadXML(loadFile);
-    }
-
-    // Toggle physics debug geometry with space
-    if (input->GetKeyPress(KEY_SPACE))
-        drawDebug_ = !drawDebug_;
-}
-
-void PhysicsStressTest::SpawnObject()
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    
-    // Create a smaller box at camera position
-    Node* boxNode = scene_->CreateChild("SmallBox");
-    boxNode->SetPosition(cameraNode_->GetPosition());
-    boxNode->SetRotation(cameraNode_->GetRotation());
-    boxNode->SetScale(0.25f);
-    StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
-    boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
-    boxObject->SetMaterial(cache->GetResource<Material>("Materials/StoneSmall.xml"));
-    boxObject->SetCastShadows(true);
-    
-    // Create physics components, use a smaller mass also
-    RigidBody* body = boxNode->CreateComponent<RigidBody>();
-    body->SetMass(0.25f);
-    body->SetFriction(0.75f);
-    CollisionShape* shape = boxNode->CreateComponent<CollisionShape>();
-    shape->SetBox(Vector3::ONE);
-    
-    const float OBJECT_VELOCITY = 10.0f;
-    
-    // Set initial velocity for the RigidBody based on camera forward vector. Add also a slight up component
-    // to overcome gravity better
-    body->SetLinearVelocity(cameraNode_->GetRotation() * Vector3(0.0f, 0.25f, 1.0f) * OBJECT_VELOCITY);
-}
-
-void PhysicsStressTest::HandleUpdate(StringHash eventType, VariantMap& eventData)
-{
-    using namespace Update;
-
-    // Take the frame time step, which is stored as a float
-    float timeStep = eventData[P_TIMESTEP].GetFloat();
-    
-    // Move the camera, scale movement with time step
-    MoveCamera(timeStep);
-}
-
-void PhysicsStressTest::HandlePostRenderUpdate(StringHash eventType, VariantMap& eventData)
-{
-    // If draw debug mode is enabled, draw physics debug geometry. Use depth test to make the result easier to interpret
-    if (drawDebug_)
-        scene_->GetComponent<PhysicsWorld>()->DrawDebugGeometry(true);
-}

+ 0 - 94
Source/Samples/12_PhysicsStressTest/PhysicsStressTest.h

@@ -1,94 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#pragma once
-
-#include "Sample.h"
-
-namespace Atomic
-{
-
-class Node;
-class Scene;
-
-}
-
-/// Physics stress test example.
-/// This sample demonstrates:
-///     - Physics and rendering performance with a high (1000) moving object count
-///     - Using triangle meshes for collision
-///     - Optimizing physics simulation by leaving out collision event signaling
-class PhysicsStressTest : public Sample
-{
-    OBJECT(PhysicsStressTest);
-
-public:
-    /// Construct.
-    PhysicsStressTest(Context* context);
-
-    /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
-
-protected:
-    /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
-        "<patch>"
-        "    <remove sel=\"/element/element[./attribute[@name='Name' and @value='Button0']]/attribute[@name='Is Visible']\" />"
-        "    <replace sel=\"/element/element[./attribute[@name='Name' and @value='Button0']]/element[./attribute[@name='Name' and @value='Label']]/attribute[@name='Text']/@value\">Spawn</replace>"
-        "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Button0']]\">"
-        "        <element type=\"Text\">"
-        "            <attribute name=\"Name\" value=\"MouseButtonBinding\" />"
-        "            <attribute name=\"Text\" value=\"LEFT\" />"
-        "        </element>"
-        "    </add>"
-        "    <remove sel=\"/element/element[./attribute[@name='Name' and @value='Button1']]/attribute[@name='Is Visible']\" />"
-        "    <replace sel=\"/element/element[./attribute[@name='Name' and @value='Button1']]/element[./attribute[@name='Name' and @value='Label']]/attribute[@name='Text']/@value\">Debug</replace>"
-        "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Button1']]\">"
-        "        <element type=\"Text\">"
-        "            <attribute name=\"Name\" value=\"KeyBinding\" />"
-        "            <attribute name=\"Text\" value=\"SPACE\" />"
-        "        </element>"
-        "    </add>"
-        "</patch>";
-    }
-
-private:
-    /// Construct the scene content.
-    void CreateScene();
-    /// Construct an instruction text to the UI.
-    void CreateInstructions();
-    /// Set up a viewport for displaying the scene.
-    void SetupViewport();
-    /// Subscribe to application-wide logic update and post-render update events.
-    void SubscribeToEvents();
-    /// Read input and moves the camera.
-    void MoveCamera(float timeStep);
-    /// Spawn a physics object from the camera position.
-    void SpawnObject();
-    /// Handle the logic update event.
-    void HandleUpdate(StringHash eventType, VariantMap& eventData);
-    /// Handle the post-render update event.
-    void HandlePostRenderUpdate(StringHash eventType, VariantMap& eventData);
-
-    /// Flag for drawing debug geometry.
-    bool drawDebug_;
-};

+ 0 - 33
Source/Samples/13_Ragdolls/CMakeLists.txt

@@ -1,33 +0,0 @@
-#
-# Copyright (c) 2008-2014 the Urho3D project.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-
-# Define target name
-set (TARGET_NAME 13_Ragdolls)
-
-# Define source files
-define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
-
-# Setup target with resource copying
-setup_main_executable ()
-
-# Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${ATOMIC_TEST_TIME_OUT})

+ 0 - 177
Source/Samples/13_Ragdolls/CreateRagdoll.cpp

@@ -1,177 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#include <Atomic/Atomic.h>
-
-#include <Atomic/Graphics/AnimatedModel.h>
-#include <Atomic/IO/Log.h>
-#include <Atomic/Scene/Node.h>
-#include <Atomic/Physics/RigidBody.h>
-#include <Atomic/Physics/PhysicsEvents.h>
-
-#include "CreateRagdoll.h"
-
-#include <Atomic/DebugNew.h>
-
-CreateRagdoll::CreateRagdoll(Context* context) :
-    Component(context)
-{
-}
-
-void CreateRagdoll::OnNodeSet(Node* node)
-{
-    // If the node pointer is non-null, this component has been created into a scene node. Subscribe to physics collisions that
-    // concern this scene node
-    if (node)
-        SubscribeToEvent(node, E_NODECOLLISION, HANDLER(CreateRagdoll, HandleNodeCollision));
-}
-
-void CreateRagdoll::HandleNodeCollision(StringHash eventType, VariantMap& eventData)
-{
-    using namespace NodeCollision;
-
-    // Get the other colliding body, make sure it is moving (has nonzero mass)
-    RigidBody* otherBody = static_cast<RigidBody*>(eventData[P_OTHERBODY].GetPtr());
-
-    if (otherBody->GetMass() > 0.0f)
-    {
-        // We do not need the physics components in the AnimatedModel's root scene node anymore
-        node_->RemoveComponent<RigidBody>();
-        node_->RemoveComponent<CollisionShape>();
-        
-        // Create RigidBody & CollisionShape components to bones
-        CreateRagdollBone("Bip01_Pelvis", SHAPE_BOX, Vector3(0.3f, 0.2f, 0.25f), Vector3(0.0f, 0.0f, 0.0f),
-            Quaternion(0.0f, 0.0f, 0.0f));
-        CreateRagdollBone("Bip01_Spine1", SHAPE_BOX, Vector3(0.35f, 0.2f, 0.3f), Vector3(0.15f, 0.0f, 0.0f),
-            Quaternion(0.0f, 0.0f, 0.0f));
-        CreateRagdollBone("Bip01_L_Thigh", SHAPE_CAPSULE, Vector3(0.175f, 0.45f, 0.175f), Vector3(0.25f, 0.0f, 0.0f),
-            Quaternion(0.0f, 0.0f, 90.0f));
-        CreateRagdollBone("Bip01_R_Thigh", SHAPE_CAPSULE, Vector3(0.175f, 0.45f, 0.175f), Vector3(0.25f, 0.0f, 0.0f),
-            Quaternion(0.0f, 0.0f, 90.0f));
-        CreateRagdollBone("Bip01_L_Calf", SHAPE_CAPSULE, Vector3(0.15f, 0.55f, 0.15f), Vector3(0.25f, 0.0f, 0.0f),
-            Quaternion(0.0f, 0.0f, 90.0f));
-        CreateRagdollBone("Bip01_R_Calf", SHAPE_CAPSULE, Vector3(0.15f, 0.55f, 0.15f), Vector3(0.25f, 0.0f, 0.0f),
-            Quaternion(0.0f, 0.0f, 90.0f));
-        CreateRagdollBone("Bip01_Head", SHAPE_BOX, Vector3(0.2f, 0.2f, 0.2f), Vector3(0.1f, 0.0f, 0.0f),
-            Quaternion(0.0f, 0.0f, 0.0f));
-        CreateRagdollBone("Bip01_L_UpperArm", SHAPE_CAPSULE, Vector3(0.15f, 0.35f, 0.15f), Vector3(0.1f, 0.0f, 0.0f),
-            Quaternion(0.0f, 0.0f, 90.0f));
-        CreateRagdollBone("Bip01_R_UpperArm", SHAPE_CAPSULE, Vector3(0.15f, 0.35f, 0.15f), Vector3(0.1f, 0.0f, 0.0f),
-            Quaternion(0.0f, 0.0f, 90.0f));
-        CreateRagdollBone("Bip01_L_Forearm", SHAPE_CAPSULE, Vector3(0.125f, 0.4f, 0.125f), Vector3(0.2f, 0.0f, 0.0f),
-            Quaternion(0.0f, 0.0f, 90.0f));
-        CreateRagdollBone("Bip01_R_Forearm", SHAPE_CAPSULE, Vector3(0.125f, 0.4f, 0.125f), Vector3(0.2f, 0.0f, 0.0f),
-            Quaternion(0.0f, 0.0f, 90.0f));
-        
-        // Create Constraints between bones
-        CreateRagdollConstraint("Bip01_L_Thigh", "Bip01_Pelvis", CONSTRAINT_CONETWIST, Vector3::BACK, Vector3::FORWARD,
-            Vector2(45.0f, 45.0f), Vector2::ZERO);
-        CreateRagdollConstraint("Bip01_R_Thigh", "Bip01_Pelvis", CONSTRAINT_CONETWIST, Vector3::BACK, Vector3::FORWARD,
-            Vector2(45.0f, 45.0f), Vector2::ZERO);
-        CreateRagdollConstraint("Bip01_L_Calf", "Bip01_L_Thigh", CONSTRAINT_HINGE, Vector3::BACK, Vector3::BACK,
-            Vector2(90.0f, 0.0f), Vector2::ZERO);
-        CreateRagdollConstraint("Bip01_R_Calf", "Bip01_R_Thigh", CONSTRAINT_HINGE, Vector3::BACK, Vector3::BACK,
-            Vector2(90.0f, 0.0f), Vector2::ZERO);
-        CreateRagdollConstraint("Bip01_Spine1", "Bip01_Pelvis", CONSTRAINT_HINGE, Vector3::FORWARD, Vector3::FORWARD,
-            Vector2(45.0f, 0.0f), Vector2(-10.0f, 0.0f));
-        CreateRagdollConstraint("Bip01_Head", "Bip01_Spine1", CONSTRAINT_CONETWIST, Vector3::LEFT, Vector3::LEFT,
-            Vector2(0.0f, 30.0f), Vector2::ZERO);
-        CreateRagdollConstraint("Bip01_L_UpperArm", "Bip01_Spine1", CONSTRAINT_CONETWIST, Vector3::DOWN, Vector3::UP,
-            Vector2(45.0f, 45.0f), Vector2::ZERO, false);
-        CreateRagdollConstraint("Bip01_R_UpperArm", "Bip01_Spine1", CONSTRAINT_CONETWIST, Vector3::DOWN, Vector3::UP,
-            Vector2(45.0f, 45.0f), Vector2::ZERO, false);
-        CreateRagdollConstraint("Bip01_L_Forearm", "Bip01_L_UpperArm", CONSTRAINT_HINGE, Vector3::BACK, Vector3::BACK,
-            Vector2(90.0f, 0.0f), Vector2::ZERO);
-        CreateRagdollConstraint("Bip01_R_Forearm", "Bip01_R_UpperArm", CONSTRAINT_HINGE, Vector3::BACK, Vector3::BACK,
-            Vector2(90.0f, 0.0f), Vector2::ZERO);
-        
-        // Disable keyframe animation from all bones so that they will not interfere with the ragdoll
-        AnimatedModel* model = GetComponent<AnimatedModel>();
-        Skeleton& skeleton = model->GetSkeleton();
-        for (unsigned i = 0; i < skeleton.GetNumBones(); ++i)
-            skeleton.GetBone(i)->animated_ = false;
-        
-        // Finally remove self from the scene node. Note that this must be the last operation performed in the function
-        Remove();
-    }
-}
-
-void CreateRagdoll::CreateRagdollBone(const String& boneName, ShapeType type, const Vector3& size, const Vector3& position,
-    const Quaternion& rotation)
-{
-    // Find the correct child scene node recursively
-    Node* boneNode = node_->GetChild(boneName, true);
-    if (!boneNode)
-    {
-        LOGWARNING("Could not find bone " + boneName + " for creating ragdoll physics components");
-        return;
-    }
-    
-    RigidBody* body = boneNode->CreateComponent<RigidBody>();
-    // Set mass to make movable
-    body->SetMass(1.0f);
-    // Set damping parameters to smooth out the motion
-    body->SetLinearDamping(0.05f);
-    body->SetAngularDamping(0.85f);
-    // Set rest thresholds to ensure the ragdoll rigid bodies come to rest to not consume CPU endlessly
-    body->SetLinearRestThreshold(1.5f);
-    body->SetAngularRestThreshold(2.5f);
-
-    CollisionShape* shape = boneNode->CreateComponent<CollisionShape>();
-    // We use either a box or a capsule shape for all of the bones
-    if (type == SHAPE_BOX)
-        shape->SetBox(size, position, rotation);
-    else
-        shape->SetCapsule(size.x_, size.y_, position, rotation);
-}
-
-void CreateRagdoll::CreateRagdollConstraint(const String& boneName, const String& parentName, ConstraintType type,
-    const Vector3& axis, const Vector3& parentAxis, const Vector2& highLimit, const Vector2& lowLimit,
-    bool disableCollision)
-{
-    Node* boneNode = node_->GetChild(boneName, true);
-    Node* parentNode = node_->GetChild(parentName, true);
-    if (!boneNode)
-    {
-        LOGWARNING("Could not find bone " + boneName + " for creating ragdoll constraint");
-        return;
-    }
-    if (!parentNode)
-    {
-        LOGWARNING("Could not find bone " + parentName + " for creating ragdoll constraint");
-        return;
-    }
-    
-    Constraint* constraint = boneNode->CreateComponent<Constraint>();
-    constraint->SetConstraintType(type);
-    // Most of the constraints in the ragdoll will work better when the connected bodies don't collide against each other
-    constraint->SetDisableCollision(disableCollision);
-    // The connected body must be specified before setting the world position
-    constraint->SetOtherBody(parentNode->GetComponent<RigidBody>());
-    // Position the constraint at the child bone we are connecting
-    constraint->SetWorldPosition(boneNode->GetWorldPosition());
-    // Configure axes and limits
-    constraint->SetAxis(axis);
-    constraint->SetOtherAxis(parentAxis);
-    constraint->SetHighLimit(highLimit);
-    constraint->SetLowLimit(lowLimit);
-}

+ 0 - 50
Source/Samples/13_Ragdolls/CreateRagdoll.h

@@ -1,50 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#pragma once
-
-#include <Atomic/Physics/CollisionShape.h>
-#include <Atomic/Physics/Constraint.h>
-
-using namespace Atomic;
-
-/// Custom component that creates a ragdoll upon collision.
-class CreateRagdoll : public Component
-{
-    OBJECT(CreateRagdoll);
-    
-public:
-    /// Construct.
-    CreateRagdoll(Context* context);
-    
-protected:
-    /// Handle node being assigned.
-    virtual void OnNodeSet(Node* node);
-    
-private:
-    /// Handle scene node's physics collision.
-    void HandleNodeCollision(StringHash eventType, VariantMap& eventData);
-    /// Make a bone physical by adding RigidBody and CollisionShape components.
-    void CreateRagdollBone(const String& boneName, ShapeType type, const Vector3& size, const Vector3& position, const Quaternion& rotation);
-    /// Join two bones with a Constraint component.
-    void CreateRagdollConstraint(const String& boneName, const String& parentName, ConstraintType type, const Vector3& axis, const Vector3& parentAxis, const Vector2& highLimit, const Vector2& lowLimit, bool disableCollision = true);
-};

+ 0 - 314
Source/Samples/13_Ragdolls/Ragdolls.cpp

@@ -1,314 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#include <Atomic/Atomic.h>
-
-#include <Atomic/Graphics/AnimatedModel.h>
-#include <Atomic/Graphics/Camera.h>
-#include <Atomic/Physics/CollisionShape.h>
-#include <Atomic/Core/CoreEvents.h>
-#include <Atomic/Graphics/DebugRenderer.h>
-#include <Atomic/Engine/Engine.h>
-#include <Atomic/IO/File.h>
-#include <Atomic/IO/FileSystem.h>
-#include <Atomic/UI/Font.h>
-#include <Atomic/Graphics/Graphics.h>
-#include <Atomic/Input/Input.h>
-#include <Atomic/Graphics/Light.h>
-#include <Atomic/Graphics/Material.h>
-#include <Atomic/Graphics/Model.h>
-#include <Atomic/Graphics/Octree.h>
-#include <Atomic/Physics/PhysicsWorld.h>
-#include <Atomic/Graphics/Renderer.h>
-#include <Atomic/Resource/ResourceCache.h>
-#include <Atomic/Physics/RigidBody.h>
-#include <Atomic/Scene/Scene.h>
-#include <Atomic/UI/Text.h>
-#include <Atomic/UI/UI.h>
-#include <Atomic/Graphics/Zone.h>
-
-#include "CreateRagdoll.h"
-#include "Ragdolls.h"
-
-#include <Atomic/DebugNew.h>
-
-DEFINE_APPLICATION_MAIN(Ragdolls)
-
-Ragdolls::Ragdolls(Context* context) :
-    Sample(context),
-    drawDebug_(false)
-{
-    // Register an object factory for our custom CreateRagdoll component so that we can create them to scene nodes
-    context->RegisterFactory<CreateRagdoll>();
-}
-
-void Ragdolls::Start()
-{
-    // Execute base class startup
-    Sample::Start();
-
-    // Create the scene content
-    CreateScene();
-    
-    // Create the UI content
-    CreateInstructions();
-    
-    // Setup the viewport for displaying the scene
-    SetupViewport();
-
-    // Hook up to the frame update and render post-update events
-    SubscribeToEvents();
-}
-
-void Ragdolls::CreateScene()
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    
-    scene_ = new Scene(context_);
-    
-    // Create octree, use default volume (-1000, -1000, -1000) to (1000, 1000, 1000)
-    // Create a physics simulation world with default parameters, which will update at 60fps. Like the Octree must
-    // exist before creating drawable components, the PhysicsWorld must exist before creating physics components.
-    // Finally, create a DebugRenderer component so that we can draw physics debug geometry
-    scene_->CreateComponent<Octree>();
-    scene_->CreateComponent<PhysicsWorld>();
-    scene_->CreateComponent<DebugRenderer>();
-    
-    // Create a Zone component for ambient lighting & fog control
-    Node* zoneNode = scene_->CreateChild("Zone");
-    Zone* zone = zoneNode->CreateComponent<Zone>();
-    zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
-    zone->SetAmbientColor(Color(0.15f, 0.15f, 0.15f));
-    zone->SetFogColor(Color(0.5f, 0.5f, 0.7f));
-    zone->SetFogStart(100.0f);
-    zone->SetFogEnd(300.0f);
-    
-    // Create a directional light to the world. Enable cascaded shadows on it
-    Node* lightNode = scene_->CreateChild("DirectionalLight");
-    lightNode->SetDirection(Vector3(0.6f, -1.0f, 0.8f));
-    Light* light = lightNode->CreateComponent<Light>();
-    light->SetLightType(LIGHT_DIRECTIONAL);
-    light->SetCastShadows(true);
-    light->SetShadowBias(BiasParameters(0.00025f, 0.5f));
-    // Set cascade splits at 10, 50 and 200 world units, fade shadows out at 80% of maximum shadow distance
-    light->SetShadowCascade(CascadeParameters(10.0f, 50.0f, 200.0f, 0.0f, 0.8f));
-    
-    {
-        // Create a floor object, 500 x 500 world units. Adjust position so that the ground is at zero Y
-        Node* floorNode = scene_->CreateChild("Floor");
-        floorNode->SetPosition(Vector3(0.0f, -0.5f, 0.0f));
-        floorNode->SetScale(Vector3(500.0f, 1.0f, 500.0f));
-        StaticModel* floorObject = floorNode->CreateComponent<StaticModel>();
-        floorObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
-        floorObject->SetMaterial(cache->GetResource<Material>("Materials/StoneTiled.xml"));
-        
-        // Make the floor physical by adding RigidBody and CollisionShape components
-        RigidBody* body = floorNode->CreateComponent<RigidBody>();
-        // We will be spawning spherical objects in this sample. The ground also needs non-zero rolling friction so that
-        // the spheres will eventually come to rest
-        body->SetRollingFriction(0.15f);
-        CollisionShape* shape = floorNode->CreateComponent<CollisionShape>();
-        // Set a box shape of size 1 x 1 x 1 for collision. The shape will be scaled with the scene node scale, so the
-        // rendering and physics representation sizes should match (the box model is also 1 x 1 x 1.)
-        shape->SetBox(Vector3::ONE);
-    }
-    
-    // Create animated models
-    for (int z = -1; z <= 1; ++z)
-    {
-        for (int x = -4; x <= 4; ++x)
-        {
-            Node* modelNode = scene_->CreateChild("Jack");
-            modelNode->SetPosition(Vector3(x * 5.0f, 0.0f, z * 5.0f));
-            modelNode->SetRotation(Quaternion(0.0f, 180.0f, 0.0f));
-            AnimatedModel* modelObject = modelNode->CreateComponent<AnimatedModel>();
-            modelObject->SetModel(cache->GetResource<Model>("Models/Jack.mdl"));
-            modelObject->SetMaterial(cache->GetResource<Material>("Materials/Jack.xml"));
-            modelObject->SetCastShadows(true);
-            // Set the model to also update when invisible to avoid staying invisible when the model should come into
-            // view, but does not as the bounding box is not updated
-            modelObject->SetUpdateInvisible(true);
-            
-            // Create a rigid body and a collision shape. These will act as a trigger for transforming the
-            // model into a ragdoll when hit by a moving object
-            RigidBody* body = modelNode->CreateComponent<RigidBody>();
-            // The Trigger mode makes the rigid body only detect collisions, but impart no forces on the
-            // colliding objects
-            body->SetTrigger(true);
-            CollisionShape* shape = modelNode->CreateComponent<CollisionShape>();
-            // Create the capsule shape with an offset so that it is correctly aligned with the model, which
-            // has its origin at the feet
-            shape->SetCapsule(0.7f, 2.0f, Vector3(0.0f, 1.0f, 0.0f));
-            
-            // Create a custom component that reacts to collisions and creates the ragdoll
-            modelNode->CreateComponent<CreateRagdoll>();
-        }
-    }
-    
-    // Create the camera. Limit far clip distance to match the fog. Note: now we actually create the camera node outside
-    // the scene, because we want it to be unaffected by scene load / save
-    cameraNode_ = new Node(context_);
-    Camera* camera = cameraNode_->CreateComponent<Camera>();
-    camera->SetFarClip(300.0f);
-    
-    // Set an initial position for the camera scene node above the floor
-    cameraNode_->SetPosition(Vector3(0.0f, 3.0f, -20.0f));
-}
-
-void Ragdolls::CreateInstructions()
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    UI* ui = GetSubsystem<UI>();
-    
-    // Construct new Text object, set string to display and font to use
-    Text* instructionText = ui->GetRoot()->CreateChild<Text>();
-    instructionText->SetText(
-        "Use WASD keys and mouse/touch to move\n"
-        "LMB to spawn physics objects\n"
-        "F5 to save scene, F7 to load\n"
-        "Space to toggle physics debug geometry"
-    );
-    instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
-    // The text has multiple rows. Center them in relation to each other
-    instructionText->SetTextAlignment(HA_CENTER);
-    
-    // Position the text relative to the screen center
-    instructionText->SetHorizontalAlignment(HA_CENTER);
-    instructionText->SetVerticalAlignment(VA_CENTER);
-    instructionText->SetPosition(0, ui->GetRoot()->GetHeight() / 4);
-}
-
-void Ragdolls::SetupViewport()
-{
-    Renderer* renderer = GetSubsystem<Renderer>();
-    
-    // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
-    SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
-    renderer->SetViewport(0, viewport);
-}
-
-void Ragdolls::MoveCamera(float timeStep)
-{
-    // Do not move if the UI has a focused element (the console)
-    if (GetSubsystem<UI>()->GetFocusElement())
-        return;
-    
-    Input* input = GetSubsystem<Input>();
-    
-    // Movement speed as world units per second
-    const float MOVE_SPEED = 20.0f;
-    // Mouse sensitivity as degrees per pixel
-    const float MOUSE_SENSITIVITY = 0.1f;
-    
-    // Use this frame's mouse motion to adjust camera node yaw and pitch. Clamp the pitch between -90 and 90 degrees
-    IntVector2 mouseMove = input->GetMouseMove();
-    yaw_ += MOUSE_SENSITIVITY * mouseMove.x_;
-    pitch_ += MOUSE_SENSITIVITY * mouseMove.y_;
-    pitch_ = Clamp(pitch_, -90.0f, 90.0f);
-    
-    // Construct new orientation for the camera scene node from yaw and pitch. Roll is fixed to zero
-    cameraNode_->SetRotation(Quaternion(pitch_, yaw_, 0.0f));
-    
-    // Read WASD keys and move the camera scene node to the corresponding direction if they are pressed
-    if (input->GetKeyDown('W'))
-        cameraNode_->Translate(Vector3::FORWARD * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('S'))
-        cameraNode_->Translate(Vector3::BACK * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('A'))
-        cameraNode_->Translate(Vector3::LEFT * MOVE_SPEED * timeStep);
-    if (input->GetKeyDown('D'))
-        cameraNode_->Translate(Vector3::RIGHT * MOVE_SPEED * timeStep);
-    
-    // "Shoot" a physics object with left mousebutton
-    if (input->GetMouseButtonPress(MOUSEB_LEFT))
-        SpawnObject();
-    
-    // Check for loading / saving the scene
-    if (input->GetKeyPress(KEY_F5))
-    {
-        File saveFile(context_, GetSubsystem<FileSystem>()->GetProgramDir() + "Data/Scenes/Ragdolls.xml", FILE_WRITE);
-        scene_->SaveXML(saveFile);
-    }
-    if (input->GetKeyPress(KEY_F7))
-    {
-        File loadFile(context_, GetSubsystem<FileSystem>()->GetProgramDir() + "Data/Scenes/Ragdolls.xml", FILE_READ);
-        scene_->LoadXML(loadFile);
-    }
-
-    // Toggle physics debug geometry with space
-    if (input->GetKeyPress(KEY_SPACE))
-        drawDebug_ = !drawDebug_;
-}
-
-void Ragdolls::SpawnObject()
-{
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    
-    Node* boxNode = scene_->CreateChild("Sphere");
-    boxNode->SetPosition(cameraNode_->GetPosition());
-    boxNode->SetRotation(cameraNode_->GetRotation());
-    boxNode->SetScale(0.25f);
-    StaticModel* boxObject = boxNode->CreateComponent<StaticModel>();
-    boxObject->SetModel(cache->GetResource<Model>("Models/Sphere.mdl"));
-    boxObject->SetMaterial(cache->GetResource<Material>("Materials/StoneSmall.xml"));
-    boxObject->SetCastShadows(true);
-    
-    RigidBody* body = boxNode->CreateComponent<RigidBody>();
-    body->SetMass(1.0f);
-    body->SetRollingFriction(0.15f);
-    CollisionShape* shape = boxNode->CreateComponent<CollisionShape>();
-    shape->SetSphere(1.0f);
-    
-    const float OBJECT_VELOCITY = 10.0f;
-    
-    // Set initial velocity for the RigidBody based on camera forward vector. Add also a slight up component
-    // to overcome gravity better
-    body->SetLinearVelocity(cameraNode_->GetRotation() * Vector3(0.0f, 0.25f, 1.0f) * OBJECT_VELOCITY);
-}
-
-void Ragdolls::SubscribeToEvents()
-{
-    // Subscribe HandleUpdate() function for processing update events
-    SubscribeToEvent(E_UPDATE, HANDLER(Ragdolls, HandleUpdate));
-    
-    // Subscribe HandlePostRenderUpdate() function for processing the post-render update event, during which we request
-    // debug geometry
-    SubscribeToEvent(E_POSTRENDERUPDATE, HANDLER(Ragdolls, HandlePostRenderUpdate));
-}
-
-void Ragdolls::HandleUpdate(StringHash eventType, VariantMap& eventData)
-{
-    using namespace Update;
-
-    // Take the frame time step, which is stored as a float
-    float timeStep = eventData[P_TIMESTEP].GetFloat();
-    
-    // Move the camera, scale movement with time step
-    MoveCamera(timeStep);
-}
-
-void Ragdolls::HandlePostRenderUpdate(StringHash eventType, VariantMap& eventData)
-{
-    // If draw debug mode is enabled, draw physics debug geometry. Use depth test to make the result easier to interpret
-    if (drawDebug_)
-        scene_->GetComponent<PhysicsWorld>()->DrawDebugGeometry(true);
-}

+ 0 - 94
Source/Samples/13_Ragdolls/Ragdolls.h

@@ -1,94 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#pragma once
-
-#include "Sample.h"
-
-namespace Atomic
-{
-
-class Node;
-class Scene;
-
-}
-
-/// Ragdoll example.
-/// This sample demonstrates:
-///     - Detecting physics collisions
-///     - Moving an AnimatedModel's bones with physics and connecting them with constraints
-///     - Using rolling friction to stop rolling objects from moving infinitely
-class Ragdolls : public Sample
-{
-    OBJECT(Ragdolls);
-
-public:
-    /// Construct.
-    Ragdolls(Context* context);
-
-    /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
-
-protected:
-    /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
-        "<patch>"
-        "    <remove sel=\"/element/element[./attribute[@name='Name' and @value='Button0']]/attribute[@name='Is Visible']\" />"
-        "    <replace sel=\"/element/element[./attribute[@name='Name' and @value='Button0']]/element[./attribute[@name='Name' and @value='Label']]/attribute[@name='Text']/@value\">Spawn</replace>"
-        "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Button0']]\">"
-        "        <element type=\"Text\">"
-        "            <attribute name=\"Name\" value=\"MouseButtonBinding\" />"
-        "            <attribute name=\"Text\" value=\"LEFT\" />"
-        "        </element>"
-        "    </add>"
-        "    <remove sel=\"/element/element[./attribute[@name='Name' and @value='Button1']]/attribute[@name='Is Visible']\" />"
-        "    <replace sel=\"/element/element[./attribute[@name='Name' and @value='Button1']]/element[./attribute[@name='Name' and @value='Label']]/attribute[@name='Text']/@value\">Debug</replace>"
-        "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Button1']]\">"
-        "        <element type=\"Text\">"
-        "            <attribute name=\"Name\" value=\"KeyBinding\" />"
-        "            <attribute name=\"Text\" value=\"SPACE\" />"
-        "        </element>"
-        "    </add>"
-        "</patch>";
-    }
-
-private:
-    /// Construct the scene content.
-    void CreateScene();
-    /// Construct an instruction text to the UI.
-    void CreateInstructions();
-    /// Set up a viewport for displaying the scene.
-    void SetupViewport();
-    /// Subscribe to application-wide logic update and post-render update events.
-    void SubscribeToEvents();
-    /// Read input and moves the camera.
-    void MoveCamera(float timeStep);
-    /// Spawn a physics object from the camera position.
-    void SpawnObject();
-    /// Handle the logic update event.
-    void HandleUpdate(StringHash eventType, VariantMap& eventData);
-    /// Handle the post-render update event.
-    void HandlePostRenderUpdate(StringHash eventType, VariantMap& eventData);
-
-    /// Flag for drawing debug geometry.
-    bool drawDebug_;
-};

+ 0 - 33
Source/Samples/14_SoundEffects/CMakeLists.txt

@@ -1,33 +0,0 @@
-#
-# Copyright (c) 2008-2014 the Urho3D project.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#
-
-# Define target name
-set (TARGET_NAME 14_SoundEffects)
-
-# Define source files
-define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
-
-# Setup target with resource copying
-setup_main_executable ()
-
-# Setup test cases
-add_test (NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} -timeout ${ATOMIC_TEST_TIME_OUT})

+ 0 - 223
Source/Samples/14_SoundEffects/SoundEffects.cpp

@@ -1,223 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#include <Atomic/Atomic.h>
-
-#include <Atomic/Audio/Audio.h>
-#include <Atomic/UI/Button.h>
-#include <Atomic/Engine/Engine.h>
-#include <Atomic/UI/Font.h>
-#include <Atomic/Input/Input.h>
-#include <Atomic/IO/Log.h>
-#include <Atomic/Resource/ResourceCache.h>
-#include <Atomic/Scene/Scene.h>
-#include <Atomic/UI/Slider.h>
-#include <Atomic/Audio/Sound.h>
-#include <Atomic/Audio/SoundSource.h>
-#include <Atomic/UI/Text.h>
-#include <Atomic/UI/UI.h>
-#include <Atomic/UI/UIEvents.h>
-
-#include "SoundEffects.h"
-
-#include <Atomic/DebugNew.h>
-
-// Custom variable identifier for storing sound effect name within the UI element
-static const StringHash VAR_SOUNDRESOURCE("SoundResource");
-static const unsigned NUM_SOUNDS = 3;
-
-static String soundNames[] = {
-    "Fist",
-    "Explosion",
-    "Power-up"
-};
-
-static String soundResourceNames[] = {
-    "Sounds/PlayerFistHit.wav",
-    "Sounds/BigExplosion.wav",
-    "Sounds/Powerup.wav"
-};
-
-DEFINE_APPLICATION_MAIN(SoundEffects)
-
-SoundEffects::SoundEffects(Context* context) :
-    Sample(context)
-{
-}
-
-void SoundEffects::Start()
-{
-    // Execute base class startup
-    Sample::Start();
-
-    // Enable OS cursor
-    GetSubsystem<Input>()->SetMouseVisible(true);
-
-    // Create the user interface
-    CreateUI();
-}
-
-void SoundEffects::CreateUI()
-{
-    // Create a scene which will not be actually rendered, but is used to hold SoundSource components while they play sounds
-    scene_ = new Scene(context_);
-    
-    UIElement* root = GetSubsystem<UI>()->GetRoot();
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    XMLFile* uiStyle = cache->GetResource<XMLFile>("UI/DefaultStyle.xml");
-    // Set style to the UI root so that elements will inherit it
-    root->SetDefaultStyle(uiStyle);
-    
-    // Create buttons for playing back sounds
-    for (unsigned i = 0; i < NUM_SOUNDS; ++i)
-    {
-        Button* button = CreateButton(i * 140 + 20, 20, 120, 40, soundNames[i]);
-        // Store the sound effect resource name as a custom variable into the button
-        button->SetVar(VAR_SOUNDRESOURCE, soundResourceNames[i]);
-        SubscribeToEvent(button, E_PRESSED, HANDLER(SoundEffects, HandlePlaySound));
-    }
-    
-    // Create buttons for playing/stopping music
-    Button* button = CreateButton(20, 80, 120, 40, "Play Music");
-    SubscribeToEvent(button, E_RELEASED, HANDLER(SoundEffects, HandlePlayMusic));
-    
-    button = CreateButton(160, 80, 120, 40, "Stop Music");
-    SubscribeToEvent(button, E_RELEASED, HANDLER(SoundEffects, HandleStopMusic));
-    
-    Audio* audio = GetSubsystem<Audio>();
-    
-    // Create sliders for controlling sound and music master volume
-    Slider* slider = CreateSlider(20, 140, 200, 20, "Sound Volume");
-    slider->SetValue(audio->GetMasterGain(SOUND_EFFECT));
-    SubscribeToEvent(slider, E_SLIDERCHANGED, HANDLER(SoundEffects, HandleSoundVolume));
-    
-    slider = CreateSlider(20, 200, 200, 20, "Music Volume");
-    slider->SetValue(audio->GetMasterGain(SOUND_MUSIC));
-    SubscribeToEvent(slider, E_SLIDERCHANGED, HANDLER(SoundEffects, HandleMusicVolume));
-}
-
-Button* SoundEffects::CreateButton(int x, int y, int xSize, int ySize, const String& text)
-{
-    UIElement* root = GetSubsystem<UI>()->GetRoot();
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    Font* font = cache->GetResource<Font>("Fonts/Anonymous Pro.ttf");
-    
-    // Create the button and center the text onto it
-    Button* button = root->CreateChild<Button>();
-    button->SetStyleAuto();
-    button->SetPosition(x, y);
-    button->SetSize(xSize, ySize);
-    
-    Text* buttonText = button->CreateChild<Text>();
-    buttonText->SetAlignment(HA_CENTER, VA_CENTER);
-    buttonText->SetFont(font, 12);
-    buttonText->SetText(text);
-    
-    return button;
-}
-
-Slider* SoundEffects::CreateSlider(int x, int y, int xSize, int ySize, const String& text)
-{
-    UIElement* root = GetSubsystem<UI>()->GetRoot();
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    Font* font = cache->GetResource<Font>("Fonts/Anonymous Pro.ttf");
-    
-    // Create text and slider below it
-    Text* sliderText = root->CreateChild<Text>();
-    sliderText->SetPosition(x, y);
-    sliderText->SetFont(font, 12);
-    sliderText->SetText(text);
-    
-    Slider* slider = root->CreateChild<Slider>();
-    slider->SetStyleAuto();
-    slider->SetPosition(x, y + 20);
-    slider->SetSize(xSize, ySize);
-    // Use 0-1 range for controlling sound/music master volume
-    slider->SetRange(1.0f);
-    
-    return slider;
-}
-
-void SoundEffects::HandlePlaySound(StringHash eventType, VariantMap& eventData)
-{
-    Button* button = static_cast<Button*>(GetEventSender());
-    const String& soundResourceName = button->GetVar(VAR_SOUNDRESOURCE).GetString();
-    
-    // Get the sound resource
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    Sound* sound = cache->GetResource<Sound>(soundResourceName);
-    
-    if (sound)
-    {
-        // Create a scene node with a SoundSource component for playing the sound. The SoundSource component plays
-        // non-positional audio, so its 3D position in the scene does not matter. For positional sounds the
-        // SoundSource3D component would be used instead
-        Node* soundNode = scene_->CreateChild("Sound");
-        SoundSource* soundSource = soundNode->CreateComponent<SoundSource>();
-        soundSource->Play(sound);
-        // In case we also play music, set the sound volume below maximum so that we don't clip the output
-        soundSource->SetGain(0.75f);
-        // Set the sound component to automatically remove its scene node from the scene when the sound is done playing
-        soundSource->SetAutoRemove(true);
-    }
-}
-
-void SoundEffects::HandlePlayMusic(StringHash eventType, VariantMap& eventData)
-{
-    // Check if the music player node/component already exist
-    if (scene_->GetChild("Music"))
-        return;
-    
-    ResourceCache* cache = GetSubsystem<ResourceCache>();
-    Sound* music = cache->GetResource<Sound>("Music/Ninja Gods.ogg");
-    // Set the song to loop
-    music->SetLooped(true);
-    
-    // Create a scene node and a sound source for the music
-    Node* musicNode = scene_->CreateChild("Music");
-    SoundSource* musicSource = musicNode->CreateComponent<SoundSource>();
-    // Set the sound type to music so that master volume control works correctly
-    musicSource->SetSoundType(SOUND_MUSIC);
-    musicSource->Play(music);
-}
-
-void SoundEffects::HandleStopMusic(StringHash eventType, VariantMap& eventData)
-{
-    // Remove the music player node from the scene
-    scene_->RemoveChild(scene_->GetChild("Music"));
-}
-
-void SoundEffects::HandleSoundVolume(StringHash eventType, VariantMap& eventData)
-{
-    using namespace SliderChanged;
-    
-    float newVolume = eventData[P_VALUE].GetFloat();
-    GetSubsystem<Audio>()->SetMasterGain(SOUND_EFFECT, newVolume);
-}
-
-void SoundEffects::HandleMusicVolume(StringHash eventType, VariantMap& eventData)
-{
-    using namespace SliderChanged;
-    
-    float newVolume = eventData[P_VALUE].GetFloat();
-    GetSubsystem<Audio>()->SetMasterGain(SOUND_MUSIC, newVolume);
-}

+ 0 - 83
Source/Samples/14_SoundEffects/SoundEffects.h

@@ -1,83 +0,0 @@
-//
-// Copyright (c) 2008-2014 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#pragma once
-
-#include "Sample.h"
-
-namespace Atomic
-{
-
-class Button;
-class Scene;
-class Slider;
-
-}
-
-/// Sound effects example
-/// This sample demonstrates:
-///     - Playing sound effects and music
-///     - Controlling sound and music master volume
-class SoundEffects : public Sample
-{
-    OBJECT(SoundEffects);
-
-public:
-    /// Construct.
-    SoundEffects(Context* context);
-
-    /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
-
-protected:
-    /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
-        "<patch>"
-        "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Button2']]\">"
-        "        <attribute name=\"Is Visible\" value=\"false\" />"
-        "    </add>"
-        "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Hat0']]\">"
-        "        <attribute name=\"Is Visible\" value=\"false\" />"
-        "    </add>"
-        "</patch>";
-    }
-
-private:
-    /// Create the UI and subscribes to UI events.
-    void CreateUI();
-    /// Create a button at position with specified text in it.
-    Button* CreateButton(int x, int y, int xSize, int ySize, const String& text);
-    /// Create a horizontal slider with specified text above it.
-    Slider* CreateSlider(int x, int y, int xSize, int ySize, const String& text);
-    /// Handle a sound effect button click.
-    void HandlePlaySound(StringHash eventType, VariantMap& eventData);
-    /// Handle "play music" button click.
-    void HandlePlayMusic(StringHash eventType, VariantMap& eventData);
-    /// Handle "stop music" button click.
-    void HandleStopMusic(StringHash eventType, VariantMap& eventData);
-    /// Handle sound effects volume slider change.
-    void HandleSoundVolume(StringHash eventType, VariantMap& eventData);
-    /// Handle music volume slider change.
-    void HandleMusicVolume(StringHash eventType, VariantMap& eventData);
-};
-
-

Some files were not shown because too many files changed in this diff