Recast: fix bad level calls, Recast compiled out if BGE not enabled. SCons updated...
authorBenoit Bolsee <benoit.bolsee@online.be>
Sun, 11 Sep 2011 14:13:04 +0000 (14:13 +0000)
committerBenoit Bolsee <benoit.bolsee@online.be>
Sun, 11 Sep 2011 14:13:04 +0000 (14:13 +0000)
12 files changed:
source/blender/blenkernel/BKE_navmesh_conversion.h [moved from source/blender/editors/include/ED_navmesh_conversion.h with 78% similarity]
source/blender/blenkernel/CMakeLists.txt
source/blender/blenkernel/SConscript
source/blender/blenkernel/intern/navmesh_conversion.cpp [moved from source/blender/editors/util/navmesh_conversion.cpp with 97% similarity]
source/blender/editors/util/CMakeLists.txt
source/blender/editors/util/SConscript
source/blender/modifiers/CMakeLists.txt
source/blender/modifiers/SConscript
source/blender/modifiers/intern/MOD_navmesh.cpp
source/gameengine/Ketsji/CMakeLists.txt
source/gameengine/Ketsji/KX_NavMeshObject.cpp
source/gameengine/Ketsji/SConscript

similarity index 78%
rename from source/blender/editors/include/ED_navmesh_conversion.h
rename to source/blender/blenkernel/BKE_navmesh_conversion.h
index 71b60cc4e4ab9af517848d3e46f92ebe628ca30e..acb3c2963a9e86080675d2d168d925ff0845d0f1 100644 (file)
 * ***** 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
index c1797427cc26dfc188c364d39b316a44d556f3f3..52709b75ca07b81d89228fa35a324a02583217be 100644 (file)
@@ -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()
index 5ea42ee65aea55cd67d87790fa0609a6d0bbf7eb..e7999f18b343d961047487a86677cec7b89bdcf1 100644 (file)
@@ -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']
 
similarity index 97%
rename from source/blender/editors/util/navmesh_conversion.cpp
rename to source/blender/blenkernel/intern/navmesh_conversion.cpp
index 8b3fee59e1a59d90607444f1b37ce962c769f522..245a2b23091c17d6eb4d97cd3381cc95b65744a1 100644 (file)
 *
 * ***** 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;
index c64b16c2d0828b1327d44a1ffb543b99c395446f..72f13c14f5dfabbf0ffffbcab605702228384427 100644 (file)
@@ -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}")
index 80c05dc5db4417bedde1f035e1504d65bb95dc81..cfbc735eb5c5ff11b67fadcca6b9bde89c4ca48a 100644 (file)
@@ -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] )
index 083ad052a58f8243a5fec92635f579a49ce4fe16..d8344a9e19b29abaa05196dbcdf0e1e58de723a8 100644 (file)
@@ -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()
 
index f90e637d151ad654bd6fb150a3e954e178684ffc..da37539e95047e7c8672d4b5967f2e3b4a6e9c68 100644 (file)
@@ -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] )
index d32281c12b6911bfcd62fb68f9de0f40b76c7391..927085033fcda214af5fa595dca7e761235d09c4 100644 (file)
 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 */
index 4b2d828fe81f1acca2ce5ab361f09c85ebe53e93..9d8b17818695ea88426a41104f115a7e3a3cc015 100644 (file)
@@ -59,7 +59,6 @@ set(INC_SYS
        ${GLEW_INCLUDE_PATH}
        ../../../extern/recastnavigation/Recast/Include
        ../../../extern/recastnavigation/Detour/Include
-       ../../blender/editors/include
 )
 
 set(SRC
index 26990f6e82bbda14692185378758890b721eb888..f72c98fb4bfe6955a99aad514aa29e900372e9e4 100644 (file)
@@ -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"
index 7c9785c24e7af76596c5876a4a570994a9fa233b..9b453ed76d5a0845d7dd092c94096f5b36dad616 100644 (file)
@@ -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']