コード例 #1
0
ファイル: SgtTerrain.cs プロジェクト: dqchess/twin
        public void UpdateStates()
        {
            ValidateFaces();
            CalculateLocalValues();

            if (NegativeX != null)
            {
                NegativeX.UpdateStates();
            }
            if (NegativeY != null)
            {
                NegativeY.UpdateStates();
            }
            if (NegativeZ != null)
            {
                NegativeZ.UpdateStates();
            }
            if (PositiveX != null)
            {
                PositiveX.UpdateStates();
            }
            if (PositiveY != null)
            {
                PositiveY.UpdateStates();
            }
            if (PositiveZ != null)
            {
                PositiveZ.UpdateStates();
            }
        }
コード例 #2
0
ファイル: SgtTerrainFace.cs プロジェクト: dqchess/twin
        public void UpdateStates()
        {
            switch (State)
            {
            case StateType.Invalid:
            {
                UpdateInvalid();

                if (Split == true)
                {
                    UpdateInvalidChildren();
                }
            }
            break;

            case StateType.Visible:
            {
                var distance = GetDistance();

                // Split?
                if (distance < Terrain.LocalDistances[Depth])
                {
                    if (Split == false && CanSplit == true)
                    {
                        SplitNow();
                    }
                }
                // Unsplit?
                else
                {
                    if (Split == true && CanUnsplit == true)
                    {
                        UnsplitNow();
                    }
                }

                if (Split == true)
                {
                    ChildBL.UpdateStates();
                    ChildBR.UpdateStates();
                    ChildTL.UpdateStates();
                    ChildTR.UpdateStates();
                }
            }
            break;
            }
        }