MLR_I_C_DT_TMesh.cpp 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. //===========================================================================//
  2. // Copyright (C) Microsoft Corporation. All rights reserved. //
  3. //===========================================================================//
  4. #include "MLRHeaders.hpp"
  5. #if defined(TRACE_ENABLED) && defined(MLR_TRACE)
  6. BitTrace *MLR_I_C_DT_TMesh_Clip;
  7. #endif
  8. //#############################################################################
  9. //###### MLRIndexedTriMesh with color but no lighting one texture layer ######
  10. //#############################################################################
  11. MLR_I_C_DT_TMesh::ClassData*
  12. MLR_I_C_DT_TMesh::DefaultData = NULL;
  13. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  14. //
  15. void
  16. MLR_I_C_DT_TMesh::InitializeClass()
  17. {
  18. Verify(!DefaultData);
  19. Verify(gos_GetCurrentHeap() == StaticHeap);
  20. DefaultData =
  21. new ClassData(
  22. MLR_I_C_DT_TMeshClassID,
  23. "MidLevelRenderer::MLR_I_C_DT_TMesh",
  24. MLR_I_DT_TMesh::DefaultData,
  25. (MLRPrimitiveBase::Factory)&Make
  26. );
  27. Register_Object(DefaultData);
  28. #if defined(TRACE_ENABLED) && defined(MLR_TRACE)
  29. MLR_I_C_DT_TMesh_Clip = new BitTrace("MLR_I_C_DT_TMesh_Clip");
  30. Register_Object(MLR_I_C_DT_TMesh_Clip);
  31. #endif
  32. }
  33. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  34. //
  35. void
  36. MLR_I_C_DT_TMesh::TerminateClass()
  37. {
  38. Unregister_Object(DefaultData);
  39. delete DefaultData;
  40. DefaultData = NULL;
  41. #if defined(TRACE_ENABLED) && defined(MLR_TRACE)
  42. Unregister_Object(MLR_I_C_DT_TMesh_Clip);
  43. delete MLR_I_C_DT_TMesh_Clip;
  44. #endif
  45. }
  46. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  47. //
  48. MLR_I_C_DT_TMesh::MLR_I_C_DT_TMesh(
  49. ClassData *class_data,
  50. MemoryStream *stream,
  51. int version
  52. ):
  53. MLR_I_DT_TMesh(class_data, stream, version)
  54. {
  55. Check_Pointer(this);
  56. Check_Pointer(stream);
  57. Verify(gos_GetCurrentHeap() == Heap);
  58. switch(version)
  59. {
  60. case 1:
  61. case 2:
  62. {
  63. STOP(("This class got created only after version 2 !"));
  64. }
  65. break;
  66. default:
  67. {
  68. #if COLOR_AS_DWORD
  69. MemoryStreamIO_Read(stream, &colors);
  70. #else
  71. Stuff::DynamicArrayOf<DWORD> smallColors;
  72. MemoryStreamIO_Read(stream, &smallColors);
  73. int i, len = smallColors.GetLength();
  74. colors.SetLength(len);
  75. DWORD theColor;
  76. for(i=0;i<len;i++)
  77. {
  78. theColor = smallColors[i];
  79. colors[i].blue = (theColor & 0xff) * One_Over_256;
  80. theColor = theColor>>8;
  81. colors[i].green = (theColor & 0xff) * One_Over_256;
  82. theColor = theColor>>8;
  83. colors[i].red = (theColor & 0xff) * One_Over_256;
  84. theColor = theColor>>8;
  85. colors[i].alpha = (theColor & 0xff) * One_Over_256;
  86. }
  87. #endif
  88. }
  89. break;
  90. }
  91. actualColors = &colors;
  92. }
  93. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  94. //
  95. MLR_I_C_DT_TMesh::MLR_I_C_DT_TMesh(ClassData *class_data):
  96. MLR_I_DT_TMesh(class_data), colors(0)
  97. {
  98. Check_Pointer(this);
  99. Verify(gos_GetCurrentHeap() == Heap);
  100. actualColors = &colors;
  101. }
  102. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  103. //
  104. MLR_I_C_DT_TMesh::~MLR_I_C_DT_TMesh()
  105. {
  106. Check_Object(this);
  107. }
  108. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  109. //
  110. MLR_I_C_DT_TMesh*
  111. MLR_I_C_DT_TMesh::Make(
  112. MemoryStream *stream,
  113. int version
  114. )
  115. {
  116. Check_Object(stream);
  117. gos_PushCurrentHeap(Heap);
  118. MLR_I_C_DT_TMesh *mesh = new MLR_I_C_DT_TMesh(DefaultData, stream, version);
  119. gos_PopCurrentHeap();
  120. return mesh;
  121. }
  122. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  123. //
  124. void
  125. MLR_I_C_DT_TMesh::Save(MemoryStream *stream)
  126. {
  127. Check_Object(this);
  128. Check_Object(stream);
  129. MLR_I_TMesh::Save(stream);
  130. #if COLOR_AS_DWORD
  131. MemoryStreamIO_Write(stream, &colors);
  132. #else
  133. Stuff::DynamicArrayOf<DWORD> smallColors;
  134. int i, len = colors.GetLength();
  135. const Stuff::RGBAColor *data = colors.GetData();
  136. smallColors.SetLength(len);
  137. for(i=0;i<len;i++)
  138. {
  139. smallColors[i] = GOSCopyColor(data+i);
  140. }
  141. MemoryStreamIO_Write(stream, &smallColors);
  142. #endif
  143. }
  144. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  145. //
  146. bool
  147. MLR_I_C_DT_TMesh::Copy(MLR_I_C_DT_PMesh *pMesh)
  148. {
  149. Check_Object(this);
  150. Check_Object(pMesh);
  151. int len;
  152. #if COLOR_AS_DWORD
  153. DWORD *_colors;
  154. #else
  155. RGBAColor *_colors;
  156. #endif
  157. MLR_I_DT_TMesh::Copy(pMesh);
  158. pMesh->GetColorData(&_colors, &len);
  159. SetColorData(_colors, len);
  160. return true;
  161. }
  162. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  163. //
  164. void
  165. MLR_I_C_DT_TMesh::SetColorData(
  166. #if COLOR_AS_DWORD
  167. const DWORD *data,
  168. #else
  169. const RGBAColor *data,
  170. #endif
  171. int dataSize
  172. )
  173. {
  174. Check_Object(this);
  175. Check_Pointer(data);
  176. Verify(coords.GetLength() == 0 || dataSize == coords.GetLength());
  177. Verify(texCoords.GetLength() == 0 || 2*dataSize == texCoords.GetLength());
  178. colors.AssignData(data, dataSize);
  179. }
  180. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  181. //
  182. void
  183. MLR_I_C_DT_TMesh::GetColorData(
  184. #if COLOR_AS_DWORD
  185. DWORD **data,
  186. #else
  187. RGBAColor **data,
  188. #endif
  189. int *dataSize
  190. )
  191. {
  192. Check_Object(this);
  193. *data = colors.GetData();
  194. *dataSize = colors.GetLength();
  195. }
  196. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  197. //
  198. void
  199. MLR_I_C_DT_TMesh::PaintMe(
  200. #if COLOR_AS_DWORD
  201. const DWORD *paintMe
  202. #else
  203. const RGBAColor *paintMe
  204. #endif
  205. )
  206. {
  207. Check_Object(this);
  208. // original color is lost !!!;
  209. int k, len = colors.GetLength();
  210. #if COLOR_AS_DWORD
  211. DWORD argb = GOSCopyColor(paintMe);
  212. for(k=0;k<len;k++)
  213. {
  214. colors[k] = argb;
  215. }
  216. #else
  217. for(k=0;k<len;k++)
  218. {
  219. colors[k] = *paintMe;
  220. }
  221. #endif
  222. }
  223. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  224. //
  225. void
  226. MLR_I_C_DT_TMesh::TestInstance() const
  227. {
  228. Verify(IsDerivedFrom(DefaultData));
  229. }
  230. extern DWORD gEnableTextureSort, gEnableAlphaSort;
  231. #define I_SAY_YES_TO_DUAL_TEXTURES
  232. #define I_SAY_YES_TO_COLOR
  233. #undef I_SAY_YES_TO_LIGHTING
  234. #define CLASSNAME MLR_I_C_DT_TMesh
  235. #if defined(TRACE_ENABLED) && defined(MLR_TRACE)
  236. #define SET_MLR_TMESH_CLIP() MLR_I_C_DT_TMesh_Clip->Set()
  237. #define CLEAR_MLR_TMESH_CLIP() MLR_I_C_DT_TMesh_Clip->Clear()
  238. #else
  239. #define SET_MLR_TMESH_CLIP()
  240. #define CLEAR_MLR_TMESH_CLIP()
  241. #endif
  242. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  243. // This include contains follwing functions:
  244. // void MLR_I_C_DT_TMesh::TransformNoClip(Matrix4D*, GOSVertexPool*);
  245. // int MLR_I_C_DT_TMesh::Clip(MLRClippingState, GOSVertexPool*);
  246. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  247. #include <MLR\MLRTriangleClipping.hpp>
  248. #undef I_SAY_YES_TO_DUAL_TEXTURES
  249. #undef I_SAY_YES_TO_COLOR
  250. #undef CLASSNAME
  251. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  252. //
  253. MLR_I_C_DT_TMesh*
  254. MidLevelRenderer::CreateIndexedTriCube_Color_NoLit_2Tex(
  255. Scalar half,
  256. MLRState *state
  257. )
  258. {
  259. #if 0
  260. gos_PushCurrentHeap(Heap);
  261. MLR_I_C_DT_TMesh *ret = new MLR_I_C_DT_TMesh();
  262. Register_Object(ret);
  263. Point3D *coords = new Point3D [8];
  264. Register_Object(coords);
  265. coords[0] = Point3D( half, -half, half);
  266. coords[1] = Point3D(-half, -half, half);
  267. coords[2] = Point3D( half, -half, -half);
  268. coords[3] = Point3D(-half, -half, -half);
  269. coords[4] = Point3D(-half, half, half);
  270. coords[5] = Point3D( half, half, half);
  271. coords[6] = Point3D( half, half, -half);
  272. coords[7] = Point3D(-half, half, -half);
  273. unsigned char *lengths = new unsigned char [6];
  274. Register_Pointer(lengths);
  275. int i;
  276. for(i=0;i<6;i++)
  277. {
  278. lengths[i] = 4;
  279. }
  280. ret->SetSubprimitiveLengths(lengths, 6);
  281. ret->SetCoordData(coords, 8);
  282. unsigned short *index = new unsigned short [6*4];
  283. Register_Pointer(index);
  284. index[0] = 0;
  285. index[1] = 2;
  286. index[2] = 6;
  287. index[3] = 5;
  288. index[4] = 0;
  289. index[5] = 5;
  290. index[6] = 4;
  291. index[7] = 1;
  292. index[8] = 5;
  293. index[9] = 6;
  294. index[10] = 7;
  295. index[11] = 4;
  296. index[12] = 2;
  297. index[13] = 3;
  298. index[14] = 7;
  299. index[15] = 6;
  300. index[16] = 1;
  301. index[17] = 4;
  302. index[18] = 7;
  303. index[19] = 3;
  304. index[20] = 0;
  305. index[21] = 1;
  306. index[22] = 3;
  307. index[23] = 2;
  308. ret->SetIndexData(index, 6*4);
  309. ret->FindFacePlanes();
  310. Vector2DScalar *texCoords = new Vector2DScalar[8];
  311. Register_Object(texCoords);
  312. texCoords[0] = Vector2DScalar(0.0f, 0.0f);
  313. texCoords[1] = Vector2DScalar(0.0f, 0.0f);
  314. texCoords[2] = Vector2DScalar(0.0f, 0.0f);
  315. texCoords[3] = Vector2DScalar(0.0f, 0.0f);
  316. texCoords[4] = Vector2DScalar(0.0f, 0.0f);
  317. texCoords[5] = Vector2DScalar(0.0f, 0.0f);
  318. texCoords[6] = Vector2DScalar(0.0f, 0.0f);
  319. texCoords[7] = Vector2DScalar(0.0f, 0.0f);
  320. if(state != NULL)
  321. {
  322. ret->SetReferenceState(*state);
  323. if(state->GetTextureHandle() > 0)
  324. {
  325. texCoords[0] = Vector2DScalar(0.0f, 0.0f);
  326. texCoords[1] = Vector2DScalar(1.0f, 0.0f);
  327. texCoords[2] = Vector2DScalar(0.25f, 0.25f);
  328. texCoords[3] = Vector2DScalar(0.75f, 0.25f);
  329. texCoords[4] = Vector2DScalar(1.0f, 1.0f);
  330. texCoords[5] = Vector2DScalar(0.0f, 1.0f);
  331. texCoords[6] = Vector2DScalar(0.25f, 0.75f);
  332. texCoords[7] = Vector2DScalar(0.75f, 0.75f);
  333. }
  334. }
  335. ret->SetTexCoordData(texCoords, 8);
  336. Unregister_Object(texCoords);
  337. delete [] texCoords;
  338. Unregister_Pointer(index);
  339. delete [] index;
  340. Unregister_Pointer(lengths);
  341. delete [] lengths;
  342. Unregister_Object(coords);
  343. delete [] coords;
  344. gos_PopCurrentHeap();
  345. return ret;
  346. #endif
  347. return NULL;
  348. }
  349. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  350. //
  351. MLRShape*
  352. MidLevelRenderer::CreateIndexedTriIcosahedron_Color_NoLit_2Tex(
  353. IcoInfo& icoInfo,
  354. MLRState *state,
  355. MLRState *state2
  356. )
  357. {
  358. gos_PushCurrentHeap(Heap);
  359. MLRShape *ret = new MLRShape(20);
  360. Register_Object(ret);
  361. int i, j, k;
  362. long nrTri = (long) ceil (icoInfo.all * pow (4.0f, icoInfo.depth));
  363. Point3D v[3];
  364. if(3*nrTri >= Limits::Max_Number_Vertices_Per_Mesh)
  365. {
  366. nrTri = Limits::Max_Number_Vertices_Per_Mesh/3;
  367. }
  368. Point3D *coords = new Point3D [nrTri*3];
  369. Register_Pointer(coords);
  370. Point3D *collapsedCoords = NULL;
  371. if(icoInfo.indexed==true)
  372. {
  373. collapsedCoords = new Point3D [nrTri*3];
  374. Register_Pointer(collapsedCoords);
  375. }
  376. unsigned short *index = new unsigned short [nrTri*3];
  377. Register_Pointer(index);
  378. Vector2DScalar *texCoords = new Vector2DScalar[2*nrTri*3];
  379. Register_Pointer(texCoords);
  380. RGBAColor *colors = new RGBAColor[nrTri*3];
  381. Register_Pointer(colors);
  382. int uniquePoints = 0;
  383. for (k=0;k<20;k++)
  384. {
  385. triDrawn = 0;
  386. MLR_I_C_DT_TMesh *mesh = new MLR_I_C_DT_TMesh();
  387. Register_Object(mesh);
  388. // setup vertex position information
  389. for (j=0;j<3;j++)
  390. {
  391. v[j].x = vdata[tindices[k][j]][0];
  392. v[j].y = vdata[tindices[k][j]][1];
  393. v[j].z = vdata[tindices[k][j]][2];
  394. }
  395. subdivide (coords, v[0], v[1], v[2], icoInfo.depth, nrTri, icoInfo.radius);
  396. mesh->SetSubprimitiveLengths(NULL, nrTri);
  397. if(icoInfo.indexed==true)
  398. {
  399. uniquePoints = 1;
  400. collapsedCoords[0] = coords[0];
  401. index[0] = 0;
  402. for(i=1;i<nrTri*3;i++)
  403. {
  404. for(j=0;j<uniquePoints;j++)
  405. {
  406. if(coords[i] == collapsedCoords[j])
  407. {
  408. break;
  409. }
  410. }
  411. if(j==uniquePoints)
  412. {
  413. collapsedCoords[uniquePoints++] = coords[i];
  414. }
  415. index[i] = static_cast<unsigned short>(j);
  416. }
  417. mesh->SetCoordData(collapsedCoords, uniquePoints);
  418. }
  419. else
  420. {
  421. uniquePoints = nrTri*3;
  422. for(i=0;i<nrTri*3;i++)
  423. {
  424. index[i] = static_cast<unsigned short>(i);
  425. }
  426. mesh->SetCoordData(coords, nrTri*3);
  427. }
  428. mesh->SetIndexData(index, nrTri*3);
  429. mesh->FindFacePlanes();
  430. if(state == NULL)
  431. {
  432. for(i=0;i<2*uniquePoints;i++)
  433. {
  434. texCoords[i] = Vector2DScalar(0.0f, 0.0f);
  435. }
  436. }
  437. else
  438. {
  439. state->SetMultiTextureMode(MLRState::MultiTextureLightmapMode);
  440. mesh->SetReferenceState(*state);
  441. state->SetMultiTextureMode(MLRState::MultiTextureOffMode);
  442. if(state->GetTextureHandle() > 0)
  443. {
  444. if(icoInfo.indexed==true)
  445. {
  446. for(i=0;i<uniquePoints;i++)
  447. {
  448. texCoords[i] =
  449. Vector2DScalar(
  450. (1.0f + collapsedCoords[i].x)/2.0f,
  451. (1.0f + collapsedCoords[i].y)/2.0f
  452. );
  453. texCoords[i+uniquePoints] =
  454. Vector2DScalar(
  455. (1.0f + collapsedCoords[i].x)/2.0f,
  456. (1.0f + collapsedCoords[i].z)/2.0f
  457. );
  458. }
  459. }
  460. else
  461. {
  462. for(i=0;i<nrTri;i++)
  463. {
  464. texCoords[3*i] =
  465. Vector2DScalar(
  466. (1.0f + coords[3*i].x)/2.0f,
  467. (1.0f + coords[3*i].y)/2.0f
  468. );
  469. texCoords[3*i+1] =
  470. Vector2DScalar(
  471. (1.0f + coords[3*i+1].x)/2.0f,
  472. (1.0f + coords[3*i+1].y)/2.0f
  473. );
  474. texCoords[3*i+2] =
  475. Vector2DScalar(
  476. (1.0f + coords[3*i+2].x)/2.0f,
  477. (1.0f + coords[3*i+2].y)/2.0f
  478. );
  479. texCoords[3*i+nrTri] =
  480. Vector2DScalar(
  481. (1.0f + coords[3*i].x)/2.0f,
  482. (1.0f + coords[3*i].z)/2.0f
  483. );
  484. texCoords[3*i+1+nrTri] =
  485. Vector2DScalar(
  486. (1.0f + coords[3*i+1].x)/2.0f,
  487. (1.0f + coords[3*i+1].z)/2.0f
  488. );
  489. texCoords[3*i+2+nrTri] =
  490. Vector2DScalar(
  491. (1.0f + coords[3*i+2].x)/2.0f,
  492. (1.0f + coords[3*i+2].z)/2.0f
  493. );
  494. }
  495. }
  496. }
  497. else
  498. {
  499. for(i=0;i<2*uniquePoints;i++)
  500. {
  501. texCoords[i] = Vector2DScalar(0.0f, 0.0f);
  502. }
  503. }
  504. }
  505. mesh->SetTexCoordData(texCoords, 2*uniquePoints);
  506. if(icoInfo.indexed==true)
  507. {
  508. for(i=0;i<uniquePoints;i++)
  509. {
  510. colors[i] =
  511. RGBAColor(
  512. (1.0f + collapsedCoords[i].x)/2.0f,
  513. (1.0f + collapsedCoords[i].y)/2.0f,
  514. (1.0f + collapsedCoords[i].z)/2.0f,
  515. 1.0f
  516. );
  517. }
  518. }
  519. else
  520. {
  521. for(i=0;i<uniquePoints;i++)
  522. {
  523. colors[i] =
  524. RGBAColor(
  525. (1.0f + coords[i].x)/2.0f,
  526. (1.0f + coords[i].y)/2.0f,
  527. (1.0f + coords[i].z)/2.0f,
  528. 1.0f
  529. );
  530. }
  531. }
  532. mesh->SetColorData(colors, uniquePoints);
  533. mesh->SetReferenceState(*state2, 1);
  534. ret->Add(mesh);
  535. mesh->DetachReference();
  536. }
  537. Unregister_Pointer(colors);
  538. delete [] colors;
  539. Unregister_Pointer(texCoords);
  540. delete [] texCoords;
  541. Unregister_Pointer(index);
  542. delete [] index;
  543. if(icoInfo.indexed==true)
  544. {
  545. Unregister_Pointer(collapsedCoords);
  546. delete [] collapsedCoords;
  547. }
  548. Unregister_Pointer(coords);
  549. delete [] coords;
  550. gos_PopCurrentHeap();
  551. return ret;
  552. }