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

Function DrawTexturedSky

Descent3/terrainrender.cpp:1678–1848  ·  view source on GitHub ↗

Draws the sky textures

Source from the content-addressed store, hash-verified

1676}
1677// Draws the sky textures
1678void DrawTexturedSky(void) {
1679 int t, k, tw;
1680 float sr, sg, sb, hr, hg, hb;
1681
1682 // Change terrain sky if needed
1683 int dome_bm = GetTextureBitmap(Terrain_sky.dome_texture, 0);
1684
1685 g3Point pnt[6], *pntlist[6];
1686 g3UVL uvls[10];
1687
1688 rend_SetWrapType(WT_WRAP);
1689 rend_SetTextureType(TT_PERSPECTIVE);
1690 rend_SetColorModel(CM_MONO);
1691 rend_SetAlphaType(ATF_TEXTURE);
1692 g3_SetTriangulationTest(1);
1693
1694 // Draw top part
1695 for (t = 0; t < MAX_HORIZON_PIECES; t++) {
1696 tw = (t + 1) % MAX_HORIZON_PIECES;
1697 pnt[0].p3_vec = Temp_sky_vectors[t][0];
1698 pnt[0].p3_vecPreRot = Temp_sky_vectors_unrotated[t][0];
1699 uvls[0].u = Terrain_sky.horizon_u[t][0];
1700 uvls[0].v = Terrain_sky.horizon_v[t][0];
1701
1702 pnt[1].p3_vec = Temp_sky_vectors[tw][1];
1703 pnt[1].p3_vecPreRot = Temp_sky_vectors_unrotated[tw][1];
1704 uvls[1].u = Terrain_sky.horizon_u[tw][1];
1705 uvls[1].v = Terrain_sky.horizon_v[tw][1];
1706
1707 pnt[2].p3_vec = Temp_sky_vectors[t][1];
1708 pnt[2].p3_vecPreRot = Temp_sky_vectors_unrotated[t][1];
1709 uvls[2].u = Terrain_sky.horizon_u[t][1];
1710 uvls[2].v = Terrain_sky.horizon_v[t][1];
1711
1712 for (k = 0; k < 3; k++) {
1713 g3Point *p = &pnt[k];
1714 p->p3_flags = PF_UV | PF_L | PF_ORIGPOINT;
1715 g3_CodePoint(p);
1716 p->p3_uvl = uvls[k];
1717 p->p3_l = 1;
1718 }
1719
1720#if (defined(EDITOR) || defined(NEWEDITOR))
1721 ddgr_color oldcolor;
1722 if (TSearch_on) {
1723 rend_SetPixel(GR_RGB(0, 255, 0), TSearch_x, TSearch_y);
1724 oldcolor = rend_GetPixel(TSearch_x, TSearch_y); // will be different in 15/16-bit color
1725 }
1726#endif
1727
1728 pntlist[0] = &pnt[0];
1729 pntlist[1] = &pnt[1];
1730 pntlist[2] = &pnt[2];
1731 g3_DrawPoly(3, pntlist, dome_bm);
1732
1733#if (defined(EDITOR) || defined(NEWEDITOR))
1734 if (TSearch_on) {
1735 ddgr_color newcolor = rend_GetPixel(TSearch_x, TSearch_y);

Callers 1

DrawSkyFunction · 0.85

Calls 14

GetTextureBitmapFunction · 0.85
g3_SetTriangulationTestFunction · 0.85
g3_CodePointFunction · 0.85
g3_DrawPolyFunction · 0.85
GR_COLOR_REDFunction · 0.85
GR_COLOR_GREENFunction · 0.85
GR_COLOR_BLUEFunction · 0.85
rend_SetWrapTypeFunction · 0.50
rend_SetTextureTypeFunction · 0.50
rend_SetColorModelFunction · 0.50
rend_SetAlphaTypeFunction · 0.50
rend_SetPixelFunction · 0.50

Tested by

no test coverage detected