MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ evaluate_grid()

void MayaFlux::Buffers::SDFMeshProcessor::evaluate_grid ( )
private

Definition at line 244 of file SDFMeshProcessor.cpp.

245{
246 const uint32_t nx = m_res_x + 1;
247 const uint32_t ny = m_res_y + 1;
248 const uint32_t nz = m_res_z + 1;
249 const size_t total = static_cast<size_t>(nx) * ny * nz;
250
251 const glm::vec3 extent = m_bounds_max - m_bounds_min;
252 const glm::vec3 step {
253 extent.x / static_cast<float>(m_res_x),
254 extent.y / static_cast<float>(m_res_y),
255 extent.z / static_cast<float>(m_res_z),
256 };
257
258 auto* grid = static_cast<float*>(m_grid_buf->get_mapped_ptr());
259
260 MayaFlux::Parallel::for_each(std::execution::par_unseq,
261 std::views::iota(0UZ, total).begin(),
262 std::views::iota(0UZ, total).end(),
263 [&](size_t idx) {
264 const uint32_t gix = idx % nx;
265 const uint32_t giy = (idx / nx) % ny;
266 const uint32_t giz = idx / (static_cast<size_t>(nx) * ny);
267 grid[idx] = m_field(glm::vec3(
268 m_bounds_min.x + static_cast<float>(gix) * step.x,
269 m_bounds_min.y + static_cast<float>(giy) * step.y,
270 m_bounds_min.z + static_cast<float>(giz) * step.z));
271 });
272}
std::shared_ptr< VKBuffer > m_grid_buf

References m_bounds_max, m_bounds_min, m_field, m_grid_buf, m_res_x, m_res_y, and m_res_z.

Referenced by on_before_execute().

+ Here is the caller graph for this function: