Commit 792a0585 authored by elsid's avatar elsid Committed by Bret Curtis

Add recastnavigation as subdirectory

parent af3c605b
......@@ -5,9 +5,6 @@ free -m
env GENERATOR='Unix Makefiles' CONFIGURATION=Release CI/build_googletest.sh
GOOGLETEST_DIR="$(pwd)/googletest/build"
env GENERATOR='Unix Makefiles' CONFIGURATION=Release CI/build_recastnavigation.sh
RECASTNAVIGATION_DIR="$(pwd)/recastnavigation/build"
mkdir build
cd build
export CODE_COVERAGE=1
......@@ -21,5 +18,4 @@ ${ANALYZE}cmake \
-DUSE_SYSTEM_TINYXML=TRUE \
-DGTEST_ROOT="${GOOGLETEST_DIR}" \
-DGMOCK_ROOT="${GOOGLETEST_DIR}" \
-DRecastNavigation_ROOT="${RECASTNAVIGATION_DIR}" \
..
......@@ -648,13 +648,6 @@ printf "SDL 2.0.7... "
echo Done.
}
echo
# recastnavigation
printf 'recastnavigation...'
{
env GENERATOR="${GENERATOR}" CONFIGURATION="${CONFIGURATION}" ${DEPS_INSTALL}/../../CI/build_recastnavigation.sh
add_cmake_opts -DRecastNavigation_ROOT="$(pwd)/recastnavigation/build"
}
echo
cd $DEPS_INSTALL/..
echo
echo "Setting up OpenMW build..."
......
......@@ -3,9 +3,6 @@
export CXX=clang++
export CC=clang
env GENERATOR='Unix Makefiles' CONFIGURATION=Release CI/build_recastnavigation.sh
RECASTNAVIGATION_DIR="$(pwd)/recastnavigation/build"
DEPENDENCIES_ROOT="/private/tmp/openmw-deps/openmw-deps"
QT_PATH=`brew --prefix qt`
mkdir build
......@@ -20,6 +17,5 @@ cmake \
-D DESIRED_QT_VERSION=5 \
-D BUILD_ESMTOOL=FALSE \
-D BUILD_MYGUI_PLUGIN=FALSE \
-D RecastNavigation_ROOT="${RECASTNAVIGATION_DIR}" \
-G"Unix Makefiles" \
..
#!/bin/sh -e
git clone https://github.com/recastnavigation/recastnavigation.git
cd recastnavigation
mkdir build
cd build
cmake \
-DCMAKE_BUILD_TYPE="${CONFIGURATION}" \
-DRECASTNAVIGATION_DEMO=OFF \
-DRECASTNAVIGATION_TESTS=OFF \
-DRECASTNAVIGATION_EXAMPLES=OFF \
-DRECASTNAVIGATION_STATIC=ON \
-DCMAKE_INSTALL_PREFIX=. \
-G "${GENERATOR}" \
..
cmake --build . --config "${CONFIGURATION}"
cmake --build . --target install --config "${CONFIGURATION}"
......@@ -469,7 +469,7 @@ if(WIN32)
INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/Debug/resources" DESTINATION "." CONFIGURATIONS Debug)
INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/Release/resources" DESTINATION "." CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel)
FILE(GLOB plugin_dir_debug "${OpenMW_BINARY_DIR}/Debug/osgPlugins-*")
FILE(GLOB plugin_dir_release "${OpenMW_BINARY_DIR}/Release/osgPlugins-*")
INSTALL(DIRECTORY ${plugin_dir_debug} DESTINATION "." CONFIGURATIONS Debug)
......@@ -536,6 +536,9 @@ if(WIN32)
endif(WIN32)
# Extern
set(RECASTNAVIGATION_DEMO OFF CACHE BOOL "Do not build RecastDemo")
add_subdirectory (extern/recastnavigation)
add_subdirectory (extern/osg-ffmpeg-videoplayer)
add_subdirectory (extern/oics)
if (BUILD_OPENCS)
......
......@@ -117,10 +117,6 @@ include_directories(
${FFmpeg_INCLUDE_DIRS}
)
find_package(RecastNavigation COMPONENTS DebugUtils Detour Recast REQUIRED)
include_directories(SYSTEM ${RecastNavigation_INCLUDE_DIRS})
target_link_libraries(openmw
${OSG_LIBRARIES}
${OPENTHREADS_LIBRARIES}
......
......@@ -28,10 +28,6 @@ if (GTEST_FOUND AND GMOCK_FOUND)
source_group(apps\\openmw_test_suite FILES openmw_test_suite.cpp ${UNITTEST_SRC_FILES})
find_package(RecastNavigation COMPONENTS DebugUtils Detour Recast REQUIRED)
include_directories(SYSTEM ${RecastNavigation_INCLUDE_DIRS})
openmw_add_executable(openmw_test_suite openmw_test_suite.cpp ${UNITTEST_SRC_FILES})
target_link_libraries(openmw_test_suite ${GMOCK_LIBRARIES} components)
......
......@@ -14,7 +14,7 @@ environment:
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
matrix:
allow_failures:
- msvc: 2015
- msvc: 2015
platform:
# - Win32
......@@ -52,6 +52,7 @@ install:
- set PATH=C:\Program Files\Git\mingw64\bin;%PATH%
before_build:
- cmd: git submodule update --init --recursive
- cmd: sh %APPVEYOR_BUILD_FOLDER%\CI\before_script.msvc.sh -c %configuration% -p %PLATFORM% -v %msvc% -V
build_script:
......
......@@ -213,10 +213,6 @@ include_directories(${Bullet_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR})
add_library(components STATIC ${COMPONENT_FILES} ${MOC_SRCS} ${ESM_UI_HDR})
find_package(RecastNavigation COMPONENTS DebugUtils Detour Recast REQUIRED)
include_directories(SYSTEM ${RecastNavigation_INCLUDE_DIRS})
target_link_libraries(components
${Boost_SYSTEM_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
......@@ -235,7 +231,9 @@ target_link_libraries(components
${SDL2_LIBRARIES}
${OPENGL_gl_LIBRARY}
${MyGUI_LIBRARIES}
${RecastNavigation_LIBRARIES}
RecastNavigation::DebugUtils
RecastNavigation::Detour
RecastNavigation::Recast
)
if (WIN32)
......
# editorconfig.org
# top-most EditorConfig file
root = true
[*]
indent_size = 4
indent_style = tab
[*.yml]
indent_size = 2
indent_style = space
## Compiled source #
*.com
*.class
*.dll
*.exe
*.ilk
*.o
*.pdb
*.so
*.idb
## Linux exes have no extension
RecastDemo/Bin/RecastDemo
RecastDemo/Bin/Tests
# Build directory
RecastDemo/Build
# Ignore meshes
RecastDemo/Bin/Meshes/*
## Logs and databases #
*.log
*.sql
*.sqlite
## OS generated files #
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
*.swp
*.swo
## xcode specific
*xcuserdata*
## SDL contrib
RecastDemo/Contrib/SDL/*
## Generated doc files
Docs/html
## IDE files
.idea/
cmake-build-*/
sudo: false
language: cpp
# Build with gcc and clang.
compiler:
- gcc
- clang
# Build both debug and release configurations, through use of an environment variable in the build matrix.
env:
- BUILD_TYPE=debug CMAKE_BUILD_TYPE=Debug
- BUILD_TYPE=release CMAKE_BUILD_TYPE=Release
addons:
apt:
packages:
- libsdl2-dev
install:
- wget https://github.com/premake/premake-core/releases/download/v5.0.0-alpha12/premake-5.0.0-alpha12-linux.tar.gz -O premake.tar.gz
- tar -xf premake.tar.gz
- rm premake.tar.gz
# Run premake to generate makefiles.
# Have to cd into directory and back out since premake5 doesn't appear to accept a directory argument.
before_script:
- cd RecastDemo && ../premake5 gmake && cd ..
- mkdir build && cd build && cmake -D CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} .. && cd ..
# Run make in the directory containing generated makefiles, on the configuration specified by the environment variable.
script:
- make -C RecastDemo/Build/gmake -j$(nproc) config=${BUILD_TYPE}
- RecastDemo/Bin/Tests
- make -C build -j$(nproc)
- cd build && ctest
cmake_minimum_required(VERSION 3.0)
project(RecastNavigation)
# lib versions
SET(SOVERSION 1)
SET(VERSION 1.0.0)
option(RECASTNAVIGATION_DEMO "Build demo" ON)
option(RECASTNAVIGATION_TESTS "Build tests" ON)
option(RECASTNAVIGATION_EXAMPLES "Build examples" ON)
option(RECASTNAVIGATION_STATIC "Build static libraries" ON)
add_subdirectory(DebugUtils)
add_subdirectory(Detour)
add_subdirectory(DetourCrowd)
add_subdirectory(DetourTileCache)
add_subdirectory(Recast)
if (RECASTNAVIGATION_DEMO)
add_subdirectory(RecastDemo)
endif ()
if (RECASTNAVIGATION_TESTS)
enable_testing()
add_subdirectory(Tests)
endif ()
# Contributing to Recast and Detour
We'd love for you to contribute to our source code and to make Recast and Detour even better than they are
today! Here are the guidelines we'd like you to follow:
- [Code of Conduct](#coc)
- [Question or Problem?](#question)
- [Issues and Bugs](#issue)
- [Feature Requests](#feature)
- [Submission Guidelines](#submission-guidelines)
- [Git Commit Guidelines](#git-commit-guidelines)
## <a name="coc"></a> Code of Conduct
This project adheres to the [Open Code of Conduct][code-of-conduct].
By participating, you are expected to honor this code.
## <a name="question"></a> Got a Question or Problem?
If you have questions about how to use Recast or Detour, please direct these to the [Google Group][groups]
discussion list. We are also available on [Gitter][gitter].
## <a name="issue"></a> Found an Issue?
If you find a bug in the source code or a mistake in the documentation, you can help us by
submitting an issue to our [GitHub Repository][github]. Even better you can submit a Pull Request
with a fix.
**Please see the Submission Guidelines below**.
## <a name="feature"></a> Want a Feature?
You can request a new feature by submitting an issue to our [GitHub Repository][github]. If you
would like to implement a new feature then consider what kind of change it is:
* **Major Changes** that you wish to contribute to the project should be discussed first on our
[Google Group][groups] or in [GitHub Issues][github-issues] so that we can better coordinate our efforts, prevent
duplication of work, and help you to craft the change so that it is successfully accepted into the
project.
* **Small Changes** can be crafted and submitted to the [GitHub Repository][github] as a Pull Request.
## Submission Guidelines
### Submitting an Issue
Before you submit your issue search the [GitHub Issues][github-issues] archive,
maybe your question was already answered.
If your issue appears to be a bug, and hasn't been reported, open a new issue.
Help us to maximize the effort we can spend fixing issues and adding new
features, by not reporting duplicate issues. Providing the following information will increase the
chances of your issue being dealt with quickly:
* **Overview of the Issue** - what type of issue is it, and why is it an issue for you?
* **Callstack** - if it's a crash or other runtime error, a callstack will help diagnosis
* **Screenshots** - for navmesh generation problems, a picture really is worth a thousand words.
Implement `duDebugDraw` and call some methods from DetourDebugDraw.h. Seriously, just do it, we'll definitely ask you to if you haven't!
* **Logs** - stdout and stderr from the console, or log files if there are any.
If integrating into your own codebase, be sure to implement the log callbacks in `rcContext`.
* **Reproduction steps** - a minimal, unambigious set of steps including input, that causes the error for you.
e.g. input geometry and settings you can use to input into RecastDemo to get it to fail.
Note: These can be saved by pressing the 9 key in RecastDemo, and the resulting .gset file can be shared (with the .obj if it is not one of the default ones).
* **Recast version(s) and/or git commit hash** - particularly if you can find the point at which the error first started happening
* **Environment** - operating system, compiler etc.
* **Related issues** - has a similar issue been reported before?
* **Suggest a Fix** - if you can't fix the bug yourself, perhaps you can point to what might be
causing the problem (line of code or commit)
Here is a great example of a well defined issue: https://github.com/recastnavigation/recastnavigation/issues/12
**If you get help, help others. Good karma rulez!**
### Submitting a Pull Request
Before you submit your pull request consider the following guidelines:
* Search [GitHub Pull Requests][github-pulls] for an open or closed Pull Request
that relates to your submission. You don't want to duplicate effort.
* Make your changes in a new git branch:
```shell
git checkout -b my-fix-branch master
```
* Implement your changes, **including appropriate tests if appropriate/possible**.
* Commit your changes using a descriptive commit message that follows our
[commit message conventions](#commit-message-format).
```shell
git commit -a
```
Note: the optional commit `-a` command line option will automatically "add" and "rm" edited files.
* Squash any work-in-progress commits (by rebasing) to form a series of commits that make sense individually.
Ideally the pull request will be small and focused enough that it fits sensibly in one commit.
```shell
git rebase -i origin/master
```
* Push your branch to GitHub:
```shell
git push origin my-fix-branch
```
* In GitHub, send a pull request to `recastnavigation:master`.
* If we suggest changes then:
* Make the required updates.
* Commit your changes to your branch (e.g. `my-fix-branch`).
* Squash the changes, overwriting history in your fix branch - we don't want history to include incomplete work.
* Push the changes to your GitHub repository (this will update your Pull Request).
If you have rebased to squash commits together, you will need to force push to update the PR:
```shell
git rebase master -i
git push origin my-fix-branch -f
```
That's it! Thank you for your contribution!
#### After your pull request is merged
After your pull request is merged, you can safely delete your branch and pull the changes
from the main (upstream) repository:
* Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows:
```shell
git push origin --delete my-fix-branch
```
* Check out the master branch:
```shell
git checkout master -f
```
* Delete the local branch:
```shell
git branch -D my-fix-branch
```
* Update your master with the latest upstream version:
```shell
git pull --ff upstream master
```
## Git Commit Guidelines
### Commit content
Do your best to factor commits appropriately, i.e not too large with unrelated
things in the same commit, and not too small with the same small change applied N
times in N different commits. If there was some accidental reformatting or whitespace
changes during the course of your commits, please rebase them away before submitting
the PR.
### Commit Message Format
Please format commit messages as follows (based on this [excellent post](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)):
```
Summarize change in 50 characters or less
Provide more detail after the first line. Leave one blank line below the
summary and wrap all lines at 72 characters or less.
If the change fixes an issue, leave another blank line after the final
paragraph and indicate which issue is fixed in the specific format
below.
Fix #42
```
Important things you should try to include in commit messages include:
* Motivation for the change
* Difference from previous behaviour
* Whether the change alters the public API, or affects existing behaviour significantly
[code-of-conduct]: http://todogroup.org/opencodeofconduct/#Recastnavigation/b.hymers@gmail.com
[github]: https://github.com/recastnavigation/recastnavigation
[github-issues]: https://github.com/recastnavigation/recastnavigation/issues
[github-pulls]: https://github.com/recastnavigation/recastnavigation/pulls
[gitter]: https://gitter.im/recastnavigation/chat
[groups]: https://groups.google.com/forum/?fromgroups#!forum/recastnavigation
file(GLOB SOURCES Source/*.cpp)
if (RECASTNAVIGATION_STATIC)
add_library(DebugUtils STATIC ${SOURCES})
else()
add_library(DebugUtils SHARED ${SOURCES})
endif()
add_library(RecastNavigation::DebugUtils ALIAS DebugUtils)
set(DebugUtils_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Include")
target_include_directories(DebugUtils PUBLIC
"$<BUILD_INTERFACE:${DebugUtils_INCLUDE_DIR}>"
)
target_link_libraries(DebugUtils
Recast
Detour
DetourTileCache
)
set_target_properties(DebugUtils PROPERTIES
SOVERSION ${SOVERSION}
VERSION ${VERSION}
)
install(TARGETS DebugUtils
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
COMPONENT library
)
file(GLOB INCLUDES Include/*.h)
install(FILES ${INCLUDES} DESTINATION include)
//
// Copyright (c) 2009-2010 Mikko Mononen memon@inside.org
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors 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 software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// 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 software.
// 3. This notice may not be removed or altered from any source distribution.
//
#ifndef DEBUGDRAW_H
#define DEBUGDRAW_H
// Some math headers don't have PI defined.
static const float DU_PI = 3.14159265f;
enum duDebugDrawPrimitives
{
DU_DRAW_POINTS,
DU_DRAW_LINES,
DU_DRAW_TRIS,
DU_DRAW_QUADS,
};
/// Abstract debug draw interface.
struct duDebugDraw
{
virtual ~duDebugDraw() = 0;
virtual void depthMask(bool state) = 0;
virtual void texture(bool state) = 0;
/// Begin drawing primitives.
/// @param prim [in] primitive type to draw, one of rcDebugDrawPrimitives.
/// @param size [in] size of a primitive, applies to point size and line width only.
virtual void begin(duDebugDrawPrimitives prim, float size = 1.0f) = 0;
/// Submit a vertex
/// @param pos [in] position of the verts.
/// @param color [in] color of the verts.
virtual void vertex(const float* pos, unsigned int color) = 0;
/// Submit a vertex
/// @param x,y,z [in] position of the verts.
/// @param color [in] color of the verts.
virtual void vertex(const float x, const float y, const float z, unsigned int color) = 0;
/// Submit a vertex
/// @param pos [in] position of the verts.
/// @param color [in] color of the verts.
virtual void vertex(const float* pos, unsigned int color, const float* uv) = 0;
/// Submit a vertex
/// @param x,y,z [in] position of the verts.
/// @param color [in] color of the verts.
virtual void vertex(const float x, const float y, const float z, unsigned int color, const float u, const float v) = 0;
/// End drawing primitives.
virtual void end() = 0;
/// Compute a color for given area.
virtual unsigned int areaToCol(unsigned int area);
};
inline unsigned int duRGBA(int r, int g, int b, int a)
{
return ((unsigned int)r) | ((unsigned int)g << 8) | ((unsigned int)b << 16) | ((unsigned int)a << 24);
}
inline unsigned int duRGBAf(float fr, float fg, float fb, float fa)
{
unsigned char r = (unsigned char)(fr*255.0f);
unsigned char g = (unsigned char)(fg*255.0f);
unsigned char b = (unsigned char)(fb*255.0f);
unsigned char a = (unsigned char)(fa*255.0f);
return duRGBA(r,g,b,a);
}
unsigned int duIntToCol(int i, int a);
void duIntToCol(int i, float* col);
inline unsigned int duMultCol(const unsigned int col, const unsigned int d)
{
const unsigned int r = col & 0xff;
const unsigned int g = (col >> 8) & 0xff;
const unsigned int b = (col >> 16) & 0xff;
const unsigned int a = (col >> 24) & 0xff;
return duRGBA((r*d) >> 8, (g*d) >> 8, (b*d) >> 8, a);
}
inline unsigned int duDarkenCol(unsigned int col)
{
return ((col >> 1) & 0x007f7f7f) | (col & 0xff000000);
}
inline unsigned int duLerpCol(unsigned int ca, unsigned int cb, unsigned int u)
{
const unsigned int ra = ca & 0xff;
const unsigned int ga = (ca >> 8) & 0xff;
const unsigned int ba = (ca >> 16) & 0xff;
const unsigned int aa = (ca >> 24) & 0xff;
const unsigned int rb = cb & 0xff;
const unsigned int gb = (cb >> 8) & 0xff;
const unsigned int bb = (cb >> 16) & 0xff;
const unsigned int ab = (cb >> 24) & 0xff;
unsigned int r = (ra*(255-u) + rb*u)/255;
unsigned int g = (ga*(255-u) + gb*u)/255;
unsigned int b = (ba*(255-u) + bb*u)/255;
unsigned int a = (aa*(255-u) + ab*u)/255;
return duRGBA(r,g,b,a);
}
inline unsigned int duTransCol(unsigned int c, unsigned int a)
{
return (a<<24) | (c & 0x00ffffff);
}
void duCalcBoxColors(unsigned int* colors, unsigned int colTop, unsigned int colSide);
void duDebugDrawCylinderWire(struct duDebugDraw* dd, float minx, float miny, float minz,
float maxx, float maxy, float maxz, unsigned int col, const float lineWidth);
void duDebugDrawBoxWire(struct duDebugDraw* dd, float minx, float miny, float minz,
float maxx, float maxy, float maxz, unsigned int col, const float lineWidth);
void duDebugDrawArc(struct duDebugDraw* dd, const float x0, const float y0, const float z0,
const float x1, const float y1, const float z1, const float h,
const float as0, const float as1, unsigned int col, const float lineWidth);
void duDebugDrawArrow(struct duDebugDraw* dd, const float x0, const float y0, const float z0,
const float x1, const float y1, const float z1,
const float as0, const float as1, unsigned int col, const float lineWidth);
void duDebugDrawCircle(struct duDebugDraw* dd, const float x, const float y, const float z,
const float r, unsigned int col, const float lineWidth);
void duDebugDrawCross(struct duDebugDraw* dd, const float x, const float y, const float z,
const float size, unsigned int col, const float lineWidth);
void duDebugDrawBox(struct duDebugDraw* dd, float minx, float miny, float minz,
float maxx, float maxy, float maxz, const unsigned int* fcol);
void duDebugDrawCylinder(struct duDebugDraw* dd, float minx, float miny, float minz,