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 <stdio.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#define S3L_FLAT 0
|
#define S3L_FLAT 0
|
||||||
#define S3L_STRICT_NEAR_CULLING 1
|
#define S3L_STRICT_NEAR_CULLING 1
|
||||||
|
@ -125,6 +126,7 @@ uint16_t l0, l1, l2;
|
||||||
S3L_Vec4 toLight;
|
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 mode = 0;
|
int8_t mode = 0;
|
||||||
S3L_Vec4 n0, n1, n2, nt;
|
S3L_Vec4 n0, n1, n2, nt;
|
||||||
|
|
||||||
|
@ -319,6 +321,9 @@ void drawPixel(S3L_PixelInfo *p)
|
||||||
b = S3L_clamp(((int16_t) b) + f,0,255);
|
b = S3L_clamp(((int16_t) b) + f,0,255);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (noise)
|
||||||
|
setPixel(p->x + rand() % 8,p->y + rand() % 8,r,g,b);
|
||||||
|
else
|
||||||
setPixel(p->x,p->y,r,g,b);
|
setPixel(p->x,p->y,r,g,b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,6 +435,8 @@ int main()
|
||||||
light = !light;
|
light = !light;
|
||||||
else if (event.key.keysym.scancode == SDL_SCANCODE_F)
|
else if (event.key.keysym.scancode == SDL_SCANCODE_F)
|
||||||
fog = !fog;
|
fog = !fog;
|
||||||
|
else if (event.key.keysym.scancode == SDL_SCANCODE_N)
|
||||||
|
noise = !noise;
|
||||||
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;
|
||||||
|
|
Loading…
Reference in a new issue