| 107 | } |
| 108 | |
| 109 | inline const RegionType *getRegion(const openpgl::Point3 &p, float *sample1D, uint32_t &id) const |
| 110 | { |
| 111 | if (m_iteration > 0 && embree::inside(m_spatialSubdiv.getBounds(), p)) |
| 112 | { |
| 113 | if (m_useStochasticNNLookUp && *sample1D >= 0.f) |
| 114 | { |
| 115 | if (USE_PRECOMPUTED_NN) |
| 116 | { |
| 117 | uint32_t regionIdx = getApproximateClosestRegionIdx(m_regionKNNSearchTree, p, sample1D, id); |
| 118 | return &m_regionStorageContainer[regionIdx].first; |
| 119 | } |
| 120 | else |
| 121 | { |
| 122 | uint32_t regionIdx = getClosestRegionIdx(m_regionKNNSearchTree, p, sample1D, id); |
| 123 | if (regionIdx != -1) |
| 124 | { |
| 125 | return &m_regionStorageContainer[regionIdx].first; |
| 126 | } |
| 127 | else |
| 128 | { |
| 129 | return nullptr; |
| 130 | } |
| 131 | } |
| 132 | } |
| 133 | else |
| 134 | { |
| 135 | uint32_t dataIdx = m_spatialSubdiv.getDataIdxAtPos(p); |
| 136 | OPENPGL_ASSERT(dataIdx < m_regionStorageContainer.size()); |
| 137 | id = dataIdx; |
| 138 | return &m_regionStorageContainer[dataIdx].first; |
| 139 | } |
| 140 | } |
| 141 | else |
| 142 | { |
| 143 | return nullptr; |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | void buildField(const SampleContainer &samples) |
| 148 | { |
nothing calls this directly
no test coverage detected