Beispiel #1
0
        public static LightingSetup[] FromXml(XmlDocument xml)
        {
            XmlNodeList setupNodes = xml.SelectNodes("configuration/lightingPresets/lightingSetup");

            if (setupNodes != null && setupNodes.Count > 0)
            {
                LightingSetup[] setups = new LightingSetup[setupNodes.Count];
                for (int i = 0; i < setupNodes.Count; i++)
                {
                    setups[i]      = new LightingSetup();
                    setups[i].name = setupNodes[i].Attributes["name"].InnerText;
                    foreach (XmlNode node in setupNodes[i].ChildNodes)
                    {
                        if (node is XmlElement)
                        {
                            if (node.Name == "light")
                            {
                                string type = node.Attributes["type"].InnerText;
                                if (type == "directional")
                                {
                                    setups[i].lights.Add(DirectionalLight.FromXml((XmlElement)node));
                                }
                            }
                        }
                    }
                }
                return(setups);
            }
            return(null);
        }
 public override void SetupWithLights(LightingSetup setup)
 {
 }
 public abstract void SetupWithLights(LightingSetup setup);
 public static LightingSetup[] FromXml(XmlDocument xml)
 {
     XmlNodeList setupNodes = xml.SelectNodes("configuration/lightingPresets/lightingSetup");
     if (setupNodes != null && setupNodes.Count > 0)
     {
         LightingSetup[] setups = new LightingSetup[setupNodes.Count];
         for (int i = 0; i < setupNodes.Count; i++)
         {
             setups[i] = new LightingSetup();
             setups[i].name = setupNodes[i].Attributes["name"].InnerText;
             foreach (XmlNode node in setupNodes[i].ChildNodes)
             {
                 if (node is XmlElement)
                 {
                     if (node.Name == "light")
                     {
                         string type = node.Attributes["type"].InnerText;
                         if (type == "directional")
                             setups[i].lights.Add(DirectionalLight.FromXml((XmlElement)node));
                     }
                 }
             }
         }
         return setups;
     }
     return null;
 }
        public MoleculeSceneManager(Device device, OutputSettings outSettings)
            : base(device)
        {
            
            screenEntities = new List<IScreenSpaceEntity>();
            postSceneWorldEntities = new List<IEntity>();
            postSceneViewEntities = new List<ViewSpaceEntity>();
            zCompareViewEntities = new SortedList<float, ViewSpaceEntity>();

            //effect = new ShadowMappingEffect(device, HashTableSettings.Instance, 1);//PPixelLightEffect(device, HashTableSettings.Instance, 1);
            effect = new PPixelLightEffect(device, HashTableSettings.Instance, 1);
            effect.LoadResources();

            LightingSetup setup = new LightingSetup();
            DirectionalLight light = new DirectionalLight();
            light.Clr = Color.White;
            light.Direction = new Vector3(1, -1, -1);
            light.Enabled = true;
            setup.lights.Add(light);

            effect.SetupWithLights(setup);
            effect.SetupForDevice(this.outSettings = outSettings);
            
            /*ppEffect = new BloomEffect(device, HashTableSettings.Instance);
            ppEffect.LoadResources();
            ppEffect.SetupWithLights(setup);*/
            effect.SetupForDevice(this.outSettings);
        }
        public void SetEffect(RenderingEffect effect)
        {
            this.effect = effect;
            effect.LoadResources();

            LightingSetup setup = new LightingSetup();
            DirectionalLight light = new DirectionalLight();
            light.Clr = Color.White;
            light.Direction = new Vector3(1, 1, -1);
            light.Enabled = true;
            setup.lights.Add(light);
            effect.SetupWithLights(setup);
            effect.SetupForDevice(outSettings);
        }
 public override void SetupWithLights(LightingSetup setup)
 {
     if (setup == null)
     {
         setup = new LightingSetup();
         DirectionalLight light = new DirectionalLight();
         light.Clr = Color.White;
         light.Direction = new Vector3(1, -1, -1);
         light.Enabled = true;
         light.Name = "light0";
         setup.lights.Add(light);
     }
     this.setup = setup;
 }