PackingDialog.cpp 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /***********************************************************************************************
  19. *** Confidential - Westwood Studios ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : LightMap *
  23. * *
  24. * $Archive:: /Commando/Code/Tool $*
  25. * *
  26. * $Author:: Ian_l $*
  27. * *
  28. * $Modtime:: 7/20/00 4:47p $*
  29. * *
  30. * $Revision:: 3 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. // Includes.
  36. #include "StdAfx.h"
  37. #include "LightMap.h"
  38. #include "PackingDialog.h"
  39. // The following is maintained by MFC tools.
  40. #ifdef _DEBUG
  41. #define new DEBUG_NEW
  42. #undef THIS_FILE
  43. static char THIS_FILE[] = __FILE__;
  44. #endif
  45. /***********************************************************************************************
  46. * PackingDialog::OnInitDialog -- *
  47. * *
  48. * INPUT: *
  49. * *
  50. * OUTPUT: *
  51. * *
  52. * WARNINGS: *
  53. * *
  54. * HISTORY: *
  55. * 02/03/00 IML : Created. *
  56. *=============================================================================================*/
  57. BOOL PackingDialog::OnInitDialog()
  58. {
  59. static LV_COLUMN _column [2] = {
  60. {LVCF_FMT | LVCF_TEXT | LVCF_WIDTH, LVCFMT_LEFT, 0, "Statistic", 0, 0},
  61. {LVCF_FMT | LVCF_TEXT | LVCF_WIDTH, LVCFMT_RIGHT, 0, "Value", 0, 0}
  62. };
  63. static float _widthratio [2] = {0.55f, 0.45f};
  64. static char *_statisticlabels [LightmapPacker::STATISTICS_COUNT] = {
  65. "Page format",
  66. "No. of lightmaps processed",
  67. "Percentage adjacent faces blended", // No. adjacent faces edge blended / No. adjacent faces. NOTE: Some adjacent
  68. // faces cannot be edge blended because they do not have the same UV mapping
  69. // as the principal face.
  70. "Edge blend efficiency", // Percentage texel area not dedicated to edge blending.
  71. "Scaling efficiency", // Percentage texel area reduction due to low-pass filter scaling.
  72. "No. of pages created",
  73. "Packing efficiency", // Percentage texel area of page used (not padded).
  74. "Replica lightmap culling efficiency", // Percentage texel area saved due to lightmap reuse.
  75. "Estimated texture swapping efficiency", // Estimated likelihood that next face will not incur a texture swap.
  76. "No. of oversize lightmaps" // No. of lightmaps that exceeded the page size limit and had to be scaled.
  77. };
  78. CListCtrl *list;
  79. LVITEM item;
  80. RECT rect;
  81. float w;
  82. CDialog::OnInitDialog();
  83. list = (CListCtrl*) GetDlgItem (IDC_PACKING_LIST);
  84. list->GetClientRect (&rect);
  85. w = (float) rect.right;
  86. for (unsigned c = 0; c < sizeof (_widthratio) / sizeof (float); c++) {
  87. float columnwidth;
  88. columnwidth = w * _widthratio [c];
  89. _column [c].cx = columnwidth;
  90. if (columnwidth - _column [c].cx > 0.5f) _column [c].cx++;
  91. list->InsertColumn (c, &_column [c]);
  92. }
  93. item.mask = LVIF_TEXT;
  94. item.iSubItem = 0;
  95. for (unsigned i = 0; i < LightmapPacker::STATISTICS_COUNT; i++) {
  96. item.iItem = i;
  97. item.pszText = _statisticlabels [i];
  98. list->InsertItem (&item);
  99. list->SetItemText (i, 1, LightmapPacker::Get_Statistic (i));
  100. }
  101. return (TRUE);
  102. }
  103. // The following is maintained by MFC tools.
  104. PackingDialog::PackingDialog(CWnd* pParent /*=NULL*/)
  105. : CDialog(PackingDialog::IDD, pParent)
  106. {
  107. //{{AFX_DATA_INIT(PackingDialog)
  108. // NOTE: the ClassWizard will add member initialization here
  109. //}}AFX_DATA_INIT
  110. }
  111. void PackingDialog::DoDataExchange(CDataExchange* pDX)
  112. {
  113. CDialog::DoDataExchange(pDX);
  114. //{{AFX_DATA_MAP(PackingDialog)
  115. // NOTE: the ClassWizard will add DDX and DDV calls here
  116. //}}AFX_DATA_MAP
  117. }
  118. BEGIN_MESSAGE_MAP(PackingDialog, CDialog)
  119. //{{AFX_MSG_MAP(PackingDialog)
  120. ON_BN_CLICKED(IDCLOSE, OnClose)
  121. //}}AFX_MSG_MAP
  122. END_MESSAGE_MAP()
  123. int PackingDialog::DoModal()
  124. {
  125. // TODO: Add your specialized code here and/or call the base class
  126. return CDialog::DoModal();
  127. }