/// <summary>
        /// Run all the <see cref="WorkStation"/> in the order the have been added
        /// </summary>
        /// <param name="pipelineData">The data which will be passed between all the <see cref="WorkStation"/> <seealso cref="IPipelineData"/></param>
        /// <param name="retryOptions"></param>
        /// <returns>A task which will be responsible for the whole execution of the pipeline</returns>
        /// <exception cref="EasyPipelineException"></exception>
        public async Task Run(IPipelineData pipelineData)
        {
            while (_workStations.TryDequeue(out var workStation))
            {
                try
                {
                    var retryAttribute =
                        (AutoRetryAttribute)Attribute.GetCustomAttribute(workStation.GetType(), typeof(AutoRetryAttribute));

                    //retry if demanded
                    if (retryAttribute != null)
                    {
                        await workStation.InvokeAsync(pipelineData).Retry(new RetryOptions()
                        {
                            Attempts            = retryAttribute.Attempts,
                            DelayBetweenRetries = TimeSpan.FromSeconds(retryAttribute.DelaySeconds),
                        });
                    }
                    else
                    {
                        await workStation.InvokeAsync(pipelineData);
                    }
                }
                catch (Exception e)
                {
                    throw new EasyPipelineException(
                              $"Pipeline has failed to continue please check inner exception for more details", e);
                }
            }
        }
Esempio n. 2
0
 public AnimePipeline(IEnumerable <IMediaService> services, IMediaPipelineDatabase database, IPipelineData data, ILocalMediaDatabase local)
 {
     m_services      = services;
     m_database      = database;
     m_data          = data;
     m_localDatabase = local;
     foreach (IMediaService service in m_services)
     {
         Console.WriteLine($"Added Service: {service.GetType().Name}");
     }
 }
Esempio n. 3
0
        public void SetSpecificUniforms(IPipelineData pipelineData)
        {
            int texId = -1;
            int normId = -1; 
            int metRoughId = -1;
            int metallicId = -1;
            int roughnessId = -1;
            int ambientId = -1; 


            Textures.TryGetValue(Materials.FirstOrDefault().Value.DiffuseMap, out texId);
            Textures.TryGetValue(Materials.FirstOrDefault().Value.NormalMap, out normId);
            Textures.TryGetValue(Materials.FirstOrDefault().Value.MetallicRoughness, out metRoughId);
            Textures.TryGetValue(Materials.FirstOrDefault().Value.Metallic, out metallicId);
            Textures.TryGetValue(Materials.FirstOrDefault().Value.Roughness, out roughnessId);
            Textures.TryGetValue(Materials.FirstOrDefault().Value.AmbientMap, out ambientId);

            _uniformHelper.TryAddUniformTexture2D(texId, maintexture, shaderProg, TextureUnit.Texture0);

             _uniformHelper.TryAddUniformTexture2D(normId, normaltexture, shaderProg, TextureUnit.Texture1);

             _uniformHelper.TryAddUniformTexture2D(metRoughId, metallicRoughness, shaderProg, TextureUnit.Texture2);

            _uniformHelper.TryAddUniformTexture2D(metallicId, metallic, shaderProg, TextureUnit.Texture2);
            _uniformHelper.TryAddUniformTexture2D(roughnessId, roughness, shaderProg, TextureUnit.Texture2);

            _uniformHelper.TryAddUniformTexture2D(ambientId, amibenOclussionMap, shaderProg, TextureUnit.Texture3);
            
             _uniformHelper.TryAddUniformTextureCubemap(pipelineData.SkyboxComponent.IrradianceMap, irradianceMap, shaderProg, TextureUnit.Texture4);

             _uniformHelper.TryAddUniformTextureCubemap(pipelineData.SkyboxComponent.PrefilteredMap, prefilterMap, shaderProg, TextureUnit.Texture5);
      
             _uniformHelper.TryAddUniformTexture2D(pipelineData.SkyboxComponent.BrdfMap, brdf, shaderProg, TextureUnit.Texture6);

            _uniformHelper.TryAddUniform1(randomCoeff, "randomCoeff", shaderProg);

              _uniformHelper.TryAddUniform1(pipelineData.Lights.Count(), numberOfLights, shaderProg);
                Vector3[] lightpositions = new Vector3[pipelineData.Lights.Count()];
                Vector3[] lightcolors = new Vector3[pipelineData.Lights.Count()];
                for (int j = 0; j < pipelineData.Lights.Count; ++j) {
                    var lightComponent =  (PointLightSceneObjectComponent)pipelineData.Lights[j].components["PointLightSceneObjectComponent"];
                    lightcolors[j] = lightComponent.Color * lightComponent.LightStrenght;
                    lightpositions[j] = pipelineData.Lights[j].Position;
                }

                bool suc = _uniformHelper.TryAddUniform1(lightcolors, lightColor, shaderProg);
                bool suc2 = _uniformHelper.TryAddUniform1(lightpositions, lightPosition, shaderProg);

                _uniformHelper.TryAddUniform1(pipelineData.Cam.Position, cameraPosition, shaderProg);

                _uniformHelper.TryAddUniform1(Materials.FirstOrDefault().Value.NormalScale, "normalScale", shaderProg);
        }
Esempio n. 4
0
        public void SetSpecificUniforms(IPipelineData pipelineData)
        {
            int  texId;
            bool isTexPresent = Textures.TryGetValue(Materials.FirstOrDefault().Value.DiffuseMap, out texId);

            if (isTexPresent)
            {
                _uniformHelper.TryAddUniformTexture2D(texId, maintexture, shaderProg, TextureUnit.Texture0);
                _uniformHelper.TryAddUniform1(1, isTextured, shaderProg);
            }
            else
            {
                _uniformHelper.TryAddUniform1(0, isTextured, shaderProg);
            }
        }
        public override Task InvokeAsync(IPipelineData data)
        {
            Test.Logger.LogTrace(nameof(CheckoutWorkStation));

            if (!(data is OrderData order))
            {
                throw new ArgumentNullException();
            }
            order.State = nameof(CheckoutWorkStation);

            Test.Logger.LogInformation($"State:{nameof(CheckoutWorkStation)} objectState: " +
                                       $"{JsonConvert.SerializeObject(order)}");

            return(Task.CompletedTask);
        }
        public override async Task InvokeAsync(IPipelineData data)
        {
            Test.Logger.LogTrace(nameof(ProducingWorkStation));

            if (!(data is OrderData order))
            {
                throw new ArgumentNullException();
            }
            order.State = nameof(ProducingWorkStation);

            Test.Logger.LogInformation(message: $"State:{nameof(ProducingWorkStation)} objectState: " +
                                       $"{JsonConvert.SerializeObject(order)}");

            // var result = 1 / order.Digit;

            await Task.Run(() =>
            {
                var result = 1 / order.Digit;
            });
        }
Esempio n. 7
0
 public AnimeInfoController(IAnimeInfo animeInfo, IPipelineData pipelineData)
 {
     m_animeInfo    = animeInfo;
     m_pipelineData = pipelineData;
 }
Esempio n. 8
0
 IPipelineConfig IPipelineConfig.UseData(IPipelineData data)
 {
     Data = data;
     return(this);
 }
 public abstract Task InvokeAsync(IPipelineData data);
Esempio n. 10
0
 public OpenglRenderer(IUniformHelper uniformHelper, IPipelineData pipelineData)
 {
     _uniformHelper = uniformHelper;
     _pipelineData  = pipelineData;
 }