diff options
| author | 3gg <3gg@shellblade.net> | 2026-02-13 14:22:07 -0800 |
|---|---|---|
| committer | 3gg <3gg@shellblade.net> | 2026-02-13 14:22:07 -0800 |
| commit | ef56151860ef4fec2ad9177557d7f81977905e2d (patch) | |
| tree | 6765f531dd728328863ca0382a543ee8b90db502 /src/main.c | |
| parent | 580f98de6babae2bcc98151c080eeaa7c155abe1 (diff) | |
Pass in normals
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 7 |
1 files changed, 6 insertions, 1 deletions
| @@ -236,7 +236,8 @@ static void RenderIndexedModel(swgfx* gfx, const IndexedModel* model, const Mode | |||
| 236 | const sgTriIdx* tris = (const sgTriIdx*)(model->data + model->offsetTris) + object->offset; | 236 | const sgTriIdx* tris = (const sgTriIdx*)(model->data + model->offsetTris) + object->offset; |
| 237 | const sgVec3* positions = (const sgVec3*) (model->data + model->offsetPositions); | 237 | const sgVec3* positions = (const sgVec3*) (model->data + model->offsetPositions); |
| 238 | const sgVec2* texcoords = (const sgVec2*) (model->data + model->offsetTexcoords); | 238 | const sgVec2* texcoords = (const sgVec2*) (model->data + model->offsetTexcoords); |
| 239 | sgTrianglesIndexedNonUniform(gfx, object->count, tris, positions, texcoords); | 239 | const sgVec3* normals = (const sgVec3*) (model->data + model->offsetNormals); |
| 240 | sgTrianglesIndexedNonUniform(gfx, object->count, tris, positions, texcoords, normals); | ||
| 240 | } | 241 | } |
| 241 | 242 | ||
| 242 | static void RenderModel(swgfx* gfx, const sgImage* textures, const Model* model) { | 243 | static void RenderModel(swgfx* gfx, const sgImage* textures, const Model* model) { |
| @@ -332,6 +333,10 @@ static bool Render(State* state) { | |||
| 332 | sgTrianglesIndexed(state->gfx, 3, indices, positions, texcoords);*/ | 333 | sgTrianglesIndexed(state->gfx, 3, indices, positions, texcoords);*/ |
| 333 | sgLighting(state->gfx); | 334 | sgLighting(state->gfx); |
| 334 | sgAmbient(state->gfx, (sgVec3){1,1,1}); | 335 | sgAmbient(state->gfx, (sgVec3){1,1,1}); |
| 336 | // Debugging <-- | ||
| 337 | //sgDepth(state->gfx); | ||
| 338 | //sgNormals(state->gfx); | ||
| 339 | // --> | ||
| 335 | sgGammaInv(state->gfx, sgColourBuffer(state->gfx), BufferWidth, BufferHeight); | 340 | sgGammaInv(state->gfx, sgColourBuffer(state->gfx), BufferWidth, BufferHeight); |
| 336 | sgPresent(state->gfx, WindowDims, window_surface->pixels); | 341 | sgPresent(state->gfx, WindowDims, window_surface->pixels); |
| 337 | 342 | ||
