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

Function CheckToRenderMineObjects

Descent3/render.cpp:3263–3308  ·  view source on GitHub ↗

Either renders the objects in a room, or stuffs them into our postrender list

Source from the content-addressed store, hash-verified

3261}
3262// Either renders the objects in a room, or stuffs them into our postrender list
3263void CheckToRenderMineObjects(int roomnum) {
3264
3265 if (UseHardware) {
3266 int index;
3267 float zdist;
3268 if (Render_mirror_for_room)
3269 return;
3270 for (index = Rooms[roomnum].objects; index != -1; index = Objects[index].next) {
3271 object *obj = &Objects[index];
3272 if (Objects[index].render_type == RT_NONE)
3273 continue;
3274 if (obj == Viewer_object)
3275 continue;
3276 // Don't draw piggybacked objects
3277 if (Viewer_object->type == OBJ_OBSERVER && index == Players[Viewer_object->id].piggy_objnum)
3278 continue;
3279 float size = Objects[index].size;
3280 // Special case weapons with streamers
3281 if (Objects[index].type == OBJ_WEAPON && (Weapons[Objects[index].id].flags & WF_STREAMER))
3282 size = Weapons[Objects[index].id].phys_info.velocity.z;
3283 // Check if object is trivially rejected
3284 int visible = IsPointVisible(&obj->pos, size, &zdist); // calculate zdist
3285 if ((obj->type == OBJ_WEAPON && Weapons[obj->id].flags & WF_ELECTRICAL) || visible) {
3286 if (Num_postrenders < MAX_POSTRENDERS) {
3287 Postrender_list[Num_postrenders].type = PRT_OBJECT;
3288 Postrender_list[Num_postrenders].z = zdist;
3289 Postrender_list[Num_postrenders++].objnum = index;
3290 }
3291 }
3292 }
3293 // Now do viseffects
3294 for (index = Rooms[roomnum].vis_effects; index != -1; index = VisEffects[index].next) {
3295 if (VisEffects[index].type == VIS_NONE || VisEffects[index].flags & VF_DEAD)
3296 continue;
3297
3298 if (IsPointVisible(&VisEffects[index].pos, VisEffects[index].size, &zdist)) {
3299 if (Num_postrenders < MAX_POSTRENDERS) {
3300 Postrender_list[Num_postrenders].type = PRT_VISEFFECT;
3301 Postrender_list[Num_postrenders].z = zdist;
3302 Postrender_list[Num_postrenders++].visnum = index;
3303 }
3304 }
3305 }
3306 } else
3307 RenderRoomObjects(&Rooms[roomnum]);
3308}
3309// Renders all the mirrored rooms for this frame
3310void RenderMirrorRooms() {
3311 int i;

Callers 1

RenderMineFunction · 0.85

Calls 2

IsPointVisibleFunction · 0.85
RenderRoomObjectsFunction · 0.85

Tested by

no test coverage detected