skeleton_gth.cpp 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179
  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. // skeleton.cpp : Defines the entry point for the application.
  20. //
  21. // Skeleton WW3D code, Hector Yee, 8/31/00
  22. #include "resource.h"
  23. #include "wwmath.h"
  24. #include "ww3d.h"
  25. #include "scene.h"
  26. #include "rendobj.h"
  27. #include "camera.h"
  28. #include "AssetMgr.H"
  29. #include "msgloop.h"
  30. #include "part_ldr.h"
  31. #include "rendobj.h"
  32. #include "hanim.h"
  33. #include "dx8wrapper.h"
  34. #include "dx8indexbuffer.h"
  35. #include "dx8vertexbuffer.h"
  36. #include "dx8fvf.h"
  37. #include "vertmaterial.h"
  38. #include "font3d.h"
  39. #include "render2d.h"
  40. #include "textdraw.h"
  41. #include "rect.h"
  42. #include "mesh.h"
  43. #include "meshmdl.h"
  44. #include "line3d.h"
  45. #include "dynamesh.h"
  46. #include "sphereobj.h"
  47. #include "ringobj.h"
  48. #include "surfaceclass.h"
  49. #include "vector2i.h"
  50. #include "bmp2d.h"
  51. #include "decalsys.h"
  52. #include "shattersystem.h"
  53. #include "light.h"
  54. #include "texproject.h"
  55. #include "keyboard.h"
  56. #include "wwmouse.h"
  57. #include "predlod.h"
  58. #include "segline.h"
  59. #include <stdio.h>
  60. #include "dx8renderer.h"
  61. #include "textureloader.h"
  62. #define MAX_LOADSTRING 100
  63. const int RESOLUTION_X = 640;
  64. const int RESOLUTION_Y = 480;
  65. const int BIT_DEPTH = 16;
  66. const Vector3 CAMERA_POSITION(3.0f,0.0f,1.0f);
  67. const Vector3 CAMERA_TARGET(0.0f,0.0f,0.90f);
  68. const Vector3 OBJECT_POSITION(0.0f,0.0f,0.0f);
  69. const char * OBJECT_NAME = "area1-LM";
  70. const char * ANIM_NAME = NULL;
  71. static void Log_Statistics();
  72. static void Init_Assets();
  73. static void Init_3D_Scene();
  74. static void Init_2D_Scene();
  75. class SkeletonSceneClass;
  76. // Global Variables:
  77. HINSTANCE hInst; // current instance
  78. TCHAR szTitle[MAX_LOADSTRING]; // The title bar text
  79. TCHAR szWindowClass[MAX_LOADSTRING]; // The title bar text
  80. WW3DAssetManager * AssetManager=NULL;
  81. SkeletonSceneClass * my_scene = NULL;
  82. SimpleSceneClass * my_2d_scene = NULL;
  83. CameraClass * my_camera = NULL;
  84. CameraClass * my_2d_camera = NULL;
  85. Render2DTextClass * mytext = NULL;
  86. RenderObjClass * my_object = NULL;
  87. HAnimClass * my_anim = NULL;
  88. TexProjectClass * my_texture_projector = NULL;
  89. MaterialPassClass * my_material_pass = NULL;
  90. LightClass * my_lights[3];
  91. Font3DInstanceClass *my_font_a=NULL;
  92. Font3DInstanceClass *my_font_b=NULL;
  93. DecalSystemClass TheDecalSystem;
  94. bool running=true;
  95. bool rotate=true;
  96. bool randmat=false;
  97. bool randtex=false;
  98. bool staticsort=true;
  99. bool using_mat_pass=false;
  100. int shatter=0;
  101. // Foward declarations of functions included in this code module:
  102. ATOM MyRegisterClass(HINSTANCE hInstance);
  103. LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
  104. LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);
  105. void Enable_Alternate_Materials(RenderObjClass * model,bool onoff);
  106. void Render();
  107. void Render2();
  108. RenderObjClass * Create_Dynamesh(void);
  109. RenderObjClass * Create_Sphere(void);
  110. RenderObjClass * Create_Ring(void);
  111. RenderObjClass * Create_bitmap2d(void);
  112. RenderObjClass * Create_segline(void);
  113. void WWDebug_Message_Callback(DebugType type, const char * message);
  114. void WWAssert_Callback(const char * message);
  115. void Debug_Refs(void);
  116. void Create_Decal(RenderObjClass * obj,Matrix3D & tm,float radius,char * texture);
  117. MaterialPassClass * Create_Material_Pass(void);
  118. TexProjectClass * Create_Texture_Projector(void);
  119. // ----------------------------------------------------------------------------
  120. //
  121. // FPS counter class counts how many times Update() has been called during the
  122. // last second. The fps counter caps at MAX_FPS which is the maximum fps count
  123. // that can be measured.
  124. //
  125. // ----------------------------------------------------------------------------
  126. const unsigned MAX_FPS=2000;
  127. class FPSCounterClass
  128. {
  129. unsigned frame_times[MAX_FPS];
  130. unsigned frame_time_count;
  131. public:
  132. FPSCounterClass();
  133. void Update();
  134. unsigned Get_FPS();
  135. };
  136. static FPSCounterClass fps_counter;
  137. // ----------------------------------------------------------------------------
  138. FPSCounterClass::FPSCounterClass()
  139. :
  140. frame_time_count(0)
  141. {
  142. }
  143. // ----------------------------------------------------------------------------
  144. void FPSCounterClass::Update()
  145. {
  146. unsigned frame_time=timeGetTime();
  147. unsigned limit=frame_time-1000;
  148. for (unsigned i=0;i<frame_time_count;++i) {
  149. if (frame_times[i]<limit) {
  150. frame_times[i]=frame_times[frame_time_count-1];
  151. frame_time_count--;
  152. }
  153. }
  154. if (frame_time_count<MAX_FPS) {
  155. frame_times[frame_time_count++]=frame_time;
  156. }
  157. }
  158. // ----------------------------------------------------------------------------
  159. unsigned FPSCounterClass::Get_FPS()
  160. {
  161. return frame_time_count;
  162. }
  163. // ----------------------------------------------------------------------------
  164. //
  165. // Cusomized scene for testing material passes.
  166. //
  167. // ----------------------------------------------------------------------------
  168. class SkeletonSceneClass : public SimpleSceneClass
  169. {
  170. public:
  171. SkeletonSceneClass(void) : TestPass(NULL) { }
  172. ~SkeletonSceneClass(void) { REF_PTR_RELEASE(TestPass); }
  173. virtual void Customized_Render(RenderInfoClass & rinfo);
  174. void Set_Material_Pass(MaterialPassClass * pass) { REF_PTR_SET(TestPass,pass); }
  175. protected:
  176. MaterialPassClass * TestPass;
  177. };
  178. // ----------------------------------------------------------------------------
  179. void SkeletonSceneClass::Customized_Render(RenderInfoClass & rinfo)
  180. {
  181. if (TestPass) {
  182. rinfo.Push_Material_Pass(TestPass);
  183. }
  184. SimpleSceneClass::Customized_Render(rinfo);
  185. if (TestPass) {
  186. rinfo.Pop_Material_Pass();
  187. }
  188. }
  189. // ----------------------------------------------------------------------------
  190. //
  191. //
  192. //
  193. // ----------------------------------------------------------------------------
  194. int APIENTRY WinMain(HINSTANCE hInstance,
  195. HINSTANCE hPrevInstance,
  196. LPSTR lpCmdLine,
  197. int nCmdShow)
  198. {
  199. HACCEL hAccelTable;
  200. hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_SKELETON);
  201. // install debug callbacks
  202. WWDebug_Install_Message_Handler(WWDebug_Message_Callback);
  203. WWDebug_Install_Assert_Handler(WWAssert_Callback);
  204. // Initialize global strings
  205. LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
  206. LoadString(hInstance, IDC_SKELETON, szWindowClass, MAX_LOADSTRING);
  207. MyRegisterClass(hInstance);
  208. // Perform application initialization:
  209. hInst = hInstance; // Store instance handle in our global variable
  210. HWND hWnd = CreateWindow(
  211. szWindowClass,
  212. szTitle,
  213. WS_OVERLAPPEDWINDOW,
  214. CW_USEDEFAULT,
  215. 0,
  216. CW_USEDEFAULT,
  217. 0,
  218. NULL,
  219. NULL,
  220. hInstance,
  221. NULL);
  222. ShowWindow(hWnd, nCmdShow);
  223. UpdateWindow(hWnd);
  224. // WW Inits
  225. WWMath::Init ();
  226. AssetManager=new WW3DAssetManager;
  227. AssetManager->Register_Prototype_Loader(&_ParticleEmitterLoader);
  228. AssetManager->Load_3D_Assets("ShatterPlanes0.w3d"); // Shatter planes
  229. WW3D::Init(hWnd);
  230. // WW3D::Set_Prelit_Mode(WW3D::PRELIT_MODE_VERTEX);
  231. WW3D::Set_Prelit_Mode(WW3D::PRELIT_MODE_LIGHTMAP_MULTI_PASS);
  232. // WW3D::Set_Prelit_Mode(WW3D::PRELIT_MODE_LIGHTMAP_MULTI_TEXTURE);
  233. // WW3D::Set_Collision_Box_Display_Mask(0xFF);
  234. if (WW3D::Set_Render_Device(-1,RESOLUTION_X,RESOLUTION_Y,BIT_DEPTH,1,true)!=WW3D_ERROR_OK) {
  235. if (WW3D::Set_Any_Render_Device()!=WW3D_ERROR_OK) {
  236. WW3D::Shutdown();
  237. WWMath::Shutdown ();
  238. Debug_Refs();
  239. return 0;
  240. }
  241. }
  242. Init_Assets();
  243. Init_2D_Scene();
  244. Init_3D_Scene();
  245. // main loop
  246. int time=timeGetTime();
  247. float theta = 0.0f;
  248. while (running)
  249. {
  250. if (my_object && rotate) {
  251. theta += DEG_TO_RADF(0.1f);
  252. Matrix3D tm(1);
  253. tm.Rotate_Z(theta);
  254. //tm.Rotate_X(theta*1.37f);
  255. //tm.Rotate_Y(theta*1.09f);
  256. tm.Set_Translation(OBJECT_POSITION);
  257. my_object->Set_Transform(tm);
  258. }
  259. if (my_object && my_texture_projector) {
  260. my_texture_projector->Set_Transform(my_object->Get_Bone_Transform("ProjectorBone"));
  261. }
  262. if (shatter==1)
  263. {
  264. if (my_object->Class_ID()==RenderObjClass::CLASSID_MESH)
  265. {
  266. my_scene->Remove_Render_Object(my_object);
  267. ShatterSystem::Shatter_Mesh((MeshClass*)my_object,Vector3(0,0,0),Vector3(1,0,0));
  268. REF_PTR_RELEASE(my_object);
  269. int count=ShatterSystem::Get_Fragment_Count();
  270. int i;
  271. for (i=0; i<count; i++)
  272. {
  273. my_object=ShatterSystem::Get_Fragment(i);
  274. my_object->Set_Position(my_object->Get_Position()+Vector3(rand()%15,rand()%15,rand()%15));
  275. my_scene->Add_Render_Object(my_object);
  276. REF_PTR_RELEASE(my_object);
  277. }
  278. }
  279. shatter++;
  280. }
  281. if (randmat)
  282. {
  283. if (my_object->Class_ID()==RenderObjClass::CLASSID_MESH)
  284. {
  285. MeshClass *mesh=(MeshClass*) my_object;
  286. MaterialInfoClass *mi=mesh->Get_Material_Info();
  287. VertexMaterialClass *vm=mi->Get_Vertex_Material(0);
  288. VertexMaterialClass *newvm=NEW_REF(VertexMaterialClass,(*vm));
  289. newvm->Set_Emissive(rand()%256/256.0,rand()%256/256.0,rand()%256/256.0);
  290. mesh->Replace_VertexMaterial(vm,newvm);
  291. mi->Replace_Material(0,newvm);
  292. REF_PTR_RELEASE(vm);
  293. REF_PTR_RELEASE(newvm);
  294. }
  295. randmat=!randmat;
  296. }
  297. if (randtex)
  298. {
  299. if (my_object->Class_ID()==RenderObjClass::CLASSID_MESH)
  300. {
  301. MeshClass *mesh=(MeshClass*) my_object;
  302. MaterialInfoClass *mi=mesh->Get_Material_Info();
  303. TextureClass *tex=mi->Peek_Texture(0);
  304. int ran=rand() % 3;
  305. char name[100];
  306. switch (ran)
  307. {
  308. case 0: sprintf(name,"catwalk.tga");
  309. break;
  310. case 1: sprintf(name,"chickonmap.tga");
  311. break;
  312. case 2: sprintf(name,"fullmoon.tga");
  313. break;
  314. }
  315. TextureClass *newtex=AssetManager->Get_Texture(name);
  316. mesh->Replace_Texture(tex,newtex);
  317. mi->Replace_Texture(0,newtex);
  318. REF_PTR_RELEASE(newtex);
  319. }
  320. randtex=!randtex;
  321. }
  322. if (my_texture_projector != NULL) {
  323. my_texture_projector->Pre_Render_Update(my_camera->Get_Transform());
  324. }
  325. WW3D::Enable_Static_Sort_Lists(staticsort);
  326. Render();
  327. Windows_Message_Handler();
  328. WW3D::Sync(timeGetTime()-time);
  329. Log_Statistics();
  330. }
  331. REF_PTR_RELEASE(my_scene);
  332. REF_PTR_RELEASE(my_camera);
  333. REF_PTR_RELEASE(my_2d_scene);
  334. REF_PTR_RELEASE(my_2d_camera);
  335. REF_PTR_RELEASE(my_lights[0]);
  336. REF_PTR_RELEASE(my_lights[1]);
  337. REF_PTR_RELEASE(my_lights[2]);
  338. delete mytext;
  339. REF_PTR_RELEASE(my_font_a);
  340. REF_PTR_RELEASE(my_font_b);
  341. REF_PTR_RELEASE(my_object);
  342. REF_PTR_RELEASE(my_anim);
  343. REF_PTR_RELEASE(my_material_pass);
  344. REF_PTR_RELEASE(my_texture_projector);
  345. PredictiveLODOptimizerClass::Free();
  346. // shutdown
  347. AssetManager->Free_Assets ();
  348. delete AssetManager;
  349. WW3D::Shutdown ();
  350. WWMath::Shutdown ();
  351. Debug_Refs();
  352. return 0;
  353. }
  354. // ----------------------------------------------------------------------------
  355. //
  356. // Render everything. Rendering stars with Begin_Scene() and ends to End_Scene().
  357. //
  358. // ----------------------------------------------------------------------------
  359. void Render()
  360. {
  361. // Predictive LOD optimizer optimizes the mesh LOD levels to match the given polygon budget
  362. PredictiveLODOptimizerClass::Optimize_LODs(5000);
  363. WW3D::Begin_Render(true,true,Vector3(0.0f,0.0f,0.0f));
  364. // Render 3D scene
  365. WW3D::Render(my_scene,my_camera);
  366. // Render 2D scene
  367. WW3D::Render(my_2d_scene,my_2d_camera);
  368. if (mytext) mytext->Render();
  369. WW3D::End_Render();
  370. fps_counter.Update();
  371. }
  372. // ----------------------------------------------------------------------------
  373. //
  374. // FUNCTION: MyRegisterClass()
  375. //
  376. // PURPOSE: Registers the window class.
  377. //
  378. // COMMENTS:
  379. //
  380. // This function and its usage is only necessary if you want this code
  381. // to be compatible with Win32 systems prior to the 'RegisterClassEx'
  382. // function that was added to Windows 95. It is important to call this function
  383. // so that the application will get 'well formed' small icons associated
  384. // with it.
  385. //
  386. // ----------------------------------------------------------------------------
  387. ATOM MyRegisterClass(HINSTANCE hInstance)
  388. {
  389. WNDCLASSEX wcex;
  390. wcex.cbSize = sizeof(WNDCLASSEX);
  391. wcex.style = CS_HREDRAW | CS_VREDRAW;
  392. wcex.lpfnWndProc = (WNDPROC)WndProc;
  393. wcex.cbClsExtra = 0;
  394. wcex.cbWndExtra = 0;
  395. wcex.hInstance = hInstance;
  396. wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_SKELETON);
  397. wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
  398. wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
  399. wcex.lpszMenuName = (LPCSTR)IDC_SKELETON;
  400. wcex.lpszClassName = szWindowClass;
  401. wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL);
  402. return RegisterClassEx(&wcex);
  403. }
  404. // ----------------------------------------------------------------------------
  405. //
  406. // FUNCTION: WndProc(HWND, unsigned, WORD, LONG)
  407. //
  408. // PURPOSE: Processes messages for the main window.
  409. //
  410. // WM_COMMAND - process the application menu
  411. // WM_PAINT - Paint the main window
  412. // WM_DESTROY - post a quit message and return
  413. //
  414. //
  415. // ----------------------------------------------------------------------------
  416. LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
  417. {
  418. int wmId, wmEvent;
  419. PAINTSTRUCT ps;
  420. HDC hdc;
  421. switch (message)
  422. {
  423. case WM_COMMAND:
  424. wmId = LOWORD(wParam);
  425. wmEvent = HIWORD(wParam);
  426. // Parse the menu selections:
  427. switch (wmId)
  428. {
  429. case IDM_ABOUT:
  430. DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
  431. break;
  432. case IDM_EXIT:
  433. DestroyWindow(hWnd);
  434. break;
  435. default:
  436. return DefWindowProc(hWnd, message, wParam, lParam);
  437. }
  438. break;
  439. case WM_ACTIVATEAPP:
  440. if (wParam) WW3D::On_Activate_App();
  441. else WW3D::On_Deactivate_App();
  442. return DefWindowProc(hWnd, message, wParam, lParam);
  443. case WM_PAINT:
  444. hdc = BeginPaint(hWnd, &ps);
  445. // TODO: Add any drawing code here...
  446. EndPaint(hWnd, &ps);
  447. break;
  448. case WM_DESTROY:
  449. running=false;
  450. PostQuitMessage(0);
  451. break;
  452. case WM_KEYUP:
  453. if ((wParam&0xff)==VK_ESCAPE) {
  454. DestroyWindow(hWnd);
  455. return 0;
  456. }
  457. return DefWindowProc(hWnd, message, wParam, lParam);
  458. case WM_CHAR:
  459. {
  460. char key=LOWORD(wParam);
  461. switch (key)
  462. {
  463. case ' ':
  464. shatter++;
  465. break;
  466. case '-':
  467. WW3D::Make_Screen_Shot("screen");
  468. break;
  469. case '+':
  470. WW3D::Toggle_Movie_Capture();
  471. break;
  472. case 'r':
  473. rotate=!rotate;
  474. break;
  475. case '1':
  476. WW3D::Set_NPatches_Level(1);
  477. break;
  478. case '2':
  479. WW3D::Set_NPatches_Level(2);
  480. break;
  481. case '3':
  482. WW3D::Set_NPatches_Level(3);
  483. break;
  484. case '4':
  485. WW3D::Set_NPatches_Level(4);
  486. break;
  487. case '5':
  488. WW3D::Set_NPatches_Level(5);
  489. break;
  490. case '6':
  491. WW3D::Set_NPatches_Level(6);
  492. break;
  493. case '7':
  494. WW3D::Set_NPatches_Level(7);
  495. break;
  496. case '8':
  497. WW3D::Set_NPatches_Level(8);
  498. break;
  499. case 'q':
  500. randmat=!randmat;
  501. break;
  502. case 'w':
  503. randtex=!randtex;
  504. break;
  505. case 's':
  506. staticsort=!staticsort;
  507. break;
  508. case 'b':
  509. {
  510. using_mat_pass=!using_mat_pass;
  511. if (!using_mat_pass) {
  512. my_scene->Set_Material_Pass(0);
  513. }
  514. else {
  515. my_scene->Set_Material_Pass(my_material_pass);
  516. }
  517. }
  518. break;
  519. case 'g':
  520. {
  521. if (WW3D::Get_NPatches_Gap_Filling_Mode()==WW3D::NPATCHES_GAP_FILLING_DISABLED) {
  522. WW3D::Set_NPatches_Gap_Filling_Mode(WW3D::NPATCHES_GAP_FILLING_ENABLED);
  523. }
  524. else {
  525. WW3D::Set_NPatches_Gap_Filling_Mode(WW3D::NPATCHES_GAP_FILLING_DISABLED);
  526. }
  527. }
  528. break;
  529. case 'm':
  530. {
  531. SceneClass::PolyRenderType type = my_scene->Get_Polygon_Mode();
  532. type = (type == SceneClass::POINT) ? SceneClass::LINE : ((type == SceneClass::LINE) ? SceneClass::FILL : SceneClass::POINT);
  533. my_scene->Set_Polygon_Mode(type);
  534. }
  535. break;
  536. }
  537. }
  538. default:
  539. return DefWindowProc(hWnd, message, wParam, lParam);
  540. }
  541. return 0;
  542. }
  543. // Mesage handler for about box.
  544. LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  545. {
  546. switch (message)
  547. {
  548. case WM_INITDIALOG:
  549. return TRUE;
  550. case WM_COMMAND:
  551. if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
  552. {
  553. EndDialog(hDlg, LOWORD(wParam));
  554. return TRUE;
  555. }
  556. break;
  557. }
  558. return FALSE;
  559. }
  560. void Enable_Alternate_Materials(RenderObjClass * model,bool onoff)
  561. {
  562. if (model == NULL) return;
  563. for (int i=0; i<model->Get_Num_Sub_Objects(); i++) {
  564. RenderObjClass * subobj = model->Get_Sub_Object(i);
  565. Enable_Alternate_Materials(subobj,onoff);
  566. REF_PTR_RELEASE(subobj);
  567. }
  568. if (model->Class_ID() == RenderObjClass::CLASSID_MESH) {
  569. MeshModelClass * mesh_model = ((MeshClass *)model)->Get_Model();
  570. mesh_model->Enable_Alternate_Material_Description(onoff);
  571. REF_PTR_RELEASE(mesh_model);
  572. }
  573. }
  574. // ----------------------------------------------------------------------------
  575. //
  576. // WWDebug message callback defines the behavior of WWDEBUG_SAY().
  577. //
  578. // ----------------------------------------------------------------------------
  579. void WWDebug_Message_Callback(DebugType type, const char * message)
  580. {
  581. OutputDebugString(message);
  582. }
  583. // ----------------------------------------------------------------------------
  584. //
  585. // WWAssert callback defines the behavior of WWASSERT().
  586. //
  587. // ----------------------------------------------------------------------------
  588. void WWAssert_Callback(const char * message)
  589. {
  590. OutputDebugString(message);
  591. _asm int 0x03
  592. }
  593. // ----------------------------------------------------------------------------
  594. RenderObjClass * Create_Dynamesh(void)
  595. {
  596. // Create a tetrahedron
  597. DynamicMeshClass *dynamesh = NEW_REF(DynamicMeshClass, (4, 6));
  598. dynamesh->Set_Shader(ShaderClass::_PresetOpaqueShader);
  599. VertexMaterialClass *vm = VertexMaterialClass::Get_Preset(VertexMaterialClass::PRELIT_NODIFFUSE);
  600. dynamesh->Set_Vertex_Material(vm);
  601. vm->Release_Ref();
  602. TextureClass *texture = AssetManager->Get_Texture("chickonmap.tga");
  603. dynamesh->Set_Texture(texture);
  604. texture->Release_Ref();
  605. dynamesh->Vertex(0.0f, 100.0f, 0.0f, 1.0f, 0.0f);
  606. dynamesh->Vertex(100.0f, -100.0f, 0.0f ,1.0f, -1.0f);
  607. dynamesh->Vertex(-100.0f, -100.0f, 0.0f, -1.0f, -1.0f);
  608. dynamesh->Vertex(0.0f, -100.0f, -100.0f, 0.0f, 0.0f);
  609. dynamesh->Vertex(0.0f, 100.0f, 0.0f, 1.0f, 0.0f);
  610. dynamesh->Vertex(100.0f, -100.0f, 0.0f ,1.0f, -1.0f);
  611. return dynamesh;
  612. }
  613. RenderObjClass *Create_segline(void)
  614. {
  615. SegmentedLineClass *segline = NEW_REF(SegmentedLineClass,());
  616. Vector3 locations[4];
  617. locations[0].Set(0,0,0);
  618. locations[1].Set(50,50,50);
  619. locations[2].Set(50,-50,10);
  620. locations[3].Set(-50,50,10);
  621. segline->Set_Points(4, locations);
  622. //segline->Set_Shader(ShaderClass::_PresetOpaqueShader);
  623. segline->Set_Shader(ShaderClass::_PresetAlphaShader);
  624. segline->Set_Color(Vector3(1,0,1));
  625. segline->Set_Opacity(0.5);
  626. segline->Set_Freeze_Random(1);
  627. segline->Set_Visible(1);
  628. segline->Set_Width(10);
  629. TextureClass *tex=NEW_REF(TextureClass,("cloudlayer.tga"));
  630. segline->Set_Texture(tex);
  631. REF_PTR_RELEASE(tex);
  632. // segline->Set_Texture_Mapping_Mode(SegmentedLineClass::TILED_TEXTURE_MAP);
  633. segline->Set_Texture_Tile_Factor(5);
  634. segline->Set_Noise_Amplitude(5);
  635. segline->Set_Merge_Intersections(1);
  636. return segline;
  637. }
  638. // ----------------------------------------------------------------------------
  639. RenderObjClass * Create_Sphere(void)
  640. {
  641. SphereRenderObjClass *sph=NEW_REF(SphereRenderObjClass,());
  642. sph->Set_Color(Vector3(1,0,1));
  643. sph->Set_Scale(Vector3(100,100,100));
  644. return sph;
  645. }
  646. // ----------------------------------------------------------------------------
  647. RenderObjClass * Create_bitmap2d(void)
  648. {
  649. Bitmap2DObjClass *bmp=NEW_REF(Bitmap2DObjClass,("chickonmap.tga",0.0,0.0,false,false,false));
  650. return bmp;
  651. }
  652. // ----------------------------------------------------------------------------
  653. RenderObjClass * Create_Ring(void)
  654. {
  655. RingRenderObjClass *rng=NEW_REF(RingRenderObjClass,());
  656. rng->Set_Color(Vector3(1,0,1));
  657. rng->Set_Inner_Scale(Vector2(10,10));
  658. rng->Set_Outer_Scale(Vector2(50,50));
  659. return rng;
  660. }
  661. // ----------------------------------------------------------------------------
  662. void Create_Decal(RenderObjClass * robj,Matrix3D & tm,float radius,char * texture_name)
  663. {
  664. /*
  665. ** Allocate the decal generator
  666. */
  667. DecalGeneratorClass * gen = TheDecalSystem.Lock_Decal_Generator();
  668. WWASSERT(gen != NULL);
  669. /*
  670. ** Set up the transform, projection, and bounding volume parameters
  671. */
  672. const float DECAL_HALF_SLAB_THICKNESS = 50.0f;
  673. const float DECAL_BACKFACE_THRESHHOLD = 0.0f;
  674. float backup_dist = DECAL_HALF_SLAB_THICKNESS + 0.01f;
  675. Matrix3D transform = tm;
  676. transform.Translate_Z(backup_dist);
  677. gen->Set_Transform(transform);
  678. gen->Set_Ortho_Projection(-radius,radius,-radius,radius,0.01f,backup_dist + 2.0f * DECAL_HALF_SLAB_THICKNESS);
  679. gen->Set_Backface_Threshhold(DECAL_BACKFACE_THRESHHOLD);
  680. /*
  681. ** Set up the material settings. Just plug in the standard alpha shader and the
  682. ** vertex material which all decals use. Then grab the texture which the user
  683. ** specified...
  684. */
  685. MaterialPassClass * material = gen->Get_Material();
  686. VertexMaterialClass * decal_mtl = NEW_REF(VertexMaterialClass,());
  687. decal_mtl->Set_Ambient(0,0,0);
  688. decal_mtl->Set_Diffuse(0,0,0);
  689. decal_mtl->Set_Specular(0,0,0);
  690. decal_mtl->Set_Emissive(1,1,1);
  691. decal_mtl->Set_Opacity(1.0f);
  692. decal_mtl->Set_Shininess(0.0f);
  693. TextureClass * tex = WW3DAssetManager::Get_Instance()->Get_Texture(texture_name);
  694. tex->Set_U_Addr_Mode(TextureClass::TEXTURE_ADDRESS_CLAMP);
  695. tex->Set_V_Addr_Mode(TextureClass::TEXTURE_ADDRESS_CLAMP);
  696. material->Set_Shader(ShaderClass::_PresetAlphaShader);
  697. material->Set_Material(decal_mtl);
  698. material->Set_Texture(tex);
  699. REF_PTR_RELEASE(decal_mtl);
  700. REF_PTR_RELEASE(tex);
  701. REF_PTR_RELEASE(material);
  702. /*
  703. ** Apply!
  704. */
  705. robj->Create_Decal(gen);
  706. TheDecalSystem.Unlock_Decal_Generator(gen);
  707. }
  708. // ----------------------------------------------------------------------------
  709. MaterialPassClass * Create_Material_Pass(void)
  710. {
  711. TextureClass * texture = WW3DAssetManager::Get_Instance()->Get_Texture("decal.tga");
  712. VertexMaterialClass * mtl = NEW_REF(VertexMaterialClass,());
  713. mtl->Set_Diffuse(0.5f,0.5f,0.5f);
  714. mtl->Set_Specular(0,0,0);
  715. mtl->Set_Ambient(0,0,0);
  716. mtl->Set_Emissive(0.5f,0.5f,0.5f);
  717. mtl->Set_Lighting(false);
  718. EnvironmentMapperClass * mapper = NEW_REF(EnvironmentMapperClass,(0));
  719. mtl->Set_Mapper(mapper,0);
  720. MaterialPassClass * test_pass = NEW_REF(MaterialPassClass,());
  721. test_pass->Set_Shader(ShaderClass::_PresetAdditiveShader);
  722. test_pass->Set_Material(mtl);
  723. test_pass->Set_Texture(texture);
  724. REF_PTR_RELEASE(mtl);
  725. REF_PTR_RELEASE(texture);
  726. REF_PTR_RELEASE(mapper);
  727. return test_pass;
  728. }
  729. // ----------------------------------------------------------------------------
  730. TexProjectClass * Create_Texture_Projector(void)
  731. {
  732. const float SIZE = 10.0f;
  733. const float ZNEAR = 0.1f;
  734. const float ZFAR = 300.0f;
  735. TexProjectClass * new_projector = NEW_REF(TexProjectClass,());
  736. new_projector->Init_Additive();
  737. new_projector->Set_Intensity(1.0,true);
  738. new_projector->Set_Ortho_Projection(-SIZE,SIZE,-SIZE,SIZE,ZNEAR,ZFAR);
  739. Matrix3D tm;
  740. tm.Look_At(Vector3(200,200,200),Vector3(0,0,0),0.0f);
  741. new_projector->Set_Transform(tm);
  742. TextureClass * texture = WW3DAssetManager::Get_Instance()->Get_Texture("GreenSpot.tga");
  743. new_projector->Set_Texture(texture);
  744. REF_PTR_RELEASE(texture);
  745. return new_projector;
  746. }
  747. // ----------------------------------------------------------------------------
  748. void Debug_Refs(void)
  749. {
  750. #ifdef _DEBUG
  751. WWDEBUG_SAY(("Dumping Un-Released Ref-Counted objects...\r\n"));
  752. RefCountNodeClass * first = RefCountClass::ActiveRefList.First();
  753. RefCountNodeClass * node = first;
  754. while (node->Is_Valid())
  755. {
  756. RefCountClass * obj = node->Get();
  757. ActiveRefStruct * ref = &(obj->ActiveRefInfo);
  758. bool display = true;
  759. int count = 0;
  760. RefCountNodeClass * search = first;
  761. while (search->Is_Valid()) {
  762. if (search == node) { // if this is not the first one
  763. if (count != 0) {
  764. display = false;
  765. break;
  766. }
  767. }
  768. RefCountClass * search_obj = search->Get();
  769. ActiveRefStruct * search_ref = &(search_obj->ActiveRefInfo);
  770. if ( ref->File && search_ref->File &&
  771. !strcmp(search_ref->File, ref->File) &&
  772. (search_ref->Line == ref->Line) ) {
  773. count++;
  774. } else if ( (ref->File == NULL) && (search_ref->File == NULL) ) {
  775. count++;
  776. }
  777. search = search->Next();
  778. }
  779. if ( display ) {
  780. WWDEBUG_SAY(( "%d Active Ref: %s %d %p\n", count, ref->File,ref->Line,obj));
  781. static int num_printed = 0;
  782. if (++num_printed > 20) {
  783. WWDEBUG_SAY(( "And Many More......\n"));
  784. break;
  785. }
  786. }
  787. node = node->Next();
  788. }
  789. WWDEBUG_SAY(("Done.\r\n"));
  790. #endif
  791. }
  792. // ----------------------------------------------------------------------
  793. //
  794. // Ugly statistics block!!!
  795. //
  796. // ----------------------------------------------------------------------
  797. void Log_Statistics()
  798. {
  799. StringClass format(255,true);
  800. StringClass status_text(500,true);
  801. // static unsigned last_frame_time=0;
  802. // unsigned frame_time=timeGetTime();
  803. // unsigned time=frame_time-last_frame_time;
  804. // last_frame_time=frame_time;
  805. // if (time>1000) time=1000;
  806. // float fps=1000.0f/float(time);
  807. // static float time_fps;
  808. // static float current_fps;
  809. // static unsigned fps_count;
  810. // time_fps+=fps;
  811. // fps_count++;
  812. // if (fps_count==20) {
  813. // fps_count=0;
  814. // current_fps=time_fps/20.0f;
  815. // time_fps=0.0f;
  816. // }
  817. unsigned current_fps=fps_counter.Get_FPS();
  818. static unsigned stats_mode;
  819. static bool tab_pressed;
  820. if (GetAsyncKeyState(VK_TAB)) {
  821. if (!tab_pressed) {
  822. stats_mode++;
  823. stats_mode%=3;
  824. }
  825. tab_pressed=true;
  826. }
  827. else {
  828. tab_pressed=false;
  829. }
  830. switch (stats_mode) {
  831. case 0:
  832. Debug_Statistics::Record_Texture_Mode(Debug_Statistics::RECORD_TEXTURE_NONE);
  833. break;
  834. case 1:
  835. Debug_Statistics::Record_Texture_Mode(Debug_Statistics::RECORD_TEXTURE_NONE);
  836. format.Format("%d FPS\n",current_fps);
  837. status_text+=format;
  838. format.Format("%d Polys/frame (%dk pps)\n",Debug_Statistics::Get_DX8_Polygons(),unsigned(Debug_Statistics::Get_DX8_Polygons()*float(current_fps))/1000);
  839. status_text+=format;
  840. break;
  841. case 2:
  842. Debug_Statistics::Record_Texture_Mode(Debug_Statistics::RECORD_TEXTURE_NONE);
  843. format.Format("%d FPS\n",current_fps);
  844. status_text+=format;
  845. format.Format("%d Polys/frame (%dk pps)\n",Debug_Statistics::Get_DX8_Polygons(),unsigned(Debug_Statistics::Get_DX8_Polygons()*float(current_fps))/1000);
  846. status_text+=format;
  847. format.Format("%d Verts/frame (%dk vps)\n",Debug_Statistics::Get_DX8_Vertices(),unsigned(Debug_Statistics::Get_DX8_Vertices()*float(current_fps))/1000);
  848. status_text+=format;
  849. format.Format("%d DX8 calls\n",DX8Wrapper::Get_Last_Frame_DX8_Calls());
  850. status_text+=format;
  851. format.Format("%d VB changes\n",DX8Wrapper::Get_Last_Frame_Vertex_Buffer_Changes());
  852. status_text+=format;
  853. format.Format("%d IB changes\n",DX8Wrapper::Get_Last_Frame_Index_Buffer_Changes());
  854. status_text+=format;
  855. format.Format("%d texture changes\n",DX8Wrapper::Get_Last_Frame_Texture_Changes());
  856. status_text+=format;
  857. format.Format("%d material changes\n",DX8Wrapper::Get_Last_Frame_Material_Changes());
  858. status_text+=format;
  859. format.Format("%d light changes\n",DX8Wrapper::Get_Last_Frame_Light_Changes());
  860. status_text+=format;
  861. format.Format("%d RS changes\n",DX8Wrapper::Get_Last_Frame_Render_State_Changes());
  862. status_text+=format;
  863. format.Format("%d TSS changes\n",DX8Wrapper::Get_Last_Frame_Texture_Stage_State_Changes());
  864. status_text+=format;
  865. format.Format("%d Mtx changes\n",DX8Wrapper::Get_Last_Frame_Matrix_Changes());
  866. status_text+=format;
  867. break;
  868. }
  869. mytext->Reset();
  870. mytext->Set_Location(Vector2(0.0,0.0));
  871. mytext->Draw_Text(status_text,0xffff0000);
  872. }
  873. // ----------------------------------------------------------------------------
  874. void Init_Assets()
  875. {
  876. TextureClass *tex=AssetManager->Get_Texture("PPVF0102.TGA");
  877. REF_PTR_RELEASE(tex);
  878. // Preload test assets. Note that not all of these will actually be used.
  879. /* AssetManager->Load_3D_Assets("GreenSphere.w3d"); // Tests regular meshes
  880. AssetManager->Load_3D_Assets("TexSphere.w3d"); // Tests texture mapping
  881. AssetManager->Load_3D_Assets("TexScrlSphere.w3d"); // Tests Linear Offset mapper
  882. AssetManager->Load_3D_Assets("SphereAnim.w3d"); // Tests hierarchical animation (if you install its anim)
  883. AssetManager->Load_3D_Assets("SkinTest.w3d"); // Tests skinning and environment mapping
  884. AssetManager->Load_3D_Assets("sorting_test.w3d"); // Tests skinning and environment mapping
  885. AssetManager->Load_3D_Assets("boxtest.w3d"); // Tests BoxRenderObjClass (turn on the box display mask)
  886. AssetManager->Load_3D_Assets("Test1.w3d"); // Test yellow particles
  887. AssetManager->Load_3D_Assets("Test2.w3d"); // Tests alpha particles
  888. AssetManager->Load_3D_Assets("MPassSphere.w3d"); // Tests more than 2 passes on a mesh
  889. AssetManager->Load_3D_Assets("MPassTeapot.w3d"); // Tests more that 2 passes
  890. AssetManager->Load_3D_Assets("DupSphere.w3d"); // Tests 3 passes which all share the same uv coords
  891. AssetManager->Load_3D_Assets("vcolortest.w3d"); // Tests vertex color
  892. AssetManager->Load_3D_Assets("valphatest.w3d"); // Tests vertex alpha
  893. AssetManager->Load_3D_Assets("LightmapTest0.w3d"); // Tests pre-lighting, 3 solves: vertex, multi-pass, multi-stage
  894. AssetManager->Load_3D_Assets("LightmapTest1.w3d"); // Tests pre-lighting with alternate solves! (not currently runtime switchable)
  895. AssetManager->Load_3D_Assets("CubeSkin.w3d"); // Tests a simple skin, also can be used to test decals on skin meshes
  896. AssetManager->Load_3D_Assets("ProjectorTest.w3d"); // This model contains a mesh and an animated "ProjectorBone" for testing texture projections
  897. AssetManager->Load_3D_Assets("PolyRateTest.w3d"); // This model has lots of polys!
  898. AssetManager->Load_3D_Assets("PPVF01A.w3d"); // Game asset
  899. AssetManager->Load_3D_Assets("SPHERE_TEST.w3d"); // Tests multitexturing
  900. AssetManager->Load_3D_Assets("SCREEN_ALIGN.w3d"); // Tests camera aligned meshes
  901. AssetManager->Load_3D_Assets("halfsphere.w3d"); // Tests two-sided flag, camera aligned, and camera oriented meshes
  902. AssetManager->Load_3D_Assets("tsi01a.w3d"); // Tests static sort level
  903. AssetManager->Load_3D_Assets("tsi08a.w3d"); // Tests static sort level
  904. */
  905. AssetManager->Load_3D_Assets("area1-LM.w3d");
  906. /*
  907. AssetManager->Load_3D_Assets("S_A_Human.W3D");
  908. AssetManager->Load_3D_Assets("c_nod_rsold_L0.W3D");
  909. AssetManager->Load_3D_Assets("h_a_a0a1.W3D");
  910. */
  911. }
  912. // ----------------------------------------------------------------------------
  913. //
  914. // Create a scene for 2D-display, such as text and rectangles.
  915. //
  916. // ----------------------------------------------------------------------------
  917. void Init_2D_Scene()
  918. {
  919. // Create a scene for the 2D stuff -----------------------------------------
  920. my_2d_scene=NEW_REF(SimpleSceneClass,());
  921. my_2d_scene->Set_Ambient_Light(Vector3(1,1,1));
  922. // Create fonts to be used for text rendering ------------------------------
  923. my_font_a = AssetManager->Get_Font3DInstance("font12x16.tga");
  924. my_font_b = AssetManager->Get_Font3DInstance("fontnew4.tga");
  925. mytext=new Render2DTextClass(my_font_b);
  926. mytext->Set_Coordinate_Range( Render2DClass::Get_Screen_Resolution() );
  927. // Scene needs camera to be rendered with ----------------------------------
  928. my_2d_camera = NEW_REF(CameraClass,());
  929. #ifdef DRAWBITMAP
  930. my_2d_camera->Set_Position(Vector3(0,0,1));
  931. my_2d_camera->Set_Clip_Planes(0.995,2);
  932. #else
  933. my_2d_camera->Set_Position(Vector3(0,0,320));
  934. my_2d_camera->Set_Clip_Planes(300,1000);
  935. #endif
  936. Vector2 min = Vector2(-1, -0.75f);
  937. Vector2 max = Vector2(+1, +0.75f);
  938. my_2d_camera->Set_View_Plane(min, max);
  939. }
  940. void Init_3D_Scene()
  941. {
  942. WW3D::Enable_Sorting(false);
  943. WW3D::Set_NPatches_Level(1);
  944. // build scene
  945. my_scene=NEW_REF(SkeletonSceneClass,());
  946. my_scene->Set_Ambient_Light(Vector3(0.5f,0.5f,0.5f));
  947. // set up a light
  948. my_lights[0]=my_lights[1]=my_lights[2]=NULL;
  949. my_lights[0]=NEW_REF(LightClass,(LightClass::DIRECTIONAL));
  950. my_lights[0]->Set_Ambient(Vector3(0.1f,0.1f,0.1f));
  951. my_lights[0]->Set_Diffuse(Vector3(1.0f,1.0f,1.0f));
  952. my_lights[0]->Set_Spot_Direction(Vector3(0,1,0));
  953. my_scene->Add_Render_Object(my_lights[0]);
  954. // Scene needs camera to be rendered with ----------------------------------
  955. my_camera=NEW_REF(CameraClass,());
  956. Matrix3D camtransform(1);
  957. camtransform.Look_At(CAMERA_POSITION,CAMERA_TARGET,0);
  958. my_camera->Set_Transform(camtransform);
  959. my_object = AssetManager->Create_Render_Obj(OBJECT_NAME);
  960. if (ANIM_NAME != NULL) {
  961. my_anim = AssetManager->Get_HAnim(ANIM_NAME);
  962. }
  963. if (my_object != NULL) {
  964. my_object->Set_Position(OBJECT_POSITION);
  965. #if 0
  966. Enable_Alternate_Materials(my_object,true);
  967. #endif
  968. // Decal System
  969. #if 0
  970. Matrix3D decal_tm;
  971. decal_tm.Look_At(Vector3(30,5,10),Vector3(0,0,10),DEG_TO_RADF(65.5f));
  972. Create_Decal(my_object,decal_tm,13.7f,"decal.tga");
  973. #endif
  974. // PredictiveLODOptimizerClass::Add_Object(my_object);
  975. my_object->Set_Position(Vector3(0,0,0));
  976. if (my_anim != NULL) {
  977. my_object->Set_Animation(my_anim,0,RenderObjClass::ANIM_MODE_LOOP);
  978. }
  979. my_scene->Add_Render_Object(my_object);
  980. if (my_object->Class_ID()==RenderObjClass::CLASSID_PARTICLEEMITTER) {
  981. ((ParticleEmitterClass*) my_object)->Start();
  982. }
  983. }
  984. // 3D line object ----------------------------------------------------------
  985. #if 0
  986. Line3DClass *line = NULL;
  987. line = NEW_REF(Line3DClass,(Vector3(0,0,0),Vector3(100,100,0), 10,1,1,1,1));
  988. my_scene->Add_Render_Object(line);
  989. REF_PTR_RELEASE(line); // Obejct can be freed after adding scene so that it gets killed when scene dies
  990. #endif
  991. // Create texture projector material pass ----------------------------------
  992. #if 0
  993. my_texture_projector = Create_Texture_Projector();
  994. my_scene->Set_Material_Pass(my_texture_projector->Peek_Material_Pass());
  995. // REF_PTR_RELEASE(my_texture_projector);
  996. #endif
  997. // Create material pass ----------------------------------------------------
  998. #if 0
  999. my_material_pass = Create_Material_Pass();
  1000. my_scene->Set_Material_Pass(my_material_pass);
  1001. REF_PTR_RELEASE(my_material_pass);
  1002. #endif
  1003. }