public static CameraComponent GetCameraFromSlot(this RenderContext context, SceneCameraSlotIndex cameraSlotIndex)
        {
            var cameraCollection = SceneCameraSlotCollection.GetCurrent(context);
            if (cameraCollection == null)
            {
                return null;
            }

            // If no camera found, just skip this part.
            var camera = cameraCollection.GetCamera(cameraSlotIndex);
            return camera;
        }
Exemple #2
0
        /// <summary>
        /// Gets the camera for the specified slotIndex or null if empty
        /// </summary>
        /// <param name="cameraSlotIndex">The camera slotIndex.</param>
        /// <returns>SiliconStudio.Xenko.Engine.CameraComponent.</returns>
        public CameraComponent GetCamera(SceneCameraSlotIndex cameraSlotIndex)
        {
            int index = cameraSlotIndex;

            if (index >= 0 && index < Count)
            {
                var slot = this[index];
                if (slot != null)
                {
                    return(slot.Camera);
                }
            }
            return(null);
        }