Minor optimization - only creating vector if we are going to use it.
This commit is contained in:
parent
54903150e9
commit
f35581506c
@ -270,8 +270,6 @@ namespace PolyVox
|
|||||||
template <typename VoxelType>
|
template <typename VoxelType>
|
||||||
typename PagedVolume<VoxelType>::Chunk* PagedVolume<VoxelType>::getChunk(int32_t uChunkX, int32_t uChunkY, int32_t uChunkZ) const
|
typename PagedVolume<VoxelType>::Chunk* PagedVolume<VoxelType>::getChunk(int32_t uChunkX, int32_t uChunkY, int32_t uChunkZ) const
|
||||||
{
|
{
|
||||||
Vector3DInt32 v3dChunkPos(uChunkX, uChunkY, uChunkZ);
|
|
||||||
|
|
||||||
// The chunk was not the same as last time, but we can now hope it is in the set of most recently used chunks.
|
// The chunk was not the same as last time, but we can now hope it is in the set of most recently used chunks.
|
||||||
/*Chunk* pChunk = nullptr;
|
/*Chunk* pChunk = nullptr;
|
||||||
auto itChunk = m_mapChunks.find(v3dChunkPos);
|
auto itChunk = m_mapChunks.find(v3dChunkPos);
|
||||||
@ -328,6 +326,7 @@ namespace PolyVox
|
|||||||
if (!pChunk)
|
if (!pChunk)
|
||||||
{
|
{
|
||||||
// The chunk was not found so we will create a new one.
|
// The chunk was not found so we will create a new one.
|
||||||
|
Vector3DInt32 v3dChunkPos(uChunkX, uChunkY, uChunkZ);
|
||||||
pChunk = new PagedVolume<VoxelType>::Chunk(v3dChunkPos, m_uChunkSideLength, m_pPager);
|
pChunk = new PagedVolume<VoxelType>::Chunk(v3dChunkPos, m_uChunkSideLength, m_pPager);
|
||||||
pChunk->m_uChunkLastAccessed = ++m_uTimestamper; // Important, as we may soon delete the oldest chunk
|
pChunk->m_uChunkLastAccessed = ++m_uTimestamper; // Important, as we may soon delete the oldest chunk
|
||||||
//m_mapChunks.insert(std::make_pair(v3dChunkPos, std::unique_ptr<Chunk>(pChunk)));
|
//m_mapChunks.insert(std::make_pair(v3dChunkPos, std::unique_ptr<Chunk>(pChunk)));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user