MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / RenderSphereFeatureObject

Method RenderSphereFeatureObject

source/MRViewer/MRRenderFeatureObjects.cpp:300–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298
299MR_REGISTER_RENDER_OBJECT_IMPL( SphereObject, RenderSphereFeatureObject )
300RenderSphereFeatureObject::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
322void RenderSphereFeatureObject::renderUi( const UiRenderParams& params )
323{

Callers

nothing calls this directly

Calls 6

makeSphereFunction · 0.85
getPointsFunction · 0.85
addSubfeaturesFunction · 0.85
setMeshMethod · 0.80
setPointCloudMethod · 0.45
normalizedMethod · 0.45

Tested by

no test coverage detected