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

Function ClipRadEdge

editor/editor_lighting.cpp:1654–1676  ·  view source on GitHub ↗

Takes two points and a plane, and clips.

Source from the content-addressed store, hash-verified

1652
1653// Takes two points and a plane, and clips.
1654void ClipRadEdge(int plane_flag, rad_point *on_pnt, rad_point *off_pnt) {
1655 if (plane_flag & CC_OFF_TOP) {
1656 float percent_on = 1.0 - ((off_pnt->pos.y - rad_ClipTop->y) / (off_pnt->pos.y - on_pnt->pos.y));
1657 GlobalTempRadPoint.pos = on_pnt->pos + ((off_pnt->pos - on_pnt->pos) * percent_on);
1658 }
1659
1660 if (plane_flag & CC_OFF_RIGHT) {
1661 float percent_on = 1.0 - ((off_pnt->pos.x - rad_ClipRight->x) / (off_pnt->pos.x - on_pnt->pos.x));
1662 GlobalTempRadPoint.pos = on_pnt->pos + ((off_pnt->pos - on_pnt->pos) * percent_on);
1663 }
1664
1665 if (plane_flag & CC_OFF_LEFT) {
1666 float percent_on = 1.0 - ((off_pnt->pos.x - rad_ClipLeft->x) / (off_pnt->pos.x - on_pnt->pos.x));
1667 GlobalTempRadPoint.pos = on_pnt->pos + ((off_pnt->pos - on_pnt->pos) * percent_on);
1668 }
1669
1670 if (plane_flag & CC_OFF_BOT) {
1671 float percent_on = 1.0 - ((off_pnt->pos.y - rad_ClipBottom->y) / (off_pnt->pos.y - on_pnt->pos.y));
1672 GlobalTempRadPoint.pos = on_pnt->pos + ((off_pnt->pos - on_pnt->pos) * percent_on);
1673 }
1674
1675 CodeRadPoint(&GlobalTempRadPoint);
1676}
1677
1678// Adds color spectrums together
1679void AddSpectra(spectra *dest, spectra *a, spectra *b) {

Callers 1

ClipRadToPlaneFunction · 0.85

Calls 1

CodeRadPointFunction · 0.85

Tested by

no test coverage detected