MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / getSample

Method getSample

Engine/source/afx/afxConstraint.cpp:2227–2254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2225}
2226
2227void afxSampleXfmBuffer::getSample(F32 lag, void* data, bool& in_bounds)
2228{
2229 U32 idx1, idx2;
2230 F32 t;
2231 in_bounds = compute_idx_from_lag(lag, idx1, idx2, t);
2232
2233 if (idx1 == idx2)
2234 {
2235 MatrixF* m1 = &mXfm_buffer[idx1];
2236 *((MatrixF*)data) = *m1;
2237 }
2238 else
2239 {
2240 MatrixF* m1 = &mXfm_buffer[idx1];
2241 MatrixF* m2 = &mXfm_buffer[idx2];
2242
2243 Point3F p1 = m1->getPosition();
2244 Point3F p2 = m2->getPosition();
2245 Point3F p; p.interpolate(p1, p2, t);
2246
2247 if (t < 0.5f)
2248 *((MatrixF*)data) = *m1;
2249 else
2250 *((MatrixF*)data) = *m2;
2251
2252 ((MatrixF*)data)->setPosition(p);
2253 }
2254}
2255
2256//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
2257// afxPointHistConstraint

Callers 2

getPositionMethod · 0.80
getTransformMethod · 0.80

Calls 3

getPositionMethod · 0.45
interpolateMethod · 0.45
setPositionMethod · 0.45

Tested by

no test coverage detected