public void CreateMap(ViewEntity entity, IRenderState renderState, int index, Dictionary <Enums.EntityType, Matrix4x4[]> transforms, Dictionary <Enums.EntityType, int> instanceCounts, Dictionary <Enums.EntityType, ITexture2D> textures, Dictionary <Enums.EntityType, ITexture2D> normalMaps, Dictionary <Enums.EntityType, ITexture2D> heightMaps, Dictionary <Enums.EntityType, Vector4> intensityMap, List <Enums.EntityType> disableBackFaceCulling, List <LightSource> lightSources, ITransformation camera, float time) { _entity = entity; _camera = camera; Vector3 position = new Vector3(entity.Transform.M41, entity.Transform.M42, entity.Transform.M43); transforms[entity.Type][index] = transforms[entity.Type][transforms[entity.Type].Length - 1]; instanceCounts[entity.Type]--; _deferred.UpdateTransforms(transforms); for (int i = 0; i < 6; i++) { _positions[i].Location = position; _deferred.Draw(renderState, _cameras[i], instanceCounts, textures, normalMaps, heightMaps, intensityMap, disableBackFaceCulling, time); _shadowMapping.Draw(renderState, _cameras[i], instanceCounts, _deferred.Depth, lightSources[0].Direction, disableBackFaceCulling, _deferred.Position, _deferred.Normal); _lighting.Draw(_cameras[i], _deferred.Color, _deferred.Normal, _deferred.Position, _shadowMapping.Output, _deferred.IntensityMap, lightSources); _lighting.Draw(_cameras[i], _deferred.Color, _deferred.Normal, _deferred.Position, _shadowMapping.Output, _deferred.IntensityMap, lightSources); _skybox.Draw(_cameras[i], 2); _add.Draw(_skybox.Output, _lighting.Output); _mapSurfaces[i].Activate(); TextureDrawer.Draw(_add.Output); _mapSurfaces[i].Deactivate(); } transforms[entity.Type][index] = entity.Transform; instanceCounts[entity.Type]++; for (int i = 0; i < 6; i++) { _bloom[i].Draw(_mapSurfaces[i].Texture); } _cubeFbo.Activate(); for (int i = 0; i < 6; i++) { GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, TextureTarget.TextureCubeMapPositiveX + i, _cubeFbo.Texture.ID, 0); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); TextureDrawer.Draw(_bloom[i].Output); } _cubeFbo.Deactivate(); _cubeFbo.Texture.Activate(); GL.GenerateMipmap(GenerateMipmapTarget.TextureCubeMap); _cubeFbo.Texture.Deactivate(); }
private void CreateMap(IReadOnlyList <ITexture2D> textures) { _cubeFbo.Activate(); for (int i = 0; i < 6; i++) { GL.FramebufferTexture2D(FramebufferTarget.Framebuffer, FramebufferAttachment.ColorAttachment0, TextureTarget.TextureCubeMapPositiveX + i, _cubeFbo.Texture.ID, 0); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); TextureDrawer.Draw(textures[i]); } _cubeFbo.Deactivate(); _cubeFbo.Texture.Activate(); GL.GenerateMipmap(GenerateMipmapTarget.TextureCubeMap); _cubeFbo.Texture.Deactivate(); }