[IclipMap_t] Optimize leafbrushnode reading

This commit is contained in:
momo5502 2016-12-30 03:39:23 +01:00
parent 554a1f717f
commit 63bc0db0b3

View File

@ -702,12 +702,11 @@ namespace Assets
clipMap->cLeafBrushNodes = builder->getAllocator()->allocateArray<Game::cLeafBrushNode_t>(clipMap->numCLeafBrushNodes); clipMap->cLeafBrushNodes = builder->getAllocator()->allocateArray<Game::cLeafBrushNode_t>(clipMap->numCLeafBrushNodes);
for (int i = 0; i < clipMap->numCLeafBrushNodes; ++i) for (int i = 0; i < clipMap->numCLeafBrushNodes; ++i)
{ {
Game::cLeafBrushNode_t tmp = reader.read<Game::cLeafBrushNode_t>(); clipMap->cLeafBrushNodes[i] = reader.read<Game::cLeafBrushNode_t>();
memcpy(&clipMap->cLeafBrushNodes[i], &tmp, sizeof(Game::cLeafBrushNode_t));
if (tmp.leafBrushCount > 0) if (clipMap->cLeafBrushNodes[i].leafBrushCount > 0)
{ {
clipMap->cLeafBrushNodes[i].data.brushes = reader.readArray<unsigned short>(tmp.leafBrushCount); clipMap->cLeafBrushNodes[i].data.brushes = reader.readArray<unsigned short>(clipMap->cLeafBrushNodes[i].leafBrushCount);
} }
} }
} }