Example #1
0
 // called when drawing for real
 public void SetLights(ref BaseEffect effect)
 {
     effect.LightColor = lightColor;
     effect.AmbientLightColor = ambientLightColor;
     effect.LightDirection = directionToSun;
     effect.ShadowMap = shadowMap;
     effect.TexelSize = TexelSize;
     effect.LightViewProjections = this.LightViewProjectionMatrices;
     effect.ClipPlanes = this.LightClipPlanes;
     #if TUNE_DEPTH_BIAS
     effect.Parameters["DepthBias"].SetValue(DepthBias);
     #endif
 }
Example #2
0
 // called when drawing to shadow map
 public void SetLightViewProjection(ref BaseEffect effect)
 {
     effect.LightViewProjection = this.lightViewProjectionMatrix;
 }
        public override void LoadContent(Microsoft.Xna.Framework.Content.ContentManager content, ParameterSet parm, Stage stage)
        {
            if (contentLoaded)
                return;

            Texture2D diffuse = null;
            Texture2D bumpMap = null;
            Texture2D specularMap = null;
            bool initialized = false;

            model = BasicModelLoad(parm, out initialized);

            if (!initialized)
            {
                foreach (ModelMesh mesh in Model.Meshes)
                {
                    foreach (ModelMeshPart part in mesh.MeshParts)
                    {
                        if (IsBumpMapped && IsSpecularMapped)
                        {
                            BumpedSpecularEffect effect = new BumpedSpecularEffect(content.Load<Effect>("Effects/v2/BumpedWithSpecular"));
                            effect.Shininess = Shininess;
                            effect.SpecularPower = SpecularPower;
                            part.Effect = effect;
                        }
                        else if (IsBumpMapped && !IsSpecularMapped)
                        {
                            BumpedEffect effect = new BumpedEffect(content.Load<Effect>("Effects/v2/Bumped"));
                            effect.Shininess = Shininess;
                            effect.SpecularPower = SpecularPower;
                            part.Effect = effect;
                        }
                        else if (!IsBumpMapped && !IsSpecularMapped)
                        {
                            BaseEffect effect = new BaseEffect(content.Load<Effect>("Effects/v2/Basic"));
                            effect.Shininess = Shininess;
                            effect.SpecularPower = SpecularPower;
                            part.Effect = effect;
                        }
                    }
                }
            }

            transforms = new Matrix[model.Bones.Count];
            model.CopyAbsoluteBoneTransformsTo(transforms);

            base.LoadContent(content, parm, stage);
        }