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

Function RenderFace

Descent3/render.cpp:1722–2124  ·  view source on GitHub ↗

Draw the specified face Parameters: rp - pointer to the room the face is un facenum - which face in the specified room

Source from the content-addressed store, hash-verified

1720// Parameters: rp - pointer to the room the face is un
1721// facenum - which face in the specified room
1722void RenderFace(room *rp, int facenum) {
1723 int vn, drawn = 0;
1724 face *fp = &rp->faces[facenum];
1725 g3Point *pointlist[MAX_VERTS_PER_FACE];
1726 g3Point pointbuffer[MAX_VERTS_PER_FACE];
1727 int bm_handle;
1728 float uchange = 0, vchange = 0;
1729 texture_type tt;
1730 uint8_t do_triangle_test = 0;
1731 g3Codes face_cc;
1732 static int first = 1;
1733 static float lm_red[32], lm_green[32], lm_blue[32];
1734 bool spec_face = 0;
1735 face_cc.cc_and = 0xff;
1736 face_cc.cc_or = 0;
1737#ifdef EDITOR
1738 if (fp->flags & FF_FLOATING_TRIG) {
1739 RenderFloatingTrig(rp, fp);
1740 return;
1741 }
1742#endif
1743 // Clear triangulation flag
1744 fp->flags &= ~FF_TRIANGULATED;
1745 // check for render windows hack
1746 if (No_render_windows_hack == 1) {
1747 if (fp->portal_num != -1)
1748 return;
1749 }
1750 if (rp->flags & RF_TRIANGULATE)
1751 do_triangle_test = 1;
1752 if (!Render_mirror_for_room && Detail_settings.Specular_lighting && (GameTextures[fp->tmap].flags & TF_SPECULAR) &&
1753 ((fp->special_handle != BAD_SPECIAL_FACE_INDEX) || (rp->flags & RF_EXTERNAL)))
1754 spec_face = 1;
1755 // Figure out if there is any texture sliding
1756 if (GameTextures[fp->tmap].slide_u != 0) {
1757 int int_time = Gametime / GameTextures[fp->tmap].slide_u;
1758 float norm_time = Gametime - (int_time * GameTextures[fp->tmap].slide_u);
1759 norm_time /= GameTextures[fp->tmap].slide_u;
1760 uchange = norm_time;
1761 }
1762 if (GameTextures[fp->tmap].slide_v != 0) {
1763 int int_time = Gametime / GameTextures[fp->tmap].slide_v;
1764 float norm_time = Gametime - (int_time * GameTextures[fp->tmap].slide_v);
1765 norm_time /= GameTextures[fp->tmap].slide_v;
1766 vchange = norm_time;
1767 }
1768 // Build list of points and UVLs for this face
1769 if (Render_mirror_for_room) // If mirror room, order the vertices counter clockwise
1770 {
1771 for (vn = 0; vn < fp->num_verts; vn++) {
1772 pointbuffer[vn] = World_point_buffer[rp->wpb_index + fp->face_verts[vn]];
1773 g3Point *p = &pointbuffer[vn];
1774 pointlist[(fp->num_verts - 1) - vn] = p;
1775 p->p3_uvl.u = fp->face_uvls[vn].u;
1776 p->p3_uvl.v = fp->face_uvls[vn].v;
1777 p->p3_uvl.u2 = fp->face_uvls[vn].u2;
1778 p->p3_uvl.v2 = fp->face_uvls[vn].v2;
1779

Callers 3

DrawPostrenderFaceFunction · 0.85
RenderRoomSortedFunction · 0.85
RenderRoomUnsortedFunction · 0.85

Calls 15

RenderFloatingTrigFunction · 0.85
UpdateSpecularFaceFunction · 0.85
lm_dataFunction · 0.85
lm_wFunction · 0.85
lm_hFunction · 0.85
GetTextureBitmapFunction · 0.85
g3_SetTriangulationTestFunction · 0.85
g3_DrawPolyFunction · 0.85
DrawScorchesFunction · 0.85
UpdateFogFaceFunction · 0.85
g3_DrawSpecialLineFunction · 0.85
g3_DrawLineFunction · 0.85

Tested by

no test coverage detected