clips a line to the viewing pyramid.
| 255 | |
| 256 | // clips a line to the viewing pyramid. |
| 257 | void ClipLine(g3Point **p0, g3Point **p1, uint8_t codes_or) { |
| 258 | int plane_flag; |
| 259 | g3Point *old_p1; |
| 260 | |
| 261 | // might have these left over |
| 262 | //(*p0)->p3_flags &= ~(PF_UV|PF_L|PF_RGBA|PF_UV2); |
| 263 | //(*p1)->p3_flags &= ~(PF_UV|PF_L|PF_RGBA|PF_UV2); |
| 264 | |
| 265 | for (plane_flag = 1; plane_flag <= 32; plane_flag <<= 1) { |
| 266 | if (codes_or & plane_flag) { |
| 267 | if ((*p0)->p3_codes & plane_flag) { |
| 268 | // swap! |
| 269 | g3Point *t = *p0; |
| 270 | *p0 = *p1; |
| 271 | *p1 = t; |
| 272 | } |
| 273 | |
| 274 | old_p1 = *p1; |
| 275 | |
| 276 | *p1 = ClipEdge(plane_flag, *p0, *p1); |
| 277 | |
| 278 | codes_or = (*p0)->p3_codes | (*p1)->p3_codes; // get new codes |
| 279 | |
| 280 | if (old_p1->p3_flags & PF_TEMP_POINT) { |
| 281 | FreeTempPoint(old_p1); |
| 282 | } |
| 283 | } |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | int ClipPlane(int plane_flag, g3Point **src, g3Point **dest, int *nv, g3Codes *cc) { |
| 288 | int i, prev, next; |
no test coverage detected