void minmax(const int p, const prevPlanes &pp, ColorVal &min, ColorVal &max) const { assert(p<numPlanes()); if (p==0 || p==3) { min=bounds[p].first; max=bounds[p].second; return; } // optimization for special case ranges->minmax(p, pp, min, max); if (min < bounds[p].first) min=bounds[p].first; if (max > bounds[p].second) max=bounds[p].second; if (min>max) { // should happen only if alpha=0 interpolation produces YI combination for which Q range from ColorRangesYIQ is outside bounds min=bounds[p].first; max=bounds[p].second; } assert(min <= max); }
bool BspSceneFile::loadPlanes(std::istream& bspStream, const Q3Bsp::DirEntry& planesEntry) { if (!bspStream.seekg(planesEntry.offset, std::ios::beg)) { return false; } std::size_t numPlanes(planesEntry.length / sizeof(Q3Bsp::Plane)); m_planes.reserve(numPlanes); if (!bspStream.read(reinterpret_cast<char*>(&m_planes[0]), planesEntry.length)) { return false; } return true; }
ColorVal max(int p) const override { if (p >= numPlanes()) return 0; assert(p<numPlanes()); return ranges[p].second; }
ColorVal min(int p) const override { if (p >= numPlanes()) return 0; assert(p<numPlanes()); return ranges[p].first; }
ColorVal max(int p) const { assert(p<numPlanes()); return std::min(ranges->max(p), bounds[p].second); }
ColorVal min(int p) const { assert(p<numPlanes()); return std::max(ranges->min(p), bounds[p].first); }