[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31681] branches/soc-2010-nicks: Add CMake build system on Recast&Navigation branch

Benoit Bolsee benoit.bolsee at online.be
Wed Sep 1 00:08:01 CEST 2010


Revision: 31681
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31681
Author:   ben2610
Date:     2010-09-01 00:08:01 +0200 (Wed, 01 Sep 2010)

Log Message:
-----------
Add CMake build system on Recast&Navigation branch

Modified Paths:
--------------
    branches/soc-2010-nicks/extern/CMakeLists.txt
    branches/soc-2010-nicks/source/blender/editors/object/CMakeLists.txt
    branches/soc-2010-nicks/source/blender/editors/object/object_navmesh.cpp
    branches/soc-2010-nicks/source/blender/editors/util/CMakeLists.txt
    branches/soc-2010-nicks/source/blender/modifiers/CMakeLists.txt
    branches/soc-2010-nicks/source/creator/CMakeLists.txt
    branches/soc-2010-nicks/source/gameengine/Converter/CMakeLists.txt
    branches/soc-2010-nicks/source/gameengine/Ketsji/CMakeLists.txt

Added Paths:
-----------
    branches/soc-2010-nicks/extern/recastnavigation/CMakeLists.txt

Property Changed:
----------------
    branches/soc-2010-nicks/source/blender/editors/object/object_navmesh.cpp

Modified: branches/soc-2010-nicks/extern/CMakeLists.txt
===================================================================
--- branches/soc-2010-nicks/extern/CMakeLists.txt	2010-08-31 21:40:11 UTC (rev 31680)
+++ branches/soc-2010-nicks/extern/CMakeLists.txt	2010-08-31 22:08:01 UTC (rev 31681)
@@ -33,6 +33,7 @@
 ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
 
 ADD_SUBDIRECTORY(glew)
+ADD_SUBDIRECTORY(recastnavigation)
 
 IF(WITH_IMAGE_OPENJPEG)
 	ADD_SUBDIRECTORY(libopenjpeg)

Added: branches/soc-2010-nicks/extern/recastnavigation/CMakeLists.txt
===================================================================
--- branches/soc-2010-nicks/extern/recastnavigation/CMakeLists.txt	                        (rev 0)
+++ branches/soc-2010-nicks/extern/recastnavigation/CMakeLists.txt	2010-08-31 22:08:01 UTC (rev 31681)
@@ -0,0 +1,32 @@
+# $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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+# The Original Code is Copyright (C) 2006, Blender Foundation
+# All rights reserved.
+#
+# The Original Code is: all of this file.
+#
+# Contributor(s): Daniel Genrich
+#
+# ***** END GPL LICENSE BLOCK *****
+
+SET(INC Recast/Include Detour/Include)
+
+FILE(GLOB SRC Recast/Source/*.cpp Detour/Source/*.cpp)
+
+BLENDERLIB(extern_recastnavigation "${SRC}" "${INC}")
+#, libtype='blender', priority = 0 )


Property changes on: branches/soc-2010-nicks/extern/recastnavigation/CMakeLists.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: branches/soc-2010-nicks/source/blender/editors/object/CMakeLists.txt
===================================================================
--- branches/soc-2010-nicks/source/blender/editors/object/CMakeLists.txt	2010-08-31 21:40:11 UTC (rev 31680)
+++ branches/soc-2010-nicks/source/blender/editors/object/CMakeLists.txt	2010-08-31 22:08:01 UTC (rev 31681)
@@ -19,7 +19,7 @@
 #
 # ***** END GPL LICENSE BLOCK *****
 
-FILE(GLOB SRC *.c)
+FILE(GLOB SRC *.c *.cpp)
 
 SET(INC
 	../include
@@ -34,6 +34,7 @@
 	../../windowmanager
 	../../render/extern/include
 	../../../../intern/guardedalloc
+	../../../../extern/recastnavigation/Recast/Include
 )
 
 IF(NOT WITH_PYTHON)

Modified: branches/soc-2010-nicks/source/blender/editors/object/object_navmesh.cpp
===================================================================
--- branches/soc-2010-nicks/source/blender/editors/object/object_navmesh.cpp	2010-08-31 21:40:11 UTC (rev 31680)
+++ branches/soc-2010-nicks/source/blender/editors/object/object_navmesh.cpp	2010-08-31 22:08:01 UTC (rev 31681)
@@ -1,371 +1,371 @@
-/**
-* $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) 2004 by Blender Foundation
-* All rights reserved.
-*
-* The Original Code is: all of this file.
-*
-* Contributor(s): none yet.
-*
-* ***** END GPL LICENSE BLOCK *****
-*/
-#include <math.h>
-#include "Recast.h"
-
-extern "C"
-{
-#include "MEM_guardedalloc.h"
-
-#include "DNA_scene_types.h"
-#include "DNA_object_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_modifier_types.h"
-#include "DNA_ID.h"
-
-#include "BKE_library.h"
-#include "BKE_depsgraph.h"
-#include "BKE_context.h"
-#include "BKE_mesh.h"
-#include "BKE_modifier.h"
-#include "BKE_scene.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_cdderivedmesh.h"
-#include "BLI_editVert.h"
-#include "BLI_listbase.h"
-#include "ED_object.h"
-#include "BLI_math_vector.h"
-
-#include "RNA_access.h"
-
-#include "ED_mesh.h"
-
-/*mesh/mesh_intern.h */
-extern struct EditVert *addvertlist(EditMesh *em, float *vec, struct EditVert *example);
-extern struct EditFace *addfacelist(EditMesh *em, struct EditVert *v1, struct EditVert *v2, struct EditVert *v3, struct EditVert *v4, struct EditFace *example, struct EditFace *exampleEdges);
-extern void free_vertlist(EditMesh *em, ListBase *edve);
-extern void free_edgelist(EditMesh *em, ListBase *lb);
-extern void free_facelist(EditMesh *em, ListBase *lb);
-
-#include "WM_api.h"
-#include "WM_types.h"
-
-static void createVertsTrisData(bContext *C, LinkNode* obs, int& nverts, float*& verts, int &ntris, int*& tris)
-{
-	MVert *mvert;
-	int nfaces = 0, *tri, i, curnverts, basenverts, curnfaces;
-	MFace *mface;
-	float co[3], wco[3];
-	Object *ob;
-	LinkNode *oblink, *dmlink;
-	DerivedMesh *dm;
-	Scene* scene = CTX_data_scene(C);
-	LinkNode* dms = NULL;
-
-	nverts = 0;
-	ntris = 0;
-	//calculate number of verts and tris
-	for (oblink = obs; oblink; oblink = oblink->next) 
-	{
-		ob = (Object*) oblink->link;	
-		DerivedMesh *dm = mesh_create_derived_no_virtual(scene, ob, NULL, CD_MASK_MESH);
-		BLI_linklist_append(&dms, (void*)dm);
-
-		nverts += dm->getNumVerts(dm);
-		nfaces = dm->getNumFaces(dm);
-		ntris += nfaces;
-
-		//resolve quad faces
-		mface = dm->getFaceArray(dm);
-		for (i=0; i<nfaces; i++)
-		{
-			MFace* mf = &mface[i];
-			if (mf->v4)
-				ntris+=1;
-		}
-	}
-
-	//create data
-	verts = (float*) MEM_mallocN(sizeof(float)*3*nverts, "verts");
-	tris = (int*) MEM_mallocN(sizeof(int)*3*ntris, "faces");
-
-	basenverts = 0;
-	tri = tris;
-	for (oblink = obs, dmlink = dms; oblink && dmlink; 
-			oblink = oblink->next, dmlink = dmlink->next)
-	{
-		ob = (Object*) oblink->link;
-		dm = (DerivedMesh*) dmlink->link;
-
-		curnverts = dm->getNumVerts(dm);
-		mvert = dm->getVertArray(dm);
-		//copy verts	
-		for (i=0; i<curnverts; i++)
-		{
-			MVert *v = &mvert[i];
-			copy_v3_v3(co, v->co);
-			mul_v3_m4v3(wco, ob->obmat, co);
-			verts[3*(basenverts+i)+0] = wco[0];
-			verts[3*(basenverts+i)+1] = wco[2];
-			verts[3*(basenverts+i)+2] = wco[1];
-		}
-
-		//create tris
-		curnfaces = dm->getNumFaces(dm);
-		mface = dm->getFaceArray(dm);
-		for (i=0; i<curnfaces; i++)
-		{
-			MFace* mf = &mface[i]; 
-			tri[0]= basenverts + mf->v1; tri[1]= basenverts + mf->v3;	tri[2]= basenverts + mf->v2; 
-			tri += 3;
-			if (mf->v4)
-			{
-				tri[0]= basenverts + mf->v1; tri[1]= basenverts + mf->v4; tri[2]= basenverts + mf->v3; 
-				tri += 3;
-			}
-		}
-		basenverts += curnverts;
-	}
-
-	//release derived mesh
-	for (dmlink = dms; dmlink; dmlink = dmlink->next)
-	{
-		dm = (DerivedMesh*) dmlink->link;
-		dm->release(dm);
-	}
-	BLI_linklist_free(dms, NULL);
-}
-
-static bool buildNavMesh(const RecastData& recastParams, int nverts, float* verts, int ntris, int* tris,
-								 rcPolyMesh*& pmesh, rcPolyMeshDetail*& dmesh)
-{
-	float bmin[3], bmax[3];
-	rcHeightfield* solid;
-	unsigned char *triflags;
-	rcCompactHeightfield* chf;
-	rcContourSet *cset;
-
-	rcCalcBounds(verts, nverts, bmin, bmax);
-
-	//
-	// Step 1. Initialize build config.
-	//
-	rcConfig cfg;
-	memset(&cfg, 0, sizeof(cfg));
-	{
-/*
-		float cellsize = 0.3f;
-		float cellheight = 0.2f;
-		float agentmaxslope = M_PI/4;
-		float agentmaxclimb = 0.9f;
-		float agentheight = 2.0f;
-		float agentradius = 0.6f;
-		float edgemaxlen = 12.0f;
-		float edgemaxerror = 1.3f;
-		float regionminsize = 50.f;
-		float regionmergesize = 20.f;
-		int vertsperpoly = 6;
-		float detailsampledist = 6.0f;
-		float detailsamplemaxerror = 1.0f;
-		cfg.cs = cellsize;
-		cfg.ch = cellheight;
-		cfg.walkableSlopeAngle = agentmaxslope/M_PI*180.f;
-		cfg.walkableHeight = (int)ceilf(agentheight/ cfg.ch);
-		cfg.walkableClimb = (int)floorf(agentmaxclimb / cfg.ch);
-		cfg.walkableRadius = (int)ceilf(agentradius / cfg.cs);
-		cfg.maxEdgeLen = (int)(edgemaxlen/cellsize);
-		cfg.maxSimplificationError = edgemaxerror;
-		cfg.minRegionSize = (int)rcSqr(regionminsize);
-		cfg.mergeRegionSize = (int)rcSqr(regionmergesize);
-		cfg.maxVertsPerPoly = vertsperpoly;
-		cfg.detailSampleDist = detailsampledist< 0.9f ? 0 : cellsize * detailsampledist;
-		cfg.detailSampleMaxError = cellheight * detailsamplemaxerror;
-*/
-		cfg.cs = recastParams.cellsize;
-		cfg.ch = recastParams.cellheight;
-		cfg.walkableSlopeAngle = recastParams.agentmaxslope/((float)M_PI)*180.f;
-		cfg.walkableHeight = (int)ceilf(recastParams.agentheight/ cfg.ch);
-		cfg.walkableClimb = (int)floorf(recastParams.agentmaxclimb / cfg.ch);
-		cfg.walkableRadius = (int)ceilf(recastParams.agentradius / cfg.cs);
-		cfg.maxEdgeLen = (int)(recastParams.edgemaxlen/recastParams.cellsize);
-		cfg.maxSimplificationError = recastParams.edgemaxerror;
-		cfg.minRegionSize = (int)rcSqr(recastParams.regionminsize);
-		cfg.mergeRegionSize = (int)rcSqr(recastParams.regionmergesize);
-		cfg.maxVertsPerPoly = recastParams.vertsperpoly;
-		cfg.detailSampleDist = recastParams.detailsampledist< 0.9f ? 0 : 
-								recastParams.cellsize * recastParams.detailsampledist;
-		cfg.detailSampleMaxError = recastParams.cellheight * recastParams.detailsamplemaxerror;
-
-	}
-
-	// Set the area where the navigation will be build.
-	vcopy(cfg.bmin, bmin);
-	vcopy(cfg.bmax, bmax);
-	rcCalcGridSize(cfg.bmin, cfg.bmax, cfg.cs, &cfg.width, &cfg.height);
-
-	//
-	// Step 2. Rasterize input polygon soup.
-	//
-	// Allocate voxel heightfield where we rasterize our input data to.
-	solid = new rcHeightfield;
-	if (!solid)
-		return false;
-
-	if (!rcCreateHeightfield(*solid, cfg.width, cfg.height, cfg.bmin, cfg.bmax, cfg.cs, cfg.ch))
-		return false;
-
-	// Allocate array that can hold triangle flags.

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list