Hello!
I think i've found a bug in the clipping code of Mesa!
It occurs with Quake3Test (on MacOS), in map1 if you go to the Teleporter.
There Quake3 uses user-clip panes for drawing the Teleporter.
Mesa seems to have problems clipping after user defined clippanes. It
doesn't executes clip-test's for vertices introduced by user-clip.
I think the following things happens:
We are going to render triangle 1,2,3
Vertex-3 is out in the left side. So ClipMask[3] = LEFT_BIT.
ClipMask[1] = 0, and So ClipMask[2] = 0.
Now the user clip-plane clips vertex 3, so the the triangle becomes:
1,2,3000,3001
where ClipMask[3000] = USERCLIP_BIT, and ClipMask[3001]=USERCLIP_BIT
But here 3000, and 3001 falls outside the clip region but we didn't notice
it!
Now the stage viewport clip comes. We go to the
static GLuint TAG(viewclip_polygon)( struct vertex_buffer *VB,
GLuint n, GLuint vlist[] )
found in line 117 of clipfuncs.h:
and Or ClipMask's and we get:
mask = USERCLIP_BIT.
Therefore the:
if (mask & (PLANE)) {
/* clip for PLANE */
}
won't be executed.
One thing that bugs me with this, i've corrected it to (seemed to be the
easiest fix):
if (mask & (PLANE | USERCLIP_BIT)) {
The clipping bug becomed better, hovewer it existed still. (It seemed that
the USERCLIP_BIT got cleared somehow...)
Then i've changed it to:
line 140 of clip_funcs.h, and it fixed the problem.
if (1 /*mask & CLIP_ALL_BITS*/) {
/* bogaXXX:This is inneficient but fixes the bug at least */
#define GENERAL_CLIP \
if (1/*mask & (PLANE | CLIP_USER_BIT)*/) { \
GLuint prevj = inlist[n-1]; \
GLuint prevflag = INSIDE(prevj); \
GLuint outcount = 0; \
GLuint i; \
But this isn't an efficient solution.
Where should this problem be solved? We should do cliptest after we
intoroduced a point in userclip?
Miklos.
_______________________________________________
Mesa-dev maillist - [EMAIL PROTECTED]
http://lists.mesa3d.org/mailman/listinfo/mesa-dev