| 21 | #include "Sequence.h" |
| 22 | |
| 23 | void BenchmarkSequence::ReadKeyframes(const json& jSequence, float timeStart, float timeEnd) |
| 24 | { |
| 25 | m_timeStart = jSequence.value("timeStart", timeStart); |
| 26 | m_timeEnd = jSequence.value("timeEnd", timeEnd); |
| 27 | |
| 28 | m_keyFrames.clear(); |
| 29 | |
| 30 | const json& keyFrames = jSequence["keyFrames"]; |
| 31 | for (const json& jkf : keyFrames) |
| 32 | { |
| 33 | KeyFrame key = {}; |
| 34 | key.m_camera = -1; |
| 35 | |
| 36 | key.m_time = jkf["time"]; |
| 37 | |
| 38 | auto find = jkf.find("camera"); |
| 39 | if(find != jkf.cend()) |
| 40 | { |
| 41 | key.m_camera = find.value(); |
| 42 | } |
| 43 | |
| 44 | if (key.m_camera == -1) |
| 45 | { |
| 46 | const json& jfrom = jkf["from"]; |
| 47 | key.m_from = math::Vector4(jfrom[0], jfrom[1], jfrom[2], 0); |
| 48 | |
| 49 | const json& jto = jkf["to"]; |
| 50 | key.m_to = math::Vector4(jto[0], jto[1], jto[2], 0); |
| 51 | } |
| 52 | |
| 53 | key.m_screenShotName = jkf.value("screenShotName", ""); |
| 54 | |
| 55 | m_keyFrames.push_back(key); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | float BenchmarkSequence::GetNextKeyTime(float time) |
| 60 | { |