public void RegisterLighting() { if (lightingRegistered) { return; } lightingRegistered = true; // Add LightProcessor if used in effect config file LightingPrepassPlugin lightingPrepassPlugin; LightingPlugin lightingPlugin; RenderConfigContext.RenderPassPlugins.TryGetValueCast("LightingPrepassPlugin", out lightingPrepassPlugin); RenderConfigContext.RenderPassPlugins.TryGetValueCast("LightingPlugin", out lightingPlugin); if (lightingPrepassPlugin != null || lightingPlugin != null) { RenderTargetsPlugin editorTargetPlugin; RenderConfigContext.RenderPassPlugins.TryGetValueCast("EditorTargetPlugin", out editorTargetPlugin); var lightProcessor = new LightProcessor(lightingPlugin, editorTargetPlugin, lightingPrepassPlugin != null ? lightingPrepassPlugin.Lights : null, false); entitySystem.Processors.Add(lightProcessor); // LightShafts enabled? RenderPass lightShaftsPass; if (RenderConfigContext.RenderPasses.TryGetValue("LightShaftsPass", out lightShaftsPass)) { entitySystem.Processors.Add(new LightShaftsProcessor(MainPlugin, MainTargetPlugin, lightShaftsPass)); } entitySystem.Processors.Add(new LightReceiverProcessor(lightProcessor)); } }
public void BuildColumn(IEnumerable <BatchUpdateItem <LightBlockItem> > fill) { var lightProcessor = new LightProcessor(ChunkSize, ChunkSize, ChunkSize); var chunkPool = PoolManager.GetObjectPool <Chunk>(); foreach (var batchUpdateItem in fill) { var pos = batchUpdateItem.Position; var chunkIndex = pos.y / ChunkSize; IChunk chunk; if (chunkIndex < _chunks.Count) { chunk = _chunks[chunkIndex]; } else { if (batchUpdateItem.Item.Block.Equals(BlockFactory.Empty) || batchUpdateItem.Item.Block.Equals(BlockFactory.BottomOfWorld)) { continue; } var newChunk = chunkPool.Pop(); newChunk.Initiailize(new Vector3Int(Offset.x, chunkIndex * ChunkSize, Offset.y), ColumnId + chunkIndex); _chunks.Add(newChunk); chunk = newChunk; _height += ChunkSize; lightProcessor.GrowArray(_height); } lightProcessor.SetupBufferStep(batchUpdateItem); chunk.UpdateBlock(pos.x, pos.y % ChunkSize, pos.z, batchUpdateItem.Item.Block); } var buffer = lightProcessor.Light(GetLight); _lightData = PoolManager.GetObjectPool <CompressableArray <uint> >().Pop(); _lightData.Initialize(buffer, ChunkSize, _height); lightProcessor.Dispose(); var missingChunks = MaxHeight / ChunkSize - _chunks.Count; for (var y = 0; y < missingChunks; ++y) { var fake = PoolManager.GetObjectPool <FakeChunk>().Pop(); fake.Initiailize(new Vector3Int(Offset.x, _chunks.Count * ChunkSize, Offset.y), ColumnId + _chunks.Count, BlockFactory.Empty); _chunks.Add(fake); } for (var y = 0; y < _chunks.Count; y++) { var chunk = _chunks[y]; chunk.PhysicsState = LoadingState.Empty; chunk.BlockDataLoaded = true; foreach (var neighbor in _neighbors) { chunk.SetNeighbor(neighbor.Key, neighbor.Value[y * ChunkSize]); } IChunk bottomNeighbor; if (y > 0) { bottomNeighbor = _chunks[y - 1]; } else { var bottomOfWorld = new FakeChunk(); bottomOfWorld.Initiailize(Vector3Int.zero, long.MinValue, BlockFactory.BottomOfWorld); bottomOfWorld.SetNeighbor(FaceDirection.XIncreasing, bottomOfWorld); bottomOfWorld.SetNeighbor(FaceDirection.ZIncreasing, bottomOfWorld); bottomNeighbor = bottomOfWorld; } chunk.SetNeighbor(FaceDirection.YDecreasing, bottomNeighbor); if (y < _chunks.Count - 1) { chunk.SetNeighbor(FaceDirection.YIncreasing, _chunks[y + 1]); } } }
protected override void DrawCore(RenderContext context) { modelProcessor = SceneInstance.GetCurrent(context).GetProcessor<ModelProcessor>(); lightProcessor = SceneInstance.GetCurrent(context).GetProcessor<LightProcessor>(); // No light processors means no light in the scene, so we can early exit if (lightProcessor == null || modelProcessor == null) { return; } // Not in the context of a SceneCameraRenderer? just exit sceneCameraRenderer = context.Tags.Get(SceneCameraRenderer.Current); sceneCamera = context.Tags.Get(CameraComponentRenderer.Current); if (sceneCameraRenderer == null || sceneCamera == null) { return; } sceneCullingMask = sceneCameraRenderer.CullingMask; // Setup the callback on the ModelRenderer and shadow map LightGroupRenderer if (!isModelComponentRendererSetup) { // TODO: Check if we could discover declared renderers in a better way than just hacking the tags of a component var modelRenderer = ModelComponentRenderer.GetAttached(sceneCameraRenderer); if (modelRenderer == null) { return; } modelRenderer.Callbacks.PreRenderModel += PrepareRenderModelForRendering; modelRenderer.Callbacks.PreRenderMesh += PreRenderMesh; // TODO: Make this pluggable // TODO: Shadows should work on mobile platforms if (context.GraphicsDevice.Features.Profile >= GraphicsProfile.Level_10_0 && (Platform.Type == PlatformType.Windows || Platform.Type == PlatformType.WindowsStore || Platform.Type == PlatformType.Windows10)) { shadowMapRenderer = new ShadowMapRenderer(modelRenderer.EffectName); shadowMapRenderer.Renderers.Add(typeof(LightDirectional), new LightDirectionalShadowMapRenderer()); shadowMapRenderer.Renderers.Add(typeof(LightSpot), new LightSpotShadowMapRenderer()); } isModelComponentRendererSetup = true; } // Collect all visible lights CollectVisibleLights(); // Draw shadow maps if (shadowMapRenderer != null) shadowMapRenderer.Draw(context, visibleLightsWithShadows); // Prepare active renderers in an ordered list (by type and shadow on/off) CollectActiveLightRenderers(context); currentModelLightShadersPermutationEntry = null; currentModelShadersParameters = null; currentShadowReceiver = true; // Clear the cache of parameter entries lightParameterEntries.Clear(); parameterCollectionEntryPool.Clear(); // Clear association between model and lights modelToLights.Clear(); // Clear all data generated by shader entries foreach (var shaderEntry in shaderEntries) { shaderEntry.Value.ResetGroupDatas(); } }
private IEnumerable <BatchUpdateItem <LightBlockItem> > Fill(Column column) { var ground = BlockFactory.CreateBlock(BlockFactory.BlockDictionary.GetBlockIdForName("Grass")); var snow = BlockFactory.CreateBlock(BlockFactory.BlockDictionary.GetBlockIdForName("Snow")); var trunk = BlockFactory.CreateBlock(BlockFactory.BlockDictionary.GetBlockIdForName("TreeTrunk")); var leaves = BlockFactory.CreateBlock(BlockFactory.BlockDictionary.GetBlockIdForName("Leaves")); var dirt = BlockFactory.CreateBlock(BlockFactory.BlockDictionary.GetBlockIdForName("Dirt")); var rock = BlockFactory.CreateBlock(BlockFactory.BlockDictionary.GetBlockIdForName("Stone")); var trees = GenerationManager.GetPlants(new Vector4(column.Offset.x - 8, column.Offset.y - 8, column.Offset.x + column.ChunkSize + 8, column.Offset.y + column.ChunkSize + 8)); var columnBuffer = PoolManager.GetArrayPool <LightBlockItem[]>(column.MaxHeight).Pop(); for (var x = 0; x < column.ChunkSize; ++x) { for (var z = 0; z < column.ChunkSize; ++z) { var threshold = GenerationManager.GetHeight(column.Offset.x + x, column.Offset.y + z); var distance = ToClosestTree(trees, new Vector2Int(x + column.Offset.x, z + column.Offset.y)); var sunLight = LightProcessor.ToLight(Colors.Black, Colors.White); for (var height = column.MaxHeight - 1; height >= 0; --height) { IBlock block; if (height > threshold) { if (distance.x <= 1 && height - distance.y <= 16) { sunLight = 0x0u; block = trunk; } else if (distance.x <= 4 && height - distance.y <= 18 && height - distance.y >= 8) { sunLight = 0x0u; block = leaves; } else { block = BlockFactory.Empty; } } else if (height == threshold) { sunLight = 0x0u; block = ground; } else if (height > threshold - 2) { sunLight = 0x0u; block = dirt; } else { sunLight = 0x0u; block = rock; } columnBuffer[height] = new LightBlockItem { Block = block, Light = sunLight }; } for (var y = 0; y < column.MaxHeight; ++y) { var bufferItem = columnBuffer[y]; yield return(new BatchUpdateItem <LightBlockItem>(new Vector3Int(x, y, z), bufferItem)); } } } }
/// <summary> /// Collects the visible lights by intersecting them with the frustum. /// </summary> private void CollectVisibleLights() { foreach (var renderView in RenderSystem.Views) { if (renderView.GetType() != typeof(RenderView)) continue; lightProcessor = renderView.SceneInstance.GetProcessor<LightProcessor>(); // No light processors means no light in the scene, so we can early exit if (lightProcessor == null) continue; RenderViewLightData renderViewLightData; if (!renderViewDatas.TryGetValue(renderView, out renderViewLightData)) { renderViewLightData = new RenderViewLightData(); renderViewDatas.Add(renderView, renderViewLightData); } else { // 1) Clear the cache of current lights (without destroying collections but keeping previously allocated ones) ClearCache(renderViewLightData.ActiveLightGroups); } renderViewLightData.VisibleLights.Clear(); renderViewLightData.VisibleLightsWithShadows.Clear(); // TODO GRAPHICS REFACTOR var sceneCullingMask = renderView.CullingMask; // 2) Cull lights with the frustum var frustum = renderView.Frustum; foreach (var light in lightProcessor.Lights) { // If light is not part of the culling mask group, we can skip it var entityLightMask = (EntityGroupMask)(1 << (int)light.Entity.Group); if ((entityLightMask & sceneCullingMask) == 0 && (light.CullingMask & sceneCullingMask) == 0) { continue; } // If light is not in the frustum, we can skip it var directLight = light.Type as IDirectLight; if (directLight != null && directLight.HasBoundingBox && !frustum.Contains(ref light.BoundingBoxExt)) { continue; } // Find the group for this light var lightGroup = GetLightGroup(renderViewLightData, light); lightGroup.PrepareLight(light); // This is a visible light renderViewLightData.VisibleLights.Add(light); // Add light to a special list if it has shadows if (directLight != null && directLight.Shadow.Enabled && ShadowMapRenderer != null) { // A visible light with shadows renderViewLightData.VisibleLightsWithShadows.Add(light); } } // 3) Allocate collection based on their culling mask AllocateCollectionsPerGroupOfCullingMask(renderViewLightData.ActiveLightGroups); // 4) Collect lights to the correct light collection group foreach (var light in renderViewLightData.VisibleLights) { var lightGroup = GetLightGroup(renderViewLightData, light); lightGroup.AddLight(light); } } }
public LightLanguageService(LightGrammar grammar, LightParser parser, LightProcessor processor) { this.grammar = grammar; this.parser = parser; this.processor = processor; }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, [NotNull] JsonSerializer serializer) { var jsonObject = JObject.Load(reader); int opacityRed = 31, opacityGreen = 31, opacityBlue = 31, opacitySunRed = 31, opacitySunGreen = 31, opacitySunBlue = 31; int emissivityRed = 0, emissivityGreen = 0, emissivityBlue = 0, emissivitySunRed = 0, emissivitySunGreen = 0, emissivitySunBlue = 0; if (jsonObject["Opacity"] != null) { var value = jsonObject["Opacity"].Value <int>(); opacityRed = value; opacityGreen = value; opacityBlue = value; opacitySunRed = value; opacitySunGreen = value; opacitySunBlue = value; } if (jsonObject["Emissivity"] != null) { var value = jsonObject["Emissivity"].Value <int>(); emissivityRed = value; emissivityGreen = value; emissivityBlue = value; } if (jsonObject["EmissivitySun"] != null) { var value = jsonObject["EmissivitySun"].Value <int>(); emissivitySunRed = value; emissivitySunGreen = value; emissivitySunBlue = value; } if (jsonObject["OpacitySun"] != null) { var value = jsonObject["OpacitySun"].Value <int>(); opacitySunRed = value; opacitySunGreen = value; opacitySunBlue = value; } if (jsonObject["OpacityRed"] != null) { var value = jsonObject["OpacityRed"].Value <int>(); opacityRed = value; opacitySunRed = value; } if (jsonObject["OpacityGreen"] != null) { var value = jsonObject["OpacityGreen"].Value <int>(); opacityGreen = value; opacitySunGreen = value; } if (jsonObject["OpacityBlue"] != null) { var value = jsonObject["OpacityBlue"].Value <int>(); opacityBlue = value; opacitySunBlue = value; } if (jsonObject["OpacitySunRed"] != null) { var value = jsonObject["OpacitySunRed"].Value <int>(); opacitySunRed = value; } if (jsonObject["OpacitySunGreen"] != null) { var value = jsonObject["OpacitySunGreen"].Value <int>(); opacitySunGreen = value; } if (jsonObject["OpacitySunBlue"] != null) { var value = jsonObject["OpacitySunBlue"].Value <int>(); opacitySunBlue = value; } if (jsonObject["EmissivityRed"] != null) { var value = jsonObject["EmissivityRed"].Value <int>(); emissivityRed = value; } if (jsonObject["EmissivityGreen"] != null) { var value = jsonObject["EmissivityGreen"].Value <int>(); emissivityGreen = value; } if (jsonObject["EmissivityBlue"] != null) { var value = jsonObject["EmissivityBlue"].Value <int>(); emissivityBlue = value; } if (jsonObject["EmissivitySunRed"] != null) { var value = jsonObject["EmissivitySunRed"].Value <int>(); emissivitySunRed = value; } if (jsonObject["EmissivitySunGreen"] != null) { var value = jsonObject["EmissivitySunGreen"].Value <int>(); emissivitySunGreen = value; } if (jsonObject["EmissivitySunBlue"] != null) { var value = jsonObject["EmissivitySunBlue"].Value <int>(); emissivitySunBlue = value; } var block = new BlockData(); serializer.Populate(jsonObject.CreateReader(), block); block.Opacity = LightProcessor.GetOpacity(opacityRed, opacityGreen, opacityBlue, opacitySunRed, opacitySunGreen, opacitySunBlue); block.Emissivity = (uint)((emissivityRed & 31) << 25) | (uint)((emissivityGreen & 31) << 20) | (uint)((emissivityBlue & 31) << 15) | (uint)((emissivitySunRed & 31) << 10) | (uint)((emissivitySunGreen & 31) << 5) | (uint)(emissivitySunBlue & 31); return(block); }
private void BuildMasks() { _min = new Vector3Int(int.MaxValue, int.MaxValue, int.MaxValue); _max = new Vector3Int(int.MinValue, int.MinValue, int.MinValue); for (var x = _cell.Min.x; x < _cell.Max.x; x++) { for (var z = _cell.Min.z; z < _cell.Max.z; z++) { for (var y = _cell.Min.y; y < _cell.Max.y; y++) { var block = _cell.GetBlock(x, y, z); if (!block.AddToRenderMesh) { continue; } var added = false; var blockLight = _cell.GetLight(x, y, z); var blockId = block.BlockId; var block100 = _cell.GetBlock(x + 1, y, z); var block010 = _cell.GetBlock(x, y + 1, z); var block001 = _cell.GetBlock(x, y, z + 1); var blockN100 = _cell.GetBlock(x - 1, y, z); var block0N10 = _cell.GetBlock(x, y - 1, z); var block00N1 = _cell.GetBlock(x, y, z - 1); var light100 = _cell.GetLight(x + 1, y, z); var light010 = _cell.GetLight(x, y + 1, z); var light001 = _cell.GetLight(x, y, z + 1); var lightN100 = _cell.GetLight(x - 1, y, z); var light0N10 = _cell.GetLight(x, y - 1, z); var light00N1 = _cell.GetLight(x, y, z - 1); var light011 = _cell.GetLight(x + 0, y + 1, z + 1); var light01N1 = _cell.GetLight(x + 0, y + 1, z - 1); var light0N11 = _cell.GetLight(x + 0, y - 1, z + 1); var light0N1N1 = _cell.GetLight(x + 0, y - 1, z - 1); var light101 = _cell.GetLight(x + 1, y + 0, z + 1); var light10N1 = _cell.GetLight(x + 1, y + 0, z - 1); var light110 = _cell.GetLight(x + 1, y + 1, z + 0); var light111 = _cell.GetLight(x + 1, y + 1, z + 1); var light11N1 = _cell.GetLight(x + 1, y + 1, z - 1); var light1N10 = _cell.GetLight(x + 1, y - 1, z + 0); var light1N11 = _cell.GetLight(x + 1, y - 1, z + 1); var light1N1N1 = _cell.GetLight(x + 1, y - 1, z - 1); var lightN101 = _cell.GetLight(x - 1, y + 0, z + 1); var lightN10N1 = _cell.GetLight(x - 1, y + 0, z - 1); var lightN110 = _cell.GetLight(x - 1, y + 1, z + 0); var lightN111 = _cell.GetLight(x - 1, y + 1, z + 1); var lightN11N1 = _cell.GetLight(x - 1, y + 1, z - 1); var lightN1N10 = _cell.GetLight(x - 1, y - 1, z + 0); var lightN1N11 = _cell.GetLight(x - 1, y - 1, z + 1); var lightN1N1N1 = _cell.GetLight(x - 1, y - 1, z - 1); //XIncreasing if (!(block100.RenderOpaque || block100.BlockId == blockId)) { var blockFace = new BlockFace { Exists = true, BlockId = block.BlockId, Tint = block.Tints[0], TextureIndex = block.GetTextureMapping(FaceDirection.XIncreasing) }; if (block.Emissivity > 0) { blockFace.LightTopLeft = blockLight; blockFace.LightTopRight = blockLight; blockFace.LightBottomRight = blockLight; blockFace.LightBottomLeft = blockLight; } else { blockFace.LightTopLeft = LightProcessor.LightAverage(light100, light10N1, light11N1, light110); blockFace.LightTopRight = LightProcessor.LightAverage(light100, light101, light111, light110); blockFace.LightBottomRight = LightProcessor.LightAverage(light100, light101, light1N11, light1N10); blockFace.LightBottomLeft = LightProcessor.LightAverage(light100, light10N1, light1N1N1, light1N10); } _masks[FaceDirection.XIncreasing][x, y, z] = blockFace; added = true; } //YIncreasing if (!(block010.RenderOpaque || block010.BlockId == blockId)) { var blockFace = new BlockFace { Exists = true, BlockId = block.BlockId, Tint = block.Tints[1], TextureIndex = block.GetTextureMapping(FaceDirection.YIncreasing) }; if (block.Emissivity > 0) { blockFace.LightTopLeft = blockLight; blockFace.LightTopRight = blockLight; blockFace.LightBottomRight = blockLight; blockFace.LightBottomLeft = blockLight; } else { blockFace.LightTopLeft = LightProcessor.LightAverage(light010, lightN110, lightN111, light011); blockFace.LightTopRight = LightProcessor.LightAverage(light010, light110, light111, light011); blockFace.LightBottomRight = LightProcessor.LightAverage(light010, light110, light11N1, light01N1); blockFace.LightBottomLeft = LightProcessor.LightAverage(light010, lightN110, lightN11N1, light01N1); } _masks[FaceDirection.YIncreasing][x, y, z] = blockFace; added = true; } //ZIncreasing if (!(block001.RenderOpaque || block001.BlockId == blockId)) { var blockFace = new BlockFace { Exists = true, BlockId = block.BlockId, Tint = block.Tints[2], TextureIndex = block.GetTextureMapping(FaceDirection.ZIncreasing) }; if (block.Emissivity > 0) { blockFace.LightTopLeft = blockLight; blockFace.LightTopRight = blockLight; blockFace.LightBottomRight = blockLight; blockFace.LightBottomLeft = blockLight; } else { blockFace.LightTopLeft = LightProcessor.LightAverage(light001, light0N11, light1N11, light101); blockFace.LightTopRight = LightProcessor.LightAverage(light001, light011, light111, light101); blockFace.LightBottomRight = LightProcessor.LightAverage(light001, light011, lightN111, lightN101); blockFace.LightBottomLeft = LightProcessor.LightAverage(light001, light0N11, lightN1N11, lightN101); } _masks[FaceDirection.ZIncreasing][x, y, z] = blockFace; added = true; } //XDecreasing if (!(blockN100.RenderOpaque || blockN100.BlockId == blockId)) { var blockFace = new BlockFace { Exists = true, BlockId = block.BlockId, Tint = block.Tints[3], TextureIndex = block.GetTextureMapping(FaceDirection.XDecreasing) }; if (block.Emissivity > 0) { blockFace.LightTopLeft = blockLight; blockFace.LightTopRight = blockLight; blockFace.LightBottomRight = blockLight; blockFace.LightBottomLeft = blockLight; } else { blockFace.LightTopLeft = LightProcessor.LightAverage(lightN100, lightN10N1, lightN11N1, lightN110); blockFace.LightTopRight = LightProcessor.LightAverage(lightN100, lightN101, lightN111, lightN110); blockFace.LightBottomRight = LightProcessor.LightAverage(lightN100, lightN101, lightN1N11, lightN1N10); blockFace.LightBottomLeft = LightProcessor.LightAverage(lightN100, lightN10N1, lightN1N1N1, lightN1N10); } _masks[FaceDirection.XDecreasing][x, y, z] = blockFace; added = true; } //YDecreasing if (!(block0N10.RenderOpaque || block0N10.BlockId == blockId)) { var blockFace = new BlockFace { Exists = true, BlockId = block.BlockId, Tint = block.Tints[4], TextureIndex = block.GetTextureMapping(FaceDirection.YDecreasing) }; if (block.Emissivity > 0) { blockFace.LightTopLeft = blockLight; blockFace.LightTopRight = blockLight; blockFace.LightBottomRight = blockLight; blockFace.LightBottomLeft = blockLight; } else { blockFace.LightTopLeft = LightProcessor.LightAverage(light0N10, lightN1N10, lightN1N11, light0N11); blockFace.LightTopRight = LightProcessor.LightAverage(light0N10, light1N10, light1N11, light0N11); blockFace.LightBottomRight = LightProcessor.LightAverage(light0N10, light1N10, light1N1N1, light0N1N1); blockFace.LightBottomLeft = LightProcessor.LightAverage(light0N10, lightN1N10, lightN1N1N1, light0N1N1); } _masks[FaceDirection.YDecreasing][x, y, z] = blockFace; added = true; } //ZDecreasing if (!(block00N1.RenderOpaque || block00N1.BlockId == blockId)) { var blockFace = new BlockFace { Exists = true, BlockId = block.BlockId, Tint = block.Tints[5], TextureIndex = block.GetTextureMapping(FaceDirection.ZDecreasing) }; if (block.Emissivity > 0) { blockFace.LightTopLeft = blockLight; blockFace.LightTopRight = blockLight; blockFace.LightBottomRight = blockLight; blockFace.LightBottomLeft = blockLight; } else { blockFace.LightTopLeft = LightProcessor.LightAverage(light00N1, light0N1N1, light1N1N1, light10N1); blockFace.LightTopRight = LightProcessor.LightAverage(light00N1, light01N1, light11N1, light10N1); blockFace.LightBottomRight = LightProcessor.LightAverage(light00N1, light01N1, lightN11N1, lightN10N1); blockFace.LightBottomLeft = LightProcessor.LightAverage(light00N1, light0N1N1, lightN1N1N1, lightN10N1); } _masks[FaceDirection.ZDecreasing][x, y, z] = blockFace; added = true; } if (!added) { continue; } var vec = new Vector3Int(x, y, z); _min = Vector3Int.Min(_min, vec); _max = Vector3Int.Max(_max, vec); } } } _max += Vector3Int.one; }
public void RegisterLighting() { if (lightingRegistered) return; lightingRegistered = true; // Add LightProcessor if used in effect config file LightingPrepassPlugin lightingPrepassPlugin; LightingPlugin lightingPlugin; RenderConfigContext.RenderPassPlugins.TryGetValueCast("LightingPrepassPlugin", out lightingPrepassPlugin); RenderConfigContext.RenderPassPlugins.TryGetValueCast("LightingPlugin", out lightingPlugin); if (lightingPrepassPlugin != null || lightingPlugin != null) { RenderTargetsPlugin editorTargetPlugin; RenderConfigContext.RenderPassPlugins.TryGetValueCast("EditorTargetPlugin", out editorTargetPlugin); var lightProcessor = new LightProcessor(lightingPlugin, editorTargetPlugin, lightingPrepassPlugin != null ? lightingPrepassPlugin.Lights : null, false); entitySystem.Processors.Add(lightProcessor); // LightShafts enabled? RenderPass lightShaftsPass; if (RenderConfigContext.RenderPasses.TryGetValue("LightShaftsPass", out lightShaftsPass)) entitySystem.Processors.Add(new LightShaftsProcessor(MainPlugin, MainTargetPlugin, lightShaftsPass)); entitySystem.Processors.Add(new LightReceiverProcessor(lightProcessor)); } }
private static void SetupCompiler() { var builder = new ContainerBuilder(); builder.RegisterAssemblyModules(typeof(LightProcessor).Assembly); builder.RegisterAssemblyModules(typeof(LightCompiler).Assembly); var container = builder.Build(); parser = container.Resolve<LightParser>(); processor = container.Resolve<LightProcessor>(); compiler = container.Resolve<LightCompiler>(); typeFormatter = container.Resolve<TypeFormatter>(); }