浏览代码

Revert changes made in a7cf20ec73

a7cf20ec73 reveals issues with the way gizmos are handled that cause
severe distortions to meidos.

Gizmos ignore layer 8 and since the drag points were on that layer,
gizmos and drag points worked together just fine.

A rework on drag points and gizmos is needed down the line.
habeebweeb 3 年之前
父节点
当前提交
38e9d1be0d

+ 1 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/DragPoint/DragPoint.cs

@@ -129,7 +129,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             GameObject dragPointGo = GameObject.CreatePrimitive(primitiveType);
             dragPointGo.transform.SetParent(DragPointParent().transform, false);
             dragPointGo.transform.localScale = scale;
-            dragPointGo.layer = layer;
+            dragPointGo.layer = 8;
 
             T dragPoint = dragPointGo.AddComponent<T>();
             dragPoint.renderer.material = dragPointMaterial;

+ 12 - 0
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/CameraManager.cs

@@ -14,6 +14,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         private float defaultCameraZoomSpeed;
         private const float cameraFastMoveSpeed = 0.1f;
         private const float cameraFastZoomSpeed = 3f;
+        private Camera subCamera;
         private CameraInfo tempCameraInfo = new CameraInfo();
         private const KeyCode AlphaOne = KeyCode.Alpha1;
         public int CameraCount => cameraInfos.Length;
@@ -63,10 +64,19 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             for (var i = 0; i < CameraCount; i++) cameraInfos[i].Reset();
 
             mainCamera.ForceCalcNearClip();
+
+            var subCamGo = new GameObject("subcam");
+            subCamera = subCamGo.AddComponent<Camera>();
+            subCamera.CopyFrom(mainCamera.camera);
+            subCamera.clearFlags = CameraClearFlags.Depth;
+            subCamera.cullingMask = 1 << 8;
+            subCamera.depth = 1f;
+            subCamera.transform.parent = mainCamera.transform;
         }
 
         public void Deactivate()
         {
+            UnityEngine.Object.Destroy(subCamera.gameObject);
             mainCamera.camera.backgroundColor = Color.black;
 
             ultimateOrbitCamera.moveSpeed = defaultCameraMoveSpeed;
@@ -96,6 +106,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 }
             }
 
+            subCamera.fieldOfView = mainCamera.camera.fieldOfView;
+
             var shift = Input.Shift;
             ultimateOrbitCamera.moveSpeed = shift ? cameraFastMoveSpeed : defaultCameraMoveSpeed;
             ultimateOrbitCamera.zoomSpeed = shift ? cameraFastZoomSpeed : defaultCameraZoomSpeed;