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

Function DrawGouraudSky

Descent3/terrainrender.cpp:1621–1676  ·  view source on GitHub ↗

Draws the gouraud sky

Source from the content-addressed store, hash-verified

1619}
1620// Draws the gouraud sky
1621void DrawGouraudSky(void) {
1622 int t, k, tw;
1623 float sr, sg, sb, hr, hg, hb;
1624
1625 g3Point pnt[4], *pntlist[6];
1626 g3UVL uvls[10];
1627 if (Terrain_sky.sky_color == Terrain_sky.horizon_color)
1628 return; // No sense in drawing anything
1629 rend_SetTextureType(TT_FLAT);
1630 rend_SetColorModel(CM_RGB);
1631 rend_SetAlphaType(AT_ALWAYS);
1632 // figure out colors for sky
1633 {
1634 sr = (float)GR_COLOR_RED(Terrain_sky.sky_color) / 255.0;
1635 sg = (float)GR_COLOR_GREEN(Terrain_sky.sky_color) / 255.0;
1636 sb = (float)GR_COLOR_BLUE(Terrain_sky.sky_color) / 255.0;
1637 hr = (float)GR_COLOR_RED(Terrain_sky.horizon_color) / 255.0;
1638 hg = (float)GR_COLOR_GREEN(Terrain_sky.horizon_color) / 255.0;
1639 hb = (float)GR_COLOR_BLUE(Terrain_sky.horizon_color) / 255.0;
1640 }
1641 for (t = 0; t < MAX_HORIZON_PIECES; t++) {
1642 tw = (t + 1) % MAX_HORIZON_PIECES;
1643 pnt[0].p3_vec = Temp_sky_vectors[t][4];
1644 pnt[0].p3_vecPreRot = Temp_sky_vectors_unrotated[t][4];
1645 uvls[0].r = sr;
1646 uvls[0].g = sg;
1647 uvls[0].b = sb;
1648
1649 pnt[1].p3_vec = Temp_sky_vectors[tw][4];
1650 pnt[1].p3_vecPreRot = Temp_sky_vectors_unrotated[tw][4];
1651 uvls[1].r = sr;
1652 uvls[1].g = sg;
1653 uvls[1].b = sb;
1654
1655 pnt[2].p3_vec = Temp_sky_vectors[tw][5];
1656 pnt[2].p3_vecPreRot = Temp_sky_vectors_unrotated[tw][5];
1657 uvls[2].r = hr;
1658 uvls[2].g = hg;
1659 uvls[2].b = hb;
1660
1661 pnt[3].p3_vec = Temp_sky_vectors[t][5];
1662 pnt[3].p3_vecPreRot = Temp_sky_vectors_unrotated[t][5];
1663 uvls[3].r = hr;
1664 uvls[3].g = hg;
1665 uvls[3].b = hb;
1666
1667 for (k = 0; k < 4; k++) {
1668 g3Point *p = &pnt[k];
1669 p->p3_flags = PF_RGBA | PF_ORIGPOINT;
1670 g3_CodePoint(p);
1671 pntlist[k] = p;
1672 p->p3_uvl = uvls[k];
1673 }
1674 g3_DrawPoly(4, pntlist, 0);
1675 }
1676}
1677// Draws the sky textures
1678void DrawTexturedSky(void) {

Callers 1

DrawSkyFunction · 0.85

Calls 8

GR_COLOR_REDFunction · 0.85
GR_COLOR_GREENFunction · 0.85
GR_COLOR_BLUEFunction · 0.85
g3_CodePointFunction · 0.85
g3_DrawPolyFunction · 0.85
rend_SetTextureTypeFunction · 0.50
rend_SetColorModelFunction · 0.50
rend_SetAlphaTypeFunction · 0.50

Tested by

no test coverage detected