mirror of
https://git.coom.tech/drummyfish/small3dlib.git
synced 2024-11-21 20:39:57 +01:00
Add noie
This commit is contained in:
parent
71627ec0aa
commit
8a2b77a41d
1 changed files with 8 additions and 1 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define S3L_FLAT 0
|
||||
#define S3L_STRICT_NEAR_CULLING 1
|
||||
|
@ -125,6 +126,7 @@ uint16_t l0, l1, l2;
|
|||
S3L_Vec4 toLight;
|
||||
int8_t light = 1;
|
||||
int8_t fog = 0;
|
||||
int8_t noise = 0;
|
||||
int8_t mode = 0;
|
||||
S3L_Vec4 n0, n1, n2, nt;
|
||||
|
||||
|
@ -319,7 +321,10 @@ void drawPixel(S3L_PixelInfo *p)
|
|||
b = S3L_clamp(((int16_t) b) + f,0,255);
|
||||
}
|
||||
|
||||
setPixel(p->x,p->y,r,g,b);
|
||||
if (noise)
|
||||
setPixel(p->x + rand() % 8,p->y + rand() % 8,r,g,b);
|
||||
else
|
||||
setPixel(p->x,p->y,r,g,b);
|
||||
}
|
||||
|
||||
void draw()
|
||||
|
@ -430,6 +435,8 @@ int main()
|
|||
light = !light;
|
||||
else if (event.key.keysym.scancode == SDL_SCANCODE_F)
|
||||
fog = !fog;
|
||||
else if (event.key.keysym.scancode == SDL_SCANCODE_N)
|
||||
noise = !noise;
|
||||
else if (event.key.keysym.scancode == SDL_SCANCODE_SPACE)
|
||||
{
|
||||
modelIndex = (modelIndex + 1) % modelsTotal;
|
||||
|
|
Loading…
Reference in a new issue