1
0
Fork 0
mirror of https://git.coom.tech/drummyfish/small3dlib.git synced 2024-11-21 20:39:57 +01:00

Add wireframe mode

This commit is contained in:
Miloslav Číž 2019-06-13 18:15:14 +02:00
parent 5f09e37291
commit b932a39e51

View file

@ -132,6 +132,7 @@ S3L_Vec4 toLight;
int8_t light = 1; int8_t light = 1;
int8_t fog = 0; int8_t fog = 0;
int8_t noise = 0; int8_t noise = 0;
int8_t wire = 0;
int8_t transparency = 0; int8_t transparency = 0;
int8_t mode = 0; int8_t mode = 0;
S3L_Vec4 n0, n1, n2, nt; S3L_Vec4 n0, n1, n2, nt;
@ -236,6 +237,12 @@ void drawPixel(S3L_PixelInfo *p)
previousTriangle = p->triangleIndex; previousTriangle = p->triangleIndex;
} }
if (wire)
if (p->barycentric[0] != 0 &&
p->barycentric[1] != 0 &&
p->barycentric[2] != 0)
return;
uint8_t r,g,b; uint8_t r,g,b;
int8_t transparent = 0; int8_t transparent = 0;
@ -475,6 +482,8 @@ int main()
fog = !fog; fog = !fog;
else if (event.key.keysym.scancode == SDL_SCANCODE_N) else if (event.key.keysym.scancode == SDL_SCANCODE_N)
noise = !noise; noise = !noise;
else if (event.key.keysym.scancode == SDL_SCANCODE_W)
wire = !wire;
else if (event.key.keysym.scancode == SDL_SCANCODE_SPACE) else if (event.key.keysym.scancode == SDL_SCANCODE_SPACE)
{ {
modelIndex = (modelIndex + 1) % modelsTotal; modelIndex = (modelIndex + 1) % modelsTotal;