示例#1
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);
        }
        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
        void IMyClipmapCell.UpdateMesh(MyRenderMessageUpdateClipmapCell msg)
        {
            Dispose();
            m_metadata = msg.Metadata;
            foreach (var batch in msg.Batches)
            {
                AddBatch(batch);
            }

            SetDirty();
            UpdateWorldAABB();
            MyRender.UpdateRenderObject(this, true);
        }
        void IMyClipmapCell.UpdateMesh(MyRenderMessageUpdateClipmapCell msg)
        {
            Dispose();
            m_offset    = msg.PositionOffset;
            m_scale     = msg.PositionScale;
            m_localAabb = msg.MeshAabb;
            foreach (var batch in msg.Batches)
            {
                AddBatch(batch);
            }

            SetDirty();
            UpdateWorldAABB();
            MyRender.UpdateRenderObject(this, true);
        }
        void IMyClipmapCell.UpdateMesh(MyRenderMessageUpdateClipmapCell msg)
        {
            MyMeshes.UpdateVoxelCell(Mesh, msg.Batches);

            m_scale       = msg.PositionScale;
            m_translation = msg.PositionOffset;

            var matrix = (Matrix)(Matrix.CreateScale(m_scale) * Matrix.CreateTranslation(m_translation) * m_worldMatrix);

            m_actor.SetMatrix(ref matrix);
            m_actor.GetRenderable().SetVoxelLod(m_lod);

            m_actor.SetAabb(msg.MeshAabb.Transform((Matrix)m_worldMatrix));

            (m_actor.GetComponent(MyActorComponentEnum.Foliage) as MyFoliageComponent).InvalidateStreams();
            m_actor.MarkRenderDirty();
        }
        void IMyClipmapCell.UpdateMesh(MyRenderMessageUpdateClipmapCell msg)
        {
            MyMeshes.UpdateVoxelCell(Mesh, msg.Batches);

            m_scale = msg.PositionScale;
            m_translation = msg.PositionOffset;

            var matrix = (Matrix)(Matrix.CreateScale(m_scale) * Matrix.CreateTranslation(m_translation) * m_worldMatrix);

            m_actor.SetMatrix(ref matrix);
            m_actor.GetRenderable().SetVoxelLod(m_lod);

            m_actor.SetAabb(msg.MeshAabb.Transform((Matrix)m_worldMatrix));

            (m_actor.GetComponent(MyActorComponentEnum.Foliage) as MyFoliageComponent).InvalidateStreams();
            m_actor.MarkRenderDirty();
        }
        void IMyClipmapCell.UpdateMesh(MyRenderMessageUpdateClipmapCell msg)
        {
            Dispose();
            m_cellOffset = msg.PositionOffset;
            m_cellScale = msg.PositionScale;
            m_localAabb = msg.MeshAabb;
            foreach (var batch in msg.Batches)
            {
                AddBatch(batch);
            }

            SetDirty();
            UpdateWorldAABB();
            MyRender.UpdateRenderObject(this, true);
        }
示例#8
0
 internal void UpdateCell(MyRenderMessageUpdateClipmapCell msg)
 {
     m_clipmapBase.UpdateCell(msg);
 }
示例#9
0
 public void UpdateMesh(IMyClipmapCell cell, MyRenderMessageUpdateClipmapCell msg)
 {
     cell.UpdateMesh(msg);
 }
示例#10
0
            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;
                }
            }
示例#11
0
 public void UpdateCell(MyRenderMessageUpdateClipmapCell msg)
 {
     m_lodLevels[msg.Cell.Lod].SetCellMesh(msg);
     m_requestCollector.RequestFulfilled(msg.Cell.PackId64());
     m_updateClipping = true;
 }
        void IMyClipmapCell.UpdateMesh(MyRenderMessageUpdateClipmapCell msg)
        {
            Dispose();
            m_metadata = msg.Metadata;
            foreach (var batch in msg.Batches)
            {
                AddBatch(batch);
            }

            SetDirty();
            UpdateWorldAABB();
            MyRender.UpdateRenderObject(this, true);
        }
示例#13
0
 public void UpdateMesh(IMyClipmapCell cell, MyRenderMessageUpdateClipmapCell msg)
 {
     cell.UpdateMesh(msg);
 }
 internal void UpdateCell(MyRenderMessageUpdateClipmapCell msg)
 {
     m_clipmapBase.UpdateCell(msg);
 }
示例#15
0
            internal void SetCellMesh(MyRenderMessageUpdateClipmapCell msg)
            {
                var cellId = msg.Metadata.Cell.PackId64();
                MyClipmap_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;
                }
            }