Compare commits

...

7 Commits

  1. 3
      application/main.cpp
  2. 3
      network_process/src/prim_gen/extract_vertex_infos.cpp
  3. 11
      primitive_process/src/primitive/simple/cylinder.cpp

3
application/main.cpp

@ -36,7 +36,8 @@ int main()
auto sphere1 = create_primitive(primitive_data_center, PRIMITIVE_TYPE_SPHERE);
// auto sphere2 = create_primitive(primitive_data_center, PRIMITIVE_TYPE_SPHERE);
auto cylinder = create_primitive(primitive_data_center, PRIMITIVE_TYPE_CYLINDER);
primitive_apply_translation(sphere1, {0.5, 0.0, 0.0});
//primitive_apply_translation(sphere1, {.0, 0.0, 0.0});
primitive_apply_scale(cylinder, {1, 1, 2});
std::cout << "primitive created..." << std::endl;
auto runtime_blobtree = create_blobtree();

3
network_process/src/prim_gen/extract_vertex_infos.cpp

@ -40,7 +40,8 @@ void extract_vertex_infos(const s_settings& settings,
// compute the SDF values for each vertex
for (uint32_t i = 0; i < tree.subfaces.size(); ++i) {
auto subface_vert_info = vertex_infos.col(i);
auto sdf_evaluator = tree.subfaces[i].object_ptr->fetch_sdf_evaluator();
const auto& subface = tree.subfaces[i];
auto sdf_evaluator = subface.object_ptr->fetch_sdf_evaluator();
for (uint32_t j = 0; j < subface_vert_info.size(); ++j) {
auto pos = get_vert_pos(j, scene_bg_mesh_info);
subface_vert_info[j] = sdf_evaluator(pos);

11
primitive_process/src/primitive/simple/cylinder.cpp

@ -24,7 +24,7 @@ void cylinder_t::destroy()
void cylinder_t::initialize(primitive_data_center_t &data_center,
const std::vector<std::pair<internal::paired_model_matrix *, bool>> &new_model_matrices)
{
std::array<subface *, 3> old_ptrs{bottom_plane.get_ptr(), cylinder_face.get_ptr(), top_plane.get_ptr()};
std::array<subface *, 3> old_ptrs{cylinder_face.get_ptr(), bottom_plane.get_ptr(), top_plane.get_ptr()};
std::array<paired_model_matrix *, 3> old_model_matrices{nullptr, nullptr, nullptr};
for (size_t i = 0; i < 3; ++i) {
if (old_ptrs[i] != nullptr) old_model_matrices[i] = old_ptrs[i]->model_matrices;
@ -52,8 +52,13 @@ void cylinder_t::initialize(primitive_data_center_t
}
// deferred release to avoid acquiring the same just-released subface
for (size_t i = 0; i < 3; ++i) {
if (old_ptrs[i] != nullptr) data_center.spheres.release(old_model_matrices[i]);
{
if (old_ptrs[0] != nullptr)
data_center.cylinders.release(cylinder_paired_model_matrix{old_model_matrices[0]});
if (old_ptrs[1] != nullptr)
data_center.planes.release(plane_paired_model_matrix{old_model_matrices[1]});
if (old_ptrs[2] != nullptr)
data_center.planes.release(plane_paired_model_matrix{old_model_matrices[2]});
}
}
} // namespace internal
Loading…
Cancel
Save