Esempio n. 1
0
        public override void Validate(TechniqueKey key)
        {
            base.Validate(key);
            if (LightingMethod == null)
            {
                LightingMethod = new PhongLighting();
            }

            LightingMethod.ActivateSignature(key);

            LightingMethod.SetFlag(SpecularFlag, Specular);
            LightingMethod.SetFlag(DiffuseMapFlag, DiffuseMap);
            LightingMethod.SetFlag(CubeMapFlag, CubeMap);
            LightingMethod.SetFlag(ShadowsFlag, Shadows);

            if (!Shadows)
            {
                return;
            }

            shadowMethod = new PCFShadows();
            shadowMethod.ActivateSignature(key);
            LightingMethod.AddReference(new MethodReference(shadowMethod, new[] {
                MethodBase.Vectors.ShadowProjection,
                ShadowMapSample.Texture.FullName,
                ShadowMapSample.Sampler.FullName
            }));
        }
Esempio n. 2
0
 public override string Access()
 {
     if (DiffuseMap || CubeMap)
     {
         return(LightingMethod.Call(Light.Reference, Material.Reference, LightDirection.Reference,
                                    ViewDirection.Reference, Normal.Reference, DiffuseMapSample.Reference));
     }
     else if (Shadows)
     {
         return(LightingMethod.Call(Light.Reference, Material.Reference, LightDirection.Reference,
                                    ViewDirection.Reference, Normal.Reference, ShadowMapSample.Reference));
     }
     else
     {
         return(LightingMethod.Call(Light.Reference, Material.Reference, LightDirection.Reference,
                                    ViewDirection.Reference, Normal.Reference));
     }
 }
Esempio n. 3
0
 public override string Access()
 {
     return(LightingMethod.Call((Struct)Light.Output, (Struct)Material.Output, (Vector)LightDirection.Output,
                                (Vector)ViewDirection.Output, (Vector)Normal.Output,
                                (Vector)DiffuseMapSample.Coordinates.Output));
 }