ref: be646bf6b54840fc068899be22d3fb4860bf6363
parent: 2d88df8f49aad564bb9a1ed915deaff44117cb68
author: David <gek@katherine>
date: Sun Feb 14 11:50:38 EST 2021
Bug Fix in 16 bit rendering mode
--- a/include/zfeatures.h
+++ b/include/zfeatures.h
@@ -51,8 +51,8 @@
#define TGL_FEATURE_8_BITS 0
#define TGL_FEATURE_24_BITS 0
//These are the only maintained modes.
-#define TGL_FEATURE_16_BITS 0
-#define TGL_FEATURE_32_BITS 1
+#define TGL_FEATURE_16_BITS 1
+#define TGL_FEATURE_32_BITS 0
//MAINTAINER'S NOTE: Only TGL_FEATURE_RENDER_BITS 32 is maintained.
//TODO: Include support for 16 bit.
--- a/src/ztriangle.c
+++ b/src/ztriangle.c
@@ -76,7 +76,7 @@
ZBufferPoint *p0,ZBufferPoint *p1,ZBufferPoint *p2)
{
#if TGL_FEATURE_RENDER_BITS == 16
- int _drgbdx;
+// int _drgbdx;
#endif
//unsigned int color;
#define INTERP_Z
@@ -108,6 +108,7 @@
#elif TGL_FEATURE_RENDER_BITS == 16
+/*
#define DRAW_INIT() \
{ \
_drgbdx=(SAR_RND_TO_ZERO(drdx, 6) << 22) & 0xFFC00000; \
@@ -114,9 +115,17 @@
_drgbdx|=SAR_RND_TO_ZERO(dgdx,5) & 0x000007FF; \
_drgbdx|=(SAR_RND_TO_ZERO(dbdx,7) << 12) & 0x001FF000; \
}
+*/
-#define PUT_PIXEL(_a) \
+
+#define DRAW_INIT() \
{ \
+ \
+}
+
+
+/*#define PUT_PIXEL(_a) \
+{ \
zz=z >> ZB_POINT_Z_FRAC_BITS; \
if (ZCMP(zz,pz[_a],_a)) { \
tmp=rgb&0xF81F07E0; \
@@ -126,7 +135,22 @@
z+=dzdx; \
rgb=(rgb+drgbdx) & ( ~ 0x00200800);\
}
+*/
+
+#define PUT_PIXEL(_a) \
+{ \
+ zz=z >> ZB_POINT_Z_FRAC_BITS; \
+ if (ZCMP(zz,pz[_a],_a)) { \
+ pp[_a] = RGB_TO_PIXEL(or1, og1, ob1);\
+ pz[_a]=zz; \
+ }\
+ z+=dzdx; \
+ og1+=dgdx; \
+ or1+=drdx; \
+ ob1+=dbdx; \
+}
+/*
#define DRAW_LINE() \
{ \
register unsigned short *pz; \
@@ -158,6 +182,7 @@
} \
}
+*/
#endif
//^ End of 16 bit mode stuff
#include "ztriangle.h"