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

Function ScanRadiosityPoly

editor/rad_hemicube.cpp:712–830  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

710}
711
712void ScanRadiosityPoly(g3Point **pl, int nv, int element_id) {
713 int i, left_edge_dir;
714
715 float Delta_right_x, Right_x, Delta_left_x, Left_x;
716 float Left_z, Right_z, Delta_left_z, Delta_right_z;
717
718 float height, left_height, right_height;
719 int vlt, vlb, vrt, vrb, desty;
720 float top_y, bottom_y, next_break_left, next_break_right, y;
721
722 hemicube_point cp[100];
723
724 int destptr;
725
726 ASSERT(element_id >= 0 && element_id <= rad_NumElements);
727
728 for (i = 0; i < nv; i++) {
729 g3Point p;
730 p = *pl[i];
731
732 cp[i].sx = p.p3_sx;
733 cp[i].sy = p.p3_sy;
734 cp[i].z = 1.0 / (float)p.p3_vec.z;
735 }
736
737 // Determine top and bottom y coords.
738 GetVertexOrdering(cp, nv, &vlt, &vlb, &vrt, &vrb, &top_y, &bottom_y, &left_edge_dir);
739
740 height = bottom_y - top_y;
741 if (height < 1.0)
742 return;
743
744#include "radscan_leftedge.h"
745#include "radscan_rightedge.h"
746
747 // Set the destptr to equal the first row to draw to
748 destptr = ((int)top_y * rad_Hemicube.ff_res);
749 desty = (int)top_y;
750
751 for (y = top_y; y < bottom_y; y++) {
752 if (y >= next_break_left) {
753 do {
754 vlt = vlb;
755
756 if (left_edge_dir == -1)
757 vlb = PrevIndex(vlb, nv);
758 else
759 vlb = NextIndex(vlb, nv);
760 } while (y == cp[vlb].sy);
761
762#include "radscan_leftedge.h"
763 }
764
765 if (y >= next_break_right) {
766 do {
767 vrt = vrb;
768 if (left_edge_dir == -1)
769 vrb = NextIndex(vrb, nv);

Callers 1

DrawRadiosityPolyFunction · 0.85

Calls 3

GetVertexOrderingFunction · 0.85
PrevIndexFunction · 0.85
NextIndexFunction · 0.85

Tested by

no test coverage detected