Exemplo n.º 1
0
    public string GetImage1()   //not blocking, screenshot will be done later
    {
        float hfov = calculateFov();

        string fn = System.DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + "_fov_" + hfov + "_screenshot.jpg";

        ScreenCapture.CaptureScreenshot(fn); //doesnt not block image, screenshot will be done/written in few ms later
        Math3DUtils.Log("Focal: " + hfov + " Resolution: " + Screen.width + "x" + Screen.height + "Fn: " + fn);
        return(fn);
    }
Exemplo n.º 2
0
    public string GetImage()   //blocking until screenshot is done
    {
        float     hfov = calculateFov();
        Texture2D snap = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false);

        snap.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0);
        snap.Apply();

        string fn = System.DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + "_fov_" + hfov + "_tscreenshot.jpg";

        string pathSnap = Application.persistentDataPath + "/" + fn;

        System.IO.File.WriteAllBytes(Application.persistentDataPath + "/" + fn, snap.EncodeToJPG());
        Math3DUtils.Log("Focal: " + hfov + " Resolution: " + Screen.width + "x" + Screen.height + "Fn: " + fn);
        return(fn);
    }