Compare commits
No commits in common. "a0d8da27762feed02c9714e42c196a8dc7b4fb12" and "4bcaac6c439e68eb6bfcbff45c44f4355563e9dd" have entirely different histories.
a0d8da2776
...
4bcaac6c43
@ -1,7 +1,7 @@
|
|||||||
#ifndef BASE_MATH_H
|
#ifndef BASE_MATH_H
|
||||||
#define BASE_MATH_H
|
#define BASE_MATH_H
|
||||||
|
|
||||||
typedef union Vec2F32 Vec2F32;
|
typedef struct Vec2F32 Vec2F32;
|
||||||
union Vec2F32 {
|
union Vec2F32 {
|
||||||
struct {
|
struct {
|
||||||
f32 x;
|
f32 x;
|
||||||
@ -10,14 +10,14 @@ union Vec2F32 {
|
|||||||
f32 v[2];
|
f32 v[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef union Vec3F32 Vec3F32;
|
typedef struct Vec3F32 Vec3F32;
|
||||||
union Vec3F32 {
|
union Vec3F32 {
|
||||||
struct {
|
struct {
|
||||||
f32 x;
|
f32 x;
|
||||||
f32 y;
|
f32 y;
|
||||||
f32 z;
|
f32 z;
|
||||||
};
|
};
|
||||||
f32 v[3];
|
f32 v[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
Vec3F32 vec3f32_rotate_x(Vec3F32 vector, float angle);
|
Vec3F32 vec3f32_rotate_x(Vec3F32 vector, float angle);
|
||||||
|
@ -15,8 +15,7 @@ Vec2F32 g_projected_points[POINTS];
|
|||||||
Vec3F32 camera_position = {.x = 0, .y = 0, .z = -5};
|
Vec3F32 camera_position = {.x = 0, .y = 0, .z = -5};
|
||||||
Vec3F32 cube_rotation = {.x = 0, .y = 0, .z = 0};
|
Vec3F32 cube_rotation = {.x = 0, .y = 0, .z = 0};
|
||||||
|
|
||||||
s32 is_running;
|
int is_running;
|
||||||
s32 previous_frame_time = 0;
|
|
||||||
|
|
||||||
// Perspective Projection (perspective divide)
|
// Perspective Projection (perspective divide)
|
||||||
// Formula
|
// Formula
|
||||||
@ -70,13 +69,6 @@ void process_input(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void update(void) {
|
void update(void) {
|
||||||
// while(!SDL_TICKS_PASSED(SDL_GetTicks(), previous_frame_time + FRAME_TARGET_TIME)); // NOTE(tijani): SLOWWWW!!!!
|
|
||||||
s32 time_to_wait = FRAME_TARGET_TIME - (SDL_GetTicks() - previous_frame_time);
|
|
||||||
if (time_to_wait > 0 && time_to_wait <= FRAME_TARGET_TIME) {
|
|
||||||
SDL_Delay(time_to_wait);
|
|
||||||
}
|
|
||||||
// previous_frame_time = SDL_GetTicks(); // NOTE(tijani): SLOWWW!!! because it locks the OS into this.
|
|
||||||
|
|
||||||
cube_rotation.x += 0.01;
|
cube_rotation.x += 0.01;
|
||||||
cube_rotation.y += 0.01;
|
cube_rotation.y += 0.01;
|
||||||
cube_rotation.z += 0.01;
|
cube_rotation.z += 0.01;
|
||||||
|
@ -3,9 +3,6 @@
|
|||||||
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
|
||||||
#define FPS 60
|
|
||||||
#define FRAME_TARGET_TIME (1000 / FPS)
|
|
||||||
|
|
||||||
SDL_Window *window = NULL;
|
SDL_Window *window = NULL;
|
||||||
SDL_Renderer *renderer = NULL;
|
SDL_Renderer *renderer = NULL;
|
||||||
SDL_Texture *colour_buffer_texture = NULL;
|
SDL_Texture *colour_buffer_texture = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user