tesseract wireframe and project rename/refactor
This commit is contained in:
28
simplex/include/glmutil.h
Normal file
28
simplex/include/glmutil.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef GL_TEMPLATE_GLMUTILS_H
|
||||
#define GL_TEMPLATE_GLMUTILS_H
|
||||
|
||||
#include <glm/mat4x4.hpp>
|
||||
#include <glm/vec3.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
|
||||
namespace glmutil {
|
||||
glm::mat4 rotation(float angle, glm::vec3 axis) {
|
||||
auto mat = glm::identity<glm::mat4>();
|
||||
return glm::rotate(mat, angle, axis);
|
||||
}
|
||||
|
||||
glm::mat4 scale(glm::vec3 v) {
|
||||
auto mat = glm::identity<glm::mat4>();
|
||||
return glm::scale(mat, v);
|
||||
}
|
||||
|
||||
glm::mat4 eulerAngles(glm::vec3 angles){
|
||||
auto mat = glm::identity<glm::mat4>();
|
||||
mat = glm::rotate(mat, angles.x, glm::vec3(1, 0, 0));
|
||||
mat = glm::rotate(mat, angles.y, glm::vec3(0, 1, 0));
|
||||
mat = glm::rotate(mat, angles.z, glm::vec3(0, 0, 1));
|
||||
return mat;
|
||||
}
|
||||
}
|
||||
|
||||
#endif //GL_TEMPLATE_GLMUTILS_H
|
||||
80
simplex/include/rotor.h
Normal file
80
simplex/include/rotor.h
Normal file
@@ -0,0 +1,80 @@
|
||||
#ifndef GL_TEMPLATE_ROTOR_H
|
||||
#define GL_TEMPLATE_ROTOR_H
|
||||
|
||||
#include <glm/mat4x4.hpp>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
glm::mat4 rotor_xy(float t) {
|
||||
float c = cos(t);
|
||||
float s = sin(t);
|
||||
|
||||
return glm::mat4(
|
||||
+c, s, 0, 0,
|
||||
-s, c, 0, 0,
|
||||
+0, 0, 1, 0,
|
||||
+0, 0, 0, 1
|
||||
);
|
||||
}
|
||||
|
||||
glm::mat4 rotor_xz(float t) {
|
||||
float c = cos(t);
|
||||
float s = sin(t);
|
||||
|
||||
return glm::mat4(
|
||||
+c, 0, s, 0,
|
||||
+0, 1, 0, 0,
|
||||
-s, 0, c, 0,
|
||||
+0, 0, 0, 1
|
||||
);
|
||||
}
|
||||
|
||||
glm::mat4 rotor_xw(float t) {
|
||||
float c = cos(t);
|
||||
float s = sin(t);
|
||||
|
||||
return glm::mat4(
|
||||
+c, 0, 0, s,
|
||||
+0, 1, 0, 0,
|
||||
+0, 0, 1, 0,
|
||||
-s, 0, 0, c
|
||||
);
|
||||
}
|
||||
|
||||
glm::mat4 rotor_yz(float t) {
|
||||
float c = cos(t);
|
||||
float s = sin(t);
|
||||
|
||||
return glm::mat4(
|
||||
1, +0, 0, 0,
|
||||
0, +c, s, 0,
|
||||
0, -s, c, 0,
|
||||
0, +0, 0, 1
|
||||
);
|
||||
}
|
||||
|
||||
glm::mat4 rotor_yw(float t) {
|
||||
float c = cos(t);
|
||||
float s = sin(t);
|
||||
|
||||
return glm::mat4(
|
||||
1, +0, 0, 0,
|
||||
0, +c, 0, s,
|
||||
0, +0, 1, 0,
|
||||
0, -s, 0, c
|
||||
);
|
||||
}
|
||||
|
||||
glm::mat4 rotor_zw(float t) {
|
||||
float c = cos(t);
|
||||
float s = sin(t);
|
||||
|
||||
return glm::mat4(
|
||||
1, 0, +0, 0,
|
||||
0, 1, +0, 0,
|
||||
0, 0, +c, s,
|
||||
0, 0, -s, c
|
||||
);
|
||||
}
|
||||
|
||||
#endif //GL_TEMPLATE_ROTOR_H
|
||||
Reference in New Issue
Block a user