示例#1
0
        /// <summary>
        /// Assigns a texture to the shader parameter with the specified name.
        /// </summary>
        /// <param name="name">Name of the shader parameter.</param>
        /// <param name="value">Value of the parameter.</param>
        public void SetTexture(string name, Texture value)
        {
            IntPtr texturePtr = IntPtr.Zero;

            if (value != null)
            {
                texturePtr = value.GetCachedPtr();
            }

            Internal_SetTexture(mCachedPtr, name, texturePtr);
        }
示例#2
0
        /// <summary>
        /// Creates a new 2D render texture using existing textures as render destinations.
        /// </summary>
        /// <param name="colorSurface">Color texture to render color data to.</param>
        /// <param name="depthStencilSurface">Optional depth/stencil texture to render depth/stencil data to.</param>
        public RenderTexture2D(Texture colorSurface, Texture depthStencilSurface = null)
        {
            IntPtr[] colorSurfaceInstances = new IntPtr[1];
            colorSurfaceInstances[0] = colorSurface.GetCachedPtr();

            IntPtr depthStencilInstance = IntPtr.Zero;

            if (depthStencilSurface != null)
            {
                depthStencilInstance = depthStencilSurface.GetCachedPtr();
            }

            Internal_Create(this, colorSurfaceInstances, depthStencilInstance);
        }
示例#3
0
        /// <summary>
        /// Creates a new 2D render texture using one or multiple color textures and a depth/stencil texture.
        /// </summary>
        /// <param name="colorSurfaces">Color texture(s) to render color data to. </param>
        /// <param name="depthStencilSurface">>Optional depth/stencil texture to render depth/stencil data to.</param>
        public RenderTexture2D(Texture[] colorSurfaces, Texture depthStencilSurface = null)
        {
            IntPtr[] colorSurfaceInstances = new IntPtr[colorSurfaces.Length];

            for (int i = 0; i < colorSurfaces.Length; i++)
            {
                colorSurfaceInstances[i] = colorSurfaces[i] != null ? colorSurfaces[i].GetCachedPtr() : IntPtr.Zero;
            }

            IntPtr depthStencilInstance = IntPtr.Zero;

            if (depthStencilSurface != null)
            {
                depthStencilInstance = depthStencilSurface.GetCachedPtr();
            }

            Internal_Create(this, colorSurfaceInstances, depthStencilInstance);
        }