From b932a39e51a0312f7fdd5848d0eda475ed244e18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Thu, 13 Jun 2019 18:15:14 +0200 Subject: [PATCH] Add wireframe mode --- programs/modelViewer.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/programs/modelViewer.c b/programs/modelViewer.c index 9ce4f4f..c91102a 100644 --- a/programs/modelViewer.c +++ b/programs/modelViewer.c @@ -132,6 +132,7 @@ S3L_Vec4 toLight; int8_t light = 1; int8_t fog = 0; int8_t noise = 0; +int8_t wire = 0; int8_t transparency = 0; int8_t mode = 0; S3L_Vec4 n0, n1, n2, nt; @@ -236,6 +237,12 @@ void drawPixel(S3L_PixelInfo *p) previousTriangle = p->triangleIndex; } + if (wire) + if (p->barycentric[0] != 0 && + p->barycentric[1] != 0 && + p->barycentric[2] != 0) + return; + uint8_t r,g,b; int8_t transparent = 0; @@ -475,6 +482,8 @@ int main() fog = !fog; else if (event.key.keysym.scancode == SDL_SCANCODE_N) noise = !noise; + else if (event.key.keysym.scancode == SDL_SCANCODE_W) + wire = !wire; else if (event.key.keysym.scancode == SDL_SCANCODE_SPACE) { modelIndex = (modelIndex + 1) % modelsTotal;