private SgtTerrainFace CreateFace(CubemapFace side, Vector3 cornerBL, Vector3 cornerBR, Vector3 cornerTL, Vector3 cornerTR)
        {
            var face     = SgtTerrainFace.Create(side.ToString(), gameObject.layer, transform);
            var z        = Mathf.Atan(Mathf.Sqrt(0.5f)) * Mathf.Rad2Deg;
            var rotation = Quaternion.Euler(-z, 0.0f, 45.0f);

            face.Terrain  = this;
            face.Side     = side;
            face.Depth    = 0;
            face.CornerBL = new SgtVector3D(rotation * cornerBL);
            face.CornerBR = new SgtVector3D(rotation * cornerBR);
            face.CornerTL = new SgtVector3D(rotation * cornerTL);
            face.CornerTR = new SgtVector3D(rotation * cornerTR);

            return(face);
        }
Beispiel #2
0
        private SgtTerrainFace CreateFace(CubemapFace side, SgtVector3D cornerBL, SgtVector3D cornerBR, SgtVector3D cornerTL, SgtVector3D cornerTR)
        {
            var face = SgtTerrainFace.Create(side.ToString(), gameObject.layer, transform);

            face.Terrain  = this;
            face.Side     = side;
            face.Depth    = 0;
            face.CornerBL = cornerBL;
            face.CornerBR = cornerBR;
            face.CornerTL = cornerTL;
            face.CornerTR = cornerTR;
            face.CoordBL  = new SgtVector2D(0.0, 0.0);
            face.CoordBR  = new SgtVector2D(1.0, 0.0);
            face.CoordTL  = new SgtVector2D(0.0, 1.0);
            face.CoordTR  = new SgtVector2D(1.0, 1.0);

            return(face);
        }