126 lines
3.9 KiB
C#
126 lines
3.9 KiB
C#
|
|
|||
|
namespace Thousandto.Plugins.Common.UniScene
|
|||
|
{
|
|||
|
//摄像机控制器的参数定义
|
|||
|
public static class CameraControlDefine
|
|||
|
{
|
|||
|
#region//常量
|
|||
|
//默认Y轴偏移量
|
|||
|
public const float DefualtTargetOffsetY = 1.5f;
|
|||
|
//默认X轴偏移量
|
|||
|
public const float DefualtTargetOffsetX = 0f;
|
|||
|
//距离改变速度
|
|||
|
public const float DisChangeSpeed = 20f;
|
|||
|
//最低pitch值
|
|||
|
public const float ConstMinPitch = -4.5f;
|
|||
|
//最大pitch值
|
|||
|
public const float ConstMaxPitch = 89f;
|
|||
|
//最小跟随距离
|
|||
|
public const float ConstMinFlowDis = 1.5f;
|
|||
|
//最大跟随距离
|
|||
|
public const float ConstMaxFlowDis = 40f;
|
|||
|
//默认pitch值
|
|||
|
public const float ConstDefaultPitch = 25f;
|
|||
|
//默认yaw值
|
|||
|
public const float ConstDefaultYaw = 0f;
|
|||
|
//默认跟随距离
|
|||
|
public const float ConstDefaultFlowDis = 8f;
|
|||
|
//默认fov
|
|||
|
public const float ConstFov = 60f;
|
|||
|
#endregion
|
|||
|
|
|||
|
#region//根据配置读取的数据
|
|||
|
//是否是远视角
|
|||
|
public static bool IsFarView = false;
|
|||
|
|
|||
|
//锁定后摄像机的控制数值
|
|||
|
public static float LockYaw = 0f;
|
|||
|
|
|||
|
public static float LockPitch
|
|||
|
{
|
|||
|
get {
|
|||
|
return IsFarView ? (FarPitch + PitchAddValue) : (NearPitch + PitchAddValue);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//限制的yaw最小值
|
|||
|
public static float MinYaw = 0f;
|
|||
|
//限制的yaw最大值
|
|||
|
public static float MaxYaw = 0f;
|
|||
|
//限制的最小距离
|
|||
|
public static float MinDis = ConstMinFlowDis;
|
|||
|
//限制的最大距离
|
|||
|
public static float MaxDis
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return IsFarView ? FarDis : NearDis;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//远视角的距离
|
|||
|
public static float FarDis = ConstMaxFlowDis;
|
|||
|
//近视角距离
|
|||
|
public static float NearDis = ConstMaxFlowDis;
|
|||
|
//远视觉的倾斜角
|
|||
|
public static float FarPitch = ConstDefaultPitch;
|
|||
|
//近视觉的倾斜角
|
|||
|
public static float NearPitch = ConstDefaultPitch;
|
|||
|
//远视角的y轴偏移
|
|||
|
public static float FarOffsetY = DefualtTargetOffsetY;
|
|||
|
//近视角的y轴偏移
|
|||
|
public static float NearOffsetY = DefualtTargetOffsetY;
|
|||
|
//该场景是否计算坡度 0不计算 1计算
|
|||
|
public static float isCalculateSlope = 0;
|
|||
|
|
|||
|
public static float LockOffsetY
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return IsFarView ? FarOffsetY : NearOffsetY;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//摄像机距离放大值,对当前的最小距离,最大距离进行加成
|
|||
|
public static float DisAddValue = 0;
|
|||
|
//摄像机pitch放大值
|
|||
|
public static float PitchAddValue = 0;
|
|||
|
|
|||
|
//当前最小距离
|
|||
|
public static float CurMinDis
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return MinDis + DisAddValue;
|
|||
|
}
|
|||
|
}
|
|||
|
//当前最大距离
|
|||
|
public static float CurMaxDis
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return MaxDis + DisAddValue;
|
|||
|
}
|
|||
|
}
|
|||
|
//fov
|
|||
|
public static float CurFov = ConstFov;
|
|||
|
#endregion
|
|||
|
|
|||
|
public static void SetCameraParms(float defaultYaw, float minYaw, float maxYaw,float defaultDis, float farDis, float defaultPitch, float farPitch, float defaultOffsetY, float farOffsetY, float fov)
|
|||
|
{
|
|||
|
LockYaw = defaultYaw;
|
|||
|
MinYaw = minYaw;
|
|||
|
MaxYaw = maxYaw;
|
|||
|
MinDis = ConstMinFlowDis;
|
|||
|
FarDis = farDis;
|
|||
|
NearDis = defaultDis;
|
|||
|
FarPitch = farPitch;
|
|||
|
NearPitch = defaultPitch;
|
|||
|
FarOffsetY = farOffsetY;
|
|||
|
NearOffsetY = defaultOffsetY;
|
|||
|
//CurFov = fov;
|
|||
|
CurFov = 60; //暂时写死看效果
|
|||
|
}
|
|||
|
}
|
|||
|
}
|