extract explicit mesh with topology information from implicit surfaces with boolean operations, and do surface/volume integrating on them.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.4 KiB

#include "data/data_center.hpp"
// before dtor, always keep identity transformation block
primitive_data_center_t::primitive_data_center_t() noexcept
{
this->transform_blocks.acquire(internal::identity_model_matrix);
this->transform_blocks.acquire(internal::plane_to_z_pos_1_model_matrix);
this->transform_blocks.acquire(internal::plane_to_z_neg_1_model_matrix);
}
primitive_data_center_t::~primitive_data_center_t() noexcept
{
this->transform_blocks.release(internal::identity_model_matrix);
this->transform_blocks.release(internal::plane_to_z_pos_1_model_matrix);
this->transform_blocks.release(internal::plane_to_z_neg_1_model_matrix);
}
namespace internal
{
PE_API primitive* new_primitive(primitive_type type)
{
switch (type) {
case PRIMITIVE_TYPE_SPHERE: return new (mi_malloc(sizeof(sphere_t))) sphere_t();
case PRIMITIVE_TYPE_CYLINDER: return new (mi_malloc(sizeof(cylinder_t))) cylinder_t();
default: return nullptr;
}
}
PE_API primitive* copy_primitive(primitive* ptr)
{
switch (ptr->get_type()) {
case PRIMITIVE_TYPE_SPHERE: return new (mi_malloc(sizeof(sphere_t))) sphere_t(*static_cast<sphere_t*>(ptr));
case PRIMITIVE_TYPE_CYLINDER: return new (mi_malloc(sizeof(cylinder_t))) cylinder_t(*static_cast<cylinder_t*>(ptr));
default: return nullptr;
}
}
} // namespace internal