private bool UpdateRuntimeParameter() { bool result = true; int ret = (int)Error.FAILED; // live mesh display mode if ((int)LiveMeshDisplayMode != LastLiveMeshDisplayMode) { HideAllLiveMeshes(); result = SetMeshDisplayMode(LiveMeshDisplayMode) && result; LastLiveMeshDisplayMode = (int)LiveMeshDisplayMode; } // full scene quality ret = ViveSR_Framework.SetParameterInt(ViveSR_Framework.MODULE_ID_RIGID_RECONSTRUCTION, (int)(ReconstructionParam.CONFIG_QUALITY), (int)FullSceneQuality); if (LiveMeshDisplayMode == ReconstructionDisplayMode.FULL_SCENE) { LiveMeshMaterial.SetFloat("_PointSizeScaler", (FullSceneQuality == ReconstructionQuality.LOW)? 1.2f : 0.8f); } result = result && (ret == (int)Error.WORK); // update live adaptive param if (LiveMeshDisplayMode == ReconstructionDisplayMode.ADAPTIVE_MESH) { ret = ViveSR_Framework.SetParameterFloat(ViveSR_Framework.MODULE_ID_RIGID_RECONSTRUCTION, (int)ReconstructionParam.ADAPTIVE_MAX_GRID, ViveSR_RigidReconstruction.LiveAdaptiveMaxGridSize * 0.01f); // cm to m result = result && (ret == (int)Error.WORK); ret = ViveSR_Framework.SetParameterFloat(ViveSR_Framework.MODULE_ID_RIGID_RECONSTRUCTION, (int)ReconstructionParam.ADAPTIVE_MIN_GRID, ViveSR_RigidReconstruction.LiveAdaptiveMinGridSize * 0.01f); result = result && (ret == (int)Error.WORK); ret = ViveSR_Framework.SetParameterFloat(ViveSR_Framework.MODULE_ID_RIGID_RECONSTRUCTION, (int)ReconstructionParam.ADAPTIVE_ERROR_THRES, ViveSR_RigidReconstruction.LiveAdaptiveErrorThres); result = result && (ret == (int)Error.WORK); } if (EnableSector != LastEnableSector) { HideAllLiveMeshes(); ViveSR_Framework.SetParameterBool(ViveSR_Framework.MODULE_ID_RIGID_RECONSTRUCTION, (int)(ReconstructionParam.ENABLE_FRUSTUM_CULLING), EnableSector); ViveSR_Framework.SetParameterBool(ViveSR_Framework.MODULE_ID_RIGID_RECONSTRUCTION, (int)(ReconstructionParam.ENABLE_SECTOR_GROUPER), EnableSector); ViveSR_Framework.SetParameterFloat(ViveSR_Framework.MODULE_ID_RIGID_RECONSTRUCTION, (int)(ReconstructionParam.SECTOR_SIZE), SectorSizeInMeter); LastEnableSector = EnableSector; } if (SetWireFrameOpaque != LastSetWireFrameOpaque) { WireframeMaterial.SetFloat("_Opaque", SetWireFrameOpaque ? 1.0f : 0.0f); LastSetWireFrameOpaque = SetWireFrameOpaque; } // refresh rate ViveSR_Framework.SetParameterInt(ViveSR_Framework.MODULE_ID_RIGID_RECONSTRUCTION, (int)ReconstructionParam.MESH_REFRESH_INTERVAL, RefreshIntervalMS); return(result); }
public static void ExportModel(string filename) { ExportStage = 0; ExportPercentage = 0; IsExportingMesh = true; ViveSR_Framework.SetParameterBool(ViveSR_Framework.MODULE_ID_RIGID_RECONSTRUCTION, (int)ReconstructionParam.EXPORT_ADAPTIVE_MODEL, ExportAdaptiveMesh); if (ExportAdaptiveMesh) { ViveSR_Framework.SetParameterFloat(ViveSR_Framework.MODULE_ID_RIGID_RECONSTRUCTION, (int)ReconstructionParam.ADAPTIVE_MAX_GRID, ExportAdaptiveMaxGridSize * 0.01f); // cm to m ViveSR_Framework.SetParameterFloat(ViveSR_Framework.MODULE_ID_RIGID_RECONSTRUCTION, (int)ReconstructionParam.ADAPTIVE_MIN_GRID, ExportAdaptiveMinGridSize * 0.01f); ViveSR_Framework.SetParameterFloat(ViveSR_Framework.MODULE_ID_RIGID_RECONSTRUCTION, (int)ReconstructionParam.ADAPTIVE_ERROR_THRES, ExportAdaptiveErrorThres); } ViveSR_Framework.RegisterCallback(ViveSR_Framework.MODULE_ID_RIGID_RECONSTRUCTION, (int)ReconstructionCallback.EXPORT_PROGRESS, Marshal.GetFunctionPointerForDelegate((ExportProgressCallback)UpdateExportProgress)); ViveSR_Framework.SetCommandString(ViveSR_Framework.MODULE_ID_RIGID_RECONSTRUCTION, (int)(ReconstructionCmd.EXPORT_MODEL_FOR_UNITY), filename); }