Axiom.Demos.Compositor.HdrLogic.SetCompositor C# (CSharp) Method

SetCompositor() public method

public SetCompositor ( CompositorInstance compositor ) : void
compositor Axiom.Graphics.CompositorInstance
return void
			public void SetCompositor( CompositorInstance compositor )
			{
				// Get some RTT dimensions for later calculations
				foreach ( CompositionTechnique.TextureDefinition textureDefinition in compositor.Technique.TextureDefinitions )
				{
					if ( textureDefinition.Name == "rt_bloom0" )
					{
						bloomSize = (int)textureDefinition.Width; // should be square
						// Calculate gaussian texture offsets & weights
						float deviation = 3.0f;
						float texelSize = 1.0f / (float)bloomSize;

						// central sample, no offset
						bloomTexOffsetsHorz[ 0 ] = 0.0f;
						bloomTexOffsetsHorz[ 1 ] = 0.0f;
						bloomTexOffsetsVert[ 0 ] = 0.0f;
						bloomTexOffsetsVert[ 1 ] = 0.0f;
						bloomTexWeights[ 0 ] = bloomTexWeights[ 1 ] = bloomTexWeights[ 2 ] = Utility.GaussianDistribution( 0, 0, deviation );
						bloomTexWeights[ 3 ] = 1.0f;

						// 'pre' samples
						for ( int i = 1; i < 8; ++i )
						{
							int offset = i * 4;
							bloomTexWeights[ offset + 0 ] = bloomTexWeights[ offset + 1 ] = bloomTexWeights[ offset + 2 ] = 1.25f * Utility.GaussianDistribution( i, 0, deviation );
							bloomTexWeights[ offset + 3 ] = 1.0f;
							bloomTexOffsetsHorz[ offset + 0 ] = i * texelSize;
							bloomTexOffsetsHorz[ offset + 1 ] = 0.0f;
							bloomTexOffsetsVert[ offset + 0 ] = 0.0f;
							bloomTexOffsetsVert[ offset + 1 ] = i * texelSize;
						}
						// 'post' samples
						for ( int i = 8; i < 15; ++i )
						{
							int offset = i * 4;
							bloomTexWeights[ offset + 0 ] = bloomTexWeights[ offset + 1 ] =
															bloomTexWeights[ offset + 2 ] = bloomTexWeights[ offset - 7 * 4 + 0 ];
							bloomTexWeights[ offset + 3 ] = 1.0f;

							bloomTexOffsetsHorz[ offset + 0 ] = -bloomTexOffsetsHorz[ offset - 7 * 4 + 0 ];
							bloomTexOffsetsHorz[ offset + 1 ] = 0.0f;
							bloomTexOffsetsVert[ offset + 0 ] = 0.0f;
							bloomTexOffsetsVert[ offset + 1 ] = -bloomTexOffsetsVert[ offset - 7 * 4 + 1 ];
						}
					}
				}
			}