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

Function FindEmptyMaskSpot

editor/editor_lighting.cpp:89–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87int Squeeze_lightmap_handle = -1;
88
89int FindEmptyMaskSpot(int w, int h, int *dest_x, int *dest_y) {
90 int cur_x = 0, cur_y = 0;
91 int i, t;
92
93 for (cur_y = 0; cur_y < 128; cur_y++) {
94 if (cur_y + h > 128)
95 return 0;
96 for (cur_x = 0; cur_x < 128; cur_x++) {
97 if (cur_x + w > 128)
98 continue;
99
100 int hit_mask = 0;
101 for (i = 0; i < h && !hit_mask; i++) {
102 for (t = 0; t < w && !hit_mask; t++) {
103 if (Lightmap_mask[((cur_y + i) * 128) + cur_x + t])
104 hit_mask = 1;
105 }
106 }
107 if (hit_mask == 0) {
108 // Hurray! We found an empty spot
109 *dest_x = cur_x;
110 *dest_y = cur_y;
111 return 1;
112 }
113 }
114 }
115
116 return 0;
117}
118
119void CopySqueezeBodyAndEdges(uint16_t *dest_data, uint16_t *src_data, int w, int h, int dest_x, int dest_y) {
120 int i, t;

Callers 1

SqueezeLightmapsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected