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(); } }
private SgtTerrainFace CreateFace(CubemapFace side) { var face = SgtTerrainFace.Create(side.ToString(), gameObject.layer, transform); face.Terrain = this; face.Side = side; return(face); }
protected virtual void OnDestroy() { SgtTerrainFace.MarkForDestruction(NegativeX); SgtTerrainFace.MarkForDestruction(NegativeY); SgtTerrainFace.MarkForDestruction(NegativeZ); SgtTerrainFace.MarkForDestruction(PositiveX); SgtTerrainFace.MarkForDestruction(PositiveY); SgtTerrainFace.MarkForDestruction(PositiveZ); }
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; }
public static SgtTerrainFace MarkForDestruction(SgtTerrainFace face) { if (face != null) { face.Terrain = null; face.gameObject.SetActive(true); } return(null); }
public static SgtTerrainFace Pool(SgtTerrainFace face) { if (face != null) { face.Terrain = null; face.Material = null; SgtComponentPool <SgtTerrainFace> .Add(face); } return(null); }