10 #include <glm/gtc/matrix_transform.hpp> 20 glm::mat4 Model::identity() {
24 glm::mat4 Model::scale(
float x,
float y,
float z) {
25 return Model::scale(vec3(x, y, z));
28 glm::mat4 Model::scale(glm::vec3 vector) {
29 return Model::scale(mat4(), vector);
32 glm::mat4 Model::scale(glm::mat4 matrix,
float x,
float y,
float z) {
33 return Model::scale(matrix, vec3(x, y, z));
36 glm::mat4 Model::scale(glm::mat4 matrix, glm::vec3 vector) {
37 return glm::scale(matrix, vector);
40 glm::mat4 Model::translate(
float x,
float y,
float z) {
41 return Model::translate(vec3(x, y, z));
44 glm::mat4 Model::translate(glm::vec3 vector) {
45 return Model::translate(mat4(), vector);
48 glm::mat4 Model::translate(glm::mat4 matrix,
float x,
float y,
float z) {
49 return Model::translate(matrix, vec3(x, y, z));
52 glm::mat4 Model::translate(glm::mat4 matrix, glm::vec3 vector) {
53 return glm::translate(matrix, vector);
56 glm::mat4 Model::rotate(
float angle,
float x,
float y,
float z) {
57 return Model::rotate(angle, vec3(x, y, z));
60 glm::mat4 Model::rotate(
float angle, glm::vec3 vector) {
61 return Model::rotate(mat4(), angle, vector);
64 glm::mat4 Model::rotate(glm::mat4 matrix,
float angle,
float x,
float y,
float z) {
65 return Model::rotate(matrix, angle, vec3(x, y, z));
68 glm::mat4 Model::rotate(glm::mat4 matrix,
float angle, glm::vec3 vector) {
70 return glm::rotate(matrix, glm::radians(angle), vector);
77 glm::mat4 View::identity() {
81 glm::mat4 View::lookAt(glm::vec3 eye, glm::vec3 center, glm::vec3 up) {
82 return glm::lookAt(eye, center, up);
85 glm::mat4 View::lookAt(
float eyeX,
float eyeY,
float eyeZ,
float centerX,
float centerY,
float centerZ,
float upX,
float upY,
float upZ) {
86 return View::lookAt(vec3(eyeX, eyeY, eyeZ), vec3(centerX, centerY, centerZ), vec3(upX, upY, upZ));
89 glm::mat4 View::lookAt(
Camera camera) {
93 Projection::Projection(
void) {
97 glm::mat4 Projection::identity() {
101 glm::mat4 Projection::ortho(
float left,
float right,
float bottom,
float top,
float zNear,
float zFar) {
102 return glm::ortho(left, right, bottom, top, zNear, zFar);
105 glm::mat4 Projection::frustum(
float left,
float right,
float bottom,
float top,
float zNear,
float zFar) {
106 return glm::frustum(left, right, bottom, top, zNear, zFar);
109 glm::mat4 Projection::perspective(
float fovy,
float aspect,
float zNear,
float zFar) {
111 return glm::perspective(glm::radians(fovy), aspect, zNear, zFar);
glm::vec3 front
The front side direction of the camera.
Generic namespace for the SimpleGL framework.
This struct defines a camera.
glm::vec3 position
The position of the camera.
glm::vec3 up
The up vector if the camera.