INNER CODE UNIT · C++

last_meshlet

oxylusengine/Oxylus · ResourceCompiler/private/ModelCompiler.cpp:402

    const auto& last_meshlet = raw_meshlets[meshlet_count - 1];
    indirect_vertex_indices.resize(last_meshlet.vertex_offset + last_meshlet.vertex_count);
    local_triangle_indices.resize(last_meshlet.triangle_offset + ((last_meshlet.triangle_count * 3 + 3) & ~3_u32));

    auto mesh_bb_min = glm::vec3(std::numeric_limits<f32>::max());
    auto mesh_bb_max = glm::vec3(std::numeric_limits<f32>::lowest());
    auto gpu_meshlet_bounds = std::vector<GPU::MeshletBounds>(meshlet_count);
    for (const auto& [raw_meshlet, meshlet, bounds] : std::views::zip(raw_meshlets, meshlets, gpu_meshlet_bounds)) {
      auto meshlet_bb_min = glm::vec3(std::numeric_limits<f32>::max());
      auto meshlet_bb_max = glm::vec3(std::numeric_limits<f32>::lowest());
      for (u32 i = 0; i < raw_meshlet.triangle_count * 3; i++) {
        auto local_triangle_index_offset = raw_meshlet.triangle_offset + i;
        auto local_triangle_index = local_triangle_indices[local_triangle_index_offset];
        auto indirect_vertex_index_offset = raw_meshlet.vertex_offset + local_triangle_index;
        auto indirect_vertex_index = indirect_vertex_indices[indirect_vertex_index_offset];

        const auto& tri_pos = positions[indirect_vertex_index];
        meshlet_bb_min = glm::min(meshlet_bb_min, tri_pos);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…