-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
1 parent
1967771
commit f89b584
Showing
3 changed files
with
88 additions
and
2 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
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
53 changes: 53 additions & 0 deletions
53
Chroma/Lighting/EnvironmentEnhancement/EnvironmentJSONDump.cs
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 UnityEngine; | ||
|
||
namespace Chroma.Lighting.EnvironmentEnhancement | ||
{ | ||
struct Vector3Json | ||
{ | ||
public float x; | ||
public float y; | ||
public float z; | ||
|
||
public Vector3Json(Vector3 vector3) | ||
{ | ||
x = vector3.x; | ||
y = vector3.y; | ||
z = vector3.z; | ||
} | ||
} | ||
|
||
struct QuaternionJson | ||
{ | ||
public float x; | ||
public float y; | ||
public float z; | ||
public float w; | ||
|
||
public QuaternionJson(Quaternion quaternion) | ||
{ | ||
x = quaternion.x; | ||
y = quaternion.y; | ||
z = quaternion.z; | ||
w = quaternion.w; | ||
} | ||
} | ||
|
||
struct GameObjectJSON | ||
{ | ||
public readonly Vector3Json position; | ||
public readonly Vector3Json localPosition; | ||
public readonly QuaternionJson rotation; | ||
public readonly QuaternionJson localRotation; | ||
public readonly Vector3Json localScale; | ||
|
||
public GameObjectJSON(GameObject gameObject) | ||
{ | ||
Transform transform = gameObject.transform; | ||
localPosition = new Vector3Json(transform.localPosition); | ||
position = new Vector3Json(transform.position); | ||
rotation = new QuaternionJson(transform.rotation); | ||
localRotation = new QuaternionJson(transform.localRotation); | ||
localScale = new Vector3Json(transform.localScale); | ||
} | ||
} | ||
} |