|
|
@@ -968,8 +968,18 @@ public class InfraredDemo : JCUnityLib.ViewBase
|
|
|
{
|
|
|
if (isFullscreen || ScreenLocate.Main.OutputTextures[4] == null)
|
|
|
{
|
|
|
- if (_cameraRender.texture == null || ScreenLocate.Main.getUVCTexture.GetNativeTexturePtr() != _cameraRender.texture.GetNativeTexturePtr())
|
|
|
- _cameraRender.texture = ScreenLocate.Main.getUVCTexture;
|
|
|
+
|
|
|
+ if (isDiffTexture)
|
|
|
+ {
|
|
|
+ if(ScreenLocate.Main.OutputDiffTexture != null && ScreenLocate.Main.OutputDiffTexture.GetNativeTexturePtr() != _cameraRender.texture.GetNativeTexturePtr())
|
|
|
+ _cameraRender.texture = ScreenLocate.Main.OutputDiffTexture;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if (_cameraRender.texture == null || ScreenLocate.Main.getUVCTexture.GetNativeTexturePtr() != _cameraRender.texture.GetNativeTexturePtr())
|
|
|
+ _cameraRender.texture = ScreenLocate.Main.getUVCTexture;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
//ScreenLocate.Main.OutputTextures[4] == null 并且 摄像机缩小的情况下。显示适配线段
|
|
|
if (!isFullscreen) SetAllToggle(true);
|
|
|
@@ -1052,6 +1062,14 @@ public class InfraredDemo : JCUnityLib.ViewBase
|
|
|
//{
|
|
|
// curIndex = 1 - index;
|
|
|
//}
|
|
|
+ if (curIndex == 0 && isDiffTexture)
|
|
|
+ {
|
|
|
+ curIndex = 2;
|
|
|
+ _crosshairsInCamera[0].gameObject.SetActive(false);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ _crosshairsInCamera[2].gameObject.SetActive(false);
|
|
|
+ }
|
|
|
_crosshairsInCamera[curIndex].gameObject.SetActive(true);
|
|
|
_crosshairsInCamera[curIndex].anchoredPosition = pos;
|
|
|
|
|
|
@@ -1388,20 +1406,40 @@ public class InfraredDemo : JCUnityLib.ViewBase
|
|
|
}
|
|
|
|
|
|
//下面是处理对象放大缩小
|
|
|
+ [Header("放大红外页面显示部分,包括差值图")]
|
|
|
public RectTransform cameraObj1; // 拖拽你的 CameraSize1 对象到此字段
|
|
|
public Button toggleButton; // 缩小时使用的按钮
|
|
|
+ public Button whiteTestButton; // 白色背景触发时候的按钮,进入画中画
|
|
|
+ public Button whiteTestButtonBack; // 退出画中画
|
|
|
+ public GameObject whiteTestPanel; //白色的背景
|
|
|
+ public Dropdown whiteTestDropdown; //白色的背景下选择渲染目标
|
|
|
+ public Toggle whiteTestUseDiffTextureToggle;//选择应用的差值图?
|
|
|
+
|
|
|
private Vector2 originalSize;
|
|
|
private Vector2 originalAnchoredPosition; // 使用 anchoredPosition 代替 localPosition
|
|
|
private Vector2 originalAnchorMin;
|
|
|
private Vector2 originalAnchorMax;
|
|
|
private int originalSiblingIndex; // 保存初始的层级索引
|
|
|
private bool isFullscreen = false;
|
|
|
+ private bool isDiffTexture = false;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 测试效果屏幕数据初始化
|
|
|
/// </summary>
|
|
|
void InitFullScreen()
|
|
|
{
|
|
|
+ whiteTestDropdown.ClearOptions();
|
|
|
+ List<string> options = new List<string>();
|
|
|
+ options.Add("红外图像");
|
|
|
+ options.Add("差值图像");
|
|
|
+ //options.Add(TextAutoLanguage2.GetTextByKey("AutoRecognition")); // "自动识别"
|
|
|
+ //options.Add(TextAutoLanguage2.GetTextByKey("SemiAutoRecognition")); // "半自动识别"
|
|
|
+ whiteTestDropdown.AddOptions(options);
|
|
|
+
|
|
|
+ // 添加监听器来处理选择事件
|
|
|
+ whiteTestDropdown.onValueChanged.AddListener(OnwhiteTestDropdownValueChanged);
|
|
|
+
|
|
|
+ whiteTestUseDiffTextureToggle.onValueChanged.AddListener(OnWhiteTestUseDiffTextureToggleValueChanged);
|
|
|
|
|
|
if (cameraObj1 != null)
|
|
|
{
|
|
|
@@ -1415,6 +1453,9 @@ public class InfraredDemo : JCUnityLib.ViewBase
|
|
|
// 为 cameraObj1 添加点击事件
|
|
|
cameraObj1.GetComponent<Button>().onClick.AddListener(ToggleFullscreen);
|
|
|
|
|
|
+ whiteTestButton.onClick.AddListener(WhiteTestFullScreen);
|
|
|
+ whiteTestButtonBack.onClick.AddListener(WhiteTestFullScreenBack);
|
|
|
+
|
|
|
toggleButton.transform.parent.gameObject.SetActive(false);
|
|
|
}
|
|
|
|
|
|
@@ -1424,6 +1465,14 @@ public class InfraredDemo : JCUnityLib.ViewBase
|
|
|
toggleButton.onClick.AddListener(RestoreSize);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ void OnwhiteTestDropdownValueChanged(int index) {
|
|
|
+ isDiffTexture = index == 0 ? false : true;
|
|
|
+ }
|
|
|
+ void OnWhiteTestUseDiffTextureToggleValueChanged(bool isChange) {
|
|
|
+ // Debug.Log(isChange);
|
|
|
+ ScreenLocate.Main.SetUsingCameraImageDifference = isChange;
|
|
|
+ }
|
|
|
void ToggleFullscreen()
|
|
|
{
|
|
|
if (cameraObj1 == null) return;
|
|
|
@@ -1450,6 +1499,34 @@ public class InfraredDemo : JCUnityLib.ViewBase
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ void WhiteTestFullScreen()
|
|
|
+ {
|
|
|
+ if (cameraObj1 == null) return;
|
|
|
+
|
|
|
+ if (isFullscreen)
|
|
|
+ {
|
|
|
+ // 恢复锚点和偏移量
|
|
|
+ cameraObj1.anchorMin = originalAnchorMin; // 使用在 Start() 中记录的初始锚点
|
|
|
+ cameraObj1.anchorMax = originalAnchorMax; // 使用在 Start() 中记录的初始锚点
|
|
|
+ cameraObj1.sizeDelta = originalSize * 0.8f;
|
|
|
+ cameraObj1.anchoredPosition = new Vector2(cameraObj1.sizeDelta.x/2, -cameraObj1.sizeDelta.y/2);
|
|
|
+
|
|
|
+ //刷新一次点
|
|
|
+ SetLocatePointsToCameraRender(ScreenLocate.quadUnityVectorList, 1, 1);
|
|
|
+
|
|
|
+ toggleButton.transform.parent.gameObject.SetActive(false);
|
|
|
+ whiteTestPanel.SetActive(true);
|
|
|
+ whiteTestPanel.GetComponent<RectTransform>().SetSiblingIndex(cameraObj1.parent.childCount - 2); // 倒数第二层
|
|
|
+ isFullscreen = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ void WhiteTestFullScreenBack() {
|
|
|
+ whiteTestPanel.SetActive(false);
|
|
|
+ ToggleFullscreen();
|
|
|
+ }
|
|
|
+
|
|
|
void RestoreSize()
|
|
|
{
|
|
|
if (cameraObj1 == null || !isFullscreen) return;
|
|
|
@@ -1466,6 +1543,10 @@ public class InfraredDemo : JCUnityLib.ViewBase
|
|
|
|
|
|
toggleButton.transform.parent.gameObject.SetActive(false);
|
|
|
isFullscreen = false;
|
|
|
+
|
|
|
+ //完全退出去后,重置一下选择差值信息
|
|
|
+ isDiffTexture = false;
|
|
|
+ whiteTestDropdown.value = 0;
|
|
|
}
|
|
|
#endregion
|
|
|
|