namespace Cthangover.Live2D.Cubism.Framework
{
///
/// Cubism model parameter.
/// Each parameter has a string ID, a numeric index into the native
/// parameter arrays, current value, and bounds (min, max, default).
///
/// Parameters are created during
/// and exposed via . External code
/// can read/write and call
/// to push changes back to the CubismCore native arrays.
///
public class CubismParameter
{
public CubismNativeModel Model { get; }
public CubismParameter(CubismNativeModel model)
{
Model = model;
}
/// Cubism parameter ID string (e.g. "ParamAngleX", "ParamMouthOpenY").
public string Id { get; set; }
/// Zero-based index into the native parameter arrays.
public int Index { get; set; }
/// Current parameter value. Writes to native model when is called.
public float Value { get; set; }
/// Minimum allowed value for this parameter.
public float MinimumValue { get; set; }
/// Maximum allowed value for this parameter.
public float MaximumValue { get; set; }
/// Default (rest) value for this parameter from the moc3.
public float DefaultValue { get; set; }
///
/// Writes directly to the native model's parameter array.
/// No clamping is performed — the caller should enforce bounds if needed.
///
public unsafe void ApplyToModel()
{
var values = Model.GetParameterValues();
values[Index] = Value;
}
}
}