예제 #1
0
        /// <summary>
        /// Creates a new instance of <see cref="RenderTargetCube"/>.
        /// </summary>
        /// <param name="renderSystem">Render system used to create the underlying implementation.</param>
        /// <param name="size">The size (width/height) of each cube face.</param>
        /// <param name="genMipMap">True if a mipmap chain should be generated or not.</param>
        /// <param name="format">The surface  format.</param>
        /// <param name="depthFormat">The depth-stencil format.</param>
        /// <param name="multiSampleCount">The number of sample locations for multisampling</param>
        /// <param name="usage">Sets the render target's behavior.</param>
        /// <exception cref="System.ArgumentNullException">Thrown if the render system is null.</exception>
        /// <exception cref="Tesla.Core.TeslaException">Thrown if creating the underlying texture fails.</exception>
        public RenderTargetCube(IRenderSystemProvider renderSystem, int size, bool genMipMap, SurfaceFormat format, DepthFormat depthFormat, int multiSampleCount, RenderTargetUsage usage)
        {
            if (renderSystem == null)
            {
                Dispose();
                throw new ArgumentNullException("renderSystem", "Render system cannot be null.");
            }

            base.RenderSystem = renderSystem;

            try {
                _impl = renderSystem.CreateRenderTargetCubeImplementation(size, genMipMap, format, depthFormat, multiSampleCount, usage);
            } catch (Exception e) {
                Dispose();
                throw new TeslaException("Error creating underlying implementation, see inner exception for details.", e);
            }
        }
예제 #2
0
        /// <summary>
        /// Creates a new instance of <see cref="RenderTargetCube"/>.
        /// </summary>
        /// <param name="renderSystem">Render system used to create the underlying implementation.</param>
        /// <param name="size">The size (width/height) of each cube face.</param>
        /// <exception cref="System.ArgumentNullException">Thrown if the render system is null.</exception>
        /// <exception cref="Tesla.Core.TeslaException">Thrown if creating the underlying texture fails.</exception>
        public RenderTargetCube(IRenderSystemProvider renderSystem, int size)
        {
            if (renderSystem == null)
            {
                Dispose();
                throw new ArgumentNullException("renderSystem", "Render system cannot be null.");
            }

            base.RenderSystem = renderSystem;

            try {
                _impl = renderSystem.CreateRenderTargetCubeImplementation(size, false, SurfaceFormat.Color, DepthFormat.None, 1, RenderTargetUsage.DiscardContents);
            } catch (Exception e) {
                Dispose();
                throw new TeslaException("Error creating underlying implementation, see inner exception for details.", e);
            }
        }
예제 #3
0
        /// <summary>
        /// Creates a new instance of <see cref="RenderTargetCube"/>.
        /// </summary>
        /// <param name="size">The size (width/height) of each cube face.</param>
        /// <param name="genMipMap">True if mip levels should be generated.</param>
        /// <param name="format">The surface format.</param>
        /// <param name="depthFormat">The depth format</param>
        /// <exception cref="Tesla.Core.TeslaException">Thrown if creating the underlying render target fails or the render
        /// system was not initialized.</exception>
        public RenderTargetCube(int size, bool genMipMap, SurfaceFormat format, DepthFormat depthFormat)
        {
            IRenderSystemProvider renderSystem = Engine.Services.GetService <IRenderSystemProvider>();

            if (renderSystem == null)
            {
                Dispose();
                throw new TeslaException("Render system provider not set, cannot create graphics resource implementation.");
            }

            base.RenderSystem = renderSystem;

            try {
                _impl = renderSystem.CreateRenderTargetCubeImplementation(size, genMipMap, format, depthFormat, 0, RenderTargetUsage.DiscardContents);
            } catch (Exception e) {
                Dispose();
                throw new TeslaException("Error creating underlying implementation, see inner exception for details.", e);
            }
        }