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

Function DrawAtmosphereBlend

Descent3/terrainrender.cpp:1889–1950  ·  view source on GitHub ↗

Draws the atmosphere over a satellite

Source from the content-addressed store, hash-verified

1887}
1888// Draws the atmosphere over a satellite
1889void DrawAtmosphereBlend(vector *pos, angle rotAngle, float w, float h, int bm, float r, float g, float b) {
1890 g3Point pnt;
1891 if (g3_RotatePoint(&pnt, pos) & CC_BEHIND)
1892 return;
1893
1894 // create the rotation matrix
1895 matrix rotMatrix;
1896 vm_AnglesToMatrix(&rotMatrix, 0, 0, rotAngle);
1897
1898 // get the view matrix
1899 matrix viewToWorld;
1900 g3_GetUnscaledMatrix(&viewToWorld);
1901 viewToWorld = ~viewToWorld;
1902
1903 // combine the matrices into one
1904 matrix rotationToWorld = rotMatrix * viewToWorld;
1905
1906 // setup the rotation vectors
1907 vector rotVectors[4];
1908 rotVectors[0].x = -w;
1909 rotVectors[0].y = h;
1910 rotVectors[1].x = w;
1911 rotVectors[1].y = h;
1912 rotVectors[2].x = w;
1913 rotVectors[2].y = -h;
1914 rotVectors[3].x = -w;
1915 rotVectors[3].y = -h;
1916
1917 // rotate the points
1918 g3Point rotPoints[8], *pntList[8];
1919 int i;
1920 for (i = 0; i < 4; ++i) {
1921 rotVectors[i].z = 0.0f;
1922 rotVectors[i] = (rotVectors[i] * rotationToWorld) + (*pos);
1923
1924 // setup the point
1925 g3_RotatePoint(&rotPoints[i], &rotVectors[i]);
1926 rotPoints[i].p3_flags |= PF_UV | PF_RGBA;
1927 rotPoints[i].p3_r = r;
1928 rotPoints[i].p3_g = g;
1929 rotPoints[i].p3_b = b;
1930 rotPoints[i].p3_a = 0.4f;
1931
1932 pntList[i] = &rotPoints[i];
1933 }
1934
1935 rotPoints[0].p3_u = 0.0f;
1936 rotPoints[0].p3_v = 0.0f;
1937 rotPoints[1].p3_u = 1.0f;
1938 rotPoints[1].p3_v = 0.0f;
1939 rotPoints[2].p3_u = 1.0f;
1940 rotPoints[2].p3_v = 1.0f;
1941 rotPoints[3].p3_u = 0.0f;
1942 rotPoints[3].p3_v = 1.0f;
1943
1944 // and draw!!
1945 rend_SetLighting(LS_NONE);
1946 rend_SetFlatColor(Terrain_sky.sky_color);

Callers 1

DrawSkyFunction · 0.85

Calls 8

g3_RotatePointFunction · 0.85
g3_GetUnscaledMatrixFunction · 0.85
g3_DrawPolyFunction · 0.85
vm_AnglesToMatrixFunction · 0.50
rend_SetLightingFunction · 0.50
rend_SetFlatColorFunction · 0.50
rend_SetAlphaTypeFunction · 0.50
rend_SetTextureTypeFunction · 0.50

Tested by

no test coverage detected