X-Git-Url: https://git.lukelau.me/?p=opengl.git;a=blobdiff_plain;f=util.hpp;h=4ccef53b62cb1371ee6f18bc3738ceaf2c164bb7;hp=89236e242e9f11892d3c505dadf926756b09ab25;hb=d88201b31a6319afd04ae31059149b0617a560b5;hpb=dbd855720a9af7d6e599ddc50bbbb0dee85458a5 diff --git a/util.hpp b/util.hpp index 89236e2..4ccef53 100644 --- a/util.hpp +++ b/util.hpp @@ -1,6 +1,33 @@ #include "program.hpp" #include +#include void initUtilProg(); Program *getUtilProg(); void drawDebugNode(glm::mat4 transform, glm::vec4 color = {1, 0.5, 1, 1}); +void printMatrix4x4(aiMatrix4x4 m); +void printVec3(glm::vec3 v); + +inline glm::mat4 aiMatrixToMat4(aiMatrix4x4 from) { + glm::mat4 to; + for (int i = 0; i < 4; i++) + for (int j = 0; j < 4; j++) + to[i][j] = from[j][i]; + return to; +} + +inline aiMatrix4x4 mat4ToaiMatrix(glm::mat4 from) { + aiMatrix4x4 to; + for (int i = 0; i < 4; i++) + for (int j = 0; j < 4; j++) + to[i][j] = from[j][i]; + return to; +} + +inline glm::vec3 aiVector3DToVec3(aiVector3D from) { + return {from[0], from[1], from[2]}; +} + +inline aiVector3D vec3ToaiVector3D(glm::vec3 from) { + return {from[0], from[1], from[2]}; +}