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

Fix equality

This commit is contained in:
Miloslav Číž 2019-06-08 19:59:06 +02:00
parent 55b6edfcb0
commit 796fc8e76d
3 changed files with 10 additions and 4 deletions

View file

@ -13,7 +13,7 @@
#define S3L_FLAT 0
#define S3L_STRICT_NEAR_CULLING 1
#define S3L_PERSPECTIVE_CORRECTION 0
#define S3L_PERSPECTIVE_CORRECTION 1
#define S3L_SORT 0
#define S3L_STENCIL_BUFFER 0
#define S3L_Z_BUFFER 1

View file

@ -85,7 +85,7 @@ uint32_t frame = 0;
void clearScreen()
{
memset(pixels,0,S3L_RESOLUTION_X * S3L_RESOLUTION_Y * sizeof(uint32_t));
memset(pixels,255,S3L_RESOLUTION_X * S3L_RESOLUTION_Y * sizeof(uint32_t));
}
static inline void setPixel(int x, int y, uint8_t red, uint8_t green, uint8_t blue)
@ -133,6 +133,12 @@ void houseTex(int32_t u, int32_t v, uint8_t *r, uint8_t *g, uint8_t *b)
void drawPixel(S3L_PixelInfo *p)
{
//setPixel(p->x,p->y,p->triangleIndex,p->triangleIndex,p->triangleIndex);
setPixel(p->x,p->y,0,0,0);
return;
if (p->x < 0 || p ->x >= S3L_RESOLUTION_X || p->y < 0 || p->y >= S3L_RESOLUTION_Y)
{
offScreenPixels++;
@ -338,7 +344,7 @@ scene.camera.transform.rotation.x = -35;
scene.camera.transform.rotation.y = 128;
scene.camera.transform.rotation.z = 0;
S3L_setTransform3D(3196,1814,5958,-18,300,0,512,512,512,&(scene.camera.transform));
S3L_setTransform3D(-2039,173,6096,-2,-296,0,512,512,512,&(scene.camera.transform));
scene.modelCount = 2;
scene.models = models;

View file

@ -2124,7 +2124,7 @@ static inline int8_t S3L_triangleIsVisible(
(p1.y - p0.y) * (p2.x - p1.x) - (p1.x - p0.x) * (p2.y - p1.y);
if ((backfaceCulling == 1 && winding < 0) ||
(backfaceCulling == 2 && winding >= 0))
(backfaceCulling == 2 && winding > 0))
return 0;
}