# IRsUnknownForegroundController Interface Reference

Inherits IUnknown.

List of all members.

## Public Member Functions
HRESULT | IsWidgetVisible (RtBool *pbVisible)
HRESULT | SetViewportParameters (IRsNode *pViewNode, RtRenderTargetInfo *pRenderTagetInfo, RtLayerInfo *pLayerInfo)
HRESULT | GetMatrix (IRdMatrixf **ppMatrix)
HRESULT | GetMesh (IRdMesh **ppMesh)
HRESULT | IsScreenDistanceRequired (RtBool *pbReqScrDist)
HRESULT | SetRaycastParameters (RtFloat fDst, RtUlong dwObjectId, RtPoint *pptNearestPt)
HRESULT | SetRaycastHit ()
HRESULT | DeactivateHighlite ()
HRESULT | CheckActivationStatus ([in] RtMouseEvent *pMouseEvent,[in] IRsNode *pViewNode,[out] IRsNode **ppActiveNode)
HRESULT | Activate ([in] RtMouseEvent *pMouseEvent,[in] IRsNode *pViewNode,[in] IRsNode *pAction)

## Detailed Description

The IRsUnknownForegroundController interface is required for widget controllers that contain active surfaces. It is for raycasting and widget tool activation.

## Member Function Documentation

HRESULT IRsUnknownForegroundController::IsWidgetVisible | ( | RtBool * | pbVisible | ) |

Check, if widget is visible and should be raycasted.

Parameters:

  | pbVisible | Return true if visible.

HRESULT IRsUnknownForegroundController::SetViewportParameters | ( | IRsNode * | pViewNode,
|  | RtRenderTargetInfo * | pRenderTagetInfo,
|  | RtLayerInfo * | pLayerInfo |
| ) |  |  |

Called by tool controller to set viewport parameters.

Parameters:

  | pViewNode | View node for raycasting
  | pRenderTargetInfo | Render target information
  | pLayerInfo | Layer information

HRESULT IRsUnknownForegroundController::GetMatrix | ( | IRdMatrixf ** | ppMatrix | ) |

Called by tool controller to retrieve matrix for raycasting.

Parameters:

  | ppMatrix | Should be filled with local->world transform matrix.

HRESULT IRsUnknownForegroundController::GetMesh | ( | IRdMesh ** | ppMesh | ) |

Called by tool controller to retrieve mesh for raycasting.

Parameters:

  | ppMesh | should be filled with mesh containing active elements

HRESULT IRsUnknownForegroundController::IsScreenDistanceRequired | ( | RtBool * | pbReqScrDist | ) |

Specify, whether tool requires screenspace distance of cursor from nearest triangle.

Parameters:

  | pbReqScrDist | Set to true to evaluate on-screen distance.

HRESULT IRsUnknownForegroundController::SetRaycastParameters | ( | RtFloat | fDst,
|  | RtUlong | dwObjectId,
|  | RtPoint * | pptNearestPt |
| ) |  |  |

Tool controller notifies handler about raytast distances, object ID and nearest point to cursor from raycasting.

Parameters:

  | fDst | on-screen distance in pixels (if required)
  | dwObjectId | Raycasted object ID if mesh contains object ID stream (IRdSurfaceIdIndexStream)
  | ppNearestPt | World space position of nearest point on the mesh.

HRESULT IRsUnknownForegroundController::SetRaycastHit | ( |  | ) |

Called by tool controller to notify handler that mesh was successfully hit during raycast.

HRESULT IRsUnknownForegroundController::DeactivateHighlite | ( |  | ) |

Called by tool controller to force highlight deactivation.

HRESULT IRsUnknownForegroundController::CheckActivationStatus | ( | [in] RtMouseEvent * | pMouseEvent,
|  | [in] IRsNode * | pViewNode,
|  | [out] IRsNode ** | ppActiveNode |
| ) |  |  |

Check if provided mouse event causes tool activation. If so, ppActiveNode should be filled with active tool.

Parameters:

  | pMouseEvent | Activation mouse event
  | pViewNode | View node
  | ppActiveNode | Should be filled with node that will be activated

HRESULT IRsUnknownForegroundController::Activate | ( | [in] RtMouseEvent * | pMouseEvent,
|  | [in] IRsNode * | pViewNode,
|  | [in] IRsNode * | pAction |
| ) |  |  |

Activate tool action.

Parameters:

  | pMouseEvent | Activation mouse event
  | pViewNode | View node
  | pAction | Action to activate in handler's context.