| 298 | |
| 299 | MR_REGISTER_RENDER_OBJECT_IMPL( SphereObject, RenderSphereFeatureObject ) |
| 300 | RenderSphereFeatureObject::RenderSphereFeatureObject( const VisualObject& object ) |
| 301 | : RenderObjectCombinator( object ), object_( &object ) |
| 302 | { |
| 303 | static const auto mesh = []{ |
| 304 | constexpr float radius = 1.0f; |
| 305 | return std::make_shared<Mesh>( makeSphere( { radius, sphereDetailLevel } ) ); |
| 306 | }(); |
| 307 | getMesh().setMesh( mesh ); |
| 308 | |
| 309 | // Subfeatures. |
| 310 | getPoints().setPointCloud( std::make_shared<PointCloud>() ); |
| 311 | addSubfeatures( SphereObject{}, nullptr, &getPoints() ); |
| 312 | |
| 313 | // More or less an arbitrary direction. Just something that's not +X to avoid overlaps with other stuff. |
| 314 | Vector3f nameTagDir = Vector3f( -1, -1, 0 ).normalized(); |
| 315 | |
| 316 | nameUiPoint = nameTagDir; |
| 317 | nameUiPointIsRelativeToBoundingBoxCenter = false; |
| 318 | nameUiLocalOffset = nameTagDir * 2.f / 3.f; |
| 319 | nameUiRotateToScreenPlaneAroundSphereCenter = Vector3f( 0, 0, 0 ); |
| 320 | } |
| 321 | |
| 322 | void RenderSphereFeatureObject::renderUi( const UiRenderParams& params ) |
| 323 | { |
nothing calls this directly
no test coverage detected