コード例 #1
0
ファイル: MyClipmap.cs プロジェクト: Tyrsis/SpaceEngineers-1
            internal void SetCellMesh(MyRenderMessageUpdateClipmapCell msg)
            {
                var      cellId = msg.Cell.PackId64();
                CellData data;

                if (m_storedCellData.TryGetValue(cellId, out data))
                {
                    if (data.Cell == null && msg.Batches.Count != 0)
                    {
                        data.Cell = m_parent.m_cellHandler.CreateCell(m_parent.m_scaleGroup, msg.Cell, ref m_parent.m_worldMatrix);
                        m_nonEmptyCells[cellId] = data;
                    }
                    else if (data.Cell != null && msg.Batches.Count == 0)
                    {
                        RemoveFromScene(cellId, data);
                        m_nonEmptyCells.Remove(cellId);
                        m_parent.m_cellHandler.DeleteCell(data.Cell);
                        data.Cell = null;
                    }

                    if (data.Cell != null)
                    {
                        data.Cell.UpdateMesh(msg);
                    }
                    data.State     = CellState.Loaded;
                    data.WasLoaded = true;
                }
            }
コード例 #2
0
        void IMyClipmapCell.UpdateMesh(MyRenderMessageUpdateClipmapCell msg)
        {
            MyMeshes.UpdateVoxelCell(m_mesh, msg.Metadata, msg.Batches);

            m_scale = msg.Metadata.PositionScale;
            m_translation = msg.Metadata.PositionOffset;
            m_localAabb = msg.Metadata.LocalAabb;

            UpdateActorInfo(true);
        }
コード例 #3
0
ファイル: MyClipmap.cs プロジェクト: Tyrsis/SpaceEngineers-1
 public void UpdateCell(MyRenderMessageUpdateClipmapCell msg)
 {
     m_lodLevels[msg.Cell.Lod].SetCellMesh(msg);
     m_requestCollector.RequestFulfilled(msg.Cell.PackId64());
     m_updateClipping = true;
 }
コード例 #4
0
            internal void SetCellMesh(MyRenderMessageUpdateClipmapCell msg)
            {
                var      cellId = msg.Metadata.Cell.PackId64();
                CellData data;
                var      clipmapCellId = MyCellCoord.GetClipmapCellHash(m_clipmap.Id, cellId);

                //  MyCellCoord cellc = new MyCellCoord();
                //  cellc.SetUnpack(cellId);

                //MyLog.Default.WriteLine("SetCellMesh Lod: " + cellc.Lod + " Coord: " + cellc.CoordInLod);

                if (m_storedCellData.TryGetValue(cellId, out data))
                {
                    PendingCacheCellData.Remove(clipmapCellId);

                    if (data.State == CellState.Invalid)
                    {
//                        MyLog.Default.WriteLine("Invalid");
                        //Cell was invalidated while calculating from old data
                        return;
                    }

                    if (data.Cell == null && msg.Batches.Count != 0)
                    {
                        //MyLog.Default.WriteLine("added to nonempty");
                        data.Cell = m_clipmap.m_cellHandler.CreateCell(m_clipmap.m_scaleGroup, msg.Metadata.Cell, ref m_clipmap.m_worldMatrix);
                        System.Diagnostics.Debug.Assert(data.Cell != null, "Cell not created");
                        if (data.Cell != null)
                        {
                            if (data.Cell.IsValid())
                            {
                                data.CellHandler        = m_clipmap.m_cellHandler;
                                m_nonEmptyCells[cellId] = data;
                            }
                        }
                    }
                    else if (data.Cell != null && msg.Batches.Count == 0)
                    {
                        //MyLog.Default.WriteLine("removed");
                        RemoveFromScene(cellId, data);
                        m_nonEmptyCells.Remove(cellId);
                        m_clipmap.m_cellHandler.DeleteCell(data.Cell);
                        m_blendedCells.Remove(cellId);
                        data.Cell        = null;
                        data.CellHandler = null;
                        if (UseCache)
                        {
                            CellsCache.Remove(cellId);
                        }
                    }

                    if (data.Cell != null)
                    {
                        //MyLog.Default.WriteLine("mesh updated");
                        if (data.Cell.IsValid())
                        {
                            m_clipmap.m_cellHandler.UpdateMesh(data.Cell, msg);
                        }
                    }
                    data.State     = CellState.Loaded;
                    data.WasLoaded = true;
                }
                else
                if (PendingCacheCellData.TryGetValue(clipmapCellId, out data))
                {
                    if (msg.Batches.Count != 0)
                    {
                        data.Cell = m_clipmap.m_cellHandler.CreateCell(m_clipmap.m_scaleGroup, msg.Metadata.Cell, ref m_clipmap.m_worldMatrix);
                        m_clipmap.m_cellHandler.UpdateMesh(data.Cell, msg);
                        data.CellHandler = m_clipmap.m_cellHandler;
                    }

                    CellsCache.Write(clipmapCellId, data);
                    PendingCacheCellData.Remove(clipmapCellId);

                    data.State     = CellState.Loaded;
                    data.WasLoaded = true;
                }
            }
コード例 #5
0
 public void UpdateMesh(IMyClipmapCell cell, MyRenderMessageUpdateClipmapCell msg)
 {
     cell.UpdateMesh(msg);
 }