Implement playable Mac client and rendering validation
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
#include "water_motion.h"
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
int main() {
|
||||
mtgodot::WaterMotion m;
|
||||
assert(m.sample(100, 2000, 15) == 0);
|
||||
assert(m.sample(400, 2000, 15) == 0);
|
||||
assert(m.sample(401, 2000, 15) == 0);
|
||||
assert(std::abs(m.sample(1401, 2000, 15) + .075) < 1e-9);
|
||||
assert(std::abs(m.sample(2401, 2000, 15) + .15) < 1e-9);
|
||||
assert(std::abs(m.sample(2402, 1000, 15) + .15) < 1e-9);
|
||||
assert(std::abs(m.sample(2902, 1000, 15) + .075) < 1e-9);
|
||||
assert(m.sample(3402, 1000, 15) == 0);
|
||||
// Large frame gaps start at the last rendered height, without overshoot.
|
||||
for (uint64_t t = 3403; t < 200000; t += 137) {
|
||||
const double y = m.sample(t, 1700, 9);
|
||||
assert(y <= 0 && y >= -.15);
|
||||
}
|
||||
std::puts("PASS: shared linear water motion, endpoints, timing, no overshoot");
|
||||
}
|
||||
Reference in New Issue
Block a user