namespace Cthangover.Live2D.Cubism.Framework
{
///
/// Cubism model part opacity.
/// Each part has a string ID, a numeric index into the native part arrays,
/// and a current opacity value (0 = hidden, 1 = fully visible).
///
/// Parts are created during
/// and exposed via .
/// External code can set and call
/// to push the change to CubismCore.
///
public class CubismPartOpacity
{
public CubismNativeModel Model { get; }
public CubismPartOpacity(CubismNativeModel model)
{
Model = model;
}
/// Cubism part ID string (e.g. "PartArmL", "PartHairBack").
public string Id { get; set; }
/// Zero-based index into the native part arrays.
public int Index { get; set; }
///
/// Current opacity value for this part. 0 = hidden, 1 = fully visible.
/// Written to native model when is called.
///
public float Value { get; set; }
///
/// Writes directly to the native model's part opacities array.
///
public unsafe void ApplyToModel()
{
var opacities = Model.GetPartOpacities();
opacities[Index] = Value;
}
}
}