forked from NathanKell/RealSolarSystem
-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
408 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using System; | ||
using UnityEngine; | ||
|
||
namespace RealSolarSystem | ||
{ | ||
public class CameraWrapper | ||
{ | ||
public string depth = string.Empty; | ||
public string farClipPlane = string.Empty; | ||
public string nearClipPlane = string.Empty; | ||
public string camName = string.Empty; | ||
|
||
public void Apply() | ||
{ | ||
Camera[] cameras = Camera.allCameras; | ||
|
||
try | ||
{ | ||
bool notFound = true; | ||
|
||
foreach (Camera cam in cameras) | ||
{ | ||
if (camName.Equals(cam.name)) | ||
{ | ||
if (float.TryParse(depth, out float ftmp)) | ||
cam.depth = ftmp; | ||
|
||
if (float.TryParse(farClipPlane, out ftmp)) | ||
cam.farClipPlane = ftmp; | ||
|
||
if (float.TryParse(nearClipPlane, out ftmp)) | ||
cam.nearClipPlane = ftmp; | ||
|
||
depth = cam.depth.ToString(); | ||
nearClipPlane = cam.nearClipPlane.ToString(); | ||
farClipPlane = cam.farClipPlane.ToString(); | ||
|
||
notFound = false; | ||
} | ||
} | ||
|
||
if (notFound) | ||
{ | ||
Debug.Log($"[RealSolarSystem] Could not find camera {camName} when applying settings!"); | ||
} | ||
} | ||
catch (Exception exceptionStack) | ||
{ | ||
Debug.Log($"[RealSolarSystem] Error applying to camera {camName}: exception {exceptionStack.Message}"); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.