/branches/JSTUDIO_VERSION_2_X/source/Engine/JetEngine/Bsp/jeBSP_HW.cpp

# · C++ · 596 lines · 353 code · 105 blank · 138 comment · 72 complexity · b5d16c433d455918bd6b799d1daca8c7 MD5 · raw file

  1. /****************************************************************************************/
  2. /* jeBSP_HW.cpp */
  3. /* */
  4. /* Author: Bruno Pettorelli */
  5. /* Description: HW optimized BSP code based on the John Pollard's */
  6. /* */
  7. /* The contents of this file are subject to the Jet3D Public License */
  8. /* Version 1.02 (the "License"); you may not use this file except in */
  9. /* compliance with the License. You may obtain a copy of the License at */
  10. /* http://www.jet3d.com */
  11. /* */
  12. /* Software distributed under the License is distributed on an "AS IS" */
  13. /* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See */
  14. /* the License for the specific language governing rights and limitations */
  15. /* under the License. */
  16. /* */
  17. /* The Original Code is Jet3D, released December 12, 1999. */
  18. /* Copyright (C) 1996-1999 Eclipse Entertainment, L.L.C. All Rights Reserved */
  19. /* */
  20. /****************************************************************************************/
  21. #include <stdio.h>
  22. #include <assert.h>
  23. #include <windows.h>
  24. // Private dependents
  25. #include "jeBSP._h"
  26. #include "Ram.h"
  27. #include "Vec3d.h"
  28. #include "Errorlog.h"
  29. #include "Log.h"
  30. #include "math.h"
  31. #include "Camera._h"
  32. // Public dependents
  33. #include "jeBSP.h"
  34. #include "jeBSP_HW.h"
  35. #ifdef _DEBUG
  36. #define JE_BSP_DEBUG_OUTPUT_LEVEL 1
  37. //#define JE_BSP_DEBUG_OUTPUT_LEVEL 2
  38. #else
  39. #define JE_BSP_DEBUG_OUTPUT_LEVEL 0
  40. #endif
  41. //--- Local global statics
  42. static int32 NumNonVisNodes;
  43. // extern data for stats purpose - Krouer
  44. extern int32 NumMakeFaces;
  45. extern int32 NumMergedFaces;
  46. extern int32 NumSubdividedFaces;
  47. // Prototypes
  48. static jeBoolean jeBSP_HWXF_CreateVertexBuffer(jeBSP* BSP);
  49. //=======================================================================================
  50. // jeBSP_Create
  51. // Create an "empty" BSP tree
  52. //=======================================================================================
  53. jeBSP *jeBSP_HWXF_Create(void)
  54. {
  55. jeBSP* BSPTree = jeBSP_Create();
  56. if (BSPTree) {
  57. BSPTree->HWHelper = NULL;
  58. BSPTree->HWVertexBuffer = JE_GEOMETRY_BUFFER_NULL_INDEX;
  59. }
  60. return BSPTree;
  61. }
  62. //=======================================================================================
  63. // jeBSP_Destroy
  64. //=======================================================================================
  65. void jeBSP_HWXF_Destroy(jeBSP **BSPTree)
  66. {
  67. // Detach from the engine (if any)
  68. if ((*BSPTree)->HWHelper)
  69. {
  70. if ((*BSPTree)->HWHelper)
  71. {
  72. delete (*BSPTree)->HWHelper;
  73. (*BSPTree)->HWHelper = NULL;
  74. }
  75. jeBSP* BSP = *BSPTree;
  76. jeGeometry_PolyData* pPolyData = NULL;
  77. while(pPolyData = (jeGeometry_PolyData*)jeChain_GetNextLinkData(BSP->HWPolyDatas, pPolyData))
  78. {
  79. jeChain_RemoveLinkData(BSP->HWPolyDatas, pPolyData);
  80. jeRam_Free(pPolyData);
  81. }
  82. jeChain_Destroy(&BSP->HWPolyDatas);
  83. }
  84. jeBSP_Destroy(BSPTree);
  85. }
  86. //=======================================================================================
  87. // jeBSP_RebuildGeometry
  88. // Creates a fresh tree from a list of brushes
  89. //=======================================================================================
  90. jeBSP *jeBSP_HWXF_RebuildGeometry(jeBSP *BSP,
  91. jeChain *BrushChain,
  92. jeBSP_Options Options,
  93. jeBSP_Logic Logic,
  94. jeBSP_LogicBalance LogicBalance)
  95. {
  96. jeBSP_Brush *BSPBrushList;
  97. assert(BSP);
  98. assert(BrushChain);
  99. // Destroy any geometry the BSP might have, and reset arrays
  100. if (!jeBSP_ResetGeometry(BSP))
  101. return NULL;
  102. BSPBrushList = NULL;
  103. // Set some globals
  104. BSP->Logic = Logic;
  105. BSP->LogicBalance = LogicBalance;
  106. BSP->NumBrushes = 0;
  107. // Create the TopLevel brushes, from the editor jeBrushes...
  108. BSP->TopBrushes = jeBSP_TopBrushCreateListFromBrushChain(BrushChain, BSP, &BSP->NumBrushes);
  109. if (!BSP->TopBrushes)
  110. goto ExitWithError;
  111. // Create the brushes that will get cut up in the tree
  112. BSPBrushList = jeBSP_BrushCreateListFromTopBrushList(BSP->TopBrushes, BSP);
  113. if (!BSPBrushList)
  114. goto ExitWithError;
  115. // CSG this list
  116. if (Options & BSP_OPTIONS_CSG_BRUSHES)
  117. {
  118. BSPBrushList = jeBSP_BrushCSGList(BSPBrushList, BSP);
  119. if (!BSPBrushList)
  120. goto ExitWithError;
  121. }
  122. // Now, build the tree
  123. if (!jeBSP_BuildBSPTree(BSP, &BSPBrushList, Logic, LogicBalance))
  124. goto ExitWithError;
  125. // Create portals
  126. if (!jeBSP_CreatePortals(BSP, JE_TRUE))
  127. goto ExitWithError;
  128. // Remove hidden leafs
  129. //if (!jeBSP_RemoveHiddenLeafs(BSP))
  130. // goto ExitWithError;
  131. // Use the tree to mark the visible sides
  132. if (!jeBSP_MarkVisibleTopSides(BSP))
  133. goto ExitWithError;
  134. // Merge nodes
  135. //jeBSPNode_MergeLeafs(BSP->RootNode);
  136. // Make collision hulls for leafs
  137. if (!jeBSPNode_UpdateLeafSides_r(BSP->RootNode, BSP))
  138. goto ExitWithError;
  139. if (Options & BSP_OPTIONS_MAKE_VIS_AREAS)
  140. {
  141. if (!jeBSP_HWXF_Node_MakeFaces_Callr(BSP->RootNode, BSP, JE_FALSE))
  142. goto ExitWithError;
  143. if (!jeBSPNode_MakeDrawFaceListOnLeafs_r(BSP->RootNode, BSP))
  144. goto ExitWithError;
  145. // We MUST destroy the chain of merged/split faces fragments as soon as we are done with them
  146. jeBSPNode_DestroyBSPFaces_r(BSP->RootNode, BSP, JE_TRUE);
  147. if (!jeBSP_MakeVisAreas(BSP))
  148. goto ExitWithError;
  149. }
  150. else
  151. {
  152. if (!jeBSP_HWXF_Node_MakeFaces_Callr(BSP->RootNode, BSP, JE_TRUE))
  153. goto ExitWithError;
  154. }
  155. if (!jeBSP_UpdateWorldSpaceBox(BSP))
  156. goto ExitWithError;
  157. if (!jeBSP_HWXF_CreateVertexBuffer(BSP))
  158. goto ExitWithError;
  159. return BSP;
  160. // Error
  161. ExitWithError:
  162. {
  163. if (BSP->RootNode)
  164. jeBSPNode_Destroy_r(&BSP->RootNode, BSP);
  165. if (BSP->TopBrushes)
  166. jeBSP_TopBrushDestroyList(&BSP->TopBrushes, BSP);
  167. if (BSPBrushList)
  168. jeBSP_BrushDestroyList(&BSPBrushList);
  169. return NULL;
  170. }
  171. }
  172. //=======================================================================================
  173. // Update lights/faces/brushes
  174. //=======================================================================================
  175. //=======================================================================================
  176. // jeBSP_HWXF_UpdateAll
  177. //=======================================================================================
  178. jeBoolean jeBSP_HWXF_UpdateAll(jeBSP *BSP)
  179. {
  180. assert(BSP);
  181. #if (JE_BSP_DEBUG_OUTPUT_LEVEL >= 2)
  182. OutputDebugString("BEGIN jeBSP_UpdateAll\n");
  183. #endif
  184. if (!BSP->RootNode)
  185. return JE_TRUE;
  186. bool bUpdate = false;
  187. if (BSP->HWVertexBuffer == JE_GEOMETRY_BUFFER_NULL_INDEX)
  188. {
  189. bUpdate = true;
  190. }
  191. if (BSP->UpdateFlags & BSP_UPDATE_FACES)
  192. {
  193. if (!jeBSP_MarkVisibleTopSides(BSP))
  194. return JE_FALSE;
  195. NumMakeFaces = 0;
  196. NumMergedFaces = 0;
  197. NumSubdividedFaces = 0;
  198. if (!jeBSP_HWXF_Node_MakeFaces_r(BSP->RootNode, BSP, JE_TRUE))
  199. return JE_FALSE;
  200. BSP->UpdateFlags &= ~BSP_UPDATE_FACES;
  201. bUpdate = true;
  202. }
  203. //if (BSP->UpdateFlags & BSP_UPDATE_LIGHTS)
  204. //{
  205. // if (!jeBSPNode_LightUpdate_r(BSP->RootNode, BSP, BSP->RootNode, JE_FALSE))
  206. // return JE_FALSE;
  207. // BSP->UpdateFlags &= ~BSP_UPDATE_LIGHTS;
  208. //}
  209. if (bUpdate && !jeBSP_HWXF_CreateVertexBuffer(BSP))
  210. return JE_FALSE;
  211. #if (JE_BSP_DEBUG_OUTPUT_LEVEL >= 2)
  212. OutputDebugString("END jeBSP_UpdateAll\n");
  213. #endif
  214. return JE_TRUE;
  215. }
  216. //=======================================================================================
  217. // jeBSP_SetEngine
  218. //=======================================================================================
  219. jeBoolean jeBSP_HWXF_SetEngine(jeBSP *BSP, jeEngine *Engine)
  220. {
  221. assert(BSP);
  222. if (Engine == NULL) {
  223. // Destroy the allocated GeometryBuffer
  224. DRV_Driver* Driver = jeEngine_GetDriver(BSP->Engine);
  225. // Delete allocated resource
  226. if (BSP->HWVertexBuffer != JE_GEOMETRY_BUFFER_NULL_INDEX) {
  227. Driver->GeometryBuffer_Destroy(BSP->HWVertexBuffer);
  228. }
  229. BSP->HWVertexBuffer = JE_GEOMETRY_BUFFER_NULL_INDEX;
  230. }
  231. jeBSP_SetEngine(BSP, Engine);
  232. if (Engine && BSP->HWVertexBuffer == JE_GEOMETRY_BUFFER_NULL_INDEX && BSP->HWHelper != NULL)
  233. {
  234. jeErrorLog_AddString(-1, "Generate the Hardware buffer from primitives", NULL);
  235. jeBSP_HWXF_CreateVertexBuffer(BSP);
  236. }
  237. return JE_TRUE;
  238. }
  239. //=======================================================================================
  240. // jeBSP_RenderFrontToBack
  241. //=======================================================================================
  242. jeBoolean jeBSP_HWXF_Render(jeBSP *BSP, jeCamera *Camera, jeFrustum *CameraSpaceFrustum, jeFrustum *ModelSpaceFrustum, jeXForm3d *ModelToCameraXForm)
  243. {
  244. if (BSP->HWVertexBuffer != JE_GEOMETRY_BUFFER_NULL_INDEX) {
  245. // Activate the correct geometry buffer
  246. DRV_Driver* Driver = jeEngine_GetDriver(BSP->Engine);
  247. Driver->GeometryBuffer_Activate(BSP->HWVertexBuffer);
  248. /*
  249. jeVec3d CamPos;
  250. jeCamera_GetPosition(Camera, &CamPos);
  251. [00:16] paradox10166: Generate the matrix using the camera position and rotation.
  252. [00:16] paradox10166: Exactly, grab the XForm.Translation from the camera.
  253. [00:17] paradox10166: Then use jeXForm3d_GetEulerAngles() on the Camera XForm.
  254. [00:20] paradox10166: Then build the view transform using this method:http://www.toymaker.info/Games/html/camera.html
  255. */
  256. // Set the Matrices
  257. #pragma message ("Krouer: Need help here to set the correct matrices")
  258. // Reset the matrice set
  259. jeXForm3d identity;
  260. jeXForm3d cameraXForm;
  261. jeXForm3d_SetIdentity(&identity);
  262. jeCamera_GetXForm(Camera, &cameraXForm);
  263. //cameraXForm.AZ = -cameraXForm.AZ;
  264. //cameraXForm.BZ = -cameraXForm.BZ;
  265. //cameraXForm.CZ = -cameraXForm.CZ;
  266. //jeVec3d_Scale(&cameraXForm.Translation, 1.5, &cameraXForm.Translation);
  267. //Driver->SetMatrix(JE_XFORM_TYPE_VIEW, ModelToCameraXForm);
  268. //Driver->SetMatrix(JE_XFORM_TYPE_WORLD, &identity);
  269. Driver->SetMatrix(JE_XFORM_TYPE_VIEW, &cameraXForm);
  270. Driver->SetMatrix(JE_XFORM_TYPE_WORLD, &BSP->WorldToModelXForm);
  271. // Call the rendering for each primitive I have
  272. if (BSP->HWPolyDatas) {
  273. jeGeometry_PolyData* pPolyData = NULL;
  274. while (pPolyData = (jeGeometry_PolyData*)jeChain_GetNextLinkData(BSP->HWPolyDatas, pPolyData))
  275. {
  276. Driver->GeometryBuffer_DrawPolyData(pPolyData);
  277. }
  278. }
  279. Driver->SetMatrix(JE_XFORM_TYPE_VIEW, &identity);
  280. Driver->SetMatrix(JE_XFORM_TYPE_WORLD, &identity);
  281. if (BSP->AreaChain)
  282. {
  283. jeChain_Link *Link;
  284. for (Link = jeChain_GetFirstLink(BSP->AreaChain); Link; Link = jeChain_LinkGetNext(Link))
  285. {
  286. jeBSPNode_Area *Area = (jeBSPNode_Area*)jeChain_LinkGetLinkData(Link);;
  287. jeChain_Link *Link2;
  288. // The Area is visible, render all objects inside the area
  289. // NOTE - For now, objects only live in one area at a time, so we
  290. // always render them. As soon as they are allowed to live in more than
  291. // one area, we will have to take this into account, and make sure we only render
  292. // them once...
  293. for (Link2 = jeChain_GetFirstLink(Area->ObjectChain); Link2; Link2 = jeChain_LinkGetNext(Link2))
  294. {
  295. jeObject *Object = (jeObject*)jeChain_LinkGetLinkData(Link2);
  296. jeObject_Type objectType = jeObject_GetType(Object);
  297. switch (objectType)
  298. {
  299. case JE_OBJECT_TYPE_LIGHT:
  300. // Do nothing
  301. break;
  302. case JE_OBJECT_TYPE_TERRAIN:
  303. // fall down to actor process
  304. case JE_OBJECT_TYPE_ACTOR:
  305. // set the flag visibility to true
  306. jeObject_SetRenderNextPass(Object, JE_TRUE);
  307. break;
  308. default:
  309. // Render the object
  310. if (!jeObject_Render(Object, BSP->World, BSP->Engine, Camera, CameraSpaceFrustum, 0))
  311. return JE_FALSE;
  312. break;
  313. }
  314. }
  315. }
  316. }
  317. else // Render every object, since there is no areas...
  318. {
  319. jeChain_Link *Link;
  320. for (Link = jeChain_GetFirstLink(BSP->BSPObjectChain); Link; Link = jeChain_LinkGetNext(Link))
  321. {
  322. jeBSP_Object *BSPObject = (jeBSP_Object*)jeChain_LinkGetLinkData(Link);
  323. // Render the object
  324. if (!jeObject_Render(BSPObject->Object, BSP->World, BSP->Engine, Camera, CameraSpaceFrustum, 0))
  325. return JE_FALSE;
  326. }
  327. }
  328. return JE_TRUE;
  329. }
  330. return jeBSP_RenderFrontToBack(BSP, Camera, CameraSpaceFrustum, ModelSpaceFrustum, ModelToCameraXForm);
  331. }
  332. //=======================================================================================
  333. // jeBSP_RenderAndVis
  334. //=======================================================================================
  335. jeBoolean jeBSP_HWXF_RenderAndVis(jeBSP *BSP, jeCamera *Camera, jeFrustum *Frustum)
  336. {
  337. jeFrustum ModelSpaceFrustum;
  338. jeXForm3d ModelToCameraXForm, CameraToModelXForm;
  339. BSP->DebugInfo.NumVisibleAreas = 0;
  340. jeXForm3d_Multiply(jeCamera_XForm(Camera), &BSP->ModelToWorldXForm, &ModelToCameraXForm);
  341. jeXForm3d_GetTranspose(&ModelToCameraXForm, &CameraToModelXForm);
  342. // Transform Frustum from camera space to model space
  343. jeFrustum_Transform(Frustum, &CameraToModelXForm, &ModelSpaceFrustum);
  344. if (!jeBSP_HWXF_UpdateAll(BSP))
  345. return JE_FALSE;
  346. if (!jeBSP_VisFrame(BSP, Camera, &ModelSpaceFrustum))
  347. return JE_FALSE;
  348. if (!jeBSP_UpdateDLights(BSP))
  349. return JE_FALSE;
  350. if (!jeBSP_UpdateObjects(BSP))
  351. return JE_FALSE;
  352. // Render the models BSP tree
  353. if (!jeBSP_HWXF_Render(BSP, Camera, Frustum, &ModelSpaceFrustum, &CameraToModelXForm /*/(jeXForm3d*) jeCamera_XForm(Camera) /*&ModelToCameraXForm*/))
  354. return JE_FALSE;
  355. return JE_TRUE;
  356. }
  357. //=======================================================================================
  358. // jeBSP_RebuildFaces
  359. //=======================================================================================
  360. jeBoolean jeBSP_HWXF_RebuildFaces(jeBSP *BSPTree)
  361. {
  362. if (!BSPTree->RootNode)
  363. return JE_TRUE;
  364. jeBSP_HWXF_Node_RebuildFaces_r(BSPTree->RootNode, BSPTree);
  365. // Use the tree to mark the visible sides
  366. if (!jeBSP_MarkVisibleTopSides(BSPTree))
  367. return JE_FALSE;
  368. if (!jeBSP_HWXF_Node_MakeFaces_Callr(BSPTree->RootNode, BSPTree, JE_TRUE))
  369. return JE_FALSE;
  370. return JE_TRUE;
  371. }
  372. void JETCC jeBSP_HWXF_ResetListener(void *Context)
  373. {
  374. jeBSP* BSP = (jeBSP*) Context;
  375. BSP->HWVertexBuffer = JE_GEOMETRY_BUFFER_NULL_INDEX;
  376. }
  377. //=======================================================================================
  378. // jeBSP_HWXF_CreateVertexBuffer
  379. // Create a vertex buffer and initialise the Geometry of all jeBSP_Brush
  380. //=======================================================================================
  381. static jeBoolean jeBSP_HWXF_CreateVertexBuffer(jeBSP* BSP)
  382. {
  383. // Like we copy the same amount of data in the vert array and in the HWHelpers
  384. SHWInfoData globalInfo;
  385. // Time to recover the primitive
  386. if (BSP->HWPolyDatas) {
  387. jeGeometry_PolyData* pPolyData = NULL;
  388. while(pPolyData = (jeGeometry_PolyData*)jeChain_GetNextLinkData(BSP->HWPolyDatas, pPolyData))
  389. {
  390. jeChain_RemoveLinkData(BSP->HWPolyDatas, pPolyData);
  391. jeRam_Free(pPolyData);
  392. }
  393. jeChain_Destroy(&BSP->HWPolyDatas);
  394. }
  395. BSP->HWPolyDatas = jeChain_Create();
  396. BSP->HWHelper->GeneratePrimitive(BSP, &globalInfo);
  397. if (BSP->Engine)
  398. {
  399. // Engine linked with the BSP so we can do something now
  400. DRV_Driver* Driver = jeEngine_GetDriver(BSP->Engine);
  401. // Delete allocated resource
  402. if (BSP->HWVertexBuffer != JE_GEOMETRY_BUFFER_NULL_INDEX) {
  403. Driver->GeometryBuffer_Destroy(BSP->HWVertexBuffer);
  404. }
  405. // Create a new geometry buffer
  406. BSP->HWVertexBuffer = Driver->GeometryBuffer_Create(globalInfo.vertices.size(), globalInfo.indices.size(), JE_FALSE, jeBSP_HWXF_ResetListener, BSP);
  407. // Move the jeHWVertex std::vector to a C array
  408. jeHWVertex* pHWVertices = JE_RAM_ALLOCATE_ARRAY(jeHWVertex, globalInfo.vertices.size());
  409. for (uint32 idx = 0; idx<globalInfo.vertices.size(); idx++) {
  410. pHWVertices[idx] = globalInfo.vertices[idx];
  411. }
  412. // Copy the array to the Driver and free it
  413. Driver->GeometryBuffer_AddVertices(BSP->HWVertexBuffer, pHWVertices, globalInfo.vertices.size(), JE_TRUE);
  414. jeRam_Free(pHWVertices);
  415. // Move the Indice std::vector to C array
  416. uint16* pIndices = JE_RAM_ALLOCATE_ARRAY(uint16, globalInfo.indices.size());
  417. for (uint32 idx = 0; idx<globalInfo.indices.size(); idx++) {
  418. pIndices[idx] = globalInfo.indices[idx];
  419. }
  420. // Copy the array to the Driver and free it
  421. Driver->GeometryBuffer_AddIndices(BSP->HWVertexBuffer, pIndices, globalInfo.indices.size(), JE_TRUE);
  422. jeRam_Free(pIndices);
  423. }
  424. return JE_TRUE;
  425. }
  426. //=======================================================================================
  427. // CBSP_HWHelper class implementation
  428. //=======================================================================================
  429. CBSP_HWHelper::CBSP_HWHelper()
  430. {
  431. }
  432. CBSP_HWHelper::~CBSP_HWHelper()
  433. {
  434. }
  435. /***
  436. Append per material the poly and the indices
  437. */
  438. jeBoolean CBSP_HWHelper::Append(jeMaterialSpec *pMat, uint32 size, jeHWVertex* pVertices, triangle_stripper::indices& indices)
  439. {
  440. SHWInfoData& indexData = m_materialMap[pMat];
  441. // Store for the addition the starting index
  442. int32 startVertex = indexData.vertices.size();
  443. // Record the index in the associated vertex array
  444. for (int32 i=0; i<indices.size();i++) {
  445. //indices[i]+=indexData.startVertex;
  446. indices[i]+=startVertex;
  447. indexData.indices.push_back(indices[i]);
  448. }
  449. for (int32 i=0; i<size; i++, pVertices++) {
  450. indexData.vertices.push_back(*pVertices);
  451. }
  452. return JE_TRUE;
  453. }
  454. SHWInfoData& CBSP_HWHelper::GetVertInfo(jeMaterialSpec* pMat)
  455. {
  456. return m_materialMap[pMat];
  457. }
  458. // Generate Geometry_PolyData per material and do the stripping when wanted
  459. void CBSP_HWHelper::GeneratePrimitive(jeBSP* BSP, SHWInfoData* pGlobalInfo)
  460. {
  461. SHWInfoDataMap::iterator it = m_materialMap.begin();
  462. while (it != m_materialMap.end())
  463. {
  464. jeGeometry_PolyData* pPolyData = JE_RAM_ALLOCATE_STRUCT(jeGeometry_PolyData);
  465. pPolyData->BaseVertexIndex = 0;
  466. pPolyData->PrimitiveType = JE_PRIMITIVE_TYPE_TRIANGLELIST;
  467. // Fill the material spec use
  468. pPolyData->Material = it->first;
  469. // Fill the vertex start point
  470. SHWInfoData& localInfo = it->second;
  471. pPolyData->StartVertex = pGlobalInfo->vertices.size();
  472. pPolyData->StartIndex = pGlobalInfo->indices.size();
  473. pPolyData->NumVertices = localInfo.vertices.size();
  474. pPolyData->NumPolys = localInfo.indices.size() / 3; // Triangle list for now
  475. for (uint32 i=0; i<localInfo.indices.size(); i++) {
  476. pGlobalInfo->indices.push_back(localInfo.indices[i] + pPolyData->StartVertex);
  477. }
  478. for (uint32 i=0; i<localInfo.vertices.size(); i++) {
  479. pGlobalInfo->vertices.push_back(localInfo.vertices[i]);
  480. }
  481. // Add the poly data to the vertice stuff
  482. jeChain_AddLinkData(BSP->HWPolyDatas, pPolyData);
  483. // Go to next material
  484. it++;
  485. }
  486. }
  487. void CBSP_HWHelper::Reset()
  488. {
  489. m_materialMap.erase(m_materialMap.begin(), m_materialMap.end());
  490. m_materialMap.clear();
  491. }