|
|
| @@ -29,7 +29,7 @@ static constexpr sgVec2i WindowDims = (sgVec2i){.x = WindowWidth, .y = WindowH |
| 29 | |
29 | |
| 30 | static constexpr R Fovy = (R)(90 * TO_RAD); |
30 | static constexpr R Fovy = (R)(90 * TO_RAD); |
| 31 | static constexpr R Near = 0.1f; |
31 | static constexpr R Near = 0.1f; |
| 32 | static constexpr R Far = 1000.0f; |
32 | static constexpr R Far = 100.0f; |
| 33 | |
33 | |
| 34 | #define DEBUG_EVENT_LOOP 1 |
34 | #define DEBUG_EVENT_LOOP 1 |
| 35 | |
35 | |
| @@ -69,7 +69,7 @@ typedef struct State { |
| 69 | void* gfx_mem; |
69 | void* gfx_mem; |
| 70 | swgfx* gfx; |
70 | swgfx* gfx; |
| 71 | Model* model; |
71 | Model* model; |
| 72 | sgTexture_t texture; |
72 | sgImage texture; |
| 73 | Camera camera; |
73 | Camera camera; |
| 74 | CameraController camera_controller; |
74 | CameraController camera_controller; |
| 75 | Uint64 last_tick; |
75 | Uint64 last_tick; |
| @@ -291,7 +291,7 @@ static bool Initialize(State* state) { |
| 291 | } |
291 | } |
| 292 | if (state->model->material.diffuseTexture[0] != 0) { |
292 | if (state->model->material.diffuseTexture[0] != 0) { |
| 293 | // TODO: When doing lighting, need to gamma-correct here. |
293 | // TODO: When doing lighting, need to gamma-correct here. |
| 294 | sgTexture_t texture = {0}; |
294 | sgImage texture = {0}; |
| 295 | int channels = 0; |
295 | int channels = 0; |
| 296 | constexpr int desired_channels = 4; |
296 | constexpr int desired_channels = 4; |
| 297 | texture.pixels = (sgPixel*)stbi_load(state->model->material.diffuseTexture, &texture.width, &texture.height, &channels, desired_channels); |
297 | texture.pixels = (sgPixel*)stbi_load(state->model->material.diffuseTexture, &texture.width, &texture.height, &channels, desired_channels); |
| @@ -326,7 +326,7 @@ static void Shutdown(State* state) { |
| 326 | |
326 | |
| 327 | if (state->texture.pixels) { |
327 | if (state->texture.pixels) { |
| 328 | free(state->texture.pixels); |
328 | free(state->texture.pixels); |
| 329 | state->texture = (sgTexture_t){0}; |
329 | state->texture = (sgImage){0}; |
| 330 | } |
330 | } |
| 331 | |
331 | |
| 332 | if (state->model) { |
332 | if (state->model) { |
|