public void Render(IGameContext gameContext, IRenderContext renderContext, ILightContext lightContext, IEnumerable <ILight> lights) { if (!_directionalLightEffect.IsReady) { return; } foreach (var ulight in lights) { var light = (IStandardDirectionalLight)ulight; var parameterSet = _directionalLightEffect.Asset.Effect.CreateParameterSet(); parameterSet["Color"]?.SetValue(lightContext.DeferredColorMap); parameterSet["Normal"]?.SetValue(lightContext.DeferredNormalMap); parameterSet["Depth"]?.SetValue(lightContext.DeferredDepthMap); parameterSet["LightDirection"]?.SetValue(light.LightDirection); parameterSet["LightColor"]?.SetValue(light.LightColor.ToVector3()); parameterSet["HalfPixel"]?.SetValue(lightContext.HalfPixel); _graphicsBlit.BlitMRT( renderContext, null, new[] { lightContext.DiffuseLightRenderTarget, lightContext.SpecularLightRenderTarget }, _directionalLightEffect.Asset.Effect, parameterSet, lightContext.LightBlendState); } }
public CategoryController( ILoggerFactory loggerFactory, IMediator mediator, ILightContext context, ILightTelemetry telemetry, ILocalization localization) : base(loggerFactory, mediator, context, telemetry, localization) { }
public GetGenericEntityQueryHandler( IMediator mediatorService, ILightContext contextService, ILightTelemetry telemetryService, IMapper mapperService, ILogger <GetGenericEntityQueryHandler <TEntity, TIdentifier> > logger) : base(mediatorService, contextService, telemetryService, mapperService) { _logger = logger; }
/// <summary> /// Verify if context was received otherwise create the context with mock /// </summary> /// <param name="token">Token</param> private void CheckContext(string token) { if (_context == null) { _context = new LightContext(); } if (_context.User == null) { _context.User = JwtSecurityCustom.VerifyTokenReceived(token); } }
public ListMoviesCommandHandler(IMediator mediatorService, ILightContext contextService, ILightTelemetry telemetryService, IMapper mapperService, IMovieServiceClient movieService) : base(mediatorService, contextService, telemetryService, mapperService) { _movieService = movieService; }
public void Render(IGameContext gameContext, IRenderContext renderContext, ILightContext lightContext) { var oldRasterizerState = renderContext.GraphicsDevice.RasterizerState; var oldWorld = renderContext.World; _parameterSet.Unlock(); _parameterSet["Color"]?.SetValue(lightContext.DeferredColorMap); _parameterSet["Normal"]?.SetValue(lightContext.DeferredNormalMap); _parameterSet["Depth"]?.SetValue(lightContext.DeferredDepthMap); _parameterSet["Specular"]?.SetValue(lightContext.DeferredSpecularMap); _parameterSet["CameraPosition"]?.SetValue(renderContext.CameraPosition); _parameterSet["LightPosition"]?.SetValue(LightPosition); _parameterSet["LightColor"]?.SetValue(LightColor.ToVector3()); _parameterSet["LightRadius"]?.SetValue(LightRadius); _parameterSet["LightIntensity"]?.SetValue(LightIntensity); _parameterSet["LightInvertViewProjection"]?.SetValue(Matrix.Invert(renderContext.View * renderContext.Projection)); _parameterSet["World"]?.SetValue(renderContext.World); _parameterSet["View"]?.SetValue(renderContext.View); _parameterSet["Projection"]?.SetValue(renderContext.Projection); // If we are inside the lighting sphere, we need to invert the culling mode so // that we see the inside faces of the model. float cameraToCenter = Vector3.Distance(renderContext.CameraPosition, LightPosition); if (cameraToCenter < LightRadius) { renderContext.GraphicsDevice.RasterizerState = lightContext.RasterizerStateCullClockwiseFace; } else { renderContext.GraphicsDevice.RasterizerState = lightContext.RasterizerStateCullCounterClockwiseFace; } renderContext.World = Matrix.CreateScale(LightRadius) * Matrix.CreateTranslation(LightPosition); if (lightContext.DiffuseLightRenderTarget != null && lightContext.SpecularLightRenderTarget != null) { renderContext.PushRenderTarget(lightContext.DiffuseLightRenderTarget, lightContext.SpecularLightRenderTarget); } _pointLightSphereModel.Render(renderContext, _pointLightEffect.Effect, _parameterSet, Matrix.Identity); if (lightContext.DiffuseLightRenderTarget != null && lightContext.SpecularLightRenderTarget != null) { renderContext.PopRenderTarget(); } renderContext.World = oldWorld; renderContext.GraphicsDevice.RasterizerState = oldRasterizerState; }
public GetMovieCommandHandler(IMediator mediatorService, ILightContext contextService, ILightTelemetry telemetryService, IMapper mapperService, IMovieServiceClient movieService, ILightCache cache, IOptions <CacheConfig> cacheConfig, ILightProducer <MovieAudience> lightProducer) : base(mediatorService, contextService, telemetryService, mapperService) { _movieService = movieService; _cache = cache; _cacheConfig = cacheConfig.Value; _lightProducer = lightProducer; }
public void Render(IGameContext gameContext, IRenderContext renderContext, ILightContext lightContext) { var parameterSet = _directionalLightEffect.Effect.CreateParameterSet(); parameterSet["Color"]?.SetValue(lightContext.DeferredColorMap); parameterSet["Normal"]?.SetValue(lightContext.DeferredNormalMap); parameterSet["Depth"]?.SetValue(lightContext.DeferredDepthMap); parameterSet["LightDirection"]?.SetValue(LightDirection); parameterSet["LightColor"]?.SetValue(LightColor.ToVector3()); parameterSet["HalfPixel"]?.SetValue(lightContext.HalfPixel); _graphicsBlit.BlitMRT( renderContext, null, new[] { lightContext.DiffuseLightRenderTarget, lightContext.SpecularLightRenderTarget }, _directionalLightEffect.Effect, parameterSet, lightContext.LightBlendState); }