MLR_I_L_PMesh.cpp 15 KB

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