| 7 | #include "PHDebug.h" |
| 8 | |
| 9 | void object_shift::dbg_draw(const Fmatrix& current_pos, const extrapolation::points& predict, const Fvector& start) const |
| 10 | { |
| 11 | Fvector p0; |
| 12 | current_pos.transform_tiny(p0, start); |
| 13 | Fmatrix predicted_pos; |
| 14 | predict.extrapolate(predicted_pos, taget_time); |
| 15 | Fvector p1; |
| 16 | predicted_pos.transform_tiny(p1, start); |
| 17 | const u16 nb_points = 200; |
| 18 | |
| 19 | float time_global = Device.fTimeGlobal; |
| 20 | if (time_global > taget_time) |
| 21 | time_global = taget_time; |
| 22 | |
| 23 | float time = taget_time - time_global; |
| 24 | float time_passed = time_global - current_time; |
| 25 | if (fis_zero(time)) |
| 26 | return; |
| 27 | |
| 28 | float time_quant = (time) / nb_points; |
| 29 | |
| 30 | const Fvector vadd = Fvector().sub(p1, p0).mul(1.f / nb_points); |
| 31 | for (u16 i = 0; i < nb_points; ++i) |
| 32 | { |
| 33 | float fshift0 = current + delta_shift(time_passed + time_quant * i); |
| 34 | float fshift1 = current + delta_shift(time_passed + time_quant * (i + 1)); |
| 35 | Fvector v0 = Fvector().add(p0, Fvector().mul(vadd, float(i))).add(Fvector().set(0, fshift0, 0)); |
| 36 | Fvector v1 = Fvector().add(p0, Fvector().mul(vadd, float(i + 1))).add(Fvector().set(0, fshift1, 0)); |
| 37 | |
| 38 | DBG_DrawLine(v0, v1, color_xrgb(0, 255, 0)); |
| 39 | } |
| 40 | |
| 41 | float start_shift = current + delta_shift(time_passed); |
| 42 | float end_shift = current + delta_shift(time_passed + time); |
| 43 | DBG_DrawLine(Fvector().add(p0, Fvector().set(0, start_shift, 0)), Fvector().add(p1, Fvector().set(0, end_shift, 0)), color_xrgb(255, 0, 0)); |
| 44 | } |
| 45 | #endif |
| 46 | |
| 47 | static const float global_max_shift = 1.0f; |
no test coverage detected