Example #1
0
 // 添加UNITY摄影机
 public SoftCamera AddCamera(UnityEngine.Camera cam)
 {
     if (cam != null)
     {
         bool isMainCamera = cam.CompareTag("MainCamera");
         if (cam.orthographic)
         {
             OCameraInfo info = OCameraInfo.Create();
             info.Size      = cam.orthographicSize;
             info.nearPlane = cam.nearClipPlane;
             info.farPlane  = cam.farClipPlane;
             var trans = cam.transform;
             return(AddOCamera(info, trans.position, trans.up, trans.forward, (int)cam.depth, isMainCamera));
         }
         else
         {
             PCameraInfo info = PCameraInfo.Create();
             info.nearPlane   = cam.nearClipPlane;
             info.farPlane    = cam.farClipPlane;
             info.fieldOfView = cam.fieldOfView;
             var trans = cam.transform;
             return(AddPCamera(info, trans.position, trans.up, trans.forward, (int)cam.depth, isMainCamera));
         }
     }
     return(null);
 }