| 373 | |
| 374 | MR_REGISTER_RENDER_OBJECT_IMPL( ConeObject, RenderConeFeatureObject ) |
| 375 | RenderConeFeatureObject::RenderConeFeatureObject( const VisualObject& object ) |
| 376 | : RenderObjectCombinator( object ), object_( &object ) |
| 377 | { |
| 378 | static const auto mesh = []{ |
| 379 | constexpr float radius = 1; |
| 380 | constexpr float height = 1; |
| 381 | return std::make_shared<Mesh>( makeOpenCone( radius, 0, height, numCircleSegments ) ); |
| 382 | }(); |
| 383 | getMesh().setMesh( mesh ); |
| 384 | getMesh().setFlatShading( true ); |
| 385 | |
| 386 | // Subfeatures. |
| 387 | getPoints().setPointCloud( std::make_shared<PointCloud>() ); |
| 388 | getLines().setPolyline( std::make_shared<Polyline3>() ); |
| 389 | addSubfeatures( ConeObject{}, &getLines(), &getPoints() ); |
| 390 | |
| 391 | // More or less an arbitrary direction. Just something that's not +X to avoid overlaps with other stuff. |
| 392 | Vector3f nameTagDir = Vector3f( -1, -1, 0 ).normalized(); |
| 393 | |
| 394 | nameUiPoint = Vector3f( 0, 0, 1 ) + nameTagDir; |
| 395 | nameUiPointIsRelativeToBoundingBoxCenter = false; |
| 396 | nameUiLocalOffset = nameTagDir * 2.f / 3.f; |
| 397 | } |
| 398 | |
| 399 | void RenderConeFeatureObject::renderUi( const UiRenderParams& params ) |
| 400 | { |
nothing calls this directly
no test coverage detected