public void Update() { if (freeze) { return; } if (_Sensor == null) { return; } frameTimeLeft -= Time.deltaTime; if (frameTimeLeft > 0.0f) { return; } frameTimeLeft += 1.0f / frameRate; if (MultiSourceManager == null) { return; } _MultiManager = MultiSourceManager.GetComponent <MultiSourceManager>(); if (_MultiManager == null) { return; } if (!_MultiManager.isFresh) { return; } //gameObject.GetComponent<Renderer>().material.mainTexture = _MultiManager.GetColorTexture(); RefreshData(_MultiManager.GetDepthData(), _MultiManager.GetColorData()); _MultiManager.isFresh = false; }
void Update() { if (_Sensor == null) { return; } if (Input.GetButtonDown("Fire1")) { if (ViewMode == DepthViewMode.MultiSourceReader) { ViewMode = DepthViewMode.SeparateSourceReaders; } else { ViewMode = DepthViewMode.MultiSourceReader; } } float yVal = Input.GetAxis("Horizontal"); float xVal = -Input.GetAxis("Vertical"); transform.Rotate( (xVal * Time.deltaTime * _Speed), (yVal * Time.deltaTime * _Speed), 0, Space.Self); if (ViewMode == DepthViewMode.SeparateSourceReaders) { if (ColorSourceManager == null) { return; } _ColorManager = ColorSourceManager.GetComponent <ColorSourceManager>(); if (_ColorManager == null) { return; } if (DepthSourceManager == null) { return; } _DepthManager = DepthSourceManager.GetComponent <DepthSourceManager>(); if (_DepthManager == null) { return; } gameObject.GetComponent <Renderer>().material.mainTexture = _ColorManager.GetColorTexture(); colorData = _ColorManager.GetData(); RefreshData(_DepthManager.GetData(), _ColorManager.ColorWidth, _ColorManager.ColorHeight); } else { if (MultiSourceManager == null) { return; } _MultiManager = MultiSourceManager.GetComponent <MultiSourceManager>(); if (_MultiManager == null) { return; } gameObject.GetComponent <Renderer>().material.mainTexture = _MultiManager.GetColorTexture(); colorData = _MultiManager.GetColorData(); RefreshData(_MultiManager.GetDepthData(), _MultiManager.ColorWidth, _MultiManager.ColorHeight); } }
void Update() { if (MultiSourceManager == null) { return; } _MultiManager = MultiSourceManager.GetComponent <MultiSourceManager>(); if (_MultiManager == null) { return; } if (DepthSourceView == null) { return; } _SourceView = DepthSourceView.GetComponent <DepthSourceView>(); if (_SourceView == null) { return; } if (_MultiManager.isReaderClosed()) { return; } _DepthData = _MultiManager.GetDepthData(); if (_DepthData == null) { return; } _ColorSpace = _SourceView.GetColorSpace(); if (_ColorSpace == null) { return; } _ColorData = _MultiManager.GetColorData(); if (_ColorData == null) { return; } _ColorTexture = _MultiManager.GetColorTexture(); if (_ColorTexture == null) { return; } ColorWidth = _MultiManager.ColorWidth; if (ColorWidth == 0) { return; } ColorHeight = _MultiManager.ColorHeight; if (ColorHeight == 0) { return; } //CustomMessages2.Instance.SendGeneralData(_MultiManager.ColorWidth, _MultiManager.ColorHeight); //CustomMessages2.Instance.SendWidth(_MultiManager.ColorWidth); //CustomMessages2.Instance.SendHeight(_MultiManager.ColorHeight); //Debug.Log("_DepthData.Length:" + _DepthData.Length); //CustomMessages2.Instance.Send(MsgTag.LENGTH, _DepthData.Length); //CustomMessages2.Instance.Send(MsgTag.COLOR_WIDTH, ColorWidth); //CustomMessages2.Instance.Send(MsgTag.COLOR_HEIGHT, ColorHeight); //Debug.Log("_colorspace.Length in sender is/...........:" + _ColorSpace.Length); //if (Time.fixedTime >= timeToGo) //Debug.Log("counter before if is: " + Counter); if (Counter % 60 == 0) { //Debug.Log("counter in if is: " + Counter); CustomMessages2.Instance.SendDepthData(MsgTag.DEPTH, _DepthData); CustomMessages2.Instance.SendColorData(MsgTag.COLOR, _ColorData); CustomMessages2.Instance.SendColorSpace(MsgTag.COLORSPACE, _ColorSpace); //timeToGo = Time.fixedTime + 0.01f; //Thread.Sleep(500); //Debug.Log("_Daepthdata in sender is" + _DepthData); /* * Debug.Log("DSPWidth: " + _MultiManager.DSPWidth); * Debug.Log("DSPHeight: " + _MultiManager.DSPHeight);*/ //CustomMessagesPointCloud.Instance.SendColorData(_ColorData); } Counter++; }