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

Function SortTerrainObjectsForRendering

Descent3/terrainrender.cpp:2183–2213  ·  view source on GitHub ↗

Checks to see if we should render objects and also sets which order the objects should be rendered in

Source from the content-addressed store, hash-verified

2181// Checks to see if we should render objects and also sets which order the objects
2182// should be rendered in
2183void SortTerrainObjectsForRendering(int cellcount) {
2184 int i, segnum;
2185 object *obj;
2186#if (!defined(RELEASE) || defined(NEWEDITOR))
2187 for (i = 0; i < cellcount; i++)
2188 Terrain_seg_render_objs[Terrain_list[i].segment] = -1;
2189#endif
2190
2191 // Go through each object and do trivial rejection
2192 for (i = 0; i <= Highest_object_index; i++) {
2193#if (!defined(RELEASE) || defined(NEWEDITOR))
2194 render_next[i] = -1;
2195#endif
2196 obj = &Objects[i];
2197 if (obj->type == OBJ_NONE)
2198 continue;
2199 if (obj->render_type == RT_NONE)
2200 continue;
2201 if (!OBJECT_OUTSIDE(obj))
2202 continue;
2203 // Ok, we know that we can see this point. If its segment is in our list
2204 // then make this object draw right after this segment is drawn. Otherwise
2205 // just draw it
2206 segnum = CELLNUM(obj->roomnum);
2207 ASSERT(segnum >= 0 && segnum <= (TERRAIN_WIDTH * TERRAIN_DEPTH));
2208 if (Terrain_rotate_list[segnum] == TS_FrameCount) {
2209 AddRenderObjectToTerrainSeg(segnum, i);
2210 } else
2211 AddRenderObjectToTerrainSeg(Terrain_list[cellcount - 1].segment, i);
2212 }
2213}
2214#if (defined(EDITOR) || defined(NEWEDITOR))
2215#define CROSS_WIDTH 8.0
2216#define CROSS_HEIGHT 8.0

Callers 1

DisplayTerrainListFunction · 0.85

Calls 1

Tested by

no test coverage detected