public static void Init() { if (!_initialized) { VLog.Log("Инициализируем модель"); VLog.Log("строка подключения:" + ConnectionString); XpoDefault.DataLayer = ConnectionHelper.GetDataLayer(AutoCreateOption.DatabaseAndSchema); _initialized = true; VLog.Log("Добавляем админа"); InitTables(); VLog.Log("Модель готова"); } }
public void SetUp() { VLog.log(VLog.LEVEL_INFO, "VideoFormater Awake"); if (leftSide != null) { leftSideMeshFilter = leftSide.GetComponent <MeshFilter>(); leftSideMeshRenderer = leftSide.GetComponent <MeshRenderer>(); } if (rightSide != null) { rightSideMeshFilter = rightSide.GetComponent <MeshFilter>(); rightSideMeshRenderer = rightSide.GetComponent <MeshRenderer>(); } if (leftSide != null) { leftSide.GetComponent <MeshRenderer>().material.shader = Shader.Find("VRVIU/Unlit_SphereInside"); } if (rightSide != null) { rightSide.GetComponent <MeshRenderer>().material.shader = Shader.Find("VRVIU/Unlit_SphereInside"); } BindPlayer(); UnityEngine.XR.InputTracking.Recenter(); // Get left eye camera component GameObject cameraObject = GameObject.Find(LEFT_EYE_CAMERA_NAME); if (cameraObject != null) { leftEyeCameraObject = cameraObject; leftEyeCamera = cameraObject.GetComponent <Camera>(); } // Get right eye camera component cameraObject = GameObject.Find(RIGHT_EYE_CAMERA_NAME); if (cameraObject != null) { rightEyeCameraObject = cameraObject; rightEyeCamera = cameraObject.GetComponent <Camera>(); } if (leftEyeCamera == null || rightEyeCamera == null) { VLog.log(VLog.LEVEL_WARN, "Missing left or right eye camera in your scene, which will cause stereo unavailable."); } }
//------------------------------------------------------------------------- // Load new mesh and bind to target materials private Mesh loadMesh(string meshURL) { // Try to load the mesh as a resource, we will have a copy in the Resource/Meshes folder. // To do this, we only need the 'filename' component of the mesh name. Mesh newMesh = null; string[] parts = meshURL.Split('/'); if (parts.Length > 0) { string meshName; string[] meshFullName = parts[parts.Length - 1].Split('.'); meshName = "Meshes/" + meshFullName[0]; newMesh = Resources.Load(meshName, typeof(Mesh)) as Mesh; if (newMesh != null) { VLog.log(VLog.LEVEL_DEBUG, "Loaded mesh from internal resource " + meshName); } } // If we can't load a built-in resource, then we load the mesh URL from the web. if (newMesh == null) { WWW meshFile = new WWW(meshURL); while (!meshFile.isDone && (meshFile.error == null)) { ; } if (string.IsNullOrEmpty(meshFile.error)) { // Load mesh here newMesh = ObjImporter.ImportMesh(meshFile.text); VLog.log(VLog.LEVEL_DEBUG, "New mesh imported from " + meshURL); if (newMesh == null) { VLog.log(VLog.LEVEL_ERROR, "Unable to parse mesh at URL " + meshURL + " error " + meshFile.error); return(newMesh); } } else { VLog.log(VLog.LEVEL_ERROR, "Unable to retrieve mesh URL " + meshURL + " error " + meshFile.error); return(newMesh); } } if (newMesh != null) { VLog.log(VLog.LEVEL_ERROR, "Download a new mesh URL " + meshURL); } return(newMesh); }
public AskOrderForm(Order order) { InitializeComponent(); try { labelControlCar.Text = string.Format("Автомобиль: {0}", order.Car); labelControlClient.Text = string.Format("Клиент: {0}", order.Client); labelControlFrom.Text = string.Format("Дата начала аренды: {0}", order.DateFrom); labelControlTo.Text = string.Format("Дата окончания аренды: {0}", order.DateTo); } catch (Exception ex) { VLog.Log(ex); } }
IEnumerator TriggerFade(float duration, bool isFadeOut) { VLog.Log("yellow", "Queueing Fade " + (isFadeOut ? "Out" : "In")); yield return(new WaitUntil(() => !this.IsFadingInProgress)); if (!this.IsFadingInProgress) { VLog.Log("yellow", "Starting Fade " + (isFadeOut ? "Out" : "In")); this.fadeStartTime = Time.time; this.fadeOut = isFadeOut; this.fadeDuration = duration; this.IsFadingInProgress = true; } }
void IFaderNotify.OnFadeOutFinished() { VLog.Log("cyan", "IFaderNotify.OnFadeOutFinished() called: " + gameObject.name); // We need to check if the video background is curently enabled // because Vuforia may restart the video background when the App is resumed // even if the app was paused in VR mode MixedRealityController.Mode mixedRealityMode = GetMixedRealityMode(); if ((this.currentMode != mixedRealityMode) || (this.InAR != VideoBackgroundManager.Instance.VideoBackgroundEnabled)) { // mixed reality mode to switch to this.currentMode = mixedRealityMode; // When we transition to VR, we deactivate the Datasets // before setting the mixed reality mode. // so to reduce CPU usage, as tracking is not needed in this phase // (with AutoStopCameraIfNotRequired ON by default, camera/tracker // will be turned off for performance optimization). if (this.currentMode == MixedRealityController.Mode.HANDHELD_VR || this.currentMode == MixedRealityController.Mode.VIEWER_VR) { Debug.Log("Switching to VR: deactivating datasets"); ActivateDataSets(false); } // As we are moving back to AR, we re-activate the Datasets, // before setting the mixed reality mode. // this will ensure that the Tracker and Camera are restarted, // in case they were previously stopped when moving to VR // before activating the AR mode if (this.currentMode == MixedRealityController.Mode.HANDHELD_AR || this.currentMode == MixedRealityController.Mode.VIEWER_AR) { Debug.Log("Switching to AR: activating datasets"); ActivateDataSets(true); } MixedRealityController.Instance.SetMode(this.currentMode); this.vrContentManager.EnableVRContent(!this.InAR); this.fader.FadeIn(); } }
private void simpleButtonChangePassword_Click(object sender, EventArgs e) { try { var pass1 = textEditPassword1.Text.Trim(); var pass2 = textEditPassword2.Text.Trim(); var oldpass = textEditOldPassword.Text.Trim(); if (string.IsNullOrEmpty(pass1) || string.IsNullOrEmpty(oldpass) || string.IsNullOrEmpty(pass2)) { MessageBox.Show("Пароль не может быть пустым"); return; } var oldpassHash = MD5Hash.Get(oldpass, Encoding.Default); if (_user.PasswordHash != oldpassHash) { MessageBox.Show("Старый пароль не совпадает с введенным"); return; } if (!pass1.Equals(pass2)) { MessageBox.Show("Новые пароли не совпадают"); return; } string url = string.Format("https://" + _mf._serverUrl + "/api/company/update_password?password={0}", pass1); VLog.Log("Постим пароль."); var result = _mf.PostString(url); VLog.Log("Запостили пароль: " + result); if (result.ToLower() != "true") { throw new Exception("Ошибка во время создания пароля."); } _user.PasswordHash = MD5Hash.Get(pass1, Encoding.Default); _user.Password = pass1; Model.Users.Put(_user, true); textEditPassword1.Text = ""; textEditPassword2.Text = ""; textEditOldPassword.Text = ""; MessageBox.Show("Пароль изменен."); } catch (Exception ex) { VLog.Log(ex); MessageBox.Show(ex.Message); } }
private int GetNumberOfMessageRows(Rect?rect, VLog item) { if (!rect.HasValue) { rect = new Rect(0, 0, _width, 0); } var messageChunkSize = 1f; var messageWidth = GUI.skin.label.CalcSize(new GUIContent(item.message)); if (messageWidth.x > rect.Value.width) { messageChunkSize = messageWidth.x / rect.Value.width; } return(Mathf.CeilToInt(messageChunkSize)); }
public static void DrawVLogHeaderGUI(string label, VLog log) { var style = GetVLogHeaderStyle(log); var rect = EditorGUILayout.BeginHorizontal(); if (Event.current.type == EventType.Repaint) { var originalColor = GUI.color; GUI.color = GetVLogHeaderColor(log); Styles.HeaderBackground.Draw(rect, false, false, false, false); GUI.color = originalColor; } GUILayout.Space(60f); GUILayout.Label(label, style); EditorGUILayout.EndHorizontal(); }
private void simpleButtonUpdate_Click(object sender, EventArgs e) { _task = new Task(() => { var appPath = Path.Combine(Path.GetTempPath(), Application.ProductName); try { Directory.CreateDirectory(appPath); appPath = Path.Combine(appPath, "Setup.exe"); VLog.Log("Скачиваем файл обновления"); var url = new Uri("http://" + _serverUrl + "/api/crm/download"); var cookies = new CookieContainer(); var request = HttpWebRequest.Create(url) as HttpWebRequest; request.CookieContainer = cookies; request.ServicePoint.Expect100Continue = false; request.Method = "GET"; request.ContentType = "application/x-www-form-urlencoded"; request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"; request.PreAuthenticate = true; var resp = request.GetResponse(); using (var fileStream = File.Create(appPath)) { resp.GetResponseStream().CopyTo(fileStream); } } catch (Exception ex) { VLog.Log(ex); MessageBox.Show(ex.Message); return; } try { VLog.Log("Запускаем установщик обновления"); Process.Start(appPath); } catch (Exception ex) { VLog.Log(ex); MessageBox.Show(ex.Message); } }); _task.Start(); }
void Update() { if (!this.isModelTargetReferenceStored && this.mTrackableBehaviour.Trackable != null) { VLog.Log("yellow", "Storing reference to " + this.mTrackableBehaviour.TrackableName + ": " + this.mTrackableBehaviour.CurrentStatus + " -- " + this.mTrackableBehaviour.CurrentStatusInfo); ModelTargetBehaviour mtb = this.mTrackableBehaviour as ModelTargetBehaviour; if (mtb != null && this.modelTargetsManager) { this.modelTargetsManager.AddAdvancedModelTargetBehaviour(mtb); this.isModelTargetReferenceStored = true; } } }
void DeactivateActiveDataSets(bool destroyDataSets = false) { List <DataSet> activeDataSets = this.objectTracker.GetActiveDataSets().ToList(); foreach (DataSet ds in activeDataSets) { // The VuforiaEmulator.xml dataset (used by GroundPlane) is managed by Vuforia. if (!ds.Path.Contains("VuforiaEmulator.xml")) { VLog.Log("white", "Deactivating: " + ds.Path); this.objectTracker.DeactivateDataSet(ds); if (destroyDataSets) { this.objectTracker.DestroyDataSet(ds, false); } } } }
private void simpleButton2_Click(object sender, EventArgs e) { try { var login = textBox1.Text.Trim(); var pass = textBox2.Text.Trim(); var user = new User() { PasswordHash = MD5Hash.Get(pass, Encoding.Default), Login = login, }; Model.Users.Post(user); DialogResult = DialogResult.OK; } catch (Exception ex) { VLog.Log(ex); MessageBox.Show(Resources.UserForm_simpleButton2_Click_Ошибка_во_время_создания_пользователя_); } }
void LoadDataSet(string datasetName) { if (DataSet.Exists(datasetName)) { DataSet dataset = this.objectTracker.CreateDataSet(); if (dataset.Load(datasetName)) { VLog.Log("yellow", "Loaded DataSet: " + datasetName); } else { Debug.LogError("Failed to load DataSet: " + datasetName); } } else { VLog.Log("yellow", "The following DataSet not found in 'StreamingAssets/Vuforia': " + datasetName); } }
/// <summary> /// Register a callback which is invoked whenever a VuMark-result is newly detected which was not tracked in the frame before /// </summary> /// <param name="vumarkBehaviour"></param> public void OnVuMarkBehaviourDetected(VuMarkBehaviour vumarkBehaviour) { VLog.Log("cyan", "VuMarkHandler.OnVuMarkBehaviourDetected(): " + vumarkBehaviour.TrackableName); // The GameObject with the VuMarkBehaviour component attached gets duplicated whenever // a new VuMark is detected and the augmentations get attached to the new object. // Since this GameObject contains a Canvas, we need to reset the Camera reference when // duplicating, otherwise the MRTK will throw an exception. The MRTK then assigns the // appropriate Camera reference to the Canvas. vumarkBehaviour.GetComponentInChildren <Canvas>().worldCamera = null; GenerateVuMarkBorderOutline(vumarkBehaviour); ToggleRenderers(vumarkBehaviour.gameObject, true); // Check for existance of previous augmentations and delete before instantiating new ones. DestroyChildAugmentationsOfTransform(vumarkBehaviour.transform); StartCoroutine(OnVuMarkTargetAvailable(vumarkBehaviour)); }
public LoginForm() { InitializeComponent(); try { var autogeneratedHelper = typeof(Core.DB.ConnectionHelper); const string constName = nameof(Model.ConnectionString); if (autogeneratedHelper.GetField(constName) != null) { throw new ApplicationException( $"Duplicated {constName}! Please review {autogeneratedHelper.FullName}"); } Model.Init(); } catch (Exception ex) { VLog.Log(ex); MessageBox.Show(ex.Message); } }
public static GUIStyle GetVLogHeaderStyle(VLog vLog) { GUIStyle style; switch (vLog == null ? VLogType.Info : vLog.vLogType) { case VLogType.Warning: style = EditorGUIUtility.isProSkin ? EditorStyles.whiteBoldLabel : EditorStyles.boldLabel; break; case VLogType.Error: style = EditorGUIUtility.isProSkin ? EditorStyles.boldLabel : EditorStyles.whiteBoldLabel; break; case VLogType.Info: default: style = EditorGUIUtility.isProSkin ? EditorStyles.boldLabel : EditorStyles.whiteBoldLabel; break; } return(style); }
public static Color GetVLogHeaderColor(VLog log) { Color color; switch (log == null ? VLogType.Info : log.vLogType) { case VLogType.Warning: color = Color.yellow; break; case VLogType.Error: color = Color.red; break; case VLogType.Info: default: color = _gColor; break; } return(color); }
public void OnEnable() { VLog.log(VLog.LEVEL_INFO, "SilverFormat OnEnable"); VideoFormater formatter = FindObjectOfType <VideoFormater>(); if (formatter) { leftEyeCamera = formatter.getLeftCameraObject(); rightEyeCamera = formatter.getRightCameraObject(); } else { // get the left eye camera object leftEyeCamera = GameObject.Find(LEFT_EYE_CAMERA_NAME); // get the right eye camera object rightEyeCamera = GameObject.Find(RIGHT_EYE_CAMERA_NAME); } // get left eye camera components leftEyeCameraComponent = leftEyeCamera.GetComponent <Camera>(); // get right camera component rightEyeCameraComponent = rightEyeCamera.GetComponent <Camera>(); }
private void TryPingObject(VLog log) { Object obj = null; switch (log.source) { case VLogSource.Scene: obj = GameObject.Find(log.objectPath); break; case VLogSource.Project: obj = AssetDatabase.LoadAssetAtPath(log.objectPath, typeof(Object)); break; } if (obj != null) { EditorGUIUtility.PingObject(obj); } else { Debug.LogWarningFormat("Could not find object at path of [{0}]", log.objectPath); } }
public VLogTreeViewItem(VLog log, int id, int depth, string displayName = "") : base(id, depth, displayName) { Log = log; }
public void SetUpViewerFormat() { int LEFT_EYE_LAYER_MASK = (1 << LayerMask.NameToLayer(LEFT_EYE_LAYER_NAME)); int RIGHT_EYE_LAYER_MASK = (1 << LayerMask.NameToLayer(RIGHT_EYE_LAYER_NAME)); int UI_LAYER_MASK = (1 << LayerMask.NameToLayer(UI_LAYER_NAME)); int DEFAULT_LAYER_MASK = (1 << LayerMask.NameToLayer(DEFAULT_LAYER_NAME)); int IGONRE_RAYCAST_LAYER_MASK = (1 << LayerMask.NameToLayer(IGONRE_RAYCAST_LAYER_NAME)); int EVERY_THING_LAYER_MASK = (1 << LayerMask.NameToLayer(EVERYTHING_LAYER_NAME)); int TRANSPRENTFX_LAYER_MASK = (1 << LayerMask.NameToLayer(TRANSPARENTFX_LAYER_NAME)); // set up camera and image materials for specified playback format // monoscopic image if (!m_formatType.ToLower().Contains(FORMAT_STEREO_STRING)) { // if mono image, then just use left camera and disable the right camera // disable right camera object if (rightEyeCamera != null) { rightEyeCamera.SetActive(true); } // enable left eye camera object if (leftEyeCamera != null) { leftEyeCamera.SetActive(true); } // set left camera component to display both eyes leftEyeCameraComponent.stereoTargetEye = StereoTargetEyeMask.Both; // only need to show left eye layer display (since we will display same image on both eyes) leftEyeCameraComponent.cullingMask = LEFT_EYE_LAYER_MASK + UI_LAYER_MASK + DEFAULT_LAYER_MASK + IGONRE_RAYCAST_LAYER_MASK + EVERY_THING_LAYER_MASK + TRANSPRENTFX_LAYER_MASK; rightEyeCameraComponent.stereoTargetEye = StereoTargetEyeMask.Both; rightEyeCameraComponent.cullingMask = RIGHT_EYE_LAYER_MASK + UI_LAYER_MASK + DEFAULT_LAYER_MASK + IGONRE_RAYCAST_LAYER_MASK + EVERY_THING_LAYER_MASK + TRANSPRENTFX_LAYER_MASK; } else { // stereoscopic image - use both left and right cameras // enable left camera object if (leftEyeCamera != null) { // set left eye camera active leftEyeCamera.SetActive(true); // set left camera component to display to left eye only leftEyeCameraComponent.stereoTargetEye = StereoTargetEyeMask.Left; // set left camera to only show left eye layer display leftEyeCameraComponent.cullingMask = LEFT_EYE_LAYER_MASK + UI_LAYER_MASK + DEFAULT_LAYER_MASK + IGONRE_RAYCAST_LAYER_MASK + EVERY_THING_LAYER_MASK + TRANSPRENTFX_LAYER_MASK; leftEyeCameraComponent.stereoSeparation = 0; } // enable right camera object if (rightEyeCamera != null) { // set right eye camera active rightEyeCamera.SetActive(true); // set right camera component to display to right eye only rightEyeCameraComponent.stereoTargetEye = StereoTargetEyeMask.Right; // set right camera to only show right eye layer display rightEyeCameraComponent.cullingMask = RIGHT_EYE_LAYER_MASK + UI_LAYER_MASK + DEFAULT_LAYER_MASK + IGONRE_RAYCAST_LAYER_MASK + EVERY_THING_LAYER_MASK + TRANSPRENTFX_LAYER_MASK; rightEyeCameraComponent.stereoSeparation = 0; } } // texture tiling and offset float textureScaleX, textureScaleY; float textureLeftEyeOffsetX, textureLeftEyeOffsetY; float textureRightEyeOffsetX, textureRightEyeOffsetY; VLog.log(VLog.LEVEL_DEBUG, "SetUpViewerFormat m_formatType" + m_formatType); VLog.log(VLog.LEVEL_DEBUG, "SetUpViewerFormat m_videoFormatType" + m_videoFormatType); // set display image material based on encoded image format if (m_formatType.ToLower().Contains(FORMAT_TOP_BOTTOM_STRING)) { textureScaleX = TOP_BOTTOM_TEXTURE_SCALE_X; textureScaleY = TOP_BOTTOM_TEXTURE_SCALE_Y; textureLeftEyeOffsetX = TOP_BOTTOM_OFFSET_X; textureLeftEyeOffsetY = UPPER_TEXTURE_OFFSET; textureRightEyeOffsetX = TOP_BOTTOM_OFFSET_X; textureRightEyeOffsetY = LOWER_TEXTURE_OFFSET; } else if (m_formatType.ToLower().Contains(FORMAT_BOTTOM_TOP_STRING)) { textureScaleX = TOP_BOTTOM_TEXTURE_SCALE_X; textureScaleY = TOP_BOTTOM_TEXTURE_SCALE_Y; textureLeftEyeOffsetX = TOP_BOTTOM_OFFSET_X; textureLeftEyeOffsetY = LOWER_TEXTURE_OFFSET; textureRightEyeOffsetX = TOP_BOTTOM_OFFSET_X; textureRightEyeOffsetY = UPPER_TEXTURE_OFFSET; } else if (m_formatType.ToLower().Contains(FORMAT_LEFT_RIGHT_STRING)) { textureScaleX = LEFT_RIGHT_TEXTURE_SCALE_X; textureScaleY = LEFT_RIGHT_TEXTURE_SCALE_Y; textureLeftEyeOffsetX = LEFT_TEXTURE_OFFSET; textureLeftEyeOffsetY = LEFT_RIGHT_OFFSET_Y; textureRightEyeOffsetX = RIGHT_TEXTURE_OFFSET; textureRightEyeOffsetY = LEFT_RIGHT_OFFSET_Y; } else if (m_formatType.ToLower().Contains(FORMAT_RIGHT_LEFT_STRING)) { textureScaleX = LEFT_RIGHT_TEXTURE_SCALE_X; textureScaleY = LEFT_RIGHT_TEXTURE_SCALE_Y; textureLeftEyeOffsetX = RIGHT_TEXTURE_OFFSET; textureLeftEyeOffsetY = LEFT_RIGHT_OFFSET_Y; textureRightEyeOffsetX = LEFT_TEXTURE_OFFSET; textureRightEyeOffsetY = LEFT_RIGHT_OFFSET_Y; } else { VLog.log(VLog.LEVEL_DEBUG, "SetUpViewerFormat m_videoFormatType" + m_videoFormatType); textureScaleX = MONO_TEXTURE_SCALE; textureScaleY = MONO_TEXTURE_SCALE; textureLeftEyeOffsetX = 0.0f; textureLeftEyeOffsetY = 0.0f; textureRightEyeOffsetX = 0.0f; textureRightEyeOffsetY = 0.0f; if (m_videoFormatType.ToLower().Contains(FORMAT_LEFT_RIGHT_STRING) || m_videoFormatType.ToLower().Contains(FORMAT_RIGHT_LEFT_STRING)) { textureScaleX = TOMONO_TEXTURE_SCALE; VLog.log(VLog.LEVEL_DEBUG, "SetUpViewerFormat textureScaleX = TOMONO_TEXTURE_SCALE" + TOMONO_TEXTURE_SCALE); } if (m_videoFormatType.ToLower().Contains(FORMAT_BOTTOM_TOP_STRING) || m_videoFormatType.ToLower().Contains(FORMAT_TOP_BOTTOM_STRING)) { textureScaleY = TOMONO_TEXTURE_SCALE; VLog.log(VLog.LEVEL_DEBUG, "SetUpViewerFormat textureScaleY = TOMONO_TEXTURE_SCALE" + TOMONO_TEXTURE_SCALE); } } // get left eye image sphere GameObject leftEyeImageSphere = GameObject.Find(LEFT_EYE_IMAGE_SPHERE_NAME); // get left eye mesh renderer leftEyeImageRenderer = leftEyeImageSphere.GetComponent <MeshRenderer>(); leftEyeImageFilter = leftEyeImageSphere.GetComponent <MeshFilter>(); // load default material for left eye Material leftMat = (Material)Instantiate(leftEyeImageRenderer.material); // duplicate material for right eye Material rightMat = (Material)Instantiate(leftMat); // set up tiling and offset for left material leftMat.mainTextureScale = new Vector2(textureScaleX, textureScaleY); leftMat.mainTextureOffset = new Vector2(textureLeftEyeOffsetX, textureLeftEyeOffsetY); // set up tiling and offset for right material rightMat.mainTextureScale = new Vector2(textureScaleX, textureScaleY); rightMat.mainTextureOffset = new Vector2(textureRightEyeOffsetX, textureRightEyeOffsetY); // set material for left eye image rendering leftEyeImageRenderer.material = leftMat; // get right eye image sphere GameObject rightEyeImageSphere = GameObject.Find(RIGHT_EYE_IMAGE_SPHERE_NAME); // get right eye mesh renderer rightEyeImageRenderer = rightEyeImageSphere.GetComponent <MeshRenderer>(); rightEyeImageFilter = rightEyeImageSphere.GetComponent <MeshFilter>(); // set material for right eye image rendering rightEyeImageRenderer.material = rightMat; }
// Use this for initialization void Start() { VLog.log(VLog.LEVEL_INFO, "SilverFormat Start"); SetUpViewerFormat(); }
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs args) { VLog.Log("Необработанная ошибка:" + args.ExceptionObject); MessageBox.Show(args.ExceptionObject.ToString()); }
/// <summary> /// Triggered when some errors happened in video player. /// </summary> void OnError(int errorCode, int errorCodeExtra) { VLog.log(VLog.LEVEL_INFO, "OnError"); }
/// <summary> /// Switch video format according to current viedoFormat. /// </summary> private void Switch() { #region Ajust camera settings. int LEFT_EYE_LAYER_MASK = (1 << LayerMask.NameToLayer(LEFT_EYE_LAYER_NAME)) | (1 << 0); int RIGHT_EYE_LAYER_MASK = (1 << LayerMask.NameToLayer(RIGHT_EYE_LAYER_NAME)) | (1 << 0); int UI_LAYER_MASK = (1 << LayerMask.NameToLayer(UI_LAYER_NAME)) | (1 << 0); int DEFAULT_LAYER_MASK = (1 << LayerMask.NameToLayer(DEFAULT_LAYER_NAME)) | (1 << 0); int IGONRE_RAYCAST_LAYER_MASK = (1 << LayerMask.NameToLayer(IGONRE_RAYCAST_LAYER_NAME)); int EVERY_THING_LAYER_MASK = (1 << LayerMask.NameToLayer(EVERYTHING_LAYER_NAME)); int TRANSPRENTFX_LAYER_MASK = (1 << LayerMask.NameToLayer(TRANSPARENTFX_LAYER_NAME)); VLog.log(VLog.LEVEL_DEBUG, "video format switch " + format); // Monoscopic if (format == VideoFormat.OPT_FLAT_MONO || format == VideoFormat.OPT_ERP_180_MONO || format == VideoFormat.OPT_ERP_360_MONO || format == VideoFormat.OPT_FISHEYE_MONO || format == VideoFormat.OPT_TROPIZED_MONO) { if (leftEyeCamera != null) { // Enable left eye camera component leftEyeCamera.gameObject.SetActive(true); // Set left camera component to display both eyes leftEyeCamera.stereoTargetEye = StereoTargetEyeMask.Both; // Only need to show left eye layer display content (since we will display same image on both eyes) leftEyeCamera.cullingMask = LEFT_EYE_LAYER_MASK + UI_LAYER_MASK + DEFAULT_LAYER_MASK + IGONRE_RAYCAST_LAYER_MASK + EVERY_THING_LAYER_MASK + TRANSPRENTFX_LAYER_MASK; leftSide.GetComponent <MeshRenderer>().material.SetTextureScale("_MainTex", Vector2.one); leftSide.GetComponent <MeshRenderer>().material.SetTextureOffset("_MainTex", Vector2.zero); if (videoFormat != VideoFormat.OPT_FLAT_MONO && videoFormat != VideoFormat.OPT_ERP_180_MONO && videoFormat != VideoFormat.OPT_ERP_360_MONO && videoFormat != VideoFormat.OPT_FISHEYE_MONO && videoFormat != VideoFormat.OPT_TROPIZED_MONO) { if (videoFormat == VideoFormat.OPT_ERP_180_LR || videoFormat == VideoFormat.OPT_ERP_360_LR || videoFormat == VideoFormat.OPT_FLAT_LR || videoFormat == VideoFormat.OPT_FISHEYE_LR || videoFormat == VideoFormat.OPT_TROPIZED_LR) { leftSide.GetComponent <MeshRenderer>().material.SetTextureScale("_MainTex", new Vector2(0.5f, 1.0f)); leftSide.GetComponent <MeshRenderer>().material.SetTextureOffset("_MainTex", new Vector2(0.5f, 0.0f)); } else { leftSide.GetComponent <MeshRenderer>().material.SetTextureScale("_MainTex", new Vector2(1.0f, 0.5f)); leftSide.GetComponent <MeshRenderer>().material.SetTextureOffset("_MainTex", Vector2.zero); } } } if (rightEyeCamera != null) { // Disable right eye camera component rightEyeCamera.gameObject.SetActive(true); // Set left camera component to display both eyes rightEyeCamera.stereoTargetEye = StereoTargetEyeMask.Both; rightEyeCamera.cullingMask = RIGHT_EYE_LAYER_MASK + UI_LAYER_MASK + DEFAULT_LAYER_MASK + IGONRE_RAYCAST_LAYER_MASK + EVERY_THING_LAYER_MASK + TRANSPRENTFX_LAYER_MASK; rightSide.GetComponent <MeshRenderer>().material.SetTextureScale("_MainTex", Vector2.one); rightSide.GetComponent <MeshRenderer>().material.SetTextureOffset("_MainTex", Vector2.zero); if (videoFormat != VideoFormat.OPT_FLAT_MONO && videoFormat != VideoFormat.OPT_ERP_180_MONO && videoFormat != VideoFormat.OPT_ERP_360_MONO && videoFormat != VideoFormat.OPT_FISHEYE_MONO && videoFormat != VideoFormat.OPT_TROPIZED_MONO) { if (videoFormat == VideoFormat.OPT_ERP_180_LR || videoFormat == VideoFormat.OPT_ERP_360_LR || videoFormat == VideoFormat.OPT_FLAT_LR || videoFormat == VideoFormat.OPT_FISHEYE_LR || videoFormat == VideoFormat.OPT_TROPIZED_LR) { rightSide.GetComponent <MeshRenderer>().material.SetTextureScale("_MainTex", new Vector2(0.5f, 1.0f)); rightSide.GetComponent <MeshRenderer>().material.SetTextureOffset("_MainTex", new Vector2(0.5f, 0.0f)); } else { rightSide.GetComponent <MeshRenderer>().material.SetTextureScale("_MainTex", new Vector2(1.0f, 0.5f)); rightSide.GetComponent <MeshRenderer>().material.SetTextureOffset("_MainTex", Vector2.zero); } } } } // Stereoscopic else { if (leftEyeCamera != null) { // Enable left camera component leftEyeCamera.gameObject.SetActive(true); // Set left camera component to display to left eye only leftEyeCamera.stereoTargetEye = StereoTargetEyeMask.Left; // Set left camera to only show left eye layer display leftEyeCamera.cullingMask = RIGHT_EYE_LAYER_MASK + UI_LAYER_MASK + DEFAULT_LAYER_MASK + IGONRE_RAYCAST_LAYER_MASK + EVERY_THING_LAYER_MASK + TRANSPRENTFX_LAYER_MASK; if (format == VideoFormat.OPT_ERP_180_LR || format == VideoFormat.OPT_ERP_360_LR || format == VideoFormat.OPT_FLAT_LR || format == VideoFormat.OPT_FISHEYE_LR || format == VideoFormat.OPT_TROPIZED_LR) { leftSide.GetComponent <MeshRenderer>().material.SetTextureScale("_MainTex", new Vector2(0.5f, 1.0f)); leftSide.GetComponent <MeshRenderer>().material.SetTextureOffset("_MainTex", new Vector2(0.5f, 0.0f)); } else { leftSide.GetComponent <MeshRenderer>().material.SetTextureScale("_MainTex", new Vector2(1.0f, 0.5f)); leftSide.GetComponent <MeshRenderer>().material.SetTextureOffset("_MainTex", Vector2.zero); } } if (rightEyeCamera != null) { // Enable right camera component rightEyeCamera.gameObject.SetActive(true); // Set right camera component to display to right eye only rightEyeCamera.stereoTargetEye = StereoTargetEyeMask.Right; // Set right camera to only show right eye layer display rightEyeCamera.cullingMask = LEFT_EYE_LAYER_MASK + UI_LAYER_MASK + DEFAULT_LAYER_MASK + IGONRE_RAYCAST_LAYER_MASK + EVERY_THING_LAYER_MASK + TRANSPRENTFX_LAYER_MASK; if (format == VideoFormat.OPT_ERP_180_LR || format == VideoFormat.OPT_ERP_360_LR || format == VideoFormat.OPT_FLAT_LR || format == VideoFormat.OPT_FISHEYE_LR || format == VideoFormat.OPT_TROPIZED_LR) { rightSide.GetComponent <MeshRenderer>().material.SetTextureScale("_MainTex", new Vector2(0.5f, 1.0f)); rightSide.GetComponent <MeshRenderer>().material.SetTextureOffset("_MainTex", Vector2.zero); } else { rightSide.GetComponent <MeshRenderer>().material.SetTextureScale("_MainTex", new Vector2(1.0f, 0.5f)); rightSide.GetComponent <MeshRenderer>().material.SetTextureOffset("_MainTex", new Vector2(0.0f, 0.5f)); } } } #endregion #region Adjust mesh component for rendering. //UnloadMesh(); SilverPlayer.MeshType meshType = SilverPlayer.MeshType.eMeshTypeErp360; SilverPlayer.MeshQuality meshQuality = SilverPlayer.MeshQuality.eQ1; float density = 0.5f; if (format == VideoFormat.OPT_FISHEYE_MONO || format == VideoFormat.OPT_FISHEYE_TB || format == VideoFormat.OPT_FISHEYE_LR) { meshType = SilverPlayer.MeshType.eMeshTypeFisheye180; } else if (format == VideoFormat.OPT_ERP_180_MONO || format == VideoFormat.OPT_ERP_180_LR || format == VideoFormat.OPT_ERP_180_TB) { meshType = SilverPlayer.MeshType.eMeshTypeErp180; } else if (format == VideoFormat.OPT_ERP_360_MONO || format == VideoFormat.OPT_ERP_360_LR || format == VideoFormat.OPT_ERP_360_TB) { meshType = SilverPlayer.MeshType.eMeshTypeErp360; } else if (format == VideoFormat.OPT_TROPIZED_TB || format == VideoFormat.OPT_TROPIZED_LR) { //meshType = SilverPlayer.MeshType.eMeshTypeTropized; } else if (format == VideoFormat.OPT_FLAT_MONO || format == VideoFormat.OPT_FLAT_LR || format == VideoFormat.OPT_FLAT_TB) { meshType = SilverPlayer.MeshType.eMeshTypePlane; } else { VLog.log(VLog.LEVEL_ERROR, "ERROR: unknown video format input."); return; } defaultMesh = SilverPlayer.GenerateMesh(meshType, meshQuality, density, 1, 1); if (!string.IsNullOrEmpty(m_mesh_url) && format != VideoFormat.OPT_FLAT_MONO && format != VideoFormat.OPT_FLAT_LR && format != VideoFormat.OPT_FLAT_TB) { defaultMesh = loadMesh(m_mesh_url); } if (leftSideMeshFilter != null && defaultMesh != null) { //Debug.LogError("Generate meshtype "+ meshType); leftSideMeshFilter.mesh = defaultMesh; } if (rightSideMeshFilter != null && defaultMesh != null) { rightSideMeshFilter.mesh = defaultMesh; } //} // else { //} #endregion }
// Use this for initialization void Start() { VLog.log(VLog.LEVEL_INFO, "VideoFormater start"); }
/// <summary> /// Triggered when video resized in video player. /// </summary> void OnResize() { VLog.log(VLog.LEVEL_INFO, "OnResize"); }
/// <summary> /// This method will be called whenever a tracked VuMark is lost /// </summary> public void OnVuMarkLost(VuMarkTarget vumarkTarget) { VLog.Log("cyan", "VuMarkHandler.OnVuMarkLost(): " + GetVuMarkId(vumarkTarget)); }
void ActivateDataSet(string datasetName) { if (this.currentActiveDataSet == datasetName) { VLog.Log("yellow", "The selected dataset is already active."); // If the current dataset is already active, return. return; } // Stop the Object Tracker before activating/deactivating datasets. this.objectTracker.Stop(); // Deactivate the currently active datasets. DeactivateActiveDataSets(); var dataSets = this.objectTracker.GetDataSets(); bool dataSetFoundAndActivated = false; foreach (DataSet ds in dataSets) { if (ds.Path.Contains(datasetName + ".xml")) { // Activate the selected dataset. if (this.objectTracker.ActivateDataSet(ds)) { this.currentActiveDataSet = datasetName; } dataSetFoundAndActivated = true; var trackables = ds.GetTrackables(); foreach (Trackable t in trackables) { ModelTarget modelTarget = t as ModelTarget; } Transform modelTargetTransform = null; if (datasetName == DataSetStandard) { modelTargetTransform = this.modelStandard.transform; } else if (datasetName == DataSetAdvanced) { modelTargetTransform = this.modelAdvanced.transform; } // Set the parent transform for the augmentation. this.augmentation.transform.SetParent(modelTargetTransform); this.augmentation.transform.localPosition = Vector3.zero; this.augmentation.transform.localRotation = Quaternion.identity; this.augmentation.transform.localScale = Vector3.one; // Once we find and process selected dataset, exit foreach loop. break; } } if (!dataSetFoundAndActivated) { Debug.LogError("DataSet Not Found: " + datasetName); } // Start the Object Tracker. this.objectTracker.Start(); }