mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-04-25 07:28:51 -05:00
MorphTargetBinding
This commit is contained in:
parent
ab79501f9f
commit
a57e30e3ba
|
|
@ -249,12 +249,7 @@ namespace UniVRM10
|
|||
maxWeightName = name;
|
||||
maxWeight = weight;
|
||||
}
|
||||
list.Add(new MorphTargetBinding
|
||||
{
|
||||
Index = i,
|
||||
RelativePath = relativePath,
|
||||
Weight = weight
|
||||
});
|
||||
list.Add(new MorphTargetBinding(relativePath, i, weight));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace UniVRM10
|
|||
public struct MorphTargetBinding : IEquatable<MorphTargetBinding>
|
||||
{
|
||||
/// <summary>
|
||||
/// SkinnedMeshRenderer を 指し示す。
|
||||
/// SkinnedMeshRenderer.BlendShape[Index].Weight を 指し示す。
|
||||
///
|
||||
/// [トレードオフ]
|
||||
///
|
||||
|
|
@ -16,9 +16,22 @@ namespace UniVRM10
|
|||
/// * モデル変更時の改変への強さ
|
||||
///
|
||||
/// </summary>
|
||||
public String RelativePath;
|
||||
public int Index;
|
||||
public float Weight;
|
||||
public readonly String RelativePath;
|
||||
public readonly int Index;
|
||||
public readonly float Weight;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="weight">0 to 100</param>
|
||||
public MorphTargetBinding(string path, int index, float weight)
|
||||
{
|
||||
RelativePath = path;
|
||||
Index = index;
|
||||
Weight = weight;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -46,12 +46,8 @@ namespace UniVRM10
|
|||
names.Add(mesh.GetBlendShapeName(i));
|
||||
}
|
||||
|
||||
return new UniVRM10.MorphTargetBinding
|
||||
{
|
||||
RelativePath = relativePath,
|
||||
Index = names.IndexOf(bind.Name),
|
||||
Weight = bind.Value,
|
||||
};
|
||||
// VRM-1.0 では値域は [0-1.0f]
|
||||
return new UniVRM10.MorphTargetBinding(relativePath, names.IndexOf(bind.Name), bind.Value * 100.0f);
|
||||
}
|
||||
|
||||
static UniVRM10.MaterialColorBinding? Build10(this VrmLib.MaterialColorBind bind, ModelMap loader)
|
||||
|
|
|
|||
|
|
@ -152,7 +152,8 @@ namespace UniVRM10
|
|||
var blendShapeValue = new VrmLib.MorphTargetBind(
|
||||
node,
|
||||
names[binding.Index],
|
||||
binding.Weight
|
||||
// Unity Range [0-100] to VRM-1.0 Range [0-1.0]
|
||||
binding.Weight * 0.01f
|
||||
);
|
||||
expression.MorphTargetBinds.Add(blendShapeValue);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user