Skip to content

Commit 93a614b

Browse files
author
Wilhelm Schnepp
committed
UnityToJSON: Camera parameter export
1 parent 9d0eef3 commit 93a614b

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

UnityToJSON/Assets/Editor/UnityJSONExporter/JECamera.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,13 @@ public class JECamera : JEComponent
1919

2020
public override JSONComponent ToJSON()
2121
{
22+
var cam = unityComponent as Camera;
2223
var json = new JSONCamera();
2324
json.type = "Camera";
25+
json.projection = cam.orthographic ? ProjectionType.Orthogonal : ProjectionType.Perspective;
26+
json.fovVertical = cam.fieldOfView;
27+
json.near = cam.nearClipPlane;
28+
json.far = cam.farClipPlane;
2429
return json;
2530
}
2631

UnityToJSON/Assets/Editor/UnityJSONExporter/JSONClasses.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,18 @@ public class JSONTimeOfDay : JSONComponent
108108
public float timeOff;
109109
}
110110

111-
public class JSONCamera : JSONComponent
112-
{
111+
public enum ProjectionType
112+
{
113+
Perspective,
114+
Orthogonal
115+
}
113116

117+
public class JSONCamera : JSONComponent
118+
{
119+
public ProjectionType projection;
120+
public float fovVertical;
121+
public float near;
122+
public float far;
114123
}
115124

116125
public class JSONLight : JSONComponent

0 commit comments

Comments
 (0)