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

Function ExternalRoomVisible

Descent3/terrainrender.cpp:1012–1032  ·  view source on GitHub ↗

Returns true if the external room is in the view cone Else returns false

Source from the content-addressed store, hash-verified

1010// Returns true if the external room is in the view cone
1011// Else returns false
1012bool ExternalRoomVisible(room *rp, vector *center, float *zdist) {
1013 ASSERT(rp->flags & RF_EXTERNAL);
1014 g3Point pnt;
1015 uint8_t ccode;
1016
1017 vector corners[8];
1018 g3_RotatePoint(&pnt, center);
1019 *zdist = pnt.p3_z;
1020 MakePointsFromMinMax(corners, &rp->min_xyz, &rp->max_xyz);
1021 uint8_t andbyte = 0xff;
1022 for (int t = 0; t < 8; t++) {
1023 g3_RotatePoint(&pnt, &corners[t]);
1024 ccode = g3_CodePoint(&pnt);
1025 if (!ccode)
1026 return true;
1027 andbyte &= ccode;
1028 }
1029 if (andbyte)
1030 return false;
1031 return true;
1032}
1033// Render all the rooms out on the terrain for this frame
1034void RenderTerrainRooms() {
1035 object *obj;

Callers 1

RenderTerrainRoomsFunction · 0.85

Calls 3

g3_RotatePointFunction · 0.85
MakePointsFromMinMaxFunction · 0.85
g3_CodePointFunction · 0.85

Tested by

no test coverage detected