#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(ptr)); case PRIMITIVE_TYPE_CYLINDER: return new (mi_malloc(sizeof(cylinder_t))) cylinder_t(*static_cast(ptr)); default: return nullptr; } } } // namespace internal