mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
[11902] Import Recast Navigation
Import Recast Navigation as third party dependency Credits go to Mikko Mononen memon at inside dot org
This commit is contained in:
parent
97cb838de1
commit
136c0ba618
399 changed files with 142994 additions and 1 deletions
19
dep/recastnavigation/CMakeLists.txt
Normal file
19
dep/recastnavigation/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
#
|
||||||
|
# Copyright (C) 2005-2011 MaNGOS project <http://getmangos.com/>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
#
|
||||||
|
add_subdirectory(Detour)
|
||||||
|
#add_subdirectory(Recast)
|
||||||
208
dep/recastnavigation/DebugUtils/Include/DebugDraw.h
Normal file
208
dep/recastnavigation/DebugUtils/Include/DebugDraw.h
Normal file
|
|
@ -0,0 +1,208 @@
|
||||||
|
//
|
||||||
|
// 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,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Abstrace debug draw interface.
|
||||||
|
struct duDebugDraw
|
||||||
|
{
|
||||||
|
virtual ~duDebugDraw() = 0;
|
||||||
|
|
||||||
|
virtual void depthMask(bool state) = 0;
|
||||||
|
|
||||||
|
// Begin drawing primitives.
|
||||||
|
// Params:
|
||||||
|
// prim - (in) primitive type to draw, one of rcDebugDrawPrimitives.
|
||||||
|
// nverts - (in) number of vertices to be submitted.
|
||||||
|
// 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
|
||||||
|
// Params:
|
||||||
|
// pos - (in) position of the verts.
|
||||||
|
// color - (in) color of the verts.
|
||||||
|
virtual void vertex(const float* pos, unsigned int color) = 0;
|
||||||
|
|
||||||
|
// Submit a vertex
|
||||||
|
// Params:
|
||||||
|
// x,y,z - (in) position of the verts.
|
||||||
|
// color - (in) color of the verts.
|
||||||
|
virtual void vertex(const float x, const float y, const float z, unsigned int color) = 0;
|
||||||
|
|
||||||
|
// End drawing primitives.
|
||||||
|
virtual void end() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
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,
|
||||||
|
float maxx, float maxy, float maxz, unsigned int col);
|
||||||
|
|
||||||
|
void duDebugDrawGridXZ(struct duDebugDraw* dd, const float ox, const float oy, const float oz,
|
||||||
|
const int w, const int h, const float size,
|
||||||
|
const unsigned int col, const float lineWidth);
|
||||||
|
|
||||||
|
|
||||||
|
// Versions without begin/end, can be used to draw multiple primitives.
|
||||||
|
void duAppendCylinderWire(struct duDebugDraw* dd, float minx, float miny, float minz,
|
||||||
|
float maxx, float maxy, float maxz, unsigned int col);
|
||||||
|
|
||||||
|
void duAppendBoxWire(struct duDebugDraw* dd, float minx, float miny, float minz,
|
||||||
|
float maxx, float maxy, float maxz, unsigned int col);
|
||||||
|
|
||||||
|
void duAppendBoxPoints(struct duDebugDraw* dd, float minx, float miny, float minz,
|
||||||
|
float maxx, float maxy, float maxz, unsigned int col);
|
||||||
|
|
||||||
|
void duAppendArc(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);
|
||||||
|
|
||||||
|
void duAppendArrow(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);
|
||||||
|
|
||||||
|
void duAppendCircle(struct duDebugDraw* dd, const float x, const float y, const float z,
|
||||||
|
const float r, unsigned int col);
|
||||||
|
|
||||||
|
void duAppendCross(struct duDebugDraw* dd, const float x, const float y, const float z,
|
||||||
|
const float size, unsigned int col);
|
||||||
|
|
||||||
|
void duAppendBox(struct duDebugDraw* dd, float minx, float miny, float minz,
|
||||||
|
float maxx, float maxy, float maxz, const unsigned int* fcol);
|
||||||
|
|
||||||
|
void duAppendCylinder(struct duDebugDraw* dd, float minx, float miny, float minz,
|
||||||
|
float maxx, float maxy, float maxz, unsigned int col);
|
||||||
|
|
||||||
|
|
||||||
|
class duDisplayList : public duDebugDraw
|
||||||
|
{
|
||||||
|
float* m_pos;
|
||||||
|
unsigned int* m_color;
|
||||||
|
int m_size;
|
||||||
|
int m_cap;
|
||||||
|
|
||||||
|
bool m_depthMask;
|
||||||
|
duDebugDrawPrimitives m_prim;
|
||||||
|
float m_primSize;
|
||||||
|
|
||||||
|
void resize(int cap);
|
||||||
|
|
||||||
|
public:
|
||||||
|
duDisplayList(int cap = 512);
|
||||||
|
~duDisplayList();
|
||||||
|
virtual void depthMask(bool state);
|
||||||
|
virtual void begin(duDebugDrawPrimitives prim, float size = 1.0f);
|
||||||
|
virtual void vertex(const float x, const float y, const float z, unsigned int color);
|
||||||
|
virtual void vertex(const float* pos, unsigned int color);
|
||||||
|
virtual void end();
|
||||||
|
void clear();
|
||||||
|
void draw(struct duDebugDraw* dd);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // DEBUGDRAW_H
|
||||||
38
dep/recastnavigation/DebugUtils/Include/DetourDebugDraw.h
Normal file
38
dep/recastnavigation/DebugUtils/Include/DetourDebugDraw.h
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
//
|
||||||
|
// 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 DETOURDEBUGDRAW_H
|
||||||
|
#define DETOURDEBUGDRAW_H
|
||||||
|
|
||||||
|
#include "DetourNavMesh.h"
|
||||||
|
#include "DetourNavMeshQuery.h"
|
||||||
|
|
||||||
|
enum DrawNavMeshFlags
|
||||||
|
{
|
||||||
|
DU_DRAWNAVMESH_OFFMESHCONS = 0x01,
|
||||||
|
DU_DRAWNAVMESH_CLOSEDLIST = 0x02,
|
||||||
|
};
|
||||||
|
|
||||||
|
void duDebugDrawNavMesh(struct duDebugDraw* dd, const dtNavMesh& mesh, unsigned char flags);
|
||||||
|
void duDebugDrawNavMeshWithClosedList(struct duDebugDraw* dd, const dtNavMesh& mesh, const dtNavMeshQuery& query, unsigned char flags);
|
||||||
|
void duDebugDrawNavMeshNodes(struct duDebugDraw* dd, const dtNavMeshQuery& query);
|
||||||
|
void duDebugDrawNavMeshBVTree(struct duDebugDraw* dd, const dtNavMesh& mesh);
|
||||||
|
void duDebugDrawNavMeshPortals(struct duDebugDraw* dd, const dtNavMesh& mesh);
|
||||||
|
void duDebugDrawNavMeshPoly(struct duDebugDraw* dd, const dtNavMesh& mesh, dtPolyRef ref, const unsigned int col);
|
||||||
|
|
||||||
|
#endif // DETOURDEBUGDRAW_H
|
||||||
38
dep/recastnavigation/DebugUtils/Include/RecastDebugDraw.h
Normal file
38
dep/recastnavigation/DebugUtils/Include/RecastDebugDraw.h
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
//
|
||||||
|
// 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 RECAST_DEBUGDRAW_H
|
||||||
|
#define RECAST_DEBUGDRAW_H
|
||||||
|
|
||||||
|
void duDebugDrawTriMesh(struct duDebugDraw* dd, const float* verts, int nverts, const int* tris, const float* normals, int ntris, const unsigned char* flags);
|
||||||
|
void duDebugDrawTriMeshSlope(struct duDebugDraw* dd, const float* verts, int nverts, const int* tris, const float* normals, int ntris, const float walkableSlopeAngle);
|
||||||
|
|
||||||
|
void duDebugDrawHeightfieldSolid(struct duDebugDraw* dd, const struct rcHeightfield& hf);
|
||||||
|
void duDebugDrawHeightfieldWalkable(struct duDebugDraw* dd, const struct rcHeightfield& hf);
|
||||||
|
|
||||||
|
void duDebugDrawCompactHeightfieldSolid(struct duDebugDraw* dd, const struct rcCompactHeightfield& chf);
|
||||||
|
void duDebugDrawCompactHeightfieldRegions(struct duDebugDraw* dd, const struct rcCompactHeightfield& chf);
|
||||||
|
void duDebugDrawCompactHeightfieldDistance(struct duDebugDraw* dd, const struct rcCompactHeightfield& chf);
|
||||||
|
|
||||||
|
void duDebugDrawRegionConnections(struct duDebugDraw* dd, const struct rcContourSet& cset, const float alpha = 1.0f);
|
||||||
|
void duDebugDrawRawContours(struct duDebugDraw* dd, const struct rcContourSet& cset, const float alpha = 1.0f);
|
||||||
|
void duDebugDrawContours(struct duDebugDraw* dd, const struct rcContourSet& cset, const float alpha = 1.0f);
|
||||||
|
void duDebugDrawPolyMesh(struct duDebugDraw* dd, const struct rcPolyMesh& mesh);
|
||||||
|
void duDebugDrawPolyMeshDetail(struct duDebugDraw* dd, const struct rcPolyMeshDetail& dmesh);
|
||||||
|
|
||||||
|
#endif // RECAST_DEBUGDRAW_H
|
||||||
43
dep/recastnavigation/DebugUtils/Include/RecastDump.h
Normal file
43
dep/recastnavigation/DebugUtils/Include/RecastDump.h
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
//
|
||||||
|
// 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 RECAST_DUMP_H
|
||||||
|
#define RECAST_DUMP_H
|
||||||
|
|
||||||
|
struct duFileIO
|
||||||
|
{
|
||||||
|
virtual ~duFileIO() = 0;
|
||||||
|
virtual bool isWriting() const = 0;
|
||||||
|
virtual bool isReading() const = 0;
|
||||||
|
virtual bool write(const void* ptr, const size_t size) = 0;
|
||||||
|
virtual bool read(void* ptr, const size_t size) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
bool duDumpPolyMeshToObj(struct rcPolyMesh& pmesh, duFileIO* io);
|
||||||
|
bool duDumpPolyMeshDetailToObj(struct rcPolyMeshDetail& dmesh, duFileIO* io);
|
||||||
|
|
||||||
|
bool duDumpContourSet(struct rcContourSet& cset, duFileIO* io);
|
||||||
|
bool duReadContourSet(struct rcContourSet& cset, duFileIO* io);
|
||||||
|
|
||||||
|
bool duDumpCompactHeightfield(struct rcCompactHeightfield& chf, duFileIO* io);
|
||||||
|
bool duReadCompactHeightfield(struct rcCompactHeightfield& chf, duFileIO* io);
|
||||||
|
|
||||||
|
void duLogBuildTimes(rcContext& ctx, const int totalTileUsec);
|
||||||
|
|
||||||
|
|
||||||
|
#endif // RECAST_DUMP_H
|
||||||
599
dep/recastnavigation/DebugUtils/Source/DebugDraw.cpp
Normal file
599
dep/recastnavigation/DebugUtils/Source/DebugDraw.cpp
Normal file
|
|
@ -0,0 +1,599 @@
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
|
||||||
|
#define _USE_MATH_DEFINES
|
||||||
|
#include <math.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "DebugDraw.h"
|
||||||
|
|
||||||
|
|
||||||
|
duDebugDraw::~duDebugDraw()
|
||||||
|
{
|
||||||
|
// Empty
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline int bit(int a, int b)
|
||||||
|
{
|
||||||
|
return (a & (1 << b)) >> b;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int duIntToCol(int i, int a)
|
||||||
|
{
|
||||||
|
int r = bit(i, 1) + bit(i, 3) * 2 + 1;
|
||||||
|
int g = bit(i, 2) + bit(i, 4) * 2 + 1;
|
||||||
|
int b = bit(i, 0) + bit(i, 5) * 2 + 1;
|
||||||
|
return duRGBA(r*63,g*63,b*63,a);
|
||||||
|
}
|
||||||
|
|
||||||
|
void duIntToCol(int i, float* col)
|
||||||
|
{
|
||||||
|
int r = bit(i, 0) + bit(i, 3) * 2 + 1;
|
||||||
|
int g = bit(i, 1) + bit(i, 4) * 2 + 1;
|
||||||
|
int b = bit(i, 2) + bit(i, 5) * 2 + 1;
|
||||||
|
col[0] = 1 - r*63.0f/255.0f;
|
||||||
|
col[1] = 1 - g*63.0f/255.0f;
|
||||||
|
col[2] = 1 - b*63.0f/255.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
void duCalcBoxColors(unsigned int* colors, unsigned int colTop, unsigned int colSide)
|
||||||
|
{
|
||||||
|
if (!colors) return;
|
||||||
|
|
||||||
|
colors[0] = duMultCol(colTop, 250);
|
||||||
|
colors[1] = duMultCol(colSide, 140);
|
||||||
|
colors[2] = duMultCol(colSide, 165);
|
||||||
|
colors[3] = duMultCol(colSide, 217);
|
||||||
|
colors[4] = duMultCol(colSide, 165);
|
||||||
|
colors[5] = duMultCol(colSide, 217);
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDebugDrawCylinderWire(struct duDebugDraw* dd, float minx, float miny, float minz,
|
||||||
|
float maxx, float maxy, float maxz, unsigned int col, const float lineWidth)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_LINES, lineWidth);
|
||||||
|
duAppendCylinderWire(dd, minx,miny,minz, maxx,maxy,maxz, col);
|
||||||
|
dd->end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDebugDrawBoxWire(struct duDebugDraw* dd, float minx, float miny, float minz,
|
||||||
|
float maxx, float maxy, float maxz, unsigned int col, const float lineWidth)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_LINES, lineWidth);
|
||||||
|
duAppendBoxWire(dd, minx,miny,minz, maxx,maxy,maxz, col);
|
||||||
|
dd->end();
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_LINES, lineWidth);
|
||||||
|
duAppendArc(dd, x0,y0,z0, x1,y1,z1, h, as0, as1, col);
|
||||||
|
dd->end();
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_LINES, lineWidth);
|
||||||
|
duAppendArrow(dd, x0,y0,z0, x1,y1,z1, as0, as1, col);
|
||||||
|
dd->end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDebugDrawCircle(struct duDebugDraw* dd, const float x, const float y, const float z,
|
||||||
|
const float r, unsigned int col, const float lineWidth)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_LINES, lineWidth);
|
||||||
|
duAppendCircle(dd, x,y,z, r, col);
|
||||||
|
dd->end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDebugDrawCross(struct duDebugDraw* dd, const float x, const float y, const float z,
|
||||||
|
const float size, unsigned int col, const float lineWidth)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_LINES, lineWidth);
|
||||||
|
duAppendCross(dd, x,y,z, size, col);
|
||||||
|
dd->end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDebugDrawBox(struct duDebugDraw* dd, float minx, float miny, float minz,
|
||||||
|
float maxx, float maxy, float maxz, const unsigned int* fcol)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_TRIS);
|
||||||
|
duAppendBox(dd, minx,miny,minz, maxx,maxy,maxz, fcol);
|
||||||
|
dd->end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDebugDrawCylinder(struct duDebugDraw* dd, float minx, float miny, float minz,
|
||||||
|
float maxx, float maxy, float maxz, unsigned int col)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_TRIS);
|
||||||
|
duAppendCylinder(dd, minx,miny,minz, maxx,maxy,maxz, col);
|
||||||
|
dd->end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDebugDrawGridXZ(struct duDebugDraw* dd, const float ox, const float oy, const float oz,
|
||||||
|
const int w, const int h, const float size,
|
||||||
|
const unsigned int col, const float lineWidth)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_LINES, lineWidth);
|
||||||
|
for (int i = 0; i <= h; ++i)
|
||||||
|
{
|
||||||
|
dd->vertex(ox,oy,oz+i*size, col);
|
||||||
|
dd->vertex(ox+w*size,oy,oz+i*size, col);
|
||||||
|
}
|
||||||
|
for (int i = 0; i <= w; ++i)
|
||||||
|
{
|
||||||
|
dd->vertex(ox+i*size,oy,oz, col);
|
||||||
|
dd->vertex(ox+i*size,oy,oz+h*size, col);
|
||||||
|
}
|
||||||
|
dd->end();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void duAppendCylinderWire(struct duDebugDraw* dd, float minx, float miny, float minz,
|
||||||
|
float maxx, float maxy, float maxz, unsigned int col)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
|
||||||
|
static const int NUM_SEG = 16;
|
||||||
|
static float dir[NUM_SEG*2];
|
||||||
|
static bool init = false;
|
||||||
|
if (!init)
|
||||||
|
{
|
||||||
|
init = true;
|
||||||
|
for (int i = 0; i < NUM_SEG; ++i)
|
||||||
|
{
|
||||||
|
const float a = (float)i/(float)NUM_SEG*DU_PI*2;
|
||||||
|
dir[i*2] = cosf(a);
|
||||||
|
dir[i*2+1] = sinf(a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const float cx = (maxx + minx)/2;
|
||||||
|
const float cz = (maxz + minz)/2;
|
||||||
|
const float rx = (maxx - minx)/2;
|
||||||
|
const float rz = (maxz - minz)/2;
|
||||||
|
|
||||||
|
for (int i = 0, j = NUM_SEG-1; i < NUM_SEG; j = i++)
|
||||||
|
{
|
||||||
|
dd->vertex(cx+dir[j*2+0]*rx, miny, cz+dir[j*2+1]*rz, col);
|
||||||
|
dd->vertex(cx+dir[i*2+0]*rx, miny, cz+dir[i*2+1]*rz, col);
|
||||||
|
dd->vertex(cx+dir[j*2+0]*rx, maxy, cz+dir[j*2+1]*rz, col);
|
||||||
|
dd->vertex(cx+dir[i*2+0]*rx, maxy, cz+dir[i*2+1]*rz, col);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < NUM_SEG; i += NUM_SEG/4)
|
||||||
|
{
|
||||||
|
dd->vertex(cx+dir[i*2+0]*rx, miny, cz+dir[i*2+1]*rz, col);
|
||||||
|
dd->vertex(cx+dir[i*2+0]*rx, maxy, cz+dir[i*2+1]*rz, col);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void duAppendBoxWire(struct duDebugDraw* dd, float minx, float miny, float minz,
|
||||||
|
float maxx, float maxy, float maxz, unsigned int col)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
// Top
|
||||||
|
dd->vertex(minx, miny, minz, col);
|
||||||
|
dd->vertex(maxx, miny, minz, col);
|
||||||
|
dd->vertex(maxx, miny, minz, col);
|
||||||
|
dd->vertex(maxx, miny, maxz, col);
|
||||||
|
dd->vertex(maxx, miny, maxz, col);
|
||||||
|
dd->vertex(minx, miny, maxz, col);
|
||||||
|
dd->vertex(minx, miny, maxz, col);
|
||||||
|
dd->vertex(minx, miny, minz, col);
|
||||||
|
|
||||||
|
// bottom
|
||||||
|
dd->vertex(minx, maxy, minz, col);
|
||||||
|
dd->vertex(maxx, maxy, minz, col);
|
||||||
|
dd->vertex(maxx, maxy, minz, col);
|
||||||
|
dd->vertex(maxx, maxy, maxz, col);
|
||||||
|
dd->vertex(maxx, maxy, maxz, col);
|
||||||
|
dd->vertex(minx, maxy, maxz, col);
|
||||||
|
dd->vertex(minx, maxy, maxz, col);
|
||||||
|
dd->vertex(minx, maxy, minz, col);
|
||||||
|
|
||||||
|
// Sides
|
||||||
|
dd->vertex(minx, miny, minz, col);
|
||||||
|
dd->vertex(minx, maxy, minz, col);
|
||||||
|
dd->vertex(maxx, miny, minz, col);
|
||||||
|
dd->vertex(maxx, maxy, minz, col);
|
||||||
|
dd->vertex(maxx, miny, maxz, col);
|
||||||
|
dd->vertex(maxx, maxy, maxz, col);
|
||||||
|
dd->vertex(minx, miny, maxz, col);
|
||||||
|
dd->vertex(minx, maxy, maxz, col);
|
||||||
|
}
|
||||||
|
|
||||||
|
void duAppendBoxPoints(struct duDebugDraw* dd, float minx, float miny, float minz,
|
||||||
|
float maxx, float maxy, float maxz, unsigned int col)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
// Top
|
||||||
|
dd->vertex(minx, miny, minz, col);
|
||||||
|
dd->vertex(maxx, miny, minz, col);
|
||||||
|
dd->vertex(maxx, miny, minz, col);
|
||||||
|
dd->vertex(maxx, miny, maxz, col);
|
||||||
|
dd->vertex(maxx, miny, maxz, col);
|
||||||
|
dd->vertex(minx, miny, maxz, col);
|
||||||
|
dd->vertex(minx, miny, maxz, col);
|
||||||
|
dd->vertex(minx, miny, minz, col);
|
||||||
|
|
||||||
|
// bottom
|
||||||
|
dd->vertex(minx, maxy, minz, col);
|
||||||
|
dd->vertex(maxx, maxy, minz, col);
|
||||||
|
dd->vertex(maxx, maxy, minz, col);
|
||||||
|
dd->vertex(maxx, maxy, maxz, col);
|
||||||
|
dd->vertex(maxx, maxy, maxz, col);
|
||||||
|
dd->vertex(minx, maxy, maxz, col);
|
||||||
|
dd->vertex(minx, maxy, maxz, col);
|
||||||
|
dd->vertex(minx, maxy, minz, col);
|
||||||
|
}
|
||||||
|
|
||||||
|
void duAppendBox(struct duDebugDraw* dd, float minx, float miny, float minz,
|
||||||
|
float maxx, float maxy, float maxz, const unsigned int* fcol)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
const float verts[8*3] =
|
||||||
|
{
|
||||||
|
minx, miny, minz,
|
||||||
|
maxx, miny, minz,
|
||||||
|
maxx, miny, maxz,
|
||||||
|
minx, miny, maxz,
|
||||||
|
minx, maxy, minz,
|
||||||
|
maxx, maxy, minz,
|
||||||
|
maxx, maxy, maxz,
|
||||||
|
minx, maxy, maxz,
|
||||||
|
};
|
||||||
|
static const unsigned char inds[6*4] =
|
||||||
|
{
|
||||||
|
7, 6, 5, 4,
|
||||||
|
0, 1, 2, 3,
|
||||||
|
1, 5, 6, 2,
|
||||||
|
3, 7, 4, 0,
|
||||||
|
2, 6, 7, 3,
|
||||||
|
0, 4, 5, 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
const unsigned char* in = inds;
|
||||||
|
for (int i = 0; i < 6; ++i)
|
||||||
|
{
|
||||||
|
dd->vertex(&verts[*in*3], fcol[i]); in++;
|
||||||
|
dd->vertex(&verts[*in*3], fcol[i]); in++;
|
||||||
|
dd->vertex(&verts[*in*3], fcol[i]); in++;
|
||||||
|
dd->vertex(&verts[*in*3], fcol[i]); in++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void duAppendCylinder(struct duDebugDraw* dd, float minx, float miny, float minz,
|
||||||
|
float maxx, float maxy, float maxz, unsigned int col)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
|
||||||
|
static const int NUM_SEG = 16;
|
||||||
|
static float dir[NUM_SEG*2];
|
||||||
|
static bool init = false;
|
||||||
|
if (!init)
|
||||||
|
{
|
||||||
|
init = true;
|
||||||
|
for (int i = 0; i < NUM_SEG; ++i)
|
||||||
|
{
|
||||||
|
const float a = (float)i/(float)NUM_SEG*DU_PI*2;
|
||||||
|
dir[i*2] = cosf(a);
|
||||||
|
dir[i*2+1] = sinf(a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int col2 = duMultCol(col, 160);
|
||||||
|
|
||||||
|
const float cx = (maxx + minx)/2;
|
||||||
|
const float cz = (maxz + minz)/2;
|
||||||
|
const float rx = (maxx - minx)/2;
|
||||||
|
const float rz = (maxz - minz)/2;
|
||||||
|
|
||||||
|
for (int i = 2; i < NUM_SEG; ++i)
|
||||||
|
{
|
||||||
|
const int a = 0, b = i-1, c = i;
|
||||||
|
dd->vertex(cx+dir[a*2+0]*rx, miny, cz+dir[a*2+1]*rz, col2);
|
||||||
|
dd->vertex(cx+dir[b*2+0]*rx, miny, cz+dir[b*2+1]*rz, col2);
|
||||||
|
dd->vertex(cx+dir[c*2+0]*rx, miny, cz+dir[c*2+1]*rz, col2);
|
||||||
|
}
|
||||||
|
for (int i = 2; i < NUM_SEG; ++i)
|
||||||
|
{
|
||||||
|
const int a = 0, b = i, c = i-1;
|
||||||
|
dd->vertex(cx+dir[a*2+0]*rx, maxy, cz+dir[a*2+1]*rz, col);
|
||||||
|
dd->vertex(cx+dir[b*2+0]*rx, maxy, cz+dir[b*2+1]*rz, col);
|
||||||
|
dd->vertex(cx+dir[c*2+0]*rx, maxy, cz+dir[c*2+1]*rz, col);
|
||||||
|
}
|
||||||
|
for (int i = 0, j = NUM_SEG-1; i < NUM_SEG; j = i++)
|
||||||
|
{
|
||||||
|
dd->vertex(cx+dir[i*2+0]*rx, miny, cz+dir[i*2+1]*rz, col2);
|
||||||
|
dd->vertex(cx+dir[j*2+0]*rx, miny, cz+dir[j*2+1]*rz, col2);
|
||||||
|
dd->vertex(cx+dir[j*2+0]*rx, maxy, cz+dir[j*2+1]*rz, col);
|
||||||
|
|
||||||
|
dd->vertex(cx+dir[i*2+0]*rx, miny, cz+dir[i*2+1]*rz, col2);
|
||||||
|
dd->vertex(cx+dir[j*2+0]*rx, maxy, cz+dir[j*2+1]*rz, col);
|
||||||
|
dd->vertex(cx+dir[i*2+0]*rx, maxy, cz+dir[i*2+1]*rz, col);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void evalArc(const float x0, const float y0, const float z0,
|
||||||
|
const float dx, const float dy, const float dz,
|
||||||
|
const float h, const float u, float* res)
|
||||||
|
{
|
||||||
|
res[0] = x0 + dx * u;
|
||||||
|
res[1] = y0 + dy * u + h * (1-(u*2-1)*(u*2-1));
|
||||||
|
res[2] = z0 + dz * u;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void vcross(float* dest, const float* v1, const float* v2)
|
||||||
|
{
|
||||||
|
dest[0] = v1[1]*v2[2] - v1[2]*v2[1];
|
||||||
|
dest[1] = v1[2]*v2[0] - v1[0]*v2[2];
|
||||||
|
dest[2] = v1[0]*v2[1] - v1[1]*v2[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void vnormalize(float* v)
|
||||||
|
{
|
||||||
|
float d = 1.0f / sqrtf(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
|
||||||
|
v[0] *= d;
|
||||||
|
v[1] *= d;
|
||||||
|
v[2] *= d;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void vsub(float* dest, const float* v1, const float* v2)
|
||||||
|
{
|
||||||
|
dest[0] = v1[0]-v2[0];
|
||||||
|
dest[1] = v1[1]-v2[1];
|
||||||
|
dest[2] = v1[2]-v2[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline float vdistSqr(const float* v1, const float* v2)
|
||||||
|
{
|
||||||
|
const float x = v1[0]-v2[0];
|
||||||
|
const float y = v1[1]-v2[1];
|
||||||
|
const float z = v1[2]-v2[2];
|
||||||
|
return x*x + y*y + z*z;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void appendArrowHead(struct duDebugDraw* dd, const float* p, const float* q,
|
||||||
|
const float s, unsigned int col)
|
||||||
|
{
|
||||||
|
const float eps = 0.001f;
|
||||||
|
if (!dd) return;
|
||||||
|
if (vdistSqr(p,q) < eps*eps) return;
|
||||||
|
float ax[3], ay[3] = {0,1,0}, az[3];
|
||||||
|
vsub(az, q, p);
|
||||||
|
vnormalize(az);
|
||||||
|
vcross(ax, ay, az);
|
||||||
|
vcross(ay, az, ax);
|
||||||
|
vnormalize(ay);
|
||||||
|
|
||||||
|
dd->vertex(p, col);
|
||||||
|
// dd->vertex(p[0]+az[0]*s+ay[0]*s/2, p[1]+az[1]*s+ay[1]*s/2, p[2]+az[2]*s+ay[2]*s/2, col);
|
||||||
|
dd->vertex(p[0]+az[0]*s+ax[0]*s/3, p[1]+az[1]*s+ax[1]*s/3, p[2]+az[2]*s+ax[2]*s/3, col);
|
||||||
|
|
||||||
|
dd->vertex(p, col);
|
||||||
|
// dd->vertex(p[0]+az[0]*s-ay[0]*s/2, p[1]+az[1]*s-ay[1]*s/2, p[2]+az[2]*s-ay[2]*s/2, col);
|
||||||
|
dd->vertex(p[0]+az[0]*s-ax[0]*s/3, p[1]+az[1]*s-ax[1]*s/3, p[2]+az[2]*s-ax[2]*s/3, col);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void duAppendArc(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)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
static const int NUM_ARC_PTS = 8;
|
||||||
|
static const float PAD = 0.05f;
|
||||||
|
static const float ARC_PTS_SCALE = (1.0f-PAD*2) / (float)NUM_ARC_PTS;
|
||||||
|
const float dx = x1 - x0;
|
||||||
|
const float dy = y1 - y0;
|
||||||
|
const float dz = z1 - z0;
|
||||||
|
const float len = sqrtf(dx*dx + dy*dy + dz*dz);
|
||||||
|
float prev[3];
|
||||||
|
evalArc(x0,y0,z0, dx,dy,dz, len*h, PAD, prev);
|
||||||
|
for (int i = 1; i <= NUM_ARC_PTS; ++i)
|
||||||
|
{
|
||||||
|
const float u = PAD + i * ARC_PTS_SCALE;
|
||||||
|
float pt[3];
|
||||||
|
evalArc(x0,y0,z0, dx,dy,dz, len*h, u, pt);
|
||||||
|
dd->vertex(prev[0],prev[1],prev[2], col);
|
||||||
|
dd->vertex(pt[0],pt[1],pt[2], col);
|
||||||
|
prev[0] = pt[0]; prev[1] = pt[1]; prev[2] = pt[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
// End arrows
|
||||||
|
if (as0 > 0.001f)
|
||||||
|
{
|
||||||
|
float p[3], q[3];
|
||||||
|
evalArc(x0,y0,z0, dx,dy,dz, len*h, PAD, p);
|
||||||
|
evalArc(x0,y0,z0, dx,dy,dz, len*h, PAD+0.05f, q);
|
||||||
|
appendArrowHead(dd, p, q, as0, col);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (as1 > 0.001f)
|
||||||
|
{
|
||||||
|
float p[3], q[3];
|
||||||
|
evalArc(x0,y0,z0, dx,dy,dz, len*h, 1-PAD, p);
|
||||||
|
evalArc(x0,y0,z0, dx,dy,dz, len*h, 1-(PAD+0.05f), q);
|
||||||
|
appendArrowHead(dd, p, q, as1, col);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void duAppendArrow(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)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
|
||||||
|
dd->vertex(x0,y0,z0, col);
|
||||||
|
dd->vertex(x1,y1,z1, col);
|
||||||
|
|
||||||
|
// End arrows
|
||||||
|
const float p[3] = {x0,y0,z0}, q[3] = {x1,y1,z1};
|
||||||
|
if (as0 > 0.001f)
|
||||||
|
appendArrowHead(dd, p, q, as0, col);
|
||||||
|
if (as1 > 0.001f)
|
||||||
|
appendArrowHead(dd, q, p, as1, col);
|
||||||
|
}
|
||||||
|
|
||||||
|
void duAppendCircle(struct duDebugDraw* dd, const float x, const float y, const float z,
|
||||||
|
const float r, unsigned int col)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
static const int NUM_SEG = 40;
|
||||||
|
static float dir[40*2];
|
||||||
|
static bool init = false;
|
||||||
|
if (!init)
|
||||||
|
{
|
||||||
|
init = true;
|
||||||
|
for (int i = 0; i < NUM_SEG; ++i)
|
||||||
|
{
|
||||||
|
const float a = (float)i/(float)NUM_SEG*DU_PI*2;
|
||||||
|
dir[i*2] = cosf(a);
|
||||||
|
dir[i*2+1] = sinf(a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0, j = NUM_SEG-1; i < NUM_SEG; j = i++)
|
||||||
|
{
|
||||||
|
dd->vertex(x+dir[j*2+0]*r, y, z+dir[j*2+1]*r, col);
|
||||||
|
dd->vertex(x+dir[i*2+0]*r, y, z+dir[i*2+1]*r, col);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void duAppendCross(struct duDebugDraw* dd, const float x, const float y, const float z,
|
||||||
|
const float s, unsigned int col)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
dd->vertex(x-s,y,z, col);
|
||||||
|
dd->vertex(x+s,y,z, col);
|
||||||
|
dd->vertex(x,y-s,z, col);
|
||||||
|
dd->vertex(x,y+s,z, col);
|
||||||
|
dd->vertex(x,y,z-s, col);
|
||||||
|
dd->vertex(x,y,z+s, col);
|
||||||
|
}
|
||||||
|
|
||||||
|
duDisplayList::duDisplayList(int cap) :
|
||||||
|
m_pos(0),
|
||||||
|
m_color(0),
|
||||||
|
m_size(0),
|
||||||
|
m_cap(0),
|
||||||
|
m_depthMask(true),
|
||||||
|
m_prim(DU_DRAW_LINES),
|
||||||
|
m_primSize(1.0f)
|
||||||
|
{
|
||||||
|
if (cap < 8)
|
||||||
|
cap = 8;
|
||||||
|
resize(cap);
|
||||||
|
}
|
||||||
|
|
||||||
|
duDisplayList::~duDisplayList()
|
||||||
|
{
|
||||||
|
delete [] m_pos;
|
||||||
|
delete [] m_color;
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDisplayList::resize(int cap)
|
||||||
|
{
|
||||||
|
float* newPos = new float[cap*3];
|
||||||
|
if (m_size)
|
||||||
|
memcpy(newPos, m_pos, sizeof(float)*3*m_size);
|
||||||
|
delete [] m_pos;
|
||||||
|
m_pos = newPos;
|
||||||
|
|
||||||
|
unsigned int* newColor = new unsigned int[cap];
|
||||||
|
if (m_size)
|
||||||
|
memcpy(newColor, m_color, sizeof(unsigned int)*m_size);
|
||||||
|
delete [] m_color;
|
||||||
|
m_color = newColor;
|
||||||
|
|
||||||
|
m_cap = cap;
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDisplayList::clear()
|
||||||
|
{
|
||||||
|
m_size = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDisplayList::depthMask(bool state)
|
||||||
|
{
|
||||||
|
m_depthMask = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDisplayList::begin(duDebugDrawPrimitives prim, float size)
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
m_prim = prim;
|
||||||
|
m_primSize = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDisplayList::vertex(const float x, const float y, const float z, unsigned int color)
|
||||||
|
{
|
||||||
|
if (m_size+1 >= m_cap)
|
||||||
|
resize(m_cap*2);
|
||||||
|
float* p = &m_pos[m_size*3];
|
||||||
|
p[0] = x;
|
||||||
|
p[1] = y;
|
||||||
|
p[2] = z;
|
||||||
|
m_color[m_size] = color;
|
||||||
|
m_size++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDisplayList::vertex(const float* pos, unsigned int color)
|
||||||
|
{
|
||||||
|
vertex(pos[0],pos[1],pos[2],color);
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDisplayList::end()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDisplayList::draw(struct duDebugDraw* dd)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
if (!m_size) return;
|
||||||
|
dd->depthMask(m_depthMask);
|
||||||
|
dd->begin(m_prim, m_primSize);
|
||||||
|
for (int i = 0; i < m_size; ++i)
|
||||||
|
dd->vertex(&m_pos[i*3], m_color[i]);
|
||||||
|
dd->end();
|
||||||
|
}
|
||||||
484
dep/recastnavigation/DebugUtils/Source/DetourDebugDraw.cpp
Normal file
484
dep/recastnavigation/DebugUtils/Source/DetourDebugDraw.cpp
Normal file
|
|
@ -0,0 +1,484 @@
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
#include "DebugDraw.h"
|
||||||
|
#include "DetourDebugDraw.h"
|
||||||
|
#include "DetourNavMesh.h"
|
||||||
|
#include "DetourCommon.h"
|
||||||
|
#include "DetourNode.h"
|
||||||
|
|
||||||
|
#include "../../RecastDemo/Include/Debug.h"
|
||||||
|
|
||||||
|
static float distancePtLine2d(const float* pt, const float* p, const float* q)
|
||||||
|
{
|
||||||
|
float pqx = q[0] - p[0];
|
||||||
|
float pqz = q[2] - p[2];
|
||||||
|
float dx = pt[0] - p[0];
|
||||||
|
float dz = pt[2] - p[2];
|
||||||
|
float d = pqx*pqx + pqz*pqz;
|
||||||
|
float t = pqx*dx + pqz*dz;
|
||||||
|
if (d != 0) t /= d;
|
||||||
|
dx = p[0] + t*pqx - pt[0];
|
||||||
|
dz = p[2] + t*pqz - pt[2];
|
||||||
|
return dx*dx + dz*dz;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void drawPolyBoundaries(duDebugDraw* dd, const dtMeshTile* tile,
|
||||||
|
const unsigned int col, const float linew,
|
||||||
|
bool inner)
|
||||||
|
{
|
||||||
|
static const float thr = 0.01f*0.01f;
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_LINES, linew);
|
||||||
|
|
||||||
|
for (int i = 0; i < tile->header->polyCount; ++i)
|
||||||
|
{
|
||||||
|
const dtPoly* p = &tile->polys[i];
|
||||||
|
|
||||||
|
if (p->getType() == DT_POLYTYPE_OFFMESH_CONNECTION) continue;
|
||||||
|
|
||||||
|
const dtPolyDetail* pd = &tile->detailMeshes[i];
|
||||||
|
|
||||||
|
for (int j = 0, nj = (int)p->vertCount; j < nj; ++j)
|
||||||
|
{
|
||||||
|
unsigned int c = col;
|
||||||
|
if (inner)
|
||||||
|
{
|
||||||
|
if (p->neis[j] == 0) continue;
|
||||||
|
if (p->neis[j] & DT_EXT_LINK)
|
||||||
|
{
|
||||||
|
bool con = false;
|
||||||
|
for (unsigned int k = p->firstLink; k != DT_NULL_LINK; k = tile->links[k].next)
|
||||||
|
{
|
||||||
|
if (tile->links[k].edge == j)
|
||||||
|
{
|
||||||
|
con = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (con)
|
||||||
|
c = duRGBA(255,255,255,24);
|
||||||
|
else
|
||||||
|
c = duRGBA(0,0,0,48);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
c = duRGBA(0,48,64,32);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (p->neis[j] != 0) continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const float* v0 = &tile->verts[p->verts[j]*3];
|
||||||
|
const float* v1 = &tile->verts[p->verts[(j+1) % nj]*3];
|
||||||
|
|
||||||
|
// Draw detail mesh edges which align with the actual poly edge.
|
||||||
|
// This is really slow.
|
||||||
|
for (int k = 0; k < pd->triCount; ++k)
|
||||||
|
{
|
||||||
|
const unsigned char* t = &tile->detailTris[(pd->triBase+k)*4];
|
||||||
|
const float* tv[3];
|
||||||
|
for (int m = 0; m < 3; ++m)
|
||||||
|
{
|
||||||
|
if (t[m] < p->vertCount)
|
||||||
|
tv[m] = &tile->verts[p->verts[t[m]]*3];
|
||||||
|
else
|
||||||
|
tv[m] = &tile->detailVerts[(pd->vertBase+(t[m]-p->vertCount))*3];
|
||||||
|
}
|
||||||
|
for (int m = 0, n = 2; m < 3; n=m++)
|
||||||
|
{
|
||||||
|
if (((t[3] >> (n*2)) & 0x3) == 0) continue; // Skip inner detail edges.
|
||||||
|
if (distancePtLine2d(tv[n],v0,v1) < thr &&
|
||||||
|
distancePtLine2d(tv[m],v0,v1) < thr)
|
||||||
|
{
|
||||||
|
dd->vertex(tv[n], c);
|
||||||
|
dd->vertex(tv[m], c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dd->end();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void drawMeshTile(duDebugDraw* dd, const dtNavMesh& mesh, const dtNavMeshQuery* query,
|
||||||
|
const dtMeshTile* tile, unsigned char flags)
|
||||||
|
{
|
||||||
|
dtPolyRef base = mesh.getPolyRefBase(tile);
|
||||||
|
|
||||||
|
dd->depthMask(false);
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_TRIS);
|
||||||
|
for (int i = 0; i < tile->header->polyCount; ++i)
|
||||||
|
{
|
||||||
|
const dtPoly* p = &tile->polys[i];
|
||||||
|
if (p->getType() == DT_POLYTYPE_OFFMESH_CONNECTION) // Skip off-mesh links.
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const dtPolyDetail* pd = &tile->detailMeshes[i];
|
||||||
|
|
||||||
|
unsigned int col;
|
||||||
|
if (query && query->isInClosedList(base | (dtPolyRef)i))
|
||||||
|
col = duRGBA(255,196,0,64);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (p->getArea() == 0) // Treat zero area type as default.
|
||||||
|
col = duRGBA(0,192,255,64);
|
||||||
|
else
|
||||||
|
switch(p->getArea())
|
||||||
|
{
|
||||||
|
case NAV_GROUND:
|
||||||
|
col = duRGBA(160,128,40,64);
|
||||||
|
break;
|
||||||
|
case NAV_MAGMA:
|
||||||
|
col = duRGBA(240,95,50,64);
|
||||||
|
break;
|
||||||
|
case NAV_SLIME:
|
||||||
|
col = duRGBA(85,225,85,64);
|
||||||
|
break;
|
||||||
|
case NAV_WATER:
|
||||||
|
col = duRGBA(160,160,245,64);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
col = duRGBA(0,192,255,64);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int j = 0; j < pd->triCount; ++j)
|
||||||
|
{
|
||||||
|
const unsigned char* t = &tile->detailTris[(pd->triBase+j)*4];
|
||||||
|
for (int k = 0; k < 3; ++k)
|
||||||
|
{
|
||||||
|
if (t[k] < p->vertCount)
|
||||||
|
dd->vertex(&tile->verts[p->verts[t[k]]*3], col);
|
||||||
|
else
|
||||||
|
dd->vertex(&tile->detailVerts[(pd->vertBase+t[k]-p->vertCount)*3], col);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dd->end();
|
||||||
|
|
||||||
|
// Draw inter poly boundaries
|
||||||
|
drawPolyBoundaries(dd, tile, duRGBA(0,48,64,32), 1.5f, true);
|
||||||
|
|
||||||
|
// Draw outer poly boundaries
|
||||||
|
drawPolyBoundaries(dd, tile, duRGBA(0,48,64,220), 2.5f, false);
|
||||||
|
|
||||||
|
if (flags & DU_DRAWNAVMESH_OFFMESHCONS)
|
||||||
|
{
|
||||||
|
dd->begin(DU_DRAW_LINES, 2.0f);
|
||||||
|
for (int i = 0; i < tile->header->polyCount; ++i)
|
||||||
|
{
|
||||||
|
const dtPoly* p = &tile->polys[i];
|
||||||
|
if (p->getType() != DT_POLYTYPE_OFFMESH_CONNECTION) // Skip regular polys.
|
||||||
|
continue;
|
||||||
|
|
||||||
|
unsigned int col;
|
||||||
|
if (query && query->isInClosedList(base | (dtPolyRef)i))
|
||||||
|
col = duRGBA(255,196,0,220);
|
||||||
|
else
|
||||||
|
col = duDarkenCol(duIntToCol(p->getArea(), 220));
|
||||||
|
|
||||||
|
const dtOffMeshConnection* con = &tile->offMeshCons[i - tile->header->offMeshBase];
|
||||||
|
const float* va = &tile->verts[p->verts[0]*3];
|
||||||
|
const float* vb = &tile->verts[p->verts[1]*3];
|
||||||
|
|
||||||
|
// Check to see if start and end end-points have links.
|
||||||
|
bool startSet = false;
|
||||||
|
bool endSet = false;
|
||||||
|
for (unsigned int k = p->firstLink; k != DT_NULL_LINK; k = tile->links[k].next)
|
||||||
|
{
|
||||||
|
if (tile->links[k].edge == 0)
|
||||||
|
startSet = true;
|
||||||
|
if (tile->links[k].edge == 1)
|
||||||
|
endSet = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// End points and their on-mesh locations.
|
||||||
|
if (startSet)
|
||||||
|
{
|
||||||
|
dd->vertex(va[0],va[1],va[2], col);
|
||||||
|
dd->vertex(con->pos[0],con->pos[1],con->pos[2], col);
|
||||||
|
duAppendCircle(dd, con->pos[0],con->pos[1]+0.1f,con->pos[2], con->rad, duRGBA(0,48,64,196));
|
||||||
|
}
|
||||||
|
if (endSet)
|
||||||
|
{
|
||||||
|
dd->vertex(vb[0],vb[1],vb[2], col);
|
||||||
|
dd->vertex(con->pos[3],con->pos[4],con->pos[5], col);
|
||||||
|
duAppendCircle(dd, con->pos[3],con->pos[4]+0.1f,con->pos[5], con->rad, duRGBA(0,48,64,196));
|
||||||
|
}
|
||||||
|
|
||||||
|
// End point vertices.
|
||||||
|
dd->vertex(con->pos[0],con->pos[1],con->pos[2], duRGBA(0,48,64,196));
|
||||||
|
dd->vertex(con->pos[0],con->pos[1]+0.2f,con->pos[2], duRGBA(0,48,64,196));
|
||||||
|
|
||||||
|
dd->vertex(con->pos[3],con->pos[4],con->pos[5], duRGBA(0,48,64,196));
|
||||||
|
dd->vertex(con->pos[3],con->pos[4]+0.2f,con->pos[5], duRGBA(0,48,64,196));
|
||||||
|
|
||||||
|
// Connection arc.
|
||||||
|
duAppendArc(dd, con->pos[0],con->pos[1],con->pos[2], con->pos[3],con->pos[4],con->pos[5], 0.25f,
|
||||||
|
(con->flags & 1) ? 0.6f : 0, 0.6f, col);
|
||||||
|
}
|
||||||
|
dd->end();
|
||||||
|
}
|
||||||
|
|
||||||
|
const unsigned int vcol = duRGBA(0,0,0,196);
|
||||||
|
dd->begin(DU_DRAW_POINTS, 3.0f);
|
||||||
|
for (int i = 0; i < tile->header->vertCount; ++i)
|
||||||
|
{
|
||||||
|
const float* v = &tile->verts[i*3];
|
||||||
|
dd->vertex(v[0], v[1], v[2], vcol);
|
||||||
|
}
|
||||||
|
dd->end();
|
||||||
|
|
||||||
|
dd->depthMask(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDebugDrawNavMesh(duDebugDraw* dd, const dtNavMesh& mesh, unsigned char flags)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
|
||||||
|
for (int i = 0; i < mesh.getMaxTiles(); ++i)
|
||||||
|
{
|
||||||
|
const dtMeshTile* tile = mesh.getTile(i);
|
||||||
|
if (!tile->header) continue;
|
||||||
|
drawMeshTile(dd, mesh, 0, tile, flags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDebugDrawNavMeshWithClosedList(struct duDebugDraw* dd, const dtNavMesh& mesh, const dtNavMeshQuery& query, unsigned char flags)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
|
||||||
|
const dtNavMeshQuery* q = (flags & DU_DRAWNAVMESH_CLOSEDLIST) ? &query : 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < mesh.getMaxTiles(); ++i)
|
||||||
|
{
|
||||||
|
const dtMeshTile* tile = mesh.getTile(i);
|
||||||
|
if (!tile->header) continue;
|
||||||
|
drawMeshTile(dd, mesh, q, tile, flags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDebugDrawNavMeshNodes(struct duDebugDraw* dd, const dtNavMeshQuery& query)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
|
||||||
|
const dtNodePool* pool = query.getNodePool();
|
||||||
|
if (pool)
|
||||||
|
{
|
||||||
|
const float off = 0.5f;
|
||||||
|
dd->begin(DU_DRAW_POINTS, 4.0f);
|
||||||
|
for (int i = 0; i < pool->getHashSize(); ++i)
|
||||||
|
{
|
||||||
|
for (unsigned short j = pool->getFirst(i); j != DT_NULL_IDX; j = pool->getNext(j))
|
||||||
|
{
|
||||||
|
const dtNode* node = pool->getNodeAtIdx(j+1);
|
||||||
|
if (!node) continue;
|
||||||
|
dd->vertex(node->pos[0],node->pos[1]+off,node->pos[2], duRGBA(255,192,0,255));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dd->end();
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_LINES, 2.0f);
|
||||||
|
for (int i = 0; i < pool->getHashSize(); ++i)
|
||||||
|
{
|
||||||
|
for (unsigned short j = pool->getFirst(i); j != DT_NULL_IDX; j = pool->getNext(j))
|
||||||
|
{
|
||||||
|
const dtNode* node = pool->getNodeAtIdx(j+1);
|
||||||
|
if (!node) continue;
|
||||||
|
if (!node->pidx) continue;
|
||||||
|
const dtNode* parent = pool->getNodeAtIdx(node->pidx);
|
||||||
|
if (!parent) continue;
|
||||||
|
dd->vertex(node->pos[0],node->pos[1]+off,node->pos[2], duRGBA(255,192,0,128));
|
||||||
|
dd->vertex(parent->pos[0],parent->pos[1]+off,parent->pos[2], duRGBA(255,192,0,128));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dd->end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void drawMeshTileBVTree(duDebugDraw* dd, const dtMeshTile* tile)
|
||||||
|
{
|
||||||
|
// Draw BV nodes.
|
||||||
|
const float cs = 1.0f / tile->header->bvQuantFactor;
|
||||||
|
dd->begin(DU_DRAW_LINES, 1.0f);
|
||||||
|
for (int i = 0; i < tile->header->bvNodeCount; ++i)
|
||||||
|
{
|
||||||
|
const dtBVNode* n = &tile->bvTree[i];
|
||||||
|
if (n->i < 0) // Leaf indices are positive.
|
||||||
|
continue;
|
||||||
|
duAppendBoxWire(dd, tile->header->bmin[0] + n->bmin[0]*cs,
|
||||||
|
tile->header->bmin[1] + n->bmin[1]*cs,
|
||||||
|
tile->header->bmin[2] + n->bmin[2]*cs,
|
||||||
|
tile->header->bmin[0] + n->bmax[0]*cs,
|
||||||
|
tile->header->bmin[1] + n->bmax[1]*cs,
|
||||||
|
tile->header->bmin[2] + n->bmax[2]*cs,
|
||||||
|
duRGBA(255,255,255,128));
|
||||||
|
}
|
||||||
|
dd->end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDebugDrawNavMeshBVTree(duDebugDraw* dd, const dtNavMesh& mesh)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
|
||||||
|
for (int i = 0; i < mesh.getMaxTiles(); ++i)
|
||||||
|
{
|
||||||
|
const dtMeshTile* tile = mesh.getTile(i);
|
||||||
|
if (!tile->header) continue;
|
||||||
|
drawMeshTileBVTree(dd, tile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void drawMeshTilePortal(duDebugDraw* dd, const dtMeshTile* tile)
|
||||||
|
{
|
||||||
|
// Draw portals
|
||||||
|
const float padx = 0.02f;
|
||||||
|
const float pady = tile->header->walkableClimb;
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_LINES, 2.0f);
|
||||||
|
|
||||||
|
for (int side = 0; side < 8; ++side)
|
||||||
|
{
|
||||||
|
unsigned short m = DT_EXT_LINK | (unsigned short)side;
|
||||||
|
|
||||||
|
for (int i = 0; i < tile->header->polyCount; ++i)
|
||||||
|
{
|
||||||
|
dtPoly* poly = &tile->polys[i];
|
||||||
|
|
||||||
|
// Create new links.
|
||||||
|
const int nv = poly->vertCount;
|
||||||
|
for (int j = 0; j < nv; ++j)
|
||||||
|
{
|
||||||
|
// Skip edges which do not point to the right side.
|
||||||
|
if (poly->neis[j] != m)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Create new links
|
||||||
|
const float* va = &tile->verts[poly->verts[j]*3];
|
||||||
|
const float* vb = &tile->verts[poly->verts[(j+1) % nv]*3];
|
||||||
|
|
||||||
|
if (side == 0 || side == 4)
|
||||||
|
{
|
||||||
|
unsigned int col = side == 0 ? duRGBA(128,0,0,128) : duRGBA(128,0,128,128);
|
||||||
|
|
||||||
|
const float x = va[0] + ((side == 0) ? -padx : padx);
|
||||||
|
|
||||||
|
dd->vertex(x,va[1]-pady,va[2], col);
|
||||||
|
dd->vertex(x,va[1]+pady,va[2], col);
|
||||||
|
|
||||||
|
dd->vertex(x,va[1]+pady,va[2], col);
|
||||||
|
dd->vertex(x,vb[1]+pady,vb[2], col);
|
||||||
|
|
||||||
|
dd->vertex(x,vb[1]+pady,vb[2], col);
|
||||||
|
dd->vertex(x,vb[1]-pady,vb[2], col);
|
||||||
|
|
||||||
|
dd->vertex(x,vb[1]-pady,vb[2], col);
|
||||||
|
dd->vertex(x,va[1]-pady,va[2], col);
|
||||||
|
}
|
||||||
|
else if (side == 2 || side == 6)
|
||||||
|
{
|
||||||
|
unsigned int col = side == 2 ? duRGBA(0,128,0,128) : duRGBA(0,128,128,128);
|
||||||
|
|
||||||
|
const float z = va[2] + ((side == 2) ? -padx : padx);
|
||||||
|
|
||||||
|
dd->vertex(va[0],va[1]-pady,z, col);
|
||||||
|
dd->vertex(va[0],va[1]+pady,z, col);
|
||||||
|
|
||||||
|
dd->vertex(va[0],va[1]+pady,z, col);
|
||||||
|
dd->vertex(vb[0],vb[1]+pady,z, col);
|
||||||
|
|
||||||
|
dd->vertex(vb[0],vb[1]+pady,z, col);
|
||||||
|
dd->vertex(vb[0],vb[1]-pady,z, col);
|
||||||
|
|
||||||
|
dd->vertex(vb[0],vb[1]-pady,z, col);
|
||||||
|
dd->vertex(va[0],va[1]-pady,z, col);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dd->end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDebugDrawNavMeshPortals(duDebugDraw* dd, const dtNavMesh& mesh)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
|
||||||
|
for (int i = 0; i < mesh.getMaxTiles(); ++i)
|
||||||
|
{
|
||||||
|
const dtMeshTile* tile = mesh.getTile(i);
|
||||||
|
if (!tile->header) continue;
|
||||||
|
drawMeshTilePortal(dd, tile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDebugDrawNavMeshPoly(duDebugDraw* dd, const dtNavMesh& mesh, dtPolyRef ref, const unsigned int col)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
|
||||||
|
const dtMeshTile* tile = 0;
|
||||||
|
const dtPoly* poly = 0;
|
||||||
|
if (mesh.getTileAndPolyByRef(ref, &tile, &poly) != DT_SUCCESS)
|
||||||
|
return;
|
||||||
|
|
||||||
|
dd->depthMask(false);
|
||||||
|
|
||||||
|
const unsigned int c = (col & 0x00ffffff) | (64 << 24);
|
||||||
|
const unsigned int ip = (unsigned int)(poly - tile->polys);
|
||||||
|
|
||||||
|
if (poly->getType() == DT_POLYTYPE_OFFMESH_CONNECTION)
|
||||||
|
{
|
||||||
|
dtOffMeshConnection* con = &tile->offMeshCons[ip - tile->header->offMeshBase];
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_LINES, 2.0f);
|
||||||
|
|
||||||
|
// Connection arc.
|
||||||
|
duAppendArc(dd, con->pos[0],con->pos[1],con->pos[2], con->pos[3],con->pos[4],con->pos[5], 0.25f,
|
||||||
|
(con->flags & 1) ? 0.6f : 0, 0.6f, c);
|
||||||
|
|
||||||
|
dd->end();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const dtPolyDetail* pd = &tile->detailMeshes[ip];
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_TRIS);
|
||||||
|
for (int i = 0; i < pd->triCount; ++i)
|
||||||
|
{
|
||||||
|
const unsigned char* t = &tile->detailTris[(pd->triBase+i)*4];
|
||||||
|
for (int j = 0; j < 3; ++j)
|
||||||
|
{
|
||||||
|
if (t[j] < poly->vertCount)
|
||||||
|
dd->vertex(&tile->verts[poly->verts[t[j]]*3], c);
|
||||||
|
else
|
||||||
|
dd->vertex(&tile->detailVerts[(pd->vertBase+t[j]-poly->vertCount)*3], c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dd->end();
|
||||||
|
}
|
||||||
|
|
||||||
|
dd->depthMask(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
689
dep/recastnavigation/DebugUtils/Source/RecastDebugDraw.cpp
Normal file
689
dep/recastnavigation/DebugUtils/Source/RecastDebugDraw.cpp
Normal file
|
|
@ -0,0 +1,689 @@
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
|
||||||
|
#define _USE_MATH_DEFINES
|
||||||
|
#include <math.h>
|
||||||
|
#include "DebugDraw.h"
|
||||||
|
#include "RecastDebugDraw.h"
|
||||||
|
#include "Recast.h"
|
||||||
|
|
||||||
|
void duDebugDrawTriMesh(duDebugDraw* dd, const float* verts, int /*nverts*/,
|
||||||
|
const int* tris, const float* normals, int ntris,
|
||||||
|
const unsigned char* flags)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
if (!verts) return;
|
||||||
|
if (!tris) return;
|
||||||
|
if (!normals) return;
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_TRIS);
|
||||||
|
for (int i = 0; i < ntris*3; i += 3)
|
||||||
|
{
|
||||||
|
unsigned int color;
|
||||||
|
unsigned char a = (unsigned char)(150*(2+normals[i+0]+normals[i+1])/4);
|
||||||
|
if (flags && !flags[i/3])
|
||||||
|
color = duRGBA(a,a/4,a/16,255);
|
||||||
|
else
|
||||||
|
color = duRGBA(a,a,a,255);
|
||||||
|
|
||||||
|
dd->vertex(&verts[tris[i+0]*3], color);
|
||||||
|
dd->vertex(&verts[tris[i+1]*3], color);
|
||||||
|
dd->vertex(&verts[tris[i+2]*3], color);
|
||||||
|
}
|
||||||
|
dd->end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDebugDrawTriMeshSlope(duDebugDraw* dd, const float* verts, int /*nverts*/,
|
||||||
|
const int* tris, const float* normals, int ntris,
|
||||||
|
const float walkableSlopeAngle)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
if (!verts) return;
|
||||||
|
if (!tris) return;
|
||||||
|
if (!normals) return;
|
||||||
|
|
||||||
|
const float walkableThr = cosf(walkableSlopeAngle/180.0f*DU_PI);
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_TRIS);
|
||||||
|
for (int i = 0; i < ntris*3; i += 3)
|
||||||
|
{
|
||||||
|
const float* norm = &normals[i];
|
||||||
|
unsigned int color;
|
||||||
|
unsigned char a = (unsigned char)(255*(2+normals[i+0]+normals[i+1])/4);
|
||||||
|
if (norm[1] < walkableThr)
|
||||||
|
color = duRGBA(a,a/4,a/16,255);
|
||||||
|
else
|
||||||
|
color = duRGBA(a,a,a,255);
|
||||||
|
|
||||||
|
dd->vertex(&verts[tris[i+0]*3], color);
|
||||||
|
dd->vertex(&verts[tris[i+1]*3], color);
|
||||||
|
dd->vertex(&verts[tris[i+2]*3], color);
|
||||||
|
}
|
||||||
|
dd->end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDebugDrawHeightfieldSolid(duDebugDraw* dd, const rcHeightfield& hf)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
|
||||||
|
const float* orig = hf.bmin;
|
||||||
|
const float cs = hf.cs;
|
||||||
|
const float ch = hf.ch;
|
||||||
|
|
||||||
|
const int w = hf.width;
|
||||||
|
const int h = hf.height;
|
||||||
|
|
||||||
|
unsigned int fcol[6];
|
||||||
|
duCalcBoxColors(fcol, duRGBA(255,255,255,255), duRGBA(255,255,255,255));
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_QUADS);
|
||||||
|
|
||||||
|
for (int y = 0; y < h; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < w; ++x)
|
||||||
|
{
|
||||||
|
float fx = orig[0] + x*cs;
|
||||||
|
float fz = orig[2] + y*cs;
|
||||||
|
const rcSpan* s = hf.spans[x + y*w];
|
||||||
|
while (s)
|
||||||
|
{
|
||||||
|
duAppendBox(dd, fx, orig[1]+s->smin*ch, fz, fx+cs, orig[1] + s->smax*ch, fz+cs, fcol);
|
||||||
|
s = s->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dd->end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDebugDrawHeightfieldWalkable(duDebugDraw* dd, const rcHeightfield& hf)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
|
||||||
|
const float* orig = hf.bmin;
|
||||||
|
const float cs = hf.cs;
|
||||||
|
const float ch = hf.ch;
|
||||||
|
|
||||||
|
const int w = hf.width;
|
||||||
|
const int h = hf.height;
|
||||||
|
|
||||||
|
unsigned int fcol[6];
|
||||||
|
duCalcBoxColors(fcol, duRGBA(255,255,255,255), duRGBA(217,217,217,255));
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_QUADS);
|
||||||
|
|
||||||
|
for (int y = 0; y < h; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < w; ++x)
|
||||||
|
{
|
||||||
|
float fx = orig[0] + x*cs;
|
||||||
|
float fz = orig[2] + y*cs;
|
||||||
|
const rcSpan* s = hf.spans[x + y*w];
|
||||||
|
while (s)
|
||||||
|
{
|
||||||
|
if (s->area == RC_WALKABLE_AREA)
|
||||||
|
fcol[0] = duRGBA(64,128,160,255);
|
||||||
|
else if (s->area == RC_NULL_AREA)
|
||||||
|
fcol[0] = duRGBA(64,64,64,255);
|
||||||
|
else
|
||||||
|
fcol[0] = duMultCol(duIntToCol(s->area, 255), 200);
|
||||||
|
|
||||||
|
duAppendBox(dd, fx, orig[1]+s->smin*ch, fz, fx+cs, orig[1] + s->smax*ch, fz+cs, fcol);
|
||||||
|
s = s->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dd->end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDebugDrawCompactHeightfieldSolid(duDebugDraw* dd, const rcCompactHeightfield& chf)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
|
||||||
|
const float cs = chf.cs;
|
||||||
|
const float ch = chf.ch;
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_QUADS);
|
||||||
|
|
||||||
|
for (int y = 0; y < chf.height; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < chf.width; ++x)
|
||||||
|
{
|
||||||
|
const float fx = chf.bmin[0] + x*cs;
|
||||||
|
const float fz = chf.bmin[2] + y*cs;
|
||||||
|
const rcCompactCell& c = chf.cells[x+y*chf.width];
|
||||||
|
|
||||||
|
for (unsigned i = c.index, ni = c.index+c.count; i < ni; ++i)
|
||||||
|
{
|
||||||
|
const rcCompactSpan& s = chf.spans[i];
|
||||||
|
|
||||||
|
unsigned int color;
|
||||||
|
if (chf.areas[i] == RC_WALKABLE_AREA)
|
||||||
|
color = duRGBA(0,192,255,64);
|
||||||
|
else if (chf.areas[i] == RC_NULL_AREA)
|
||||||
|
color = duRGBA(0,0,0,64);
|
||||||
|
else
|
||||||
|
color = duIntToCol(chf.areas[i], 255);
|
||||||
|
|
||||||
|
const float fy = chf.bmin[1] + (s.y+1)*ch;
|
||||||
|
dd->vertex(fx, fy, fz, color);
|
||||||
|
dd->vertex(fx, fy, fz+cs, color);
|
||||||
|
dd->vertex(fx+cs, fy, fz+cs, color);
|
||||||
|
dd->vertex(fx+cs, fy, fz, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dd->end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDebugDrawCompactHeightfieldRegions(duDebugDraw* dd, const rcCompactHeightfield& chf)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
|
||||||
|
const float cs = chf.cs;
|
||||||
|
const float ch = chf.ch;
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_QUADS);
|
||||||
|
|
||||||
|
for (int y = 0; y < chf.height; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < chf.width; ++x)
|
||||||
|
{
|
||||||
|
const float fx = chf.bmin[0] + x*cs;
|
||||||
|
const float fz = chf.bmin[2] + y*cs;
|
||||||
|
const rcCompactCell& c = chf.cells[x+y*chf.width];
|
||||||
|
|
||||||
|
for (unsigned i = c.index, ni = c.index+c.count; i < ni; ++i)
|
||||||
|
{
|
||||||
|
const rcCompactSpan& s = chf.spans[i];
|
||||||
|
const float fy = chf.bmin[1] + (s.y)*ch;
|
||||||
|
unsigned int color;
|
||||||
|
if (s.reg)
|
||||||
|
color = duIntToCol(s.reg, 192);
|
||||||
|
else
|
||||||
|
color = duRGBA(0,0,0,64);
|
||||||
|
|
||||||
|
dd->vertex(fx, fy, fz, color);
|
||||||
|
dd->vertex(fx, fy, fz+cs, color);
|
||||||
|
dd->vertex(fx+cs, fy, fz+cs, color);
|
||||||
|
dd->vertex(fx+cs, fy, fz, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dd->end();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void duDebugDrawCompactHeightfieldDistance(duDebugDraw* dd, const rcCompactHeightfield& chf)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
if (!chf.dist) return;
|
||||||
|
|
||||||
|
const float cs = chf.cs;
|
||||||
|
const float ch = chf.ch;
|
||||||
|
|
||||||
|
float maxd = chf.maxDistance;
|
||||||
|
if (maxd < 1.0f) maxd = 1;
|
||||||
|
const float dscale = 255.0f / maxd;
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_QUADS);
|
||||||
|
|
||||||
|
for (int y = 0; y < chf.height; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < chf.width; ++x)
|
||||||
|
{
|
||||||
|
const float fx = chf.bmin[0] + x*cs;
|
||||||
|
const float fz = chf.bmin[2] + y*cs;
|
||||||
|
const rcCompactCell& c = chf.cells[x+y*chf.width];
|
||||||
|
|
||||||
|
for (unsigned i = c.index, ni = c.index+c.count; i < ni; ++i)
|
||||||
|
{
|
||||||
|
const rcCompactSpan& s = chf.spans[i];
|
||||||
|
const float fy = chf.bmin[1] + (s.y+1)*ch;
|
||||||
|
const unsigned char cd = (unsigned char)(chf.dist[i] * dscale);
|
||||||
|
const unsigned int color = duRGBA(cd,cd,cd,255);
|
||||||
|
dd->vertex(fx, fy, fz, color);
|
||||||
|
dd->vertex(fx, fy, fz+cs, color);
|
||||||
|
dd->vertex(fx+cs, fy, fz+cs, color);
|
||||||
|
dd->vertex(fx+cs, fy, fz, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dd->end();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void getContourCenter(const rcContour* cont, const float* orig, float cs, float ch, float* center)
|
||||||
|
{
|
||||||
|
center[0] = 0;
|
||||||
|
center[1] = 0;
|
||||||
|
center[2] = 0;
|
||||||
|
if (!cont->nverts)
|
||||||
|
return;
|
||||||
|
for (int i = 0; i < cont->nverts; ++i)
|
||||||
|
{
|
||||||
|
const int* v = &cont->verts[i*4];
|
||||||
|
center[0] += (float)v[0];
|
||||||
|
center[1] += (float)v[1];
|
||||||
|
center[2] += (float)v[2];
|
||||||
|
}
|
||||||
|
const float s = 1.0f / cont->nverts;
|
||||||
|
center[0] *= s * cs;
|
||||||
|
center[1] *= s * ch;
|
||||||
|
center[2] *= s * cs;
|
||||||
|
center[0] += orig[0];
|
||||||
|
center[1] += orig[1] + 4*ch;
|
||||||
|
center[2] += orig[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
static const rcContour* findContourFromSet(const rcContourSet& cset, unsigned short reg)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < cset.nconts; ++i)
|
||||||
|
{
|
||||||
|
if (cset.conts[i].reg == reg)
|
||||||
|
return &cset.conts[i];
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDebugDrawRegionConnections(duDebugDraw* dd, const rcContourSet& cset, const float alpha)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
|
||||||
|
const float* orig = cset.bmin;
|
||||||
|
const float cs = cset.cs;
|
||||||
|
const float ch = cset.ch;
|
||||||
|
|
||||||
|
// Draw centers
|
||||||
|
float pos[3], pos2[3];
|
||||||
|
|
||||||
|
unsigned int color = duRGBA(0,0,0,196);
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_LINES, 2.0f);
|
||||||
|
|
||||||
|
for (int i = 0; i < cset.nconts; ++i)
|
||||||
|
{
|
||||||
|
const rcContour* cont = &cset.conts[i];
|
||||||
|
getContourCenter(cont, orig, cs, ch, pos);
|
||||||
|
for (int j = 0; j < cont->nverts; ++j)
|
||||||
|
{
|
||||||
|
const int* v = &cont->verts[j*4];
|
||||||
|
if (v[3] == 0 || (unsigned short)v[3] < cont->reg) continue;
|
||||||
|
const rcContour* cont2 = findContourFromSet(cset, (unsigned short)v[3]);
|
||||||
|
if (cont2)
|
||||||
|
{
|
||||||
|
getContourCenter(cont2, orig, cs, ch, pos2);
|
||||||
|
duAppendArc(dd, pos[0],pos[1],pos[2], pos2[0],pos2[1],pos2[2], 0.25f, 0.6f, 0.6f, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dd->end();
|
||||||
|
|
||||||
|
unsigned char a = (unsigned char)(alpha * 255.0f);
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_POINTS, 7.0f);
|
||||||
|
|
||||||
|
for (int i = 0; i < cset.nconts; ++i)
|
||||||
|
{
|
||||||
|
const rcContour* cont = &cset.conts[i];
|
||||||
|
unsigned int color = duDarkenCol(duIntToCol(cont->reg,a));
|
||||||
|
getContourCenter(cont, orig, cs, ch, pos);
|
||||||
|
dd->vertex(pos, color);
|
||||||
|
}
|
||||||
|
dd->end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDebugDrawRawContours(duDebugDraw* dd, const rcContourSet& cset, const float alpha)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
|
||||||
|
const float* orig = cset.bmin;
|
||||||
|
const float cs = cset.cs;
|
||||||
|
const float ch = cset.ch;
|
||||||
|
|
||||||
|
const unsigned char a = (unsigned char)(alpha*255.0f);
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_LINES, 2.0f);
|
||||||
|
|
||||||
|
for (int i = 0; i < cset.nconts; ++i)
|
||||||
|
{
|
||||||
|
const rcContour& c = cset.conts[i];
|
||||||
|
unsigned int color = duIntToCol(c.reg, a);
|
||||||
|
|
||||||
|
for (int j = 0; j < c.nrverts; ++j)
|
||||||
|
{
|
||||||
|
const int* v = &c.rverts[j*4];
|
||||||
|
float fx = orig[0] + v[0]*cs;
|
||||||
|
float fy = orig[1] + (v[1]+1+(i&1))*ch;
|
||||||
|
float fz = orig[2] + v[2]*cs;
|
||||||
|
dd->vertex(fx,fy,fz,color);
|
||||||
|
if (j > 0)
|
||||||
|
dd->vertex(fx,fy,fz,color);
|
||||||
|
}
|
||||||
|
// Loop last segment.
|
||||||
|
const int* v = &c.rverts[0];
|
||||||
|
float fx = orig[0] + v[0]*cs;
|
||||||
|
float fy = orig[1] + (v[1]+1+(i&1))*ch;
|
||||||
|
float fz = orig[2] + v[2]*cs;
|
||||||
|
dd->vertex(fx,fy,fz,color);
|
||||||
|
}
|
||||||
|
dd->end();
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_POINTS, 2.0f);
|
||||||
|
|
||||||
|
for (int i = 0; i < cset.nconts; ++i)
|
||||||
|
{
|
||||||
|
const rcContour& c = cset.conts[i];
|
||||||
|
unsigned int color = duDarkenCol(duIntToCol(c.reg, a));
|
||||||
|
|
||||||
|
for (int j = 0; j < c.nrverts; ++j)
|
||||||
|
{
|
||||||
|
const int* v = &c.rverts[j*4];
|
||||||
|
float off = 0;
|
||||||
|
unsigned int colv = color;
|
||||||
|
if (v[3] & RC_BORDER_VERTEX)
|
||||||
|
{
|
||||||
|
colv = duRGBA(255,255,255,a);
|
||||||
|
off = ch*2;
|
||||||
|
}
|
||||||
|
|
||||||
|
float fx = orig[0] + v[0]*cs;
|
||||||
|
float fy = orig[1] + (v[1]+1+(i&1))*ch + off;
|
||||||
|
float fz = orig[2] + v[2]*cs;
|
||||||
|
dd->vertex(fx,fy,fz, colv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dd->end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDebugDrawContours(duDebugDraw* dd, const rcContourSet& cset, const float alpha)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
|
||||||
|
const float* orig = cset.bmin;
|
||||||
|
const float cs = cset.cs;
|
||||||
|
const float ch = cset.ch;
|
||||||
|
|
||||||
|
const unsigned char a = (unsigned char)(alpha*255.0f);
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_LINES, 2.5f);
|
||||||
|
|
||||||
|
for (int i = 0; i < cset.nconts; ++i)
|
||||||
|
{
|
||||||
|
const rcContour& c = cset.conts[i];
|
||||||
|
if (!c.nverts)
|
||||||
|
continue;
|
||||||
|
unsigned int color = duIntToCol(c.reg, a);
|
||||||
|
|
||||||
|
for (int j = 0; j < c.nverts; ++j)
|
||||||
|
{
|
||||||
|
const int* v = &c.verts[j*4];
|
||||||
|
float fx = orig[0] + v[0]*cs;
|
||||||
|
float fy = orig[1] + (v[1]+1+(i&1))*ch;
|
||||||
|
float fz = orig[2] + v[2]*cs;
|
||||||
|
dd->vertex(fx,fy,fz, color);
|
||||||
|
if (j > 0)
|
||||||
|
dd->vertex(fx,fy,fz, color);
|
||||||
|
}
|
||||||
|
// Loop last segment
|
||||||
|
const int* v = &c.verts[0];
|
||||||
|
float fx = orig[0] + v[0]*cs;
|
||||||
|
float fy = orig[1] + (v[1]+1+(i&1))*ch;
|
||||||
|
float fz = orig[2] + v[2]*cs;
|
||||||
|
dd->vertex(fx,fy,fz, color);
|
||||||
|
}
|
||||||
|
dd->end();
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_POINTS, 3.0f);
|
||||||
|
|
||||||
|
for (int i = 0; i < cset.nconts; ++i)
|
||||||
|
{
|
||||||
|
const rcContour& c = cset.conts[i];
|
||||||
|
unsigned int color = duDarkenCol(duIntToCol(c.reg, a));
|
||||||
|
for (int j = 0; j < c.nverts; ++j)
|
||||||
|
{
|
||||||
|
const int* v = &c.verts[j*4];
|
||||||
|
float off = 0;
|
||||||
|
unsigned int colv = color;
|
||||||
|
if (v[3] & RC_BORDER_VERTEX)
|
||||||
|
{
|
||||||
|
colv = duRGBA(255,255,255,a);
|
||||||
|
off = ch*2;
|
||||||
|
}
|
||||||
|
|
||||||
|
float fx = orig[0] + v[0]*cs;
|
||||||
|
float fy = orig[1] + (v[1]+1+(i&1))*ch + off;
|
||||||
|
float fz = orig[2] + v[2]*cs;
|
||||||
|
dd->vertex(fx,fy,fz, colv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dd->end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDebugDrawPolyMesh(duDebugDraw* dd, const struct rcPolyMesh& mesh)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
|
||||||
|
const int nvp = mesh.nvp;
|
||||||
|
const float cs = mesh.cs;
|
||||||
|
const float ch = mesh.ch;
|
||||||
|
const float* orig = mesh.bmin;
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_TRIS);
|
||||||
|
|
||||||
|
for (int i = 0; i < mesh.npolys; ++i)
|
||||||
|
{
|
||||||
|
const unsigned short* p = &mesh.polys[i*nvp*2];
|
||||||
|
|
||||||
|
unsigned int color;
|
||||||
|
if (mesh.areas[i] == RC_WALKABLE_AREA)
|
||||||
|
color = duRGBA(0,192,255,64);
|
||||||
|
else if (mesh.areas[i] == RC_NULL_AREA)
|
||||||
|
color = duRGBA(0,0,0,64);
|
||||||
|
else
|
||||||
|
color = duIntToCol(mesh.areas[i], 255);
|
||||||
|
|
||||||
|
unsigned short vi[3];
|
||||||
|
for (int j = 2; j < nvp; ++j)
|
||||||
|
{
|
||||||
|
if (p[j] == RC_MESH_NULL_IDX) break;
|
||||||
|
vi[0] = p[0];
|
||||||
|
vi[1] = p[j-1];
|
||||||
|
vi[2] = p[j];
|
||||||
|
for (int k = 0; k < 3; ++k)
|
||||||
|
{
|
||||||
|
const unsigned short* v = &mesh.verts[vi[k]*3];
|
||||||
|
const float x = orig[0] + v[0]*cs;
|
||||||
|
const float y = orig[1] + (v[1]+1)*ch;
|
||||||
|
const float z = orig[2] + v[2]*cs;
|
||||||
|
dd->vertex(x,y,z, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dd->end();
|
||||||
|
|
||||||
|
// Draw neighbours edges
|
||||||
|
const unsigned int coln = duRGBA(0,48,64,32);
|
||||||
|
dd->begin(DU_DRAW_LINES, 1.5f);
|
||||||
|
for (int i = 0; i < mesh.npolys; ++i)
|
||||||
|
{
|
||||||
|
const unsigned short* p = &mesh.polys[i*nvp*2];
|
||||||
|
for (int j = 0; j < nvp; ++j)
|
||||||
|
{
|
||||||
|
if (p[j] == RC_MESH_NULL_IDX) break;
|
||||||
|
if (p[nvp+j] == RC_MESH_NULL_IDX) continue;
|
||||||
|
int vi[2];
|
||||||
|
vi[0] = p[j];
|
||||||
|
if (j+1 >= nvp || p[j+1] == RC_MESH_NULL_IDX)
|
||||||
|
vi[1] = p[0];
|
||||||
|
else
|
||||||
|
vi[1] = p[j+1];
|
||||||
|
for (int k = 0; k < 2; ++k)
|
||||||
|
{
|
||||||
|
const unsigned short* v = &mesh.verts[vi[k]*3];
|
||||||
|
const float x = orig[0] + v[0]*cs;
|
||||||
|
const float y = orig[1] + (v[1]+1)*ch + 0.1f;
|
||||||
|
const float z = orig[2] + v[2]*cs;
|
||||||
|
dd->vertex(x, y, z, coln);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dd->end();
|
||||||
|
|
||||||
|
// Draw boundary edges
|
||||||
|
const unsigned int colb = duRGBA(0,48,64,220);
|
||||||
|
dd->begin(DU_DRAW_LINES, 2.5f);
|
||||||
|
for (int i = 0; i < mesh.npolys; ++i)
|
||||||
|
{
|
||||||
|
const unsigned short* p = &mesh.polys[i*nvp*2];
|
||||||
|
for (int j = 0; j < nvp; ++j)
|
||||||
|
{
|
||||||
|
if (p[j] == RC_MESH_NULL_IDX) break;
|
||||||
|
if (p[nvp+j] != RC_MESH_NULL_IDX) continue;
|
||||||
|
int vi[2];
|
||||||
|
vi[0] = p[j];
|
||||||
|
if (j+1 >= nvp || p[j+1] == RC_MESH_NULL_IDX)
|
||||||
|
vi[1] = p[0];
|
||||||
|
else
|
||||||
|
vi[1] = p[j+1];
|
||||||
|
for (int k = 0; k < 2; ++k)
|
||||||
|
{
|
||||||
|
const unsigned short* v = &mesh.verts[vi[k]*3];
|
||||||
|
const float x = orig[0] + v[0]*cs;
|
||||||
|
const float y = orig[1] + (v[1]+1)*ch + 0.1f;
|
||||||
|
const float z = orig[2] + v[2]*cs;
|
||||||
|
dd->vertex(x, y, z, colb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dd->end();
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_POINTS, 3.0f);
|
||||||
|
const unsigned int colv = duRGBA(0,0,0,220);
|
||||||
|
for (int i = 0; i < mesh.nverts; ++i)
|
||||||
|
{
|
||||||
|
const unsigned short* v = &mesh.verts[i*3];
|
||||||
|
const float x = orig[0] + v[0]*cs;
|
||||||
|
const float y = orig[1] + (v[1]+1)*ch + 0.1f;
|
||||||
|
const float z = orig[2] + v[2]*cs;
|
||||||
|
dd->vertex(x,y,z, colv);
|
||||||
|
}
|
||||||
|
dd->end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void duDebugDrawPolyMeshDetail(duDebugDraw* dd, const struct rcPolyMeshDetail& dmesh)
|
||||||
|
{
|
||||||
|
if (!dd) return;
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_TRIS);
|
||||||
|
|
||||||
|
for (int i = 0; i < dmesh.nmeshes; ++i)
|
||||||
|
{
|
||||||
|
const unsigned int* m = &dmesh.meshes[i*4];
|
||||||
|
const unsigned int bverts = m[0];
|
||||||
|
const unsigned int btris = m[2];
|
||||||
|
const int ntris = (int)m[3];
|
||||||
|
const float* verts = &dmesh.verts[bverts*3];
|
||||||
|
const unsigned char* tris = &dmesh.tris[btris*4];
|
||||||
|
|
||||||
|
unsigned int color = duIntToCol(i, 192);
|
||||||
|
|
||||||
|
for (int j = 0; j < ntris; ++j)
|
||||||
|
{
|
||||||
|
dd->vertex(&verts[tris[j*4+0]*3], color);
|
||||||
|
dd->vertex(&verts[tris[j*4+1]*3], color);
|
||||||
|
dd->vertex(&verts[tris[j*4+2]*3], color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dd->end();
|
||||||
|
|
||||||
|
// Internal edges.
|
||||||
|
dd->begin(DU_DRAW_LINES, 1.0f);
|
||||||
|
const unsigned int coli = duRGBA(0,0,0,64);
|
||||||
|
for (int i = 0; i < dmesh.nmeshes; ++i)
|
||||||
|
{
|
||||||
|
const unsigned int* m = &dmesh.meshes[i*4];
|
||||||
|
const unsigned int bverts = m[0];
|
||||||
|
const unsigned int btris = m[2];
|
||||||
|
const int ntris = (int)m[3];
|
||||||
|
const float* verts = &dmesh.verts[bverts*3];
|
||||||
|
const unsigned char* tris = &dmesh.tris[btris*4];
|
||||||
|
|
||||||
|
for (int j = 0; j < ntris; ++j)
|
||||||
|
{
|
||||||
|
const unsigned char* t = &tris[j*4];
|
||||||
|
for (int k = 0, kp = 2; k < 3; kp=k++)
|
||||||
|
{
|
||||||
|
unsigned char ef = (t[3] >> (kp*2)) & 0x3;
|
||||||
|
if (ef == 0)
|
||||||
|
{
|
||||||
|
// Internal edge
|
||||||
|
if (t[kp] < t[k])
|
||||||
|
{
|
||||||
|
dd->vertex(&verts[t[kp]*3], coli);
|
||||||
|
dd->vertex(&verts[t[k]*3], coli);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dd->end();
|
||||||
|
|
||||||
|
// External edges.
|
||||||
|
dd->begin(DU_DRAW_LINES, 2.0f);
|
||||||
|
const unsigned int cole = duRGBA(0,0,0,64);
|
||||||
|
for (int i = 0; i < dmesh.nmeshes; ++i)
|
||||||
|
{
|
||||||
|
const unsigned int* m = &dmesh.meshes[i*4];
|
||||||
|
const unsigned int bverts = m[0];
|
||||||
|
const unsigned int btris = m[2];
|
||||||
|
const int ntris = (int)m[3];
|
||||||
|
const float* verts = &dmesh.verts[bverts*3];
|
||||||
|
const unsigned char* tris = &dmesh.tris[btris*4];
|
||||||
|
|
||||||
|
for (int j = 0; j < ntris; ++j)
|
||||||
|
{
|
||||||
|
const unsigned char* t = &tris[j*4];
|
||||||
|
for (int k = 0, kp = 2; k < 3; kp=k++)
|
||||||
|
{
|
||||||
|
unsigned char ef = (t[3] >> (kp*2)) & 0x3;
|
||||||
|
if (ef != 0)
|
||||||
|
{
|
||||||
|
// Ext edge
|
||||||
|
dd->vertex(&verts[t[kp]*3], cole);
|
||||||
|
dd->vertex(&verts[t[k]*3], cole);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dd->end();
|
||||||
|
|
||||||
|
dd->begin(DU_DRAW_POINTS, 3.0f);
|
||||||
|
const unsigned int colv = duRGBA(0,0,0,64);
|
||||||
|
for (int i = 0; i < dmesh.nmeshes; ++i)
|
||||||
|
{
|
||||||
|
const unsigned int* m = &dmesh.meshes[i*4];
|
||||||
|
const unsigned int bverts = m[0];
|
||||||
|
const int nverts = (int)m[1];
|
||||||
|
const float* verts = &dmesh.verts[bverts*3];
|
||||||
|
for (int j = 0; j < nverts; ++j)
|
||||||
|
dd->vertex(&verts[j*3], colv);
|
||||||
|
}
|
||||||
|
dd->end();
|
||||||
|
}
|
||||||
439
dep/recastnavigation/DebugUtils/Source/RecastDump.cpp
Normal file
439
dep/recastnavigation/DebugUtils/Source/RecastDump.cpp
Normal file
|
|
@ -0,0 +1,439 @@
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
|
||||||
|
#define _USE_MATH_DEFINES
|
||||||
|
#include <math.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "Recast.h"
|
||||||
|
#include "RecastAlloc.h"
|
||||||
|
#include "RecastDump.h"
|
||||||
|
|
||||||
|
|
||||||
|
duFileIO::~duFileIO()
|
||||||
|
{
|
||||||
|
// Empty
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ioprintf(duFileIO* io, const char* format, ...)
|
||||||
|
{
|
||||||
|
char line[256];
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, format);
|
||||||
|
const int n = vsnprintf(line, sizeof(line), format, ap);
|
||||||
|
va_end(ap);
|
||||||
|
if (n > 0)
|
||||||
|
io->write(line, sizeof(char)*n);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool duDumpPolyMeshToObj(rcPolyMesh& pmesh, duFileIO* io)
|
||||||
|
{
|
||||||
|
if (!io)
|
||||||
|
{
|
||||||
|
printf("duDumpPolyMeshToObj: input IO is null.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!io->isWriting())
|
||||||
|
{
|
||||||
|
printf("duDumpPolyMeshToObj: input IO not writing.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const int nvp = pmesh.nvp;
|
||||||
|
const float cs = pmesh.cs;
|
||||||
|
const float ch = pmesh.ch;
|
||||||
|
const float* orig = pmesh.bmin;
|
||||||
|
|
||||||
|
ioprintf(io, "# Recast Navmesh\n");
|
||||||
|
ioprintf(io, "o NavMesh\n");
|
||||||
|
|
||||||
|
ioprintf(io, "\n");
|
||||||
|
|
||||||
|
for (int i = 0; i < pmesh.nverts; ++i)
|
||||||
|
{
|
||||||
|
const unsigned short* v = &pmesh.verts[i*3];
|
||||||
|
const float x = orig[0] + v[0]*cs;
|
||||||
|
const float y = orig[1] + (v[1]+1)*ch + 0.1f;
|
||||||
|
const float z = orig[2] + v[2]*cs;
|
||||||
|
ioprintf(io, "v %f %f %f\n", x,y,z);
|
||||||
|
}
|
||||||
|
|
||||||
|
ioprintf(io, "\n");
|
||||||
|
|
||||||
|
for (int i = 0; i < pmesh.npolys; ++i)
|
||||||
|
{
|
||||||
|
const unsigned short* p = &pmesh.polys[i*nvp*2];
|
||||||
|
for (int j = 2; j < nvp; ++j)
|
||||||
|
{
|
||||||
|
if (p[j] == RC_MESH_NULL_IDX) break;
|
||||||
|
ioprintf(io, "f %d %d %d\n", p[0]+1, p[j-1]+1, p[j]+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool duDumpPolyMeshDetailToObj(rcPolyMeshDetail& dmesh, duFileIO* io)
|
||||||
|
{
|
||||||
|
if (!io)
|
||||||
|
{
|
||||||
|
printf("duDumpPolyMeshDetailToObj: input IO is null.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!io->isWriting())
|
||||||
|
{
|
||||||
|
printf("duDumpPolyMeshDetailToObj: input IO not writing.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ioprintf(io, "# Recast Navmesh\n");
|
||||||
|
ioprintf(io, "o NavMesh\n");
|
||||||
|
|
||||||
|
ioprintf(io, "\n");
|
||||||
|
|
||||||
|
for (int i = 0; i < dmesh.nverts; ++i)
|
||||||
|
{
|
||||||
|
const float* v = &dmesh.verts[i*3];
|
||||||
|
ioprintf(io, "v %f %f %f\n", v[0],v[1],v[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
ioprintf(io, "\n");
|
||||||
|
|
||||||
|
for (int i = 0; i < dmesh.nmeshes; ++i)
|
||||||
|
{
|
||||||
|
const unsigned int* m = &dmesh.meshes[i*4];
|
||||||
|
const unsigned int bverts = m[0];
|
||||||
|
const unsigned int btris = m[2];
|
||||||
|
const unsigned int ntris = m[3];
|
||||||
|
const unsigned char* tris = &dmesh.tris[btris*4];
|
||||||
|
for (unsigned int j = 0; j < ntris; ++j)
|
||||||
|
{
|
||||||
|
ioprintf(io, "f %d %d %d\n",
|
||||||
|
(int)(bverts+tris[j*4+0])+1,
|
||||||
|
(int)(bverts+tris[j*4+1])+1,
|
||||||
|
(int)(bverts+tris[j*4+2])+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const int CSET_MAGIC = ('c' << 24) | ('s' << 16) | ('e' << 8) | 't';
|
||||||
|
static const int CSET_VERSION = 1;
|
||||||
|
|
||||||
|
bool duDumpContourSet(struct rcContourSet& cset, duFileIO* io)
|
||||||
|
{
|
||||||
|
if (!io)
|
||||||
|
{
|
||||||
|
printf("duDumpContourSet: input IO is null.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!io->isWriting())
|
||||||
|
{
|
||||||
|
printf("duDumpContourSet: input IO not writing.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
io->write(&CSET_MAGIC, sizeof(CSET_MAGIC));
|
||||||
|
io->write(&CSET_VERSION, sizeof(CSET_VERSION));
|
||||||
|
|
||||||
|
io->write(&cset.nconts, sizeof(cset.nconts));
|
||||||
|
|
||||||
|
io->write(cset.bmin, sizeof(cset.bmin));
|
||||||
|
io->write(cset.bmax, sizeof(cset.bmax));
|
||||||
|
|
||||||
|
io->write(&cset.cs, sizeof(cset.cs));
|
||||||
|
io->write(&cset.ch, sizeof(cset.ch));
|
||||||
|
|
||||||
|
for (int i = 0; i < cset.nconts; ++i)
|
||||||
|
{
|
||||||
|
const rcContour& cont = cset.conts[i];
|
||||||
|
io->write(&cont.nverts, sizeof(cont.nverts));
|
||||||
|
io->write(&cont.nrverts, sizeof(cont.nrverts));
|
||||||
|
io->write(&cont.reg, sizeof(cont.reg));
|
||||||
|
io->write(&cont.area, sizeof(cont.area));
|
||||||
|
io->write(cont.verts, sizeof(int)*4*cont.nverts);
|
||||||
|
io->write(cont.rverts, sizeof(int)*4*cont.nrverts);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool duReadContourSet(struct rcContourSet& cset, duFileIO* io)
|
||||||
|
{
|
||||||
|
if (!io)
|
||||||
|
{
|
||||||
|
printf("duReadContourSet: input IO is null.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!io->isReading())
|
||||||
|
{
|
||||||
|
printf("duReadContourSet: input IO not reading.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int magic = 0;
|
||||||
|
int version = 0;
|
||||||
|
|
||||||
|
io->read(&magic, sizeof(magic));
|
||||||
|
io->read(&version, sizeof(version));
|
||||||
|
|
||||||
|
if (magic != CSET_MAGIC)
|
||||||
|
{
|
||||||
|
printf("duReadContourSet: Bad voodoo.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (version != CSET_VERSION)
|
||||||
|
{
|
||||||
|
printf("duReadContourSet: Bad version.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
io->read(&cset.nconts, sizeof(cset.nconts));
|
||||||
|
|
||||||
|
cset.conts = (rcContour*)rcAlloc(sizeof(rcContour)*cset.nconts, RC_ALLOC_PERM);
|
||||||
|
if (!cset.conts)
|
||||||
|
{
|
||||||
|
printf("duReadContourSet: Could not alloc contours (%d)\n", cset.nconts);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
memset(cset.conts, 0, sizeof(rcContour)*cset.nconts);
|
||||||
|
|
||||||
|
io->read(cset.bmin, sizeof(cset.bmin));
|
||||||
|
io->read(cset.bmax, sizeof(cset.bmax));
|
||||||
|
|
||||||
|
io->read(&cset.cs, sizeof(cset.cs));
|
||||||
|
io->read(&cset.ch, sizeof(cset.ch));
|
||||||
|
|
||||||
|
for (int i = 0; i < cset.nconts; ++i)
|
||||||
|
{
|
||||||
|
rcContour& cont = cset.conts[i];
|
||||||
|
io->read(&cont.nverts, sizeof(cont.nverts));
|
||||||
|
io->read(&cont.nrverts, sizeof(cont.nrverts));
|
||||||
|
io->read(&cont.reg, sizeof(cont.reg));
|
||||||
|
io->read(&cont.area, sizeof(cont.area));
|
||||||
|
|
||||||
|
cont.verts = (int*)rcAlloc(sizeof(int)*4*cont.nverts, RC_ALLOC_PERM);
|
||||||
|
if (!cont.verts)
|
||||||
|
{
|
||||||
|
printf("duReadContourSet: Could not alloc contour verts (%d)\n", cont.nverts);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
cont.rverts = (int*)rcAlloc(sizeof(int)*4*cont.nrverts, RC_ALLOC_PERM);
|
||||||
|
if (!cont.rverts)
|
||||||
|
{
|
||||||
|
printf("duReadContourSet: Could not alloc contour rverts (%d)\n", cont.nrverts);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
io->read(cont.verts, sizeof(int)*4*cont.nverts);
|
||||||
|
io->read(cont.rverts, sizeof(int)*4*cont.nrverts);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static const int CHF_MAGIC = ('r' << 24) | ('c' << 16) | ('h' << 8) | 'f';
|
||||||
|
static const int CHF_VERSION = 2;
|
||||||
|
|
||||||
|
bool duDumpCompactHeightfield(struct rcCompactHeightfield& chf, duFileIO* io)
|
||||||
|
{
|
||||||
|
if (!io)
|
||||||
|
{
|
||||||
|
printf("duDumpCompactHeightfield: input IO is null.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!io->isWriting())
|
||||||
|
{
|
||||||
|
printf("duDumpCompactHeightfield: input IO not writing.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
io->write(&CHF_MAGIC, sizeof(CHF_MAGIC));
|
||||||
|
io->write(&CHF_VERSION, sizeof(CHF_VERSION));
|
||||||
|
|
||||||
|
io->write(&chf.width, sizeof(chf.width));
|
||||||
|
io->write(&chf.height, sizeof(chf.height));
|
||||||
|
io->write(&chf.spanCount, sizeof(chf.spanCount));
|
||||||
|
|
||||||
|
io->write(&chf.walkableHeight, sizeof(chf.walkableHeight));
|
||||||
|
io->write(&chf.walkableClimb, sizeof(chf.walkableClimb));
|
||||||
|
|
||||||
|
io->write(&chf.maxDistance, sizeof(chf.maxDistance));
|
||||||
|
io->write(&chf.maxRegions, sizeof(chf.maxRegions));
|
||||||
|
|
||||||
|
io->write(chf.bmin, sizeof(chf.bmin));
|
||||||
|
io->write(chf.bmax, sizeof(chf.bmax));
|
||||||
|
|
||||||
|
io->write(&chf.cs, sizeof(chf.cs));
|
||||||
|
io->write(&chf.ch, sizeof(chf.ch));
|
||||||
|
|
||||||
|
int tmp = 0;
|
||||||
|
if (chf.cells) tmp |= 1;
|
||||||
|
if (chf.spans) tmp |= 2;
|
||||||
|
if (chf.dist) tmp |= 4;
|
||||||
|
if (chf.areas) tmp |= 8;
|
||||||
|
|
||||||
|
io->write(&tmp, sizeof(tmp));
|
||||||
|
|
||||||
|
if (chf.cells)
|
||||||
|
io->write(chf.cells, sizeof(rcCompactCell)*chf.width*chf.height);
|
||||||
|
if (chf.spans)
|
||||||
|
io->write(chf.spans, sizeof(rcCompactSpan)*chf.spanCount);
|
||||||
|
if (chf.dist)
|
||||||
|
io->write(chf.dist, sizeof(unsigned short)*chf.spanCount);
|
||||||
|
if (chf.areas)
|
||||||
|
io->write(chf.areas, sizeof(unsigned char)*chf.spanCount);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool duReadCompactHeightfield(struct rcCompactHeightfield& chf, duFileIO* io)
|
||||||
|
{
|
||||||
|
if (!io)
|
||||||
|
{
|
||||||
|
printf("duReadCompactHeightfield: input IO is null.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!io->isReading())
|
||||||
|
{
|
||||||
|
printf("duReadCompactHeightfield: input IO not reading.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int magic = 0;
|
||||||
|
int version = 0;
|
||||||
|
|
||||||
|
io->read(&magic, sizeof(magic));
|
||||||
|
io->read(&version, sizeof(version));
|
||||||
|
|
||||||
|
if (magic != CHF_MAGIC)
|
||||||
|
{
|
||||||
|
printf("duReadCompactHeightfield: Bad voodoo.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (version != CHF_VERSION)
|
||||||
|
{
|
||||||
|
printf("duReadCompactHeightfield: Bad version.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
io->read(&chf.width, sizeof(chf.width));
|
||||||
|
io->read(&chf.height, sizeof(chf.height));
|
||||||
|
io->read(&chf.spanCount, sizeof(chf.spanCount));
|
||||||
|
|
||||||
|
io->read(&chf.walkableHeight, sizeof(chf.walkableHeight));
|
||||||
|
io->read(&chf.walkableClimb, sizeof(chf.walkableClimb));
|
||||||
|
|
||||||
|
io->read(&chf.maxDistance, sizeof(chf.maxDistance));
|
||||||
|
io->read(&chf.maxRegions, sizeof(chf.maxRegions));
|
||||||
|
|
||||||
|
io->read(chf.bmin, sizeof(chf.bmin));
|
||||||
|
io->read(chf.bmax, sizeof(chf.bmax));
|
||||||
|
|
||||||
|
io->read(&chf.cs, sizeof(chf.cs));
|
||||||
|
io->read(&chf.ch, sizeof(chf.ch));
|
||||||
|
|
||||||
|
int tmp = 0;
|
||||||
|
io->read(&tmp, sizeof(tmp));
|
||||||
|
|
||||||
|
if (tmp & 1)
|
||||||
|
{
|
||||||
|
chf.cells = (rcCompactCell*)rcAlloc(sizeof(rcCompactCell)*chf.width*chf.height, RC_ALLOC_PERM);
|
||||||
|
if (!chf.cells)
|
||||||
|
{
|
||||||
|
printf("duReadCompactHeightfield: Could not alloc cells (%d)\n", chf.width*chf.height);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
io->read(chf.cells, sizeof(rcCompactCell)*chf.width*chf.height);
|
||||||
|
}
|
||||||
|
if (tmp & 2)
|
||||||
|
{
|
||||||
|
chf.spans = (rcCompactSpan*)rcAlloc(sizeof(rcCompactSpan)*chf.spanCount, RC_ALLOC_PERM);
|
||||||
|
if (!chf.spans)
|
||||||
|
{
|
||||||
|
printf("duReadCompactHeightfield: Could not alloc spans (%d)\n", chf.spanCount);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
io->read(chf.spans, sizeof(rcCompactSpan)*chf.spanCount);
|
||||||
|
}
|
||||||
|
if (tmp & 4)
|
||||||
|
{
|
||||||
|
chf.dist = (unsigned short*)rcAlloc(sizeof(unsigned short)*chf.spanCount, RC_ALLOC_PERM);
|
||||||
|
if (!chf.dist)
|
||||||
|
{
|
||||||
|
printf("duReadCompactHeightfield: Could not alloc dist (%d)\n", chf.spanCount);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
io->read(chf.dist, sizeof(unsigned short)*chf.spanCount);
|
||||||
|
}
|
||||||
|
if (tmp & 8)
|
||||||
|
{
|
||||||
|
chf.areas = (unsigned char*)rcAlloc(sizeof(unsigned char)*chf.spanCount, RC_ALLOC_PERM);
|
||||||
|
if (!chf.areas)
|
||||||
|
{
|
||||||
|
printf("duReadCompactHeightfield: Could not alloc areas (%d)\n", chf.spanCount);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
io->read(chf.areas, sizeof(unsigned char)*chf.spanCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void logLine(rcContext& ctx, rcTimerLabel label, const char* name, const float pc)
|
||||||
|
{
|
||||||
|
const int t = ctx.getAccumulatedTime(label);
|
||||||
|
if (t < 0) return;
|
||||||
|
ctx.log(RC_LOG_PROGRESS, "%s:\t%.2fms\t(%.1f%%)", name, t/1000.0f, t*pc);
|
||||||
|
}
|
||||||
|
|
||||||
|
void duLogBuildTimes(rcContext& ctx, const int totalTimeUsec)
|
||||||
|
{
|
||||||
|
const float pc = 100.0f / totalTimeUsec;
|
||||||
|
|
||||||
|
ctx.log(RC_LOG_PROGRESS, "Build Times");
|
||||||
|
logLine(ctx, RC_TIMER_RASTERIZE_TRIANGLES, "- Rasterize", pc);
|
||||||
|
logLine(ctx, RC_TIMER_BUILD_COMPACTHEIGHTFIELD, "- Build Compact", pc);
|
||||||
|
logLine(ctx, RC_TIMER_FILTER_BORDER, "- Filter Border", pc);
|
||||||
|
logLine(ctx, RC_TIMER_FILTER_WALKABLE, "- Filter Walkable", pc);
|
||||||
|
logLine(ctx, RC_TIMER_ERODE_AREA, "- Erode Area", pc);
|
||||||
|
logLine(ctx, RC_TIMER_MEDIAN_AREA, "- Median Area", pc);
|
||||||
|
logLine(ctx, RC_TIMER_MARK_BOX_AREA, "- Mark Box Area", pc);
|
||||||
|
logLine(ctx, RC_TIMER_MARK_CONVEXPOLY_AREA, "- Mark Convex Area", pc);
|
||||||
|
logLine(ctx, RC_TIMER_BUILD_DISTANCEFIELD, "- Build Disntace Field", pc);
|
||||||
|
logLine(ctx, RC_TIMER_BUILD_DISTANCEFIELD_DIST, " - Distance", pc);
|
||||||
|
logLine(ctx, RC_TIMER_BUILD_DISTANCEFIELD_BLUR, " - Blur", pc);
|
||||||
|
logLine(ctx, RC_TIMER_BUILD_REGIONS, "- Build Regions", pc);
|
||||||
|
logLine(ctx, RC_TIMER_BUILD_REGIONS_WATERSHED, " - Watershed", pc);
|
||||||
|
logLine(ctx, RC_TIMER_BUILD_REGIONS_EXPAND, " - Expand", pc);
|
||||||
|
logLine(ctx, RC_TIMER_BUILD_REGIONS_FLOOD, " - Find Basins", pc);
|
||||||
|
logLine(ctx, RC_TIMER_BUILD_REGIONS_FILTER, " - Filter", pc);
|
||||||
|
logLine(ctx, RC_TIMER_BUILD_CONTOURS, "- Build Contours", pc);
|
||||||
|
logLine(ctx, RC_TIMER_BUILD_CONTOURS_TRACE, " - Trace", pc);
|
||||||
|
logLine(ctx, RC_TIMER_BUILD_CONTOURS_SIMPLIFY, " - Simplify", pc);
|
||||||
|
logLine(ctx, RC_TIMER_BUILD_POLYMESH, "- Build Polymesh", pc);
|
||||||
|
logLine(ctx, RC_TIMER_BUILD_POLYMESHDETAIL, "- Build Polymesh Detail", pc);
|
||||||
|
logLine(ctx, RC_TIMER_MERGE_POLYMESH, "- Merge Polymeshes", pc);
|
||||||
|
logLine(ctx, RC_TIMER_MERGE_POLYMESHDETAIL, "- Merge Polymesh Details", pc);
|
||||||
|
ctx.log(RC_LOG_PROGRESS, "=== TOTAL:\t%.2fms", totalTimeUsec/1000.0f);
|
||||||
|
}
|
||||||
|
|
||||||
18
dep/recastnavigation/Detour/CMakeLists.txt
Normal file
18
dep/recastnavigation/Detour/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
#
|
||||||
|
# Copyright (C) 2005-2011 MaNGOS project <http://getmangos.com/>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
#
|
||||||
|
add_subdirectory(Source)
|
||||||
36
dep/recastnavigation/Detour/Include/DetourAlloc.h
Normal file
36
dep/recastnavigation/Detour/Include/DetourAlloc.h
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
//
|
||||||
|
// 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 DETOURALLOCATOR_H
|
||||||
|
#define DETOURALLOCATOR_H
|
||||||
|
|
||||||
|
enum dtAllocHint
|
||||||
|
{
|
||||||
|
DT_ALLOC_PERM, // Memory persist after a function call.
|
||||||
|
DT_ALLOC_TEMP // Memory used temporarily within a function.
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef void* (dtAllocFunc)(int size, dtAllocHint hint);
|
||||||
|
typedef void (dtFreeFunc)(void* ptr);
|
||||||
|
|
||||||
|
void dtAllocSetCustom(dtAllocFunc *allocFunc, dtFreeFunc *freeFunc);
|
||||||
|
|
||||||
|
void* dtAlloc(int size, dtAllocHint hint);
|
||||||
|
void dtFree(void* ptr);
|
||||||
|
|
||||||
|
#endif
|
||||||
33
dep/recastnavigation/Detour/Include/DetourAssert.h
Normal file
33
dep/recastnavigation/Detour/Include/DetourAssert.h
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
//
|
||||||
|
// 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 DETOURASSERT_H
|
||||||
|
#define DETOURASSERT_H
|
||||||
|
|
||||||
|
// Note: This header file's only purpose is to include define assert.
|
||||||
|
// Feel free to change the file and include your own implementation instead.
|
||||||
|
|
||||||
|
#ifdef NDEBUG
|
||||||
|
// From http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/
|
||||||
|
# define dtAssert(x) do { (void)sizeof(x); } while(__LINE__==-1,false)
|
||||||
|
#else
|
||||||
|
# include <assert.h>
|
||||||
|
# define dtAssert assert
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // DETOURASSERT_H
|
||||||
248
dep/recastnavigation/Detour/Include/DetourCommon.h
Normal file
248
dep/recastnavigation/Detour/Include/DetourCommon.h
Normal file
|
|
@ -0,0 +1,248 @@
|
||||||
|
//
|
||||||
|
// 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 DETOURCOMMON_H
|
||||||
|
#define DETOURCOMMON_H
|
||||||
|
|
||||||
|
template<class T> inline void dtSwap(T& a, T& b) { T t = a; a = b; b = t; }
|
||||||
|
template<class T> inline T dtMin(T a, T b) { return a < b ? a : b; }
|
||||||
|
template<class T> inline T dtMax(T a, T b) { return a > b ? a : b; }
|
||||||
|
template<class T> inline T dtAbs(T a) { return a < 0 ? -a : a; }
|
||||||
|
template<class T> inline T dtSqr(T a) { return a*a; }
|
||||||
|
template<class T> inline T dtClamp(T v, T mn, T mx) { return v < mn ? mn : (v > mx ? mx : v); }
|
||||||
|
|
||||||
|
float dtSqrt(float x);
|
||||||
|
|
||||||
|
inline void dtVcross(float* dest, const float* v1, const float* v2)
|
||||||
|
{
|
||||||
|
dest[0] = v1[1]*v2[2] - v1[2]*v2[1];
|
||||||
|
dest[1] = v1[2]*v2[0] - v1[0]*v2[2];
|
||||||
|
dest[2] = v1[0]*v2[1] - v1[1]*v2[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline float dtVdot(const float* v1, const float* v2)
|
||||||
|
{
|
||||||
|
return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void dtVmad(float* dest, const float* v1, const float* v2, const float s)
|
||||||
|
{
|
||||||
|
dest[0] = v1[0]+v2[0]*s;
|
||||||
|
dest[1] = v1[1]+v2[1]*s;
|
||||||
|
dest[2] = v1[2]+v2[2]*s;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void dtVlerp(float* dest, const float* v1, const float* v2, const float t)
|
||||||
|
{
|
||||||
|
dest[0] = v1[0]+(v2[0]-v1[0])*t;
|
||||||
|
dest[1] = v1[1]+(v2[1]-v1[1])*t;
|
||||||
|
dest[2] = v1[2]+(v2[2]-v1[2])*t;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void dtVadd(float* dest, const float* v1, const float* v2)
|
||||||
|
{
|
||||||
|
dest[0] = v1[0]+v2[0];
|
||||||
|
dest[1] = v1[1]+v2[1];
|
||||||
|
dest[2] = v1[2]+v2[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void dtVsub(float* dest, const float* v1, const float* v2)
|
||||||
|
{
|
||||||
|
dest[0] = v1[0]-v2[0];
|
||||||
|
dest[1] = v1[1]-v2[1];
|
||||||
|
dest[2] = v1[2]-v2[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void dtVscale(float* dest, const float* v, const float t)
|
||||||
|
{
|
||||||
|
dest[0] = v[0]*t;
|
||||||
|
dest[1] = v[1]*t;
|
||||||
|
dest[2] = v[2]*t;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void dtVmin(float* mn, const float* v)
|
||||||
|
{
|
||||||
|
mn[0] = dtMin(mn[0], v[0]);
|
||||||
|
mn[1] = dtMin(mn[1], v[1]);
|
||||||
|
mn[2] = dtMin(mn[2], v[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void dtVmax(float* mx, const float* v)
|
||||||
|
{
|
||||||
|
mx[0] = dtMax(mx[0], v[0]);
|
||||||
|
mx[1] = dtMax(mx[1], v[1]);
|
||||||
|
mx[2] = dtMax(mx[2], v[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void dtVset(float* dest, const float x, const float y, const float z)
|
||||||
|
{
|
||||||
|
dest[0] = x; dest[1] = y; dest[2] = z;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void dtVcopy(float* dest, const float* a)
|
||||||
|
{
|
||||||
|
dest[0] = a[0];
|
||||||
|
dest[1] = a[1];
|
||||||
|
dest[2] = a[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline float dtVlen(const float* v)
|
||||||
|
{
|
||||||
|
return dtSqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline float dtVlenSqr(const float* v)
|
||||||
|
{
|
||||||
|
return v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline float dtVdist(const float* v1, const float* v2)
|
||||||
|
{
|
||||||
|
const float dx = v2[0] - v1[0];
|
||||||
|
const float dy = v2[1] - v1[1];
|
||||||
|
const float dz = v2[2] - v1[2];
|
||||||
|
return dtSqrt(dx*dx + dy*dy + dz*dz);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline float dtVdistSqr(const float* v1, const float* v2)
|
||||||
|
{
|
||||||
|
const float dx = v2[0] - v1[0];
|
||||||
|
const float dy = v2[1] - v1[1];
|
||||||
|
const float dz = v2[2] - v1[2];
|
||||||
|
return dx*dx + dy*dy + dz*dz;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline float dtVdist2D(const float* v1, const float* v2)
|
||||||
|
{
|
||||||
|
const float dx = v2[0] - v1[0];
|
||||||
|
const float dz = v2[2] - v1[2];
|
||||||
|
return dtSqrt(dx*dx + dz*dz);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline float dtVdist2DSqr(const float* v1, const float* v2)
|
||||||
|
{
|
||||||
|
const float dx = v2[0] - v1[0];
|
||||||
|
const float dz = v2[2] - v1[2];
|
||||||
|
return dx*dx + dz*dz;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void dtVnormalize(float* v)
|
||||||
|
{
|
||||||
|
float d = 1.0f / dtSqrt(dtSqr(v[0]) + dtSqr(v[1]) + dtSqr(v[2]));
|
||||||
|
v[0] *= d;
|
||||||
|
v[1] *= d;
|
||||||
|
v[2] *= d;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool dtVequal(const float* p0, const float* p1)
|
||||||
|
{
|
||||||
|
static const float thr = dtSqr(1.0f/16384.0f);
|
||||||
|
const float d = dtVdistSqr(p0, p1);
|
||||||
|
return d < thr;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline unsigned int dtNextPow2(unsigned int v)
|
||||||
|
{
|
||||||
|
v--;
|
||||||
|
v |= v >> 1;
|
||||||
|
v |= v >> 2;
|
||||||
|
v |= v >> 4;
|
||||||
|
v |= v >> 8;
|
||||||
|
v |= v >> 16;
|
||||||
|
v++;
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline unsigned int dtIlog2(unsigned int v)
|
||||||
|
{
|
||||||
|
unsigned int r;
|
||||||
|
unsigned int shift;
|
||||||
|
r = (v > 0xffff) << 4; v >>= r;
|
||||||
|
shift = (v > 0xff) << 3; v >>= shift; r |= shift;
|
||||||
|
shift = (v > 0xf) << 2; v >>= shift; r |= shift;
|
||||||
|
shift = (v > 0x3) << 1; v >>= shift; r |= shift;
|
||||||
|
r |= (v >> 1);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int dtAlign4(int x) { return (x+3) & ~3; }
|
||||||
|
|
||||||
|
inline int dtOppositeTile(int side) { return (side+4) & 0x7; }
|
||||||
|
|
||||||
|
inline float dtVdot2D(const float* u, const float* v)
|
||||||
|
{
|
||||||
|
return u[0]*v[0] + u[2]*v[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline float dtVperp2D(const float* u, const float* v)
|
||||||
|
{
|
||||||
|
return u[2]*v[0] - u[0]*v[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline float dtTriArea2D(const float* a, const float* b, const float* c)
|
||||||
|
{
|
||||||
|
const float abx = b[0] - a[0];
|
||||||
|
const float abz = b[2] - a[2];
|
||||||
|
const float acx = c[0] - a[0];
|
||||||
|
const float acz = c[2] - a[2];
|
||||||
|
return acx*abz - abx*acz;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool dtOverlapQuantBounds(const unsigned short amin[3], const unsigned short amax[3],
|
||||||
|
const unsigned short bmin[3], const unsigned short bmax[3])
|
||||||
|
{
|
||||||
|
bool overlap = true;
|
||||||
|
overlap = (amin[0] > bmax[0] || amax[0] < bmin[0]) ? false : overlap;
|
||||||
|
overlap = (amin[1] > bmax[1] || amax[1] < bmin[1]) ? false : overlap;
|
||||||
|
overlap = (amin[2] > bmax[2] || amax[2] < bmin[2]) ? false : overlap;
|
||||||
|
return overlap;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool dtOverlapBounds(const float* amin, const float* amax,
|
||||||
|
const float* bmin, const float* bmax)
|
||||||
|
{
|
||||||
|
bool overlap = true;
|
||||||
|
overlap = (amin[0] > bmax[0] || amax[0] < bmin[0]) ? false : overlap;
|
||||||
|
overlap = (amin[1] > bmax[1] || amax[1] < bmin[1]) ? false : overlap;
|
||||||
|
overlap = (amin[2] > bmax[2] || amax[2] < bmin[2]) ? false : overlap;
|
||||||
|
return overlap;
|
||||||
|
}
|
||||||
|
|
||||||
|
void dtClosestPtPointTriangle(float* closest, const float* p,
|
||||||
|
const float* a, const float* b, const float* c);
|
||||||
|
|
||||||
|
bool dtClosestHeightPointTriangle(const float* p, const float* a, const float* b, const float* c, float& h);
|
||||||
|
|
||||||
|
bool dtIntersectSegmentPoly2D(const float* p0, const float* p1,
|
||||||
|
const float* verts, int nverts,
|
||||||
|
float& tmin, float& tmax,
|
||||||
|
int& segMin, int& segMax);
|
||||||
|
|
||||||
|
bool dtPointInPolygon(const float* pt, const float* verts, const int nverts);
|
||||||
|
|
||||||
|
bool dtDistancePtPolyEdgesSqr(const float* pt, const float* verts, const int nverts,
|
||||||
|
float* ed, float* et);
|
||||||
|
|
||||||
|
float dtDistancePtSegSqr2D(const float* pt, const float* p, const float* q, float& t);
|
||||||
|
|
||||||
|
void dtCalcPolyCenter(float* tc, const unsigned short* idx, int nidx, const float* verts);
|
||||||
|
|
||||||
|
bool dtOverlapPolyPoly2D(const float* polya, const int npolya,
|
||||||
|
const float* polyb, const int npolyb);
|
||||||
|
|
||||||
|
#endif // DETOURCOMMON_H
|
||||||
428
dep/recastnavigation/Detour/Include/DetourNavMesh.h
Normal file
428
dep/recastnavigation/Detour/Include/DetourNavMesh.h
Normal file
|
|
@ -0,0 +1,428 @@
|
||||||
|
//
|
||||||
|
// 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 DETOURNAVMESH_H
|
||||||
|
#define DETOURNAVMESH_H
|
||||||
|
|
||||||
|
#include "DetourAlloc.h"
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
typedef unsigned __int64 uint64;
|
||||||
|
#else
|
||||||
|
#include <stdint.h>
|
||||||
|
#ifndef uint64_t
|
||||||
|
#ifdef __linux__
|
||||||
|
#include <linux/types.h>
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
typedef uint64_t uint64;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Note: If you want to use 64-bit refs, change the types of both dtPolyRef & dtTileRef.
|
||||||
|
// It is also recommended to change dtHashRef() to proper 64-bit hash too.
|
||||||
|
|
||||||
|
// Reference to navigation polygon.
|
||||||
|
typedef uint64 dtPolyRef;
|
||||||
|
|
||||||
|
// Reference to navigation mesh tile.
|
||||||
|
typedef uint64 dtTileRef;
|
||||||
|
|
||||||
|
// Maximum number of vertices per navigation polygon.
|
||||||
|
static const int DT_VERTS_PER_POLYGON = 6;
|
||||||
|
|
||||||
|
static const int DT_NAVMESH_MAGIC = 'D'<<24 | 'N'<<16 | 'A'<<8 | 'V'; //'DNAV';
|
||||||
|
static const int DT_NAVMESH_VERSION = 6;
|
||||||
|
|
||||||
|
static const int DT_NAVMESH_STATE_MAGIC = 'D'<<24 | 'N'<<16 | 'M'<<8 | 'S'; //'DNMS';
|
||||||
|
static const int DT_NAVMESH_STATE_VERSION = 1;
|
||||||
|
|
||||||
|
static const unsigned short DT_EXT_LINK = 0x8000;
|
||||||
|
static const unsigned int DT_NULL_LINK = 0xffffffff;
|
||||||
|
static const unsigned int DT_OFFMESH_CON_BIDIR = 1;
|
||||||
|
|
||||||
|
static const int DT_MAX_AREAS = 64;
|
||||||
|
|
||||||
|
static const int STATIC_SALT_BITS = 12;
|
||||||
|
static const int STATIC_TILE_BITS = 21;
|
||||||
|
static const int STATIC_POLY_BITS = 31;
|
||||||
|
// we cannot have over 31 bits for either tile nor poly
|
||||||
|
// without changing polyCount to use 64bits too.
|
||||||
|
|
||||||
|
// Flags for addTile
|
||||||
|
enum dtTileFlags
|
||||||
|
{
|
||||||
|
DT_TILE_FREE_DATA = 0x01, // Navmesh owns the tile memory and should free it.
|
||||||
|
};
|
||||||
|
|
||||||
|
// Flags returned by findStraightPath().
|
||||||
|
enum dtStraightPathFlags
|
||||||
|
{
|
||||||
|
DT_STRAIGHTPATH_START = 0x01, // The vertex is the start position.
|
||||||
|
DT_STRAIGHTPATH_END = 0x02, // The vertex is the end position.
|
||||||
|
DT_STRAIGHTPATH_OFFMESH_CONNECTION = 0x04, // The vertex is start of an off-mesh link.
|
||||||
|
};
|
||||||
|
|
||||||
|
// Flags describing polygon properties.
|
||||||
|
enum dtPolyTypes
|
||||||
|
{
|
||||||
|
DT_POLYTYPE_GROUND = 0, // Regular ground polygons.
|
||||||
|
DT_POLYTYPE_OFFMESH_CONNECTION = 1, // Off-mesh connections.
|
||||||
|
};
|
||||||
|
|
||||||
|
enum dtStatus
|
||||||
|
{
|
||||||
|
DT_FAILURE = 0, // Operation failed.
|
||||||
|
DT_FAILURE_DATA_MAGIC,
|
||||||
|
DT_FAILURE_DATA_VERSION,
|
||||||
|
DT_FAILURE_OUT_OF_MEMORY,
|
||||||
|
DT_SUCCESS, // Operation succeed.
|
||||||
|
DT_IN_PROGRESS, // Operation still in progress.
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Structure describing the navigation polygon data.
|
||||||
|
struct dtPoly
|
||||||
|
{
|
||||||
|
unsigned int firstLink; // Index to first link in linked list.
|
||||||
|
unsigned short verts[DT_VERTS_PER_POLYGON]; // Indices to vertices of the poly.
|
||||||
|
unsigned short neis[DT_VERTS_PER_POLYGON]; // Refs to neighbours of the poly.
|
||||||
|
unsigned short flags; // Flags (see dtPolyFlags).
|
||||||
|
unsigned char vertCount; // Number of vertices.
|
||||||
|
unsigned char areaAndtype; // Bit packed: Area ID of the polygon, and Polygon type, see dtPolyTypes..
|
||||||
|
inline void setArea(unsigned char a) { areaAndtype = (areaAndtype & 0xc0) | (a & 0x3f); }
|
||||||
|
inline void setType(unsigned char t) { areaAndtype = (areaAndtype & 0x3f) | (t << 6); }
|
||||||
|
inline unsigned char getArea() const { return areaAndtype & 0x3f; }
|
||||||
|
inline unsigned char getType() const { return areaAndtype >> 6; }
|
||||||
|
};
|
||||||
|
|
||||||
|
// Stucture describing polygon detail triangles.
|
||||||
|
struct dtPolyDetail
|
||||||
|
{
|
||||||
|
unsigned int vertBase; // Offset to detail vertex array.
|
||||||
|
unsigned int triBase; // Offset to detail triangle array.
|
||||||
|
unsigned char vertCount; // Number of vertices in the detail mesh.
|
||||||
|
unsigned char triCount; // Number of triangles.
|
||||||
|
};
|
||||||
|
|
||||||
|
// Stucture describing a link to another polygon.
|
||||||
|
struct dtLink
|
||||||
|
{
|
||||||
|
dtPolyRef ref; // Neighbour reference.
|
||||||
|
unsigned int next; // Index to next link.
|
||||||
|
unsigned char edge; // Index to polygon edge which owns this link.
|
||||||
|
unsigned char side; // If boundary link, defines on which side the link is.
|
||||||
|
unsigned char bmin, bmax; // If boundary link, defines the sub edge area.
|
||||||
|
};
|
||||||
|
|
||||||
|
struct dtBVNode
|
||||||
|
{
|
||||||
|
unsigned short bmin[3], bmax[3]; // BVnode bounds
|
||||||
|
int i; // Index to item or if negative, escape index.
|
||||||
|
};
|
||||||
|
|
||||||
|
struct dtOffMeshConnection
|
||||||
|
{
|
||||||
|
float pos[6]; // Both end point locations.
|
||||||
|
float rad; // Link connection radius.
|
||||||
|
unsigned short poly; // Poly Id
|
||||||
|
unsigned char flags; // Link flags
|
||||||
|
unsigned char side; // End point side.
|
||||||
|
unsigned int userId; // User ID to identify this connection.
|
||||||
|
};
|
||||||
|
|
||||||
|
struct dtMeshHeader
|
||||||
|
{
|
||||||
|
int magic; // Magic number, used to identify the data.
|
||||||
|
int version; // Data version number.
|
||||||
|
int x, y; // Location of the time on the grid.
|
||||||
|
unsigned int userId; // User ID of the tile.
|
||||||
|
int polyCount; // Number of polygons in the tile.
|
||||||
|
int vertCount; // Number of vertices in the tile.
|
||||||
|
int maxLinkCount; // Number of allocated links.
|
||||||
|
int detailMeshCount; // Number of detail meshes.
|
||||||
|
int detailVertCount; // Number of detail vertices.
|
||||||
|
int detailTriCount; // Number of detail triangles.
|
||||||
|
int bvNodeCount; // Number of BVtree nodes.
|
||||||
|
int offMeshConCount; // Number of Off-Mesh links.
|
||||||
|
int offMeshBase; // Index to first polygon which is Off-Mesh link.
|
||||||
|
float walkableHeight; // Height of the agent.
|
||||||
|
float walkableRadius; // Radius of the agent
|
||||||
|
float walkableClimb; // Max climb height of the agent.
|
||||||
|
float bmin[3], bmax[3]; // Bounding box of the tile.
|
||||||
|
float bvQuantFactor; // BVtree quantization factor (world to bvnode coords)
|
||||||
|
};
|
||||||
|
|
||||||
|
struct dtMeshTile
|
||||||
|
{
|
||||||
|
unsigned int salt; // Counter describing modifications to the tile.
|
||||||
|
|
||||||
|
unsigned int linksFreeList; // Index to next free link.
|
||||||
|
dtMeshHeader* header; // Pointer to tile header.
|
||||||
|
dtPoly* polys; // Pointer to the polygons (will be updated when tile is added).
|
||||||
|
float* verts; // Pointer to the vertices (will be updated when tile added).
|
||||||
|
dtLink* links; // Pointer to the links (will be updated when tile added).
|
||||||
|
dtPolyDetail* detailMeshes; // Pointer to detail meshes (will be updated when tile added).
|
||||||
|
float* detailVerts; // Pointer to detail vertices (will be updated when tile added).
|
||||||
|
unsigned char* detailTris; // Pointer to detail triangles (will be updated when tile added).
|
||||||
|
dtBVNode* bvTree; // Pointer to BVtree nodes (will be updated when tile added).
|
||||||
|
dtOffMeshConnection* offMeshCons; // Pointer to Off-Mesh links. (will be updated when tile added).
|
||||||
|
|
||||||
|
unsigned char* data; // Pointer to tile data.
|
||||||
|
int dataSize; // Size of the tile data.
|
||||||
|
int flags; // Tile flags, see dtTileFlags.
|
||||||
|
dtMeshTile* next; // Next free tile or, next tile in spatial grid.
|
||||||
|
};
|
||||||
|
|
||||||
|
struct dtNavMeshParams
|
||||||
|
{
|
||||||
|
float orig[3]; // Origin of the nav mesh tile space.
|
||||||
|
float tileWidth, tileHeight; // Width and height of each tile.
|
||||||
|
int maxTiles; // Maximum number of tiles the navmesh can contain.
|
||||||
|
int maxPolys; // Maximum number of polygons each tile can contain.
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class dtNavMesh
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
dtNavMesh();
|
||||||
|
~dtNavMesh();
|
||||||
|
|
||||||
|
// Initializes the nav mesh for tiled use.
|
||||||
|
// Params:
|
||||||
|
// params - (in) navmesh initialization params, see dtNavMeshParams.
|
||||||
|
// Returns: True if succeed, else false.
|
||||||
|
dtStatus init(const dtNavMeshParams* params);
|
||||||
|
|
||||||
|
// Initializes the nav mesh for single tile use.
|
||||||
|
// Params:
|
||||||
|
// data - (in) Data of the new tile mesh.
|
||||||
|
// dataSize - (in) Data size of the new tile mesh.
|
||||||
|
// flags - (in) Tile flags, see dtTileFlags.
|
||||||
|
// Returns: True if succeed, else false.
|
||||||
|
dtStatus init(unsigned char* data, const int dataSize, const int flags);
|
||||||
|
|
||||||
|
// Returns pointer to navmesh initialization params.
|
||||||
|
const dtNavMeshParams* getParams() const;
|
||||||
|
|
||||||
|
// Adds new tile into the navmesh.
|
||||||
|
// The add will fail if the data is in wrong format,
|
||||||
|
// there is not enough tiles left, or if there is a tile already at the location.
|
||||||
|
// Params:
|
||||||
|
// data - (in) Data of the new tile mesh.
|
||||||
|
// dataSize - (in) Data size of the new tile mesh.
|
||||||
|
// flags - (in) Tile flags, see dtTileFlags.
|
||||||
|
// lastRef - (in,optional) Last tile ref, the tile will be restored so that
|
||||||
|
// the reference (as well as poly references) will be the same. Default: 0.
|
||||||
|
// result - (out,optional) tile ref if the tile was succesfully added.
|
||||||
|
dtStatus addTile(unsigned char* data, int dataSize, int flags, dtTileRef lastRef, dtTileRef* result);
|
||||||
|
|
||||||
|
// Removes specified tile.
|
||||||
|
// Params:
|
||||||
|
// ref - (in) Reference to the tile to remove.
|
||||||
|
// data - (out) Data associated with deleted tile.
|
||||||
|
// dataSize - (out) Size of the data associated with deleted tile.
|
||||||
|
dtStatus removeTile(dtTileRef ref, unsigned char** data, int* dataSize);
|
||||||
|
|
||||||
|
// Calculates tile location based in input world position.
|
||||||
|
// Params:
|
||||||
|
// pos - (in) world position of the query.
|
||||||
|
// tx - (out) tile x location.
|
||||||
|
// ty - (out) tile y location.
|
||||||
|
void calcTileLoc(const float* pos, int* tx, int* ty) const;
|
||||||
|
|
||||||
|
// Returns pointer to tile at specified location.
|
||||||
|
// Params:
|
||||||
|
// x,y - (in) Location of the tile to get.
|
||||||
|
// Returns: pointer to tile if tile exists or 0 tile does not exists.
|
||||||
|
const dtMeshTile* getTileAt(int x, int y) const;
|
||||||
|
|
||||||
|
// Returns reference to tile at specified location.
|
||||||
|
// Params:
|
||||||
|
// x,y - (in) Location of the tile to get.
|
||||||
|
// Returns: reference to tile if tile exists or 0 tile does not exists.
|
||||||
|
dtTileRef getTileRefAt(int x, int y) const;
|
||||||
|
|
||||||
|
// Returns tile references of a tile based on tile pointer.
|
||||||
|
dtTileRef getTileRef(const dtMeshTile* tile) const;
|
||||||
|
|
||||||
|
// Returns tile based on references.
|
||||||
|
const dtMeshTile* getTileByRef(dtTileRef ref) const;
|
||||||
|
|
||||||
|
// Returns max number of tiles.
|
||||||
|
int getMaxTiles() const;
|
||||||
|
|
||||||
|
// Returns pointer to tile in the tile array.
|
||||||
|
// Params:
|
||||||
|
// i - (in) Index to the tile to retrieve, max index is getMaxTiles()-1.
|
||||||
|
// Returns: Pointer to specified tile.
|
||||||
|
const dtMeshTile* getTile(int i) const;
|
||||||
|
|
||||||
|
// Returns pointer to tile and polygon pointed by the polygon reference.
|
||||||
|
// Params:
|
||||||
|
// ref - (in) reference to a polygon.
|
||||||
|
// tile - (out) pointer to the tile containing the polygon.
|
||||||
|
// poly - (out) pointer to the polygon.
|
||||||
|
dtStatus getTileAndPolyByRef(const dtPolyRef ref, const dtMeshTile** tile, const dtPoly** poly) const;
|
||||||
|
|
||||||
|
// Returns pointer to tile and polygon pointed by the polygon reference.
|
||||||
|
// Note: this function does not check if 'ref' s valid, and is thus faster. Use only with valid refs!
|
||||||
|
// Params:
|
||||||
|
// ref - (in) reference to a polygon.
|
||||||
|
// tile - (out) pointer to the tile containing the polygon.
|
||||||
|
// poly - (out) pointer to the polygon.
|
||||||
|
void getTileAndPolyByRefUnsafe(const dtPolyRef ref, const dtMeshTile** tile, const dtPoly** poly) const;
|
||||||
|
|
||||||
|
// Returns true if polygon reference points to valid data.
|
||||||
|
bool isValidPolyRef(dtPolyRef ref) const;
|
||||||
|
|
||||||
|
// Returns base poly id for specified tile, polygon refs can be deducted from this.
|
||||||
|
dtPolyRef getPolyRefBase(const dtMeshTile* tile) const;
|
||||||
|
|
||||||
|
// Returns start and end location of an off-mesh link polygon.
|
||||||
|
// Params:
|
||||||
|
// prevRef - (in) ref to the polygon before the link (used to select direction).
|
||||||
|
// polyRef - (in) ref to the off-mesh link polygon.
|
||||||
|
// startPos[3] - (out) start point of the link.
|
||||||
|
// endPos[3] - (out) end point of the link.
|
||||||
|
// Returns: true if link is found.
|
||||||
|
dtStatus getOffMeshConnectionPolyEndPoints(dtPolyRef prevRef, dtPolyRef polyRef, float* startPos, float* endPos) const;
|
||||||
|
|
||||||
|
// Returns pointer to off-mesh connection based on polyref, or null if ref not valid.
|
||||||
|
const dtOffMeshConnection* getOffMeshConnectionByRef(dtPolyRef ref) const;
|
||||||
|
|
||||||
|
// Sets polygon flags.
|
||||||
|
dtStatus setPolyFlags(dtPolyRef ref, unsigned short flags);
|
||||||
|
|
||||||
|
// Return polygon flags.
|
||||||
|
dtStatus getPolyFlags(dtPolyRef ref, unsigned short* resultFlags) const;
|
||||||
|
|
||||||
|
// Set polygon type.
|
||||||
|
dtStatus setPolyArea(dtPolyRef ref, unsigned char area);
|
||||||
|
|
||||||
|
// Return polygon area type.
|
||||||
|
dtStatus getPolyArea(dtPolyRef ref, unsigned char* resultArea) const;
|
||||||
|
|
||||||
|
|
||||||
|
// Returns number of bytes required to store tile state.
|
||||||
|
int getTileStateSize(const dtMeshTile* tile) const;
|
||||||
|
|
||||||
|
// Stores tile state to buffer.
|
||||||
|
dtStatus storeTileState(const dtMeshTile* tile, unsigned char* data, const int maxDataSize) const;
|
||||||
|
|
||||||
|
// Restores tile state.
|
||||||
|
dtStatus restoreTileState(dtMeshTile* tile, const unsigned char* data, const int maxDataSize);
|
||||||
|
|
||||||
|
|
||||||
|
// Encodes a tile id.
|
||||||
|
inline dtPolyRef encodePolyId(unsigned int salt, unsigned int it, unsigned int ip) const
|
||||||
|
{
|
||||||
|
return ((dtPolyRef)salt << (m_polyBits+m_tileBits)) | ((dtPolyRef)it << m_polyBits) | (dtPolyRef)ip;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Decodes a tile id.
|
||||||
|
inline void decodePolyId(dtPolyRef ref, unsigned int& salt, unsigned int& it, unsigned int& ip) const
|
||||||
|
{
|
||||||
|
const dtPolyRef saltMask = ((dtPolyRef)1<<m_saltBits)-1;
|
||||||
|
const dtPolyRef tileMask = ((dtPolyRef)1<<m_tileBits)-1;
|
||||||
|
const dtPolyRef polyMask = ((dtPolyRef)1<<m_polyBits)-1;
|
||||||
|
salt = (unsigned int)((ref >> (m_polyBits+m_tileBits)) & saltMask);
|
||||||
|
it = (unsigned int)((ref >> m_polyBits) & tileMask);
|
||||||
|
ip = (unsigned int)(ref & polyMask);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Decodes a tile salt.
|
||||||
|
inline unsigned int decodePolyIdSalt(dtPolyRef ref) const
|
||||||
|
{
|
||||||
|
const dtPolyRef saltMask = ((dtPolyRef)1<<m_saltBits)-1;
|
||||||
|
return (unsigned int)((ref >> (m_polyBits+m_tileBits)) & saltMask);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Decodes a tile id.
|
||||||
|
inline unsigned int decodePolyIdTile(dtPolyRef ref) const
|
||||||
|
{
|
||||||
|
const dtPolyRef tileMask = ((dtPolyRef)1<<m_tileBits)-1;
|
||||||
|
return (unsigned int)((ref >> m_polyBits) & tileMask);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Decodes a poly id.
|
||||||
|
inline unsigned int decodePolyIdPoly(dtPolyRef ref) const
|
||||||
|
{
|
||||||
|
const dtPolyRef polyMask = ((dtPolyRef)1<<m_polyBits)-1;
|
||||||
|
return (unsigned int)(ref & polyMask);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Returns pointer to tile in the tile array.
|
||||||
|
dtMeshTile* getTile(int i);
|
||||||
|
|
||||||
|
// Returns neighbour tile based on side.
|
||||||
|
dtMeshTile* getNeighbourTileAt(int x, int y, int side) const;
|
||||||
|
// Returns all polygons in neighbour tile based on portal defined by the segment.
|
||||||
|
int findConnectingPolys(const float* va, const float* vb,
|
||||||
|
const dtMeshTile* tile, int side,
|
||||||
|
dtPolyRef* con, float* conarea, int maxcon) const;
|
||||||
|
|
||||||
|
// Builds internal polygons links for a tile.
|
||||||
|
void connectIntLinks(dtMeshTile* tile);
|
||||||
|
// Builds internal polygons links for a tile.
|
||||||
|
void connectIntOffMeshLinks(dtMeshTile* tile);
|
||||||
|
|
||||||
|
// Builds external polygon links for a tile.
|
||||||
|
void connectExtLinks(dtMeshTile* tile, dtMeshTile* target, int side);
|
||||||
|
// Builds external polygon links for a tile.
|
||||||
|
void connectExtOffMeshLinks(dtMeshTile* tile, dtMeshTile* target, int side);
|
||||||
|
|
||||||
|
// Removes external links at specified side.
|
||||||
|
void unconnectExtLinks(dtMeshTile* tile, int side);
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: These methods are duplicates from dtNavMeshQuery, but are needed for off-mesh connection finding.
|
||||||
|
|
||||||
|
// Queries polygons within a tile.
|
||||||
|
int queryPolygonsInTile(const dtMeshTile* tile, const float* qmin, const float* qmax,
|
||||||
|
dtPolyRef* polys, const int maxPolys) const;
|
||||||
|
// Find nearest polygon within a tile.
|
||||||
|
dtPolyRef findNearestPolyInTile(const dtMeshTile* tile, const float* center,
|
||||||
|
const float* extents, float* nearestPt) const;
|
||||||
|
// Returns closest point on polygon.
|
||||||
|
dtStatus closestPointOnPolyInTile(const dtMeshTile* tile, unsigned int ip,
|
||||||
|
const float* pos, float* closest) const;
|
||||||
|
|
||||||
|
dtNavMeshParams m_params; // Current initialization params. TODO: do not store this info twice.
|
||||||
|
float m_orig[3]; // Origin of the tile (0,0)
|
||||||
|
float m_tileWidth, m_tileHeight; // Dimensions of each tile.
|
||||||
|
int m_maxTiles; // Max number of tiles.
|
||||||
|
int m_tileLutSize; // Tile hash lookup size (must be pot).
|
||||||
|
int m_tileLutMask; // Tile hash lookup mask.
|
||||||
|
|
||||||
|
dtMeshTile** m_posLookup; // Tile hash lookup.
|
||||||
|
dtMeshTile* m_nextFree; // Freelist of tiles.
|
||||||
|
dtMeshTile* m_tiles; // List of tiles.
|
||||||
|
|
||||||
|
unsigned int m_saltBits; // Number of salt bits in the tile ID.
|
||||||
|
unsigned int m_tileBits; // Number of tile bits in the tile ID.
|
||||||
|
unsigned int m_polyBits; // Number of poly bits in the tile ID.
|
||||||
|
};
|
||||||
|
|
||||||
|
// Helper function to allocate navmesh class using Detour allocator.
|
||||||
|
dtNavMesh* dtAllocNavMesh();
|
||||||
|
void dtFreeNavMesh(dtNavMesh* navmesh);
|
||||||
|
|
||||||
|
#endif // DETOURNAVMESH_H
|
||||||
77
dep/recastnavigation/Detour/Include/DetourNavMeshBuilder.h
Normal file
77
dep/recastnavigation/Detour/Include/DetourNavMeshBuilder.h
Normal file
|
|
@ -0,0 +1,77 @@
|
||||||
|
//
|
||||||
|
// 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 DETOURNAVMESHBUILDER_H
|
||||||
|
#define DETOURNAVMESHBUILDER_H
|
||||||
|
|
||||||
|
#include "DetourAlloc.h"
|
||||||
|
|
||||||
|
|
||||||
|
// The units of the parameters are specified in parenthesis as follows:
|
||||||
|
// (vx) voxels, (wu) world units
|
||||||
|
struct dtNavMeshCreateParams
|
||||||
|
{
|
||||||
|
// Navmesh vertices.
|
||||||
|
const unsigned short* verts; // Array of vertices, each vertex has 3 components. (vx).
|
||||||
|
int vertCount; // Vertex count
|
||||||
|
// Navmesh polygons
|
||||||
|
const unsigned short* polys; // Array of polygons, uses same format as rcPolyMesh.
|
||||||
|
const unsigned short* polyFlags; // Array of flags per polygon.
|
||||||
|
const unsigned char* polyAreas; // Array of area ids per polygon.
|
||||||
|
int polyCount; // Number of polygons
|
||||||
|
int nvp; // Number of verts per polygon.
|
||||||
|
// Navmesh Detail
|
||||||
|
const unsigned int* detailMeshes; // Detail meshes, uses same format as rcPolyMeshDetail.
|
||||||
|
const float* detailVerts; // Detail mesh vertices, uses same format as rcPolyMeshDetail (wu).
|
||||||
|
int detailVertsCount; // Total number of detail vertices
|
||||||
|
const unsigned char* detailTris; // Array of detail tris per detail mesh.
|
||||||
|
int detailTriCount; // Total number of detail triangles.
|
||||||
|
// Off-Mesh Connections.
|
||||||
|
const float* offMeshConVerts; // Off-mesh connection vertices (wu).
|
||||||
|
const float* offMeshConRad; // Off-mesh connection radii (wu).
|
||||||
|
const unsigned short* offMeshConFlags; // Off-mesh connection flags.
|
||||||
|
const unsigned char* offMeshConAreas; // Off-mesh connection area ids.
|
||||||
|
const unsigned char* offMeshConDir; // Off-mesh connection direction flags (1 = bidir, 0 = oneway).
|
||||||
|
const unsigned int* offMeshConUserID; // Off-mesh connection user id (optional).
|
||||||
|
int offMeshConCount; // Number of off-mesh connections
|
||||||
|
// Tile location
|
||||||
|
unsigned int userId; // User ID bound to the tile.
|
||||||
|
int tileX, tileY; // Tile location (tile coords).
|
||||||
|
float bmin[3], bmax[3]; // Tile bounds (wu).
|
||||||
|
// Settings
|
||||||
|
float walkableHeight; // Agent height (wu).
|
||||||
|
float walkableRadius; // Agent radius (wu).
|
||||||
|
float walkableClimb; // Agent max climb (wu).
|
||||||
|
float cs; // Cell size (xz) (wu).
|
||||||
|
float ch; // Cell height (y) (wu).
|
||||||
|
int tileSize; // Tile size (width & height) (vx).
|
||||||
|
};
|
||||||
|
|
||||||
|
// Build navmesh data from given input data.
|
||||||
|
bool dtCreateNavMeshData(dtNavMeshCreateParams* params, unsigned char** outData, int* outDataSize);
|
||||||
|
|
||||||
|
// Swaps endianess of navmesh header.
|
||||||
|
bool dtNavMeshHeaderSwapEndian(unsigned char* data, const int dataSize);
|
||||||
|
|
||||||
|
// Swaps endianess of the navmesh data. This function assumes that the header is in correct
|
||||||
|
// endianess already. Call dtNavMeshHeaderSwapEndian() first on the data if the data is
|
||||||
|
// assumed to be in wrong endianess to start with. If converting from native endianess to foreign,
|
||||||
|
// call dtNavMeshHeaderSwapEndian() after the data has been swapped.
|
||||||
|
bool dtNavMeshDataSwapEndian(unsigned char* data, const int dataSize);
|
||||||
|
|
||||||
|
#endif // DETOURNAVMESHBUILDER_H
|
||||||
407
dep/recastnavigation/Detour/Include/DetourNavMeshQuery.h
Normal file
407
dep/recastnavigation/Detour/Include/DetourNavMeshQuery.h
Normal file
|
|
@ -0,0 +1,407 @@
|
||||||
|
//
|
||||||
|
// 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 DETOURNAVMESHQUERY_H
|
||||||
|
#define DETOURNAVMESHQUERY_H
|
||||||
|
|
||||||
|
#include "DetourNavMesh.h"
|
||||||
|
|
||||||
|
|
||||||
|
// Define DT_VIRTUAL_QUERYFILTER if you wish to derive a custom filter from dtQueryFilter.
|
||||||
|
// On certain platforms indirect or virtual function call is expensive. The default
|
||||||
|
// setting is to use non-virtual functions, the actualy implementations of the functions
|
||||||
|
// are declared as inline for maximum speed.
|
||||||
|
|
||||||
|
//#define DT_VIRTUAL_QUERYFILTER 1
|
||||||
|
|
||||||
|
// Class for polygon filtering and cost calculation during query operations.
|
||||||
|
// - It is possible to derive a custom query filter from dtQueryFilter by overriding
|
||||||
|
// the virtual functions passFilter() and getCost().
|
||||||
|
// - Both functions should be as fast as possible. Use cached local copy of data
|
||||||
|
// instead of accessing your own objects where possible.
|
||||||
|
// - You do not need to adhere to the flags and cost logic provided by the default
|
||||||
|
// implementation.
|
||||||
|
// - In order for the A* to work properly, the cost should be proportional to
|
||||||
|
// the travel distance. Using cost modifier less than 1.0 is likely to lead
|
||||||
|
// to problems during pathfinding.
|
||||||
|
class dtQueryFilter
|
||||||
|
{
|
||||||
|
float m_areaCost[DT_MAX_AREAS]; // Array storing cost per area type, used by default implementation.
|
||||||
|
unsigned short m_includeFlags; // Include poly flags, used by default implementation.
|
||||||
|
unsigned short m_excludeFlags; // Exclude poly flags, used by default implementation.
|
||||||
|
|
||||||
|
public:
|
||||||
|
dtQueryFilter();
|
||||||
|
|
||||||
|
// Returns true if the polygon is can visited.
|
||||||
|
// Params:
|
||||||
|
// ref - (in) reference to the polygon test.
|
||||||
|
// tile - (in) pointer to the tile of the polygon test.
|
||||||
|
// poly - (in) pointer to the polygon test.
|
||||||
|
#ifdef DT_VIRTUAL_QUERYFILTER
|
||||||
|
virtual bool passFilter(const dtPolyRef ref,
|
||||||
|
const dtMeshTile* tile,
|
||||||
|
const dtPoly* poly) const;
|
||||||
|
#else
|
||||||
|
bool passFilter(const dtPolyRef ref,
|
||||||
|
const dtMeshTile* tile,
|
||||||
|
const dtPoly* poly) const;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Returns cost to travel from 'pa' to 'pb'.'
|
||||||
|
// The segment is fully contained inside 'cur'.
|
||||||
|
// 'pa' lies on the edge between 'prev' and 'cur',
|
||||||
|
// 'pb' lies on the edge between 'cur' and 'next'.
|
||||||
|
// Params:
|
||||||
|
// pa - (in) segment start position.
|
||||||
|
// pb - (in) segment end position.
|
||||||
|
// prevRef, prevTile, prevPoly - (in) data describing the previous polygon, can be null.
|
||||||
|
// curRef, curTile, curPoly - (in) data describing the current polygon.
|
||||||
|
// nextRef, nextTile, nextPoly - (in) data describing the next polygon, can be null.
|
||||||
|
#ifdef DT_VIRTUAL_QUERYFILTER
|
||||||
|
virtual float getCost(const float* pa, const float* pb,
|
||||||
|
const dtPolyRef prevRef, const dtMeshTile* prevTile, const dtPoly* prevPoly,
|
||||||
|
const dtPolyRef curRef, const dtMeshTile* curTile, const dtPoly* curPoly,
|
||||||
|
const dtPolyRef nextRef, const dtMeshTile* nextTile, const dtPoly* nextPoly) const;
|
||||||
|
#else
|
||||||
|
float getCost(const float* pa, const float* pb,
|
||||||
|
const dtPolyRef prevRef, const dtMeshTile* prevTile, const dtPoly* prevPoly,
|
||||||
|
const dtPolyRef curRef, const dtMeshTile* curTile, const dtPoly* curPoly,
|
||||||
|
const dtPolyRef nextRef, const dtMeshTile* nextTile, const dtPoly* nextPoly) const;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Getters and setters for the default implementation data.
|
||||||
|
inline float getAreaCost(const int i) const { return m_areaCost[i]; }
|
||||||
|
inline void setAreaCost(const int i, const float cost) { m_areaCost[i] = cost; }
|
||||||
|
|
||||||
|
inline unsigned short getIncludeFlags() const { return m_includeFlags; }
|
||||||
|
inline void setIncludeFlags(const unsigned short flags) { m_includeFlags = flags; }
|
||||||
|
|
||||||
|
inline unsigned short getExcludeFlags() const { return m_excludeFlags; }
|
||||||
|
inline void setExcludeFlags(const unsigned short flags) { m_excludeFlags = flags; }
|
||||||
|
};
|
||||||
|
|
||||||
|
class dtNavMeshQuery
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
dtNavMeshQuery();
|
||||||
|
~dtNavMeshQuery();
|
||||||
|
|
||||||
|
// Initializes the nav mesh query.
|
||||||
|
// Params:
|
||||||
|
// nav - (in) pointer to navigation mesh data.
|
||||||
|
// maxNodes - (in) Maximum number of search nodes to use (max 65536).
|
||||||
|
// Returns: True if succeed, else false.
|
||||||
|
dtStatus init(const dtNavMesh* nav, const int maxNodes);
|
||||||
|
|
||||||
|
// Finds the nearest navigation polygon around the center location.
|
||||||
|
// Params:
|
||||||
|
// center[3] - (in) The center of the search box.
|
||||||
|
// extents[3] - (in) The extents of the search box.
|
||||||
|
// filter - (in) path polygon filter.
|
||||||
|
// nearestRef - (out) Reference to the nearest polygon.
|
||||||
|
// nearestPt[3] - (out, opt) The nearest point on found polygon, null if not needed.
|
||||||
|
// Returns: Reference identifier for the polygon, or 0 if no polygons found.
|
||||||
|
dtStatus findNearestPoly(const float* center, const float* extents,
|
||||||
|
const dtQueryFilter* filter,
|
||||||
|
dtPolyRef* nearestRef, float* nearestPt) const;
|
||||||
|
|
||||||
|
// Returns polygons which overlap the query box.
|
||||||
|
// Params:
|
||||||
|
// center[3] - (in) the center of the search box.
|
||||||
|
// extents[3] - (in) the extents of the search box.
|
||||||
|
// filter - (in) path polygon filter.
|
||||||
|
// polys - (out) array holding the search result.
|
||||||
|
// polyCount - (out) Number of polygons in search result array.
|
||||||
|
// maxPolys - (in) The max number of polygons the polys array can hold.
|
||||||
|
dtStatus queryPolygons(const float* center, const float* extents,
|
||||||
|
const dtQueryFilter* filter,
|
||||||
|
dtPolyRef* polys, int* polyCount, const int maxPolys) const;
|
||||||
|
|
||||||
|
// Finds path from start polygon to end polygon.
|
||||||
|
// If target polygon canno be reached through the navigation graph,
|
||||||
|
// the last node on the array is nearest node to the end polygon.
|
||||||
|
// Start end end positions are needed to calculate more accurate
|
||||||
|
// traversal cost at start end end polygons.
|
||||||
|
// Params:
|
||||||
|
// startRef - (in) ref to path start polygon.
|
||||||
|
// endRef - (in) ref to path end polygon.
|
||||||
|
// startPos[3] - (in) Path start location.
|
||||||
|
// endPos[3] - (in) Path end location.
|
||||||
|
// filter - (in) path polygon filter.
|
||||||
|
// path - (out) array holding the search result.
|
||||||
|
// pathCount - (out) Number of polygons in search result array.
|
||||||
|
// maxPath - (in) The max number of polygons the path array can hold. Must be at least 1.
|
||||||
|
dtStatus findPath(dtPolyRef startRef, dtPolyRef endRef,
|
||||||
|
const float* startPos, const float* endPos,
|
||||||
|
const dtQueryFilter* filter,
|
||||||
|
dtPolyRef* path, int* pathCount, const int maxPath) const;
|
||||||
|
|
||||||
|
// Intializes sliced path find query.
|
||||||
|
// Note 1: calling any other dtNavMeshQuery method before calling findPathEnd()
|
||||||
|
// may results in corrupted data!
|
||||||
|
// Note 2: The pointer to filter is store, and used in subsequent
|
||||||
|
// calls to updateSlicedFindPath().
|
||||||
|
// Params:
|
||||||
|
// startRef - (in) ref to path start polygon.
|
||||||
|
// endRef - (in) ref to path end polygon.
|
||||||
|
// startPos[3] - (in) Path start location.
|
||||||
|
// endPos[3] - (in) Path end location.
|
||||||
|
// filter - (in) path polygon filter.
|
||||||
|
dtStatus initSlicedFindPath(dtPolyRef startRef, dtPolyRef endRef,
|
||||||
|
const float* startPos, const float* endPos,
|
||||||
|
const dtQueryFilter* filter);
|
||||||
|
|
||||||
|
// Updates sliced path find query.
|
||||||
|
// Params:
|
||||||
|
// maxIter - (in) max number of iterations to update.
|
||||||
|
// Returns: Path query state.
|
||||||
|
dtStatus updateSlicedFindPath(const int maxIter);
|
||||||
|
|
||||||
|
// Finalizes sliced path find query and returns found path.
|
||||||
|
// path - (out) array holding the search result.
|
||||||
|
// pathCount - (out) Number of polygons in search result array.
|
||||||
|
// maxPath - (in) The max number of polygons the path array can hold.
|
||||||
|
dtStatus finalizeSlicedFindPath(dtPolyRef* path, int* pathCount, const int maxPath);
|
||||||
|
|
||||||
|
// Finalizes partial sliced path find query and returns path to the furthest
|
||||||
|
// polygon on the existing path that was visited during the search.
|
||||||
|
// existing - (out) Array of polygons in the existing path.
|
||||||
|
// existingSize - (out) Number of polygons in existing path array.
|
||||||
|
// path - (out) array holding the search result.
|
||||||
|
// pathCount - (out) Number of polygons in search result array.
|
||||||
|
// maxPath - (in) The max number of polygons the path array can hold.
|
||||||
|
dtStatus finalizeSlicedFindPathPartial(const dtPolyRef* existing, const int existingSize,
|
||||||
|
dtPolyRef* path, int* pathCount, const int maxPath);
|
||||||
|
|
||||||
|
// Finds a straight path from start to end locations within the corridor
|
||||||
|
// described by the path polygons.
|
||||||
|
// Start and end locations will be clamped on the corridor.
|
||||||
|
// The returned polygon references are point to polygon which was entered when
|
||||||
|
// a path point was added. For the end point, zero will be returned. This allows
|
||||||
|
// to match for example off-mesh link points to their representative polygons.
|
||||||
|
// Params:
|
||||||
|
// startPos[3] - (in) Path start location.
|
||||||
|
// endPo[3] - (in) Path end location.
|
||||||
|
// path - (in) Array of connected polygons describing the corridor.
|
||||||
|
// pathSize - (in) Number of polygons in path array.
|
||||||
|
// straightPath - (out) Points describing the straight path.
|
||||||
|
// straightPathFlags - (out, opt) Flags describing each point type, see dtStraightPathFlags.
|
||||||
|
// straightPathRefs - (out, opt) References to polygons at point locations.
|
||||||
|
// straightPathCount - (out) Number of points in the path.
|
||||||
|
// maxStraightPath - (in) The max number of points the straight path array can hold. Must be at least 1.
|
||||||
|
dtStatus findStraightPath(const float* startPos, const float* endPos,
|
||||||
|
const dtPolyRef* path, const int pathSize,
|
||||||
|
float* straightPath, unsigned char* straightPathFlags, dtPolyRef* straightPathRefs,
|
||||||
|
int* straightPathCount, const int maxStraightPath) const;
|
||||||
|
|
||||||
|
// Moves from startPos to endPos constrained to the navmesh.
|
||||||
|
// If the endPos is reachable, the resultPos will be endPos,
|
||||||
|
// or else the resultPos will be the nearest point in navmesh.
|
||||||
|
// Note: The resulting point is not projected to the ground, use getPolyHeight() to get height.
|
||||||
|
// Note: The algorithm is optimized for small delta movement and small number of polygons.
|
||||||
|
// Params:
|
||||||
|
// startRef - (in) ref to the polygon where startPos lies.
|
||||||
|
// startPos[3] - (in) start position of the mover.
|
||||||
|
// endPos[3] - (in) desired end position of the mover.
|
||||||
|
// filter - (in) path polygon filter.
|
||||||
|
// resultPos[3] - (out) new position of the mover.
|
||||||
|
// visited - (out) array of visited polygons.
|
||||||
|
// visitedCount - (out) Number of entries in the visited array.
|
||||||
|
// maxVisitedSize - (in) max number of polygons in the visited array.
|
||||||
|
dtStatus moveAlongSurface(dtPolyRef startRef, const float* startPos, const float* endPos,
|
||||||
|
const dtQueryFilter* filter,
|
||||||
|
float* resultPos, dtPolyRef* visited, int* visitedCount, const int maxVisitedSize) const;
|
||||||
|
|
||||||
|
// Casts 'walkability' ray along the navmesh surface from startPos towards the endPos.
|
||||||
|
// Params:
|
||||||
|
// startRef - (in) ref to the polygon where the start lies.
|
||||||
|
// startPos[3] - (in) start position of the query.
|
||||||
|
// endPos[3] - (in) end position of the query.
|
||||||
|
// t - (out) hit parameter along the segment, FLT_MAX if no hit.
|
||||||
|
// hitNormal[3] - (out) normal of the nearest hit.
|
||||||
|
// filter - (in) path polygon filter.
|
||||||
|
// path - (out,opt) visited path polygons.
|
||||||
|
// pathCount - (out,opt) Number of polygons visited.
|
||||||
|
// maxPath - (in) max number of polygons in the path array.
|
||||||
|
dtStatus raycast(dtPolyRef startRef, const float* startPos, const float* endPos,
|
||||||
|
const dtQueryFilter* filter,
|
||||||
|
float* t, float* hitNormal, dtPolyRef* path, int* pathCount, const int maxPath) const;
|
||||||
|
|
||||||
|
// Returns distance to nearest wall from the specified location.
|
||||||
|
// Params:
|
||||||
|
// startRef - (in) ref to the polygon where the center lies.
|
||||||
|
// centerPos[3] - (in) center if the query circle.
|
||||||
|
// maxRadius - (in) max search radius.
|
||||||
|
// filter - (in) path polygon filter.
|
||||||
|
// hitDist - (out) distance to nearest wall from the test location.
|
||||||
|
// hitPos[3] - (out) location of the nearest hit.
|
||||||
|
// hitNormal[3] - (out) normal of the nearest hit.
|
||||||
|
dtStatus findDistanceToWall(dtPolyRef startRef, const float* centerPos, const float maxRadius,
|
||||||
|
const dtQueryFilter* filter,
|
||||||
|
float* hitDist, float* hitPos, float* hitNormal) const;
|
||||||
|
|
||||||
|
// Finds polygons found along the navigation graph which touch the specified circle.
|
||||||
|
// Params:
|
||||||
|
// startRef - (in) ref to the polygon where the search starts.
|
||||||
|
// centerPos[3] - (in) center if the query circle.
|
||||||
|
// radius - (in) radius of the query circle.
|
||||||
|
// filter - (in) path polygon filter.
|
||||||
|
// resultRef - (out, opt) refs to the polygons touched by the circle.
|
||||||
|
// resultParent - (out, opt) parent of each result polygon.
|
||||||
|
// resultCost - (out, opt) search cost at each result polygon.
|
||||||
|
// resultCount - (out, opt) Number of results.
|
||||||
|
// maxResult - (int) maximum capacity of search results.
|
||||||
|
dtStatus findPolysAroundCircle(dtPolyRef startRef, const float* centerPos, const float radius,
|
||||||
|
const dtQueryFilter* filter,
|
||||||
|
dtPolyRef* resultRef, dtPolyRef* resultParent, float* resultCost,
|
||||||
|
int* resultCount, const int maxResult) const;
|
||||||
|
|
||||||
|
// Finds polygons found along the navigation graph which touch the convex polygon shape.
|
||||||
|
// Params:
|
||||||
|
// startRef - (in) ref to the polygon where the search starts.
|
||||||
|
// verts[3*n] - (in) vertices describing convex polygon shape (CCW).
|
||||||
|
// nverts - (in) number of vertices in the polygon.
|
||||||
|
// filter - (in) path polygon filter.
|
||||||
|
// resultRef - (out, opt) refs to the polygons touched by the circle.
|
||||||
|
// resultParent - (out, opt) parent of each result polygon.
|
||||||
|
// resultCost - (out, opt) search cost at each result polygon.
|
||||||
|
// resultCount - (out) number of results.
|
||||||
|
// maxResult - (int) maximum capacity of search results.
|
||||||
|
dtStatus findPolysAroundShape(dtPolyRef startRef, const float* verts, const int nverts,
|
||||||
|
const dtQueryFilter* filter,
|
||||||
|
dtPolyRef* resultRef, dtPolyRef* resultParent, float* resultCost,
|
||||||
|
int* resultCount, const int maxResult) const;
|
||||||
|
|
||||||
|
// Finds non-overlapping local neighbourhood around center location.
|
||||||
|
// Note: The algorithm is optimized for small query radius and small number of polygons.
|
||||||
|
// Params:
|
||||||
|
// startRef - (in) ref to the polygon where the search starts.
|
||||||
|
// centerPos[3] - (in) center if the query circle.
|
||||||
|
// radius - (in) radius of the query circle.
|
||||||
|
// filter - (in) path polygon filter.
|
||||||
|
// resultRef - (out) refs to the polygons touched by the circle.
|
||||||
|
// resultParent - (out, opt) parent of each result polygon.
|
||||||
|
// resultCount - (out) number of results.
|
||||||
|
// maxResult - (int) maximum capacity of search results.
|
||||||
|
dtStatus findLocalNeighbourhood(dtPolyRef startRef, const float* centerPos, const float radius,
|
||||||
|
const dtQueryFilter* filter,
|
||||||
|
dtPolyRef* resultRef, dtPolyRef* resultParent,
|
||||||
|
int* resultCount, const int maxResult) const;
|
||||||
|
|
||||||
|
// Returns wall segments of specified polygon.
|
||||||
|
// Params:
|
||||||
|
// ref - (in) ref to the polygon.
|
||||||
|
// filter - (in) path polygon filter.
|
||||||
|
// segments[6*maxSegments] - (out) wall segments (2 endpoints per segment).
|
||||||
|
// segmentCount - (out) number of wall segments.
|
||||||
|
// maxSegments - (in) max number of segments that can be stored in 'segments'.
|
||||||
|
dtStatus getPolyWallSegments(dtPolyRef ref, const dtQueryFilter* filter,
|
||||||
|
float* segments, int* segmentCount, const int maxSegments) const;
|
||||||
|
|
||||||
|
// Returns closest point on navigation polygon.
|
||||||
|
// Uses detail polygons to find the closest point to the navigation polygon surface.
|
||||||
|
// Params:
|
||||||
|
// ref - (in) ref to the polygon.
|
||||||
|
// pos[3] - (in) the point to check.
|
||||||
|
// closest[3] - (out) closest point.
|
||||||
|
// Returns: true if closest point found.
|
||||||
|
dtStatus closestPointOnPoly(dtPolyRef ref, const float* pos, float* closest) const;
|
||||||
|
|
||||||
|
// Returns closest point on navigation polygon boundary.
|
||||||
|
// Uses the navigation polygon boundary to snap the point to poly boundary
|
||||||
|
// if it is outside the polygon. Much faster than closestPointToPoly. Does not affect height.
|
||||||
|
// Params:
|
||||||
|
// ref - (in) ref to the polygon.
|
||||||
|
// pos[3] - (in) the point to check.
|
||||||
|
// closest[3] - (out) closest point.
|
||||||
|
// Returns: true if closest point found.
|
||||||
|
dtStatus closestPointOnPolyBoundary(dtPolyRef ref, const float* pos, float* closest) const;
|
||||||
|
|
||||||
|
// Returns start and end location of an off-mesh link polygon.
|
||||||
|
// Params:
|
||||||
|
// prevRef - (in) ref to the polygon before the link (used to select direction).
|
||||||
|
// polyRef - (in) ref to the off-mesh link polygon.
|
||||||
|
// startPos[3] - (out) start point of the link.
|
||||||
|
// endPos[3] - (out) end point of the link.
|
||||||
|
// Returns: true if link is found.
|
||||||
|
dtStatus getOffMeshConnectionPolyEndPoints(dtPolyRef prevRef, dtPolyRef polyRef, float* startPos, float* endPos) const;
|
||||||
|
|
||||||
|
// Returns height of the polygon at specified location.
|
||||||
|
// Params:
|
||||||
|
// ref - (in) ref to the polygon.
|
||||||
|
// pos[3] - (in) the point where to locate the height.
|
||||||
|
// height - (out) height at the location.
|
||||||
|
// Returns: true if over polygon.
|
||||||
|
dtStatus getPolyHeight(dtPolyRef ref, const float* pos, float* height) const;
|
||||||
|
|
||||||
|
// Returns true if poly reference ins in closed list.
|
||||||
|
bool isInClosedList(dtPolyRef ref) const;
|
||||||
|
|
||||||
|
class dtNodePool* getNodePool() const { return m_nodePool; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Returns neighbour tile based on side.
|
||||||
|
dtMeshTile* getNeighbourTileAt(int x, int y, int side) const;
|
||||||
|
|
||||||
|
// Queries polygons within a tile.
|
||||||
|
int queryPolygonsInTile(const dtMeshTile* tile, const float* qmin, const float* qmax, const dtQueryFilter* filter,
|
||||||
|
dtPolyRef* polys, const int maxPolys) const;
|
||||||
|
// Find nearest polygon within a tile.
|
||||||
|
dtPolyRef findNearestPolyInTile(const dtMeshTile* tile, const float* center, const float* extents,
|
||||||
|
const dtQueryFilter* filter, float* nearestPt) const;
|
||||||
|
// Returns closest point on polygon.
|
||||||
|
dtStatus closestPointOnPolyInTile(const dtMeshTile* tile, const dtPoly* poly, const float* pos, float* closest) const;
|
||||||
|
|
||||||
|
// Returns portal points between two polygons.
|
||||||
|
dtStatus getPortalPoints(dtPolyRef from, dtPolyRef to, float* left, float* right,
|
||||||
|
unsigned char& fromType, unsigned char& toType) const;
|
||||||
|
dtStatus getPortalPoints(dtPolyRef from, const dtPoly* fromPoly, const dtMeshTile* fromTile,
|
||||||
|
dtPolyRef to, const dtPoly* toPoly, const dtMeshTile* toTile,
|
||||||
|
float* left, float* right) const;
|
||||||
|
|
||||||
|
// Returns edge mid point between two polygons.
|
||||||
|
dtStatus getEdgeMidPoint(dtPolyRef from, dtPolyRef to, float* mid) const;
|
||||||
|
dtStatus getEdgeMidPoint(dtPolyRef from, const dtPoly* fromPoly, const dtMeshTile* fromTile,
|
||||||
|
dtPolyRef to, const dtPoly* toPoly, const dtMeshTile* toTile,
|
||||||
|
float* mid) const;
|
||||||
|
|
||||||
|
const dtNavMesh* m_nav; // Pointer to navmesh data.
|
||||||
|
|
||||||
|
struct dtQueryData
|
||||||
|
{
|
||||||
|
dtStatus status;
|
||||||
|
struct dtNode* lastBestNode;
|
||||||
|
float lastBestNodeCost;
|
||||||
|
dtPolyRef startRef, endRef;
|
||||||
|
float startPos[3], endPos[3];
|
||||||
|
const dtQueryFilter* filter;
|
||||||
|
};
|
||||||
|
dtQueryData m_query; // Sliced query state.
|
||||||
|
|
||||||
|
class dtNodePool* m_tinyNodePool; // Pointer to small node pool.
|
||||||
|
class dtNodePool* m_nodePool; // Pointer to node pool.
|
||||||
|
class dtNodeQueue* m_openList; // Pointer to open list queue.
|
||||||
|
};
|
||||||
|
|
||||||
|
// Helper function to allocate navmesh query class using Detour allocator.
|
||||||
|
dtNavMeshQuery* dtAllocNavMeshQuery();
|
||||||
|
void dtFreeNavMeshQuery(dtNavMeshQuery* query);
|
||||||
|
|
||||||
|
#endif // DETOURNAVMESHQUERY_H
|
||||||
157
dep/recastnavigation/Detour/Include/DetourNode.h
Normal file
157
dep/recastnavigation/Detour/Include/DetourNode.h
Normal file
|
|
@ -0,0 +1,157 @@
|
||||||
|
//
|
||||||
|
// 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 DETOURNODE_H
|
||||||
|
#define DETOURNODE_H
|
||||||
|
|
||||||
|
#include "DetourNavMesh.h"
|
||||||
|
|
||||||
|
enum dtNodeFlags
|
||||||
|
{
|
||||||
|
DT_NODE_OPEN = 0x01,
|
||||||
|
DT_NODE_CLOSED = 0x02,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const unsigned short DT_NULL_IDX = 0xffff;
|
||||||
|
|
||||||
|
struct dtNode
|
||||||
|
{
|
||||||
|
float pos[3]; // Position of the node.
|
||||||
|
float cost; // Cost from previous node to current node.
|
||||||
|
float total; // Cost up to the node.
|
||||||
|
unsigned int pidx : 30; // Index to parent node.
|
||||||
|
unsigned int flags : 2; // Node flags 0/open/closed.
|
||||||
|
dtPolyRef id; // Polygon ref the node corresponds to.
|
||||||
|
};
|
||||||
|
|
||||||
|
class dtNodePool
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
dtNodePool(int maxNodes, int hashSize);
|
||||||
|
~dtNodePool();
|
||||||
|
inline void operator=(const dtNodePool&) {}
|
||||||
|
void clear();
|
||||||
|
dtNode* getNode(dtPolyRef id);
|
||||||
|
dtNode* findNode(dtPolyRef id);
|
||||||
|
|
||||||
|
inline unsigned int getNodeIdx(const dtNode* node) const
|
||||||
|
{
|
||||||
|
if (!node) return 0;
|
||||||
|
return (unsigned int)(node - m_nodes)+1;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline dtNode* getNodeAtIdx(unsigned int idx)
|
||||||
|
{
|
||||||
|
if (!idx) return 0;
|
||||||
|
return &m_nodes[idx-1];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const dtNode* getNodeAtIdx(unsigned int idx) const
|
||||||
|
{
|
||||||
|
if (!idx) return 0;
|
||||||
|
return &m_nodes[idx-1];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int getMemUsed() const
|
||||||
|
{
|
||||||
|
return sizeof(*this) +
|
||||||
|
sizeof(dtNode)*m_maxNodes +
|
||||||
|
sizeof(unsigned short)*m_maxNodes +
|
||||||
|
sizeof(unsigned short)*m_hashSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int getMaxNodes() const { return m_maxNodes; }
|
||||||
|
|
||||||
|
inline int getHashSize() const { return m_hashSize; }
|
||||||
|
inline unsigned short getFirst(int bucket) const { return m_first[bucket]; }
|
||||||
|
inline unsigned short getNext(int i) const { return m_next[i]; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
dtNode* m_nodes;
|
||||||
|
unsigned short* m_first;
|
||||||
|
unsigned short* m_next;
|
||||||
|
const int m_maxNodes;
|
||||||
|
const int m_hashSize;
|
||||||
|
int m_nodeCount;
|
||||||
|
};
|
||||||
|
|
||||||
|
class dtNodeQueue
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
dtNodeQueue(int n);
|
||||||
|
~dtNodeQueue();
|
||||||
|
inline void operator=(dtNodeQueue&) {}
|
||||||
|
|
||||||
|
inline void clear()
|
||||||
|
{
|
||||||
|
m_size = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline dtNode* top()
|
||||||
|
{
|
||||||
|
return m_heap[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline dtNode* pop()
|
||||||
|
{
|
||||||
|
dtNode* result = m_heap[0];
|
||||||
|
m_size--;
|
||||||
|
trickleDown(0, m_heap[m_size]);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void push(dtNode* node)
|
||||||
|
{
|
||||||
|
m_size++;
|
||||||
|
bubbleUp(m_size-1, node);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void modify(dtNode* node)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < m_size; ++i)
|
||||||
|
{
|
||||||
|
if (m_heap[i] == node)
|
||||||
|
{
|
||||||
|
bubbleUp(i, node);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool empty() const { return m_size == 0; }
|
||||||
|
|
||||||
|
inline int getMemUsed() const
|
||||||
|
{
|
||||||
|
return sizeof(*this) +
|
||||||
|
sizeof(dtNode*)*(m_capacity+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int getCapacity() const { return m_capacity; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
void bubbleUp(int i, dtNode* node);
|
||||||
|
void trickleDown(int i, dtNode* node);
|
||||||
|
|
||||||
|
dtNode** m_heap;
|
||||||
|
const int m_capacity;
|
||||||
|
int m_size;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // DETOURNODE_H
|
||||||
148
dep/recastnavigation/Detour/Include/DetourObstacleAvoidance.h
Normal file
148
dep/recastnavigation/Detour/Include/DetourObstacleAvoidance.h
Normal file
|
|
@ -0,0 +1,148 @@
|
||||||
|
//
|
||||||
|
// 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 DETOUROBSTACLEAVOIDANCE_H
|
||||||
|
#define DETOUROBSTACLEAVOIDANCE_H
|
||||||
|
|
||||||
|
struct dtObstacleCircle
|
||||||
|
{
|
||||||
|
float p[3]; // Position of the obstacle
|
||||||
|
float vel[3]; // Velocity of the obstacle
|
||||||
|
float dvel[3]; // Velocity of the obstacle
|
||||||
|
float rad; // Radius of the obstacle
|
||||||
|
float dp[3], np[3]; // Use for side selection during sampling.
|
||||||
|
};
|
||||||
|
|
||||||
|
struct dtObstacleSegment
|
||||||
|
{
|
||||||
|
float p[3], q[3]; // End points of the obstacle segment
|
||||||
|
bool touch;
|
||||||
|
};
|
||||||
|
|
||||||
|
static const int RVO_SAMPLE_RAD = 15;
|
||||||
|
static const int MAX_RVO_SAMPLES = (RVO_SAMPLE_RAD*2+1)*(RVO_SAMPLE_RAD*2+1) + 100;
|
||||||
|
|
||||||
|
class dtObstacleAvoidanceDebugData
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
dtObstacleAvoidanceDebugData();
|
||||||
|
~dtObstacleAvoidanceDebugData();
|
||||||
|
|
||||||
|
bool init(const int maxSamples);
|
||||||
|
void reset();
|
||||||
|
void addSample(const float* vel, const float ssize, const float pen,
|
||||||
|
const float vpen, const float vcpen, const float spen, const float tpen);
|
||||||
|
|
||||||
|
void normalizeSamples();
|
||||||
|
|
||||||
|
inline int getSampleCount() const { return m_nsamples; }
|
||||||
|
inline const float* getSampleVelocity(const int i) const { return &m_vel[i*3]; }
|
||||||
|
inline float getSampleSize(const int i) const { return m_ssize[i]; }
|
||||||
|
inline float getSamplePenalty(const int i) const { return m_pen[i]; }
|
||||||
|
inline float getSampleDesiredVelocityPenalty(const int i) const { return m_vpen[i]; }
|
||||||
|
inline float getSampleCurrentVelocityPenalty(const int i) const { return m_vcpen[i]; }
|
||||||
|
inline float getSamplePreferredSidePenalty(const int i) const { return m_spen[i]; }
|
||||||
|
inline float getSampleCollisionTimePenalty(const int i) const { return m_tpen[i]; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
int m_nsamples;
|
||||||
|
int m_maxSamples;
|
||||||
|
float* m_vel;
|
||||||
|
float* m_ssize;
|
||||||
|
float* m_pen;
|
||||||
|
float* m_vpen;
|
||||||
|
float* m_vcpen;
|
||||||
|
float* m_spen;
|
||||||
|
float* m_tpen;
|
||||||
|
};
|
||||||
|
|
||||||
|
dtObstacleAvoidanceDebugData* dtAllocObstacleAvoidanceDebugData();
|
||||||
|
void dtFreeObstacleAvoidanceDebugData(dtObstacleAvoidanceDebugData* ptr);
|
||||||
|
|
||||||
|
|
||||||
|
class dtObstacleAvoidanceQuery
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
dtObstacleAvoidanceQuery();
|
||||||
|
~dtObstacleAvoidanceQuery();
|
||||||
|
|
||||||
|
bool init(const int maxCircles, const int maxSegments);
|
||||||
|
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
void addCircle(const float* pos, const float rad,
|
||||||
|
const float* vel, const float* dvel);
|
||||||
|
|
||||||
|
void addSegment(const float* p, const float* q);
|
||||||
|
|
||||||
|
inline void setVelocitySelectionBias(float v) { m_velBias = v; }
|
||||||
|
inline void setDesiredVelocityWeight(float w) { m_weightDesVel = w; }
|
||||||
|
inline void setCurrentVelocityWeight(float w) { m_weightCurVel = w; }
|
||||||
|
inline void setPreferredSideWeight(float w) { m_weightSide = w; }
|
||||||
|
inline void setCollisionTimeWeight(float w) { m_weightToi = w; }
|
||||||
|
inline void setTimeHorizon(float t) { m_horizTime = t; }
|
||||||
|
|
||||||
|
void sampleVelocityGrid(const float* pos, const float rad, const float vmax,
|
||||||
|
const float* vel, const float* dvel, float* nvel,
|
||||||
|
const int gsize,
|
||||||
|
dtObstacleAvoidanceDebugData* debug = 0);
|
||||||
|
|
||||||
|
void sampleVelocityAdaptive(const float* pos, const float rad, const float vmax,
|
||||||
|
const float* vel, const float* dvel, float* nvel,
|
||||||
|
const int ndivs, const int nrings, const int depth,
|
||||||
|
dtObstacleAvoidanceDebugData* debug = 0);
|
||||||
|
|
||||||
|
inline int getObstacleCircleCount() const { return m_ncircles; }
|
||||||
|
const dtObstacleCircle* getObstacleCircle(const int i) { return &m_circles[i]; }
|
||||||
|
|
||||||
|
inline int getObstacleSegmentCount() const { return m_nsegments; }
|
||||||
|
const dtObstacleSegment* getObstacleSegment(const int i) { return &m_segments[i]; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
void prepare(const float* pos, const float* dvel);
|
||||||
|
|
||||||
|
float processSample(const float* vcand, const float cs,
|
||||||
|
const float* pos, const float rad,
|
||||||
|
const float vmax, const float* vel, const float* dvel,
|
||||||
|
dtObstacleAvoidanceDebugData* debug);
|
||||||
|
|
||||||
|
dtObstacleCircle* insertCircle(const float dist);
|
||||||
|
dtObstacleSegment* insertSegment(const float dist);
|
||||||
|
|
||||||
|
float m_velBias;
|
||||||
|
float m_weightDesVel;
|
||||||
|
float m_weightCurVel;
|
||||||
|
float m_weightSide;
|
||||||
|
float m_weightToi;
|
||||||
|
float m_horizTime;
|
||||||
|
|
||||||
|
int m_maxCircles;
|
||||||
|
dtObstacleCircle* m_circles;
|
||||||
|
int m_ncircles;
|
||||||
|
|
||||||
|
int m_maxSegments;
|
||||||
|
dtObstacleSegment* m_segments;
|
||||||
|
int m_nsegments;
|
||||||
|
};
|
||||||
|
|
||||||
|
dtObstacleAvoidanceQuery* dtAllocObstacleAvoidanceQuery();
|
||||||
|
void dtFreeObstacleAvoidanceQuery(dtObstacleAvoidanceQuery* ptr);
|
||||||
|
|
||||||
|
|
||||||
|
#endif // DETOUROBSTACLEAVOIDANCE_H
|
||||||
37
dep/recastnavigation/Detour/Source/CMakeLists.txt
Normal file
37
dep/recastnavigation/Detour/Source/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
#
|
||||||
|
# Copyright (C) 2005-2011 MaNGOS project <http://getmangos.com/>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
#
|
||||||
|
set(detour_SRCS
|
||||||
|
DetourAlloc.cpp
|
||||||
|
DetourCommon.cpp
|
||||||
|
DetourNavMeshBuilder.cpp
|
||||||
|
DetourNavMesh.cpp
|
||||||
|
DetourNavMeshQuery.cpp
|
||||||
|
DetourNode.cpp
|
||||||
|
DetourObstacleAvoidance.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
include_directories(
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${CMAKE_SOURCE_DIR}/dep/recastnavigation
|
||||||
|
${CMAKE_SOURCE_DIR}/dep/recastnavigation/Detour
|
||||||
|
${CMAKE_SOURCE_DIR}/dep/recastnavigation/Detour/Include
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(detour STATIC
|
||||||
|
${detour_SRCS}
|
||||||
|
)
|
||||||
50
dep/recastnavigation/Detour/Source/DetourAlloc.cpp
Normal file
50
dep/recastnavigation/Detour/Source/DetourAlloc.cpp
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "DetourAlloc.h"
|
||||||
|
|
||||||
|
static void *dtAllocDefault(int size, dtAllocHint)
|
||||||
|
{
|
||||||
|
return malloc(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void dtFreeDefault(void *ptr)
|
||||||
|
{
|
||||||
|
free(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static dtAllocFunc* sAllocFunc = dtAllocDefault;
|
||||||
|
static dtFreeFunc* sFreeFunc = dtFreeDefault;
|
||||||
|
|
||||||
|
void dtAllocSetCustom(dtAllocFunc *allocFunc, dtFreeFunc *freeFunc)
|
||||||
|
{
|
||||||
|
sAllocFunc = allocFunc ? allocFunc : dtAllocDefault;
|
||||||
|
sFreeFunc = freeFunc ? freeFunc : dtFreeDefault;
|
||||||
|
}
|
||||||
|
|
||||||
|
void* dtAlloc(int size, dtAllocHint hint)
|
||||||
|
{
|
||||||
|
return sAllocFunc(size, hint);
|
||||||
|
}
|
||||||
|
|
||||||
|
void dtFree(void* ptr)
|
||||||
|
{
|
||||||
|
if (ptr)
|
||||||
|
sFreeFunc(ptr);
|
||||||
|
}
|
||||||
329
dep/recastnavigation/Detour/Source/DetourCommon.cpp
Normal file
329
dep/recastnavigation/Detour/Source/DetourCommon.cpp
Normal file
|
|
@ -0,0 +1,329 @@
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
#include "DetourCommon.h"
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
float dtSqrt(float x)
|
||||||
|
{
|
||||||
|
return sqrtf(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
void dtClosestPtPointTriangle(float* closest, const float* p,
|
||||||
|
const float* a, const float* b, const float* c)
|
||||||
|
{
|
||||||
|
// Check if P in vertex region outside A
|
||||||
|
float ab[3], ac[3], ap[3];
|
||||||
|
dtVsub(ab, b, a);
|
||||||
|
dtVsub(ac, c, a);
|
||||||
|
dtVsub(ap, p, a);
|
||||||
|
float d1 = dtVdot(ab, ap);
|
||||||
|
float d2 = dtVdot(ac, ap);
|
||||||
|
if (d1 <= 0.0f && d2 <= 0.0f)
|
||||||
|
{
|
||||||
|
// barycentric coordinates (1,0,0)
|
||||||
|
dtVcopy(closest, a);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if P in vertex region outside B
|
||||||
|
float bp[3];
|
||||||
|
dtVsub(bp, p, b);
|
||||||
|
float d3 = dtVdot(ab, bp);
|
||||||
|
float d4 = dtVdot(ac, bp);
|
||||||
|
if (d3 >= 0.0f && d4 <= d3)
|
||||||
|
{
|
||||||
|
// barycentric coordinates (0,1,0)
|
||||||
|
dtVcopy(closest, b);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if P in edge region of AB, if so return projection of P onto AB
|
||||||
|
float vc = d1*d4 - d3*d2;
|
||||||
|
if (vc <= 0.0f && d1 >= 0.0f && d3 <= 0.0f)
|
||||||
|
{
|
||||||
|
// barycentric coordinates (1-v,v,0)
|
||||||
|
float v = d1 / (d1 - d3);
|
||||||
|
closest[0] = a[0] + v * ab[0];
|
||||||
|
closest[1] = a[1] + v * ab[1];
|
||||||
|
closest[2] = a[2] + v * ab[2];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if P in vertex region outside C
|
||||||
|
float cp[3];
|
||||||
|
dtVsub(cp, p, c);
|
||||||
|
float d5 = dtVdot(ab, cp);
|
||||||
|
float d6 = dtVdot(ac, cp);
|
||||||
|
if (d6 >= 0.0f && d5 <= d6)
|
||||||
|
{
|
||||||
|
// barycentric coordinates (0,0,1)
|
||||||
|
dtVcopy(closest, c);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if P in edge region of AC, if so return projection of P onto AC
|
||||||
|
float vb = d5*d2 - d1*d6;
|
||||||
|
if (vb <= 0.0f && d2 >= 0.0f && d6 <= 0.0f)
|
||||||
|
{
|
||||||
|
// barycentric coordinates (1-w,0,w)
|
||||||
|
float w = d2 / (d2 - d6);
|
||||||
|
closest[0] = a[0] + w * ac[0];
|
||||||
|
closest[1] = a[1] + w * ac[1];
|
||||||
|
closest[2] = a[2] + w * ac[2];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if P in edge region of BC, if so return projection of P onto BC
|
||||||
|
float va = d3*d6 - d5*d4;
|
||||||
|
if (va <= 0.0f && (d4 - d3) >= 0.0f && (d5 - d6) >= 0.0f)
|
||||||
|
{
|
||||||
|
// barycentric coordinates (0,1-w,w)
|
||||||
|
float w = (d4 - d3) / ((d4 - d3) + (d5 - d6));
|
||||||
|
closest[0] = b[0] + w * (c[0] - b[0]);
|
||||||
|
closest[1] = b[1] + w * (c[1] - b[1]);
|
||||||
|
closest[2] = b[2] + w * (c[2] - b[2]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// P inside face region. Compute Q through its barycentric coordinates (u,v,w)
|
||||||
|
float denom = 1.0f / (va + vb + vc);
|
||||||
|
float v = vb * denom;
|
||||||
|
float w = vc * denom;
|
||||||
|
closest[0] = a[0] + ab[0] * v + ac[0] * w;
|
||||||
|
closest[1] = a[1] + ab[1] * v + ac[1] * w;
|
||||||
|
closest[2] = a[2] + ab[2] * v + ac[2] * w;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dtIntersectSegmentPoly2D(const float* p0, const float* p1,
|
||||||
|
const float* verts, int nverts,
|
||||||
|
float& tmin, float& tmax,
|
||||||
|
int& segMin, int& segMax)
|
||||||
|
{
|
||||||
|
static const float EPS = 0.00000001f;
|
||||||
|
|
||||||
|
tmin = 0;
|
||||||
|
tmax = 1;
|
||||||
|
segMin = -1;
|
||||||
|
segMax = -1;
|
||||||
|
|
||||||
|
float dir[3];
|
||||||
|
dtVsub(dir, p1, p0);
|
||||||
|
|
||||||
|
for (int i = 0, j = nverts-1; i < nverts; j=i++)
|
||||||
|
{
|
||||||
|
float edge[3], diff[3];
|
||||||
|
dtVsub(edge, &verts[i*3], &verts[j*3]);
|
||||||
|
dtVsub(diff, p0, &verts[j*3]);
|
||||||
|
const float n = dtVperp2D(edge, diff);
|
||||||
|
const float d = dtVperp2D(dir, edge);
|
||||||
|
if (fabsf(d) < EPS)
|
||||||
|
{
|
||||||
|
// S is nearly parallel to this edge
|
||||||
|
if (n < 0)
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const float t = n / d;
|
||||||
|
if (d < 0)
|
||||||
|
{
|
||||||
|
// segment S is entering across this edge
|
||||||
|
if (t > tmin)
|
||||||
|
{
|
||||||
|
tmin = t;
|
||||||
|
segMin = j;
|
||||||
|
// S enters after leaving polygon
|
||||||
|
if (tmin > tmax)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// segment S is leaving across this edge
|
||||||
|
if (t < tmax)
|
||||||
|
{
|
||||||
|
tmax = t;
|
||||||
|
segMax = j;
|
||||||
|
// S leaves before entering polygon
|
||||||
|
if (tmax < tmin)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
float dtDistancePtSegSqr2D(const float* pt, const float* p, const float* q, float& t)
|
||||||
|
{
|
||||||
|
float pqx = q[0] - p[0];
|
||||||
|
float pqz = q[2] - p[2];
|
||||||
|
float dx = pt[0] - p[0];
|
||||||
|
float dz = pt[2] - p[2];
|
||||||
|
float d = pqx*pqx + pqz*pqz;
|
||||||
|
t = pqx*dx + pqz*dz;
|
||||||
|
if (d > 0) t /= d;
|
||||||
|
if (t < 0) t = 0;
|
||||||
|
else if (t > 1) t = 1;
|
||||||
|
dx = p[0] + t*pqx - pt[0];
|
||||||
|
dz = p[2] + t*pqz - pt[2];
|
||||||
|
return dx*dx + dz*dz;
|
||||||
|
}
|
||||||
|
|
||||||
|
void dtCalcPolyCenter(float* tc, const unsigned short* idx, int nidx, const float* verts)
|
||||||
|
{
|
||||||
|
tc[0] = 0.0f;
|
||||||
|
tc[1] = 0.0f;
|
||||||
|
tc[2] = 0.0f;
|
||||||
|
for (int j = 0; j < nidx; ++j)
|
||||||
|
{
|
||||||
|
const float* v = &verts[idx[j]*3];
|
||||||
|
tc[0] += v[0];
|
||||||
|
tc[1] += v[1];
|
||||||
|
tc[2] += v[2];
|
||||||
|
}
|
||||||
|
const float s = 1.0f / nidx;
|
||||||
|
tc[0] *= s;
|
||||||
|
tc[1] *= s;
|
||||||
|
tc[2] *= s;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dtClosestHeightPointTriangle(const float* p, const float* a, const float* b, const float* c, float& h)
|
||||||
|
{
|
||||||
|
float v0[3], v1[3], v2[3];
|
||||||
|
dtVsub(v0, c,a);
|
||||||
|
dtVsub(v1, b,a);
|
||||||
|
dtVsub(v2, p,a);
|
||||||
|
|
||||||
|
const float dot00 = dtVdot2D(v0, v0);
|
||||||
|
const float dot01 = dtVdot2D(v0, v1);
|
||||||
|
const float dot02 = dtVdot2D(v0, v2);
|
||||||
|
const float dot11 = dtVdot2D(v1, v1);
|
||||||
|
const float dot12 = dtVdot2D(v1, v2);
|
||||||
|
|
||||||
|
// Compute barycentric coordinates
|
||||||
|
const float invDenom = 1.0f / (dot00 * dot11 - dot01 * dot01);
|
||||||
|
const float u = (dot11 * dot02 - dot01 * dot12) * invDenom;
|
||||||
|
const float v = (dot00 * dot12 - dot01 * dot02) * invDenom;
|
||||||
|
|
||||||
|
// The (sloppy) epsilon is needed to allow to get height of points which
|
||||||
|
// are interpolated along the edges of the triangles.
|
||||||
|
static const float EPS = 1e-4f;
|
||||||
|
|
||||||
|
// If point lies inside the triangle, return interpolated ycoord.
|
||||||
|
if (u >= -EPS && v >= -EPS && (u+v) <= 1+EPS)
|
||||||
|
{
|
||||||
|
h = a[1] + v0[1]*u + v1[1]*v;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dtPointInPolygon(const float* pt, const float* verts, const int nverts)
|
||||||
|
{
|
||||||
|
// TODO: Replace pnpoly with triArea2D tests?
|
||||||
|
int i, j;
|
||||||
|
bool c = false;
|
||||||
|
for (i = 0, j = nverts-1; i < nverts; j = i++)
|
||||||
|
{
|
||||||
|
const float* vi = &verts[i*3];
|
||||||
|
const float* vj = &verts[j*3];
|
||||||
|
if (((vi[2] > pt[2]) != (vj[2] > pt[2])) &&
|
||||||
|
(pt[0] < (vj[0]-vi[0]) * (pt[2]-vi[2]) / (vj[2]-vi[2]) + vi[0]) )
|
||||||
|
c = !c;
|
||||||
|
}
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dtDistancePtPolyEdgesSqr(const float* pt, const float* verts, const int nverts,
|
||||||
|
float* ed, float* et)
|
||||||
|
{
|
||||||
|
// TODO: Replace pnpoly with triArea2D tests?
|
||||||
|
int i, j;
|
||||||
|
bool c = false;
|
||||||
|
for (i = 0, j = nverts-1; i < nverts; j = i++)
|
||||||
|
{
|
||||||
|
const float* vi = &verts[i*3];
|
||||||
|
const float* vj = &verts[j*3];
|
||||||
|
if (((vi[2] > pt[2]) != (vj[2] > pt[2])) &&
|
||||||
|
(pt[0] < (vj[0]-vi[0]) * (pt[2]-vi[2]) / (vj[2]-vi[2]) + vi[0]) )
|
||||||
|
c = !c;
|
||||||
|
ed[j] = dtDistancePtSegSqr2D(pt, vj, vi, et[j]);
|
||||||
|
}
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void projectPoly(const float* axis, const float* poly, const int npoly,
|
||||||
|
float& rmin, float& rmax)
|
||||||
|
{
|
||||||
|
rmin = rmax = dtVdot2D(axis, &poly[0]);
|
||||||
|
for (int i = 1; i < npoly; ++i)
|
||||||
|
{
|
||||||
|
const float d = dtVdot2D(axis, &poly[i*3]);
|
||||||
|
rmin = dtMin(rmin, d);
|
||||||
|
rmax = dtMax(rmax, d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool overlapRange(const float amin, const float amax,
|
||||||
|
const float bmin, const float bmax,
|
||||||
|
const float eps)
|
||||||
|
{
|
||||||
|
return ((amin+eps) > bmax || (amax-eps) < bmin) ? false : true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dtOverlapPolyPoly2D(const float* polya, const int npolya,
|
||||||
|
const float* polyb, const int npolyb)
|
||||||
|
{
|
||||||
|
const float eps = 1e-4f;
|
||||||
|
|
||||||
|
for (int i = 0, j = npolya-1; i < npolya; j=i++)
|
||||||
|
{
|
||||||
|
const float* va = &polya[j*3];
|
||||||
|
const float* vb = &polya[i*3];
|
||||||
|
const float n[3] = { vb[2]-va[2], 0, -(vb[0]-va[0]) };
|
||||||
|
float amin,amax,bmin,bmax;
|
||||||
|
projectPoly(n, polya, npolya, amin,amax);
|
||||||
|
projectPoly(n, polyb, npolyb, bmin,bmax);
|
||||||
|
if (!overlapRange(amin,amax, bmin,bmax, eps))
|
||||||
|
{
|
||||||
|
// Found separating axis
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0, j = npolyb-1; i < npolyb; j=i++)
|
||||||
|
{
|
||||||
|
const float* va = &polyb[j*3];
|
||||||
|
const float* vb = &polyb[i*3];
|
||||||
|
const float n[3] = { vb[2]-va[2], 0, -(vb[0]-va[0]) };
|
||||||
|
float amin,amax,bmin,bmax;
|
||||||
|
projectPoly(n, polya, npolya, amin,amax);
|
||||||
|
projectPoly(n, polyb, npolyb, bmin,bmax);
|
||||||
|
if (!overlapRange(amin,amax, bmin,bmax, eps))
|
||||||
|
{
|
||||||
|
// Found separating axis
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
1235
dep/recastnavigation/Detour/Source/DetourNavMesh.cpp
Normal file
1235
dep/recastnavigation/Detour/Source/DetourNavMesh.cpp
Normal file
File diff suppressed because it is too large
Load diff
717
dep/recastnavigation/Detour/Source/DetourNavMeshBuilder.cpp
Normal file
717
dep/recastnavigation/Detour/Source/DetourNavMeshBuilder.cpp
Normal file
|
|
@ -0,0 +1,717 @@
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "DetourNavMesh.h"
|
||||||
|
#include "DetourCommon.h"
|
||||||
|
#include "DetourNavMeshBuilder.h"
|
||||||
|
#include "DetourAlloc.h"
|
||||||
|
#include "DetourAssert.h"
|
||||||
|
|
||||||
|
static unsigned short MESH_NULL_IDX = 0xffff;
|
||||||
|
|
||||||
|
|
||||||
|
struct BVItem
|
||||||
|
{
|
||||||
|
unsigned short bmin[3];
|
||||||
|
unsigned short bmax[3];
|
||||||
|
int i;
|
||||||
|
};
|
||||||
|
|
||||||
|
static int compareItemX(const void* va, const void* vb)
|
||||||
|
{
|
||||||
|
const BVItem* a = (const BVItem*)va;
|
||||||
|
const BVItem* b = (const BVItem*)vb;
|
||||||
|
if (a->bmin[0] < b->bmin[0])
|
||||||
|
return -1;
|
||||||
|
if (a->bmin[0] > b->bmin[0])
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int compareItemY(const void* va, const void* vb)
|
||||||
|
{
|
||||||
|
const BVItem* a = (const BVItem*)va;
|
||||||
|
const BVItem* b = (const BVItem*)vb;
|
||||||
|
if (a->bmin[1] < b->bmin[1])
|
||||||
|
return -1;
|
||||||
|
if (a->bmin[1] > b->bmin[1])
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int compareItemZ(const void* va, const void* vb)
|
||||||
|
{
|
||||||
|
const BVItem* a = (const BVItem*)va;
|
||||||
|
const BVItem* b = (const BVItem*)vb;
|
||||||
|
if (a->bmin[2] < b->bmin[2])
|
||||||
|
return -1;
|
||||||
|
if (a->bmin[2] > b->bmin[2])
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void calcExtends(BVItem* items, const int /*nitems*/, const int imin, const int imax,
|
||||||
|
unsigned short* bmin, unsigned short* bmax)
|
||||||
|
{
|
||||||
|
bmin[0] = items[imin].bmin[0];
|
||||||
|
bmin[1] = items[imin].bmin[1];
|
||||||
|
bmin[2] = items[imin].bmin[2];
|
||||||
|
|
||||||
|
bmax[0] = items[imin].bmax[0];
|
||||||
|
bmax[1] = items[imin].bmax[1];
|
||||||
|
bmax[2] = items[imin].bmax[2];
|
||||||
|
|
||||||
|
for (int i = imin+1; i < imax; ++i)
|
||||||
|
{
|
||||||
|
const BVItem& it = items[i];
|
||||||
|
if (it.bmin[0] < bmin[0]) bmin[0] = it.bmin[0];
|
||||||
|
if (it.bmin[1] < bmin[1]) bmin[1] = it.bmin[1];
|
||||||
|
if (it.bmin[2] < bmin[2]) bmin[2] = it.bmin[2];
|
||||||
|
|
||||||
|
if (it.bmax[0] > bmax[0]) bmax[0] = it.bmax[0];
|
||||||
|
if (it.bmax[1] > bmax[1]) bmax[1] = it.bmax[1];
|
||||||
|
if (it.bmax[2] > bmax[2]) bmax[2] = it.bmax[2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int longestAxis(unsigned short x, unsigned short y, unsigned short z)
|
||||||
|
{
|
||||||
|
int axis = 0;
|
||||||
|
unsigned short maxVal = x;
|
||||||
|
if (y > maxVal)
|
||||||
|
{
|
||||||
|
axis = 1;
|
||||||
|
maxVal = y;
|
||||||
|
}
|
||||||
|
if (z > maxVal)
|
||||||
|
{
|
||||||
|
axis = 2;
|
||||||
|
maxVal = z;
|
||||||
|
}
|
||||||
|
return axis;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void subdivide(BVItem* items, int nitems, int imin, int imax, int& curNode, dtBVNode* nodes)
|
||||||
|
{
|
||||||
|
int inum = imax - imin;
|
||||||
|
int icur = curNode;
|
||||||
|
|
||||||
|
dtBVNode& node = nodes[curNode++];
|
||||||
|
|
||||||
|
if (inum == 1)
|
||||||
|
{
|
||||||
|
// Leaf
|
||||||
|
node.bmin[0] = items[imin].bmin[0];
|
||||||
|
node.bmin[1] = items[imin].bmin[1];
|
||||||
|
node.bmin[2] = items[imin].bmin[2];
|
||||||
|
|
||||||
|
node.bmax[0] = items[imin].bmax[0];
|
||||||
|
node.bmax[1] = items[imin].bmax[1];
|
||||||
|
node.bmax[2] = items[imin].bmax[2];
|
||||||
|
|
||||||
|
node.i = items[imin].i;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Split
|
||||||
|
calcExtends(items, nitems, imin, imax, node.bmin, node.bmax);
|
||||||
|
|
||||||
|
int axis = longestAxis(node.bmax[0] - node.bmin[0],
|
||||||
|
node.bmax[1] - node.bmin[1],
|
||||||
|
node.bmax[2] - node.bmin[2]);
|
||||||
|
|
||||||
|
if (axis == 0)
|
||||||
|
{
|
||||||
|
// Sort along x-axis
|
||||||
|
qsort(items+imin, inum, sizeof(BVItem), compareItemX);
|
||||||
|
}
|
||||||
|
else if (axis == 1)
|
||||||
|
{
|
||||||
|
// Sort along y-axis
|
||||||
|
qsort(items+imin, inum, sizeof(BVItem), compareItemY);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Sort along z-axis
|
||||||
|
qsort(items+imin, inum, sizeof(BVItem), compareItemZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
int isplit = imin+inum/2;
|
||||||
|
|
||||||
|
// Left
|
||||||
|
subdivide(items, nitems, imin, isplit, curNode, nodes);
|
||||||
|
// Right
|
||||||
|
subdivide(items, nitems, isplit, imax, curNode, nodes);
|
||||||
|
|
||||||
|
int iescape = curNode - icur;
|
||||||
|
// Negative index means escape.
|
||||||
|
node.i = -iescape;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int createBVTree(const unsigned short* verts, const int /*nverts*/,
|
||||||
|
const unsigned short* polys, const int npolys, const int nvp,
|
||||||
|
const float cs, const float ch,
|
||||||
|
const int /*nnodes*/, dtBVNode* nodes)
|
||||||
|
{
|
||||||
|
// Build tree
|
||||||
|
BVItem* items = (BVItem*)dtAlloc(sizeof(BVItem)*npolys, DT_ALLOC_TEMP);
|
||||||
|
for (int i = 0; i < npolys; i++)
|
||||||
|
{
|
||||||
|
BVItem& it = items[i];
|
||||||
|
it.i = i;
|
||||||
|
// Calc polygon bounds.
|
||||||
|
const unsigned short* p = &polys[i*nvp*2];
|
||||||
|
it.bmin[0] = it.bmax[0] = verts[p[0]*3+0];
|
||||||
|
it.bmin[1] = it.bmax[1] = verts[p[0]*3+1];
|
||||||
|
it.bmin[2] = it.bmax[2] = verts[p[0]*3+2];
|
||||||
|
|
||||||
|
for (int j = 1; j < nvp; ++j)
|
||||||
|
{
|
||||||
|
if (p[j] == MESH_NULL_IDX) break;
|
||||||
|
unsigned short x = verts[p[j]*3+0];
|
||||||
|
unsigned short y = verts[p[j]*3+1];
|
||||||
|
unsigned short z = verts[p[j]*3+2];
|
||||||
|
|
||||||
|
if (x < it.bmin[0]) it.bmin[0] = x;
|
||||||
|
if (y < it.bmin[1]) it.bmin[1] = y;
|
||||||
|
if (z < it.bmin[2]) it.bmin[2] = z;
|
||||||
|
|
||||||
|
if (x > it.bmax[0]) it.bmax[0] = x;
|
||||||
|
if (y > it.bmax[1]) it.bmax[1] = y;
|
||||||
|
if (z > it.bmax[2]) it.bmax[2] = z;
|
||||||
|
}
|
||||||
|
// Remap y
|
||||||
|
it.bmin[1] = (unsigned short)floorf((float)it.bmin[1]*ch/cs);
|
||||||
|
it.bmax[1] = (unsigned short)ceilf((float)it.bmax[1]*ch/cs);
|
||||||
|
}
|
||||||
|
|
||||||
|
int curNode = 0;
|
||||||
|
subdivide(items, npolys, 0, npolys, curNode, nodes);
|
||||||
|
|
||||||
|
dtFree(items);
|
||||||
|
|
||||||
|
return curNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned char classifyOffMeshPoint(const float* pt, const float* bmin, const float* bmax)
|
||||||
|
{
|
||||||
|
static const unsigned char XP = 1<<0;
|
||||||
|
static const unsigned char ZP = 1<<1;
|
||||||
|
static const unsigned char XM = 1<<2;
|
||||||
|
static const unsigned char ZM = 1<<3;
|
||||||
|
|
||||||
|
unsigned char outcode = 0;
|
||||||
|
outcode |= (pt[0] >= bmax[0]) ? XP : 0;
|
||||||
|
outcode |= (pt[2] >= bmax[2]) ? ZP : 0;
|
||||||
|
outcode |= (pt[0] < bmin[0]) ? XM : 0;
|
||||||
|
outcode |= (pt[2] < bmin[2]) ? ZM : 0;
|
||||||
|
|
||||||
|
switch (outcode)
|
||||||
|
{
|
||||||
|
case XP: return 0;
|
||||||
|
case XP|ZP: return 1;
|
||||||
|
case ZP: return 2;
|
||||||
|
case XM|ZP: return 3;
|
||||||
|
case XM: return 4;
|
||||||
|
case XM|ZM: return 5;
|
||||||
|
case ZM: return 6;
|
||||||
|
case XP|ZM: return 7;
|
||||||
|
};
|
||||||
|
return 0xff;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Better error handling.
|
||||||
|
|
||||||
|
bool dtCreateNavMeshData(dtNavMeshCreateParams* params, unsigned char** outData, int* outDataSize)
|
||||||
|
{
|
||||||
|
if (params->nvp > DT_VERTS_PER_POLYGON)
|
||||||
|
return false;
|
||||||
|
if (params->vertCount >= 0xffff)
|
||||||
|
return false;
|
||||||
|
if (!params->vertCount || !params->verts)
|
||||||
|
return false;
|
||||||
|
if (!params->polyCount || !params->polys)
|
||||||
|
return false;
|
||||||
|
if (!params->detailMeshes || !params->detailVerts || !params->detailTris)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const int nvp = params->nvp;
|
||||||
|
|
||||||
|
// Classify off-mesh connection points. We store only the connections
|
||||||
|
// whose start point is inside the tile.
|
||||||
|
unsigned char* offMeshConClass = 0;
|
||||||
|
int storedOffMeshConCount = 0;
|
||||||
|
int offMeshConLinkCount = 0;
|
||||||
|
|
||||||
|
if (params->offMeshConCount > 0)
|
||||||
|
{
|
||||||
|
offMeshConClass = (unsigned char*)dtAlloc(sizeof(unsigned char)*params->offMeshConCount*2, DT_ALLOC_TEMP);
|
||||||
|
if (!offMeshConClass)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
for (int i = 0; i < params->offMeshConCount; ++i)
|
||||||
|
{
|
||||||
|
offMeshConClass[i*2+0] = classifyOffMeshPoint(¶ms->offMeshConVerts[(i*2+0)*3], params->bmin, params->bmax);
|
||||||
|
offMeshConClass[i*2+1] = classifyOffMeshPoint(¶ms->offMeshConVerts[(i*2+1)*3], params->bmin, params->bmax);
|
||||||
|
|
||||||
|
// Cound how many links should be allocated for off-mesh connections.
|
||||||
|
if (offMeshConClass[i*2+0] == 0xff)
|
||||||
|
offMeshConLinkCount++;
|
||||||
|
if (offMeshConClass[i*2+1] == 0xff)
|
||||||
|
offMeshConLinkCount++;
|
||||||
|
|
||||||
|
if (offMeshConClass[i*2+0] == 0xff)
|
||||||
|
storedOffMeshConCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Off-mesh connectionss are stored as polygons, adjust values.
|
||||||
|
const int totPolyCount = params->polyCount + storedOffMeshConCount;
|
||||||
|
const int totVertCount = params->vertCount + storedOffMeshConCount*2;
|
||||||
|
|
||||||
|
// Find portal edges which are at tile borders.
|
||||||
|
int edgeCount = 0;
|
||||||
|
int portalCount = 0;
|
||||||
|
for (int i = 0; i < params->polyCount; ++i)
|
||||||
|
{
|
||||||
|
const unsigned short* p = ¶ms->polys[i*2*nvp];
|
||||||
|
for (int j = 0; j < nvp; ++j)
|
||||||
|
{
|
||||||
|
if (p[j] == MESH_NULL_IDX) break;
|
||||||
|
int nj = j+1;
|
||||||
|
if (nj >= nvp || p[nj] == MESH_NULL_IDX) nj = 0;
|
||||||
|
const unsigned short* va = ¶ms->verts[p[j]*3];
|
||||||
|
const unsigned short* vb = ¶ms->verts[p[nj]*3];
|
||||||
|
|
||||||
|
edgeCount++;
|
||||||
|
|
||||||
|
if (params->tileSize > 0)
|
||||||
|
{
|
||||||
|
if (va[0] == params->tileSize && vb[0] == params->tileSize)
|
||||||
|
portalCount++; // x+
|
||||||
|
else if (va[2] == params->tileSize && vb[2] == params->tileSize)
|
||||||
|
portalCount++; // z+
|
||||||
|
else if (va[0] == 0 && vb[0] == 0)
|
||||||
|
portalCount++; // x-
|
||||||
|
else if (va[2] == 0 && vb[2] == 0)
|
||||||
|
portalCount++; // z-
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const int maxLinkCount = edgeCount + portalCount*2 + offMeshConLinkCount*2;
|
||||||
|
|
||||||
|
// Find unique detail vertices.
|
||||||
|
int uniqueDetailVertCount = 0;
|
||||||
|
for (int i = 0; i < params->polyCount; ++i)
|
||||||
|
{
|
||||||
|
const unsigned short* p = ¶ms->polys[i*nvp*2];
|
||||||
|
int ndv = params->detailMeshes[i*4+1];
|
||||||
|
int nv = 0;
|
||||||
|
for (int j = 0; j < nvp; ++j)
|
||||||
|
{
|
||||||
|
if (p[j] == MESH_NULL_IDX) break;
|
||||||
|
nv++;
|
||||||
|
}
|
||||||
|
ndv -= nv;
|
||||||
|
uniqueDetailVertCount += ndv;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate data size
|
||||||
|
const int headerSize = dtAlign4(sizeof(dtMeshHeader));
|
||||||
|
const int vertsSize = dtAlign4(sizeof(float)*3*totVertCount);
|
||||||
|
const int polysSize = dtAlign4(sizeof(dtPoly)*totPolyCount);
|
||||||
|
const int linksSize = dtAlign4(sizeof(dtLink)*maxLinkCount);
|
||||||
|
const int detailMeshesSize = dtAlign4(sizeof(dtPolyDetail)*params->polyCount);
|
||||||
|
const int detailVertsSize = dtAlign4(sizeof(float)*3*uniqueDetailVertCount);
|
||||||
|
const int detailTrisSize = dtAlign4(sizeof(unsigned char)*4*params->detailTriCount);
|
||||||
|
const int bvTreeSize = dtAlign4(sizeof(dtBVNode)*params->polyCount*2);
|
||||||
|
const int offMeshConsSize = dtAlign4(sizeof(dtOffMeshConnection)*storedOffMeshConCount);
|
||||||
|
|
||||||
|
const int dataSize = headerSize + vertsSize + polysSize + linksSize +
|
||||||
|
detailMeshesSize + detailVertsSize + detailTrisSize +
|
||||||
|
bvTreeSize + offMeshConsSize;
|
||||||
|
|
||||||
|
unsigned char* data = (unsigned char*)dtAlloc(sizeof(unsigned char)*dataSize, DT_ALLOC_PERM);
|
||||||
|
if (!data)
|
||||||
|
{
|
||||||
|
dtFree(offMeshConClass);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
memset(data, 0, dataSize);
|
||||||
|
|
||||||
|
unsigned char* d = data;
|
||||||
|
dtMeshHeader* header = (dtMeshHeader*)d; d += headerSize;
|
||||||
|
float* navVerts = (float*)d; d += vertsSize;
|
||||||
|
dtPoly* navPolys = (dtPoly*)d; d += polysSize;
|
||||||
|
d += linksSize;
|
||||||
|
dtPolyDetail* navDMeshes = (dtPolyDetail*)d; d += detailMeshesSize;
|
||||||
|
float* navDVerts = (float*)d; d += detailVertsSize;
|
||||||
|
unsigned char* navDTris = (unsigned char*)d; d += detailTrisSize;
|
||||||
|
dtBVNode* navBvtree = (dtBVNode*)d; d += bvTreeSize;
|
||||||
|
dtOffMeshConnection* offMeshCons = (dtOffMeshConnection*)d; d += offMeshConsSize;
|
||||||
|
|
||||||
|
|
||||||
|
// Store header
|
||||||
|
header->magic = DT_NAVMESH_MAGIC;
|
||||||
|
header->version = DT_NAVMESH_VERSION;
|
||||||
|
header->x = params->tileX;
|
||||||
|
header->y = params->tileY;
|
||||||
|
header->userId = params->userId;
|
||||||
|
header->polyCount = totPolyCount;
|
||||||
|
header->vertCount = totVertCount;
|
||||||
|
header->maxLinkCount = maxLinkCount;
|
||||||
|
dtVcopy(header->bmin, params->bmin);
|
||||||
|
dtVcopy(header->bmax, params->bmax);
|
||||||
|
header->detailMeshCount = params->polyCount;
|
||||||
|
header->detailVertCount = uniqueDetailVertCount;
|
||||||
|
header->detailTriCount = params->detailTriCount;
|
||||||
|
header->bvQuantFactor = 1.0f / params->cs;
|
||||||
|
header->offMeshBase = params->polyCount;
|
||||||
|
header->walkableHeight = params->walkableHeight;
|
||||||
|
header->walkableRadius = params->walkableRadius;
|
||||||
|
header->walkableClimb = params->walkableClimb;
|
||||||
|
header->offMeshConCount = storedOffMeshConCount;
|
||||||
|
header->bvNodeCount = params->polyCount*2;
|
||||||
|
|
||||||
|
const int offMeshVertsBase = params->vertCount;
|
||||||
|
const int offMeshPolyBase = params->polyCount;
|
||||||
|
|
||||||
|
// Store vertices
|
||||||
|
// Mesh vertices
|
||||||
|
for (int i = 0; i < params->vertCount; ++i)
|
||||||
|
{
|
||||||
|
const unsigned short* iv = ¶ms->verts[i*3];
|
||||||
|
float* v = &navVerts[i*3];
|
||||||
|
v[0] = params->bmin[0] + iv[0] * params->cs;
|
||||||
|
v[1] = params->bmin[1] + iv[1] * params->ch;
|
||||||
|
v[2] = params->bmin[2] + iv[2] * params->cs;
|
||||||
|
}
|
||||||
|
// Off-mesh link vertices.
|
||||||
|
int n = 0;
|
||||||
|
for (int i = 0; i < params->offMeshConCount; ++i)
|
||||||
|
{
|
||||||
|
// Only store connections which start from this tile.
|
||||||
|
if (offMeshConClass[i*2+0] == 0xff)
|
||||||
|
{
|
||||||
|
const float* linkv = ¶ms->offMeshConVerts[i*2*3];
|
||||||
|
float* v = &navVerts[(offMeshVertsBase + n*2)*3];
|
||||||
|
dtVcopy(&v[0], &linkv[0]);
|
||||||
|
dtVcopy(&v[3], &linkv[3]);
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store polygons
|
||||||
|
// Mesh polys
|
||||||
|
const unsigned short* src = params->polys;
|
||||||
|
for (int i = 0; i < params->polyCount; ++i)
|
||||||
|
{
|
||||||
|
dtPoly* p = &navPolys[i];
|
||||||
|
p->vertCount = 0;
|
||||||
|
p->flags = params->polyFlags[i];
|
||||||
|
p->setArea(params->polyAreas[i]);
|
||||||
|
p->setType(DT_POLYTYPE_GROUND);
|
||||||
|
for (int j = 0; j < nvp; ++j)
|
||||||
|
{
|
||||||
|
if (src[j] == MESH_NULL_IDX) break;
|
||||||
|
p->verts[j] = src[j];
|
||||||
|
p->neis[j] = (src[nvp+j]+1) & 0xffff;
|
||||||
|
p->vertCount++;
|
||||||
|
}
|
||||||
|
src += nvp*2;
|
||||||
|
}
|
||||||
|
// Off-mesh connection vertices.
|
||||||
|
n = 0;
|
||||||
|
for (int i = 0; i < params->offMeshConCount; ++i)
|
||||||
|
{
|
||||||
|
// Only store connections which start from this tile.
|
||||||
|
if (offMeshConClass[i*2+0] == 0xff)
|
||||||
|
{
|
||||||
|
dtPoly* p = &navPolys[offMeshPolyBase+n];
|
||||||
|
p->vertCount = 2;
|
||||||
|
p->verts[0] = (unsigned short)(offMeshVertsBase + n*2+0);
|
||||||
|
p->verts[1] = (unsigned short)(offMeshVertsBase + n*2+1);
|
||||||
|
p->flags = params->offMeshConFlags[i];
|
||||||
|
p->setArea(params->offMeshConAreas[i]);
|
||||||
|
p->setType(DT_POLYTYPE_OFFMESH_CONNECTION);
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store portal edges.
|
||||||
|
if (params->tileSize > 0)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < params->polyCount; ++i)
|
||||||
|
{
|
||||||
|
dtPoly* poly = &navPolys[i];
|
||||||
|
for (int j = 0; j < poly->vertCount; ++j)
|
||||||
|
{
|
||||||
|
int nj = j+1;
|
||||||
|
if (nj >= poly->vertCount) nj = 0;
|
||||||
|
|
||||||
|
const unsigned short* va = ¶ms->verts[poly->verts[j]*3];
|
||||||
|
const unsigned short* vb = ¶ms->verts[poly->verts[nj]*3];
|
||||||
|
|
||||||
|
if (va[0] == params->tileSize && vb[0] == params->tileSize) // x+
|
||||||
|
poly->neis[j] = DT_EXT_LINK | 0;
|
||||||
|
else if (va[2] == params->tileSize && vb[2] == params->tileSize) // z+
|
||||||
|
poly->neis[j] = DT_EXT_LINK | 2;
|
||||||
|
else if (va[0] == 0 && vb[0] == 0) // x-
|
||||||
|
poly->neis[j] = DT_EXT_LINK | 4;
|
||||||
|
else if (va[2] == 0 && vb[2] == 0) // z-
|
||||||
|
poly->neis[j] = DT_EXT_LINK | 6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store detail meshes and vertices.
|
||||||
|
// The nav polygon vertices are stored as the first vertices on each mesh.
|
||||||
|
// We compress the mesh data by skipping them and using the navmesh coordinates.
|
||||||
|
unsigned short vbase = 0;
|
||||||
|
for (int i = 0; i < params->polyCount; ++i)
|
||||||
|
{
|
||||||
|
dtPolyDetail& dtl = navDMeshes[i];
|
||||||
|
const int vb = (int)params->detailMeshes[i*4+0];
|
||||||
|
const int ndv = (int)params->detailMeshes[i*4+1];
|
||||||
|
const int nv = navPolys[i].vertCount;
|
||||||
|
dtl.vertBase = (unsigned int)vbase;
|
||||||
|
dtl.vertCount = (unsigned char)(ndv-nv);
|
||||||
|
dtl.triBase = (unsigned int)params->detailMeshes[i*4+2];
|
||||||
|
dtl.triCount = (unsigned char)params->detailMeshes[i*4+3];
|
||||||
|
// Copy vertices except the first 'nv' verts which are equal to nav poly verts.
|
||||||
|
if (ndv-nv)
|
||||||
|
{
|
||||||
|
memcpy(&navDVerts[vbase*3], ¶ms->detailVerts[(vb+nv)*3], sizeof(float)*3*(ndv-nv));
|
||||||
|
vbase += (unsigned short)(ndv-nv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Store triangles.
|
||||||
|
memcpy(navDTris, params->detailTris, sizeof(unsigned char)*4*params->detailTriCount);
|
||||||
|
|
||||||
|
// Store and create BVtree.
|
||||||
|
// TODO: take detail mesh into account! use byte per bbox extent?
|
||||||
|
createBVTree(params->verts, params->vertCount, params->polys, params->polyCount,
|
||||||
|
nvp, params->cs, params->ch, params->polyCount*2, navBvtree);
|
||||||
|
|
||||||
|
// Store Off-Mesh connections.
|
||||||
|
n = 0;
|
||||||
|
for (int i = 0; i < params->offMeshConCount; ++i)
|
||||||
|
{
|
||||||
|
// Only store connections which start from this tile.
|
||||||
|
if (offMeshConClass[i*2+0] == 0xff)
|
||||||
|
{
|
||||||
|
dtOffMeshConnection* con = &offMeshCons[n];
|
||||||
|
con->poly = (unsigned short)(offMeshPolyBase + n);
|
||||||
|
// Copy connection end-points.
|
||||||
|
const float* endPts = ¶ms->offMeshConVerts[i*2*3];
|
||||||
|
dtVcopy(&con->pos[0], &endPts[0]);
|
||||||
|
dtVcopy(&con->pos[3], &endPts[3]);
|
||||||
|
con->rad = params->offMeshConRad[i];
|
||||||
|
con->flags = params->offMeshConDir[i] ? DT_OFFMESH_CON_BIDIR : 0;
|
||||||
|
con->side = offMeshConClass[i*2+1];
|
||||||
|
if (params->offMeshConUserID)
|
||||||
|
con->userId = params->offMeshConUserID[i];
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dtFree(offMeshConClass);
|
||||||
|
|
||||||
|
*outData = data;
|
||||||
|
*outDataSize = dataSize;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void swapByte(unsigned char* a, unsigned char* b)
|
||||||
|
{
|
||||||
|
unsigned char tmp = *a;
|
||||||
|
*a = *b;
|
||||||
|
*b = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void swapEndian(unsigned short* v)
|
||||||
|
{
|
||||||
|
unsigned char* x = (unsigned char*)v;
|
||||||
|
swapByte(x+0, x+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void swapEndian(short* v)
|
||||||
|
{
|
||||||
|
unsigned char* x = (unsigned char*)v;
|
||||||
|
swapByte(x+0, x+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void swapEndian(unsigned int* v)
|
||||||
|
{
|
||||||
|
unsigned char* x = (unsigned char*)v;
|
||||||
|
swapByte(x+0, x+3); swapByte(x+1, x+2);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void swapEndian(int* v)
|
||||||
|
{
|
||||||
|
unsigned char* x = (unsigned char*)v;
|
||||||
|
swapByte(x+0, x+3); swapByte(x+1, x+2);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void swapEndian(float* v)
|
||||||
|
{
|
||||||
|
unsigned char* x = (unsigned char*)v;
|
||||||
|
swapByte(x+0, x+3); swapByte(x+1, x+2);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dtNavMeshHeaderSwapEndian(unsigned char* data, const int /*dataSize*/)
|
||||||
|
{
|
||||||
|
dtMeshHeader* header = (dtMeshHeader*)data;
|
||||||
|
|
||||||
|
int swappedMagic = DT_NAVMESH_MAGIC;
|
||||||
|
int swappedVersion = DT_NAVMESH_VERSION;
|
||||||
|
swapEndian(&swappedMagic);
|
||||||
|
swapEndian(&swappedVersion);
|
||||||
|
|
||||||
|
if ((header->magic != DT_NAVMESH_MAGIC || header->version != DT_NAVMESH_VERSION) &&
|
||||||
|
(header->magic != swappedMagic || header->version != swappedVersion))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
swapEndian(&header->magic);
|
||||||
|
swapEndian(&header->version);
|
||||||
|
swapEndian(&header->x);
|
||||||
|
swapEndian(&header->y);
|
||||||
|
swapEndian(&header->userId);
|
||||||
|
swapEndian(&header->polyCount);
|
||||||
|
swapEndian(&header->vertCount);
|
||||||
|
swapEndian(&header->maxLinkCount);
|
||||||
|
swapEndian(&header->detailMeshCount);
|
||||||
|
swapEndian(&header->detailVertCount);
|
||||||
|
swapEndian(&header->detailTriCount);
|
||||||
|
swapEndian(&header->bvNodeCount);
|
||||||
|
swapEndian(&header->offMeshConCount);
|
||||||
|
swapEndian(&header->offMeshBase);
|
||||||
|
swapEndian(&header->walkableHeight);
|
||||||
|
swapEndian(&header->walkableRadius);
|
||||||
|
swapEndian(&header->walkableClimb);
|
||||||
|
swapEndian(&header->bmin[0]);
|
||||||
|
swapEndian(&header->bmin[1]);
|
||||||
|
swapEndian(&header->bmin[2]);
|
||||||
|
swapEndian(&header->bmax[0]);
|
||||||
|
swapEndian(&header->bmax[1]);
|
||||||
|
swapEndian(&header->bmax[2]);
|
||||||
|
swapEndian(&header->bvQuantFactor);
|
||||||
|
|
||||||
|
// Freelist index and pointers are updated when tile is added, no need to swap.
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dtNavMeshDataSwapEndian(unsigned char* data, const int /*dataSize*/)
|
||||||
|
{
|
||||||
|
// Make sure the data is in right format.
|
||||||
|
dtMeshHeader* header = (dtMeshHeader*)data;
|
||||||
|
if (header->magic != DT_NAVMESH_MAGIC)
|
||||||
|
return false;
|
||||||
|
if (header->version != DT_NAVMESH_VERSION)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Patch header pointers.
|
||||||
|
const int headerSize = dtAlign4(sizeof(dtMeshHeader));
|
||||||
|
const int vertsSize = dtAlign4(sizeof(float)*3*header->vertCount);
|
||||||
|
const int polysSize = dtAlign4(sizeof(dtPoly)*header->polyCount);
|
||||||
|
const int linksSize = dtAlign4(sizeof(dtLink)*(header->maxLinkCount));
|
||||||
|
const int detailMeshesSize = dtAlign4(sizeof(dtPolyDetail)*header->detailMeshCount);
|
||||||
|
const int detailVertsSize = dtAlign4(sizeof(float)*3*header->detailVertCount);
|
||||||
|
const int detailTrisSize = dtAlign4(sizeof(unsigned char)*4*header->detailTriCount);
|
||||||
|
const int bvtreeSize = dtAlign4(sizeof(dtBVNode)*header->bvNodeCount);
|
||||||
|
const int offMeshLinksSize = dtAlign4(sizeof(dtOffMeshConnection)*header->offMeshConCount);
|
||||||
|
|
||||||
|
unsigned char* d = data + headerSize;
|
||||||
|
float* verts = (float*)d; d += vertsSize;
|
||||||
|
dtPoly* polys = (dtPoly*)d; d += polysSize;
|
||||||
|
/*dtLink* links = (dtLink*)d;*/ d += linksSize;
|
||||||
|
dtPolyDetail* detailMeshes = (dtPolyDetail*)d; d += detailMeshesSize;
|
||||||
|
float* detailVerts = (float*)d; d += detailVertsSize;
|
||||||
|
/*unsigned char* detailTris = (unsigned char*)d;*/ d += detailTrisSize;
|
||||||
|
dtBVNode* bvTree = (dtBVNode*)d; d += bvtreeSize;
|
||||||
|
dtOffMeshConnection* offMeshCons = (dtOffMeshConnection*)d; d += offMeshLinksSize;
|
||||||
|
|
||||||
|
// Vertices
|
||||||
|
for (int i = 0; i < header->vertCount*3; ++i)
|
||||||
|
{
|
||||||
|
swapEndian(&verts[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Polys
|
||||||
|
for (int i = 0; i < header->polyCount; ++i)
|
||||||
|
{
|
||||||
|
dtPoly* p = &polys[i];
|
||||||
|
// poly->firstLink is update when tile is added, no need to swap.
|
||||||
|
for (int j = 0; j < DT_VERTS_PER_POLYGON; ++j)
|
||||||
|
{
|
||||||
|
swapEndian(&p->verts[j]);
|
||||||
|
swapEndian(&p->neis[j]);
|
||||||
|
}
|
||||||
|
swapEndian(&p->flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Links are rebuild when tile is added, no need to swap.
|
||||||
|
|
||||||
|
// Detail meshes
|
||||||
|
for (int i = 0; i < header->detailMeshCount; ++i)
|
||||||
|
{
|
||||||
|
dtPolyDetail* pd = &detailMeshes[i];
|
||||||
|
swapEndian(&pd->vertBase);
|
||||||
|
swapEndian(&pd->triBase);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Detail verts
|
||||||
|
for (int i = 0; i < header->detailVertCount*3; ++i)
|
||||||
|
{
|
||||||
|
swapEndian(&detailVerts[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// BV-tree
|
||||||
|
for (int i = 0; i < header->bvNodeCount; ++i)
|
||||||
|
{
|
||||||
|
dtBVNode* node = &bvTree[i];
|
||||||
|
for (int j = 0; j < 3; ++j)
|
||||||
|
{
|
||||||
|
swapEndian(&node->bmin[j]);
|
||||||
|
swapEndian(&node->bmax[j]);
|
||||||
|
}
|
||||||
|
swapEndian(&node->i);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Off-mesh Connections.
|
||||||
|
for (int i = 0; i < header->offMeshConCount; ++i)
|
||||||
|
{
|
||||||
|
dtOffMeshConnection* con = &offMeshCons[i];
|
||||||
|
for (int j = 0; j < 6; ++j)
|
||||||
|
swapEndian(&con->pos[j]);
|
||||||
|
swapEndian(&con->rad);
|
||||||
|
swapEndian(&con->poly);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
2564
dep/recastnavigation/Detour/Source/DetourNavMeshQuery.cpp
Normal file
2564
dep/recastnavigation/Detour/Source/DetourNavMeshQuery.cpp
Normal file
File diff suppressed because it is too large
Load diff
164
dep/recastnavigation/Detour/Source/DetourNode.cpp
Normal file
164
dep/recastnavigation/Detour/Source/DetourNode.cpp
Normal file
|
|
@ -0,0 +1,164 @@
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "DetourNode.h"
|
||||||
|
#include "DetourAlloc.h"
|
||||||
|
#include "DetourAssert.h"
|
||||||
|
#include "DetourCommon.h"
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
inline unsigned int dtHashRef(dtPolyRef a)
|
||||||
|
{
|
||||||
|
a = (~a) + (a << 18);
|
||||||
|
a = a ^ (a >> 31);
|
||||||
|
a = a * 21;
|
||||||
|
a = a ^ (a >> 11);
|
||||||
|
a = a + (a << 6);
|
||||||
|
a = a ^ (a >> 22);
|
||||||
|
return (unsigned int)a;
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
dtNodePool::dtNodePool(int maxNodes, int hashSize) :
|
||||||
|
m_nodes(0),
|
||||||
|
m_first(0),
|
||||||
|
m_next(0),
|
||||||
|
m_maxNodes(maxNodes),
|
||||||
|
m_hashSize(hashSize),
|
||||||
|
m_nodeCount(0)
|
||||||
|
{
|
||||||
|
dtAssert(dtNextPow2(m_hashSize) == (unsigned int)m_hashSize);
|
||||||
|
dtAssert(m_maxNodes > 0);
|
||||||
|
|
||||||
|
m_nodes = (dtNode*)dtAlloc(sizeof(dtNode)*m_maxNodes, DT_ALLOC_PERM);
|
||||||
|
m_next = (unsigned short*)dtAlloc(sizeof(unsigned short)*m_maxNodes, DT_ALLOC_PERM);
|
||||||
|
m_first = (unsigned short*)dtAlloc(sizeof(unsigned short)*hashSize, DT_ALLOC_PERM);
|
||||||
|
|
||||||
|
dtAssert(m_nodes);
|
||||||
|
dtAssert(m_next);
|
||||||
|
dtAssert(m_first);
|
||||||
|
|
||||||
|
memset(m_first, 0xff, sizeof(unsigned short)*m_hashSize);
|
||||||
|
memset(m_next, 0xff, sizeof(unsigned short)*m_maxNodes);
|
||||||
|
}
|
||||||
|
|
||||||
|
dtNodePool::~dtNodePool()
|
||||||
|
{
|
||||||
|
dtFree(m_nodes);
|
||||||
|
dtFree(m_next);
|
||||||
|
dtFree(m_first);
|
||||||
|
}
|
||||||
|
|
||||||
|
void dtNodePool::clear()
|
||||||
|
{
|
||||||
|
memset(m_first, 0xff, sizeof(unsigned short)*m_hashSize);
|
||||||
|
m_nodeCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
dtNode* dtNodePool::findNode(dtPolyRef id)
|
||||||
|
{
|
||||||
|
unsigned int bucket = dtHashRef(id) & (m_hashSize-1);
|
||||||
|
unsigned short i = m_first[bucket];
|
||||||
|
while (i != DT_NULL_IDX)
|
||||||
|
{
|
||||||
|
if (m_nodes[i].id == id)
|
||||||
|
return &m_nodes[i];
|
||||||
|
i = m_next[i];
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
dtNode* dtNodePool::getNode(dtPolyRef id)
|
||||||
|
{
|
||||||
|
unsigned int bucket = dtHashRef(id) & (m_hashSize-1);
|
||||||
|
unsigned short i = m_first[bucket];
|
||||||
|
dtNode* node = 0;
|
||||||
|
while (i != DT_NULL_IDX)
|
||||||
|
{
|
||||||
|
if (m_nodes[i].id == id)
|
||||||
|
return &m_nodes[i];
|
||||||
|
i = m_next[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_nodeCount >= m_maxNodes)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
i = (unsigned short)m_nodeCount;
|
||||||
|
m_nodeCount++;
|
||||||
|
|
||||||
|
// Init node
|
||||||
|
node = &m_nodes[i];
|
||||||
|
node->pidx = 0;
|
||||||
|
node->cost = 0;
|
||||||
|
node->total = 0;
|
||||||
|
node->id = id;
|
||||||
|
node->flags = 0;
|
||||||
|
|
||||||
|
m_next[i] = m_first[bucket];
|
||||||
|
m_first[bucket] = i;
|
||||||
|
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
dtNodeQueue::dtNodeQueue(int n) :
|
||||||
|
m_heap(0),
|
||||||
|
m_capacity(n),
|
||||||
|
m_size(0)
|
||||||
|
{
|
||||||
|
dtAssert(m_capacity > 0);
|
||||||
|
|
||||||
|
m_heap = (dtNode**)dtAlloc(sizeof(dtNode*)*(m_capacity+1), DT_ALLOC_PERM);
|
||||||
|
dtAssert(m_heap);
|
||||||
|
}
|
||||||
|
|
||||||
|
dtNodeQueue::~dtNodeQueue()
|
||||||
|
{
|
||||||
|
dtFree(m_heap);
|
||||||
|
}
|
||||||
|
|
||||||
|
void dtNodeQueue::bubbleUp(int i, dtNode* node)
|
||||||
|
{
|
||||||
|
int parent = (i-1)/2;
|
||||||
|
// note: (index > 0) means there is a parent
|
||||||
|
while ((i > 0) && (m_heap[parent]->total > node->total))
|
||||||
|
{
|
||||||
|
m_heap[i] = m_heap[parent];
|
||||||
|
i = parent;
|
||||||
|
parent = (i-1)/2;
|
||||||
|
}
|
||||||
|
m_heap[i] = node;
|
||||||
|
}
|
||||||
|
|
||||||
|
void dtNodeQueue::trickleDown(int i, dtNode* node)
|
||||||
|
{
|
||||||
|
int child = (i*2)+1;
|
||||||
|
while (child < m_size)
|
||||||
|
{
|
||||||
|
if (((child+1) < m_size) &&
|
||||||
|
(m_heap[child]->total > m_heap[child+1]->total))
|
||||||
|
{
|
||||||
|
child++;
|
||||||
|
}
|
||||||
|
m_heap[i] = m_heap[child];
|
||||||
|
i = child;
|
||||||
|
child = (i*2)+1;
|
||||||
|
}
|
||||||
|
bubbleUp(i, node);
|
||||||
|
}
|
||||||
532
dep/recastnavigation/Detour/Source/DetourObstacleAvoidance.cpp
Normal file
532
dep/recastnavigation/Detour/Source/DetourObstacleAvoidance.cpp
Normal file
|
|
@ -0,0 +1,532 @@
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "DetourObstacleAvoidance.h"
|
||||||
|
#include "DetourCommon.h"
|
||||||
|
#include "DetourAlloc.h"
|
||||||
|
#include "DetourAssert.h"
|
||||||
|
#include <string.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include <float.h>
|
||||||
|
#include <new>
|
||||||
|
|
||||||
|
|
||||||
|
static int sweepCircleCircle(const float* c0, const float r0, const float* v,
|
||||||
|
const float* c1, const float r1,
|
||||||
|
float& tmin, float& tmax)
|
||||||
|
{
|
||||||
|
static const float EPS = 0.0001f;
|
||||||
|
float s[3];
|
||||||
|
dtVsub(s,c1,c0);
|
||||||
|
float r = r0+r1;
|
||||||
|
float c = dtVdot2D(s,s) - r*r;
|
||||||
|
float a = dtVdot2D(v,v);
|
||||||
|
if (a < EPS) return 0; // not moving
|
||||||
|
|
||||||
|
// Overlap, calc time to exit.
|
||||||
|
float b = dtVdot2D(v,s);
|
||||||
|
float d = b*b - a*c;
|
||||||
|
if (d < 0.0f) return 0; // no intersection.
|
||||||
|
a = 1.0f / a;
|
||||||
|
const float rd = dtSqrt(d);
|
||||||
|
tmin = (b - rd) * a;
|
||||||
|
tmax = (b + rd) * a;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int isectRaySeg(const float* ap, const float* u,
|
||||||
|
const float* bp, const float* bq,
|
||||||
|
float& t)
|
||||||
|
{
|
||||||
|
float v[3], w[3];
|
||||||
|
dtVsub(v,bq,bp);
|
||||||
|
dtVsub(w,ap,bp);
|
||||||
|
float d = dtVperp2D(u,v);
|
||||||
|
if (fabsf(d) < 1e-6f) return 0;
|
||||||
|
d = 1.0f/d;
|
||||||
|
t = dtVperp2D(v,w) * d;
|
||||||
|
if (t < 0 || t > 1) return 0;
|
||||||
|
float s = dtVperp2D(u,w) * d;
|
||||||
|
if (s < 0 || s > 1) return 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
dtObstacleAvoidanceDebugData* dtAllocObstacleAvoidanceDebugData()
|
||||||
|
{
|
||||||
|
void* mem = dtAlloc(sizeof(dtObstacleAvoidanceDebugData), DT_ALLOC_PERM);
|
||||||
|
if (!mem) return 0;
|
||||||
|
return new(mem) dtObstacleAvoidanceDebugData;
|
||||||
|
}
|
||||||
|
|
||||||
|
void dtFreeObstacleAvoidanceDebugData(dtObstacleAvoidanceDebugData* ptr)
|
||||||
|
{
|
||||||
|
if (!ptr) return;
|
||||||
|
ptr->~dtObstacleAvoidanceDebugData();
|
||||||
|
dtFree(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
dtObstacleAvoidanceDebugData::dtObstacleAvoidanceDebugData() :
|
||||||
|
m_nsamples(0),
|
||||||
|
m_maxSamples(0),
|
||||||
|
m_vel(0),
|
||||||
|
m_ssize(0),
|
||||||
|
m_pen(0),
|
||||||
|
m_vpen(0),
|
||||||
|
m_vcpen(0),
|
||||||
|
m_spen(0),
|
||||||
|
m_tpen(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
dtObstacleAvoidanceDebugData::~dtObstacleAvoidanceDebugData()
|
||||||
|
{
|
||||||
|
dtFree(m_vel);
|
||||||
|
dtFree(m_ssize);
|
||||||
|
dtFree(m_pen);
|
||||||
|
dtFree(m_vpen);
|
||||||
|
dtFree(m_vcpen);
|
||||||
|
dtFree(m_spen);
|
||||||
|
dtFree(m_tpen);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dtObstacleAvoidanceDebugData::init(const int maxSamples)
|
||||||
|
{
|
||||||
|
dtAssert(maxSamples);
|
||||||
|
m_maxSamples = maxSamples;
|
||||||
|
|
||||||
|
m_vel = (float*)dtAlloc(sizeof(float)*3*m_maxSamples, DT_ALLOC_PERM);
|
||||||
|
if (!m_vel)
|
||||||
|
return false;
|
||||||
|
m_pen = (float*)dtAlloc(sizeof(float)*m_maxSamples, DT_ALLOC_PERM);
|
||||||
|
if (!m_pen)
|
||||||
|
return false;
|
||||||
|
m_ssize = (float*)dtAlloc(sizeof(float)*m_maxSamples, DT_ALLOC_PERM);
|
||||||
|
if (!m_ssize)
|
||||||
|
return false;
|
||||||
|
m_vpen = (float*)dtAlloc(sizeof(float)*m_maxSamples, DT_ALLOC_PERM);
|
||||||
|
if (!m_vpen)
|
||||||
|
return false;
|
||||||
|
m_vcpen = (float*)dtAlloc(sizeof(float)*m_maxSamples, DT_ALLOC_PERM);
|
||||||
|
if (!m_vcpen)
|
||||||
|
return false;
|
||||||
|
m_spen = (float*)dtAlloc(sizeof(float)*m_maxSamples, DT_ALLOC_PERM);
|
||||||
|
if (!m_spen)
|
||||||
|
return false;
|
||||||
|
m_tpen = (float*)dtAlloc(sizeof(float)*m_maxSamples, DT_ALLOC_PERM);
|
||||||
|
if (!m_tpen)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void dtObstacleAvoidanceDebugData::reset()
|
||||||
|
{
|
||||||
|
m_nsamples = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void dtObstacleAvoidanceDebugData::addSample(const float* vel, const float ssize, const float pen,
|
||||||
|
const float vpen, const float vcpen, const float spen, const float tpen)
|
||||||
|
{
|
||||||
|
if (m_nsamples >= m_maxSamples)
|
||||||
|
return;
|
||||||
|
dtAssert(m_vel);
|
||||||
|
dtAssert(m_ssize);
|
||||||
|
dtAssert(m_pen);
|
||||||
|
dtAssert(m_vpen);
|
||||||
|
dtAssert(m_vcpen);
|
||||||
|
dtAssert(m_spen);
|
||||||
|
dtAssert(m_tpen);
|
||||||
|
dtVcopy(&m_vel[m_nsamples*3], vel);
|
||||||
|
m_ssize[m_nsamples] = ssize;
|
||||||
|
m_pen[m_nsamples] = pen;
|
||||||
|
m_vpen[m_nsamples] = vpen;
|
||||||
|
m_vcpen[m_nsamples] = vcpen;
|
||||||
|
m_spen[m_nsamples] = spen;
|
||||||
|
m_tpen[m_nsamples] = tpen;
|
||||||
|
m_nsamples++;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void normalizeArray(float* arr, const int n)
|
||||||
|
{
|
||||||
|
// Normalize penaly range.
|
||||||
|
float minPen = FLT_MAX;
|
||||||
|
float maxPen = -FLT_MAX;
|
||||||
|
for (int i = 0; i < n; ++i)
|
||||||
|
{
|
||||||
|
minPen = dtMin(minPen, arr[i]);
|
||||||
|
maxPen = dtMax(maxPen, arr[i]);
|
||||||
|
}
|
||||||
|
const float penRange = maxPen-minPen;
|
||||||
|
const float s = penRange > 0.001f ? (1.0f / penRange) : 1;
|
||||||
|
for (int i = 0; i < n; ++i)
|
||||||
|
arr[i] = dtClamp((arr[i]-minPen)*s, 0.0f, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void dtObstacleAvoidanceDebugData::normalizeSamples()
|
||||||
|
{
|
||||||
|
normalizeArray(m_pen, m_nsamples);
|
||||||
|
normalizeArray(m_vpen, m_nsamples);
|
||||||
|
normalizeArray(m_vcpen, m_nsamples);
|
||||||
|
normalizeArray(m_spen, m_nsamples);
|
||||||
|
normalizeArray(m_tpen, m_nsamples);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
dtObstacleAvoidanceQuery* dtAllocObstacleAvoidanceQuery()
|
||||||
|
{
|
||||||
|
void* mem = dtAlloc(sizeof(dtObstacleAvoidanceQuery), DT_ALLOC_PERM);
|
||||||
|
if (!mem) return 0;
|
||||||
|
return new(mem) dtObstacleAvoidanceQuery;
|
||||||
|
}
|
||||||
|
|
||||||
|
void dtFreeObstacleAvoidanceQuery(dtObstacleAvoidanceQuery* ptr)
|
||||||
|
{
|
||||||
|
if (!ptr) return;
|
||||||
|
ptr->~dtObstacleAvoidanceQuery();
|
||||||
|
dtFree(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
dtObstacleAvoidanceQuery::dtObstacleAvoidanceQuery() :
|
||||||
|
m_velBias(0.0f),
|
||||||
|
m_weightDesVel(0.0f),
|
||||||
|
m_weightCurVel(0.0f),
|
||||||
|
m_weightSide(0.0f),
|
||||||
|
m_weightToi(0.0f),
|
||||||
|
m_horizTime(0.0f),
|
||||||
|
m_maxCircles(0),
|
||||||
|
m_circles(0),
|
||||||
|
m_ncircles(0),
|
||||||
|
m_maxSegments(0),
|
||||||
|
m_segments(0),
|
||||||
|
m_nsegments(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
dtObstacleAvoidanceQuery::~dtObstacleAvoidanceQuery()
|
||||||
|
{
|
||||||
|
dtFree(m_circles);
|
||||||
|
dtFree(m_segments);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dtObstacleAvoidanceQuery::init(const int maxCircles, const int maxSegments)
|
||||||
|
{
|
||||||
|
m_maxCircles = maxCircles;
|
||||||
|
m_ncircles = 0;
|
||||||
|
m_circles = (dtObstacleCircle*)dtAlloc(sizeof(dtObstacleCircle)*m_maxCircles, DT_ALLOC_PERM);
|
||||||
|
if (!m_circles)
|
||||||
|
return false;
|
||||||
|
memset(m_circles, 0, sizeof(dtObstacleCircle)*m_maxCircles);
|
||||||
|
|
||||||
|
m_maxSegments = maxSegments;
|
||||||
|
m_nsegments = 0;
|
||||||
|
m_segments = (dtObstacleSegment*)dtAlloc(sizeof(dtObstacleSegment)*m_maxSegments, DT_ALLOC_PERM);
|
||||||
|
if (!m_segments)
|
||||||
|
return false;
|
||||||
|
memset(m_segments, 0, sizeof(dtObstacleSegment)*m_maxSegments);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void dtObstacleAvoidanceQuery::reset()
|
||||||
|
{
|
||||||
|
m_ncircles = 0;
|
||||||
|
m_nsegments = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void dtObstacleAvoidanceQuery::addCircle(const float* pos, const float rad,
|
||||||
|
const float* vel, const float* dvel)
|
||||||
|
{
|
||||||
|
if (m_ncircles >= m_maxCircles)
|
||||||
|
return;
|
||||||
|
|
||||||
|
dtObstacleCircle* cir = &m_circles[m_ncircles++];
|
||||||
|
dtVcopy(cir->p, pos);
|
||||||
|
cir->rad = rad;
|
||||||
|
dtVcopy(cir->vel, vel);
|
||||||
|
dtVcopy(cir->dvel, dvel);
|
||||||
|
}
|
||||||
|
|
||||||
|
void dtObstacleAvoidanceQuery::addSegment(const float* p, const float* q)
|
||||||
|
{
|
||||||
|
if (m_nsegments > m_maxSegments)
|
||||||
|
return;
|
||||||
|
|
||||||
|
dtObstacleSegment* seg = &m_segments[m_nsegments++];
|
||||||
|
dtVcopy(seg->p, p);
|
||||||
|
dtVcopy(seg->q, q);
|
||||||
|
}
|
||||||
|
|
||||||
|
void dtObstacleAvoidanceQuery::prepare(const float* pos, const float* dvel)
|
||||||
|
{
|
||||||
|
// Prepare obstacles
|
||||||
|
for (int i = 0; i < m_ncircles; ++i)
|
||||||
|
{
|
||||||
|
dtObstacleCircle* cir = &m_circles[i];
|
||||||
|
|
||||||
|
// Side
|
||||||
|
const float* pa = pos;
|
||||||
|
const float* pb = cir->p;
|
||||||
|
|
||||||
|
const float orig[3] = {0,0};
|
||||||
|
float dv[3];
|
||||||
|
dtVsub(cir->dp,pb,pa);
|
||||||
|
dtVnormalize(cir->dp);
|
||||||
|
dtVsub(dv, cir->dvel, dvel);
|
||||||
|
|
||||||
|
const float a = dtTriArea2D(orig, cir->dp,dv);
|
||||||
|
if (a < 0.01f)
|
||||||
|
{
|
||||||
|
cir->np[0] = -cir->dp[2];
|
||||||
|
cir->np[2] = cir->dp[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cir->np[0] = cir->dp[2];
|
||||||
|
cir->np[2] = -cir->dp[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < m_nsegments; ++i)
|
||||||
|
{
|
||||||
|
dtObstacleSegment* seg = &m_segments[i];
|
||||||
|
|
||||||
|
// Precalc if the agent is really close to the segment.
|
||||||
|
const float r = 0.01f;
|
||||||
|
float t;
|
||||||
|
seg->touch = dtDistancePtSegSqr2D(pos, seg->p, seg->q, t) < dtSqr(r);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float dtObstacleAvoidanceQuery::processSample(const float* vcand, const float cs,
|
||||||
|
const float* pos, const float rad,
|
||||||
|
const float vmax, const float* vel, const float* dvel,
|
||||||
|
dtObstacleAvoidanceDebugData* debug)
|
||||||
|
{
|
||||||
|
// Find min time of impact and exit amongst all obstacles.
|
||||||
|
float tmin = m_horizTime;
|
||||||
|
float side = 0;
|
||||||
|
int nside = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < m_ncircles; ++i)
|
||||||
|
{
|
||||||
|
const dtObstacleCircle* cir = &m_circles[i];
|
||||||
|
|
||||||
|
// RVO
|
||||||
|
float vab[3];
|
||||||
|
dtVscale(vab, vcand, 2);
|
||||||
|
dtVsub(vab, vab, vel);
|
||||||
|
dtVsub(vab, vab, cir->vel);
|
||||||
|
|
||||||
|
// Side
|
||||||
|
side += dtClamp(dtMin(dtVdot2D(cir->dp,vab)*0.5f+0.5f, dtVdot2D(cir->np,vab)*2), 0.0f, 1.0f);
|
||||||
|
nside++;
|
||||||
|
|
||||||
|
float htmin = 0, htmax = 0;
|
||||||
|
if (!sweepCircleCircle(pos,rad, vab, cir->p,cir->rad, htmin, htmax))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Handle overlapping obstacles.
|
||||||
|
if (htmin < 0.0f && htmax > 0.0f)
|
||||||
|
{
|
||||||
|
// Avoid more when overlapped.
|
||||||
|
htmin = -htmin * 0.5f;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (htmin >= 0.0f)
|
||||||
|
{
|
||||||
|
// The closest obstacle is somewhere ahead of us, keep track of nearest obstacle.
|
||||||
|
if (htmin < tmin)
|
||||||
|
tmin = htmin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < m_nsegments; ++i)
|
||||||
|
{
|
||||||
|
const dtObstacleSegment* seg = &m_segments[i];
|
||||||
|
float htmin = 0;
|
||||||
|
|
||||||
|
if (seg->touch)
|
||||||
|
{
|
||||||
|
// Special case when the agent is very close to the segment.
|
||||||
|
float sdir[3], snorm[3];
|
||||||
|
dtVsub(sdir, seg->q, seg->p);
|
||||||
|
snorm[0] = -sdir[2];
|
||||||
|
snorm[2] = sdir[0];
|
||||||
|
// If the velocity is pointing towards the segment, no collision.
|
||||||
|
if (dtVdot2D(snorm, vcand) < 0.0f)
|
||||||
|
continue;
|
||||||
|
// Else immediate collision.
|
||||||
|
htmin = 0.0f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!isectRaySeg(pos, vcand, seg->p, seg->q, htmin))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Avoid less when facing walls.
|
||||||
|
htmin *= 2.0f;
|
||||||
|
|
||||||
|
// The closest obstacle is somewhere ahead of us, keep track of nearest obstacle.
|
||||||
|
if (htmin < tmin)
|
||||||
|
tmin = htmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Normalize side bias, to prevent it dominating too much.
|
||||||
|
if (nside)
|
||||||
|
side /= nside;
|
||||||
|
|
||||||
|
const float ivmax = 1.0f / vmax;
|
||||||
|
const float vpen = m_weightDesVel * (dtVdist2D(vcand, dvel) * ivmax);
|
||||||
|
const float vcpen = m_weightCurVel * (dtVdist2D(vcand, vel) * ivmax);
|
||||||
|
const float spen = m_weightSide * side;
|
||||||
|
const float tpen = m_weightToi * (1.0f/(0.1f+tmin / m_horizTime));
|
||||||
|
|
||||||
|
const float penalty = vpen + vcpen + spen + tpen;
|
||||||
|
|
||||||
|
// Store different penalties for debug viewing
|
||||||
|
if (debug)
|
||||||
|
debug->addSample(vcand, cs, penalty, vpen, vcpen, spen, tpen);
|
||||||
|
|
||||||
|
return penalty;
|
||||||
|
}
|
||||||
|
|
||||||
|
void dtObstacleAvoidanceQuery::sampleVelocityGrid(const float* pos, const float rad, const float vmax,
|
||||||
|
const float* vel, const float* dvel,
|
||||||
|
float* nvel, const int gsize,
|
||||||
|
dtObstacleAvoidanceDebugData* debug)
|
||||||
|
{
|
||||||
|
prepare(pos, dvel);
|
||||||
|
|
||||||
|
dtVset(nvel, 0,0,0);
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
debug->reset();
|
||||||
|
|
||||||
|
const float cvx = dvel[0] * m_velBias;
|
||||||
|
const float cvz = dvel[2] * m_velBias;
|
||||||
|
const float cs = vmax * 2 * (1 - m_velBias) / (float)(gsize-1);
|
||||||
|
const float half = (gsize-1)*cs*0.5f;
|
||||||
|
|
||||||
|
float minPenalty = FLT_MAX;
|
||||||
|
|
||||||
|
for (int y = 0; y < gsize; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < gsize; ++x)
|
||||||
|
{
|
||||||
|
float vcand[3];
|
||||||
|
vcand[0] = cvx + x*cs - half;
|
||||||
|
vcand[1] = 0;
|
||||||
|
vcand[2] = cvz + y*cs - half;
|
||||||
|
|
||||||
|
if (dtSqr(vcand[0])+dtSqr(vcand[2]) > dtSqr(vmax+cs/2)) continue;
|
||||||
|
|
||||||
|
const float penalty = processSample(vcand, cs, pos,rad,vmax,vel,dvel, debug);
|
||||||
|
if (penalty < minPenalty)
|
||||||
|
{
|
||||||
|
minPenalty = penalty;
|
||||||
|
dtVcopy(nvel, vcand);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static const float DT_PI = 3.14159265f;
|
||||||
|
|
||||||
|
void dtObstacleAvoidanceQuery::sampleVelocityAdaptive(const float* pos, const float rad, const float vmax,
|
||||||
|
const float* vel, const float* dvel, float* nvel,
|
||||||
|
const int ndivs, const int nrings, const int depth,
|
||||||
|
dtObstacleAvoidanceDebugData* debug)
|
||||||
|
{
|
||||||
|
prepare(pos, dvel);
|
||||||
|
|
||||||
|
dtVset(nvel, 0,0,0);
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
debug->reset();
|
||||||
|
|
||||||
|
// Build sampling pattern aligned to desired velocity.
|
||||||
|
static const int MAX_PATTERN_DIVS = 32;
|
||||||
|
static const int MAX_PATTERN_RINGS = 4;
|
||||||
|
float pat[(MAX_PATTERN_DIVS*MAX_PATTERN_RINGS+1)*2];
|
||||||
|
int npat = 0;
|
||||||
|
|
||||||
|
const int nd = dtClamp(ndivs, 1, MAX_PATTERN_DIVS);
|
||||||
|
const int nr = dtClamp(nrings, 1, MAX_PATTERN_RINGS);
|
||||||
|
const float da = (1.0f/nd) * DT_PI*2;
|
||||||
|
const float dang = atan2f(dvel[2], dvel[0]);
|
||||||
|
|
||||||
|
// Always add sample at zero
|
||||||
|
pat[npat*2+0] = 0;
|
||||||
|
pat[npat*2+1] = 0;
|
||||||
|
npat++;
|
||||||
|
|
||||||
|
for (int j = 0; j < nr; ++j)
|
||||||
|
{
|
||||||
|
const float rad = (float)(nr-j)/(float)nr;
|
||||||
|
float a = dang + (j&1)*0.5f*da;
|
||||||
|
for (int i = 0; i < nd; ++i)
|
||||||
|
{
|
||||||
|
pat[npat*2+0] = cosf(a)*rad;
|
||||||
|
pat[npat*2+1] = sinf(a)*rad;
|
||||||
|
npat++;
|
||||||
|
a += da;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start sampling.
|
||||||
|
float cr = vmax * (1.0f-m_velBias);
|
||||||
|
float res[3];
|
||||||
|
dtVset(res, dvel[0] * m_velBias, 0, dvel[2] * m_velBias);
|
||||||
|
|
||||||
|
for (int k = 0; k < depth; ++k)
|
||||||
|
{
|
||||||
|
float minPenalty = FLT_MAX;
|
||||||
|
float bvel[3];
|
||||||
|
dtVset(bvel, 0,0,0);
|
||||||
|
|
||||||
|
for (int i = 0; i < npat; ++i)
|
||||||
|
{
|
||||||
|
float vcand[3];
|
||||||
|
vcand[0] = res[0] + pat[i*2+0]*cr;
|
||||||
|
vcand[1] = 0;
|
||||||
|
vcand[2] = res[2] + pat[i*2+1]*cr;
|
||||||
|
|
||||||
|
if (dtSqr(vcand[0])+dtSqr(vcand[2]) > dtSqr(vmax+0.001f)) continue;
|
||||||
|
|
||||||
|
const float penalty = processSample(vcand,cr/10, pos,rad,vmax,vel,dvel, debug);
|
||||||
|
if (penalty < minPenalty)
|
||||||
|
{
|
||||||
|
minPenalty = penalty;
|
||||||
|
dtVcopy(bvel, vcand);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dtVcopy(res, bvel);
|
||||||
|
|
||||||
|
cr *= 0.5f;
|
||||||
|
}
|
||||||
|
|
||||||
|
dtVcopy(nvel, res);
|
||||||
|
}
|
||||||
|
|
||||||
20
dep/recastnavigation/Detour/win/Detour_VC100.sln
Normal file
20
dep/recastnavigation/Detour/win/Detour_VC100.sln
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||||
|
# Visual Studio 2010
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Detour", "VC100\Detour.vcxproj", "{72BDF975-4D4A-42C7-B2C4-F9ED90A2ABB6}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Win32 = Debug|Win32
|
||||||
|
Release|Win32 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{72BDF975-4D4A-42C7-B2C4-F9ED90A2ABB6}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{72BDF975-4D4A-42C7-B2C4-F9ED90A2ABB6}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{72BDF975-4D4A-42C7-B2C4-F9ED90A2ABB6}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{72BDF975-4D4A-42C7-B2C4-F9ED90A2ABB6}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
20
dep/recastnavigation/Detour/win/Detour_VC90.sln
Normal file
20
dep/recastnavigation/Detour/win/Detour_VC90.sln
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||||
|
# Visual Studio 2008
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Detour", "VC90\Detour.vcproj", "{5FDC0EBC-3F80-4518-A5DF-1CD5BBEB64F7}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Win32 = Debug|Win32
|
||||||
|
Release|Win32 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{5FDC0EBC-3F80-4518-A5DF-1CD5BBEB64F7}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{5FDC0EBC-3F80-4518-A5DF-1CD5BBEB64F7}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{5FDC0EBC-3F80-4518-A5DF-1CD5BBEB64F7}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{5FDC0EBC-3F80-4518-A5DF-1CD5BBEB64F7}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
6
dep/recastnavigation/Detour/win/VC100/.gitignore
vendored
Normal file
6
dep/recastnavigation/Detour/win/VC100/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
*__Win32_Release
|
||||||
|
*__Win32_Debug
|
||||||
|
*__x64_Release
|
||||||
|
*__x64_Debug
|
||||||
|
*.user
|
||||||
162
dep/recastnavigation/Detour/win/VC100/Detour.vcxproj
Normal file
162
dep/recastnavigation/Detour/win/VC100/Detour.vcxproj
Normal file
|
|
@ -0,0 +1,162 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{72BDF975-4D4A-42C7-B2C4-F9ED90A2ABB6}</ProjectGuid>
|
||||||
|
<RootNamespace>Detour</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<OutDir>$(ProjectDir)\..\..\..\..\lib\$(Platform)_$(Configuration)\</OutDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<OutDir>$(ProjectDir)\..\..\..\..\lib\$(Platform)_$(Configuration)\</OutDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<IntDir>.\$(ProjectName)__$(Platform)_$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<IntDir>.\$(ProjectName)__$(Platform)_$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<OutDir>$(ProjectDir)\..\..\..\..\lib\$(Platform)_$(Configuration)\</OutDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<OutDir>$(ProjectDir)\..\..\..\..\lib\$(Platform)_$(Configuration)\</OutDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<IntDir>.\$(ProjectName)__$(Platform)_$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<IntDir>.\$(ProjectName)__$(Platform)_$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
|
||||||
|
<PreprocessorDefinitions>WIN32;DEBUG;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
|
||||||
|
<PreprocessorDefinitions>WIN32;DEBUG;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\Include\DetourAlloc.h" />
|
||||||
|
<ClInclude Include="..\..\Include\DetourAssert.h" />
|
||||||
|
<ClInclude Include="..\..\Include\DetourCommon.h" />
|
||||||
|
<ClInclude Include="..\..\Include\DetourNavMesh.h" />
|
||||||
|
<ClInclude Include="..\..\Include\DetourNavMeshBuilder.h" />
|
||||||
|
<ClInclude Include="..\..\Include\DetourNavMeshQuery.h" />
|
||||||
|
<ClInclude Include="..\..\Include\DetourNode.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\Source\DetourAlloc.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\DetourCommon.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\DetourNavMesh.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\DetourNavMeshBuilder.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\DetourNavMeshQuery.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\DetourNode.cpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
54
dep/recastnavigation/Detour/win/VC100/Detour.vcxproj.filters
Normal file
54
dep/recastnavigation/Detour/win/VC100/Detour.vcxproj.filters
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="src">
|
||||||
|
<UniqueIdentifier>{93bb99d1-034f-421d-abf2-856b22079565}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="include">
|
||||||
|
<UniqueIdentifier>{661147bd-4839-4f24-8697-6ce5cb9b61a2}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\Include\DetourAlloc.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Include\DetourCommon.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Include\DetourNavMesh.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Include\DetourNavMeshBuilder.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Include\DetourNode.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Include\DetourAssert.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Include\DetourNavMeshQuery.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\Source\DetourAlloc.cpp">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\DetourCommon.cpp">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\DetourNavMesh.cpp">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\DetourNavMeshBuilder.cpp">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\DetourNode.cpp">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\DetourNavMeshQuery.cpp">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
6
dep/recastnavigation/Detour/win/VC90/.gitignore
vendored
Normal file
6
dep/recastnavigation/Detour/win/VC90/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
*__Win32_Release
|
||||||
|
*__Win32_Debug
|
||||||
|
*__x64_Release
|
||||||
|
*__x64_Debug
|
||||||
|
*.user
|
||||||
336
dep/recastnavigation/Detour/win/VC90/Detour.vcproj
Normal file
336
dep/recastnavigation/Detour/win/VC90/Detour.vcproj
Normal file
|
|
@ -0,0 +1,336 @@
|
||||||
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
|
<VisualStudioProject
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="9.00"
|
||||||
|
Name="Detour"
|
||||||
|
ProjectGUID="{5FDC0EBC-3F80-4518-A5DF-1CD5BBEB64F7}"
|
||||||
|
RootNamespace="Detour_VC90"
|
||||||
|
TargetFrameworkVersion="196613"
|
||||||
|
>
|
||||||
|
<Platforms>
|
||||||
|
<Platform
|
||||||
|
Name="Win32"
|
||||||
|
/>
|
||||||
|
<Platform
|
||||||
|
Name="x64"
|
||||||
|
/>
|
||||||
|
</Platforms>
|
||||||
|
<ToolFiles>
|
||||||
|
</ToolFiles>
|
||||||
|
<Configurations>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
OutputDirectory="$(ProjectDir)\..\..\..\..\lib\$(PlatformName)_$(ConfigurationName)\"
|
||||||
|
IntermediateDirectory=".\$(ProjectName)__$(PlatformName)_$(ConfigurationName)\"
|
||||||
|
ConfigurationType="4"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories="..\..\include"
|
||||||
|
PreprocessorDefinitions="WIN32;DEBUG;"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="3"
|
||||||
|
WarningLevel="3"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLibrarianTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
OutputDirectory="$(ProjectDir)\..\..\..\..\lib\$(PlatformName)_$(ConfigurationName)\"
|
||||||
|
IntermediateDirectory=".\$(ProjectName)__$(PlatformName)_$(ConfigurationName)\"
|
||||||
|
ConfigurationType="4"
|
||||||
|
CharacterSet="2"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="2"
|
||||||
|
EnableIntrinsicFunctions="true"
|
||||||
|
AdditionalIncludeDirectories="..\..\include"
|
||||||
|
PreprocessorDefinitions="WIN32;NDEBUG;"
|
||||||
|
RuntimeLibrary="2"
|
||||||
|
EnableFunctionLevelLinking="true"
|
||||||
|
WarningLevel="3"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLibrarianTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|x64"
|
||||||
|
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||||
|
ConfigurationType="4"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
TargetEnvironment="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories="..\..\include"
|
||||||
|
PreprocessorDefinitions="WIN32;DEBUG;"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="3"
|
||||||
|
WarningLevel="3"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLibrarianTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|x64"
|
||||||
|
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||||
|
ConfigurationType="4"
|
||||||
|
CharacterSet="2"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
TargetEnvironment="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="2"
|
||||||
|
EnableIntrinsicFunctions="true"
|
||||||
|
AdditionalIncludeDirectories="..\..\include"
|
||||||
|
PreprocessorDefinitions="WIN32;NDEBUG;"
|
||||||
|
RuntimeLibrary="2"
|
||||||
|
EnableFunctionLevelLinking="true"
|
||||||
|
WarningLevel="3"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLibrarianTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
</Configurations>
|
||||||
|
<References>
|
||||||
|
</References>
|
||||||
|
<Files>
|
||||||
|
<Filter
|
||||||
|
Name="include"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\DetourAlloc.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\DetourAssert.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\DetourCommon.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\DetourNavMesh.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\DetourNavMeshBuilder.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\DetourNavMeshQuery.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\DetourNode.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="src"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\DetourAlloc.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\DetourCommon.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\DetourNavMesh.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\DetourNavMeshBuilder.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\DetourNavMeshQuery.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\DetourNode.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
</Files>
|
||||||
|
<Globals>
|
||||||
|
</Globals>
|
||||||
|
</VisualStudioProject>
|
||||||
18
dep/recastnavigation/License.txt
Normal file
18
dep/recastnavigation/License.txt
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
Copyright (c) 2009 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.
|
||||||
|
|
||||||
120
dep/recastnavigation/Readme.txt
Normal file
120
dep/recastnavigation/Readme.txt
Normal file
|
|
@ -0,0 +1,120 @@
|
||||||
|
|
||||||
|
Recast & Detour Version 1.4
|
||||||
|
|
||||||
|
|
||||||
|
Recast
|
||||||
|
|
||||||
|
Recast is state of the art navigation mesh construction toolset for games.
|
||||||
|
|
||||||
|
* It is automatic, which means that you can throw any level geometry
|
||||||
|
at it and you will get robust mesh out
|
||||||
|
* It is fast which means swift turnaround times for level designers
|
||||||
|
* It is open source so it comes with full source and you can
|
||||||
|
customize it to your hearts content.
|
||||||
|
|
||||||
|
The Recast process starts with constructing a voxel mold from a level geometry
|
||||||
|
and then casting a navigation mesh over it. The process consists of three steps,
|
||||||
|
building the voxel mold, partitioning the mold into simple regions, peeling off
|
||||||
|
the regions as simple polygons.
|
||||||
|
|
||||||
|
1. The voxel mold is build from the input triangle mesh by rasterizing
|
||||||
|
the triangles into a multi-layer heightfield. Some simple filters are
|
||||||
|
then applied to the mold to prune out locations where the character
|
||||||
|
would not be able to move.
|
||||||
|
2. The walkable areas described by the mold are divided into simple
|
||||||
|
overlayed 2D regions. The resulting regions have only one non-overlapping
|
||||||
|
contour, which simplifies the final step of the process tremendously.
|
||||||
|
3. The navigation polygons are peeled off from the regions by first tracing
|
||||||
|
the boundaries and then simplifying them. The resulting polygons are
|
||||||
|
finally converted to convex polygons which makes them perfect for
|
||||||
|
pathfinding and spatial reasoning about the level.
|
||||||
|
|
||||||
|
The toolset code is located in the Recast folder and demo application using the Recast
|
||||||
|
toolset is located in the RecastDemo folder.
|
||||||
|
|
||||||
|
The project files with this distribution can be compiled with Microsoft Visual C++ 2008
|
||||||
|
(you can download it for free) and XCode 3.1.
|
||||||
|
|
||||||
|
|
||||||
|
Detour
|
||||||
|
|
||||||
|
Recast is accompanied with Detour, path-finding and spatial reasoning toolkit. You can use any navigation mesh with Detour, but of course the data generated with Recast fits perfectly.
|
||||||
|
|
||||||
|
Detour offers simple static navigation mesh which is suitable for many simple cases, as well as tiled navigation mesh which allows you to plug in and out pieces of the mesh. The tiled mesh allows to create systems where you stream new navigation data in and out as the player progresses the level, or you may regenerate tiles as the world changes.
|
||||||
|
|
||||||
|
|
||||||
|
Latest code available at http://code.google.com/p/recastnavigation/
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
|
||||||
|
Release Notes
|
||||||
|
|
||||||
|
----------------
|
||||||
|
* Recast 1.4
|
||||||
|
Released August 24th, 2009
|
||||||
|
|
||||||
|
- Added detail height mesh generation (RecastDetailMesh.cpp) for single,
|
||||||
|
tiled statmeshes as well as tilemesh.
|
||||||
|
- Added feature to contour tracing which detects extra vertices along
|
||||||
|
tile edges which should be removed later.
|
||||||
|
- Changed the tiled stat mesh preprocess, so that it first generated
|
||||||
|
polymeshes per tile and finally combines them.
|
||||||
|
- Fixed bug in the GUI code where invisible buttons could be pressed.
|
||||||
|
|
||||||
|
----------------
|
||||||
|
* Recast 1.31
|
||||||
|
Released July 24th, 2009
|
||||||
|
|
||||||
|
- Better cost and heuristic functions.
|
||||||
|
- Fixed tile navmesh raycast on tile borders.
|
||||||
|
|
||||||
|
----------------
|
||||||
|
* Recast 1.3
|
||||||
|
Released July 14th, 2009
|
||||||
|
|
||||||
|
- Added dtTileNavMesh which allows to dynamically add and remove navmesh pieces at runtime.
|
||||||
|
- Renamed stat navmesh types to dtStat* (i.e. dtPoly is now dtStatPoly).
|
||||||
|
- Moved common code used by tile and stat navmesh to DetourNode.h/cpp and DetourCommon.h/cpp.
|
||||||
|
- Refactores the demo code.
|
||||||
|
|
||||||
|
----------------
|
||||||
|
* Recast 1.2
|
||||||
|
Released June 17th, 2009
|
||||||
|
|
||||||
|
- Added tiled mesh generation. The tiled generation allows to generate navigation for
|
||||||
|
much larger worlds, it removes some of the artifacts that comes from distance fields
|
||||||
|
in open areas, and allows later streaming and dynamic runtime generation
|
||||||
|
- Improved and added some debug draw modes
|
||||||
|
- API change: The helper function rcBuildNavMesh does not exists anymore,
|
||||||
|
had to change few internal things to cope with the tiled processing,
|
||||||
|
similar API functionality will be added later once the tiled process matures
|
||||||
|
- The demo is getting way too complicated, need to split demos
|
||||||
|
- Fixed several filtering functions so that the mesh is tighter to the geometry,
|
||||||
|
sometimes there could be up error up to tow voxel units close to walls,
|
||||||
|
now it should be just one.
|
||||||
|
|
||||||
|
----------------
|
||||||
|
* Recast 1.1
|
||||||
|
Released April 11th, 2009
|
||||||
|
|
||||||
|
This is the first release of Detour.
|
||||||
|
|
||||||
|
----------------
|
||||||
|
* Recast 1.0
|
||||||
|
Released March 29th, 2009
|
||||||
|
|
||||||
|
This is the first release of Recast.
|
||||||
|
|
||||||
|
The process is not always as robust as I would wish. The watershed phase sometimes swallows tiny islands
|
||||||
|
which are close to edges. These droppings are handled in rcBuildContours, but the code is not
|
||||||
|
particularly robust either.
|
||||||
|
|
||||||
|
Another non-robust case is when portal contours (contours shared between two regions) are always
|
||||||
|
assumed to be straight. That can lead to overlapping contours specially when the level has
|
||||||
|
large open areas.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Mikko Mononen
|
||||||
|
memon@inside.org
|
||||||
688
dep/recastnavigation/Recast/Include/Recast.h
Normal file
688
dep/recastnavigation/Recast/Include/Recast.h
Normal file
|
|
@ -0,0 +1,688 @@
|
||||||
|
//
|
||||||
|
// 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 RECAST_H
|
||||||
|
#define RECAST_H
|
||||||
|
|
||||||
|
// Some math headers don't have PI defined.
|
||||||
|
static const float RC_PI = 3.14159265f;
|
||||||
|
|
||||||
|
enum rcLogCategory
|
||||||
|
{
|
||||||
|
RC_LOG_PROGRESS = 1,
|
||||||
|
RC_LOG_WARNING,
|
||||||
|
RC_LOG_ERROR,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum rcTimerLabel
|
||||||
|
{
|
||||||
|
RC_TIMER_TOTAL,
|
||||||
|
RC_TIMER_TEMP,
|
||||||
|
RC_TIMER_RASTERIZE_TRIANGLES,
|
||||||
|
RC_TIMER_BUILD_COMPACTHEIGHTFIELD,
|
||||||
|
RC_TIMER_BUILD_CONTOURS,
|
||||||
|
RC_TIMER_BUILD_CONTOURS_TRACE,
|
||||||
|
RC_TIMER_BUILD_CONTOURS_SIMPLIFY,
|
||||||
|
RC_TIMER_FILTER_BORDER,
|
||||||
|
RC_TIMER_FILTER_WALKABLE,
|
||||||
|
RC_TIMER_MEDIAN_AREA,
|
||||||
|
RC_TIMER_FILTER_LOW_OBSTACLES,
|
||||||
|
RC_TIMER_BUILD_POLYMESH,
|
||||||
|
RC_TIMER_MERGE_POLYMESH,
|
||||||
|
RC_TIMER_ERODE_AREA,
|
||||||
|
RC_TIMER_MARK_BOX_AREA,
|
||||||
|
RC_TIMER_MARK_CONVEXPOLY_AREA,
|
||||||
|
RC_TIMER_BUILD_DISTANCEFIELD,
|
||||||
|
RC_TIMER_BUILD_DISTANCEFIELD_DIST,
|
||||||
|
RC_TIMER_BUILD_DISTANCEFIELD_BLUR,
|
||||||
|
RC_TIMER_BUILD_REGIONS,
|
||||||
|
RC_TIMER_BUILD_REGIONS_WATERSHED,
|
||||||
|
RC_TIMER_BUILD_REGIONS_EXPAND,
|
||||||
|
RC_TIMER_BUILD_REGIONS_FLOOD,
|
||||||
|
RC_TIMER_BUILD_REGIONS_FILTER,
|
||||||
|
RC_TIMER_BUILD_POLYMESHDETAIL,
|
||||||
|
RC_TIMER_MERGE_POLYMESHDETAIL,
|
||||||
|
RC_MAX_TIMERS
|
||||||
|
};
|
||||||
|
|
||||||
|
// Build context provides several optional utilities needed for the build process,
|
||||||
|
// such as timing, logging, and build time collecting.
|
||||||
|
class rcContext
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
inline rcContext(bool state = true) : m_logEnabled(state), m_timerEnabled(state) {}
|
||||||
|
virtual ~rcContext() {}
|
||||||
|
|
||||||
|
// Enables or disables logging.
|
||||||
|
inline void enableLog(bool state) { m_logEnabled = state; }
|
||||||
|
// Resets log.
|
||||||
|
inline void resetLog() { if (m_logEnabled) doResetLog(); }
|
||||||
|
// Logs a message.
|
||||||
|
void log(const rcLogCategory category, const char* format, ...);
|
||||||
|
|
||||||
|
// Enables or disables timer.
|
||||||
|
inline void enableTimer(bool state) { m_timerEnabled = state; }
|
||||||
|
// Resets all timers.
|
||||||
|
inline void resetTimers() { if (m_timerEnabled) doResetTimers(); }
|
||||||
|
// Starts timer, used for performance timing.
|
||||||
|
inline void startTimer(const rcTimerLabel label) { if (m_timerEnabled) doStartTimer(label); }
|
||||||
|
// Stops timer, used for performance timing.
|
||||||
|
inline void stopTimer(const rcTimerLabel label) { if (m_timerEnabled) doStopTimer(label); }
|
||||||
|
// Returns time accumulated between timer start/stop.
|
||||||
|
inline int getAccumulatedTime(const rcTimerLabel label) const { return m_timerEnabled ? doGetAccumulatedTime(label) : -1; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Virtual functions to override for custom implementations.
|
||||||
|
virtual void doResetLog() {}
|
||||||
|
virtual void doLog(const rcLogCategory /*category*/, const char* /*msg*/, const int /*len*/) {}
|
||||||
|
virtual void doResetTimers() {}
|
||||||
|
virtual void doStartTimer(const rcTimerLabel /*label*/) {}
|
||||||
|
virtual void doStopTimer(const rcTimerLabel /*label*/) {}
|
||||||
|
virtual int doGetAccumulatedTime(const rcTimerLabel /*label*/) const { return -1; }
|
||||||
|
|
||||||
|
bool m_logEnabled;
|
||||||
|
bool m_timerEnabled;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// The units of the parameters are specified in parenthesis as follows:
|
||||||
|
// (vx) voxels, (wu) world units
|
||||||
|
struct rcConfig
|
||||||
|
{
|
||||||
|
int width, height; // Dimensions of the rasterized heightfield (vx)
|
||||||
|
int tileSize; // Width and Height of a tile (vx)
|
||||||
|
int borderSize; // Non-navigable Border around the heightfield (vx)
|
||||||
|
float cs, ch; // Grid cell size and height (wu)
|
||||||
|
float bmin[3], bmax[3]; // Grid bounds (wu)
|
||||||
|
float walkableSlopeAngle; // Maximum walkable slope angle in degrees.
|
||||||
|
int walkableHeight; // Minimum height where the agent can still walk (vx)
|
||||||
|
int walkableClimb; // Maximum height between grid cells the agent can climb (vx)
|
||||||
|
int walkableRadius; // Radius of the agent in cells (vx)
|
||||||
|
int maxEdgeLen; // Maximum contour edge length (vx)
|
||||||
|
float maxSimplificationError; // Maximum distance error from contour to cells (vx)
|
||||||
|
int minRegionArea; // Regions whose area is smaller than this threshold will be removed. (vx)
|
||||||
|
int mergeRegionArea; // Regions whose area is smaller than this threshold will be merged (vx)
|
||||||
|
int maxVertsPerPoly; // Max number of vertices per polygon
|
||||||
|
float detailSampleDist; // Detail mesh sample spacing.
|
||||||
|
float detailSampleMaxError; // Detail mesh simplification max sample error.
|
||||||
|
};
|
||||||
|
|
||||||
|
// Define number of bits in the above structure for smin/smax.
|
||||||
|
// The max height is used for clamping rasterized values.
|
||||||
|
static const int RC_SPAN_HEIGHT_BITS = 16;
|
||||||
|
static const int RC_SPAN_MAX_HEIGHT = (1<<RC_SPAN_HEIGHT_BITS)-1;
|
||||||
|
|
||||||
|
// Heightfield span.
|
||||||
|
struct rcSpan
|
||||||
|
{
|
||||||
|
unsigned int smin : 16; // Span min height.
|
||||||
|
unsigned int smax : 16; // Span max height.
|
||||||
|
unsigned char area; // Span area type.
|
||||||
|
rcSpan* next; // Next span in column.
|
||||||
|
};
|
||||||
|
|
||||||
|
// Number of spans allocated per pool.
|
||||||
|
static const int RC_SPANS_PER_POOL = 2048;
|
||||||
|
|
||||||
|
// Memory pool used for quick span allocation.
|
||||||
|
struct rcSpanPool
|
||||||
|
{
|
||||||
|
rcSpanPool* next; // Pointer to next pool.
|
||||||
|
rcSpan items[RC_SPANS_PER_POOL]; // Array of spans.
|
||||||
|
};
|
||||||
|
|
||||||
|
// Dynamic span-heightfield.
|
||||||
|
struct rcHeightfield
|
||||||
|
{
|
||||||
|
int width, height; // Dimension of the heightfield.
|
||||||
|
float bmin[3], bmax[3]; // Bounding box of the heightfield
|
||||||
|
float cs, ch; // Cell size and height.
|
||||||
|
rcSpan** spans; // Heightfield of spans (width*height).
|
||||||
|
rcSpanPool* pools; // Linked list of span pools.
|
||||||
|
rcSpan* freelist; // Pointer to next free span.
|
||||||
|
};
|
||||||
|
|
||||||
|
rcHeightfield* rcAllocHeightfield();
|
||||||
|
void rcFreeHeightField(rcHeightfield* hf);
|
||||||
|
|
||||||
|
|
||||||
|
struct rcCompactCell
|
||||||
|
{
|
||||||
|
unsigned int index : 24; // Index to first span in column.
|
||||||
|
unsigned int count : 8; // Number of spans in this column.
|
||||||
|
};
|
||||||
|
|
||||||
|
struct rcCompactSpan
|
||||||
|
{
|
||||||
|
unsigned short y; // Bottom coordinate of the span.
|
||||||
|
unsigned short reg;
|
||||||
|
unsigned int con : 24; // Connections to neighbour cells.
|
||||||
|
unsigned int h : 8; // Height of the span.
|
||||||
|
};
|
||||||
|
|
||||||
|
// Compact static heightfield.
|
||||||
|
struct rcCompactHeightfield
|
||||||
|
{
|
||||||
|
int width, height; // Width and height of the heightfield.
|
||||||
|
int spanCount; // Number of spans in the heightfield.
|
||||||
|
int walkableHeight, walkableClimb; // Agent properties.
|
||||||
|
unsigned short maxDistance; // Maximum distance value stored in heightfield.
|
||||||
|
unsigned short maxRegions; // Maximum Region Id stored in heightfield.
|
||||||
|
float bmin[3], bmax[3]; // Bounding box of the heightfield.
|
||||||
|
float cs, ch; // Cell size and height.
|
||||||
|
rcCompactCell* cells; // Pointer to width*height cells.
|
||||||
|
rcCompactSpan* spans; // Pointer to spans.
|
||||||
|
unsigned short* dist; // Pointer to per span distance to border.
|
||||||
|
unsigned char* areas; // Pointer to per span area ID.
|
||||||
|
};
|
||||||
|
|
||||||
|
rcCompactHeightfield* rcAllocCompactHeightfield();
|
||||||
|
void rcFreeCompactHeightfield(rcCompactHeightfield* chf);
|
||||||
|
|
||||||
|
|
||||||
|
struct rcContour
|
||||||
|
{
|
||||||
|
int* verts; // Vertex coordinates, each vertex contains 4 components.
|
||||||
|
int nverts; // Number of vertices.
|
||||||
|
int* rverts; // Raw vertex coordinates, each vertex contains 4 components.
|
||||||
|
int nrverts; // Number of raw vertices.
|
||||||
|
unsigned short reg; // Region ID of the contour.
|
||||||
|
unsigned char area; // Area ID of the contour.
|
||||||
|
};
|
||||||
|
|
||||||
|
struct rcContourSet
|
||||||
|
{
|
||||||
|
rcContour* conts; // Pointer to all contours.
|
||||||
|
int nconts; // Number of contours.
|
||||||
|
float bmin[3], bmax[3]; // Bounding box of the heightfield.
|
||||||
|
float cs, ch; // Cell size and height.
|
||||||
|
};
|
||||||
|
|
||||||
|
rcContourSet* rcAllocContourSet();
|
||||||
|
void rcFreeContourSet(rcContourSet* cset);
|
||||||
|
|
||||||
|
|
||||||
|
// Polymesh store a connected mesh of polygons.
|
||||||
|
// The polygons are store in an array where each polygons takes
|
||||||
|
// 'nvp*2' elements. The first 'nvp' elements are indices to vertices
|
||||||
|
// and the second 'nvp' elements are indices to neighbour polygons.
|
||||||
|
// If a polygon has less than 'bvp' vertices, the remaining indices
|
||||||
|
// are set to RC_MESH_NULL_IDX. If an polygon edge does not have a neighbour
|
||||||
|
// the neighbour index is set to RC_MESH_NULL_IDX.
|
||||||
|
// Vertices can be transformed into world space as follows:
|
||||||
|
// x = bmin[0] + verts[i*3+0]*cs;
|
||||||
|
// y = bmin[1] + verts[i*3+1]*ch;
|
||||||
|
// z = bmin[2] + verts[i*3+2]*cs;
|
||||||
|
struct rcPolyMesh
|
||||||
|
{
|
||||||
|
unsigned short* verts; // Vertices of the mesh, 3 elements per vertex.
|
||||||
|
unsigned short* polys; // Polygons of the mesh, nvp*2 elements per polygon.
|
||||||
|
unsigned short* regs; // Region ID of the polygons.
|
||||||
|
unsigned short* flags; // Per polygon flags.
|
||||||
|
unsigned char* areas; // Area ID of polygons.
|
||||||
|
int nverts; // Number of vertices.
|
||||||
|
int npolys; // Number of polygons.
|
||||||
|
int maxpolys; // Number of allocated polygons.
|
||||||
|
int nvp; // Max number of vertices per polygon.
|
||||||
|
float bmin[3], bmax[3]; // Bounding box of the mesh.
|
||||||
|
float cs, ch; // Cell size and height.
|
||||||
|
};
|
||||||
|
|
||||||
|
rcPolyMesh* rcAllocPolyMesh();
|
||||||
|
void rcFreePolyMesh(rcPolyMesh* pmesh);
|
||||||
|
|
||||||
|
|
||||||
|
// Detail mesh generated from a rcPolyMesh.
|
||||||
|
// Each submesh represents a polygon in the polymesh and they are stored in
|
||||||
|
// exactly same order. Each submesh is described as 4 values:
|
||||||
|
// base vertex, vertex count, base triangle, triangle count. That is,
|
||||||
|
// const unsigned char* t = &dmesh.tris[(tbase+i)*3]; and
|
||||||
|
// const float* v = &dmesh.verts[(vbase+t[j])*3];
|
||||||
|
// If the input polygon has 'n' vertices, those vertices are first in the
|
||||||
|
// submesh vertex list. This allows to compres the mesh by not storing the
|
||||||
|
// first vertices and using the polymesh vertices instead.
|
||||||
|
// Max number of vertices per submesh is 127 and
|
||||||
|
// max number of triangles per submesh is 255.
|
||||||
|
|
||||||
|
struct rcPolyMeshDetail
|
||||||
|
{
|
||||||
|
unsigned int* meshes; // Pointer to all mesh data.
|
||||||
|
float* verts; // Pointer to all vertex data.
|
||||||
|
unsigned char* tris; // Pointer to all triangle data.
|
||||||
|
int nmeshes; // Number of meshes.
|
||||||
|
int nverts; // Number of total vertices.
|
||||||
|
int ntris; // Number of triangles.
|
||||||
|
};
|
||||||
|
|
||||||
|
rcPolyMeshDetail* rcAllocPolyMeshDetail();
|
||||||
|
void rcFreePolyMeshDetail(rcPolyMeshDetail* dmesh);
|
||||||
|
|
||||||
|
|
||||||
|
// If heightfield region ID has the following bit set, the region is on border area
|
||||||
|
// and excluded from many calculations.
|
||||||
|
static const unsigned short RC_BORDER_REG = 0x8000;
|
||||||
|
|
||||||
|
// If contour region ID has the following bit set, the vertex will be later
|
||||||
|
// removed in order to match the segments and vertices at tile boundaries.
|
||||||
|
static const int RC_BORDER_VERTEX = 0x10000;
|
||||||
|
|
||||||
|
static const int RC_AREA_BORDER = 0x20000;
|
||||||
|
|
||||||
|
enum rcBuildContoursFlags
|
||||||
|
{
|
||||||
|
RC_CONTOUR_TESS_WALL_EDGES = 0x01, // Tessellate wall edges
|
||||||
|
RC_CONTOUR_TESS_AREA_EDGES = 0x02, // Tessellate edges between areas.
|
||||||
|
};
|
||||||
|
|
||||||
|
// Mask used with contours to extract region id.
|
||||||
|
static const int RC_CONTOUR_REG_MASK = 0xffff;
|
||||||
|
|
||||||
|
// Null index which is used with meshes to mark unset or invalid indices.
|
||||||
|
static const unsigned short RC_MESH_NULL_IDX = 0xffff;
|
||||||
|
|
||||||
|
// Area ID that is considered empty.
|
||||||
|
static const unsigned char RC_NULL_AREA = 0;
|
||||||
|
|
||||||
|
// Area ID that is considered generally walkable.
|
||||||
|
static const unsigned char RC_WALKABLE_AREA = 63;
|
||||||
|
|
||||||
|
// Value returned by rcGetCon() if the direction is not connected.
|
||||||
|
static const int RC_NOT_CONNECTED = 0x3f;
|
||||||
|
|
||||||
|
// Compact span neighbour helpers.
|
||||||
|
inline void rcSetCon(rcCompactSpan& s, int dir, int i)
|
||||||
|
{
|
||||||
|
const unsigned int shift = (unsigned int)dir*6;
|
||||||
|
unsigned int con = s.con;
|
||||||
|
s.con = (con & ~(0x3f << shift)) | (((unsigned int)i & 0x3f) << shift);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int rcGetCon(const rcCompactSpan& s, int dir)
|
||||||
|
{
|
||||||
|
const unsigned int shift = (unsigned int)dir*6;
|
||||||
|
return (s.con >> shift) & 0x3f;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int rcGetDirOffsetX(int dir)
|
||||||
|
{
|
||||||
|
const int offset[4] = { -1, 0, 1, 0, };
|
||||||
|
return offset[dir&0x03];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int rcGetDirOffsetY(int dir)
|
||||||
|
{
|
||||||
|
const int offset[4] = { 0, 1, 0, -1 };
|
||||||
|
return offset[dir&0x03];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Common helper functions
|
||||||
|
template<class T> inline void rcSwap(T& a, T& b) { T t = a; a = b; b = t; }
|
||||||
|
template<class T> inline T rcMin(T a, T b) { return a < b ? a : b; }
|
||||||
|
template<class T> inline T rcMax(T a, T b) { return a > b ? a : b; }
|
||||||
|
template<class T> inline T rcAbs(T a) { return a < 0 ? -a : a; }
|
||||||
|
template<class T> inline T rcSqr(T a) { return a*a; }
|
||||||
|
template<class T> inline T rcClamp(T v, T mn, T mx) { return v < mn ? mn : (v > mx ? mx : v); }
|
||||||
|
float rcSqrt(float x);
|
||||||
|
|
||||||
|
// Common vector helper functions.
|
||||||
|
inline void rcVcross(float* dest, const float* v1, const float* v2)
|
||||||
|
{
|
||||||
|
dest[0] = v1[1]*v2[2] - v1[2]*v2[1];
|
||||||
|
dest[1] = v1[2]*v2[0] - v1[0]*v2[2];
|
||||||
|
dest[2] = v1[0]*v2[1] - v1[1]*v2[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline float rcVdot(const float* v1, const float* v2)
|
||||||
|
{
|
||||||
|
return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void rcVmad(float* dest, const float* v1, const float* v2, const float s)
|
||||||
|
{
|
||||||
|
dest[0] = v1[0]+v2[0]*s;
|
||||||
|
dest[1] = v1[1]+v2[1]*s;
|
||||||
|
dest[2] = v1[2]+v2[2]*s;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void rcVadd(float* dest, const float* v1, const float* v2)
|
||||||
|
{
|
||||||
|
dest[0] = v1[0]+v2[0];
|
||||||
|
dest[1] = v1[1]+v2[1];
|
||||||
|
dest[2] = v1[2]+v2[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void rcVsub(float* dest, const float* v1, const float* v2)
|
||||||
|
{
|
||||||
|
dest[0] = v1[0]-v2[0];
|
||||||
|
dest[1] = v1[1]-v2[1];
|
||||||
|
dest[2] = v1[2]-v2[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void rcVmin(float* mn, const float* v)
|
||||||
|
{
|
||||||
|
mn[0] = rcMin(mn[0], v[0]);
|
||||||
|
mn[1] = rcMin(mn[1], v[1]);
|
||||||
|
mn[2] = rcMin(mn[2], v[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void rcVmax(float* mx, const float* v)
|
||||||
|
{
|
||||||
|
mx[0] = rcMax(mx[0], v[0]);
|
||||||
|
mx[1] = rcMax(mx[1], v[1]);
|
||||||
|
mx[2] = rcMax(mx[2], v[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void rcVcopy(float* dest, const float* v)
|
||||||
|
{
|
||||||
|
dest[0] = v[0];
|
||||||
|
dest[1] = v[1];
|
||||||
|
dest[2] = v[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline float rcVdist(const float* v1, const float* v2)
|
||||||
|
{
|
||||||
|
float dx = v2[0] - v1[0];
|
||||||
|
float dy = v2[1] - v1[1];
|
||||||
|
float dz = v2[2] - v1[2];
|
||||||
|
return rcSqrt(dx*dx + dy*dy + dz*dz);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline float rcVdistSqr(const float* v1, const float* v2)
|
||||||
|
{
|
||||||
|
float dx = v2[0] - v1[0];
|
||||||
|
float dy = v2[1] - v1[1];
|
||||||
|
float dz = v2[2] - v1[2];
|
||||||
|
return dx*dx + dy*dy + dz*dz;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void rcVnormalize(float* v)
|
||||||
|
{
|
||||||
|
float d = 1.0f / rcSqrt(rcSqr(v[0]) + rcSqr(v[1]) + rcSqr(v[2]));
|
||||||
|
v[0] *= d;
|
||||||
|
v[1] *= d;
|
||||||
|
v[2] *= d;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool rcVequal(const float* p0, const float* p1)
|
||||||
|
{
|
||||||
|
static const float thr = rcSqr(1.0f/16384.0f);
|
||||||
|
const float d = rcVdistSqr(p0, p1);
|
||||||
|
return d < thr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculated bounding box of array of vertices.
|
||||||
|
// Params:
|
||||||
|
// verts - (in) array of vertices
|
||||||
|
// nv - (in) vertex count
|
||||||
|
// bmin, bmax - (out) bounding box
|
||||||
|
void rcCalcBounds(const float* verts, int nv, float* bmin, float* bmax);
|
||||||
|
|
||||||
|
// Calculates grid size based on bounding box and grid cell size.
|
||||||
|
// Params:
|
||||||
|
// bmin, bmax - (in) bounding box
|
||||||
|
// cs - (in) grid cell size
|
||||||
|
// w - (out) grid width
|
||||||
|
// h - (out) grid height
|
||||||
|
void rcCalcGridSize(const float* bmin, const float* bmax, float cs, int* w, int* h);
|
||||||
|
|
||||||
|
// Creates and initializes new heightfield.
|
||||||
|
// Params:
|
||||||
|
// hf - (in/out) heightfield to initialize.
|
||||||
|
// width - (in) width of the heightfield.
|
||||||
|
// height - (in) height of the heightfield.
|
||||||
|
// bmin, bmax - (in) bounding box of the heightfield
|
||||||
|
// cs - (in) grid cell size
|
||||||
|
// ch - (in) grid cell height
|
||||||
|
bool rcCreateHeightfield(rcContext* ctx, rcHeightfield& hf, int width, int height,
|
||||||
|
const float* bmin, const float* bmax,
|
||||||
|
float cs, float ch);
|
||||||
|
|
||||||
|
// Sets the RC_WALKABLE_AREA for every triangle whose slope is below
|
||||||
|
// the maximum walkable slope angle.
|
||||||
|
// Params:
|
||||||
|
// walkableSlopeAngle - (in) maximum slope angle in degrees.
|
||||||
|
// verts - (in) array of vertices
|
||||||
|
// nv - (in) vertex count
|
||||||
|
// tris - (in) array of triangle vertex indices
|
||||||
|
// nt - (in) triangle count
|
||||||
|
// areas - (out) array of triangle area types
|
||||||
|
void rcMarkWalkableTriangles(rcContext* ctx, const float walkableSlopeAngle, const float* verts, int nv,
|
||||||
|
const int* tris, int nt, unsigned char* areas);
|
||||||
|
|
||||||
|
// Sets the RC_NULL_AREA for every triangle whose slope is steeper than
|
||||||
|
// the maximum walkable slope angle.
|
||||||
|
// Params:
|
||||||
|
// walkableSlopeAngle - (in) maximum slope angle in degrees.
|
||||||
|
// verts - (in) array of vertices
|
||||||
|
// nv - (in) vertex count
|
||||||
|
// tris - (in) array of triangle vertex indices
|
||||||
|
// nt - (in) triangle count
|
||||||
|
// areas - (out) array of triangle are types
|
||||||
|
void rcClearUnwalkableTriangles(rcContext* ctx, const float walkableSlopeAngle, const float* verts, int nv,
|
||||||
|
const int* tris, int nt, unsigned char* areas);
|
||||||
|
|
||||||
|
// Adds span to heightfield.
|
||||||
|
// The span addition can set to favor flags. If the span is merged to
|
||||||
|
// another span and the new smax is within 'flagMergeThr' units away
|
||||||
|
// from the existing span the span flags are merged and stored.
|
||||||
|
// Params:
|
||||||
|
// solid - (in) heightfield where the spans is added to
|
||||||
|
// x,y - (in) location on the heightfield where the span is added
|
||||||
|
// smin,smax - (in) spans min/max height
|
||||||
|
// flags - (in) span flags (zero or WALKABLE)
|
||||||
|
// flagMergeThr - (in) merge threshold.
|
||||||
|
void rcAddSpan(rcContext* ctx, rcHeightfield& solid, const int x, const int y,
|
||||||
|
const unsigned short smin, const unsigned short smax,
|
||||||
|
const unsigned short area, const int flagMergeThr);
|
||||||
|
|
||||||
|
// Rasterizes a triangle into heightfield spans.
|
||||||
|
// Params:
|
||||||
|
// v0,v1,v2 - (in) the vertices of the triangle.
|
||||||
|
// area - (in) area type of the triangle.
|
||||||
|
// solid - (in) heightfield where the triangle is rasterized
|
||||||
|
// flagMergeThr - (in) distance in voxel where walkable flag is favored over non-walkable.
|
||||||
|
void rcRasterizeTriangle(rcContext* ctx, const float* v0, const float* v1, const float* v2,
|
||||||
|
const unsigned char area, rcHeightfield& solid,
|
||||||
|
const int flagMergeThr = 1);
|
||||||
|
|
||||||
|
// Rasterizes indexed triangle mesh into heightfield spans.
|
||||||
|
// Params:
|
||||||
|
// verts - (in) array of vertices
|
||||||
|
// nv - (in) vertex count
|
||||||
|
// tris - (in) array of triangle vertex indices
|
||||||
|
// area - (in) array of triangle area types.
|
||||||
|
// nt - (in) triangle count
|
||||||
|
// solid - (in) heightfield where the triangles are rasterized
|
||||||
|
// flagMergeThr - (in) distance in voxel where walkable flag is favored over non-walkable.
|
||||||
|
void rcRasterizeTriangles(rcContext* ctx, const float* verts, const int nv,
|
||||||
|
const int* tris, const unsigned char* areas, const int nt,
|
||||||
|
rcHeightfield& solid, const int flagMergeThr = 1);
|
||||||
|
|
||||||
|
// Rasterizes indexed triangle mesh into heightfield spans.
|
||||||
|
// Params:
|
||||||
|
// verts - (in) array of vertices
|
||||||
|
// nv - (in) vertex count
|
||||||
|
// tris - (in) array of triangle vertex indices
|
||||||
|
// area - (in) array of triangle area types.
|
||||||
|
// nt - (in) triangle count
|
||||||
|
// solid - (in) heightfield where the triangles are rasterized
|
||||||
|
// flagMergeThr - (in) distance in voxel where walkable flag is favored over non-walkable.
|
||||||
|
void rcRasterizeTriangles(rcContext* ctx, const float* verts, const int nv,
|
||||||
|
const unsigned short* tris, const unsigned char* areas, const int nt,
|
||||||
|
rcHeightfield& solid, const int flagMergeThr = 1);
|
||||||
|
|
||||||
|
// Rasterizes the triangles into heightfield spans.
|
||||||
|
// Params:
|
||||||
|
// verts - (in) array of vertices
|
||||||
|
// area - (in) array of triangle area types.
|
||||||
|
// nt - (in) triangle count
|
||||||
|
// solid - (in) heightfield where the triangles are rasterized
|
||||||
|
void rcRasterizeTriangles(rcContext* ctx, const float* verts, const unsigned char* areas, const int nt,
|
||||||
|
rcHeightfield& solid, const int flagMergeThr = 1);
|
||||||
|
|
||||||
|
// Marks non-walkable low obstacles as walkable if they are closer than walkableClimb
|
||||||
|
// from a walkable surface. Applying this filter allows to step over low hanging
|
||||||
|
// low obstacles.
|
||||||
|
// Params:
|
||||||
|
// walkableHeight - (in) minimum height where the agent can still walk
|
||||||
|
// solid - (in/out) heightfield describing the solid space
|
||||||
|
// TODO: Missuses ledge flag, must be called before rcFilterLedgeSpans!
|
||||||
|
void rcFilterLowHangingWalkableObstacles(rcContext* ctx, const int walkableClimb, rcHeightfield& solid);
|
||||||
|
|
||||||
|
// Removes WALKABLE flag from all spans that are at ledges. This filtering
|
||||||
|
// removes possible overestimation of the conservative voxelization so that
|
||||||
|
// the resulting mesh will not have regions hanging in air over ledges.
|
||||||
|
// Params:
|
||||||
|
// walkableHeight - (in) minimum height where the agent can still walk
|
||||||
|
// walkableClimb - (in) maximum height between grid cells the agent can climb
|
||||||
|
// solid - (in/out) heightfield describing the solid space
|
||||||
|
void rcFilterLedgeSpans(rcContext* ctx, const int walkableHeight,
|
||||||
|
const int walkableClimb, rcHeightfield& solid);
|
||||||
|
|
||||||
|
// Removes WALKABLE flag from all spans which have smaller than
|
||||||
|
// 'walkableHeight' clearance above them.
|
||||||
|
// Params:
|
||||||
|
// walkableHeight - (in) minimum height where the agent can still walk
|
||||||
|
// solid - (in/out) heightfield describing the solid space
|
||||||
|
void rcFilterWalkableLowHeightSpans(rcContext* ctx, int walkableHeight, rcHeightfield& solid);
|
||||||
|
|
||||||
|
// Returns number of spans contained in a heightfield.
|
||||||
|
// Params:
|
||||||
|
// hf - (in) heightfield to be compacted
|
||||||
|
// Returns number of spans.
|
||||||
|
int rcGetHeightFieldSpanCount(rcContext* ctx, rcHeightfield& hf);
|
||||||
|
|
||||||
|
// Builds compact representation of the heightfield.
|
||||||
|
// Params:
|
||||||
|
// walkableHeight - (in) minimum height where the agent can still walk
|
||||||
|
// walkableClimb - (in) maximum height between grid cells the agent can climb
|
||||||
|
// flags - (in) require flags for a cell to be included in the compact heightfield.
|
||||||
|
// hf - (in) heightfield to be compacted
|
||||||
|
// chf - (out) compact heightfield representing the open space.
|
||||||
|
// Returns false if operation ran out of memory.
|
||||||
|
bool rcBuildCompactHeightfield(rcContext* ctx, const int walkableHeight, const int walkableClimb,
|
||||||
|
rcHeightfield& hf, rcCompactHeightfield& chf);
|
||||||
|
|
||||||
|
// Erodes walkable area.
|
||||||
|
// Params:
|
||||||
|
// radius - (in) radius of erosion (max 255).
|
||||||
|
// chf - (in/out) compact heightfield to erode.
|
||||||
|
// Returns false if operation ran out of memory.
|
||||||
|
bool rcErodeWalkableArea(rcContext* ctx, int radius, rcCompactHeightfield& chf);
|
||||||
|
|
||||||
|
// Applies median filter to walkable area types, removing noise.
|
||||||
|
// Params:
|
||||||
|
// chf - (in/out) compact heightfield to erode.
|
||||||
|
// Returns false if operation ran out of memory.
|
||||||
|
bool rcMedianFilterWalkableArea(rcContext* ctx, rcCompactHeightfield& chf);
|
||||||
|
|
||||||
|
// Marks the area of the convex polygon into the area type of the compact heightfield.
|
||||||
|
// Params:
|
||||||
|
// bmin/bmax - (in) bounds of the axis aligned box.
|
||||||
|
// areaId - (in) area ID to mark.
|
||||||
|
// chf - (in/out) compact heightfield to mark.
|
||||||
|
void rcMarkBoxArea(rcContext* ctx, const float* bmin, const float* bmax, unsigned char areaId,
|
||||||
|
rcCompactHeightfield& chf);
|
||||||
|
|
||||||
|
// Marks the area of the convex polygon into the area type of the compact heightfield.
|
||||||
|
// Params:
|
||||||
|
// verts - (in) vertices of the convex polygon.
|
||||||
|
// nverts - (in) number of vertices in the polygon.
|
||||||
|
// hmin/hmax - (in) min and max height of the polygon.
|
||||||
|
// areaId - (in) area ID to mark.
|
||||||
|
// chf - (in/out) compact heightfield to mark.
|
||||||
|
void rcMarkConvexPolyArea(rcContext* ctx, const float* verts, const int nverts,
|
||||||
|
const float hmin, const float hmax, unsigned char areaId,
|
||||||
|
rcCompactHeightfield& chf);
|
||||||
|
|
||||||
|
// Builds distance field and stores it into the combat heightfield.
|
||||||
|
// Params:
|
||||||
|
// chf - (in/out) compact heightfield representing the open space.
|
||||||
|
// Returns false if operation ran out of memory.
|
||||||
|
bool rcBuildDistanceField(rcContext* ctx, rcCompactHeightfield& chf);
|
||||||
|
|
||||||
|
// Divides the walkable heighfied into simple regions using watershed partitioning.
|
||||||
|
// Each region has only one contour and no overlaps.
|
||||||
|
// The regions are stored in the compact heightfield 'reg' field.
|
||||||
|
// The process sometimes creates small regions. If the area of a regions is
|
||||||
|
// smaller than 'mergeRegionArea' then the region will be merged with a neighbour
|
||||||
|
// region if possible. If multiple regions form an area which is smaller than
|
||||||
|
// 'minRegionArea' all the regions belonging to that area will be removed.
|
||||||
|
// Here area means the count of spans in an area.
|
||||||
|
// Params:
|
||||||
|
// chf - (in/out) compact heightfield representing the open space.
|
||||||
|
// minRegionArea - (in) the smallest allowed region area.
|
||||||
|
// maxMergeRegionArea - (in) the largest allowed region area which can be merged.
|
||||||
|
// Returns false if operation ran out of memory.
|
||||||
|
bool rcBuildRegions(rcContext* ctx, rcCompactHeightfield& chf,
|
||||||
|
const int borderSize, const int minRegionArea, const int mergeRegionArea);
|
||||||
|
|
||||||
|
// Divides the walkable heighfied into simple regions using simple monotone partitioning.
|
||||||
|
// Each region has only one contour and no overlaps.
|
||||||
|
// The regions are stored in the compact heightfield 'reg' field.
|
||||||
|
// The process sometimes creates small regions. If the area of a regions is
|
||||||
|
// smaller than 'mergeRegionArea' then the region will be merged with a neighbour
|
||||||
|
// region if possible. If multiple regions form an area which is smaller than
|
||||||
|
// 'minRegionArea' all the regions belonging to that area will be removed.
|
||||||
|
// Here area means the count of spans in an area.
|
||||||
|
// Params:
|
||||||
|
// chf - (in/out) compact heightfield representing the open space.
|
||||||
|
// minRegionArea - (in) the smallest allowed regions size.
|
||||||
|
// maxMergeRegionArea - (in) the largest allowed regions size which can be merged.
|
||||||
|
// Returns false if operation ran out of memory.
|
||||||
|
bool rcBuildRegionsMonotone(rcContext* ctx, rcCompactHeightfield& chf,
|
||||||
|
const int borderSize, const int minRegionArea, const int mergeRegionArea);
|
||||||
|
|
||||||
|
// Builds simplified contours from the regions outlines.
|
||||||
|
// Params:
|
||||||
|
// chf - (in) compact heightfield which has regions set.
|
||||||
|
// maxError - (in) maximum allowed distance between simplified contour and cells.
|
||||||
|
// maxEdgeLen - (in) maximum allowed contour edge length in cells.
|
||||||
|
// cset - (out) Resulting contour set.
|
||||||
|
// flags - (in) build flags, see rcBuildContoursFlags.
|
||||||
|
// Returns false if operation ran out of memory.
|
||||||
|
bool rcBuildContours(rcContext* ctx, rcCompactHeightfield& chf,
|
||||||
|
const float maxError, const int maxEdgeLen,
|
||||||
|
rcContourSet& cset, const int flags = RC_CONTOUR_TESS_WALL_EDGES);
|
||||||
|
|
||||||
|
// Builds connected convex polygon mesh from contour polygons.
|
||||||
|
// Params:
|
||||||
|
// cset - (in) contour set.
|
||||||
|
// nvp - (in) maximum number of vertices per polygon.
|
||||||
|
// mesh - (out) poly mesh.
|
||||||
|
// Returns false if operation ran out of memory.
|
||||||
|
bool rcBuildPolyMesh(rcContext* ctx, rcContourSet& cset, int nvp, rcPolyMesh& mesh);
|
||||||
|
|
||||||
|
bool rcMergePolyMeshes(rcContext* ctx, rcPolyMesh** meshes, const int nmeshes, rcPolyMesh& mesh);
|
||||||
|
|
||||||
|
// Builds detail triangle mesh for each polygon in the poly mesh.
|
||||||
|
// Params:
|
||||||
|
// mesh - (in) poly mesh to detail.
|
||||||
|
// chf - (in) compact height field, used to query height for new vertices.
|
||||||
|
// sampleDist - (in) spacing between height samples used to generate more detail into mesh.
|
||||||
|
// sampleMaxError - (in) maximum allowed distance between simplified detail mesh and height sample.
|
||||||
|
// pmdtl - (out) detail mesh.
|
||||||
|
// Returns false if operation ran out of memory.
|
||||||
|
bool rcBuildPolyMeshDetail(rcContext* ctx, const rcPolyMesh& mesh, const rcCompactHeightfield& chf,
|
||||||
|
const float sampleDist, const float sampleMaxError,
|
||||||
|
rcPolyMeshDetail& dmesh);
|
||||||
|
|
||||||
|
bool rcMergePolyMeshDetails(rcContext* ctx, rcPolyMeshDetail** meshes, const int nmeshes, rcPolyMeshDetail& mesh);
|
||||||
|
|
||||||
|
|
||||||
|
#endif // RECAST_H
|
||||||
69
dep/recastnavigation/Recast/Include/RecastAlloc.h
Normal file
69
dep/recastnavigation/Recast/Include/RecastAlloc.h
Normal file
|
|
@ -0,0 +1,69 @@
|
||||||
|
//
|
||||||
|
// 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 RECASTALLOC_H
|
||||||
|
#define RECASTALLOC_H
|
||||||
|
|
||||||
|
enum rcAllocHint
|
||||||
|
{
|
||||||
|
RC_ALLOC_PERM, // Memory persist after a function call.
|
||||||
|
RC_ALLOC_TEMP // Memory used temporarily within a function.
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef void* (rcAllocFunc)(int size, rcAllocHint hint);
|
||||||
|
typedef void (rcFreeFunc)(void* ptr);
|
||||||
|
|
||||||
|
void rcAllocSetCustom(rcAllocFunc *allocFunc, rcFreeFunc *freeFunc);
|
||||||
|
|
||||||
|
void* rcAlloc(int size, rcAllocHint hint);
|
||||||
|
void rcFree(void* ptr);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Simple dynamic array ints.
|
||||||
|
class rcIntArray
|
||||||
|
{
|
||||||
|
int* m_data;
|
||||||
|
int m_size, m_cap;
|
||||||
|
inline rcIntArray(const rcIntArray&);
|
||||||
|
inline rcIntArray& operator=(const rcIntArray&);
|
||||||
|
public:
|
||||||
|
inline rcIntArray() : m_data(0), m_size(0), m_cap(0) {}
|
||||||
|
inline rcIntArray(int n) : m_data(0), m_size(0), m_cap(0) { resize(n); }
|
||||||
|
inline ~rcIntArray() { rcFree(m_data); }
|
||||||
|
void resize(int n);
|
||||||
|
inline void push(int item) { resize(m_size+1); m_data[m_size-1] = item; }
|
||||||
|
inline int pop() { if (m_size > 0) m_size--; return m_data[m_size]; }
|
||||||
|
inline const int& operator[](int i) const { return m_data[i]; }
|
||||||
|
inline int& operator[](int i) { return m_data[i]; }
|
||||||
|
inline int size() const { return m_size; }
|
||||||
|
};
|
||||||
|
|
||||||
|
// Simple internal helper class to delete array in scope
|
||||||
|
template<class T> class rcScopedDelete
|
||||||
|
{
|
||||||
|
T* ptr;
|
||||||
|
inline T* operator=(T* p);
|
||||||
|
public:
|
||||||
|
inline rcScopedDelete() : ptr(0) {}
|
||||||
|
inline rcScopedDelete(T* p) : ptr(p) {}
|
||||||
|
inline ~rcScopedDelete() { rcFree(ptr); }
|
||||||
|
inline operator T*() { return ptr; }
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
33
dep/recastnavigation/Recast/Include/RecastAssert.h
Normal file
33
dep/recastnavigation/Recast/Include/RecastAssert.h
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
//
|
||||||
|
// 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 RECASTASSERT_H
|
||||||
|
#define RECASTASSERT_H
|
||||||
|
|
||||||
|
// Note: This header file's only purpose is to include define assert.
|
||||||
|
// Feel free to change the file and include your own implementation instead.
|
||||||
|
|
||||||
|
#ifdef NDEBUG
|
||||||
|
// From http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/
|
||||||
|
# define rcAssert(x) do { (void)sizeof(x); } while(__LINE__==-1,false)
|
||||||
|
#else
|
||||||
|
# include <assert.h>
|
||||||
|
# define rcAssert assert
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // RECASTASSERT_H
|
||||||
423
dep/recastnavigation/Recast/Source/Recast.cpp
Normal file
423
dep/recastnavigation/Recast/Source/Recast.cpp
Normal file
|
|
@ -0,0 +1,423 @@
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <float.h>
|
||||||
|
#define _USE_MATH_DEFINES
|
||||||
|
#include <math.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include "Recast.h"
|
||||||
|
#include "RecastAlloc.h"
|
||||||
|
#include "RecastAssert.h"
|
||||||
|
|
||||||
|
float rcSqrt(float x)
|
||||||
|
{
|
||||||
|
return sqrtf(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void rcContext::log(const rcLogCategory category, const char* format, ...)
|
||||||
|
{
|
||||||
|
if (!m_logEnabled)
|
||||||
|
return;
|
||||||
|
static const int MSG_SIZE = 512;
|
||||||
|
char msg[MSG_SIZE];
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, format);
|
||||||
|
int len = vsnprintf(msg, MSG_SIZE, format, ap);
|
||||||
|
if (len >= MSG_SIZE)
|
||||||
|
{
|
||||||
|
len = MSG_SIZE-1;
|
||||||
|
msg[MSG_SIZE-1] = '\0';
|
||||||
|
}
|
||||||
|
va_end(ap);
|
||||||
|
doLog(category, msg, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
rcHeightfield* rcAllocHeightfield()
|
||||||
|
{
|
||||||
|
rcHeightfield* hf = (rcHeightfield*)rcAlloc(sizeof(rcHeightfield), RC_ALLOC_PERM);
|
||||||
|
memset(hf, 0, sizeof(rcHeightfield));
|
||||||
|
return hf;
|
||||||
|
}
|
||||||
|
|
||||||
|
void rcFreeHeightField(rcHeightfield* hf)
|
||||||
|
{
|
||||||
|
if (!hf) return;
|
||||||
|
// Delete span array.
|
||||||
|
rcFree(hf->spans);
|
||||||
|
// Delete span pools.
|
||||||
|
while (hf->pools)
|
||||||
|
{
|
||||||
|
rcSpanPool* next = hf->pools->next;
|
||||||
|
rcFree(hf->pools);
|
||||||
|
hf->pools = next;
|
||||||
|
}
|
||||||
|
rcFree(hf);
|
||||||
|
}
|
||||||
|
|
||||||
|
rcCompactHeightfield* rcAllocCompactHeightfield()
|
||||||
|
{
|
||||||
|
rcCompactHeightfield* chf = (rcCompactHeightfield*)rcAlloc(sizeof(rcCompactHeightfield), RC_ALLOC_PERM);
|
||||||
|
memset(chf, 0, sizeof(rcCompactHeightfield));
|
||||||
|
return chf;
|
||||||
|
}
|
||||||
|
|
||||||
|
void rcFreeCompactHeightfield(rcCompactHeightfield* chf)
|
||||||
|
{
|
||||||
|
if (!chf) return;
|
||||||
|
rcFree(chf->cells);
|
||||||
|
rcFree(chf->spans);
|
||||||
|
rcFree(chf->dist);
|
||||||
|
rcFree(chf->areas);
|
||||||
|
rcFree(chf);
|
||||||
|
}
|
||||||
|
|
||||||
|
rcContourSet* rcAllocContourSet()
|
||||||
|
{
|
||||||
|
rcContourSet* cset = (rcContourSet*)rcAlloc(sizeof(rcContourSet), RC_ALLOC_PERM);
|
||||||
|
memset(cset, 0, sizeof(rcContourSet));
|
||||||
|
return cset;
|
||||||
|
}
|
||||||
|
|
||||||
|
void rcFreeContourSet(rcContourSet* cset)
|
||||||
|
{
|
||||||
|
if (!cset) return;
|
||||||
|
for (int i = 0; i < cset->nconts; ++i)
|
||||||
|
{
|
||||||
|
rcFree(cset->conts[i].verts);
|
||||||
|
rcFree(cset->conts[i].rverts);
|
||||||
|
}
|
||||||
|
rcFree(cset->conts);
|
||||||
|
rcFree(cset);
|
||||||
|
}
|
||||||
|
|
||||||
|
rcPolyMesh* rcAllocPolyMesh()
|
||||||
|
{
|
||||||
|
rcPolyMesh* pmesh = (rcPolyMesh*)rcAlloc(sizeof(rcPolyMesh), RC_ALLOC_PERM);
|
||||||
|
memset(pmesh, 0, sizeof(rcPolyMesh));
|
||||||
|
return pmesh;
|
||||||
|
}
|
||||||
|
|
||||||
|
void rcFreePolyMesh(rcPolyMesh* pmesh)
|
||||||
|
{
|
||||||
|
if (!pmesh) return;
|
||||||
|
rcFree(pmesh->verts);
|
||||||
|
rcFree(pmesh->polys);
|
||||||
|
rcFree(pmesh->regs);
|
||||||
|
rcFree(pmesh->flags);
|
||||||
|
rcFree(pmesh->areas);
|
||||||
|
rcFree(pmesh);
|
||||||
|
}
|
||||||
|
|
||||||
|
rcPolyMeshDetail* rcAllocPolyMeshDetail()
|
||||||
|
{
|
||||||
|
rcPolyMeshDetail* dmesh = (rcPolyMeshDetail*)rcAlloc(sizeof(rcPolyMeshDetail), RC_ALLOC_PERM);
|
||||||
|
memset(dmesh, 0, sizeof(rcPolyMeshDetail));
|
||||||
|
return dmesh;
|
||||||
|
}
|
||||||
|
|
||||||
|
void rcFreePolyMeshDetail(rcPolyMeshDetail* dmesh)
|
||||||
|
{
|
||||||
|
if (!dmesh) return;
|
||||||
|
rcFree(dmesh->meshes);
|
||||||
|
rcFree(dmesh->verts);
|
||||||
|
rcFree(dmesh->tris);
|
||||||
|
rcFree(dmesh);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void rcCalcBounds(const float* verts, int nv, float* bmin, float* bmax)
|
||||||
|
{
|
||||||
|
// Calculate bounding box.
|
||||||
|
rcVcopy(bmin, verts);
|
||||||
|
rcVcopy(bmax, verts);
|
||||||
|
for (int i = 1; i < nv; ++i)
|
||||||
|
{
|
||||||
|
const float* v = &verts[i*3];
|
||||||
|
rcVmin(bmin, v);
|
||||||
|
rcVmax(bmax, v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void rcCalcGridSize(const float* bmin, const float* bmax, float cs, int* w, int* h)
|
||||||
|
{
|
||||||
|
*w = (int)((bmax[0] - bmin[0])/cs+0.5f);
|
||||||
|
*h = (int)((bmax[2] - bmin[2])/cs+0.5f);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool rcCreateHeightfield(rcContext* /*ctx*/, rcHeightfield& hf, int width, int height,
|
||||||
|
const float* bmin, const float* bmax,
|
||||||
|
float cs, float ch)
|
||||||
|
{
|
||||||
|
// TODO: VC complains about unref formal variable, figure out a way to handle this better.
|
||||||
|
// rcAssert(ctx);
|
||||||
|
|
||||||
|
hf.width = width;
|
||||||
|
hf.height = height;
|
||||||
|
rcVcopy(hf.bmin, bmin);
|
||||||
|
rcVcopy(hf.bmax, bmax);
|
||||||
|
hf.cs = cs;
|
||||||
|
hf.ch = ch;
|
||||||
|
hf.spans = (rcSpan**)rcAlloc(sizeof(rcSpan*)*hf.width*hf.height, RC_ALLOC_PERM);
|
||||||
|
if (!hf.spans)
|
||||||
|
return false;
|
||||||
|
memset(hf.spans, 0, sizeof(rcSpan*)*hf.width*hf.height);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void calcTriNormal(const float* v0, const float* v1, const float* v2, float* norm)
|
||||||
|
{
|
||||||
|
float e0[3], e1[3];
|
||||||
|
rcVsub(e0, v1, v0);
|
||||||
|
rcVsub(e1, v2, v0);
|
||||||
|
rcVcross(norm, e0, e1);
|
||||||
|
rcVnormalize(norm);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rcMarkWalkableTriangles(rcContext* /*ctx*/, const float walkableSlopeAngle,
|
||||||
|
const float* verts, int /*nv*/,
|
||||||
|
const int* tris, int nt,
|
||||||
|
unsigned char* areas)
|
||||||
|
{
|
||||||
|
// TODO: VC complains about unref formal variable, figure out a way to handle this better.
|
||||||
|
// rcAssert(ctx);
|
||||||
|
|
||||||
|
const float walkableThr = cosf(walkableSlopeAngle/180.0f*RC_PI);
|
||||||
|
|
||||||
|
float norm[3];
|
||||||
|
|
||||||
|
for (int i = 0; i < nt; ++i)
|
||||||
|
{
|
||||||
|
const int* tri = &tris[i*3];
|
||||||
|
calcTriNormal(&verts[tri[0]*3], &verts[tri[1]*3], &verts[tri[2]*3], norm);
|
||||||
|
// Check if the face is walkable.
|
||||||
|
if (norm[1] > walkableThr)
|
||||||
|
areas[i] = RC_WALKABLE_AREA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void rcClearUnwalkableTriangles(rcContext* /*ctx*/, const float walkableSlopeAngle,
|
||||||
|
const float* verts, int /*nv*/,
|
||||||
|
const int* tris, int nt,
|
||||||
|
unsigned char* areas)
|
||||||
|
{
|
||||||
|
// TODO: VC complains about unref formal variable, figure out a way to handle this better.
|
||||||
|
// rcAssert(ctx);
|
||||||
|
|
||||||
|
const float walkableThr = cosf(walkableSlopeAngle/180.0f*RC_PI);
|
||||||
|
|
||||||
|
float norm[3];
|
||||||
|
|
||||||
|
for (int i = 0; i < nt; ++i)
|
||||||
|
{
|
||||||
|
const int* tri = &tris[i*3];
|
||||||
|
calcTriNormal(&verts[tri[0]*3], &verts[tri[1]*3], &verts[tri[2]*3], norm);
|
||||||
|
// Check if the face is walkable.
|
||||||
|
if (norm[1] <= walkableThr)
|
||||||
|
areas[i] = RC_NULL_AREA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int rcGetHeightFieldSpanCount(rcContext* /*ctx*/, rcHeightfield& hf)
|
||||||
|
{
|
||||||
|
// TODO: VC complains about unref formal variable, figure out a way to handle this better.
|
||||||
|
// rcAssert(ctx);
|
||||||
|
|
||||||
|
const int w = hf.width;
|
||||||
|
const int h = hf.height;
|
||||||
|
int spanCount = 0;
|
||||||
|
for (int y = 0; y < h; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < w; ++x)
|
||||||
|
{
|
||||||
|
for (rcSpan* s = hf.spans[x + y*w]; s; s = s->next)
|
||||||
|
{
|
||||||
|
if (s->area != RC_NULL_AREA)
|
||||||
|
spanCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return spanCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool rcBuildCompactHeightfield(rcContext* ctx, const int walkableHeight, const int walkableClimb,
|
||||||
|
rcHeightfield& hf, rcCompactHeightfield& chf)
|
||||||
|
{
|
||||||
|
rcAssert(ctx);
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_BUILD_COMPACTHEIGHTFIELD);
|
||||||
|
|
||||||
|
const int w = hf.width;
|
||||||
|
const int h = hf.height;
|
||||||
|
const int spanCount = rcGetHeightFieldSpanCount(ctx, hf);
|
||||||
|
|
||||||
|
// Fill in header.
|
||||||
|
chf.width = w;
|
||||||
|
chf.height = h;
|
||||||
|
chf.spanCount = spanCount;
|
||||||
|
chf.walkableHeight = walkableHeight;
|
||||||
|
chf.walkableClimb = walkableClimb;
|
||||||
|
chf.maxRegions = 0;
|
||||||
|
rcVcopy(chf.bmin, hf.bmin);
|
||||||
|
rcVcopy(chf.bmax, hf.bmax);
|
||||||
|
chf.bmax[1] += walkableHeight*hf.ch;
|
||||||
|
chf.cs = hf.cs;
|
||||||
|
chf.ch = hf.ch;
|
||||||
|
chf.cells = (rcCompactCell*)rcAlloc(sizeof(rcCompactCell)*w*h, RC_ALLOC_PERM);
|
||||||
|
if (!chf.cells)
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_ERROR, "rcBuildCompactHeightfield: Out of memory 'chf.cells' (%d)", w*h);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
memset(chf.cells, 0, sizeof(rcCompactCell)*w*h);
|
||||||
|
chf.spans = (rcCompactSpan*)rcAlloc(sizeof(rcCompactSpan)*spanCount, RC_ALLOC_PERM);
|
||||||
|
if (!chf.spans)
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_ERROR, "rcBuildCompactHeightfield: Out of memory 'chf.spans' (%d)", spanCount);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
memset(chf.spans, 0, sizeof(rcCompactSpan)*spanCount);
|
||||||
|
chf.areas = (unsigned char*)rcAlloc(sizeof(unsigned char)*spanCount, RC_ALLOC_PERM);
|
||||||
|
if (!chf.areas)
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_ERROR, "rcBuildCompactHeightfield: Out of memory 'chf.areas' (%d)", spanCount);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
memset(chf.areas, RC_NULL_AREA, sizeof(unsigned char)*spanCount);
|
||||||
|
|
||||||
|
const int MAX_HEIGHT = 0xffff;
|
||||||
|
|
||||||
|
// Fill in cells and spans.
|
||||||
|
int idx = 0;
|
||||||
|
for (int y = 0; y < h; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < w; ++x)
|
||||||
|
{
|
||||||
|
const rcSpan* s = hf.spans[x + y*w];
|
||||||
|
// If there are no spans at this cell, just leave the data to index=0, count=0.
|
||||||
|
if (!s) continue;
|
||||||
|
rcCompactCell& c = chf.cells[x+y*w];
|
||||||
|
c.index = idx;
|
||||||
|
c.count = 0;
|
||||||
|
while (s)
|
||||||
|
{
|
||||||
|
if (s->area != RC_NULL_AREA)
|
||||||
|
{
|
||||||
|
const int bot = (int)s->smax;
|
||||||
|
const int top = s->next ? (int)s->next->smin : MAX_HEIGHT;
|
||||||
|
chf.spans[idx].y = (unsigned short)rcClamp(bot, 0, 0xffff);
|
||||||
|
chf.spans[idx].h = (unsigned char)rcClamp(top - bot, 0, 0xff);
|
||||||
|
chf.areas[idx] = s->area;
|
||||||
|
idx++;
|
||||||
|
c.count++;
|
||||||
|
}
|
||||||
|
s = s->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find neighbour connections.
|
||||||
|
const int MAX_LAYERS = RC_NOT_CONNECTED-1;
|
||||||
|
int tooHighNeighbour = 0;
|
||||||
|
for (int y = 0; y < h; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < w; ++x)
|
||||||
|
{
|
||||||
|
const rcCompactCell& c = chf.cells[x+y*w];
|
||||||
|
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
|
||||||
|
{
|
||||||
|
rcCompactSpan& s = chf.spans[i];
|
||||||
|
|
||||||
|
for (int dir = 0; dir < 4; ++dir)
|
||||||
|
{
|
||||||
|
rcSetCon(s, dir, RC_NOT_CONNECTED);
|
||||||
|
const int nx = x + rcGetDirOffsetX(dir);
|
||||||
|
const int ny = y + rcGetDirOffsetY(dir);
|
||||||
|
// First check that the neighbour cell is in bounds.
|
||||||
|
if (nx < 0 || ny < 0 || nx >= w || ny >= h)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Iterate over all neighbour spans and check if any of the is
|
||||||
|
// accessible from current cell.
|
||||||
|
const rcCompactCell& nc = chf.cells[nx+ny*w];
|
||||||
|
for (int k = (int)nc.index, nk = (int)(nc.index+nc.count); k < nk; ++k)
|
||||||
|
{
|
||||||
|
const rcCompactSpan& ns = chf.spans[k];
|
||||||
|
const int bot = rcMax(s.y, ns.y);
|
||||||
|
const int top = rcMin(s.y+s.h, ns.y+ns.h);
|
||||||
|
|
||||||
|
// Check that the gap between the spans is walkable,
|
||||||
|
// and that the climb height between the gaps is not too high.
|
||||||
|
if ((top - bot) >= walkableHeight && rcAbs((int)ns.y - (int)s.y) <= walkableClimb)
|
||||||
|
{
|
||||||
|
// Mark direction as walkable.
|
||||||
|
const int idx = k - (int)nc.index;
|
||||||
|
if (idx < 0 || idx > MAX_LAYERS)
|
||||||
|
{
|
||||||
|
tooHighNeighbour = rcMax(tooHighNeighbour, idx);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
rcSetCon(s, dir, idx);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tooHighNeighbour > MAX_LAYERS)
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_ERROR, "rcBuildCompactHeightfield: Heightfield has too many layers %d (max: %d)",
|
||||||
|
tooHighNeighbour, MAX_LAYERS);
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_BUILD_COMPACTHEIGHTFIELD);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
static int getHeightfieldMemoryUsage(const rcHeightfield& hf)
|
||||||
|
{
|
||||||
|
int size = 0;
|
||||||
|
size += sizeof(hf);
|
||||||
|
size += hf.width * hf.height * sizeof(rcSpan*);
|
||||||
|
|
||||||
|
rcSpanPool* pool = hf.pools;
|
||||||
|
while (pool)
|
||||||
|
{
|
||||||
|
size += (sizeof(rcSpanPool) - sizeof(rcSpan)) + sizeof(rcSpan)*RC_SPANS_PER_POOL;
|
||||||
|
pool = pool->next;
|
||||||
|
}
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int getCompactHeightFieldMemoryusage(const rcCompactHeightfield& chf)
|
||||||
|
{
|
||||||
|
int size = 0;
|
||||||
|
size += sizeof(rcCompactHeightfield);
|
||||||
|
size += sizeof(rcCompactSpan) * chf.spanCount;
|
||||||
|
size += sizeof(rcCompactCell) * chf.width * chf.height;
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
*/
|
||||||
67
dep/recastnavigation/Recast/Source/RecastAlloc.cpp
Normal file
67
dep/recastnavigation/Recast/Source/RecastAlloc.cpp
Normal file
|
|
@ -0,0 +1,67 @@
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "RecastAlloc.h"
|
||||||
|
|
||||||
|
static void *rcAllocDefault(int size, rcAllocHint)
|
||||||
|
{
|
||||||
|
return malloc(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rcFreeDefault(void *ptr)
|
||||||
|
{
|
||||||
|
free(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static rcAllocFunc* sRecastAllocFunc = rcAllocDefault;
|
||||||
|
static rcFreeFunc* sRecastFreeFunc = rcFreeDefault;
|
||||||
|
|
||||||
|
void rcAllocSetCustom(rcAllocFunc *allocFunc, rcFreeFunc *freeFunc)
|
||||||
|
{
|
||||||
|
sRecastAllocFunc = allocFunc ? allocFunc : rcAllocDefault;
|
||||||
|
sRecastFreeFunc = freeFunc ? freeFunc : rcFreeDefault;
|
||||||
|
}
|
||||||
|
|
||||||
|
void* rcAlloc(int size, rcAllocHint hint)
|
||||||
|
{
|
||||||
|
return sRecastAllocFunc(size, hint);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rcFree(void* ptr)
|
||||||
|
{
|
||||||
|
if (ptr)
|
||||||
|
sRecastFreeFunc(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void rcIntArray::resize(int n)
|
||||||
|
{
|
||||||
|
if (n > m_cap)
|
||||||
|
{
|
||||||
|
if (!m_cap) m_cap = n;
|
||||||
|
while (m_cap < n) m_cap *= 2;
|
||||||
|
int* newData = (int*)rcAlloc(m_cap*sizeof(int), RC_ALLOC_TEMP);
|
||||||
|
if (m_size && newData) memcpy(newData, m_data, m_size*sizeof(int));
|
||||||
|
rcFree(m_data);
|
||||||
|
m_data = newData;
|
||||||
|
}
|
||||||
|
m_size = n;
|
||||||
|
}
|
||||||
|
|
||||||
413
dep/recastnavigation/Recast/Source/RecastArea.cpp
Normal file
413
dep/recastnavigation/Recast/Source/RecastArea.cpp
Normal file
|
|
@ -0,0 +1,413 @@
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <float.h>
|
||||||
|
#define _USE_MATH_DEFINES
|
||||||
|
#include <math.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "Recast.h"
|
||||||
|
#include "RecastAlloc.h"
|
||||||
|
#include "RecastAssert.h"
|
||||||
|
|
||||||
|
|
||||||
|
bool rcErodeWalkableArea(rcContext* ctx, int radius, rcCompactHeightfield& chf)
|
||||||
|
{
|
||||||
|
rcAssert(ctx);
|
||||||
|
|
||||||
|
const int w = chf.width;
|
||||||
|
const int h = chf.height;
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_ERODE_AREA);
|
||||||
|
|
||||||
|
unsigned char* dist = (unsigned char*)rcAlloc(sizeof(unsigned char)*chf.spanCount, RC_ALLOC_TEMP);
|
||||||
|
if (!dist)
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_ERROR, "erodeWalkableArea: Out of memory 'dist' (%d).", chf.spanCount);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Init distance.
|
||||||
|
memset(dist, 0xff, sizeof(unsigned char)*chf.spanCount);
|
||||||
|
|
||||||
|
// Mark boundary cells.
|
||||||
|
for (int y = 0; y < h; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < w; ++x)
|
||||||
|
{
|
||||||
|
const rcCompactCell& c = chf.cells[x+y*w];
|
||||||
|
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
|
||||||
|
{
|
||||||
|
if (chf.areas[i] != RC_NULL_AREA)
|
||||||
|
{
|
||||||
|
const rcCompactSpan& s = chf.spans[i];
|
||||||
|
int nc = 0;
|
||||||
|
for (int dir = 0; dir < 4; ++dir)
|
||||||
|
{
|
||||||
|
if (rcGetCon(s, dir) != RC_NOT_CONNECTED)
|
||||||
|
nc++;
|
||||||
|
}
|
||||||
|
// At least one missing neighbour.
|
||||||
|
if (nc != 4)
|
||||||
|
dist[i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char nd;
|
||||||
|
|
||||||
|
// Pass 1
|
||||||
|
for (int y = 0; y < h; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < w; ++x)
|
||||||
|
{
|
||||||
|
const rcCompactCell& c = chf.cells[x+y*w];
|
||||||
|
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
|
||||||
|
{
|
||||||
|
const rcCompactSpan& s = chf.spans[i];
|
||||||
|
|
||||||
|
if (rcGetCon(s, 0) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
// (-1,0)
|
||||||
|
const int ax = x + rcGetDirOffsetX(0);
|
||||||
|
const int ay = y + rcGetDirOffsetY(0);
|
||||||
|
const int ai = (int)chf.cells[ax+ay*w].index + rcGetCon(s, 0);
|
||||||
|
const rcCompactSpan& as = chf.spans[ai];
|
||||||
|
nd = (unsigned char)rcMin((int)dist[ai]+2, 255);
|
||||||
|
if (nd < dist[i])
|
||||||
|
dist[i] = nd;
|
||||||
|
|
||||||
|
// (-1,-1)
|
||||||
|
if (rcGetCon(as, 3) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const int aax = ax + rcGetDirOffsetX(3);
|
||||||
|
const int aay = ay + rcGetDirOffsetY(3);
|
||||||
|
const int aai = (int)chf.cells[aax+aay*w].index + rcGetCon(as, 3);
|
||||||
|
nd = (unsigned char)rcMin((int)dist[aai]+3, 255);
|
||||||
|
if (nd < dist[i])
|
||||||
|
dist[i] = nd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rcGetCon(s, 3) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
// (0,-1)
|
||||||
|
const int ax = x + rcGetDirOffsetX(3);
|
||||||
|
const int ay = y + rcGetDirOffsetY(3);
|
||||||
|
const int ai = (int)chf.cells[ax+ay*w].index + rcGetCon(s, 3);
|
||||||
|
const rcCompactSpan& as = chf.spans[ai];
|
||||||
|
nd = (unsigned char)rcMin((int)dist[ai]+2, 255);
|
||||||
|
if (nd < dist[i])
|
||||||
|
dist[i] = nd;
|
||||||
|
|
||||||
|
// (1,-1)
|
||||||
|
if (rcGetCon(as, 2) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const int aax = ax + rcGetDirOffsetX(2);
|
||||||
|
const int aay = ay + rcGetDirOffsetY(2);
|
||||||
|
const int aai = (int)chf.cells[aax+aay*w].index + rcGetCon(as, 2);
|
||||||
|
nd = (unsigned char)rcMin((int)dist[aai]+3, 255);
|
||||||
|
if (nd < dist[i])
|
||||||
|
dist[i] = nd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pass 2
|
||||||
|
for (int y = h-1; y >= 0; --y)
|
||||||
|
{
|
||||||
|
for (int x = w-1; x >= 0; --x)
|
||||||
|
{
|
||||||
|
const rcCompactCell& c = chf.cells[x+y*w];
|
||||||
|
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
|
||||||
|
{
|
||||||
|
const rcCompactSpan& s = chf.spans[i];
|
||||||
|
|
||||||
|
if (rcGetCon(s, 2) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
// (1,0)
|
||||||
|
const int ax = x + rcGetDirOffsetX(2);
|
||||||
|
const int ay = y + rcGetDirOffsetY(2);
|
||||||
|
const int ai = (int)chf.cells[ax+ay*w].index + rcGetCon(s, 2);
|
||||||
|
const rcCompactSpan& as = chf.spans[ai];
|
||||||
|
nd = (unsigned char)rcMin((int)dist[ai]+2, 255);
|
||||||
|
if (nd < dist[i])
|
||||||
|
dist[i] = nd;
|
||||||
|
|
||||||
|
// (1,1)
|
||||||
|
if (rcGetCon(as, 1) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const int aax = ax + rcGetDirOffsetX(1);
|
||||||
|
const int aay = ay + rcGetDirOffsetY(1);
|
||||||
|
const int aai = (int)chf.cells[aax+aay*w].index + rcGetCon(as, 1);
|
||||||
|
nd = (unsigned char)rcMin((int)dist[aai]+3, 255);
|
||||||
|
if (nd < dist[i])
|
||||||
|
dist[i] = nd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rcGetCon(s, 1) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
// (0,1)
|
||||||
|
const int ax = x + rcGetDirOffsetX(1);
|
||||||
|
const int ay = y + rcGetDirOffsetY(1);
|
||||||
|
const int ai = (int)chf.cells[ax+ay*w].index + rcGetCon(s, 1);
|
||||||
|
const rcCompactSpan& as = chf.spans[ai];
|
||||||
|
nd = (unsigned char)rcMin((int)dist[ai]+2, 255);
|
||||||
|
if (nd < dist[i])
|
||||||
|
dist[i] = nd;
|
||||||
|
|
||||||
|
// (-1,1)
|
||||||
|
if (rcGetCon(as, 0) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const int aax = ax + rcGetDirOffsetX(0);
|
||||||
|
const int aay = ay + rcGetDirOffsetY(0);
|
||||||
|
const int aai = (int)chf.cells[aax+aay*w].index + rcGetCon(as, 0);
|
||||||
|
nd = (unsigned char)rcMin((int)dist[aai]+3, 255);
|
||||||
|
if (nd < dist[i])
|
||||||
|
dist[i] = nd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const unsigned char thr = (unsigned char)(radius*2);
|
||||||
|
for (int i = 0; i < chf.spanCount; ++i)
|
||||||
|
if (dist[i] < thr)
|
||||||
|
chf.areas[i] = RC_NULL_AREA;
|
||||||
|
|
||||||
|
rcFree(dist);
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_ERODE_AREA);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void insertSort(unsigned char* a, const int n)
|
||||||
|
{
|
||||||
|
int i, j;
|
||||||
|
for (i = 1; i < n; i++)
|
||||||
|
{
|
||||||
|
const unsigned char value = a[i];
|
||||||
|
for (j = i - 1; j >= 0 && a[j] > value; j--)
|
||||||
|
a[j+1] = a[j];
|
||||||
|
a[j+1] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool rcMedianFilterWalkableArea(rcContext* ctx, rcCompactHeightfield& chf)
|
||||||
|
{
|
||||||
|
rcAssert(ctx);
|
||||||
|
|
||||||
|
const int w = chf.width;
|
||||||
|
const int h = chf.height;
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_MEDIAN_AREA);
|
||||||
|
|
||||||
|
unsigned char* areas = (unsigned char*)rcAlloc(sizeof(unsigned char)*chf.spanCount, RC_ALLOC_TEMP);
|
||||||
|
if (!areas)
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_ERROR, "medianFilterWalkableArea: Out of memory 'areas' (%d).", chf.spanCount);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Init distance.
|
||||||
|
memset(areas, 0xff, sizeof(unsigned char)*chf.spanCount);
|
||||||
|
|
||||||
|
for (int y = 0; y < h; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < w; ++x)
|
||||||
|
{
|
||||||
|
const rcCompactCell& c = chf.cells[x+y*w];
|
||||||
|
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
|
||||||
|
{
|
||||||
|
const rcCompactSpan& s = chf.spans[i];
|
||||||
|
if (chf.areas[i] == RC_NULL_AREA)
|
||||||
|
{
|
||||||
|
areas[i] = chf.areas[i];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char nei[9];
|
||||||
|
for (int j = 0; j < 9; ++j)
|
||||||
|
nei[j] = chf.areas[i];
|
||||||
|
|
||||||
|
for (int dir = 0; dir < 4; ++dir)
|
||||||
|
{
|
||||||
|
if (rcGetCon(s, dir) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const int ax = x + rcGetDirOffsetX(dir);
|
||||||
|
const int ay = y + rcGetDirOffsetY(dir);
|
||||||
|
const int ai = (int)chf.cells[ax+ay*w].index + rcGetCon(s, dir);
|
||||||
|
if (chf.areas[ai] != RC_NULL_AREA)
|
||||||
|
nei[dir*2+0] = chf.areas[ai];
|
||||||
|
|
||||||
|
const rcCompactSpan& as = chf.spans[ai];
|
||||||
|
const int dir2 = (dir+1) & 0x3;
|
||||||
|
if (rcGetCon(as, dir2) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const int ax2 = ax + rcGetDirOffsetX(dir2);
|
||||||
|
const int ay2 = ay + rcGetDirOffsetY(dir2);
|
||||||
|
const int ai2 = (int)chf.cells[ax2+ay2*w].index + rcGetCon(as, dir2);
|
||||||
|
if (chf.areas[ai2] != RC_NULL_AREA)
|
||||||
|
nei[dir*2+1] = chf.areas[ai2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
insertSort(nei, 9);
|
||||||
|
areas[i] = nei[4];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(chf.areas, areas, sizeof(unsigned char)*chf.spanCount);
|
||||||
|
|
||||||
|
rcFree(areas);
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_MEDIAN_AREA);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void rcMarkBoxArea(rcContext* ctx, const float* bmin, const float* bmax, unsigned char areaId,
|
||||||
|
rcCompactHeightfield& chf)
|
||||||
|
{
|
||||||
|
rcAssert(ctx);
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_MARK_BOX_AREA);
|
||||||
|
|
||||||
|
int minx = (int)((bmin[0]-chf.bmin[0])/chf.cs);
|
||||||
|
int miny = (int)((bmin[1]-chf.bmin[1])/chf.ch);
|
||||||
|
int minz = (int)((bmin[2]-chf.bmin[2])/chf.cs);
|
||||||
|
int maxx = (int)((bmax[0]-chf.bmin[0])/chf.cs);
|
||||||
|
int maxy = (int)((bmax[1]-chf.bmin[1])/chf.ch);
|
||||||
|
int maxz = (int)((bmax[2]-chf.bmin[2])/chf.cs);
|
||||||
|
|
||||||
|
if (maxx < 0) return;
|
||||||
|
if (minx >= chf.width) return;
|
||||||
|
if (maxz < 0) return;
|
||||||
|
if (minz >= chf.height) return;
|
||||||
|
|
||||||
|
if (minx < 0) minx = 0;
|
||||||
|
if (maxx >= chf.width) maxx = chf.width-1;
|
||||||
|
if (minz < 0) minz = 0;
|
||||||
|
if (maxz >= chf.height) maxz = chf.height-1;
|
||||||
|
|
||||||
|
for (int z = minz; z <= maxz; ++z)
|
||||||
|
{
|
||||||
|
for (int x = minx; x <= maxx; ++x)
|
||||||
|
{
|
||||||
|
const rcCompactCell& c = chf.cells[x+z*chf.width];
|
||||||
|
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
|
||||||
|
{
|
||||||
|
rcCompactSpan& s = chf.spans[i];
|
||||||
|
if ((int)s.y >= miny && (int)s.y <= maxy)
|
||||||
|
{
|
||||||
|
chf.areas[i] = areaId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_MARK_BOX_AREA);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int pointInPoly(int nvert, const float* verts, const float* p)
|
||||||
|
{
|
||||||
|
int i, j, c = 0;
|
||||||
|
for (i = 0, j = nvert-1; i < nvert; j = i++)
|
||||||
|
{
|
||||||
|
const float* vi = &verts[i*3];
|
||||||
|
const float* vj = &verts[j*3];
|
||||||
|
if (((vi[2] > p[2]) != (vj[2] > p[2])) &&
|
||||||
|
(p[0] < (vj[0]-vi[0]) * (p[2]-vi[2]) / (vj[2]-vi[2]) + vi[0]) )
|
||||||
|
c = !c;
|
||||||
|
}
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
void rcMarkConvexPolyArea(rcContext* ctx, const float* verts, const int nverts,
|
||||||
|
const float hmin, const float hmax, unsigned char areaId,
|
||||||
|
rcCompactHeightfield& chf)
|
||||||
|
{
|
||||||
|
rcAssert(ctx);
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_MARK_CONVEXPOLY_AREA);
|
||||||
|
|
||||||
|
float bmin[3], bmax[3];
|
||||||
|
rcVcopy(bmin, verts);
|
||||||
|
rcVcopy(bmax, verts);
|
||||||
|
for (int i = 1; i < nverts; ++i)
|
||||||
|
{
|
||||||
|
rcVmin(bmin, &verts[i*3]);
|
||||||
|
rcVmax(bmax, &verts[i*3]);
|
||||||
|
}
|
||||||
|
bmin[1] = hmin;
|
||||||
|
bmax[1] = hmax;
|
||||||
|
|
||||||
|
int minx = (int)((bmin[0]-chf.bmin[0])/chf.cs);
|
||||||
|
int miny = (int)((bmin[1]-chf.bmin[1])/chf.ch);
|
||||||
|
int minz = (int)((bmin[2]-chf.bmin[2])/chf.cs);
|
||||||
|
int maxx = (int)((bmax[0]-chf.bmin[0])/chf.cs);
|
||||||
|
int maxy = (int)((bmax[1]-chf.bmin[1])/chf.ch);
|
||||||
|
int maxz = (int)((bmax[2]-chf.bmin[2])/chf.cs);
|
||||||
|
|
||||||
|
if (maxx < 0) return;
|
||||||
|
if (minx >= chf.width) return;
|
||||||
|
if (maxz < 0) return;
|
||||||
|
if (minz >= chf.height) return;
|
||||||
|
|
||||||
|
if (minx < 0) minx = 0;
|
||||||
|
if (maxx >= chf.width) maxx = chf.width-1;
|
||||||
|
if (minz < 0) minz = 0;
|
||||||
|
if (maxz >= chf.height) maxz = chf.height-1;
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: Optimize.
|
||||||
|
for (int z = minz; z <= maxz; ++z)
|
||||||
|
{
|
||||||
|
for (int x = minx; x <= maxx; ++x)
|
||||||
|
{
|
||||||
|
const rcCompactCell& c = chf.cells[x+z*chf.width];
|
||||||
|
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
|
||||||
|
{
|
||||||
|
rcCompactSpan& s = chf.spans[i];
|
||||||
|
if ((int)s.y >= miny && (int)s.y <= maxy)
|
||||||
|
{
|
||||||
|
float p[3];
|
||||||
|
p[0] = chf.bmin[0] + (x+0.5f)*chf.cs;
|
||||||
|
p[1] = 0;
|
||||||
|
p[2] = chf.bmin[2] + (z+0.5f)*chf.cs;
|
||||||
|
|
||||||
|
if (pointInPoly(nverts, verts, p))
|
||||||
|
{
|
||||||
|
chf.areas[i] = areaId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_MARK_CONVEXPOLY_AREA);
|
||||||
|
}
|
||||||
804
dep/recastnavigation/Recast/Source/RecastContour.cpp
Normal file
804
dep/recastnavigation/Recast/Source/RecastContour.cpp
Normal file
|
|
@ -0,0 +1,804 @@
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
|
||||||
|
#define _USE_MATH_DEFINES
|
||||||
|
#include <math.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "Recast.h"
|
||||||
|
#include "RecastAlloc.h"
|
||||||
|
#include "RecastAssert.h"
|
||||||
|
|
||||||
|
|
||||||
|
static int getCornerHeight(int x, int y, int i, int dir,
|
||||||
|
const rcCompactHeightfield& chf,
|
||||||
|
bool& isBorderVertex)
|
||||||
|
{
|
||||||
|
const rcCompactSpan& s = chf.spans[i];
|
||||||
|
int ch = (int)s.y;
|
||||||
|
int dirp = (dir+1) & 0x3;
|
||||||
|
|
||||||
|
unsigned int regs[4] = {0,0,0,0};
|
||||||
|
|
||||||
|
// Combine region and area codes in order to prevent
|
||||||
|
// border vertices which are in between two areas to be removed.
|
||||||
|
regs[0] = chf.spans[i].reg | (chf.areas[i] << 16);
|
||||||
|
|
||||||
|
if (rcGetCon(s, dir) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const int ax = x + rcGetDirOffsetX(dir);
|
||||||
|
const int ay = y + rcGetDirOffsetY(dir);
|
||||||
|
const int ai = (int)chf.cells[ax+ay*chf.width].index + rcGetCon(s, dir);
|
||||||
|
const rcCompactSpan& as = chf.spans[ai];
|
||||||
|
ch = rcMax(ch, (int)as.y);
|
||||||
|
regs[1] = chf.spans[ai].reg | (chf.areas[ai] << 16);
|
||||||
|
if (rcGetCon(as, dirp) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const int ax2 = ax + rcGetDirOffsetX(dirp);
|
||||||
|
const int ay2 = ay + rcGetDirOffsetY(dirp);
|
||||||
|
const int ai2 = (int)chf.cells[ax2+ay2*chf.width].index + rcGetCon(as, dirp);
|
||||||
|
const rcCompactSpan& as2 = chf.spans[ai2];
|
||||||
|
ch = rcMax(ch, (int)as2.y);
|
||||||
|
regs[2] = chf.spans[ai2].reg | (chf.areas[ai2] << 16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rcGetCon(s, dirp) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const int ax = x + rcGetDirOffsetX(dirp);
|
||||||
|
const int ay = y + rcGetDirOffsetY(dirp);
|
||||||
|
const int ai = (int)chf.cells[ax+ay*chf.width].index + rcGetCon(s, dirp);
|
||||||
|
const rcCompactSpan& as = chf.spans[ai];
|
||||||
|
ch = rcMax(ch, (int)as.y);
|
||||||
|
regs[3] = chf.spans[ai].reg | (chf.areas[ai] << 16);
|
||||||
|
if (rcGetCon(as, dir) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const int ax2 = ax + rcGetDirOffsetX(dir);
|
||||||
|
const int ay2 = ay + rcGetDirOffsetY(dir);
|
||||||
|
const int ai2 = (int)chf.cells[ax2+ay2*chf.width].index + rcGetCon(as, dir);
|
||||||
|
const rcCompactSpan& as2 = chf.spans[ai2];
|
||||||
|
ch = rcMax(ch, (int)as2.y);
|
||||||
|
regs[2] = chf.spans[ai2].reg | (chf.areas[ai2] << 16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the vertex is special edge vertex, these vertices will be removed later.
|
||||||
|
for (int j = 0; j < 4; ++j)
|
||||||
|
{
|
||||||
|
const int a = j;
|
||||||
|
const int b = (j+1) & 0x3;
|
||||||
|
const int c = (j+2) & 0x3;
|
||||||
|
const int d = (j+3) & 0x3;
|
||||||
|
|
||||||
|
// The vertex is a border vertex there are two same exterior cells in a row,
|
||||||
|
// followed by two interior cells and none of the regions are out of bounds.
|
||||||
|
const bool twoSameExts = (regs[a] & regs[b] & RC_BORDER_REG) != 0 && regs[a] == regs[b];
|
||||||
|
const bool twoInts = ((regs[c] | regs[d]) & RC_BORDER_REG) == 0;
|
||||||
|
const bool intsSameArea = (regs[c]>>16) == (regs[d]>>16);
|
||||||
|
const bool noZeros = regs[a] != 0 && regs[b] != 0 && regs[c] != 0 && regs[d] != 0;
|
||||||
|
if (twoSameExts && twoInts && intsSameArea && noZeros)
|
||||||
|
{
|
||||||
|
isBorderVertex = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ch;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void walkContour(int x, int y, int i,
|
||||||
|
rcCompactHeightfield& chf,
|
||||||
|
unsigned char* flags, rcIntArray& points)
|
||||||
|
{
|
||||||
|
// Choose the first non-connected edge
|
||||||
|
unsigned char dir = 0;
|
||||||
|
while ((flags[i] & (1 << dir)) == 0)
|
||||||
|
dir++;
|
||||||
|
|
||||||
|
unsigned char startDir = dir;
|
||||||
|
int starti = i;
|
||||||
|
|
||||||
|
const unsigned char area = chf.areas[i];
|
||||||
|
|
||||||
|
int iter = 0;
|
||||||
|
while (++iter < 40000)
|
||||||
|
{
|
||||||
|
if (flags[i] & (1 << dir))
|
||||||
|
{
|
||||||
|
// Choose the edge corner
|
||||||
|
bool isBorderVertex = false;
|
||||||
|
bool isAreaBorder = false;
|
||||||
|
int px = x;
|
||||||
|
int py = getCornerHeight(x, y, i, dir, chf, isBorderVertex);
|
||||||
|
int pz = y;
|
||||||
|
switch(dir)
|
||||||
|
{
|
||||||
|
case 0: pz++; break;
|
||||||
|
case 1: px++; pz++; break;
|
||||||
|
case 2: px++; break;
|
||||||
|
}
|
||||||
|
int r = 0;
|
||||||
|
const rcCompactSpan& s = chf.spans[i];
|
||||||
|
if (rcGetCon(s, dir) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const int ax = x + rcGetDirOffsetX(dir);
|
||||||
|
const int ay = y + rcGetDirOffsetY(dir);
|
||||||
|
const int ai = (int)chf.cells[ax+ay*chf.width].index + rcGetCon(s, dir);
|
||||||
|
r = (int)chf.spans[ai].reg;
|
||||||
|
if (area != chf.areas[ai])
|
||||||
|
isAreaBorder = true;
|
||||||
|
}
|
||||||
|
if (isBorderVertex)
|
||||||
|
r |= RC_BORDER_VERTEX;
|
||||||
|
if (isAreaBorder)
|
||||||
|
r |= RC_AREA_BORDER;
|
||||||
|
points.push(px);
|
||||||
|
points.push(py);
|
||||||
|
points.push(pz);
|
||||||
|
points.push(r);
|
||||||
|
|
||||||
|
flags[i] &= ~(1 << dir); // Remove visited edges
|
||||||
|
dir = (dir+1) & 0x3; // Rotate CW
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int ni = -1;
|
||||||
|
const int nx = x + rcGetDirOffsetX(dir);
|
||||||
|
const int ny = y + rcGetDirOffsetY(dir);
|
||||||
|
const rcCompactSpan& s = chf.spans[i];
|
||||||
|
if (rcGetCon(s, dir) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const rcCompactCell& nc = chf.cells[nx+ny*chf.width];
|
||||||
|
ni = (int)nc.index + rcGetCon(s, dir);
|
||||||
|
}
|
||||||
|
if (ni == -1)
|
||||||
|
{
|
||||||
|
// Should not happen.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
x = nx;
|
||||||
|
y = ny;
|
||||||
|
i = ni;
|
||||||
|
dir = (dir+3) & 0x3; // Rotate CCW
|
||||||
|
}
|
||||||
|
|
||||||
|
if (starti == i && startDir == dir)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static float distancePtSeg(const int x, const int z,
|
||||||
|
const int px, const int pz,
|
||||||
|
const int qx, const int qz)
|
||||||
|
{
|
||||||
|
/* float pqx = (float)(qx - px);
|
||||||
|
float pqy = (float)(qy - py);
|
||||||
|
float pqz = (float)(qz - pz);
|
||||||
|
float dx = (float)(x - px);
|
||||||
|
float dy = (float)(y - py);
|
||||||
|
float dz = (float)(z - pz);
|
||||||
|
float d = pqx*pqx + pqy*pqy + pqz*pqz;
|
||||||
|
float t = pqx*dx + pqy*dy + pqz*dz;
|
||||||
|
if (d > 0)
|
||||||
|
t /= d;
|
||||||
|
if (t < 0)
|
||||||
|
t = 0;
|
||||||
|
else if (t > 1)
|
||||||
|
t = 1;
|
||||||
|
|
||||||
|
dx = px + t*pqx - x;
|
||||||
|
dy = py + t*pqy - y;
|
||||||
|
dz = pz + t*pqz - z;
|
||||||
|
|
||||||
|
return dx*dx + dy*dy + dz*dz;*/
|
||||||
|
|
||||||
|
float pqx = (float)(qx - px);
|
||||||
|
float pqz = (float)(qz - pz);
|
||||||
|
float dx = (float)(x - px);
|
||||||
|
float dz = (float)(z - pz);
|
||||||
|
float d = pqx*pqx + pqz*pqz;
|
||||||
|
float t = pqx*dx + pqz*dz;
|
||||||
|
if (d > 0)
|
||||||
|
t /= d;
|
||||||
|
if (t < 0)
|
||||||
|
t = 0;
|
||||||
|
else if (t > 1)
|
||||||
|
t = 1;
|
||||||
|
|
||||||
|
dx = px + t*pqx - x;
|
||||||
|
dz = pz + t*pqz - z;
|
||||||
|
|
||||||
|
return dx*dx + dz*dz;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void simplifyContour(rcIntArray& points, rcIntArray& simplified,
|
||||||
|
const float maxError, const int maxEdgeLen, const int buildFlags)
|
||||||
|
{
|
||||||
|
// Add initial points.
|
||||||
|
bool hasConnections = false;
|
||||||
|
for (int i = 0; i < points.size(); i += 4)
|
||||||
|
{
|
||||||
|
if ((points[i+3] & RC_CONTOUR_REG_MASK) != 0)
|
||||||
|
{
|
||||||
|
hasConnections = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasConnections)
|
||||||
|
{
|
||||||
|
// The contour has some portals to other regions.
|
||||||
|
// Add a new point to every location where the region changes.
|
||||||
|
for (int i = 0, ni = points.size()/4; i < ni; ++i)
|
||||||
|
{
|
||||||
|
int ii = (i+1) % ni;
|
||||||
|
const bool differentRegs = (points[i*4+3] & RC_CONTOUR_REG_MASK) != (points[ii*4+3] & RC_CONTOUR_REG_MASK);
|
||||||
|
const bool areaBorders = (points[i*4+3] & RC_AREA_BORDER) != (points[ii*4+3] & RC_AREA_BORDER);
|
||||||
|
if (differentRegs || areaBorders)
|
||||||
|
{
|
||||||
|
simplified.push(points[i*4+0]);
|
||||||
|
simplified.push(points[i*4+1]);
|
||||||
|
simplified.push(points[i*4+2]);
|
||||||
|
simplified.push(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (simplified.size() == 0)
|
||||||
|
{
|
||||||
|
// If there is no connections at all,
|
||||||
|
// create some initial points for the simplification process.
|
||||||
|
// Find lower-left and upper-right vertices of the contour.
|
||||||
|
int llx = points[0];
|
||||||
|
int lly = points[1];
|
||||||
|
int llz = points[2];
|
||||||
|
int lli = 0;
|
||||||
|
int urx = points[0];
|
||||||
|
int ury = points[1];
|
||||||
|
int urz = points[2];
|
||||||
|
int uri = 0;
|
||||||
|
for (int i = 0; i < points.size(); i += 4)
|
||||||
|
{
|
||||||
|
int x = points[i+0];
|
||||||
|
int y = points[i+1];
|
||||||
|
int z = points[i+2];
|
||||||
|
if (x < llx || (x == llx && z < llz))
|
||||||
|
{
|
||||||
|
llx = x;
|
||||||
|
lly = y;
|
||||||
|
llz = z;
|
||||||
|
lli = i/4;
|
||||||
|
}
|
||||||
|
if (x > urx || (x == urx && z > urz))
|
||||||
|
{
|
||||||
|
urx = x;
|
||||||
|
ury = y;
|
||||||
|
urz = z;
|
||||||
|
uri = i/4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
simplified.push(llx);
|
||||||
|
simplified.push(lly);
|
||||||
|
simplified.push(llz);
|
||||||
|
simplified.push(lli);
|
||||||
|
|
||||||
|
simplified.push(urx);
|
||||||
|
simplified.push(ury);
|
||||||
|
simplified.push(urz);
|
||||||
|
simplified.push(uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add points until all raw points are within
|
||||||
|
// error tolerance to the simplified shape.
|
||||||
|
const int pn = points.size()/4;
|
||||||
|
for (int i = 0; i < simplified.size()/4; )
|
||||||
|
{
|
||||||
|
int ii = (i+1) % (simplified.size()/4);
|
||||||
|
|
||||||
|
const int ax = simplified[i*4+0];
|
||||||
|
const int az = simplified[i*4+2];
|
||||||
|
const int ai = simplified[i*4+3];
|
||||||
|
|
||||||
|
const int bx = simplified[ii*4+0];
|
||||||
|
const int bz = simplified[ii*4+2];
|
||||||
|
const int bi = simplified[ii*4+3];
|
||||||
|
|
||||||
|
// Find maximum deviation from the segment.
|
||||||
|
float maxd = 0;
|
||||||
|
int maxi = -1;
|
||||||
|
int ci, cinc, endi;
|
||||||
|
|
||||||
|
// Traverse the segment in lexilogical order so that the
|
||||||
|
// max deviation is calculated similarly when traversing
|
||||||
|
// opposite segments.
|
||||||
|
if (bx > ax || (bx == ax && bz > az))
|
||||||
|
{
|
||||||
|
cinc = 1;
|
||||||
|
ci = (ai+cinc) % pn;
|
||||||
|
endi = bi;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cinc = pn-1;
|
||||||
|
ci = (bi+cinc) % pn;
|
||||||
|
endi = ai;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tessellate only outer edges oredges between areas.
|
||||||
|
if ((points[ci*4+3] & RC_CONTOUR_REG_MASK) == 0 ||
|
||||||
|
(points[ci*4+3] & RC_AREA_BORDER))
|
||||||
|
{
|
||||||
|
while (ci != endi)
|
||||||
|
{
|
||||||
|
float d = distancePtSeg(points[ci*4+0], points[ci*4+2], ax, az, bx, bz);
|
||||||
|
if (d > maxd)
|
||||||
|
{
|
||||||
|
maxd = d;
|
||||||
|
maxi = ci;
|
||||||
|
}
|
||||||
|
ci = (ci+cinc) % pn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// If the max deviation is larger than accepted error,
|
||||||
|
// add new point, else continue to next segment.
|
||||||
|
if (maxi != -1 && maxd > (maxError*maxError))
|
||||||
|
{
|
||||||
|
// Add space for the new point.
|
||||||
|
simplified.resize(simplified.size()+4);
|
||||||
|
const int n = simplified.size()/4;
|
||||||
|
for (int j = n-1; j > i; --j)
|
||||||
|
{
|
||||||
|
simplified[j*4+0] = simplified[(j-1)*4+0];
|
||||||
|
simplified[j*4+1] = simplified[(j-1)*4+1];
|
||||||
|
simplified[j*4+2] = simplified[(j-1)*4+2];
|
||||||
|
simplified[j*4+3] = simplified[(j-1)*4+3];
|
||||||
|
}
|
||||||
|
// Add the point.
|
||||||
|
simplified[(i+1)*4+0] = points[maxi*4+0];
|
||||||
|
simplified[(i+1)*4+1] = points[maxi*4+1];
|
||||||
|
simplified[(i+1)*4+2] = points[maxi*4+2];
|
||||||
|
simplified[(i+1)*4+3] = maxi;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Split too long edges.
|
||||||
|
if (maxEdgeLen > 0 && (buildFlags & (RC_CONTOUR_TESS_WALL_EDGES|RC_CONTOUR_TESS_AREA_EDGES)) != 0)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < simplified.size()/4; )
|
||||||
|
{
|
||||||
|
const int ii = (i+1) % (simplified.size()/4);
|
||||||
|
|
||||||
|
const int ax = simplified[i*4+0];
|
||||||
|
const int az = simplified[i*4+2];
|
||||||
|
const int ai = simplified[i*4+3];
|
||||||
|
|
||||||
|
const int bx = simplified[ii*4+0];
|
||||||
|
const int bz = simplified[ii*4+2];
|
||||||
|
const int bi = simplified[ii*4+3];
|
||||||
|
|
||||||
|
// Find maximum deviation from the segment.
|
||||||
|
int maxi = -1;
|
||||||
|
int ci = (ai+1) % pn;
|
||||||
|
|
||||||
|
// Tessellate only outer edges or edges between areas.
|
||||||
|
bool tess = false;
|
||||||
|
// Wall edges.
|
||||||
|
if ((buildFlags & RC_CONTOUR_TESS_WALL_EDGES) && (points[ci*4+3] & RC_CONTOUR_REG_MASK) == 0)
|
||||||
|
tess = true;
|
||||||
|
// Edges between areas.
|
||||||
|
if ((buildFlags & RC_CONTOUR_TESS_AREA_EDGES) && (points[ci*4+3] & RC_AREA_BORDER))
|
||||||
|
tess = true;
|
||||||
|
|
||||||
|
if (tess)
|
||||||
|
{
|
||||||
|
int dx = bx - ax;
|
||||||
|
int dz = bz - az;
|
||||||
|
if (dx*dx + dz*dz > maxEdgeLen*maxEdgeLen)
|
||||||
|
{
|
||||||
|
// Round based on the segments in lexilogical order so that the
|
||||||
|
// max tesselation is consistent regardles in which direction
|
||||||
|
// segments are traversed.
|
||||||
|
if (bx > ax || (bx == ax && bz > az))
|
||||||
|
{
|
||||||
|
const int n = bi < ai ? (bi+pn - ai) : (bi - ai);
|
||||||
|
maxi = (ai + n/2) % pn;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const int n = bi < ai ? (bi+pn - ai) : (bi - ai);
|
||||||
|
maxi = (ai + (n+1)/2) % pn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the max deviation is larger than accepted error,
|
||||||
|
// add new point, else continue to next segment.
|
||||||
|
if (maxi != -1)
|
||||||
|
{
|
||||||
|
// Add space for the new point.
|
||||||
|
simplified.resize(simplified.size()+4);
|
||||||
|
const int n = simplified.size()/4;
|
||||||
|
for (int j = n-1; j > i; --j)
|
||||||
|
{
|
||||||
|
simplified[j*4+0] = simplified[(j-1)*4+0];
|
||||||
|
simplified[j*4+1] = simplified[(j-1)*4+1];
|
||||||
|
simplified[j*4+2] = simplified[(j-1)*4+2];
|
||||||
|
simplified[j*4+3] = simplified[(j-1)*4+3];
|
||||||
|
}
|
||||||
|
// Add the point.
|
||||||
|
simplified[(i+1)*4+0] = points[maxi*4+0];
|
||||||
|
simplified[(i+1)*4+1] = points[maxi*4+1];
|
||||||
|
simplified[(i+1)*4+2] = points[maxi*4+2];
|
||||||
|
simplified[(i+1)*4+3] = maxi;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < simplified.size()/4; ++i)
|
||||||
|
{
|
||||||
|
// The edge vertex flag is take from the current raw point,
|
||||||
|
// and the neighbour region is take from the next raw point.
|
||||||
|
const int ai = (simplified[i*4+3]+1) % pn;
|
||||||
|
const int bi = simplified[i*4+3];
|
||||||
|
simplified[i*4+3] = (points[ai*4+3] & RC_CONTOUR_REG_MASK) | (points[bi*4+3] & RC_BORDER_VERTEX);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void removeDegenerateSegments(rcIntArray& simplified)
|
||||||
|
{
|
||||||
|
// Remove adjacent vertices which are equal on xz-plane,
|
||||||
|
// or else the triangulator will get confused.
|
||||||
|
for (int i = 0; i < simplified.size()/4; ++i)
|
||||||
|
{
|
||||||
|
int ni = i+1;
|
||||||
|
if (ni >= (simplified.size()/4))
|
||||||
|
ni = 0;
|
||||||
|
|
||||||
|
if (simplified[i*4+0] == simplified[ni*4+0] &&
|
||||||
|
simplified[i*4+2] == simplified[ni*4+2])
|
||||||
|
{
|
||||||
|
// Degenerate segment, remove.
|
||||||
|
for (int j = i; j < simplified.size()/4-1; ++j)
|
||||||
|
{
|
||||||
|
simplified[j*4+0] = simplified[(j+1)*4+0];
|
||||||
|
simplified[j*4+1] = simplified[(j+1)*4+1];
|
||||||
|
simplified[j*4+2] = simplified[(j+1)*4+2];
|
||||||
|
simplified[j*4+3] = simplified[(j+1)*4+3];
|
||||||
|
}
|
||||||
|
simplified.resize(simplified.size()-4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int calcAreaOfPolygon2D(const int* verts, const int nverts)
|
||||||
|
{
|
||||||
|
int area = 0;
|
||||||
|
for (int i = 0, j = nverts-1; i < nverts; j=i++)
|
||||||
|
{
|
||||||
|
const int* vi = &verts[i*4];
|
||||||
|
const int* vj = &verts[j*4];
|
||||||
|
area += vi[0] * vj[2] - vj[0] * vi[2];
|
||||||
|
}
|
||||||
|
return (area+1) / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool ileft(const int* a, const int* b, const int* c)
|
||||||
|
{
|
||||||
|
return (b[0] - a[0]) * (c[2] - a[2]) - (c[0] - a[0]) * (b[2] - a[2]) <= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void getClosestIndices(const int* vertsa, const int nvertsa,
|
||||||
|
const int* vertsb, const int nvertsb,
|
||||||
|
int& ia, int& ib)
|
||||||
|
{
|
||||||
|
int closestDist = 0xfffffff;
|
||||||
|
ia = -1, ib = -1;
|
||||||
|
for (int i = 0; i < nvertsa; ++i)
|
||||||
|
{
|
||||||
|
const int in = (i+1) % nvertsa;
|
||||||
|
const int ip = (i+nvertsa-1) % nvertsa;
|
||||||
|
const int* va = &vertsa[i*4];
|
||||||
|
const int* van = &vertsa[in*4];
|
||||||
|
const int* vap = &vertsa[ip*4];
|
||||||
|
|
||||||
|
for (int j = 0; j < nvertsb; ++j)
|
||||||
|
{
|
||||||
|
const int* vb = &vertsb[j*4];
|
||||||
|
// vb must be "infront" of va.
|
||||||
|
if (ileft(vap,va,vb) && ileft(va,van,vb))
|
||||||
|
{
|
||||||
|
const int dx = vb[0] - va[0];
|
||||||
|
const int dz = vb[2] - va[2];
|
||||||
|
const int d = dx*dx + dz*dz;
|
||||||
|
if (d < closestDist)
|
||||||
|
{
|
||||||
|
ia = i;
|
||||||
|
ib = j;
|
||||||
|
closestDist = d;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool mergeContours(rcContour& ca, rcContour& cb, int ia, int ib)
|
||||||
|
{
|
||||||
|
const int maxVerts = ca.nverts + cb.nverts + 2;
|
||||||
|
int* verts = (int*)rcAlloc(sizeof(int)*maxVerts*4, RC_ALLOC_PERM);
|
||||||
|
if (!verts)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
int nv = 0;
|
||||||
|
|
||||||
|
// Copy contour A.
|
||||||
|
for (int i = 0; i <= ca.nverts; ++i)
|
||||||
|
{
|
||||||
|
int* dst = &verts[nv*4];
|
||||||
|
const int* src = &ca.verts[((ia+i)%ca.nverts)*4];
|
||||||
|
dst[0] = src[0];
|
||||||
|
dst[1] = src[1];
|
||||||
|
dst[2] = src[2];
|
||||||
|
dst[3] = src[3];
|
||||||
|
nv++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy contour B
|
||||||
|
for (int i = 0; i <= cb.nverts; ++i)
|
||||||
|
{
|
||||||
|
int* dst = &verts[nv*4];
|
||||||
|
const int* src = &cb.verts[((ib+i)%cb.nverts)*4];
|
||||||
|
dst[0] = src[0];
|
||||||
|
dst[1] = src[1];
|
||||||
|
dst[2] = src[2];
|
||||||
|
dst[3] = src[3];
|
||||||
|
nv++;
|
||||||
|
}
|
||||||
|
|
||||||
|
rcFree(ca.verts);
|
||||||
|
ca.verts = verts;
|
||||||
|
ca.nverts = nv;
|
||||||
|
|
||||||
|
rcFree(cb.verts);
|
||||||
|
cb.verts = 0;
|
||||||
|
cb.nverts = 0;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool rcBuildContours(rcContext* ctx, rcCompactHeightfield& chf,
|
||||||
|
const float maxError, const int maxEdgeLen,
|
||||||
|
rcContourSet& cset, const int buildFlags)
|
||||||
|
{
|
||||||
|
rcAssert(ctx);
|
||||||
|
|
||||||
|
const int w = chf.width;
|
||||||
|
const int h = chf.height;
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_BUILD_CONTOURS);
|
||||||
|
|
||||||
|
rcVcopy(cset.bmin, chf.bmin);
|
||||||
|
rcVcopy(cset.bmax, chf.bmax);
|
||||||
|
cset.cs = chf.cs;
|
||||||
|
cset.ch = chf.ch;
|
||||||
|
|
||||||
|
int maxContours = rcMax((int)chf.maxRegions, 8);
|
||||||
|
cset.conts = (rcContour*)rcAlloc(sizeof(rcContour)*maxContours, RC_ALLOC_PERM);
|
||||||
|
if (!cset.conts)
|
||||||
|
return false;
|
||||||
|
cset.nconts = 0;
|
||||||
|
|
||||||
|
rcScopedDelete<unsigned char> flags = (unsigned char*)rcAlloc(sizeof(unsigned char)*chf.spanCount, RC_ALLOC_TEMP);
|
||||||
|
if (!flags)
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_ERROR, "rcBuildContours: Out of memory 'flags' (%d).", chf.spanCount);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_BUILD_CONTOURS_TRACE);
|
||||||
|
|
||||||
|
// Mark boundaries.
|
||||||
|
for (int y = 0; y < h; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < w; ++x)
|
||||||
|
{
|
||||||
|
const rcCompactCell& c = chf.cells[x+y*w];
|
||||||
|
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
|
||||||
|
{
|
||||||
|
unsigned char res = 0;
|
||||||
|
const rcCompactSpan& s = chf.spans[i];
|
||||||
|
if (!chf.spans[i].reg || (chf.spans[i].reg & RC_BORDER_REG))
|
||||||
|
{
|
||||||
|
flags[i] = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (int dir = 0; dir < 4; ++dir)
|
||||||
|
{
|
||||||
|
unsigned short r = 0;
|
||||||
|
if (rcGetCon(s, dir) != RC_NOT_CONNECTED)
|
||||||
|
{
|
||||||
|
const int ax = x + rcGetDirOffsetX(dir);
|
||||||
|
const int ay = y + rcGetDirOffsetY(dir);
|
||||||
|
const int ai = (int)chf.cells[ax+ay*w].index + rcGetCon(s, dir);
|
||||||
|
r = chf.spans[ai].reg;
|
||||||
|
}
|
||||||
|
if (r == chf.spans[i].reg)
|
||||||
|
res |= (1 << dir);
|
||||||
|
}
|
||||||
|
flags[i] = res ^ 0xf; // Inverse, mark non connected edges.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_BUILD_CONTOURS_TRACE);
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_BUILD_CONTOURS_SIMPLIFY);
|
||||||
|
|
||||||
|
rcIntArray verts(256);
|
||||||
|
rcIntArray simplified(64);
|
||||||
|
|
||||||
|
for (int y = 0; y < h; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < w; ++x)
|
||||||
|
{
|
||||||
|
const rcCompactCell& c = chf.cells[x+y*w];
|
||||||
|
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
|
||||||
|
{
|
||||||
|
if (flags[i] == 0 || flags[i] == 0xf)
|
||||||
|
{
|
||||||
|
flags[i] = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const unsigned short reg = chf.spans[i].reg;
|
||||||
|
if (!reg || (reg & RC_BORDER_REG))
|
||||||
|
continue;
|
||||||
|
const unsigned char area = chf.areas[i];
|
||||||
|
|
||||||
|
verts.resize(0);
|
||||||
|
simplified.resize(0);
|
||||||
|
walkContour(x, y, i, chf, flags, verts);
|
||||||
|
simplifyContour(verts, simplified, maxError, maxEdgeLen, buildFlags);
|
||||||
|
removeDegenerateSegments(simplified);
|
||||||
|
|
||||||
|
// Store region->contour remap info.
|
||||||
|
// Create contour.
|
||||||
|
if (simplified.size()/4 >= 3)
|
||||||
|
{
|
||||||
|
if (cset.nconts >= maxContours)
|
||||||
|
{
|
||||||
|
// Allocate more contours.
|
||||||
|
// This can happen when there are tiny holes in the heightfield.
|
||||||
|
const int oldMax = maxContours;
|
||||||
|
maxContours *= 2;
|
||||||
|
rcContour* newConts = (rcContour*)rcAlloc(sizeof(rcContour)*maxContours, RC_ALLOC_PERM);
|
||||||
|
for (int j = 0; j < cset.nconts; ++j)
|
||||||
|
{
|
||||||
|
newConts[j] = cset.conts[j];
|
||||||
|
// Reset source pointers to prevent data deletion.
|
||||||
|
cset.conts[j].verts = 0;
|
||||||
|
cset.conts[j].rverts = 0;
|
||||||
|
}
|
||||||
|
rcFree(cset.conts);
|
||||||
|
cset.conts = newConts;
|
||||||
|
|
||||||
|
ctx->log(RC_LOG_WARNING, "rcBuildContours: Expanding max contours from %d to %d.", oldMax, maxContours);
|
||||||
|
}
|
||||||
|
|
||||||
|
rcContour* cont = &cset.conts[cset.nconts++];
|
||||||
|
|
||||||
|
cont->nverts = simplified.size()/4;
|
||||||
|
cont->verts = (int*)rcAlloc(sizeof(int)*cont->nverts*4, RC_ALLOC_PERM);
|
||||||
|
if (!cont->verts)
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_ERROR, "rcBuildContours: Out of memory 'verts' (%d).", cont->nverts);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
memcpy(cont->verts, &simplified[0], sizeof(int)*cont->nverts*4);
|
||||||
|
|
||||||
|
cont->nrverts = verts.size()/4;
|
||||||
|
cont->rverts = (int*)rcAlloc(sizeof(int)*cont->nrverts*4, RC_ALLOC_PERM);
|
||||||
|
if (!cont->rverts)
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_ERROR, "rcBuildContours: Out of memory 'rverts' (%d).", cont->nrverts);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
memcpy(cont->rverts, &verts[0], sizeof(int)*cont->nrverts*4);
|
||||||
|
|
||||||
|
/* cont->cx = cont->cy = cont->cz = 0;
|
||||||
|
for (int i = 0; i < cont->nverts; ++i)
|
||||||
|
{
|
||||||
|
cont->cx += cont->verts[i*4+0];
|
||||||
|
cont->cy += cont->verts[i*4+1];
|
||||||
|
cont->cz += cont->verts[i*4+2];
|
||||||
|
}
|
||||||
|
cont->cx /= cont->nverts;
|
||||||
|
cont->cy /= cont->nverts;
|
||||||
|
cont->cz /= cont->nverts;*/
|
||||||
|
|
||||||
|
cont->reg = reg;
|
||||||
|
cont->area = area;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check and merge droppings.
|
||||||
|
// Sometimes the previous algorithms can fail and create several contours
|
||||||
|
// per area. This pass will try to merge the holes into the main region.
|
||||||
|
for (int i = 0; i < cset.nconts; ++i)
|
||||||
|
{
|
||||||
|
rcContour& cont = cset.conts[i];
|
||||||
|
// Check if the contour is would backwards.
|
||||||
|
if (calcAreaOfPolygon2D(cont.verts, cont.nverts) < 0)
|
||||||
|
{
|
||||||
|
// Find another contour which has the same region ID.
|
||||||
|
int mergeIdx = -1;
|
||||||
|
for (int j = 0; j < cset.nconts; ++j)
|
||||||
|
{
|
||||||
|
if (i == j) continue;
|
||||||
|
if (cset.conts[j].nverts && cset.conts[j].reg == cont.reg)
|
||||||
|
{
|
||||||
|
// Make sure the polygon is correctly oriented.
|
||||||
|
if (calcAreaOfPolygon2D(cset.conts[j].verts, cset.conts[j].nverts))
|
||||||
|
{
|
||||||
|
mergeIdx = j;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mergeIdx == -1)
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_WARNING, "rcBuildContours: Could not find merge target for bad contour %d.", i);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rcContour& mcont = cset.conts[mergeIdx];
|
||||||
|
// Merge by closest points.
|
||||||
|
int ia = 0, ib = 0;
|
||||||
|
getClosestIndices(mcont.verts, mcont.nverts, cont.verts, cont.nverts, ia, ib);
|
||||||
|
if (ia == -1 || ib == -1)
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_WARNING, "rcBuildContours: Failed to find merge points for %d and %d.", i, mergeIdx);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!mergeContours(mcont, cont, ia, ib))
|
||||||
|
{
|
||||||
|
ctx->log(RC_LOG_WARNING, "rcBuildContours: Failed to merge contours %d and %d.", i, mergeIdx);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_BUILD_CONTOURS_SIMPLIFY);
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_BUILD_CONTOURS);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
179
dep/recastnavigation/Recast/Source/RecastFilter.cpp
Normal file
179
dep/recastnavigation/Recast/Source/RecastFilter.cpp
Normal file
|
|
@ -0,0 +1,179 @@
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
|
||||||
|
#define _USE_MATH_DEFINES
|
||||||
|
#include <math.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "Recast.h"
|
||||||
|
#include "RecastAssert.h"
|
||||||
|
|
||||||
|
|
||||||
|
void rcFilterLowHangingWalkableObstacles(rcContext* ctx, const int walkableClimb, rcHeightfield& solid)
|
||||||
|
{
|
||||||
|
rcAssert(ctx);
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_FILTER_LOW_OBSTACLES);
|
||||||
|
|
||||||
|
const int w = solid.width;
|
||||||
|
const int h = solid.height;
|
||||||
|
|
||||||
|
for (int y = 0; y < h; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < w; ++x)
|
||||||
|
{
|
||||||
|
rcSpan* ps = 0;
|
||||||
|
bool previousWalkable = false;
|
||||||
|
|
||||||
|
for (rcSpan* s = solid.spans[x + y*w]; s; ps = s, s = s->next)
|
||||||
|
{
|
||||||
|
const bool walkable = s->area != RC_NULL_AREA;
|
||||||
|
// If current span is not walkable, but there is walkable
|
||||||
|
// span just below it, mark the span above it walkable too.
|
||||||
|
if (!walkable && previousWalkable)
|
||||||
|
{
|
||||||
|
if (rcAbs((int)s->smax - (int)ps->smax) <= walkableClimb)
|
||||||
|
s->area = RC_NULL_AREA;
|
||||||
|
}
|
||||||
|
// Copy walkable flag so that it cannot propagate
|
||||||
|
// past multiple non-walkable objects.
|
||||||
|
previousWalkable = walkable;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_FILTER_LOW_OBSTACLES);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rcFilterLedgeSpans(rcContext* ctx, const int walkableHeight, const int walkableClimb,
|
||||||
|
rcHeightfield& solid)
|
||||||
|
{
|
||||||
|
rcAssert(ctx);
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_FILTER_BORDER);
|
||||||
|
|
||||||
|
const int w = solid.width;
|
||||||
|
const int h = solid.height;
|
||||||
|
const int MAX_HEIGHT = 0xffff;
|
||||||
|
|
||||||
|
// Mark border spans.
|
||||||
|
for (int y = 0; y < h; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < w; ++x)
|
||||||
|
{
|
||||||
|
for (rcSpan* s = solid.spans[x + y*w]; s; s = s->next)
|
||||||
|
{
|
||||||
|
// Skip non walkable spans.
|
||||||
|
if (s->area == RC_NULL_AREA)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const int bot = (int)(s->smax);
|
||||||
|
const int top = s->next ? (int)(s->next->smin) : MAX_HEIGHT;
|
||||||
|
|
||||||
|
// Find neighbours minimum height.
|
||||||
|
int minh = MAX_HEIGHT;
|
||||||
|
|
||||||
|
// Min and max height of accessible neighbours.
|
||||||
|
int asmin = s->smax;
|
||||||
|
int asmax = s->smax;
|
||||||
|
|
||||||
|
for (int dir = 0; dir < 4; ++dir)
|
||||||
|
{
|
||||||
|
int dx = x + rcGetDirOffsetX(dir);
|
||||||
|
int dy = y + rcGetDirOffsetY(dir);
|
||||||
|
// Skip neighbours which are out of bounds.
|
||||||
|
if (dx < 0 || dy < 0 || dx >= w || dy >= h)
|
||||||
|
{
|
||||||
|
minh = rcMin(minh, -walkableClimb - bot);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// From minus infinity to the first span.
|
||||||
|
rcSpan* ns = solid.spans[dx + dy*w];
|
||||||
|
int nbot = -walkableClimb;
|
||||||
|
int ntop = ns ? (int)ns->smin : MAX_HEIGHT;
|
||||||
|
// Skip neightbour if the gap between the spans is too small.
|
||||||
|
if (rcMin(top,ntop) - rcMax(bot,nbot) > walkableHeight)
|
||||||
|
minh = rcMin(minh, nbot - bot);
|
||||||
|
|
||||||
|
// Rest of the spans.
|
||||||
|
for (ns = solid.spans[dx + dy*w]; ns; ns = ns->next)
|
||||||
|
{
|
||||||
|
nbot = (int)ns->smax;
|
||||||
|
ntop = ns->next ? (int)ns->next->smin : MAX_HEIGHT;
|
||||||
|
// Skip neightbour if the gap between the spans is too small.
|
||||||
|
if (rcMin(top,ntop) - rcMax(bot,nbot) > walkableHeight)
|
||||||
|
{
|
||||||
|
minh = rcMin(minh, nbot - bot);
|
||||||
|
|
||||||
|
// Find min/max accessible neighbour height.
|
||||||
|
if (rcAbs(nbot - bot) <= walkableClimb)
|
||||||
|
{
|
||||||
|
if (nbot < asmin) asmin = nbot;
|
||||||
|
if (nbot > asmax) asmax = nbot;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// The current span is close to a ledge if the drop to any
|
||||||
|
// neighbour span is less than the walkableClimb.
|
||||||
|
if (minh < -walkableClimb)
|
||||||
|
s->area = RC_NULL_AREA;
|
||||||
|
|
||||||
|
// If the difference between all neighbours is too large,
|
||||||
|
// we are at steep slope, mark the span as ledge.
|
||||||
|
if ((asmax - asmin) > walkableClimb)
|
||||||
|
{
|
||||||
|
s->area = RC_NULL_AREA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_FILTER_BORDER);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rcFilterWalkableLowHeightSpans(rcContext* ctx, int walkableHeight, rcHeightfield& solid)
|
||||||
|
{
|
||||||
|
rcAssert(ctx);
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_FILTER_WALKABLE);
|
||||||
|
|
||||||
|
const int w = solid.width;
|
||||||
|
const int h = solid.height;
|
||||||
|
const int MAX_HEIGHT = 0xffff;
|
||||||
|
|
||||||
|
// Remove walkable flag from spans which do not have enough
|
||||||
|
// space above them for the agent to stand there.
|
||||||
|
for (int y = 0; y < h; ++y)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < w; ++x)
|
||||||
|
{
|
||||||
|
for (rcSpan* s = solid.spans[x + y*w]; s; s = s->next)
|
||||||
|
{
|
||||||
|
const int bot = (int)(s->smax);
|
||||||
|
const int top = s->next ? (int)(s->next->smin) : MAX_HEIGHT;
|
||||||
|
if ((top - bot) <= walkableHeight)
|
||||||
|
s->area = RC_NULL_AREA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_FILTER_WALKABLE);
|
||||||
|
}
|
||||||
1322
dep/recastnavigation/Recast/Source/RecastMesh.cpp
Normal file
1322
dep/recastnavigation/Recast/Source/RecastMesh.cpp
Normal file
File diff suppressed because it is too large
Load diff
1237
dep/recastnavigation/Recast/Source/RecastMeshDetail.cpp
Normal file
1237
dep/recastnavigation/Recast/Source/RecastMeshDetail.cpp
Normal file
File diff suppressed because it is too large
Load diff
360
dep/recastnavigation/Recast/Source/RecastRasterization.cpp
Normal file
360
dep/recastnavigation/Recast/Source/RecastRasterization.cpp
Normal file
|
|
@ -0,0 +1,360 @@
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
|
||||||
|
#define _USE_MATH_DEFINES
|
||||||
|
#include <math.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "Recast.h"
|
||||||
|
#include "RecastAlloc.h"
|
||||||
|
#include "RecastAssert.h"
|
||||||
|
|
||||||
|
inline bool overlapBounds(const float* amin, const float* amax, const float* bmin, const float* bmax)
|
||||||
|
{
|
||||||
|
bool overlap = true;
|
||||||
|
overlap = (amin[0] > bmax[0] || amax[0] < bmin[0]) ? false : overlap;
|
||||||
|
overlap = (amin[1] > bmax[1] || amax[1] < bmin[1]) ? false : overlap;
|
||||||
|
overlap = (amin[2] > bmax[2] || amax[2] < bmin[2]) ? false : overlap;
|
||||||
|
return overlap;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool overlapInterval(unsigned short amin, unsigned short amax,
|
||||||
|
unsigned short bmin, unsigned short bmax)
|
||||||
|
{
|
||||||
|
if (amax < bmin) return false;
|
||||||
|
if (amin > bmax) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static rcSpan* allocSpan(rcHeightfield& hf)
|
||||||
|
{
|
||||||
|
// If running out of memory, allocate new page and update the freelist.
|
||||||
|
if (!hf.freelist || !hf.freelist->next)
|
||||||
|
{
|
||||||
|
// Create new page.
|
||||||
|
// Allocate memory for the new pool.
|
||||||
|
rcSpanPool* pool = (rcSpanPool*)rcAlloc(sizeof(rcSpanPool), RC_ALLOC_PERM);
|
||||||
|
if (!pool) return 0;
|
||||||
|
pool->next = 0;
|
||||||
|
// Add the pool into the list of pools.
|
||||||
|
pool->next = hf.pools;
|
||||||
|
hf.pools = pool;
|
||||||
|
// Add new items to the free list.
|
||||||
|
rcSpan* freelist = hf.freelist;
|
||||||
|
rcSpan* head = &pool->items[0];
|
||||||
|
rcSpan* it = &pool->items[RC_SPANS_PER_POOL];
|
||||||
|
do
|
||||||
|
{
|
||||||
|
--it;
|
||||||
|
it->next = freelist;
|
||||||
|
freelist = it;
|
||||||
|
}
|
||||||
|
while (it != head);
|
||||||
|
hf.freelist = it;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pop item from in front of the free list.
|
||||||
|
rcSpan* it = hf.freelist;
|
||||||
|
hf.freelist = hf.freelist->next;
|
||||||
|
return it;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void freeSpan(rcHeightfield& hf, rcSpan* ptr)
|
||||||
|
{
|
||||||
|
if (!ptr) return;
|
||||||
|
// Add the node in front of the free list.
|
||||||
|
ptr->next = hf.freelist;
|
||||||
|
hf.freelist = ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void addSpan(rcHeightfield& hf, const int x, const int y,
|
||||||
|
const unsigned short smin, const unsigned short smax,
|
||||||
|
const unsigned char area, const int flagMergeThr)
|
||||||
|
{
|
||||||
|
|
||||||
|
int idx = x + y*hf.width;
|
||||||
|
|
||||||
|
rcSpan* s = allocSpan(hf);
|
||||||
|
s->smin = smin;
|
||||||
|
s->smax = smax;
|
||||||
|
s->area = area;
|
||||||
|
s->next = 0;
|
||||||
|
|
||||||
|
// Empty cell, add he first span.
|
||||||
|
if (!hf.spans[idx])
|
||||||
|
{
|
||||||
|
hf.spans[idx] = s;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
rcSpan* prev = 0;
|
||||||
|
rcSpan* cur = hf.spans[idx];
|
||||||
|
|
||||||
|
// Insert and merge spans.
|
||||||
|
while (cur)
|
||||||
|
{
|
||||||
|
if (cur->smin > s->smax)
|
||||||
|
{
|
||||||
|
// Current span is further than the new span, break.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (cur->smax < s->smin)
|
||||||
|
{
|
||||||
|
// Current span is before the new span advance.
|
||||||
|
prev = cur;
|
||||||
|
cur = cur->next;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Merge spans.
|
||||||
|
if (cur->smin < s->smin)
|
||||||
|
s->smin = cur->smin;
|
||||||
|
if (cur->smax > s->smax)
|
||||||
|
s->smax = cur->smax;
|
||||||
|
|
||||||
|
// Merge flags.
|
||||||
|
if (rcAbs((int)s->smax - (int)cur->smax) <= flagMergeThr)
|
||||||
|
s->area = rcMax(s->area, cur->area);
|
||||||
|
|
||||||
|
// Remove current span.
|
||||||
|
rcSpan* next = cur->next;
|
||||||
|
freeSpan(hf, cur);
|
||||||
|
if (prev)
|
||||||
|
prev->next = next;
|
||||||
|
else
|
||||||
|
hf.spans[idx] = next;
|
||||||
|
cur = next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Insert new span.
|
||||||
|
if (prev)
|
||||||
|
{
|
||||||
|
s->next = prev->next;
|
||||||
|
prev->next = s;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s->next = hf.spans[idx];
|
||||||
|
hf.spans[idx] = s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void rcAddSpan(rcContext* /*ctx*/, rcHeightfield& hf, const int x, const int y,
|
||||||
|
const unsigned short smin, const unsigned short smax,
|
||||||
|
const unsigned char area, const int flagMergeThr)
|
||||||
|
{
|
||||||
|
// rcAssert(ctx);
|
||||||
|
addSpan(hf, x,y, smin, smax, area, flagMergeThr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int clipPoly(const float* in, int n, float* out, float pnx, float pnz, float pd)
|
||||||
|
{
|
||||||
|
float d[12];
|
||||||
|
for (int i = 0; i < n; ++i)
|
||||||
|
d[i] = pnx*in[i*3+0] + pnz*in[i*3+2] + pd;
|
||||||
|
|
||||||
|
int m = 0;
|
||||||
|
for (int i = 0, j = n-1; i < n; j=i, ++i)
|
||||||
|
{
|
||||||
|
bool ina = d[j] >= 0;
|
||||||
|
bool inb = d[i] >= 0;
|
||||||
|
if (ina != inb)
|
||||||
|
{
|
||||||
|
float s = d[j] / (d[j] - d[i]);
|
||||||
|
out[m*3+0] = in[j*3+0] + (in[i*3+0] - in[j*3+0])*s;
|
||||||
|
out[m*3+1] = in[j*3+1] + (in[i*3+1] - in[j*3+1])*s;
|
||||||
|
out[m*3+2] = in[j*3+2] + (in[i*3+2] - in[j*3+2])*s;
|
||||||
|
m++;
|
||||||
|
}
|
||||||
|
if (inb)
|
||||||
|
{
|
||||||
|
out[m*3+0] = in[i*3+0];
|
||||||
|
out[m*3+1] = in[i*3+1];
|
||||||
|
out[m*3+2] = in[i*3+2];
|
||||||
|
m++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rasterizeTri(const float* v0, const float* v1, const float* v2,
|
||||||
|
const unsigned char area, rcHeightfield& hf,
|
||||||
|
const float* bmin, const float* bmax,
|
||||||
|
const float cs, const float ics, const float ich,
|
||||||
|
const int flagMergeThr)
|
||||||
|
{
|
||||||
|
const int w = hf.width;
|
||||||
|
const int h = hf.height;
|
||||||
|
float tmin[3], tmax[3];
|
||||||
|
const float by = bmax[1] - bmin[1];
|
||||||
|
|
||||||
|
// Calculate the bounding box of the triangle.
|
||||||
|
rcVcopy(tmin, v0);
|
||||||
|
rcVcopy(tmax, v0);
|
||||||
|
rcVmin(tmin, v1);
|
||||||
|
rcVmin(tmin, v2);
|
||||||
|
rcVmax(tmax, v1);
|
||||||
|
rcVmax(tmax, v2);
|
||||||
|
|
||||||
|
// If the triangle does not touch the bbox of the heightfield, skip the triagle.
|
||||||
|
if (!overlapBounds(bmin, bmax, tmin, tmax))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Calculate the footpring of the triangle on the grid.
|
||||||
|
int x0 = (int)((tmin[0] - bmin[0])*ics);
|
||||||
|
int y0 = (int)((tmin[2] - bmin[2])*ics);
|
||||||
|
int x1 = (int)((tmax[0] - bmin[0])*ics);
|
||||||
|
int y1 = (int)((tmax[2] - bmin[2])*ics);
|
||||||
|
x0 = rcClamp(x0, 0, w-1);
|
||||||
|
y0 = rcClamp(y0, 0, h-1);
|
||||||
|
x1 = rcClamp(x1, 0, w-1);
|
||||||
|
y1 = rcClamp(y1, 0, h-1);
|
||||||
|
|
||||||
|
// Clip the triangle into all grid cells it touches.
|
||||||
|
float in[7*3], out[7*3], inrow[7*3];
|
||||||
|
|
||||||
|
for (int y = y0; y <= y1; ++y)
|
||||||
|
{
|
||||||
|
// Clip polygon to row.
|
||||||
|
rcVcopy(&in[0], v0);
|
||||||
|
rcVcopy(&in[1*3], v1);
|
||||||
|
rcVcopy(&in[2*3], v2);
|
||||||
|
int nvrow = 3;
|
||||||
|
const float cz = bmin[2] + y*cs;
|
||||||
|
nvrow = clipPoly(in, nvrow, out, 0, 1, -cz);
|
||||||
|
if (nvrow < 3) continue;
|
||||||
|
nvrow = clipPoly(out, nvrow, inrow, 0, -1, cz+cs);
|
||||||
|
if (nvrow < 3) continue;
|
||||||
|
|
||||||
|
for (int x = x0; x <= x1; ++x)
|
||||||
|
{
|
||||||
|
// Clip polygon to column.
|
||||||
|
int nv = nvrow;
|
||||||
|
const float cx = bmin[0] + x*cs;
|
||||||
|
nv = clipPoly(inrow, nv, out, 1, 0, -cx);
|
||||||
|
if (nv < 3) continue;
|
||||||
|
nv = clipPoly(out, nv, in, -1, 0, cx+cs);
|
||||||
|
if (nv < 3) continue;
|
||||||
|
|
||||||
|
// Calculate min and max of the span.
|
||||||
|
float smin = in[1], smax = in[1];
|
||||||
|
for (int i = 1; i < nv; ++i)
|
||||||
|
{
|
||||||
|
smin = rcMin(smin, in[i*3+1]);
|
||||||
|
smax = rcMax(smax, in[i*3+1]);
|
||||||
|
}
|
||||||
|
smin -= bmin[1];
|
||||||
|
smax -= bmin[1];
|
||||||
|
// Skip the span if it is outside the heightfield bbox
|
||||||
|
if (smax < 0.0f) continue;
|
||||||
|
if (smin > by) continue;
|
||||||
|
// Clamp the span to the heightfield bbox.
|
||||||
|
if (smin < 0.0f) smin = 0;
|
||||||
|
if (smax > by) smax = by;
|
||||||
|
|
||||||
|
// Snap the span to the heightfield height grid.
|
||||||
|
unsigned short ismin = (unsigned short)rcClamp((int)floorf(smin * ich), 0, RC_SPAN_MAX_HEIGHT);
|
||||||
|
unsigned short ismax = (unsigned short)rcClamp((int)ceilf(smax * ich), (int)ismin+1, RC_SPAN_MAX_HEIGHT);
|
||||||
|
|
||||||
|
addSpan(hf, x, y, ismin, ismax, area, flagMergeThr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void rcRasterizeTriangle(rcContext* ctx, const float* v0, const float* v1, const float* v2,
|
||||||
|
const unsigned char area, rcHeightfield& solid,
|
||||||
|
const int flagMergeThr)
|
||||||
|
{
|
||||||
|
rcAssert(ctx);
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_RASTERIZE_TRIANGLES);
|
||||||
|
|
||||||
|
const float ics = 1.0f/solid.cs;
|
||||||
|
const float ich = 1.0f/solid.ch;
|
||||||
|
rasterizeTri(v0, v1, v2, area, solid, solid.bmin, solid.bmax, solid.cs, ics, ich, flagMergeThr);
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_RASTERIZE_TRIANGLES);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rcRasterizeTriangles(rcContext* ctx, const float* verts, const int /*nv*/,
|
||||||
|
const int* tris, const unsigned char* areas, const int nt,
|
||||||
|
rcHeightfield& solid, const int flagMergeThr)
|
||||||
|
{
|
||||||
|
rcAssert(ctx);
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_RASTERIZE_TRIANGLES);
|
||||||
|
|
||||||
|
const float ics = 1.0f/solid.cs;
|
||||||
|
const float ich = 1.0f/solid.ch;
|
||||||
|
// Rasterize triangles.
|
||||||
|
for (int i = 0; i < nt; ++i)
|
||||||
|
{
|
||||||
|
const float* v0 = &verts[tris[i*3+0]*3];
|
||||||
|
const float* v1 = &verts[tris[i*3+1]*3];
|
||||||
|
const float* v2 = &verts[tris[i*3+2]*3];
|
||||||
|
// Rasterize.
|
||||||
|
rasterizeTri(v0, v1, v2, areas[i], solid, solid.bmin, solid.bmax, solid.cs, ics, ich, flagMergeThr);
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_RASTERIZE_TRIANGLES);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rcRasterizeTriangles(rcContext* ctx, const float* verts, const int /*nv*/,
|
||||||
|
const unsigned short* tris, const unsigned char* areas, const int nt,
|
||||||
|
rcHeightfield& solid, const int flagMergeThr)
|
||||||
|
{
|
||||||
|
rcAssert(ctx);
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_RASTERIZE_TRIANGLES);
|
||||||
|
|
||||||
|
const float ics = 1.0f/solid.cs;
|
||||||
|
const float ich = 1.0f/solid.ch;
|
||||||
|
// Rasterize triangles.
|
||||||
|
for (int i = 0; i < nt; ++i)
|
||||||
|
{
|
||||||
|
const float* v0 = &verts[tris[i*3+0]*3];
|
||||||
|
const float* v1 = &verts[tris[i*3+1]*3];
|
||||||
|
const float* v2 = &verts[tris[i*3+2]*3];
|
||||||
|
// Rasterize.
|
||||||
|
rasterizeTri(v0, v1, v2, areas[i], solid, solid.bmin, solid.bmax, solid.cs, ics, ich, flagMergeThr);
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_RASTERIZE_TRIANGLES);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rcRasterizeTriangles(rcContext* ctx, const float* verts, const unsigned char* areas, const int nt,
|
||||||
|
rcHeightfield& solid, const int flagMergeThr)
|
||||||
|
{
|
||||||
|
rcAssert(ctx);
|
||||||
|
|
||||||
|
ctx->startTimer(RC_TIMER_RASTERIZE_TRIANGLES);
|
||||||
|
|
||||||
|
const float ics = 1.0f/solid.cs;
|
||||||
|
const float ich = 1.0f/solid.ch;
|
||||||
|
// Rasterize triangles.
|
||||||
|
for (int i = 0; i < nt; ++i)
|
||||||
|
{
|
||||||
|
const float* v0 = &verts[(i*3+0)*3];
|
||||||
|
const float* v1 = &verts[(i*3+1)*3];
|
||||||
|
const float* v2 = &verts[(i*3+2)*3];
|
||||||
|
// Rasterize.
|
||||||
|
rasterizeTri(v0, v1, v2, areas[i], solid, solid.bmin, solid.bmax, solid.cs, ics, ich, flagMergeThr);
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->stopTimer(RC_TIMER_RASTERIZE_TRIANGLES);
|
||||||
|
}
|
||||||
1283
dep/recastnavigation/Recast/Source/RecastRegion.cpp
Normal file
1283
dep/recastnavigation/Recast/Source/RecastRegion.cpp
Normal file
File diff suppressed because it is too large
Load diff
20
dep/recastnavigation/Recast/win/Recast_VC100.sln
Normal file
20
dep/recastnavigation/Recast/win/Recast_VC100.sln
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||||
|
# Visual Studio 2010
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Recast", "VC100\Recast.vcxproj", "{00B9DC66-96A6-465D-A6C1-5DFF94E48A64}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Win32 = Debug|Win32
|
||||||
|
Release|Win32 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{00B9DC66-96A6-465D-A6C1-5DFF94E48A64}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{00B9DC66-96A6-465D-A6C1-5DFF94E48A64}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{00B9DC66-96A6-465D-A6C1-5DFF94E48A64}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{00B9DC66-96A6-465D-A6C1-5DFF94E48A64}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
20
dep/recastnavigation/Recast/win/Recast_VC90.sln
Normal file
20
dep/recastnavigation/Recast/win/Recast_VC90.sln
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||||
|
# Visual Studio 2008
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Recast", "VC90\Recast.vcproj", "{B6137343-A2F6-4AE7-BA47-484EC0EF369C}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Win32 = Debug|Win32
|
||||||
|
Release|Win32 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{B6137343-A2F6-4AE7-BA47-484EC0EF369C}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{B6137343-A2F6-4AE7-BA47-484EC0EF369C}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{B6137343-A2F6-4AE7-BA47-484EC0EF369C}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{B6137343-A2F6-4AE7-BA47-484EC0EF369C}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
6
dep/recastnavigation/Recast/win/VC100/.gitignore
vendored
Normal file
6
dep/recastnavigation/Recast/win/VC100/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
*__Win32_Release
|
||||||
|
*__Win32_Debug
|
||||||
|
*__x64_Release
|
||||||
|
*__x64_Debug
|
||||||
|
*.user
|
||||||
95
dep/recastnavigation/Recast/win/VC100/Recast.vcxproj
Normal file
95
dep/recastnavigation/Recast/win/VC100/Recast.vcxproj
Normal file
|
|
@ -0,0 +1,95 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{00B9DC66-96A6-465D-A6C1-5DFF94E48A64}</ProjectGuid>
|
||||||
|
<RootNamespace>Recast</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<OutDir>$(ProjectDir)\..\..\..\..\lib\$(Platform)_$(Configuration)\</OutDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<IntDir>.\$(ProjectName)__$(Platform)_$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<OutDir>$(ProjectDir)\..\..\..\..\lib\$(Platform)_$(Configuration)\</OutDir>
|
||||||
|
<IntDir>.\$(ProjectName)__$(Platform)_$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
|
||||||
|
<PreprocessorDefinitions>WIN32;DEBUG;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\Include\Recast.h" />
|
||||||
|
<ClInclude Include="..\..\Include\RecastAlloc.h" />
|
||||||
|
<ClInclude Include="..\..\Include\RecastAssert.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\Source\Recast.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\RecastAlloc.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\RecastArea.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\RecastContour.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\RecastFilter.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\RecastMesh.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\RecastMeshDetail.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\RecastRasterization.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\RecastRegion.cpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
51
dep/recastnavigation/Recast/win/VC100/Recast.vcxproj.filters
Normal file
51
dep/recastnavigation/Recast/win/VC100/Recast.vcxproj.filters
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="src">
|
||||||
|
<UniqueIdentifier>{ef95c759-27da-462b-9f5e-d599017cb842}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="include">
|
||||||
|
<UniqueIdentifier>{4ea80bc1-958b-4d16-b708-675bc74de83d}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\Include\Recast.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Include\RecastAlloc.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Include\RecastAssert.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\Source\Recast.cpp">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\RecastAlloc.cpp">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\RecastArea.cpp">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\RecastContour.cpp">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\RecastFilter.cpp">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\RecastMesh.cpp">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\RecastMeshDetail.cpp">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\RecastRasterization.cpp">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\RecastRegion.cpp">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
6
dep/recastnavigation/Recast/win/VC90/.gitignore
vendored
Normal file
6
dep/recastnavigation/Recast/win/VC90/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
*__Win32_Release
|
||||||
|
*__Win32_Debug
|
||||||
|
*__x64_Release
|
||||||
|
*__x64_Debug
|
||||||
|
*.user
|
||||||
204
dep/recastnavigation/Recast/win/VC90/Recast.vcproj
Normal file
204
dep/recastnavigation/Recast/win/VC90/Recast.vcproj
Normal file
|
|
@ -0,0 +1,204 @@
|
||||||
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
|
<VisualStudioProject
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="9.00"
|
||||||
|
Name="Recast"
|
||||||
|
ProjectGUID="{B6137343-A2F6-4AE7-BA47-484EC0EF369C}"
|
||||||
|
RootNamespace="Recast_VC90"
|
||||||
|
TargetFrameworkVersion="196613"
|
||||||
|
>
|
||||||
|
<Platforms>
|
||||||
|
<Platform
|
||||||
|
Name="Win32"
|
||||||
|
/>
|
||||||
|
</Platforms>
|
||||||
|
<ToolFiles>
|
||||||
|
</ToolFiles>
|
||||||
|
<Configurations>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
OutputDirectory="$(ProjectDir)\..\..\..\..\lib\$(PlatformName)_$(ConfigurationName)\"
|
||||||
|
IntermediateDirectory=".\$(ProjectName)__$(PlatformName)_$(ConfigurationName)\"
|
||||||
|
ConfigurationType="4"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories="..\..\include"
|
||||||
|
PreprocessorDefinitions="WIN32;DEBUG;"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="3"
|
||||||
|
WarningLevel="3"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLibrarianTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
OutputDirectory="$(ProjectDir)\..\..\..\..\lib\$(PlatformName)_$(ConfigurationName)\"
|
||||||
|
IntermediateDirectory=".\$(ProjectName)__$(PlatformName)_$(ConfigurationName)\"
|
||||||
|
ConfigurationType="4"
|
||||||
|
CharacterSet="2"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="2"
|
||||||
|
EnableIntrinsicFunctions="true"
|
||||||
|
AdditionalIncludeDirectories="..\..\include"
|
||||||
|
PreprocessorDefinitions="WIN32;NDEBUG;"
|
||||||
|
RuntimeLibrary="2"
|
||||||
|
EnableFunctionLevelLinking="true"
|
||||||
|
WarningLevel="3"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLibrarianTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
</Configurations>
|
||||||
|
<References>
|
||||||
|
</References>
|
||||||
|
<Files>
|
||||||
|
<Filter
|
||||||
|
Name="include"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\Recast.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\RecastAlloc.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\RecastAssert.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="src"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\Recast.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\RecastAlloc.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\RecastArea.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\RecastContour.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\RecastFilter.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\RecastMesh.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\RecastMeshDetail.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\RecastRasterization.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\RecastRegion.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
</Files>
|
||||||
|
<Globals>
|
||||||
|
</Globals>
|
||||||
|
</VisualStudioProject>
|
||||||
3
dep/recastnavigation/RecastDemo/Bin/.gitignore
vendored
Normal file
3
dep/recastnavigation/RecastDemo/Bin/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
!.gitignore
|
||||||
|
*
|
||||||
BIN
dep/recastnavigation/RecastDemo/Bin/DroidSans.ttf
Normal file
BIN
dep/recastnavigation/RecastDemo/Bin/DroidSans.ttf
Normal file
Binary file not shown.
15234
dep/recastnavigation/RecastDemo/Bin/Meshes/dungeon.obj
Normal file
15234
dep/recastnavigation/RecastDemo/Bin/Meshes/dungeon.obj
Normal file
File diff suppressed because it is too large
Load diff
3506
dep/recastnavigation/RecastDemo/Bin/Meshes/nav_test.obj
Normal file
3506
dep/recastnavigation/RecastDemo/Bin/Meshes/nav_test.obj
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>English</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>Recast</string>
|
||||||
|
<key>CFBundleIconFile</key>
|
||||||
|
<string>Icon.icns</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>com.yourcompany.Recast</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>Recast</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>1.0</string>
|
||||||
|
<key>NSMainNibFile</key>
|
||||||
|
<string>MainMenu</string>
|
||||||
|
<key>NSPrincipalClass</key>
|
||||||
|
<string>NSApplication</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
Binary file not shown.
|
|
@ -0,0 +1 @@
|
||||||
|
APPL????
|
||||||
Binary file not shown.
BIN
dep/recastnavigation/RecastDemo/Bin/Recast.app/Contents/Resources/English.lproj/MainMenu.nib
generated
Normal file
BIN
dep/recastnavigation/RecastDemo/Bin/Recast.app/Contents/Resources/English.lproj/MainMenu.nib
generated
Normal file
Binary file not shown.
BIN
dep/recastnavigation/RecastDemo/Bin/SDL.dll
Normal file
BIN
dep/recastnavigation/RecastDemo/Bin/SDL.dll
Normal file
Binary file not shown.
15
dep/recastnavigation/RecastDemo/Bin/Tests/movement_test.txt
Normal file
15
dep/recastnavigation/RecastDemo/Bin/Tests/movement_test.txt
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
s Solo Mesh Simple
|
||||||
|
f movement.obj
|
||||||
|
pf -100.539185 -1.000000 54.028996 62.582016 15.757828 52.842243 0x3 0x0
|
||||||
|
pf -100.539185 -1.000000 54.028996 -1.259964 -1.000000 50.116970 0x3 0x0
|
||||||
|
pf -100.539185 -1.000000 54.028996 1.598934 -1.000000 23.528656 0x3 0x0
|
||||||
|
pf -100.539185 -1.000000 54.028996 3.652847 -1.000000 -5.022881 0x3 0x0
|
||||||
|
pf -100.539185 -1.000000 54.028996 -39.182816 8.999985 -24.697731 0x3 0x0
|
||||||
|
pf -100.539185 -1.000000 54.028996 -66.847992 -1.000000 -28.908646 0x3 0x0
|
||||||
|
pf -100.539185 -1.000000 54.028996 -90.966019 -1.000000 -3.219864 0x3 0x0
|
||||||
|
pf -43.394421 -1.000000 13.312424 -90.966019 -1.000000 -3.219864 0x3 0x0
|
||||||
|
pf -43.394421 -1.000000 13.312424 -36.447182 3.999992 -25.008087 0x3 0x0
|
||||||
|
pf -43.394421 -1.000000 13.312424 26.394167 15.757812 -13.491264 0x3 0x0
|
||||||
|
pf -43.394421 -1.000000 13.312424 -4.140746 6.944923 4.888435 0x3 0x0
|
||||||
|
pf -43.394421 -1.000000 13.312424 -73.532791 -1.062469 23.137051 0x3 0x0
|
||||||
|
pf -43.394421 -1.000000 13.312424 -72.902054 7.996834 15.076473 0x3 0x0
|
||||||
23
dep/recastnavigation/RecastDemo/Bin/Tests/nav_mesh_test.txt
Normal file
23
dep/recastnavigation/RecastDemo/Bin/Tests/nav_mesh_test.txt
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
s Solo Mesh Simple
|
||||||
|
f nav_test.obj
|
||||||
|
pf 18.138550 -2.370003 -21.319118 -19.206181 -2.369133 24.802742 0x3 0x0
|
||||||
|
pf 18.252758 -2.368240 -7.000238 -19.206181 -2.369133 24.802742 0x3 0x0
|
||||||
|
pf 18.252758 -2.368240 -7.000238 -22.759071 -2.369453 2.003946 0x3 0x0
|
||||||
|
pf 18.252758 -2.368240 -7.000238 -24.483898 -2.369728 -6.778278 0x3 0x0
|
||||||
|
pf 18.252758 -2.368240 -7.000238 -24.068850 -2.370285 -18.879251 0x3 0x0
|
||||||
|
pf 18.252758 -2.368240 -7.000238 12.124170 -2.369637 -21.222471 0x3 0x0
|
||||||
|
pf 10.830146 -2.366791 19.002508 12.124170 -2.369637 -21.222471 0x3 0x0
|
||||||
|
pf 10.830146 -2.366791 19.002508 -7.146484 -2.368736 -16.031403 0x3 0x0
|
||||||
|
pf 10.830146 -2.366791 19.002508 -21.615391 -2.368706 -3.264029 0x3 0x0
|
||||||
|
pf 10.830146 -2.366791 19.002508 -22.651268 -2.369354 1.053217 0x3 0x0
|
||||||
|
pf 10.830146 -2.366791 19.002508 19.181122 -2.368134 3.011776 0x3 0x0
|
||||||
|
pf 10.830146 -2.366791 19.002508 19.041592 -2.368713 -7.404587 0x3 0x0
|
||||||
|
pf 6.054083 -2.365402 3.330421 19.041592 -2.368713 -7.404587 0x3 0x0
|
||||||
|
pf 6.054083 -2.365402 3.330421 21.846087 -2.368568 17.918859 0x3 0x0
|
||||||
|
pf 6.054083 -2.365402 3.330421 0.967449 -2.368439 25.767756 0x3 0x0
|
||||||
|
pf 6.054083 -2.365402 3.330421 -17.518076 -2.368477 26.569633 0x3 0x0
|
||||||
|
pf 6.054083 -2.365402 3.330421 -22.141787 -2.369209 2.440046 0x3 0x0
|
||||||
|
pf 6.054083 -2.365402 3.330421 -23.296972 -2.369797 -17.411043 0x3 0x0
|
||||||
|
pf 6.054083 -2.365402 3.330421 -1.564062 -2.369926 -20.452827 0x3 0x0
|
||||||
|
pf 6.054083 -2.365402 3.330421 16.905643 -2.370193 -21.811655 0x3 0x0
|
||||||
|
pf 6.054083 -2.365402 3.330421 19.289761 -2.368813 -6.954918 0x3 0x0
|
||||||
BIN
dep/recastnavigation/RecastDemo/Bin/test.chf
Normal file
BIN
dep/recastnavigation/RecastDemo/Bin/test.chf
Normal file
Binary file not shown.
7
dep/recastnavigation/RecastDemo/Build/GNUMake/Common.mk
Normal file
7
dep/recastnavigation/RecastDemo/Build/GNUMake/Common.mk
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
OBJECTS = $(patsubst $(NAME)/Source/%.cpp,$(OBJ)/%.o,$(wildcard $(NAME)/Source/*.cpp))
|
||||||
|
CPPFLAGS += -I$(NAME)/Include
|
||||||
|
|
||||||
|
$(OBJ)/%.o: $(NAME)/Source/%.cpp
|
||||||
|
c++ $(CPPFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
19
dep/recastnavigation/RecastDemo/Build/GNUMake/DebugUtils.mk
Normal file
19
dep/recastnavigation/RecastDemo/Build/GNUMake/DebugUtils.mk
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
NAME = DebugUtils
|
||||||
|
|
||||||
|
SOURCES = \
|
||||||
|
DebugDraw.cpp \
|
||||||
|
DetourDebugDraw.cpp \
|
||||||
|
RecastDebugDraw.cpp \
|
||||||
|
RecastDump.cpp
|
||||||
|
|
||||||
|
HEADERS = \
|
||||||
|
DebugDraw.h \
|
||||||
|
DetourDebugDraw.h \
|
||||||
|
RecastDebugDraw.h \
|
||||||
|
RecastDump.h
|
||||||
|
|
||||||
|
CPPFLAGS = \
|
||||||
|
-I Detour/Include \
|
||||||
|
-I Recast/Include
|
||||||
|
|
||||||
|
include $(BUILD)/HelperLibrary.mk
|
||||||
22
dep/recastnavigation/RecastDemo/Build/GNUMake/Detour.mk
Normal file
22
dep/recastnavigation/RecastDemo/Build/GNUMake/Detour.mk
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
NAME = Detour
|
||||||
|
|
||||||
|
SOURCES = \
|
||||||
|
DetourAlloc.cpp \
|
||||||
|
DetourCommon.cpp \
|
||||||
|
DetourNavMesh.cpp \
|
||||||
|
DetourNavMeshBuilder.cpp \
|
||||||
|
DetourNavMeshQuery.cpp \
|
||||||
|
DetourNode.cpp \
|
||||||
|
DetourObstacleAvoidance.cpp
|
||||||
|
|
||||||
|
HEADERS = \
|
||||||
|
DetourAlloc.h \
|
||||||
|
DetourAssert.h \
|
||||||
|
DetourCommon.h \
|
||||||
|
DetourNavMesh.h \
|
||||||
|
DetourNavMeshBuilder.h \
|
||||||
|
DetourNavMeshQuery.h \
|
||||||
|
DetourNode.h \
|
||||||
|
DetourObstacleAvoidance.h
|
||||||
|
|
||||||
|
include $(BUILD)/Library.mk
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
include $(BUILD)/Common.mk
|
||||||
|
|
||||||
|
$(BIN)/$(NAME).a: $(OBJECTS)
|
||||||
|
ar -q $@ $(OBJECTS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(BIN)/$(NAME).a $(OBJECTS)
|
||||||
10
dep/recastnavigation/RecastDemo/Build/GNUMake/Library.mk
Normal file
10
dep/recastnavigation/RecastDemo/Build/GNUMake/Library.mk
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
include $(BUILD)/Common.mk
|
||||||
|
|
||||||
|
CPPFLAGS += -fPIC
|
||||||
|
LDFLAGS += -shared
|
||||||
|
|
||||||
|
$(BIN)/lib$(NAME).so: $(OBJECTS)
|
||||||
|
c++ $(LDFLAGS) -o $@ $(OBJECTS) $(LIBS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(BIN)/lib$(NAME).so $(OBJECTS)
|
||||||
7
dep/recastnavigation/RecastDemo/Build/GNUMake/Program.mk
Normal file
7
dep/recastnavigation/RecastDemo/Build/GNUMake/Program.mk
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
include $(BUILD)/Common.mk
|
||||||
|
|
||||||
|
$(BIN)/$(NAME): $(OBJECTS)
|
||||||
|
c++ $(LDFLAGS) -o $@ $(OBJECTS) $(LIBS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(BIN)/$(NAME).a $(OBJECTS)
|
||||||
18
dep/recastnavigation/RecastDemo/Build/GNUMake/Recast.mk
Normal file
18
dep/recastnavigation/RecastDemo/Build/GNUMake/Recast.mk
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
NAME = Recast
|
||||||
|
|
||||||
|
OBJECTS = \
|
||||||
|
Recast.cpp \
|
||||||
|
RecastAlloc.cpp \
|
||||||
|
RecastArea.cpp \
|
||||||
|
RecastFilter.cpp \
|
||||||
|
RecastMesh.cpp \
|
||||||
|
RecastMeshDetail.cpp \
|
||||||
|
RecastRasterization.cpp \
|
||||||
|
RecastRegion.cpp
|
||||||
|
|
||||||
|
HEADERS = \
|
||||||
|
Recast.h \
|
||||||
|
RecastAlloc.h \
|
||||||
|
RecastAssert.h
|
||||||
|
|
||||||
|
include $(BUILD)/Library.mk
|
||||||
70
dep/recastnavigation/RecastDemo/Build/GNUMake/RecastDemo.mk
Normal file
70
dep/recastnavigation/RecastDemo/Build/GNUMake/RecastDemo.mk
Normal file
|
|
@ -0,0 +1,70 @@
|
||||||
|
NAME = RecastDemo
|
||||||
|
|
||||||
|
SOURCES = \
|
||||||
|
ChunkyTriMesh.cpp \
|
||||||
|
ConvexVolumeTool.cpp \
|
||||||
|
CrowdManager.cpp \
|
||||||
|
CrowdTool.cpp \
|
||||||
|
Filelist.cpp \
|
||||||
|
foo \
|
||||||
|
imgui.cpp \
|
||||||
|
imguiRenderGL.cpp \
|
||||||
|
InputGeom.cpp \
|
||||||
|
main.cpp \
|
||||||
|
MeshLoaderObj.cpp \
|
||||||
|
NavMeshTesterTool.cpp \
|
||||||
|
OffMeshConnectionTool.cpp \
|
||||||
|
PerfTimer.cpp \
|
||||||
|
Sample.cpp \
|
||||||
|
Sample_Debug.cpp \
|
||||||
|
SampleInterfaces.cpp \
|
||||||
|
Sample_SoloMeshSimple.cpp \
|
||||||
|
Sample_SoloMeshTiled.cpp \
|
||||||
|
Sample_TileMesh.cpp \
|
||||||
|
SDLMain.m \
|
||||||
|
SlideShow.cpp \
|
||||||
|
TestCase.cpp \
|
||||||
|
ValueHistory.cpp
|
||||||
|
|
||||||
|
HEADERS = \
|
||||||
|
ChunkyTriMesh.h \
|
||||||
|
ConvexVolumeTool.h \
|
||||||
|
CrowdManager.h \
|
||||||
|
CrowdTool.h \
|
||||||
|
Filelist.h \
|
||||||
|
foo \
|
||||||
|
imgui.h \
|
||||||
|
imguiRenderGL.h \
|
||||||
|
InputGeom.h \
|
||||||
|
MeshLoaderObj.h \
|
||||||
|
NavMeshTesterTool.h \
|
||||||
|
OffMeshConnectionTool.h \
|
||||||
|
PerfTimer.h \
|
||||||
|
Sample_Debug.h \
|
||||||
|
Sample.h \
|
||||||
|
SampleInterfaces.h \
|
||||||
|
Sample_SoloMeshSimple.h \
|
||||||
|
Sample_SoloMeshTiled.h \
|
||||||
|
Sample_TileMesh.h \
|
||||||
|
SDLMain.h \
|
||||||
|
SlideShow.h \
|
||||||
|
TestCase.h \
|
||||||
|
ValueHistory.h
|
||||||
|
|
||||||
|
CPPFLAGS = \
|
||||||
|
-I $(NAME)/Contrib \
|
||||||
|
-I DebugUtils/Include \
|
||||||
|
-I Detour/Include \
|
||||||
|
-I Recast/Include \
|
||||||
|
`pkg-config --cflags sdl`
|
||||||
|
|
||||||
|
LDFLAGS = \
|
||||||
|
-L $(BIN) \
|
||||||
|
-lDetour \
|
||||||
|
-lRecast \
|
||||||
|
-lGL -lGLU \
|
||||||
|
`pkg-config --libs sdl`
|
||||||
|
|
||||||
|
LIBS = $(BIN)/DebugUtils.a
|
||||||
|
|
||||||
|
include $(BUILD)/Program.mk
|
||||||
BIN
dep/recastnavigation/RecastDemo/Build/Icon.png
Normal file
BIN
dep/recastnavigation/RecastDemo/Build/Icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.5 KiB |
3
dep/recastnavigation/RecastDemo/Build/VC10/.gitignore
vendored
Normal file
3
dep/recastnavigation/RecastDemo/Build/VC10/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
Debug
|
||||||
|
Release
|
||||||
20
dep/recastnavigation/RecastDemo/Build/VC10/Recast.sln
Normal file
20
dep/recastnavigation/RecastDemo/Build/VC10/Recast.sln
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||||
|
# Visual Studio 2010
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Recast", "Recast.vcxproj", "{CEF242C5-E9A3-403B-BAFF-99397BDA5730}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Win32 = Debug|Win32
|
||||||
|
Release|Win32 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{CEF242C5-E9A3-403B-BAFF-99397BDA5730}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{CEF242C5-E9A3-403B-BAFF-99397BDA5730}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{CEF242C5-E9A3-403B-BAFF-99397BDA5730}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{CEF242C5-E9A3-403B-BAFF-99397BDA5730}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
180
dep/recastnavigation/RecastDemo/Build/VC10/Recast.vcxproj
Normal file
180
dep/recastnavigation/RecastDemo/Build/VC10/Recast.vcxproj
Normal file
|
|
@ -0,0 +1,180 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{CEF242C5-E9A3-403B-BAFF-99397BDA5730}</ProjectGuid>
|
||||||
|
<RootNamespace>Recast</RootNamespace>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||||
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\Bin\</OutDir>
|
||||||
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
|
||||||
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental>
|
||||||
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\Bin\</OutDir>
|
||||||
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
|
||||||
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<AdditionalIncludeDirectories>..\..\Contrib\SDL\include;..\..\Include;..\..\..\Detour\Include;..\..\..\DebugUtils\Include;..\..\..\Recast\Include;..\..\Contrib</AdditionalIncludeDirectories>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<MinimalRebuild>true</MinimalRebuild>
|
||||||
|
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||||
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<AdditionalDependencies>opengl32.lib;glu32.lib;sdlmain.lib;sdl.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>..\..\Contrib\SDL\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<TargetMachine>MachineX86</TargetMachine>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<AdditionalIncludeDirectories>..\..\..\DebugUtils\Include;..\..\Contrib\SDL\include;..\..\Include;..\..\..\Detour\Include;..\..\..\Recast\Include;..\..\Contrib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<AdditionalDependencies>opengl32.lib;glu32.lib;sdlmain.lib;sdl.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>..\..\Contrib\SDL\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<TargetMachine>MachineX86</TargetMachine>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\..\Recast\Include\Recast.h" />
|
||||||
|
<ClInclude Include="..\..\..\Recast\Include\RecastAlloc.h" />
|
||||||
|
<ClInclude Include="..\..\..\Recast\Include\RecastAssert.h" />
|
||||||
|
<ClInclude Include="..\..\..\Detour\Include\DetourAlloc.h" />
|
||||||
|
<ClInclude Include="..\..\..\Detour\Include\DetourAssert.h" />
|
||||||
|
<ClInclude Include="..\..\..\Detour\Include\DetourCommon.h" />
|
||||||
|
<ClInclude Include="..\..\..\Detour\Include\DetourNavMesh.h" />
|
||||||
|
<ClInclude Include="..\..\..\Detour\Include\DetourNavMeshBuilder.h" />
|
||||||
|
<ClInclude Include="..\..\..\Detour\Include\DetourNavMeshQuery.h" />
|
||||||
|
<ClInclude Include="..\..\..\Detour\Include\DetourNode.h" />
|
||||||
|
<ClInclude Include="..\..\..\Detour\Include\DetourObstacleAvoidance.h" />
|
||||||
|
<ClInclude Include="..\..\Include\ChunkyTriMesh.h" />
|
||||||
|
<ClInclude Include="..\..\Include\ConvexVolumeTool.h" />
|
||||||
|
<ClInclude Include="..\..\Include\CrowdManager.h" />
|
||||||
|
<ClInclude Include="..\..\Include\CrowdTool.h" />
|
||||||
|
<ClInclude Include="..\..\Include\Debug.h" />
|
||||||
|
<ClInclude Include="..\..\Include\Filelist.h" />
|
||||||
|
<ClInclude Include="..\..\Include\imgui.h" />
|
||||||
|
<ClInclude Include="..\..\Include\imguiRenderGL.h" />
|
||||||
|
<ClInclude Include="..\..\Include\InputGeom.h" />
|
||||||
|
<ClInclude Include="..\..\Include\MeshLoaderObj.h" />
|
||||||
|
<ClInclude Include="..\..\Include\NavMeshTesterTool.h" />
|
||||||
|
<ClInclude Include="..\..\Include\OffMeshConnectionTool.h" />
|
||||||
|
<ClInclude Include="..\..\Include\PerfTimer.h" />
|
||||||
|
<ClInclude Include="..\..\Include\Sample.h" />
|
||||||
|
<ClInclude Include="..\..\Include\Sample_Debug.h" />
|
||||||
|
<ClInclude Include="..\..\Include\Sample_SoloMeshSimple.h" />
|
||||||
|
<ClInclude Include="..\..\Include\Sample_SoloMeshTiled.h" />
|
||||||
|
<ClInclude Include="..\..\Include\Sample_TileMesh.h" />
|
||||||
|
<ClInclude Include="..\..\Include\SampleInterfaces.h" />
|
||||||
|
<ClInclude Include="..\..\Include\SlideShow.h" />
|
||||||
|
<ClInclude Include="..\..\Contrib\stb_image.h" />
|
||||||
|
<ClInclude Include="..\..\Contrib\stb_truetype.h" />
|
||||||
|
<ClInclude Include="..\..\Include\TestCase.h" />
|
||||||
|
<ClInclude Include="..\..\Include\ValueHistory.h" />
|
||||||
|
<ClInclude Include="..\..\..\DebugUtils\Include\DebugDraw.h" />
|
||||||
|
<ClInclude Include="..\..\..\DebugUtils\Include\DetourDebugDraw.h" />
|
||||||
|
<ClInclude Include="..\..\..\DebugUtils\Include\RecastDebugDraw.h" />
|
||||||
|
<ClInclude Include="..\..\..\DebugUtils\Include\RecastDump.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\..\Recast\Source\Recast.cpp" />
|
||||||
|
<ClCompile Include="..\..\..\Recast\Source\RecastAlloc.cpp" />
|
||||||
|
<ClCompile Include="..\..\..\Recast\Source\RecastArea.cpp" />
|
||||||
|
<ClCompile Include="..\..\..\Recast\Source\RecastContour.cpp" />
|
||||||
|
<ClCompile Include="..\..\..\Recast\Source\RecastFilter.cpp" />
|
||||||
|
<ClCompile Include="..\..\..\Recast\Source\RecastMesh.cpp" />
|
||||||
|
<ClCompile Include="..\..\..\Recast\Source\RecastMeshDetail.cpp" />
|
||||||
|
<ClCompile Include="..\..\..\Recast\Source\RecastRasterization.cpp" />
|
||||||
|
<ClCompile Include="..\..\..\Recast\Source\RecastRegion.cpp" />
|
||||||
|
<ClCompile Include="..\..\..\Detour\Source\DetourAlloc.cpp" />
|
||||||
|
<ClCompile Include="..\..\..\Detour\Source\DetourCommon.cpp" />
|
||||||
|
<ClCompile Include="..\..\..\Detour\Source\DetourNavMesh.cpp" />
|
||||||
|
<ClCompile Include="..\..\..\Detour\Source\DetourNavMeshBuilder.cpp" />
|
||||||
|
<ClCompile Include="..\..\..\Detour\Source\DetourNavMeshQuery.cpp" />
|
||||||
|
<ClCompile Include="..\..\..\Detour\Source\DetourNode.cpp" />
|
||||||
|
<ClCompile Include="..\..\..\Detour\Source\DetourObstacleAvoidance.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\ChunkyTriMesh.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\ConvexVolumeTool.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\CrowdManager.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\CrowdTool.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\Debug.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\Filelist.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\imgui.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\imguiRenderGL.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\InputGeom.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\main.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\MeshLoaderObj.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\NavMeshTesterTool.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\OffMeshConnectionTool.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\PerfTimer.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\Sample.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\Sample_Debug.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\Sample_SoloMeshSimple.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\Sample_SoloMeshTiled.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\Sample_TileMesh.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\SampleInterfaces.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\SlideShow.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\TestCase.cpp" />
|
||||||
|
<ClCompile Include="..\..\Source\ValueHistory.cpp" />
|
||||||
|
<ClCompile Include="..\..\..\DebugUtils\Source\DebugDraw.cpp" />
|
||||||
|
<ClCompile Include="..\..\..\DebugUtils\Source\DetourDebugDraw.cpp" />
|
||||||
|
<ClCompile Include="..\..\..\DebugUtils\Source\RecastDebugDraw.cpp" />
|
||||||
|
<ClCompile Include="..\..\..\DebugUtils\Source\RecastDump.cpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,295 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Resource Files">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Recast">
|
||||||
|
<UniqueIdentifier>{84bf8ba9-f9d0-4ed2-8f08-b34832ccfa4c}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Recast\Include">
|
||||||
|
<UniqueIdentifier>{5e4b8ced-36a6-4e52-b2be-c85846cfa532}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Recast\Source">
|
||||||
|
<UniqueIdentifier>{d6907ba5-317a-4288-a1cf-0987bdce1203}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Detour">
|
||||||
|
<UniqueIdentifier>{82977c1d-c20c-41d6-a10c-0a8d4267ac92}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Detour\Include">
|
||||||
|
<UniqueIdentifier>{61aeb09b-9567-453b-bb3f-71081e070e14}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Detour\Source">
|
||||||
|
<UniqueIdentifier>{daaf8ba1-489c-4311-b413-09a59326ac7a}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Demo">
|
||||||
|
<UniqueIdentifier>{d0925230-3864-4117-8a75-6effa47637ee}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Demo\Include">
|
||||||
|
<UniqueIdentifier>{acdba4c2-12d6-4152-a648-316ce4352942}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Demo\Source">
|
||||||
|
<UniqueIdentifier>{611fd29f-d10e-4838-84de-7a3cfbb50938}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="DebugUtils">
|
||||||
|
<UniqueIdentifier>{fe143be5-42bb-448c-89ac-64ce6b8085a7}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="DebugUtils\Include">
|
||||||
|
<UniqueIdentifier>{33d54d81-b560-489c-9e6f-98eea5e392eb}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="DebugUtils\Source">
|
||||||
|
<UniqueIdentifier>{397247ef-dd89-4c1f-9aa6-3530fd912461}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\..\Recast\Include\Recast.h">
|
||||||
|
<Filter>Recast\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\Recast\Include\RecastAlloc.h">
|
||||||
|
<Filter>Recast\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\Recast\Include\RecastAssert.h">
|
||||||
|
<Filter>Recast\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\Detour\Include\DetourAlloc.h">
|
||||||
|
<Filter>Detour\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\Detour\Include\DetourAssert.h">
|
||||||
|
<Filter>Detour\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\Detour\Include\DetourCommon.h">
|
||||||
|
<Filter>Detour\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\Detour\Include\DetourNavMesh.h">
|
||||||
|
<Filter>Detour\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\Detour\Include\DetourNavMeshBuilder.h">
|
||||||
|
<Filter>Detour\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\Detour\Include\DetourNavMeshQuery.h">
|
||||||
|
<Filter>Detour\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\Detour\Include\DetourNode.h">
|
||||||
|
<Filter>Detour\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\Detour\Include\DetourObstacleAvoidance.h">
|
||||||
|
<Filter>Detour\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Include\ChunkyTriMesh.h">
|
||||||
|
<Filter>Demo\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Include\ConvexVolumeTool.h">
|
||||||
|
<Filter>Demo\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Include\CrowdManager.h">
|
||||||
|
<Filter>Demo\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Include\CrowdTool.h">
|
||||||
|
<Filter>Demo\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Include\Debug.h">
|
||||||
|
<Filter>Demo\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Include\Filelist.h">
|
||||||
|
<Filter>Demo\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Include\imgui.h">
|
||||||
|
<Filter>Demo\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Include\imguiRenderGL.h">
|
||||||
|
<Filter>Demo\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Include\InputGeom.h">
|
||||||
|
<Filter>Demo\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Include\MeshLoaderObj.h">
|
||||||
|
<Filter>Demo\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Include\NavMeshTesterTool.h">
|
||||||
|
<Filter>Demo\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Include\OffMeshConnectionTool.h">
|
||||||
|
<Filter>Demo\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Include\PerfTimer.h">
|
||||||
|
<Filter>Demo\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Include\Sample.h">
|
||||||
|
<Filter>Demo\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Include\Sample_Debug.h">
|
||||||
|
<Filter>Demo\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Include\Sample_SoloMeshSimple.h">
|
||||||
|
<Filter>Demo\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Include\Sample_SoloMeshTiled.h">
|
||||||
|
<Filter>Demo\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Include\Sample_TileMesh.h">
|
||||||
|
<Filter>Demo\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Include\SampleInterfaces.h">
|
||||||
|
<Filter>Demo\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Include\SlideShow.h">
|
||||||
|
<Filter>Demo\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Contrib\stb_image.h">
|
||||||
|
<Filter>Demo\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Contrib\stb_truetype.h">
|
||||||
|
<Filter>Demo\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Include\TestCase.h">
|
||||||
|
<Filter>Demo\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\Include\ValueHistory.h">
|
||||||
|
<Filter>Demo\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\DebugUtils\Include\DebugDraw.h">
|
||||||
|
<Filter>DebugUtils\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\DebugUtils\Include\DetourDebugDraw.h">
|
||||||
|
<Filter>DebugUtils\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\DebugUtils\Include\RecastDebugDraw.h">
|
||||||
|
<Filter>DebugUtils\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\DebugUtils\Include\RecastDump.h">
|
||||||
|
<Filter>DebugUtils\Include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\..\Recast\Source\Recast.cpp">
|
||||||
|
<Filter>Recast\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\Recast\Source\RecastAlloc.cpp">
|
||||||
|
<Filter>Recast\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\Recast\Source\RecastArea.cpp">
|
||||||
|
<Filter>Recast\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\Recast\Source\RecastContour.cpp">
|
||||||
|
<Filter>Recast\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\Recast\Source\RecastFilter.cpp">
|
||||||
|
<Filter>Recast\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\Recast\Source\RecastMesh.cpp">
|
||||||
|
<Filter>Recast\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\Recast\Source\RecastMeshDetail.cpp">
|
||||||
|
<Filter>Recast\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\Recast\Source\RecastRasterization.cpp">
|
||||||
|
<Filter>Recast\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\Recast\Source\RecastRegion.cpp">
|
||||||
|
<Filter>Recast\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\Detour\Source\DetourAlloc.cpp">
|
||||||
|
<Filter>Detour\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\Detour\Source\DetourCommon.cpp">
|
||||||
|
<Filter>Detour\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\Detour\Source\DetourNavMesh.cpp">
|
||||||
|
<Filter>Detour\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\Detour\Source\DetourNavMeshBuilder.cpp">
|
||||||
|
<Filter>Detour\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\Detour\Source\DetourNavMeshQuery.cpp">
|
||||||
|
<Filter>Detour\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\Detour\Source\DetourNode.cpp">
|
||||||
|
<Filter>Detour\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\Detour\Source\DetourObstacleAvoidance.cpp">
|
||||||
|
<Filter>Detour\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\ChunkyTriMesh.cpp">
|
||||||
|
<Filter>Demo\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\ConvexVolumeTool.cpp">
|
||||||
|
<Filter>Demo\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\CrowdManager.cpp">
|
||||||
|
<Filter>Demo\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\CrowdTool.cpp">
|
||||||
|
<Filter>Demo\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\Debug.cpp">
|
||||||
|
<Filter>Demo\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\Filelist.cpp">
|
||||||
|
<Filter>Demo\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\imgui.cpp">
|
||||||
|
<Filter>Demo\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\imguiRenderGL.cpp">
|
||||||
|
<Filter>Demo\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\InputGeom.cpp">
|
||||||
|
<Filter>Demo\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\main.cpp">
|
||||||
|
<Filter>Demo\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\MeshLoaderObj.cpp">
|
||||||
|
<Filter>Demo\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\NavMeshTesterTool.cpp">
|
||||||
|
<Filter>Demo\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\OffMeshConnectionTool.cpp">
|
||||||
|
<Filter>Demo\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\PerfTimer.cpp">
|
||||||
|
<Filter>Demo\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\Sample.cpp">
|
||||||
|
<Filter>Demo\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\Sample_Debug.cpp">
|
||||||
|
<Filter>Demo\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\Sample_SoloMeshSimple.cpp">
|
||||||
|
<Filter>Demo\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\Sample_SoloMeshTiled.cpp">
|
||||||
|
<Filter>Demo\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\Sample_TileMesh.cpp">
|
||||||
|
<Filter>Demo\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\SampleInterfaces.cpp">
|
||||||
|
<Filter>Demo\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\SlideShow.cpp">
|
||||||
|
<Filter>Demo\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\TestCase.cpp">
|
||||||
|
<Filter>Demo\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\Source\ValueHistory.cpp">
|
||||||
|
<Filter>Demo\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\DebugUtils\Source\DebugDraw.cpp">
|
||||||
|
<Filter>DebugUtils\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\DebugUtils\Source\DetourDebugDraw.cpp">
|
||||||
|
<Filter>DebugUtils\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\DebugUtils\Source\RecastDebugDraw.cpp">
|
||||||
|
<Filter>DebugUtils\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\DebugUtils\Source\RecastDump.cpp">
|
||||||
|
<Filter>DebugUtils\Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
3
dep/recastnavigation/RecastDemo/Build/VC9/.gitignore
vendored
Normal file
3
dep/recastnavigation/RecastDemo/Build/VC9/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
Debug
|
||||||
|
Release
|
||||||
20
dep/recastnavigation/RecastDemo/Build/VC9/Recast.sln
Normal file
20
dep/recastnavigation/RecastDemo/Build/VC9/Recast.sln
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||||
|
# Visual C++ Express 2008
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Recast", "Recast.vcproj", "{CEF242C5-E9A3-403B-BAFF-99397BDA5730}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Win32 = Debug|Win32
|
||||||
|
Release|Win32 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{CEF242C5-E9A3-403B-BAFF-99397BDA5730}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{CEF242C5-E9A3-403B-BAFF-99397BDA5730}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{CEF242C5-E9A3-403B-BAFF-99397BDA5730}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{CEF242C5-E9A3-403B-BAFF-99397BDA5730}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
559
dep/recastnavigation/RecastDemo/Build/VC9/Recast.vcproj
Normal file
559
dep/recastnavigation/RecastDemo/Build/VC9/Recast.vcproj
Normal file
|
|
@ -0,0 +1,559 @@
|
||||||
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
|
<VisualStudioProject
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="9.00"
|
||||||
|
Name="Recast"
|
||||||
|
ProjectGUID="{CEF242C5-E9A3-403B-BAFF-99397BDA5730}"
|
||||||
|
RootNamespace="Recast"
|
||||||
|
Keyword="Win32Proj"
|
||||||
|
TargetFrameworkVersion="196613"
|
||||||
|
>
|
||||||
|
<Platforms>
|
||||||
|
<Platform
|
||||||
|
Name="Win32"
|
||||||
|
/>
|
||||||
|
</Platforms>
|
||||||
|
<ToolFiles>
|
||||||
|
</ToolFiles>
|
||||||
|
<Configurations>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
OutputDirectory="..\..\Bin"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="1"
|
||||||
|
CharacterSet="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories="..\..\Contrib\SDL\include;..\..\Include;..\..\..\Detour\Include;..\..\..\DebugUtils\Include;..\..\..\Recast\Include;..\..\Contrib;$(NOINHERIT)"
|
||||||
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="3"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="opengl32.lib glu32.lib sdlmain.lib sdl.lib"
|
||||||
|
LinkIncremental="1"
|
||||||
|
AdditionalLibraryDirectories="..\..\Contrib\SDL\lib"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="2"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
OutputDirectory="..\..\Bin"
|
||||||
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
|
ConfigurationType="1"
|
||||||
|
CharacterSet="1"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="2"
|
||||||
|
EnableIntrinsicFunctions="true"
|
||||||
|
AdditionalIncludeDirectories="..\..\..\DebugUtils\Include;..\..\Contrib\SDL\include;..\..\Include;..\..\..\Detour\Include;..\..\..\Recast\Include;..\..\Contrib"
|
||||||
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS"
|
||||||
|
RuntimeLibrary="2"
|
||||||
|
EnableFunctionLevelLinking="true"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="4"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="opengl32.lib glu32.lib sdlmain.lib sdl.lib"
|
||||||
|
LinkIncremental="1"
|
||||||
|
AdditionalLibraryDirectories="..\..\Contrib\SDL\lib"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="2"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
</Configurations>
|
||||||
|
<References>
|
||||||
|
</References>
|
||||||
|
<Files>
|
||||||
|
<Filter
|
||||||
|
Name="Resource Files"
|
||||||
|
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||||
|
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||||
|
>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Recast"
|
||||||
|
>
|
||||||
|
<Filter
|
||||||
|
Name="Include"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Recast\Include\Recast.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Recast\Include\RecastAlloc.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Recast\Include\RecastAssert.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Source"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Recast\Source\Recast.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Recast\Source\RecastAlloc.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Recast\Source\RecastArea.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Recast\Source\RecastContour.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Recast\Source\RecastFilter.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Recast\Source\RecastMesh.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Recast\Source\RecastMeshDetail.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Recast\Source\RecastRasterization.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Recast\Source\RecastRegion.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Detour"
|
||||||
|
>
|
||||||
|
<Filter
|
||||||
|
Name="Include"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Detour\Include\DetourAlloc.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Detour\Include\DetourAssert.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Detour\Include\DetourCommon.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Detour\Include\DetourNavMesh.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Detour\Include\DetourNavMeshBuilder.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Detour\Include\DetourNavMeshQuery.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Detour\Include\DetourNode.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Detour\Include\DetourObstacleAvoidance.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Source"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Detour\Source\DetourAlloc.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Detour\Source\DetourCommon.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Detour\Source\DetourNavMesh.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Detour\Source\DetourNavMeshBuilder.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Detour\Source\DetourNavMeshQuery.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Detour\Source\DetourNode.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Detour\Source\DetourObstacleAvoidance.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Demo"
|
||||||
|
>
|
||||||
|
<Filter
|
||||||
|
Name="Include"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\ChunkyTriMesh.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\ConvexVolumeTool.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\CrowdManager.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\CrowdTool.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\Debug.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\Filelist.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\imgui.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\imguiRenderGL.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\InputGeom.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\MeshLoaderObj.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\NavMeshTesterTool.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\OffMeshConnectionTool.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\PerfTimer.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\Sample.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\Sample_Debug.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\Sample_SoloMeshSimple.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\Sample_SoloMeshTiled.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\Sample_TileMesh.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\SampleInterfaces.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\SlideShow.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Contrib\stb_image.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Contrib\stb_truetype.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\TestCase.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Include\ValueHistory.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Source"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\ChunkyTriMesh.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\ConvexVolumeTool.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\CrowdManager.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\CrowdTool.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\Debug.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\Filelist.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\imgui.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\imguiRenderGL.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\InputGeom.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\main.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\MeshLoaderObj.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\NavMeshTesterTool.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\OffMeshConnectionTool.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\PerfTimer.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\Sample.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\Sample_Debug.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\Sample_SoloMeshSimple.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\Sample_SoloMeshTiled.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\Sample_TileMesh.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\SampleInterfaces.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\SlideShow.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\TestCase.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Source\ValueHistory.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="DebugUtils"
|
||||||
|
>
|
||||||
|
<Filter
|
||||||
|
Name="Include"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\DebugUtils\Include\DebugDraw.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\DebugUtils\Include\DetourDebugDraw.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\DebugUtils\Include\RecastDebugDraw.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\DebugUtils\Include\RecastDump.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Source"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\DebugUtils\Source\DebugDraw.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\DebugUtils\Source\DetourDebugDraw.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\DebugUtils\Source\RecastDebugDraw.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\DebugUtils\Source\RecastDump.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
</Filter>
|
||||||
|
</Files>
|
||||||
|
<Globals>
|
||||||
|
</Globals>
|
||||||
|
</VisualStudioProject>
|
||||||
Binary file not shown.
File diff suppressed because it is too large
Load diff
BIN
dep/recastnavigation/RecastDemo/Build/Xcode/Icon.icns
Normal file
BIN
dep/recastnavigation/RecastDemo/Build/Xcode/Icon.icns
Normal file
Binary file not shown.
28
dep/recastnavigation/RecastDemo/Build/Xcode/Info.plist
Normal file
28
dep/recastnavigation/RecastDemo/Build/Xcode/Info.plist
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>English</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>${EXECUTABLE_NAME}</string>
|
||||||
|
<key>CFBundleIconFile</key>
|
||||||
|
<string>Icon.icns</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>com.yourcompany.${PRODUCT_NAME:identifier}</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>${PRODUCT_NAME}</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>1.0</string>
|
||||||
|
<key>NSMainNibFile</key>
|
||||||
|
<string>MainMenu</string>
|
||||||
|
<key>NSPrincipalClass</key>
|
||||||
|
<string>NSApplication</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
Binary file not shown.
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,596 @@
|
||||||
|
// !$*UTF8*$!
|
||||||
|
{
|
||||||
|
archiveVersion = 1;
|
||||||
|
classes = {
|
||||||
|
};
|
||||||
|
objectVersion = 45;
|
||||||
|
objects = {
|
||||||
|
|
||||||
|
/* Begin PBXBuildFile section */
|
||||||
|
1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; };
|
||||||
|
6B024C0D10060AC600CF7107 /* Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 6B024C0C10060AC600CF7107 /* Icon.icns */; };
|
||||||
|
6B1185F51006895B0018F96F /* DetourNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B1185F41006895B0018F96F /* DetourNode.cpp */; };
|
||||||
|
6B1185FE10068B150018F96F /* DetourCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B1185FD10068B150018F96F /* DetourCommon.cpp */; };
|
||||||
|
6B137C710F7FCBBB00459200 /* imgui.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B137C6C0F7FCBBB00459200 /* imgui.cpp */; };
|
||||||
|
6B137C720F7FCBBB00459200 /* MeshLoaderObj.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B137C6D0F7FCBBB00459200 /* MeshLoaderObj.cpp */; };
|
||||||
|
6B137C730F7FCBBB00459200 /* SDLMain.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B137C6E0F7FCBBB00459200 /* SDLMain.m */; };
|
||||||
|
6B137C8B0F7FCC1100459200 /* Recast.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B137C820F7FCC1100459200 /* Recast.cpp */; };
|
||||||
|
6B137C8C0F7FCC1100459200 /* RecastContour.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B137C830F7FCC1100459200 /* RecastContour.cpp */; };
|
||||||
|
6B137C8E0F7FCC1100459200 /* RecastFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B137C850F7FCC1100459200 /* RecastFilter.cpp */; };
|
||||||
|
6B137C900F7FCC1100459200 /* RecastMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B137C870F7FCC1100459200 /* RecastMesh.cpp */; };
|
||||||
|
6B137C910F7FCC1100459200 /* RecastRasterization.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B137C880F7FCC1100459200 /* RecastRasterization.cpp */; };
|
||||||
|
6B137C920F7FCC1100459200 /* RecastRegion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B137C890F7FCC1100459200 /* RecastRegion.cpp */; };
|
||||||
|
6B25B6190FFA62BE004F1BC4 /* Sample.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B25B6140FFA62BE004F1BC4 /* Sample.cpp */; };
|
||||||
|
6B25B61D0FFA62BE004F1BC4 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B25B6180FFA62BE004F1BC4 /* main.cpp */; };
|
||||||
|
6B2AEC530FFB8958005BE9CC /* Sample_TileMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B2AEC520FFB8958005BE9CC /* Sample_TileMesh.cpp */; };
|
||||||
|
6B324C66111C5D9A00EBD2FD /* ConvexVolumeTool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B324C65111C5D9A00EBD2FD /* ConvexVolumeTool.cpp */; };
|
||||||
|
6B555DB1100B212E00247EA3 /* imguiRenderGL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B555DB0100B212E00247EA3 /* imguiRenderGL.cpp */; };
|
||||||
|
6B62416A103434880002E346 /* RecastMeshDetail.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B624169103434880002E346 /* RecastMeshDetail.cpp */; };
|
||||||
|
6B8036AE113BAABE005ED67B /* Sample_Debug.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B8036AD113BAABE005ED67B /* Sample_Debug.cpp */; };
|
||||||
|
6B847777122D221D00ADF63D /* ValueHistory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B847776122D221C00ADF63D /* ValueHistory.cpp */; };
|
||||||
|
6B8632DA0F78122C00E2684A /* SDL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B8632D90F78122C00E2684A /* SDL.framework */; };
|
||||||
|
6B8632DC0F78123E00E2684A /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B8632DB0F78123E00E2684A /* OpenGL.framework */; };
|
||||||
|
6B8DE88910B69E3E00DF20FB /* DetourNavMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B8DE88710B69E3E00DF20FB /* DetourNavMesh.cpp */; };
|
||||||
|
6B8DE88A10B69E3E00DF20FB /* DetourNavMeshBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B8DE88810B69E3E00DF20FB /* DetourNavMeshBuilder.cpp */; };
|
||||||
|
6B98463311E6144400FA177B /* Sample_SoloMeshTiled.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B98463211E6144400FA177B /* Sample_SoloMeshTiled.cpp */; };
|
||||||
|
6B9846EF11E718F800FA177B /* DetourAlloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B9846EE11E718F800FA177B /* DetourAlloc.cpp */; };
|
||||||
|
6B9847B811E7519A00FA177B /* RecastAlloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B9847B711E7519A00FA177B /* RecastAlloc.cpp */; };
|
||||||
|
6B9EFF0912281C3E00535FF1 /* DetourObstacleAvoidance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B9EFF0812281C3E00535FF1 /* DetourObstacleAvoidance.cpp */; };
|
||||||
|
6BA1E88B10C7BFC9008007F6 /* Sample_SoloMeshSimple.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BA1E88810C7BFC9008007F6 /* Sample_SoloMeshSimple.cpp */; };
|
||||||
|
6BAF3C591211663A008CFCDF /* CrowdTool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BAF3C581211663A008CFCDF /* CrowdTool.cpp */; };
|
||||||
|
6BAF40DB12196A3D008CFCDF /* DetourNavMeshQuery.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BAF40DA12196A3D008CFCDF /* DetourNavMeshQuery.cpp */; };
|
||||||
|
6BAF4442121C3D26008CFCDF /* SampleInterfaces.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BAF4441121C3D26008CFCDF /* SampleInterfaces.cpp */; };
|
||||||
|
6BB788170FC0472B003C24DB /* ChunkyTriMesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BB788160FC0472B003C24DB /* ChunkyTriMesh.cpp */; };
|
||||||
|
6BB7FC0B10EBB6AA006DA0A6 /* NavMeshTesterTool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BB7FC0A10EBB6AA006DA0A6 /* NavMeshTesterTool.cpp */; };
|
||||||
|
6BB7FDA510F36F0E006DA0A6 /* InputGeom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BB7FDA410F36F0E006DA0A6 /* InputGeom.cpp */; };
|
||||||
|
6BB93C7D10CFE1D500F74F2B /* DebugDraw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BB93C7A10CFE1D500F74F2B /* DebugDraw.cpp */; };
|
||||||
|
6BB93C7E10CFE1D500F74F2B /* DetourDebugDraw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BB93C7B10CFE1D500F74F2B /* DetourDebugDraw.cpp */; };
|
||||||
|
6BB93C7F10CFE1D500F74F2B /* RecastDebugDraw.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BB93C7C10CFE1D500F74F2B /* RecastDebugDraw.cpp */; };
|
||||||
|
6BB93CF610CFEC4500F74F2B /* RecastDump.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BB93CF510CFEC4500F74F2B /* RecastDump.cpp */; };
|
||||||
|
6BCF32361104CD05009445BF /* OffMeshConnectionTool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BCF32351104CD05009445BF /* OffMeshConnectionTool.cpp */; };
|
||||||
|
6BD402011224279400995864 /* PerfTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BD402001224279400995864 /* PerfTimer.cpp */; };
|
||||||
|
6BD667DA123D28100021A7A4 /* CrowdManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BD667D9123D28100021A7A4 /* CrowdManager.cpp */; };
|
||||||
|
6BF5F23A11747606000502A6 /* Filelist.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BF5F23911747606000502A6 /* Filelist.cpp */; };
|
||||||
|
6BF5F2401174763B000502A6 /* SlideShow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BF5F23F1174763B000502A6 /* SlideShow.cpp */; };
|
||||||
|
6BF7C1401111953A002B3F46 /* TestCase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BF7C13F1111953A002B3F46 /* TestCase.cpp */; };
|
||||||
|
6BF7C4541115C277002B3F46 /* RecastArea.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6BF7C4531115C277002B3F46 /* RecastArea.cpp */; };
|
||||||
|
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
|
||||||
|
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
|
||||||
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
|
/* Begin PBXFileReference section */
|
||||||
|
089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||||
|
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
|
||||||
|
13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
|
||||||
|
1DDD58150DA1D0A300B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = "<group>"; };
|
||||||
|
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
|
||||||
|
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
|
||||||
|
32CA4F630368D1EE00C91783 /* Recast_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Recast_Prefix.pch; sourceTree = "<group>"; };
|
||||||
|
6B024C0C10060AC600CF7107 /* Icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Icon.icns; sourceTree = "<group>"; };
|
||||||
|
6B1185F41006895B0018F96F /* DetourNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DetourNode.cpp; path = ../../../Detour/Source/DetourNode.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B1185F61006896B0018F96F /* DetourNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DetourNode.h; path = ../../../Detour/Include/DetourNode.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B1185FC10068B040018F96F /* DetourCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DetourCommon.h; path = ../../../Detour/Include/DetourCommon.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B1185FD10068B150018F96F /* DetourCommon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DetourCommon.cpp; path = ../../../Detour/Source/DetourCommon.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B137C6C0F7FCBBB00459200 /* imgui.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = imgui.cpp; path = ../../Source/imgui.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B137C6D0F7FCBBB00459200 /* MeshLoaderObj.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MeshLoaderObj.cpp; path = ../../Source/MeshLoaderObj.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B137C6E0F7FCBBB00459200 /* SDLMain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLMain.m; path = ../../Source/SDLMain.m; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B137C7A0F7FCBE400459200 /* imgui.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imgui.h; path = ../../Include/imgui.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B137C7B0F7FCBE400459200 /* MeshLoaderObj.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MeshLoaderObj.h; path = ../../Include/MeshLoaderObj.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B137C7C0F7FCBE400459200 /* SDLMain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDLMain.h; path = ../../Include/SDLMain.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B137C7E0F7FCBFE00459200 /* Recast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Recast.h; path = ../../../Recast/Include/Recast.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B137C820F7FCC1100459200 /* Recast.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Recast.cpp; path = ../../../Recast/Source/Recast.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B137C830F7FCC1100459200 /* RecastContour.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RecastContour.cpp; path = ../../../Recast/Source/RecastContour.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B137C850F7FCC1100459200 /* RecastFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RecastFilter.cpp; path = ../../../Recast/Source/RecastFilter.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B137C870F7FCC1100459200 /* RecastMesh.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RecastMesh.cpp; path = ../../../Recast/Source/RecastMesh.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B137C880F7FCC1100459200 /* RecastRasterization.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RecastRasterization.cpp; path = ../../../Recast/Source/RecastRasterization.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B137C890F7FCC1100459200 /* RecastRegion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RecastRegion.cpp; path = ../../../Recast/Source/RecastRegion.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B25B6100FFA62AD004F1BC4 /* Sample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Sample.h; path = ../../Include/Sample.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B25B6140FFA62BE004F1BC4 /* Sample.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Sample.cpp; path = ../../Source/Sample.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B25B6180FFA62BE004F1BC4 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = ../../Source/main.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B2AEC510FFB8946005BE9CC /* Sample_TileMesh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Sample_TileMesh.h; path = ../../Include/Sample_TileMesh.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B2AEC520FFB8958005BE9CC /* Sample_TileMesh.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Sample_TileMesh.cpp; path = ../../Source/Sample_TileMesh.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B324C64111C5D9A00EBD2FD /* ConvexVolumeTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ConvexVolumeTool.h; path = ../../Include/ConvexVolumeTool.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B324C65111C5D9A00EBD2FD /* ConvexVolumeTool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ConvexVolumeTool.cpp; path = ../../Source/ConvexVolumeTool.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B555DAE100B211D00247EA3 /* imguiRenderGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imguiRenderGL.h; path = ../../Include/imguiRenderGL.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B555DB0100B212E00247EA3 /* imguiRenderGL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = imguiRenderGL.cpp; path = ../../Source/imguiRenderGL.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B555DF6100B273500247EA3 /* stb_truetype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = stb_truetype.h; path = ../../Contrib/stb_truetype.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B624169103434880002E346 /* RecastMeshDetail.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RecastMeshDetail.cpp; path = ../../../Recast/Source/RecastMeshDetail.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B8036AC113BAABE005ED67B /* Sample_Debug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Sample_Debug.h; path = ../../Include/Sample_Debug.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B8036AD113BAABE005ED67B /* Sample_Debug.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Sample_Debug.cpp; path = ../../Source/Sample_Debug.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B847774122D220D00ADF63D /* ValueHistory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ValueHistory.h; path = ../../Include/ValueHistory.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B847776122D221C00ADF63D /* ValueHistory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ValueHistory.cpp; path = ../../Source/ValueHistory.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B8632D90F78122C00E2684A /* SDL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL.framework; path = Library/Frameworks/SDL.framework; sourceTree = SDKROOT; };
|
||||||
|
6B8632DB0F78123E00E2684A /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; };
|
||||||
|
6B8DE88710B69E3E00DF20FB /* DetourNavMesh.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DetourNavMesh.cpp; path = ../../../Detour/Source/DetourNavMesh.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B8DE88810B69E3E00DF20FB /* DetourNavMeshBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DetourNavMeshBuilder.cpp; path = ../../../Detour/Source/DetourNavMeshBuilder.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B8DE88B10B69E4C00DF20FB /* DetourNavMesh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DetourNavMesh.h; path = ../../../Detour/Include/DetourNavMesh.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B8DE88C10B69E4C00DF20FB /* DetourNavMeshBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DetourNavMeshBuilder.h; path = ../../../Detour/Include/DetourNavMeshBuilder.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B98463111E6144400FA177B /* Sample_SoloMeshTiled.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Sample_SoloMeshTiled.h; path = ../../Include/Sample_SoloMeshTiled.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B98463211E6144400FA177B /* Sample_SoloMeshTiled.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Sample_SoloMeshTiled.cpp; path = ../../Source/Sample_SoloMeshTiled.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B9846ED11E718F800FA177B /* DetourAlloc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DetourAlloc.h; path = ../../../Detour/Include/DetourAlloc.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B9846EE11E718F800FA177B /* DetourAlloc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DetourAlloc.cpp; path = ../../../Detour/Source/DetourAlloc.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B98470511E733B600FA177B /* RecastAlloc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RecastAlloc.h; path = ../../../Recast/Include/RecastAlloc.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B9847B711E7519A00FA177B /* RecastAlloc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RecastAlloc.cpp; path = ../../../Recast/Source/RecastAlloc.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B9EFF02122819E200535FF1 /* DetourObstacleAvoidance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DetourObstacleAvoidance.h; path = ../../../Detour/Include/DetourObstacleAvoidance.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6B9EFF0812281C3E00535FF1 /* DetourObstacleAvoidance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DetourObstacleAvoidance.cpp; path = ../../../Detour/Source/DetourObstacleAvoidance.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BA1E88810C7BFC9008007F6 /* Sample_SoloMeshSimple.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Sample_SoloMeshSimple.cpp; path = ../../Source/Sample_SoloMeshSimple.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BA1E88E10C7BFD3008007F6 /* Sample_SoloMeshSimple.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Sample_SoloMeshSimple.h; path = ../../Include/Sample_SoloMeshSimple.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BAF3C571211663A008CFCDF /* CrowdTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CrowdTool.h; path = ../../Include/CrowdTool.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BAF3C581211663A008CFCDF /* CrowdTool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CrowdTool.cpp; path = ../../Source/CrowdTool.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BAF40D912196A25008CFCDF /* DetourNavMeshQuery.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DetourNavMeshQuery.h; path = ../../../Detour/Include/DetourNavMeshQuery.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BAF40DA12196A3D008CFCDF /* DetourNavMeshQuery.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DetourNavMeshQuery.cpp; path = ../../../Detour/Source/DetourNavMeshQuery.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BAF427A121ADCC2008CFCDF /* DetourAssert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DetourAssert.h; path = ../../../Detour/Include/DetourAssert.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BAF4440121C3D0A008CFCDF /* SampleInterfaces.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SampleInterfaces.h; path = ../../Include/SampleInterfaces.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BAF4441121C3D26008CFCDF /* SampleInterfaces.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SampleInterfaces.cpp; path = ../../Source/SampleInterfaces.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BAF4561121D173A008CFCDF /* RecastAssert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RecastAssert.h; path = ../../../Recast/Include/RecastAssert.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BB788160FC0472B003C24DB /* ChunkyTriMesh.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ChunkyTriMesh.cpp; path = ../../Source/ChunkyTriMesh.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BB788180FC04753003C24DB /* ChunkyTriMesh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ChunkyTriMesh.h; path = ../../Include/ChunkyTriMesh.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BB7FC0910EBB6AA006DA0A6 /* NavMeshTesterTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NavMeshTesterTool.h; path = ../../Include/NavMeshTesterTool.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BB7FC0A10EBB6AA006DA0A6 /* NavMeshTesterTool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NavMeshTesterTool.cpp; path = ../../Source/NavMeshTesterTool.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BB7FDA310F36EFC006DA0A6 /* InputGeom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InputGeom.h; path = ../../Include/InputGeom.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BB7FDA410F36F0E006DA0A6 /* InputGeom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = InputGeom.cpp; path = ../../Source/InputGeom.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BB93C7710CFE1D500F74F2B /* DebugDraw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DebugDraw.h; path = ../../../DebugUtils/Include/DebugDraw.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BB93C7810CFE1D500F74F2B /* DetourDebugDraw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DetourDebugDraw.h; path = ../../../DebugUtils/Include/DetourDebugDraw.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BB93C7910CFE1D500F74F2B /* RecastDebugDraw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RecastDebugDraw.h; path = ../../../DebugUtils/Include/RecastDebugDraw.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BB93C7A10CFE1D500F74F2B /* DebugDraw.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DebugDraw.cpp; path = ../../../DebugUtils/Source/DebugDraw.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BB93C7B10CFE1D500F74F2B /* DetourDebugDraw.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DetourDebugDraw.cpp; path = ../../../DebugUtils/Source/DetourDebugDraw.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BB93C7C10CFE1D500F74F2B /* RecastDebugDraw.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RecastDebugDraw.cpp; path = ../../../DebugUtils/Source/RecastDebugDraw.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BB93CF410CFEC4500F74F2B /* RecastDump.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RecastDump.h; path = ../../../DebugUtils/Include/RecastDump.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BB93CF510CFEC4500F74F2B /* RecastDump.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RecastDump.cpp; path = ../../../DebugUtils/Source/RecastDump.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BCF32341104CD05009445BF /* OffMeshConnectionTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OffMeshConnectionTool.h; path = ../../Include/OffMeshConnectionTool.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BCF32351104CD05009445BF /* OffMeshConnectionTool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OffMeshConnectionTool.cpp; path = ../../Source/OffMeshConnectionTool.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BD401FF1224278800995864 /* PerfTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PerfTimer.h; path = ../../Include/PerfTimer.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BD402001224279400995864 /* PerfTimer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PerfTimer.cpp; path = ../../Source/PerfTimer.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BD667D8123D27EC0021A7A4 /* CrowdManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CrowdManager.h; path = ../../Include/CrowdManager.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BD667D9123D28100021A7A4 /* CrowdManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CrowdManager.cpp; path = ../../Source/CrowdManager.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BF5F23911747606000502A6 /* Filelist.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Filelist.cpp; path = ../../Source/Filelist.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BF5F23C11747614000502A6 /* Filelist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Filelist.h; path = ../../Include/Filelist.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BF5F23E1174763B000502A6 /* SlideShow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SlideShow.h; path = ../../Include/SlideShow.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BF5F23F1174763B000502A6 /* SlideShow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SlideShow.cpp; path = ../../Source/SlideShow.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BF5F2C511747E9F000502A6 /* stb_image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = stb_image.h; path = ../../Contrib/stb_image.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BF7C13E11119520002B3F46 /* TestCase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TestCase.h; path = ../../Include/TestCase.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BF7C13F1111953A002B3F46 /* TestCase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TestCase.cpp; path = ../../Source/TestCase.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
6BF7C4531115C277002B3F46 /* RecastArea.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RecastArea.cpp; path = ../../../Recast/Source/RecastArea.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
|
8D1107320486CEB800E47090 /* Recast.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Recast.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
8D11072E0486CEB800E47090 /* Frameworks */ = {
|
||||||
|
isa = PBXFrameworksBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
|
||||||
|
6B8632DA0F78122C00E2684A /* SDL.framework in Frameworks */,
|
||||||
|
6B8632DC0F78123E00E2684A /* OpenGL.framework in Frameworks */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXFrameworksBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXGroup section */
|
||||||
|
080E96DDFE201D6D7F000001 /* Classes */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
6BB93C7610CFE1BD00F74F2B /* DebugUtils */,
|
||||||
|
6BDD9E030F91110C00904EEF /* Detour */,
|
||||||
|
6B137C7D0F7FCBE800459200 /* Recast */,
|
||||||
|
6B555DF5100B25FC00247EA3 /* Samples */,
|
||||||
|
6BB7FE8E10F4A175006DA0A6 /* Tools */,
|
||||||
|
6B25B6180FFA62BE004F1BC4 /* main.cpp */,
|
||||||
|
6BD667D8123D27EC0021A7A4 /* CrowdManager.h */,
|
||||||
|
6BD667D9123D28100021A7A4 /* CrowdManager.cpp */,
|
||||||
|
6BAF4440121C3D0A008CFCDF /* SampleInterfaces.h */,
|
||||||
|
6BAF4441121C3D26008CFCDF /* SampleInterfaces.cpp */,
|
||||||
|
6BF5F2C511747E9F000502A6 /* stb_image.h */,
|
||||||
|
6BF5F23E1174763B000502A6 /* SlideShow.h */,
|
||||||
|
6BF5F23F1174763B000502A6 /* SlideShow.cpp */,
|
||||||
|
6BF5F23C11747614000502A6 /* Filelist.h */,
|
||||||
|
6BF5F23911747606000502A6 /* Filelist.cpp */,
|
||||||
|
6B555DF6100B273500247EA3 /* stb_truetype.h */,
|
||||||
|
6B137C7A0F7FCBE400459200 /* imgui.h */,
|
||||||
|
6B137C6C0F7FCBBB00459200 /* imgui.cpp */,
|
||||||
|
6B555DAE100B211D00247EA3 /* imguiRenderGL.h */,
|
||||||
|
6B555DB0100B212E00247EA3 /* imguiRenderGL.cpp */,
|
||||||
|
6B137C7B0F7FCBE400459200 /* MeshLoaderObj.h */,
|
||||||
|
6B137C6D0F7FCBBB00459200 /* MeshLoaderObj.cpp */,
|
||||||
|
6BB788180FC04753003C24DB /* ChunkyTriMesh.h */,
|
||||||
|
6BB788160FC0472B003C24DB /* ChunkyTriMesh.cpp */,
|
||||||
|
6B137C7C0F7FCBE400459200 /* SDLMain.h */,
|
||||||
|
6B137C6E0F7FCBBB00459200 /* SDLMain.m */,
|
||||||
|
6BB7FDA310F36EFC006DA0A6 /* InputGeom.h */,
|
||||||
|
6BB7FDA410F36F0E006DA0A6 /* InputGeom.cpp */,
|
||||||
|
6BF7C13E11119520002B3F46 /* TestCase.h */,
|
||||||
|
6BF7C13F1111953A002B3F46 /* TestCase.cpp */,
|
||||||
|
6BD401FF1224278800995864 /* PerfTimer.h */,
|
||||||
|
6BD402001224279400995864 /* PerfTimer.cpp */,
|
||||||
|
6B847774122D220D00ADF63D /* ValueHistory.h */,
|
||||||
|
6B847776122D221C00ADF63D /* ValueHistory.cpp */,
|
||||||
|
);
|
||||||
|
name = Classes;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
6B8632D90F78122C00E2684A /* SDL.framework */,
|
||||||
|
6B8632DB0F78123E00E2684A /* OpenGL.framework */,
|
||||||
|
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
|
||||||
|
);
|
||||||
|
name = "Linked Frameworks";
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
29B97324FDCFA39411CA2CEA /* AppKit.framework */,
|
||||||
|
13E42FB307B3F0F600E4EEF1 /* CoreData.framework */,
|
||||||
|
29B97325FDCFA39411CA2CEA /* Foundation.framework */,
|
||||||
|
);
|
||||||
|
name = "Other Frameworks";
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
19C28FACFE9D520D11CA2CBB /* Products */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
8D1107320486CEB800E47090 /* Recast.app */,
|
||||||
|
);
|
||||||
|
name = Products;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
29B97314FDCFA39411CA2CEA /* Recast */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
080E96DDFE201D6D7F000001 /* Classes */,
|
||||||
|
29B97315FDCFA39411CA2CEA /* Other Sources */,
|
||||||
|
29B97317FDCFA39411CA2CEA /* Resources */,
|
||||||
|
29B97323FDCFA39411CA2CEA /* Frameworks */,
|
||||||
|
19C28FACFE9D520D11CA2CBB /* Products */,
|
||||||
|
);
|
||||||
|
name = Recast;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
29B97315FDCFA39411CA2CEA /* Other Sources */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
32CA4F630368D1EE00C91783 /* Recast_Prefix.pch */,
|
||||||
|
);
|
||||||
|
name = "Other Sources";
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
29B97317FDCFA39411CA2CEA /* Resources */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
6B024C0C10060AC600CF7107 /* Icon.icns */,
|
||||||
|
8D1107310486CEB800E47090 /* Info.plist */,
|
||||||
|
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
|
||||||
|
1DDD58140DA1D0A300B32029 /* MainMenu.xib */,
|
||||||
|
);
|
||||||
|
name = Resources;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */,
|
||||||
|
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */,
|
||||||
|
);
|
||||||
|
name = Frameworks;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
6B137C7D0F7FCBE800459200 /* Recast */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
6BAF4561121D173A008CFCDF /* RecastAssert.h */,
|
||||||
|
6B137C7E0F7FCBFE00459200 /* Recast.h */,
|
||||||
|
6B137C820F7FCC1100459200 /* Recast.cpp */,
|
||||||
|
6B137C880F7FCC1100459200 /* RecastRasterization.cpp */,
|
||||||
|
6B137C850F7FCC1100459200 /* RecastFilter.cpp */,
|
||||||
|
6BF7C4531115C277002B3F46 /* RecastArea.cpp */,
|
||||||
|
6B137C890F7FCC1100459200 /* RecastRegion.cpp */,
|
||||||
|
6B137C830F7FCC1100459200 /* RecastContour.cpp */,
|
||||||
|
6B137C870F7FCC1100459200 /* RecastMesh.cpp */,
|
||||||
|
6B624169103434880002E346 /* RecastMeshDetail.cpp */,
|
||||||
|
6B98470511E733B600FA177B /* RecastAlloc.h */,
|
||||||
|
6B9847B711E7519A00FA177B /* RecastAlloc.cpp */,
|
||||||
|
);
|
||||||
|
name = Recast;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
6B555DF5100B25FC00247EA3 /* Samples */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
6B25B6100FFA62AD004F1BC4 /* Sample.h */,
|
||||||
|
6B25B6140FFA62BE004F1BC4 /* Sample.cpp */,
|
||||||
|
6BA1E88E10C7BFD3008007F6 /* Sample_SoloMeshSimple.h */,
|
||||||
|
6BA1E88810C7BFC9008007F6 /* Sample_SoloMeshSimple.cpp */,
|
||||||
|
6B98463111E6144400FA177B /* Sample_SoloMeshTiled.h */,
|
||||||
|
6B98463211E6144400FA177B /* Sample_SoloMeshTiled.cpp */,
|
||||||
|
6B2AEC510FFB8946005BE9CC /* Sample_TileMesh.h */,
|
||||||
|
6B2AEC520FFB8958005BE9CC /* Sample_TileMesh.cpp */,
|
||||||
|
6B8036AC113BAABE005ED67B /* Sample_Debug.h */,
|
||||||
|
6B8036AD113BAABE005ED67B /* Sample_Debug.cpp */,
|
||||||
|
);
|
||||||
|
name = Samples;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
6BB7FE8E10F4A175006DA0A6 /* Tools */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
6BAF3C571211663A008CFCDF /* CrowdTool.h */,
|
||||||
|
6BAF3C581211663A008CFCDF /* CrowdTool.cpp */,
|
||||||
|
6B324C64111C5D9A00EBD2FD /* ConvexVolumeTool.h */,
|
||||||
|
6B324C65111C5D9A00EBD2FD /* ConvexVolumeTool.cpp */,
|
||||||
|
6BCF32341104CD05009445BF /* OffMeshConnectionTool.h */,
|
||||||
|
6BCF32351104CD05009445BF /* OffMeshConnectionTool.cpp */,
|
||||||
|
6BB7FC0910EBB6AA006DA0A6 /* NavMeshTesterTool.h */,
|
||||||
|
6BB7FC0A10EBB6AA006DA0A6 /* NavMeshTesterTool.cpp */,
|
||||||
|
);
|
||||||
|
name = Tools;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
6BB93C7610CFE1BD00F74F2B /* DebugUtils */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
6BB93CF410CFEC4500F74F2B /* RecastDump.h */,
|
||||||
|
6BB93CF510CFEC4500F74F2B /* RecastDump.cpp */,
|
||||||
|
6BB93C7710CFE1D500F74F2B /* DebugDraw.h */,
|
||||||
|
6BB93C7A10CFE1D500F74F2B /* DebugDraw.cpp */,
|
||||||
|
6BB93C7910CFE1D500F74F2B /* RecastDebugDraw.h */,
|
||||||
|
6BB93C7C10CFE1D500F74F2B /* RecastDebugDraw.cpp */,
|
||||||
|
6BB93C7810CFE1D500F74F2B /* DetourDebugDraw.h */,
|
||||||
|
6BB93C7B10CFE1D500F74F2B /* DetourDebugDraw.cpp */,
|
||||||
|
);
|
||||||
|
name = DebugUtils;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
6BDD9E030F91110C00904EEF /* Detour */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
6BAF427A121ADCC2008CFCDF /* DetourAssert.h */,
|
||||||
|
6B9846ED11E718F800FA177B /* DetourAlloc.h */,
|
||||||
|
6B9846EE11E718F800FA177B /* DetourAlloc.cpp */,
|
||||||
|
6B8DE88B10B69E4C00DF20FB /* DetourNavMesh.h */,
|
||||||
|
6B8DE88710B69E3E00DF20FB /* DetourNavMesh.cpp */,
|
||||||
|
6BAF40D912196A25008CFCDF /* DetourNavMeshQuery.h */,
|
||||||
|
6BAF40DA12196A3D008CFCDF /* DetourNavMeshQuery.cpp */,
|
||||||
|
6B8DE88C10B69E4C00DF20FB /* DetourNavMeshBuilder.h */,
|
||||||
|
6B8DE88810B69E3E00DF20FB /* DetourNavMeshBuilder.cpp */,
|
||||||
|
6B1185F61006896B0018F96F /* DetourNode.h */,
|
||||||
|
6B1185F41006895B0018F96F /* DetourNode.cpp */,
|
||||||
|
6B1185FC10068B040018F96F /* DetourCommon.h */,
|
||||||
|
6B1185FD10068B150018F96F /* DetourCommon.cpp */,
|
||||||
|
6B9EFF02122819E200535FF1 /* DetourObstacleAvoidance.h */,
|
||||||
|
6B9EFF0812281C3E00535FF1 /* DetourObstacleAvoidance.cpp */,
|
||||||
|
);
|
||||||
|
name = Detour;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
/* End PBXGroup section */
|
||||||
|
|
||||||
|
/* Begin PBXNativeTarget section */
|
||||||
|
8D1107260486CEB800E47090 /* Recast */ = {
|
||||||
|
isa = PBXNativeTarget;
|
||||||
|
buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "Recast" */;
|
||||||
|
buildPhases = (
|
||||||
|
8D1107290486CEB800E47090 /* Resources */,
|
||||||
|
8D11072C0486CEB800E47090 /* Sources */,
|
||||||
|
8D11072E0486CEB800E47090 /* Frameworks */,
|
||||||
|
);
|
||||||
|
buildRules = (
|
||||||
|
);
|
||||||
|
dependencies = (
|
||||||
|
);
|
||||||
|
name = Recast;
|
||||||
|
productInstallPath = "$(HOME)/Applications";
|
||||||
|
productName = Recast;
|
||||||
|
productReference = 8D1107320486CEB800E47090 /* Recast.app */;
|
||||||
|
productType = "com.apple.product-type.application";
|
||||||
|
};
|
||||||
|
/* End PBXNativeTarget section */
|
||||||
|
|
||||||
|
/* Begin PBXProject section */
|
||||||
|
29B97313FDCFA39411CA2CEA /* Project object */ = {
|
||||||
|
isa = PBXProject;
|
||||||
|
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Recast" */;
|
||||||
|
compatibilityVersion = "Xcode 3.1";
|
||||||
|
hasScannedForEncodings = 1;
|
||||||
|
mainGroup = 29B97314FDCFA39411CA2CEA /* Recast */;
|
||||||
|
projectDirPath = "";
|
||||||
|
projectRoot = "";
|
||||||
|
targets = (
|
||||||
|
8D1107260486CEB800E47090 /* Recast */,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
/* End PBXProject section */
|
||||||
|
|
||||||
|
/* Begin PBXResourcesBuildPhase section */
|
||||||
|
8D1107290486CEB800E47090 /* Resources */ = {
|
||||||
|
isa = PBXResourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
|
||||||
|
1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */,
|
||||||
|
6B024C0D10060AC600CF7107 /* Icon.icns in Resources */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXResourcesBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXSourcesBuildPhase section */
|
||||||
|
8D11072C0486CEB800E47090 /* Sources */ = {
|
||||||
|
isa = PBXSourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
6B137C710F7FCBBB00459200 /* imgui.cpp in Sources */,
|
||||||
|
6B137C720F7FCBBB00459200 /* MeshLoaderObj.cpp in Sources */,
|
||||||
|
6B137C730F7FCBBB00459200 /* SDLMain.m in Sources */,
|
||||||
|
6B137C8B0F7FCC1100459200 /* Recast.cpp in Sources */,
|
||||||
|
6B137C8C0F7FCC1100459200 /* RecastContour.cpp in Sources */,
|
||||||
|
6B137C8E0F7FCC1100459200 /* RecastFilter.cpp in Sources */,
|
||||||
|
6B137C900F7FCC1100459200 /* RecastMesh.cpp in Sources */,
|
||||||
|
6B137C910F7FCC1100459200 /* RecastRasterization.cpp in Sources */,
|
||||||
|
6B137C920F7FCC1100459200 /* RecastRegion.cpp in Sources */,
|
||||||
|
6BB788170FC0472B003C24DB /* ChunkyTriMesh.cpp in Sources */,
|
||||||
|
6B25B6190FFA62BE004F1BC4 /* Sample.cpp in Sources */,
|
||||||
|
6B25B61D0FFA62BE004F1BC4 /* main.cpp in Sources */,
|
||||||
|
6B2AEC530FFB8958005BE9CC /* Sample_TileMesh.cpp in Sources */,
|
||||||
|
6B1185F51006895B0018F96F /* DetourNode.cpp in Sources */,
|
||||||
|
6B1185FE10068B150018F96F /* DetourCommon.cpp in Sources */,
|
||||||
|
6B555DB1100B212E00247EA3 /* imguiRenderGL.cpp in Sources */,
|
||||||
|
6B62416A103434880002E346 /* RecastMeshDetail.cpp in Sources */,
|
||||||
|
6B8DE88910B69E3E00DF20FB /* DetourNavMesh.cpp in Sources */,
|
||||||
|
6B8DE88A10B69E3E00DF20FB /* DetourNavMeshBuilder.cpp in Sources */,
|
||||||
|
6BA1E88B10C7BFC9008007F6 /* Sample_SoloMeshSimple.cpp in Sources */,
|
||||||
|
6BB93C7D10CFE1D500F74F2B /* DebugDraw.cpp in Sources */,
|
||||||
|
6BB93C7E10CFE1D500F74F2B /* DetourDebugDraw.cpp in Sources */,
|
||||||
|
6BB93C7F10CFE1D500F74F2B /* RecastDebugDraw.cpp in Sources */,
|
||||||
|
6BB93CF610CFEC4500F74F2B /* RecastDump.cpp in Sources */,
|
||||||
|
6BB7FC0B10EBB6AA006DA0A6 /* NavMeshTesterTool.cpp in Sources */,
|
||||||
|
6BB7FDA510F36F0E006DA0A6 /* InputGeom.cpp in Sources */,
|
||||||
|
6BCF32361104CD05009445BF /* OffMeshConnectionTool.cpp in Sources */,
|
||||||
|
6BF7C1401111953A002B3F46 /* TestCase.cpp in Sources */,
|
||||||
|
6BF7C4541115C277002B3F46 /* RecastArea.cpp in Sources */,
|
||||||
|
6B324C66111C5D9A00EBD2FD /* ConvexVolumeTool.cpp in Sources */,
|
||||||
|
6B8036AE113BAABE005ED67B /* Sample_Debug.cpp in Sources */,
|
||||||
|
6BF5F23A11747606000502A6 /* Filelist.cpp in Sources */,
|
||||||
|
6BF5F2401174763B000502A6 /* SlideShow.cpp in Sources */,
|
||||||
|
6B98463311E6144400FA177B /* Sample_SoloMeshTiled.cpp in Sources */,
|
||||||
|
6B9846EF11E718F800FA177B /* DetourAlloc.cpp in Sources */,
|
||||||
|
6B9847B811E7519A00FA177B /* RecastAlloc.cpp in Sources */,
|
||||||
|
6BAF3C591211663A008CFCDF /* CrowdTool.cpp in Sources */,
|
||||||
|
6BAF40DB12196A3D008CFCDF /* DetourNavMeshQuery.cpp in Sources */,
|
||||||
|
6BAF4442121C3D26008CFCDF /* SampleInterfaces.cpp in Sources */,
|
||||||
|
6BD402011224279400995864 /* PerfTimer.cpp in Sources */,
|
||||||
|
6B9EFF0912281C3E00535FF1 /* DetourObstacleAvoidance.cpp in Sources */,
|
||||||
|
6B847777122D221D00ADF63D /* ValueHistory.cpp in Sources */,
|
||||||
|
6BD667DA123D28100021A7A4 /* CrowdManager.cpp in Sources */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXSourcesBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXVariantGroup section */
|
||||||
|
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = {
|
||||||
|
isa = PBXVariantGroup;
|
||||||
|
children = (
|
||||||
|
089C165DFE840E0CC02AAC07 /* English */,
|
||||||
|
);
|
||||||
|
name = InfoPlist.strings;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
1DDD58140DA1D0A300B32029 /* MainMenu.xib */ = {
|
||||||
|
isa = PBXVariantGroup;
|
||||||
|
children = (
|
||||||
|
1DDD58150DA1D0A300B32029 /* English */,
|
||||||
|
);
|
||||||
|
name = MainMenu.xib;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
/* End PBXVariantGroup section */
|
||||||
|
|
||||||
|
/* Begin XCBuildConfiguration section */
|
||||||
|
C01FCF4B08A954540054247B /* Debug */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
CONFIGURATION_BUILD_DIR = ../../Bin;
|
||||||
|
COPY_PHASE_STRIP = NO;
|
||||||
|
GCC_DYNAMIC_NO_PIC = NO;
|
||||||
|
GCC_ENABLE_FIX_AND_CONTINUE = YES;
|
||||||
|
GCC_MODEL_TUNING = G5;
|
||||||
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
|
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||||
|
GCC_PREFIX_HEADER = Recast_Prefix.pch;
|
||||||
|
GCC_VERSION = 4.2;
|
||||||
|
HEADER_SEARCH_PATHS = "/Library/Frameworks/SDL.framework/Headers/**";
|
||||||
|
INFOPLIST_FILE = Info.plist;
|
||||||
|
INSTALL_PATH = "$(HOME)/Applications";
|
||||||
|
OTHER_CPLUSPLUSFLAGS = (
|
||||||
|
"$(OTHER_CFLAGS)",
|
||||||
|
"-Wreorder",
|
||||||
|
"-Wsign-compare",
|
||||||
|
"-Wall",
|
||||||
|
);
|
||||||
|
PRODUCT_NAME = Recast;
|
||||||
|
USER_HEADER_SEARCH_PATHS = "";
|
||||||
|
};
|
||||||
|
name = Debug;
|
||||||
|
};
|
||||||
|
C01FCF4C08A954540054247B /* Release */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
|
||||||
|
CONFIGURATION_BUILD_DIR = ../../Bin;
|
||||||
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
|
GCC_MODEL_TUNING = G5;
|
||||||
|
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||||
|
GCC_PREFIX_HEADER = Recast_Prefix.pch;
|
||||||
|
GCC_VERSION = 4.2;
|
||||||
|
HEADER_SEARCH_PATHS = "/Library/Frameworks/SDL.framework/Headers/**";
|
||||||
|
INFOPLIST_FILE = Info.plist;
|
||||||
|
INSTALL_PATH = "$(HOME)/Applications";
|
||||||
|
OTHER_CFLAGS = "";
|
||||||
|
OTHER_CPLUSPLUSFLAGS = (
|
||||||
|
"$(OTHER_CFLAGS)",
|
||||||
|
"-Wreorder",
|
||||||
|
"-Wsign-compare",
|
||||||
|
"-Wall",
|
||||||
|
);
|
||||||
|
PRODUCT_NAME = Recast;
|
||||||
|
USER_HEADER_SEARCH_PATHS = "";
|
||||||
|
};
|
||||||
|
name = Release;
|
||||||
|
};
|
||||||
|
C01FCF4F08A954540054247B /* Debug */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
|
||||||
|
GCC_C_LANGUAGE_STANDARD = c99;
|
||||||
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||||
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
|
PREBINDING = NO;
|
||||||
|
SDKROOT = macosx10.5;
|
||||||
|
};
|
||||||
|
name = Debug;
|
||||||
|
};
|
||||||
|
C01FCF5008A954540054247B /* Release */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
|
||||||
|
GCC_C_LANGUAGE_STANDARD = c99;
|
||||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||||
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
|
PREBINDING = NO;
|
||||||
|
SDKROOT = macosx10.5;
|
||||||
|
};
|
||||||
|
name = Release;
|
||||||
|
};
|
||||||
|
/* End XCBuildConfiguration section */
|
||||||
|
|
||||||
|
/* Begin XCConfigurationList section */
|
||||||
|
C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "Recast" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
C01FCF4B08A954540054247B /* Debug */,
|
||||||
|
C01FCF4C08A954540054247B /* Release */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
|
};
|
||||||
|
C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Recast" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
C01FCF4F08A954540054247B /* Debug */,
|
||||||
|
C01FCF5008A954540054247B /* Release */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
|
};
|
||||||
|
/* End XCConfigurationList section */
|
||||||
|
};
|
||||||
|
rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
//
|
||||||
|
// Prefix header for all source files of the 'Recast' target in the 'Recast' project
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifdef __OBJC__
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
#endif
|
||||||
18
dep/recastnavigation/RecastDemo/Contrib/SDL/BUGS
Normal file
18
dep/recastnavigation/RecastDemo/Contrib/SDL/BUGS
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
|
||||||
|
Bugs are now managed in the SDL bug tracker, here:
|
||||||
|
|
||||||
|
http://bugzilla.libsdl.org/
|
||||||
|
|
||||||
|
You may report bugs there, and search to see if a given issue has already
|
||||||
|
been reported, discussed, and maybe even fixed.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
You may also find help at the SDL mailing list. Subscription information:
|
||||||
|
|
||||||
|
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
|
||||||
|
|
||||||
|
Bug reports are welcome here, but we really appreciate if you use Bugzilla, as
|
||||||
|
bugs discussed on the mailing list may be forgotten or missed.
|
||||||
|
|
||||||
|
|
||||||
458
dep/recastnavigation/RecastDemo/Contrib/SDL/COPYING
Normal file
458
dep/recastnavigation/RecastDemo/Contrib/SDL/COPYING
Normal file
|
|
@ -0,0 +1,458 @@
|
||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 2.1, February 1999
|
||||||
|
|
||||||
|
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||||
|
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
[This is the first released version of the Lesser GPL. It also counts
|
||||||
|
as the successor of the GNU Library Public License, version 2, hence
|
||||||
|
the version number 2.1.]
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
Licenses are intended to guarantee your freedom to share and change
|
||||||
|
free software--to make sure the software is free for all its users.
|
||||||
|
|
||||||
|
This license, the Lesser General Public License, applies to some
|
||||||
|
specially designated software packages--typically libraries--of the
|
||||||
|
Free Software Foundation and other authors who decide to use it. You
|
||||||
|
can use it too, but we suggest you first think carefully about whether
|
||||||
|
this license or the ordinary General Public License is the better
|
||||||
|
strategy to use in any particular case, based on the explanations below.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom of use,
|
||||||
|
not price. Our General Public Licenses are designed to make sure that
|
||||||
|
you have the freedom to distribute copies of free software (and charge
|
||||||
|
for this service if you wish); that you receive source code or can get
|
||||||
|
it if you want it; that you can change the software and use pieces of
|
||||||
|
it in new free programs; and that you are informed that you can do
|
||||||
|
these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
distributors to deny you these rights or to ask you to surrender these
|
||||||
|
rights. These restrictions translate to certain responsibilities for
|
||||||
|
you if you distribute copies of the library or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of the library, whether gratis
|
||||||
|
or for a fee, you must give the recipients all the rights that we gave
|
||||||
|
you. You must make sure that they, too, receive or can get the source
|
||||||
|
code. If you link other code with the library, you must provide
|
||||||
|
complete object files to the recipients, so that they can relink them
|
||||||
|
with the library after making changes to the library and recompiling
|
||||||
|
it. And you must show them these terms so they know their rights.
|
||||||
|
|
||||||
|
We protect your rights with a two-step method: (1) we copyright the
|
||||||
|
library, and (2) we offer you this license, which gives you legal
|
||||||
|
permission to copy, distribute and/or modify the library.
|
||||||
|
|
||||||
|
To protect each distributor, we want to make it very clear that
|
||||||
|
there is no warranty for the free library. Also, if the library is
|
||||||
|
modified by someone else and passed on, the recipients should know
|
||||||
|
that what they have is not the original version, so that the original
|
||||||
|
author's reputation will not be affected by problems that might be
|
||||||
|
introduced by others.
|
||||||
|
|
||||||
|
Finally, software patents pose a constant threat to the existence of
|
||||||
|
any free program. We wish to make sure that a company cannot
|
||||||
|
effectively restrict the users of a free program by obtaining a
|
||||||
|
restrictive license from a patent holder. Therefore, we insist that
|
||||||
|
any patent license obtained for a version of the library must be
|
||||||
|
consistent with the full freedom of use specified in this license.
|
||||||
|
|
||||||
|
Most GNU software, including some libraries, is covered by the
|
||||||
|
ordinary GNU General Public License. This license, the GNU Lesser
|
||||||
|
General Public License, applies to certain designated libraries, and
|
||||||
|
is quite different from the ordinary General Public License. We use
|
||||||
|
this license for certain libraries in order to permit linking those
|
||||||
|
libraries into non-free programs.
|
||||||
|
|
||||||
|
When a program is linked with a library, whether statically or using
|
||||||
|
a shared library, the combination of the two is legally speaking a
|
||||||
|
combined work, a derivative of the original library. The ordinary
|
||||||
|
General Public License therefore permits such linking only if the
|
||||||
|
entire combination fits its criteria of freedom. The Lesser General
|
||||||
|
Public License permits more lax criteria for linking other code with
|
||||||
|
the library.
|
||||||
|
|
||||||
|
We call this license the "Lesser" General Public License because it
|
||||||
|
does Less to protect the user's freedom than the ordinary General
|
||||||
|
Public License. It also provides other free software developers Less
|
||||||
|
of an advantage over competing non-free programs. These disadvantages
|
||||||
|
are the reason we use the ordinary General Public License for many
|
||||||
|
libraries. However, the Lesser license provides advantages in certain
|
||||||
|
special circumstances.
|
||||||
|
|
||||||
|
For example, on rare occasions, there may be a special need to
|
||||||
|
encourage the widest possible use of a certain library, so that it becomes
|
||||||
|
a de-facto standard. To achieve this, non-free programs must be
|
||||||
|
allowed to use the library. A more frequent case is that a free
|
||||||
|
library does the same job as widely used non-free libraries. In this
|
||||||
|
case, there is little to gain by limiting the free library to free
|
||||||
|
software only, so we use the Lesser General Public License.
|
||||||
|
|
||||||
|
In other cases, permission to use a particular library in non-free
|
||||||
|
programs enables a greater number of people to use a large body of
|
||||||
|
free software. For example, permission to use the GNU C Library in
|
||||||
|
non-free programs enables many more people to use the whole GNU
|
||||||
|
operating system, as well as its variant, the GNU/Linux operating
|
||||||
|
system.
|
||||||
|
|
||||||
|
Although the Lesser General Public License is Less protective of the
|
||||||
|
users' freedom, it does ensure that the user of a program that is
|
||||||
|
linked with the Library has the freedom and the wherewithal to run
|
||||||
|
that program using a modified version of the Library.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow. Pay close attention to the difference between a
|
||||||
|
"work based on the library" and a "work that uses the library". The
|
||||||
|
former contains code derived from the library, whereas the latter must
|
||||||
|
be combined with the library in order to run.
|
||||||
|
|
||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License Agreement applies to any software library or other
|
||||||
|
program which contains a notice placed by the copyright holder or
|
||||||
|
other authorized party saying it may be distributed under the terms of
|
||||||
|
this Lesser General Public License (also called "this License").
|
||||||
|
Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
A "library" means a collection of software functions and/or data
|
||||||
|
prepared so as to be conveniently linked with application programs
|
||||||
|
(which use some of those functions and data) to form executables.
|
||||||
|
|
||||||
|
The "Library", below, refers to any such software library or work
|
||||||
|
which has been distributed under these terms. A "work based on the
|
||||||
|
Library" means either the Library or any derivative work under
|
||||||
|
copyright law: that is to say, a work containing the Library or a
|
||||||
|
portion of it, either verbatim or with modifications and/or translated
|
||||||
|
straightforwardly into another language. (Hereinafter, translation is
|
||||||
|
included without limitation in the term "modification".)
|
||||||
|
|
||||||
|
"Source code" for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For a library, complete source code means
|
||||||
|
all the source code for all modules it contains, plus any associated
|
||||||
|
interface definition files, plus the scripts used to control compilation
|
||||||
|
and installation of the library.
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running a program using the Library is not restricted, and output from
|
||||||
|
such a program is covered only if its contents constitute a work based
|
||||||
|
on the Library (independent of the use of the Library in a tool for
|
||||||
|
writing it). Whether that is true depends on what the Library does
|
||||||
|
and what the program that uses the Library does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Library's
|
||||||
|
complete source code as you receive it, in any medium, provided that
|
||||||
|
you conspicuously and appropriately publish on each copy an
|
||||||
|
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||||
|
all the notices that refer to this License and to the absence of any
|
||||||
|
warranty; and distribute a copy of this License along with the
|
||||||
|
Library.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy,
|
||||||
|
and you may at your option offer warranty protection in exchange for a
|
||||||
|
fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Library or any portion
|
||||||
|
of it, thus forming a work based on the Library, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The modified work must itself be a software library.
|
||||||
|
|
||||||
|
b) You must cause the files modified to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
c) You must cause the whole of the work to be licensed at no
|
||||||
|
charge to all third parties under the terms of this License.
|
||||||
|
|
||||||
|
d) If a facility in the modified Library refers to a function or a
|
||||||
|
table of data to be supplied by an application program that uses
|
||||||
|
the facility, other than as an argument passed when the facility
|
||||||
|
is invoked, then you must make a good faith effort to ensure that,
|
||||||
|
in the event an application does not supply such function or
|
||||||
|
table, the facility still operates, and performs whatever part of
|
||||||
|
its purpose remains meaningful.
|
||||||
|
|
||||||
|
(For example, a function in a library to compute square roots has
|
||||||
|
a purpose that is entirely well-defined independent of the
|
||||||
|
application. Therefore, Subsection 2d requires that any
|
||||||
|
application-supplied function or table used by this function must
|
||||||
|
be optional: if the application does not supply it, the square
|
||||||
|
root function must still compute square roots.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Library,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Library, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote
|
||||||
|
it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Library.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Library
|
||||||
|
with the Library (or with a work based on the Library) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||||
|
License instead of this License to a given copy of the Library. To do
|
||||||
|
this, you must alter all the notices that refer to this License, so
|
||||||
|
that they refer to the ordinary GNU General Public License, version 2,
|
||||||
|
instead of to this License. (If a newer version than version 2 of the
|
||||||
|
ordinary GNU General Public License has appeared, then you can specify
|
||||||
|
that version instead if you wish.) Do not make any other change in
|
||||||
|
these notices.
|
||||||
|
|
||||||
|
Once this change is made in a given copy, it is irreversible for
|
||||||
|
that copy, so the ordinary GNU General Public License applies to all
|
||||||
|
subsequent copies and derivative works made from that copy.
|
||||||
|
|
||||||
|
This option is useful when you wish to copy part of the code of
|
||||||
|
the Library into a program that is not a library.
|
||||||
|
|
||||||
|
4. You may copy and distribute the Library (or a portion or
|
||||||
|
derivative of it, under Section 2) in object code or executable form
|
||||||
|
under the terms of Sections 1 and 2 above provided that you accompany
|
||||||
|
it with the complete corresponding machine-readable source code, which
|
||||||
|
must be distributed under the terms of Sections 1 and 2 above on a
|
||||||
|
medium customarily used for software interchange.
|
||||||
|
|
||||||
|
If distribution of object code is made by offering access to copy
|
||||||
|
from a designated place, then offering equivalent access to copy the
|
||||||
|
source code from the same place satisfies the requirement to
|
||||||
|
distribute the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
5. A program that contains no derivative of any portion of the
|
||||||
|
Library, but is designed to work with the Library by being compiled or
|
||||||
|
linked with it, is called a "work that uses the Library". Such a
|
||||||
|
work, in isolation, is not a derivative work of the Library, and
|
||||||
|
therefore falls outside the scope of this License.
|
||||||
|
|
||||||
|
However, linking a "work that uses the Library" with the Library
|
||||||
|
creates an executable that is a derivative of the Library (because it
|
||||||
|
contains portions of the Library), rather than a "work that uses the
|
||||||
|
library". The executable is therefore covered by this License.
|
||||||
|
Section 6 states terms for distribution of such executables.
|
||||||
|
|
||||||
|
When a "work that uses the Library" uses material from a header file
|
||||||
|
that is part of the Library, the object code for the work may be a
|
||||||
|
derivative work of the Library even though the source code is not.
|
||||||
|
Whether this is true is especially significant if the work can be
|
||||||
|
linked without the Library, or if the work is itself a library. The
|
||||||
|
threshold for this to be true is not precisely defined by law.
|
||||||
|
|
||||||
|
If such an object file uses only numerical parameters, data
|
||||||
|
structure layouts and accessors, and small macros and small inline
|
||||||
|
functions (ten lines or less in length), then the use of the object
|
||||||
|
file is unrestricted, regardless of whether it is legally a derivative
|
||||||
|
work. (Executables containing this object code plus portions of the
|
||||||
|
Library will still fall under Section 6.)
|
||||||
|
|
||||||
|
Otherwise, if the work is a derivative of the Library, you may
|
||||||
|
distribute the object code for the work under the terms of Section 6.
|
||||||
|
Any executables containing that work also fall under Section 6,
|
||||||
|
whether or not they are linked directly with the Library itself.
|
||||||
|
|
||||||
|
6. As an exception to the Sections above, you may also combine or
|
||||||
|
link a "work that uses the Library" with the Library to produce a
|
||||||
|
work containing portions of the Library, and distribute that work
|
||||||
|
under terms of your choice, provided that the terms permit
|
||||||
|
modification of the work for the customer's own use and reverse
|
||||||
|
engineering for debugging such modifications.
|
||||||
|
|
||||||
|
You must give prominent notice with each copy of the work that the
|
||||||
|
Library is used in it and that the Library and its use are covered by
|
||||||
|
this License. You must supply a copy of this License. If the work
|
||||||
|
during execution displays copyright notices, you must include the
|
||||||
|
copyright notice for the Library among them, as well as a reference
|
||||||
|
directing the user to the copy of this License. Also, you must do one
|
||||||
|
of these things:
|
||||||
|
|
||||||
|
a) Accompany the work with the complete corresponding
|
||||||
|
machine-readable source code for the Library including whatever
|
||||||
|
changes were used in the work (which must be distributed under
|
||||||
|
Sections 1 and 2 above); and, if the work is an executable linked
|
||||||
|
with the Library, with the complete machine-readable "work that
|
||||||
|
uses the Library", as object code and/or source code, so that the
|
||||||
|
user can modify the Library and then relink to produce a modified
|
||||||
|
executable containing the modified Library. (It is understood
|
||||||
|
that the user who changes the contents of definitions files in the
|
||||||
|
Library will not necessarily be able to recompile the application
|
||||||
|
to use the modified definitions.)
|
||||||
|
|
||||||
|
b) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (1) uses at run time a
|
||||||
|
copy of the library already present on the user's computer system,
|
||||||
|
rather than copying library functions into the executable, and (2)
|
||||||
|
will operate properly with a modified version of the library, if
|
||||||
|
the user installs one, as long as the modified version is
|
||||||
|
interface-compatible with the version that the work was made with.
|
||||||
|
|
||||||
|
c) Accompany the work with a written offer, valid for at
|
||||||
|
least three years, to give the same user the materials
|
||||||
|
specified in Subsection 6a, above, for a charge no more
|
||||||
|
than the cost of performing this distribution.
|
||||||
|
|
||||||
|
d) If distribution of the work is made by offering access to copy
|
||||||
|
from a designated place, offer equivalent access to copy the above
|
||||||
|
specified materials from the same place.
|
||||||
|
|
||||||
|
e) Verify that the user has already received a copy of these
|
||||||
|
materials or that you have already sent this user a copy.
|
||||||
|
|
||||||
|
For an executable, the required form of the "work that uses the
|
||||||
|
Library" must include any data and utility programs needed for
|
||||||
|
reproducing the executable from it. However, as a special exception,
|
||||||
|
the materials to be distributed need not include anything that is
|
||||||
|
normally distributed (in either source or binary form) with the major
|
||||||
|
components (compiler, kernel, and so on) of the operating system on
|
||||||
|
which the executable runs, unless that component itself accompanies
|
||||||
|
the executable.
|
||||||
|
|
||||||
|
It may happen that this requirement contradicts the license
|
||||||
|
restrictions of other proprietary libraries that do not normally
|
||||||
|
accompany the operating system. Such a contradiction means you cannot
|
||||||
|
use both them and the Library together in an executable that you
|
||||||
|
distribute.
|
||||||
|
|
||||||
|
7. You may place library facilities that are a work based on the
|
||||||
|
Library side-by-side in a single library together with other library
|
||||||
|
facilities not covered by this License, and distribute such a combined
|
||||||
|
library, provided that the separate distribution of the work based on
|
||||||
|
the Library and of the other library facilities is otherwise
|
||||||
|
permitted, and provided that you do these two things:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work
|
||||||
|
based on the Library, uncombined with any other library
|
||||||
|
facilities. This must be distributed under the terms of the
|
||||||
|
Sections above.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library of the fact
|
||||||
|
that part of it is a work based on the Library, and explaining
|
||||||
|
where to find the accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
8. You may not copy, modify, sublicense, link with, or distribute
|
||||||
|
the Library except as expressly provided under this License. Any
|
||||||
|
attempt otherwise to copy, modify, sublicense, link with, or
|
||||||
|
distribute the Library is void, and will automatically terminate your
|
||||||
|
rights under this License. However, parties who have received copies,
|
||||||
|
or rights, from you under this License will not have their licenses
|
||||||
|
terminated so long as such parties remain in full compliance.
|
||||||
|
|
||||||
|
9. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Library or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Library (or any work based on the
|
||||||
|
Library), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Library or works based on it.
|
||||||
|
|
||||||
|
10. Each time you redistribute the Library (or any work based on the
|
||||||
|
Library), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute, link with or modify the Library
|
||||||
|
subject to these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties with
|
||||||
|
this License.
|
||||||
|
|
||||||
|
11. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Library at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Library by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Library.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under any
|
||||||
|
particular circumstance, the balance of the section is intended to apply,
|
||||||
|
and the section as a whole is intended to apply in other circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
12. If the distribution and/or use of the Library is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Library under this License may add
|
||||||
|
an explicit geographical distribution limitation excluding those countries,
|
||||||
|
so that distribution is permitted only in or among countries not thus
|
||||||
|
excluded. In such case, this License incorporates the limitation as if
|
||||||
|
written in the body of this License.
|
||||||
|
|
||||||
|
13. The Free Software Foundation may publish revised and/or new
|
||||||
|
versions of the Lesser General Public License from time to time.
|
||||||
|
Such new versions will be similar in spirit to the present version,
|
||||||
|
but may differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Library
|
||||||
|
specifies a version number of this License which applies to it and
|
||||||
|
"any later version", you have the option of following the terms and
|
||||||
|
conditions either of that version or of any later version published by
|
||||||
|
the Free Software Foundation. If the Library does not specify a
|
||||||
|
license version number, you may choose any version ever published by
|
||||||
|
the Free Software Foundation.
|
||||||
|
|
||||||
|
14. If you wish to incorporate parts of the Library into other free
|
||||||
|
programs whose distribution conditions are incompatible with these,
|
||||||
|
write to the author to ask for permission. For software which is
|
||||||
|
copyrighted by the Free Software Foundation, write to the Free
|
||||||
|
Software Foundation; we sometimes make exceptions for this. Our
|
||||||
|
decision will be guided by the two goals of preserving the free status
|
||||||
|
of all derivatives of our free software and of promoting the sharing
|
||||||
|
and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||||
|
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||||
|
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||||
|
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||||
|
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||||
|
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||||
|
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||||
|
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||||
|
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||||
|
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||||
|
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||||
|
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||||
|
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||||
|
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||||
|
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
49
dep/recastnavigation/RecastDemo/Contrib/SDL/README
Normal file
49
dep/recastnavigation/RecastDemo/Contrib/SDL/README
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
|
||||||
|
Simple DirectMedia Layer
|
||||||
|
|
||||||
|
(SDL)
|
||||||
|
|
||||||
|
Version 1.2
|
||||||
|
|
||||||
|
---
|
||||||
|
http://www.libsdl.org/
|
||||||
|
|
||||||
|
This is the Simple DirectMedia Layer, a general API that provides low
|
||||||
|
level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL,
|
||||||
|
and 2D framebuffer across multiple platforms.
|
||||||
|
|
||||||
|
The current version supports Linux, Windows CE/95/98/ME/XP/Vista, BeOS,
|
||||||
|
MacOS Classic, Mac OS X, FreeBSD, NetBSD, OpenBSD, BSD/OS, Solaris, IRIX,
|
||||||
|
and QNX. The code contains support for Dreamcast, Atari, AIX, OSF/Tru64,
|
||||||
|
RISC OS, SymbianOS, Nintendo DS, and OS/2, but these are not officially
|
||||||
|
supported.
|
||||||
|
|
||||||
|
SDL is written in C, but works with C++ natively, and has bindings to
|
||||||
|
several other languages, including Ada, C#, Eiffel, Erlang, Euphoria,
|
||||||
|
Guile, Haskell, Java, Lisp, Lua, ML, Objective C, Pascal, Perl, PHP,
|
||||||
|
Pike, Pliant, Python, Ruby, and Smalltalk.
|
||||||
|
|
||||||
|
This library is distributed under GNU LGPL version 2, which can be
|
||||||
|
found in the file "COPYING". This license allows you to use SDL
|
||||||
|
freely in commercial programs as long as you link with the dynamic
|
||||||
|
library.
|
||||||
|
|
||||||
|
The best way to learn how to use SDL is to check out the header files in
|
||||||
|
the "include" subdirectory and the programs in the "test" subdirectory.
|
||||||
|
The header files and test programs are well commented and always up to date.
|
||||||
|
More documentation is available in HTML format in "docs/index.html", and
|
||||||
|
a documentation wiki is available online at:
|
||||||
|
http://www.libsdl.org/cgi/docwiki.cgi
|
||||||
|
|
||||||
|
The test programs in the "test" subdirectory are in the public domain.
|
||||||
|
|
||||||
|
Frequently asked questions are answered online:
|
||||||
|
http://www.libsdl.org/faq.php
|
||||||
|
|
||||||
|
If you need help with the library, or just want to discuss SDL related
|
||||||
|
issues, you can join the developers mailing list:
|
||||||
|
http://www.libsdl.org/mailing-list.php
|
||||||
|
|
||||||
|
Enjoy!
|
||||||
|
Sam Lantinga (slouken@libsdl.org)
|
||||||
|
|
||||||
13
dep/recastnavigation/RecastDemo/Contrib/SDL/README-SDL.txt
Normal file
13
dep/recastnavigation/RecastDemo/Contrib/SDL/README-SDL.txt
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
|
||||||
|
Please distribute this file with the SDL runtime environment:
|
||||||
|
|
||||||
|
The Simple DirectMedia Layer (SDL for short) is a cross-platfrom library
|
||||||
|
designed to make it easy to write multi-media software, such as games and
|
||||||
|
emulators.
|
||||||
|
|
||||||
|
The Simple DirectMedia Layer library source code is available from:
|
||||||
|
http://www.libsdl.org/
|
||||||
|
|
||||||
|
This library is distributed under the terms of the GNU LGPL license:
|
||||||
|
http://www.gnu.org/copyleft/lesser.html
|
||||||
|
|
||||||
171
dep/recastnavigation/RecastDemo/Contrib/SDL/VisualC.html
Normal file
171
dep/recastnavigation/RecastDemo/Contrib/SDL/VisualC.html
Normal file
|
|
@ -0,0 +1,171 @@
|
||||||
|
<HTML>
|
||||||
|
<HEAD>
|
||||||
|
<TITLE>Using SDL with Microsoft Visual C++</TITLE>
|
||||||
|
</HEAD>
|
||||||
|
<BODY>
|
||||||
|
<H1>
|
||||||
|
Using SDL with Microsoft Visual C++ 5,6 and 7
|
||||||
|
</H1>
|
||||||
|
<H3>
|
||||||
|
by <A HREF="mailto:snowlion@sprynet.com">Lion Kimbro </A>and additions by <A HREF="mailto:james@conceptofzero.net">
|
||||||
|
James Turk</A>
|
||||||
|
</H3>
|
||||||
|
<p>
|
||||||
|
You can either use the precompiled libraries from <A HREF="http://www.libsdl.org/download.php">
|
||||||
|
the SDL Download web site </A>, or you can build SDL yourself.
|
||||||
|
</p>
|
||||||
|
<H3>
|
||||||
|
Building SDL
|
||||||
|
</H3>
|
||||||
|
<P>
|
||||||
|
Unzip the <CODE>VisualC.zip</CODE> file into the directory that contains this
|
||||||
|
file (<CODE>VisualC.html</CODE>).
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Be certain that you unzip the zip file for your compiler into <strong>this</strong>
|
||||||
|
directory and not any other directory. If you are using WinZip, be careful to
|
||||||
|
make sure that it extracts to <strong>this</strong> folder, because it's
|
||||||
|
convenient feature of unzipping to a folder with the name of the file currently
|
||||||
|
being unzipped will get you in trouble if you use it right now. And that's all
|
||||||
|
I have to say about that.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Now that it's unzipped, go into the VisualC
|
||||||
|
directory that is created, and double-click on the VC++ file "<CODE>SDL.dsw</CODE>"<STRONG><FONT color="#009900">
|
||||||
|
("<CODE>SDL.sln</CODE>").</FONT></STRONG> This should open up the IDE.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
You may be prompted at this point to upgrade the workspace, should you be using
|
||||||
|
a more recent version of Visual C++. If so, allow the workspace to be upgraded.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Build the <CODE>.dll</CODE> and <CODE>.lib</CODE> files.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
This is done by right clicking on each project in turn (Projects are listed in
|
||||||
|
the Workspace panel in the FileView tab), and selecting "Build".
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
If you get an error about SDL_config.h being missing, you should
|
||||||
|
copy include/SDL_config.h.default to include/SDL_config.h and try again.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
You may get a few warnings, but you should not get any errors. You do have to
|
||||||
|
have at least the DirectX 5 SDK installed, however. The latest
|
||||||
|
version of DirectX can be downloaded or purchased on a cheap CD (my
|
||||||
|
recommendation) from <A HREF="http://www.microsoft.com">Microsoft </A>.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Later, we will refer to the following .lib and .dll files that have just been
|
||||||
|
generated:
|
||||||
|
</P>
|
||||||
|
<ul>
|
||||||
|
<li> SDL.dll</li>
|
||||||
|
<li> SDL.lib</li>
|
||||||
|
<li> SDLmain.lib</li>
|
||||||
|
</ul>
|
||||||
|
<P>
|
||||||
|
Search for these using the Windows Find (Windows-F) utility, if you don't
|
||||||
|
already know where they should be. For those of you with a clue, look inside
|
||||||
|
the Debug or Release directories of the subdirectories of the Project folder.
|
||||||
|
(It might be easier to just use Windows Find if this sounds confusing. And
|
||||||
|
don't worry about needing a clue; we all need visits from the clue fairy
|
||||||
|
frequently.)
|
||||||
|
</P>
|
||||||
|
<H3>
|
||||||
|
Creating a Project with SDL
|
||||||
|
</H3>
|
||||||
|
<P>
|
||||||
|
Create a project as a Win32 Application.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Create a C++ file for your project.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Set the C runtime to "Multi-threaded DLL" in the menu: <CODE>Project|Settings|C/C++
|
||||||
|
tab|Code Generation|Runtime Library </CODE>.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Add the SDL <CODE>include</CODE> directory to your list of includes in the
|
||||||
|
menu: <CODE>Project|Settings|C/C++ tab|Preprocessor|Additional include directories </CODE>
|
||||||
|
.
|
||||||
|
<br>
|
||||||
|
<STRONG><FONT color="#009900">VC7 Specific: Instead of doing this I find it easier to
|
||||||
|
add the include and library directories to the list that VC7 keeps. Do this by
|
||||||
|
selecting Tools|Options|Projects|VC++ Directories and under the "Show
|
||||||
|
Directories For:" dropbox select "Include Files", and click the "New Directory
|
||||||
|
Icon" and add the [SDLROOT]\include directory (ex. If you installed to
|
||||||
|
c:\SDL-1.2.5\ add c:\SDL-1.2.5\include). Proceed to change the
|
||||||
|
dropbox selection to "Library Files" and add [SDLROOT]\lib.</FONT></STRONG>
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
The "include directory" I am referring to is the <CODE>include</CODE> folder
|
||||||
|
within the main SDL directory (the one that this HTML file located within).
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Now we're going to use the files that we had created earlier in the Build SDL
|
||||||
|
step.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Copy the following files into your Project directory:
|
||||||
|
</P>
|
||||||
|
<ul>
|
||||||
|
<li> SDL.dll</li>
|
||||||
|
</ul>
|
||||||
|
<P>
|
||||||
|
Add the following files to your project (It is not necessary to copy them to
|
||||||
|
your project directory):
|
||||||
|
</P>
|
||||||
|
<ul>
|
||||||
|
<li> SDL.lib </li>
|
||||||
|
<li> SDLmain.lib</li>
|
||||||
|
</ul>
|
||||||
|
<P>
|
||||||
|
(To add them to your project, right click on your project, and select "Add
|
||||||
|
files to project")
|
||||||
|
</P>
|
||||||
|
<P><STRONG><FONT color="#009900">Instead of adding the files to your project it is more
|
||||||
|
desireable to add them to the linker options: Project|Properties|Linker|Command
|
||||||
|
Line and type the names of the libraries to link with in the "Additional
|
||||||
|
Options:" box. Note: This must be done for each build
|
||||||
|
configuration (eg. Release,Debug).</FONT></STRONG></P>
|
||||||
|
<H3>
|
||||||
|
SDL 101, First Day of Class
|
||||||
|
</H3>
|
||||||
|
<P>
|
||||||
|
Now create the basic body of your project. The body of your program should take
|
||||||
|
the following form: <CODE>
|
||||||
|
<PRE>
|
||||||
|
#include "SDL.h"
|
||||||
|
|
||||||
|
int main( int argc, char* argv[] )
|
||||||
|
{
|
||||||
|
// Body of the program goes here.
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
</PRE>
|
||||||
|
</CODE>
|
||||||
|
<P></P>
|
||||||
|
<H3>
|
||||||
|
That's it!
|
||||||
|
</H3>
|
||||||
|
<P>
|
||||||
|
I hope that this document has helped you get through the most difficult part of
|
||||||
|
using the SDL: installing it. Suggestions for improvements to this document
|
||||||
|
should be sent to the writers of this document.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Thanks to Paulus Esterhazy (pesterhazy@gmx.net), for the work on VC++ port.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
This document was originally called "VisualC.txt", and was written by <A HREF="mailto:slouken@libsdl.org">
|
||||||
|
Sam Lantinga</A>.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Later, it was converted to HTML and expanded into the document that you see
|
||||||
|
today by <A HREF="mailto:snowlion@sprynet.com">Lion Kimbro</A>.
|
||||||
|
</P>
|
||||||
|
<P>Minor Fixes and Visual C++ 7 Information (In Green) was added by <A HREF="mailto:james@conceptofzero.net">James Turk</A>
|
||||||
|
</P>
|
||||||
|
</BODY>
|
||||||
|
</HTML>
|
||||||
727
dep/recastnavigation/RecastDemo/Contrib/SDL/WhatsNew
Normal file
727
dep/recastnavigation/RecastDemo/Contrib/SDL/WhatsNew
Normal file
|
|
@ -0,0 +1,727 @@
|
||||||
|
|
||||||
|
This is a list of API changes in SDL's version history.
|
||||||
|
|
||||||
|
Version 1.0:
|
||||||
|
|
||||||
|
1.2.14:
|
||||||
|
Added cast macros for correct usage with C++:
|
||||||
|
SDL_reinterpret_cast(type, expression)
|
||||||
|
SDL_static_cast(type, expression)
|
||||||
|
|
||||||
|
Added SDL_VIDEO_FULLSCREEN_DISPLAY as a preferred synonym for
|
||||||
|
SDL_VIDEO_FULLSCREEN_HEAD on X11.
|
||||||
|
|
||||||
|
Added SDL_DISABLE_LOCK_KEYS environment variable to enable normal
|
||||||
|
up/down events for Caps-Lock and Num-Lock keys.
|
||||||
|
|
||||||
|
1.2.13:
|
||||||
|
Added SDL_BUTTON_X1 and SDL_BUTTON_X2 constants.
|
||||||
|
|
||||||
|
1.2.12:
|
||||||
|
Added SDL_VIDEO_ALLOW_SCREENSAVER to override SDL's disabling
|
||||||
|
of the screensaver on Mac OS X and X11.
|
||||||
|
|
||||||
|
1.2.10:
|
||||||
|
If SDL_OpenAudio() is passed zero for the desired format
|
||||||
|
fields, the following environment variables will be used
|
||||||
|
to fill them in:
|
||||||
|
SDL_AUDIO_FREQUENCY
|
||||||
|
SDL_AUDIO_FORMAT
|
||||||
|
SDL_AUDIO_CHANNELS
|
||||||
|
SDL_AUDIO_SAMPLES
|
||||||
|
If an environment variable is not specified, it will be set
|
||||||
|
to a reasonable default value.
|
||||||
|
|
||||||
|
Added support for the SDL_VIDEO_FULLSCREEN_HEAD environment
|
||||||
|
variable, currently supported on X11 Xinerama configurations.
|
||||||
|
|
||||||
|
Added SDL_GL_SWAP_CONTROL to wait for vsync in OpenGL applications.
|
||||||
|
|
||||||
|
Added SDL_GL_ACCELERATED_VISUAL to guarantee hardware acceleration.
|
||||||
|
|
||||||
|
Added current_w and current_h to the SDL_VideoInfo structure,
|
||||||
|
which is set to the desktop resolution during video intialization,
|
||||||
|
and then set to the current resolution when a video mode is set.
|
||||||
|
|
||||||
|
SDL_SetVideoMode() now accepts 0 for width or height and will use
|
||||||
|
the current video mode (or the desktop mode if no mode has been set.)
|
||||||
|
|
||||||
|
Added SDL_GetKeyRepeat()
|
||||||
|
|
||||||
|
Added SDL_config.h, with defaults for various build environments.
|
||||||
|
|
||||||
|
1.2.7:
|
||||||
|
Added CPU feature detection functions to SDL_cpuinfo.h:
|
||||||
|
SDL_HasRDTSC(), SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE(),
|
||||||
|
SDL_HasAltiVec()
|
||||||
|
Added function to create RWops from const memory: SDL_RWFromConstMem()
|
||||||
|
|
||||||
|
1.2.6:
|
||||||
|
Added SDL_LoadObject(), SDL_LoadFunction(), and SDL_UnloadObject()
|
||||||
|
|
||||||
|
Added SDL_GL_MULTISAMPLEBUFFERS and SDL_GL_MULTISAMPLESAMPLES for FSAA
|
||||||
|
|
||||||
|
1.2.5:
|
||||||
|
Added SDL_BUTTON_WHEELUP (4) and SDL_BUTTON_WHEELDOWN (5)
|
||||||
|
|
||||||
|
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
|
||||||
|
|
||||||
|
1.2.0:
|
||||||
|
Added SDL_VIDEOEXPOSE event to signal that the screen needs to
|
||||||
|
be redrawn. This is currently only delivered to OpenGL windows
|
||||||
|
on X11, though it may be delivered in the future when the video
|
||||||
|
memory is lost under DirectX.
|
||||||
|
|
||||||
|
1.1.8:
|
||||||
|
You can pass SDL_NOFRAME to SDL_VideoMode() to create a window
|
||||||
|
that has no title bar or frame decoration. Fullscreen video
|
||||||
|
modes automatically have this flag set.
|
||||||
|
|
||||||
|
Added a function to query the clipping rectangle for a surface:
|
||||||
|
void SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect)
|
||||||
|
|
||||||
|
Added a function to query the current event filter:
|
||||||
|
SDL_EventFilter SDL_GetEventFilter(void)
|
||||||
|
|
||||||
|
If you pass -1 to SDL_ShowCursor(), it won't change the current
|
||||||
|
cursor visibility state, but will still return it.
|
||||||
|
|
||||||
|
SDL_LockSurface() and SDL_UnlockSurface() are recursive, meaning
|
||||||
|
you can nest them as deep as you want, as long as each lock call
|
||||||
|
has a matching unlock call. The surface remains locked until the
|
||||||
|
last matching unlock call.
|
||||||
|
|
||||||
|
Note that you may not blit to or from a locked surface.
|
||||||
|
|
||||||
|
1.1.7:
|
||||||
|
The SDL_SetGammaRamp() and SDL_GetGammaRamp() functions now take
|
||||||
|
arrays of Uint16 values instead of Uint8 values. For the most part,
|
||||||
|
you can just take your old values and shift them up 8 bits to get
|
||||||
|
new correct values for your gamma ramps.
|
||||||
|
|
||||||
|
You can pass SDL_RLEACCEL in flags passed to SDL_ConvertSurface()
|
||||||
|
and SDL will try to RLE accelerate colorkey and alpha blits in the
|
||||||
|
resulting surface.
|
||||||
|
|
||||||
|
1.1.6:
|
||||||
|
Added a function to return the thread ID of a specific thread:
|
||||||
|
Uint32 SDL_GetThreadID(SDL_Thread *thread)
|
||||||
|
If 'thread' is NULL, this function returns the id for this thread.
|
||||||
|
|
||||||
|
1.1.5:
|
||||||
|
The YUV overlay structure has been changed to use an array of
|
||||||
|
pitches and pixels representing the planes of a YUV image, to
|
||||||
|
better enable hardware acceleration. The YV12 and IYUV formats
|
||||||
|
each have three planes, corresponding to the Y, U, and V portions
|
||||||
|
of the image, while packed pixel YUV formats just have one plane.
|
||||||
|
|
||||||
|
For palettized mode (8bpp), the screen colormap is now split in
|
||||||
|
a physical and a logical palette. The physical palette determines
|
||||||
|
what colours the screen pixels will get when displayed, and the
|
||||||
|
logical palette controls the mapping from blits to/from the screen.
|
||||||
|
A new function, SDL_SetPalette() has been added to change
|
||||||
|
logical and physical palettes separately. SDL_SetColors() works
|
||||||
|
just as before, and is equivalent to calling SDL_SetPalette() with
|
||||||
|
a flag argument of (SDL_LOGPAL|SDL_PHYSPAL).
|
||||||
|
|
||||||
|
SDL_BlitSurface() no longer modifies the source rectangle, only the
|
||||||
|
destination rectangle. The width/height members of the destination
|
||||||
|
rectangle are ignored, only the position is used.
|
||||||
|
|
||||||
|
The old source clipping function SDL_SetClipping() has been replaced
|
||||||
|
with a more useful function to set the destination clipping rectangle:
|
||||||
|
SDL_bool SDL_SetClipRect(SDL_Surface *surface, SDL_Rect *rect)
|
||||||
|
|
||||||
|
Added a function to see what subsystems have been initialized:
|
||||||
|
Uint32 SDL_WasInit(Uint32 flags)
|
||||||
|
|
||||||
|
The Big Alpha Flip: SDL now treats alpha as opacity like everybody
|
||||||
|
else, and not as transparency:
|
||||||
|
|
||||||
|
A new cpp symbol: SDL_ALPHA_OPAQUE is defined as 255
|
||||||
|
A new cpp symbol: SDL_ALPHA_TRANSPARENT is defined as 0
|
||||||
|
Values between 0 and 255 vary from fully transparent to fully opaque.
|
||||||
|
|
||||||
|
New functions:
|
||||||
|
SDL_DisplayFormatAlpha()
|
||||||
|
Returns a surface converted to a format with alpha-channel
|
||||||
|
that can be blit efficiently to the screen. (In other words,
|
||||||
|
like SDL_DisplayFormat() but the resulting surface has
|
||||||
|
an alpha channel.) This is useful for surfaces with alpha.
|
||||||
|
SDL_MapRGBA()
|
||||||
|
Works as SDL_MapRGB() but takes an additional alpha parameter.
|
||||||
|
SDL_GetRGBA()
|
||||||
|
Works as SDL_GetRGB() but also returns the alpha value
|
||||||
|
(SDL_ALPHA_OPAQUE for formats without an alpha channel)
|
||||||
|
|
||||||
|
Both SDL_GetRGB() and SDL_GetRGBA() now always return values in
|
||||||
|
the [0..255] interval. Previously, SDL_GetRGB() would return
|
||||||
|
(0xf8, 0xfc, 0xf8) for a completely white pixel in RGB565 format.
|
||||||
|
(N.B.: This is broken for bit fields < 3 bits.)
|
||||||
|
|
||||||
|
SDL_MapRGB() returns pixels in which the alpha channel is set opaque.
|
||||||
|
|
||||||
|
SDL_SetAlpha() can now be used for both setting the per-surface
|
||||||
|
alpha, using the new way of thinking of alpha, and also to enable
|
||||||
|
and disable per-pixel alpha blending for surfaces with an alpha
|
||||||
|
channel:
|
||||||
|
To disable alpha blending:
|
||||||
|
SDL_SetAlpha(surface, 0, 0);
|
||||||
|
To re-enable alpha blending:
|
||||||
|
SDL_SetAlpha(surface, SDL_SRCALPHA, 0);
|
||||||
|
Surfaces with an alpha channel have blending enabled by default.
|
||||||
|
|
||||||
|
SDL_SetAlpha() now accepts SDL_RLEACCEL as a flag, which requests
|
||||||
|
RLE acceleration of blits, just as like with SDL_SetColorKey().
|
||||||
|
This flag can be set for both surfaces with an alpha channel
|
||||||
|
and surfaces with an alpha value set by SDL_SetAlpha().
|
||||||
|
As always, RLE surfaces must be locked before pixel access is
|
||||||
|
allowed, and unlocked before any other SDL operations are done
|
||||||
|
on it.
|
||||||
|
|
||||||
|
The blit semantics for surfaces with and without alpha and colorkey
|
||||||
|
have now been defined:
|
||||||
|
|
||||||
|
RGBA->RGB:
|
||||||
|
SDL_SRCALPHA set:
|
||||||
|
alpha-blend (using alpha-channel).
|
||||||
|
SDL_SRCCOLORKEY ignored.
|
||||||
|
SDL_SRCALPHA not set:
|
||||||
|
copy RGB.
|
||||||
|
if SDL_SRCCOLORKEY set, only copy the pixels matching the
|
||||||
|
RGB values of the source colour key, ignoring alpha in the
|
||||||
|
comparison.
|
||||||
|
|
||||||
|
RGB->RGBA:
|
||||||
|
SDL_SRCALPHA set:
|
||||||
|
alpha-blend (using the source per-surface alpha value);
|
||||||
|
set destination alpha to opaque.
|
||||||
|
SDL_SRCALPHA not set:
|
||||||
|
copy RGB, set destination alpha to opaque.
|
||||||
|
both:
|
||||||
|
if SDL_SRCCOLORKEY set, only copy the pixels matching the
|
||||||
|
source colour key.
|
||||||
|
|
||||||
|
RGBA->RGBA:
|
||||||
|
SDL_SRCALPHA set:
|
||||||
|
alpha-blend (using the source alpha channel) the RGB values;
|
||||||
|
leave destination alpha untouched. [Note: is this correct?]
|
||||||
|
SDL_SRCCOLORKEY ignored.
|
||||||
|
SDL_SRCALPHA not set:
|
||||||
|
copy all of RGBA to the destination.
|
||||||
|
if SDL_SRCCOLORKEY set, only copy the pixels matching the
|
||||||
|
RGB values of the source colour key, ignoring alpha in the
|
||||||
|
comparison.
|
||||||
|
|
||||||
|
RGB->RGB:
|
||||||
|
SDL_SRCALPHA set:
|
||||||
|
alpha-blend (using the source per-surface alpha value).
|
||||||
|
SDL_SRCALPHA not set:
|
||||||
|
copy RGB.
|
||||||
|
both:
|
||||||
|
if SDL_SRCCOLORKEY set, only copy the pixels matching the
|
||||||
|
source colour key.
|
||||||
|
|
||||||
|
As a special case, blits from surfaces with per-surface alpha
|
||||||
|
value of 128 (50% transparency) are optimised and much faster
|
||||||
|
than other alpha values. This does not apply to surfaces with
|
||||||
|
alpha channels (per-pixel alpha).
|
||||||
|
|
||||||
|
New functions for manipulating the gamma of the display have
|
||||||
|
been added:
|
||||||
|
int SDL_SetGamma(float red, float green, float blue);
|
||||||
|
int SDL_SetGammaRamp(Uint8 *red, Uint8 *green, Uint8 *blue);
|
||||||
|
int SDL_GetGammaRamp(Uint8 *red, Uint8 *green, Uint8 *blue);
|
||||||
|
Gamma ramps are tables with 256 entries which map the screen color
|
||||||
|
components into actually displayed colors. For an example of
|
||||||
|
implementing gamma correction and gamma fades, see test/testgamma.c
|
||||||
|
Gamma control is not supported on all hardware.
|
||||||
|
|
||||||
|
1.1.4:
|
||||||
|
The size of the SDL_CDtrack structure changed from 8 to 12 bytes
|
||||||
|
as the size of the length member was extended to 32 bits.
|
||||||
|
|
||||||
|
You can now use SDL for 2D blitting with a GL mode by passing the
|
||||||
|
SDL_OPENGLBLIT flag to SDL_SetVideoMode(). You can specify 16 or
|
||||||
|
32 bpp, and the data in the framebuffer is put into the GL scene
|
||||||
|
when you call SDL_UpdateRects(), and the scene will be visible
|
||||||
|
when you call SDL_GL_SwapBuffers().
|
||||||
|
|
||||||
|
Run the "testgl" test program with the -logo command line option
|
||||||
|
to see an example of this blending of 2D and 3D in SDL.
|
||||||
|
|
||||||
|
1.1.3:
|
||||||
|
Added SDL_FreeRW() to the API, to complement SDL_AllocRW()
|
||||||
|
|
||||||
|
Added resizable window support - just add SDL_RESIZABLE to the
|
||||||
|
SDL_SetVideoMode() flags, and then wait for SDL_VIDEORESIZE events.
|
||||||
|
See SDL_events.h for details on the new SDL_ResizeEvent structure.
|
||||||
|
|
||||||
|
Added condition variable support, based on mutexes and semaphores.
|
||||||
|
SDL_CreateCond()
|
||||||
|
SDL_DestroyCond()
|
||||||
|
SDL_CondSignal()
|
||||||
|
SDL_CondBroadcast()
|
||||||
|
SDL_CondWait()
|
||||||
|
SDL_CondTimedWait()
|
||||||
|
The new function prototypes are in SDL_mutex.h
|
||||||
|
|
||||||
|
Added counting semaphore support, based on the mutex primitive.
|
||||||
|
SDL_CreateSemaphore()
|
||||||
|
SDL_DestroySemaphore()
|
||||||
|
SDL_SemWait()
|
||||||
|
SDL_SemTryWait()
|
||||||
|
SDL_SemWaitTimeout()
|
||||||
|
SDL_SemPost()
|
||||||
|
SDL_SemValue()
|
||||||
|
The new function prototypes are in SDL_mutex.h
|
||||||
|
|
||||||
|
Added support for asynchronous blitting. To take advantage of this,
|
||||||
|
you must set the SDL_ASYNCBLIT flag when setting the video mode and
|
||||||
|
creating surfaces that you want accelerated in this way. You must
|
||||||
|
lock surfaces that have this flag set, and the lock will block until
|
||||||
|
any queued blits have completed.
|
||||||
|
|
||||||
|
Added YUV video overlay support.
|
||||||
|
The supported YUV formats are: YV12, IYUV, YUY2, UYVY, and YVYU.
|
||||||
|
This function creates an overlay surface:
|
||||||
|
SDL_CreateYUVOverlay()
|
||||||
|
You must lock and unlock the overlay to get access to the data:
|
||||||
|
SDL_LockYUVOverlay() SDL_UnlockYUVOverlay()
|
||||||
|
You can then display the overlay:
|
||||||
|
SDL_DisplayYUVOverlay()
|
||||||
|
You must free the overlay when you are done using it:
|
||||||
|
SDL_FreeYUVOverlay()
|
||||||
|
See SDL_video.h for the full function prototypes.
|
||||||
|
|
||||||
|
The joystick hat position constants have been changed:
|
||||||
|
Old constant New constant
|
||||||
|
------------ ------------
|
||||||
|
0 SDL_HAT_CENTERED
|
||||||
|
1 SDL_HAT_UP
|
||||||
|
2 SDL_HAT_RIGHTUP
|
||||||
|
3 SDL_HAT_RIGHT
|
||||||
|
4 SDL_HAT_RIGHTDOWN
|
||||||
|
5 SDL_HAT_DOWN
|
||||||
|
6 SDL_HAT_LEFTDOWN
|
||||||
|
7 SDL_HAT_LEFT
|
||||||
|
8 SDL_HAT_LEFTUP
|
||||||
|
The new constants are bitmasks, so you can check for the
|
||||||
|
individual axes like this:
|
||||||
|
if ( hat_position & SDL_HAT_UP ) {
|
||||||
|
}
|
||||||
|
and you'll catch left-up, up, and right-up.
|
||||||
|
|
||||||
|
1.1.2:
|
||||||
|
Added multiple timer support:
|
||||||
|
SDL_AddTimer() and SDL_RemoveTimer()
|
||||||
|
|
||||||
|
SDL_WM_SetIcon() now respects the icon colorkey if mask is NULL.
|
||||||
|
|
||||||
|
1.1.0:
|
||||||
|
Added initial OpenGL support.
|
||||||
|
First set GL attributes (such as RGB depth, alpha depth, etc.)
|
||||||
|
SDL_GL_SetAttribute()
|
||||||
|
Then call SDL_SetVideoMode() with the SDL_OPENGL flag.
|
||||||
|
Perform all of your normal GL drawing.
|
||||||
|
Finally swap the buffers with the new SDL function:
|
||||||
|
SDL_GL_SwapBuffers()
|
||||||
|
See the new 'testgl' test program for an example of using GL with SDL.
|
||||||
|
|
||||||
|
You can load GL extension functions by using the function:
|
||||||
|
SDL_GL_LoadProcAddress()
|
||||||
|
|
||||||
|
Added functions to initialize and cleanup specific SDL subsystems:
|
||||||
|
SDL_InitSubSystem() and SDL_QuitSubSystem()
|
||||||
|
|
||||||
|
Added user-defined event type:
|
||||||
|
typedef struct {
|
||||||
|
Uint8 type;
|
||||||
|
int code;
|
||||||
|
void *data1;
|
||||||
|
void *data2;
|
||||||
|
} SDL_UserEvent;
|
||||||
|
This structure is in the "user" member of an SDL_Event.
|
||||||
|
|
||||||
|
Added a function to push events into the event queue:
|
||||||
|
SDL_PushEvent()
|
||||||
|
|
||||||
|
Example of using the new SDL user-defined events:
|
||||||
|
{
|
||||||
|
SDL_Event event;
|
||||||
|
|
||||||
|
event.type = SDL_USEREVENT;
|
||||||
|
event.user.code = my_event_code;
|
||||||
|
event.user.data1 = significant_data;
|
||||||
|
event.user.data2 = 0;
|
||||||
|
SDL_PushEvent(&event);
|
||||||
|
}
|
||||||
|
|
||||||
|
Added a function to get mouse deltas since last query:
|
||||||
|
SDL_GetRelativeMouseState()
|
||||||
|
|
||||||
|
Added a boolean datatype to SDL_types.h:
|
||||||
|
SDL_bool = { SDL_TRUE, SDL_FALSE }
|
||||||
|
|
||||||
|
Added a function to get the current audio status:
|
||||||
|
SDL_GetAudioState();
|
||||||
|
It returns one of:
|
||||||
|
SDL_AUDIO_STOPPED,
|
||||||
|
SDL_AUDIO_PLAYING,
|
||||||
|
SDL_AUDIO_PAUSED
|
||||||
|
|
||||||
|
Added an AAlib driver (ASCII Art) - by Stephane Peter.
|
||||||
|
|
||||||
|
1.0.6:
|
||||||
|
The input grab state is reset after each call to SDL_SetVideoMode().
|
||||||
|
The input is grabbed by default in fullscreen mode, and ungrabbed in
|
||||||
|
windowed mode. If you want to set input grab to a particular value,
|
||||||
|
you should set it after each call to SDL_SetVideoMode().
|
||||||
|
|
||||||
|
1.0.5:
|
||||||
|
Exposed SDL_AudioInit(), SDL_VideoInit()
|
||||||
|
Added SDL_AudioDriverName() and SDL_VideoDriverName()
|
||||||
|
|
||||||
|
Added new window manager function:
|
||||||
|
SDL_WM_ToggleFullScreen()
|
||||||
|
This is currently implemented only on Linux
|
||||||
|
|
||||||
|
The ALT-ENTER code has been removed - it's not appropriate for a
|
||||||
|
lib to bind keys when they aren't even emergency escape sequences.
|
||||||
|
|
||||||
|
ALT-ENTER functionality can be implemented with the following code:
|
||||||
|
|
||||||
|
int Handle_AltEnter(const SDL_Event *event)
|
||||||
|
{
|
||||||
|
if ( event->type == SDL_KEYDOWN ) {
|
||||||
|
if ( (event->key.keysym.sym == SDLK_RETURN) &&
|
||||||
|
(event->key.keysym.mod & KMOD_ALT) ) {
|
||||||
|
SDL_WM_ToggleFullScreen(SDL_GetVideoSurface());
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
SDL_SetEventFilter(Handle_AltEnter);
|
||||||
|
|
||||||
|
1.0.3:
|
||||||
|
Under X11, if you grab the input and hide the mouse cursor,
|
||||||
|
the mouse will go into a "relative motion" mode where you
|
||||||
|
will always get relative motion events no matter how far in
|
||||||
|
each direction you move the mouse - relative motion is not
|
||||||
|
bounded by the edges of the window (though the absolute values
|
||||||
|
of the mouse positions are clamped by the size of the window).
|
||||||
|
The SVGAlib, framebuffer console, and DirectInput drivers all
|
||||||
|
have this behavior naturally, and the GDI and BWindow drivers
|
||||||
|
never go into "relative motion" mode.
|
||||||
|
|
||||||
|
1.0.2:
|
||||||
|
Added a function to enable keyboard repeat:
|
||||||
|
SDL_EnableKeyRepeat()
|
||||||
|
|
||||||
|
Added a function to grab the mouse and keyboard input
|
||||||
|
SDL_WM_GrabInput()
|
||||||
|
|
||||||
|
Added a function to iconify the window.
|
||||||
|
SDL_WM_IconifyWindow()
|
||||||
|
If this function succeeds, the application will receive an event
|
||||||
|
signaling SDL_APPACTIVE event
|
||||||
|
|
||||||
|
1.0.1:
|
||||||
|
Added constants to SDL_audio.h for 16-bit native byte ordering:
|
||||||
|
AUDIO_U16SYS, AUDIO_S16SYS
|
||||||
|
|
||||||
|
1.0.0:
|
||||||
|
New public release
|
||||||
|
|
||||||
|
Version 0.11:
|
||||||
|
|
||||||
|
0.11.5:
|
||||||
|
A new function SDL_GetVideoSurface() has been added, and returns
|
||||||
|
a pointer to the current display surface.
|
||||||
|
|
||||||
|
SDL_AllocSurface() has been renamed SDL_CreateRGBSurface(), and
|
||||||
|
a new function SDL_CreateRGBSurfaceFrom() has been added to allow
|
||||||
|
creating an SDL surface from an existing pixel data buffer.
|
||||||
|
|
||||||
|
Added SDL_GetRGB() to the headers and documentation.
|
||||||
|
|
||||||
|
0.11.4:
|
||||||
|
SDL_SetLibraryPath() is no longer meaningful, and has been removed.
|
||||||
|
|
||||||
|
0.11.3:
|
||||||
|
A new flag for SDL_Init(), SDL_INIT_NOPARACHUTE, prevents SDL from
|
||||||
|
installing fatal signal handlers on operating systems that support
|
||||||
|
them.
|
||||||
|
|
||||||
|
Version 0.9:
|
||||||
|
|
||||||
|
0.9.15:
|
||||||
|
SDL_CreateColorCursor() has been removed. Color cursors should
|
||||||
|
be implemented as sprites, blitted by the application when the
|
||||||
|
cursor moves. To get smooth color cursor updates when the app
|
||||||
|
is busy, pass the SDL_INIT_EVENTTHREAD flag to SDL_Init(). This
|
||||||
|
allows you to handle the mouse motion in another thread from an
|
||||||
|
event filter function, but is currently only supported by Linux
|
||||||
|
and BeOS. Note that you'll have to protect the display surface
|
||||||
|
from multi-threaded access by using mutexes if you do this.
|
||||||
|
|
||||||
|
Thread-safe surface support has been removed from SDL.
|
||||||
|
This makes blitting somewhat faster, by removing SDL_MiddleBlit().
|
||||||
|
Code that used SDL_MiddleBlit() should use SDL_LowerBlit() instead.
|
||||||
|
You can make your surfaces thread-safe by allocating your own
|
||||||
|
mutex and making lock/unlock calls around accesses to your surface.
|
||||||
|
|
||||||
|
0.9.14:
|
||||||
|
SDL_GetMouseState() now takes pointers to int rather than Uint16.
|
||||||
|
|
||||||
|
If you set the SDL_WINDOWID environment variable under UNIX X11,
|
||||||
|
SDL will use that as the main window instead of creating it's own.
|
||||||
|
This is an unsupported extension to SDL, and not portable at all.
|
||||||
|
|
||||||
|
0.9.13:
|
||||||
|
Added a function SDL_SetLibraryPath() which can be used to specify
|
||||||
|
the directory containing the SDL dynamic libraries. This is useful
|
||||||
|
for commercial applications which ship with particular versions
|
||||||
|
of the libraries, and for security on multi-user systems.
|
||||||
|
If this function is not used, the default system directories are
|
||||||
|
searched using the native dynamic object loading mechanism.
|
||||||
|
|
||||||
|
In order to support C linkage under Visual C++, you must declare
|
||||||
|
main() without any return type:
|
||||||
|
main(int argc, char *argv[]) {
|
||||||
|
/* Do the program... */
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
C++ programs should also return a value if compiled under VC++.
|
||||||
|
|
||||||
|
The blit_endian member of the SDL_VideoInfo struct has been removed.
|
||||||
|
|
||||||
|
SDL_SymToASCII() has been replaced with SDL_GetKeyName(), so there
|
||||||
|
is now no longer any function to translate a keysym to a character.
|
||||||
|
|
||||||
|
The SDL_keysym structure has been extended with a 'scancode' and
|
||||||
|
'unicode' member. The 'scancode' is a hardware specific scancode
|
||||||
|
for the key that was pressed, and may be 0. The 'unicode' member
|
||||||
|
is a 16-bit UNICODE translation of the key that was pressed along
|
||||||
|
with any modifiers or compose keys that have been pressed.
|
||||||
|
If no UNICODE translation exists for the key, 'unicode' will be 0.
|
||||||
|
|
||||||
|
Added a function SDL_EnableUNICODE() to enable/disable UNICODE
|
||||||
|
translation of character keypresses. Translation defaults off.
|
||||||
|
|
||||||
|
To convert existing code to use the new API, change code which
|
||||||
|
uses SDL_SymToASCII() to get the keyname to use SDL_GetKeyName(),
|
||||||
|
and change code which uses it to get the ASCII value of a sym to
|
||||||
|
use the 'unicode' member of the event keysym.
|
||||||
|
|
||||||
|
0.9.12:
|
||||||
|
There is partial support for 64-bit datatypes. I don't recommend
|
||||||
|
you use this if you have a choice, because 64-bit datatypes are not
|
||||||
|
supported on many platforms. On platforms for which it is supported,
|
||||||
|
the SDL_HAS_64BIT_TYPE C preprocessor define will be enabled, and
|
||||||
|
you can use the Uint64 and Sint64 datatypes.
|
||||||
|
|
||||||
|
Added functions to SDL_endian.h to support 64-bit datatypes:
|
||||||
|
SDL_SwapLE64(), SDL_SwapBE64(),
|
||||||
|
SDL_ReadLE64(), SDL_ReadBE64(), SDL_WriteLE64(), SDL_WriteBE64()
|
||||||
|
|
||||||
|
A new member "len_ratio" has been added to the SDL_AudioCVT structure,
|
||||||
|
and allows you to determine either the original buffer length or the
|
||||||
|
converted buffer length, given the other.
|
||||||
|
|
||||||
|
A new function SDL_FreeWAV() has been added to the API to free data
|
||||||
|
allocated by SDL_LoadWAV_RW(). This is necessary under Win32 since
|
||||||
|
the gcc compiled DLL uses a different heap than VC++ compiled apps.
|
||||||
|
|
||||||
|
SDL now has initial support for international keyboards using the
|
||||||
|
Latin character set.
|
||||||
|
If a particular mapping is desired, you can set the DEFAULT_KEYBOARD
|
||||||
|
compile-time variable, or you can set the environment variable
|
||||||
|
"SDL_KEYBOARD" to a string identifying the keyboard mapping you desire.
|
||||||
|
The valid values for these variables can be found in SDL_keyboard.c
|
||||||
|
|
||||||
|
Full support for German and French keyboards under X11 is implemented.
|
||||||
|
|
||||||
|
0.9.11:
|
||||||
|
The THREADED_EVENTS compile-time define has been replaced with the
|
||||||
|
SDL_INIT_EVENTTHREAD flag. If this flag is passed to SDL_Init(),
|
||||||
|
SDL will create a separate thread to perform input event handling.
|
||||||
|
If this flag is passed to SDL_Init(), and the OS doesn't support
|
||||||
|
event handling in a separate thread, SDL_Init() will fail.
|
||||||
|
Be sure to add calls to SDL_Delay() in your main thread to allow
|
||||||
|
the OS to schedule your event thread, or it may starve, leading
|
||||||
|
to slow event delivery and/or dropped events.
|
||||||
|
Currently MacOS and Win32 do not support this flag, while BeOS
|
||||||
|
and Linux do support it. I recommend that your application only
|
||||||
|
use this flag if absolutely necessary.
|
||||||
|
|
||||||
|
The SDL thread function passed to SDL_CreateThread() now returns a
|
||||||
|
status. This status can be retrieved by passing a non-NULL pointer
|
||||||
|
as the 'status' argument to SDL_WaitThread().
|
||||||
|
|
||||||
|
The volume parameter to SDL_MixAudio() has been increased in range
|
||||||
|
from (0-8) to (0-128)
|
||||||
|
|
||||||
|
SDL now has a data source abstraction which can encompass a file,
|
||||||
|
an area of memory, or any custom object you can envision. It uses
|
||||||
|
these abstractions, SDL_RWops, in the endian read/write functions,
|
||||||
|
and the built-in WAV and BMP file loaders. This means you can load
|
||||||
|
WAV chunks from memory mapped files, compressed archives, network
|
||||||
|
pipes, or anything else that has a data read abstraction.
|
||||||
|
|
||||||
|
There are three built-in data source abstractions:
|
||||||
|
SDL_RWFromFile(), SDL_RWFromFP(), SDL_RWFromMem()
|
||||||
|
along with a generic data source allocation function:
|
||||||
|
SDL_AllocRW()
|
||||||
|
These data sources can be used like stdio file pointers with the
|
||||||
|
following convenience functions:
|
||||||
|
SDL_RWseek(), SDL_RWread(), SDL_RWwrite(), SDL_RWclose()
|
||||||
|
These functions are defined in the new header file "SDL_rwops.h"
|
||||||
|
|
||||||
|
The endian swapping functions have been turned into macros for speed
|
||||||
|
and SDL_CalculateEndian() has been removed. SDL_endian.h now defines
|
||||||
|
SDL_BYTEORDER as either SDL_BIG_ENDIAN or SDL_LIL_ENDIAN depending on
|
||||||
|
the endianness of the host system.
|
||||||
|
|
||||||
|
The endian read/write functions now take an SDL_RWops pointer
|
||||||
|
instead of a stdio FILE pointer, to support the new data source
|
||||||
|
abstraction.
|
||||||
|
|
||||||
|
The SDL_*LoadWAV() functions have been replaced with a single
|
||||||
|
SDL_LoadWAV_RW() function that takes a SDL_RWops pointer as it's
|
||||||
|
first parameter, and a flag whether or not to automatically
|
||||||
|
free it as the second parameter. SDL_LoadWAV() is a macro for
|
||||||
|
backward compatibility and convenience:
|
||||||
|
SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...);
|
||||||
|
|
||||||
|
The SDL_*LoadBMP()/SDL_*SaveBMP() functions have each been replaced
|
||||||
|
with a single function that takes a SDL_RWops pointer as it's
|
||||||
|
first parameter, and a flag whether or not to automatically
|
||||||
|
free it as the second parameter. SDL_LoadBMP() and SDL_SaveBMP()
|
||||||
|
are macros for backward compatibility and convenience:
|
||||||
|
SDL_LoadBMP_RW(SDL_RWFromFile("sample.bmp", "rb"), 1, ...);
|
||||||
|
SDL_SaveBMP_RW(SDL_RWFromFile("sample.bmp", "wb"), 1, ...);
|
||||||
|
Note that these functions use SDL_RWseek() extensively, and should
|
||||||
|
not be used on pipes or other non-seekable data sources.
|
||||||
|
|
||||||
|
0.9.10:
|
||||||
|
The Linux SDL_SysWMInfo and SDL_SysWMMsg structures have been
|
||||||
|
extended to support multiple types of display drivers, as well as
|
||||||
|
safe access to the X11 display when THREADED_EVENTS is enabled.
|
||||||
|
The new structures are documented in the SDL_syswm.h header file.
|
||||||
|
|
||||||
|
Thanks to John Elliott <jce@seasip.demon.co.uk>, the UK keyboard
|
||||||
|
should now work properly, as well as the "Windows" keys on US
|
||||||
|
keyboards.
|
||||||
|
|
||||||
|
The Linux CD-ROM code now reads the CD-ROM devices from /etc/fstab
|
||||||
|
instead of trying to open each block device on the system.
|
||||||
|
The CD must be listed in /etc/fstab as using the iso9660 filesystem.
|
||||||
|
|
||||||
|
On Linux, if you define THREADED_EVENTS at compile time, a separate
|
||||||
|
thread will be spawned to gather X events asynchronously from the
|
||||||
|
graphics updates. This hasn't been extensively tested, but it does
|
||||||
|
provide a means of handling keyboard and mouse input in a separate
|
||||||
|
thread from the graphics thread. (This is now enabled by default.)
|
||||||
|
|
||||||
|
A special access function SDL_PeepEvents() allows you to manipulate
|
||||||
|
the event queue in a thread-safe manner, including peeking at events,
|
||||||
|
removing events of a specified type, and adding new events of arbitrary
|
||||||
|
type to the queue (use the new 'user' member of the SDL_Event type).
|
||||||
|
|
||||||
|
If you use SDL_PeepEvents() to gather events, then the main graphics
|
||||||
|
thread needs to call SDL_PumpEvents() periodically to drive the event
|
||||||
|
loop and generate input events. This is not necessary if SDL has been
|
||||||
|
compiled with THREADED_EVENTS defined, but doesn't hurt.
|
||||||
|
|
||||||
|
A new function SDL_ThreadID() returns the identifier associated with
|
||||||
|
the current thread.
|
||||||
|
|
||||||
|
0.9.9:
|
||||||
|
The AUDIO_STEREO format flag has been replaced with a new 'channels'
|
||||||
|
member of the SDL_AudioSpec structure. The channels are 1 for mono
|
||||||
|
audio, and 2 for stereo audio. In the future more channels may be
|
||||||
|
supported for 3D surround sound.
|
||||||
|
|
||||||
|
The SDL_MixAudio() function now takes an additional volume parameter,
|
||||||
|
which should be set to SDL_MIX_MAXVOLUME for compatibility with the
|
||||||
|
original function.
|
||||||
|
|
||||||
|
The CD-ROM functions which take a 'cdrom' parameter can now be
|
||||||
|
passed NULL, and will act on the last successfully opened CD-ROM.
|
||||||
|
|
||||||
|
0.9.8:
|
||||||
|
No changes, bugfixes only.
|
||||||
|
|
||||||
|
0.9.7:
|
||||||
|
No changes, bugfixes only.
|
||||||
|
|
||||||
|
0.9.6:
|
||||||
|
Added a fast rectangle fill function: SDL_FillRect()
|
||||||
|
|
||||||
|
Addition of a useful function for getting info on the video hardware:
|
||||||
|
const SDL_VideoInfo *SDL_GetVideoInfo(void)
|
||||||
|
This function replaces SDL_GetDisplayFormat().
|
||||||
|
|
||||||
|
Initial support for double-buffering:
|
||||||
|
Use the SDL_DOUBLEBUF flag in SDL_SetVideoMode()
|
||||||
|
Update the screen with a new function: SDL_Flip()
|
||||||
|
|
||||||
|
SDL_AllocSurface() takes two new flags:
|
||||||
|
SDL_SRCCOLORKEY means that the surface will be used for colorkey blits
|
||||||
|
and if the hardware supports hardware acceleration of colorkey blits
|
||||||
|
between two surfaces in video memory, to place the surface in video
|
||||||
|
memory if possible, otherwise it will be placed in system memory.
|
||||||
|
SDL_SRCALPHA means that the surface will be used for alpha blits and
|
||||||
|
if the hardware supports hardware acceleration of alpha blits between
|
||||||
|
two surfaces in video memory, to place the surface in video memory
|
||||||
|
if possible, otherwise it will be placed in system memory.
|
||||||
|
SDL_HWSURFACE now means that the surface will be created with the
|
||||||
|
same format as the display surface, since having surfaces in video
|
||||||
|
memory is only useful for fast blitting to the screen, and you can't
|
||||||
|
blit surfaces with different surface formats in video memory.
|
||||||
|
|
||||||
|
0.9.5:
|
||||||
|
You can now pass a NULL mask to SDL_WM_SetIcon(), and it will assume
|
||||||
|
that the icon consists of the entire image.
|
||||||
|
|
||||||
|
SDL_LowerBlit() is back -- but don't use it on the display surface.
|
||||||
|
It is exactly the same as SDL_MiddleBlit(), but doesn't check for
|
||||||
|
thread safety.
|
||||||
|
|
||||||
|
Added SDL_FPLoadBMP(), SDL_FPSaveBMP(), SDL_FPLoadWAV(), which take
|
||||||
|
a FILE pointer instead of a file name.
|
||||||
|
|
||||||
|
Added CD-ROM audio control API:
|
||||||
|
SDL_CDNumDrives()
|
||||||
|
SDL_CDName()
|
||||||
|
SDL_CDOpen()
|
||||||
|
SDL_CDStatus()
|
||||||
|
SDL_CDPlayTracks()
|
||||||
|
SDL_CDPlay()
|
||||||
|
SDL_CDPause()
|
||||||
|
SDL_CDResume()
|
||||||
|
SDL_CDStop()
|
||||||
|
SDL_CDEject()
|
||||||
|
SDL_CDClose()
|
||||||
|
|
||||||
|
0.9.4:
|
||||||
|
No changes, bugfixes only.
|
||||||
|
|
||||||
|
0.9.3:
|
||||||
|
Mouse motion event now includes relative motion information:
|
||||||
|
Sint16 event->motion.xrel, Sint16 event->motion.yrel
|
||||||
|
|
||||||
|
X11 keyrepeat handling can be disabled by defining IGNORE_X_KEYREPEAT
|
||||||
|
(Add -DIGNORE_X_KEYREPEAT to CFLAGS line in obj/x11Makefile)
|
||||||
|
|
||||||
|
0.9.2:
|
||||||
|
No changes, bugfixes only.
|
||||||
|
|
||||||
|
0.9.1:
|
||||||
|
Removed SDL_MapSurface() and SDL_UnmapSurface() -- surfaces are now
|
||||||
|
automatically mapped on blit.
|
||||||
|
|
||||||
|
0.8.0:
|
||||||
|
SDL stable release
|
||||||
629
dep/recastnavigation/RecastDemo/Contrib/SDL/docs.html
Normal file
629
dep/recastnavigation/RecastDemo/Contrib/SDL/docs.html
Normal file
|
|
@ -0,0 +1,629 @@
|
||||||
|
<HTML>
|
||||||
|
<HEAD><TITLE>SDL Stable Release</TITLE></HEAD>
|
||||||
|
<BODY BGCOLOR="#FFEBCD" TEXT="#000000">
|
||||||
|
|
||||||
|
<IMG SRC="docs/images/rainbow.gif" ALT="[separator]" WIDTH="100%">
|
||||||
|
<P>
|
||||||
|
This source is stable, and is fully tested on all supported platforms.<br>
|
||||||
|
Please send bug reports or questions to the SDL mailing list:<br>
|
||||||
|
<a href="http://www.libsdl.org/mailing-list.php"
|
||||||
|
>http://www.libsdl.org/mailing-list.php</a><br>
|
||||||
|
The latest stable release may be found on the
|
||||||
|
<a href="http://www.libsdl.org/">SDL website</A>.
|
||||||
|
</P>
|
||||||
|
|
||||||
|
<H2> <A HREF="docs/index.html">API Documentation</A> </H2>
|
||||||
|
|
||||||
|
<IMG SRC="docs/images/rainbow.gif" ALT="[separator]" WIDTH="100%">
|
||||||
|
|
||||||
|
<H2> SDL 1.2.14 Release Notes </H2>
|
||||||
|
<P>
|
||||||
|
SDL 1.2.14 is a significant bug fix release and a recommended update.
|
||||||
|
</P>
|
||||||
|
|
||||||
|
<H3> General Notes </H3>
|
||||||
|
|
||||||
|
<BLOCKQUOTE>
|
||||||
|
<P>
|
||||||
|
Fixed flicker when resizing the SDL window
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed crash in SDL_SetGammaRamp()
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed freeze in SDL_memset() with 0 length when assembly code is disabled.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Added SDL_DISABLE_LOCK_KEYS environment variable to enable normal up/down events for Caps-Lock and Num-Lock keys.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed audio quality problem when converting between 22050 Hz and 44100 Hz.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed a threading crash when a few threads are rapidly created and complete.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Increased accuracy of alpha blending routines.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed crash loading BMP files saved with the scanlines inverted.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed mouse coordinate clamping if SDL_SetVideoMode() isn't called in response to SDL_VIDEORESIZE event.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Added doxygen documentation for the SDL API headers.
|
||||||
|
</P>
|
||||||
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
|
<H3> Unix Notes </H3>
|
||||||
|
|
||||||
|
<BLOCKQUOTE>
|
||||||
|
<P>
|
||||||
|
Fixed potential memory corruption due to assembly bug with SDL_revcpy()
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed crashes trying to detect SSE features on x86_64 architecture.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed assembly for GCC optimized 50% alpha blending blits.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Added configure option --enable-screensaver, to allow enabling the screensaver by default.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Use XResetScreenSaver() instead of disabling screensaver entirely.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Removed the maximum window size limitation on X11.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed SDL_GL_SWAP_CONTROL on X11.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed setting the X11 window input hint.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed distorted X11 window icon for some visuals.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed detecting X11 libraries for dynamic loading on 64-bit Linux.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
SDL_GL_GetAttribute(SDL_GL_SWAP_CONTROL) returns the correct value with GLX_SGI_swap_control.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Added SDL_VIDEO_FULLSCREEN_DISPLAY as a preferred synonym for SDL_VIDEO_FULLSCREEN_HEAD on X11.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
The SDL_VIDEO_FULLSCREEN_DISPLAY environment variable can be set to 0 to place fullscreen SDL windows on the first Xinerama screen.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Added the SDL_VIDEO_FBCON_ROTATION environment variable to control output orientation on the framebuffer console.
|
||||||
|
<BR>
|
||||||
|
Valid values are:
|
||||||
|
<UL>
|
||||||
|
<LI>not set - Not rotating, no shadow.
|
||||||
|
<LI>"NONE" - Not rotating, but still using shadow.
|
||||||
|
<LI>"CW" - Rotating screen clockwise.
|
||||||
|
<LI>"UD" - Rotating screen upside down.
|
||||||
|
<LI>"CCW" - Rotating screen counter clockwise.
|
||||||
|
</UL>
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed DirectFB detection on some Linux distributions.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Added code to use the PS3 SPE processors for YUV conversion on Linux.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Updated ALSA support to the latest stable API
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
ALSA is now preferred over OSS audio. (SDL_AUDIODRIVER=dsp will restore the previous behavior.)
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Improved support for PulseAudio
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
The Network Audio System support is now dynamically loaded at runtime.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed crash with the MP-8866 Dual USB Joypad on newer Linux kernels.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed crash in SDL_Quit() when a joystick has been unplugged.
|
||||||
|
</P>
|
||||||
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
|
<H3> Windows Notes </H3>
|
||||||
|
|
||||||
|
<BLOCKQUOTE>
|
||||||
|
<P>
|
||||||
|
Verified 100% compatibility with Windows 7.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Prevent loss of OpenGL context when setting the video mode in response to a window resize event.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed video initialization with SDL_WINDOWID on Windows XP.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Improved mouse input responsiveness for first-person-shooter games.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
IME messages are now generated for localized input.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
SDL_RWFromFile() takes a UTF-8 filename when opening a file.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
The SDL_STDIO_REDIRECT environment variable can be used to override whether SDL redirects stdio to stdout.txt and stderr.txt.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed dynamic object loading on Windows CE.
|
||||||
|
</P>
|
||||||
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
|
<H3> Mac OS X Notes </H3>
|
||||||
|
|
||||||
|
<BLOCKQUOTE>
|
||||||
|
<P>
|
||||||
|
SDL now builds on Mac OS X 10.6 (Snow Leopard).
|
||||||
|
<BR>
|
||||||
|
Eric Wing posted a good rundown on the numerous changes here: <A HREF="http://playcontrol.net/ewing/jibberjabber/big_behind-the-scenes_chang.html">http://playcontrol.net/ewing/jibberjabber/big_behind-the-scenes_chang.html</A>
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
The X11 video driver is built by default.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed SDL_VIDEO_WINDOW_POS environment variable for Quartz target.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed setting the starting working directory in release builds.
|
||||||
|
</P>
|
||||||
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
|
<IMG SRC="docs/images/rainbow.gif" ALT="[separator]" WIDTH="100%">
|
||||||
|
|
||||||
|
<H2> SDL 1.2.13 Release Notes </H2>
|
||||||
|
<P>
|
||||||
|
SDL 1.2.13 is a minor bug fix release.
|
||||||
|
</P>
|
||||||
|
|
||||||
|
<H3> General Notes </H3>
|
||||||
|
|
||||||
|
<BLOCKQUOTE>
|
||||||
|
<P>
|
||||||
|
Fixed link error when building with Intel Compiler 10.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Removed stray C++ comment from public headers.
|
||||||
|
</P>
|
||||||
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
|
<H3> Unix Notes </H3>
|
||||||
|
|
||||||
|
<BLOCKQUOTE>
|
||||||
|
<P>
|
||||||
|
Fixed crash in SDL_SoftStretch() on secure operating systems.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed undefined symbol on X11 implementations without UTF-8 support.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Worked around BadAlloc error when using XVideo on the XFree86 Intel Integrated Graphics driver.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Scan for all joysticks on Linux instead of stopping at one that was removed.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed use of sdl-config arguments in sdl.m4
|
||||||
|
</P>
|
||||||
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
|
<H3> Windows Notes </H3>
|
||||||
|
|
||||||
|
<BLOCKQUOTE>
|
||||||
|
<P>
|
||||||
|
Fixed crash when a video driver reports higher than 32 bpp video modes.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed restoring the desktop after setting a 24-bit OpenGL video mode.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed window titles on Windows 95/98/ME.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Added SDL_BUTTON_X1 and SDL_BUTTON_X2 constants for extended mouse buttons.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Added support for quoted command line arguments.
|
||||||
|
</P>
|
||||||
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
|
<H3> Mac OS X Notes </H3>
|
||||||
|
|
||||||
|
<BLOCKQUOTE>
|
||||||
|
<P>
|
||||||
|
SDL now builds on Mac OS X 10.5 (Leopard).
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed high frequency crash involving text input.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed beeping when the escape key is pressed and UNICODE translation is enabled.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Improved trackpad scrolling support.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed joystick hat reporting for certain joysticks.
|
||||||
|
</P>
|
||||||
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
|
<IMG SRC="docs/images/rainbow.gif" ALT="[separator]" WIDTH="100%">
|
||||||
|
|
||||||
|
<H2> SDL 1.2.12 Release Notes </H2>
|
||||||
|
<P>
|
||||||
|
SDL 1.2.12 is a minor bug fix release.
|
||||||
|
</P>
|
||||||
|
|
||||||
|
<H3> General Notes </H3>
|
||||||
|
|
||||||
|
<BLOCKQUOTE>
|
||||||
|
<P>
|
||||||
|
Added support for the PulseAudio sound server: http://www.pulseaudio.org/
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Added SDL_VIDEO_ALLOW_SCREENSAVER to override SDL's disabling of the screensaver on Mac OS X, Windows, and X11.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed buffer overrun crash when resampling audio rates.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed audio bug where converting to mono was doubling the volume.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed off-by-one error in the C implementation of SDL_revcpy()
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed compiling with Sun Studio.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Support for AmigaOS has been removed from the main SDL code.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Support for Nokia 9210 "EPOC" driver has been removed from the main SDL code.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Unofficial support for the S60/SymbianOS platform has been added.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Unofficial support for the Nintendo DS platform has been added.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Reenabled MMX assembly for YUV overlay processing (GNU C Compiler only).
|
||||||
|
</P>
|
||||||
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
|
<H3> Unix Notes </H3>
|
||||||
|
|
||||||
|
<BLOCKQUOTE>
|
||||||
|
<P>
|
||||||
|
Fixed detection of X11 DGA mouse support.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Improved XIM support for asian character sets.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
The GFX_Display has been added to the X11 window information in SDL_syswm.h.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed PAGE_SIZE compile error in the fbcon video driver on newer Linux kernels.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed hang or crash at startup if aRts can't access the hardware.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed relative mouse mode when the cursor starts outside the X11 window.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed accidental free of stack memory in X11 mouse acceleration code.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Closed minor memory leak in XME code.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed TEXTRELs in the library to resolve some PIC issues.
|
||||||
|
</P>
|
||||||
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
|
<H3> Windows Notes </H3>
|
||||||
|
|
||||||
|
<BLOCKQUOTE>
|
||||||
|
<P>
|
||||||
|
The GDI video driver makes better use of the palette in 8-bit modes.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
The windib driver now supports more mouse buttons with WM_XBUTTON events.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
On Windows, SDL_SetVideoMode() will re-create the window instead of failing if the multisample settings are changed.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Added support for UTF-8 window titles on Windows.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed joystick detection on Windows.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Improved performance with Win32 file I/O.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed HBITMAP leak in GAPI driver.
|
||||||
|
</P>
|
||||||
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
|
<H3> Mac OS X Notes </H3>
|
||||||
|
|
||||||
|
<BLOCKQUOTE>
|
||||||
|
<P>
|
||||||
|
Added support for multi-axis controllers like 3Dconnxion's SpaceNavigator on Mac OS X.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed YUV overlay crash inside Quicktime on Intel Mac OS X.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed blitting alignment in Altivec alpha blit functions.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Keys F13, F14, and F15 are now usable on Apple keyboards under Mac OS X.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed joystick calibration code on Mac OS X.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed mouse jitter when multiple motion events are queued up in Mac OS X.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed changing the cursor in fullscreen mode on Mac OS X.
|
||||||
|
</P>
|
||||||
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
|
<H3> Mac OS Classic Notes </H3>
|
||||||
|
|
||||||
|
<BLOCKQUOTE>
|
||||||
|
<P>
|
||||||
|
Added support for gamma ramps to both toolbox and DrawSprocket video drivers.
|
||||||
|
</P>
|
||||||
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
|
<H3> BeOS Notes </H3>
|
||||||
|
|
||||||
|
<BLOCKQUOTE>
|
||||||
|
<P>
|
||||||
|
Implemented mouse grabbing and mouse relative mode on BeOS.
|
||||||
|
</P>
|
||||||
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
|
<IMG SRC="docs/images/rainbow.gif" ALT="[separator]" WIDTH="100%">
|
||||||
|
|
||||||
|
<H2> SDL 1.2.11 Release Notes </H2>
|
||||||
|
<P>
|
||||||
|
SDL 1.2.11 is a minor bug fix release.
|
||||||
|
</P>
|
||||||
|
|
||||||
|
<H3> Unix Notes </H3>
|
||||||
|
|
||||||
|
<BLOCKQUOTE>
|
||||||
|
<P>
|
||||||
|
Dynamic X11 loading is only enabled with gcc 4 supporting -fvisibility=hidden. This fixes crashes related to symbol collisions, and allows building on Solaris and IRIX.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed building SDL with Xinerama disabled.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed DRI OpenGL library loading, using RTLD_GLOBAL in dlopen().
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Added pkgconfig configuration support.
|
||||||
|
</P>
|
||||||
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
|
<H3> Windows Notes </H3>
|
||||||
|
|
||||||
|
<BLOCKQUOTE>
|
||||||
|
<P>
|
||||||
|
Setting SDL_GL_SWAP_CONTROL now works with Windows OpenGL.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
The Win32 window positioning code works properly for windows with menus.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
DirectSound audio quality has been improved on certain sound cards.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed 5.1 audio channel ordering on Windows and Mac OS X.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Plugged a couple of minor memory leaks in the windib video driver.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed type collision with stdint.h when building with gcc on Win32.
|
||||||
|
</P>
|
||||||
|
<P>
|
||||||
|
Fixed building with the Digital Mars Compiler on Win32.
|
||||||
|
</P>
|
||||||
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
|
<H3> Mac OS X Notes </H3>
|
||||||
|
|
||||||
|
<BLOCKQUOTE>
|
||||||
|
<P>
|
||||||
|
The Quartz video driver supports 32x32 cursors on Mac OS X 10.3 and above.
|
||||||
|
</P>
|
||||||
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
|
<IMG SRC="docs/images/rainbow.gif" ALT="[separator]" WIDTH="100%">
|
||||||
|
|
||||||
|
<H2> SDL 1.2.10 Release Notes </H2>
|
||||||
|
<P>
|
||||||
|
SDL 1.2.10 is a major release, featuring a revamp of the build system and many API improvements and bug fixes.
|
||||||
|
</P>
|
||||||
|
<H3> API enhancements </H3>
|
||||||
|
<UL>
|
||||||
|
<LI>
|
||||||
|
If SDL_OpenAudio() is passed zero for the desired format
|
||||||
|
fields, the following environment variables will be used
|
||||||
|
to fill them in:
|
||||||
|
<pre><code>
|
||||||
|
SDL_AUDIO_FREQUENCY
|
||||||
|
SDL_AUDIO_FORMAT
|
||||||
|
SDL_AUDIO_CHANNELS
|
||||||
|
SDL_AUDIO_SAMPLES
|
||||||
|
</code></pre>
|
||||||
|
If an environment variable is not specified, it will be set
|
||||||
|
to a reasonable default value.
|
||||||
|
<LI>
|
||||||
|
SDL_SetVideoMode() now accepts 0 for width or height and will use
|
||||||
|
the current video mode (or the desktop mode if no mode has been set.)
|
||||||
|
<LI>
|
||||||
|
Added current_w and current_h to the SDL_VideoInfo structure,
|
||||||
|
which is set to the desktop resolution during video intialization,
|
||||||
|
and then set to the current resolution when a video mode is set.
|
||||||
|
<LI>
|
||||||
|
SDL_GL_LoadLibrary() will load the system default OpenGL library
|
||||||
|
if it is passed NULL as a parameter.
|
||||||
|
<LI>
|
||||||
|
Added SDL_GL_SWAP_CONTROL to wait for vsync in OpenGL applications.
|
||||||
|
<LI>
|
||||||
|
Added SDL_GL_ACCELERATED_VISUAL to guarantee hardware acceleration.
|
||||||
|
<LI>
|
||||||
|
SDL_WM_SetCaption() now officially takes UTF-8 title and icon strings, and displays international characters on supported platforms.
|
||||||
|
<LI>
|
||||||
|
Added SDL_GetKeyRepeat() to query the key repeat settings.
|
||||||
|
<LI>
|
||||||
|
Added the "dummy" audio driver, which can be used to emulate audio
|
||||||
|
output without a sound card.
|
||||||
|
<LI>
|
||||||
|
Added SDL_config.h, with defaults for various build environments.
|
||||||
|
</UL>
|
||||||
|
|
||||||
|
<H3> General Notes </H3>
|
||||||
|
|
||||||
|
<BLOCKQUOTE>
|
||||||
|
<P>
|
||||||
|
The SDL website now has an <A HREF="http://www.libsdl.org/rss/rss.xml">RSS feed</A>!
|
||||||
|
<P>
|
||||||
|
The SDL development source code is now managed with <A HREF="http://www.libsdl.org/svn.php">Subversion</A>.
|
||||||
|
<P>
|
||||||
|
SDL now uses the Bugzilla <A HREF="http://bugzilla.libsdl.org/">bug tracking system</A>, hosted by icculus.org.
|
||||||
|
<P>
|
||||||
|
SDL is licensed under version 2.1 of the GNU Lesser General Public License.
|
||||||
|
<P>
|
||||||
|
The entire build system has been revamped to make it much more portable, including versions of C library functions to make it possible to run SDL on a minimal embedded environment. See README.Porting in the SDL source distribution for information on how to port SDL to a new platform.
|
||||||
|
<P>
|
||||||
|
SDL_opengl.h has been updated with the latest glext.h from <A HREF="http://oss.sgi.com/projects/ogl-sample/registry/">http://oss.sgi.com/projects/ogl-sample/registry/</A>
|
||||||
|
<P>
|
||||||
|
Alex Volkov contributed highly optimized RGB <-> RGBA blitters.
|
||||||
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
|
<H3> Unix Notes </H3>
|
||||||
|
|
||||||
|
<BLOCKQUOTE>
|
||||||
|
<P>
|
||||||
|
The X11 libraries are dynamically loaded at runtime by default. This allows the distributed version of SDL to run on systems without X11 libraries installed.
|
||||||
|
<P>
|
||||||
|
The XiG XME extension code is now included in the X11 video driver by default.
|
||||||
|
<P>
|
||||||
|
XRandR support for video mode switching has been added to the X11 driver, but is disabled because of undesired interactions with window managers. You can enable this by setting the environment variable SDL_VIDEO_X11_XRANDR to 1.
|
||||||
|
<P>
|
||||||
|
Xinerama multi-head displays are properly handled now, and the SDL_VIDEO_FULLSCREEN_HEAD environment variable can be used to select the screen used for fullscreen video modes. Note that changing the video modes only works on screen 0.
|
||||||
|
<P>
|
||||||
|
XVidMode video modes are now sorted so they maintain the refresh rates specified in the X11 configuration file.
|
||||||
|
<P>
|
||||||
|
SDL windows are no longer transparent in X11 compositing systems like XGL.
|
||||||
|
<P>
|
||||||
|
The mouse is properly released by the X11 video driver if the fullscreen window loses focus.
|
||||||
|
<P>
|
||||||
|
The X11 input driver now uses XIM to handle international input.
|
||||||
|
<P>
|
||||||
|
The screensaver and DPMS monitor blanking are disabled while SDL games are running under the X11 and DGA video drivers. This behavior will be formalized and selectable in SDL 1.3.
|
||||||
|
<P>
|
||||||
|
Fixed a bug preventing stereo OpenGL contexts from being selected on the X11 driver.
|
||||||
|
<P>
|
||||||
|
The DGA video driver now waits for pending blits involving surfaces before they are freed. This prevents display oddities when using SDL_DisplayFormat() to convert many images.
|
||||||
|
<P>
|
||||||
|
The framebuffer console video driver now has a parser for /etc/fb.modes for improved video mode handling.
|
||||||
|
<P>
|
||||||
|
The framebuffer console video driver now allows asynchronous VT switching, and restores the full contents of the screen when switched back.
|
||||||
|
<P>
|
||||||
|
The framebuffer console now uses CTRL-ALT-FN to switch virtual terminals, to avoid collisions with application key bindings.
|
||||||
|
<P>
|
||||||
|
The framebuffer console input driver correctly sets IMPS/2 mode for wheel mice. It also properly detects when gpm is in IMPS/2 protocol mode, or passing raw protocol from an IMPS/2 mouse.
|
||||||
|
<P>
|
||||||
|
The SVGAlib video driver now has support for banked (non-linear) video modes.
|
||||||
|
<P>
|
||||||
|
A video driver for OpenBSD on the Sharp Zaurus has been contributed by Staffan Ulfberg. See the file README.wscons in the SDL source distribution for details.
|
||||||
|
<P>
|
||||||
|
Many patches have been incorporated from *BSD ports.
|
||||||
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
|
<H3> Windows Notes </H3>
|
||||||
|
|
||||||
|
<BLOCKQUOTE>
|
||||||
|
<P>
|
||||||
|
The "windib" video driver is the default now, to prevent problems with certain laptops, 64-bit Windows, and Windows Vista. The DirectX driver is still available, and can be selected by setting the environment variable SDL_VIDEODRIVER to "directx".
|
||||||
|
<P>
|
||||||
|
SDL has been ported to 64-bit Windows.
|
||||||
|
<P>
|
||||||
|
Dmitry Yakimov contributed a GAPI video driver for Windows CE.
|
||||||
|
<P>
|
||||||
|
The default fullscreen refresh rate has been increased to match the desktop refresh rate, when using equivalent resolutions. A full API for querying and selecting refresh rates is planned for SDL 1.3.
|
||||||
|
<P>
|
||||||
|
Dialog boxes are now shown when SDL is in windowed OpenGL mode.
|
||||||
|
<P>
|
||||||
|
The SDL window is recreated when necessary to maintain OpenGL context attributes, when switching between windowed and fullscreen modes.
|
||||||
|
<P>
|
||||||
|
An SDL_VIDEORESIZE event is properly sent when the SDL window is maximized and restored.
|
||||||
|
<P>
|
||||||
|
Window positions are retained when switching between fullscreen and windowed modes.
|
||||||
|
<P>
|
||||||
|
ToUnicode() is used, when available, for improved handling of international keyboard input.
|
||||||
|
<P>
|
||||||
|
The PrtScrn is now treated normally with both key down and key up events.
|
||||||
|
<P>
|
||||||
|
Pressing ALT-F4 now delivers an SDL_QUIT event to SDL applications.
|
||||||
|
<P>
|
||||||
|
Joystick names are now correct for joysticks which have been unplugged and then plugged back in since booting.
|
||||||
|
<P>
|
||||||
|
An MCI error when playing the last track on a CD-ROM has been fixed.
|
||||||
|
<P>
|
||||||
|
OpenWatcom projects for building SDL have been provided by Marc Peter.
|
||||||
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
|
<H3> Mac OS X Notes </H3>
|
||||||
|
|
||||||
|
<BLOCKQUOTE>
|
||||||
|
<P>
|
||||||
|
SDL now supports building Universal binaries, both through Xcode projects and when using configure/make. See README.MacOSX in the SDL source archive for details.
|
||||||
|
<P>
|
||||||
|
The X11 video driver with GLX support can be built on Mac OS X, if the X11 development SDK is installed.
|
||||||
|
<P>
|
||||||
|
Transitions between fullscreen resolutions and windowed mode now use a much faster asynchronous fade to hide desktop flicker.
|
||||||
|
<P>
|
||||||
|
Icons set with SDL_WM_SetIcon() now have the proper colors on Intel Macs.
|
||||||
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
|
<H3> OS/2 Notes </H3>
|
||||||
|
|
||||||
|
<BLOCKQUOTE>
|
||||||
|
<P>
|
||||||
|
Projects for building SDL on OS/2 with OpenWatcom have been contributed by Doodle. See the file README.OS2 in the SDL source distribution for details.
|
||||||
|
</BLOCKQUOTE>
|
||||||
|
|
||||||
|
<IMG SRC="docs/images/rainbow.gif" ALT="[separator]" WIDTH="100%">
|
||||||
|
|
||||||
|
</BODY>
|
||||||
|
</HTML>
|
||||||
242
dep/recastnavigation/RecastDemo/Contrib/SDL/docs/html/audio.html
Normal file
242
dep/recastnavigation/RecastDemo/Contrib/SDL/docs/html/audio.html
Normal file
|
|
@ -0,0 +1,242 @@
|
||||||
|
<HTML
|
||||||
|
><HEAD
|
||||||
|
><TITLE
|
||||||
|
>Audio</TITLE
|
||||||
|
><META
|
||||||
|
NAME="GENERATOR"
|
||||||
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
|
||||||
|
"><LINK
|
||||||
|
REL="HOME"
|
||||||
|
TITLE="SDL Library Documentation"
|
||||||
|
HREF="index.html"><LINK
|
||||||
|
REL="UP"
|
||||||
|
TITLE="SDL Reference"
|
||||||
|
HREF="reference.html"><LINK
|
||||||
|
REL="PREVIOUS"
|
||||||
|
TITLE="SDL_JoystickClose"
|
||||||
|
HREF="sdljoystickclose.html"><LINK
|
||||||
|
REL="NEXT"
|
||||||
|
TITLE="SDL_AudioSpec"
|
||||||
|
HREF="sdlaudiospec.html"><META
|
||||||
|
NAME="KEYWORD"
|
||||||
|
CONTENT="audio"><META
|
||||||
|
NAME="KEYWORD"
|
||||||
|
CONTENT="function"></HEAD
|
||||||
|
><BODY
|
||||||
|
CLASS="CHAPTER"
|
||||||
|
BGCOLOR="#FFF8DC"
|
||||||
|
TEXT="#000000"
|
||||||
|
LINK="#0000ee"
|
||||||
|
VLINK="#551a8b"
|
||||||
|
ALINK="#ff0000"
|
||||||
|
><DIV
|
||||||
|
CLASS="NAVHEADER"
|
||||||
|
><TABLE
|
||||||
|
SUMMARY="Header navigation table"
|
||||||
|
WIDTH="100%"
|
||||||
|
BORDER="0"
|
||||||
|
CELLPADDING="0"
|
||||||
|
CELLSPACING="0"
|
||||||
|
><TR
|
||||||
|
><TH
|
||||||
|
COLSPAN="3"
|
||||||
|
ALIGN="center"
|
||||||
|
>SDL Library Documentation</TH
|
||||||
|
></TR
|
||||||
|
><TR
|
||||||
|
><TD
|
||||||
|
WIDTH="10%"
|
||||||
|
ALIGN="left"
|
||||||
|
VALIGN="bottom"
|
||||||
|
><A
|
||||||
|
HREF="sdljoystickclose.html"
|
||||||
|
ACCESSKEY="P"
|
||||||
|
>Prev</A
|
||||||
|
></TD
|
||||||
|
><TD
|
||||||
|
WIDTH="80%"
|
||||||
|
ALIGN="center"
|
||||||
|
VALIGN="bottom"
|
||||||
|
></TD
|
||||||
|
><TD
|
||||||
|
WIDTH="10%"
|
||||||
|
ALIGN="right"
|
||||||
|
VALIGN="bottom"
|
||||||
|
><A
|
||||||
|
HREF="sdlaudiospec.html"
|
||||||
|
ACCESSKEY="N"
|
||||||
|
>Next</A
|
||||||
|
></TD
|
||||||
|
></TR
|
||||||
|
></TABLE
|
||||||
|
><HR
|
||||||
|
ALIGN="LEFT"
|
||||||
|
WIDTH="100%"></DIV
|
||||||
|
><DIV
|
||||||
|
CLASS="CHAPTER"
|
||||||
|
><H1
|
||||||
|
><A
|
||||||
|
NAME="AUDIO"
|
||||||
|
></A
|
||||||
|
>Chapter 10. Audio</H1
|
||||||
|
><DIV
|
||||||
|
CLASS="TOC"
|
||||||
|
><DL
|
||||||
|
><DT
|
||||||
|
><B
|
||||||
|
>Table of Contents</B
|
||||||
|
></DT
|
||||||
|
><DT
|
||||||
|
><A
|
||||||
|
HREF="sdlaudiospec.html"
|
||||||
|
>SDL_AudioSpec</A
|
||||||
|
> -- Audio Specification Structure</DT
|
||||||
|
><DT
|
||||||
|
><A
|
||||||
|
HREF="sdlopenaudio.html"
|
||||||
|
>SDL_OpenAudio</A
|
||||||
|
> -- Opens the audio device with the desired parameters.</DT
|
||||||
|
><DT
|
||||||
|
><A
|
||||||
|
HREF="sdlpauseaudio.html"
|
||||||
|
>SDL_PauseAudio</A
|
||||||
|
> -- Pauses and unpauses the audio callback processing</DT
|
||||||
|
><DT
|
||||||
|
><A
|
||||||
|
HREF="sdlgetaudiostatus.html"
|
||||||
|
>SDL_GetAudioStatus</A
|
||||||
|
> -- Get the current audio state</DT
|
||||||
|
><DT
|
||||||
|
><A
|
||||||
|
HREF="sdlloadwav.html"
|
||||||
|
>SDL_LoadWAV</A
|
||||||
|
> -- Load a WAVE file</DT
|
||||||
|
><DT
|
||||||
|
><A
|
||||||
|
HREF="sdlfreewav.html"
|
||||||
|
>SDL_FreeWAV</A
|
||||||
|
> -- Frees previously opened WAV data</DT
|
||||||
|
><DT
|
||||||
|
><A
|
||||||
|
HREF="sdlaudiocvt.html"
|
||||||
|
>SDL_AudioCVT</A
|
||||||
|
> -- Audio Conversion Structure</DT
|
||||||
|
><DT
|
||||||
|
><A
|
||||||
|
HREF="sdlbuildaudiocvt.html"
|
||||||
|
>SDL_BuildAudioCVT</A
|
||||||
|
> -- Initializes a SDL_AudioCVT structure for conversion</DT
|
||||||
|
><DT
|
||||||
|
><A
|
||||||
|
HREF="sdlconvertaudio.html"
|
||||||
|
>SDL_ConvertAudio</A
|
||||||
|
> -- Convert audio data to a desired audio format.</DT
|
||||||
|
><DT
|
||||||
|
><A
|
||||||
|
HREF="sdlmixaudio.html"
|
||||||
|
>SDL_MixAudio</A
|
||||||
|
> -- Mix audio data</DT
|
||||||
|
><DT
|
||||||
|
><A
|
||||||
|
HREF="sdllockaudio.html"
|
||||||
|
>SDL_LockAudio</A
|
||||||
|
> -- Lock out the callback function</DT
|
||||||
|
><DT
|
||||||
|
><A
|
||||||
|
HREF="sdlunlockaudio.html"
|
||||||
|
>SDL_UnlockAudio</A
|
||||||
|
> -- Unlock the callback function</DT
|
||||||
|
><DT
|
||||||
|
><A
|
||||||
|
HREF="sdlcloseaudio.html"
|
||||||
|
>SDL_CloseAudio</A
|
||||||
|
> -- Shuts down audio processing and closes the audio device.</DT
|
||||||
|
></DL
|
||||||
|
></DIV
|
||||||
|
><P
|
||||||
|
>Sound on the computer is translated from waves that you hear into a series of
|
||||||
|
values, or samples, each representing the amplitude of the wave. When these
|
||||||
|
samples are sent in a stream to a sound card, an approximation of the original
|
||||||
|
wave can be recreated. The more bits used to represent the amplitude, and the
|
||||||
|
greater frequency these samples are gathered, the closer the approximated
|
||||||
|
sound is to the original, and the better the quality of sound.</P
|
||||||
|
><P
|
||||||
|
>This library supports both 8 and 16 bit signed and unsigned sound samples,
|
||||||
|
at frequencies ranging from 11025 Hz to 44100 Hz, depending on the
|
||||||
|
underlying hardware. If the hardware doesn't support the desired audio
|
||||||
|
format or frequency, it can be emulated if desired (See
|
||||||
|
<A
|
||||||
|
HREF="sdlopenaudio.html"
|
||||||
|
><TT
|
||||||
|
CLASS="FUNCTION"
|
||||||
|
>SDL_OpenAudio()</TT
|
||||||
|
></A
|
||||||
|
>)</P
|
||||||
|
><P
|
||||||
|
>A commonly supported audio format is 16 bits per sample at 22050 Hz.</P
|
||||||
|
></DIV
|
||||||
|
><DIV
|
||||||
|
CLASS="NAVFOOTER"
|
||||||
|
><HR
|
||||||
|
ALIGN="LEFT"
|
||||||
|
WIDTH="100%"><TABLE
|
||||||
|
SUMMARY="Footer navigation table"
|
||||||
|
WIDTH="100%"
|
||||||
|
BORDER="0"
|
||||||
|
CELLPADDING="0"
|
||||||
|
CELLSPACING="0"
|
||||||
|
><TR
|
||||||
|
><TD
|
||||||
|
WIDTH="33%"
|
||||||
|
ALIGN="left"
|
||||||
|
VALIGN="top"
|
||||||
|
><A
|
||||||
|
HREF="sdljoystickclose.html"
|
||||||
|
ACCESSKEY="P"
|
||||||
|
>Prev</A
|
||||||
|
></TD
|
||||||
|
><TD
|
||||||
|
WIDTH="34%"
|
||||||
|
ALIGN="center"
|
||||||
|
VALIGN="top"
|
||||||
|
><A
|
||||||
|
HREF="index.html"
|
||||||
|
ACCESSKEY="H"
|
||||||
|
>Home</A
|
||||||
|
></TD
|
||||||
|
><TD
|
||||||
|
WIDTH="33%"
|
||||||
|
ALIGN="right"
|
||||||
|
VALIGN="top"
|
||||||
|
><A
|
||||||
|
HREF="sdlaudiospec.html"
|
||||||
|
ACCESSKEY="N"
|
||||||
|
>Next</A
|
||||||
|
></TD
|
||||||
|
></TR
|
||||||
|
><TR
|
||||||
|
><TD
|
||||||
|
WIDTH="33%"
|
||||||
|
ALIGN="left"
|
||||||
|
VALIGN="top"
|
||||||
|
>SDL_JoystickClose</TD
|
||||||
|
><TD
|
||||||
|
WIDTH="34%"
|
||||||
|
ALIGN="center"
|
||||||
|
VALIGN="top"
|
||||||
|
><A
|
||||||
|
HREF="reference.html"
|
||||||
|
ACCESSKEY="U"
|
||||||
|
>Up</A
|
||||||
|
></TD
|
||||||
|
><TD
|
||||||
|
WIDTH="33%"
|
||||||
|
ALIGN="right"
|
||||||
|
VALIGN="top"
|
||||||
|
>SDL_AudioSpec</TD
|
||||||
|
></TR
|
||||||
|
></TABLE
|
||||||
|
></DIV
|
||||||
|
></BODY
|
||||||
|
></HTML
|
||||||
|
>
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue