Ejemplo n.º 1
0
        /// <summary>
        /// Looks up shortcut references to our effect parameters.
        /// </summary>
        void CacheEffectParameters(SkinnedEffect cloneSource)
        {
            textureParam               = Parameters["Texture"];
            diffuseColorParam          = Parameters["DiffuseColor"];
            emissiveColorParam         = Parameters["EmissiveColor"];
            specularColorParam         = Parameters["SpecularColor"];
            specularPowerParam         = Parameters["SpecularPower"];
            eyePositionParam           = Parameters["EyePosition"];
            fogColorParam              = Parameters["FogColor"];
            fogVectorParam             = Parameters["FogVector"];
            worldParam                 = Parameters["World"];
            worldInverseTransposeParam = Parameters["WorldInverseTranspose"];
            worldViewProjParam         = Parameters["WorldViewProj"];
            bonesParam                 = Parameters["Bones"];
            shaderIndexParam           = Parameters["ShaderIndex"];

            light0 = new DirectionalLight(Parameters["DirLight0Direction"],
                                          Parameters["DirLight0DiffuseColor"],
                                          Parameters["DirLight0SpecularColor"],
                                          (cloneSource != null) ? cloneSource.light0 : null);

            light1 = new DirectionalLight(Parameters["DirLight1Direction"],
                                          Parameters["DirLight1DiffuseColor"],
                                          Parameters["DirLight1SpecularColor"],
                                          (cloneSource != null) ? cloneSource.light1 : null);

            light2 = new DirectionalLight(Parameters["DirLight2Direction"],
                                          Parameters["DirLight2DiffuseColor"],
                                          Parameters["DirLight2SpecularColor"],
                                          (cloneSource != null) ? cloneSource.light2 : null);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a new SkinnedEffect by cloning parameter settings from an existing instance.
        /// </summary>
        protected SkinnedEffect(SkinnedEffect cloneSource)
            : base(cloneSource)
        {
            CacheEffectParameters(cloneSource);

            preferPerPixelLighting = cloneSource.preferPerPixelLighting;
            fogEnabled             = cloneSource.fogEnabled;

            world      = cloneSource.world;
            view       = cloneSource.view;
            projection = cloneSource.projection;

            diffuseColor      = cloneSource.diffuseColor;
            emissiveColor     = cloneSource.emissiveColor;
            ambientLightColor = cloneSource.ambientLightColor;

            alpha = cloneSource.alpha;

            fogStart = cloneSource.fogStart;
            fogEnd   = cloneSource.fogEnd;

            weightsPerVertex = cloneSource.weightsPerVertex;
        }