Skip to content

Commit

Permalink
fix camera pointers for orthographic/perspective
Browse files Browse the repository at this point in the history
  • Loading branch information
hybridherbst committed May 31, 2022
1 parent acff8bf commit 51bb3f9
Showing 1 changed file with 36 additions and 11 deletions.
47 changes: 36 additions & 11 deletions UnityGLTF/Assets/UnityGLTF/Runtime/Scripts/GLTFSceneExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4613,18 +4613,38 @@ public void AddAnimationData(Object animatedObject, string propertyName, GLTFAni
}
break;
case Camera camera:
switch (propertyName)
if(camera.orthographic)
{
case "field of view":
// TODO conversion factor
propertyName = "yfov";
break;
case "near clip plane":
propertyName = "znear";
break;
case "far clip plane":
propertyName = "zfar";
break;
switch (propertyName)
{
case "orthographic size":
// TODO conversion factor
propertyName = "orthographic/ymag";
secondPropertyName = "orthographic/xmag";
break;
case "near clip plane":
propertyName = "orthographic/znear";
break;
case "far clip plane":
propertyName = "orthographic/zfar";
break;
}
}
else
{
switch (propertyName)
{
case "field of view":
// TODO conversion factor
propertyName = "perspective/yfov";
break;
case "near clip plane":
propertyName = "perspective/znear";
break;
case "far clip plane":
propertyName = "perspective/zfar";
break;
}
}
break;
default:
Expand Down Expand Up @@ -4666,6 +4686,11 @@ public void AddAnimationData(Object animatedObject, string propertyName, GLTFAni
else
{
Tsampler.Output = ExportAccessor(Array.ConvertAll(values, e => (float)e));

if (propertyName == "orthographic/ymag")
{
Tsampler2.Output = Tsampler.Output;
}
}
break;
case Vector2 _:
Expand Down

0 comments on commit 51bb3f9

Please sign in to comment.