示例#1
0
        /// <summary>
        /// Builds a contour set from the region outlines in the provided <see cref="CompactHeightfield"/>.
        /// </summary>
        /// <remarks>
        /// <para>
        /// The raw contours will match the region outlines exactly.  The edgeMaxDeviation 
        /// and maxEdgeLength parameters control how closely the simplified contours will match 
        /// the raw contours.
        /// </para>
        /// <para>
        /// Simplified contours are generated such that the vertices for portals between areas 
        /// match up.  (They are considered mandatory vertices.)
        /// </para>
        /// <para>
        /// Setting maxEdgeLength to zero will disabled the feature.
        /// </para>
        /// </remarks>
        /// <param name="context">The context to use for the build.</param>
        /// <param name="field">The field to use for the build.(Must have region data.)</param>
        /// <param name="edgeMaxDeviation">
        /// The maximum distance a simplified edge may deviate from the raw contour's vertices.
        /// [Limit: >= 0]
        /// </param>
        /// <param name="maxEdgeLength">
        /// The maximum allowed length of a simplified edge. [Limit: >= 0]
        /// </param>
        /// <param name="flags">The build flags.</param>
        /// <returns>The contour set, or null on failure.</returns>
        public static ContourSet Build(BuildContext context, CompactHeightfield field
            , float edgeMaxDeviation, int maxEdgeLength, ContourBuildFlags flags)
        {
            if (context == null || field == null || field.IsDisposed
                || edgeMaxDeviation < 0
                || maxEdgeLength < 0)
            {
                return null;
            }

            ContourSetEx root = new ContourSetEx();

            if (ContourSetEx.nmcsBuildSet(context.root, field
                , edgeMaxDeviation, maxEdgeLength
                , root
                , flags))
            {
                return new ContourSet(root);
            }

            return null;
        }
示例#2
0
 private ContourSet(ContourSetEx root)
 {
     this.root = root;
 }
示例#3
0
 public static extern bool rcpmBuildFromContourSet(IntPtr context
                                                   , [In] ContourSetEx cset
                                                   , int maxVertsPerPoly
                                                   , ref PolyMeshEx polyMesh
                                                   , ref int maxVerts);
示例#4
0
 public static extern bool nmcsGetContour([In] ContourSetEx cset
                                          , int index
                                          , [In, Out] Contour result);
示例#5
0
 public static extern void nmcsFreeSetData([In, Out] ContourSetEx cset);
示例#6
0
 public static extern bool nmcsBuildSet(IntPtr context
                                        , [In] CompactHeightfield chf
                                        , float maxError
                                        , int maxEdgeLen
                                        , [In, Out] ContourSetEx cset
                                        , ContourBuildFlags flags);