static GL_procvert * intersect(GL_primitive_list *pl, GLcontext *g, GL_procvert *v0, GL_procvert *v1, GL_procvert *vc, GL_float plane[4]) { GL_clipvert *cv = __glcore_create_clipvert(); GL_procvert *v = &cv->procvert; /* Hack! If d0 is always outside, complementary criterion cannot be met */ /* Should use a spatial sort of d0 and d1 */ GL_float d0 = vdot(v0->position, plane); /* outside */ GL_float d1 = vdot(v1->position, plane); /* inside */ GL_float t = d0 / (d0 - d1); assert(d0 < 0.0f); assert(d1 >= 0.0f); __glcore_add_clipvert(pl, cv); vinterp(v->position, v0->position, v1->position, t); /* Hack? There has got to be a better way to maintain color vertex. */ /* Hack? Given primitive facing, could copy only front or back. */ if (g->lighting.shademodel == GL_SMOOTH) { vinterp(v->frontcolor, v0->frontcolor, v1->frontcolor, t); vinterp(v->backcolor, v0->backcolor, v1->backcolor, t); } else { vcopy(v->frontcolor, vc->frontcolor); vcopy(v->backcolor, vc->backcolor); } vinterp(v->texcoord, v0->texcoord, v1->texcoord, t); return v; }
void vlex(char *s) { value_t *p; char *cp; if (equal(s, "all")) { for (p = vtable; p->v_name; p++) if (vaccess(p->v_access, READ)) vprint(p); } else { do { if ((cp = vinterp(s, ' '))) cp++; vtoken(s); s = cp; } while (s); } if (col > 0) { printf("\r\n"); col = 0; } }