コード例 #1
0
 /// <summary>
 /// Loads all object templates from the "Editor/Templates" directory
 /// </summary>
 public ObjectEditMode( RayCastOptions pickOptions )
 {
     m_PickOptions = pickOptions;
     m_Templates = BuildObjectTemplates( );
     if ( m_Templates.Count > 0 )
     {
         m_Template = m_Templates[ 0 ];
     }
 }
コード例 #2
0
        /// <summary>
        /// Creates a pick ray, and returns the first intersection in the scene
        /// </summary>
        public ILineIntersection FirstPick( int cursorX, int cursorY, RayCastOptions options )
        {
            Viewer viewer = GetViewerUnderCursor( cursorX, cursorY );
            if ( ( viewer == null ) || ( viewer.Camera == null ) )
            {
                return null;
            }
            if ( viewer.Camera is ICamera3 )
            {
                IRayCastService rayCaster = EditorState.Instance.CurrentScene.GetService< IRayCastService >( );
                if ( rayCaster == null )
                {
                    return null;
                }

                Ray3 ray = ( ( ICamera3 )viewer.Camera ).PickRay( cursorX, cursorY );
                Line3Intersection intersection = rayCaster.GetFirstIntersection( ray, options );
                return intersection;
            }

            return null;
        }
コード例 #3
0
 /// <summary>
 /// Sets up this action
 /// </summary>
 /// <param name="options">Pick raycast options</param>
 public MoveAction( RayCastOptions options )
 {
     m_PickOptions = options;
 }
コード例 #4
0
 /// <summary>
 /// Binds the edit mode to a control and viewer
 /// </summary>
 /// <param name="actionButton">The mouse button that this edit mode listens out for</param>
 /// <param name="pickOptions">Pick raycast options</param>
 public SelectEditMode( MouseButtons actionButton, RayCastOptions pickOptions )
 {
     m_ActionButton = actionButton;
     m_PickOptions = pickOptions;
 }