forked from bartvdbraak/blender
Recast: fix bad level calls, Recast compiled out if BGE not enabled. SCons updated but not tested.
This commit is contained in:
parent
3d3f6b1ddc
commit
b988a2abf8
@ -27,12 +27,8 @@
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#ifndef NAVMESH_CONVERSION_H
|
||||
#define NAVMESH_CONVERSION_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#ifndef BKE_NAVMESH_CONVERSION_H
|
||||
#define BKE_NAVMESH_CONVERSION_H
|
||||
|
||||
struct DerivedMesh;
|
||||
|
||||
@ -65,32 +61,4 @@ bool polyIsConvex(const unsigned short* p, const int vertsPerPoly, const float*
|
||||
int polyFindVertex(const unsigned short* p, const int vertsPerPoly, unsigned short vertexIdx);
|
||||
float distPointToSegmentSq(const float* point, const float* a, const float* b);
|
||||
|
||||
|
||||
inline int bit(int a, int b)
|
||||
{
|
||||
return (a & (1 << b)) >> b;
|
||||
}
|
||||
|
||||
inline void intToCol(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;
|
||||
}
|
||||
|
||||
inline float area2(const float* a, const float* b, const float* c)
|
||||
{
|
||||
return (b[0] - a[0]) * (c[2] - a[2]) - (c[0] - a[0]) * (b[2] - a[2]);
|
||||
}
|
||||
inline bool left(const float* a, const float* b, const float* c)
|
||||
{
|
||||
return area2(a, b, c) < 0;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif //NAVMESH_CONVERSION_H
|
@ -353,6 +353,16 @@ if(WITH_LZMA)
|
||||
add_definitions(-DWITH_LZMA)
|
||||
endif()
|
||||
|
||||
if(WITH_GAMEENGINE)
|
||||
list(APPEND INC_SYS
|
||||
../../../extern/recastnavigation/Recast/Include
|
||||
)
|
||||
list(APPEND SRC
|
||||
intern/navmesh_conversion.cpp
|
||||
BKE_navmesh_conversion.h
|
||||
)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
|
||||
endif()
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
Import ('env')
|
||||
|
||||
sources = env.Glob('intern/*.c')
|
||||
sources = env.Glob('intern/*.c') + env.Glob('intern/*.cpp')
|
||||
|
||||
incs = '. #/intern/guardedalloc #/intern/memutil ../editors/include'
|
||||
incs += ' ../blenlib ../blenfont ../makesdna ../windowmanager'
|
||||
@ -90,6 +90,12 @@ if env['WITH_BF_LZMA']:
|
||||
incs += ' #/extern/lzma'
|
||||
defs.append('WITH_LZMA')
|
||||
|
||||
if env['WITH_BF_GAMEENGINE']:
|
||||
incs += ' #/extern/recastnavigation/Recast/Include'
|
||||
defs.append('WITH_GAMEENGINE')
|
||||
else:
|
||||
sources.remove('intern/navmesh_conversion.cpp')
|
||||
|
||||
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
|
||||
incs += ' ' + env['BF_PTHREADS_INC']
|
||||
|
||||
|
@ -26,18 +26,28 @@
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "Recast.h"
|
||||
|
||||
|
||||
extern "C"{
|
||||
#include "ED_navmesh_conversion.h"
|
||||
#include "BKE_navmesh_conversion.h"
|
||||
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "BKE_cdderivedmesh.h"
|
||||
#include "BLI_math.h"
|
||||
}
|
||||
|
||||
inline float area2(const float* a, const float* b, const float* c)
|
||||
{
|
||||
return (b[0] - a[0]) * (c[2] - a[2]) - (c[0] - a[0]) * (b[2] - a[2]);
|
||||
}
|
||||
|
||||
inline bool left(const float* a, const float* b, const float* c)
|
||||
{
|
||||
return area2(a, b, c) < 0;
|
||||
}
|
||||
|
||||
int polyNumVerts(const unsigned short* p, const int vertsPerPoly)
|
||||
{
|
||||
int nv = 0;
|
@ -87,16 +87,4 @@ set(SRC
|
||||
../include/UI_view2d.h
|
||||
)
|
||||
|
||||
if(WITH_GAMEENGINE)
|
||||
list(APPEND INC
|
||||
../../../../extern/recastnavigation/Recast/Include
|
||||
)
|
||||
|
||||
list(APPEND SRC
|
||||
navmesh_conversion.cpp
|
||||
|
||||
../include/ED_navmesh_conversion.h
|
||||
)
|
||||
endif()
|
||||
|
||||
blender_add_lib(bf_editor_util "${SRC}" "${INC}" "${INC_SYS}")
|
||||
|
@ -1,15 +1,11 @@
|
||||
#!/usr/bin/python
|
||||
Import ('env')
|
||||
|
||||
sources = env.Glob('*.c') + env.Glob('*.cpp')
|
||||
sources = env.Glob('*.c')
|
||||
|
||||
incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
|
||||
incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
|
||||
incs += ' ../../makesrna'
|
||||
incs += ' #extern/recastnavigation/Recast/Include'
|
||||
incs += ' ../../blenloader'
|
||||
|
||||
if not env['WITH_BF_GAMEENGINE']:
|
||||
sources.remove('navmesh_conversion.cpp')
|
||||
|
||||
env.BlenderLib ( 'bf_editors_util', sources, Split(incs), [], libtype=['core','player'], priority=[330,210] )
|
||||
|
@ -122,7 +122,6 @@ if(WITH_GAMEENGINE)
|
||||
list(APPEND INC
|
||||
../gpu
|
||||
../../../extern/recastnavigation/Recast/Include
|
||||
../editors/include # XXX - BAD LEVEL CALL, REMOVE BEFORE RELEASE
|
||||
)
|
||||
endif()
|
||||
|
||||
|
@ -7,8 +7,7 @@ incs = '. ./intern'
|
||||
incs += ' #/intern/guardedalloc #/intern/decimation/extern #/intern/bsp/extern #/intern/elbeem/extern #/extern/glew/include'
|
||||
incs += ' ../render/extern/include ../blenloader'
|
||||
incs += ' ../include ../blenlib ../makesdna ../makesrna ../blenkernel ../blenkernel/intern'
|
||||
incs += ' ../editors/include ../gpu'
|
||||
incs += ' #extern/recastnavigation/Recast/Include'
|
||||
incs += ' ../gpu'
|
||||
|
||||
incs += ' ' + env['BF_ZLIB_INC']
|
||||
|
||||
@ -21,6 +20,10 @@ defs += ['WITH_MOD_DECIMATE']
|
||||
if env['BF_NO_ELBEEM']:
|
||||
defs.append('DISABLE_ELBEEM')
|
||||
|
||||
if env['WITH_BF_GAMEENGINE']:
|
||||
incs += ' #/extern/recastnavigation/Recast/Include'
|
||||
defs.append('WITH_GAMEENGINE')
|
||||
|
||||
env.BlenderLib ( libname = 'bf_modifiers', sources = sources,
|
||||
includes = Split(incs), defines=defs,
|
||||
libtype=['core','player'], priority = [80, 40] )
|
||||
|
@ -34,11 +34,10 @@
|
||||
extern "C"{
|
||||
|
||||
#ifdef WITH_GAMEENGINE
|
||||
# include "ED_navmesh_conversion.h"
|
||||
# include "BIF_gl.h"
|
||||
# include "BKE_navmesh_conversion.h"
|
||||
# include "GL/glew.h"
|
||||
# include "GPU_buffers.h"
|
||||
# include "GPU_draw.h"
|
||||
# include "UI_resources.h"
|
||||
#endif
|
||||
|
||||
#include "DNA_mesh_types.h"
|
||||
@ -54,6 +53,22 @@ extern "C"{
|
||||
#include "BKE_customdata.h"
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
inline int bit(int a, int b)
|
||||
{
|
||||
return (a & (1 << b)) >> b;
|
||||
}
|
||||
|
||||
inline void intToCol(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;
|
||||
}
|
||||
|
||||
|
||||
static void initData(ModifierData *md)
|
||||
{
|
||||
/* NavMeshModifierData *nmmd = (NavMeshModifierData*) md; */ /* UNUSED */
|
||||
|
@ -59,7 +59,6 @@ set(INC_SYS
|
||||
${GLEW_INCLUDE_PATH}
|
||||
../../../extern/recastnavigation/Recast/Include
|
||||
../../../extern/recastnavigation/Detour/Include
|
||||
../../blender/editors/include
|
||||
)
|
||||
|
||||
set(SRC
|
||||
|
@ -38,9 +38,7 @@ extern "C" {
|
||||
#include "BKE_customdata.h"
|
||||
#include "BKE_cdderivedmesh.h"
|
||||
#include "BKE_DerivedMesh.h"
|
||||
|
||||
|
||||
#include "ED_navmesh_conversion.h"
|
||||
#include "BKE_navmesh_conversion.h"
|
||||
}
|
||||
|
||||
#include "KX_PythonInit.h"
|
||||
|
@ -21,7 +21,6 @@ incs += ' #source/gameengine/SceneGraph #source/gameengine/Physics/common'
|
||||
incs += ' #source/gameengine/Physics/Dummy'
|
||||
incs += ' #source/blender/misc #source/blender/blenloader #extern/glew/include #source/blender/gpu'
|
||||
incs += ' #extern/recastnavigation/Recast/Include #extern/recastnavigation/Detour/Include'
|
||||
incs += ' #source/blender/editors/include'
|
||||
|
||||
incs += ' ' + env['BF_BULLET_INC']
|
||||
incs += ' ' + env['BF_OPENGL_INC']
|
||||
|
Loading…
Reference in New Issue
Block a user