source: opengl-game/utils.cpp@ cf727ca

feature/imgui-sdl points-test
Last change on this file since cf727ca was 203ab1b, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 5 years ago

Rename utils.h to utils.hpp

  • Property mode set to 100644
File size: 895 bytes
Line 
1#include "utils.hpp"
2
3#include <iostream>
4
5float getRandomNum(float low, float high) {
6 return low + ((float)rand() / RAND_MAX) * (high-low);
7}
8
9void printVec3(string label, const vec3& v) {
10 cout << label << " -> (" << v.x << "," << v.y << "," << v.z << ")" << endl;
11}
12
13void printVec4(string label, const vec4& v) {
14 cout << label << " -> (" << v.x << "," << v.y << "," << v.z << "," << v.w << ")" << endl;
15}
16
17void printMat4(string label, const mat4& m) {
18 cout << label << ": " << endl;
19 cout << "[ " << m[0][0] << " " << m[1][0] << " " << m[2][0] << " " << m[3][0] << " ]" << endl;
20 cout << "[ " << m[0][1] << " " << m[1][1] << " " << m[2][1] << " " << m[3][1] << " ]" << endl;
21 cout << "[ " << m[0][2] << " " << m[1][2] << " " << m[2][2] << " " << m[3][2] << " ]" << endl;
22 cout << "[ " << m[0][3] << " " << m[1][3] << " " << m[2][3] << " " << m[3][3] << " ]" << endl;
23}
Note: See TracBrowser for help on using the repository browser.