|
|
@@ -61,18 +61,14 @@ public class InfraredScreenPositioningView : JCUnityLib.ViewBase
|
|
|
// InfraredDemo._ins.SetBrightness(value);
|
|
|
//});
|
|
|
//slider.value = InfraredDemo._ins.brightness.Get();
|
|
|
+ }
|
|
|
|
|
|
- //图像
|
|
|
+ void Update()
|
|
|
+ {
|
|
|
if (InfraredDemo.running)
|
|
|
{
|
|
|
- //渲染截图
|
|
|
- Texture2D texture2D = InfraredDemo.infraredCameraHelper.EnterScreenLocateManual();
|
|
|
- if (texture2D == null)
|
|
|
- {
|
|
|
- InfraredDemo.infraredCameraHelper.QuitScreenLocateManual(null);
|
|
|
- return;
|
|
|
- }
|
|
|
- rawImage.texture = texture2D;
|
|
|
+ //渲染相机画面
|
|
|
+ rawImage.texture = InfraredDemo.infraredCameraHelper.GetCameraTexture();
|
|
|
rawImage.material = InfraredDemo.infraredCameraHelper.GetCameraMaterial();
|
|
|
}
|
|
|
}
|
|
|
@@ -176,7 +172,7 @@ public class InfraredScreenPositioningView : JCUnityLib.ViewBase
|
|
|
//确认修改
|
|
|
public void onConfirmation()
|
|
|
{
|
|
|
-
|
|
|
+ if (!ConfirmScreenLocateManual()) return;
|
|
|
|
|
|
if (oldLinePosition.Count > 1) // 确保列表不为空
|
|
|
{
|
|
|
@@ -191,10 +187,6 @@ public class InfraredScreenPositioningView : JCUnityLib.ViewBase
|
|
|
ViewManager2.HideView(ViewManager2.Path_InfraredScreenPositioningView);
|
|
|
ViewManager2.ShowView(ViewManager2.Path_ConnectGuidanceView);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- Quit();
|
|
|
|
|
|
//存储一次节点
|
|
|
SaveLocalPos();
|
|
|
@@ -225,21 +217,33 @@ public class InfraredScreenPositioningView : JCUnityLib.ViewBase
|
|
|
void RecordLocatePoint(RectTransform p, Vector2 pivot)
|
|
|
{
|
|
|
Vector2 pos = JCUnityLib.RectTransformUtils.GetPositionByPivot(p, pivot);
|
|
|
- pos.x = pos.x / Screen.width * _texWidth;
|
|
|
- pos.y = pos.y / Screen.height * _texHeight;
|
|
|
+ pos.x = Mathf.Clamp01(pos.x / Screen.width) * _texWidth;
|
|
|
+ pos.y = Mathf.Clamp01(pos.y / Screen.height) * _texHeight;
|
|
|
_locatePointList.Add(pos);
|
|
|
}
|
|
|
- void Quit()
|
|
|
+ bool ConfirmScreenLocateManual()
|
|
|
{
|
|
|
- if (InfraredDemo.running && InfraredDemo.infraredCameraHelper.IsScreenLocateManualDoing())
|
|
|
+ if (InfraredDemo.running)
|
|
|
{
|
|
|
+ //渲染截图
|
|
|
+ Texture2D texture2D = InfraredDemo.infraredCameraHelper.EnterScreenLocateManual();
|
|
|
+ if (texture2D == null)
|
|
|
+ {
|
|
|
+ InfraredDemo.infraredCameraHelper.QuitScreenLocateManual(null);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ _locatePointList.Clear();
|
|
|
+ _texWidth = texture2D.width;
|
|
|
+ _texHeight = texture2D.height;
|
|
|
RecordLocatePoint(pos1, new Vector2(0, 0));
|
|
|
RecordLocatePoint(pos2, new Vector2(1, 0));
|
|
|
RecordLocatePoint(pos3, new Vector2(1, 1));
|
|
|
RecordLocatePoint(pos4, new Vector2(0, 1));
|
|
|
InfraredDemo.infraredCameraHelper.QuitScreenLocateManual(_locatePointList);
|
|
|
FindObjectOfType<InfraredDemo>().SetLocatePointsToCameraRender(_locatePointList, _texWidth, _texHeight);
|
|
|
+ return true;
|
|
|
}
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
|