| 207 | |
| 208 | MR_REGISTER_RENDER_OBJECT_IMPL( CircleObject, RenderCircleFeatureObject ) |
| 209 | RenderCircleFeatureObject::RenderCircleFeatureObject( const VisualObject& object ) |
| 210 | : RenderObjectCombinator( object ), object_( &object ) |
| 211 | { |
| 212 | // Main visualization. |
| 213 | static const auto polyline = []{ |
| 214 | auto ret = std::make_shared<Polyline3>(); |
| 215 | std::array<Vector3f, numCircleSegments> points; |
| 216 | for ( int i = 0; i < numCircleSegments; ++i ) |
| 217 | { |
| 218 | float angle = i * 2 * PI_F / numCircleSegments; |
| 219 | points[i].x = cosf( angle ); |
| 220 | points[i].y = sinf( angle ); |
| 221 | } |
| 222 | ret->addFromPoints( points.data(), numCircleSegments, true ); |
| 223 | return ret; |
| 224 | }(); |
| 225 | getLines().setPolyline( polyline ); |
| 226 | |
| 227 | // Subfeatures. |
| 228 | getPoints().setPointCloud( std::make_shared<PointCloud>() ); |
| 229 | addSubfeatures( CircleObject{}, &getLines(), &getPoints() ); |
| 230 | |
| 231 | // More or less an arbitrary direction. Just something that's not +X to avoid overlaps with other stuff. |
| 232 | Vector3f nameTagDir = Vector3f( -1, -1, 0 ).normalized(); |
| 233 | nameUiPoint = nameTagDir; |
| 234 | nameUiPointIsRelativeToBoundingBoxCenter = false; |
| 235 | nameUiLocalOffset = nameTagDir * 2.f / 3.f; |
| 236 | } |
| 237 | |
| 238 | void RenderCircleFeatureObject::renderUi( const UiRenderParams& params ) |
| 239 | { |
nothing calls this directly
no test coverage detected