void findUniqueIdRange(int *minId, int *maxId) { if (!minId && !maxId) return; if (minId) *minId = DDMAXINT; if (maxId) *maxId = DDMININT; PathTreeIterator<Index> iter(index.leafNodes()); while (iter.hasNext()) { TextureManifest &manifest = iter.next(); int const uniqueId = manifest.uniqueId(); if (minId && uniqueId < *minId) *minId = uniqueId; if (maxId && uniqueId > *maxId) *maxId = uniqueId; } }
void rebuildUniqueIdLut() { // Is a rebuild necessary? if(!uniqueIdLutDirty) return; // Determine the size of the LUT. int minId, maxId; findUniqueIdRange(&minId, &maxId); int lutSize = 0; if(minId > maxId) // None found? { uniqueIdBase = 0; } else { uniqueIdBase = minId; lutSize = maxId - minId + 1; } // Fill the LUT with initial values. #ifdef DENG2_QT_4_7_OR_NEWER uniqueIdLut.reserve(lutSize); #endif int i = 0; for(; i < uniqueIdLut.size(); ++i) { uniqueIdLut[i] = 0; } for(; i < lutSize; ++i) { uniqueIdLut.push_back(0); } if(lutSize) { // Populate the LUT. PathTreeIterator<Index> iter(index.leafNodes()); while(iter.hasNext()) { linkInUniqueIdLut(iter.next()); } } uniqueIdLutDirty = false; }
~Impl() { self().clear(); DENG_ASSERT(index.isEmpty()); }
~Instance() { self.clear(); DENG_ASSERT(index.isEmpty()); }