[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40404] trunk/blender: Get rid of c++ in blenkernel and modifiers
Sergey Sharybin
g.ulairi at gmail.com
Tue Sep 20 18:24:50 CEST 2011
Revision: 40404
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40404
Author: nazgul
Date: 2011-09-20 16:24:50 +0000 (Tue, 20 Sep 2011)
Log Message:
-----------
Get rid of c++ in blenkernel and modifiers
Also use guarded allocations for navmesh stuff.
Modified Paths:
--------------
trunk/blender/extern/recastnavigation/CMakeLists.txt
trunk/blender/source/blender/blenkernel/BKE_navmesh_conversion.h
trunk/blender/source/blender/blenkernel/CMakeLists.txt
trunk/blender/source/blender/blenkernel/SConscript
trunk/blender/source/blender/modifiers/CMakeLists.txt
trunk/blender/source/blender/modifiers/SConscript
trunk/blender/source/gameengine/Ketsji/KX_NavMeshObject.cpp
Added Paths:
-----------
trunk/blender/extern/recastnavigation/recast-capi.cpp
trunk/blender/extern/recastnavigation/recast-capi.h
trunk/blender/source/blender/blenkernel/intern/navmesh_conversion.c
trunk/blender/source/blender/modifiers/intern/MOD_navmesh.c
Removed Paths:
-------------
trunk/blender/source/blender/blenkernel/intern/navmesh_conversion.cpp
trunk/blender/source/blender/modifiers/intern/MOD_navmesh.cpp
Modified: trunk/blender/extern/recastnavigation/CMakeLists.txt
===================================================================
--- trunk/blender/extern/recastnavigation/CMakeLists.txt 2011-09-20 15:55:28 UTC (rev 40403)
+++ trunk/blender/extern/recastnavigation/CMakeLists.txt 2011-09-20 16:24:50 UTC (rev 40404)
@@ -25,7 +25,7 @@
# ***** END GPL LICENSE BLOCK *****
set(INC
- Recast/Include
+ Recast/Include
Detour/Include
)
@@ -34,6 +34,10 @@
)
set(SRC
+ recast-capi.cpp
+ recast-capi.h
+
+
Detour/Source/DetourCommon.cpp
Detour/Source/DetourNode.cpp
Detour/Source/DetourStatNavMesh.cpp
@@ -47,7 +51,7 @@
Detour/Include/DetourStatNavMeshBuilder.h
Detour/Include/DetourTileNavMesh.h
Detour/Include/DetourTileNavMeshBuilder.h
-
+
Recast/Source/Recast.cpp
Recast/Source/RecastContour.cpp
Recast/Source/RecastFilter.cpp
@@ -57,10 +61,10 @@
Recast/Source/RecastRasterization.cpp
Recast/Source/RecastRegion.cpp
Recast/Source/RecastTimer.cpp
-
+
Recast/Include/Recast.h
Recast/Include/RecastLog.h
- Recast/Include/RecastTimer.h
+ Recast/Include/RecastTimer.h
)
blender_add_lib(extern_recastnavigation "${SRC}" "${INC}" "${INC_SYS}")
Added: trunk/blender/extern/recastnavigation/recast-capi.cpp
===================================================================
--- trunk/blender/extern/recastnavigation/recast-capi.cpp (rev 0)
+++ trunk/blender/extern/recastnavigation/recast-capi.cpp 2011-09-20 16:24:50 UTC (rev 40404)
@@ -0,0 +1,37 @@
+/*
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2011 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Sergey Sharybin
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "recast-capi.h"
+
+#include <math.h>
+#include "Recast.h"
+
+int recast_buildMeshAdjacency(unsigned short* polys, const int npolys,
+ const int nverts, const int vertsPerPoly)
+{
+ return (int) buildMeshAdjacency(polys, npolys, nverts, vertsPerPoly);
+}
Added: trunk/blender/extern/recastnavigation/recast-capi.h
===================================================================
--- trunk/blender/extern/recastnavigation/recast-capi.h (rev 0)
+++ trunk/blender/extern/recastnavigation/recast-capi.h 2011-09-20 16:24:50 UTC (rev 40404)
@@ -0,0 +1,42 @@
+/*
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2011 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Sergey Sharybin
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef RECAST_C_API_H
+#define RECAST_C_API_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int recast_buildMeshAdjacency(unsigned short* polys, const int npolys,
+ const int nverts, const int vertsPerPoly);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // RECAST_C_API_H
Modified: trunk/blender/source/blender/blenkernel/BKE_navmesh_conversion.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_navmesh_conversion.h 2011-09-20 15:55:28 UTC (rev 40403)
+++ trunk/blender/source/blender/blenkernel/BKE_navmesh_conversion.h 2011-09-20 16:24:50 UTC (rev 40404)
@@ -32,32 +32,32 @@
struct DerivedMesh;
-/* navmesh_conversion.cpp */
-bool buildNavMeshDataByDerivedMesh(DerivedMesh *dm, int& vertsPerPoly,
- int &nverts, float *&verts,
- int &ndtris, unsigned short *&dtris,
- int& npolys, unsigned short *&dmeshes,
- unsigned short*& polys, int *&dtrisToPolysMap,
- int *&dtrisToTrisMap, int *&trisToFacesMap);
+/* navmesh_conversion.c */
+int buildNavMeshDataByDerivedMesh(struct DerivedMesh *dm, int *vertsPerPoly,
+ int *nverts, float **verts,
+ int *ndtris, unsigned short **dtris,
+ int *npolys, unsigned short **dmeshes,
+ unsigned short **polys, int **dtrisToPolysMap,
+ int **dtrisToTrisMap, int **trisToFacesMap);
-bool buildRawVertIndicesData(DerivedMesh* dm, int &nverts, float *&verts,
- int &ntris, unsigned short *&tris, int *&trisToFacesMap,
- int *&recastData);
+int buildRawVertIndicesData(struct DerivedMesh* dm, int *nverts, float **verts,
+ int *ntris, unsigned short **tris, int **trisToFacesMap,
+ int **recastData);
-bool buildNavMeshData(const int nverts, const float* verts,
- const int ntris, const unsigned short *tris,
+int buildNavMeshData(const int nverts, const float* verts,
+ const int ntris, const unsigned short *tris,
const int* recastData, const int* trisToFacesMap,
- int &ndtris, unsigned short *&dtris,
- int &npolys, unsigned short *&dmeshes, unsigned short *&polys,
- int &vertsPerPoly, int *&dtrisToPolysMap, int *&dtrisToTrisMap);
+ int *ndtris, unsigned short **dtris,
+ int *npolys, unsigned short **dmeshes, unsigned short **polys,
+ int *vertsPerPoly, int **dtrisToPolysMap, int **dtrisToTrisMap);
-bool buildPolygonsByDetailedMeshes(const int vertsPerPoly, const int npolys,
- unsigned short* polys, const unsigned short* dmeshes,
- const float* verts, const unsigned short* dtris,
+int buildPolygonsByDetailedMeshes(const int vertsPerPoly, const int npolys,
+ unsigned short* polys, const unsigned short* dmeshes,
+ const float* verts, const unsigned short* dtris,
const int* dtrisToPolysMap);
int polyNumVerts(const unsigned short* p, const int vertsPerPoly);
-bool polyIsConvex(const unsigned short* p, const int vertsPerPoly, const float* verts);
+int polyIsConvex(const unsigned short* p, const int vertsPerPoly, const float* verts);
int polyFindVertex(const unsigned short* p, const int vertsPerPoly, unsigned short vertexIdx);
float distPointToSegmentSq(const float* point, const float* a, const float* b);
Modified: trunk/blender/source/blender/blenkernel/CMakeLists.txt
===================================================================
--- trunk/blender/source/blender/blenkernel/CMakeLists.txt 2011-09-20 15:55:28 UTC (rev 40403)
+++ trunk/blender/source/blender/blenkernel/CMakeLists.txt 2011-09-20 16:24:50 UTC (rev 40404)
@@ -353,10 +353,10 @@
if(WITH_GAMEENGINE)
list(APPEND INC_SYS
- ../../../extern/recastnavigation/Recast/Include
+ ../../../extern/recastnavigation
)
list(APPEND SRC
- intern/navmesh_conversion.cpp
+ intern/navmesh_conversion.c
BKE_navmesh_conversion.h
)
endif()
Modified: trunk/blender/source/blender/blenkernel/SConscript
===================================================================
--- trunk/blender/source/blender/blenkernel/SConscript 2011-09-20 15:55:28 UTC (rev 40403)
+++ trunk/blender/source/blender/blenkernel/SConscript 2011-09-20 16:24:50 UTC (rev 40404)
@@ -2,7 +2,7 @@
Import ('env')
import os
-sources = env.Glob('intern/*.c') + env.Glob('intern/*.cpp')
+sources = env.Glob('intern/*.c')
incs = '. #/intern/guardedalloc #/intern/memutil'
incs += ' ../blenlib ../blenfont ../makesdna ../windowmanager'
@@ -92,10 +92,10 @@
defs.append('WITH_LZMA')
if env['WITH_BF_GAMEENGINE']:
- incs += ' #/extern/recastnavigation/Recast/Include'
+ incs += ' #/extern/recastnavigation'
defs.append('WITH_GAMEENGINE')
else:
- sources.remove('intern' + os.sep + 'navmesh_conversion.cpp')
+ sources.remove('intern' + os.sep + 'navmesh_conversion.c')
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
incs += ' ' + env['BF_PTHREADS_INC']
Copied: trunk/blender/source/blender/blenkernel/intern/navmesh_conversion.c (from rev 40403, trunk/blender/source/blender/blenkernel/intern/navmesh_conversion.cpp)
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/navmesh_conversion.c (rev 0)
+++ trunk/blender/source/blender/blenkernel/intern/navmesh_conversion.c 2011-09-20 16:24:50 UTC (rev 40404)
@@ -0,0 +1,508 @@
+/**
+* $Id$
+*
+* ***** BEGIN GPL LICENSE BLOCK *****
+*
+* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*
+* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+* All rights reserved.
+*
+* The Original Code is: all of this file.
+*
+* Contributor(s): none yet.
+*
+* ***** END GPL LICENSE BLOCK *****
+*/
+
+#include <math.h>
+#include <stdlib.h>
+
+#include "MEM_guardedalloc.h"
+
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list