class ScenePicking

Inherits: IScriptExportable

Handles picking of scene objects with a pointer in scene view.

Public

Constructors

ScenePicking

ScenePicking(const SPtr<EditorSceneInstance> &scene)

Methods

~ScenePicking

~ScenePicking() noexcept

PickClosestObject

HSceneObject PickClosestObject(const HCamera &camera, const GizmoDrawSettings &gizmoDrawSettings, const Vector2I &position, const Vector2I &area, const Vector<HSceneObject> &ignoreRenderables, PickingHitData *outData = nullptr)

Attempts to find a single nearest scene object under the provided position and area.

camera
Camera to perform the picking from.
gizmoDrawSettings
Settings used for drawing pickable gizmos.
position
Pointer position relative to the camera viewport, in pixels.
area
Width/height of the checked area in pixels. Use (1, 1) if you want the exact position under the pointer.
ignoreRenderables
A list of objects that should be ignored during scene picking.
outData
Picking data regarding position and normal.

Returns: Nearest SceneObject under the provided area, or an empty handle if no object is found.

PickObjects

Vector<HSceneObject> PickObjects(const HCamera &camera, const GizmoDrawSettings &gizmoDrawSettings, const Vector2I &position, const Vector2I &area, const Vector<HSceneObject> &ignoreRenderables, PickingHitData *outData = nullptr)

Attempts to find all scene objects under the provided position and area.

This does not mean objects occluded by other objects.

camera
Camera to perform the picking from.
gizmoDrawSettings
Settings used for drawing pickable gizmos.
position
Pointer position relative to the camera viewport, in pixels.
area
Width/height of the checked area in pixels. Use (1, 1) if you want the exact position under the pointer.
ignoreRenderables
A list of objects that should be ignored during scene picking.
outData
Picking data regarding position and normal.

Returns: A list of SceneObjects under the provided area.

Private

Methods

staticEncodeIndex

static Color EncodeIndex(u32 index)

Encodes a pickable object identifier to a unique color.

staticDecodeIndex

static u32 DecodeIndex(Color color)

Decodes a color into a unique object identifier.

Color should have initially been encoded with encodeIndex().

Fields

mEditorScene

WeakSPtr<EditorSceneInstance> mEditorScene

mRenderProxy

render::ScenePicking * mRenderProxy