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

Function FreeLightmapInfo

Descent3/lightmap_info.cpp:149–172  ·  view source on GitHub ↗

Given a handle, frees the lightmap memory and flags this lightmap as unused

Source from the content-addressed store, hash-verified

147
148// Given a handle, frees the lightmap memory and flags this lightmap as unused
149void FreeLightmapInfo(int handle) {
150 ASSERT(handle >= 0 && handle <= MAX_LIGHTMAP_INFOS);
151
152 if (Dedicated_server)
153 return;
154
155 // when we free up our rooms, which frees up lightmaps, the lightmap array
156 // may already be freed
157 if (!LightmapInfo)
158 return;
159
160 if (LightmapInfo[handle].used < 1)
161 return;
162
163 LightmapInfo[handle].used--;
164
165 if (LightmapInfo[handle].used == 0) {
166 if (!Dedicated_server)
167 rend_FreePreUploadedTexture(LightmapInfo[handle].lm_handle, MAP_TYPE_LIGHTMAP);
168 lm_FreeLightmap(LightmapInfo[handle].lm_handle);
169
170 Free_lmi_list[--Num_of_lightmap_info] = handle;
171 }
172}
173
174// Gets the width of this lightmap_info handle
175int lmi_w(int handle) {

Callers 4

FreeRoomFaceFunction · 0.85
ClearRoomLightmapsFunction · 0.85
ClearObjectLightmapsFunction · 0.85
LoadLevelFunction · 0.85

Calls 2

lm_FreeLightmapFunction · 0.85

Tested by

no test coverage detected