using System; using System.Runtime.CompilerServices; using BansheeEngine; namespace BansheeEditor { /// /// Handles rendering of the selection overlay and picking of objects in the target camera's view. /// internal sealed class SceneSelection : ScriptObject { /// /// Creates a new scene selection manager. /// /// Camera into which to render the selection overlay, and perform picking from. internal SceneSelection(Camera sceneCamera) { Internal_Create(this, sceneCamera.Native.GetCachedPtr()); } /// /// Queues selection overlay drawing for this frame. /// internal void Draw() { Internal_Draw(mCachedPtr); } /// /// Attempts to select a scene object under the pointer position. /// /// Position of the pointer relative to the scene camera viewport. /// Should this selection add to the existing selection, or replace it. internal void PickObject(Vector2I pointerPos, bool controlHeld) { Internal_PickObject(mCachedPtr, ref pointerPos, controlHeld); } [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_Create(SceneSelection managedInstance, IntPtr camera); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_Draw(IntPtr thisPtr); [MethodImpl(MethodImplOptions.InternalCall)] private static extern void Internal_PickObject(IntPtr thisPtr, ref Vector2I pointerPos, bool controlHeld); } }