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

Function DrawLightningSky

Descent3/terrainrender.cpp:1554–1619  ·  view source on GitHub ↗

Draws a lightning sky

Source from the content-addressed store, hash-verified

1552}
1553// Draws a lightning sky
1554void DrawLightningSky(void) {
1555 int t, k, tw;
1556 float r, g, b;
1557
1558 g3Point pnt[4], *pntlist[6];
1559
1560 rend_SetTextureType(TT_FLAT);
1561 rend_SetColorModel(CM_RGB);
1562 rend_SetLighting(LS_GOURAUD);
1563 rend_SetAlphaType(AT_SATURATE_VERTEX);
1564
1565 // figure out colors for sky
1566 r = .8f;
1567 g = .8f;
1568 b = 1.0;
1569 // Draw top part
1570 for (t = 0; t < MAX_HORIZON_PIECES; t++) {
1571 tw = (t + 1) % MAX_HORIZON_PIECES;
1572 pnt[0].p3_vec = Temp_sky_vectors[t][0];
1573 pnt[0].p3_vecPreRot = Temp_sky_vectors_unrotated[t][0];
1574 pnt[1].p3_vec = Temp_sky_vectors[tw][1];
1575 pnt[1].p3_vecPreRot = Temp_sky_vectors_unrotated[tw][1];
1576 pnt[2].p3_vec = Temp_sky_vectors[t][1];
1577 pnt[2].p3_vecPreRot = Temp_sky_vectors_unrotated[t][1];
1578
1579 for (k = 0; k < 3; k++) {
1580 g3Point *p = &pnt[k];
1581 p->p3_flags = PF_RGBA | PF_ORIGPOINT;
1582 g3_CodePoint(p);
1583 p->p3_a = .3f;
1584 p->p3_r = r;
1585 p->p3_g = g;
1586 p->p3_b = b;
1587 }
1588 pntlist[0] = &pnt[0];
1589 pntlist[1] = &pnt[1];
1590 pntlist[2] = &pnt[2];
1591 g3_DrawPoly(3, pntlist, 0);
1592 }
1593 // Draw bottom part
1594 for (int i = 1; i < 5; i++) {
1595 for (t = 0; t < MAX_HORIZON_PIECES; t++) {
1596 tw = (t + 1) % MAX_HORIZON_PIECES;
1597 pnt[0].p3_vec = Temp_sky_vectors[t][i];
1598 pnt[0].p3_vecPreRot = Temp_sky_vectors_unrotated[t][i];
1599 pnt[1].p3_vec = Temp_sky_vectors[tw][i];
1600 pnt[1].p3_vecPreRot = Temp_sky_vectors_unrotated[tw][i];
1601 pnt[2].p3_vec = Temp_sky_vectors[tw][i + 1];
1602 pnt[2].p3_vecPreRot = Temp_sky_vectors_unrotated[tw][i + 1];
1603 pnt[3].p3_vec = Temp_sky_vectors[t][i + 1];
1604 pnt[3].p3_vecPreRot = Temp_sky_vectors_unrotated[t][i + 1];
1605
1606 for (k = 0; k < 4; k++) {
1607 g3Point *p = &pnt[k];
1608 p->p3_flags = PF_RGBA | PF_ORIGPOINT;
1609 g3_CodePoint(p);
1610 p->p3_a = .3f;
1611 p->p3_r = r;

Callers 1

DrawSkyFunction · 0.85

Calls 6

g3_CodePointFunction · 0.85
g3_DrawPolyFunction · 0.85
rend_SetTextureTypeFunction · 0.50
rend_SetColorModelFunction · 0.50
rend_SetLightingFunction · 0.50
rend_SetAlphaTypeFunction · 0.50

Tested by

no test coverage detected