CORE_Static
This commit is contained in:
@@ -1596,7 +1596,7 @@ api Vec4 normalize(Vec4 a) {
|
||||
return result;
|
||||
}
|
||||
|
||||
function
|
||||
CORE_Static
|
||||
Mat4 mat4_identity() {
|
||||
Mat4 result = {};
|
||||
result.p[0][0] = 1;
|
||||
@@ -1606,7 +1606,7 @@ Mat4 mat4_identity() {
|
||||
return result;
|
||||
}
|
||||
|
||||
function
|
||||
CORE_Static
|
||||
Mat4 mat4_scale(Vec3 a) {
|
||||
Mat4 result = {};
|
||||
result.p[0][0] = a.x;
|
||||
@@ -1616,7 +1616,7 @@ Mat4 mat4_scale(Vec3 a) {
|
||||
return result;
|
||||
}
|
||||
|
||||
function
|
||||
CORE_Static
|
||||
Mat4 mat4_translation(Vec3 a) {
|
||||
return {
|
||||
1, 0, 0, a.x,
|
||||
@@ -1626,7 +1626,7 @@ Mat4 mat4_translation(Vec3 a) {
|
||||
};
|
||||
}
|
||||
|
||||
function
|
||||
CORE_Static
|
||||
Mat4 mat4_rotation_z(float rotation) {
|
||||
float s = sinf(rotation);
|
||||
float c = cosf(rotation);
|
||||
@@ -1639,7 +1639,7 @@ Mat4 mat4_rotation_z(float rotation) {
|
||||
return result;
|
||||
}
|
||||
|
||||
function
|
||||
CORE_Static
|
||||
Mat4 mat4_rotation_y(float rotation) {
|
||||
float s = sinf(rotation);
|
||||
float c = cosf(rotation);
|
||||
@@ -1652,7 +1652,7 @@ Mat4 mat4_rotation_y(float rotation) {
|
||||
return result;
|
||||
}
|
||||
|
||||
function
|
||||
CORE_Static
|
||||
Mat4 mat4_rotation_x(float rotation) {
|
||||
float s = sinf(rotation);
|
||||
float c = cosf(rotation);
|
||||
@@ -1667,7 +1667,7 @@ Mat4 mat4_rotation_x(float rotation) {
|
||||
|
||||
constexpr F32 deg2rad = (PI32 / 180.f); // @Usage: degree * deg2rad = radians;
|
||||
constexpr F32 rad2deg = (180.f / PI32);
|
||||
function
|
||||
CORE_Static
|
||||
Mat4 mat4_perspective(float fov, float window_x, float window_y, float znear, float zfar) {
|
||||
float aspect_ratio = window_y / window_x;
|
||||
float f = (1.f / tanf((fov/2.f)*deg2rad));
|
||||
@@ -1680,7 +1680,7 @@ Mat4 mat4_perspective(float fov, float window_x, float window_y, float znear, fl
|
||||
return result;
|
||||
}
|
||||
|
||||
function Mat4 mat4_look_at(Vec3 pos, Vec3 target, Vec3 up) {
|
||||
CORE_Static Mat4 mat4_look_at(Vec3 pos, Vec3 target, Vec3 up) {
|
||||
Vec3 z = normalize(target - pos);
|
||||
Vec3 x = normalize(cross(up, z));
|
||||
Vec3 y = cross(z, x);
|
||||
@@ -1693,7 +1693,7 @@ function Mat4 mat4_look_at(Vec3 pos, Vec3 target, Vec3 up) {
|
||||
return result;
|
||||
}
|
||||
|
||||
function
|
||||
CORE_Static
|
||||
Mat4 mat4_transpose(Mat4 a) {
|
||||
Mat4 result = a;
|
||||
result.p[0][1] = result.p[1][0];
|
||||
@@ -1705,7 +1705,7 @@ Mat4 mat4_transpose(Mat4 a) {
|
||||
return result;
|
||||
}
|
||||
|
||||
function
|
||||
CORE_Static
|
||||
Mat4 mat4_translate(Mat4 a, Vec3 translation) {
|
||||
a.p[0][0] += translation.x;
|
||||
a.p[0][1] += translation.y;
|
||||
|
||||
Reference in New Issue
Block a user