public void GetMatrixData(string roomName, string matrixArrayFilepath, out Matrix4x4[] worldToCameraMatrixArray, out Matrix4x4[] projectionMatrixArray, out Matrix4x4[] localToWorldMatrixArray) { // Try loading from file bool loaded = MatrixArray.LoadMatrixArrays_AssetsStored(out worldToCameraMatrixArray, out projectionMatrixArray, out localToWorldMatrixArray); // If file not available, try loading from asset bundle if (!loaded) { // NOTE: If running into an error with the asset bundle here, you MUST DELETE THE BUNDLE, and rebundle it so the open reference closes AssetBundle bundle = AssetBundle.LoadFromFile(Config.AssetBundle.RoomPackage.CompileAbsoluteAssetPath(Config.AssetBundle.RoomPackage.CompileFilename(), roomName)); TextAsset matrixAsset = bundle.LoadAsset <TextAsset>("RoomMatrices".ToLower()); MatrixArray.LoadMatrixArrays_FromAssetBundle(matrixAsset, out worldToCameraMatrixArray, out projectionMatrixArray, out localToWorldMatrixArray); loaded = true; } else { Debug.Log("RoomModel matrix data loaded from stored assets."); } }
/// <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); } }