Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

551 lines
17 KiB

  1. #define D3D_OVERLOADS
  2. #include "StdAfx.h"
  3. #include "D3DApp.h"
  4. #include "D3DTextr.h"
  5. #include "D3DUtil.h"
  6. #include "D3DMath.h"
  7. #include "D3DFile.h"
  8. #include "resource.h"
  9. /*
  10. **-----------------------------------------------------------------------------
  11. ** File: fish.cpp
  12. ** Purpose: fish demo
  13. ** Notes:
  14. ** and SetTransform
  15. **
  16. ** Copyright (c) 1995 - 1997 by Microsoft, all rights reserved
  17. **-----------------------------------------------------------------------------
  18. */
  19. //#define FREQUENCY ((rnd()<0.01)||(abs(loc.x-goal.x)< 5.0f)||(abs(loc.y-goal.y)< 5.0f)||(abs(loc.z-goal.z)< 5.0f))
  20. //#define FREQUENCY ((abs(loc.x-goal.x)< 5.0f)||(abs(loc.y-goal.y)< 5.0f)||(abs(loc.z-goal.z)< 5.0f))
  21. #define FREQUENCY 0
  22. #define SPEED 0.001f
  23. /*
  24. **-----------------------------------------------------------------------------
  25. ** Include files
  26. **-----------------------------------------------------------------------------
  27. */
  28. typedef struct xxx_FISH {
  29. D3DVECTOR loc, // current location
  30. goal, // current goal
  31. delta; // current direction
  32. float yaw, pitch, roll;
  33. float dyaw;
  34. } AFISH;
  35. /*
  36. **-----------------------------------------------------------------------------
  37. ** Local variables
  38. **-----------------------------------------------------------------------------
  39. */
  40. const float pi = (float)3.1415;
  41. //#define POINT_LINE_TEST
  42. #define GROUND_GRID
  43. //#define NUM_FISH 42
  44. AFISH FISH[NUM_FISH];
  45. #define FISH_VERTICES 36
  46. #define FISH_INDICES 60
  47. D3DVERTEX vFISH[FISH_VERTICES];
  48. WORD iFISH[FISH_INDICES];
  49. #ifdef GROUND_GRID
  50. #define NUM_GRID 22
  51. #define GRID_WIDTH 800.0f
  52. D3DVERTEX grid[NUM_GRID*NUM_GRID];
  53. #endif
  54. #ifdef POINT_LINE_TEST
  55. #define LOTS_OF_POINTS (222)
  56. D3DVERTEX points[LOTS_OF_POINTS];
  57. #endif
  58. D3DMATRIX g_proj, g_view, g_world; // Matrices
  59. D3DLIGHT7 g_light; // Structure defining the light
  60. D3DMATRIX MatrixMult(D3DMATRIX a, D3DMATRIX b)
  61. {
  62. D3DMATRIX result;
  63. D3DXMatrixMultiply((D3DXMATRIX*)&result,(D3DXMATRIX*)&a,(D3DXMATRIX*)&b);
  64. return result;
  65. }
  66. D3DMATRIX RotateXMatrix(float rot)
  67. {
  68. D3DMATRIX result;
  69. D3DXMatrixRotationX((D3DXMATRIX*)&result,rot);
  70. return result;
  71. }
  72. D3DMATRIX RotateYMatrix(float rot)
  73. {
  74. D3DMATRIX result;
  75. D3DXMatrixRotationY((D3DXMATRIX*)&result,rot);
  76. return result;
  77. }
  78. D3DMATRIX RotateZMatrix(float rot)
  79. {
  80. D3DMATRIX result;
  81. D3DXMatrixRotationZ((D3DXMATRIX*)&result,rot);
  82. return result;
  83. }
  84. D3DMATRIX TranslateMatrix(D3DVECTOR v)
  85. {
  86. D3DMATRIX result;
  87. D3DXMatrixTranslation((D3DXMATRIX*)&result,v.x,v.y,v.z);
  88. return result;
  89. }
  90. D3DMATRIX TranslateMatrix(float x, float y , float z)
  91. {
  92. D3DMATRIX result;
  93. D3DXMatrixTranslation((D3DXMATRIX*)&result,x,y,z);
  94. return result;
  95. }
  96. /*
  97. float rnd(void)
  98. {
  99. return float(rand())/RAND_MAX;
  100. }
  101. */
  102. /*
  103. **-----------------------------------------------------------------------------
  104. ** Name: DrawFISH
  105. ** Purpose: Draws a single Paper FISH
  106. **-----------------------------------------------------------------------------
  107. */
  108. HRESULT DrawFISH (LPDIRECT3DDEVICE7 lpDev)
  109. {
  110. HRESULT hResult;
  111. lpDev->SetTexture(0,NULL);
  112. hResult =lpDev->DrawIndexedPrimitive (D3DPT_TRIANGLELIST, D3DVT_VERTEX, (LPVOID)vFISH, FISH_VERTICES, iFISH, FISH_INDICES, D3DDP_WAIT);
  113. return hResult;
  114. }
  115. /*
  116. **-----------------------------------------------------------------------------
  117. ** Name: D3DWindow::Init
  118. ** Purpose: Initialize scene objects
  119. **-----------------------------------------------------------------------------
  120. */
  121. HRESULT InitGeometry()
  122. {
  123. //
  124. // generate the paper FISH data
  125. //
  126. // right wing top
  127. vFISH[ 0] = D3DVERTEX(D3DVECTOR(0.125f, 0.03125f, 3.5f), Normalize(D3DVECTOR(-0.25f, 1.0f, 0.0f)), rnd(), rnd());
  128. vFISH[ 1] = D3DVERTEX(D3DVECTOR(0.75f, 0.1875f, 3.25f), Normalize(D3DVECTOR(-0.25f, 1.0f, 0.0f)), rnd(), rnd());
  129. vFISH[ 2] = D3DVERTEX(D3DVECTOR(2.75f, 0.6875f, -2.0f), Normalize(D3DVECTOR(-0.25f, 1.0f, 0.0f)), rnd(), rnd());
  130. vFISH[ 3] = D3DVERTEX(D3DVECTOR(2.0f, 0.5f, -4.25f), Normalize(D3DVECTOR(-0.25f, 1.0f, 0.0f)), rnd(), rnd());
  131. vFISH[ 4] = D3DVERTEX(D3DVECTOR(0.5f, 0.125f, -3.5f), Normalize(D3DVECTOR(-0.25f, 1.0f, 0.0f)), rnd(), rnd());
  132. // right wing bottom
  133. vFISH[ 5] = D3DVERTEX(D3DVECTOR(0.125f, 0.03125f, 3.5f), Normalize(D3DVECTOR(0.25f, -1.0f, 0.0f)), rnd(), rnd());
  134. vFISH[ 6] = D3DVERTEX(D3DVECTOR(0.75f, 0.1875f, 3.25f), Normalize(D3DVECTOR(0.25f, -1.0f, 0.0f)), rnd(), rnd());
  135. vFISH[ 7] = D3DVERTEX(D3DVECTOR(2.75f, 0.6875f, -2.0f), Normalize(D3DVECTOR(0.25f, -1.0f, 0.0f)), rnd(), rnd());
  136. vFISH[ 8] = D3DVERTEX(D3DVECTOR(2.0f, 0.5f, -4.25f), Normalize(D3DVECTOR(0.25f, -1.0f, 0.0f)), rnd(), rnd());
  137. vFISH[ 9] = D3DVERTEX(D3DVECTOR(0.5f, 0.125f, -3.5f), Normalize(D3DVECTOR(0.25f, -1.0f, 0.0f)), rnd(), rnd());
  138. // left wing bottom
  139. vFISH[10] = D3DVERTEX(D3DVECTOR(-0.125f, 0.03125f, 3.5f), Normalize(D3DVECTOR(-0.25f, -1.0f, 0.0f)), rnd(), rnd());
  140. vFISH[11] = D3DVERTEX(D3DVECTOR(-0.75f, 0.1875f, 3.25f), Normalize(D3DVECTOR(-0.25f, -1.0f, 0.0f)), rnd(), rnd());
  141. vFISH[12] = D3DVERTEX(D3DVECTOR(-2.75f, 0.6875f, -2.0f), Normalize(D3DVECTOR(-0.25f, -1.0f, 0.0f)), rnd(), rnd());
  142. vFISH[13] = D3DVERTEX(D3DVECTOR(-2.0f, 0.5f, -4.25f), Normalize(D3DVECTOR(-0.25f, -1.0f, 0.0f)), rnd(), rnd());
  143. vFISH[14] = D3DVERTEX(D3DVECTOR(-0.5f, 0.125f, -3.5f), Normalize(D3DVECTOR(-0.25f, -1.0f, 0.0f)), rnd(), rnd());
  144. // left wing top
  145. vFISH[15] = D3DVERTEX(D3DVECTOR(-0.125f, 0.03125f, 3.5f), Normalize(D3DVECTOR(0.25f, 1.0f, 0.0f)), rnd(), rnd());
  146. vFISH[16] = D3DVERTEX(D3DVECTOR(-0.75f, 0.1875f, 3.25f), Normalize(D3DVECTOR(0.25f, 1.0f, 0.0f)), rnd(), rnd());
  147. vFISH[17] = D3DVERTEX(D3DVECTOR(-2.75f, 0.6875f, -2.0f), Normalize(D3DVECTOR(0.25f, 1.0f, 0.0f)), rnd(), rnd());
  148. vFISH[18] = D3DVERTEX(D3DVECTOR(-2.0f, 0.5f, -4.25f), Normalize(D3DVECTOR(0.25f, 1.0f, 0.0f)), rnd(), rnd());
  149. vFISH[19] = D3DVERTEX(D3DVECTOR(-0.5f, 0.125f, -3.5f), Normalize(D3DVECTOR(0.25f, 1.0f, 0.0f)), rnd(), rnd());
  150. // right body outside
  151. vFISH[20] = D3DVERTEX(D3DVECTOR(0.125f, 0.03125f, 3.5f), Normalize(D3DVECTOR(1.0f, -0.1f, 0.0f)), rnd(), rnd());
  152. vFISH[21] = D3DVERTEX(D3DVECTOR(0.5f, 0.125f, -3.5f), Normalize(D3DVECTOR(1.0f, -0.1f, 0.0f)), rnd(), rnd());
  153. vFISH[22] = D3DVERTEX(D3DVECTOR(0.0f, -2.25f, -2.75f), Normalize(D3DVECTOR(1.0f, -0.1f, 0.0f)), rnd(), rnd());
  154. vFISH[23] = D3DVERTEX(D3DVECTOR(0.0f, -0.5f, 3.625f), Normalize(D3DVECTOR(1.0f, -0.1f, 0.0f)), rnd(), rnd());
  155. // right body inside
  156. vFISH[24] = D3DVERTEX(D3DVECTOR(0.125f, 0.03125f, 3.5f), Normalize(D3DVECTOR(-1.0f, 0.1f, 0.0f)), rnd(), rnd());
  157. vFISH[25] = D3DVERTEX(D3DVECTOR(0.5f, 0.125f, -3.5f), Normalize(D3DVECTOR(-1.0f, 0.1f, 0.0f)), rnd(), rnd());
  158. vFISH[26] = D3DVERTEX(D3DVECTOR(0.0f, -2.25f, -2.75f), Normalize(D3DVECTOR(-1.0f, 0.1f, 0.0f)), rnd(), rnd());
  159. vFISH[27] = D3DVERTEX(D3DVECTOR(0.0f, -0.5f, 3.625f), Normalize(D3DVECTOR(-1.0f, 0.1f, 0.0f)), rnd(), rnd());
  160. // left body outside
  161. vFISH[28] = D3DVERTEX(D3DVECTOR(-0.125f, 0.03125f, 3.5f), Normalize(D3DVECTOR(-1.0f, -0.1f, 0.0f)), rnd(), rnd());
  162. vFISH[29] = D3DVERTEX(D3DVECTOR(-0.5f, 0.125f, -3.5f), Normalize(D3DVECTOR(-1.0f, -0.1f, 0.0f)), rnd(), rnd());
  163. vFISH[30] = D3DVERTEX(D3DVECTOR(0.0f, -2.25f, -2.75f), Normalize(D3DVECTOR(-1.0f, -0.1f, 0.0f)), rnd(), rnd());
  164. vFISH[31] = D3DVERTEX(D3DVECTOR(0.0f, -0.5f, 3.625f), Normalize(D3DVECTOR(-1.0f, -0.1f, 0.0f)), rnd(), rnd());
  165. // left body inside
  166. vFISH[32] = D3DVERTEX(D3DVECTOR(-0.125f, 0.03125f, 3.5f), Normalize(D3DVECTOR(1.0f, 0.1f, 0.0f)), rnd(), rnd());
  167. vFISH[33] = D3DVERTEX(D3DVECTOR(-0.5f, 0.125f, -3.5f), Normalize(D3DVECTOR(1.0f, 0.1f, 0.0f)), rnd(), rnd());
  168. vFISH[34] = D3DVERTEX(D3DVECTOR(0.0f, -2.25f, -2.75f), Normalize(D3DVECTOR(1.0f, 0.1f, 0.0f)), rnd(), rnd());
  169. vFISH[35] = D3DVERTEX(D3DVECTOR(0.0f, -0.5f, 3.625f), Normalize(D3DVECTOR(1.0f, 0.1f, 0.0f)), rnd(), rnd());
  170. // right wing top
  171. iFISH[ 0] = 0;
  172. iFISH[ 1] = 1;
  173. iFISH[ 2] = 4;
  174. iFISH[ 3] = 1;
  175. iFISH[ 4] = 2;
  176. iFISH[ 5] = 4;
  177. iFISH[ 6] = 4;
  178. iFISH[ 7] = 2;
  179. iFISH[ 8] = 3;
  180. // right wing bottom
  181. iFISH[ 9] = 5;
  182. iFISH[10] = 9;
  183. iFISH[11] = 6;
  184. iFISH[12] = 6;
  185. iFISH[13] = 9;
  186. iFISH[14] = 7;
  187. iFISH[15] = 7;
  188. iFISH[16] = 9;
  189. iFISH[17] = 8;
  190. // left wing top
  191. iFISH[18] = 10;
  192. iFISH[19] = 11;
  193. iFISH[20] = 14;
  194. iFISH[21] = 11;
  195. iFISH[22] = 12;
  196. iFISH[23] = 14;
  197. iFISH[24] = 14;
  198. iFISH[25] = 12;
  199. iFISH[26] = 13;
  200. // left wing bottom
  201. iFISH[27] = 15;
  202. iFISH[28] = 19;
  203. iFISH[29] = 16;
  204. iFISH[30] = 16;
  205. iFISH[31] = 19;
  206. iFISH[32] = 17;
  207. iFISH[33] = 17;
  208. iFISH[34] = 19;
  209. iFISH[35] = 18;
  210. // right body outside
  211. iFISH[36] = 20;
  212. iFISH[37] = 23;
  213. iFISH[38] = 21;
  214. iFISH[39] = 21;
  215. iFISH[40] = 23;
  216. iFISH[41] = 22;
  217. // right body inside
  218. iFISH[42] = 24;
  219. iFISH[43] = 25;
  220. iFISH[44] = 27;
  221. iFISH[45] = 25;
  222. iFISH[46] = 26;
  223. iFISH[47] = 27;
  224. // left body outside
  225. iFISH[48] = 28;
  226. iFISH[49] = 29;
  227. iFISH[50] = 31;
  228. iFISH[51] = 29;
  229. iFISH[52] = 30;
  230. iFISH[53] = 31;
  231. // left body inside
  232. iFISH[54] = 32;
  233. iFISH[55] = 35;
  234. iFISH[56] = 33;
  235. iFISH[57] = 33;
  236. iFISH[58] = 35;
  237. iFISH[59] = 34;
  238. // seed the random number generator
  239. srand (time (0));
  240. for (int i=0; i<NUM_FISH; i++)
  241. {
  242. FISH[i].loc = D3DVECTOR(0.0f, 0.0f, 0.0f);
  243. FISH[i].goal = D3DVECTOR(XEXTENT, YEXTENT,ZEXTENT);
  244. FISH[i].delta = D3DVECTOR(0.0f, 0.0f, 1.0f);
  245. FISH[i].yaw = 0.0f;
  246. FISH[i].pitch = 0.0f;
  247. FISH[i].roll = 0.0f;
  248. FISH[i].dyaw = 0.0f;
  249. }
  250. float size = GRID_WIDTH/(NUM_GRID-1.0f);
  251. float offset = GRID_WIDTH/2.0f;
  252. for (i=0; i<NUM_GRID; i++)
  253. {
  254. for (int j=0; j<NUM_GRID; j++)
  255. {
  256. grid[j+i*NUM_GRID] = D3DVERTEX(D3DVECTOR(i*size-offset, 0.0f, j*size-offset), Normalize(D3DVECTOR(0.0f, 1.0f, 0.0f)), 0.0f, 0.0f);
  257. }
  258. }
  259. return S_OK;
  260. }
  261. /*
  262. **-----------------------------------------------------------------------------
  263. ** Name: D3DScene::Render
  264. ** Purpose: Draws scene
  265. **-----------------------------------------------------------------------------
  266. */
  267. HRESULT PlayWithFish(LPDIRECT3DDEVICE7 lpDev)
  268. {
  269. HRESULT hResult;
  270. // play with FISH
  271. static float tic = 0.0f;
  272. static float speed=SPEED;
  273. static float angle_tweak = TWEAK;
  274. static D3DVECTOR z_ward(0.0f, 0.0f, 1.0f);
  275. for (int i=0; i<NUM_FISH; i++)
  276. {
  277. D3DVECTOR offset;
  278. // tweek orientation based on last position and goal
  279. offset = FISH[i].goal - FISH[i].loc;
  280. // first, tweak the pitch
  281. if (offset.y > 1.0) { // we're too low
  282. FISH[i].pitch += angle_tweak;
  283. if (FISH[i].pitch > 0.8f)
  284. FISH[i].pitch = 0.8f;
  285. } else if (offset.y < -1.0) { // we're too high
  286. FISH[i].pitch -= angle_tweak;
  287. if (FISH[i].pitch < -0.8f)
  288. FISH[i].pitch = -0.8f;
  289. } else {
  290. // add damping
  291. FISH[i].pitch *= 0.95f;
  292. }
  293. // now figure out yaw changes
  294. offset.y = 0.0f; FISH[i].delta.y = 0.0f;
  295. FISH[i].delta = Normalize (FISH[i].delta);
  296. offset = Normalize (offset);
  297. float dot = DotProduct (offset, FISH[i].delta);
  298. offset = CrossProduct (offset, FISH[i].delta);
  299. dot = (1.0f-dot)/2.0f * angle_tweak * 10.0f;
  300. if (offset.y > 0.01) {
  301. FISH[i].dyaw = (FISH[i].dyaw*9.0f + dot) * 0.1f;
  302. } else if (offset.y < 0.01) {
  303. FISH[i].dyaw = (FISH[i].dyaw*9.0f - dot) * 0.1f;
  304. }
  305. FISH[i].yaw += FISH[i].dyaw;
  306. FISH[i].roll = -FISH[i].dyaw * 9.0f;
  307. D3DVECTOR loc=FISH[i].loc;
  308. D3DVECTOR goal=FISH[i].goal;
  309. if (FREQUENCY)
  310. {
  311. FISH[i].goal = D3DVECTOR(XEXTENT,YEXTENT,ZEXTENT);
  312. }
  313. g_world =
  314. MatrixMult(
  315. MatrixMult (
  316. RotateYMatrix (FISH[i].yaw),
  317. RotateXMatrix (FISH[i].pitch)
  318. ),
  319. RotateZMatrix (FISH[i].roll)
  320. );
  321. // get delta buy grabbing the z axis out of the transform
  322. FISH[i].delta[0] = g_world(2, 0);
  323. FISH[i].delta[1] = g_world(2, 1);
  324. FISH[i].delta[2] = g_world(2, 2);
  325. // update position
  326. FISH[i].loc += speed * FISH[i].delta;
  327. D3DMATRIX scaleMatrix;
  328. D3DXMatrixScaling((D3DXMATRIX*)&scaleMatrix,0.1f,0.1f,0.1f);
  329. // first scale then translate into place, then set orientation, then scale
  330. g_world = MatrixMult(scaleMatrix,TranslateMatrix (FISH[i].loc));
  331. g_world = MatrixMult (g_world, MatrixMult (MatrixMult (RotateYMatrix (FISH[i].yaw), RotateXMatrix (FISH[i].pitch)), RotateZMatrix (FISH[i].roll)));
  332. // apply the world matrix
  333. hResult = lpDev->SetTransform (D3DTRANSFORMSTATE_WORLD, &g_world);
  334. if (FAILED (hResult))
  335. return hResult;
  336. // display the vFISH
  337. DrawFISH (lpDev);
  338. } // end of loop for each vFISH
  339. tic += 0.01f;
  340. return DD_OK;
  341. }
  342. HRESULT PlayWithGeometry(LPDIRECT3DDEVICE7 lpDev,CD3DFile* pFileObject)
  343. {
  344. HRESULT hResult;
  345. // play with FISH
  346. static float tic = 0.0f;
  347. static float speed=2.0f;
  348. static float angle_tweak = 0.02f;
  349. static D3DVECTOR z_ward(0.0f, 0.0f, 1.0f);
  350. for (int i=0; i<NUM_FISH; i++)
  351. {
  352. D3DVECTOR offset;
  353. // tweek orientation based on last position and goal
  354. offset = FISH[i].goal - FISH[i].loc;
  355. // first, tweak the pitch
  356. if (offset.y > 1.0) { // we're too low
  357. FISH[i].pitch += angle_tweak;
  358. if (FISH[i].pitch > 0.8f)
  359. FISH[i].pitch = 0.8f;
  360. } else if (offset.y < -1.0) { // we're too high
  361. FISH[i].pitch -= angle_tweak;
  362. if (FISH[i].pitch < -0.8f)
  363. FISH[i].pitch = -0.8f;
  364. } else {
  365. // add damping
  366. FISH[i].pitch *= 0.95f;
  367. }
  368. // now figure out yaw changes
  369. offset.y = 0.0f; FISH[i].delta.y = 0.0f;
  370. FISH[i].delta = Normalize (FISH[i].delta);
  371. offset = Normalize (offset);
  372. float dot = DotProduct (offset, FISH[i].delta);
  373. offset = CrossProduct (offset, FISH[i].delta);
  374. dot = (1.0f-dot)/2.0f * angle_tweak * 10.0f;
  375. if (offset.y > 0.01) {
  376. FISH[i].dyaw = (FISH[i].dyaw*9.0f + dot) * 0.1f;
  377. } else if (offset.y < 0.01) {
  378. FISH[i].dyaw = (FISH[i].dyaw*9.0f - dot) * 0.1f;
  379. }
  380. FISH[i].yaw += FISH[i].dyaw;
  381. FISH[i].roll = -FISH[i].dyaw * 9.0f;
  382. if (rnd() < 0.03)
  383. {
  384. FISH[i].goal = D3DVECTOR(10.0f*(rnd()-rnd()), 10.0f*(rnd()-rnd()), rnd()*20.0f - 10.0f);
  385. }
  386. D3DMATRIX scaleMatrix;
  387. D3DXMatrixScaling((D3DXMATRIX*)&scaleMatrix,0.1f,0.1f,0.1f);
  388. // build the world matrix for the vFISH
  389. g_world = MatrixMult(
  390. MatrixMult (RotateYMatrix (FISH[i].yaw),
  391. RotateXMatrix (FISH[i].pitch)), RotateZMatrix (FISH[i].roll)
  392. );
  393. // get delta buy grabbing the z axis out of the transform
  394. FISH[i].delta[0] = g_world(2, 0);
  395. FISH[i].delta[1] = g_world(2, 1);
  396. FISH[i].delta[2] = g_world(2, 2);
  397. // update position
  398. FISH[i].loc += speed * FISH[i].delta;
  399. // first translate into place, then set orientation, then scale
  400. g_world = MatrixMult (g_world, MatrixMult (MatrixMult (RotateYMatrix (FISH[i].yaw), RotateXMatrix (FISH[i].pitch)), RotateZMatrix (FISH[i].roll)));
  401. g_world = MatrixMult(scaleMatrix,g_world);
  402. //g_world = MatrixMult (g_world, MatrixMult (MatrixMult (RotateYMatrix (FISH[i].yaw), RotateXMatrix (FISH[i].pitch)), RotateZMatrix (FISH[i].roll)));
  403. //g_world = MatrixMult (g_world, Scale(5.0f));
  404. // apply the world matrix
  405. hResult = lpDev->SetTransform (D3DTRANSFORMSTATE_WORLD, &g_world);
  406. if (FAILED (hResult))
  407. return hResult;
  408. pFileObject->Render(lpDev);
  409. // display the vFISH
  410. //DrawFISH (lpDev);
  411. } // end of loop for each vFISH
  412. /*
  413. g_world = TranslateMatrix (0.0f, -60.0f, 0.0f);
  414. hResult = lpDev->SetTransform (D3DTRANSFORMSTATE_WORLD, &g_world);
  415. if (FAILED (hResult))
  416. return hResult;
  417. hResult = lpDev->DrawPrimitive (D3DPT_LINELIST, D3DVT_VERTEX, (LPVOID)grid, NUM_GRID*NUM_GRID, D3DDP_WAIT);
  418. if (FAILED (hResult))
  419. return hResult;
  420. g_world = MatrixMult (g_world, RotateYMatrix (pi/2.0f));
  421. hResult = lpDev->SetTransform (D3DTRANSFORMSTATE_WORLD, &g_world);
  422. if (FAILED (hResult))
  423. return hResult;
  424. hResult = lpDev->DrawPrimitive (D3DPT_LINELIST, D3DVT_VERTEX, (LPVOID)grid, NUM_GRID*NUM_GRID, D3DDP_WAIT);
  425. if (FAILED (hResult))
  426. return hResult;
  427. */
  428. tic += 0.01f;
  429. return DD_OK;
  430. }