GameMtlTextureDlg.cpp 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  1. /*
  2. ** Command & Conquer Generals Zero Hour(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. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : Max2W3d *
  23. * *
  24. * $Archive:: /Commando/Code/Tools/max2w3d/GameMtlTextureDlg.cpp $*
  25. * *
  26. * Author:: Greg Hjelstrom *
  27. * *
  28. * $Modtime:: 8/14/00 1:47p $*
  29. * *
  30. * $Revision:: 15 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * GameMtlTextureDlg::GameMtlTextureDlg -- constructor *
  35. * GameMtlTextureDlg::~GameMtlTextureDlg -- destructor *
  36. * GameMtlTextureDlg::Dialog_Proc -- windows message handler *
  37. * GameMtlTextureDlg::ReloadDialog -- reload the contents of all of the controls in this dia *
  38. * GameMtlTextureDlg::ActivateDlg -- activate/deactivate this dialog *
  39. * GameMtlTextureDlg::Enable_Stage -- enable or disable a texture stage *
  40. * GameMtlTextureDlg::Update_Texture_Buttons -- update the texture buttons text *
  41. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  42. #include "GameMtlTextureDlg.h"
  43. #include "GameMtl.h"
  44. #include "dllmain.h"
  45. #include "resource.h"
  46. #include <Max.h>
  47. #include <bmmlib.h>
  48. #include <stdmat.h>
  49. /***********************************************************************************************
  50. * GameMtlTextureDlg::GameMtlTextureDlg -- constructor *
  51. * *
  52. * INPUT: *
  53. * *
  54. * OUTPUT: *
  55. * *
  56. * WARNINGS: *
  57. * *
  58. * HISTORY: *
  59. * 11/23/98 GTH : Created. *
  60. *=============================================================================================*/
  61. GameMtlTextureDlg::GameMtlTextureDlg
  62. (
  63. HWND parent,
  64. IMtlParams * imp,
  65. GameMtl * mtl,
  66. int pass
  67. ) :
  68. GameMtlFormClass(imp,mtl,pass)
  69. {
  70. Stage0FramesSpin = NULL;
  71. Stage1FramesSpin = NULL;
  72. Stage0RateSpin = NULL;
  73. Stage1RateSpin = NULL;
  74. Stage0PublishButton = NULL;
  75. Stage1PublishButton = NULL;
  76. Stage0ClampUButton = NULL;
  77. Stage1ClampUButton = NULL;
  78. Stage0ClampVButton = NULL;
  79. Stage1ClampVButton = NULL;
  80. Stage0NoLODButton = NULL;
  81. Stage1NoLODButton = NULL;
  82. Stage0AlphaBitmapButton = NULL;
  83. Stage1AlphaBitmapButton = NULL;
  84. Stage0DisplayButton = NULL;
  85. Stage1DisplayButton = NULL;
  86. if (mtl->Get_Shader_Type() == GameMtl::STE_PC_SHADER) {
  87. Create_Form(parent,IDD_GAMEMTL_TEXTURES);
  88. } else {
  89. // Use the PS2 dialog. It is the same but it disables some functions that aren't
  90. // supported yet.
  91. Create_Form(parent,IDD_GAMEMTL_PS2_TEXTURES);
  92. }
  93. }
  94. /***********************************************************************************************
  95. * GameMtlTextureDlg::~GameMtlTextureDlg -- destructor *
  96. * *
  97. * INPUT: *
  98. * *
  99. * OUTPUT: *
  100. * *
  101. * WARNINGS: *
  102. * *
  103. * HISTORY: *
  104. * 11/23/98 GTH : Created. *
  105. *=============================================================================================*/
  106. GameMtlTextureDlg::~GameMtlTextureDlg()
  107. {
  108. assert(Stage0FramesSpin && Stage1FramesSpin && Stage0RateSpin && Stage1RateSpin);
  109. ReleaseISpinner(Stage0FramesSpin);
  110. ReleaseISpinner(Stage1FramesSpin);
  111. ReleaseISpinner(Stage0RateSpin);
  112. ReleaseISpinner(Stage1RateSpin);
  113. ReleaseICustButton(Stage0PublishButton);
  114. ReleaseICustButton(Stage1PublishButton);
  115. ReleaseICustButton(Stage0ClampUButton);
  116. ReleaseICustButton(Stage1ClampUButton);
  117. ReleaseICustButton(Stage0ClampVButton);
  118. ReleaseICustButton(Stage1ClampVButton);
  119. ReleaseICustButton(Stage0NoLODButton);
  120. ReleaseICustButton(Stage1NoLODButton);
  121. ReleaseICustButton(Stage0AlphaBitmapButton);
  122. ReleaseICustButton(Stage1AlphaBitmapButton);
  123. ReleaseICustButton(Stage0DisplayButton);
  124. ReleaseICustButton(Stage1DisplayButton);
  125. }
  126. /***********************************************************************************************
  127. * GameMtlTextureDlg::Dialog_Proc -- windows message handler *
  128. * *
  129. * INPUT: *
  130. * *
  131. * OUTPUT: *
  132. * *
  133. * WARNINGS: *
  134. * *
  135. * HISTORY: *
  136. * 11/23/98 GTH : Created. *
  137. * 10/6/1999 MLL: Turned off the display button when the texture is turned off. *
  138. *=============================================================================================*/
  139. BOOL GameMtlTextureDlg::Dialog_Proc (HWND dlg_wnd, UINT message, WPARAM wparam, LPARAM lparam)
  140. {
  141. int cursel;
  142. int id = LOWORD(wparam);
  143. int code = HIWORD(wparam);
  144. switch (message)
  145. {
  146. case WM_INITDIALOG:
  147. {
  148. Stage0FramesSpin = SetupIntSpinner( dlg_wnd,
  149. IDC_STAGE0_FRAMES_SPIN,
  150. IDC_STAGE0_FRAMES_EDIT,
  151. 1,999,
  152. TheMtl->Get_Texture_Frame_Count(PassIndex,0) );
  153. Stage0RateSpin = SetupFloatSpinner( dlg_wnd,
  154. IDC_STAGE0_RATE_SPIN,
  155. IDC_STAGE0_RATE_EDIT,
  156. 0.0f,60.0f,
  157. TheMtl->Get_Texture_Frame_Rate(PassIndex,0),
  158. 1.0f );
  159. Stage1FramesSpin = SetupIntSpinner( dlg_wnd,
  160. IDC_STAGE1_FRAMES_SPIN,
  161. IDC_STAGE1_FRAMES_EDIT,
  162. 1,999,
  163. TheMtl->Get_Texture_Frame_Count(PassIndex,1) );
  164. Stage1RateSpin = SetupFloatSpinner( dlg_wnd,
  165. IDC_STAGE1_RATE_SPIN,
  166. IDC_STAGE1_RATE_EDIT,
  167. 0.0f,60.0f,
  168. TheMtl->Get_Texture_Frame_Rate(PassIndex,1),
  169. 1.0f );
  170. Stage0PublishButton = GetICustButton(GetDlgItem(dlg_wnd, IDC_STAGE0_PUBLISH_BUTTON));
  171. Stage0PublishButton->SetType(CBT_CHECK);
  172. Stage0PublishButton->SetHighlightColor(GREEN_WASH);
  173. Stage0PublishButton->SetCheck(TheMtl->Get_Texture_Publish(PassIndex,0));
  174. Stage0PublishButton->SetText(Get_String(IDS_PUBLISH));
  175. Stage1PublishButton = GetICustButton(GetDlgItem(dlg_wnd, IDC_STAGE1_PUBLISH_BUTTON));
  176. Stage1PublishButton->SetType(CBT_CHECK);
  177. Stage1PublishButton->SetHighlightColor(GREEN_WASH);
  178. Stage1PublishButton->SetCheck(TheMtl->Get_Texture_Publish(PassIndex,1));
  179. Stage1PublishButton->SetText(Get_String(IDS_PUBLISH));
  180. Stage0ClampUButton = GetICustButton(GetDlgItem(dlg_wnd, IDC_STAGE0_CLAMP_U_BUTTON));
  181. Stage0ClampUButton->SetType(CBT_CHECK);
  182. Stage0ClampUButton->SetHighlightColor(GREEN_WASH);
  183. Stage0ClampUButton->SetCheck(TheMtl->Get_Texture_Clamp_U(PassIndex,0));
  184. Stage0ClampUButton->SetText(Get_String(IDS_CLAMP_U));
  185. Stage1ClampUButton = GetICustButton(GetDlgItem(dlg_wnd, IDC_STAGE1_CLAMP_U_BUTTON));
  186. Stage1ClampUButton->SetType(CBT_CHECK);
  187. Stage1ClampUButton->SetHighlightColor(GREEN_WASH);
  188. Stage1ClampUButton->SetCheck(TheMtl->Get_Texture_Clamp_U(PassIndex,1));
  189. Stage1ClampUButton->SetText(Get_String(IDS_CLAMP_U));
  190. Stage0ClampVButton = GetICustButton(GetDlgItem(dlg_wnd, IDC_STAGE0_CLAMP_V_BUTTON));
  191. Stage0ClampVButton->SetType(CBT_CHECK);
  192. Stage0ClampVButton->SetHighlightColor(GREEN_WASH);
  193. Stage0ClampVButton->SetCheck(TheMtl->Get_Texture_Clamp_V(PassIndex,0));
  194. Stage0ClampVButton->SetText(Get_String(IDS_CLAMP_V));
  195. Stage1ClampVButton = GetICustButton(GetDlgItem(dlg_wnd, IDC_STAGE1_CLAMP_V_BUTTON));
  196. Stage1ClampVButton->SetType(CBT_CHECK);
  197. Stage1ClampVButton->SetHighlightColor(GREEN_WASH);
  198. Stage1ClampVButton->SetCheck(TheMtl->Get_Texture_Clamp_V(PassIndex,1));
  199. Stage1ClampVButton->SetText(Get_String(IDS_CLAMP_V));
  200. Stage0NoLODButton = GetICustButton(GetDlgItem(dlg_wnd, IDC_STAGE0_NOLOD_BUTTON));
  201. Stage0NoLODButton->SetType(CBT_CHECK);
  202. Stage0NoLODButton->SetHighlightColor(GREEN_WASH);
  203. Stage0NoLODButton->SetCheck(TheMtl->Get_Texture_No_LOD(PassIndex,0));
  204. Stage0NoLODButton->SetText(Get_String(IDS_NO_LOD));
  205. Stage1NoLODButton = GetICustButton(GetDlgItem(dlg_wnd, IDC_STAGE1_NOLOD_BUTTON));
  206. Stage1NoLODButton->SetType(CBT_CHECK);
  207. Stage1NoLODButton->SetHighlightColor(GREEN_WASH);
  208. Stage1NoLODButton->SetCheck(TheMtl->Get_Texture_No_LOD(PassIndex,0));
  209. Stage1NoLODButton->SetText(Get_String(IDS_NO_LOD));
  210. Stage0AlphaBitmapButton = GetICustButton(GetDlgItem(dlg_wnd, IDC_STAGE0_ALPHA_BITMAP_BUTTON));
  211. Stage0AlphaBitmapButton->SetType(CBT_CHECK);
  212. Stage0AlphaBitmapButton->SetHighlightColor(GREEN_WASH);
  213. Stage0AlphaBitmapButton->SetCheck(TheMtl->Get_Texture_Alpha_Bitmap(PassIndex,0));
  214. Stage0AlphaBitmapButton->SetText(Get_String(IDS_ALPHA_BITMAP));
  215. Stage1AlphaBitmapButton = GetICustButton(GetDlgItem(dlg_wnd, IDC_STAGE1_ALPHA_BITMAP_BUTTON));
  216. Stage1AlphaBitmapButton->SetType(CBT_CHECK);
  217. Stage1AlphaBitmapButton->SetHighlightColor(GREEN_WASH);
  218. Stage1AlphaBitmapButton->SetCheck(TheMtl->Get_Texture_Alpha_Bitmap(PassIndex,1));
  219. Stage1AlphaBitmapButton->SetText(Get_String(IDS_ALPHA_BITMAP));
  220. Stage0DisplayButton = GetICustButton(GetDlgItem(dlg_wnd, IDC_STAGE0_DISPLAY_BUTTON));
  221. Stage0DisplayButton->SetType(CBT_CHECK);
  222. Stage0DisplayButton->SetHighlightColor(GREEN_WASH);
  223. Stage0DisplayButton->SetCheck(TheMtl->Get_Texture_Display(PassIndex,0));
  224. Stage0DisplayButton->SetText(Get_String(IDS_DISPLAY));
  225. Stage1DisplayButton = GetICustButton(GetDlgItem(dlg_wnd, IDC_STAGE1_DISPLAY_BUTTON));
  226. Stage1DisplayButton->SetType(CBT_CHECK);
  227. Stage1DisplayButton->SetHighlightColor(GREEN_WASH);
  228. Stage1DisplayButton->SetCheck(TheMtl->Get_Texture_Display(PassIndex,1));
  229. Stage1DisplayButton->SetText(Get_String(IDS_DISPLAY));
  230. break;
  231. }
  232. case WM_LBUTTONDOWN:
  233. case WM_LBUTTONUP:
  234. case WM_MOUSEMOVE:
  235. {
  236. IParams->RollupMouseMessage(dlg_wnd,message,wparam,lparam);
  237. return FALSE;
  238. }
  239. case CC_SPINNER_CHANGE:
  240. {
  241. TheMtl->Set_Texture_Frame_Count( PassIndex, 0,
  242. Stage0FramesSpin->GetIVal());
  243. TheMtl->Set_Texture_Frame_Rate( PassIndex, 0,
  244. Stage0RateSpin->GetFVal());
  245. TheMtl->Set_Texture_Frame_Count( PassIndex, 1,
  246. Stage1FramesSpin->GetIVal());
  247. TheMtl->Set_Texture_Frame_Rate( PassIndex, 1,
  248. Stage1RateSpin->GetFVal());
  249. break;
  250. }
  251. case CC_SPINNER_BUTTONUP:
  252. {
  253. TheMtl->Notify_Changed();
  254. break;
  255. }
  256. case WM_COMMAND:
  257. {
  258. switch (id)
  259. {
  260. case IDC_STAGE0_BUTTON:
  261. {
  262. BitmapInfo bmi;
  263. BitmapTex * texture;
  264. if (TheManager->SelectFileInput(&bmi, m_hWnd)) {
  265. texture = NewDefaultBitmapTex();
  266. if (texture) {
  267. BOOL disp = TheMtl->Get_Texture_Display(PassIndex,0);
  268. if (disp) {
  269. TheMtl->Set_Texture_Display(PassIndex,0,FALSE);
  270. }
  271. texture->SetMapName((char *)bmi.Name());
  272. int texmap_index = TheMtl->pass_stage_to_texmap_index(PassIndex,0);
  273. TheMtl->SetSubTexmap(texmap_index,texture);
  274. Update_Texture_Buttons();
  275. TheMtl->Notify_Changed();
  276. if (disp) {
  277. TheMtl->Set_Texture_Display(PassIndex,0,TRUE);
  278. TheMtl->Notify_Changed();
  279. }
  280. }
  281. }
  282. break;
  283. }
  284. case IDC_STAGE1_BUTTON:
  285. {
  286. BitmapInfo bmi;
  287. BitmapTex * texture;
  288. if (TheManager->SelectFileInput(&bmi, m_hWnd)) {
  289. texture = NewDefaultBitmapTex();
  290. if (texture) {
  291. BOOL disp = TheMtl->Get_Texture_Display(PassIndex,1);
  292. if (disp) {
  293. TheMtl->Set_Texture_Display(PassIndex,1,FALSE);
  294. }
  295. texture->SetMapName((char *)bmi.Name());
  296. int texmap_index = TheMtl->pass_stage_to_texmap_index(PassIndex,1);
  297. TheMtl->SetSubTexmap(texmap_index,texture);
  298. Update_Texture_Buttons();
  299. TheMtl->Notify_Changed();
  300. if (disp) {
  301. TheMtl->Set_Texture_Display(PassIndex,1,TRUE);
  302. TheMtl->Notify_Changed();
  303. }
  304. }
  305. }
  306. break;
  307. }
  308. case IDC_STAGE0_ENABLE:
  309. {
  310. int checkbox = GetCheckBox(dlg_wnd,IDC_STAGE0_ENABLE);
  311. Enable_Stage(0,(checkbox == TRUE ? true : false) );
  312. // If the texture stage is turned off, turn off the Display button so that it won't
  313. // show up in the viewport.
  314. if (checkbox == FALSE) {
  315. TheMtl->Set_Texture_Display(PassIndex, 0, FALSE);
  316. TheMtl->Notify_Changed();
  317. }
  318. break;
  319. }
  320. case IDC_STAGE1_ENABLE:
  321. {
  322. int checkbox = GetCheckBox(dlg_wnd,IDC_STAGE1_ENABLE);
  323. Enable_Stage(1,(checkbox == TRUE ? true : false) );
  324. // If the texture stage is turned off, turn off the Display button so that it won't
  325. // show up in the viewport.
  326. if (checkbox == FALSE) {
  327. TheMtl->Set_Texture_Display(PassIndex, 1, FALSE);
  328. TheMtl->Notify_Changed();
  329. }
  330. break;
  331. }
  332. case IDC_STAGE0_PUBLISH_BUTTON:
  333. {
  334. TheMtl->Set_Texture_Publish(PassIndex,0,(Stage0PublishButton->IsChecked() ? TRUE : FALSE));
  335. break;
  336. }
  337. case IDC_STAGE1_PUBLISH_BUTTON:
  338. {
  339. TheMtl->Set_Texture_Publish(PassIndex,1,(Stage1PublishButton->IsChecked() ? TRUE : FALSE));
  340. break;
  341. }
  342. case IDC_STAGE0_CLAMP_U_BUTTON:
  343. {
  344. TheMtl->Set_Texture_Clamp_U(PassIndex,0,(Stage0ClampUButton->IsChecked() ? TRUE : FALSE));
  345. break;
  346. }
  347. case IDC_STAGE1_CLAMP_U_BUTTON:
  348. {
  349. TheMtl->Set_Texture_Clamp_U(PassIndex,1,(Stage1ClampUButton->IsChecked() ? TRUE : FALSE));
  350. break;
  351. }
  352. case IDC_STAGE0_CLAMP_V_BUTTON:
  353. {
  354. TheMtl->Set_Texture_Clamp_V(PassIndex,0,(Stage0ClampVButton->IsChecked() ? TRUE : FALSE));
  355. break;
  356. }
  357. case IDC_STAGE1_CLAMP_V_BUTTON:
  358. {
  359. TheMtl->Set_Texture_Clamp_V(PassIndex,1,(Stage1ClampVButton->IsChecked() ? TRUE : FALSE));
  360. break;
  361. }
  362. case IDC_STAGE0_NOLOD_BUTTON:
  363. {
  364. TheMtl->Set_Texture_No_LOD(PassIndex,0,(Stage0NoLODButton->IsChecked() ? TRUE : FALSE));
  365. break;
  366. }
  367. case IDC_STAGE1_NOLOD_BUTTON:
  368. {
  369. TheMtl->Set_Texture_No_LOD(PassIndex,1,(Stage1NoLODButton->IsChecked() ? TRUE : FALSE));
  370. break;
  371. }
  372. case IDC_STAGE0_ALPHA_BITMAP_BUTTON:
  373. {
  374. TheMtl->Set_Texture_Alpha_Bitmap(PassIndex,0,(Stage0AlphaBitmapButton->IsChecked() ? TRUE : FALSE));
  375. break;
  376. }
  377. case IDC_STAGE1_ALPHA_BITMAP_BUTTON:
  378. {
  379. TheMtl->Set_Texture_Alpha_Bitmap(PassIndex,1,(Stage0AlphaBitmapButton->IsChecked() ? TRUE : FALSE));
  380. break;
  381. }
  382. case IDC_STAGE0_DISPLAY_BUTTON:
  383. {
  384. TheMtl->Set_Texture_Display(PassIndex,0,(Stage0DisplayButton->IsChecked() ? TRUE : FALSE));
  385. TheMtl->Notify_Changed();
  386. break;
  387. }
  388. case IDC_STAGE1_DISPLAY_BUTTON:
  389. {
  390. TheMtl->Set_Texture_Display(PassIndex,1,(Stage1DisplayButton->IsChecked() ? TRUE : FALSE));
  391. TheMtl->Notify_Changed();
  392. break;
  393. }
  394. case IDC_STAGE0_ANIM_COMBO:
  395. {
  396. if (code == CBN_SELCHANGE) {
  397. cursel = SendDlgItemMessage(dlg_wnd,IDC_STAGE0_ANIM_COMBO,CB_GETCURSEL,0,0);
  398. TheMtl->Set_Texture_Anim_Type(PassIndex,0,cursel);
  399. }
  400. break;
  401. }
  402. case IDC_STAGE1_ANIM_COMBO:
  403. {
  404. if (code == CBN_SELCHANGE) {
  405. cursel = SendDlgItemMessage(dlg_wnd,IDC_STAGE1_ANIM_COMBO,CB_GETCURSEL,0,0);
  406. TheMtl->Set_Texture_Anim_Type(PassIndex,1,cursel);
  407. }
  408. break;
  409. }
  410. case IDC_STAGE0_HINT_COMBO:
  411. {
  412. if (code == CBN_SELCHANGE) {
  413. cursel = SendDlgItemMessage(dlg_wnd,IDC_STAGE0_HINT_COMBO,CB_GETCURSEL,0,0);
  414. TheMtl->Set_Texture_Hint(PassIndex,0,cursel);
  415. }
  416. break;
  417. }
  418. case IDC_STAGE1_HINT_COMBO:
  419. {
  420. if (code == CBN_SELCHANGE) {
  421. cursel = SendDlgItemMessage(dlg_wnd,IDC_STAGE1_HINT_COMBO,CB_GETCURSEL,0,0);
  422. TheMtl->Set_Texture_Hint(PassIndex,1,cursel);
  423. }
  424. break;
  425. }
  426. }
  427. break;
  428. }
  429. }
  430. return FALSE;
  431. }
  432. /***********************************************************************************************
  433. * GameMtlTextureDlg::ReloadDialog -- reload the contents of all of the controls in this dialo *
  434. * *
  435. * INPUT: *
  436. * *
  437. * OUTPUT: *
  438. * *
  439. * WARNINGS: *
  440. * *
  441. * HISTORY: *
  442. * 11/23/98 GTH : Created. *
  443. *=============================================================================================*/
  444. void GameMtlTextureDlg::ReloadDialog(void)
  445. {
  446. DebugPrint("GameMtlTextureDlg::ReloadDialog\n");
  447. assert(Stage0FramesSpin && Stage1FramesSpin && Stage0RateSpin && Stage1RateSpin);
  448. Stage0FramesSpin->SetValue(TheMtl->Get_Texture_Frame_Count(PassIndex,0),FALSE);
  449. Stage1FramesSpin->SetValue(TheMtl->Get_Texture_Frame_Count(PassIndex,1),FALSE);
  450. Stage0RateSpin->SetValue(TheMtl->Get_Texture_Frame_Rate(PassIndex,0),FALSE);
  451. Stage1RateSpin->SetValue(TheMtl->Get_Texture_Frame_Rate(PassIndex,1),FALSE);
  452. SendDlgItemMessage( m_hWnd,
  453. IDC_STAGE0_ANIM_COMBO,
  454. CB_SETCURSEL,
  455. TheMtl->Get_Texture_Anim_Type(PassIndex,0), 0 );
  456. SendDlgItemMessage( m_hWnd,
  457. IDC_STAGE1_ANIM_COMBO,
  458. CB_SETCURSEL,
  459. TheMtl->Get_Texture_Anim_Type(PassIndex,1), 0 );
  460. SendDlgItemMessage( m_hWnd,
  461. IDC_STAGE0_HINT_COMBO,
  462. CB_SETCURSEL,
  463. TheMtl->Get_Texture_Hint(PassIndex,0), 0 );
  464. SendDlgItemMessage( m_hWnd,
  465. IDC_STAGE1_HINT_COMBO,
  466. CB_SETCURSEL,
  467. TheMtl->Get_Texture_Hint(PassIndex,1), 0 );
  468. SetCheckBox(m_hWnd,IDC_STAGE0_ENABLE, TheMtl->Get_Texture_Enable(PassIndex,0));
  469. SetCheckBox(m_hWnd,IDC_STAGE1_ENABLE, TheMtl->Get_Texture_Enable(PassIndex,1));
  470. Stage0PublishButton->SetCheck(TheMtl->Get_Texture_Publish(PassIndex,0));
  471. Stage1PublishButton->SetCheck(TheMtl->Get_Texture_Publish(PassIndex,1));
  472. Stage0ClampUButton->SetCheck(TheMtl->Get_Texture_Clamp_U(PassIndex,0));
  473. Stage1ClampUButton->SetCheck(TheMtl->Get_Texture_Clamp_U(PassIndex,1));
  474. Stage0ClampVButton->SetCheck(TheMtl->Get_Texture_Clamp_V(PassIndex,0));
  475. Stage1ClampVButton->SetCheck(TheMtl->Get_Texture_Clamp_V(PassIndex,1));
  476. Stage0NoLODButton->SetCheck(TheMtl->Get_Texture_No_LOD(PassIndex,0));
  477. Stage1NoLODButton->SetCheck(TheMtl->Get_Texture_No_LOD(PassIndex,1));
  478. Stage0AlphaBitmapButton->SetCheck(TheMtl->Get_Texture_Alpha_Bitmap(PassIndex,0));
  479. Stage1AlphaBitmapButton->SetCheck(TheMtl->Get_Texture_Alpha_Bitmap(PassIndex,1));
  480. Stage0DisplayButton->SetCheck(TheMtl->Get_Texture_Display(PassIndex,0));
  481. Stage1DisplayButton->SetCheck(TheMtl->Get_Texture_Display(PassIndex,1));
  482. Update_Texture_Buttons();
  483. Enable_Stage(0,TheMtl->Get_Texture_Enable(PassIndex,0));
  484. Enable_Stage(1,TheMtl->Get_Texture_Enable(PassIndex,1));
  485. }
  486. /***********************************************************************************************
  487. * GameMtlTextureDlg::ActivateDlg -- activate/deactivate this dialog *
  488. * *
  489. * INPUT: *
  490. * *
  491. * OUTPUT: *
  492. * *
  493. * WARNINGS: *
  494. * *
  495. * HISTORY: *
  496. * 11/23/98 GTH : Created. *
  497. *=============================================================================================*/
  498. void GameMtlTextureDlg::ActivateDlg(BOOL onOff)
  499. {
  500. // no color swatches to activate.
  501. }
  502. /***********************************************************************************************
  503. * GameMtlTextureDlg::Enable_Stage -- enable or disable a texture stage *
  504. * *
  505. * INPUT: *
  506. * *
  507. * OUTPUT: *
  508. * *
  509. * WARNINGS: *
  510. * *
  511. * HISTORY: *
  512. * 11/23/98 GTH : Created. *
  513. *=============================================================================================*/
  514. void GameMtlTextureDlg::Enable_Stage(int stage,BOOL onoff)
  515. {
  516. assert((stage >= 0) && (stage < W3dMaterialClass::MAX_STAGES));
  517. TheMtl->Set_Texture_Enable(PassIndex,stage,(onoff == TRUE ? true : false));
  518. if (stage == 0) {
  519. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_BUTTON),onoff);
  520. // Turn these off if it is a playstation 2 shader.
  521. // These aren't supported yet.
  522. if (TheMtl->Get_Shader_Type() == GameMtl::STE_PC_SHADER) {
  523. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_RATE_SPIN), onoff);
  524. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_RATE_EDIT), onoff);
  525. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_FRAMES_SPIN), onoff);
  526. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_FRAMES_EDIT), onoff);
  527. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_ANIM_COMBO), onoff);
  528. } else {
  529. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_RATE_SPIN), FALSE);
  530. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_RATE_EDIT), FALSE);
  531. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_FRAMES_SPIN), FALSE);
  532. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_FRAMES_EDIT), FALSE);
  533. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_ANIM_COMBO), FALSE);
  534. }
  535. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_PUBLISH_BUTTON),onoff);
  536. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_CLAMP_U_BUTTON),onoff);
  537. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_CLAMP_V_BUTTON),onoff);
  538. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_NOLOD_BUTTON),onoff);
  539. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_ALPHA_BITMAP_BUTTON),onoff);
  540. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_DISPLAY_BUTTON),onoff);
  541. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE0_HINT_COMBO),onoff);
  542. } else {
  543. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE1_BUTTON),onoff);
  544. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE1_RATE_SPIN),onoff);
  545. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE1_RATE_EDIT),onoff);
  546. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE1_FRAMES_SPIN),onoff);
  547. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE1_FRAMES_EDIT),onoff);
  548. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE1_PUBLISH_BUTTON),onoff);
  549. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE1_CLAMP_U_BUTTON),onoff);
  550. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE1_CLAMP_V_BUTTON),onoff);
  551. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE1_NOLOD_BUTTON),onoff);
  552. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE1_ALPHA_BITMAP_BUTTON),onoff);
  553. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE1_DISPLAY_BUTTON),onoff);
  554. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE1_ANIM_COMBO),onoff);
  555. EnableWindow(GetDlgItem(m_hWnd,IDC_STAGE1_HINT_COMBO),onoff);
  556. }
  557. }
  558. /***********************************************************************************************
  559. * GameMtlTextureDlg::Update_Texture_Buttons -- update the texture buttons text *
  560. * *
  561. * INPUT: *
  562. * *
  563. * OUTPUT: *
  564. * *
  565. * WARNINGS: *
  566. * *
  567. * HISTORY: *
  568. * 11/23/98 GTH : Created. *
  569. *=============================================================================================*/
  570. void GameMtlTextureDlg::Update_Texture_Buttons(void)
  571. {
  572. Texmap * texmap;
  573. texmap = TheMtl->Get_Texture(PassIndex,0);
  574. TSTR filename;
  575. if (texmap) {
  576. SplitPathFile(texmap->GetFullName(),NULL,&filename);
  577. SetDlgItemText(m_hWnd, IDC_STAGE0_BUTTON,filename);
  578. } else {
  579. SetDlgItemText(m_hWnd, IDC_STAGE0_BUTTON,Get_String(IDS_NONE));
  580. }
  581. texmap = TheMtl->Get_Texture(PassIndex,1);
  582. if (texmap) {
  583. SplitPathFile(texmap->GetFullName(),NULL,&filename);
  584. SetDlgItemText(m_hWnd, IDC_STAGE1_BUTTON,filename);
  585. } else {
  586. SetDlgItemText(m_hWnd, IDC_STAGE1_BUTTON,Get_String(IDS_NONE));
  587. }
  588. }