public override void VisitFeature(MaterialGeneratorContext context)
        {
            var shaderSource = new ShaderMixinSource();

            shaderSource.Mixins.Add(new ShaderClassSource("MaterialSurfaceShadingSpecularCelShading"));

            if (RampFunction != null)
            {
                shaderSource.AddComposition("celLightFunction", RampFunction.Generate(context));
            }

            if (Fresnel != null)
            {
                shaderSource.AddComposition("fresnelFunction", Fresnel.Generate());
            }

            if (Visibility != null)
            {
                shaderSource.AddComposition("geometricShadowingFunction", Visibility.Generate());
            }

            if (NormalDistribution != null)
            {
                shaderSource.AddComposition("normalDistributionFunction", NormalDistribution.Generate());
            }

            context.AddShading(this, shaderSource);
        }
Ejemplo n.º 2
0
    public static void fresnel_cos_values_test()
    //****************************************************************************80
    //
    //  Purpose:
    //
    //    FRESNEL_COS_VALUES_TEST tests FRESNEL_COS_VALUES.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    12 June 2007
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        double fx = 0;
        double x  = 0;

        Console.WriteLine("");
        Console.WriteLine("FRESNEL_COS_VALUES_TEST:");
        Console.WriteLine("  FRESNEL_COS_VALUES stores values of");
        Console.WriteLine("  the Fresnel cosine integral C(X).");
        Console.WriteLine("");
        Console.WriteLine("      X           C(X)");
        Console.WriteLine("");
        int n_data = 0;

        for (;;)
        {
            Fresnel.fresnel_cos_values(ref n_data, ref x, ref fx);
            if (n_data == 0)
            {
                break;
            }

            Console.WriteLine("  "
                              + x.ToString(CultureInfo.InvariantCulture).PadLeft(12) + "  "
                              + fx.ToString("0.################").PadLeft(24) + "");
        }
    }
Ejemplo n.º 3
0
        public virtual void Visit(MaterialGeneratorContext context)
        {
            var shaderSource = new ShaderMixinSource();

            shaderSource.Mixins.Add(new ShaderClassSource("MaterialSurfaceShadingSpecularMicrofacet"));

            if (Fresnel != null)
            {
                shaderSource.AddComposition("fresnelFunction", Fresnel.Generate());
            }

            if (Visibility != null)
            {
                shaderSource.AddComposition("geometricShadowingFunction", Visibility.Generate());
            }

            if (NormalDistribution != null)
            {
                shaderSource.AddComposition("normalDistributionFunction", NormalDistribution.Generate());
            }

            context.AddShading(this, shaderSource);
        }
Ejemplo n.º 4
0
 public ReflectiveMaterial(SampledSpectrum spectrum = null, Fresnel fresnel = null)
 {
     _specular = new SpecularReflection(1, spectrum ?? SampledSpectrum.Random());
 }
Ejemplo n.º 5
0
 public MicrofacetReflection(TrowbridgeReitzDistribution distribution, Fresnel fresnel, RgbColor tint)
 {
     this.distribution = distribution;
     this.fresnel      = fresnel;
     this.tint         = tint;
 }