public override void SetupInitialization(ShaderInitializer initializer)
        {
            var services  = initializer.Services;
            var technique = initializer.Technique;

            var scene = services.GetService <IEntityProvider>();
            var data  = from e in scene.Entities
                        where e.ContainsComponent <MaterialComponent>()
                        let techniqueComponents = e.Components.OfType <ITechniqueComponent>()
                                                  from techniqueRange in techniqueComponents
                                                  from t in techniqueRange.Techniques
                                                  where t.Name == technique.Name
                                                  group e.Id by e.GetComponent <MaterialComponent>()
                                                  into materialEntities
                                                  select new { Material = materialEntities.Key, Entities = materialEntities.ToArray() };

            foreach (var kvp in data)
            {
                foreach (var entityId in kvp.Entities)
                {
                    InitializerParameters parameters = new InitializerParameters(entityId, technique, services, InstanceSelector);
                    initializer.Initialize(this, (IMaterial)kvp.Material, parameters);
                }
            }
        }
Example #2
0
        public override void SetupInitialization(ShaderInitializer initializer)
        {
            var services = initializer.Services;
            var settings = services.GetService <IGraphicsDeviceService>();

            InitializerParameters parameters = new InitializerParameters(-1, initializer.Technique, services, StaticSelector);

            initializer.Initialize(this, settings, parameters);
        }
Example #3
0
        public override void SetupInitialization(ShaderInitializer initializer)
        {
            var services  = initializer.Services;
            var technique = initializer.Technique;
            InitializerParameters parameters = new InitializerParameters(-1, technique, services, StaticSelector);
            var data = from metaData in technique.MetaData
                       where metaData.Key == Param.Properties.LightId
                       select Int32.Parse(metaData.Value);

            ILightService lightService = services.GetService <ILightService>();

            foreach (int lightId in data)
            {
                initializer.Initialize(this, lightService[lightId], parameters);
            }
        }
Example #4
0
        public override void SetupInitialization(ShaderInitializer initializer)
        {
            var services  = initializer.Services;
            var technique = initializer.Technique;

            var scene = services.GetService <IEntityProvider>();

            var data = from e in scene.Entities
                       let techniqueComponents = e.Components.OfType <ITechniqueComponent>()
                                                 from cTechnique in techniqueComponents
                                                 from t in cTechnique.Techniques
                                                 where t.Name == technique.Name
                                                 select e.Id;

            foreach (long entityId in data)
            {
                InitializerParameters parameters = new InitializerParameters(entityId, technique, services, InstanceSelector);
                initializer.Initialize(this, scene.SelectEntity(entityId), parameters);
            }
        }
Example #5
0
        public override void SetupInitialization(ShaderInitializer initializer)
        {
            var services  = initializer.Services;
            var scene     = services.GetService <IEntityProvider>();
            var technique = initializer.Technique;
            InitializerParameters parameters = new InitializerParameters(-1, technique, services, StaticSelector);
            var data = from metaData in technique.MetaData
                       where metaData.Key == Param.Properties.CameraId
                       select Int32.Parse(metaData.Value);

            var cameras = (from e in scene.Entities
                           where e.ContainsComponent <CameraComponent>()
                           let cameraComponent = e.GetComponent <CameraComponent>()
                                                 select new { Entity = e, CameraComponent = cameraComponent }).ToDictionary(kvp => kvp.CameraComponent.Index, kvp => kvp.Entity);

            foreach (int cameraId in data)
            {
                initializer.Initialize(this, cameras[cameraId], parameters);
            }
        }
Example #6
0
 public abstract void SetupInitialization(ShaderInitializer initializer);