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

Function ShowRadView

editor/TextureGrWnd.cpp:1649–1683  ·  view source on GitHub ↗

Shows radiosity progress in the texture window. This function needs to go in this file because of the stupid MFC problems that occur if you try to access MFC member variables from a non- MFC file

Source from the content-addressed store, hash-verified

1647// problems that occur if you try to access MFC member variables from a non-
1648// MFC file
1649void ShowRadView() {
1650 grSurface *cur_surf;
1651 int i, t;
1652
1653 CTextureGrWnd *tview = theApp.textured_view;
1654
1655 cur_surf = rad_Viewport->lock();
1656 uint16_t *dest = (uint16_t *)cur_surf->data();
1657 int rowsize = cur_surf->rowsize() / 2;
1658
1659 int height = cur_surf->height();
1660 int width = cur_surf->width();
1661
1662 fix du = IntToFix(rad_Hemicube.ff_res) / cur_surf->width();
1663 fix dv = IntToFix(rad_Hemicube.ff_res) / cur_surf->height();
1664 fix u, v;
1665
1666 for (v = 0, i = 0; i < height; i++, v += dv)
1667 for (u = 0, t = 0; t < width; t++, u += du) {
1668 int x = FixToInt(u);
1669 int y = FixToInt(v);
1670
1671 int color = rad_Hemicube.id_grid[y * rad_Hemicube.ff_res + x];
1672 if (color == -1)
1673 dest[i * rowsize + t] = 0;
1674 else
1675 dest[i * rowsize + t] = GR_COLOR_TO_16(color);
1676 }
1677
1678 rad_Viewport->unlock();
1679 tview->Invalidate();
1680 tview->SendMessage(WM_PAINT);
1681
1682 World_changed = 1;
1683}

Callers 1

EndHemicubeDrawingFunction · 0.85

Calls 8

GR_COLOR_TO_16Function · 0.85
dataMethod · 0.80
rowsizeMethod · 0.80
InvalidateMethod · 0.80
lockMethod · 0.45
heightMethod · 0.45
widthMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected