示例#1
0
        public WorldSceneConfig(int numFlocks, int numPowerUps, int numTriggers, string map, NetworkSystem network)
        {
            NumFlocks   = numFlocks;
            NumPowerUps = numPowerUps;
            NumTriggers = numTriggers;
            Map         = map;
            Network     = network;
            Map         = map;

            LightConfig = new LightingConfig();
            LightConfig.DiffuseColor  = new Vector3(1, 0.9607844f, 0.8078432f);
            LightConfig.Direction     = new Vector3(-0.5265408f, -0.5735765f, -0.6275069f);
            LightConfig.SpecularColor = new Vector3(1, 0.9607844f, 0.8078432f);
            LightConfig.AmbientColor  = new Vector3(0.05333332f, 0.09882354f, 0.1819608f);

            if (Map == "Tropical") //"DinoIsland"
            {
                IsRaining      = false;
                WaterHeight    = -7;
                HeightMapScale = 300;
                YScaleMap      = 0.1f;
                Playerz        = 0;
                Playerx        = 0;
                colorsMap      = createColorsTropical();

                LightConfig.FogEnabled = true;
                LightConfig.FogStart   = 35;
                LightConfig.FogEnd     = 100;
                LightConfig.ClearColor = new Vector3(0.4f, 0.7f, 0.9f);
            }
            else if (Map == "UpNorth")
            {
                IsRaining = true;
                //HeightMap
                HeightMapScale = 300;
                YScaleMap      = 0.5f;
                WaterHeight    = -58;
                Playerz        = -49;
                Playerx        = -62;
                colorsMap      = createColors();

                LightConfig.FogEnabled = true;
                LightConfig.FogStart   = 10;
                LightConfig.FogEnd     = 90;
                LightConfig.ClearColor = new Vector3(0.45f, 0.5f, 0.6f);
            }
        }
示例#2
0
        private void SetupBasicEffect(BasicEffect effect,
                                      CCamera camera,
                                      C3DRenderable model,
                                      Scene scene,
                                      CTransform transform,
                                      ModelMesh mesh,
                                      Matrix anim,
                                      Matrix boneTransform,
                                      LightingConfig config)
        {
            // TODO: we want the same lighting everywhere so no cheating with this ;) (other shaders dont have this)
            effect.EnableDefaultLighting();

            effect.PreferPerPixelLighting = true;
            effect.VertexColorEnabled     = model.enableVertexColor;
            effect.LightingEnabled        = true;
            effect.AmbientLightColor      = config.AmbientColor;

            effect.DirectionalLight0.Enabled       = true;
            effect.DirectionalLight0.Direction     = config.Direction;
            effect.DirectionalLight0.DiffuseColor  = config.DiffuseColor;
            effect.DirectionalLight0.SpecularColor = config.SpecularColor * model.specular;

            effect.DirectionalLight1.Enabled       = true;
            effect.DirectionalLight1.DiffuseColor  = config.DiffuseColor * 0.7f;
            effect.DirectionalLight1.SpecularColor = config.SpecularColor * model.specular;

            effect.DirectionalLight2.Enabled       = true;
            effect.DirectionalLight2.DiffuseColor  = config.DiffuseColor * 0.5f;
            effect.DirectionalLight2.SpecularColor = config.SpecularColor * model.specular;

            effect.SpecularPower = 100;

            effect.FogEnabled = config.FogEnabled;
            effect.FogStart   = config.FogStart;
            effect.FogEnd     = config.FogEnd;
            effect.FogColor   = config.ClearColor;

            effect.Projection = camera.Projection;
            effect.View       = camera.View;
            effect.World      = boneTransform * anim * transform.Frame;
        }