Ejemplo n.º 1
0
            private void RemoveFromScene(UInt64 key, CellData data)
            {
                // data = data ?? m_storedCellData[key];

                if (data.InScene)
                {
                    Debug.Assert(data.Cell != null);

                    if (MyClipmap.UseDithering)
                    {
                        CellBlendData blendData;

                        if (!m_blendedCells.TryGetValue(key, out blendData))
                        {
                            blendData          = new CellBlendData();
                            blendData.CellData = data;
                            System.Diagnostics.Debug.Assert(blendData.CellData.Cell.IsValid(), "Invalid cell!");
                            blendData.TimeAdded = m_clipmap.m_cellHandler.GetTime();
                            blendData.State     = BlendState.Removing;
                            m_blendedCells.Add(key, blendData);
                            data.Cell.SetDithering(0);
                        }
                        else
                        {
                            if (blendData.State == BlendState.Adding)
                            {
                                blendData.UndoAfterFinish = true;
                            }
                            else
                            {
                                blendData.UndoAfterFinish = false;
                                //blendData.CellData.DeleteAfterRemove = false;
                            }

                            System.Diagnostics.Debug.Assert(blendData.CellData.Cell.IsValid(), "Invalid cell!");
                            m_blendedCells[key] = blendData;
                        }
                    }
                    else
                    {
                        m_clipmap.m_cellHandler.RemoveFromScene(data.Cell);
                        data.InScene = false;
                    }
                }
            }
Ejemplo n.º 2
0
            private void RemoveFromScene(UInt64 key, MyClipmap_CellData data = null)
            {
               // data = data ?? m_storedCellData[key];

                if (data.InScene)
                {
                    Debug.Assert(data.Cell != null);

                    if (MyClipmap.UseDithering)
                    {
                        CellBlendData blendData;

                        if (!m_blendedCells.TryGetValue(key, out blendData))
                        {
                            blendData = new CellBlendData();
                            blendData.CellData = data;
                            System.Diagnostics.Debug.Assert(blendData.CellData.Cell.IsValid(), "Invalid cell!");
                            blendData.TimeAdded = m_clipmap.m_cellHandler.GetTime();
                            blendData.State = BlendState.Removing;
                            m_blendedCells.Add(key, blendData);
                            data.Cell.SetDithering(0);
                        }
                        else
                        {
                            if (blendData.State == BlendState.Adding)
                                blendData.UndoAfterFinish = true;
                            else
                            {
                                blendData.UndoAfterFinish = false;
                                //blendData.CellData.DeleteAfterRemove = false;
                            }

                            System.Diagnostics.Debug.Assert(blendData.CellData.Cell.IsValid(), "Invalid cell!");
                            m_blendedCells[key] = blendData;
                        }
                    }
                    else
                    {
                        m_clipmap.m_cellHandler.RemoveFromScene(data.Cell);
                        data.InScene = false;
                    }
                }
            }
Ejemplo n.º 3
0
            private void AddToScene(UInt64 key, CellData data = null)
            {
                // data = data ?? m_storedCellData[key];
                CellBlendData blendData;

                bool inScene = data.InScene;

                if (!data.InScene && !data.ClippedOut)
                {
                    Debug.Assert(data.Cell != null, "Adding null cell");
                    if (data.Cell != null)
                    {
                        //System.Diagnostics.Debug.Assert(data.Cell.IsValid(), "Invalid cell!");
                        if (data.Cell.IsValid())
                        {
                            m_clipmap.m_cellHandler.AddToScene(data.Cell);
                            data.Cell.SetDithering(0);
                            data.InScene = true;
                        }
                    }
                }

                if (MyClipmap.UseDithering)
                {
                    if (!m_blendedCells.TryGetValue(key, out blendData))
                    {
                        if (!inScene && data.InScene)
                        {
                            blendData           = new CellBlendData();
                            blendData.CellData  = data;
                            blendData.TimeAdded = m_clipmap.m_cellHandler.GetTime();
                            blendData.State     = BlendState.Adding;
                            m_blendedCells.Add(key, blendData);
                            data.Cell.SetDithering(2);
                        }
                    }
                    else
                    {
                        //   System.Diagnostics.Debug.Assert(inScene, "We are blending something what was not in scene");

                        if (inScene)
                        {
                            if (!data.ClippedOut)
                            {
                                if (blendData.State == BlendState.Removing)
                                {
                                    blendData.State                      = BlendState.Adding;
                                    blendData.UndoAfterFinish            = false;
                                    blendData.CellData.DeleteAfterRemove = false;

                                    float newEndTime = m_clipmap.m_cellHandler.GetTime() - blendData.TimeAdded;

                                    blendData.TimeAdded = m_clipmap.m_cellHandler.GetTime() - CellsDitherTime;
                                }
                                else
                                {
                                    blendData.UndoAfterFinish = false;
                                }
                            }

                            m_blendedCells[key] = blendData;
                        }
                    }
                }
            }
Ejemplo n.º 4
0
            private void AddToScene(UInt64 key, MyClipmap_CellData data = null)
            {
               // data = data ?? m_storedCellData[key];
                CellBlendData blendData;

                bool inScene = data.InScene;
                if (!data.InScene && !data.ClippedOut)
                {
                    Debug.Assert(data.Cell != null, "Adding null cell");
                    if (data.Cell != null)
                    {
                        //System.Diagnostics.Debug.Assert(data.Cell.IsValid(), "Invalid cell!");
                        if (data.Cell.IsValid())
                        {
                            m_clipmap.m_cellHandler.AddToScene(data.Cell);
                            data.Cell.SetDithering(0);
                            data.InScene = true;
                        }
                    }
                }

                if (MyClipmap.UseDithering)
                {
                    if (!m_blendedCells.TryGetValue(key, out blendData))
                    {
                        if (!inScene && data.InScene)
                        {
                            blendData = new CellBlendData();
                            blendData.CellData = data;
                            blendData.TimeAdded = m_clipmap.m_cellHandler.GetTime();
                            blendData.State = BlendState.Adding;
                            m_blendedCells.Add(key, blendData);
                            data.Cell.SetDithering(2);
                        }
                    }
                    else
                    {
                     //   System.Diagnostics.Debug.Assert(inScene, "We are blending something what was not in scene");

                        if (inScene)
                        {
                            if (!data.ClippedOut)
                            {
                                if (blendData.State == BlendState.Removing)
                                {
                                    blendData.State = BlendState.Adding;
                                    blendData.UndoAfterFinish = false;
                                    blendData.CellData.DeleteAfterRemove = false;

                                    float newEndTime = m_clipmap.m_cellHandler.GetTime() - blendData.TimeAdded;

                                    blendData.TimeAdded = m_clipmap.m_cellHandler.GetTime() - CellsDitherTime;

                                }
                                else
                                    blendData.UndoAfterFinish = false;
                            }

                            m_blendedCells[key] = blendData;
                        }
                    }
                }
                           
            }