10#include "math/float4.h"
11#include "math/quaternion.h"
13#include "characters/characterjointmask.h"
27 const float4& velocityScale,
28 const float4* src0SamplePtr,
30 uchar* outSampleCounts)
34 for (i = 0; i < numCurves; i++)
37 if (!curve.IsActive())
40 outSampleCounts[i] = 0;
45 outSampleCounts[i] = 1;
49 f0 = curve.GetStaticKey();
53 f0.load((
scalar*)src0SamplePtr);
61 f0 = float4::multiply(f0, velocityScale);
63 f0.store((
scalar*)outSamplePtr);
77 const float4& velocityScale,
78 const float4* src0SamplePtr,
79 const float4* src1SamplePtr,
81 uchar* outSampleCounts)
84 quaternion q0, q1, qDst;
86 for (i = 0; i < numCurves; i++)
89 if (!curve.IsActive())
92 outSampleCounts[i] = 0;
99 outSampleCounts[i] = 1;
101 if (curve.IsStatic())
104 f0 = curve.GetStaticKey();
107 f0 = float4::multiply(f0, velocityScale);
109 f0.store((
scalar*)outSamplePtr);
115 q0.load((
scalar*)src0SamplePtr);
116 q1.load((
scalar*)src1SamplePtr);
117 qDst = quaternion::slerp(q0, q1, sampleWeight);
118 qDst.store((
scalar*)outSamplePtr);
122 f0.load((
scalar*)src0SamplePtr);
123 f1.load((
scalar*)src1SamplePtr);
124 fDst = float4::lerp(f0, f1, sampleWeight);
127 fDst = float4::multiply(fDst, velocityScale);
129 fDst.store((
scalar*)outSamplePtr);
155 const Characters::CharacterJointMask* mask,
157 const float4* src0SamplePtr,
158 const float4* src1SamplePtr,
159 const uchar* src0SampleCounts,
160 const uchar* src1SampleCounts,
162 uchar* outSampleCounts)
165 quaternion q0, q1, qDst;
167 for (i = 0; i < numCurves; i++)
170 uchar src0Count = src0SampleCounts[i];
171 uchar src1Count = src1SampleCounts[i];
174 outSampleCounts[i] = src0Count + src1Count;
176 if ((src0Count > 0) && (src1Count > 0))
178 float maskWeight = 1;
181 if (mask != 0) maskWeight = mask->GetWeight(i/4);
186 q0.load((
scalar*)src0SamplePtr);
187 q1.load((
scalar*)src1SamplePtr);
188 qDst = quaternion::slerp(q0, q1, mixWeight * maskWeight);
189 qDst.store((
scalar*)outSamplePtr);
193 f0.load((
scalar*)src0SamplePtr);
194 f1.load((
scalar*)src1SamplePtr);
195 fDst = float4::lerp(f0, f1, mixWeight * maskWeight);
196 fDst.store((
scalar*)outSamplePtr);
199 else if (src0Count > 0)
202 f0.load((
scalar*)src0SamplePtr);
203 f0.store((
scalar*)outSamplePtr);
205 else if (src1Count > 0)
208 f1.load((
scalar*)src1SamplePtr);
209 f1.store((
scalar*)outSamplePtr);
An animation curve describes a set of animation keys in an AnimKeyBuffer.
Definition animcurve.h:28
Code
animation curve types, keep this order!
Definition curvetype.h:25
@ Rotation
Definition curvetype.h:27
@ Velocity
Definition curvetype.h:30
An animation resource holds a set of animations from a loaded NAX file.
Definition charactercontext.h:40
void AnimJobUtilSampleStep(const AnimCurve *curves, int numCurves, const float4 &velocityScale, const float4 *src0SamplePtr, float4 *outSamplePtr, uchar *outSampleCounts)
Sampler for "step" interpolation type.
Definition animjobutil.h:25
void AnimJobUtilSampleLinear(const AnimCurve *curves, int numCurves, float sampleWeight, const float4 &velocityScale, const float4 *src0SamplePtr, const float4 *src1SamplePtr, float4 *outSamplePtr, uchar *outSampleCounts)
Sampler for "linear" interpolation type.
Definition animjobutil.h:74
void AnimJobUtilMix(const AnimCurve *curves, int numCurves, const Characters::CharacterJointMask *mask, float mixWeight, const float4 *src0SamplePtr, const float4 *src1SamplePtr, const uchar *src0SampleCounts, const uchar *src1SampleCounts, float4 *outSamplePtr, uchar *outSampleCounts)
Mixes 2 source sample buffers into a destination sample buffer using a single lerp-value between 0....
Definition animjobutil.h:153
Different curves.
Definition angularpfeedbackloop.h:17
float scalar
Definition scalar.h:45
unsigned char uchar
Definition types.h:33