: IPosed, IPosedInternal
where D : PosedData
where P : IPose
{
internal readonly D data;
internal readonly P pose, constrainedPose;
internal P appliedPose;
protected Posed (D data, P pose, P constrainedPose) {
if (data == null) throw new ArgumentNullException("data", "data cannot be null.");
this.data = data;
this.pose = pose;
this.constrainedPose = constrainedPose;
appliedPose = pose;
}
/// Sets the unconstrained pose to the setup pose.
public virtual void SetupPose () {
pose.Set(data.setupPose);
}
bool IPosedInternal.PoseEqualsApplied {
get { return (object)pose == (object)appliedPose; }
}
void IPosedInternal.Unconstrained () {
appliedPose = pose;
}
void IPosedInternal.Constrained () {
appliedPose = constrainedPose;
}
void IPosedInternal.ResetConstrained () {
appliedPose.Set(pose);
}
/// The setup pose data. May be shared with multiple instances.
public D Data { get { return data; } }
/// The unconstrained pose for this object, set by animations and application code.
public P Pose { get { return pose; } }
/// The pose to use for rendering. If no constraints modify this pose, this is the same as . Otherwise it is a
/// copy of modified by constraints.
public P AppliedPose { get { return appliedPose; } }
override public string ToString () {
return data.name;
}
}
}