コード例 #1
0
ファイル: SgtTerrain.cs プロジェクト: BackToGround/XGame
    public void UpdateMeshes()
    {
        if (Detail > 0)
        {
            if (NegativeX == null)
            {
                NegativeX = CreateFace(CubemapFace.NegativeX);
            }
            if (NegativeY == null)
            {
                NegativeY = CreateFace(CubemapFace.NegativeY);
            }
            if (NegativeZ == null)
            {
                NegativeZ = CreateFace(CubemapFace.NegativeZ);
            }
            if (PositiveX == null)
            {
                PositiveX = CreateFace(CubemapFace.PositiveX);
            }
            if (PositiveY == null)
            {
                PositiveY = CreateFace(CubemapFace.PositiveY);
            }
            if (PositiveZ == null)
            {
                PositiveZ = CreateFace(CubemapFace.PositiveZ);
            }

            UpdateShells();

            NegativeX.Mark();
            NegativeY.Mark();
            NegativeZ.Mark();
            PositiveX.Mark();
            PositiveY.Mark();
            PositiveZ.Mark();

            for (var i = 0; i < shells.Count; i++)
            {
                var shell  = shells[i];
                var detail = shell.Detail;

                NegativeX.Write(new SgtBoundsL(-detail, -detail, -detail, -detail + 1, detail, detail), shell, 0, i);
                NegativeY.Write(new SgtBoundsL(-detail, -detail, -detail, detail, -detail + 1, detail), shell, 1, i);
                NegativeZ.Write(new SgtBoundsL(-detail, -detail, -detail, detail, detail, -detail + 1), shell, 2, i);

                PositiveX.Write(new SgtBoundsL(detail - 1, -detail, -detail, detail, detail, detail), shell, 3, i);
                PositiveY.Write(new SgtBoundsL(-detail, detail - 1, -detail, detail, detail, detail), shell, 4, i);
                PositiveZ.Write(new SgtBoundsL(-detail, -detail, detail - 1, detail, detail, detail), shell, 5, i);
            }

            NegativeX.Sweep();
            NegativeY.Sweep();
            NegativeZ.Sweep();
            PositiveX.Sweep();
            PositiveY.Sweep();
            PositiveZ.Sweep();
        }
    }
コード例 #2
0
ファイル: SgtTerrain.cs プロジェクト: BackToGround/XGame
    private SgtTerrainFace CreateFace(CubemapFace side)
    {
        var face = SgtTerrainFace.Create(side.ToString(), gameObject.layer, transform);

        face.Terrain = this;
        face.Side    = side;

        return(face);
    }
コード例 #3
0
ファイル: SgtTerrain.cs プロジェクト: BackToGround/XGame
 protected virtual void OnDestroy()
 {
     SgtTerrainFace.MarkForDestruction(NegativeX);
     SgtTerrainFace.MarkForDestruction(NegativeY);
     SgtTerrainFace.MarkForDestruction(NegativeZ);
     SgtTerrainFace.MarkForDestruction(PositiveX);
     SgtTerrainFace.MarkForDestruction(PositiveY);
     SgtTerrainFace.MarkForDestruction(PositiveZ);
 }
コード例 #4
0
 public void Set(SgtTerrainFace newFace, int newI, int newA, int newB, int newO, int newC, int newD, int newZ)
 {
     Face = newFace;
     I    = newI;
     A    = newA;
     B    = newB;
     O    = newO;
     C    = newC;
     D    = newD;
     Z    = newZ;
 }
コード例 #5
0
ファイル: SgtTerrainFace.cs プロジェクト: BackToGround/XGame
    public static SgtTerrainFace MarkForDestruction(SgtTerrainFace face)
    {
        if (face != null)
        {
            face.Terrain = null;

            face.gameObject.SetActive(true);
        }

        return(null);
    }
コード例 #6
0
ファイル: SgtTerrainFace.cs プロジェクト: BackToGround/XGame
    public static SgtTerrainFace Pool(SgtTerrainFace face)
    {
        if (face != null)
        {
            face.Terrain  = null;
            face.Material = null;

            SgtComponentPool <SgtTerrainFace> .Add(face);
        }

        return(null);
    }