shengine pre-release
shengine by mrsinho
Loading...
Searching...
No Matches
shLinearAlgebra.h
Go to the documentation of this file.
1#ifndef SH_LINEAR_ALGEBRA_H
2#define SH_LINEAR_ALGEBRA_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif//__cplusplus
7
8
9
10#define _CRT_SECURE_NO_WARNINGS
11#pragma warning (disable: 26812 4996)
12#include <cglm/cglm.h>
13
14#include <math.h>
15
16
17
18#define SH_DEGREES_TO_RADIANS(angle) (angle) * 3.14159265358f / 180.0f
19#define SH_RADIANS_TO_DEGREES(rad) (rad) / 3.14159265358f * 180.0f
20
21typedef struct ShWindow ShWindow;
22
23
24
25static void shEulerToVector(float* rotation, float* front) {
26 front[0] = (float)(sin(rotation[1]) * cos(rotation[0]));
27 front[1] = (float)(sin(rotation[0]));
28 front[2] = -(float)(cos(rotation[1]) * cos(rotation[0]));
29}
30
31
32extern uint8_t shSetProjection(
34 float fov,
35 float nc,
36 float fc,
37 float projection[4][4]
38);
39
40extern uint8_t shSetView(
41 float* p_position,
42 float* p_front,
43 float* p_up,
44 float view[4][4]
45);
46
47
48
49#ifdef __cplusplus
50}
51#endif//__cplusplus
52
53#endif//SH_LINEAR_ALGEBRA_H
uint8_t shSetView(float *p_position, float *p_front, float *p_up, float view[4][4])
Definition shLinearAlgebra.c:35
uint8_t shSetProjection(ShWindow window, float fov, float nc, float fc, float projection[4][4])
Definition shLinearAlgebra.c:14
Structure representing a window in the shengine framework.
Definition shWindow.h:54
GLFWwindow * window
Definition shWindow.h:55