示例#1
0
        /// <summary>
        /// Renders a picking map of the current <see cref="Duality.Resources.Scene"/>.
        /// This method needs to be called each frame a picking operation is to be performed.
        /// </summary>
        /// <param name="viewportSize">Size of the viewport area to which will be rendered.</param>
        /// <param name="imageSize">Target size of the rendered image before adjusting it to fit the specified viewport.</param>
        /// <param name="renderOverlay">Whether or not to render screen overlay renderers onto the picking target.</param>
        public void RenderPickingMap(Point2 viewportSize, Vector2 imageSize, bool renderOverlay)
        {
            // Make sure the drawing device has all the latest settings for rendering
            this.UpdateDrawDevice();

            if (this.pickingSetup == null)
            {
                this.pickingSetup = new PickingRenderSetup();
            }
            this.pickingSetup.RenderOverlay = renderOverlay;
            this.pickingSetup.RenderPointOfView(
                // Parent scene might be null for editor-only cameras
                this.GameObj.Scene ?? Scene.Current,
                this.drawDevice,
                new Rect(viewportSize),
                imageSize);
        }
示例#2
0
        /// <summary>
        /// Renders a picking map of the current <see cref="Duality.Resources.Scene"/>.
        /// This method needs to be called each frame a picking operation is to be performed.
        /// </summary>
        /// <param name="viewportSize">Size of the viewport area to which will be rendered.</param>
        /// <param name="imageSize">Target size of the rendered image before adjusting it to fit the specified viewport.</param>
        /// <param name="renderOverlay">Whether or not to render screen overlay renderers onto the picking target.</param>
        public void RenderPickingMap(Point2 viewportSize, Vector2 imageSize, bool renderOverlay)
        {
            //Profile.TimeVisualPicking.BeginMeasure();

            this.UpdateDeviceConfig();

            if (this.pickingSetup == null)
            {
                this.pickingSetup = new PickingRenderSetup();
            }
            this.pickingSetup.RenderOverlay = renderOverlay;
            this.pickingSetup.RenderPointOfView(
                // Parent scene might be null for editor-only cameras
                this.GameObj.ParentScene ?? Scene.Current,
                this.drawDevice,
                new Rect(viewportSize),
                imageSize);

            //Profile.TimeVisualPicking.EndMeasure();
        }