Beispiel #1
0
 /// <inheritdoc/>
 public override void SectionAdditionalParameters()
 {
     // Enable the user to choose the parameters for per-view meshing.
     if (shouldExecute)
     {
         using (var indentScope = new EditorGUI.IndentLevelScope())
             PMPerViewMeshesQSTR.SectionAdditionalParameters();
     }
 }
        /// <summary>
        /// Loads a fitting scene representation from the bundled assets.
        /// </summary>
        /// <returns></returns>
        private IEnumerator LoadSceneRepresentationCoroutine()
        {
            // Load the scene representation.
            yield return(StartCoroutine(PMColorTextureArray.LoadProcessedTextureArrayCoroutine()));

            yield return(StartCoroutine(PMPerViewMeshesQSTR.LoadProcessedPerViewMeshesCoroutine()));

            // Deactivate the created geometry.
            _helperCommandBuffer.DeactivateCreatedGeometry(PMPerViewMeshesQSTR.perViewMeshTransforms[0].parent);
        }
Beispiel #3
0
 /// <summary>
 /// Coroutine that renders per-view meshes from the given depth texture array.
 /// </summary>
 /// <returns></returns>
 private IEnumerator StorePerViewMeshesCoroutine()
 {
     // Reset the progress bar.
     GeneralToolkit.ResetCancelableProgressBar(true, false);
     // Initialize the compute shader's properties.
     PMPerViewMeshesQSTR.InitializePerCall();
     // Create a mesh for each source depth map.
     for (int sourceCamIndex = 0; sourceCamIndex < cameraSetup.cameraModels.Length; sourceCamIndex++)
     {
         // Check if the asset has already been processed.
         string bundledAssetName = dataHandler.GetBundledAssetName(PMPerViewMeshesQSTR, PerViewMeshesQSTR.perViewMeshAssetPrefix + sourceCamIndex);
         string meshRelativePath = Path.Combine(GeneralToolkit.tempDirectoryRelativePath, bundledAssetName + ".asset");
         if (dataHandler.IsAssetAlreadyProcessed(meshRelativePath))
         {
             continue;
         }
         // Update the progress bar, and enable the user to cancel the process.
         PMPerViewMeshesQSTR.DisplayAndUpdateCancelableProgressBar();
         if (GeneralToolkit.progressBarCanceled)
         {
             processingCaller.processingCanceled = true;
             break;
         }
         // Update the camera model.
         PMPerViewMeshesQSTR.cameraModel = cameraSetup.cameraModels[sourceCamIndex];
         // Initialize the distance map texture, and load the depth data into it.
         PMPerViewMeshesQSTR.InitializeDistanceMap();
         Vector2Int    distanceMapResolution  = new Vector2Int(PMPerViewMeshesQSTR.distanceMap.width, PMPerViewMeshesQSTR.distanceMap.height);
         RenderTexture depthTextureArraySlice = new RenderTexture(1, 1, 0);
         GeneralToolkit.CreateRenderTexture(ref depthTextureArraySlice, distanceMapResolution, 0, RenderTextureFormat.ARGB32, true, FilterMode.Point);
         Graphics.Blit(PMDepthTextureArray.depthData, depthTextureArraySlice, sourceCamIndex, 0);
         GeneralToolkit.CopyRenderTextureToTexture2D(depthTextureArraySlice, ref PMPerViewMeshesQSTR.distanceMap);
         DestroyImmediate(depthTextureArraySlice);
         // Compute a mesh from the distance map.
         Mesh meshAsset;
         PMPerViewMeshesQSTR.ComputeMesh(out meshAsset);
         // Save this mesh as an asset.
         GeneralToolkit.CreateAndUnloadAsset(meshAsset, meshRelativePath);
         yield return(null);
     }
     // Reset the progress bar.
     GeneralToolkit.ResetCancelableProgressBar(true, false);
 }
Beispiel #4
0
        /// <summary>
        /// Loads a fitting scene representation from the bundled assets.
        /// </summary>
        /// <returns></returns>
        private IEnumerator LoadSceneRepresentationCoroutine()
        {
            yield return(StartCoroutine(PMColorTextureArray.LoadProcessedTextureArrayCoroutine()));

            yield return(StartCoroutine(PMPerViewMeshesQSTR.LoadProcessedPerViewMeshesCoroutine()));
        }
Beispiel #5
0
 /// <inheritdoc/>
 public override GUIContent GetProcessedDataName()
 {
     return(PMPerViewMeshesQSTR.GetProcessedDataName());
 }
Beispiel #6
0
 /// <inheritdoc/>
 public override GUIContent GetGUIInfo()
 {
     return(PMPerViewMeshesQSTR.GetGUIInfo());
 }