コード例 #1
0
 public MyHighLevelPrimitive(MyHighLevelGroup parent, int index, Vector3 position)
 {
     m_parent = parent;
     m_neighbors = new List<int>(4);
     m_index = index;
     m_position = position;
     IsExpanded = false;
 }
コード例 #2
0
        public MyVoxelNavigationMesh(MyVoxelBase voxelMap, MyNavmeshCoordinator coordinator, Func<long> timestampFunction)
            : base(coordinator.Links, 16, timestampFunction)
        {
            m_voxelMap = voxelMap;
            m_cellSize = m_voxelMap.SizeInMetres / m_voxelMap.Storage.Geometry.CellsCount * (1 << NAVMESH_LOD);

            m_processedCells = new MyVector3ISet();
            m_markedForAddition = new MyVector3ISet();
            m_toAdd = new MyBinaryStructHeap<float, Vector3I>(128);

            m_connectionHelper = new MyVoxelConnectionHelper();
            m_navmeshCoordinator = coordinator;
            m_higherLevel = new MyHighLevelGroup(this, coordinator.HighLevelLinks, timestampFunction);
            m_higherLevelHelper = new MyVoxelHighLevelHelper(this);

            m_debugCellEdges = new Dictionary<ulong, List<DebugDrawEdge>>();

            voxelMap.Storage.RangeChanged += OnStorageChanged;
        }
コード例 #3
0
        public MyGridNavigationMesh(MyCubeGrid grid, MyNavmeshCoordinator coordinator, int triPrealloc = 32, Func<long> timestampFunction = null)
            : base(coordinator != null ? coordinator.Links : null, triPrealloc, timestampFunction)
        {
            m_connectionHelper = new Dictionary<EdgeIndex, int>();
            m_smallTriangleRegistry = new Dictionary<Vector3I, List<int>>();
            m_cubeSet = new MyVector3ISet();

            m_coordinator = coordinator;

            m_static = false;
            if (grid != null)
            {
                m_higherLevel = new MyHighLevelGroup(this, coordinator.HighLevelLinks, timestampFunction);
                m_higherLevelHelper = new MyGridHighLevelHelper(this, m_smallTriangleRegistry, new Vector3I(8, 8, 8));

                m_grid = grid;
                grid.OnBlockAdded += grid_OnBlockAdded;
                grid.OnBlockRemoved += grid_OnBlockRemoved;

                float divisor = 1.0f / grid.CubeBlocks.Count;
                Vector3 center = Vector3.Zero;

                foreach (var block in grid.CubeBlocks)
                {
                    OnBlockAddedInternal(block);
                    center += block.Position * grid.GridSize * divisor;
                }
            }
        }