53 lines
1.3 KiB
C#
53 lines
1.3 KiB
C#
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
|
||
namespace Xeric.Runtime.MicroLibrary
|
||
{
|
||
/// <summary>
|
||
///
|
||
/// </summary>
|
||
/// <remarks>
|
||
/// 坐标系统换算库
|
||
/// </remarks>
|
||
public static class MacroTransferAxes
|
||
{
|
||
#region 坐标系换算
|
||
|
||
/**
|
||
* 像Maya就是Y向上的三维软件,它原来属于Silicon Graphice,Inc.的硬件开发,使用的也是SGI的标准;
|
||
* 以及DX,OpenGL也是使用Z缓冲区之类的名称来处理屏幕空间渲染。
|
||
* Unity,Zbrush,DirectX使用的是Y轴向上的左手坐标系
|
||
* Maya,OpenGL使用的是Y轴向上的右手坐标系
|
||
*
|
||
* 像Unreal诞生时Maya还没诞生,大家都用的是3D Max,所以采用了Z轴向上的左手坐标系。
|
||
* 另外3D Max,source engine,cry engine, blender使用的是Z轴向上的右手坐标系;
|
||
*
|
||
* 数学上可能左手会好些
|
||
*/
|
||
|
||
/// <summary>
|
||
/// 将Y轴向上的坐标系转为Z轴向上的坐标系;
|
||
/// </summary>
|
||
/// <param name="input"></param>
|
||
/// <returns></returns>
|
||
public static Vector3 YupToZupAxes(Vector3 input)
|
||
{
|
||
return new Vector3(input.x, input.y, input.z);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 将Z轴向上的坐标系转为Y轴向上的坐标系;
|
||
/// </summary>
|
||
/// <param name="input"></param>
|
||
/// <returns></returns>
|
||
public static Vector3 ZupToYupAxes(Vector3 input)
|
||
{
|
||
return new Vector3(input.x, input.y, input.z);
|
||
}
|
||
|
||
#endregion
|
||
|
||
}
|
||
}
|