[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40701] trunk/blender: Recast: upgrade library.

Benoit Bolsee benoit.bolsee at online.be
Thu Sep 29 23:38:58 CEST 2011


Revision: 40701
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40701
Author:   ben2610
Date:     2011-09-29 21:38:57 +0000 (Thu, 29 Sep 2011)
Log Message:
-----------
Recast: upgrade library.

- Upgrade Recast library to latest portable version
- Implement recast_qsort based on FreeBSD qsort.c to have 
  portable thread safe quick sort for use in conversion routine.
- Better default value for the Build Navigation Mesh operator

Modified Paths:
--------------
    trunk/blender/extern/recastnavigation/CMakeLists.txt
    trunk/blender/extern/recastnavigation/Recast/Include/Recast.h
    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/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-capi.cpp
    trunk/blender/extern/recastnavigation/recast-capi.h
    trunk/blender/source/blender/blenkernel/intern/navmesh_conversion.c
    trunk/blender/source/blender/blenkernel/intern/scene.c
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/editors/mesh/mesh_navmesh.c
    trunk/blender/source/gameengine/Ketsji/KX_NavMeshObject.cpp
    trunk/blender/source/gameengine/Ketsji/KX_SteeringActuator.cpp

Added Paths:
-----------
    trunk/blender/extern/recastnavigation/Recast/Include/RecastAlloc.h
    trunk/blender/extern/recastnavigation/Recast/Include/RecastAssert.h
    trunk/blender/extern/recastnavigation/Recast/Source/RecastAlloc.cpp
    trunk/blender/extern/recastnavigation/Recast/Source/RecastArea.cpp
    trunk/blender/extern/recastnavigation/Recast/Source/RecastLayers.cpp

Modified: trunk/blender/extern/recastnavigation/CMakeLists.txt
===================================================================
--- trunk/blender/extern/recastnavigation/CMakeLists.txt	2011-09-29 20:28:46 UTC (rev 40700)
+++ trunk/blender/extern/recastnavigation/CMakeLists.txt	2011-09-29 21:38:57 UTC (rev 40701)
@@ -53,18 +53,19 @@
 		Detour/Include/DetourTileNavMeshBuilder.h
 
 		Recast/Source/Recast.cpp
-		Recast/Source/RecastContour.cpp
+		Recast/Source/RecastAlloc.cpp
+		Recast/Source/RecastArea.cpp
+        Recast/Source/RecastContour.cpp
 		Recast/Source/RecastFilter.cpp
-		Recast/Source/RecastLog.cpp
+		Recast/Source/RecastLayers.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
+		Recast/Include/RecastAlloc.h
+		Recast/Include/RecastAssert.h	
 )
 
 blender_add_lib(extern_recastnavigation "${SRC}" "${INC}" "${INC_SYS}")

Modified: trunk/blender/extern/recastnavigation/Recast/Include/Recast.h
===================================================================
--- trunk/blender/extern/recastnavigation/Recast/Include/Recast.h	2011-09-29 20:28:46 UTC (rev 40700)
+++ trunk/blender/extern/recastnavigation/Recast/Include/Recast.h	2011-09-29 21:38:57 UTC (rev 40701)
@@ -1,5 +1,5 @@
 //
-// Copyright (c) 2009 Mikko Mononen memon at inside.org
+// Copyright (c) 2009-2010 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
@@ -19,298 +19,685 @@
 #ifndef RECAST_H
 #define RECAST_H
 
-// The units of the parameters are specified in parenthesis as follows:
-// (vx) voxels, (wu) world units
+/// The value of PI used by Recast.
+static const float RC_PI = 3.14159265f;
+
+/// Recast log categories.
+/// @see rcContext
+enum rcLogCategory
+{
+	RC_LOG_PROGRESS = 1,	///< A progress log entry.
+	RC_LOG_WARNING,	 	    ///< A warning log entry.
+	RC_LOG_ERROR,	   	    ///< An error log entry.
+};
+
+/// Recast performance timer categories.
+/// @see rcContext
+enum rcTimerLabel
+{
+	/// The user defined total time of the build.
+	RC_TIMER_TOTAL,
+	/// A user defined build time.
+	RC_TIMER_TEMP,
+	/// The time to rasterize the triangles. (See: #rcRasterizeTriangle)
+	RC_TIMER_RASTERIZE_TRIANGLES,
+	/// The time to build the compact heightfield. (See: #rcBuildCompactHeightfield)
+	RC_TIMER_BUILD_COMPACTHEIGHTFIELD,
+	/// The total time to build the contours. (See: #rcBuildContours)
+	RC_TIMER_BUILD_CONTOURS,
+	/// The time to trace the boundaries of the contours. (See: #rcBuildContours)
+	RC_TIMER_BUILD_CONTOURS_TRACE,
+	/// The time to simplify the contours. (See: #rcBuildContours)
+	RC_TIMER_BUILD_CONTOURS_SIMPLIFY,
+	/// The time to filter ledge spans. (See: #rcFilterLedgeSpans)
+	RC_TIMER_FILTER_BORDER,
+	/// The time to filter low height spans. (See: #rcFilterWalkableLowHeightSpans)
+	RC_TIMER_FILTER_WALKABLE,
+	/// The time to apply the median filter. (See: #rcMedianFilterWalkableArea)
+	RC_TIMER_MEDIAN_AREA,
+	/// The time to filter low obstacles. (See: #rcFilterLowHangingWalkableObstacles)
+	RC_TIMER_FILTER_LOW_OBSTACLES,
+	/// The time to build the polygon mesh. (See: #rcBuildPolyMesh)
+	RC_TIMER_BUILD_POLYMESH,
+	/// The time to merge polygon meshes. (See: #rcMergePolyMeshes)
+	RC_TIMER_MERGE_POLYMESH,
+	/// The time to erode the walkable area. (See: #rcErodeWalkableArea)
+	RC_TIMER_ERODE_AREA,
+	/// The time to mark a box area. (See: #rcMarkBoxArea)
+	RC_TIMER_MARK_BOX_AREA,
+	/// The time to mark a cylinder area. (See: #rcMarkCylinderArea)
+	RC_TIMER_MARK_CYLINDER_AREA,
+	/// The time to mark a convex polygon area. (See: #rcMarkConvexPolyArea)
+	RC_TIMER_MARK_CONVEXPOLY_AREA,
+	/// The total time to build the distance field. (See: #rcBuildDistanceField)
+	RC_TIMER_BUILD_DISTANCEFIELD,
+	/// The time to build the distances of the distance field. (See: #rcBuildDistanceField)
+	RC_TIMER_BUILD_DISTANCEFIELD_DIST,
+	/// The time to blur the distance field. (See: #rcBuildDistanceField)
+	RC_TIMER_BUILD_DISTANCEFIELD_BLUR,
+	/// The total time to build the regions. (See: #rcBuildRegions, #rcBuildRegionsMonotone)
+	RC_TIMER_BUILD_REGIONS,
+	/// The total time to apply the watershed algorithm. (See: #rcBuildRegions)
+	RC_TIMER_BUILD_REGIONS_WATERSHED,
+	/// The time to expand regions while applying the watershed algorithm. (See: #rcBuildRegions)
+	RC_TIMER_BUILD_REGIONS_EXPAND,
+	/// The time to flood regions while applying the watershed algorithm. (See: #rcBuildRegions)
+	RC_TIMER_BUILD_REGIONS_FLOOD,
+	/// The time to filter out small regions. (See: #rcBuildRegions, #rcBuildRegionsMonotone)
+	RC_TIMER_BUILD_REGIONS_FILTER,
+	/// The time to build heightfield layers. (See: #rcBuildHeightfieldLayers)
+	RC_TIMER_BUILD_LAYERS, 
+	/// The time to build the polygon mesh detail. (See: #rcBuildPolyMeshDetail)
+	RC_TIMER_BUILD_POLYMESHDETAIL,
+	/// The time to merge polygon mesh details. (See: #rcMergePolyMeshDetails)
+	RC_TIMER_MERGE_POLYMESHDETAIL,
+	/// The maximum number of timers.  (Used for iterating timers.)
+	RC_MAX_TIMERS
+};
+
+/// Provides an interface for optional logging and performance tracking of the Recast 
+/// build process.
+/// @ingroup recast
+class rcContext
+{
+public:
+
+	/// Contructor.
+	///  @param[in] state  TRUE if the logging and performance timers should be enabled.  [Default: true]
+	inline rcContext(bool state = true) : m_logEnabled(state), m_timerEnabled(state) {}
+	virtual ~rcContext() {}
+
+	/// Enables or disables logging.
+	///  @param[in] state TRUE if logging should be enabled.
+	inline void enableLog(bool state) { m_logEnabled = state; }
+
+	/// Clears all log entries.
+	inline void resetLog() { if (m_logEnabled) doResetLog(); }
+
+	/// Logs a message.
+	///  @param[in] category The category of the message.
+	///  @param[in] format The message.
+	void log(const rcLogCategory category, const char* format, ...);
+
+	/// Enables or disables the performance timers.
+	///  @param[in] state  TRUE if timers should be enabled.
+	inline void enableTimer(bool state) { m_timerEnabled = state; }
+
+	/// Clears all peformance timers. (Resets all to unused.)
+	inline void resetTimers() { if (m_timerEnabled) doResetTimers(); }
+
+	/// Starts the specified performance timer.
+	///  @param label  The category of timer.
+	inline void startTimer(const rcTimerLabel label) { if (m_timerEnabled) doStartTimer(label); }
+
+	/// Stops the specified performance timer.
+	///  @param label  The category of the timer.
+	inline void stopTimer(const rcTimerLabel label) { if (m_timerEnabled) doStopTimer(label); }
+
+	/// Returns the total accumulated time of the specified performance timer.
+	///  @param label  The category of the timer.
+	///  @return The accumulated time of the timer, or -1 if timers are disabled or the timer has never been started.
+	inline int getAccumulatedTime(const rcTimerLabel label) const { return m_timerEnabled ? doGetAccumulatedTime(label) : -1; }
+
+protected:
+
+	/// Clears all log entries.
+	virtual void doResetLog() {}
+
+	/// Logs a message.
+	///  @param[in] category The category of the message.
+	///  @param[in] msg The formatted message.
+	///  @param[in] len The length of the formatted message.
+	virtual void doLog(const rcLogCategory /*category*/, const char* /*msg*/, const int /*len*/) {}
+
+	/// Clears all timers. (Resets all to unused.)
+	virtual void doResetTimers() {}
+
+	/// Starts the specified performance timer.
+	///  @param[in] label  The category of timer.
+	virtual void doStartTimer(const rcTimerLabel /*label*/) {}
+
+	/// Stops the specified performance timer.
+	///  @param[in] label  The category of the timer.
+	virtual void doStopTimer(const rcTimerLabel /*label*/) {}
+
+	/// Returns the total accumulated time of the specified performance timer.
+	///  @param[in] label  The category of the timer.
+	///  @return The accumulated time of the timer, or -1 if timers are disabled or the timer has never been started.
+	virtual int doGetAccumulatedTime(const rcTimerLabel /*label*/) const { return -1; }
+	
+	/// True if logging is enabled.
+	bool m_logEnabled;
+
+	/// True if the performance timers are enabled.
+	bool m_timerEnabled;
+};
+
+/// Specifies a configuration to use when performing Recast builds.
+/// @ingroup recast
 struct rcConfig
 {
-	int width, height;				// Dimensions of the rasterized heighfield (vx)
-	int tileSize;					// Width and Height of a tile (vx)
-	int borderSize;					// Non-navigable Border around the heightfield (vx)
-	float cs, ch;					// Grid cell size and height (wu)
-	float bmin[3], bmax[3];			// Grid bounds (wu)
-	float walkableSlopeAngle;		// Maximum walkble slope angle in degrees.
-	int walkableHeight;				// Minimum height where the agent can still walk (vx)
-	int walkableClimb;				// Maximum height between grid cells the agent can climb (vx)
-	int walkableRadius;				// Radius of the agent in cells (vx)
-	int maxEdgeLen;					// Maximum contour edge length (vx)
-	float maxSimplificationError;	// Maximum distance error from contour to cells (vx)
-	int minRegionSize;				// Minimum regions size. Smaller regions will be deleted (vx)
-	int mergeRegionSize;			// Minimum regions size. Smaller regions will be merged (vx)
-	int maxVertsPerPoly;			// Max number of vertices per polygon
-	float detailSampleDist;			// Detail mesh sample spacing.
-	float detailSampleMaxError;		// Detail mesh simplification max sample error.
+	/// The width of the field along the x-axis. [Limit: >= 0] [Units: vx]
+	int width;
+
+	/// The height of the field along the z-axis. [Limit: >= 0] [Units: vx]
+	int height;	
+	
+	/// The width/height size of tile's on the xz-plane. [Limit: >= 0] [Units: vx]
+	int tileSize;	
+	
+	/// The size of the non-navigable border around the heightfield. [Limit: >=0] [Units: vx]
+	int borderSize;
+
+	/// The xz-plane cell size to use for fields. [Limit: > 0] [Units: wu] 
+	float cs;
+
+	/// The y-axis cell size to use for fields. [Limit: > 0] [Units: wu]
+	float ch;
+
+	/// The minimum bounds of the field's AABB. [(x, y, z)] [Units: wu]
+	float bmin[3]; 
+
+	/// The maximum bounds of the field's AABB. [(x, y, z)] [Units: wu]
+	float bmax[3];
+
+	/// The maximum slope that is considered walkable. [Limits: 0 <= value < 90] [Units: Degrees] 
+	float walkableSlopeAngle;
+

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list