------------------------------------------------------------------------------------------------
| 180 | |
| 181 | // ------------------------------------------------------------------------------------------------ |
| 182 | void TargetAnimationHelper::Process(std::vector<aiVectorKey> *distanceTrack) { |
| 183 | ai_assert(nullptr != targetPositions); |
| 184 | ai_assert(nullptr != distanceTrack); |
| 185 | |
| 186 | // TODO: in most cases we won't need the extra array |
| 187 | std::vector<aiVectorKey> real; |
| 188 | |
| 189 | std::vector<aiVectorKey> *fill = (distanceTrack == objectPositions ? &real : distanceTrack); |
| 190 | fill->reserve(std::max(objectPositions->size(), targetPositions->size())); |
| 191 | |
| 192 | // Iterate through all object keys and interpolate their values if necessary. |
| 193 | // Then get the corresponding target position, compute the difference |
| 194 | // vector between object and target position. Then compute a rotation matrix |
| 195 | // that rotates the base vector of the object coordinate system at that time |
| 196 | // to match the diff vector. |
| 197 | |
| 198 | KeyIterator iter(objectPositions, targetPositions, &fixedMain); |
| 199 | for (; !iter.Finished(); ++iter) { |
| 200 | const aiVector3D &position = iter.GetCurPosition(); |
| 201 | const aiVector3D &tposition = iter.GetCurTargetPosition(); |
| 202 | |
| 203 | // diff vector |
| 204 | aiVector3D diff = tposition - position; |
| 205 | ai_real f = diff.Length(); |
| 206 | |
| 207 | // output distance vector |
| 208 | if (f) { |
| 209 | fill->push_back(aiVectorKey()); |
| 210 | aiVectorKey &v = fill->back(); |
| 211 | v.mTime = iter.GetCurTime(); |
| 212 | v.mValue = diff; |
| 213 | |
| 214 | diff /= f; |
| 215 | } else { |
| 216 | // FIXME: handle this |
| 217 | } |
| 218 | |
| 219 | // diff is now the vector in which our camera is pointing |
| 220 | } |
| 221 | |
| 222 | if (real.size()) { |
| 223 | *distanceTrack = real; |
| 224 | } |
| 225 | } |
nothing calls this directly
no test coverage detected