/// <summary> /// Called when the Hololens webcam is created and primed. Triggers /// the enabling of voice commands for taking photos or ending /// camera mode. Removes ability to erroneously start up texturing /// process while the texturing process is underway. Sets the displayed /// text. /// </summary> /// <param name="result"> /// The information/image saved from the PhotoCapture's photo capture. /// </param> static void OnStartPhotoMode(PhotoCapture.PhotoCaptureResult result) { VoiceManager.EnableVoiceCommand(VoiceCommands.Photo); VoiceManager.EnableVoiceCommand(VoiceCommands.End); VoiceManager.DisableVoiceCommand(VoiceCommands.Start); TextManager.SetText(Messages.PhotoPrompt + Messages.AppendNumPhotosTaken()); }
/// <summary> /// Handles the logic of stopping the active webcam mode for the Hololens. /// Disposes and nulls out the webcam object and disables voice commands. /// Re-enables the start voice command to restart the process of taking /// room textures if the user desires. /// </summary> /// <param name="result"> /// The success of stopping the OnStoppedPhotoMode. /// </param> static void OnStoppedPhotoMode(PhotoCapture.PhotoCaptureResult result) { // Disables the ability to take pictures, and cleans up/disposes of // the photo capture object. VoiceManager.DisableVoiceCommand(VoiceCommands.Photo); photoCaptureObj.Dispose(); photoCaptureObj = null; // Sets locally stored matrices and supplementary info required for // correct texture placement, then saves them along with the mesh SetLocalToWorldMatrices(); // Must be called before SaveMatrixArrays SetMeshSupplementaryInfo(); string roomName = Config.RoomObject.GameObjectName; MatrixArray.SaveMatrixArrays(WorldToCameraMatrixArray, ProjectionMatrixArray, LocalToWorldMatrixArray, currentPhoto); CustomMesh.SaveMesh(MeshArray); CustomOrientation.Save(PositionArray, RotationArray); // ERROR TESTING - REMOVE // CustomMesh.SaveSupplementaryInfo(PositionArray, RotationArray); // Disable the ability to end the photo capture process VoiceManager.DisableVoiceCommand(VoiceCommands.End); VoiceManager.EnableVoiceCommand(VoiceCommands.Start); isEndingPhotoCapture = false; TextManager.SetText("Finished!"); if (currentPhoto < MaxPhotoNum) { TextManager.SetText(Messages.PhotoCaptureEnded); } else { TextManager.SetText(Messages.MaxPhotosTaken); } }