#pragma once #include #include namespace internal { struct sphere_t final : primitive { sphere_t(primitive_data_center_t *data_center_ptr) : primitive(data_center_ptr) { initialize({identity_model_matrix_ptr}, {false}, stl_vector_mp{}, k_aabb_unit); } primitive_type get_type() const override { return PRIMITIVE_TYPE_SPHERE; }; stl_vector_mp get_subface_geometries() const override { // sphere 没有 descriptor,返回 nullptr return {nullptr}; } span> get_subfaces() const override { return {const_cast *>(&sphere_face), 1}; } stl_vector_mp get_subface_types() const override { return {surface_type::sphere}; } // sphere_t does not support geometry descriptor updates. void update_geometry(const void * new_geometry_ptr, size_t subface_index = 0) override { throw std::invalid_argument("sphere_t::update_geometry: sphere geometry is fully encoded in the model matrix " "and has no separate descriptor. Use apply_transform() to modify the sphere."); } marked_subface_ptr_t sphere_face{}; }; } // namespace internal