MLR_I_C_TMesh.cpp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684
  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_TMesh_Clip;
  7. #endif
  8. //#############################################################################
  9. //###### MLRIndexedTriMesh with color but no lighting one texture layer ######
  10. //#############################################################################
  11. MLR_I_C_TMesh::ClassData*
  12. MLR_I_C_TMesh::DefaultData = NULL;
  13. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  14. //
  15. void
  16. MLR_I_C_TMesh::InitializeClass()
  17. {
  18. Verify(!DefaultData);
  19. Verify(gos_GetCurrentHeap() == StaticHeap);
  20. DefaultData =
  21. new ClassData(
  22. MLR_I_C_TMeshClassID,
  23. "MidLevelRenderer::MLR_I_C_TMesh",
  24. MLR_I_TMesh::DefaultData,
  25. (MLRPrimitiveBase::Factory)&Make
  26. );
  27. Register_Object(DefaultData);
  28. #if defined(TRACE_ENABLED) && defined(MLR_TRACE)
  29. MLR_I_C_TMesh_Clip = new BitTrace("MLR_I_C_TMesh_Clip");
  30. Register_Object(MLR_I_C_TMesh_Clip);
  31. #endif
  32. }
  33. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  34. //
  35. void
  36. MLR_I_C_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_TMesh_Clip);
  43. delete MLR_I_C_TMesh_Clip;
  44. #endif
  45. }
  46. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  47. //
  48. MLR_I_C_TMesh::MLR_I_C_TMesh(
  49. ClassData *class_data,
  50. MemoryStream *stream,
  51. int version
  52. ):
  53. MLR_I_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_TMesh::MLR_I_C_TMesh(ClassData *class_data):
  96. MLR_I_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_TMesh::~MLR_I_C_TMesh()
  105. {
  106. Check_Object(this);
  107. }
  108. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  109. //
  110. MLR_I_C_TMesh*
  111. MLR_I_C_TMesh::Make(
  112. MemoryStream *stream,
  113. int version
  114. )
  115. {
  116. Check_Object(stream);
  117. gos_PushCurrentHeap(Heap);
  118. MLR_I_C_TMesh *mesh = new MLR_I_C_TMesh(DefaultData, stream, version);
  119. gos_PopCurrentHeap();
  120. return mesh;
  121. }
  122. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  123. //
  124. void
  125. MLR_I_C_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_TMesh::Copy(MLR_I_C_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_TMesh::Copy(pMesh);
  158. pMesh->GetColorData(&_colors, &len);
  159. SetColorData(_colors, len);
  160. return true;
  161. }
  162. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  163. //
  164. void
  165. MLR_I_C_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 || dataSize == texCoords.GetLength());
  178. colors.AssignData(data, dataSize);
  179. }
  180. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  181. //
  182. void
  183. MLR_I_C_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_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_TMesh::HurtMe(const Stuff::LinearMatrix4D& pain, Stuff::Scalar radius)
  227. {
  228. Check_Object(this);
  229. Verify(colors.GetLength() == coords.GetLength());
  230. int i, len = colors.GetLength();
  231. Point3D painpoint;
  232. Vector3D diff;
  233. UnitVector3D up, left, forward;
  234. Scalar x, y, sqRadius = radius*radius;
  235. painpoint = pain;
  236. pain.GetLocalLeftInWorld(&left);
  237. pain.GetLocalUpInWorld(&up);
  238. pain.GetLocalForwardInWorld(&forward);
  239. if(FindBackFace(painpoint) && FindVisibleVertices())
  240. {
  241. for(i=0;i<len;i++)
  242. {
  243. if(visibleIndexedVertices[i]>0)
  244. {
  245. diff.Subtract(coords[i], painpoint);
  246. x = diff*left;
  247. y = diff*up;
  248. if((x*x + y*y) < sqRadius)
  249. {
  250. #if COLOR_AS_DWORD
  251. colors[i] = 0xff000000;
  252. #else
  253. colors[i].red = 0.0f;
  254. colors[i].green = 0.0f;
  255. colors[i].blue = 0.0f;
  256. colors[i].alpha = 1.0f;
  257. #endif
  258. }
  259. }
  260. }
  261. }
  262. visibleIndexedVerticesKey = false;
  263. }
  264. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  265. //
  266. void
  267. MLR_I_C_TMesh::TestInstance() const
  268. {
  269. Verify(IsDerivedFrom(DefaultData));
  270. }
  271. extern DWORD gEnableTextureSort, gEnableAlphaSort;
  272. #undef I_SAY_YES_TO_DUAL_TEXTURES
  273. #define I_SAY_YES_TO_COLOR
  274. #undef I_SAY_YES_TO_LIGHTING
  275. #define CLASSNAME MLR_I_C_TMesh
  276. #if defined(TRACE_ENABLED) && defined(MLR_TRACE)
  277. #define SET_MLR_TMESH_CLIP() MLR_I_C_TMesh_Clip->Set()
  278. #define CLEAR_MLR_TMESH_CLIP() MLR_I_C_TMesh_Clip->Clear()
  279. #else
  280. #define SET_MLR_TMESH_CLIP()
  281. #define CLEAR_MLR_TMESH_CLIP()
  282. #endif
  283. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  284. // This include contains follwing functions:
  285. // void MLR_I_C_TMesh::TransformNoClip(Matrix4D*, GOSVertexPool*);
  286. // int MLR_I_C_TMesh::Clip(MLRClippingState, GOSVertexPool*);
  287. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  288. #include <MLR\MLRTriangleClipping.hpp>
  289. #undef I_SAY_YES_TO_COLOR
  290. #undef CLASSNAME
  291. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  292. //
  293. MLR_I_C_TMesh*
  294. MidLevelRenderer::CreateIndexedTriCube_Color_NoLit(
  295. Scalar half,
  296. MLRState *state
  297. )
  298. {
  299. #if 0
  300. gos_PushCurrentHeap(Heap);
  301. MLR_I_C_TMesh *ret = new MLR_I_C_TMesh();
  302. Register_Object(ret);
  303. Point3D *coords = new Point3D [8];
  304. Register_Object(coords);
  305. coords[0] = Point3D( half, -half, half);
  306. coords[1] = Point3D(-half, -half, half);
  307. coords[2] = Point3D( half, -half, -half);
  308. coords[3] = Point3D(-half, -half, -half);
  309. coords[4] = Point3D(-half, half, half);
  310. coords[5] = Point3D( half, half, half);
  311. coords[6] = Point3D( half, half, -half);
  312. coords[7] = Point3D(-half, half, -half);
  313. unsigned char *lengths = new unsigned char [6];
  314. Register_Pointer(lengths);
  315. int i;
  316. for(i=0;i<6;i++)
  317. {
  318. lengths[i] = 4;
  319. }
  320. ret->SetSubprimitiveLengths(lengths, 6);
  321. ret->SetCoordData(coords, 8);
  322. unsigned short *index = new unsigned short [6*4];
  323. Register_Pointer(index);
  324. index[0] = 0;
  325. index[1] = 2;
  326. index[2] = 6;
  327. index[3] = 5;
  328. index[4] = 0;
  329. index[5] = 5;
  330. index[6] = 4;
  331. index[7] = 1;
  332. index[8] = 5;
  333. index[9] = 6;
  334. index[10] = 7;
  335. index[11] = 4;
  336. index[12] = 2;
  337. index[13] = 3;
  338. index[14] = 7;
  339. index[15] = 6;
  340. index[16] = 1;
  341. index[17] = 4;
  342. index[18] = 7;
  343. index[19] = 3;
  344. index[20] = 0;
  345. index[21] = 1;
  346. index[22] = 3;
  347. index[23] = 2;
  348. ret->SetIndexData(index, 6*4);
  349. ret->FindFacePlanes();
  350. Vector2DScalar *texCoords = new Vector2DScalar[8];
  351. Register_Object(texCoords);
  352. texCoords[0] = Vector2DScalar(0.0f, 0.0f);
  353. texCoords[1] = Vector2DScalar(0.0f, 0.0f);
  354. texCoords[2] = Vector2DScalar(0.0f, 0.0f);
  355. texCoords[3] = Vector2DScalar(0.0f, 0.0f);
  356. texCoords[4] = Vector2DScalar(0.0f, 0.0f);
  357. texCoords[5] = Vector2DScalar(0.0f, 0.0f);
  358. texCoords[6] = Vector2DScalar(0.0f, 0.0f);
  359. texCoords[7] = Vector2DScalar(0.0f, 0.0f);
  360. if(state != NULL)
  361. {
  362. ret->SetReferenceState(*state);
  363. if(state->GetTextureHandle() > 0)
  364. {
  365. texCoords[0] = Vector2DScalar(0.0f, 0.0f);
  366. texCoords[1] = Vector2DScalar(1.0f, 0.0f);
  367. texCoords[2] = Vector2DScalar(0.25f, 0.25f);
  368. texCoords[3] = Vector2DScalar(0.75f, 0.25f);
  369. texCoords[4] = Vector2DScalar(1.0f, 1.0f);
  370. texCoords[5] = Vector2DScalar(0.0f, 1.0f);
  371. texCoords[6] = Vector2DScalar(0.25f, 0.75f);
  372. texCoords[7] = Vector2DScalar(0.75f, 0.75f);
  373. }
  374. }
  375. ret->SetTexCoordData(texCoords, 8);
  376. Unregister_Object(texCoords);
  377. delete [] texCoords;
  378. Unregister_Pointer(index);
  379. delete [] index;
  380. Unregister_Pointer(lengths);
  381. delete [] lengths;
  382. Unregister_Object(coords);
  383. delete [] coords;
  384. gos_PopCurrentHeap();
  385. return ret;
  386. #endif
  387. return NULL;
  388. }
  389. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  390. //
  391. MLRShape*
  392. MidLevelRenderer::CreateIndexedTriIcosahedron_Color_NoLit(
  393. IcoInfo& icoInfo,
  394. MLRState *state
  395. )
  396. {
  397. gos_PushCurrentHeap(Heap);
  398. MLRShape *ret = new MLRShape(20);
  399. Register_Object(ret);
  400. int i, j, k;
  401. long nrTri = (long) ceil (icoInfo.all * pow (4.0f, icoInfo.depth));
  402. Point3D v[3];
  403. if(3*nrTri >= Limits::Max_Number_Vertices_Per_Mesh)
  404. {
  405. nrTri = Limits::Max_Number_Vertices_Per_Mesh/3;
  406. }
  407. Point3D *coords = new Point3D [nrTri*3];
  408. Register_Pointer(coords);
  409. Point3D *collapsedCoords = NULL;
  410. if(icoInfo.indexed==true)
  411. {
  412. collapsedCoords = new Point3D [nrTri*3];
  413. Register_Pointer(collapsedCoords);
  414. }
  415. unsigned short *index = new unsigned short [nrTri*3];
  416. Register_Pointer(index);
  417. Vector2DScalar *texCoords = new Vector2DScalar[nrTri*3];
  418. Register_Pointer(texCoords);
  419. RGBAColor *colors = new RGBAColor[nrTri*3];
  420. Register_Pointer(colors);
  421. int uniquePoints = 0;
  422. for (k=0;k<20;k++)
  423. {
  424. triDrawn = 0;
  425. MLR_I_C_TMesh *mesh = new MLR_I_C_TMesh();
  426. Register_Object(mesh);
  427. // setup vertex position information
  428. for (j=0;j<3;j++)
  429. {
  430. v[j].x = vdata[tindices[k][j]][0];
  431. v[j].y = vdata[tindices[k][j]][1];
  432. v[j].z = vdata[tindices[k][j]][2];
  433. }
  434. subdivide (coords, v[0], v[1], v[2], icoInfo.depth, nrTri, icoInfo.radius);
  435. mesh->SetSubprimitiveLengths(NULL, nrTri);
  436. if(icoInfo.indexed==true)
  437. {
  438. uniquePoints = 1;
  439. collapsedCoords[0] = coords[0];
  440. index[0] = 0;
  441. for(i=1;i<nrTri*3;i++)
  442. {
  443. for(j=0;j<uniquePoints;j++)
  444. {
  445. if(coords[i] == collapsedCoords[j])
  446. {
  447. break;
  448. }
  449. }
  450. if(j==uniquePoints)
  451. {
  452. collapsedCoords[uniquePoints++] = coords[i];
  453. }
  454. index[i] = static_cast<unsigned short>(j);
  455. }
  456. mesh->SetCoordData(collapsedCoords, uniquePoints);
  457. }
  458. else
  459. {
  460. uniquePoints = nrTri*3;
  461. for(i=0;i<nrTri*3;i++)
  462. {
  463. index[i] = static_cast<unsigned short>(i);
  464. }
  465. mesh->SetCoordData(coords, nrTri*3);
  466. }
  467. mesh->SetIndexData(index, nrTri*3);
  468. mesh->FindFacePlanes();
  469. if(state == NULL)
  470. {
  471. for(i=0;i<uniquePoints;i++)
  472. {
  473. texCoords[i] = Vector2DScalar(0.0f, 0.0f);
  474. }
  475. }
  476. else
  477. {
  478. mesh->SetReferenceState(*state);
  479. if(state->GetTextureHandle() > 0)
  480. {
  481. if(icoInfo.indexed==true)
  482. {
  483. for(i=0;i<uniquePoints;i++)
  484. {
  485. texCoords[i] =
  486. Vector2DScalar(
  487. (1.0f + collapsedCoords[i].x)/2.0f,
  488. (1.0f + collapsedCoords[i].y)/2.0f
  489. );
  490. }
  491. }
  492. else
  493. {
  494. for(i=0;i<nrTri;i++)
  495. {
  496. texCoords[3*i] =
  497. Vector2DScalar(
  498. (1.0f + coords[3*i].x)/2.0f,
  499. (1.0f + coords[3*i].y)/2.0f
  500. );
  501. texCoords[3*i+1] =
  502. Vector2DScalar(
  503. (1.0f + coords[3*i+1].x)/2.0f,
  504. (1.0f + coords[3*i+1].y)/2.0f
  505. );
  506. texCoords[3*i+2] =
  507. Vector2DScalar(
  508. (1.0f + coords[3*i+2].x)/2.0f,
  509. (1.0f + coords[3*i+2].y)/2.0f
  510. );
  511. }
  512. }
  513. }
  514. else
  515. {
  516. for(i=0;i<uniquePoints;i++)
  517. {
  518. texCoords[i] = Vector2DScalar(0.0f, 0.0f);
  519. }
  520. }
  521. }
  522. mesh->SetTexCoordData(texCoords, uniquePoints);
  523. if(icoInfo.indexed==true)
  524. {
  525. for(i=0;i<uniquePoints;i++)
  526. {
  527. colors[i] =
  528. RGBAColor(
  529. (1.0f + collapsedCoords[i].x)/2.0f,
  530. (1.0f + collapsedCoords[i].y)/2.0f,
  531. (1.0f + collapsedCoords[i].z)/2.0f,
  532. 1.0f
  533. );
  534. }
  535. }
  536. else
  537. {
  538. for(i=0;i<uniquePoints;i++)
  539. {
  540. colors[i] =
  541. RGBAColor(
  542. (1.0f + coords[i].x)/2.0f,
  543. (1.0f + coords[i].y)/2.0f,
  544. (1.0f + coords[i].z)/2.0f,
  545. 1.0f
  546. );
  547. }
  548. }
  549. mesh->SetColorData(colors, uniquePoints);
  550. ret->Add(mesh);
  551. mesh->DetachReference();
  552. }
  553. Unregister_Pointer(colors);
  554. delete [] colors;
  555. Unregister_Pointer(texCoords);
  556. delete [] texCoords;
  557. Unregister_Pointer(index);
  558. delete [] index;
  559. if(icoInfo.indexed==true)
  560. {
  561. Unregister_Pointer(collapsedCoords);
  562. delete [] collapsedCoords;
  563. }
  564. Unregister_Pointer(coords);
  565. delete [] coords;
  566. gos_PopCurrentHeap();
  567. return ret;
  568. }