示例#1
0
    public static Color NearestSample(this Cubemap c, Utils.CubemapCoordinates coords)
    {
        // Can I somehow make sure that coords.X or coords.Y is never 1 for sane directions
        int x = (int)Mathf.Min(coords.X * c.width, c.width - 1);
        int y = (int)Mathf.Min(coords.Y * c.width, c.width - 1);

        return(c.GetPixel(coords.Face, x, y));
    }
示例#2
0
 ////////////////////////////////////////////////////////////////////////////
 // Computes the direction vector used for looking up in cubemap from the
 // x and y coords normalized to range [-0.5, 0.5] and the cube side.
 ////////////////////////////////////////////////////////////////////////////
 public static Vector3 CubemapDirection(CubemapCoordinates coords)
 {
     return(CubemapDirection(coords.Face, coords.X, coords.Y));
 }
示例#3
0
 public static Color NearestSample(this Cubemap c, Vector3 direction)
 {
     Utils.CubemapCoordinates coords = Utils.Cubemap.CubemapCoordinates(direction);
     return(c.NearestSample(coords));
 }