public void SaveImage() { //z++; z += jumpDelta; if (z >= zMax) { z = zMin; //y++; y += jumpDelta; } if (y >= yMax) { y = yMin; //x++; x += jumpDelta; } if (x < xMax) { Invoke("SaveImage", 0.01f); //funciono con 0.005 string route = url; string name = route + FloatToString(x) + " " + FloatToString(y) + " " + FloatToString(z) + ".jpg"; camarita.transform.position = new Vector3(x, y, z); //Debug.Log("Comienza imagen"); //le puse false en el último parámetro File.WriteAllBytes(name, I360Render.Capture(imageSize, true, camarita.GetComponent <Camera>(), false)); //Debug.Log("Termina imagen: " + name); } else { Debug.Log("termine"); } }
public void TakeScreenshot() { tracerLayer = gazeTracers[0].layer; foreach (GameObject obj in gazeTracers) { // Change the layer of the Tracer to Default so it can be visible by the camera; obj.layer = 0; } Debug.Log("Gaze Screenshot taken !"); cameraScreenshot = I360Render.Capture(screenshotResolution, false, myCamera); string path = Path.Combine(Application.dataPath, "ScreenGaze.png"); File.WriteAllBytes(path, cameraScreenshot); foreach (GameObject obj in gazeTracers) { // Change back the layer of the Tracer to be invisible obj.layer = tracerLayer; Debug.Log(obj.layer); } }
private static void Generate360Screenshot() { int imageWidth = 4096; bool saveAsJPEG = true; bool newFileName = false; int currentCount = 1; string path; byte[] bytes = I360Render.Capture(imageWidth, saveAsJPEG); if (bytes != null) { while (!newFileName) { if (File.Exists("Assets/360Photos/360Render_" + UnityEngine.SceneManagement.SceneManager.GetActiveScene().name + "_" + currentCount + (saveAsJPEG ? ".jpeg" : ".png"))) { currentCount++; } else { path = Path.Combine("Assets/360Photos", "360Render_" + UnityEngine.SceneManagement.SceneManager.GetActiveScene().name + "_" + currentCount + (saveAsJPEG ? ".jpeg" : ".png")); File.WriteAllBytes(path, bytes); Debug.Log("360 render saved to " + path); newFileName = true; } } } }
void TakePhoto() { var go = Fsm.GetOwnerDefaultTarget(camera); if (go == null) { return; } if (imageWidth.Value < 1) { return; } if (_camera == null) { Debug.LogError("Playmaker error: No camera component for 360 screen shot found on " + go.name); return; } // take a photo byte[] bytes = I360Render.Capture(imageWidth.Value, useJPEG.Value, _camera); if (bytes != null) { string path = Path.Combine(Application.persistentDataPath, photoSaveName + (useJPEG.Value ? ".jpeg" : ".png")); File.WriteAllBytes(path, bytes); Debug.Log("360 render saved to " + path); } }
void Update() { if (Input.GetKeyDown(KeyCode.P)) { byte[] bytes = I360Render.Capture(imageWidth, saveAsJPEG); if (bytes != null) { string path = Path.Combine(Application.persistentDataPath, "360render" + (saveAsJPEG ? ".jpeg" : ".png")); File.WriteAllBytes(path, bytes); Debug.Log("360 render saved to " + path); } } }
// パノラマでキャプチャしてSkyBoxに割り当てる public void Capture() { byte[] bytes = I360Render.Capture(imageWidth, false); if (bytes != null) { Debug.Log("Capture 360"); skyboxBaseTexture.LoadImage(bytes); customSkybox.material.mainTexture = skyboxBaseTexture; customSkybox.material.SetInt("_Rotation", Mathf.RoundToInt(-cameraObj.transform.localRotation.eulerAngles.y + 90)); SkyboxEnable(true); } }
private IEnumerator Take360Screenshot() { yield return(new WaitForEndOfFrame()); try { var filename = GetUniqueFilename(); File.WriteAllBytes(filename, I360Render.Capture(Resolution360.Value, false)); Utils.Sound.Play(SystemSE.photo); Logger.Log(ScreenshotMessage.Value ? LogLevel.Message : LogLevel.Info, $"360 screenshot saved to {filename}"); } catch (Exception e) { Logger.Log(LogLevel.Message | LogLevel.Error, "Failed to take a 360 screenshot - " + e.Message); Logger.Log(LogLevel.Error, e.StackTrace); } }
// Update is called once per frame void Update() { int imageWidth = 1024; bool saveAsJPEG = true; if (Input.GetKeyDown(KeyCode.P)) { Debug.Log("360 SCREENSHOT"); byte[] bytes = I360Render.Capture(imageWidth, saveAsJPEG); if (bytes != null) { string path = Path.Combine(Application.persistentDataPath, "360render" + cptScreen + (saveAsJPEG ? ".jpeg" : ".png")); File.WriteAllBytes(path, bytes); Debug.Log("360 render saved to " + path); cptScreen++; } } }