mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-06-02 22:14:30 -05:00
max
This commit is contained in:
parent
27fc4324c8
commit
d688a1568e
|
|
@ -17,9 +17,6 @@ namespace VRM
|
|||
[Range(0, 90.0f)]
|
||||
public float CurveYRangeDegree;
|
||||
|
||||
// zero 除算などを回避する閾値
|
||||
public const float MIMIMUM_INPUT_MAX_VALUE = 1e-5f;
|
||||
|
||||
public CurveMapper(float xRange, float yRange)
|
||||
{
|
||||
CurveXRangeDegree = xRange;
|
||||
|
|
@ -64,23 +61,8 @@ namespace VRM
|
|||
|
||||
public float Map(float src)
|
||||
{
|
||||
if (CurveXRangeDegree < MIMIMUM_INPUT_MAX_VALUE)
|
||||
{
|
||||
// https://github.com/vrm-c/UniVRM/issues/2452
|
||||
return src <= 0 ? 0 : CurveYRangeDegree;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (src < 0)
|
||||
{
|
||||
src = 0;
|
||||
}
|
||||
else if (src > CurveXRangeDegree)
|
||||
{
|
||||
src = CurveXRangeDegree;
|
||||
}
|
||||
return Curve.Evaluate(src / CurveXRangeDegree) * CurveYRangeDegree;
|
||||
}
|
||||
// https://github.com/vrm-c/UniVRM/issues/2452
|
||||
return Curve.Evaluate(Mathf.Clamp(src, 0, 1) / MathF.Max(CurveXRangeDegree, 0.001f)) * CurveYRangeDegree;
|
||||
}
|
||||
|
||||
public bool Equals(CurveMapper other)
|
||||
|
|
|
|||
|
|
@ -13,9 +13,6 @@ namespace UniVRM10
|
|||
[Range(0, 90.0f)]
|
||||
public float CurveYRangeDegree;
|
||||
|
||||
// zero 除算などを回避する閾値
|
||||
public const float MIMIMUM_INPUT_MAX_VALUE = 1e-5f;
|
||||
|
||||
public CurveMapper(float xRange, float yRange)
|
||||
{
|
||||
CurveXRangeDegree = xRange;
|
||||
|
|
@ -32,23 +29,8 @@ namespace UniVRM10
|
|||
|
||||
public float Map(float src)
|
||||
{
|
||||
if (CurveXRangeDegree < MIMIMUM_INPUT_MAX_VALUE)
|
||||
{
|
||||
// https://github.com/vrm-c/UniVRM/issues/2452
|
||||
return src <= 0 ? 0 : CurveXRangeDegree;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (src < 0)
|
||||
{
|
||||
src = 0;
|
||||
}
|
||||
else if (src > CurveXRangeDegree)
|
||||
{
|
||||
src = CurveXRangeDegree;
|
||||
}
|
||||
return src / CurveXRangeDegree * CurveYRangeDegree;
|
||||
}
|
||||
// https://github.com/vrm-c/UniVRM/issues/2452
|
||||
return Mathf.Clamp(src, 0, CurveXRangeDegree) / Mathf.Max(0.001f, CurveXRangeDegree) * CurveYRangeDegree;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user