feature/imgui-sdl
points-test
Last change
on this file since 99d44b2 was 4762301, checked in by Dmitry Portnoy <dmp1488@…>, 6 years ago |
Make CrashLogger work for Debian-based systems
|
-
Property mode
set to
100644
|
File size:
915 bytes
|
Line | |
---|
1 | #ifndef __UTILS_H__
|
---|
2 | #define __UTILS_H__
|
---|
3 |
|
---|
4 | #include <string>
|
---|
5 |
|
---|
6 | #include <glm/mat4x4.hpp>
|
---|
7 | #include <glm/gtc/type_ptr.hpp>
|
---|
8 |
|
---|
9 | using namespace std;
|
---|
10 | using namespace glm;
|
---|
11 |
|
---|
12 | float getRandomNum(float low, float high);
|
---|
13 |
|
---|
14 | void printVec3(string label, const vec3& v);
|
---|
15 | void printVec4(string label, const vec4& v);
|
---|
16 | void printMat4(string label, const mat4& m);
|
---|
17 |
|
---|
18 | // Code for offset_of function from https://gist.github.com/graphitemaster/494f21190bb2c63c5516
|
---|
19 |
|
---|
20 | template <typename T1, typename T2>
|
---|
21 | struct offset_of_impl {
|
---|
22 | static T2 object;
|
---|
23 | static constexpr size_t offset(T1 T2::*member) {
|
---|
24 | return size_t(&(offset_of_impl<T1, T2>::object.*member)) -
|
---|
25 | size_t(&offset_of_impl<T1, T2>::object);
|
---|
26 | }
|
---|
27 | };
|
---|
28 | template <typename T1, typename T2>
|
---|
29 | T2 offset_of_impl<T1, T2>::object;
|
---|
30 |
|
---|
31 | template <typename T1, typename T2>
|
---|
32 | inline constexpr size_t offset_of(T1 T2::*member) {
|
---|
33 | return offset_of_impl<T1, T2>::offset(member);
|
---|
34 | }
|
---|
35 |
|
---|
36 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.