Hi,
I have been looking for a solution for this for quite a while now, but have to give in after having tried all I can think of.
For testing purposes I am reusing the DescriptionToolData
provided in this thread
I know it isn't the best example, but still usable for quick tests to figure out if a prototype works or not.
Now, instead of using the single result I am looking to get all (visible) polygons under the area of the mouse cursor.
Bool MyDescriptionTool::GetCursorInfo(BaseDocument* doc, BaseContainer& data, BaseDraw* bd, Float x, Float y, BaseContainer& bc)
{
...
AutoAlloc<ViewportSelect> viewportSelect;
if (viewportSelect && viewportSelect->Init(w, h, bd, object, Mpolygons, true, VIEWPORTSELECTFLAGS::NONE))
{
Int32 vpsX = SAFEINT32(x);
Int32 vpsY = SAFEINT32(y);
const Int32 radius = 10;
const ViewportPixel* vpPixel = viewportSelect->GetNearestPolygon(object, vpsX, vpsY, radius, false, nullptr, 0);
while (vpPixel)
{
iferr(mPolygons.Append(vpPixel->i))
{}
vpPixel = vpPixel->next;
}
ApplicationOutput("@", mPolygons);
}
I have tried differet values for the "radius" variable, still I mainly only get a single polygon as result of the GetNearestPolygon
call.
I am using a default sphere primitive, manually created in an empty scene, and "made editable".
I must be overlooking something simple ...