Re: [AD] triangle3d_f with | POLYTYPE_ZBUF bug |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Javier González wrote :
>
> Hello, I've noticed that if i use:
>
> triangle3d_f(buff, POLYTYPE_GCOL | POLYTYPE_ZBUF, NULL, v[0], v[1], v[2]);
>
> that wont work properly, meanwhile when i switched it to:
>
> polygon3d_f(buff, POLYTYPE_GCOL | POLYTYPE_ZBUF, NULL, 3, v);
>
> (it's supposed to be the same) that works...
> i haven't tested the fixed version, but maybe buggy too...
Bug fixed ! See attached file : this is the smaller patch ever sent to
this mailing list ;-)
To fix the bug in your lib you may :
1. apply the patch
2. do it yourself :
- open poly3d.c
- goto line number 1420 (float z1 = 65536. / v->z;)
- replace 65536. by 1. (the line should then looks like : float z1 = 1.
/ v->z;).
- save and quit
- recompile of course :-)
- That's all folks !
BTW fixed point version of triangle3d is not buggy.
Bertrand.
--- poly3d.c.old Sun Jan 7 03:39:48 2001
+++ poly3d.c Sun Jan 7 03:40:07 2001
@@ -1418,7 +1418,7 @@
float w1 = 65536. / w;
/* Z (depth) interpolation */
- float z1 = 65536. / v->z;
+ float z1 = 1. / v->z;
info->dz = (s1->z - z1) * w1;