Core/Refactor: Part 3

This commit is contained in:
hondacrx
2018-05-16 19:57:48 -04:00
parent 225a5d27f7
commit 5dacd669b5
112 changed files with 564 additions and 561 deletions
+1 -1
View File
@@ -290,7 +290,7 @@ namespace System.Collections
{
Contract.Ensures(Contract.Result<int>() >= 0);
return (int)_mLength;
return _mLength;
}
}
+3 -3
View File
@@ -31,10 +31,10 @@ namespace Framework.Constants
{
None = 0x00,
Read = 0x01,
Returned = 0x02, /// This Mail Was Returned. Do Not Allow Returning Mail Back Again.
Copied = 0x04, /// This Mail Was Copied. Do Not Allow Making A Copy Of Items In Mail.
Returned = 0x02, // This Mail Was Returned. Do Not Allow Returning Mail Back Again.
Copied = 0x04, // This Mail Was Copied. Do Not Allow Making A Copy Of Items In Mail.
CodPayment = 0x08,
HasBody = 0x10 /// This Mail Has Body Text.
HasBody = 0x10 // This Mail Has Body Text.
}
public enum MailStationery
+3 -3
View File
@@ -323,9 +323,9 @@ namespace Framework.Constants
SavePlayer = 0x01,
ResurrectPlayer = 0x02,
SpellCastDeserter = 0x04,
BGMountRestore = 0x08, ///< Flag to restore mount state after teleport from BG
BGTaxiRestore = 0x10, ///< Flag to restore taxi state after teleport from BG
BGGroupRestore = 0x20, ///< Flag to restore group state after teleport from BG
BGMountRestore = 0x08, // Flag to restore mount state after teleport from BG
BGTaxiRestore = 0x10, // Flag to restore taxi state after teleport from BG
BGGroupRestore = 0x20, // Flag to restore group state after teleport from BG
End
}
+6
View File
@@ -483,6 +483,12 @@ namespace Framework.Constants
ChaseMove = 0x4000000,
FollowMove = 0x8000000,
IgnorePathfinding = 0x10000000,
AllStateSupported = Died | MeleeAttacking | Stunned | Roaming | Chase
| Fleeing | InFlight | Follow | Root | Confused
| Distracted | Isolated | AttackPlayer | Casting
| Possessed | Charging | Jumping | Move | Rotating
| Evade | RoamingMove | ConfusedMove | FleeingMove
| ChaseMove | FollowMove | IgnorePathfinding,
Unattackable = InFlight,
// For Real Move Using Movegen Check And Stop (Except Unstoppable Flight)
Moving = RoamingMove | ConfusedMove | FleeingMove | ChaseMove | FollowMove,
+2 -1
View File
@@ -52,7 +52,7 @@ namespace Framework.Database
public QueryCallbackStatus InvokeIfReady()
{
QueryCallbackData callback = _callbacks.Dequeue();
QueryCallbackData callback = _callbacks.Peek();
while (true)
{
@@ -64,6 +64,7 @@ namespace Framework.Database
cb(this, f.Result);
_callbacks.Dequeue();
bool hasNext = _result != null;
if (_callbacks.Count == 0)
{
@@ -78,6 +78,7 @@ namespace Framework.Dynamic
/// Calls the optional callback on successfully finish.
/// </summary>
/// <param name="milliseconds"></param>
/// <param name="callback"></param>
/// <returns></returns>
public TaskScheduler Update(uint milliseconds, success_t callback = null)
{
@@ -89,6 +90,7 @@ namespace Framework.Dynamic
/// Calls the optional callback on successfully finish.
/// </summary>
/// <param name="difftime"></param>
/// <param name="callback"></param>
/// <returns></returns>
TaskScheduler Update(TimeSpan difftime, success_t callback = null)
{
+1 -1
View File
@@ -236,7 +236,7 @@ namespace Framework.GameMath
/// the specified object.
/// </summary>
/// <param name="obj">An object to compare to this instance.</param>
/// <returns>True if <paramref name="obj"/> is a <see cref="Vector2D"/> and has the same values as this instance; otherwise, False.</returns>
/// <returns>True if <paramref name="obj"/> is a <see cref="Plane"/> and has the same values as this instance; otherwise, False.</returns>
public override bool Equals(object obj)
{
if (obj is Plane)
+5 -5
View File
@@ -258,7 +258,7 @@ namespace Framework.GameMath
/// Converts the specified string to its <see cref="Quaternion"/> equivalent.
/// </summary>
/// <param name="value">A string representation of a <see cref="Quaternion"/></param>
/// <returns>A <see cref="Quaternion"/> that represents the vector specified by the <paramref name="s"/> parameter.</returns>
/// <returns>A <see cref="Quaternion"/> that represents the vector specified by the <paramref name="value"/> parameter.</returns>
public static Quaternion Parse(string value)
{
Regex r = new Regex(@"\((?<w>.*),(?<x>.*),(?<y>.*),(?<z>.*)\)", RegexOptions.None);
@@ -358,7 +358,7 @@ namespace Framework.GameMath
}
/// <summary>
/// Multiplies quaternion <paramref name="a"/> by quaternion <paramref name="b"/>.
/// Multiplies quaternion <paramref name="left"/> by quaternion <paramref name="right"/>.
/// </summary>
/// <param name="left">A <see cref="Quaternion"/> instance.</param>
/// <param name="right">A <see cref="Quaternion"/> instance.</param>
@@ -374,7 +374,7 @@ namespace Framework.GameMath
return result;
}
/// <summary>
/// Multiplies quaternion <paramref name="a"/> by quaternion <paramref name="b"/> and put the result in a third quaternion.
/// Multiplies quaternion <paramref name="left"/> by quaternion <paramref name="right"/> and put the result in a third quaternion.
/// </summary>
/// <param name="left">A <see cref="Quaternion"/> instance.</param>
/// <param name="right">A <see cref="Quaternion"/> instance.</param>
@@ -617,7 +617,7 @@ namespace Framework.GameMath
/// </summary>
/// <remarks>
/// The quaternion values that are close to zero within the given tolerance are set to zero.
/// The tolerance value used is <see cref="MathFunctions.EpsilonD"/>
/// The tolerance value used is <see cref="MathFunctions.Epsilon"/>
/// </remarks>
public void ClampZero()
{
@@ -707,7 +707,7 @@ namespace Framework.GameMath
return Quaternion.Subtract(left, right);
}
/// <summary>
/// Multiplies quaternion <paramref name="a"/> by quaternion <paramref name="b"/>.
/// Multiplies quaternion <paramref name="left"/> by quaternion <paramref name="right"/>.
/// </summary>
/// <param name="left">A <see cref="Quaternion"/> instance.</param>
/// <param name="right">A <see cref="Quaternion"/> instance.</param>
-1
View File
@@ -285,7 +285,6 @@ namespace Framework.GameMath
/// <param name="culture">The <see cref="System.Globalization.CultureInfo"/> to use as the current culture. </param>
/// <param name="value">The <see cref="Object"/> to convert.</param>
/// <returns>An <see cref="Object"/> that represents the converted value.</returns>
/// <exception cref="ParseException">Failed parsing from string.</exception>
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
if (value.GetType() == typeof(string))
+5 -6
View File
@@ -530,7 +530,7 @@ namespace Framework.GameMath
/// </summary>
/// <remarks>
/// The vector values that are close to zero within the given tolerance are set to zero.
/// The tolerance value used is <see cref="MathFunctions.EpsilonD"/>
/// The tolerance value used is <see cref="MathFunctions.Epsilon"/>
/// </remarks>
public void ClampZero()
{
@@ -825,10 +825,10 @@ namespace Framework.GameMath
return array;
}
/// <summary>
/// Converts the vector to a <see cref="System.Collections.Generic.List"/> of single-precision floating point values.
/// Converts the vector to a <see cref="System.Collections.Generic.List{T}"/> of single-precision floating point values.
/// </summary>
/// <param name="vector">A <see cref="Vector2"/> instance.</param>
/// <returns>A <see cref="System.Collections.Generic.List"/> of single-precision floating point values.</returns>
/// <returns>A <see cref="System.Collections.Generic.List{T}"/> of single-precision floating point values.</returns>
public static explicit operator List<float>(Vector2 vector)
{
List<float> list = new List<float>();
@@ -838,10 +838,10 @@ namespace Framework.GameMath
return list;
}
/// <summary>
/// Converts the vector to a <see cref="System.Collections.Generic.LinkedList"/> of single-precision floating point values.
/// Converts the vector to a <see cref="System.Collections.Generic.LinkedList{T}"/> of single-precision floating point values.
/// </summary>
/// <param name="vector">A <see cref="Vector2"/> instance.</param>
/// <returns>A <see cref="System.Collections.Generic.LinkedList"/> of single-precision floating point values.</returns>
/// <returns>A <see cref="System.Collections.Generic.LinkedList{T}"/> of single-precision floating point values.</returns>
public static explicit operator LinkedList<float>(Vector2 vector)
{
LinkedList<float> list = new LinkedList<float>();
@@ -910,7 +910,6 @@ namespace Framework.GameMath
/// <param name="culture">The <see cref="System.Globalization.CultureInfo"/> to use as the current culture. </param>
/// <param name="value">The <see cref="Object"/> to convert.</param>
/// <returns>An <see cref="Object"/> that represents the converted value.</returns>
/// <exception cref="ParseException">Failed parsing from string.</exception>
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
if (value.GetType() == typeof(string))
+5 -6
View File
@@ -554,7 +554,7 @@ namespace Framework.GameMath
/// </summary>
/// <remarks>
/// The vector values that are close to zero within the given tolerance are set to zero.
/// The tolerance value used is <see cref="MathFunctions.EpsilonD"/>
/// The tolerance value used is <see cref="MathFunctions.Epsilon"/>
/// </remarks>
public void ClampZero()
{
@@ -895,10 +895,10 @@ namespace Framework.GameMath
return array;
}
/// <summary>
/// Converts the vector to a <see cref="System.Collections.Generic.List"/> of single-precision floating point values.
/// Converts the vector to a <see cref="System.Collections.Generic.List{T}"/> of single-precision floating point values.
/// </summary>
/// <param name="vector">A <see cref="Vector3"/> instance.</param>
/// <returns>A <see cref="System.Collections.Generic.List"/> of single-precision floating point values.</returns>
/// <returns>A <see cref="System.Collections.Generic.List{T}"/> of single-precision floating point values.</returns>
public static explicit operator List<float>(Vector3 vector)
{
List<float> list = new List<float>(3);
@@ -909,10 +909,10 @@ namespace Framework.GameMath
return list;
}
/// <summary>
/// Converts the vector to a <see cref="System.Collections.Generic.LinkedList"/> of single-precision floating point values.
/// Converts the vector to a <see cref="System.Collections.Generic.LinkedList{T}"/> of single-precision floating point values.
/// </summary>
/// <param name="vector">A <see cref="Vector3"/> instance.</param>
/// <returns>A <see cref="System.Collections.Generic.LinkedList"/> of single-precision floating point values.</returns>
/// <returns>A <see cref="System.Collections.Generic.LinkedList{T}"/> of single-precision floating point values.</returns>
public static explicit operator LinkedList<float>(Vector3 vector)
{
LinkedList<float> list = new LinkedList<float>();
@@ -1061,7 +1061,6 @@ namespace Framework.GameMath
/// <param name="culture">The <see cref="System.Globalization.CultureInfo"/> to use as the current culture. </param>
/// <param name="value">The <see cref="Object"/> to convert.</param>
/// <returns>An <see cref="Object"/> that represents the converted value.</returns>
/// <exception cref="ParseException">Failed parsing from string.</exception>
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
if (value.GetType() == typeof(string))
+5 -6
View File
@@ -576,7 +576,7 @@ namespace Framework.GameMath
/// </summary>
/// <remarks>
/// The vector values that are close to zero within the given tolerance are set to zero.
/// The tolerance value used is <see cref="MathFunctions.EpsilonD"/>
/// The tolerance value used is <see cref="MathFunctions.Epsilon"/>
/// </remarks>
public void ClampZero()
{
@@ -908,10 +908,10 @@ namespace Framework.GameMath
return array;
}
/// <summary>
/// Converts the vector to a <see cref="System.Collections.Generic.List"/> of single-precision floating point values.
/// Converts the vector to a <see cref="System.Collections.Generic.List{T}"/> of single-precision floating point values.
/// </summary>
/// <param name="vector">A <see cref="Vector4"/> instance.</param>
/// <returns>A <see cref="System.Collections.Generic.List"/> of single-precision floating point values.</returns>
/// <returns>A <see cref="System.Collections.Generic.List{T}"/> of single-precision floating point values.</returns>
public static explicit operator List<float>(Vector4 vector)
{
List<float> list = new List<float>(4);
@@ -923,10 +923,10 @@ namespace Framework.GameMath
return list;
}
/// <summary>
/// Converts the vector to a <see cref="System.Collections.Generic.LinkedList"/> of single-precision floating point values.
/// Converts the vector to a <see cref="System.Collections.Generic.LinkedList{T}"/> of single-precision floating point values.
/// </summary>
/// <param name="vector">A <see cref="Vector4"/> instance.</param>
/// <returns>A <see cref="System.Collections.Generic.LinkedList"/> of single-precision floating point values.</returns>
/// <returns>A <see cref="System.Collections.Generic.LinkedList{T}"/> of single-precision floating point values.</returns>
public static explicit operator LinkedList<float>(Vector4 vector)
{
LinkedList<float> list = new LinkedList<float>();
@@ -997,7 +997,6 @@ namespace Framework.GameMath
/// <param name="culture">The <see cref="System.Globalization.CultureInfo"/> to use as the current culture. </param>
/// <param name="value">The <see cref="Object"/> to convert.</param>
/// <returns>An <see cref="Object"/> that represents the converted value.</returns>
/// <exception cref="ParseException">Failed parsing from string.</exception>
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
if (value.GetType() == typeof(string))
@@ -247,8 +247,8 @@ public static partial class Detour
/// @param[in] pt The point to check. [(x, y, z)]
/// @param[in] verts The polygon vertices. [(x, y, z) * @p nverts]
/// @param[in] nverts The number of vertices. [Limit: >= 3]
/// @return True if the point is inside the polygon.
/// @par
// @return True if the point is inside the polygon.
// @par
///
/// All points are projected onto the xz-plane, so the y-values are ignored.
public static bool dtPointInPolygon(float[] pt, float[] verts, int nverts)
@@ -305,8 +305,8 @@ public static partial class Detour
/// @param[in] npolya The number of vertices in polygon A.
/// @param[in] polyb Polygon B vertices. [(x, y, z) * @p npolyb]
/// @param[in] npolyb The number of vertices in polygon B.
/// @return True if the two polygons overlap.
/// @par
// @return True if the two polygons overlap.
// @par
///
/// All vertices are projected onto the xz-plane, so the y-values are ignored.
public static bool dtOverlapPolyPoly2D(float[] polya, int npolya, float[] polyb, int npolyb)
@@ -478,9 +478,9 @@ public static partial class Detour
return v < mn ? mn : (v > mx ? mx : v);
}
/// @}
/// @name Vector helper functions.
/// @{
// @}
// @name Vector helper functions.
// @{
/// Derives the cross product of two vectors. (@p v1 x @p v2)
/// @param[out] dest The cross product. [(x, y, z)]
@@ -495,7 +495,7 @@ public static partial class Detour
/// Derives the dot product of two vectors. (@p v1 . @p v2)
/// @param[in] v1 A Vector [(x, y, z)]
/// @param[in] v2 A vector [(x, y, z)]
/// @return The dot product.
// @return The dot product.
public static float dtVdot(float[] v1, float[] v2)
{
return v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2];
@@ -521,7 +521,7 @@ public static partial class Detour
/// @param[out] dest The result vector. [(x, y, x)]
/// @param[in] v1 The starting vector.
/// @param[in] v2 The destination vector.
/// @param[in] t The interpolation factor. [Limits: 0 <= value <= 1.0]
/// @param[in] t The interpolation factor. [Limits: 0 &lt;= value &lt;= 1.0]
public static void dtVlerp(float[] dest, float[] v1, float[] v2, float t)
{
dest[0] = v1[0] + (v2[0] - v1[0]) * t;
@@ -647,7 +647,7 @@ public static partial class Detour
}
/// Derives the scalar length of the vector.
/// @param[in] v The vector. [(x, y, z)]
/// @return The scalar length of the vector.
// @return The scalar length of the vector.
public static float dtVlen(float[] v)
{
return (float)Math.Sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
@@ -659,7 +659,7 @@ public static partial class Detour
/// Derives the square of the scalar length of the vector. (len * len)
/// @param[in] v The vector. [(x, y, z)]
/// @return The square of the scalar length of the vector.
// @return The square of the scalar length of the vector.
public static float dtVlenSqr(float[] v)
{
return v[0] * v[0] + v[1] * v[1] + v[2] * v[2];
@@ -672,7 +672,7 @@ public static partial class Detour
/// Returns the distance between two points.
/// @param[in] v1 A point. [(x, y, z)]
/// @param[in] v2 A point. [(x, y, z)]
/// @return The distance between the two points.
// @return The distance between the two points.
public static float dtVdist(float[] v1, float[] v2)
{
float dx = v2[0] - v1[0];
@@ -691,7 +691,7 @@ public static partial class Detour
/// Returns the square of the distance between two points.
/// @param[in] v1 A point. [(x, y, z)]
/// @param[in] v2 A point. [(x, y, z)]
/// @return The square of the distance between the two points.
// @return The square of the distance between the two points.
public static float dtVdistSqr(float[] v1, float[] v2)
{
float dx = v2[0] - v1[0];
@@ -710,7 +710,7 @@ public static partial class Detour
/// Derives the distance between the specified points on the xz-plane.
/// @param[in] v1 A point. [(x, y, z)]
/// @param[in] v2 A point. [(x, y, z)]
/// @return The distance between the point on the xz-plane.
// @return The distance between the point on the xz-plane.
///
/// The vectors are projected onto the xz-plane, so the y-values are ignored.
public static float dtVdist2D(float[] v1, float[] v2)
@@ -728,7 +728,7 @@ public static partial class Detour
/// Derives the square of the distance between the specified points on the xz-plane.
/// @param[in] v1 A point. [(x, y, z)]
/// @param[in] v2 A point. [(x, y, z)]
/// @return The square of the distance between the point on the xz-plane.
// @return The square of the distance between the point on the xz-plane.
public static float dtVdist2DSqr(float[] v1, float[] v2)
{
float dx = v2[0] - v1[0];
@@ -761,7 +761,7 @@ public static partial class Detour
/// Performs a 'sloppy' colocation check of the specified points.
/// @param[in] p0 A point. [(x, y, z)]
/// @param[in] p1 A point. [(x, y, z)]
/// @return True if the points are considered to be at the same location.
// @return True if the points are considered to be at the same location.
///
/// Basically, this function will return true if the specified points are
/// close enough to eachother to be considered colocated.
@@ -782,7 +782,7 @@ public static partial class Detour
/// Derives the dot product of two vectors on the xz-plane. (@p u . @p v)
/// @param[in] u A vector [(x, y, z)]
/// @param[in] v A vector [(x, y, z)]
/// @return The dot product on the xz-plane.
// @return The dot product on the xz-plane.
///
/// The vectors are projected onto the xz-plane, so the y-values are ignored.
public static float dtVdot2D(float[] u, float[] v)
@@ -797,7 +797,7 @@ public static partial class Detour
/// Derives the xz-plane 2D perp product of the two vectors. (uz*vx - ux*vz)
/// @param[in] u The LHV vector [(x, y, z)]
/// @param[in] v The RHV vector [(x, y, z)]
/// @return The dot product on the xz-plane.
// @return The dot product on the xz-plane.
///
/// The vectors are projected onto the xz-plane, so the y-values are ignored.
public static float dtVperp2D(float[] u, float[] v)
@@ -808,9 +808,9 @@ public static partial class Detour
{
return u[uStart + 2] * v[vStart + 0] - u[uStart + 0] * v[vStart + 2];
}
/// @}
/// @name Computational geometry helper functions.
/// @{
// @}
// @name Computational geometry helper functions.
// @{
/**
@@ -856,7 +856,7 @@ public static partial class Detour
/// @param[in] a Vertex A. [(x, y, z)]
/// @param[in] b Vertex B. [(x, y, z)]
/// @param[in] c Vertex C. [(x, y, z)]
/// @return The signed xz-plane area of the triangle.
// @return The signed xz-plane area of the triangle.
public static float dtTriArea2D(float[] a, float[] b, float[] c)
{
float abx = b[0] - a[0];
@@ -878,8 +878,8 @@ public static partial class Detour
/// @param[in] amax Maximum bounds of box A. [(x, y, z)]
/// @param[in] bmin Minimum bounds of box B. [(x, y, z)]
/// @param[in] bmax Maximum bounds of box B. [(x, y, z)]
/// @return True if the two AABB's overlap.
/// @see dtOverlapBounds
// @return True if the two AABB's overlap.
// @see dtOverlapBounds
public static bool dtOverlapQuantBounds(ushort[] amin, ushort[] amax, ushort[] bmin, ushort[] bmax)
{
bool overlap = true;
@@ -894,8 +894,8 @@ public static partial class Detour
/// @param[in] amax Maximum bounds of box A. [(x, y, z)]
/// @param[in] bmin Minimum bounds of box B. [(x, y, z)]
/// @param[in] bmax Maximum bounds of box B. [(x, y, z)]
/// @return True if the two AABB's overlap.
/// @see dtOverlapQuantBounds
// @return True if the two AABB's overlap.
// @see dtOverlapQuantBounds
public static bool dtOverlapBounds(float[] amin, float[] amax, float[] bmin, float[] bmax)
{
bool overlap = true;
@@ -905,9 +905,9 @@ public static partial class Detour
return overlap;
}
/// @}
/// @name Miscellanious functions.
/// @{
// @}
// @name Miscellanious functions.
// @{
public static uint dtNextPow2(uint v)
{
@@ -164,7 +164,7 @@ public static partial class Detour
return new(mem) dtNavMesh;
}
*/
/// @par
// @par
///
/// This function will only free the memory for tiles with the #DT_TILE_FREE_DATA
/// flag set.
@@ -208,7 +208,7 @@ public static partial class Detour
@see dtNavMeshQuery, dtCreateNavMeshData, dtNavMeshCreateParams, #dtAllocNavMesh, #dtFreeNavMesh
*/
/// A navigation mesh based on tiles of convex polygons.
/// @ingroup detour
// @ingroup detour
public class dtNavMesh
{
private dtNavMeshParams m_params; //< Current initialization params. TODO: do not store this info twice.
@@ -312,12 +312,12 @@ public static partial class Detour
return (uint)(polyRef & polyMask);
}
/// @{
/// @name Initialization and Tile Management
// @{
// @name Initialization and Tile Management
/// Initializes the navigation mesh for tiled use.
/// @param[in] params Initialization parameters.
/// @return The status flags for the operation.
// @return The status flags for the operation.
public dtStatus init(dtNavMeshParams navMeshParams)
{
//memcpy(&m_params, params, sizeof(dtNavMeshParams));
@@ -363,7 +363,7 @@ public static partial class Detour
/// @param[in] data Data of the new tile. (See: #dtCreateNavMeshData)
/// @param[in] dataSize The data size of the new tile.
/// @param[in] flags The tile flags. (See: #dtTileFlags)
/// @return The status flags for the operation.
// @return The status flags for the operation.
/// @see dtCreateNavMeshData
public dtStatus init(dtRawTileData rawTile, int flags)
{
@@ -394,9 +394,9 @@ public static partial class Detour
}
/// The navigation mesh initialization params.
/// @par
// @par
///
/// @note The parameters are created automatically when the single tile
// @note The parameters are created automatically when the single tile
/// initialization is performed.
public dtNavMeshParams getParams()
{
@@ -988,7 +988,7 @@ public static partial class Detour
}
}
/// @par
// @par
///
/// The add operation will fail if the data is in the wrong format, the allocated tile
/// space is full, or there is a tile already at the specified reference.
@@ -998,14 +998,14 @@ public static partial class Detour
/// tile will be restored to the same values they were before the tile was
/// removed.
///
/// @see dtCreateNavMeshData, #removeTile
// @see dtCreateNavMeshData, #removeTile
/// Adds a tile to the navigation mesh.
/// @param[in] data Data for the new tile mesh. (See: #dtCreateNavMeshData)
/// @param[in] dataSize Data size of the new tile mesh.
/// @param[in] flags Tile flags. (See: #dtTileFlags)
/// @param[in] lastRef The desired reference for the tile. (When reloading a tile.) [opt] [Default: 0]
/// @param[out] result The tile reference. (If the tile was succesfully added.) [opt]
/// @return The status flags for the operation.
// @return The status flags for the operation.
public dtStatus addTile(dtRawTileData rawTileData, int flags, dtTileRef lastRef, ref dtTileRef result)
{
//C#: Using an intermediate class dtRawTileData because Cpp uses a binary buffer.
@@ -1153,7 +1153,7 @@ public static partial class Detour
/// @param[in] x The tile's x-location. (x, y, layer)
/// @param[in] y The tile's y-location. (x, y, layer)
/// @param[in] layer The tile's layer. (x, y, layer)
/// @return The tile, or null if the tile does not exist.
// @return The tile, or null if the tile does not exist.
public dtMeshTile getTileAt(int x, int y, int layer)
{
// Find tile based on hash.
@@ -1192,7 +1192,7 @@ public static partial class Detour
}
/// @par
// @par
///
/// This function will not fail if the tiles array is too small to hold the
/// entire result set. It will simply fill the array to capacity.
@@ -1201,7 +1201,7 @@ public static partial class Detour
/// @param[in] y The tile's y-location. (x, y)
/// @param[out] tiles A pointer to an array of tiles that will hold the result.
/// @param[in] maxTiles The maximum tiles the tiles parameter can hold.
/// @return The number of tiles returned in the tiles array.
// @return The number of tiles returned in the tiles array.
public int getTilesAt(int x, int y, dtMeshTile[] tiles, int maxTiles)
{
int n = 0;
@@ -1228,7 +1228,7 @@ public static partial class Detour
/// @param[in] x The tile's x-location. (x, y, layer)
/// @param[in] y The tile's y-location. (x, y, layer)
/// @param[in] layer The tile's layer. (x, y, layer)
/// @return The tile reference of the tile, or 0 if there is none.
// @return The tile reference of the tile, or 0 if there is none.
public dtTileRef getTileRefAt(int x, int y, int layer)
{
// Find tile based on hash.
@@ -1249,7 +1249,7 @@ public static partial class Detour
}
/// Gets the tile for the specified tile reference.
/// @param[in] ref The tile reference of the tile to retrieve.
/// @return The tile for the specified reference, or null if the
// @return The tile for the specified reference, or null if the
/// reference is invalid.
public dtMeshTile getTileByRef(dtTileRef tileRef)
{
@@ -1266,15 +1266,15 @@ public static partial class Detour
}
/// The maximum number of tiles supported by the navigation mesh.
/// @return The maximum number of tiles supported by the navigation mesh.
// @return The maximum number of tiles supported by the navigation mesh.
public int getMaxTiles()
{
return m_maxTiles;
}
/// Gets the tile at the specified index.
/// @param[in] i The tile index. [Limit: 0 >= index < #getMaxTiles()]
/// @return The tile at the specified index.
/// @param[in] i The tile index. [Limit: 0 >= index &lt; #getMaxTiles()]
// @return The tile at the specified index.
public dtMeshTile getTile(int i)
{
return m_tiles[i];
@@ -1294,7 +1294,7 @@ public static partial class Detour
/// @param[in] ref The reference for the a polygon.
/// @param[out] tile The tile containing the polygon.
/// @param[out] poly The polygon.
/// @return The status flags for the operation.
// @return The status flags for the operation.
public dtStatus getTileAndPolyByRef(dtPolyRef polyRef, ref dtMeshTile tile, ref dtPoly poly)
{
if (polyRef == 0)
@@ -1331,9 +1331,9 @@ public static partial class Detour
return DT_SUCCESS;
}
/// @par
// @par
///
/// @warning Only use this function if it is known that the provided polygon
// @warning Only use this function if it is known that the provided polygon
/// reference is valid. This function is faster than #getTileAndPolyByRef, but
/// it does not validate the reference.
/// Returns the tile and polygon for the specified polygon reference.
@@ -1358,7 +1358,7 @@ public static partial class Detour
/// Checks the validity of a polygon reference.
/// @param[in] ref The polygon reference to check.
/// @return True if polygon reference is valid for the navigation mesh.
// @return True if polygon reference is valid for the navigation mesh.
public bool isValidPolyRef(dtPolyRef polyRef)
{
if (polyRef == 0)
@@ -1374,17 +1374,17 @@ public static partial class Detour
return true;
}
/// @par
// @par
///
/// This function returns the data for the tile so that, if desired,
/// it can be added back to the navigation mesh at a later point.
///
/// @see #addTile
// @see #addTile
/// Removes the specified tile from the navigation mesh.
/// @param[in] ref The reference of the tile to remove.
/// @param[out] data Data associated with deleted tile.
/// @param[out] dataSize Size of the data associated with deleted tile.
/// @return The status flags for the operation.
// @return The status flags for the operation.
public dtStatus removeTile(dtTileRef tileRef, out dtRawTileData rawTileData)
{
rawTileData = null;
@@ -1488,7 +1488,7 @@ public static partial class Detour
/// Gets the tile reference for the specified tile.
/// @param[in] tile The tile.
/// @return The tile reference of the tile.
// @return The tile reference of the tile.
public dtTileRef getTileRef(dtMeshTile tile)
{
if (tile == null) return 0;
@@ -1496,23 +1496,23 @@ public static partial class Detour
return encodePolyId(tile.salt, it, 0);
}
/// @par
// @par
///
/// Example use case:
/// @code
// @code
///
/// const dtPolyRef base = navmesh.getPolyRefBase(tile);
/// for (int i = 0; i < tile.header.polyCount; ++i)
/// for (int i = 0; i &lt; tile.header.polyCount; ++i)
/// {
/// const dtPoly* p = &tile.polys[i];
/// const dtPoly* p = tile.polys[i];
/// const dtPolyRef ref = base | (dtPolyRef)i;
///
/// // Use the reference to access the polygon data.
/// }
/// @endcode
// @endcode
/// Gets the polygon reference for the tile's base polygon.
/// @param[in] tile The tile.
/// @return The polygon reference for the base polygon in the specified tile.
// @return The polygon reference for the base polygon in the specified tile.
public dtPolyRef getPolyRefBase(dtMeshTile tile)
{
if (tile == null) return 0;
@@ -1525,7 +1525,7 @@ public static partial class Detour
/// @see #storeTileState
/// Gets the size of the buffer required by #storeTileState to store the specified tile's state.
/// @param[in] tile The tile.
/// @return The size of the buffer required to store the state.
// @return The size of the buffer required to store the state.
int getTileStateSize(dtMeshTile tile)
{
if (tile == null) return 0;
@@ -1534,16 +1534,16 @@ public static partial class Detour
return headerSize + polyStateSize;
}
/// @par
// @par
///
/// Tile state includes non-structural data such as polygon flags, area ids, etc.
/// @note The state data is only valid until the tile reference changes.
/// @see #getTileStateSize, #restoreTileState
// @note The state data is only valid until the tile reference changes.
// @see #getTileStateSize, #restoreTileState
/// Stores the non-structural state of the tile in the specified buffer. (Flags, area ids, etc.)
/// @param[in] tile The tile.
/// @param[out] data The buffer to store the tile's state in.
/// @param[in] maxDataSize The size of the data buffer. [Limit: >= #getTileStateSize]
/// @return The status flags for the operation.
// @return The status flags for the operation.
dtStatus dtNavMesh::storeTileState(const dtMeshTile* tile, byte* data, const int maxDataSize) const
{
// Make sure there is enough space to store the state.
@@ -1571,16 +1571,16 @@ public static partial class Detour
return DT_SUCCESS;
}
/// @par
// @par
///
/// Tile state includes non-structural data such as polygon flags, area ids, etc.
/// @note This function does not impact the tile's #dtTileRef and #dtPolyRef's.
/// @see #storeTileState
// @note This function does not impact the tile's #dtTileRef and #dtPolyRef's.
// @see #storeTileState
/// Restores the state of the tile.
/// @param[in] tile The tile.
/// @param[in] data The new state. (Obtained from #storeTileState.)
/// @param[in] maxDataSize The size of the state within the data buffer.
/// @return The status flags for the operation.
// @return The status flags for the operation.
dtStatus dtNavMesh::restoreTileState(dtMeshTile* tile, const byte* data, const int maxDataSize)
{
// Make sure there is enough space to store the state.
@@ -1611,7 +1611,7 @@ public static partial class Detour
return DT_SUCCESS;
}
*/
/// @par
// @par
///
/// Off-mesh connections are stored in the navigation mesh as special 2-vertex
/// polygons with a single edge. At least one of the vertices is expected to be
@@ -1623,7 +1623,7 @@ public static partial class Detour
/// @param[in] polyRef The reference of the off-mesh connection polygon.
/// @param[out] startPos The start position of the off-mesh connection. [(x, y, z)]
/// @param[out] endPos The end position of the off-mesh connection. [(x, y, z)]
/// @return The status flags for the operation.
// @return The status flags for the operation.
public dtStatus getOffMeshConnectionPolyEndPoints(dtPolyRef prevRef, dtPolyRef polyRef, float[] startPos, float[] endPos)
{
uint salt = 0, it = 0, ip = 0;
@@ -1668,7 +1668,7 @@ public static partial class Detour
/// Gets the specified off-mesh connection.
/// @param[in] ref The polygon reference of the off-mesh connection.
/// @return The specified off-mesh connection, or null if the polygon reference is not valid.
// @return The specified off-mesh connection, or null if the polygon reference is not valid.
public dtOffMeshConnection getOffMeshConnectionByRef(dtPolyRef polyRef)
{
uint salt = 0, it = 0, ip = 0;
@@ -1693,14 +1693,14 @@ public static partial class Detour
return tile.offMeshCons[idx];
}
/// @{
/// @name State Management
// @{
// @name State Management
/// These functions do not effect #dtTileRef or #dtPolyRef's.
/// Sets the user defined flags for the specified polygon.
/// @param[in] ref The polygon reference.
/// @param[in] flags The new flags for the polygon.
/// @return The status flags for the operation.
// @return The status flags for the operation.
public dtStatus setPolyFlags(dtPolyRef polyRef, ushort flags)
{
if (polyRef == 0) return DT_FAILURE;
@@ -1723,7 +1723,7 @@ public static partial class Detour
/// Gets the user defined flags for the specified polygon.
/// @param[in] ref The polygon reference.
/// @param[out] resultFlags The polygon flags.
/// @return The status flags for the operation.
// @return The status flags for the operation.
public dtStatus getPolyFlags(dtPolyRef polyRef, ref ushort resultFlags)
{
if (polyRef == 0) return DT_FAILURE;
@@ -1742,8 +1742,8 @@ public static partial class Detour
/// Sets the user defined area for the specified polygon.
/// @param[in] ref The polygon reference.
/// @param[in] area The new area id for the polygon. [Limit: < #DT_MAX_AREAS]
/// @return The status flags for the operation.
/// @param[in] area The new area id for the polygon. [Limit: &lt; #DT_MAX_AREAS]
// @return The status flags for the operation.
public dtStatus setPolyArea(dtPolyRef polyRef, byte area)
{
if (polyRef == 0) return DT_FAILURE;
@@ -1763,7 +1763,7 @@ public static partial class Detour
/// Gets the user defined area for the specified polygon.
/// @param[in] ref The polygon reference.
/// @param[out] resultArea The area id for the polygon.
/// @return The status flags for the operation.
// @return The status flags for the operation.
public dtStatus getPolyArea(dtPolyRef polyRef, ref byte resultArea)
{
if (polyRef == 0) return DT_FAILURE;
@@ -6,11 +6,11 @@ using dtPolyRef = System.UInt64;
public static partial class Detour
{
/// The maximum number of vertices per navigation polygon.
/// @ingroup detour
// @ingroup detour
public const int DT_VERTS_PER_POLYGON = 6;
/// @{
/// @name Tile Serialization Constants
// @{
// @name Tile Serialization Constants
/// These constants are used to detect whether a navigation tile's data
/// and state format is compatible with the current build.
///
@@ -27,7 +27,7 @@ public static partial class Detour
/// A version number used to detect compatibility of navigation tile states.
public const int DT_NAVMESH_STATE_VERSION = 1;
/// @}
// @}
/// A flag that indicates that an entity links to an external entity.
/// (E.g. A polygon edge is a portal that links to another polygon.)
@@ -40,7 +40,7 @@ public static partial class Detour
public const uint DT_OFFMESH_CON_BIDIR = 1;
/// The maximum number of user defined area ids.
/// @ingroup detour
// @ingroup detour
public const int DT_MAX_AREAS = 64;
const ushort MESH_NULL_IDX = 0xffff;
@@ -79,7 +79,7 @@ public static partial class Detour
/// Defines a polyogn within a dtMeshTile object.
/// @ingroup detour
// @ingroup detour
public class dtPoly
{
/// Index to first link in linked list. (Or #DT_NULL_LINK if there is no link.)
@@ -119,7 +119,7 @@ public static partial class Detour
public byte vertCount;
/// The bit packed area id and polygon type.
/// @note Use the structure's set and get methods to acess this value.
// @note Use the structure's set and get methods to acess this value.
public byte areaAndtype;
public int FromBytes(byte[] array, int start)
@@ -158,7 +158,7 @@ public static partial class Detour
return bytes.ToArray();
}
/// Sets the user defined area id. [Limit: < #DT_MAX_AREAS]
/// Sets the user defined area id. [Limit: &lt; #DT_MAX_AREAS]
public void setArea(byte a)
{
//Bitwise operators are done on ints in C#
@@ -216,8 +216,8 @@ public static partial class Detour
};
/// Defines a link between polygons.
/// @note This structure is rarely if ever used by the end user.
/// @see dtMeshTile
// @note This structure is rarely if ever used by the end user.
// @see dtMeshTile
public class dtLink
{
public dtPolyRef polyRef; //< Neighbour reference. (The neighbor that is linked to.)
@@ -254,8 +254,8 @@ public static partial class Detour
};
/// Bounding volume node.
/// @note This structure is rarely if ever used by the end user.
/// @see dtMeshTile
// @note This structure is rarely if ever used by the end user.
// @see dtMeshTile
public class dtBVNode
{
public ushort[] bmin = new ushort[3]; //< Minimum bounds of the node's AABB. [(x, y, z)]
@@ -307,7 +307,7 @@ public static partial class Detour
public ushort poly;
/// Link flags.
/// @note These are not the connection's user defined flags. Those are assigned via the
// @note These are not the connection's user defined flags. Those are assigned via the
/// connection's dtPoly definition. These are link flags used for internal purposes.
public byte flags;
@@ -352,7 +352,7 @@ public static partial class Detour
/// Provides high level information related to a dtMeshTile object.
/// @ingroup detour
// @ingroup detour
public class dtMeshHeader
{
public int magic; //< Tile magic number. (Used to identify the data format.)
@@ -605,7 +605,7 @@ public static partial class Detour
}
}
/// Defines a navigation mesh tile.
/// @ingroup detour
// @ingroup detour
/*
@struct dtMeshTile
@par
@@ -661,8 +661,8 @@ public static partial class Detour
/// Configuration parameters used to define multi-tile navigation meshes.
/// The values are used to allocate space during the initialization of a navigation mesh.
/// @see dtNavMesh::init()
/// @ingroup detour
// @see dtNavMesh::init()
// @ingroup detour
public class dtNavMeshParams
{
public float[] orig = new float[3]; //< The world space origin of the navigation mesh's tile space. [(x, y, z)]
@@ -687,7 +687,7 @@ public static partial class Detour
};
/// Represents the source data used to build an navigation mesh tile.
/// @ingroup detour
// @ingroup detour
/**
@struct dtNavMeshCreateParams
@par
@@ -709,10 +709,10 @@ public static partial class Detour
public class dtNavMeshCreateParams
{
/// @name Polygon Mesh Attributes
/// Used to create the base navigation graph.
/// See #rcPolyMesh for details related to these attributes.
/// @{
// @name Polygon Mesh Attributes
// Used to create the base navigation graph.
// See #rcPolyMesh for details related to these attributes.
// @{
public ushort[] verts; //< The polygon mesh vertices. [(x, y, z) * #vertCount] [Unit: vx]
public int vertCount; //< The number vertices in the polygon mesh. [Limit: >= 3]
@@ -722,10 +722,10 @@ public static partial class Detour
public int polyCount; //< Number of polygons in the mesh. [Limit: >= 1]
public int nvp; //< Number maximum number of vertices per polygon. [Limit: >= 3]
/// @}
/// @name Height Detail Attributes (Optional)
/// See #rcPolyMeshDetail for details related to these attributes.
/// @{
// @}
// @name Height Detail Attributes (Optional)
// See #rcPolyMeshDetail for details related to these attributes.
// @{
public uint[] detailMeshes; //< The height detail sub-mesh data. [Size: 4 * #polyCount]
public float[] detailVerts; //< The detail mesh vertices. [Size: 3 * #detailVertsCount] [Unit: wu]
@@ -733,35 +733,35 @@ public static partial class Detour
public byte[] detailTris; //< The detail mesh triangles. [Size: 4 * #detailTriCount]
public int detailTriCount; //< The number of triangles in the detail mesh.
/// @}
/// @name Off-Mesh Connections Attributes (Optional)
/// Used to define a custom point-to-point edge within the navigation graph, an
/// off-mesh connection is a user defined traversable connection made up to two vertices,
/// at least one of which resides within a navigation mesh polygon.
/// @{
// @}
// @name Off-Mesh Connections Attributes (Optional)
// Used to define a custom point-to-point edge within the navigation graph, an
// off-mesh connection is a user defined traversable connection made up to two vertices,
// at least one of which resides within a navigation mesh polygon.
// @{
/// Off-mesh connection vertices. [(ax, ay, az, bx, by, bz) * #offMeshConCount] [Unit: wu]
// Off-mesh connection vertices. [(ax, ay, az, bx, by, bz) * #offMeshConCount] [Unit: wu]
public float[] offMeshConVerts;
/// Off-mesh connection radii. [Size: #offMeshConCount] [Unit: wu]
// Off-mesh connection radii. [Size: #offMeshConCount] [Unit: wu]
public float[] offMeshConRad;
/// User defined flags assigned to the off-mesh connections. [Size: #offMeshConCount]
// User defined flags assigned to the off-mesh connections. [Size: #offMeshConCount]
public ushort[] offMeshConFlags;
/// User defined area ids assigned to the off-mesh connections. [Size: #offMeshConCount]
// User defined area ids assigned to the off-mesh connections. [Size: #offMeshConCount]
public byte[] offMeshConAreas;
/// The permitted travel direction of the off-mesh connections. [Size: #offMeshConCount]
///
/// 0 = Travel only from endpoint A to endpoint B.<br/>
/// #DT_OFFMESH_CON_BIDIR = Bidirectional travel.
// The permitted travel direction of the off-mesh connections. [Size: #offMeshConCount]
//
// 0 = Travel only from endpoint A to endpoint B.<br/>
// #DT_OFFMESH_CON_BIDIR = Bidirectional travel.
public byte[] offMeshConDir;
/// The user defined ids of the off-mesh connection. [Size: #offMeshConCount]
// The user defined ids of the off-mesh connection. [Size: #offMeshConCount]
public uint[] offMeshConUserID;
/// The number of off-mesh connections. [Limit: >= 0]
// The number of off-mesh connections. [Limit: >= 0]
public int offMeshConCount;
/// @}
/// @name Tile Attributes
/// @note The tile grid/layer data can be left at zero if the destination is a single tile mesh.
/// @{
// @}
// @name Tile Attributes
// @note The tile grid/layer data can be left at zero if the destination is a single tile mesh.
// @{
public uint userId; //< The user defined id of the tile.
public int tileX; //< The tile's x-grid location within the multi-tile destination mesh. (Along the x-axis.)
@@ -770,9 +770,9 @@ public static partial class Detour
public float[] bmin = new float[3]; //< The minimum bounds of the tile. [(x, y, z)] [Unit: wu]
public float[] bmax = new float[3]; //< The maximum bounds of the tile. [(x, y, z)] [Unit: wu]
/// @}
/// @name General Configuration Attributes
/// @{
// @}
// @name General Configuration Attributes
// @{
public float walkableHeight; //< The agent height. [Unit: wu]
public float walkableRadius; //< The agent radius. [Unit: wu]
@@ -781,10 +781,10 @@ public static partial class Detour
public float ch; //< The y-axis cell height of the polygon mesh. [Limit: > 0] [Unit: wu]
/// True if a bounding volume tree should be built for the tile.
/// @note The BVTree is not normally needed for layered navigation meshes.
// @note The BVTree is not normally needed for layered navigation meshes.
public bool buildBvTree;
/// @}
// @}
}
public class BVItem
@@ -1008,19 +1008,19 @@ public static partial class Detour
// TODO: Better error handling.
/// @par
// @par
///
/// The output data array is allocated using the detour allocator (dtAlloc()). The method
/// used to free the memory will be determined by how the tile is added to the navigation
/// mesh.
///
/// @see dtNavMesh, dtNavMesh::addTile()
// @see dtNavMesh, dtNavMesh::addTile()
/// Builds navigation mesh tile data from the provided tile creation data.
/// @ingroup detour
// @ingroup detour
/// @param[in] params Tile creation data.
/// @param[out] outData The resulting tile data.
/// @param[out] outDataSize The size of the tile data array.
/// @return True if the tile data was successfully created.
// @return True if the tile data was successfully created.
public static bool dtCreateNavMeshData(dtNavMeshCreateParams createParams, out dtRawTileData outTile)//ref byte[] outData, ref int outDataSize)
{
outTile = null;
@@ -1526,15 +1526,15 @@ public static partial class Detour
return true;
}
*/
/// @par
///
/// @warning This function assumes that the header is in the correct endianess already.
/// Call #dtNavMeshHeaderSwapEndian() first on the data if the data is expected to be in wrong endianess
/// to start with. Call #dtNavMeshHeaderSwapEndian() after the data has been swapped if converting from
/// native to foreign endianess.
/// Swaps endianess of the tile data.
/// @param[in,out] data The tile data array.
/// @param[in] dataSize The size of the data array.
// @par
//
// @warning This function assumes that the header is in the correct endianess already.
// Call #dtNavMeshHeaderSwapEndian() first on the data if the data is expected to be in wrong endianess
// to start with. Call #dtNavMeshHeaderSwapEndian() after the data has been swapped if converting from
// native to foreign endianess.
// Swaps endianess of the tile data.
// @param[in,out] data The tile data array.
// @param[in] dataSize The size of the data array.
/*
bool dtNavMeshDataSwapEndian(byte* data, const int dataSize)
{
@@ -1,36 +1,36 @@
/// @class dtQueryFilter
///
/// <b>The Default Implementation</b>
///
/// At construction: All area costs default to 1.0. All flags are included
/// and none are excluded.
///
/// If a polygon has both an include and an exclude flag, it will be excluded.
///
/// The way filtering works, a navigation mesh polygon must have at least one flag
/// set to ever be considered by a query. So a polygon with no flags will never
/// be considered.
///
/// Setting the include flags to 0 will result in all polygons being excluded.
///
/// <b>Custom Implementations</b>
///
/// DT_VIRTUAL_QUERYFILTER must be defined in order to extend this class.
///
/// Implement a custom query filter by overriding the virtual passFilter()
/// and getCost() functions. If this is done, both functions should be as
/// fast as possible. Use cached local copies of data rather than accessing
/// your own objects where possible.
///
/// Custom implementations do not need to adhere to the flags or cost logic
/// used by the default implementation.
///
/// In order for A* searches to work properly, the cost should be proportional to
/// the travel distance. Implementing a cost modifier less than 1.0 is likely
/// to lead to problems during pathfinding.
///
/// @see dtNavMeshQuery
///
// @class dtQueryFilter
//
// <b>The Default Implementation</b>
//
// At construction: All area costs default to 1.0. All flags are included
// and none are excluded.
//
// If a polygon has both an include and an exclude flag, it will be excluded.
//
// The way filtering works, a navigation mesh polygon must have at least one flag
// set to ever be considered by a query. So a polygon with no flags will never
// be considered.
//
// Setting the include flags to 0 will result in all polygons being excluded.
//
// <b>Custom Implementations</b>
//
// DT_VIRTUAL_QUERYFILTER must be defined in order to extend this class.
//
// Implement a custom query filter by overriding the virtual passFilter()
// and getCost() functions. If this is done, both functions should be as
// fast as possible. Use cached local copies of data rather than accessing
// your own objects where possible.
//
// Custom implementations do not need to adhere to the flags or cost logic
// used by the default implementation.
//
// In order for A* searches to work properly, the cost should be proportional to
// the travel distance. Implementing a cost modifier less than 1.0 is likely
// to lead to problems during pathfinding.
//
// @see dtNavMeshQuery
//
using System;
using System.Diagnostics;
@@ -49,7 +49,7 @@ public static partial class Detour
const float H_SCALE = 0.999f; // Search heuristic scale.
/// Defines polygon filtering and traversal costs for navigation mesh query operations.
/// @ingroup detour
// @ingroup detour
public class dtQueryFilter
{
public float[] m_areaCost = new float[DT_MAX_AREAS]; //< Cost per area type. (Used by default implementation.)
@@ -91,12 +91,12 @@ public static partial class Detour
return dtVdist(pa, pb) * m_areaCost[curPoly.getArea()];
}
/// @name Getters and setters for the default implementation data.
// @name Getters and setters for the default implementation data.
///@{
/// Returns the traversal cost of the area.
/// @param[in] i The id of the area.
/// @returns The traversal cost of the area.
// @returns The traversal cost of the area.
public float getAreaCost(int i)
{
return m_areaCost[i];
@@ -119,7 +119,7 @@ public static partial class Detour
}
/// Sets the include flags for the filter.
/// @param[in] flags The new flags.
// @param[in] flags The new flags.
public void setIncludeFlags(ushort flags)
{
m_includeFlags = flags;
@@ -134,7 +134,7 @@ public static partial class Detour
}
/// Sets the exclude flags for the filter.
/// @param[in] flags The new flags.
// @param[in] flags The new flags.
public void setExcludeFlags(ushort flags)
{
m_excludeFlags = flags;
@@ -143,7 +143,7 @@ public static partial class Detour
//////////////////////////////////////////////////////////////////////////////////////////
/// @class dtNavMeshQuery
// @class dtNavMeshQuery
/// Provides the ability to perform pathfinding related queries against
/// a navigation mesh.
///
@@ -159,8 +159,8 @@ public static partial class Detour
/// considered impassable. A @e portal is a passable segment between polygons.
/// A portal may be treated as a wall based on the dtQueryFilter used for a query.
///
/// @see dtNavMesh, dtQueryFilter, #dtAllocNavMeshQuery(), #dtAllocNavMeshQuery()
/// @ingroup detour
// @see dtNavMesh, dtQueryFilter, #dtAllocNavMeshQuery(), #dtAllocNavMeshQuery()
// @ingroup detour
public class dtNavMeshQuery
{
private dtNavMesh m_nav; //< Pointer to navmesh data.
@@ -201,7 +201,7 @@ public static partial class Detour
{
}
/// @par
// @par
///
/// Must be the first function called after construction, before other
/// functions are used.
@@ -209,8 +209,8 @@ public static partial class Detour
/// This function can be used multiple times.
/// Initializes the query object.
/// @param[in] nav Pointer to the dtNavMesh object to use for all queries.
/// @param[in] maxNodes Maximum number of search nodes. [Limits: 0 < value <= 65536]
/// @returns The status flags for the query.
/// @param[in] maxNodes Maximum number of search nodes. [Limits: 0 &lt; value &lt;= 65536]
// @returns The status flags for the query.
public dtStatus init(dtNavMesh nav, int maxNodes)
{
m_nav = nav;
@@ -264,7 +264,7 @@ public static partial class Detour
return DT_SUCCESS;
}
/// @name Standard Pathfinding Functions
// @name Standard Pathfinding Functions
public delegate float randomFloatGenerator();
@@ -274,7 +274,7 @@ public static partial class Detour
/// @param[in] frand Function returning a random number [0..1).
/// @param[out] randomRef The reference id of the random location.
/// @param[out] randomPt The random location.
/// @returns The status flags for the query.
// @returns The status flags for the query.
public dtStatus findRandomPoint(dtQueryFilter filter, randomFloatGenerator frand, ref dtPolyRef randomRef, ref float[] randomPt)
{
Debug.Assert(m_nav != null);
@@ -377,7 +377,7 @@ public static partial class Detour
/// @param[in] frand Function returning a random number [0..1).
/// @param[out] randomRef The reference id of the random location.
/// @param[out] randomPt The random location. [(x, y, z)]
/// @returns The status flags for the query.
// @returns The status flags for the query.
public dtStatus findRandomPointAroundCircle(dtPolyRef startRef, float[] centerPos, float radius, dtQueryFilter filter, randomFloatGenerator frand, ref dtPolyRef randomRef, ref float[] randomPt)
{
Debug.Assert(m_nav != null);
@@ -574,12 +574,12 @@ public static partial class Detour
/// @param[in] pos The position to check. [(x, y, z)]
/// @param[out] closest The closest point on the polygon. [(x, y, z)]
/// @param[out] posOverPoly True of the position is over the polygon.
/// @returns The status flags for the query.
/// @par
// @returns The status flags for the query.
// @par
///
/// Uses the detail polygons to find the surface height. (Most accurate.)
///
/// @p pos does not have to be within the bounds of the polygon or navigation mesh.
// @p pos does not have to be within the bounds of the polygon or navigation mesh.
///
/// See closestPointOnPolyBoundary() for a limited but faster option.
///
@@ -693,8 +693,8 @@ public static partial class Detour
/// @param[in] ref The reference id to the polygon.
/// @param[in] pos The position to check. [(x, y, z)]
/// @param[out] closest The closest point. [(x, y, z)]
/// @returns The status flags for the query.
/// @par
// @returns The status flags for the query.
// @par
///
/// Much faster than closestPointOnPoly().
///
@@ -703,7 +703,7 @@ public static partial class Detour
///
/// The height of @p closest will be the polygon boundary. The height detail is not used.
///
/// @p pos does not have to be within the bounds of the polybon or the navigation mesh.
// @p pos does not have to be within the bounds of the polybon or the navigation mesh.
///
public dtStatus closestPointOnPolyBoundary(dtPolyRef polyRef, float[] pos, float[] closest)
{
@@ -758,8 +758,8 @@ public static partial class Detour
/// @param[in] ref The reference id of the polygon.
/// @param[in] pos A position within the xz-bounds of the polygon. [(x, y, z)]
/// @param[out] height The height at the surface of the polygon.
/// @returns The status flags for the query.
/// @par
// @returns The status flags for the query.
// @par
///
/// Will return #DT_FAILURE if the provided position is outside the xz-bounds
/// of the polygon.
@@ -827,8 +827,8 @@ public static partial class Detour
return DT_FAILURE | DT_INVALID_PARAM;
}
/// @}
/// @name Local Query Functions
// @}
// @name Local Query Functions
///@{
/// Finds the polygon nearest to the specified center point.
@@ -837,14 +837,14 @@ public static partial class Detour
/// @param[in] filter The polygon filter to apply to the query.
/// @param[out] nearestRef The reference id of the nearest polygon.
/// @param[out] nearestPt The nearest point on the polygon. [opt] [(x, y, z)]
/// @returns The status flags for the query.
/// @par
// @returns The status flags for the query.
// @par
///
/// @note If the search box does not intersect any polygons the search will
// @note If the search box does not intersect any polygons the search will
/// return #DT_SUCCESS, but @p nearestRef will be zero. So if in doubt, check
/// @p nearestRef before using @p nearestPt.
// @p nearestRef before using @p nearestPt.
///
/// @warning This function is not suitable for large area searches. If the search
// @warning This function is not suitable for large area searches. If the search
/// extents overlaps more than 128 polygons it may return an invalid result.
///
public dtStatus findNearestPoly(float[] center, float[] extents, dtQueryFilter filter, ref dtPolyRef nearestRef, ref float[] nearestPt)
@@ -1014,11 +1014,11 @@ public static partial class Detour
/// @param[out] polys The reference ids of the polygons that overlap the query box.
/// @param[out] polyCount The number of polygons in the search result.
/// @param[in] maxPolys The maximum number of polygons the search result can hold.
/// @returns The status flags for the query.
/// @par
// @returns The status flags for the query.
// @par
///
/// If no polygons are found, the function will return #DT_SUCCESS with a
/// @p polyCount of zero.
// @p polyCount of zero.
///
/// If @p polys is too small to hold the entire result set, then the array will
/// be filled to capacity. The method of choosing which polygons from the
@@ -1073,7 +1073,7 @@ public static partial class Detour
/// [(polyRef) * @p pathCount]
/// @param[out] pathCount The number of polygons returned in the @p path array.
/// @param[in] maxPath The maximum number of polygons the @p path array can hold. [Limit: >= 1]
/// @par
// @par
///
/// If the end polygon cannot be reached through the navigation graph,
/// the last polygon in the path will be the nearest the end polygon.
@@ -1298,7 +1298,7 @@ public static partial class Detour
}
///@}
/// @name Sliced Pathfinding Functions
// @name Sliced Pathfinding Functions
/// Common use case:
/// -# Call initSlicedFindPath() to initialize the sliced path query.
/// -# Call updateSlicedFindPath() until it returns complete.
@@ -1311,10 +1311,10 @@ public static partial class Detour
/// @param[in] startPos A position within the start polygon. [(x, y, z)]
/// @param[in] endPos A position within the end polygon. [(x, y, z)]
/// @param[in] filter The polygon filter to apply to the query.
/// @returns The status flags for the query.
/// @par
// @returns The status flags for the query.
// @par
///
/// @warning Calling any non-slice methods before calling finalizeSlicedFindPath()
// @warning Calling any non-slice methods before calling finalizeSlicedFindPath()
/// or finalizeSlicedFindPathPartial() may result in corrupted data!
///
/// The @p filter pointer is stored and used for the duration of the sliced
@@ -1371,7 +1371,7 @@ public static partial class Detour
/// Updates an in-progress sliced path query.
/// @param[in] maxIter The maximum number of iterations to perform.
/// @param[out] doneIters The actual number of iterations completed. [opt]
/// @returns The status flags for the query.
// @returns The status flags for the query.
public dtStatus updateSlicedFindPath(int maxIter, ref int doneIters)
{
if (!dtStatusInProgress(m_query.status))
@@ -1557,7 +1557,7 @@ public static partial class Detour
/// [(polyRef) * @p pathCount]
/// @param[out] pathCount The number of polygons returned in the @p path array.
/// @param[in] maxPath The max number of polygons the path array can hold. [Limit: >= 1]
/// @returns The status flags for the query.
// @returns The status flags for the query.
public dtStatus finalizeSlicedFindPath(dtPolyRef[] path, ref int pathCount, int maxPath)
{
pathCount = 0;
@@ -1630,7 +1630,7 @@ public static partial class Detour
/// [(polyRef) * @p pathCount]
/// @param[out] pathCount The number of polygons returned in the @p path array.
/// @param[in] maxPath The max number of polygons the @p path array can hold. [Limit: >= 1]
/// @returns The status flags for the query.
// @returns The status flags for the query.
public dtStatus finalizeSlicedFindPathPartial(dtPolyRef[] existing, int existingSize, dtPolyRef[] path, ref int pathCount, int maxPath)
{
pathCount = 0;
@@ -1801,8 +1801,8 @@ public static partial class Detour
/// @param[out] straightPathCount The number of points in the straight path.
/// @param[in] maxStraightPath The maximum number of points the straight path arrays can hold. [Limit: > 0]
/// @param[in] options Query options. (see: #dtStraightPathOptions)
/// @returns The status flags for the query.
/// @par
// @returns The status flags for the query.
// @par
///
/// This method peforms what is often called 'string pulling'.
///
@@ -2050,17 +2050,17 @@ public static partial class Detour
/// @param[out] visited The reference ids of the polygons visited during the move.
/// @param[out] visitedCount The number of polygons visited during the move.
/// @param[in] maxVisitedSize The maximum number of polygons the @p visited array can hold.
/// @returns The status flags for the query.
/// @par
// @returns The status flags for the query.
// @par
///
/// This method is optimized for small delta movement and a small number of
/// polygons. If used for too great a distance, the result set will form an
/// incomplete path.
///
/// @p resultPos will equal the @p endPos if the end is reached.
// @p resultPos will equal the @p endPos if the end is reached.
/// Otherwise the closest reachable position will be returned.
///
/// @p resultPos is not projected onto the surface of the navigation
// @p resultPos is not projected onto the surface of the navigation
/// mesh. Use #getPolyHeight if this is needed.
///
/// This method treats the end position in the same manner as
@@ -2404,8 +2404,8 @@ public static partial class Detour
/// @param[out] path The reference ids of the visited polygons. [opt]
/// @param[out] pathCount The number of visited polygons. [opt]
/// @param[in] maxPath The maximum number of polygons the @p path array can hold.
/// @returns The status flags for the query.
/// @par
// @returns The status flags for the query.
// @par
///
/// This method is meant to be used for quick, short distance checks.
///
@@ -2421,12 +2421,12 @@ public static partial class Detour
/// If the hit parameter is zero, then the start position is on the wall that
/// was hit and the value of @p hitNormal is undefined.
///
/// If 0 < t < 1.0 then the following applies:
/// If 0 &lt; t &lt; 1.0 then the following applies:
///
/// @code
// @code
/// distanceToHitBorder = distanceToEndPosition * t
/// hitPoint = startPos + (endPos - startPos) * t
/// @endcode
// @endcode
///
/// <b>Use Case Restriction</b>
///
@@ -2628,8 +2628,8 @@ public static partial class Detour
}
///@}
/// @name Dijkstra Search Functions
/// @{
// @name Dijkstra Search Functions
// @{
/// Finds the polygons along the navigation graph that touch the specified circle.
/// @param[in] startRef The reference id of the polygon where the search starts.
@@ -2642,8 +2642,8 @@ public static partial class Detour
/// @param[out] resultCost The search cost from @p centerPos to the polygon. [opt]
/// @param[out] resultCount The number of polygons found. [opt]
/// @param[in] maxResult The maximum number of polygons the result arrays can hold.
/// @returns The status flags for the query.
/// @par
// @returns The status flags for the query.
// @par
///
/// At least one result array must be provided.
///
@@ -2838,8 +2838,8 @@ public static partial class Detour
/// @param[out] resultCost The search cost from the centroid point to the polygon. [opt]
/// @param[out] resultCount The number of polygons found.
/// @param[in] maxResult The maximum number of polygons the result arrays can hold.
/// @returns The status flags for the query.
/// @par
// @returns The status flags for the query.
// @par
///
/// The order of the result set is from least to highest cost.
///
@@ -3031,8 +3031,8 @@ public static partial class Detour
/// Zero if a result polygon has no parent. [opt]
/// @param[out] resultCount The number of polygons found.
/// @param[in] maxResult The maximum number of polygons the result arrays can hold.
/// @returns The status flags for the query.
/// @par
// @returns The status flags for the query.
// @par
///
/// This method is optimized for a small search radius and small number of result
/// polygons.
@@ -3276,8 +3276,8 @@ public static partial class Detour
/// Or zero if the segment is a wall. [opt] [(parentRef) * @p segmentCount]
/// @param[out] segmentCount The number of segments returned.
/// @param[in] maxSegments The maximum number of segments the result arrays can hold.
/// @returns The status flags for the query.
/// @par
// @returns The status flags for the query.
// @par
///
/// If the @p segmentRefs parameter is provided, then all polygon segments will be returned.
/// Otherwise only the wall segments are returned.
@@ -3443,12 +3443,12 @@ public static partial class Detour
/// @param[out] hitPos The nearest position on the wall that was hit. [(x, y, z)]
/// @param[out] hitNormal The normalized ray formed from the wall point to the
/// source point. [(x, y, z)]
/// @returns The status flags for the query.
/// @par
// @returns The status flags for the query.
// @par
///
/// @p hitPos is not adjusted using the height detail data.
// @p hitPos is not adjusted using the height detail data.
///
/// @p hitDist will equal the search radius if there is no wall within the
// @p hitDist will equal the search radius if there is no wall within the
/// radius. In this case the values of @p hitPos and @p hitNormal are
/// undefined.
///
@@ -3643,9 +3643,9 @@ public static partial class Detour
return status;
}
/// @}
/// @name Miscellaneous Functions
/// @{
// @}
// @name Miscellaneous Functions
// @{
/// Returns true if the polygon reference is valid and passes the filter restrictions.
/// @param[in] ref The polygon reference to check.
@@ -3666,8 +3666,8 @@ public static partial class Detour
/// Returns true if the polygon reference is in the closed list.
/// @param[in] ref The reference id of the polygon to check.
/// @returns True if the polygon is in closed list.
/// @par
// @returns True if the polygon is in closed list.
// @par
///
/// The closed list is the list of polygons that were fully evaluated during
/// the last navigation graph search. (A* or Dijkstra)
@@ -3680,7 +3680,7 @@ public static partial class Detour
}
/// Gets the navigation mesh the query object is using.
/// @return The navigation mesh the query object is using.
// @return The navigation mesh the query object is using.
public dtNavMesh getAttachedNavMesh()
{
return m_nav;
+1 -1
View File
@@ -51,7 +51,7 @@ namespace Framework.Serialization
return CreateObject<T>(Encoding.UTF8.GetBytes(split ? jsonData.Split(new[] { ':' }, 2)[1] : jsonData));
}
public static T CreateObject<T>(byte[] jsonData) => (T)CreateObject<T>(new MemoryStream(jsonData));
public static T CreateObject<T>(byte[] jsonData) => CreateObject<T>(new MemoryStream(jsonData));
public static object CreateObject(Stream jsonData, Type type)
{
+11 -8
View File
@@ -66,6 +66,9 @@ namespace System.Collections.Generic
}
public static KeyValuePair<TKey, TValue> Find<TKey, TValue>(this IDictionary<TKey, TValue> dict, TKey key)
{
if (!dict.ContainsKey(key))
return default(KeyValuePair<TKey, TValue>);
return new KeyValuePair<TKey, TValue>(key, dict[key]);
}
@@ -113,17 +116,17 @@ namespace System.Collections.Generic
}
}
public static void RandomResize<T>(this ICollection<T> list, Predicate<T> predicate, uint size)
public static void RandomResize<T>(this List<T> list, Predicate<T> predicate, uint size)
{
List<T> listCopy = new List<T>();
foreach (var obj in list)
if (predicate(obj))
listCopy.Add(obj);
for (var i = 0; i < list.Count; ++i)
{
var obj = list[i];
if (!predicate(obj))
list.Remove(obj);
}
if (size != 0)
listCopy.Resize(size);
list = listCopy;
list.Resize(size);
}
public static T SelectRandom<T>(this IEnumerable<T> source)
+2 -2
View File
@@ -72,7 +72,7 @@ namespace System
for (int i = 0; i < length; i++)
{
int randValue = -1;
int randValue;
do
{
@@ -128,7 +128,7 @@ namespace System
public static BigInteger ToBigInteger<T>(this T value, bool isBigEndian = false)
{
var ret = BigInteger.Zero;
BigInteger ret;
switch (typeof(T).Name)
{
+2 -2
View File
@@ -100,9 +100,9 @@ public class RandomHelper
public static T RAND<T>(params T[] args)
{
int rand = IRand(0, args.Length - 1);
int randIndex = IRand(0, args.Length - 1);
return args[rand];
return args[randIndex];
}
}