Ejemplo n.º 1
0
//@Todo curve flags won't transfer over - it only overwritees
void FBlendedCurve::Blend(const FBlendedCurve& A, const FBlendedCurve& B, float Alpha)
{
	check(A.Num()==B.Num());
	if(FMath::Abs(Alpha) <= ZERO_ANIMWEIGHT_THRESH)
	{
		// if blend is all the way for child1, then just copy its bone atoms
		Override(A);
	}
	else if(FMath::Abs(Alpha - 1.0f) <= ZERO_ANIMWEIGHT_THRESH)
	{
		// if blend is all the way for child2, then just copy its bone atoms
		Override(B);
	}
	else
	{
		InitFrom(A);
		for(int32 CurveId=0; CurveId<A.Elements.Num(); ++CurveId)
		{
			Elements[CurveId].Value = FMath::Lerp(A.Elements[CurveId].Value, B.Elements[CurveId].Value, Alpha); 
			Elements[CurveId].Flags |= (A.Elements[CurveId].Flags | B.Elements[CurveId].Flags);
		}
	}

	ValidateCurve(this);
}
Ejemplo n.º 2
0
void FBlendedCurve::ConvertToAdditive(const FBlendedCurve& BaseCurve)
{
	check(bInitialized);
	check(Num()==BaseCurve.Num());

	for(int32 CurveId=0; CurveId<Elements.Num(); ++CurveId)
	{
		Elements[CurveId].Value -= BaseCurve.Elements[CurveId].Value;
		Elements[CurveId].Flags |= BaseCurve.Elements[CurveId].Flags;
	}
	ValidateCurve(this);
}
Ejemplo n.º 3
0
void FBlendedCurve::Accumulate(const FBlendedCurve& AdditiveCurve, float Weight)
{
	check(bInitialized);
	check(Num()==AdditiveCurve.Num());

	if (Weight > ZERO_ANIMWEIGHT_THRESH)
	{
		for(int32 CurveId=0; CurveId<Elements.Num(); ++CurveId)
		{
			Elements[CurveId].Value += AdditiveCurve.Elements[CurveId].Value * Weight;
			Elements[CurveId].Flags |= AdditiveCurve.Elements[CurveId].Flags;
		}
	}

	ValidateCurve(this);
}
Ejemplo n.º 4
0
void FBlendedCurve::Combine(const FBlendedCurve& CurveToCombine)
{
	check(bInitialized);
	check(Num()==CurveToCombine.Num());

	for(int32 CurveId=0; CurveId<CurveToCombine.Elements.Num(); ++CurveId)
	{
		// if target value is non zero, we accpet target's value
		// originally this code was doing max, but that doesn't make sense since the values can be negative
		// we could try to pick non-zero, but if target value is non-zero, I think we should accept that value 
		// if source is non zero, it will be overriden
		if (CurveToCombine.Elements[CurveId].Value != 0.f)
		{
			Elements[CurveId].Value = CurveToCombine.Elements[CurveId].Value; 
		}

		Elements[CurveId].Flags |= CurveToCombine.Elements[CurveId].Flags;
	}

	ValidateCurve(this);
}