ソースを参照

Merge pull request #6 from urho3d/master

sync with official repo
SuperWangKai 8 年 前
コミット
a5ede8b327
100 ファイル変更4342 行追加759 行削除
  1. 5 5
      .appveyor.yml
  2. 0 2
      .bash_helpers.sh
  3. 162 103
      .travis.yml
  4. 8 2
      Android/src/org/libsdl/app/SDLActivity.java
  5. 1 1
      CMake/Modules/CheckHost.cmake
  6. 38 61
      CMake/Modules/GenerateExportHeader.cmake
  7. 112 79
      CMake/Modules/UrhoCommon.cmake
  8. 5 4
      CMake/Modules/exportheader.cmake.in
  9. 2 0
      CMakeLists.txt
  10. 135 81
      Docs/AngelScriptAPI.h
  11. 1 1
      Docs/Doxyfile.in
  12. 3 0
      Docs/GettingStarted.dox
  13. 108 40
      Docs/LuaScriptAPI.dox
  14. 325 8
      Docs/Reference.dox
  15. 143 81
      Docs/ScriptAPI.dox
  16. 269 2
      Docs/Urho3D.dox
  17. 5 1
      README.md
  18. 5 3
      Rakefile
  19. 8 0
      Source/CMakeLists.txt
  20. 2 0
      Source/Clang-Tools/CMakeLists.txt
  21. 2 2
      Source/Samples/01_HelloWorld/HelloWorld.h
  22. 2 2
      Source/Samples/02_HelloGUI/HelloGUI.h
  23. 2 2
      Source/Samples/03_Sprites/Sprites.h
  24. 1 1
      Source/Samples/04_StaticScene/StaticScene.h
  25. 1 1
      Source/Samples/05_AnimatingScene/AnimatingScene.h
  26. 1 1
      Source/Samples/05_AnimatingScene/Rotator.h
  27. 1 1
      Source/Samples/06_SkeletalAnimation/Mover.h
  28. 2 2
      Source/Samples/06_SkeletalAnimation/SkeletalAnimation.h
  29. 2 2
      Source/Samples/07_Billboards/Billboards.h
  30. 1 1
      Source/Samples/08_Decals/Decals.cpp
  31. 2 2
      Source/Samples/08_Decals/Decals.h
  32. 2 2
      Source/Samples/09_MultipleViewports/MultipleViewports.h
  33. 1 1
      Source/Samples/10_RenderToTexture/RenderToTexture.h
  34. 1 1
      Source/Samples/10_RenderToTexture/Rotator.h
  35. 2 2
      Source/Samples/11_Physics/Physics.h
  36. 2 2
      Source/Samples/12_PhysicsStressTest/PhysicsStressTest.h
  37. 1 1
      Source/Samples/13_Ragdolls/CreateRagdoll.h
  38. 2 2
      Source/Samples/13_Ragdolls/Ragdolls.h
  39. 1 1
      Source/Samples/14_SoundEffects/SoundEffects.cpp
  40. 3 3
      Source/Samples/14_SoundEffects/SoundEffects.h
  41. 81 3
      Source/Samples/15_Navigation/Navigation.cpp
  42. 16 2
      Source/Samples/15_Navigation/Navigation.h
  43. 2 2
      Source/Samples/16_Chat/Chat.cpp
  44. 2 2
      Source/Samples/16_Chat/Chat.h
  45. 2 2
      Source/Samples/17_SceneReplication/SceneReplication.h
  46. 2 2
      Source/Samples/18_CharacterDemo/Character.h
  47. 3 3
      Source/Samples/18_CharacterDemo/CharacterDemo.h
  48. 2 2
      Source/Samples/19_VehicleDemo/Vehicle.h
  49. 1 1
      Source/Samples/19_VehicleDemo/VehicleDemo.h
  50. 1 1
      Source/Samples/20_HugeObjectCount/HugeObjectCount.cpp
  51. 2 2
      Source/Samples/20_HugeObjectCount/HugeObjectCount.h
  52. 1 1
      Source/Samples/21_AngelScriptIntegration/AngelScriptIntegration.h
  53. 1 1
      Source/Samples/22_LuaIntegration/LuaIntegration.h
  54. 1 1
      Source/Samples/23_Water/Water.h
  55. 2 2
      Source/Samples/24_Urho2DSprite/Urho2DSprite.h
  56. 2 2
      Source/Samples/25_Urho2DParticle/Urho2DParticle.h
  57. 2 2
      Source/Samples/26_ConsoleInput/ConsoleInput.h
  58. 2 2
      Source/Samples/27_Urho2DPhysics/Urho2DPhysics.h
  59. 2 2
      Source/Samples/28_Urho2DPhysicsRope/Urho2DPhysicsRope.h
  60. 3 3
      Source/Samples/29_SoundSynthesis/SoundSynthesis.h
  61. 1 1
      Source/Samples/30_LightAnimation/LightAnimation.h
  62. 1 1
      Source/Samples/31_MaterialAnimation/MaterialAnimation.h
  63. 2 2
      Source/Samples/32_Urho2DConstraints/Urho2DConstraints.cpp
  64. 2 2
      Source/Samples/32_Urho2DConstraints/Urho2DConstraints.h
  65. 2 2
      Source/Samples/33_Urho2DSpriterAnimation/Urho2DSpriterAnimation.h
  66. 2 2
      Source/Samples/34_DynamicGeometry/DynamicGeometry.h
  67. 1 1
      Source/Samples/35_SignedDistanceFieldText/SignedDistanceFieldText.h
  68. 1 1
      Source/Samples/36_Urho2DTileMap/Urho2DTileMap.cpp
  69. 2 2
      Source/Samples/36_Urho2DTileMap/Urho2DTileMap.h
  70. 2 2
      Source/Samples/37_UIDrag/UIDrag.h
  71. 1 1
      Source/Samples/38_SceneAndUILoad/SceneAndUILoad.h
  72. 89 1
      Source/Samples/39_CrowdNavigation/CrowdNavigation.cpp
  73. 16 2
      Source/Samples/39_CrowdNavigation/CrowdNavigation.h
  74. 1 1
      Source/Samples/40_Localization/L10n.h
  75. 2 2
      Source/Samples/41_DatabaseDemo/DatabaseDemo.cpp
  76. 3 3
      Source/Samples/41_DatabaseDemo/DatabaseDemo.h
  77. 4 4
      Source/Samples/42_PBRMaterials/PBRMaterials.cpp
  78. 1 1
      Source/Samples/42_PBRMaterials/PBRMaterials.h
  79. 2 2
      Source/Samples/43_HttpRequestDemo/HttpRequestDemo.h
  80. 1 1
      Source/Samples/44_RibbonTrailDemo/RibbonTrailDemo.h
  81. 13 10
      Source/Samples/45_InverseKinematics/InverseKinematics.cpp
  82. 1 1
      Source/Samples/45_InverseKinematics/InverseKinematics.h
  83. 1 1
      Source/Samples/46_RaycastVehicle/RaycastVehicleDemo.h
  84. 4 4
      Source/Samples/46_RaycastVehicle/Vehicle.h
  85. 48 15
      Source/Samples/47_Typography/Typography.cpp
  86. 4 3
      Source/Samples/47_Typography/Typography.h
  87. 33 0
      Source/Samples/48_Hello3DUI/CMakeLists.txt
  88. 360 0
      Source/Samples/48_Hello3DUI/Hello3DUI.cpp
  89. 103 0
      Source/Samples/48_Hello3DUI/Hello3DUI.h
  90. 3 3
      Source/Samples/Sample.h
  91. 2 2
      Source/ThirdParty/FreeType/src/gzip/zutil.c
  92. 4 1
      Source/ThirdParty/FreeType/src/gzip/zutil.h
  93. 63 0
      Source/ThirdParty/LICENSES
  94. 1 1
      Source/ThirdParty/Lua/CMakeLists.txt
  95. 2 2
      Source/ThirdParty/Lua/src/loslib.c
  96. 3 0
      Source/ThirdParty/LuaJIT/CMakeLists.txt
  97. 2 0
      Source/ThirdParty/LuaJIT/src/host/CMakeLists.txt
  98. 937 37
      Source/ThirdParty/SQLite/src/shell.c
  99. 843 24
      Source/ThirdParty/SQLite/src/sqlite3.c
  100. 280 77
      Source/ThirdParty/SQLite/src/sqlite3.h

+ 5 - 5
.appveyor.yml

@@ -35,15 +35,15 @@ cache:
   - C:\tools\mingw64
 environment:
   GIT_NAME:
-    secure: onlJNy/nGFT1GXNdusL4jokojSPZ732EFaXwdhPnpM0=
+    secure: JatNbOZZZKMvMHL8sRq9XpHgESzJ13eh9NHbMK99rX8=
   GIT_EMAIL:
-    secure: RdTdiZIl3fnggJFH8JhmqT2TAg/23ENX/4sFCrJfQ3s=
+    secure: 7EAYZJ5nFqEhMKcPmUvnqPp81XAoJEILzDJJ2qZXrKA=
   GH_TOKEN:
-    secure: VP9a1Mu28nO7cN+RVyccA9bNvIG92pGQ0zgFjTIds62In6BdiIxj3FgIb8G3XR0K
+    secure: xx7og+aLQbdBSsdVo79OTGtdfqedOpYpIJjduNlzjFSXsTkD8NX8fEPq0XE1KT5n
   SF_KEY:
-    secure: JgsjFoVAP5yjNxyS/+S+4byhtnTKCWfI3bkCmHws3P1MwSaUS5+0C6WV1pHIJTVW00Qvo3+JsgVqMYUJ7fo2m/bXvUPNCoSa4BifXZlS6bE=
+    secure: 6Vuo+sNP2YT/iI4ilNDdyJbKpu1AYxSpkdwjJxeZ3BVXM0XQQnG7VS/6IspV9kgWXmYpeVnUTqpoxAg7GDf3MTN9SeXgwHuSsblIAHDaOJk=
   SF_API:
-    secure: cc1q9CXo5BwIYqtgigHpkCGG90zEVM45xx/YzXTOjVp512oQNUzTJq0AmxEYXP78
+    secure: gEDrho4yNr5++SbgkWsxQiFA62GJfTLrZU9Dzjz9HCUcS7XwjTGg3XsFm84w6B1s
 # VS build actually does not need MinGW compiler toolchains so prevent its restoration and update check
   APPVEYOR_CACHE_SKIP_RESTORE: true
   APPVEYOR_CACHE_SKIP_SAVE: true

+ 0 - 2
.bash_helpers.sh

@@ -98,8 +98,6 @@ post_cmake() {
         fi
     elif [ -e "$BUILD"/*.xcodeproj/project.pbxproj ] && perl -v >/dev/null 2>&1; then
         echo -- post_cmake: Fix generated Xcode project
-        # Temporary workaround to fix file references being added into multiple groups warnings (CMake bug https://www.cmake.org/Bug/view.php?id=15272, stil exists in 3.1)
-        perl -i -pe 'BEGIN {$/=undef} s/(Begin PBXGroup section.*?\/\* Sources \*\/,).*?,/\1/s' "$BUILD"/*.xcodeproj/project.pbxproj
         # Speed up build for Debug build configuration by building only active arch (currently this is not doable via CMake generator-expression as it only works for individual target instead of global)
         perl -i -pe 'BEGIN {$/=undef} s/(Debug \*\/ = {[^}]+?)SDKROOT/\1ONLY_ACTIVE_ARCH = YES; SDKROOT/s' "$BUILD"/*.xcodeproj/project.pbxproj
         # Speed up build for Debug build configuration by skipping dSYM file generation

+ 162 - 103
.travis.yml

@@ -27,8 +27,8 @@ compiler: gcc
 cache:
   ccache: true
   directories:
-    - $HOME/cmake-3.8.1-Linux-x86_64/bin
-    - $HOME/cmake-3.8.1-Linux-x86_64/share
+    - $HOME/cmake-3.8.2-Linux-x86_64/bin
+    - $HOME/cmake-3.8.2-Linux-x86_64/share
 dist: trusty
 sudo: false
 addons: {apt: {packages: &default_packages [doxygen, graphviz]}}
@@ -42,6 +42,51 @@ env:
     - CCACHE_COMPRESS=1
     - CCACHE_MAXSIZE=100M
     - URHO3D_DEPLOYMENT_TARGET=generic
+stage: build
+before_script:
+  - rake ci_timer
+  # Upgrade CMake using tarball from its vendor and cache the installation
+  - if [[ ! -f $HOME/cmake-3.8.2-Linux-x86_64/bin/cmake ]]; then wget --no-check-certificate https://cmake.org/files/v3.8/cmake-3.8.2-Linux-x86_64.tar.gz -O $HOME/cmake.tar.gz && tar xf $HOME/cmake.tar.gz -C $HOME && rm $HOME/cmake.tar.gz; fi
+  - export PATH=$HOME/cmake-3.8.2-Linux-x86_64/bin:$PATH
+  # Rely on git directly to detect the commit message and the release tag instead of using the corresponding Travis's environment variable because we may be querying for different commit SHA
+  - if [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then export COMMIT_MESSAGE=$(git log --format=%B -n 1 $TRAVIS_COMMIT); fi
+  - export TAG=$(git describe --exact-match $TRAVIS_COMMIT 2>/dev/null); if [[ $TAG =~ [[:digit:]]+\.[[:digit:]]+ ]]; then export RELEASE_TAG=$TAG; fi
+  # Travis-CI has a special case handling for release tag where it checks out directly from the tag branch instead of the default 'master' branch
+  - if [[ $RELEASE_TAG ]] || ([[ "$TRAVIS_BRANCH" == "master" ]] && [[ "$TRAVIS_PULL_REQUEST" == "false" ]]); then if [[ ${TRAVIS_JOB_NUMBER##*.} == 1 ]]; then export SITE_UPDATE=1; fi; if [[ "$CC" == "gcc" ]] && ([[ $RELEASE_TAG ]] || echo $COMMIT_MESSAGE |grep -cq '\[ci package\]'); then export PACKAGE_UPLOAD=1; fi; fi
+  - if [[ $LINUX ]]; then
+      if [[ "$URHO3D_64BIT" == "0" ]]; then
+        export CMAKE_PREFIX_PATH=/usr/lib/i386-linux-gnu;
+      elif [[ ! $PACKAGE_UPLOAD ]]; then
+        export DISPLAY=:99.0; bash -e /etc/init.d/xvfb start;
+      fi;
+    elif [[ $WIN32 ]]; then
+      if [[ "$URHO3D_64BIT" == "0" ]]; then export ARCH=i686; else export ARCH=x86_64; fi;
+      export MINGW_PREFIX=/usr/bin/${ARCH}-w64-mingw32 DIRECTX_LIB_SEARCH_PATHS=/usr/${ARCH}-w64-mingw32/lib;
+    fi
+  - if [[ $URHO3D_BINDINGS ]]; then git clone --depth 1 https://github.com/urho3d/fastcomp-clang.git && export LLVM_CLANG_ROOT=$(pwd)/fastcomp-clang; fi
+  # For some reason clang compiler toolchain installation in Ubuntu does not have symlink in the ccache symlinks directory, so workaround it
+  - if [[ "$CC"  == "clang" ]]; then ln -s $(which ccache) $HOME/clang && ln -s $(which ccache) $HOME/clang++ && export PATH=$HOME:$PATH; fi
+  - rake ci_setup_cache
+script: rake ci && if [[ $SITE_UPDATE ]]; then rake ci_site_update; fi && if [[ $PACKAGE_UPLOAD ]]; then rake ci_package_upload && if [[ $LINUX ]] && [[ ! "$URHO3D_64BIT" == "0" ]]; then rake ci_package_upload URHO3D_USE_LIB64_RPM=1; fi; fi && rake ci_timer
+after_script:
+  - rake ci_teardown_cache
+  - if [[ ${TRAVIS_JOB_NUMBER##*.} == 1 ]] && [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then rake ci_create_mirrors; fi
+notifications: {email: {on_success: never, on_failure: change}}
+
+# Below are our custom data to preset build stages for other documents in this YAML stream, we do this because YAML anchor cannot be referenced across document boundary
+data:
+  stages:
+    base: &base
+      addons:
+      before_script:
+      after_script:
+    housekeep:
+      <<: *base
+      cache:
+      env:
+      before_script: export TAG=$(git describe --exact-match $TRAVIS_COMMIT~ 2>/dev/null); if [[ $TAG =~ [[:digit:]]+\.[[:digit:]]+ ]]; then export RELEASE_TAG=$TAG; fi
+      script: rake ci_delete_mirror
+
 matrix:
   fast_finish: true
   exclude:
@@ -53,9 +98,8 @@ matrix:
     - <<: *Linux-64bit
       env: LINUX=1 URHO3D_LIB_TYPE=SHARED
     - &Linux-64bit-clang
-      <<: *Linux-64bit
       compiler: clang
-      addons: {apt: {packages: *linux_packages}}
+      addons: &pulseaudio {apt: {packages: libpulse-dev}}
       env: LINUX=1 URHO3D_LIB_TYPE=STATIC
     - <<: *Linux-64bit-clang
       env: LINUX=1 URHO3D_LIB_TYPE=SHARED
@@ -89,39 +133,26 @@ matrix:
       env: WIN32=1 URHO3D_LIB_TYPE=STATIC URHO3D_64BIT=0 URHO3D_OPENGL=0
     - <<: *MinGW-32bit
       env: WIN32=1 URHO3D_LIB_TYPE=SHARED URHO3D_64BIT=0 URHO3D_OPENGL=0
-before_script:
-  - rake ci_timer
-  # Upgrade CMake using tarball from its vendor and cache the installation
-  - if [[ ! -f $HOME/cmake-3.8.1-Linux-x86_64/bin/cmake ]]; then wget --no-check-certificate https://cmake.org/files/v3.8/cmake-3.8.1-Linux-x86_64.tar.gz -O $HOME/cmake.tar.gz && tar xf $HOME/cmake.tar.gz -C $HOME && rm $HOME/cmake.tar.gz; fi
-  - export PATH=$HOME/cmake-3.8.1-Linux-x86_64/bin:$PATH
-  # Rely on git directly to detect the commit message and the release tag instead of using the corresponding Travis's environment variable because we may be querying for different commit SHA
-  - if [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then export COMMIT_MESSAGE=$(git log --format=%B -n 1 $TRAVIS_COMMIT); fi
-  - export TAG=$(git describe --exact-match $TRAVIS_COMMIT 2>/dev/null); if [[ $TAG =~ [[:digit:]]+\.[[:digit:]]+ ]]; then export RELEASE_TAG=$TAG; fi
-  # Travis-CI has a special case handling for release tag where it checks out directly from the tag branch instead of the default 'master' branch
-  - if [[ $RELEASE_TAG ]] || ([[ "$TRAVIS_BRANCH" == "master" ]] && [[ "$TRAVIS_PULL_REQUEST" == "false" ]]); then if [[ ${TRAVIS_JOB_NUMBER##*.} == 1 ]]; then export SITE_UPDATE=1; fi; if [[ "$CC" == "gcc" ]] && ([[ $RELEASE_TAG ]] || echo $COMMIT_MESSAGE |grep -cq '\[ci package\]'); then export PACKAGE_UPLOAD=1; fi; fi
-  - if [[ $LINUX ]]; then
-      if [[ "$URHO3D_64BIT" == "0" ]]; then
-        export CMAKE_PREFIX_PATH=/usr/lib/i386-linux-gnu;
-      elif [[ ! $PACKAGE_UPLOAD ]]; then
-        export DISPLAY=:99.0; bash -e /etc/init.d/xvfb start;
-      fi;
-    elif [[ $WIN32 ]]; then
-      if [[ "$URHO3D_64BIT" == "0" ]]; then export ARCH=i686; else export ARCH=x86_64; fi;
-      export MINGW_PREFIX=/usr/bin/${ARCH}-w64-mingw32 DIRECTX_LIB_SEARCH_PATHS=/usr/${ARCH}-w64-mingw32/lib;
-    fi
-  - if [[ $URHO3D_BINDINGS ]]; then git clone --depth 1 https://github.com/urho3d/fastcomp-clang.git && export LLVM_CLANG_ROOT=$(pwd)/fastcomp-clang; fi
-  # For some reason clang compiler toolchain installation in Ubuntu does not have symlink in the ccache symlinks directory, so workaround it
-  - if [[ "$CC"  == "clang" ]]; then ln -s $(which ccache) $HOME/clang && ln -s $(which ccache) $HOME/clang++ && export PATH=$HOME:$PATH; fi
-  - rake ci_setup_cache
-script: rake ci && if [[ $SITE_UPDATE ]]; then rake ci_site_update; fi && if [[ $PACKAGE_UPLOAD ]]; then rake ci_package_upload && if [[ $LINUX ]] && [[ ! "$URHO3D_64BIT" == "0" ]]; then rake ci_package_upload URHO3D_USE_LIB64_RPM=1; fi; fi && rake ci_timer
-after_script:
-  - rake ci_teardown_cache
-  - if [[ ${TRAVIS_JOB_NUMBER##*.} == 1 ]] && [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then rake ci_create_mirrors; fi
-notifications: {email: {on_success: never, on_failure: change}}
+    - &debug-build-stage
+      stage: debug build
+      addons: *pulseaudio
+      env: LINUX=1 URHO3D_LIB_TYPE=STATIC CMAKE_BUILD_TYPE=Debug
+      script: rake ci && rake ci_timer
+    - <<: *debug-build-stage
+      env: LINUX=1 URHO3D_LIB_TYPE=SHARED CMAKE_BUILD_TYPE=Debug
+    - &debug-build-stage-clang
+      <<: *debug-build-stage
+      compiler: clang
+    - <<: *debug-build-stage-clang
+      env: LINUX=1 URHO3D_LIB_TYPE=SHARED CMAKE_BUILD_TYPE=Debug
+# TODO - if/when Travis-CI later supports conditional build stages then move the 'scan' and 'annotate' stages here
+    - stage: lint (to be implemented)
+      <<: *base
+      script: true  # Using clang-tidy or something like that or using CMake/clang-tidy integration (see <LANG>_CLANG_TIDY CMake property)
 
 ---
 
-branch: {name: MinGW-CI, active: yes, appveyor: yes, last_job: 'x64:SHARED'}
+branch: {name: MinGW-CI, active: yes, appveyor: yes}
 version: '{build}'
 platform:
   - x86
@@ -137,15 +168,15 @@ cache:
   - C:\tools\mingw64
 environment:
   GIT_NAME:
-    secure: onlJNy/nGFT1GXNdusL4jokojSPZ732EFaXwdhPnpM0=
+    secure: JatNbOZZZKMvMHL8sRq9XpHgESzJ13eh9NHbMK99rX8=
   GIT_EMAIL:
-    secure: RdTdiZIl3fnggJFH8JhmqT2TAg/23ENX/4sFCrJfQ3s=
+    secure: 7EAYZJ5nFqEhMKcPmUvnqPp81XAoJEILzDJJ2qZXrKA=
   GH_TOKEN:
-    secure: VP9a1Mu28nO7cN+RVyccA9bNvIG92pGQ0zgFjTIds62In6BdiIxj3FgIb8G3XR0K
+    secure: xx7og+aLQbdBSsdVo79OTGtdfqedOpYpIJjduNlzjFSXsTkD8NX8fEPq0XE1KT5n
   SF_KEY:
-    secure: JgsjFoVAP5yjNxyS/+S+4byhtnTKCWfI3bkCmHws3P1MwSaUS5+0C6WV1pHIJTVW00Qvo3+JsgVqMYUJ7fo2m/bXvUPNCoSa4BifXZlS6bE=
+    secure: 6Vuo+sNP2YT/iI4ilNDdyJbKpu1AYxSpkdwjJxeZ3BVXM0XQQnG7VS/6IspV9kgWXmYpeVnUTqpoxAg7GDf3MTN9SeXgwHuSsblIAHDaOJk=
   SF_API:
-    secure: cc1q9CXo5BwIYqtgigHpkCGG90zEVM45xx/YzXTOjVp512oQNUzTJq0AmxEYXP78
+    secure: gEDrho4yNr5++SbgkWsxQiFA62GJfTLrZU9Dzjz9HCUcS7XwjTGg3XsFm84w6B1s
 # Using neither-in-nor-out-of-source (Urho3D-legacy) build tree when on AppVeyor; using out-of-source (and in-the-source) build tree when on Travis-CI for test coverage
   build_tree: mingw-Build
   config: Release
@@ -180,7 +211,9 @@ before_build:
 build_script:
   - rake ci && if "%PACKAGE_UPLOAD%" == "1" (rake ci_package_upload && move %build_tree%\*.zip . && rd /S /Q %build_tree%\_CPack_Packages)
   - rake ci_timer
-#after_build: rake ci_teardown_cache
+after_build:
+  # rake ci_teardown_cache
+  - if "%PLATFORM%:%URHO3D_LIB_TYPE%" == "x64:SHARED" rake ci_delete_mirror
 test: off
 artifacts:
   - path: .\*.zip
@@ -194,8 +227,8 @@ compiler: gcc
 cache:
   ccache: true
   directories:
-    - $HOME/cmake-3.8.1-Linux-x86_64/bin
-    - $HOME/cmake-3.8.1-Linux-x86_64/share
+    - $HOME/cmake-3.8.2-Linux-x86_64/bin
+    - $HOME/cmake-3.8.2-Linux-x86_64/share
 dist: trusty
 sudo: false
 addons:
@@ -218,14 +251,17 @@ env:
     - CCACHE_SLOPPINESS=pch_defines,time_macros
     - CCACHE_COMPRESS=1
     - CCACHE_MAXSIZE=100M
+stage: scan
 before_script:
-  - if [[ ! -f $HOME/cmake-3.8.1-Linux-x86_64/bin/cmake ]]; then wget --no-check-certificate https://cmake.org/files/v3.8/cmake-3.8.1-Linux-x86_64.tar.gz -O $HOME/cmake.tar.gz && tar xf $HOME/cmake.tar.gz -C $HOME && rm $HOME/cmake.tar.gz; fi
-  - export PATH=$HOME/cmake-3.8.1-Linux-x86_64/bin:$PATH
+  - if [[ ! -f $HOME/cmake-3.8.2-Linux-x86_64/bin/cmake ]]; then wget --no-check-certificate https://cmake.org/files/v3.8/cmake-3.8.2-Linux-x86_64.tar.gz -O $HOME/cmake.tar.gz && tar xf $HOME/cmake.tar.gz -C $HOME && rm $HOME/cmake.tar.gz; fi
+  - export PATH=$HOME/cmake-3.8.2-Linux-x86_64/bin:$PATH
   - export TRAVIS_COMMIT=$TRAVIS_COMMIT~
   - export COMMIT_MESSAGE=$(git log --format=%B -n 1 $TRAVIS_COMMIT)
   - rake ci_setup_cache
 script: true
-after_script: rake ci_teardown_cache
+after_script:
+  - rake ci_teardown_cache
+  - rake ci_delete_mirror
 
 ---
 
@@ -235,8 +271,8 @@ compiler: gcc
 cache:
   ccache: true
   directories:
-    - $HOME/cmake-3.8.1-Linux-x86_64/bin
-    - $HOME/cmake-3.8.1-Linux-x86_64/share
+    - $HOME/cmake-3.8.2-Linux-x86_64/bin
+    - $HOME/cmake-3.8.2-Linux-x86_64/share
 addons: {apt: {packages: libpulse-dev}}
 env:
   global:
@@ -246,15 +282,18 @@ env:
     - CCACHE_SLOPPINESS=pch_defines,time_macros
     - CCACHE_COMPRESS=1
     - CCACHE_MAXSIZE=100M
+stage: annotate
 before_script:
-  - if [[ ! -f $HOME/cmake-3.8.1-Linux-x86_64/bin/cmake ]]; then wget --no-check-certificate https://cmake.org/files/v3.8/cmake-3.8.1-Linux-x86_64.tar.gz -O $HOME/cmake.tar.gz && tar xf $HOME/cmake.tar.gz -C $HOME && rm $HOME/cmake.tar.gz; fi
-  - export PATH=$HOME/cmake-3.8.1-Linux-x86_64/bin:$PATH
+  - if [[ ! -f $HOME/cmake-3.8.2-Linux-x86_64/bin/cmake ]]; then wget --no-check-certificate https://cmake.org/files/v3.8/cmake-3.8.2-Linux-x86_64.tar.gz -O $HOME/cmake.tar.gz && tar xf $HOME/cmake.tar.gz -C $HOME && rm $HOME/cmake.tar.gz; fi
+  - export PATH=$HOME/cmake-3.8.2-Linux-x86_64/bin:$PATH
   - export TRAVIS_COMMIT=$TRAVIS_COMMIT~
   - export COMMIT_MESSAGE=$(git log --format=%B -n 1 $TRAVIS_COMMIT)
   - git clone --depth 1 https://github.com/urho3d/fastcomp-clang.git && export LLVM_CLANG_ROOT=$(pwd)/fastcomp-clang
   - rake ci_setup_cache
 script: rake ci_annotate
-after_script: rake ci_teardown_cache
+after_script:
+  - rake ci_teardown_cache
+  - rake ci_delete_mirror
 
 ---
 
@@ -263,8 +302,8 @@ language: android
 cache:
   directories:
     - $HOME/.ccache
-    - $HOME/cmake-3.8.1-Linux-x86_64/bin
-    - $HOME/cmake-3.8.1-Linux-x86_64/share
+    - $HOME/cmake-3.8.2-Linux-x86_64/bin
+    - $HOME/cmake-3.8.2-Linux-x86_64/share
 dist: trusty
 sudo: false
 addons: {apt: {packages: &default_packages [doxygen, graphviz, g++-multilib]}}
@@ -280,6 +319,8 @@ env:
     - CCACHE_COMPRESS=1
     - CCACHE_MAXSIZE=100M
   matrix:
+    - ANDROID_ABI=armeabi-v7a ANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-clang URHO3D_LIB_TYPE=STATIC                 # Using default native API Level android-9
+    - ANDROID_ABI=armeabi-v7a ANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-clang URHO3D_LIB_TYPE=SHARED AVD=21
     # x86 and x86_64 emulation currently requires hardware acceleration which Travis-CI cannot provide, so skip testing using AVD for now
     - ANDROID_ABI=x86_64 ANDROID_TOOLCHAIN_NAME=x86_64-clang URHO3D_LIB_TYPE=STATIC INSTALL=sys-img-x86_64-android-21   # Using default native API level android-21
     - ANDROID_ABI=x86_64 ANDROID_TOOLCHAIN_NAME=x86_64-clang URHO3D_LIB_TYPE=SHARED INSTALL=sys-img-x86_64-android-21
@@ -288,16 +329,13 @@ env:
     # ANDROID_ANDROID_ABI=arm64-v8a uses NEON by default, so the following two CI jobs also test NEON code path in the build
     - ANDROID_ABI=arm64-v8a ANDROID_TOOLCHAIN_NAME=aarch64-linux-android-clang URHO3D_LIB_TYPE=STATIC NO_SDK_SYSIMG=1   # Using default native API level android-21
     - ANDROID_ABI=arm64-v8a ANDROID_TOOLCHAIN_NAME=aarch64-linux-android-clang URHO3D_LIB_TYPE=SHARED NO_SDK_SYSIMG=1
-    - ANDROID_ABI=armeabi-v7a ANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-clang URHO3D_LIB_TYPE=STATIC                 # Using default native API Level android-9
-    - ANDROID_ABI=armeabi-v7a ANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-clang URHO3D_LIB_TYPE=SHARED AVD=21
-matrix:
-  fast_finish: true
+stage: build
 before_script:
   # Temporarily disable the test to build the APK as Travis-CI Trusty beta VM has not yet setup the environment for Android properly
   - export NO_SDK_SYSIMG=1; unset AVD INSTALL
   - rake ci_timer
-  - if [[ ! -f $HOME/cmake-3.8.1-Linux-x86_64/bin/cmake ]]; then wget --no-check-certificate https://cmake.org/files/v3.8/cmake-3.8.1-Linux-x86_64.tar.gz -O $HOME/cmake.tar.gz && tar xf $HOME/cmake.tar.gz -C $HOME && rm $HOME/cmake.tar.gz; fi
-  - export PATH=$HOME/cmake-3.8.1-Linux-x86_64/bin:$PATH
+  - if [[ ! -f $HOME/cmake-3.8.2-Linux-x86_64/bin/cmake ]]; then wget --no-check-certificate https://cmake.org/files/v3.8/cmake-3.8.2-Linux-x86_64.tar.gz -O $HOME/cmake.tar.gz && tar xf $HOME/cmake.tar.gz -C $HOME && rm $HOME/cmake.tar.gz; fi
+  - export PATH=$HOME/cmake-3.8.2-Linux-x86_64/bin:$PATH
   - export TRAVIS_COMMIT=$TRAVIS_COMMIT~
   - export COMMIT_MESSAGE=$(git log --format=%B -n1 $TRAVIS_COMMIT)
   - export TAG=$(git describe --exact-match $TRAVIS_COMMIT 2>/dev/null); if [[ $TAG =~ [[:digit:]]+\.[[:digit:]]+ ]]; then export RELEASE_TAG=$TAG; fi
@@ -309,6 +347,9 @@ before_script:
   - rake ci_setup_cache
 script: rake ci && if [[ $PACKAGE_UPLOAD ]]; then rake ci_package_upload; fi && rake ci_timer
 after_script: rake ci_teardown_cache
+matrix:
+  fast_finish: true
+  include: [stage: housekeep]
 
 ---
 
@@ -318,8 +359,8 @@ compiler: gcc
 cache:
   ccache: true
   directories:
-    - $HOME/cmake-3.8.1-Linux-x86_64/bin
-    - $HOME/cmake-3.8.1-Linux-x86_64/share
+    - $HOME/cmake-3.8.2-Linux-x86_64/bin
+    - $HOME/cmake-3.8.2-Linux-x86_64/share
 dist: trusty
 sudo: false
 addons: {apt: {packages: [doxygen, graphviz, g++-multilib, rpm]}}
@@ -340,12 +381,11 @@ env:
     # RPI 2/3
     - URHO3D_LIB_TYPE=STATIC RPI_ABI='armeabi-v7a with NEON'
     - URHO3D_LIB_TYPE=SHARED RPI_ABI='armeabi-v7a with NEON'
-matrix:
-  fast_finish: true
+stage: build
 before_script:
   - rake ci_timer
-  - if [[ ! -f $HOME/cmake-3.8.1-Linux-x86_64/bin/cmake ]]; then wget --no-check-certificate https://cmake.org/files/v3.8/cmake-3.8.1-Linux-x86_64.tar.gz -O $HOME/cmake.tar.gz && tar xf $HOME/cmake.tar.gz -C $HOME && rm $HOME/cmake.tar.gz; fi
-  - export PATH=$HOME/cmake-3.8.1-Linux-x86_64/bin:$PATH
+  - if [[ ! -f $HOME/cmake-3.8.2-Linux-x86_64/bin/cmake ]]; then wget --no-check-certificate https://cmake.org/files/v3.8/cmake-3.8.2-Linux-x86_64.tar.gz -O $HOME/cmake.tar.gz && tar xf $HOME/cmake.tar.gz -C $HOME && rm $HOME/cmake.tar.gz; fi
+  - export PATH=$HOME/cmake-3.8.2-Linux-x86_64/bin:$PATH
   - git clone --depth 1 https://github.com/raspberrypi/tools.git rpi-tools && export RPI_PREFIX=$(pwd)/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf && git clone --depth 1 https://github.com/urho3d/rpi-sysroot.git && export RPI_SYSROOT=$(pwd)/rpi-sysroot && for compiler in $RPI_PREFIX-{gcc,g++}; do touch -d "2017-01-01 00:00:00 +0800" $compiler; done
   - export TRAVIS_COMMIT=$TRAVIS_COMMIT~
   - export COMMIT_MESSAGE=$(git log --format=%B -n 1 $TRAVIS_COMMIT)
@@ -355,6 +395,9 @@ before_script:
   - rake ci_setup_cache
 script: rake ci && if [[ $PACKAGE_UPLOAD ]]; then rake ci_package_upload; fi && rake ci_timer
 after_script: rake ci_teardown_cache
+matrix:
+  fast_finish: true
+  include: [stage: housekeep]
 
 ---
 
@@ -364,8 +407,8 @@ compiler: gcc
 cache:
   ccache: true
   directories:
-    - $HOME/cmake-3.8.1-Linux-x86_64/bin
-    - $HOME/cmake-3.8.1-Linux-x86_64/share
+    - $HOME/cmake-3.8.2-Linux-x86_64/bin
+    - $HOME/cmake-3.8.2-Linux-x86_64/share
 dist: trusty
 sudo: false
 addons: {apt: {packages: [doxygen, graphviz, g++-multilib, rpm]}}
@@ -386,12 +429,11 @@ env:
     # ODROID-C2
     - SYSROOT=arm64-sysroot URHO3D_LIB_TYPE=STATIC ARM_ABI_FLAGS='-mcpu=cortex-a53'
     - SYSROOT=arm64-sysroot URHO3D_LIB_TYPE=SHARED ARM_ABI_FLAGS='-mcpu=cortex-a53'
-matrix:
-  fast_finish: true
+stage: build
 before_script:
   - rake ci_timer
-  - if [[ ! -f $HOME/cmake-3.8.1-Linux-x86_64/bin/cmake ]]; then wget --no-check-certificate https://cmake.org/files/v3.8/cmake-3.8.1-Linux-x86_64.tar.gz -O $HOME/cmake.tar.gz && tar xf $HOME/cmake.tar.gz -C $HOME && rm $HOME/cmake.tar.gz; fi
-  - export PATH=$HOME/cmake-3.8.1-Linux-x86_64/bin:$PATH
+  - if [[ ! -f $HOME/cmake-3.8.2-Linux-x86_64/bin/cmake ]]; then wget --no-check-certificate https://cmake.org/files/v3.8/cmake-3.8.2-Linux-x86_64.tar.gz -O $HOME/cmake.tar.gz && tar xf $HOME/cmake.tar.gz -C $HOME && rm $HOME/cmake.tar.gz; fi
+  - export PATH=$HOME/cmake-3.8.2-Linux-x86_64/bin:$PATH
   - if [[ $SYSROOT =~ arm64 ]]; then export triplet=aarch64-linux-gnu; else export triplet=arm-linux-gnueabihf; fi
   - wget https://releases.linaro.org/components/toolchain/binaries/latest-5/$triplet/gcc-linaro-5.4.1-2017.05-x86_64_$triplet.tar.xz -O arm-tools.tar.xz && tar xf arm-tools.tar.xz && rm arm-tools.tar.xz && mv gcc-linaro* gcc-linaro && export ARM_PREFIX=$(pwd)/gcc-linaro/bin/$triplet
   - for compiler in $ARM_PREFIX-{gcc,g++}; do touch -d "2017-01-01 00:00:00 +0800" $compiler; done
@@ -404,6 +446,9 @@ before_script:
   - rake ci_setup_cache
 script: rake ci && if [[ $PACKAGE_UPLOAD ]]; then rake ci_package_upload && if [[ "$SYSROOT" == "arm64-sysroot" ]]; then rake ci_package_upload URHO3D_USE_LIB64_RPM=1; fi; fi && rake ci_timer
 after_script: rake ci_teardown_cache
+matrix:
+  fast_finish: true
+  include: [stage: housekeep]
 
 ---
 
@@ -413,8 +458,8 @@ compiler: gcc
 cache:
   ccache: true
   directories:
-    - $HOME/cmake-3.8.1-Linux-x86_64/bin
-    - $HOME/cmake-3.8.1-Linux-x86_64/share
+    - $HOME/cmake-3.8.2-Linux-x86_64/bin
+    - $HOME/cmake-3.8.2-Linux-x86_64/share
 dist: trusty
 sudo: false
 addons: {apt: {packages: [doxygen, graphviz]}}
@@ -436,12 +481,11 @@ env:
     # URHO3D_LIB_TYPE=MODULE EMSCRIPTEN_WASM=1 BRANCH=incoming numjobs=4
     - URHO3D_LIB_TYPE=STATIC EMSCRIPTEN_WASM=1 BRANCH=incoming
     - URHO3D_LIB_TYPE=SHARED EMSCRIPTEN_WASM=1 BRANCH=incoming
-matrix:
-  fast_finish: true
+stage: build
 before_script:
   - rake ci_timer
-  - if [[ ! -f $HOME/cmake-3.8.1-Linux-x86_64/bin/cmake ]]; then wget --no-check-certificate https://cmake.org/files/v3.8/cmake-3.8.1-Linux-x86_64.tar.gz -O $HOME/cmake.tar.gz && tar xf $HOME/cmake.tar.gz -C $HOME && rm $HOME/cmake.tar.gz; fi
-  - export PATH=$HOME/cmake-3.8.1-Linux-x86_64/bin:$PATH
+  - if [[ ! -f $HOME/cmake-3.8.2-Linux-x86_64/bin/cmake ]]; then wget --no-check-certificate https://cmake.org/files/v3.8/cmake-3.8.2-Linux-x86_64.tar.gz -O $HOME/cmake.tar.gz && tar xf $HOME/cmake.tar.gz -C $HOME && rm $HOME/cmake.tar.gz; fi
+  - export PATH=$HOME/cmake-3.8.2-Linux-x86_64/bin:$PATH
   - export TRAVIS_COMMIT=$TRAVIS_COMMIT~
   - export COMMIT_MESSAGE=$(git log --format=%B -n 1 $TRAVIS_COMMIT)
   - export TAG=$(git describe --exact-match $TRAVIS_COMMIT 2>/dev/null); if [[ $TAG =~ [[:digit:]]+\.[[:digit:]]+ ]]; then export RELEASE_TAG=$TAG; fi
@@ -450,14 +494,20 @@ before_script:
   - git clone --depth 1 --branch $BRANCH https://github.com/urho3d/emscripten-sdk.git && emscripten-sdk/emsdk activate --build=Release sdk-${BRANCH}-64bit $BINARYEN && source emscripten-sdk/emsdk_env.sh
   - for compiler in $EMSCRIPTEN/{emcc,em++}; do touch -d "2017-01-01 00:00:00 +0800" $compiler; done
   - rake ci_setup_cache
-script: rake ci && if [[ "$TRAVIS_BRANCH" == "Web-CI" ]] && [[ ! $EMSCRIPTEN_WASM ]] && [[ "$TRAVIS_PULL_REQUEST" == "false" ]] && [[ "$URHO3D_LIB_TYPE" == "SHARED" ]]; then rake ci_emscripten_samples_update; fi && if [ $PACKAGE_UPLOAD ]; then rake ci_package_upload; fi && rake ci_timer
+script: rake ci && if [ $PACKAGE_UPLOAD ]; then rake ci_package_upload; fi && if [[ "$TRAVIS_BRANCH" == "Web-CI" ]] && [[ ! $EMSCRIPTEN_WASM ]] && [[ "$TRAVIS_PULL_REQUEST" == "false" ]] && [[ "$URHO3D_LIB_TYPE" == "SHARED" ]]; then rake ci_emscripten_samples_update; fi && rake ci_timer
 after_script: rake ci_teardown_cache
+matrix:
+  fast_finish: true
+  include: [stage: housekeep]
 
 ---
 
-branch: {name: OSX-CI, active: yes, mandatory: yes}
+branch: {name: OSX-CI, active: yes}
 language: objective-c
-cache: {directories: $HOME/.ccache}
+cache:
+  directories:
+    - $HOME/.ccache
+    - $HOME/initial-build-tree
 osx_image: xcode8.3
 env:
   global:
@@ -470,41 +520,50 @@ env:
     - CCACHE_COMPRESS=1
     - CCACHE_MAXSIZE=300M
   matrix:
-    - MAKEFILE=1     URHO3D_LIB_TYPE=STATIC URHO3D_DEPLOYMENT_TARGET=generic
-    - MAKEFILE=1     URHO3D_LIB_TYPE=SHARED URHO3D_DEPLOYMENT_TARGET=generic
-    - XCODE=1        URHO3D_LIB_TYPE=STATIC CMAKE_OSX_DEPLOYMENT_TARGET=10.12 SF_DEFAULT=mac:OSX-64bit-STATIC.tar.gz
-    - XCODE=1        URHO3D_LIB_TYPE=SHARED CMAKE_OSX_DEPLOYMENT_TARGET=10.12
-    - XCODE=1 TVOS=1 URHO3D_LIB_TYPE=STATIC APPLETVOS_DEPLOYMENT_TARGET=10.2 sdk=appletvsimulator
-    - XCODE=1 IOS=1  URHO3D_LIB_TYPE=STATIC IPHONEOS_DEPLOYMENT_TARGET=10.3 sdk=iphonesimulator
-matrix:
-  fast_finish: true
-before_script:
+    - &tvOS XCODE=1 TVOS=1 URHO3D_LIB_TYPE=STATIC APPLETVOS_DEPLOYMENT_TARGET=10.2 sdk=appletvsimulator
+    - &iOS XCODE=1 IOS=1 URHO3D_LIB_TYPE=STATIC IPHONEOS_DEPLOYMENT_TARGET=10.3 sdk=iphonesimulator
+    - &macOS-STATIC XCODE=1 URHO3D_LIB_TYPE=STATIC CMAKE_OSX_DEPLOYMENT_TARGET=10.12 SF_DEFAULT=mac:OSX-64bit-STATIC.tar.gz
+    - &macOS-SHARED XCODE=1 URHO3D_LIB_TYPE=SHARED CMAKE_OSX_DEPLOYMENT_TARGET=10.12
+    - MAKEFILE=1 URHO3D_LIB_TYPE=STATIC URHO3D_DEPLOYMENT_TARGET=generic
+    - MAKEFILE=1 URHO3D_LIB_TYPE=SHARED URHO3D_DEPLOYMENT_TARGET=generic
+stage: build
+before_script: &before_script
   - rake ci_timer
   - export TRAVIS_COMMIT=$TRAVIS_COMMIT~
   - export COMMIT_MESSAGE=$(git log --format=%B -n 1 $TRAVIS_COMMIT)
   - export TAG=$(git describe --exact-match $TRAVIS_COMMIT 2>/dev/null); if [[ $TAG =~ [[:digit:]]+\.[[:digit:]]+ ]]; then export RELEASE_TAG=$TAG; fi
-  - if [[ $XCODE ]] && ([[ $RELEASE_TAG ]] || (! [[ $TRAVIS_BRANCH =~ [^-]+-[^-]+-CI ]] && echo $COMMIT_MESSAGE |grep -cq '\[ci package\]')); then export PACKAGE_UPLOAD=1; fi
   - brew update
   - which cmake >/dev/null 2>&1 || cmake=cmake
-  - if [[ $PACKAGE_UPLOAD ]]; then doxygen='doxygen graphviz';
-      whitelist='brew-cask ccache cmake doxygen graphviz libpng libyaml md5deep openssl pkg-config readline';
-      for f in $(brew list); do [[ $whitelist =~ $f ]] || brew uninstall --force $f; done &&
-      for f in $(brew cask list |grep -v Uninstalling); do [[ $whitelist =~ $f ]] || brew cask uninstall --force $f; done &&
-      brew cleanup;
-    fi
-  - travis_retry brew install ccache $cmake $doxygen
+  - travis_retry brew install ccache $cmake
   - if [[ ! $cmake ]]; then brew outdated cmake || brew upgrade cmake; fi
   - export PATH=$(brew info ccache |grep -o '\S*lib\S*'):$PATH
-  - if [[ $XCODE ]]; then pushd $(dirname $(xcodebuild -find-executable clang)) && sudo cp -p $(which ccache) . && for compiler in clang clang++; do sudo mv $compiler{,.orig} && sudo ln -sf $(pwd)/clang.orig /usr/local/bin/$compiler && sudo ln -sf ccache $compiler; done && popd && if [[ $IOS ]]; then redundant=AppleTV,Watch; elif [[ $TVOS ]]; then redundant=iPhone,Watch; else redundant=iPhone,AppleTV,Watch; fi && eval sudo rm -rf /Applications/Xcode.app/Contents/Developer/Platforms/{$redundant}{OS,Simulator}.platform; if echo $COMMIT_MESSAGE |egrep -cq '\[(cache clear|xcode 64bit only)\]' || [[ $(ccache -s |grep 'files in cache' |rev |cut -d' ' -f1 |rev) == '0' ]]; then export XCODE_64BIT_ONLY=1; fi; fi
+  - if [[ $XCODE ]]; then pushd $(dirname $(xcodebuild -find-executable clang)) >/dev/null && sudo cp -p $(which ccache) . && for compiler in clang clang++; do sudo mv $compiler{,.orig} && sudo ln -sf $(pwd)/clang.orig /usr/local/bin/$compiler && sudo ln -sf ccache $compiler; done && popd >/dev/null && if [[ $IOS ]]; then redundant=AppleTV,Watch; elif [[ $TVOS ]]; then redundant=iPhone,Watch; else redundant=iPhone,AppleTV,Watch; fi && eval sudo rm -rf /Applications/Xcode.app/Contents/Developer/Platforms/{$redundant}{OS,Simulator}.platform; if echo $COMMIT_MESSAGE |egrep -cq '\[(cache clear|xcode 64bit only)\]' || [[ $(ccache -s |grep 'files in cache' |rev |cut -d' ' -f1 |rev) == '0' ]]; then export XCODE_64BIT_ONLY=1; fi; fi
   - rake ci_setup_cache
 script: rake ci && if [[ $PACKAGE_UPLOAD ]]; then rake ci_package_upload; fi && rake ci_timer
 after_script: rake ci_teardown_cache
-
-# Below samples are excluded from Xcode/OSX build due to build time constraint
-data:
-  excluded_sample:
-    '#2': [42_PBRMaterials]
-    '#3': [42_PBRMaterials]
+matrix:
+  fast_finish: true
+  include:
+    - &package-stage
+      stage: package
+      condition: PACKAGE_UPLOAD
+      env: *tvOS
+      before_script:
+        - *before_script
+        - export PACKAGE_UPLOAD=1
+        # Uncomment/readjust below when the packaging build is running out of disk space again
+        # whitelist='brew-cask ccache cmake doxygen graphviz libpng libyaml md5deep openssl pkg-config readline'
+        # for f in $(brew list); do [[ $whitelist =~ $f ]] || brew uninstall --force $f; done
+        # for f in $(brew cask list |grep -v Uninstalling); do [[ $whitelist =~ $f ]] || brew cask uninstall --force $f; done
+        - travis_retry brew cleanup
+        - travis_retry brew install doxygen graphviz
+    - <<: *package-stage
+      env: *iOS
+    - <<: *package-stage
+      env: *macOS-STATIC
+    - <<: *package-stage
+      env: *macOS-SHARED
+    - stage: housekeep
 
 ...
 

+ 8 - 2
Android/src/org/libsdl/app/SDLActivity.java

@@ -64,6 +64,8 @@ public class SDLActivity extends Activity {
 
     // Urho3D: flag to load the .so and a new method load them
     private static boolean mIsSharedLibraryLoaded = false;
+    // Urho3D: Hash of activity object that owns state, kept around in order to prevent dying activity overwriting state it no longer owns.
+    private static int mStateOwner = 0;
 
     protected boolean onLoadLibrary(ArrayList<String> libraryNames) {
         for (final String name : libraryNames) {
@@ -98,6 +100,7 @@ public class SDLActivity extends Activity {
         mIsPaused = false;
         mIsSurfaceReady = false;
         mHasFocus = true;
+        mStateOwner = 0;
     }
 
     // Setup
@@ -109,6 +112,7 @@ public class SDLActivity extends Activity {
         super.onCreate(savedInstanceState);
 
         SDLActivity.initialize();
+        mStateOwner = hashCode();
         // So we can call stuff from static callbacks
         mSingleton = this;
 
@@ -255,7 +259,8 @@ public class SDLActivity extends Activity {
         if (!SDLActivity.mIsSharedLibraryLoaded) {  // Urho3D
            super.onDestroy();
            // Reset everything in case the user re opens the app
-           SDLActivity.initialize();
+           if (mStateOwner == hashCode())
+               SDLActivity.initialize();
            return;
         }
 
@@ -277,7 +282,8 @@ public class SDLActivity extends Activity {
 
         super.onDestroy();
         // Reset everything in case the user re opens the app
-        SDLActivity.initialize();
+        if (mStateOwner == hashCode())
+            SDLActivity.initialize();
     }
 
     @Override

+ 1 - 1
CMake/Modules/CheckHost.cmake

@@ -39,7 +39,7 @@ if (CMAKE_HOST_WIN32)
     set (NULL_DEVICE nul)
     if (NOT DEFINED HAS_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)
+        execute_process (COMMAND cmd /C mklink test-link CMakeCache.txt WORKING_DIRECTORY ${CMAKE_BINARY_DIR} RESULT_VARIABLE MKLINK_EXIT_CODE OUTPUT_QUIET ERROR_QUIET)
         if (MKLINK_EXIT_CODE EQUAL 0)
             set (HAS_MKLINK TRUE)
             file (REMOVE ${CMAKE_BINARY_DIR}/test-link)

+ 38 - 61
CMake/Modules/GenerateExportHeader.cmake

@@ -1,3 +1,6 @@
+# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
 #.rst:
 # GenerateExportHeader
 # --------------------
@@ -20,6 +23,7 @@
 #              [NO_DEPRECATED_MACRO_NAME <no_deprecated_macro_name>]
 #              [DEFINE_NO_DEPRECATED]
 #              [PREFIX_NAME <prefix_name>]
+#              [CUSTOM_CONTENT_FROM_VARIABLE <variable>]
 #    )
 #
 #
@@ -60,8 +64,10 @@
 # The CMake fragment will generate a file in the
 # ``${CMAKE_CURRENT_BINARY_DIR}`` called ``somelib_export.h`` containing the
 # macros ``SOMELIB_EXPORT``, ``SOMELIB_NO_EXPORT``, ``SOMELIB_DEPRECATED``,
-# ``SOMELIB_DEPRECATED_EXPORT`` and ``SOMELIB_DEPRECATED_NO_EXPORT``.  The
-# resulting file should be installed with other headers in the library.
+# ``SOMELIB_DEPRECATED_EXPORT`` and ``SOMELIB_DEPRECATED_NO_EXPORT``.
+# They will be followed by content taken from the variable specified by
+# the ``CUSTOM_CONTENT_FROM_VARIABLE`` option, if any.
+# The resulting file should be installed with other headers in the library.
 #
 # The ``BASE_NAME`` argument can be used to override the file name and the
 # names used for the macros:
@@ -178,22 +184,8 @@
 # :prop_tgt:`CXX_VISIBILITY_PRESET <<LANG>_VISIBILITY_PRESET>` and
 # :prop_tgt:`VISIBILITY_INLINES_HIDDEN` instead.
 
-#=============================================================================
-# Copyright 2011 Stephen Kelly <[email protected]>
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-#  License text for the above reference.)
-
 # Modified by Yao Wei Tjong for Urho3D
 
-include(CMakeParseArguments)
 include(CheckCXXCompilerFlag)
 
 # TODO: Install this macro separately?
@@ -207,7 +199,7 @@ macro(_test_compiler_hidden_visibility)
 
   if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.2")
     set(GCC_TOO_OLD TRUE)
-  elseif(CMAKE_COMPILER_IS_GNUC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "4.2")
+  elseif(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "4.2")
     set(GCC_TOO_OLD TRUE)
   elseif(CMAKE_CXX_COMPILER_ID MATCHES Intel AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "12.0")
     set(_INTEL_TOO_OLD TRUE)
@@ -222,17 +214,20 @@ macro(_test_compiler_hidden_visibility)
       AND NOT CMAKE_CXX_COMPILER_ID MATCHES XL
       AND NOT CMAKE_CXX_COMPILER_ID MATCHES PGI
       AND NOT CMAKE_CXX_COMPILER_ID MATCHES Watcom)
-    check_cxx_compiler_flag(-fvisibility=hidden COMPILER_HAS_HIDDEN_VISIBILITY)
-    check_cxx_compiler_flag(-fvisibility-inlines-hidden
-      COMPILER_HAS_HIDDEN_INLINE_VISIBILITY)
-    option(USE_COMPILER_HIDDEN_VISIBILITY
-      "Use HIDDEN visibility support if available." ON)
-    mark_as_advanced(USE_COMPILER_HIDDEN_VISIBILITY)
+    # Urho3D - set the flags in a variable before testing
+    set (COMPILER_HIDDEN_VISIBILITY_FLAGS -fvisibility=hidden)
+    set (COMPILER_HIDDEN_INLINE_VISIBILITY_FLAGS -fvisibility-inlines-hidden)
+    check_cxx_compiler_flag(${COMPILER_HIDDEN_VISIBILITY_FLAGS} COMPILER_HAS_HIDDEN_VISIBILITY)
+    check_cxx_compiler_flag(${COMPILER_HIDDEN_INLINE_VISIBILITY_FLAGS} COMPILER_HAS_HIDDEN_INLINE_VISIBILITY)
   endif()
 endmacro()
 
 macro(_test_compiler_has_deprecated)
+  # NOTE:  Some Embarcadero compilers silently compile __declspec(deprecated)
+  # without error, but this is not a documented feature and the attribute does
+  # not actually generate any warnings.
   if(CMAKE_CXX_COMPILER_ID MATCHES Borland
+      OR CMAKE_CXX_COMPILER_ID MATCHES Embarcadero
       OR CMAKE_CXX_COMPILER_ID MATCHES HP
       OR GCC_TOO_OLD
       OR CMAKE_CXX_COMPILER_ID MATCHES PGI
@@ -268,10 +263,10 @@ macro(_DO_SET_MACRO_VALUES TARGET_LIBRARY)
   endif()
 
   # Urho3D: always generate header file regardless of target type
-    if(WIN32)
+    if(WIN32 OR CYGWIN)
       set(DEFINE_EXPORT "__declspec(dllexport)")
       set(DEFINE_IMPORT "__declspec(dllimport)")
-    elseif(COMPILER_HAS_HIDDEN_VISIBILITY AND USE_COMPILER_HIDDEN_VISIBILITY)
+    elseif(COMPILER_HAS_HIDDEN_VISIBILITY)
       set(DEFINE_EXPORT "__attribute__((visibility(\"default\")))")
       set(DEFINE_IMPORT "__attribute__((visibility(\"default\")))")
       set(DEFINE_NO_EXPORT "__attribute__((visibility(\"hidden\")))")
@@ -283,7 +278,7 @@ macro(_DO_GENERATE_EXPORT_HEADER TARGET_LIBRARY)
   set(options DEFINE_NO_DEPRECATED)
   set(oneValueArgs PREFIX_NAME BASE_NAME EXPORT_MACRO_NAME EXPORT_FILE_NAME
     DEPRECATED_MACRO_NAME NO_EXPORT_MACRO_NAME STATIC_DEFINE
-    NO_DEPRECATED_MACRO_NAME)
+    NO_DEPRECATED_MACRO_NAME CUSTOM_CONTENT_FROM_VARIABLE)
   set(multiValueArgs)
 
   cmake_parse_arguments(_GEH "${options}" "${oneValueArgs}" "${multiValueArgs}"
@@ -314,8 +309,7 @@ macro(_DO_GENERATE_EXPORT_HEADER TARGET_LIBRARY)
   if(_GEH_EXPORT_MACRO_NAME)
     set(EXPORT_MACRO_NAME ${_GEH_PREFIX_NAME}${_GEH_EXPORT_MACRO_NAME})
   endif()
-  # Urho3D: CMake version less than 2.8.12 does not have this sub-command yet, so comment it out until the cmake minimum required is 2.8.12
-  #string(MAKE_C_IDENTIFIER ${EXPORT_MACRO_NAME} EXPORT_MACRO_NAME)
+  string(MAKE_C_IDENTIFIER ${EXPORT_MACRO_NAME} EXPORT_MACRO_NAME)
   if(_GEH_EXPORT_FILE_NAME)
     if(IS_ABSOLUTE ${_GEH_EXPORT_FILE_NAME})
       set(EXPORT_FILE_NAME ${_GEH_EXPORT_FILE_NAME})
@@ -326,31 +320,41 @@ macro(_DO_GENERATE_EXPORT_HEADER TARGET_LIBRARY)
   if(_GEH_DEPRECATED_MACRO_NAME)
     set(DEPRECATED_MACRO_NAME ${_GEH_PREFIX_NAME}${_GEH_DEPRECATED_MACRO_NAME})
   endif()
-  #string(MAKE_C_IDENTIFIER ${DEPRECATED_MACRO_NAME} DEPRECATED_MACRO_NAME)
+  string(MAKE_C_IDENTIFIER ${DEPRECATED_MACRO_NAME} DEPRECATED_MACRO_NAME)
   if(_GEH_NO_EXPORT_MACRO_NAME)
     set(NO_EXPORT_MACRO_NAME ${_GEH_PREFIX_NAME}${_GEH_NO_EXPORT_MACRO_NAME})
   endif()
-  #string(MAKE_C_IDENTIFIER ${NO_EXPORT_MACRO_NAME} NO_EXPORT_MACRO_NAME)
+  string(MAKE_C_IDENTIFIER ${NO_EXPORT_MACRO_NAME} NO_EXPORT_MACRO_NAME)
   if(_GEH_STATIC_DEFINE)
     set(STATIC_DEFINE ${_GEH_PREFIX_NAME}${_GEH_STATIC_DEFINE})
   endif()
-  #string(MAKE_C_IDENTIFIER ${STATIC_DEFINE} STATIC_DEFINE)
+  string(MAKE_C_IDENTIFIER ${STATIC_DEFINE} STATIC_DEFINE)
 
   if(_GEH_DEFINE_NO_DEPRECATED)
-    set(DEFINE_NO_DEPRECATED TRUE)
+    set(DEFINE_NO_DEPRECATED 1)
+  else()
+    set(DEFINE_NO_DEPRECATED 0)
   endif()
 
   if(_GEH_NO_DEPRECATED_MACRO_NAME)
     set(NO_DEPRECATED_MACRO_NAME
       ${_GEH_PREFIX_NAME}${_GEH_NO_DEPRECATED_MACRO_NAME})
   endif()
-  #string(MAKE_C_IDENTIFIER ${NO_DEPRECATED_MACRO_NAME} NO_DEPRECATED_MACRO_NAME)
+  string(MAKE_C_IDENTIFIER ${NO_DEPRECATED_MACRO_NAME} NO_DEPRECATED_MACRO_NAME)
 
   set(INCLUDE_GUARD_NAME "${EXPORT_MACRO_NAME}_H")
 
   # Urho3D: Our revised version does not depend on the target to be added first, so always derive the variable value from target name instead
   set(EXPORT_IMPORT_CONDITION ${TARGET_LIBRARY}_EXPORTS)
-  #string(MAKE_C_IDENTIFIER ${EXPORT_IMPORT_CONDITION} EXPORT_IMPORT_CONDITION)
+  string(MAKE_C_IDENTIFIER ${EXPORT_IMPORT_CONDITION} EXPORT_IMPORT_CONDITION)
+
+  if(_GEH_CUSTOM_CONTENT_FROM_VARIABLE)
+    if(DEFINED "${_GEH_CUSTOM_CONTENT_FROM_VARIABLE}")
+      set(CUSTOM_CONTENT "${${_GEH_CUSTOM_CONTENT_FROM_VARIABLE}}")
+    else()
+      set(CUSTOM_CONTENT "")
+    endif()
+  endif()
 
   configure_file("${_GENERATE_EXPORT_HEADER_MODULE_DIR}/exportheader.cmake.in"
     "${EXPORT_FILE_NAME}" @ONLY)
@@ -368,30 +372,3 @@ function(GENERATE_EXPORT_HEADER TARGET_LIBRARY type)
   _do_generate_export_header(${TARGET_LIBRARY} ${ARGN})
 endfunction()
 
-function(add_compiler_export_flags)
-  if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.12)
-    message(DEPRECATION "The add_compiler_export_flags function is obsolete. Use the CXX_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN target properties instead.")
-  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")
-
-  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()

+ 112 - 79
CMake/Modules/UrhoCommon.cmake

@@ -129,7 +129,6 @@ set (CMAKE_EXE_LINKER_FLAGS "${INDIRECT_DEPS_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKE
 
 # Define all supported build options
 include (CMakeDependentOption)
-option (URHO3D_C++11 "Enable C++11 standard")
 cmake_dependent_option (IOS "Setup build for iOS platform" FALSE "XCODE" FALSE)
 cmake_dependent_option (TVOS "Setup build for tvOS platform" FALSE "XCODE" FALSE)
 cmake_dependent_option (URHO3D_64BIT "Enable 64-bit build, the default is set based on the native ABI of the chosen compiler toolchain" "${NATIVE_64BIT}" "NOT MSVC AND NOT ANDROID AND NOT (ARM AND NOT IOS) AND NOT WEB AND NOT POWERPC" "${NATIVE_64BIT}")     # Intentionally only enable the option for iOS but not for tvOS as the latter is 64-bit only
@@ -141,6 +140,7 @@ option (URHO3D_NAVIGATION "Enable navigation support" TRUE)
 cmake_dependent_option (URHO3D_NETWORK "Enable networking support" TRUE "NOT WEB AND EXCEPTIONS" FALSE)
 option (URHO3D_PHYSICS "Enable physics support" TRUE)
 option (URHO3D_URHO2D "Enable 2D graphics and physics support" TRUE)
+option (URHO3D_WEBP "Enable WebP support" TRUE)
 if (ARM AND NOT ANDROID AND NOT RPI AND NOT APPLE)
     set (ARM_ABI_FLAGS "" CACHE STRING "Specify ABI compiler flags (ARM on Linux platform only); e.g. Orange-Pi Mini 2 could use '-mcpu=cortex-a7 -mfpu=neon-vfpv4'")
 endif ()
@@ -374,7 +374,6 @@ if (URHO3D_CLANG_TOOLS OR URHO3D_BINDINGS)
 endif ()
 if (URHO3D_CLANG_TOOLS)
     # Require C++11 standard and no precompiled-header
-    set (URHO3D_C++11 1)
     set (URHO3D_PCH 0)
     set (URHO3D_LIB_TYPE SHARED)
     # Set build options that would maximise the AST of Urho3D library
@@ -397,6 +396,11 @@ if (URHO3D_CLANG_TOOLS)
     endforeach ()
 endif ()
 
+# Coverity scan does not support PCH
+if ($ENV{COVERITY_SCAN_BRANCH})
+    set (URHO3D_PCH 0)
+endif ()
+
 # Enable testing
 if (URHO3D_TESTING)
     enable_testing ()
@@ -417,15 +421,8 @@ if (NOT URHO3D_LIB_TYPE STREQUAL SHARED AND NOT URHO3D_LIB_TYPE STREQUAL MODULE)
     endif ()
 endif ()
 
-# Force C++11 standard (required by the generic bindings generation) if using AngelScript on Web and 64-bit ARM platforms
-if (URHO3D_ANGELSCRIPT AND (EMSCRIPTEN OR (ARM AND URHO3D_64BIT)))
-    set (URHO3D_C++11 1)
-endif ()
-
-# Force C++11 standard (required by nanodbc library) if using ODBC
 if (URHO3D_DATABASE_ODBC)
     find_package (ODBC REQUIRED)
-    set (URHO3D_C++11 1)
 endif ()
 
 # Define preprocessor macros (for building the Urho3D library) based on the configured build options
@@ -443,6 +440,7 @@ foreach (OPT
         URHO3D_PROFILING
         URHO3D_THREADING
         URHO3D_URHO2D
+        URHO3D_WEBP
         URHO3D_WIN32_CONSOLE)
     if (${OPT})
         add_definitions (-D${OPT})
@@ -468,30 +466,27 @@ if (WIN32 AND NOT CMAKE_PROJECT_NAME MATCHES ^Urho3D-ExternalProject-)
 endif ()
 
 # Platform and compiler specific options
-if (URHO3D_C++11)
-    add_definitions (-DURHO3D_CXX11)   # Note the define is NOT 'URHO3D_C++11'!
-    if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
-        # Use gnu++11/gnu++0x instead of c++11/c++0x as the latter does not work as expected when cross compiling
-        if (VERIFIED_SUPPORTED_STANDARD)
-            set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=${VERIFIED_SUPPORTED_STANDARD}")
-        else ()
-            foreach (STANDARD gnu++11 gnu++0x)  # Fallback to gnu++0x on older GCC version
-                execute_process (COMMAND ${CMAKE_COMMAND} -E echo COMMAND ${CMAKE_CXX_COMPILER} -std=${STANDARD} -E - RESULT_VARIABLE GCC_EXIT_CODE OUTPUT_QUIET ERROR_QUIET)
-                if (GCC_EXIT_CODE EQUAL 0)
-                    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=${STANDARD}")
-                    set (VERIFIED_SUPPORTED_STANDARD ${STANDARD} CACHE INTERNAL "GNU extension of C++11 standard that is verified to be supported by the chosen compiler")
-                    break ()
-                endif ()
-            endforeach ()
-            if (NOT GCC_EXIT_CODE EQUAL 0)
-                message (FATAL_ERROR "Your GCC version ${CMAKE_CXX_COMPILER_VERSION} is too old to enable C++11 standard")
+if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
+    # Use gnu++11/gnu++0x instead of c++11/c++0x as the latter does not work as expected when cross compiling
+    if (VERIFIED_SUPPORTED_STANDARD)
+        set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=${VERIFIED_SUPPORTED_STANDARD}")
+    else ()
+        foreach (STANDARD gnu++11 gnu++0x)  # Fallback to gnu++0x on older GCC version
+            execute_process (COMMAND ${CMAKE_COMMAND} -E echo COMMAND ${CMAKE_CXX_COMPILER} -std=${STANDARD} -E - RESULT_VARIABLE GCC_EXIT_CODE OUTPUT_QUIET ERROR_QUIET)
+            if (GCC_EXIT_CODE EQUAL 0)
+                set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=${STANDARD}")
+                set (VERIFIED_SUPPORTED_STANDARD ${STANDARD} CACHE INTERNAL "GNU extension of C++11 standard that is verified to be supported by the chosen compiler")
+                break ()
             endif ()
+        endforeach ()
+        if (NOT GCC_EXIT_CODE EQUAL 0)
+            message (FATAL_ERROR "Your GCC version ${CMAKE_CXX_COMPILER_VERSION} is too old to enable C++11 standard")
         endif ()
-    elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang)
-        set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
-    elseif (MSVC80)
-        message (FATAL_ERROR "Your MSVC version is too told to enable C++11 standard")
     endif ()
+elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang)
+    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+elseif (MSVC80)
+    message (FATAL_ERROR "Your MSVC version is too told to enable C++11 standard")
 endif ()
 if (APPLE)
     if (IOS)
@@ -545,9 +540,11 @@ if (MSVC)
         set (RELEASE_RUNTIME /MT)
         set (DEBUG_RUNTIME /MTd)
     endif ()
+    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
     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 "${CMAKE_CXX_FLAGS} /MP")
     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})
@@ -566,6 +563,8 @@ if (MSVC)
     set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /OPT:REF /OPT:ICF")
 else ()
     # GCC/Clang-specific setup
+    set (CMAKE_CXX_VISIBILITY_PRESET hidden)
+    set (CMAKE_VISIBILITY_INLINES_HIDDEN true)
     set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-offsetof")
     if (NOT ANDROID)    # Most of the flags are already setup in Android toolchain file
         if (ARM AND CMAKE_SYSTEM_NAME STREQUAL Linux)
@@ -693,14 +692,8 @@ else ()
                     set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mstackrealign")
                     set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mstackrealign")
                 else ()
-                    if (DEFINED ENV{TRAVIS})
-                        # TODO: Remove this workaround when Travis CI VM has been migrated to Ubuntu 14.04 LTS
-                        set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fno-tree-slp-vectorize -fno-tree-vectorize")
-                        set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-tree-slp-vectorize -fno-tree-vectorize")
-                    else ()
-                        set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fno-tree-loop-vectorize -fno-tree-slp-vectorize -fno-tree-vectorize")
-                        set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-tree-loop-vectorize -fno-tree-slp-vectorize -fno-tree-vectorize")
-                    endif ()
+                    set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fno-tree-loop-vectorize -fno-tree-slp-vectorize -fno-tree-vectorize")
+                    set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-tree-loop-vectorize -fno-tree-slp-vectorize -fno-tree-vectorize")
                 endif ()
             endif ()
         else ()
@@ -720,11 +713,6 @@ else ()
             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
-        if (DEFINED ENV{TRAVIS} AND "$ENV{LINUX}")
-            add_definitions (-D__extern_always_inline=inline)
-        endif ()
     else ()
         # GCC-specific
         if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9.1)
@@ -828,6 +816,12 @@ macro (create_symlink SOURCE DESTINATION)
     endif ()
 endmacro ()
 
+# Macro for adding additional make clean files
+macro (add_make_clean_files)
+    get_directory_property (ADDITIONAL_MAKE_CLEAN_FILES ADDITIONAL_MAKE_CLEAN_FILES)
+    set_directory_properties (PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${ADDITIONAL_MAKE_CLEAN_FILES};${ARGN}")
+endmacro ()
+
 # *** THIS IS A DEPRECATED MACRO ***
 # Macro for defining external library dependencies
 # The purpose of this macro is emulate CMake to set the external library dependencies transitively
@@ -933,9 +927,10 @@ endmacro ()
 #  EXTRA_H_FILES <list> - Include the provided list of files into H_FILES result
 #  PCH <list> - Enable precompiled header support on the defined source files using the specified header file, the list is "<path/to/header> [C++|C]"
 #  RECURSE - Option to glob recursively
+#  GROUP - Option to group source files based on its relative path to the corresponding parent directory
 macro (define_source_files)
     # Source files are defined by globbing source files in current source directory and also by including the extra source files if provided
-    cmake_parse_arguments (ARG "RECURSE" "" "PCH;EXTRA_CPP_FILES;EXTRA_H_FILES;GLOB_CPP_PATTERNS;GLOB_H_PATTERNS;EXCLUDE_PATTERNS" ${ARGN})
+    cmake_parse_arguments (ARG "RECURSE;GROUP" "" "PCH;EXTRA_CPP_FILES;EXTRA_H_FILES;GLOB_CPP_PATTERNS;GLOB_H_PATTERNS;EXCLUDE_PATTERNS" ${ARGN})
     if (NOT ARG_GLOB_CPP_PATTERNS)
         set (ARG_GLOB_CPP_PATTERNS *.cpp)    # Default glob pattern
     endif ()
@@ -968,6 +963,23 @@ macro (define_source_files)
     if (ARG_PCH)
         enable_pch (${ARG_PCH})
     endif ()
+    # Optionally group the sources based on their physical subdirectories
+    if (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 defining resource directories with optional arguments as follows:
@@ -1015,7 +1027,7 @@ macro (define_resource_dirs)
             list (APPEND RESOURCE_PAKS ${RESOURCE_${DIR}_PATHNAME})
             if (EMSCRIPTEN AND NOT EMSCRIPTEN_SHARE_DATA)
                 # Set the custom EMCC_OPTION property to preload the *.pak individually
-                set_source_files_properties (${RESOURCE_${DIR}_PATHNAME} PROPERTIES EMCC_OPTION preload-file EMCC_FILE_ALIAS "@/${NAME}.pak --use-preload-cache")
+                set_source_files_properties (${RESOURCE_${DIR}_PATHNAME} PROPERTIES EMCC_OPTION preload-file EMCC_FILE_ALIAS "${NAME}.pak")
             endif ()
         endforeach ()
         set_property (SOURCE ${RESOURCE_PAKS} PROPERTY GENERATED TRUE)
@@ -1181,12 +1193,11 @@ macro (enable_pch HEADER_PATHNAME)
                 get_directory_property (COMPILE_DEFINITIONS COMPILE_DEFINITIONS)
                 get_directory_property (INCLUDE_DIRECTORIES INCLUDE_DIRECTORIES)
                 get_target_property (TYPE ${TARGET_NAME} TYPE)
-                if (TYPE MATCHES SHARED)
+                if (TYPE MATCHES SHARED|MODULE)
                     list (APPEND COMPILE_DEFINITIONS ${TARGET_NAME}_EXPORTS)
-                    # todo: Reevaluate the replacement of this deprecated function (since CMake 2.8.12) when the CMake minimum required version is set to 2.8.12
-                    # At the moment it seems using the function is the "only way" to get the export flags into a CMake variable
-                    # Additionally, CMake implementation of 'VISIBILITY_INLINES_HIDDEN' has a bug (tested in 2.8.12.2) that it erroneously sets the flag for C compiler too
-                    add_compiler_export_flags (COMPILER_EXPORT_FLAGS)
+                    if (LANG STREQUAL CXX)
+                        _test_compiler_hidden_visibility ()
+                    endif ()
                 endif ()
                 # Use PIC flags as necessary, except when compiling using MinGW which already uses PIC flags for all codes
                 if (NOT MINGW)
@@ -1203,35 +1214,37 @@ macro (enable_pch HEADER_PATHNAME)
                 endif ()
                 # Make sure the precompiled headers are not stale by creating custom rules to re-compile the header as necessary
                 file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${PCH_FILENAME})
+                set (ABS_PATH_PCH ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME})
                 foreach (CONFIG ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE})   # These two vars are mutually exclusive
                     # Generate *.rsp containing configuration specific compiler flags
                     string (TOUPPER ${CONFIG} UPPERCASE_CONFIG)
-                    file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.rsp.new "${COMPILE_DEFINITIONS} ${SYSROOT_FLAGS} ${CLANG_${LANG}_FLAGS} ${CMAKE_${LANG}_FLAGS} ${CMAKE_${LANG}_FLAGS_${UPPERCASE_CONFIG}} ${COMPILER_EXPORT_FLAGS} ${PIC_FLAGS} ${INCLUDE_DIRECTORIES} -c -x ${LANG_H}")
-                    execute_process (COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.rsp.new ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.rsp)
-                    file (REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.rsp.new)
-                    # Determine the dependency list
-                    execute_process (COMMAND ${CMAKE_${LANG}_COMPILER} @${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.rsp -MTdeps -MM -o ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.deps ${ABS_HEADER_PATHNAME} RESULT_VARIABLE ${LANG}_COMPILER_EXIT_CODE)
-                    if (NOT ${LANG}_COMPILER_EXIT_CODE EQUAL 0)
-                        message (FATAL_ERROR "Could not generate dependency list for PCH. There is something wrong with your compiler toolchain. "
-                            "Ensure its bin path is in the PATH environment variable or ensure CMake can find CC/CXX in your build environment.")
+                    file (WRITE ${ABS_PATH_PCH}.${CONFIG}.pch.rsp.new "${COMPILE_DEFINITIONS} ${SYSROOT_FLAGS} ${CLANG_${LANG}_FLAGS} ${CMAKE_${LANG}_FLAGS} ${CMAKE_${LANG}_FLAGS_${UPPERCASE_CONFIG}} ${COMPILER_HIDDEN_VISIBILITY_FLAGS} ${COMPILER_HIDDEN_INLINE_VISIBILITY_FLAGS} ${PIC_FLAGS} ${INCLUDE_DIRECTORIES} -c -x ${LANG_H}")
+                    execute_process (COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ABS_PATH_PCH}.${CONFIG}.pch.rsp.new ${ABS_PATH_PCH}.${CONFIG}.pch.rsp)
+                    file (REMOVE ${ABS_PATH_PCH}.${CONFIG}.pch.rsp.new)
+                    if (NOT ${TARGET_NAME}_PCH_DEPS)
+                        if (NOT CMAKE_CURRENT_SOURCE_DIR EQUAL CMAKE_CURRENT_BINARY_DIR)
+                            # Create a dummy initial PCH file in the Out-of-source build tree to keep CLion happy
+                            execute_process (COMMAND ${CMAKE_COMMAND} -E touch ${ABS_PATH_PCH})
+                        endif ()
+                        # Determine the dependency list
+                        execute_process (COMMAND ${CMAKE_${LANG}_COMPILER} @${ABS_PATH_PCH}.${CONFIG}.pch.rsp -MTdeps -MM -MF ${ABS_PATH_PCH}.d ${ABS_HEADER_PATHNAME} RESULT_VARIABLE ${LANG}_COMPILER_EXIT_CODE)
+                        if (NOT ${LANG}_COMPILER_EXIT_CODE EQUAL 0)
+                            message (FATAL_ERROR "Could not generate dependency list for PCH. There is something wrong with your compiler toolchain. "
+                                "Ensure its bin path is in the PATH environment variable or ensure CMake can find CC/CXX in your build environment.")
+                        endif ()
+                        file (STRINGS ${ABS_PATH_PCH}.d ${TARGET_NAME}_PCH_DEPS)
+                        string (REGEX REPLACE "^deps: *| *\\; *" ";" ${TARGET_NAME}_PCH_DEPS ${${TARGET_NAME}_PCH_DEPS})
+                        string (REGEX REPLACE "\\\\ " "\ " ${TARGET_NAME}_PCH_DEPS "${${TARGET_NAME}_PCH_DEPS}")    # Need to stringify the second time to preserve the semicolons
                     endif ()
-                    file (STRINGS ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.deps DEPS)
-                    string (REGEX REPLACE "^deps: *| *\\; *" ";" DEPS ${DEPS})
-                    string (REGEX REPLACE "\\\\ " "\ " DEPS "${DEPS}")  # Need to stringify the second time to preserve the semicolons
                     # Create the rule that depends on the included headers
                     add_custom_command (OUTPUT ${HEADER_FILENAME}.${CONFIG}.pch.trigger
-                        COMMAND ${CMAKE_${LANG}_COMPILER} @${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.rsp -o ${PCH_FILENAME}/${PCH_FILENAME}.${CONFIG} ${ABS_HEADER_PATHNAME}
+                        COMMAND ${CMAKE_${LANG}_COMPILER} @${ABS_PATH_PCH}.${CONFIG}.pch.rsp -o ${PCH_FILENAME}/${PCH_FILENAME}.${CONFIG} ${ABS_HEADER_PATHNAME}
                         COMMAND ${CMAKE_COMMAND} -E touch ${HEADER_FILENAME}.${CONFIG}.pch.trigger
-                        DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.rsp ${DEPS}
+                        DEPENDS ${ABS_PATH_PCH}.${CONFIG}.pch.rsp ${${TARGET_NAME}_PCH_DEPS}
                         COMMENT "Precompiling header file '${HEADER_FILENAME}' for ${CONFIG} configuration")
+                    add_make_clean_files (${PCH_FILENAME}/${PCH_FILENAME}.${CONFIG})
                 endforeach ()
                 # Using precompiled header file
-                if ($ENV{COVERITY_SCAN_BRANCH})
-                    # Coverity scan does not support PCH so workaround by including the actual header file
-                    set (ABS_PATH_PCH ${ABS_HEADER_PATHNAME})
-                else ()
-                    set (ABS_PATH_PCH ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME})
-                endif ()
                 set (CMAKE_${LANG}_FLAGS "${CMAKE_${LANG}_FLAGS} -include \"${ABS_PATH_PCH}\"")
                 unset (${TARGET_NAME}_HEADER_PATHNAME)
             else ()
@@ -1450,15 +1463,18 @@ macro (setup_executable)
         # Make a copy of the Urho3D DLL to the runtime directory in the build tree
         if (TARGET Urho3D)
             add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Urho3D> ${RUNTIME_DIR})
+            add_make_clean_files (${RUNTIME_DIR}/$<TARGET_FILE_NAME:Urho3D>)
         else ()
             foreach (DLL ${URHO3D_DLL})
                 add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DLL} ${RUNTIME_DIR})
+                add_make_clean_files (${RUNTIME_DIR}/${DLL})
             endforeach ()
         endif ()
     endif ()
     if (DIRECT3D_DLL AND NOT ARG_NODEPS)
         # Make a copy of the D3D DLL to the runtime directory in the build tree
         add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DIRECT3D_DLL} ${RUNTIME_DIR})
+        add_make_clean_files (${RUNTIME_DIR}/${DIRECT3D_DLL})
     endif ()
     # Need to check if the destination variable is defined first because this macro could be called by downstream project that does not wish to install anything
     if (NOT ARG_PRIVATE)
@@ -1520,12 +1536,6 @@ macro (setup_library)
     endif ()
     _setup_target ()
 
-    # Setup the compiler flags for building shared library
-    if (LIB_TYPE STREQUAL SHARED_LIBRARY)
-        # Hide the symbols that are not explicitly marked for export
-        add_compiler_export_flags ()
-    endif ()
-
     if (PROJECT_NAME STREQUAL Urho3D)
         # Accumulate all the dependent static libraries that are used in building the Urho3D library itself
         if (NOT ${TARGET_NAME} STREQUAL Urho3D AND LIB_TYPE STREQUAL STATIC_LIBRARY)
@@ -1576,6 +1586,13 @@ macro (setup_main_executable)
             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
+        if (ANDROID_STL MATCHES shared)
+            # Android toolchain may already copy a shared C++ STL runtime to library output path,
+            # still we configure another post build command to copy the runtime and its clean up here for consistency sake
+            add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
+                COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${STL_LIBRARY_DIR}/lib${ANDROID_STL}.so ${CMAKE_BINARY_DIR}/libs/${ANDROID_NDK_ABI_NAME}/lib${ANDROID_STL}.so)
+            add_make_clean_files (${CMAKE_BINARY_DIR}/libs/${ANDROID_NDK_ABI_NAME}/lib${ANDROID_STL}.so)
+        endif ()
         foreach (FILE ${ABSOLUTE_PATH_LIBS})
             get_filename_component (EXT ${FILE} EXT)
             if (EXT STREQUAL .so)
@@ -1583,6 +1600,7 @@ macro (setup_main_executable)
                 add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
                     COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${FILE} ${CMAKE_BINARY_DIR}/libs/${ANDROID_NDK_ABI_NAME}
                     COMMENT "Copying ${NAME} to library output directory")
+                add_make_clean_files (${CMAKE_BINARY_DIR}/libs/${ANDROID_NDK_ABI_NAME}/${NAME})
             endif ()
         endforeach ()
         if (ANDROID_NDK_GDB)
@@ -1590,6 +1608,7 @@ macro (setup_main_executable)
             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")
+            add_make_clean_files (${NDK_GDB_SOLIB_PATH}/$<TARGET_FILE_NAME:${TARGET_NAME}>)
         endif ()
         # When performing packaging, include the final apk file
         if (CMAKE_PROJECT_NAME STREQUAL Urho3D AND NOT APK_INCLUDED)
@@ -1640,6 +1659,11 @@ macro (setup_main_executable)
             endif ()
         endif ()
         setup_executable (${EXE_TYPE} ${ARG_UNPARSED_ARGUMENTS})
+        if (HAS_SHELL_FILE)
+            get_target_property (LOCATION ${TARGET_NAME} LOCATION)
+            get_filename_component (NAME_WE ${LOCATION} NAME_WE)
+            add_make_clean_files ($<TARGET_FILE_DIR:${TARGET_NAME}>/${NAME_WE}.js $<TARGET_FILE_DIR:${TARGET_NAME}>/${NAME_WE}.wasm)
+        endif ()
     endif ()
     # Setup custom resource checker target
     if ((EXE_TYPE STREQUAL MACOSX_BUNDLE OR URHO3D_PACKAGING) AND RESOURCE_DIRS)
@@ -1673,6 +1697,7 @@ macro (setup_main_executable)
                 endif ()
                 list (APPEND COMMANDS COMMAND echo Checking ${DIR}... && bash -c \"\(\( `find ${DIR} -newer ${DIR} |wc -l` \)\)\" && touch -cm ${DIR} ${PACKAGING_COMMAND} || ${OUTPUT_COMMAND})
             endif ()
+            add_make_clean_files (${RESOURCE_${DIR}_PATHNAME})
         endforeach ()
         string (MD5 MD5ALL ${MD5ALL})
         # Ensure the resource check is done before building the main executable target
@@ -1746,13 +1771,13 @@ macro (_setup_target)
                 list (APPEND LINK_FLAGS "-s ALLOW_MEMORY_GROWTH=1")
             endif ()
             if (EMSCRIPTEN_SHARE_DATA)      # MODULE lib type always have this variable enabled
-                list (APPEND LINK_FLAGS "--pre-js ${CMAKE_BINARY_DIR}/Source/pak-loader.js")
+                list (APPEND LINK_FLAGS "--pre-js \"${CMAKE_BINARY_DIR}/Source/pak-loader.js\"")
             endif ()
             if (URHO3D_TESTING)
                 list (APPEND LINK_FLAGS --emrun)
             else ()
                 # If not using EMRUN then we need to include the emrun_prejs.js manually in order to process the request parameters as app's arguments correctly
-                list (APPEND LINK_FLAGS "--pre-js ${EMSCRIPTEN_ROOT_PATH}/src/emrun_prejs.js")
+                list (APPEND LINK_FLAGS "--pre-js \"${EMSCRIPTEN_ROOT_PATH}/src/emrun_prejs.js\"")
             endif ()
         endif ()
         # These flags are here instead of in the CMAKE_(EXE|MODULE)_LINKER_FLAGS so that they do not interfere with the auto-detection logic during initial configuration
@@ -1779,6 +1804,7 @@ macro (_setup_target)
                     COMMAND ${CMAKE_COMMAND} -E copy_if_different $<$<STREQUAL:${URHO3D_LIBRARIES},Urho3D>:$<TARGET_FILE:Urho3D>>$<$<NOT:$<STREQUAL:${URHO3D_LIBRARIES},Urho3D>>:${URHO3D_LIBRARIES}> $<TARGET_FILE_DIR:${TARGET_NAME}>
                     COMMAND ${CMAKE_COMMAND} -E $<$<NOT:$<CONFIG:Debug>>:echo> copy_if_different $<$<STREQUAL:${URHO3D_LIBRARIES},Urho3D>:$<TARGET_FILE:Urho3D>.map>$<$<NOT:$<STREQUAL:${URHO3D_LIBRARIES},Urho3D>>:${URHO3D_LIBRARIES}.map> $<TARGET_FILE_DIR:${TARGET_NAME}> $<$<NOT:$<CONFIG:Debug>>:$<ANGLE-R>${NULL_DEVICE}>
                     COMMAND ${CMAKE_COMMAND} -DTARGET_NAME=${TARGET_NAME} -DTARGET_FILE=$<TARGET_FILE:${TARGET_NAME}> -DTARGET_DIR=$<TARGET_FILE_DIR:${TARGET_NAME}> -DHAS_SHELL_FILE=${HAS_SHELL_FILE} -DSIDE_MODULES="${SIDE_MODULES}" -P ${CMAKE_SOURCE_DIR}/CMake/Modules/PostProcessForWebModule.cmake)
+                add_make_clean_files ($<TARGET_FILE_DIR:${TARGET_NAME}>/libUrho3D.js $<TARGET_FILE_DIR:${TARGET_NAME}>/libUrho3D.js.map)
             endif ()
         endif ()
         # Pass additional source files to linker with the supported flags, such as: js-library, pre-js, post-js, embed-file, preload-file, shell-file
@@ -1787,16 +1813,23 @@ macro (_setup_target)
             if (EMCC_OPTION)
                 unset (EMCC_FILE_ALIAS)
                 unset (EMCC_EXCLUDE_FILE)
+                unset (USE_PRELOAD_CACHE)
                 if (EMCC_OPTION STREQUAL embed-file OR EMCC_OPTION STREQUAL preload-file)
                     get_property (EMCC_FILE_ALIAS SOURCE ${FILE} PROPERTY EMCC_FILE_ALIAS)
+                    if (EMCC_FILE_ALIAS)
+                        set (EMCC_FILE_ALIAS "@\"${EMCC_FILE_ALIAS}\"")
+                    endif ()
                     get_property (EMCC_EXCLUDE_FILE SOURCE ${FILE} PROPERTY EMCC_EXCLUDE_FILE)
                     if (EMCC_EXCLUDE_FILE)
-                        set (EMCC_EXCLUDE_FILE " --exclude-file ${EMCC_EXCLUDE_FILE}")
+                        set (EMCC_EXCLUDE_FILE " --exclude-file \"${EMCC_EXCLUDE_FILE}\"")
                     else ()
                         list (APPEND LINK_DEPENDS ${FILE})
                     endif ()
+                    if (EMCC_OPTION STREQUAL preload-file)
+                        set (USE_PRELOAD_CACHE " --use-preload-cache")
+                    endif ()
                 endif ()
-                list (APPEND LINK_FLAGS "--${EMCC_OPTION} ${FILE}${EMCC_FILE_ALIAS}${EMCC_EXCLUDE_FILE}")
+                list (APPEND LINK_FLAGS "--${EMCC_OPTION} \"${FILE}\"${EMCC_FILE_ALIAS}${EMCC_EXCLUDE_FILE}${USE_PRELOAD_CACHE}")
             endif ()
         endforeach ()
         # If it is a self-executable shell-file then change the file permission of the output file accordingly

+ 5 - 4
CMake/Modules/exportheader.cmake.in

@@ -63,11 +63,12 @@
 #  define @DEPRECATED_MACRO_NAME@_NO_EXPORT @NO_EXPORT_MACRO_NAME@ @DEPRECATED_MACRO_NAME@
 #endif
 
-#cmakedefine01 DEFINE_NO_DEPRECATED
-#if DEFINE_NO_DEPRECATED
-# define @NO_DEPRECATED_MACRO_NAME@
+#if @DEFINE_NO_DEPRECATED@ /* DEFINE_NO_DEPRECATED */
+#  ifndef @NO_DEPRECATED_MACRO_NAME@
+#    define @NO_DEPRECATED_MACRO_NAME@
+#  endif
 #endif
-
+@CUSTOM_CONTENT@
 #define NONSCRIPTABLE @ANNOTATE_NONSCRIPTABLE@
 @POST_EXPORT_HEADER@
 #endif

+ 2 - 0
CMakeLists.txt

@@ -31,6 +31,8 @@ if (COMMAND cmake_policy)
     cmake_policy (SET CMP0026 OLD)
     # MACOSX_RPATH is enabled by default
     cmake_policy (SET CMP0042 NEW)
+    # Honor the visibility properties for SHARED target types only
+    cmake_policy (SET CMP0063 OLD)
 endif ()
 
 # Set project name

+ 135 - 81
Docs/AngelScriptAPI.h

@@ -647,11 +647,10 @@ AttributeInfo(const AttributeInfo&in);
 Variant defaultValue;
 /* readonly */
 Array<String> enumNames;
+VariantMap metadata;
 uint mode;
 String name;
 VariantType type;
-/* readonly */
-Array<String> variantStructureElementNames;
 };
 
 class Audio
@@ -1075,6 +1074,7 @@ void Define(const Vector3&);
 void Define(const Vector3&, const Vector3&);
 void Define(float, float);
 bool Defined() const;
+float DistanceToPoint(const Vector3&) const;
 Intersection IsInside(const BoundingBox&) const;
 Intersection IsInside(const Sphere&) const;
 Intersection IsInside(const Vector3&) const;
@@ -4191,6 +4191,7 @@ void AddPolyhedron(const Polyhedron&, const Color&, bool = true);
 void AddQuad(const Vector3&, float, float, const Color&, bool = true);
 void AddSkeleton(Skeleton, const Color&, bool = true);
 void AddSphere(const Sphere&, const Color&, bool = true);
+void AddSphereSector(const Sphere&, const Quaternion&, float, bool, const Color&, bool = true);
 void AddTriangle(const Vector3&, const Vector3&, const Vector3&, const Color&, bool = true);
 void ApplyAttributes();
 void DrawDebugGeometry(DebugRenderer, bool);
@@ -4397,6 +4398,8 @@ Vector3 ReadVector3();
 Vector4 ReadVector4();
 VectorBuffer ReadVectorBuffer(uint);
 uint Seek(uint);
+uint SeekRelative(int);
+uint Tell() const;
 
 // Properties:
 /* readonly */
@@ -4869,9 +4872,12 @@ class DynamicNavigationMesh
 {
 public:
 // Methods:
+bool AddTile(const VectorBuffer&) const;
+bool Allocate(const BoundingBox&, uint);
 void ApplyAttributes();
 bool Build();
 bool Build(const BoundingBox&);
+bool Build(const IntVector2&, const IntVector2&);
 void DrawDebugGeometry(DebugRenderer, bool);
 void DrawDebugGeometry(bool);
 Vector3 FindNearestPoint(const Vector3&, const Vector3& = Vector3 ( 1.0 , 1.0 , 1.0 ));
@@ -4887,8 +4893,12 @@ float GetDistanceToWall(const Vector3&, float, const Vector3& = Vector3 ( 1.0 ,
 bool GetInterceptNetworkUpdate(const String&) const;
 Vector3 GetRandomPoint();
 Vector3 GetRandomPointInCircle(const Vector3&, float, const Vector3& = Vector3 ( 1.0 , 1.0 , 1.0 ));
+BoundingBox GetTileBoudningBox(const IntVector2&) const;
+VectorBuffer GetTileData(const IntVector2&) const;
+IntVector2 GetTileIndex(const Vector3&) const;
 bool HasSubscribedToEvent(Object, const String&);
 bool HasSubscribedToEvent(const String&);
+bool HasTile(const IntVector2&) const;
 bool Load(File, bool = false);
 bool Load(VectorBuffer&, bool = false);
 bool LoadJSON(const JSONValue&, bool = false);
@@ -4897,9 +4907,11 @@ void MarkNetworkUpdate() const;
 Vector3 MoveAlongSurface(const Vector3&, const Vector3&, const Vector3& = Vector3 ( 1.0 , 1.0 , 1.0 ), int = 3);
 Vector3 Raycast(const Vector3&, const Vector3&, const Vector3& = Vector3 ( 1.0 , 1.0 , 1.0 ));
 void Remove();
+void RemoveAllTiles();
 void RemoveAttributeAnimation(const String&);
 void RemoveInstanceDefault();
 void RemoveObjectAnimation();
+void RemoveTile(const IntVector2&);
 void ResetToDefault();
 bool Save(File) const;
 bool Save(VectorBuffer&) const;
@@ -5058,7 +5070,9 @@ Vector3 ReadVector3();
 Vector4 ReadVector4();
 VectorBuffer ReadVectorBuffer(uint);
 uint Seek(uint);
+uint SeekRelative(int);
 void SendEvent(const String&, VariantMap& = VariantMap ( ));
+uint Tell() const;
 uint Write(Array<uint8>);
 bool WriteBool(bool);
 bool WriteBoundingBox(const BoundingBox&);
@@ -5475,6 +5489,8 @@ Vector3 ReadVector3();
 Vector4 ReadVector4();
 VectorBuffer ReadVectorBuffer(uint);
 uint Seek(uint);
+uint SeekRelative(int);
+uint Tell() const;
 
 // Properties:
 /* readonly */
@@ -5505,74 +5521,6 @@ String verb;
 int weakRefs;
 };
 
-class IKConstraint
-{
-public:
-// Methods:
-void ApplyAttributes();
-void DrawDebugGeometry(DebugRenderer, bool);
-Variant GetAttribute(const String&) const;
-ValueAnimation GetAttributeAnimation(const String&) const;
-float GetAttributeAnimationSpeed(const String&) const;
-float GetAttributeAnimationTime(const String&) const;
-WrapMode GetAttributeAnimationWrapMode(const String&) const;
-Variant GetAttributeDefault(const String&) const;
-bool GetInterceptNetworkUpdate(const String&) const;
-bool HasSubscribedToEvent(Object, const String&);
-bool HasSubscribedToEvent(const String&);
-bool Load(File, bool = false);
-bool Load(VectorBuffer&, bool = false);
-bool LoadJSON(const JSONValue&, bool = false);
-bool LoadXML(const XMLElement&, bool = false);
-void MarkNetworkUpdate() const;
-void Remove();
-void RemoveAttributeAnimation(const String&);
-void RemoveInstanceDefault();
-void RemoveObjectAnimation();
-void ResetToDefault();
-bool Save(File) const;
-bool Save(VectorBuffer&) const;
-bool SaveJSON(JSONValue&) const;
-bool SaveXML(XMLElement&) const;
-void SendEvent(const String&, VariantMap& = VariantMap ( ));
-void SetAnimationTime(float);
-bool SetAttribute(const String&, const Variant&);
-void SetAttributeAnimation(const String&, ValueAnimation, WrapMode = WM_LOOP, float = 1.0f);
-void SetAttributeAnimationSpeed(const String&, float);
-void SetAttributeAnimationTime(const String&, float);
-void SetAttributeAnimationWrapMode(const String&, WrapMode);
-void SetInterceptNetworkUpdate(const String&, bool);
-
-// Properties:
-bool animationEnabled;
-/* readonly */
-Array<Variant> attributeDefaults;
-/* readonly */
-Array<AttributeInfo> attributeInfos;
-Array<Variant> attributes;
-/* readonly */
-String category;
-bool enabled;
-/* readonly */
-bool enabledEffective;
-/* readonly */
-uint id;
-/* readonly */
-Node node;
-/* readonly */
-uint numAttributes;
-ObjectAnimation objectAnimation;
-/* readonly */
-int refs;
-bool temporary;
-/* readonly */
-StringHash type;
-/* readonly */
-String typeName;
-/* readonly */
-int weakRefs;
-};
-
 class IKEffector
 {
 public:
@@ -5627,7 +5575,6 @@ bool enabled;
 bool enabledEffective;
 /* readonly */
 uint id;
-bool inheritParentRotation;
 /* readonly */
 Node node;
 /* readonly */
@@ -5649,14 +5596,19 @@ String typeName;
 /* readonly */
 int weakRefs;
 float weight;
-bool weightedNlerp;
 };
 
 class IKSolver
 {
 public:
 // Methods:
+void ApplyActivePoseToScene();
 void ApplyAttributes();
+void ApplyOriginalPoseToActivePose();
+void ApplyOriginalPoseToScene();
+void ApplySceneToActivePose();
+void ApplySceneToInitialPose();
+void CalculateJointRotations();
 void DrawDebugGeometry(DebugRenderer, bool);
 void DrawDebugGeometry(bool);
 Variant GetAttribute(const String&) const;
@@ -5673,12 +5625,13 @@ bool Load(VectorBuffer&, bool = false);
 bool LoadJSON(const JSONValue&, bool = false);
 bool LoadXML(const XMLElement&, bool = false);
 void MarkNetworkUpdate() const;
+void RebuildChainTrees();
+void RecalculateSegmentLengths();
 void Remove();
 void RemoveAttributeAnimation(const String&);
 void RemoveInstanceDefault();
 void RemoveObjectAnimation();
 void ResetToDefault();
-void ResetToInitialPose();
 bool Save(File) const;
 bool Save(VectorBuffer&) const;
 bool SaveJSON(JSONValue&) const;
@@ -5692,9 +5645,15 @@ void SetAttributeAnimationTime(const String&, float);
 void SetAttributeAnimationWrapMode(const String&, WrapMode);
 void SetInterceptNetworkUpdate(const String&, bool);
 void Solve();
-void UpdateInitialPose();
 
 // Properties:
+bool AUTO_SOLVE;
+bool CONSTRAINTS;
+bool JOINT_ROTATIONS;
+bool TARGET_ROTATIONS;
+bool UPDATE_ACTIVE_POSE;
+bool UPDATE_ORIGINAL_POSE;
+bool USE_ORIGINAL_POSE;
 IKAlgorithm algorithm;
 bool animationEnabled;
 /* readonly */
@@ -5702,11 +5661,8 @@ Array<Variant> attributeDefaults;
 /* readonly */
 Array<AttributeInfo> attributeInfos;
 Array<Variant> attributes;
-bool autoSolve;
-bool boneRotations;
 /* readonly */
 String category;
-bool continuousSolving;
 bool enabled;
 /* readonly */
 bool enabledEffective;
@@ -5720,14 +5676,12 @@ uint numAttributes;
 ObjectAnimation objectAnimation;
 /* readonly */
 int refs;
-bool targetRotation;
 bool temporary;
 float tolerance;
 /* readonly */
 StringHash type;
 /* readonly */
 String typeName;
-bool updatePose;
 /* readonly */
 int weakRefs;
 };
@@ -5765,6 +5719,7 @@ bool SaveDDS(const String&) const;
 bool SaveJPG(const String&, int) const;
 bool SavePNG(const String&) const;
 bool SaveTGA(const String&) const;
+bool SaveWEBP(const String&, float = 0.0f) const;
 void SendEvent(const String&, VariantMap& = VariantMap ( ));
 void SetPixel(int, int, const Color&);
 void SetPixel(int, int, int, const Color&);
@@ -5951,9 +5906,12 @@ public:
 IntRect();
 IntRect(const IntRect&in);
 IntRect(int, int, int, int);
+IntRect(const IntVector2&in, const IntVector2&in);
 IntRect(int[]&inout);
 // Methods:
+int Clip(const IntRect&);
 Intersection IsInside(const IntVector2&) const;
+int Merge(const IntRect&);
 
 // Properties:
 int bottom;
@@ -7388,7 +7346,9 @@ Vector3 ReadVector3();
 Vector4 ReadVector4();
 VectorBuffer ReadVectorBuffer(uint);
 uint Seek(uint);
+uint SeekRelative(int);
 void SendEvent(const String&, VariantMap& = VariantMap ( ));
+uint Tell() const;
 uint Write(Array<uint8>);
 bool WriteBool(bool);
 bool WriteBoundingBox(const BoundingBox&);
@@ -7596,9 +7556,12 @@ class NavigationMesh
 {
 public:
 // Methods:
+bool AddTile(const VectorBuffer&) const;
+bool Allocate(const BoundingBox&, uint);
 void ApplyAttributes();
 bool Build();
 bool Build(const BoundingBox&);
+bool Build(const IntVector2&, const IntVector2&);
 void DrawDebugGeometry(DebugRenderer, bool);
 void DrawDebugGeometry(bool);
 Vector3 FindNearestPoint(const Vector3&, const Vector3& = Vector3 ( 1.0 , 1.0 , 1.0 ));
@@ -7614,8 +7577,12 @@ float GetDistanceToWall(const Vector3&, float, const Vector3& = Vector3 ( 1.0 ,
 bool GetInterceptNetworkUpdate(const String&) const;
 Vector3 GetRandomPoint();
 Vector3 GetRandomPointInCircle(const Vector3&, float, const Vector3& = Vector3 ( 1.0 , 1.0 , 1.0 ));
+BoundingBox GetTileBoudningBox(const IntVector2&) const;
+VectorBuffer GetTileData(const IntVector2&) const;
+IntVector2 GetTileIndex(const Vector3&) const;
 bool HasSubscribedToEvent(Object, const String&);
 bool HasSubscribedToEvent(const String&);
+bool HasTile(const IntVector2&) const;
 bool Load(File, bool = false);
 bool Load(VectorBuffer&, bool = false);
 bool LoadJSON(const JSONValue&, bool = false);
@@ -7624,9 +7591,11 @@ void MarkNetworkUpdate() const;
 Vector3 MoveAlongSurface(const Vector3&, const Vector3&, const Vector3& = Vector3 ( 1.0 , 1.0 , 1.0 ), int = 3);
 Vector3 Raycast(const Vector3&, const Vector3&, const Vector3& = Vector3 ( 1.0 , 1.0 , 1.0 ));
 void Remove();
+void RemoveAllTiles();
 void RemoveAttributeAnimation(const String&);
 void RemoveInstanceDefault();
 void RemoveObjectAnimation();
+void RemoveTile(const IntVector2&);
 void ResetToDefault();
 bool Save(File) const;
 bool Save(VectorBuffer&) const;
@@ -9376,6 +9345,7 @@ class Renderer
 public:
 // Methods:
 void DrawDebugGeometry(bool) const;
+Viewport GetViewportForScene(Scene, uint);
 bool HasSubscribedToEvent(Object, const String&);
 bool HasSubscribedToEvent(const String&);
 void ReloadShaders() const;
@@ -11527,6 +11497,8 @@ void Define(const Sphere&);
 void Define(const Vector3&, float);
 bool Defined() const;
 float Distance(const Vector3&) const;
+Vector3 GetLocalPoint(float, float) const;
+Vector3 GetPoint(float, float) const;
 Intersection IsInside(const BoundingBox&) const;
 Intersection IsInside(const Sphere&) const;
 Intersection IsInside(const Vector3&) const;
@@ -12407,6 +12379,7 @@ Vector3 GetNormal(const Vector3&) const;
 TerrainPatch GetPatch(int, int) const;
 bool HasSubscribedToEvent(Object, const String&);
 bool HasSubscribedToEvent(const String&);
+Vector3 HeightMapToWorld(const IntVector2&) const;
 bool Load(File, bool = false);
 bool Load(VectorBuffer&, bool = false);
 bool LoadJSON(const JSONValue&, bool = false);
@@ -12655,7 +12628,7 @@ void SetFixedHeight(int);
 void SetFixedSize(int, int);
 void SetFixedWidth(int);
 bool SetFont(Font, float);
-bool SetFont(const String&, int);
+bool SetFont(const String&, float);
 void SetInterceptNetworkUpdate(const String&, bool);
 void SetLayout(LayoutMode, int = 0, const IntRect& = IntRect ( 0 , 0 , 0 , 0 ));
 void SetMaxAnchor(float, float);
@@ -13385,6 +13358,7 @@ WrapMode GetAttributeAnimationWrapMode(const String&) const;
 Variant GetAttributeDefault(const String&) const;
 bool GetInterceptNetworkUpdate(const String&) const;
 TileMapLayer2D GetLayer(uint) const;
+Array<TileMapObject2D> GetTileCollisionShapes(int) const;
 bool HasSubscribedToEvent(Object, const String&);
 bool HasSubscribedToEvent(const String&);
 bool Load(File, bool = false);
@@ -13917,6 +13891,8 @@ int dragBeginDistance;
 float dragBeginInterval;
 UIElement focusElement;
 FontHintLevel fontHintLevel;
+int fontOversampling;
+float fontSubpixelThreshold;
 bool forceAutoHint;
 /* readonly */
 UIElement frontElement;
@@ -13929,7 +13905,6 @@ int refs;
 /* readonly */
 UIElement root;
 float scale;
-bool subpixelGlyphPositions;
 /* readonly */
 StringHash type;
 /* readonly */
@@ -13941,6 +13916,79 @@ bool useSystemClipboard;
 int weakRefs;
 };
 
+class UIComponent
+{
+public:
+// Methods:
+void ApplyAttributes();
+Variant GetAttribute(const String&) const;
+ValueAnimation GetAttributeAnimation(const String&) const;
+float GetAttributeAnimationSpeed(const String&) const;
+float GetAttributeAnimationTime(const String&) const;
+WrapMode GetAttributeAnimationWrapMode(const String&) const;
+Variant GetAttributeDefault(const String&) const;
+bool GetInterceptNetworkUpdate(const String&) const;
+bool HasSubscribedToEvent(Object, const String&);
+bool HasSubscribedToEvent(const String&);
+bool Load(File, bool = false);
+bool Load(VectorBuffer&, bool = false);
+bool LoadJSON(const JSONValue&, bool = false);
+bool LoadXML(const XMLElement&, bool = false);
+void MarkNetworkUpdate() const;
+void Remove();
+void RemoveAttributeAnimation(const String&);
+void RemoveInstanceDefault();
+void RemoveObjectAnimation();
+void ResetToDefault();
+bool Save(File) const;
+bool Save(VectorBuffer&) const;
+bool SaveJSON(JSONValue&) const;
+bool SaveXML(XMLElement&) const;
+void SendEvent(const String&, VariantMap& = VariantMap ( ));
+void SetAnimationTime(float);
+bool SetAttribute(const String&, const Variant&);
+void SetAttributeAnimation(const String&, ValueAnimation, WrapMode = WM_LOOP, float = 1.0f);
+void SetAttributeAnimationSpeed(const String&, float);
+void SetAttributeAnimationTime(const String&, float);
+void SetAttributeAnimationWrapMode(const String&, WrapMode);
+void SetInterceptNetworkUpdate(const String&, bool);
+
+// Properties:
+bool animationEnabled;
+/* readonly */
+Array<Variant> attributeDefaults;
+/* readonly */
+Array<AttributeInfo> attributeInfos;
+Array<Variant> attributes;
+/* readonly */
+String category;
+bool enabled;
+/* readonly */
+bool enabledEffective;
+/* readonly */
+uint id;
+/* readonly */
+Material material;
+/* readonly */
+Node node;
+/* readonly */
+uint numAttributes;
+ObjectAnimation objectAnimation;
+/* readonly */
+int refs;
+/* readonly */
+UIElement root;
+bool temporary;
+/* readonly */
+Texture2D texture;
+/* readonly */
+StringHash type;
+/* readonly */
+String typeName;
+/* readonly */
+int weakRefs;
+};
+
 class UIElement
 {
 public:
@@ -14450,7 +14498,9 @@ Vector4 ReadVector4();
 VectorBuffer ReadVectorBuffer(uint);
 void Resize(uint);
 uint Seek(uint);
+uint SeekRelative(int);
 void SetData(Deserializer, uint);
+uint Tell() const;
 uint Write(Array<uint8>);
 bool WriteBool(bool);
 bool WriteBoundingBox(const BoundingBox&);
@@ -15598,6 +15648,8 @@ HTTP_CLOSED,
 
 enum IKAlgorithm
 {
+ONE_BONE,
+TWO_BONE,
 FABRIK,
 };
 
@@ -15979,6 +16031,7 @@ void ClearDelayedExecute(const String& = String ( ));
 VectorBuffer CompressVectorBuffer(VectorBuffer&);
 float Cos(float);
 uint CountSetBits(uint);
+Object CreateObject(const String&);
 VectorBuffer DecompressVectorBuffer(VectorBuffer&);
 void DelayedExecute(float, bool, const String&, const Array<Variant> = null);
 bool Equals(float, float);
@@ -16041,6 +16094,7 @@ bool IsPowerOfTwo(uint);
 String Join(Array<String>&, const String&);
 float Lerp(float, float, float);
 float Ln(float);
+uint LogBaseTwo(uint);
 void MarkNetworkUpdate();
 float Max(float, float);
 int Max(int, int);

+ 1 - 1
Docs/Doxyfile.in

@@ -851,7 +851,7 @@ EXAMPLE_RECURSIVE      = NO
 # that contain images that are to be included in the documentation (see the
 # \image command).
 
-IMAGE_PATH             =
+IMAGE_PATH             = @CMAKE_CURRENT_SOURCE_DIR@/images
 
 # The INPUT_FILTER tag can be used to specify a program that doxygen should
 # invoke to filter for each input file. Doxygen will invoke the filter program

+ 3 - 0
Docs/GettingStarted.dox

@@ -123,6 +123,7 @@ A number of build options can be defined when invoking the build scripts or when
 |URHO3D_PCH           |1|Enable PCH support|
 |URHO3D_DATABASE_ODBC |0|Enable %Database support with ODBC, requires vendor-specific ODBC driver|
 |URHO3D_DATABASE_SQLITE|0|Enable %Database support with SQLite embedded|
+|URHO3D_WEBP          |1|Enable WebP image support|
 |URHO3D_C++11         |0|Enable use of C++11 standard; it is not enabled by default, but certain build option combinations will force it enabled internally, such as: URHO3D_ANGELSCRIPT on Web platform and Android/ARM platforms that use aarch64 architecture, and URHO3D_DATABASE_ODBC on all platforms|
 |URHO3D_MMX           |0|Enable MMX instruction set (32-bit Linux platform only); the MMX is effectively enabled when 3DNow! or SSE is enabled; should only be used for older CPU with MMX support|
 |URHO3D_3DNOW         |0|Enable 3DNow! instruction set (Linux platform only); should only be used for older CPU with (legacy) 3DNow! support|
@@ -577,6 +578,8 @@ if (COMMAND cmake_policy)
     cmake_policy (SET CMP0026 OLD)
     # MACOSX_RPATH is enabled by default
     cmake_policy (SET CMP0042 NEW)
+    # Honor the visibility properties for SHARED target types only
+    cmake_policy (SET CMP0063 OLD)
 endif ()
 
 # Set project name

+ 108 - 40
Docs/LuaScriptAPI.dox

@@ -209,6 +209,7 @@ namespace Urho3D
 <a href="#Class_ToolTip"><b>ToolTip</b></a>
 <a href="#Class_TouchState"><b>TouchState</b></a>
 <a href="#Class_UI"><b>UI</b></a>
+<a href="#Class_UIComponent"><b>UIComponent</b></a>
 <a href="#Class_UIElement"><b>UIElement</b></a>
 <a href="#Class_ValueAnimation"><b>ValueAnimation</b></a>
 <a href="#Class_Variant"><b>Variant</b></a>
@@ -745,6 +746,7 @@ Methods:
 - BoundingBox Transformed(const Matrix3& transform) const
 - BoundingBox Transformed(const Matrix3x4& transform) const
 - Rect Projected(const Matrix4& projection) const
+- float DistanceToPoint(const Vector3& point) const
 - Intersection IsInside(const Vector3& point) const
 - Intersection IsInside(const BoundingBox& box) const
 - Intersection IsInsideFast(const BoundingBox& box) const
@@ -1958,6 +1960,7 @@ Methods:
 - void AddFrustum(const Frustum& frustum, const Color& color, bool depthTest = true)
 - void AddPolyhedron(const Polyhedron& poly, const Color& color, bool depthTest = true)
 - void AddSphere(const Sphere& sphere, const Color& color, bool depthTest = true)
+- void AddSphereSector(const Sphere& sphere, const Quaternion& rotation, float angle, bool drawLines, const Color& color, bool depthTest = true)
 - void AddSkeleton(const Skeleton& skeleton, const Color& color, bool depthTest = true)
 - void AddTriangleMesh(const void* vertexData, unsigned vertexSize, const void* indexData, unsigned indexSize, unsigned indexStart, unsigned indexCount, const Matrix3x4& transform, const Color& color, bool depthTest = true)
 - void AddCircle(const Vector3& center, const Vector3& normal, float radius, const Color& color, int steps = 64, bool depthTest = true)
@@ -2015,9 +2018,11 @@ Methods:
 
 - VectorBuffer Read(unsigned size)
 - unsigned Seek(unsigned position)
+- unsigned SeekRelative(int delta)
 - const String GetName() const
 - unsigned GetChecksum()
 - unsigned GetPosition() const
+- unsigned Tell() const
 - unsigned GetSize() const
 - bool IsEof() const
 - int ReadInt()
@@ -2253,9 +2258,11 @@ Methods:
 - bool IsPackaged() const
 - VectorBuffer Read(unsigned size)
 - unsigned Seek(unsigned position)
+- unsigned SeekRelative(int delta)
 - const String GetName() const
 - unsigned GetChecksum()
 - unsigned GetPosition() const
+- unsigned Tell() const
 - unsigned GetSize() const
 - bool IsEof() const
 - int ReadInt()
@@ -2763,10 +2770,6 @@ Methods:
 - void SetRotationWeight(float weight)
 - float GetRotationDecay() const
 - void SetRotationDecay(float decay)
-- bool WeightedNlerpEnabled() const
-- void EnableWeightedNlerp(bool enable)
-- bool InheritParentRotationEnabled() const
-- void EnableInheritParentRotation(bool enable)
 
 Properties:
 
@@ -2778,32 +2781,23 @@ Properties:
 - float weight
 - float rotationWeight
 - float rotationDecay
+- bool WEIGHT_NLERP
+- bool INHERIT_PARENT_ROTATION
 
 <a name="Class_IKSolver"></a>
 ### IKSolver : Component
 
 Methods:
 
-- IKSolver::Algorithm GetAlgorithm() const
-- void SetAlgorithm(IKSolver::Algorithm algorithm)
-- unsigned GetMaximumIterations() const
-- void SetMaximumIterations(unsigned iterations)
-- float GetTolerance() const
-- void SetTolerance(float tolerance)
-- bool BoneRotationsEnabled() const
-- void EnableBoneRotations(bool enable)
-- bool TargetRotationEnabled() const
-- void EnableTargetRotation(bool enable)
-- bool ContinuousSolvingEnabled() const
-- void EnableContinuousSolving(bool enable)
-- bool UpdatePoseEnabled() const
-- void EnableUpdatePose(bool enable)
-- bool AutoSolveEnabled() const
-- void EnableAutoSolve(bool enable)
+- void RebuildChainTrees()
+- void RecalculateSegmentLengths()
+- void CalculateJointRotations()
 - void Solve()
-- void ResetToInitialPose()
-- void UpdateInitialPose()
-- void MarkSolverTreeDirty()
+- void ApplyOriginalPoseToScene()
+- void ApplySceneToOriginalPose()
+- void ApplyActivePoseToScene()
+- void ApplySceneToActivePose()
+- void ApplyOriginalPoseToActivePose()
 - void DrawDebugGeometry(bool depthTest)
 
 Properties:
@@ -2811,6 +2805,13 @@ Properties:
 - IKSolver::Algorithm algorithm
 - unsigned maximumIterations
 - float tolerance
+- bool JOINT_ROTATIONS
+- bool TARGET_ROTATIONS
+- bool UPDATE_ORIGINAL_POSE
+- bool UPDATE_ACTIVE_POSE
+- bool USE_ORIGINAL_POSE
+- bool CONSTRAINTS
+- bool AUTO_SOLVE
 
 <a name="Class_Image"></a>
 ### Image : Resource
@@ -2838,6 +2839,7 @@ Methods:
 - bool SaveTGA(const String fileName) const
 - bool SaveJPG(const String fileName, int quality) const
 - bool SaveDDS(const String fileName) const
+- bool SaveWEBP(const String fileName, float compression = 0.0f) const
 - Color GetPixel(int x, int y) const
 - Color GetPixel(int x, int y, int z) const
 - unsigned GetPixelInt(int x, int y) const
@@ -2990,12 +2992,16 @@ Methods:
 - IntRect* new()
 - IntRect(int left, int top, int right, int bottom) (GC)
 - IntRect* new(int left, int top, int right, int bottom)
+- IntRect(const IntVector2& min, const IntVector2& max) (GC)
+- IntRect* new(const IntVector2& min, const IntVector2& max)
 - void delete()
 - bool operator==(const IntRect& rhs) const
 - IntVector2 Size() const
 - int Width() const
 - int Height() const
 - Intersection IsInside(const IntVector2& point) const
+- void Clip(const IntRect& rect)
+- void Merge(const IntRect& rect)
 
 Properties:
 
@@ -3026,7 +3032,9 @@ Methods:
 - IntVector2 operator-() const
 - IntVector2 operator-(const IntVector2& rhs) const
 - IntVector2 operator*(int rhs) const
+- IntVector2 operator*(const IntVector2& rhs) const
 - IntVector2 operator/(int rhs) const
+- IntVector2 operator/(const IntVector2& rhs) const
 - String ToString() const
 - unsigned ToHash() const
 - float Length() const
@@ -3036,6 +3044,11 @@ Properties:
 - int x
 - int y
 - const IntVector2 ZERO
+- const IntVector2 LEFT
+- const IntVector2 RIGHT
+- const IntVector2 UP
+- const IntVector2 DOWN
+- const IntVector2 ONE
 
 <a name="Class_IntVector3"></a>
 ### IntVector3
@@ -3055,7 +3068,9 @@ Methods:
 - IntVector3 operator-() const
 - IntVector3 operator-(const IntVector3& rhs) const
 - IntVector3 operator*(int rhs) const
+- IntVector3 operator*(const IntVector3& rhs) const
 - IntVector3 operator/(int rhs) const
+- IntVector3 operator/(const IntVector3& rhs) const
 - String ToString() const
 - unsigned ToHash() const
 - float Length() const
@@ -3917,8 +3932,17 @@ Methods:
 - void SetDetailSampleMaxError(float error)
 - void SetPadding(const Vector3& padding)
 - void SetAreaCost(unsigned areaID, float cost)
+- bool Allocate(const BoundingBox& boundingBox, unsigned maxTiles)
 - bool Build()
 - bool Build(const BoundingBox& boundingBox)
+- bool Build(const IntVector2& from, const IntVector2& to)
+- VectorBuffer GetTileData(const IntVector2& tile) const
+- bool AddTile(const VectorBuffer& tileData)
+- void RemoveTile(const IntVector2& tile)
+- void RemoveAllTiles()
+- bool HasTile(const IntVector2& tile) const
+- BoundingBox GetTileBoudningBox(const IntVector2& tile) const
+- IntVector2 GetTileIndex(const Vector3& position) const
 - void SetPartitionType(NavmeshPartitionType aType)
 - void SetDrawOffMeshConnections(bool enable)
 - void SetDrawNavAreas(bool enable)
@@ -5298,6 +5322,7 @@ Methods:
 - void ReloadShaders()
 - unsigned GetNumViewports() const
 - Viewport* GetViewport(unsigned index) const
+- Viewport* GetViewportForScene(Scene* scene, unsigned index) const
 - RenderPath* GetDefaultRenderPath() const
 - Technique* GetDefaultTechnique() const
 - bool GetHDRRendering() const
@@ -5728,6 +5753,7 @@ Methods:
 - Node* Instantiate(const String fileName, const Vector3& position, const Quaternion& rotation, CreateMode mode = REPLICATED)
 - Node* InstantiateXML(File* source, const Vector3& position, const Quaternion& rotation, CreateMode mode = REPLICATED)
 - Node* InstantiateXML(const String fileName, const Vector3& position, const Quaternion& rotation, CreateMode mode = REPLICATED)
+- Node* InstantiateJSON(const String fileName, const Vector3& position, const Quaternion& rotation, CreateMode mode = REPLICATED)
 - bool LoadAsync(File* file, LoadMode mode = LOAD_SCENE_AND_RESOURCES)
 - bool LoadAsyncXML(File* file, LoadMode mode = LOAD_SCENE_AND_RESOURCES)
 - bool LoadAsync(const String fileName, LoadMode mode = LOAD_SCENE_AND_RESOURCES)
@@ -6128,6 +6154,8 @@ Methods:
 - Intersection IsInside(const BoundingBox& box) const
 - Intersection IsInsideFast(const BoundingBox& box) const
 - float Distance(const Vector3& point) const
+- Vector3 GetLocalPoint(float theta, float phi) const
+- Vector3 GetPoint(float theta, float phi) const
 
 Properties:
 
@@ -6463,6 +6491,7 @@ Methods:
 - float GetHeight(const Vector3& worldPosition) const
 - Vector3 GetNormal(const Vector3& worldPosition) const
 - IntVector2 WorldToHeightMap(const Vector3& worldPosition) const
+- Vector3 HeightMapToWorld(const IntVector2& pixelPosition) const
 - SharedArrayPtr<float> GetHeightData() const
 - float GetDrawDistance() const
 - float GetShadowDistance() const
@@ -7027,7 +7056,8 @@ Methods:
 - void SetUseMutableGlyphs(bool enable)
 - void SetForceAutoHint(bool enable)
 - void SetFontHintLevel(FontHintLevel level)
-- void SetSubpixelGlyphPositions(bool enable)
+- void SetFontSubpixelThreshold(float threshold)
+- void SetFontOversampling(int limit)
 - void SetScale(float scale)
 - void SetWidth(float width)
 - void SetHeight(float height)
@@ -7054,7 +7084,8 @@ Methods:
 - bool GetUseMutableGlyphs() const
 - bool GetForceAutoHint() const
 - FontHintLevel GetFontHintLevel() const
-- bool GetSubpixelGlyphPositions() const
+- float GetFontSubpixelThreshold() const
+- int GetFontOversampling() const
 - bool HasModalElement() const
 - bool IsDragging() const
 - float GetScale() const
@@ -7080,11 +7111,29 @@ Properties:
 - bool useMutableGlyphs
 - bool forceAutoHint
 - FontHintLevel fontHintLevel
-- bool subpixelGlyphPositions
+- float fontSubpixelThreshold
+- int fontOversampling
 - bool modalElement (readonly)
 - float scale
 - IntVector2& customSize
 
+<a name="Class_UIComponent"></a>
+### UIComponent : Component
+
+Methods:
+
+- UIComponent() (GC)
+- UIComponent* new()
+- UIElement* GetRoot() const
+- Material* GetMaterial() const
+- Texture2D* GetTexture() const
+
+Properties:
+
+- UIElement* root (readonly)
+- Material* material (readonly)
+- Texture2D* texture (readonly)
+
 <a name="Class_UIElement"></a>
 ### UIElement : Animatable
 
@@ -7447,7 +7496,6 @@ Methods:
 - Vector2 operator*(const Vector2& rhs) const
 - Vector2 operator/(float rhs) const
 - Vector2 operator/(const Vector2& rhs) const
-- Vector2 operator/(const Vector2& rhs) const
 - void Normalize()
 - float Length() const
 - float LengthSquared() const
@@ -7592,9 +7640,11 @@ Methods:
 - void* GetModifiableData()
 - VectorBuffer Read(unsigned size)
 - unsigned Seek(unsigned position)
+- unsigned SeekRelative(int delta)
 - const String GetName() const
 - unsigned GetChecksum()
 - unsigned GetPosition() const
+- unsigned Tell() const
 - unsigned GetSize() const
 - bool IsEof() const
 - int ReadInt()
@@ -8009,6 +8059,8 @@ Properties:
 
 ### Algorithm
 
+- int ONE_BONE
+- int TWO_BONE
 - int FABRIK
 
 ### AnimationBlendMode
@@ -8181,6 +8233,21 @@ Properties:
 - int FC_LOOKAT_MIXED
 - int FC_DIRECTION
 
+### Feature
+
+- int WEIGHT_NLERP
+- int INHERIT_PARENT_ROTATION
+
+### Feature
+
+- int JOINT_ROTATIONS
+- int TARGET_ROTATIONS
+- int UPDATE_ORIGINAL_POSE
+- int UPDATE_ACTIVE_POSE
+- int USE_ORIGINAL_POSE
+- int CONSTRAINTS
+- int AUTO_SOLVE
+
 ### FileMode
 
 - int FILE_READ
@@ -8691,8 +8758,8 @@ Properties:
 - Time* GetTime()
 - long GetTotalMemory()
 - UI* GetUI()
-- bool HasSubscribedToEvent(Object* sender, const String eventName)
 - bool HasSubscribedToEvent(const String eventName)
+- bool HasSubscribedToEvent(Object* sender, const String eventName)
 - float InverseLerp(float lhs, float rhs, float x)
 - bool IsAbsolutePath(const String pathName)
 - bool IsAlpha(unsigned ch)
@@ -8701,6 +8768,7 @@ Properties:
 - bool IsPowerOfTwo(unsigned value)
 - float Lerp(float lhs, float rhs, float t)
 - float Ln(float x)
+- unsigned LogBaseTwo(unsigned value)
 - float Max(float lhs, float rhs)
 - int MaxInt(int lhs, int rhs)
 - float Min(float lhs, float rhs)
@@ -8715,8 +8783,8 @@ Properties:
 - float Random(float min, float max)
 - float Random()
 - float Random(float range)
-- int RandomInt(int min, int max)
 - int RandomInt(int range)
+- int RandomInt(int min, int max)
 - float RandomNormal(float meanValue, float variance)
 - void RegisterEventName(const String eventName)
 - String RemoveTrailingSlash(const String pathName)
@@ -8733,9 +8801,9 @@ Properties:
 - float Sin(float angle)
 - float SmoothStep(float lhs, float rhs, float t)
 - float Sqrt(float x)
-- float StableRandom(float seed)
-- float StableRandom(const Vector2& seed)
 - float StableRandom(const Vector3& seed)
+- float StableRandom(const Vector2& seed)
+- float StableRandom(float seed)
 - void SubscribeToEvent(void* sender, const String eventName, void* functionOrFunctionName)
 - void SubscribeToEvent(const String eventName, void* functionOrFunctionName)
 - float Tan(float angle)
@@ -8766,31 +8834,31 @@ Properties:
 - void UnsubscribeFromEvent(Object* sender, const String eventName)
 - void UnsubscribeFromEvent(const String eventName)
 - void UnsubscribeFromEvents(Object* sender)
+- Vector2 VectorCeil(const Vector2& vec)
 - Vector4 VectorCeil(const Vector4& vec)
 - Vector3 VectorCeil(const Vector3& vec)
-- Vector2 VectorCeil(const Vector2& vec)
-- IntVector3 VectorCeilToInt(const Vector3& vec)
 - IntVector2 VectorCeilToInt(const Vector2& vec)
-- Vector4 VectorFloor(const Vector4& vec)
+- IntVector3 VectorCeilToInt(const Vector3& vec)
 - Vector3 VectorFloor(const Vector3& vec)
 - Vector2 VectorFloor(const Vector2& vec)
+- Vector4 VectorFloor(const Vector4& vec)
 - IntVector2 VectorFloorToInt(const Vector2& vec)
 - IntVector3 VectorFloorToInt(const Vector3& vec)
 - Vector2 VectorLerp(const Vector2& lhs, const Vector2& rhs, const Vector2& t)
-- Vector3 VectorLerp(const Vector3& lhs, const Vector3& rhs, const Vector3& t)
 - Vector4 VectorLerp(const Vector4& lhs, const Vector4& rhs, const Vector4& t)
+- Vector3 VectorLerp(const Vector3& lhs, const Vector3& rhs, const Vector3& t)
 - Vector3 VectorMax(const Vector3& lhs, const Vector3& rhs)
-- IntVector3 VectorMax(const IntVector3& lhs, const IntVector3& rhs)
-- Vector2 VectorMax(const Vector2& lhs, const Vector2& rhs)
 - Vector4 VectorMax(const Vector4& lhs, const Vector4& rhs)
 - IntVector2 VectorMax(const IntVector2& lhs, const IntVector2& rhs)
-- Vector4 VectorMin(const Vector4& lhs, const Vector4& rhs)
+- IntVector3 VectorMax(const IntVector3& lhs, const IntVector3& rhs)
+- Vector2 VectorMax(const Vector2& lhs, const Vector2& rhs)
 - Vector3 VectorMin(const Vector3& lhs, const Vector3& rhs)
-- Vector2 VectorMin(const Vector2& lhs, const Vector2& rhs)
 - IntVector3 VectorMin(const IntVector3& lhs, const IntVector3& rhs)
+- Vector2 VectorMin(const Vector2& lhs, const Vector2& rhs)
+- Vector4 VectorMin(const Vector4& lhs, const Vector4& rhs)
 - IntVector2 VectorMin(const IntVector2& lhs, const IntVector2& rhs)
-- Vector4 VectorRound(const Vector4& vec)
 - Vector2 VectorRound(const Vector2& vec)
+- Vector4 VectorRound(const Vector4& vec)
 - Vector3 VectorRound(const Vector3& vec)
 - IntVector3 VectorRoundToInt(const Vector3& vec)
 - IntVector2 VectorRoundToInt(const Vector2& vec)

+ 325 - 8
Docs/Reference.dox

@@ -2127,6 +2127,288 @@ CrowdAgents' handle navigation areas differently. The CrowdManager can contains
 
 See the 39_CrowdNavigation sample application for an example on how to use CrowdAgents and the CrowdManager.
 
+
+\page IK Inverse Kinematics
+
+\section ikoverview Overview
+
+IK  (Inverse kinematics)  can  be  useful  in  many  situations  ranging  from
+procedural animation to small adjustments of animation. Simply put, IK is used
+when  you want to position the tips of a hierarchichal structure  at  a  known
+location and  need  to  calculate all of the rotations of the parent joints to
+achieve this.
+
+Examples include: Moving a hand to pick  up  an object, or adjusting a foot so
+it's  always  touching  the  ground, regardless of incline.
+
+\section ikterminology Terminology
+
+It is helpful to know some of  the terminology used when talking about inverse
+kinematics, so you can better understand what's being said.
+
+  - The upper-most node in a solver's tree is known as the \a base \a node or \a root \a node.
+  - Nodes which need to be moved to a specific target location (example: The hand of a human) are called an \a end \a effector.
+  - Joints from which multiple children branch off from are called a \a sub-base \a node.
+  - IK solvers work most efficiently on single "strings" of nodes, which are referred to as \a chains.
+  - The entire structure (in the case of a human with two hands) is called a \a chain \a tree.
+
+\section ikendeffectors End Effectors
+
+Effectors are used to set the target position and rotation of a  node. You can
+create one by attaching the IKEffector component to a node.
+
+\code{.cpp}
+Node* handNode = modelNode->GetChild("Hand.R", true);
+
+IKEffector* effector = handNode->CreateComponent<IKEffector>();  // C++
+IKEffector@ effector = handNode.CreateComponent("IKEffector");   // AngelScript
+local effector = handNode:CreateComponent("IKEffector")          -- Lua
+\endcode
+
+You can then give the effector a target position (for example, the position of
+an apple) using  IKEffector::SetTargetPosition or you can tell the effector to
+automatically track  the  position  of  a node with IKEffector::SetTargetNode.
+
+\code{.cpp}
+effector->SetTargetPosition(appleNode->GetWorldPosition());  // C++
+effector.targetPosition = appleNode.worldPosition;           // AngelScript
+effector.targetPosition = appleNode.worldPosition            -- Lua
+\endcode
+
+If enabled, you  can also tell the effector to try and match a target rotation
+using IKEffector::SetTargetRotation. This is useful if  you  want your hand to
+point  in  a particular direction in relation to the apple (this feature needs
+to be enabled in the solver, which is discussed futher below).
+
+The target position and rotation are both set in global space.
+
+Another    important    parameter    is    the    \a    chain    \a    length,
+IKEffector::SetChainLength.  A  chain  length of 1 means a single  segment  or
+"bone" is affected. Arms and legs typically use a value of 2 (because you only
+want  to  solve for the arm and not the entire body). The default value is  0,
+which   means  all  nodes  right  down  to  the  base   node   are   affected.
+
+\code{.cpp}
+effector->SetChainLength(2); // Humans have two bones in their arms
+effector.chainLength = 2;    // AngelScript
+effector.chainLength = 2     -- Lua
+\endcode
+
+Effectors have  a  \a  weight parameter (use IKEffector::SetWeight) indicating
+how  much influence they have on the tree to be solved. You can  make  use  of
+this to smoothly transition in and out of IK solutions.  This will be required
+for when your character begins  picking  up an object and you want to smoothly
+switch from animation to IK.
+
+\code{.cpp}
+effector->SetWeight(SomeSplineFunction());  // C++
+effector.weight = SomeSplineFunction();     // AngelScript
+effector.weight = SomeSplineFunction();     -- Lua
+\endcode
+
+If you've played around with the weight parameter, you may  have  noticed that
+it causes a \a linear interpolation of the target  position. This can look bad
+on  organic  creatures,  especially when the solved tree is far apart from the
+original tree.  You  might consider enabling \a nlerp, which causes the weight
+to rotate around the next sub-base  joint.  This  feature  can be enabled with
+IKEffector::SetFeature.
+
+\code{.cpp}
+effector->SetFeature(IKEffector::WEIGHT_NLERP, true);  // C++
+effector.WEIGHT_NLERP = true;                          // AngelScript
+effector.WEIGHT_NLERP = true                           -- Lua
+\endcode
+
+Note that the script  bindings  work  a little differently in this regard. The
+features can be enabled/disabled directly on the effector object as attributes
+rather than  having  to  call  SetFeature. This is for convenience (but may be
+changed in the future due to script API inconsistency).
+
+\section iksolvers Solvers
+
+Solvers  are  responsible  for  calculating  a solution based on the  attached
+effectors and their settings.
+
+Note that solvers will \a only ever affect  nodes  that  are in their subtree.
+This means  that if you attach an IKEffector to a node that is a parent of the
+IKSolver node, then the solver will ignore this effector.
+
+You can create a solver by attaching an IKSolver component to a node:
+
+\code{.cpp}
+IKSolver* solver = modelNode->CreateComponent<IKSolver>();  // C++
+IKSolver@ solver = modelNode.CreateComponent("IKSolver");   // AngelScript
+local solver = modelNode:CreateComponent("IKSolver")        -- Lua
+\endcode
+
+The first thing  you'll  want to do is select the appropriate algorithm. As of
+this writing, there are  3  algorithms  to  choose from, and you should favour
+them in the order listed here.
+
+  - ONE_BONE: A specialized solver designed to point an object at a target position (such as eyes, heads, etc.)
+  - TWO_BONE: A specialized solver that calculates a direct solution using trigonometry, specifically for two-bone structures (arms, legs)
+  - FABRIK: A generic solver capable of solving anything you can throw at it. It uses an iterative algorithm and is thus a bit slower than the two specialized algorithms. Should be used for structures with 3 or more bones, or structures with multiple end effectors.
+
+You can set the algorithm using:
+
+\code{.cpp}
+solver->SetAlgorithm(IKSolver::FABRIK);  // C++
+solver.algorithm = IKAlgorithm::FABRIK;  // AngelScript
+solver.algorithm = IKSolver.FABRIK       -- Lua
+\endcode
+
+If  you chose an iterative algorithm, then you might also want  to  tweak  the
+maximum number of iterations  and the tolerance. FABRIK converges very quickly
+and works well with  20  or  less  iterations. Sometimes you can even get away
+with just 5 iterations. The tolerance  specifies  the  maximum distance an end
+effector is allowed to be from its target. Obviously, the smaller  you set the
+tolerance,  the more iterations will be required.  Good  starting  values  for
+tolerance  are about 100th the size of the chain you're solving (e.g. if  your
+chain is 2 units long, then set the tolerance to 0.02).
+
+\code{.cpp}
+solver->SetMaximumIterations(20); // Good starting value for FABRIK
+solver->SetTolerance(0.02);       // Good value is 100th of your chain length.
+
+solver.maximumIterations = 20;    // AngelScript
+solver.tolerance = 0.02;
+
+solver.maximumIterations = 20     -- Lua
+solver.tolerance = 0.02
+\endcode
+
+Note that these settings do nothing if you have selected a direct solver (such
+as TWO_BONE or ONE_BONE).
+
+\section iksolverfeatures Solver Features
+
+There are a number of features that can be enabled/disabled on the solver, all
+of  which  can  be  toggled  by  using  IKSolver::SetFeature  and checked with
+IKSolver::GetFeature.   You   can   always  look  at  the   documentation   of
+IKSolver::Feature for a detailed description of each feature.
+
+\subsection iksolverautosolve AUTO_SOLVE
+
+By default, the solver will be in \a  auto  \a  solve mode. This means that it
+will  automatically  perform  its  calculations   for   you   in  response  to
+E_SCENEDRAWABLEUPDATEFINISHED. All  you  have  to do is create your effectors,
+set  their  target  positions,  and let the solver handle the  rest.  You  can
+override this behaviour by disabling the AUTO_SOLVE feature, in which case you
+will have to call  IKSolver::Solve manually for it to do anything. This may be
+desired if you want to "hook in" right between when the animation has updated,
+but before inverse kinematics is calculated.
+
+\code{.cpp}
+solver->SetFeature(IKSolver::AUTO_SOLVE, false);  // C++
+solver.AUTO_SOLVE = false;                        // AngelScript
+solver.AUTO_SOLVE = false                         -- Lua
+\endcode
+
+And here's how you manually invoke the solver.
+
+\code{.cpp}
+// C++
+void MyLogic::Setup()
+{
+    SubscribeToEvent(GetScene(), E_SCENEDRAWABLEUPDATEFINISHED, URHO3D_HANDLER(MyLogic, HandleSceneDrawableUpdateFinished));
+}
+void MyLogic::HandleSceneDrawableUpdateFinished(StringHash eventType, VariantMap& eventData)
+{
+    GetComponent<IKSolver>()->Solve();
+}
+
+// AngelScript
+void Setup()
+{
+    SubscribeToEvent("SceneDrawableUpdateFinished", "HandleSceneDrawableUpdateFinished")
+}
+void HandleSceneDrawableUpdateFinished(StringHash eventType, VariantMap& eventData)
+{
+    GetComponent("IKSolver").Solve()
+}
+
+// Lua
+function Setup()
+    SubscribeToEvent("SceneDrawableUpdateFinished", "HandleSceneDrawableUpdateFinished")
+end
+function HandleSceneDrawableUpdateFinished(eventType, eventData)
+    GetComponent("IKSolver"):Solve()
+end
+\endcode
+
+\subsection iksolverjointrotations IKSolver::JOINT_ROTATIONS
+
+\code{.cpp}
+solver->SetFeature(IKSolver::JOINT_ROTATIONS, false);  // C++
+solver.JOINT_ROTATIONS = false;                        // AngelScript
+solver.JOINT_ROTATIONS = false                         -- Lua
+\endcode
+
+This is should be enabled if you are using IK on skinned models (or  otherwise
+node structures that  need rotations). If you don't care about node rotations,
+you   can   disable   this   feature   and  get  a  small  performance  boost.
+
+When disabled, all nodes will simply keep their  original  orientation  in the
+world, only their positions will change.
+
+The solver calculates  joint  rotations  after  the  solution has converged by
+comparing the solved tree with the original tree as a  way  to  compute  delta
+angles.  These  are  then  multiplied by the original rotations to obtain  the
+final joint rotations.
+
+\subsection iksolvertargetrotations TARGET_ROTATIONS
+
+\code{.cpp}
+solver->SetFeature(IKSolver::TARGET_ROTATIONS, false);  // C++
+solver.TARGET_ROTATIONS = false;                        // AngelScript
+solver.TARGET_ROTATIONS = false                         -- Lua
+\endcode
+
+Enabling   this   will   cause   the  orientation   of   the   effector   node
+(IKEffector::SetTargetRotation)  to  be  considered during solving. This means
+that the effector node will try to match the rotation of the target as best as
+possible. If the target is out of reach or just within reach, the  chain  will
+reach out and start to ignore  the  target  rotation in favour of reaching its
+target.
+
+Disabling this feature causes IKEffector::SetTargetRotation to have no effect.
+
+\subsection iksolvertrees UPDATE_ORIGINAL_POSE, UPDATE_ACTIVE_POSE, and USE_ORIGINAL_POSE
+
+These options can be quite confusing to understand.
+
+The solver actually stores \a two  \a trees, not one. There is an \a active \a
+tree, which is kind of like the "workbench". The  solver  uses the active tree
+for its initial condition but also writes the solution  back  into  the active
+tree (i.e. the tree is solved in-place, rather than cloning).
+
+Then  there  is the \a original \a tree, which is set once during creation and
+then never changed (at least not by default).
+
+You can control which tree the solver should use for its initial condition. If
+you   enable   USE_ORIGINAL_POSE,  then  the  solver  will  first   copy   all
+positions/rotations  from  the original  tree  into  the  active  tree  before
+solving. Thus,  the  solution  will  tend  to  "snap  back"  into its original
+configuration if it can.
+
+If you disable USE_ORIGINAL_POSE, then  the  solver  will  use the active tree
+instead. The active tree will contain whatever pose was solved last. Thus, the
+solution will tend to be more "continuous".
+
+Very important: Note that the active tree is NOT updated  by Urho3D unless you
+enable  UPDATE_ACTIVE_POSE (this is enabled by default). If UPDATE_ACTIVE_POSE
+is disabled, then any nodes that have moved outside of IKSolver's control will
+effectively be \a ignored.  Thus,  if  your model is animated, you very likely
+want this enabled.
+
+UPDATE_ORIGINAL_POSE  isn't   really  required,  but  is  here  for  debugging
+purposes. You can update the original  pose either by enabling this feature or
+by explicitely calling IKSolver::ApplySceneToOriginalPose.
+
+\subsection iksolverconstraints CONSTRAINTS
+
+This feature is not yet implemented and is planned for a future release.
+
 \page UI User interface
 
 Urho3D implements a simple, hierarchical user interface system based on rectangular elements. The elements provided are:
@@ -2234,6 +2516,18 @@ For FreeType fonts, it is possible to adjust the positioning of the font glyphs.
 </font>
 \endcode
 
+The \ref UI "UI" class has various global configuration options for font rendering. The default settings are similar to Windows-style rendering, with crisp characters but uneven spacing. For macOS-style rendering, with accurate spacing but slightly blurrier outlines, call \ref UI::SetFontHintLevel "UI::SetFontHintLevel(FONT_HINT_LEVEL_NONE)". Use the Typography sample to explore these options and find the best configuration for your game.
+
+By default, outline fonts will be hinted (aligned to pixel boundaries), using the font's embedded hints if possible. Call \ref UI::SetForceAutoHint "SetForceAutoHint()" to use FreeType's standard auto-hinter rather than each font's embedded hints.
+
+To adjust hinting, call \ref UI::SetFontHintLevel "SetFontHintLevel()". If the level is set to FONT_HINT_LEVEL_LIGHT, fonts will be aligned to the pixel grid vertically, but not horizontally. At FONT_HINT_LEVEL_NONE, hinting is completely disabled.
+
+Hint levels LIGHT and NONE allow for subpixel glyph positioning, which greatly improves spacing, especially at small font sizes. By default, subpixel positioning is only used at sizes up to 12 points; at larger sizes, each glyph is pixel-aligned. Call \ref UI::SetFontSubpixelThreshold "SetFontSubpixelThreshold" to change this threshold.
+
+When textures aren't pixel-aligned, bilinear texture filtering makes them appear blurry. Therefore, subpixel font textures are oversampled (stretched horizontally) to reduce this blurriness, at the cost of extra memory usage. By default, subpixel fonts use 2x oversampling. Call \ref UI::SetFontOversampling "SetFontOversampling" to change this.
+
+Subpixel positioning only operates horizontally. %Text is always pixel-aligned vertically.
+
 \section UI_Sprites Sprites
 
 Sprites are a special kind of %UI element that allow subpixel (float) positioning and scaling, as well as rotation, while the other elements use integer positioning for pixel-perfect display. Sprites can be used to implement rotating HUD elements such as minimaps or speedometer needles.
@@ -3481,17 +3775,17 @@ byte[]     Bytecode, produced by AngelScript serializer
 
 - Indents use 4 spaces instead of tabs. Indents on empty lines should not be kept.
 
-- Class and struct names are in camelcase beginning with an uppercase letter. They should be nouns. For example %DebugRenderer, FreeTypeLibrary, %Graphics.
+- Class and struct names are in camelcase beginning with an uppercase letter. They should be nouns. For example \c %DebugRenderer, \c FreeTypeLibrary, \c %Graphics.
 
-- Functions are likewise in upper-camelcase. For example CreateComponent, SetLinearRestThreshold.
+- Functions are likewise in upper-camelcase. For example \c CreateComponent, \c SetLinearRestThreshold.
 
-- Variables are in lower-camelcase. Member variables have an underscore appended. For example numContacts, randomSeed_.
+- Variables are in lower-camelcase. Member variables have an underscore appended. For example \c numContacts, \c randomSeed_.
 
-- Constants and enumerations are in uppercase. For example %Vector3::ZERO or PASS_SHADOW.
+- Constants and enumerations are in uppercase. For example \c %Vector3::ZERO or \c PASS_SHADOW.
 
-- Pointers and references append the * or & symbol to the type without a space in between. For example Drawable* drawable, %Serializer& dest.
+- Pointers and references append the * or & symbol to the type without a space in between. For example \c Drawable* drawable, \c %Serializer& dest.
 
-- The macro NULL should not be used, 0 is used instead.
+- The macro \c NULL and 0 should not be used for null pointers, \c nullptr is used instead.
 
 - Class definitions proceed in the following order:
   - public constructors and the destructor
@@ -3506,6 +3800,31 @@ byte[]     Bytecode, produced by AngelScript serializer
 
 - Inline functions are defined inside the class definitions where possible, without using the inline keyword.
 
+Keep contributions consistent with existing code unless wide scale refactoring is performed.
+Follow this guideline to keep code style consistent among contributions and contributors:
+
+- Use \c override wherever possible.
+
+- Prefer inplace member initialization to initializer lists.
+
+- Prefer \c using to \c typedef type declarations.
+
+- Prefer range-based \c for to old style \c for unless index or iterator is used by itself.
+
+- Avoid \c enum \c class to keep Urho API consistent. TODO: Perform API-breaking migration to \c enum \c class?
+
+- Avoid \c auto unless it increases code readability.
+
+- Use \c auto for verbose, unknown or redundant types. Example:
+  \code
+  auto iter = variables.Find(name); // verbose iterator type: HashMap<String, Variant>::Iterator
+  for (auto& variable : variables) { } // verbose pair type: HashMap<String, Variant>::KeyValue
+  auto model = MakeShared<Model>(context_); // type is already mentioned in the expression: SharedPtr<Model>
+  \endcode
+  See https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-auto.html and https://google.github.io/styleguide/cppguide.html#auto
+
+- Use \c auto instead of manual type deduction via \c decltype and \c typename.
+
 \page ContributionChecklist Contribution checklist
 
 When contributing code to the Urho3D project, there are a few things to check so that the process goes smoothly.
@@ -3544,8 +3863,6 @@ Third, there are requirements for new code that come from Urho3D striving to be
 
 - Prefer small and well-focused libraries for the Urho3D runtime. For example we use stb_image instead of FreeImage to load images, as it's assumed that the application developer can control the data and do offline conversion to supported formats as necessary.
 
-- For libraries that would be mandatorily part of the Urho3D build (not switchable off via CMake options), use of C++11 features is not yet acceptable. The same applies to your own code.
-
 - Third-party libraries should not leak C++ exceptions or use of STL containers into the Urho3D public API. Do a wrapping for example on the subsystem level if necessary.
 */
 

+ 143 - 81
Docs/ScriptAPI.dox

@@ -306,6 +306,20 @@ namespace Urho3D
 - %BoundsMin : Vector3
 - %BoundsMax : Vector3
 
+### NavigationTileAdded
+- %Node : Node pointer
+- %Mesh : NavigationMesh pointer
+- %Tile : IntVector2
+
+### NavigationTileRemoved
+- %Node : Node pointer
+- %Mesh : NavigationMesh pointer
+- %Tile : IntVector2
+
+### NavigationAllTilesRemoved
+- %Node : Node pointer
+- %Mesh : NavigationMesh pointer
+
 ### CrowdAgentFormation
 - %Node : Node pointer
 - %CrowdAgent : CrowdAgent pointer
@@ -1536,11 +1550,6 @@ namespace Urho3D
 - %Max %Layers : int
 - %Draw %Obstacles : bool
 
-### IKConstraint
-- %Stiffness : float
-- %Stretchiness : float
-- %Length %Constraints : Vector2
-
 ### IKEffector
 - %Target %Node : String
 - %Chain %Length : int
@@ -1556,10 +1565,12 @@ namespace Urho3D
 - %Algorithm : int
 - %Max %Iterations : int
 - %Convergence %Tolerance : float
-- %Bone %Rotations : bool
-- %Target %Rotation : bool
-- %Continuous %Solving : bool
-- %Update %Pose : bool
+- %Joint %Rotations : bool
+- %Target %Rotations : bool
+- %Update %Original %Pose : bool
+- %Update %Active %Pose : bool
+- %Use %Original %Pose : bool
+- %Enable %Constraints : bool
 - %Auto %Solve : bool
 
 ### Light
@@ -2724,7 +2735,6 @@ namespace Urho3D
 <a href="#Class_Geometry"><b>Geometry</b></a>
 <a href="#Class_Graphics"><b>Graphics</b></a>
 <a href="#Class_HttpRequest"><b>HttpRequest</b></a>
-<a href="#Class_IKConstraint"><b>IKConstraint</b></a>
 <a href="#Class_IKEffector"><b>IKEffector</b></a>
 <a href="#Class_IKSolver"><b>IKSolver</b></a>
 <a href="#Class_Image"><b>Image</b></a>
@@ -2844,6 +2854,7 @@ namespace Urho3D
 <a href="#Class_ToolTip"><b>ToolTip</b></a>
 <a href="#Class_TouchState"><b>TouchState</b></a>
 <a href="#Class_UI"><b>UI</b></a>
+<a href="#Class_UIComponent"><b>UIComponent</b></a>
 <a href="#Class_UIElement"><b>UIElement</b></a>
 <a href="#Class_ValueAnimation"><b>ValueAnimation</b></a>
 <a href="#Class_Variant"><b>Variant</b></a>
@@ -3409,10 +3420,10 @@ Properties:
 
 - Variant defaultValue
 - String[]@ enumNames // readonly
+- VariantMap metadata
 - uint mode
 - String name
 - VariantType type
-- String[]@ variantStructureElementNames // readonly
 
 <a name="Class_Audio"></a>
 
@@ -3774,6 +3785,7 @@ Methods:
 - void Define(const Vector3&, const Vector3&)
 - void Define(float, float)
 - bool Defined() const
+- float DistanceToPoint(const Vector3&) const
 - Intersection IsInside(const BoundingBox&) const
 - Intersection IsInside(const Sphere&) const
 - Intersection IsInside(const Vector3&) const
@@ -6458,6 +6470,7 @@ Methods:
 - void AddQuad(const Vector3&, float, float, const Color&, bool = true)
 - void AddSkeleton(Skeleton@, const Color&, bool = true)
 - void AddSphere(const Sphere&, const Color&, bool = true)
+- void AddSphereSector(const Sphere&, const Quaternion&, float, bool, const Color&, bool = true)
 - void AddTriangle(const Vector3&, const Vector3&, const Vector3&, const Color&, bool = true)
 - void ApplyAttributes()
 - void DrawDebugGeometry(DebugRenderer@, bool)
@@ -6639,6 +6652,8 @@ Methods:
 - Vector4 ReadVector4()
 - VectorBuffer ReadVectorBuffer(uint)
 - uint Seek(uint)
+- uint SeekRelative(int)
+- uint Tell() const
 
 Properties:
 
@@ -7042,9 +7057,12 @@ Properties:
 
 Methods:
 
+- bool AddTile(const VectorBuffer&) const
+- bool Allocate(const BoundingBox&, uint)
 - void ApplyAttributes()
 - bool Build()
 - bool Build(const BoundingBox&)
+- bool Build(const IntVector2&, const IntVector2&)
 - void DrawDebugGeometry(DebugRenderer@, bool)
 - void DrawDebugGeometry(bool)
 - Vector3 FindNearestPoint(const Vector3&, const Vector3& = Vector3 ( 1.0 , 1.0 , 1.0 ))
@@ -7060,8 +7078,12 @@ Methods:
 - bool GetInterceptNetworkUpdate(const String&) const
 - Vector3 GetRandomPoint()
 - Vector3 GetRandomPointInCircle(const Vector3&, float, const Vector3& = Vector3 ( 1.0 , 1.0 , 1.0 ))
+- BoundingBox GetTileBoudningBox(const IntVector2&) const
+- VectorBuffer GetTileData(const IntVector2&) const
+- IntVector2 GetTileIndex(const Vector3&) const
 - bool HasSubscribedToEvent(Object@, const String&)
 - bool HasSubscribedToEvent(const String&)
+- bool HasTile(const IntVector2&) const
 - bool Load(File@, bool = false)
 - bool Load(VectorBuffer&, bool = false)
 - bool LoadJSON(const JSONValue&, bool = false)
@@ -7070,9 +7092,11 @@ Methods:
 - Vector3 MoveAlongSurface(const Vector3&, const Vector3&, const Vector3& = Vector3 ( 1.0 , 1.0 , 1.0 ), int = 3)
 - Vector3 Raycast(const Vector3&, const Vector3&, const Vector3& = Vector3 ( 1.0 , 1.0 , 1.0 ))
 - void Remove()
+- void RemoveAllTiles()
 - void RemoveAttributeAnimation(const String&)
 - void RemoveInstanceDefault()
 - void RemoveObjectAnimation()
+- void RemoveTile(const IntVector2&)
 - void ResetToDefault()
 - bool Save(File@) const
 - bool Save(VectorBuffer&) const
@@ -7210,7 +7234,9 @@ Methods:
 - Vector4 ReadVector4()
 - VectorBuffer ReadVectorBuffer(uint)
 - uint Seek(uint)
+- uint SeekRelative(int)
 - void SendEvent(const String&, VariantMap& = VariantMap ( ))
+- uint Tell() const
 - uint Write(uint8[]@)
 - bool WriteBool(bool)
 - bool WriteBoundingBox(const BoundingBox&)
@@ -7544,6 +7570,8 @@ Methods:
 - Vector4 ReadVector4()
 - VectorBuffer ReadVectorBuffer(uint)
 - uint Seek(uint)
+- uint SeekRelative(int)
+- uint Tell() const
 
 Properties:
 
@@ -7561,65 +7589,6 @@ Properties:
 - String verb // readonly
 - int weakRefs // readonly
 
-<a name="Class_IKConstraint"></a>
-
-### IKConstraint
-
-Methods:
-
-- void ApplyAttributes()
-- void DrawDebugGeometry(DebugRenderer@, bool)
-- Variant GetAttribute(const String&) const
-- ValueAnimation@ GetAttributeAnimation(const String&) const
-- float GetAttributeAnimationSpeed(const String&) const
-- float GetAttributeAnimationTime(const String&) const
-- WrapMode GetAttributeAnimationWrapMode(const String&) const
-- Variant GetAttributeDefault(const String&) const
-- bool GetInterceptNetworkUpdate(const String&) const
-- bool HasSubscribedToEvent(Object@, const String&)
-- bool HasSubscribedToEvent(const String&)
-- bool Load(File@, bool = false)
-- bool Load(VectorBuffer&, bool = false)
-- bool LoadJSON(const JSONValue&, bool = false)
-- bool LoadXML(const XMLElement&, bool = false)
-- void MarkNetworkUpdate() const
-- void Remove()
-- void RemoveAttributeAnimation(const String&)
-- void RemoveInstanceDefault()
-- void RemoveObjectAnimation()
-- void ResetToDefault()
-- bool Save(File@) const
-- bool Save(VectorBuffer&) const
-- bool SaveJSON(JSONValue&) const
-- bool SaveXML(XMLElement&) const
-- void SendEvent(const String&, VariantMap& = VariantMap ( ))
-- void SetAnimationTime(float)
-- bool SetAttribute(const String&, const Variant&)
-- void SetAttributeAnimation(const String&, ValueAnimation@, WrapMode = WM_LOOP, float = 1.0f)
-- void SetAttributeAnimationSpeed(const String&, float)
-- void SetAttributeAnimationTime(const String&, float)
-- void SetAttributeAnimationWrapMode(const String&, WrapMode)
-- void SetInterceptNetworkUpdate(const String&, bool)
-
-Properties:
-
-- bool animationEnabled
-- Variant[] attributeDefaults // readonly
-- AttributeInfo[] attributeInfos // readonly
-- Variant[] attributes
-- String category // readonly
-- bool enabled
-- bool enabledEffective // readonly
-- uint id // readonly
-- Node@ node // readonly
-- uint numAttributes // readonly
-- ObjectAnimation@ objectAnimation
-- int refs // readonly
-- bool temporary
-- StringHash type // readonly
-- String typeName // readonly
-- int weakRefs // readonly
-
 <a name="Class_IKEffector"></a>
 
 ### IKEffector
@@ -7672,7 +7641,6 @@ Properties:
 - bool enabled
 - bool enabledEffective // readonly
 - uint id // readonly
-- bool inheritParentRotation
 - Node@ node // readonly
 - uint numAttributes // readonly
 - ObjectAnimation@ objectAnimation
@@ -7688,7 +7656,6 @@ Properties:
 - String typeName // readonly
 - int weakRefs // readonly
 - float weight
-- bool weightedNlerp
 
 <a name="Class_IKSolver"></a>
 
@@ -7696,7 +7663,13 @@ Properties:
 
 Methods:
 
+- void ApplyActivePoseToScene()
 - void ApplyAttributes()
+- void ApplyOriginalPoseToActivePose()
+- void ApplyOriginalPoseToScene()
+- void ApplySceneToActivePose()
+- void ApplySceneToInitialPose()
+- void CalculateJointRotations()
 - void DrawDebugGeometry(DebugRenderer@, bool)
 - void DrawDebugGeometry(bool)
 - Variant GetAttribute(const String&) const
@@ -7713,12 +7686,13 @@ Methods:
 - bool LoadJSON(const JSONValue&, bool = false)
 - bool LoadXML(const XMLElement&, bool = false)
 - void MarkNetworkUpdate() const
+- void RebuildChainTrees()
+- void RecalculateSegmentLengths()
 - void Remove()
 - void RemoveAttributeAnimation(const String&)
 - void RemoveInstanceDefault()
 - void RemoveObjectAnimation()
 - void ResetToDefault()
-- void ResetToInitialPose()
 - bool Save(File@) const
 - bool Save(VectorBuffer&) const
 - bool SaveJSON(JSONValue&) const
@@ -7732,19 +7706,22 @@ Methods:
 - void SetAttributeAnimationWrapMode(const String&, WrapMode)
 - void SetInterceptNetworkUpdate(const String&, bool)
 - void Solve()
-- void UpdateInitialPose()
 
 Properties:
 
+- bool AUTO_SOLVE
+- bool CONSTRAINTS
+- bool JOINT_ROTATIONS
+- bool TARGET_ROTATIONS
+- bool UPDATE_ACTIVE_POSE
+- bool UPDATE_ORIGINAL_POSE
+- bool USE_ORIGINAL_POSE
 - IKAlgorithm algorithm
 - bool animationEnabled
 - Variant[] attributeDefaults // readonly
 - AttributeInfo[] attributeInfos // readonly
 - Variant[] attributes
-- bool autoSolve
-- bool boneRotations
 - String category // readonly
-- bool continuousSolving
 - bool enabled
 - bool enabledEffective // readonly
 - uint id // readonly
@@ -7753,12 +7730,10 @@ Properties:
 - uint numAttributes // readonly
 - ObjectAnimation@ objectAnimation
 - int refs // readonly
-- bool targetRotation
 - bool temporary
 - float tolerance
 - StringHash type // readonly
 - String typeName // readonly
-- bool updatePose
 - int weakRefs // readonly
 
 <a name="Class_Image"></a>
@@ -7794,6 +7769,7 @@ Methods:
 - bool SaveJPG(const String&, int) const
 - bool SavePNG(const String&) const
 - bool SaveTGA(const String&) const
+- bool SaveWEBP(const String&, float = 0.0f) const
 - void SendEvent(const String&, VariantMap& = VariantMap ( ))
 - void SetPixel(int, int, const Color&)
 - void SetPixel(int, int, int, const Color&)
@@ -7929,7 +7905,9 @@ Properties:
 
 Methods:
 
+- int Clip(const IntRect&)
 - Intersection IsInside(const IntVector2&) const
+- int Merge(const IntRect&)
 
 Properties:
 
@@ -9157,7 +9135,9 @@ Methods:
 - Vector4 ReadVector4()
 - VectorBuffer ReadVectorBuffer(uint)
 - uint Seek(uint)
+- uint SeekRelative(int)
 - void SendEvent(const String&, VariantMap& = VariantMap ( ))
+- uint Tell() const
 - uint Write(uint8[]@)
 - bool WriteBool(bool)
 - bool WriteBoundingBox(const BoundingBox&)
@@ -9336,9 +9316,12 @@ Properties:
 
 Methods:
 
+- bool AddTile(const VectorBuffer&) const
+- bool Allocate(const BoundingBox&, uint)
 - void ApplyAttributes()
 - bool Build()
 - bool Build(const BoundingBox&)
+- bool Build(const IntVector2&, const IntVector2&)
 - void DrawDebugGeometry(DebugRenderer@, bool)
 - void DrawDebugGeometry(bool)
 - Vector3 FindNearestPoint(const Vector3&, const Vector3& = Vector3 ( 1.0 , 1.0 , 1.0 ))
@@ -9354,8 +9337,12 @@ Methods:
 - bool GetInterceptNetworkUpdate(const String&) const
 - Vector3 GetRandomPoint()
 - Vector3 GetRandomPointInCircle(const Vector3&, float, const Vector3& = Vector3 ( 1.0 , 1.0 , 1.0 ))
+- BoundingBox GetTileBoudningBox(const IntVector2&) const
+- VectorBuffer GetTileData(const IntVector2&) const
+- IntVector2 GetTileIndex(const Vector3&) const
 - bool HasSubscribedToEvent(Object@, const String&)
 - bool HasSubscribedToEvent(const String&)
+- bool HasTile(const IntVector2&) const
 - bool Load(File@, bool = false)
 - bool Load(VectorBuffer&, bool = false)
 - bool LoadJSON(const JSONValue&, bool = false)
@@ -9364,9 +9351,11 @@ Methods:
 - Vector3 MoveAlongSurface(const Vector3&, const Vector3&, const Vector3& = Vector3 ( 1.0 , 1.0 , 1.0 ), int = 3)
 - Vector3 Raycast(const Vector3&, const Vector3&, const Vector3& = Vector3 ( 1.0 , 1.0 , 1.0 ))
 - void Remove()
+- void RemoveAllTiles()
 - void RemoveAttributeAnimation(const String&)
 - void RemoveInstanceDefault()
 - void RemoveObjectAnimation()
+- void RemoveTile(const IntVector2&)
 - void ResetToDefault()
 - bool Save(File@) const
 - bool Save(VectorBuffer&) const
@@ -10882,6 +10871,7 @@ Properties:
 Methods:
 
 - void DrawDebugGeometry(bool) const
+- Viewport@ GetViewportForScene(Scene@, uint)
 - bool HasSubscribedToEvent(Object@, const String&)
 - bool HasSubscribedToEvent(const String&)
 - void ReloadShaders() const
@@ -12724,6 +12714,8 @@ Methods:
 - void Define(const Vector3&, float)
 - bool Defined() const
 - float Distance(const Vector3&) const
+- Vector3 GetLocalPoint(float, float) const
+- Vector3 GetPoint(float, float) const
 - Intersection IsInside(const BoundingBox&) const
 - Intersection IsInside(const Sphere&) const
 - Intersection IsInside(const Vector3&) const
@@ -13480,6 +13472,7 @@ Methods:
 - TerrainPatch@ GetPatch(int, int) const
 - bool HasSubscribedToEvent(Object@, const String&)
 - bool HasSubscribedToEvent(const String&)
+- Vector3 HeightMapToWorld(const IntVector2&) const
 - bool Load(File@, bool = false)
 - bool Load(VectorBuffer&, bool = false)
 - bool LoadJSON(const JSONValue&, bool = false)
@@ -13702,7 +13695,7 @@ Methods:
 - void SetFixedSize(int, int)
 - void SetFixedWidth(int)
 - bool SetFont(Font@, float)
-- bool SetFont(const String&, int)
+- bool SetFont(const String&, float)
 - void SetInterceptNetworkUpdate(const String&, bool)
 - void SetLayout(LayoutMode, int = 0, const IntRect& = IntRect ( 0 , 0 , 0 , 0 ))
 - void SetMaxAnchor(float, float)
@@ -14260,6 +14253,7 @@ Methods:
 - Variant GetAttributeDefault(const String&) const
 - bool GetInterceptNetworkUpdate(const String&) const
 - TileMapLayer2D@ GetLayer(uint) const
+- TileMapObject2D@[]@ GetTileCollisionShapes(int) const
 - bool HasSubscribedToEvent(Object@, const String&)
 - bool HasSubscribedToEvent(const String&)
 - bool Load(File@, bool = false)
@@ -14710,6 +14704,8 @@ Properties:
 - float dragBeginInterval
 - UIElement@ focusElement
 - FontHintLevel fontHintLevel
+- int fontOversampling
+- float fontSubpixelThreshold
 - bool forceAutoHint
 - UIElement@ frontElement // readonly
 - int maxFontTextureSize
@@ -14718,7 +14714,6 @@ Properties:
 - int refs // readonly
 - UIElement@ root // readonly
 - float scale
-- bool subpixelGlyphPositions
 - StringHash type // readonly
 - String typeName // readonly
 - bool useMutableGlyphs
@@ -14726,6 +14721,67 @@ Properties:
 - bool useSystemClipboard
 - int weakRefs // readonly
 
+<a name="Class_UIComponent"></a>
+
+### UIComponent
+
+Methods:
+
+- void ApplyAttributes()
+- Variant GetAttribute(const String&) const
+- ValueAnimation@ GetAttributeAnimation(const String&) const
+- float GetAttributeAnimationSpeed(const String&) const
+- float GetAttributeAnimationTime(const String&) const
+- WrapMode GetAttributeAnimationWrapMode(const String&) const
+- Variant GetAttributeDefault(const String&) const
+- bool GetInterceptNetworkUpdate(const String&) const
+- bool HasSubscribedToEvent(Object@, const String&)
+- bool HasSubscribedToEvent(const String&)
+- bool Load(File@, bool = false)
+- bool Load(VectorBuffer&, bool = false)
+- bool LoadJSON(const JSONValue&, bool = false)
+- bool LoadXML(const XMLElement&, bool = false)
+- void MarkNetworkUpdate() const
+- void Remove()
+- void RemoveAttributeAnimation(const String&)
+- void RemoveInstanceDefault()
+- void RemoveObjectAnimation()
+- void ResetToDefault()
+- bool Save(File@) const
+- bool Save(VectorBuffer&) const
+- bool SaveJSON(JSONValue&) const
+- bool SaveXML(XMLElement&) const
+- void SendEvent(const String&, VariantMap& = VariantMap ( ))
+- void SetAnimationTime(float)
+- bool SetAttribute(const String&, const Variant&)
+- void SetAttributeAnimation(const String&, ValueAnimation@, WrapMode = WM_LOOP, float = 1.0f)
+- void SetAttributeAnimationSpeed(const String&, float)
+- void SetAttributeAnimationTime(const String&, float)
+- void SetAttributeAnimationWrapMode(const String&, WrapMode)
+- void SetInterceptNetworkUpdate(const String&, bool)
+
+Properties:
+
+- bool animationEnabled
+- Variant[] attributeDefaults // readonly
+- AttributeInfo[] attributeInfos // readonly
+- Variant[] attributes
+- String category // readonly
+- bool enabled
+- bool enabledEffective // readonly
+- uint id // readonly
+- Material@ material // readonly
+- Node@ node // readonly
+- uint numAttributes // readonly
+- ObjectAnimation@ objectAnimation
+- int refs // readonly
+- UIElement@ root // readonly
+- bool temporary
+- Texture2D@ texture // readonly
+- StringHash type // readonly
+- String typeName // readonly
+- int weakRefs // readonly
+
 <a name="Class_UIElement"></a>
 
 ### UIElement
@@ -15140,7 +15196,9 @@ Methods:
 - VectorBuffer ReadVectorBuffer(uint)
 - void Resize(uint)
 - uint Seek(uint)
+- uint SeekRelative(int)
 - void SetData(Deserializer@, uint)
+- uint Tell() const
 - uint Write(uint8[]@)
 - bool WriteBool(bool)
 - bool WriteBoundingBox(const BoundingBox&)
@@ -16159,6 +16217,8 @@ Properties:
 
 ### IKAlgorithm
 
+- ONE_BONE
+- TWO_BONE
 - FABRIK
 
 
@@ -16539,6 +16599,7 @@ Properties:
 - VectorBuffer CompressVectorBuffer(VectorBuffer&)
 - float Cos(float)
 - uint CountSetBits(uint)
+- Object@ CreateObject(const String&)
 - VectorBuffer DecompressVectorBuffer(VectorBuffer&)
 - void DelayedExecute(float, bool, const String&, const Variant[]@ = null)
 - bool Equals(float, float)
@@ -16601,6 +16662,7 @@ Properties:
 - String Join(String[]&, const String&)
 - float Lerp(float, float, float)
 - float Ln(float)
+- uint LogBaseTwo(uint)
 - void MarkNetworkUpdate()
 - float Max(float, float)
 - int Max(int, int)

+ 269 - 2
Docs/Urho3D.dox

@@ -34,6 +34,7 @@ For further reference, see:
 \ref Audio "Audio" <br>
 \ref Physics "Physics" <br>
 \ref Navigation "Navigation" <br>
+\ref IK "Inverse Kinematics" <br>
 \ref UI "User interface" <br>
 \ref Urho2D "Urho2D" <br>
 \ref Serialization "Serialization" <br>
@@ -79,6 +80,8 @@ Urho3D development, contributions and bugfixes by:
 - Pete Chown
 - Christian Clavet
 - Sebastian Delatorre (primitivewaste)
+- Stanislav Demyanovich
+- Rainer Deyke
 - Josh Engebretson
 - Simon Flores
 - Manuel Freiberger
@@ -109,6 +112,7 @@ Urho3D development, contributions and bugfixes by:
 - Nathanial Lydick
 - Xavier Maupeu
 - Iain Merrick
+- Justin Miller
 - Jonne Nauha
 - Huy Nguyen
 - Paul Noome
@@ -226,13 +230,14 @@ Urho3D uses the following third-party libraries:
 - rapidjson 1.1.0 (https://github.com/miloyip/rapidjson)
 - Recast/Detour (https://github.com/memononen/recastnavigation)
 - SDL 2.0.5 (https://www.libsdl.org)
-- SQLite 3.18.0 (https://www.sqlite.org)
+- SQLite 3.20.1 (https://www.sqlite.org)
 - StanHull (https://codesuppository.blogspot.com/2006/03/john-ratcliffs-code-suppository-blog.html)
 - stb_image 2.12 (https://nothings.org)
 - stb_image_write 1.02 (https://nothings.org)
 - stb_rect_pack 0.08 (https://nothings.org)
 - stb_vorbis 1.09 (https://nothings.org)
 - tolua++ 1.0.93 (defunct - http://www.codenix.com/~tolua)
+- WebP (https://chromium.googlesource.com/webm/libwebp)
 
 DXT / ETC1 / PVRTC decompression code based on the Squish library and the Oolong %Engine.<br>
 Jack and mushroom models from the realXtend project. (https://www.realxtend.org)<br>
@@ -260,6 +265,263 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
 
 \page History History
 
+V1.7
+
+- Inverse kinematics support.
+- Bullet %RaycastVehicle support.
+- AppleTV platform support.
+- WebAssembly support on the Web platform.
+- IME support on Linux platform.
+- Several font rendering improvements and TypoGraphy sample.
+- WebP image loading support.
+- Sparse navigation meshes and navmesh streaming support.
+- AutoRemove bool removed. Replaced with more general AutoRemoveMode mechanism.
+- Free functions supported in attribute accessors.
+- %IntVector3 class.
+- %EnumAttributeAccessorImpl is now compatible with enum classes.
+- Use default continuous physics & substepping values for Box2D world.
+- Node-specific 2D physics collision events.
+- Improved Box2D joint handling.
+- Use GetDerivedComponent() when getting %PhysicsWorld2D to allow subclassing it. %PhysicsWorld2D members no longer private also for this reason.
+- ApplyLinearImpulseToCenter() function in %RigidBody2D.
+- Additional info exposed in 2D physics events.
+- %CollisionShape2D scale allowed to be signed.
+- Refactor %PhysicsWorld2D contact info.
+- %ParticleEmitter2D can be made to stop / restart emitting.
+- CSV and base64 encoding options when loading TMX files.
+- Several tilemap / TMX file improvements.
+- Improved convex hull debug draw.
+- Bool & int shader parameters on D3D11 / OpenGL.
+- Maximum extrusion distance for directional light shadows.
+- %Shader compilation defines added to materials.
+- %Shader compilation defines added to renderpath commands.
+- %Shader compilation define exclusion mechanism in %Pass.
+- Multisampled rendertargets.
+- Mipmapped rendertargets.
+- Alpha-to-coverage can be enabled in pass or material. Requires D3D11 or OpenGL.
+- Line antialiasing support.
+- Optional soft particles support.
+- Improve VSM shadows by moving z/w divide to pixel shader.
+- Anisotropic-nearest filtering mode, when supported.
+- Optional per-texture max anisotropy setting.
+- Physical light values support.
+- Area light support.
+- Multisample option for VSM shadows.
+- %Shader cache location is configurable, and defaults to a user-writable directory.
+- %Renderer events for screen buffer allocation & global shader parameters having been set.
+- %Renderer event for all views having been rendered.
+- %DecalSet optionally sizes vertex & index buffer only based on use.
+- New face camera mode in %BillboardSet & %Text3D.
+- Support defining neighbor terrains to avoid LOD discontinuities.
+- %AnimationController internal control structures can be accessed as part of its public API.
+- %AnimationController can be queried if any animation is playing on a layer.
+- Allow to get animation tracks by index.
+- Custom projection matrix support.
+- Implement GetMultiSampleLevels() on OpenGL.
+- Monitor and refresh rate options for %Graphics::SetMode().
+- Allow unclamped morph weights.
+- Static helper function for calculating %VertexBuffer element offsets.
+- %Model metadata support.
+- PBR improvements.
+- Clean up PBR shaders & techniques; do not require tangents in PBR shaders unless using normal mappings.
+- Possibility to set mouse mode or visibility before %Input class initialization.
+- Mouse centering / position setting moved to %Input public API.
+- Seek method for audio streams.
+- Anchors and pivots can optionally be specified for %UI elements.
+- %ProgressBar %UI element added.
+- %UI root element custom size support.
+- %UIElement child XML loading returns created child instead of success bool.
+- Add delta parameter to %UI element resize event.
+- SDF font supersampling.
+- FontType enum exposed to public API.
+- NAVIGATIONPUSHINESS_NONE mode in %CrowdAgent.
+- %NavArea solid debug geometry.
+- To/from string conversions in %JSONValueType / %JSONNumberType.
+- Add function to test for %Rect / %Rect intersection.
+- Resize overloads in %Vector / %PODVector.
+- Remove ineffective static %TypeInfo checking functions.
+- %Node & %UIElement child query function overloads that return a collection.
+- %Node IsChildOf() function.
+- Temporary parameter added to %Node CreateChild() function.
+- %Sprite2D can define its draw & texture rectangles.
+- %UniquePtr class.
+- Several math API functions added.
+- Stable random generator added.
+- Add FloatToRawIntBits function.
+- %Variant can hold %Rect objects.
+- %Variant can hold 64-bit integers.
+- Mipmap manipulation support in %Image.
+- %Image class SaveDDS() function.
+- %Text3D GetHeight() function.
+- %Console auto-completion.
+- %Console text highlighting according to message type.
+- %XMLFile GetOrCreateRoot() function, and %XMLElement GetOrCreateChild() function.
+- Urho3DPlayer attempts to read CommandLine.txt from resource system on all platforms, if cannot read from filesystem.
+- Improve use of SDL_Init() so that %Context keeps track of initialized SDL subsystems.
+- IES cookie generation in RampGenerator.
+- %AbstractFile as a parent class for those that implement both %Serializer & %Deserializer.
+- Allow specifying child node by name in attribute animation paths.
+- Functions to get rotation axis & angle in %Quaternion.
+- Improved AngelScript API dump.
+- Consts exposed to AngelScript API.
+- OS query functions added to ProcessUtils.
+- Add resource to cache before sending background load event.
+- Prevent sending event to subscribers added during event handling.
+- Prevent rendering of unnecessary shadow maps.
+- Prevent rendering of deferred light volumes which would be masked out due to lightmask being only 8-bit in deferred rendering.
+- Move "cold" parts of %Node into %NodeImpl class to improve performance.
+- Populate rapidjson value before adding to parent.
+- Update to AngelScript 2.31.2.
+- Update to FreeType 2.7.1.
+- Update to SQLite 3.18.0.
+- Update to LibCpuId 0.4.0.
+- Update to Box2D 2.3.2.
+- Update to Assimp 3.2.
+- Update to LZ4 1.7.5.
+- Update to Bullet 2.86.1.
+- Build system: ensure empty CMAKE_OSX_DEPLOYMENT_TARGET on iOS build.
+- Build system: auto-disable PCH on Android Clang build.
+- Build system: prefer CMake's regex instead of grep.
+- Build system: turn off PCH on bad ccache version.
+- Build system: Bash on Ubuntu on Windows -support.
+- Build system: work around MinGW 6.1.0 linking issue.
+- Build system: MinGW 6.1.0+ fix (narrowing conversion / internal compiler error.)
+- Build system: consider MinGW as multilib compiler.
+- Build system: make URHO3D_64BIT option applicable on MinGW.
+- Build system: use absolute output path for MinGW sysroot auto-detection.
+- Build system: fix Wayland build.
+- Build system: autodetect availability of clock_gettime() on Apple platforms.
+- Build system: fix package metadata for RPI & ARM platforms.
+- Build system: fix Urho3DAll.h generation in non out-of-source build.
+- Build system: avoid special chars in paths in MRI script passed to ar utility (Web build.)
+- Build system: Always use export header for auto-discovering build options.
+- Build system: use -O2 option for MinGW release build
+- Build system: add option to control how to share resources on web platform.
+- Build system: check availability of native compiler toolchain.
+- Build system: remove older CMake constructs that are no longer necessary.
+- Build system: new Android toolchain.
+- Build system: several Web build related improvements.
+- Build system: MODULE library type support option for Web build.
+- Build system: disable exception handling codegen for Web DEBUG build.
+- Build system: remove unused options from define_source_files() macro.
+- Build system: Prevent resource symlink creation during resource packaging.
+- Build system: Skip try_compile test when not appropriate (iOS debug build.)
+- Build system: use no_weak_imports linker flag.
+- Build system: workaround struct redefinition on newer MinGW.
+- Build system: search for DirectX path both rooted & non-rooted.
+- Build system: make clean for MinGW / Android / Web platforms.
+- Build system: enable multi-threaded compilation in Visual Studio.
+- Build system: fix mklink test when current path is not sources dir.
+- Build system: fix symlinked batch files not being launchable from Windows Explorer.
+- Build system: generate PCH files using naming convention expected by Clion.
+- Build system: generate dummy PCH only in out-of-source build tree.
+- Editor: do not attempt to parse extensionless files as XML.
+- Editor: draw navigation debug geometry.
+- Editor: prevent unnecessary attribute inspector refresh on resource reload.
+- Editor: allow drag-drop of generic XML files into attribute edit fields.
+- Editor: improved handling of structure attributes.
+- Editor: optimization to avoid updating temporary objects when they are not shown in hierarchy.
+- Editor: optimize update during object spawn.
+- Editor: paint selection.
+- Editor: show origins option.
+- Editor: fix %UI element internal var indexing so that editing user-defined variables works right.
+- Editor: restore window positions on viewport mode switch.
+- Editor: terrain editor.
+- Editor: color wheel for %Text3D.
+- Editor: double size on high DPI display.
+- Editor: fix resource browser node add/removal shown in hierarchy window.
+- Editor: fix resource browser preview camera position.
+- AssetImporter: possibility to export animation without skinned mesh.
+- AssetImporter: $fbx node suppression.
+- AssetImporter: fix animation start/end times when saving multiple animations.
+- AssetImporter: fix incorrect applying of model's root node transform.
+- Documentation: explain how to setup Windows MKLINK privilege.
+- Documentation: add section on scene graph events.
+- Documentation: explain EMSCRIPTEN_WASM build option.
+- Documentation: note on simultaneous network server & client usage.
+- Documentation: update on the define_resource_dirs() macro.
+- Documentation: do not include RapidJSON classes.
+- Documentation: inverse kinematics page.
+- Sample content: Kachujin model, used in SkeletalAnimation sample.
+- Sample content: new Urho3D logo.
+- Sample content: mutant model added to the CharacterDemo.
+- Sample content: Vertex colors in the standard primitive models.
+- Sample content: fix normals / lighting on the cylinder.
+- Sample content: Line primitive models.
+- Sample content: material preview model.
+- Fix broken off-mesh movement for %CrowdAgent.
+- Fix Bullet assert / crash when collision shape was changed from compound to non-compound.
+- Fix unintended update of wordwrapping text's width.
+- Fix uninitialized fields in %FontFaceBitmap.
+- Fix recreation of %CollisionChain2D shape.
+- Fix positioning of borderless window (if not filling the whole monitor.)
+- Fix %RigidBody2D not returning to original transform.
+- Fix copypaste error in %SpriteSheet2D load code.
+- Fix out-of-bounds text buffer access when compiling an AngelScript module.
+- Fix VariantMap to %JSONValue and back conversion.
+- Fix handling /./ in executable path in SanitateResourceName().
+- Fix crash if script object constructor throws.
+- Fix incorrect optimization in %UIElement::GetElementAt().
+- Fix potential crash when erasing sibling nodes during component destructor.
+- Fix blend modes for 2D particles.
+- Fix use of asGetActiveContext() in template code, as it could leak undesirably to user application and cause undefined symbol.
+- Fix jumping %Slider knob.
+- Fix AngelScript temp variable corruption and problem with handle-reference argument.
+- Fix %Constraint2D body connection serialization (other body nodeID.)
+- Fix instancing in vegetation shader.
+- Fix SDL keyboard input on RPI platform.
+- Fix fixed size billboard not properly realculating size in all cases.
+- Fix multisample quality handling on D3D11.
+- Fix %Text3D batches beyond the first not showing correctly.
+- Fix input scaling for high DPI displays.
+- Fix differentiation of alpha & RGBA textures in text shader.
+- Fix crash in usedGlyphs mode.
+- Fix zero sized %UI root element causing divide by zero.
+- Fix various missing script API functions.
+- Fix terrain UV coordinates generation.
+- Fix shader define update when %Text3D changes its rendering between SDF / non-SDF.
+- Fix erroneous fadeout of other %AnimationController animations, if playback of new animation failed.
+- Fix nearest filter mode not using mipmaps on OpenGOL.
+- Fix skinning matrix pointers changing erroneously after late creation of bones.
+- Fix %BillboardSet 16 bit indices limitation.
+- Fix %CrowdAgents getting erroneously included in navmesh geometry.
+- Fix calculation of %UI element combined screen rect.
+- Fix world space tangent for billboards.
+- Fix %ValueAnimation's time range not getting expanded by adding event frames.
+- Fix %ValueAnimation removal during event handling causing crash.
+- Fix word wrap text char positions.
+- Fix %WorkQueue item insertion; insert last if no other option possible.
+- Fix unnecessary mouse centering in screen mode change handling.
+- Fix unsafe removal of event receivers.
+- Fix string corruption in SQLite queries.
+- Fix error in skybox HLSL shader when instancing is forced on.
+- Fix erroneous reuse of backbuffer depth buffer when multisampling.
+- Fix uninitialized memory in %Material.
+- Fix out of bounds array access when material quality is higher than high.
+- Fix shadow-related shader function signatures on GLES.
+- Fix shaky water shader on GLES.
+- Fix memory leak in AngelScript Dictionary.
+- Fix weight fade erroneously affecting animation after weight was set manually.
+- Fix LookAt mixed rotation mode.
+- Fix skydome GLSL shader.
+- Fix depth bias not getting cloned in %Material::Clone().
+- Fix %CrowdAgent removal to be safe during reposition event.
+- Fix keeping track of %RigidBody2D constraints.
+- Fix double shader parameters passed from e.g. Lua, convert to float.
+- Fix navigation system obstacles not observing their scene node movement and updating themselves.
+- Fix self-insertion in %Vector.
+- Fix slowed down navigation agent when scene node dirtied during reposition event.
+- Fix slope-scale bias adjustment on OpenGL.
+- Fix incorrect hashing of rasterizer states on D3D11.
+- Fix %AnimationController animation search differentiating slash and backslash when it shouldn't.
+- Fix %LineEdit text & cursor not being centered by default.
+- Fix potential flipped normals in physics collisions (double manifold issue.)
+- Fix undefined __cpu_model symbol in shared lib on GCC.
+- Fix cache datatype for URHO3D_LIB_TYPE
+- Fix Android black screenshot (use RGBA format.)
+- Fix missing network update if node is added to the scene late.
+- Fix crash when setting model resource to drawable component that is not attached to a scene node.
+
 V1.6
 
 - Physically based rendering shaders, techniques, renderpaths and example materials / demo scene.
@@ -1077,7 +1339,7 @@ From 1.5 to 1.6:
 - Build system - the inclusion of Urho3D-CMake-common.cmake module into downstream project's CMakeLists.txt would implicitly instruct CMake to find all the required software packages, including Urho3D library. There is no need now for downstream's CMakeLists.txt to call "find_package (Urho3D)" explicitly, to avoid the Urho3D library from being searched twice. The enhanced FindUrho3D.cmake module now auto-discovers the build options used when building Urho3D library and reapply them to downstream projects. There is no need for users to remember and to supply the same set of build options when performing the initial configuration/generation of the downstream project's build tree.
 - Build system - the Urho3DAll.h header file is now auto-generated for downstream project that needs it. It is not a good practice though to use this "convenience header" as it would slow down the build process unnecessarily.
 
-From 1.6 to master:
+From 1.6 to 1.7:
 
 - SoundSource autoremove boolean was replaced with AutoRemoveMode enum, which allows removing either the component or owner node. Also used by ParticleEmitter.
 - Getting camera projection matrix has changed. Use GetProjection() to get the API-independent matrix, and GetGPUProjection() to get the matrix converted to be usable as a shader parameter. On D3D these are the same.
@@ -1101,6 +1363,11 @@ From 1.6 to master:
 - Build system - the "Urho3D-CMake-common.cmake" file is now renamed to "UrhoCommon.cmake".
 - Build system - downstream project is now responsible to add the HTML shell-file by calling the add_html_shell() macro or by passing "HTML_SHELL" option when calling the define_resource_dirs() in order to generate the HTML output when targeting Web platform, i.e. the build system defaults to JS output now, except when URHO3D_TESTING build option is set. When URHO3D_TESTING is set then it is assumed the output should be test runnable by using emrun, therefore the build system will automatically add the default HTML shell-file if none has been added yet.
 - Build system - when targeting macOS platform, the build tree will be configured to only target x86_64 arch by default as we are phasing out 32-bit mode. Use the URHO3D_UNIVERSAL build option, if you still want the universal binary build.
+
+From 1.7 to master:
+- URHO3D_CXX11 define was removed. C++11 mode is unconditionally enabled.
+- URHO3D_ACCESSOR_VARIANT_VECTOR_STRUCTURE_ATTRIBUTE and URHO3D_MIXED_ACCESSOR_VARIANT_VECTOR_STRUCTURE_ATTRIBUTE macros were removed. Use attribute metadata instead. Element names shall be stored in StringVector (without trailing zero) instead of const char*[].
+
 */
 
 }

+ 5 - 1
README.md

@@ -34,6 +34,8 @@ Urho3D development, contributions and bugfixes by:
 - Pete Chown
 - Christian Clavet
 - Sebastian Delatorre (primitivewaste)
+- Stanislav Demyanovich
+- Rainer Deyke
 - Josh Engebretson
 - Simon Flores
 - Manuel Freiberger
@@ -64,6 +66,7 @@ Urho3D development, contributions and bugfixes by:
 - Nathanial Lydick
 - Xavier Maupeu
 - Iain Merrick
+- Justin Miller
 - Jonne Nauha
 - Huy Nguyen
 - Paul Noome
@@ -190,13 +193,14 @@ Urho3D uses the following third-party libraries:
 - rapidjson 1.1.0 (https://github.com/miloyip/rapidjson)
 - Recast/Detour (https://github.com/memononen/recastnavigation)
 - SDL 2.0.5 (https://www.libsdl.org)
-- SQLite 3.18.0 (https://www.sqlite.org)
+- SQLite 3.20.1 (https://www.sqlite.org)
 - StanHull (https://codesuppository.blogspot.com/2006/03/john-ratcliffs-code-suppository-blog.html)
 - stb_image 2.12 (https://nothings.org)
 - stb_image_write 1.02 (https://nothings.org)
 - stb_rect_pack 0.08 (https://nothings.org)
 - stb_vorbis 1.09 (https://nothings.org)
 - tolua++ 1.0.93 (defunct - http://www.codenix.com/~tolua)
+- WebP (https://chromium.googlesource.com/webm/libwebp)
 
 DXT / ETC1 / PVRTC decompression code based on the Squish library and the Oolong
 Engine.

ファイルの差分が大きいため隠しています
+ 5 - 3
Rakefile


+ 8 - 0
Source/CMakeLists.txt

@@ -35,6 +35,10 @@ foreach (FUNCT __sincosf malloc_usable_size)
 endforeach ()
 include (CheckLibraryExists)
 check_library_exists (m sincosf "" HAVE_SINCOSF)
+if (MINGW)
+    include (CheckStructHasMember)
+    check_struct_has_member (RTL_OSVERSIONINFOW dwOSVersionInfoSize minwindef.h\;winnt.h HAVE_RTL_OSVERSIONINFOW)
+endif ()
 
 # Setup RPATH settings
 if (URHO3D_LIB_TYPE STREQUAL SHARED AND NOT WIN32 AND NOT ANDROID AND NOT IOS AND NOT TVOS AND NOT WEB)
@@ -108,6 +112,10 @@ if (URHO3D_URHO2D)
     endif ()
 endif ()
 
+if (URHO3D_WEBP)
+    add_subdirectory (ThirdParty/WebP)
+endif ()
+
 if (URHO3D_PHYSICS)
     add_subdirectory (ThirdParty/Bullet)
 endif ()

+ 2 - 0
Source/Clang-Tools/CMakeLists.txt

@@ -38,6 +38,8 @@ else ()
         cmake_policy (SET CMP0026 OLD)
         # MACOSX_RPATH is enabled by default
         cmake_policy (SET CMP0042 NEW)
+        # Honor the visibility properties for SHARED target types only
+        cmake_policy (SET CMP0063 OLD)
     endif ()
 
     # Set project name

+ 2 - 2
Source/Samples/01_HelloWorld/HelloWorld.h

@@ -38,11 +38,11 @@ public:
     HelloWorld(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { return
         "<patch>"
         "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Hat0']]\">"
         "        <attribute name=\"Is Visible\" value=\"false\" />"

+ 2 - 2
Source/Samples/02_HelloGUI/HelloGUI.h

@@ -49,11 +49,11 @@ public:
     HelloGUI(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { return
         "<patch>"
         "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Hat0']]\">"
         "        <attribute name=\"Is Visible\" value=\"false\" />"

+ 2 - 2
Source/Samples/03_Sprites/Sprites.h

@@ -39,11 +39,11 @@ public:
     Sprites(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { return
         "<patch>"
         "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Hat0']]\">"
         "        <attribute name=\"Is Visible\" value=\"false\" />"

+ 1 - 1
Source/Samples/04_StaticScene/StaticScene.h

@@ -46,7 +46,7 @@ public:
     StaticScene(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 private:
     /// Construct the scene content.

+ 1 - 1
Source/Samples/05_AnimatingScene/AnimatingScene.h

@@ -46,7 +46,7 @@ public:
     AnimatingScene(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 private:
     /// Construct the scene content.

+ 1 - 1
Source/Samples/05_AnimatingScene/Rotator.h

@@ -39,7 +39,7 @@ public:
     /// 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);
+    virtual void Update(float timeStep) override;
     
     /// Return rotation speed.
     const Vector3& GetRotationSpeed() const { return rotationSpeed_; }

+ 1 - 1
Source/Samples/06_SkeletalAnimation/Mover.h

@@ -38,7 +38,7 @@ public:
     /// 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);
+    virtual void Update(float timeStep) override;
     
     /// Return forward movement speed.
     float GetMoveSpeed() const { return moveSpeed_; }

+ 2 - 2
Source/Samples/06_SkeletalAnimation/SkeletalAnimation.h

@@ -48,11 +48,11 @@ public:
     SkeletalAnimation(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { 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>"

+ 2 - 2
Source/Samples/07_Billboards/Billboards.h

@@ -46,11 +46,11 @@ public:
     Billboards(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { 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>"

+ 1 - 1
Source/Samples/08_Decals/Decals.cpp

@@ -278,7 +278,7 @@ void Decals::PaintDecal()
 
 bool Decals::Raycast(float maxDistance, Vector3& hitPos, Drawable*& hitDrawable)
 {
-    hitDrawable = 0;
+    hitDrawable = nullptr;
 
     UI* ui = GetSubsystem<UI>();
     IntVector2 pos = ui->GetCursorPosition();

+ 2 - 2
Source/Samples/08_Decals/Decals.h

@@ -48,11 +48,11 @@ public:
     Decals(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { 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>"

+ 2 - 2
Source/Samples/09_MultipleViewports/MultipleViewports.h

@@ -45,11 +45,11 @@ public:
     MultipleViewports(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { return
         "<patch>"
         "    <add sel=\"/element\">"
         "        <element type=\"Button\">"

+ 1 - 1
Source/Samples/10_RenderToTexture/RenderToTexture.h

@@ -45,7 +45,7 @@ public:
     RenderToTexture(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 private:
     /// Construct the scene content.

+ 1 - 1
Source/Samples/10_RenderToTexture/Rotator.h

@@ -39,7 +39,7 @@ public:
     /// 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);
+    virtual void Update(float timeStep) override;
     
     /// Return rotation speed.
     const Vector3& GetRotationSpeed() const { return rotationSpeed_; }

+ 2 - 2
Source/Samples/11_Physics/Physics.h

@@ -47,11 +47,11 @@ public:
     Physics(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { 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>"

+ 2 - 2
Source/Samples/12_PhysicsStressTest/PhysicsStressTest.h

@@ -46,11 +46,11 @@ public:
     PhysicsStressTest(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { 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>"

+ 1 - 1
Source/Samples/13_Ragdolls/CreateRagdoll.h

@@ -38,7 +38,7 @@ public:
     
 protected:
     /// Handle node being assigned.
-    virtual void OnNodeSet(Node* node);
+    virtual void OnNodeSet(Node* node) override;
     
 private:
     /// Handle scene node's physics collision.

+ 2 - 2
Source/Samples/13_Ragdolls/Ragdolls.h

@@ -46,11 +46,11 @@ public:
     Ragdolls(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { 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>"

+ 1 - 1
Source/Samples/14_SoundEffects/SoundEffects.cpp

@@ -60,7 +60,7 @@ URHO3D_DEFINE_APPLICATION_MAIN(SoundEffects)
 
 SoundEffects::SoundEffects(Context* context) :
     Sample(context),
-    musicSource_(0)
+    musicSource_(nullptr)
 {
 }
 

+ 3 - 3
Source/Samples/14_SoundEffects/SoundEffects.h

@@ -46,16 +46,16 @@ public:
     SoundEffects(Context* context);
 
     /// Setup before engine initialization. Modifies the engine parameters.
-    virtual void Setup();
+    virtual void Setup() override;
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
 
     SoundSource* musicSource_;
 
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { return
         "<patch>"
         "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Button2']]\">"
         "        <attribute name=\"Is Visible\" value=\"false\" />"

+ 81 - 3
Source/Samples/15_Navigation/Navigation.cpp

@@ -48,7 +48,9 @@ URHO3D_DEFINE_APPLICATION_MAIN(Navigation)
 
 Navigation::Navigation(Context* context) :
     Sample(context),
-    drawDebug_(false)
+    drawDebug_(false),
+    useStreaming_(false),
+    streamingDistance_(2)
 {
 }
 
@@ -141,6 +143,8 @@ void Navigation::CreateScene()
 
     // Create a NavigationMesh component to the scene root
     NavigationMesh* navMesh = scene_->CreateComponent<NavigationMesh>();
+    // Set small tiles to show navigation mesh streaming
+    navMesh->SetTileSize(32);
     // Create a Navigable component to the scene root. This tags all of the geometry in the scene as being part of the
     // navigation mesh. By default this is recursive, but the recursion could be turned off from Navigable
     scene_->CreateComponent<Navigable>();
@@ -185,6 +189,7 @@ void Navigation::CreateUI()
         "Use WASD keys to move, RMB to rotate view\n"
         "LMB to set destination, SHIFT+LMB to teleport\n"
         "MMB or O key to add or remove obstacles\n"
+        "Tab to toggle navigation mesh streaming\n"
         "Space to toggle debug geometry"
     );
     instructionText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 15);
@@ -299,7 +304,7 @@ void Navigation::AddOrRemoveObject()
     Vector3 hitPos;
     Drawable* hitDrawable;
 
-    if (Raycast(250.0f, hitPos, hitDrawable))
+    if (!useStreaming_ && Raycast(250.0f, hitPos, hitDrawable))
     {
         // The part of the navigation mesh we must update, which is the world bounding box of the associated
         // drawable component
@@ -343,7 +348,7 @@ Node* Navigation::CreateMushroom(const Vector3& pos)
 
 bool Navigation::Raycast(float maxDistance, Vector3& hitPos, Drawable*& hitDrawable)
 {
-    hitDrawable = 0;
+    hitDrawable = nullptr;
 
     UI* ui = GetSubsystem<UI>();
     IntVector2 pos = ui->GetCursorPosition();
@@ -390,6 +395,69 @@ void Navigation::FollowPath(float timeStep)
     }
 }
 
+void Navigation::ToggleStreaming(bool enabled)
+{
+    NavigationMesh* navMesh = scene_->GetComponent<NavigationMesh>();
+    if (enabled)
+    {
+        int maxTiles = (2 * streamingDistance_ + 1) * (2 * streamingDistance_ + 1);
+        BoundingBox boundingBox = navMesh->GetBoundingBox();
+        SaveNavigationData();
+        navMesh->Allocate(boundingBox, maxTiles);
+    }
+    else
+        navMesh->Build();
+}
+
+void Navigation::UpdateStreaming()
+{
+    // Center the navigation mesh at the jack
+    NavigationMesh* navMesh = scene_->GetComponent<NavigationMesh>();
+    const IntVector2 jackTile = navMesh->GetTileIndex(jackNode_->GetWorldPosition());
+    const IntVector2 numTiles = navMesh->GetNumTiles();
+    const IntVector2 beginTile = VectorMax(IntVector2::ZERO, jackTile - IntVector2::ONE * streamingDistance_);
+    const IntVector2 endTile = VectorMin(jackTile + IntVector2::ONE * streamingDistance_, numTiles - IntVector2::ONE);
+
+    // Remove tiles
+    for (HashSet<IntVector2>::Iterator i = addedTiles_.Begin(); i != addedTiles_.End();)
+    {
+        const IntVector2 tileIdx = *i;
+        if (beginTile.x_ <= tileIdx.x_ && tileIdx.x_ <= endTile.x_ && beginTile.y_ <= tileIdx.y_ && tileIdx.y_ <= endTile.y_)
+            ++i;
+        else
+        {
+            navMesh->RemoveTile(tileIdx);
+            i = addedTiles_.Erase(i);
+        }
+    }
+
+    // Add tiles
+    for (int z = beginTile.y_; z <= endTile.y_; ++z)
+        for (int x = beginTile.x_; x <= endTile.x_; ++x)
+        {
+            const IntVector2 tileIdx(x, z);
+            if (!navMesh->HasTile(tileIdx) && tileData_.Contains(tileIdx))
+            {
+                addedTiles_.Insert(tileIdx);
+                navMesh->AddTile(tileData_[tileIdx]);
+            }
+        }
+}
+
+void Navigation::SaveNavigationData()
+{
+    NavigationMesh* navMesh = scene_->GetComponent<NavigationMesh>();
+    tileData_.Clear();
+    addedTiles_.Clear();
+    const IntVector2 numTiles = navMesh->GetNumTiles();
+    for (int z = 0; z < numTiles.y_; ++z)
+        for (int x = 0; x <= numTiles.x_; ++x)
+        {
+            const IntVector2 tileIdx = IntVector2(x, z);
+            tileData_[tileIdx] = navMesh->GetTileData(tileIdx);
+        }
+}
+
 void Navigation::HandleUpdate(StringHash eventType, VariantMap& eventData)
 {
     using namespace Update;
@@ -402,6 +470,16 @@ void Navigation::HandleUpdate(StringHash eventType, VariantMap& eventData)
 
     // Make Jack follow the Detour path
     FollowPath(timeStep);
+
+    // Update streaming
+    Input* input = GetSubsystem<Input>();
+    if (input->GetKeyPress(KEY_TAB))
+    {
+        useStreaming_ = !useStreaming_;
+        ToggleStreaming(useStreaming_);
+    }
+    if (useStreaming_)
+        UpdateStreaming();
 }
 
 void Navigation::HandlePostRenderUpdate(StringHash eventType, VariantMap& eventData)

+ 16 - 2
Source/Samples/15_Navigation/Navigation.h

@@ -50,11 +50,11 @@ public:
     Navigation(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { return
         "<patch>"
         "    <add sel=\"/element\">"
         "        <element type=\"Button\">"
@@ -146,6 +146,12 @@ private:
     bool Raycast(float maxDistance, Vector3& hitPos, Drawable*& hitDrawable);
     /// Make Jack follow the Detour path.
     void FollowPath(float timeStep);
+    /// Toggle navigation mesh streaming.
+    void ToggleStreaming(bool enabled);
+    /// Update navigation mesh streaming.
+    void UpdateStreaming();
+    /// Save navigation data for streaming.
+    void SaveNavigationData();
     /// Handle the logic update event.
     void HandleUpdate(StringHash eventType, VariantMap& eventData);
     /// Handle the post-render update event.
@@ -159,4 +165,12 @@ private:
     SharedPtr<Node> jackNode_;
     /// Flag for drawing debug geometry.
     bool drawDebug_;
+    /// Flag for using navigation mesh streaming.
+    bool useStreaming_;
+    /// Streaming distance.
+    int streamingDistance_;
+    /// Tile data.
+    HashMap<IntVector2, PODVector<unsigned char> > tileData_;
+    /// Added tiles.
+    HashSet<IntVector2> addedTiles_;
 };

+ 2 - 2
Source/Samples/16_Chat/Chat.cpp

@@ -175,7 +175,7 @@ void Chat::UpdateButtons()
     bool serverRunning = network->IsServerRunning();
 
     // Show and hide buttons so that eg. Connect and Disconnect are never shown at the same time
-    sendButton_->SetVisible(serverConnection != 0);
+    sendButton_->SetVisible(serverConnection != nullptr);
     connectButton_->SetVisible(!serverConnection && !serverRunning);
     disconnectButton_->SetVisible(serverConnection || serverRunning);
     startServerButton_->SetVisible(!serverConnection && !serverRunning);
@@ -221,7 +221,7 @@ void Chat::HandleConnect(StringHash eventType, VariantMap& eventData)
     // Connect to server, do not specify a client scene as we are not using scene replication, just messages.
     // At connect time we could also send identity parameters (such as username) in a VariantMap, but in this
     // case we skip it for simplicity
-    network->Connect(address, CHAT_SERVER_PORT, 0);
+    network->Connect(address, CHAT_SERVER_PORT, nullptr);
 
     UpdateButtons();
 }

+ 2 - 2
Source/Samples/16_Chat/Chat.h

@@ -47,11 +47,11 @@ public:
     Chat(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { return
         "<patch>"
         "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Button2']]\">"
         "        <attribute name=\"Is Visible\" value=\"false\" />"

+ 2 - 2
Source/Samples/17_SceneReplication/SceneReplication.h

@@ -50,11 +50,11 @@ public:
     SceneReplication(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { return
         "<patch>"
         "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Hat0']]\">"
         "        <attribute name=\"Is Visible\" value=\"false\" />"

+ 2 - 2
Source/Samples/18_CharacterDemo/Character.h

@@ -53,9 +53,9 @@ public:
     static void RegisterObject(Context* context);
     
     /// Handle startup. Called by LogicComponent base class.
-    virtual void Start();
+    virtual void Start() override;
     /// Handle physics world update. Called by LogicComponent base class.
-    virtual void FixedUpdate(float timeStep);
+    virtual void FixedUpdate(float timeStep) override;
     
     /// Movement controls. Assigned by the main program each frame.
     Controls controls_;

+ 3 - 3
Source/Samples/18_CharacterDemo/CharacterDemo.h

@@ -51,14 +51,14 @@ public:
     /// Construct.
     CharacterDemo(Context* context);
     /// Destruct.
-    ~CharacterDemo();
+    virtual ~CharacterDemo() override;
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { return
         "<patch>"
         "    <add sel=\"/element\">"
         "        <element type=\"Button\">"

+ 2 - 2
Source/Samples/19_VehicleDemo/Vehicle.h

@@ -59,9 +59,9 @@ public:
     static void RegisterObject(Context* context);
     
     /// Perform post-load after deserialization. Acquire the components from the scene nodes.
-    virtual void ApplyAttributes();
+    virtual void ApplyAttributes() override;
     /// Handle physics world update. Called by LogicComponent base class.
-    virtual void FixedUpdate(float timeStep);
+    virtual void FixedUpdate(float timeStep) override;
     
     /// Initialize the vehicle. Create rendering and physics components. Called by the application.
     void Init();

+ 1 - 1
Source/Samples/19_VehicleDemo/VehicleDemo.h

@@ -48,7 +48,7 @@ public:
     VehicleDemo(Context* context);
     
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
     
 private:
     /// Create static scene content.

+ 1 - 1
Source/Samples/20_HugeObjectCount/HugeObjectCount.cpp

@@ -126,7 +126,7 @@ void HugeObjectCount::CreateScene()
         light->SetSpecularIntensity(1.5f);
 
         // Create StaticModelGroups in the scene
-        StaticModelGroup* lastGroup = 0;
+        StaticModelGroup* lastGroup = nullptr;
 
         for (int y = -125; y < 125; ++y)
         {

+ 2 - 2
Source/Samples/20_HugeObjectCount/HugeObjectCount.h

@@ -48,11 +48,11 @@ public:
     HugeObjectCount(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { 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\">Group</replace>"

+ 1 - 1
Source/Samples/21_AngelScriptIntegration/AngelScriptIntegration.h

@@ -45,7 +45,7 @@ public:
     AngelScriptIntegration(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 private:
     /// Construct the scene content.

+ 1 - 1
Source/Samples/22_LuaIntegration/LuaIntegration.h

@@ -45,7 +45,7 @@ public:
     LuaIntegration(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 private:
     /// Construct the scene content.

+ 1 - 1
Source/Samples/23_Water/Water.h

@@ -47,7 +47,7 @@ public:
     Water(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 private:
     /// Construct the scene content.

+ 2 - 2
Source/Samples/24_Urho2DSprite/Urho2DSprite.h

@@ -44,11 +44,11 @@ public:
     Urho2DSprite(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { 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\">Zoom In</replace>"

+ 2 - 2
Source/Samples/25_Urho2DParticle/Urho2DParticle.h

@@ -44,11 +44,11 @@ public:
     Urho2DParticle(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { return
         "<patch>"
         "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Hat0']]\">"
         "        <attribute name=\"Is Visible\" value=\"false\" />"

+ 2 - 2
Source/Samples/26_ConsoleInput/ConsoleInput.h

@@ -38,11 +38,11 @@ public:
     ConsoleInput(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { return
         "<patch>"
         "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Button2']]\">"
         "        <attribute name=\"Is Visible\" value=\"false\" />"

+ 2 - 2
Source/Samples/27_Urho2DPhysics/Urho2DPhysics.h

@@ -43,11 +43,11 @@ public:
     Urho2DPhysics(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { 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\">Zoom In</replace>"

+ 2 - 2
Source/Samples/28_Urho2DPhysicsRope/Urho2DPhysicsRope.h

@@ -45,11 +45,11 @@ public:
     Urho2DPhysicsRope(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { 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\">Zoom In</replace>"

+ 3 - 3
Source/Samples/29_SoundSynthesis/SoundSynthesis.h

@@ -44,13 +44,13 @@ public:
     SoundSynthesis(Context* context);
 
     /// Setup before engine initialization. Modifies the engine parameters.
-    virtual void Setup();
+    virtual void Setup() override;
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { return
         "<patch>"
         "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Button2']]\">"
         "        <attribute name=\"Is Visible\" value=\"false\" />"

+ 1 - 1
Source/Samples/30_LightAnimation/LightAnimation.h

@@ -44,7 +44,7 @@ public:
     LightAnimation(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 private:
     /// Construct the scene content.

+ 1 - 1
Source/Samples/31_MaterialAnimation/MaterialAnimation.h

@@ -44,7 +44,7 @@ public:
     MaterialAnimation(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 private:
     /// Construct the scene content.

+ 2 - 2
Source/Samples/32_Urho2DConstraints/Urho2DConstraints.cpp

@@ -537,7 +537,7 @@ void Urho2DConstraints::HandleMouseButtonUp(StringHash eventType, VariantMap& ev
         staticSprite->SetColor(Color(1.0f, 1.0f, 1.0f, 1.0f)); // Restore picked sprite color
 
         pickedNode->RemoveComponent<ConstraintMouse2D>(); // Remove temporary constraint
-        pickedNode = NULL;
+        pickedNode = nullptr;
     }
     UnsubscribeFromEvent(E_MOUSEMOVE);
     UnsubscribeFromEvent(E_MOUSEBUTTONUP);
@@ -607,7 +607,7 @@ void Urho2DConstraints::HandleTouchEnd3(StringHash eventType, VariantMap& eventD
         staticSprite->SetColor(Color(1.0f, 1.0f, 1.0f, 1.0f)); // Restore picked sprite color
 
         pickedNode->RemoveComponent<ConstraintMouse2D>(); // Remove temporary constraint
-        pickedNode = NULL;
+        pickedNode = nullptr;
     }
     UnsubscribeFromEvent(E_TOUCHMOVE);
     UnsubscribeFromEvent(E_TOUCHEND);

+ 2 - 2
Source/Samples/32_Urho2DConstraints/Urho2DConstraints.h

@@ -59,11 +59,11 @@ public:
     Urho2DConstraints(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { 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\">Zoom In</replace>"

+ 2 - 2
Source/Samples/33_Urho2DSpriterAnimation/Urho2DSpriterAnimation.h

@@ -44,11 +44,11 @@ public:
     Urho2DSpriterAnimation(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { 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\">Zoom In</replace>"

+ 2 - 2
Source/Samples/34_DynamicGeometry/DynamicGeometry.h

@@ -46,11 +46,11 @@ public:
     DynamicGeometry(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { 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\">Animation</replace>"

+ 1 - 1
Source/Samples/35_SignedDistanceFieldText/SignedDistanceFieldText.h

@@ -47,7 +47,7 @@ public:
     SignedDistanceFieldText(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 private:
     /// Construct the scene content.

+ 1 - 1
Source/Samples/36_Urho2DTileMap/Urho2DTileMap.cpp

@@ -215,7 +215,7 @@ void Urho2DTileMap::HandleMouseButtonDown(StringHash eventType, VariantMap& even
                 sprite->SetSprite(layer->GetTile(0, 0)->GetSprite()); // Replace grass by water sprite used in top tile
             else sprite->SetSprite(layer->GetTile(24, 24)->GetSprite()); // Replace water by grass sprite used in bottom tile
         }
-        else sprite->SetSprite(NULL); // 'Remove' sprite
+        else sprite->SetSprite(nullptr); // 'Remove' sprite
     }
 }
 

+ 2 - 2
Source/Samples/36_Urho2DTileMap/Urho2DTileMap.h

@@ -39,11 +39,11 @@ public:
     Urho2DTileMap(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { 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\">Zoom In</replace>"

+ 2 - 2
Source/Samples/37_UIDrag/UIDrag.h

@@ -45,11 +45,11 @@ public:
     UIDrag(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { return
         "<patch>"
         "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Hat0']]\">"
         "        <attribute name=\"Is Visible\" value=\"false\" />"

+ 1 - 1
Source/Samples/38_SceneAndUILoad/SceneAndUILoad.h

@@ -47,7 +47,7 @@ public:
     SceneAndUILoad(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 private:
     /// Construct the scene content.

+ 89 - 1
Source/Samples/39_CrowdNavigation/CrowdNavigation.cpp

@@ -55,6 +55,7 @@ URHO3D_DEFINE_APPLICATION_MAIN(CrowdNavigation)
 
 CrowdNavigation::CrowdNavigation(Context* context) :
     Sample(context),
+    streamingDistance_(2),
     drawDebug_(false)
 {
 }
@@ -135,6 +136,8 @@ void CrowdNavigation::CreateScene()
 
     // Create a DynamicNavigationMesh component to the scene root
     DynamicNavigationMesh* navMesh = scene_->CreateComponent<DynamicNavigationMesh>();
+    // Set small tiles to show navigation mesh streaming
+    navMesh->SetTileSize(32);
     // Enable drawing debug geometry for obstacles and off-mesh connections
     navMesh->SetDrawObstacles(true);
     navMesh->SetDrawOffMeshConnections(true);
@@ -213,6 +216,7 @@ void CrowdNavigation::CreateUI()
         "LMB to set destination, SHIFT+LMB to spawn a Jack\n"
         "MMB or O key to add obstacles or remove obstacles/agents\n"
         "F5 to save scene, F7 to load\n"
+        "Tab to toggle navigation mesh streaming\n"
         "Space to toggle debug geometry\n"
         "F12 to toggle this instruction text"
     );
@@ -377,7 +381,7 @@ void CrowdNavigation::AddOrRemoveObject()
 
 bool CrowdNavigation::Raycast(float maxDistance, Vector3& hitPos, Drawable*& hitDrawable)
 {
-    hitDrawable = 0;
+    hitDrawable = nullptr;
 
     UI* ui = GetSubsystem<UI>();
     IntVector2 pos = ui->GetCursorPosition();
@@ -473,6 +477,79 @@ void CrowdNavigation::MoveCamera(float timeStep)
     }
 }
 
+void CrowdNavigation::ToggleStreaming(bool enabled)
+{
+    DynamicNavigationMesh* navMesh = scene_->GetComponent<DynamicNavigationMesh>();
+    if (enabled)
+    {
+        int maxTiles = (2 * streamingDistance_ + 1) * (2 * streamingDistance_ + 1);
+        BoundingBox boundingBox = navMesh->GetBoundingBox();
+        SaveNavigationData();
+        navMesh->Allocate(boundingBox, maxTiles);
+    }
+    else
+        navMesh->Build();
+}
+
+void CrowdNavigation::UpdateStreaming()
+{
+    // Center the navigation mesh at the crowd of jacks
+    Vector3 averageJackPosition;
+    if (Node* jackGroup = scene_->GetChild("Jacks"))
+    {
+        const unsigned numJacks = jackGroup->GetNumChildren();
+        for (unsigned i = 0; i < numJacks; ++i)
+            averageJackPosition += jackGroup->GetChild(i)->GetWorldPosition();
+        averageJackPosition /= (float)numJacks;
+    }
+
+    // Compute currently loaded area
+    DynamicNavigationMesh* navMesh = scene_->GetComponent<DynamicNavigationMesh>();
+    const IntVector2 jackTile = navMesh->GetTileIndex(averageJackPosition);
+    const IntVector2 numTiles = navMesh->GetNumTiles();
+    const IntVector2 beginTile = VectorMax(IntVector2::ZERO, jackTile - IntVector2::ONE * streamingDistance_);
+    const IntVector2 endTile = VectorMin(jackTile + IntVector2::ONE * streamingDistance_, numTiles - IntVector2::ONE);
+
+    // Remove tiles
+    for (HashSet<IntVector2>::Iterator i = addedTiles_.Begin(); i != addedTiles_.End();)
+    {
+        const IntVector2 tileIdx = *i;
+        if (beginTile.x_ <= tileIdx.x_ && tileIdx.x_ <= endTile.x_ && beginTile.y_ <= tileIdx.y_ && tileIdx.y_ <= endTile.y_)
+            ++i;
+        else
+        {
+            navMesh->RemoveTile(tileIdx);
+            i = addedTiles_.Erase(i);
+        }
+    }
+
+    // Add tiles
+    for (int z = beginTile.y_; z <= endTile.y_; ++z)
+        for (int x = beginTile.x_; x <= endTile.x_; ++x)
+        {
+            const IntVector2 tileIdx(x, z);
+            if (!navMesh->HasTile(tileIdx) && tileData_.Contains(tileIdx))
+            {
+                addedTiles_.Insert(tileIdx);
+                navMesh->AddTile(tileData_[tileIdx]);
+            }
+        }
+}
+
+void CrowdNavigation::SaveNavigationData()
+{
+    DynamicNavigationMesh* navMesh = scene_->GetComponent<DynamicNavigationMesh>();
+    tileData_.Clear();
+    addedTiles_.Clear();
+    const IntVector2 numTiles = navMesh->GetNumTiles();
+    for (int z = 0; z < numTiles.y_; ++z)
+        for (int x = 0; x <= numTiles.x_; ++x)
+        {
+            const IntVector2 tileIdx = IntVector2(x, z);
+            tileData_[tileIdx] = navMesh->GetTileData(tileIdx);
+        }
+}
+
 void CrowdNavigation::HandleUpdate(StringHash eventType, VariantMap& eventData)
 {
     using namespace Update;
@@ -482,6 +559,17 @@ void CrowdNavigation::HandleUpdate(StringHash eventType, VariantMap& eventData)
 
     // Move the camera, scale movement with time step
     MoveCamera(timeStep);
+
+    // Update streaming
+    Input* input = GetSubsystem<Input>();
+    if (input->GetKeyPress(KEY_TAB))
+    {
+        useStreaming_ = !useStreaming_;
+        ToggleStreaming(useStreaming_);
+    }
+    if (useStreaming_)
+        UpdateStreaming();
+
 }
 
 void CrowdNavigation::HandlePostRenderUpdate(StringHash eventType, VariantMap& eventData)

+ 16 - 2
Source/Samples/39_CrowdNavigation/CrowdNavigation.h

@@ -52,11 +52,11 @@ public:
     CrowdNavigation(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { return
         "<patch>"
         "    <add sel=\"/element\">"
         "        <element type=\"Button\">"
@@ -152,6 +152,12 @@ private:
     void CreateMovingBarrels(DynamicNavigationMesh* navMesh);
     /// Utility function to raycast to the cursor position. Return true if hit.
     bool Raycast(float maxDistance, Vector3& hitPos, Drawable*& hitDrawable);
+    /// Toggle navigation mesh streaming.
+    void ToggleStreaming(bool enabled);
+    /// Update navigation mesh streaming.
+    void UpdateStreaming();
+    /// Save navigation data for streaming.
+    void SaveNavigationData();
     /// Handle the logic update event.
     void HandleUpdate(StringHash eventType, VariantMap& eventData);
     /// Handle the post-render update event.
@@ -163,6 +169,14 @@ private:
     /// Handle crowd agent formation.
     void HandleCrowdAgentFormation(StringHash eventType, VariantMap& eventData);
 
+    /// Flag for using navigation mesh streaming.
+    bool useStreaming_;
+    /// Streaming distance.
+    int streamingDistance_;
+    /// Tile data.
+    HashMap<IntVector2, PODVector<unsigned char> > tileData_;
+    /// Added tiles.
+    HashSet<IntVector2> addedTiles_;
     /// Flag for drawing debug geometry.
     bool drawDebug_;
 };

+ 1 - 1
Source/Samples/40_Localization/L10n.h

@@ -38,7 +38,7 @@ public:
     L10n(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 private:
     // Load strings from JSON files and subscribe to the change language event

+ 2 - 2
Source/Samples/41_DatabaseDemo/DatabaseDemo.cpp

@@ -38,7 +38,7 @@ URHO3D_DEFINE_APPLICATION_MAIN(DatabaseDemo)
 
 DatabaseDemo::DatabaseDemo(Context* context) :
     Sample(context),
-    connection_(0),
+    connection_(nullptr),
     row_(0),
     maxRows_(50)
 {
@@ -49,7 +49,7 @@ DatabaseDemo::~DatabaseDemo()
     // Although the managed database connection will be disconnected by Database subsystem automatically in its destructor,
     // it is a good practice for a class to balance the number of connect() and disconnect() calls.
     GetSubsystem<Database>()->Disconnect(connection_);
-    connection_ = 0;
+    connection_ = nullptr;
 }
 
 void DatabaseDemo::Start()

+ 3 - 3
Source/Samples/41_DatabaseDemo/DatabaseDemo.h

@@ -33,14 +33,14 @@ public:
     /// Construct.
     DatabaseDemo(Context* context);
     /// Destruct.
-    virtual ~DatabaseDemo();
+    virtual ~DatabaseDemo() override;
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { return
         "<patch>"
         "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Button2']]\">"
         "        <attribute name=\"Is Visible\" value=\"false\" />"

+ 4 - 4
Source/Samples/42_PBRMaterials/PBRMaterials.cpp

@@ -48,10 +48,10 @@ URHO3D_DEFINE_APPLICATION_MAIN(PBRMaterials)
 
 PBRMaterials::PBRMaterials(Context* context) :
     Sample(context),
-    dynamicMaterial_(0),
-    roughnessLabel_(0),
-    metallicLabel_(0),
-    ambientLabel_(0)
+    dynamicMaterial_(nullptr),
+    roughnessLabel_(nullptr),
+    metallicLabel_(nullptr),
+    ambientLabel_(nullptr)
 {
 }
 

+ 1 - 1
Source/Samples/42_PBRMaterials/PBRMaterials.h

@@ -49,7 +49,7 @@ public:
     PBRMaterials(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 private:
     /// Construct the scene content.

+ 2 - 2
Source/Samples/43_HttpRequestDemo/HttpRequestDemo.h

@@ -42,11 +42,11 @@ public:
     HttpRequestDemo(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { return
         "<patch>"
         "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Hat0']]\">"
         "        <attribute name=\"Is Visible\" value=\"false\" />"

+ 1 - 1
Source/Samples/44_RibbonTrailDemo/RibbonTrailDemo.h

@@ -44,7 +44,7 @@ public:
     RibbonTrailDemo(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Trail that emitted from sword.

+ 13 - 10
Source/Samples/45_InverseKinematics/InverseKinematics.cpp

@@ -50,7 +50,9 @@
 URHO3D_DEFINE_APPLICATION_MAIN(InverseKinematics)
 
 InverseKinematics::InverseKinematics(Context* context) :
-    Sample(context)
+    Sample(context),
+    floorPitch_(0.0f),
+    floorRoll_(0.0f)
 {
 }
 
@@ -139,16 +141,17 @@ void InverseKinematics::CreateScene()
     Node* spine = jackNode_->GetChild("Bip01_Spine", true);
     solver_ = spine->CreateComponent<IKSolver>();
 
+    // Two-bone solver is more efficient and more stable than FABRIK (but only
+    // works for two bones, obviously).
+    solver_->SetAlgorithm(IKSolver::TWO_BONE);
+
     // Disable auto-solving, which means we need to call Solve() manually
-    solver_->EnableAutoSolve(false);
-
-    // When this is enabled, the solver will use the current positions of the
-    // nodes in the skeleton as its basis every frame. If you disable this, then
-    // the solver will store the initial positions of the nodes once and always
-    // use those positions for calculating solutions.
-    // With animated characters you generally want to continuously update the
-    // initial positions.
-    solver_->EnableUpdatePose(true);
+    solver_->SetFeature(IKSolver::AUTO_SOLVE, false);
+
+    // Only enable this so the debug draw shows us the pose before solving.
+    // This should NOT be enabled for any other reason (it does nothing and is
+    // a waste of performance).
+    solver_->SetFeature(IKSolver::UPDATE_ORIGINAL_POSE, true);
 
     // Create the camera.
     cameraRotateNode_ = scene_->CreateChild("CameraRotate");

+ 1 - 1
Source/Samples/45_InverseKinematics/InverseKinematics.h

@@ -44,7 +44,7 @@ public:
     InverseKinematics(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Animation controller of Jack.

+ 1 - 1
Source/Samples/46_RaycastVehicle/RaycastVehicleDemo.h

@@ -48,7 +48,7 @@ public:
     RaycastVehicleDemo(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 private:
     /// Create static scene content.

+ 4 - 4
Source/Samples/46_RaycastVehicle/Vehicle.h

@@ -54,21 +54,21 @@ public :
     /// Construct.
     Vehicle(Context* context);
     /// Destruct.
-    ~Vehicle();
+    virtual ~Vehicle() override;
 
     /// Register object factory and attributes.
     static void RegisterObject(Context* context);
 
     /// Perform post-load after deserialization. Acquire the components from the scene nodes.
-    virtual void ApplyAttributes();
+    virtual void ApplyAttributes() override;
 
     /// Initialize the vehicle. Create rendering and physics components. Called by the application.
     void Init();
 
     /// Handle physics world update. Called by LogicComponent base class.
-    virtual void FixedUpdate(float timeStep);
+    virtual void FixedUpdate(float timeStep) override;
     /// Updating wheel effects here.
-    virtual void PostUpdate(float timeStep);
+    virtual void PostUpdate(float timeStep) override;
 
     /// Movement controls.
     Controls controls_;

+ 48 - 15
Source/Samples/47_Typography/Typography.cpp

@@ -71,7 +71,7 @@ void Typography::Start()
     // (Don't modify the root directly, as the base Sample class uses it)
     uielement_ = new UIElement(context_);
     uielement_->SetAlignment(HA_CENTER, VA_CENTER);
-    uielement_->SetLayout(LM_VERTICAL, 20, IntRect(20, 40, 20, 40));
+    uielement_->SetLayout(LM_VERTICAL, 10, IntRect(20, 40, 20, 40));
     root->AddChild(uielement_);
 
     // Add some sample text.
@@ -92,20 +92,46 @@ void Typography::Start()
     CreateCheckbox("UI::SetForceAutoHint", URHO3D_HANDLER(Typography, HandleForceAutoHint))
         ->SetChecked(ui->GetForceAutoHint());
 
-    // Add a checkbox for the global SubpixelGlyphPositions setting. This affects character spacing.
-    CreateCheckbox("UI::SetSubpixelGlyphPositions", URHO3D_HANDLER(Typography, HandleSubpixelGlyphPositions))
-        ->SetChecked(ui->GetSubpixelGlyphPositions());
-
     // Add a drop-down menu to control the font hinting level.
-    const char* items[] = {
+    const char* levels[] = {
         "FONT_HINT_LEVEL_NONE",
         "FONT_HINT_LEVEL_LIGHT",
         "FONT_HINT_LEVEL_NORMAL",
-        NULL
+        nullptr
     };
-    CreateMenu("UI::SetFontHintLevel", items, URHO3D_HANDLER(Typography, HandleFontHintLevel))
+    CreateMenu("UI::SetFontHintLevel", levels, URHO3D_HANDLER(Typography, HandleFontHintLevel))
         ->SetSelection(ui->GetFontHintLevel());
 
+    // Add a drop-down menu to control the subpixel threshold.
+    const char* thresholds[] = {
+        "0",
+        "3",
+        "6",
+        "9",
+        "12",
+        "15",
+        "18",
+        "21",
+        nullptr
+    };
+    CreateMenu("UI::SetFontSubpixelThreshold", thresholds, URHO3D_HANDLER(Typography, HandleFontSubpixel))
+        ->SetSelection(ui->GetFontSubpixelThreshold() / 3);
+
+    // Add a drop-down menu to control oversampling.
+    const char* limits[] = {
+        "1",
+        "2",
+        "3",
+        "4",
+        "5",
+        "6",
+        "7",
+        "8",
+        nullptr
+    };
+    CreateMenu("UI::SetFontOversampling", limits, URHO3D_HANDLER(Typography, HandleFontOversampling))
+        ->SetSelection(ui->GetFontOversampling() - 1);
+
     // Set the mouse mode to use in the sample
     Sample::InitMouseMode(MM_FREE);
 }
@@ -174,11 +200,11 @@ SharedPtr<DropDownList> Typography::CreateMenu(const String& label, const char**
         list->AddItem(item);
         item->SetText(items[i]);
         item->SetStyleAuto();
+        item->SetMinWidth(item->GetRowWidth(0) + 10);
         item->AddTag(TEXT_TAG);
     }
 
     text->SetMaxWidth(text->GetRowWidth(0));
-    list->SetMaxWidth(text->GetRowWidth(0) * 1.5);
 
     SubscribeToEvent(list, E_ITEMSELECTED, handler);
     return list;
@@ -229,16 +255,23 @@ void Typography::HandleSRGB(StringHash eventType, VariantMap& eventData)
     }
 }
 
-void Typography::HandleSubpixelGlyphPositions(StringHash eventType, VariantMap& eventData)
+void Typography::HandleFontHintLevel(StringHash eventType, VariantMap& eventData)
 {
-    CheckBox* box = static_cast<CheckBox*>(eventData[Toggled::P_ELEMENT].GetPtr());
-    bool checked = box->IsChecked();
-    GetSubsystem<UI>()->SetSubpixelGlyphPositions(checked);
+    DropDownList* list = static_cast<DropDownList*>(eventData[Toggled::P_ELEMENT].GetPtr());
+    unsigned i = list->GetSelection();
+    GetSubsystem<UI>()->SetFontHintLevel((FontHintLevel)i);
 }
 
-void Typography::HandleFontHintLevel(StringHash eventType, VariantMap& eventData)
+void Typography::HandleFontSubpixel(StringHash eventType, VariantMap& eventData)
 {
     DropDownList* list = static_cast<DropDownList*>(eventData[Toggled::P_ELEMENT].GetPtr());
     unsigned i = list->GetSelection();
-    GetSubsystem<UI>()->SetFontHintLevel((FontHintLevel)i);
+    GetSubsystem<UI>()->SetFontSubpixelThreshold(i * 3);
+}
+
+void Typography::HandleFontOversampling(StringHash eventType, VariantMap& eventData)
+{
+    DropDownList* list = static_cast<DropDownList*>(eventData[Toggled::P_ELEMENT].GetPtr());
+    unsigned i = list->GetSelection();
+    GetSubsystem<UI>()->SetFontOversampling(i + 1);
 }

+ 4 - 3
Source/Samples/47_Typography/Typography.h

@@ -35,11 +35,11 @@ public:
     Typography(Context* context);
 
     /// Setup after engine initialization and before running the main loop.
-    virtual void Start();
+    virtual void Start() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
-    virtual String GetScreenJoystickPatchString() const { return
+    virtual String GetScreenJoystickPatchString() const override { return
         "<patch>"
         "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Hat0']]\">"
         "        <attribute name=\"Is Visible\" value=\"false\" />"
@@ -58,5 +58,6 @@ private:
     void HandleSRGB(StringHash eventType, VariantMap& eventData);
     void HandleForceAutoHint(StringHash eventType, VariantMap& eventData);
     void HandleFontHintLevel(StringHash eventType, VariantMap& eventData);
-    void HandleSubpixelGlyphPositions(StringHash eventType, VariantMap& eventData);
+    void HandleFontSubpixel(StringHash eventType, VariantMap& eventData);
+    void HandleFontOversampling(StringHash eventType, VariantMap& eventData);
 };

+ 33 - 0
Source/Samples/48_Hello3DUI/CMakeLists.txt

@@ -0,0 +1,33 @@
+#
+# Copyright (c) 2008-2017 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 48_Hello3DUI)
+
+# Define source files
+define_source_files (EXTRA_H_FILES ${COMMON_SAMPLE_H_FILES})
+
+# Setup target with resource copying
+setup_main_executable ()
+
+# Setup test cases
+setup_test ()

+ 360 - 0
Source/Samples/48_Hello3DUI/Hello3DUI.cpp

@@ -0,0 +1,360 @@
+//
+// Copyright (c) 2008-2017 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 <Urho3D/Core/CoreEvents.h>
+#include <Urho3D/Engine/Engine.h>
+#include <Urho3D/Graphics/Graphics.h>
+#include <Urho3D/Graphics/Texture2D.h>
+#include <Urho3D/Graphics/Zone.h>
+#include <Urho3D/Graphics/StaticModel.h>
+#include <Urho3D/Graphics/Model.h>
+#include <Urho3D/Graphics/Technique.h>
+#include <Urho3D/Graphics/Octree.h>
+#include <Urho3D/Input/Input.h>
+#include <Urho3D/Resource/ResourceCache.h>
+#include <Urho3D/UI/Button.h>
+#include <Urho3D/UI/CheckBox.h>
+#include <Urho3D/UI/LineEdit.h>
+#include <Urho3D/UI/Text.h>
+#include <Urho3D/UI/ToolTip.h>
+#include <Urho3D/UI/UI.h>
+#include <Urho3D/UI/UIEvents.h>
+#include <Urho3D/UI/Window.h>
+#include <Urho3D/UI/ListView.h>
+#include <Urho3D/UI/UIComponent.h>
+
+#include "Hello3DUI.h"
+
+#include <Urho3D/DebugNew.h>
+
+URHO3D_DEFINE_APPLICATION_MAIN(Hello3DUI)
+
+Hello3DUI::Hello3DUI(Context* context) :
+    Sample(context),
+    uiRoot_(GetSubsystem<UI>()->GetRoot()),
+    dragBeginPosition_(IntVector2::ZERO),
+    animateCube_(true),
+    renderOnCube_(false),
+    drawDebug_(false)
+{
+}
+
+void Hello3DUI::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 Scene
+    InitScene();
+
+    // Initialize Window
+    InitWindow();
+
+    // Create and add some controls to the Window
+    InitControls();
+
+    // Create a draggable Fish
+    CreateDraggableFish();
+
+    // Create 3D UI rendered on a cube.
+    Init3DUI();
+
+    // Set the mouse mode to use in the sample
+    Sample::InitMouseMode(MM_FREE);
+}
+
+void Hello3DUI::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();
+
+    instructions_ = new Text(context_);
+    instructions_->SetStyleAuto();
+    instructions_->SetText("[TAB]   - toggle between rendering on screen or cube.\n"
+                           "[Space] - toggle cube rotation.");
+    uiRoot_->AddChild(instructions_);
+}
+
+void Hello3DUI::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_->SetMinWidth(384);
+    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);
+
+    // Create a list.
+    ListView* list = window_->CreateChild<ListView>();
+    list->SetSelectOnClickEnd(true);
+    list->SetHighlightMode(HM_ALWAYS);
+    list->SetMinHeight(200);
+
+    for (int i = 0; i < 32; i++)
+    {
+        Text* text = new Text(context_);
+        text->SetStyleAuto();
+        text->SetText(ToString("List item %d", i));
+        text->SetName(ToString("Item %d", i));
+        list->AddItem(text);
+    }
+
+    // Apply styles
+    window_->SetStyleAuto();
+    list->SetStyleAuto();
+    windowTitle->SetStyleAuto();
+    buttonClose->SetStyle("CloseButton");
+
+    // Subscribe to buttonClose release (following a 'press') events
+    SubscribeToEvent(buttonClose, E_RELEASED, URHO3D_HANDLER(Hello3DUI, HandleClosePressed));
+
+    // Subscribe also to all UI mouse clicks just to see where we have clicked
+    SubscribeToEvent(E_UIMOUSECLICK, URHO3D_HANDLER(Hello3DUI, HandleControlClicked));
+}
+
+void Hello3DUI::InitScene()
+{
+    ResourceCache* cache = GetSubsystem<ResourceCache>();
+
+    scene_ = new Scene(context_);
+    scene_->CreateComponent<Octree>();
+    Zone* zone = scene_->CreateComponent<Zone>();
+    zone->SetBoundingBox(BoundingBox(-1000.0f, 1000.0f));
+    zone->SetFogColor(Color::GRAY);
+    zone->SetFogStart(100.0f);
+    zone->SetFogEnd(300.0f);
+
+    // Create a child scene node (at world origin) and a StaticModel component into it.
+    Node* boxNode = scene_->CreateChild("Box");
+    boxNode->SetScale(Vector3(5.0f, 5.0f, 5.0f));
+    boxNode->SetRotation(Quaternion(90, Vector3::LEFT));
+
+    // Create a box model and hide it initially.
+    StaticModel* boxModel = boxNode->CreateComponent<StaticModel>();
+    boxModel->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
+    boxNode->SetEnabled(false);
+
+    // Create a camera.
+    cameraNode_ = scene_->CreateChild("Camera");
+    cameraNode_->CreateComponent<Camera>();
+
+    // Set an initial position for the camera scene node.
+    cameraNode_->SetPosition(Vector3(0.0f, 0.0f, -10.0f));
+
+    // Set up a viewport so 3D scene can be visible.
+    Renderer* renderer = GetSubsystem<Renderer>();
+    SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
+    renderer->SetViewport(0, viewport);
+
+    // Subscribe to update event and animate cube and handle input.
+    SubscribeToEvent(E_UPDATE, URHO3D_HANDLER(Hello3DUI, HandleUpdate));
+}
+
+void Hello3DUI::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, URHO3D_HANDLER(Hello3DUI, HandleDragBegin));
+    SubscribeToEvent(draggableFish, E_DRAGMOVE, URHO3D_HANDLER(Hello3DUI, HandleDragMove));
+    SubscribeToEvent(draggableFish, E_DRAGEND, URHO3D_HANDLER(Hello3DUI, HandleDragEnd));
+}
+
+void Hello3DUI::HandleDragBegin(StringHash eventType, VariantMap& eventData)
+{
+    // Get UIElement relative position where input (touch or click) occurred (top-left = IntVector2(0,0))
+    dragBeginPosition_ = IntVector2(eventData["ElementX"].GetInt(), eventData["ElementY"].GetInt());
+}
+
+void Hello3DUI::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 Hello3DUI::HandleDragEnd(StringHash eventType, VariantMap& eventData) // For reference (not used here)
+{
+}
+
+void Hello3DUI::HandleClosePressed(StringHash eventType, VariantMap& eventData)
+{
+    if (GetPlatform() != "Web")
+        engine_->Exit();
+}
+
+void Hello3DUI::HandleControlClicked(StringHash eventType, VariantMap& eventData)
+{
+    // Get the Text control acting as the Window's title
+    Text* windowTitle = window_->GetChildStaticCast<Text>("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 + "!");
+}
+
+void Hello3DUI::Init3DUI()
+{
+    ResourceCache* cache = GetSubsystem<ResourceCache>();
+
+    // Node that will get UI rendered on it.
+    Node* boxNode = scene_->GetChild("Box");
+    // Create a component that sets up UI rendering. It sets material to StaticModel of the node.
+    UIComponent* component = boxNode->CreateComponent<UIComponent>();
+    // Optionally modify material. Technique is changed so object is visible without any lights.
+    component->GetMaterial()->SetTechnique(0, cache->GetResource<Technique>("Techniques/DiffUnlit.xml"));
+    // Save root element of texture UI for later use.
+    textureRoot_ = component->GetRoot();
+    // Set size of root element. This is size of texture as well.
+    textureRoot_->SetSize(512, 512);
+}
+
+void Hello3DUI::HandleUpdate(StringHash, VariantMap& eventData)
+{
+    using namespace Update;
+    float timeStep = eventData[P_TIMESTEP].GetFloat();
+    Input* input = GetSubsystem<Input>();
+    Node* node = scene_->GetChild("Box");
+
+    if (current_.NotNull() && drawDebug_)
+        GetSubsystem<UI>()->DebugDraw(current_);
+
+    if (input->GetMouseButtonPress(MOUSEB_LEFT))
+        current_ = GetSubsystem<UI>()->GetElementAt(input->GetMousePosition());
+
+    if (input->GetKeyPress(KEY_TAB))
+    {
+        renderOnCube_ = !renderOnCube_;
+        // Toggle between rendering on screen or to texture.
+        if (renderOnCube_)
+        {
+            node->SetEnabled(true);
+            textureRoot_->AddChild(window_);
+        }
+        else
+        {
+            node->SetEnabled(false);
+            uiRoot_->AddChild(window_);
+        }
+    }
+
+    if (input->GetKeyPress(KEY_SPACE))
+        animateCube_ = !animateCube_;
+
+    if (input->GetKeyPress(KEY_F2))
+        drawDebug_ = !drawDebug_;
+
+    if (animateCube_)
+    {
+        node->Yaw(6.0f * timeStep * 1.5f);
+        node->Roll(-6.0f * timeStep * 1.5f);
+        node->Pitch(-6.0f * timeStep * 1.5f);
+    }
+}

+ 103 - 0
Source/Samples/48_Hello3DUI/Hello3DUI.h

@@ -0,0 +1,103 @@
+//
+// Copyright (c) 2008-2017 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 Urho3D
+{
+
+class Window;
+
+}
+
+/// A 3D UI demonstration based on the HelloGUI sample. Renders UI alternatively
+/// either to a 3D scene object using UIComponent, or directly to the backbuffer.
+class Hello3DUI : public Sample
+{
+    URHO3D_OBJECT(Hello3DUI, Sample);
+
+public:
+    /// Construct.
+    Hello3DUI(Context* context);
+
+    /// Setup after engine initialization and before running the main loop.
+    virtual void Start() override;
+
+protected:
+    /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
+    virtual String GetScreenJoystickPatchString() const override { 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 Scene.
+    void InitScene();
+    /// 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);
+    /// Animate cube.
+    void HandleUpdate(StringHash, VariantMap& eventData);
+    /// Create 3D UI.
+    void Init3DUI();
+
+    /// The Scene.
+    SharedPtr<Scene> scene_;
+    /// The Window.
+    SharedPtr<Window> window_;
+    /// The UI's root UIElement.
+    SharedPtr<UIElement> uiRoot_;
+    /// Remembered drag begin position.
+    IntVector2 dragBeginPosition_;
+    /// Root UI element of texture.
+    SharedPtr<UIElement> textureRoot_;
+    /// UI element with instructions.
+    SharedPtr<Text> instructions_;
+    /// Enable or disable cube rotation.
+    bool animateCube_;
+    /// Enable or disable rendering to texture.
+    bool renderOnCube_;
+    /// Draw debug information of last clicked element.
+    bool drawDebug_;
+    /// Last clicked UI element.
+    WeakPtr<UIElement> current_;
+};
+
+

+ 3 - 3
Source/Samples/Sample.h

@@ -59,11 +59,11 @@ public:
     Sample(Context* context);
 
     /// Setup before engine initialization. Modifies the engine parameters.
-    virtual void Setup();
+    virtual void Setup() override;
     /// Setup after engine initialization. Creates the logo, console & debug HUD.
-    virtual void Start();
+    virtual void Start() override;
     /// Cleanup after the main loop. Called by Application.
-    virtual void Stop();
+    virtual void Stop() override;
 
 protected:
     /// Return XML patch instructions for screen joystick layout for a specific sample app, if any.

+ 2 - 2
Source/ThirdParty/FreeType/src/gzip/zutil.c

@@ -5,7 +5,7 @@
 
 /* @(#) $Id$ */
 
-// Modified by Yao Wei Tjong for Urho3D
+// Modified by Yao Wei Tjong & Lasse Oorni for Urho3D
 
 #include "zutil.h"
 
@@ -14,7 +14,7 @@ extern void exit OF((int));
 #endif
 
 // Urho3D: quick fix for debug build
-#ifdef DEBUG
+#if 0
 
 #  ifndef verbose
 #    define verbose 0

+ 4 - 1
Source/ThirdParty/FreeType/src/gzip/zutil.h

@@ -10,6 +10,8 @@
 
 /* @(#) $Id$ */
 
+// Modified by Lasse Oorni for Urho3D
+
 #ifndef _Z_UTIL_H
 #define _Z_UTIL_H
 
@@ -182,7 +184,8 @@ typedef unsigned long  ulg;
 #endif
 
 /* Diagnostic functions */
-#ifdef DEBUG
+// Urho3D: disabled to prevent clash with Assimp's zlib
+#if 0
 #  include <stdio.h>
    extern int z_verbose;
    extern void z_error    OF((char *m));

+ 63 - 0
Source/ThirdParty/LICENSES

@@ -30,6 +30,34 @@ Andreas Jonsson
 [email protected]
 
 
+Base64 license
+--------------
+
+base64.cpp and base64.h
+
+Copyright (C) 2004-2017 René Nyffenegger
+
+This source code is provided 'as-is', without any express or implied
+warranty. In no event will the author be held liable for any damages
+arising from the use of this software.
+
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute it
+freely, subject to the following restrictions:
+
+1. The origin of this source code must not be misrepresented; you must not
+   claim that you wrote the original source code. If you use this source code
+   in a product, an acknowledgment in the product documentation would be
+   appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and must not be
+   misrepresented as being the original source code.
+
+3. This notice may not be removed or altered from any source distribution.
+
+René Nyffenegger [email protected]
+
+
 Boost license
 -------------
 
@@ -656,3 +684,38 @@ 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.
+
+
+WebP license
+------------
+
+Copyright (c) 2010, Google Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+  * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+  * 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.
+
+  * Neither the name of Google 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.
+

+ 1 - 1
Source/ThirdParty/Lua/CMakeLists.txt

@@ -40,7 +40,7 @@ setup_library ()
 install_header_files (DIRECTORY src/ DESTINATION ${DEST_INCLUDE_DIR}/ThirdParty/Lua FILES_MATCHING PATTERN *.h)  # Note: the trailing slash is significant
 
 # Setup additional Lua standalone targets (these targets can be transfered and executed on an embedded device, such as Raspberry Pi and Android)
-if (NOT IOS AND NOT TVOS AND NOT WEB)
+if (NOT CMAKE_PROJECT_NAME MATCHES ^Urho3D-ExternalProject-tolua\\+\\+ AND NOT IOS AND NOT TVOS AND NOT WEB)
     # Define target name for Lua interpreter
     set (TARGET_NAME lua_interpreter)   # Note: intended target name is 'lua' which clashes with 'Lua' library target above for case-insensitive platform
 

+ 2 - 2
Source/ThirdParty/Lua/src/loslib.c

@@ -36,8 +36,8 @@ static int os_pushresult (lua_State *L, int i, const char *filename) {
 
 
 static int os_execute (lua_State *L) {
-// Urho3D - tvOS port, system not available for AppleTVOS and also its simulator
-#ifdef TVOS
+// Urho3D - tvOS port, system not available for AppleTVOS and also its simulator, also soon for iOS
+#if defined(TVOS) || defined(IOS)
   lua_pushinteger(L, -1);
 #else
   lua_pushinteger(L, system(luaL_optstring(L, 1, NULL)));

+ 3 - 0
Source/ThirdParty/LuaJIT/CMakeLists.txt

@@ -39,6 +39,8 @@ if (NOT CMAKE_PROJECT_NAME STREQUAL Urho3D)
         cmake_policy (SET CMP0026 OLD)
         # MACOSX_RPATH is enabled by default
         cmake_policy (SET CMP0042 NEW)
+        # Honor the visibility properties for SHARED target types only
+        cmake_policy (SET CMP0063 OLD)
     endif ()
 
     # Set project name
@@ -595,6 +597,7 @@ if (NOT CMAKE_PROJECT_NAME MATCHES ^Urho3D-ExternalProject-LuaJIT AND NOT IOS AN
         COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/src/jit ${LUAJIT_DEP_DIR}
         COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/generated/vmdef.lua ${LUAJIT_DEP_DIR}
         COMMENT "Copying dependency files for luajit standalone executable")
+    add_make_clean_files (${LUAJIT_DEP_DIR})
 
     # Install dependency files required by luajit
     if (DEST_RUNTIME_DIR)

+ 2 - 0
Source/ThirdParty/LuaJIT/src/host/CMakeLists.txt

@@ -36,6 +36,8 @@ if (NOT CMAKE_PROJECT_NAME STREQUAL Urho3D)
         cmake_policy (SET CMP0026 OLD)
         # MACOSX_RPATH is enabled by default
         cmake_policy (SET CMP0042 NEW)
+        # Honor the visibility properties for SHARED target types only
+        cmake_policy (SET CMP0063 OLD)
     endif ()
 
     # Set project name

ファイルの差分が大きいため隠しています
+ 937 - 37
Source/ThirdParty/SQLite/src/shell.c


ファイルの差分が大きいため隠しています
+ 843 - 24
Source/ThirdParty/SQLite/src/sqlite3.c


+ 280 - 77
Source/ThirdParty/SQLite/src/sqlite3.h

@@ -1,5 +1,5 @@
 /*
-** 2001 September 15
+** 2001-09-15
 **
 ** The author disclaims copyright to this source code.  In place of
 ** a legal notice, here is a blessing:
@@ -121,9 +121,9 @@ extern "C" {
 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
 ** [sqlite_version()] and [sqlite_source_id()].
 */
-#define SQLITE_VERSION        "3.18.0"
-#define SQLITE_VERSION_NUMBER 3018000
-#define SQLITE_SOURCE_ID      "2017-03-28 18:48:43 424a0d380332858ee55bdebc4af3789f74e70a2b3ba1cf29d84b9b4bcf3e2e37"
+#define SQLITE_VERSION        "3.20.1"
+#define SQLITE_VERSION_NUMBER 3020001
+#define SQLITE_SOURCE_ID      "2017-08-24 16:21:36 8d3a7ea6c5690d6b7c3767558f4f01b511c55463e3f9e64506801fe9b74dce34"
 
 /*
 ** CAPI3REF: Run-Time Library Version Numbers
@@ -417,7 +417,7 @@ SQLITE_API int sqlite3_exec(
 */
 #define SQLITE_OK           0   /* Successful result */
 /* beginning-of-error-codes */
-#define SQLITE_ERROR        1   /* SQL error or missing database */
+#define SQLITE_ERROR        1   /* Generic error */
 #define SQLITE_INTERNAL     2   /* Internal logic error in SQLite */
 #define SQLITE_PERM         3   /* Access permission denied */
 #define SQLITE_ABORT        4   /* Callback routine requested an abort */
@@ -432,7 +432,7 @@ SQLITE_API int sqlite3_exec(
 #define SQLITE_FULL        13   /* Insertion failed because database is full */
 #define SQLITE_CANTOPEN    14   /* Unable to open the database file */
 #define SQLITE_PROTOCOL    15   /* Database lock protocol error */
-#define SQLITE_EMPTY       16   /* Database is empty */
+#define SQLITE_EMPTY       16   /* Not used */
 #define SQLITE_SCHEMA      17   /* The database schema changed */
 #define SQLITE_TOOBIG      18   /* String or BLOB exceeds size limit */
 #define SQLITE_CONSTRAINT  19   /* Abort due to constraint violation */
@@ -440,7 +440,7 @@ SQLITE_API int sqlite3_exec(
 #define SQLITE_MISUSE      21   /* Library used incorrectly */
 #define SQLITE_NOLFS       22   /* Uses OS features not supported on host */
 #define SQLITE_AUTH        23   /* Authorization denied */
-#define SQLITE_FORMAT      24   /* Auxiliary database format error */
+#define SQLITE_FORMAT      24   /* Not used */
 #define SQLITE_RANGE       25   /* 2nd parameter to sqlite3_bind out of range */
 #define SQLITE_NOTADB      26   /* File opened that is not a database file */
 #define SQLITE_NOTICE      27   /* Notifications from sqlite3_log() */
@@ -857,7 +857,7 @@ struct sqlite3_io_methods {
 ** opcode allows these two values (10 retries and 25 milliseconds of delay)
 ** to be adjusted.  The values are changed for all database connections
 ** within the same process.  The argument is a pointer to an array of two
-** integers where the first integer i the new retry count and the second
+** integers where the first integer is the new retry count and the second
 ** integer is the delay.  If either integer is negative, then the setting
 ** is not changed but instead the prior value of that setting is written
 ** into the array entry, allowing the current retry settings to be
@@ -2007,6 +2007,17 @@ struct sqlite3_mem_methods {
 ** have been disabled - 0 if they are not disabled, 1 if they are.
 ** </dd>
 **
+** <dt>SQLITE_DBCONFIG_ENABLE_QPSG</dt>
+** <dd>^(The SQLITE_DBCONFIG_ENABLE_QPSG option activates or deactivates
+** the [query planner stability guarantee] (QPSG).  When the QPSG is active,
+** a single SQL query statement will always use the same algorithm regardless
+** of values of [bound parameters].)^ The QPSG disables some query optimizations
+** that look at the values of bound parameters, which can make some queries
+** slower.  But the QPSG has the advantage of more predictable behavior.  With
+** the QPSG active, SQLite will always use the same query plan in the field as
+** was used during testing in the lab.
+** </dd>
+**
 ** </dl>
 */
 #define SQLITE_DBCONFIG_MAINDBNAME            1000 /* const char* */
@@ -2016,6 +2027,7 @@ struct sqlite3_mem_methods {
 #define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */
 #define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */
 #define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE      1006 /* int int* */
+#define SQLITE_DBCONFIG_ENABLE_QPSG           1007 /* int int* */
 
 
 /*
@@ -2211,9 +2223,6 @@ SQLITE_API int sqlite3_total_changes(sqlite3*);
 ** ^A call to sqlite3_interrupt(D) that occurs when there are no running
 ** SQL statements is a no-op and has no effect on SQL statements
 ** that are started after the sqlite3_interrupt() call returns.
-**
-** If the database connection closes while [sqlite3_interrupt()]
-** is running then bad things will likely happen.
 */
 SQLITE_API void sqlite3_interrupt(sqlite3*);
 
@@ -2676,12 +2685,14 @@ SQLITE_API void sqlite3_randomness(int N, void *P);
 /*
 ** CAPI3REF: Compile-Time Authorization Callbacks
 ** METHOD: sqlite3
+** KEYWORDS: {authorizer callback}
 **
 ** ^This routine registers an authorizer callback with a particular
 ** [database connection], supplied in the first argument.
 ** ^The authorizer callback is invoked as SQL statements are being compiled
 ** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()],
-** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()].  ^At various
+** [sqlite3_prepare_v3()], [sqlite3_prepare16()], [sqlite3_prepare16_v2()],
+** and [sqlite3_prepare16_v3()].  ^At various
 ** points during the compilation process, as logic is being created
 ** to perform various actions, the authorizer callback is invoked to
 ** see if those actions are allowed.  ^The authorizer callback should
@@ -2703,8 +2714,10 @@ SQLITE_API void sqlite3_randomness(int N, void *P);
 ** parameter to the sqlite3_set_authorizer() interface. ^The second parameter
 ** to the callback is an integer [SQLITE_COPY | action code] that specifies
 ** the particular action to be authorized. ^The third through sixth parameters
-** to the callback are zero-terminated strings that contain additional
-** details about the action to be authorized.
+** to the callback are either NULL pointers or zero-terminated strings
+** that contain additional details about the action to be authorized.
+** Applications must always be prepared to encounter a NULL pointer in any
+** of the third through the sixth parameters of the authorization callback.
 **
 ** ^If the action code is [SQLITE_READ]
 ** and the callback returns [SQLITE_IGNORE] then the
@@ -2713,6 +2726,10 @@ SQLITE_API void sqlite3_randomness(int N, void *P);
 ** been read if [SQLITE_OK] had been returned.  The [SQLITE_IGNORE]
 ** return can be used to deny an untrusted user access to individual
 ** columns of a table.
+** ^When a table is referenced by a [SELECT] but no column values are
+** extracted from that table (for example in a query like
+** "SELECT count(*) FROM tab") then the [SQLITE_READ] authorizer callback
+** is invoked once for that table with a column name that is an empty string.
 ** ^If the action code is [SQLITE_DELETE] and the callback returns
 ** [SQLITE_IGNORE] then the [DELETE] operation proceeds but the
 ** [truncate optimization] is disabled and all rows are deleted individually.
@@ -3464,6 +3481,29 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
 #define SQLITE_LIMIT_TRIGGER_DEPTH            10
 #define SQLITE_LIMIT_WORKER_THREADS           11
 
+/*
+** CAPI3REF: Prepare Flags
+**
+** These constants define various flags that can be passed into
+** "prepFlags" parameter of the [sqlite3_prepare_v3()] and
+** [sqlite3_prepare16_v3()] interfaces.
+**
+** New flags may be added in future releases of SQLite.
+**
+** <dl>
+** [[SQLITE_PREPARE_PERSISTENT]] ^(<dt>SQLITE_PREPARE_PERSISTENT</dt>
+** <dd>The SQLITE_PREPARE_PERSISTENT flag is a hint to the query planner
+** that the prepared statement will be retained for a long time and
+** probably reused many times.)^ ^Without this flag, [sqlite3_prepare_v3()]
+** and [sqlite3_prepare16_v3()] assume that the prepared statement will 
+** be used just once or at most a few times and then destroyed using
+** [sqlite3_finalize()] relatively soon. The current implementation acts
+** on this hint by avoiding the use of [lookaside memory] so as not to
+** deplete the limited store of lookaside memory. Future versions of
+** SQLite may act on this hint differently.
+** </dl>
+*/
+#define SQLITE_PREPARE_PERSISTENT              0x01
 
 /*
 ** CAPI3REF: Compiling An SQL Statement
@@ -3471,17 +3511,29 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
 ** METHOD: sqlite3
 ** CONSTRUCTOR: sqlite3_stmt
 **
-** To execute an SQL query, it must first be compiled into a byte-code
-** program using one of these routines.
+** To execute an SQL statement, it must first be compiled into a byte-code
+** program using one of these routines.  Or, in other words, these routines
+** are constructors for the [prepared statement] object.
+**
+** The preferred routine to use is [sqlite3_prepare_v2()].  The
+** [sqlite3_prepare()] interface is legacy and should be avoided.
+** [sqlite3_prepare_v3()] has an extra "prepFlags" option that is used
+** for special purposes.
+**
+** The use of the UTF-8 interfaces is preferred, as SQLite currently
+** does all parsing using UTF-8.  The UTF-16 interfaces are provided
+** as a convenience.  The UTF-16 interfaces work by converting the
+** input text into UTF-8, then invoking the corresponding UTF-8 interface.
 **
 ** The first argument, "db", is a [database connection] obtained from a
 ** prior successful call to [sqlite3_open()], [sqlite3_open_v2()] or
 ** [sqlite3_open16()].  The database connection must not have been closed.
 **
 ** The second argument, "zSql", is the statement to be compiled, encoded
-** as either UTF-8 or UTF-16.  The sqlite3_prepare() and sqlite3_prepare_v2()
-** interfaces use UTF-8, and sqlite3_prepare16() and sqlite3_prepare16_v2()
-** use UTF-16.
+** as either UTF-8 or UTF-16.  The sqlite3_prepare(), sqlite3_prepare_v2(),
+** and sqlite3_prepare_v3()
+** interfaces use UTF-8, and sqlite3_prepare16(), sqlite3_prepare16_v2(),
+** and sqlite3_prepare16_v3() use UTF-16.
 **
 ** ^If the nByte argument is negative, then zSql is read up to the
 ** first zero terminator. ^If nByte is positive, then it is the
@@ -3508,10 +3560,11 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
 ** ^On success, the sqlite3_prepare() family of routines return [SQLITE_OK];
 ** otherwise an [error code] is returned.
 **
-** The sqlite3_prepare_v2() and sqlite3_prepare16_v2() interfaces are
-** recommended for all new programs. The two older interfaces are retained
-** for backwards compatibility, but their use is discouraged.
-** ^In the "v2" interfaces, the prepared statement
+** The sqlite3_prepare_v2(), sqlite3_prepare_v3(), sqlite3_prepare16_v2(),
+** and sqlite3_prepare16_v3() interfaces are recommended for all new programs.
+** The older interfaces (sqlite3_prepare() and sqlite3_prepare16())
+** are retained for backwards compatibility, but their use is discouraged.
+** ^In the "vX" interfaces, the prepared statement
 ** that is returned (the [sqlite3_stmt] object) contains a copy of the
 ** original SQL text. This causes the [sqlite3_step()] interface to
 ** behave differently in three ways:
@@ -3544,6 +3597,12 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
 ** or [GLOB] operator or if the parameter is compared to an indexed column
 ** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled.
 ** </li>
+**
+** <p>^sqlite3_prepare_v3() differs from sqlite3_prepare_v2() only in having
+** the extra prepFlags parameter, which is a bit array consisting of zero or
+** more of the [SQLITE_PREPARE_PERSISTENT|SQLITE_PREPARE_*] flags.  ^The
+** sqlite3_prepare_v2() interface works exactly the same as
+** sqlite3_prepare_v3() with a zero prepFlags parameter.
 ** </ol>
 */
 SQLITE_API int sqlite3_prepare(
@@ -3560,6 +3619,14 @@ SQLITE_API int sqlite3_prepare_v2(
   sqlite3_stmt **ppStmt,  /* OUT: Statement handle */
   const char **pzTail     /* OUT: Pointer to unused portion of zSql */
 );
+SQLITE_API int sqlite3_prepare_v3(
+  sqlite3 *db,            /* Database handle */
+  const char *zSql,       /* SQL statement, UTF-8 encoded */
+  int nByte,              /* Maximum length of zSql in bytes. */
+  unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_ flags */
+  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */
+  const char **pzTail     /* OUT: Pointer to unused portion of zSql */
+);
 SQLITE_API int sqlite3_prepare16(
   sqlite3 *db,            /* Database handle */
   const void *zSql,       /* SQL statement, UTF-16 encoded */
@@ -3574,6 +3641,14 @@ SQLITE_API int sqlite3_prepare16_v2(
   sqlite3_stmt **ppStmt,  /* OUT: Statement handle */
   const void **pzTail     /* OUT: Pointer to unused portion of zSql */
 );
+SQLITE_API int sqlite3_prepare16_v3(
+  sqlite3 *db,            /* Database handle */
+  const void *zSql,       /* SQL statement, UTF-16 encoded */
+  int nByte,              /* Maximum length of zSql in bytes. */
+  unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_ flags */
+  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */
+  const void **pzTail     /* OUT: Pointer to unused portion of zSql */
+);
 
 /*
 ** CAPI3REF: Retrieving Statement SQL
@@ -3581,7 +3656,8 @@ SQLITE_API int sqlite3_prepare16_v2(
 **
 ** ^The sqlite3_sql(P) interface returns a pointer to a copy of the UTF-8
 ** SQL text used to create [prepared statement] P if P was
-** created by either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()].
+** created by [sqlite3_prepare_v2()], [sqlite3_prepare_v3()],
+** [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()].
 ** ^The sqlite3_expanded_sql(P) interface returns a pointer to a UTF-8
 ** string containing the SQL text of prepared statement P with
 ** [bound parameters] expanded.
@@ -3705,7 +3781,7 @@ SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*);
 ** The [sqlite3_value_blob | sqlite3_value_type()] family of
 ** interfaces require protected sqlite3_value objects.
 */
-typedef struct Mem sqlite3_value;
+typedef struct sqlite3_value sqlite3_value;
 
 /*
 ** CAPI3REF: SQL Function Context Object
@@ -3807,6 +3883,15 @@ typedef struct sqlite3_context sqlite3_context;
 ** [sqlite3_blob_open | incremental BLOB I/O] routines.
 ** ^A negative value for the zeroblob results in a zero-length BLOB.
 **
+** ^The sqlite3_bind_pointer(S,I,P,T,D) routine causes the I-th parameter in
+** [prepared statement] S to have an SQL value of NULL, but to also be
+** associated with the pointer P of type T.  ^D is either a NULL pointer or
+** a pointer to a destructor function for P. ^SQLite will invoke the
+** destructor D with a single argument of P when it is finished using
+** P.  The T parameter should be a static string, preferably a string
+** literal. The sqlite3_bind_pointer() routine is part of the
+** [pointer passing interface] added for SQLite 3.20.0.
+**
 ** ^If any of the sqlite3_bind_*() routines are called with a NULL pointer
 ** for the [prepared statement] or with a prepared statement for which
 ** [sqlite3_step()] has been called more recently than [sqlite3_reset()],
@@ -3840,6 +3925,7 @@ SQLITE_API int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)
 SQLITE_API int sqlite3_bind_text64(sqlite3_stmt*, int, const char*, sqlite3_uint64,
                          void(*)(void*), unsigned char encoding);
 SQLITE_API int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
+SQLITE_API int sqlite3_bind_pointer(sqlite3_stmt*, int, void*, const char*,void(*)(void*));
 SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
 SQLITE_API int sqlite3_bind_zeroblob64(sqlite3_stmt*, int, sqlite3_uint64);
 
@@ -3883,8 +3969,8 @@ SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt*);
 ** ^If the value N is out of range or if the N-th parameter is
 ** nameless, then NULL is returned.  ^The returned string is
 ** always in UTF-8 encoding even if the named parameter was
-** originally specified as UTF-16 in [sqlite3_prepare16()] or
-** [sqlite3_prepare16_v2()].
+** originally specified as UTF-16 in [sqlite3_prepare16()],
+** [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()].
 **
 ** See also: [sqlite3_bind_blob|sqlite3_bind()],
 ** [sqlite3_bind_parameter_count()], and
@@ -3901,7 +3987,8 @@ SQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int);
 ** parameter to [sqlite3_bind_blob|sqlite3_bind()].  ^A zero
 ** is returned if no matching parameter is found.  ^The parameter
 ** name must be given in UTF-8 even if the original statement
-** was prepared from UTF-16 text using [sqlite3_prepare16_v2()].
+** was prepared from UTF-16 text using [sqlite3_prepare16_v2()] or
+** [sqlite3_prepare16_v3()].
 **
 ** See also: [sqlite3_bind_blob|sqlite3_bind()],
 ** [sqlite3_bind_parameter_count()], and
@@ -4055,16 +4142,18 @@ SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
 ** CAPI3REF: Evaluate An SQL Statement
 ** METHOD: sqlite3_stmt
 **
-** After a [prepared statement] has been prepared using either
-** [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] or one of the legacy
+** After a [prepared statement] has been prepared using any of
+** [sqlite3_prepare_v2()], [sqlite3_prepare_v3()], [sqlite3_prepare16_v2()],
+** or [sqlite3_prepare16_v3()] or one of the legacy
 ** interfaces [sqlite3_prepare()] or [sqlite3_prepare16()], this function
 ** must be called one or more times to evaluate the statement.
 **
 ** The details of the behavior of the sqlite3_step() interface depend
-** on whether the statement was prepared using the newer "v2" interface
-** [sqlite3_prepare_v2()] and [sqlite3_prepare16_v2()] or the older legacy
-** interface [sqlite3_prepare()] and [sqlite3_prepare16()].  The use of the
-** new "v2" interface is recommended for new applications but the legacy
+** on whether the statement was prepared using the newer "vX" interfaces
+** [sqlite3_prepare_v3()], [sqlite3_prepare_v2()], [sqlite3_prepare16_v3()],
+** [sqlite3_prepare16_v2()] or the older legacy
+** interfaces [sqlite3_prepare()] and [sqlite3_prepare16()].  The use of the
+** new "vX" interface is recommended for new applications but the legacy
 ** interface will continue to be supported.
 **
 ** ^In the legacy interface, the return value will be either [SQLITE_BUSY],
@@ -4110,7 +4199,7 @@ SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
 ** other than [SQLITE_ROW] before any subsequent invocation of
 ** sqlite3_step().  Failure to reset the prepared statement using 
 ** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
-** sqlite3_step().  But after [version 3.6.23.1] ([dateof:3.6.23.1],
+** sqlite3_step().  But after [version 3.6.23.1] ([dateof:3.6.23.1]),
 ** sqlite3_step() began
 ** calling [sqlite3_reset()] automatically in this circumstance rather
 ** than returning [SQLITE_MISUSE].  This is not considered a compatibility
@@ -4125,10 +4214,11 @@ SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
 ** specific [error codes] that better describes the error.
 ** We admit that this is a goofy design.  The problem has been fixed
 ** with the "v2" interface.  If you prepare all of your SQL statements
-** using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] instead
+** using [sqlite3_prepare_v3()] or [sqlite3_prepare_v2()]
+** or [sqlite3_prepare16_v2()] or [sqlite3_prepare16_v3()] instead
 ** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces,
 ** then the more specific [error codes] are returned directly
-** by sqlite3_step().  The use of the "v2" interface is recommended.
+** by sqlite3_step().  The use of the "vX" interfaces is recommended.
 */
 SQLITE_API int sqlite3_step(sqlite3_stmt*);
 
@@ -4190,6 +4280,28 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
 ** KEYWORDS: {column access functions}
 ** METHOD: sqlite3_stmt
 **
+** <b>Summary:</b>
+** <blockquote><table border=0 cellpadding=0 cellspacing=0>
+** <tr><td><b>sqlite3_column_blob</b><td>&rarr;<td>BLOB result
+** <tr><td><b>sqlite3_column_double</b><td>&rarr;<td>REAL result
+** <tr><td><b>sqlite3_column_int</b><td>&rarr;<td>32-bit INTEGER result
+** <tr><td><b>sqlite3_column_int64</b><td>&rarr;<td>64-bit INTEGER result
+** <tr><td><b>sqlite3_column_text</b><td>&rarr;<td>UTF-8 TEXT result
+** <tr><td><b>sqlite3_column_text16</b><td>&rarr;<td>UTF-16 TEXT result
+** <tr><td><b>sqlite3_column_value</b><td>&rarr;<td>The result as an 
+** [sqlite3_value|unprotected sqlite3_value] object.
+** <tr><td>&nbsp;<td>&nbsp;<td>&nbsp;
+** <tr><td><b>sqlite3_column_bytes</b><td>&rarr;<td>Size of a BLOB
+** or a UTF-8 TEXT result in bytes
+** <tr><td><b>sqlite3_column_bytes16&nbsp;&nbsp;</b>
+** <td>&rarr;&nbsp;&nbsp;<td>Size of UTF-16
+** TEXT in bytes
+** <tr><td><b>sqlite3_column_type</b><td>&rarr;<td>Default
+** datatype of the result
+** </table></blockquote>
+**
+** <b>Details:</b>
+**
 ** ^These routines return information about a single column of the current
 ** result row of a query.  ^In every case the first argument is a pointer
 ** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*]
@@ -4211,16 +4323,29 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
 ** are called from a different thread while any of these routines
 ** are pending, then the results are undefined.
 **
+** The first six interfaces (_blob, _double, _int, _int64, _text, and _text16)
+** each return the value of a result column in a specific data format.  If
+** the result column is not initially in the requested format (for example,
+** if the query returns an integer but the sqlite3_column_text() interface
+** is used to extract the value) then an automatic type conversion is performed.
+**
 ** ^The sqlite3_column_type() routine returns the
 ** [SQLITE_INTEGER | datatype code] for the initial data type
 ** of the result column.  ^The returned value is one of [SQLITE_INTEGER],
-** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].  The value
-** returned by sqlite3_column_type() is only meaningful if no type
-** conversions have occurred as described below.  After a type conversion,
-** the value returned by sqlite3_column_type() is undefined.  Future
+** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].
+** The return value of sqlite3_column_type() can be used to decide which
+** of the first six interface should be used to extract the column value.
+** The value returned by sqlite3_column_type() is only meaningful if no
+** automatic type conversions have occurred for the value in question.  
+** After a type conversion, the result of calling sqlite3_column_type()
+** is undefined, though harmless.  Future
 ** versions of SQLite may change the behavior of sqlite3_column_type()
 ** following a type conversion.
 **
+** If the result is a BLOB or a TEXT string, then the sqlite3_column_bytes()
+** or sqlite3_column_bytes16() interfaces can be used to determine the size
+** of that BLOB or string.
+**
 ** ^If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes()
 ** routine returns the number of bytes in that BLOB or string.
 ** ^If the result is a UTF-16 string, then sqlite3_column_bytes() converts
@@ -4257,9 +4382,13 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
 ** [sqlite3_column_value()] is used in any other way, including calls
 ** to routines like [sqlite3_value_int()], [sqlite3_value_text()],
 ** or [sqlite3_value_bytes()], the behavior is not threadsafe.
+** Hence, the sqlite3_column_value() interface
+** is normally only useful within the implementation of 
+** [application-defined SQL functions] or [virtual tables], not within
+** top-level application code.
 **
-** These routines attempt to convert the value where appropriate.  ^For
-** example, if the internal representation is FLOAT and a text result
+** The these routines may attempt to convert the datatype of the result.
+** ^For example, if the internal representation is FLOAT and a text result
 ** is requested, [sqlite3_snprintf()] is used internally to perform the
 ** conversion automatically.  ^(The following table details the conversions
 ** that are applied:
@@ -4331,7 +4460,7 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
 ** ^The pointers returned are valid until a type conversion occurs as
 ** described above, or until [sqlite3_step()] or [sqlite3_reset()] or
 ** [sqlite3_finalize()] is called.  ^The memory space used to hold strings
-** and BLOBs is freed automatically.  Do <em>not</em> pass the pointers returned
+** and BLOBs is freed automatically.  Do not pass the pointers returned
 ** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into
 ** [sqlite3_free()].
 **
@@ -4342,15 +4471,15 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
 ** [SQLITE_NOMEM].)^
 */
 SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);
-SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
-SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
 SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol);
 SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol);
 SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);
 SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);
 SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);
-SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);
 SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);
+SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
+SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
+SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);
 
 /*
 ** CAPI3REF: Destroy A Prepared Statement Object
@@ -4584,21 +4713,40 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6
 ** CAPI3REF: Obtaining SQL Values
 ** METHOD: sqlite3_value
 **
-** The C-language implementation of SQL functions and aggregates uses
-** this set of interface routines to access the parameter values on
-** the function or aggregate.  
-**
-** The xFunc (for scalar functions) or xStep (for aggregates) parameters
-** to [sqlite3_create_function()] and [sqlite3_create_function16()]
-** define callbacks that implement the SQL functions and aggregates.
-** The 3rd parameter to these callbacks is an array of pointers to
-** [protected sqlite3_value] objects.  There is one [sqlite3_value] object for
-** each parameter to the SQL function.  These routines are used to
-** extract values from the [sqlite3_value] objects.
+** <b>Summary:</b>
+** <blockquote><table border=0 cellpadding=0 cellspacing=0>
+** <tr><td><b>sqlite3_value_blob</b><td>&rarr;<td>BLOB value
+** <tr><td><b>sqlite3_value_double</b><td>&rarr;<td>REAL value
+** <tr><td><b>sqlite3_value_int</b><td>&rarr;<td>32-bit INTEGER value
+** <tr><td><b>sqlite3_value_int64</b><td>&rarr;<td>64-bit INTEGER value
+** <tr><td><b>sqlite3_value_pointer</b><td>&rarr;<td>Pointer value
+** <tr><td><b>sqlite3_value_text</b><td>&rarr;<td>UTF-8 TEXT value
+** <tr><td><b>sqlite3_value_text16</b><td>&rarr;<td>UTF-16 TEXT value in
+** the native byteorder
+** <tr><td><b>sqlite3_value_text16be</b><td>&rarr;<td>UTF-16be TEXT value
+** <tr><td><b>sqlite3_value_text16le</b><td>&rarr;<td>UTF-16le TEXT value
+** <tr><td>&nbsp;<td>&nbsp;<td>&nbsp;
+** <tr><td><b>sqlite3_value_bytes</b><td>&rarr;<td>Size of a BLOB
+** or a UTF-8 TEXT in bytes
+** <tr><td><b>sqlite3_value_bytes16&nbsp;&nbsp;</b>
+** <td>&rarr;&nbsp;&nbsp;<td>Size of UTF-16
+** TEXT in bytes
+** <tr><td><b>sqlite3_value_type</b><td>&rarr;<td>Default
+** datatype of the value
+** <tr><td><b>sqlite3_value_numeric_type&nbsp;&nbsp;</b>
+** <td>&rarr;&nbsp;&nbsp;<td>Best numeric datatype of the value
+** </table></blockquote>
+**
+** <b>Details:</b>
+**
+** These routines extract type, size, and content information from
+** [protected sqlite3_value] objects.  Protected sqlite3_value objects
+** are used to pass parameter information into implementation of
+** [application-defined SQL functions] and [virtual tables].
 **
 ** These routines work only with [protected sqlite3_value] objects.
 ** Any attempt to use these routines on an [unprotected sqlite3_value]
-** object results in undefined behavior.
+** is not threadsafe.
 **
 ** ^These routines work just like the corresponding [column access functions]
 ** except that these routines take a single [protected sqlite3_value] object
@@ -4609,6 +4757,24 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6
 ** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces
 ** extract UTF-16 strings as big-endian and little-endian respectively.
 **
+** ^If [sqlite3_value] object V was initialized 
+** using [sqlite3_bind_pointer(S,I,P,X,D)] or [sqlite3_result_pointer(C,P,X,D)]
+** and if X and Y are strings that compare equal according to strcmp(X,Y),
+** then sqlite3_value_pointer(V,Y) will return the pointer P.  ^Otherwise,
+** sqlite3_value_pointer(V,Y) returns a NULL. The sqlite3_bind_pointer() 
+** routine is part of the [pointer passing interface] added for SQLite 3.20.0.
+**
+** ^(The sqlite3_value_type(V) interface returns the
+** [SQLITE_INTEGER | datatype code] for the initial datatype of the
+** [sqlite3_value] object V. The returned value is one of [SQLITE_INTEGER],
+** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].)^
+** Other interfaces might change the datatype for an sqlite3_value object.
+** For example, if the datatype is initially SQLITE_INTEGER and
+** sqlite3_value_text(V) is called to extract a text value for that
+** integer, then subsequent calls to sqlite3_value_type(V) might return
+** SQLITE_TEXT.  Whether or not a persistent internal datatype conversion
+** occurs is undefined and may change from one release of SQLite to the next.
+**
 ** ^(The sqlite3_value_numeric_type() interface attempts to apply
 ** numeric affinity to the value.  This means that an attempt is
 ** made to convert the value to an integer or floating point.  If
@@ -4627,15 +4793,16 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6
 ** the SQL function that supplied the [sqlite3_value*] parameters.
 */
 SQLITE_API const void *sqlite3_value_blob(sqlite3_value*);
-SQLITE_API int sqlite3_value_bytes(sqlite3_value*);
-SQLITE_API int sqlite3_value_bytes16(sqlite3_value*);
 SQLITE_API double sqlite3_value_double(sqlite3_value*);
 SQLITE_API int sqlite3_value_int(sqlite3_value*);
 SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*);
+SQLITE_API void *sqlite3_value_pointer(sqlite3_value*, const char*);
 SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*);
 SQLITE_API const void *sqlite3_value_text16(sqlite3_value*);
 SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*);
 SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*);
+SQLITE_API int sqlite3_value_bytes(sqlite3_value*);
+SQLITE_API int sqlite3_value_bytes16(sqlite3_value*);
 SQLITE_API int sqlite3_value_type(sqlite3_value*);
 SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
 
@@ -4648,10 +4815,6 @@ SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
 ** information can be used to pass a limited amount of context from
 ** one SQL function to another.  Use the [sqlite3_result_subtype()]
 ** routine to set the subtype for the return value of an SQL function.
-**
-** SQLite makes no use of subtype itself.  It merely passes the subtype
-** from the result of one [application-defined SQL function] into the
-** input of another.
 */
 SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*);
 
@@ -4759,10 +4922,11 @@ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*);
 ** the compiled regular expression can be reused on multiple
 ** invocations of the same function.
 **
-** ^The sqlite3_get_auxdata() interface returns a pointer to the metadata
-** associated by the sqlite3_set_auxdata() function with the Nth argument
-** value to the application-defined function. ^If there is no metadata
-** associated with the function argument, this sqlite3_get_auxdata() interface
+** ^The sqlite3_get_auxdata(C,N) interface returns a pointer to the metadata
+** associated by the sqlite3_set_auxdata(C,N,P,X) function with the Nth argument
+** value to the application-defined function.  ^N is zero for the left-most
+** function argument.  ^If there is no metadata
+** associated with the function argument, the sqlite3_get_auxdata(C,N) interface
 ** returns a NULL pointer.
 **
 ** ^The sqlite3_set_auxdata(C,N,P,X) interface saves P as metadata for the N-th
@@ -4793,6 +4957,10 @@ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*);
 ** function parameters that are compile-time constants, including literal
 ** values and [parameters] and expressions composed from the same.)^
 **
+** The value of the N parameter to these interfaces should be non-negative.
+** Future enhancements may make use of negative N values to define new
+** kinds of function caching behavior.
+**
 ** These routines must be called from the same thread in which
 ** the SQL function is running.
 */
@@ -4916,7 +5084,7 @@ typedef void (*sqlite3_destructor_type)(void*);
 ** when it has finished using that result.
 ** ^If the 4th parameter to the sqlite3_result_text* interfaces
 ** or sqlite3_result_blob is the special constant SQLITE_TRANSIENT
-** then SQLite makes a copy of the result into space obtained from
+** then SQLite makes a copy of the result into space obtained
 ** from [sqlite3_malloc()] before it returns.
 **
 ** ^The sqlite3_result_value() interface sets the result of
@@ -4929,6 +5097,17 @@ typedef void (*sqlite3_destructor_type)(void*);
 ** [unprotected sqlite3_value] object is required, so either
 ** kind of [sqlite3_value] object can be used with this interface.
 **
+** ^The sqlite3_result_pointer(C,P,T,D) interface sets the result to an
+** SQL NULL value, just like [sqlite3_result_null(C)], except that it
+** also associates the host-language pointer P or type T with that 
+** NULL value such that the pointer can be retrieved within an
+** [application-defined SQL function] using [sqlite3_value_pointer()].
+** ^If the D parameter is not NULL, then it is a pointer to a destructor
+** for the P parameter.  ^SQLite invokes D with P as its only argument
+** when SQLite is finished with P.  The T parameter should be a static
+** string and preferably a string literal. The sqlite3_result_pointer()
+** routine is part of the [pointer passing interface] added for SQLite 3.20.0.
+**
 ** If these routines are called from within the different thread
 ** than the one containing the application-defined function that received
 ** the [sqlite3_context] pointer, the results are undefined.
@@ -4952,6 +5131,7 @@ SQLITE_API void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*
 SQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
 SQLITE_API void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));
 SQLITE_API void sqlite3_result_value(sqlite3_context*, sqlite3_value*);
+SQLITE_API void sqlite3_result_pointer(sqlite3_context*, void*,const char*,void(*)(void*));
 SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n);
 SQLITE_API int sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n);
 
@@ -5611,7 +5791,9 @@ SQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N);
 ** ^If the column-name parameter to sqlite3_table_column_metadata() is a
 ** NULL pointer, then this routine simply checks for the existence of the
 ** table and returns SQLITE_OK if the table exists and SQLITE_ERROR if it
-** does not.
+** does not.  If the table name parameter T in a call to
+** sqlite3_table_column_metadata(X,D,T,C,...) is NULL then the result is
+** undefined behavior.
 **
 ** ^The column is identified by the second, third and fourth parameters to
 ** this function. ^(The second parameter is either the name of the database
@@ -7124,6 +7306,24 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
 ** used as a proxy for the total work done by the prepared statement.
 ** If the number of virtual machine operations exceeds 2147483647
 ** then the value returned by this statement status code is undefined.
+**
+** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt>
+** <dd>^This is the number of times that the prepare statement has been
+** automatically regenerated due to schema changes or change to 
+** [bound parameters] that might affect the query plan.
+**
+** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt>
+** <dd>^This is the number of times that the prepared statement has
+** been run.  A single "run" for the purposes of this counter is one
+** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()].
+** The counter is incremented on the first [sqlite3_step()] call of each
+** cycle.
+**
+** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt>
+** <dd>^This is the approximate number of bytes of heap memory
+** used to store the prepared statement.  ^This value is not actually
+** a counter, and so the resetFlg parameter to sqlite3_stmt_status()
+** is ignored when the opcode is SQLITE_STMTSTATUS_MEMUSED.
 ** </dd>
 ** </dl>
 */
@@ -7131,6 +7331,9 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
 #define SQLITE_STMTSTATUS_SORT              2
 #define SQLITE_STMTSTATUS_AUTOINDEX         3
 #define SQLITE_STMTSTATUS_VM_STEP           4
+#define SQLITE_STMTSTATUS_REPREPARE         5
+#define SQLITE_STMTSTATUS_RUN               6
+#define SQLITE_STMTSTATUS_MEMUSED           99
 
 /*
 ** CAPI3REF: Custom Page Cache Object
@@ -9387,7 +9590,7 @@ typedef struct sqlite3_changegroup sqlite3_changegroup;
 ** sqlite3changegroup_output() functions, also available are the streaming
 ** versions sqlite3changegroup_add_strm() and sqlite3changegroup_output_strm().
 */
-int sqlite3changegroup_new(sqlite3_changegroup **pp);
+SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup **pp);
 
 /*
 ** CAPI3REF: Add A Changeset To A Changegroup
@@ -9464,7 +9667,7 @@ int sqlite3changegroup_new(sqlite3_changegroup **pp);
 **
 ** If no error occurs, SQLITE_OK is returned.
 */
-int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData);
+SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData);
 
 /*
 ** CAPI3REF: Obtain A Composite Changeset From A Changegroup
@@ -9490,7 +9693,7 @@ int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData);
 ** responsibility of the caller to eventually free the buffer using a
 ** call to sqlite3_free().
 */
-int sqlite3changegroup_output(
+SQLITE_API int sqlite3changegroup_output(
   sqlite3_changegroup*,
   int *pnData,                    /* OUT: Size of output buffer in bytes */
   void **ppData                   /* OUT: Pointer to output buffer */
@@ -9499,7 +9702,7 @@ int sqlite3changegroup_output(
 /*
 ** CAPI3REF: Delete A Changegroup Object
 */
-void sqlite3changegroup_delete(sqlite3_changegroup*);
+SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup*);
 
 /*
 ** CAPI3REF: Apply A Changeset To A Database
@@ -9888,11 +10091,11 @@ SQLITE_API int sqlite3session_patchset_strm(
   int (*xOutput)(void *pOut, const void *pData, int nData),
   void *pOut
 );
-int sqlite3changegroup_add_strm(sqlite3_changegroup*, 
+SQLITE_API int sqlite3changegroup_add_strm(sqlite3_changegroup*, 
     int (*xInput)(void *pIn, void *pData, int *pnData),
     void *pIn
 );
-int sqlite3changegroup_output_strm(sqlite3_changegroup*,
+SQLITE_API int sqlite3changegroup_output_strm(sqlite3_changegroup*,
     int (*xOutput)(void *pOut, const void *pData, int nData), 
     void *pOut
 );

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません