コード例 #1
0
        /// <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);
                }
            }
        }
コード例 #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}");
     }
 }
コード例 #3
0
ファイル: Pbr.cs プロジェクト: Gribochek277/IeCore
        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);
        }
コード例 #4
0
ファイル: SimpleDiffuse.cs プロジェクト: Gribochek277/IeCore
        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);
            }
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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;
            });
        }
コード例 #7
0
 public AnimeInfoController(IAnimeInfo animeInfo, IPipelineData pipelineData)
 {
     m_animeInfo    = animeInfo;
     m_pipelineData = pipelineData;
 }
コード例 #8
0
 IPipelineConfig IPipelineConfig.UseData(IPipelineData data)
 {
     Data = data;
     return(this);
 }
コード例 #9
0
 public abstract Task InvokeAsync(IPipelineData data);
コード例 #10
0
 public OpenglRenderer(IUniformHelper uniformHelper, IPipelineData pipelineData)
 {
     _uniformHelper = uniformHelper;
     _pipelineData  = pipelineData;
 }