private static List <EffectParameterDeclaration> DeferredLightingEffectParams(RenderTarget srcRenderTarget, float4 backgroundColor)
 {
     return(new List <EffectParameterDeclaration>()
     {
         new EffectParameterDeclaration {
             Name = UniformNameDeclarations.DeferredRenderTextures[(int)RenderTargetTextureTypes.Position], Value = srcRenderTarget.RenderTextures[(int)RenderTargetTextureTypes.Position]
         },
         new EffectParameterDeclaration {
             Name = UniformNameDeclarations.DeferredRenderTextures[(int)RenderTargetTextureTypes.Normal], Value = srcRenderTarget.RenderTextures[(int)RenderTargetTextureTypes.Normal]
         },
         new EffectParameterDeclaration {
             Name = UniformNameDeclarations.DeferredRenderTextures[(int)RenderTargetTextureTypes.Albedo], Value = srcRenderTarget.RenderTextures[(int)RenderTargetTextureTypes.Albedo]
         },
         new EffectParameterDeclaration {
             Name = UniformNameDeclarations.DeferredRenderTextures[(int)RenderTargetTextureTypes.Ssao], Value = srcRenderTarget.RenderTextures[(int)RenderTargetTextureTypes.Ssao]
         },
         new EffectParameterDeclaration {
             Name = UniformNameDeclarations.DeferredRenderTextures[(int)RenderTargetTextureTypes.Specular], Value = srcRenderTarget.RenderTextures[(int)RenderTargetTextureTypes.Specular]
         },
         new EffectParameterDeclaration {
             Name = UniformNameDeclarations.IView, Value = float4x4.Identity
         },
         new EffectParameterDeclaration {
             Name = UniformNameDeclarations.View, Value = float4x4.Identity
         },
         new EffectParameterDeclaration {
             Name = UniformNameDeclarations.ITView, Value = float4x4.Identity
         },
         new EffectParameterDeclaration {
             Name = "light.position", Value = new float3(0, 0, -1.0f)
         },
         new EffectParameterDeclaration {
             Name = "light.intensities", Value = float4.Zero
         },
         new EffectParameterDeclaration {
             Name = "light.maxDistance", Value = 0.0f
         },
         new EffectParameterDeclaration {
             Name = "light.strength", Value = 0.0f
         },
         new EffectParameterDeclaration {
             Name = "light.outerConeAngle", Value = 0.0f
         },
         new EffectParameterDeclaration {
             Name = "light.innerConeAngle", Value = 0.0f
         },
         new EffectParameterDeclaration {
             Name = "light.direction", Value = float3.Zero
         },
         new EffectParameterDeclaration {
             Name = "light.lightType", Value = 1
         },
         new EffectParameterDeclaration {
             Name = "light.isActive", Value = 1
         },
         new EffectParameterDeclaration {
             Name = "light.isCastingShadows", Value = 0
         },
         new EffectParameterDeclaration {
             Name = "light.bias", Value = 0.0f
         },
         new EffectParameterDeclaration {
             Name = UniformNameDeclarations.RenderPassNo, Value = 0
         },
         new EffectParameterDeclaration {
             Name = UniformNameDeclarations.BackgroundColor, Value = backgroundColor
         },
         new EffectParameterDeclaration {
             Name = UniformNameDeclarations.SsaoOn, Value = 1
         },
     });
 }
Exemple #2
0
        /// <summary>
        /// Sets a RenderTexture from another RenderTarget at the correct position in the RenderTexure array.
        /// </summary>
        /// <param name="src">The source RenderTarget.</param>
        /// <param name="tex">The type of the texture.</param>
        public void SetTextureFromRenderTarget(RenderTarget src, RenderTargetTextureTypes tex)
        {
            var srcTex = src.RenderTextures[(int)tex];

            RenderTextures[(int)tex] = srcTex ?? throw new ArgumentException("Texture from source target is null!");
        }