コード例 #1
0
 public void create_compact_heightfield()
 {
     using (var ctx = new RecastContext())
     {
         var mesh = GetInputGeom(ctx);
         var chf  = ctx.CreateCompactHeightfield(_config, mesh);
         Assert.IsNotNull(chf);
     }
 }
コード例 #2
0
 public void create_polymesh_detail()
 {
     using (var ctx = new RecastContext())
     {
         var mesh           = GetInputGeom(ctx);
         var chf            = ctx.CreateCompactHeightfield(_config, mesh);
         var polyMesh       = ctx.CreatePolyMesh(_config, chf);
         var polyMeshDetail = ctx.CreatePolyMeshDetail(_config, polyMesh, chf);
     }
 }
コード例 #3
0
 public void create_navmesh()
 {
     using (var ctx = new RecastContext())
     {
         var mesh           = GetInputGeom(ctx);
         var chf            = ctx.CreateCompactHeightfield(_config, mesh);
         var polyMesh       = ctx.CreatePolyMesh(_config, chf);
         var polyMeshDetail = ctx.CreatePolyMeshDetail(_config, polyMesh, chf);
         var navMeshData    = ctx.CreateNavMeshData(_config, polyMeshDetail, polyMesh, mesh, 0, 0,
                                                    BuildSettings.agentHeight, BuildSettings.agentRadius, BuildSettings.agentMaxClimb);
         var navMesh = ctx.CreateNavMesh(navMeshData);
         Assert.IsNotNull(navMesh);
     }
 }
コード例 #4
0
        private NavMesh CreateNavMesh(RecastContext ctx)
        {
            var mesh = ctx.LoadInputGeom(TestUtils.ResolveResource("Resources/Tile_+007_+006_L21.obj"), true);

            Assert.IsNotNull(mesh);
            ctx.CalcGridSize(ref _config, mesh);
            var chf            = ctx.CreateCompactHeightfield(_config, mesh);
            var polyMesh       = ctx.CreatePolyMesh(_config, chf);
            var polyMeshDetail = ctx.CreatePolyMeshDetail(_config, polyMesh, chf);
            var navMeshData    = ctx.CreateNavMeshData(_config, polyMeshDetail, polyMesh, mesh, 0, 0,
                                                       BuildSettings.agentHeight, BuildSettings.agentRadius,
                                                       BuildSettings.agentMaxClimb);

            return(ctx.CreateNavMesh(navMeshData));
        }
コード例 #5
0
        public void create_navmesh_data()
        {
            using (var ctx = new RecastContext())
            {
                var mesh           = GetInputGeom(ctx);
                var chf            = ctx.CreateCompactHeightfield(_config, mesh);
                var polyMesh       = ctx.CreatePolyMesh(_config, chf);
                var polyMeshDetail = ctx.CreatePolyMeshDetail(_config, polyMesh, chf);
                var navMeshData    = ctx.CreateNavMeshData(_config, polyMeshDetail, polyMesh, mesh, 0, 0,
                                                           BuildSettings.agentHeight, BuildSettings.agentRadius, BuildSettings.agentMaxClimb);
                // TODO: This is different to Java!!
                Assert.AreEqual(114764, navMeshData.size);

                var bytes = navMeshData.GetData();
                Assert.AreEqual(bytes.Length, navMeshData.size);
            }
        }
コード例 #6
0
        public void disposes_work()
        {
            var ctx            = new RecastContext();
            var mesh           = GetInputGeom(ctx);
            var chf            = ctx.CreateCompactHeightfield(_config, mesh);
            var polyMesh       = ctx.CreatePolyMesh(_config, chf);
            var polyMeshDetail = ctx.CreatePolyMeshDetail(_config, polyMesh, chf);
            var navMeshData    = ctx.CreateNavMeshData(_config, polyMeshDetail, polyMesh, mesh, 0, 0,
                                                       BuildSettings.agentHeight, BuildSettings.agentRadius, BuildSettings.agentMaxClimb);
            var navMesh      = ctx.CreateNavMesh(navMeshData);
            var navMeshQuery = ctx.CreateNavMeshQuery(navMesh);

            Assert.IsNotNull(navMeshQuery);

            navMeshQuery.Dispose();
            navMesh.Dispose();
            polyMeshDetail.Dispose();
            polyMesh.Dispose();
            chf.Dispose();
            mesh.Dispose();
            ctx.Dispose();
        }