[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40080] trunk/blender: BGE: merge Recast & Detour branch (sock-2010-nicks).

Benoit Bolsee benoit.bolsee at online.be
Fri Sep 9 23:28:57 CEST 2011


Revision: 40080
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40080
Author:   ben2610
Date:     2011-09-09 21:28:56 +0000 (Fri, 09 Sep 2011)
Log Message:
-----------
BGE: merge Recast & Detour branch (sock-2010-nicks).

Add navigation mesh capability to the BGE, both by logic bricks and python.
Add tools to creation navigation mesh in the creator:
- manualy
- automatically from existing mesh with "object.create_navmesh" operator
- automatically from existing mesh with "Navigation mesh" modifier
Editing navigation mesh is possible via special modifier edit mode.
Creation and modification of Navigation mesh is also possible at runtime in the BGE.

Documentation at http://wiki.blender.org/index.php/User:Nicks/Gsoc2010/Docs

Warning: No upgrade is provided for blend files created under the branch.
         If you load a blend with navigation data created with a branch
         build, it will likely crash blender or behave incorrectly.

Modified Paths:
--------------
    trunk/blender/extern/CMakeLists.txt
    trunk/blender/extern/SConscript
    trunk/blender/release/scripts/startup/bl_ui/properties_data_modifier.py
    trunk/blender/release/scripts/startup/bl_ui/properties_game.py
    trunk/blender/release/scripts/startup/bl_ui/properties_scene.py
    trunk/blender/source/blender/blenkernel/intern/customdata.c
    trunk/blender/source/blender/blenkernel/intern/object.c
    trunk/blender/source/blender/blenkernel/intern/sca.c
    trunk/blender/source/blender/blenkernel/intern/scene.c
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/blenloader/intern/writefile.c
    trunk/blender/source/blender/editors/object/CMakeLists.txt
    trunk/blender/source/blender/editors/object/SConscript
    trunk/blender/source/blender/editors/object/object_intern.h
    trunk/blender/source/blender/editors/object/object_ops.c
    trunk/blender/source/blender/editors/space_logic/logic_window.c
    trunk/blender/source/blender/editors/util/CMakeLists.txt
    trunk/blender/source/blender/editors/util/SConscript
    trunk/blender/source/blender/makesdna/DNA_actuator_types.h
    trunk/blender/source/blender/makesdna/DNA_customdata_types.h
    trunk/blender/source/blender/makesdna/DNA_meshdata_types.h
    trunk/blender/source/blender/makesdna/DNA_modifier_types.h
    trunk/blender/source/blender/makesdna/DNA_object_types.h
    trunk/blender/source/blender/makesdna/DNA_scene_types.h
    trunk/blender/source/blender/makesrna/intern/rna_actuator.c
    trunk/blender/source/blender/makesrna/intern/rna_modifier.c
    trunk/blender/source/blender/makesrna/intern/rna_object.c
    trunk/blender/source/blender/makesrna/intern/rna_scene.c
    trunk/blender/source/blender/modifiers/CMakeLists.txt
    trunk/blender/source/blender/modifiers/MOD_modifiertypes.h
    trunk/blender/source/blender/modifiers/SConscript
    trunk/blender/source/blender/modifiers/intern/MOD_util.c
    trunk/blender/source/creator/CMakeLists.txt
    trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp
    trunk/blender/source/gameengine/Converter/CMakeLists.txt
    trunk/blender/source/gameengine/Converter/KX_ConvertActuators.cpp
    trunk/blender/source/gameengine/Converter/SConscript
    trunk/blender/source/gameengine/GameLogic/SCA_IActuator.h
    trunk/blender/source/gameengine/Ketsji/CMakeLists.txt
    trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp
    trunk/blender/source/gameengine/Ketsji/KX_GameObject.h
    trunk/blender/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
    trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp
    trunk/blender/source/gameengine/Ketsji/KX_PythonInit.h
    trunk/blender/source/gameengine/Ketsji/KX_PythonInitTypes.cpp
    trunk/blender/source/gameengine/Ketsji/KX_Scene.cpp
    trunk/blender/source/gameengine/Ketsji/KX_Scene.h
    trunk/blender/source/gameengine/Ketsji/SConscript
    trunk/blender/source/gameengine/Rasterizer/RAS_IRasterizer.h
    trunk/blender/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
    trunk/blender/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h

Added Paths:
-----------
    trunk/blender/extern/recastnavigation/
    trunk/blender/extern/recastnavigation/CMakeLists.txt
    trunk/blender/extern/recastnavigation/Detour/
    trunk/blender/extern/recastnavigation/Detour/Include/
    trunk/blender/extern/recastnavigation/Detour/Include/DetourCommon.h
    trunk/blender/extern/recastnavigation/Detour/Include/DetourNode.h
    trunk/blender/extern/recastnavigation/Detour/Include/DetourStatNavMesh.h
    trunk/blender/extern/recastnavigation/Detour/Include/DetourStatNavMeshBuilder.h
    trunk/blender/extern/recastnavigation/Detour/Include/DetourTileNavMesh.h
    trunk/blender/extern/recastnavigation/Detour/Include/DetourTileNavMeshBuilder.h
    trunk/blender/extern/recastnavigation/Detour/Source/
    trunk/blender/extern/recastnavigation/Detour/Source/DetourCommon.cpp
    trunk/blender/extern/recastnavigation/Detour/Source/DetourNode.cpp
    trunk/blender/extern/recastnavigation/Detour/Source/DetourStatNavMesh.cpp
    trunk/blender/extern/recastnavigation/Detour/Source/DetourStatNavMeshBuilder.cpp
    trunk/blender/extern/recastnavigation/Detour/Source/DetourTileNavMesh.cpp
    trunk/blender/extern/recastnavigation/Detour/Source/DetourTileNavMeshBuilder.cpp
    trunk/blender/extern/recastnavigation/License.txt
    trunk/blender/extern/recastnavigation/Readme.txt
    trunk/blender/extern/recastnavigation/Recast/
    trunk/blender/extern/recastnavigation/Recast/Include/
    trunk/blender/extern/recastnavigation/Recast/Include/Recast.h
    trunk/blender/extern/recastnavigation/Recast/Include/RecastLog.h
    trunk/blender/extern/recastnavigation/Recast/Include/RecastTimer.h
    trunk/blender/extern/recastnavigation/Recast/Source/
    trunk/blender/extern/recastnavigation/Recast/Source/Recast.cpp
    trunk/blender/extern/recastnavigation/Recast/Source/RecastContour.cpp
    trunk/blender/extern/recastnavigation/Recast/Source/RecastFilter.cpp
    trunk/blender/extern/recastnavigation/Recast/Source/RecastLog.cpp
    trunk/blender/extern/recastnavigation/Recast/Source/RecastMesh.cpp
    trunk/blender/extern/recastnavigation/Recast/Source/RecastMeshDetail.cpp
    trunk/blender/extern/recastnavigation/Recast/Source/RecastRasterization.cpp
    trunk/blender/extern/recastnavigation/Recast/Source/RecastRegion.cpp
    trunk/blender/extern/recastnavigation/Recast/Source/RecastTimer.cpp
    trunk/blender/extern/recastnavigation/SConscript
    trunk/blender/source/blender/editors/include/ED_navmesh_conversion.h
    trunk/blender/source/blender/editors/object/object_navmesh.cpp
    trunk/blender/source/blender/editors/util/navmesh_conversion.cpp
    trunk/blender/source/blender/modifiers/intern/MOD_navmesh.cpp
    trunk/blender/source/gameengine/Ketsji/KX_NavMeshObject.cpp
    trunk/blender/source/gameengine/Ketsji/KX_NavMeshObject.h
    trunk/blender/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp
    trunk/blender/source/gameengine/Ketsji/KX_ObstacleSimulation.h
    trunk/blender/source/gameengine/Ketsji/KX_SteeringActuator.cpp
    trunk/blender/source/gameengine/Ketsji/KX_SteeringActuator.h

Modified: trunk/blender/extern/CMakeLists.txt
===================================================================
--- trunk/blender/extern/CMakeLists.txt	2011-09-09 19:30:33 UTC (rev 40079)
+++ trunk/blender/extern/CMakeLists.txt	2011-09-09 21:28:56 UTC (rev 40080)
@@ -42,6 +42,7 @@
 if(WITH_BUILTIN_GLEW)
 	add_subdirectory(glew)
 endif()
+add_subdirectory(recastnavigation)
 
 if(WITH_IMAGE_OPENJPEG AND (NOT UNIX OR APPLE))
 	add_subdirectory(libopenjpeg)

Modified: trunk/blender/extern/SConscript
===================================================================
--- trunk/blender/extern/SConscript	2011-09-09 19:30:33 UTC (rev 40079)
+++ trunk/blender/extern/SConscript	2011-09-09 21:28:56 UTC (rev 40080)
@@ -3,6 +3,7 @@
 Import('env')
 
 SConscript(['glew/SConscript'])
+SConscript(['recastnavigation/SConscript'])
 
 if env['WITH_BF_ELTOPO']:
     SConscript(['eltopo/SConscript'])

Added: trunk/blender/extern/recastnavigation/CMakeLists.txt
===================================================================
--- trunk/blender/extern/recastnavigation/CMakeLists.txt	                        (rev 0)
+++ trunk/blender/extern/recastnavigation/CMakeLists.txt	2011-09-09 21:28:56 UTC (rev 40080)
@@ -0,0 +1,66 @@
+# $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
+)
+
+set(INC_SYS
+
+)
+
+set(SRC 
+		Detour/Source/DetourCommon.cpp
+		Detour/Source/DetourNode.cpp
+		Detour/Source/DetourStatNavMesh.cpp
+		Detour/Source/DetourStatNavMeshBuilder.cpp
+		Detour/Source/DetourTileNavMesh.cpp
+		Detour/Source/DetourTileNavMeshBuilder.cpp
+
+		Detour/Include/DetourCommon.h
+		Detour/Include/DetourNode.h
+		Detour/Include/DetourStatNavMesh.h
+		Detour/Include/DetourStatNavMeshBuilder.h
+		Detour/Include/DetourTileNavMesh.h
+		Detour/Include/DetourTileNavMeshBuilder.h
+			
+		Recast/Source/Recast.cpp
+		Recast/Source/RecastContour.cpp
+		Recast/Source/RecastFilter.cpp
+		Recast/Source/RecastLog.cpp
+		Recast/Source/RecastMesh.cpp
+		Recast/Source/RecastMeshDetail.cpp
+		Recast/Source/RecastRasterization.cpp
+		Recast/Source/RecastRegion.cpp
+		Recast/Source/RecastTimer.cpp
+		
+		Recast/Include/Recast.h
+		Recast/Include/RecastLog.h
+		Recast/Include/RecastTimer.h	
+)
+
+blender_add_lib(extern_recastnavigation "${SRC}" "${INC}" "${INC_SYS}")
\ No newline at end of file


Property changes on: trunk/blender/extern/recastnavigation/CMakeLists.txt
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Added: trunk/blender/extern/recastnavigation/Detour/Include/DetourCommon.h
===================================================================
--- trunk/blender/extern/recastnavigation/Detour/Include/DetourCommon.h	                        (rev 0)
+++ trunk/blender/extern/recastnavigation/Detour/Include/DetourCommon.h	2011-09-09 21:28:56 UTC (rev 40080)
@@ -0,0 +1,167 @@
+//
+// Copyright (c) 2009 Mikko Mononen memon at 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 swap(T& a, T& b) { T t = a; a = b; b = t; }
+template<class T> inline T min(T a, T b) { return a < b ? a : b; }
+template<class T> inline T max(T a, T b) { return a > b ? a : b; }
+template<class T> inline T abs(T a) { return a < 0 ? -a : a; }
+template<class T> inline T sqr(T a) { return a*a; }
+template<class T> inline T clamp(T v, T mn, T mx) { return v < mn ? mn : (v > mx ? mx : v); }
+
+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 float vdot(const float* v1, const float* v2)
+{
+	return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2];
+}
+
+inline void vmad(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 vadd(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 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 void vmin(float* mn, const float* v)
+{
+	mn[0] = min(mn[0], v[0]);
+	mn[1] = min(mn[1], v[1]);
+	mn[2] = min(mn[2], v[2]);
+}
+
+inline void vmax(float* mx, const float* v)
+{
+	mx[0] = max(mx[0], v[0]);
+	mx[1] = max(mx[1], v[1]);
+	mx[2] = max(mx[2], v[2]);
+}
+
+inline void vcopy(float* dest, const float* a)
+{
+	dest[0] = a[0];
+	dest[1] = a[1];
+	dest[2] = a[2];
+}
+
+inline float vdist(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 sqrtf(dx*dx + dy*dy + dz*dz);
+}
+
+inline float vdistSqr(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 vnormalize(float* v)
+{
+	float d = 1.0f / sqrtf(sqr(v[0]) + sqr(v[1]) + sqr(v[2]));
+	v[0] *= d;
+	v[1] *= d;
+	v[2] *= d;
+}
+
+inline bool vequal(const float* p0, const float* p1)
+{
+	static const float thr = sqr(1.0f/16384.0f);
+	const float d = vdistSqr(p0, p1);
+	return d < thr;
+}
+
+inline int nextPow2(int v)
+{
+	v--;
+	v |= v >> 1;
+	v |= v >> 2;
+	v |= v >> 4;
+	v |= v >> 8;
+	v |= v >> 16;
+	v++;
+	return v;
+}
+
+inline float vdot2D(const float* u, const float* v)
+{
+	return u[0]*v[0] + u[2]*v[2];
+}
+
+inline float vperp2D(const float* u, const float* v)
+{
+	return u[2]*v[0] - u[0]*v[2];
+}
+
+inline float triArea2D(const float* a, const float* b, const float* c)
+{
+	return ((b[0]*a[2] - a[0]*b[2]) + (c[0]*b[2] - b[0]*c[2]) + (a[0]*c[2] - c[0]*a[2])) * 0.5f;
+}
+
+inline bool checkOverlapBox(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;
+}
+
+void closestPtPointTriangle(float* closest, const float* p,
+							const float* a, const float* b, const float* c);
+
+bool closestHeightPointTriangle(const float* p, const float* a, const float* b, const float* c, float& h);
+
+bool intersectSegmentPoly2D(const float* p0, const float* p1,
+							const float* verts, int nverts,
+							float& tmin, float& tmax,
+							int& segMin, int& segMax);
+
+float distancePtSegSqr2D(const float* pt, const float* p, const float* q, float& t);
+
+void calcPolyCenter(float* tc, const unsigned short* idx, int nidx, const float* verts);
+
+#endif // DETOURCOMMON_H
\ No newline at end of file


Property changes on: trunk/blender/extern/recastnavigation/Detour/Include/DetourCommon.h
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Added: trunk/blender/extern/recastnavigation/Detour/Include/DetourNode.h
===================================================================
--- trunk/blender/extern/recastnavigation/Detour/Include/DetourNode.h	                        (rev 0)
+++ trunk/blender/extern/recastnavigation/Detour/Include/DetourNode.h	2011-09-09 21:28:56 UTC (rev 40080)
@@ -0,0 +1,149 @@
+//
+// Copyright (c) 2009 Mikko Mononen memon at 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
+
+enum dtNodeFlags
+{
+	DT_NODE_OPEN = 0x01,
+	DT_NODE_CLOSED = 0x02,
+};
+
+struct dtNode
+{
+	float cost;
+	float total;
+	unsigned int id;
+	unsigned int pidx : 30;
+	unsigned int flags : 2;
+};
+
+class dtNodePool
+{

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list