MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / ClipRadPointList

Function ClipRadPointList

editor/editor_lighting.cpp:1574–1600  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1572// Returns number of points in clipped polygon
1573
1574int ClipRadPointList(rad_point **src, rad_point **dest, int *nv, int code) {
1575 int plane, num = 0;
1576 rad_point **save_src = src, *t;
1577 rad_point **save_dest = dest;
1578
1579 for (plane = 1; plane < 16; plane <<= 1) {
1580 if (plane & code) // Is this point off this plane?
1581 {
1582
1583 *nv = ClipRadToPlane(plane, *src, *dest, *nv);
1584 if (*nv == 0)
1585 return 0;
1586 ASSERT(*nv >= 3);
1587
1588 t = *dest;
1589 *dest = *src;
1590 *src = t;
1591 num++;
1592 }
1593 }
1594
1595 t = *dest;
1596 *dest = *src;
1597 *src = t;
1598
1599 return (*nv);
1600}
1601
1602// Clips to a specific plane, putting resulting points in dest and returning number of points in dest
1603int ClipRadToPlane(int plane, rad_point *src, rad_point *dest, int nv) {

Callers 1

ClipSurfaceElementFunction · 0.85

Calls 1

ClipRadToPlaneFunction · 0.85

Tested by

no test coverage detected