nngn
Loading...
Searching...
No Matches
collision.h
Go to the documentation of this file.
1#ifndef NNGN_TEST_BENCH_COLLISION_H
2#define NNGN_TEST_BENCH_COLLISION_H
3
4#include <random>
5
6#include <QTest>
7
8#include "collision/collision.h"
9#include "math/vec3.h"
10
11#ifndef NNGN_BENCH_N_COLLIDERS
12#define NNGN_BENCH_N_COLLIDERS 1u << 10
13#endif
14
15class CollisionBench : public QObject {
16 Q_OBJECT
17 std::mt19937 mt = {};
18 std::uniform_real_distribution<float> pos_dist, pos_sparse_dist, rot_dist;
21protected:
22 virtual nngn::Colliders make_colliders() const = 0;
23public:
25 pos_dist(0, 16),
26 pos_sparse_dist(0, 1u << 16),
27 rot_dist(-1, 1) {}
28private slots:
29 void aabb_benchmark();
31 void bb_benchmark();
33 void sphere_benchmark();
35};
36
37#endif
Definition collision.h:15
void bb_sparse_benchmark()
Definition collision.cpp:61
std::uniform_real_distribution< float > pos_sparse_dist
Definition collision.h:18
void aabb_sparse_benchmark()
Definition collision.cpp:32
std::mt19937 mt
Definition collision.h:17
void aabb_benchmark()
Definition collision.cpp:19
std::uniform_real_distribution< float > rot_dist
Definition collision.h:18
void sphere_sparse_benchmark()
Definition collision.cpp:88
nngn::vec3 rnd()
Definition collision.cpp:10
void sphere_benchmark()
Definition collision.cpp:77
std::uniform_real_distribution< float > pos_dist
Definition collision.h:18
void bb_benchmark()
Definition collision.cpp:45
nngn::vec3 rnd_sparse()
Definition collision.cpp:13
virtual nngn::Colliders make_colliders() const =0
CollisionBench()
Definition collision.h:24
Definition collision.h:72