Exemple #1
0
 public void SetLights(ref Water water)
 {
     water.AmbientLightColor = ambientLightColor;
     water.LightDirection = directionToSun;
 }
        public override void LoadContent(Microsoft.Xna.Framework.Content.ContentManager content, ParameterSet parm, Stage stage)
        {
            if (contentLoaded)
                return;

            bool initialized = false;

            model = BasicModelLoad(parm, out initialized);

            if (!initialized)
            {
                foreach (ModelMesh mesh in model.Meshes)
                {
                    foreach (ModelMeshPart part in mesh.MeshParts)
                    {
                        Water effect = new Water(content.Load<Effect>("Effects/v2/Water"));
                        if (stage.Parm.HasParm("WaterSpecularPower"))
                            effect.SpecularPower = stage.Parm.GetFloat("WaterSpecularPower");
                        if (stage.Parm.HasParm("WaterShininess"))
                            effect.Shininess = stage.Parm.GetFloat("WaterShininess");
                        if (stage.Parm.HasParm("WaterColor"))
                            effect.WaterColor = stage.Parm.GetVector4("WaterColor");
                        if (stage.Parm.HasParm("WaterBase"))
                            effect.WaterBase = stage.Parm.GetVector4("WaterBase");
                        part.Effect = effect;
                    }
                }
            }

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

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