Ejemplo n.º 1
0
        private void FirstPass(RendererCollection renderables, Camera camera)
        {
            _gbuffer.Bind();
            _glContext.DrawBuffers(
                FramebufferAttachment.ColorAttachment0,
                FramebufferAttachment.ColorAttachment1,
                FramebufferAttachment.ColorAttachment2,
                FramebufferAttachment.ColorAttachment3,
                FramebufferAttachment.ColorAttachment4);

            _glContext.ClearBuffer(ClearBuffer.Depth, 0, 1f);
            _glContext.ClearBuffer(ClearBuffer.Color, 0, Vector3.Zero);
            _glContext.ClearBuffer(ClearBuffer.Color, 1, Vector3.Zero);
            _glContext.ClearBuffer(ClearBuffer.Color, 2, Vector3.Zero);
            _glContext.ClearBuffer(ClearBuffer.Color, 3, UIVector4.Zero);
            _glContext.ClearBuffer(ClearBuffer.Color, 4, Vector3.Zero);

            _glContext.DepthMask(true);
            _glContext.Disable(EnableCap.Blend);

            var opaque = renderables.Opaque;

            for (int j = 0; j < opaque.Count; j++)
            {
                _graphics.UpdateAndRender(camera, opaque[j], (uint)(j + 1));
            }
        }
Ejemplo n.º 2
0
 public TemplateEngine([NotNull] ITable templateTable, [NotNull] ILog logger)
 {
     this.templateTable = templateTable;
     templateCollection = new TemplateCollection(templateTable);
     rendererCollection = new RendererCollection(templateCollection);
     parserCollection   = new ParserCollection(logger.ForContext("ExcelObjectPrinter"));
 }
Ejemplo n.º 3
0
 private void CreateRenderersIfNeeded()
 {
     if (_renderers == null)
     {
         _renderers = new RendererCollection(this);
         _renderers.Reset();
     }
 }
Ejemplo n.º 4
0
        private void OnBeginRender(Camera camera)
        {
            if (camera == null)
            {
                return;
            }
            if (!profiles.Any())
            {
                return;
            }

            // カメラ毎に Renderer を作る
            if (!rendererCollections.ContainsKey(camera))
            {
                rendererCollections[camera] = new RendererCollection();
            }

            foreach (var profile in profiles)
            {
                rendererCollections[camera]
                .OnBeginRender(camera, profile, targetTerrain, bakedAlphaMaps, maxParallelJobCount);
            }
        }
Ejemplo n.º 5
0
        private void RenderCamera(Camera camera, RendererCollection renderables)
        {
            renderables.OpenGLSort(camera);

            _glContext.DepthMask(true);
            _glContext.Disable(EnableCap.Blend);
            var opaque = renderables.Opaque;

            for (int i = 0; i < opaque.Count; i++)
            {
                _graphics.UpdateAndRender(camera, opaque[i], (uint)(i + 1));
            }

            _glContext.DepthMask(false);
            _glContext.Enable(EnableCap.Blend);
            var transparent = renderables.Transparent;

            for (int i = 0; i < transparent.Count; i++)
            {
                _graphics.UpdateAndRender(camera, transparent[i], (uint)(i + 1 + opaque.Count));
            }
            _glContext.DepthMask(true);
        }
Ejemplo n.º 6
0
        internal void LoadProviders(HttpContextBase http)
        {
            // if there is no section found, then create one
            if (ConfigSection == null)
            {
                //create a new section with the default settings
                ConfigSection = new ClientDependencySection();
            }

            //Load in the path first
            var rootPath = HttpRuntime.AppDomainAppVirtualPath ?? "/";
            //need to check if it's an http path or a lambda path
            var path = ConfigSection.CompositeFileElement.CompositeFileHandlerPath;

            CompositeFileHandlerPath = path.StartsWith("~/")
                ? VirtualPathUtility.ToAbsolute(ConfigSection.CompositeFileElement.CompositeFileHandlerPath, rootPath)
                : ConfigSection.CompositeFileElement.CompositeFileHandlerPath;

            FileRegistrationProviderCollection        = new FileRegistrationProviderCollection();
            CompositeFileProcessingProviderCollection = new CompositeFileProcessingProviderCollection();
            MvcRendererCollection     = new RendererCollection();
            FileMapProviderCollection = new FileMapProviderCollection();

            //load the providers from the config, if there isn't config sections then add default providers
            // and then load the defaults.

            LoadDefaultCompositeFileConfig(ConfigSection, http);

            ////Here we need to detect legacy settings
            //if (ConfigSection.CompositeFileElement.DefaultFileProcessingProviderLegacy != "CompositeFileProcessor"
            //    && ConfigSection.CompositeFileElement.DefaultFileProcessingProvider == "CompositeFileProcessor")
            //{
            //    //if the legacy section is not the default and the non-legacy section IS the default, then use the legacy section
            //    DefaultCompositeFileProcessingProvider = CompositeFileProcessingProviderCollection[ConfigSection.CompositeFileElement.DefaultFileProcessingProviderLegacy];
            //}
            //else
            //{
            //    DefaultCompositeFileProcessingProvider = CompositeFileProcessingProviderCollection[ConfigSection.CompositeFileElement.DefaultFileProcessingProvider];
            //}
            DefaultCompositeFileProcessingProvider = CompositeFileProcessingProviderCollection[ConfigSection.CompositeFileElement.DefaultFileProcessingProvider];
            if (DefaultCompositeFileProcessingProvider == null)
            {
                throw new ProviderException("Unable to load default composite file provider");
            }

            LoadDefaultFileMapConfig(ConfigSection, http);

            DefaultFileMapProvider = FileMapProviderCollection[ConfigSection.CompositeFileElement.DefaultFileMapProvider];
            if (DefaultFileMapProvider == null)
            {
                throw new ProviderException("Unable to load default file map provider");
            }

            LoadDefaultMvcFileConfig(ConfigSection);

            DefaultMvcRenderer = MvcRendererCollection[ConfigSection.MvcElement.DefaultRenderer];
            if (DefaultMvcRenderer == null)
            {
                throw new ProviderException("Unable to load default mvc renderer");
            }

            LoadDefaultFileRegConfig(ConfigSection);

            DefaultFileRegistrationProvider = FileRegistrationProviderCollection[ConfigSection.FileRegistrationElement.DefaultProvider];
            if (DefaultFileRegistrationProvider == null)
            {
                throw new ProviderException("Unable to load default file registration provider");
            }

            if (string.IsNullOrEmpty(ConfigSection.LoggerType))
            {
                Logger = new TraceLogger();
            }
            else
            {
                var t = Type.GetType(ConfigSection.LoggerType);
                if (!typeof(ILogger).IsAssignableFrom(t))
                {
                    throw new ArgumentException("The loggerType '" + ConfigSection.LoggerType + "' does not inherit from ClientDependency.Core.Logging.ILogger");
                }

                Logger = (ILogger)Activator.CreateInstance(t);
            }
        }
Ejemplo n.º 7
0
        internal void RenderAll(IReadOnlyList <Camera> cameras, IReadOnlyList <LightSource> lights, RendererCollection renderables)
        {
            Check();

            _renderTechnique.RenderAll(cameras, lights, renderables);

            //_uiRender.Render();

            SwapBuffers();
        }
Ejemplo n.º 8
0
        public void RenderAll(IReadOnlyList <Camera> cameras, IReadOnlyList <LightSource> lights, RendererCollection renderables)
        {
            Assert.True(cameras.Count > 0);

            _glContext.Viewport(0u, 0u, (uint)_screenSize.Width, (uint)_screenSize.Height);
            _graphics.DrawCalls = 0;

            for (int camNo = 0; camNo < cameras.Count; camNo++)
            {
                var camera = cameras[camNo];
                if (camera.IsEnabled == false)
                {
                    continue;
                }

                _graphics.SetupCameraAndLights(camera, lights);

                FirstPass(renderables, camera);
                SecondPass(camNo == 0, camera);

                _glContext.DepthMask(false);
                _glContext.Enable(EnableCap.Blend);
                var opaqueCount = renderables.Opaque.Count;
                var transparent = renderables.Transparent;
                for (int i = 0; i < transparent.Count; i++)
                {
                    _graphics.UpdateAndRender(camera, transparent[i], (uint)(i + 1 + opaqueCount));
                }
                _glContext.DepthMask(true);
            }

            DrawGBuffer();
        }
Ejemplo n.º 9
0
        public void RenderAll(IReadOnlyList <Camera> cameras, IReadOnlyList <LightSource> lights, RendererCollection renderables)
        {
            Prepare();

            for (int i = 0; i < cameras.Count; i++)
            {
                var camera = cameras[i];
                if (camera.IsEnabled == false)
                {
                    continue;
                }

                if (i == 0)
                {
                    _glContext.ClearColor(camera.ClearColor);
                    _glContext.Clear(BufferMask.ColorBufferBit | BufferMask.DepthBufferBit | BufferMask.StencilBufferBit);
                }
                else
                {
                    _glContext.Clear(BufferMask.DepthBufferBit);
                }

                _graphics.SetupCameraAndLights(camera, lights);
                RenderCamera(camera, renderables);
            }
        }
Ejemplo n.º 10
0
        internal void LoadProviders(ClientDependencySection section, HttpContextBase http)
        {
            ConfigSection = section;

            FileRegistrationProviderCollection        = new FileRegistrationProviderCollection();
            CompositeFileProcessingProviderCollection = new CompositeFileProcessingProviderCollection();
            MvcRendererCollection     = new RendererCollection();
            FileMapProviderCollection = new FileMapProviderCollection();

            // if there is no section found, then create one
            if (ConfigSection == null)
            {
                //create a new section with the default settings
                ConfigSection = new ClientDependencySection();
            }

            //need to check if it's an http path or a lambda path
            var path = ConfigSection.CompositeFileElement.CompositeFileHandlerPath;

            CompositeFileHandlerPath = path.StartsWith("~/")
                ? VirtualPathUtility.ToAbsolute(ConfigSection.CompositeFileElement.CompositeFileHandlerPath, http.Request.ApplicationPath)
                : ConfigSection.CompositeFileElement.CompositeFileHandlerPath;
            Version = ConfigSection.Version;
            FileBasedDependencyExtensionList = ConfigSection.FileBasedDependencyExtensionList.ToList();

            //load the providers from the config, if there isn't config sections then add default providers
            // and then load the defaults.

            LoadDefaultCompositeFileConfig(ConfigSection, http);

            DefaultCompositeFileProcessingProvider = CompositeFileProcessingProviderCollection[ConfigSection.CompositeFileElement.DefaultFileProcessingProvider];
            if (DefaultCompositeFileProcessingProvider == null)
            {
                throw new ProviderException("Unable to load default composite file provider");
            }

            LoadDefaultFileMapConfig(ConfigSection, http);

            DefaultFileMapProvider = FileMapProviderCollection[ConfigSection.CompositeFileElement.DefaultFileMapProvider];
            if (DefaultFileMapProvider == null)
            {
                throw new ProviderException("Unable to load default file map provider");
            }

            LoadDefaultMvcFileConfig(ConfigSection);

            DefaultMvcRenderer = MvcRendererCollection[ConfigSection.MvcElement.DefaultRenderer];
            if (DefaultMvcRenderer == null)
            {
                throw new ProviderException("Unable to load default mvc renderer");
            }

            LoadDefaultFileRegConfig(ConfigSection);

            DefaultFileRegistrationProvider = FileRegistrationProviderCollection[ConfigSection.FileRegistrationElement.DefaultProvider];
            if (DefaultFileRegistrationProvider == null)
            {
                throw new ProviderException("Unable to load default file registration provider");
            }

            if (string.IsNullOrEmpty(ConfigSection.LoggerType))
            {
                Logger = new NullLogger();
            }
            else
            {
                var t = Type.GetType(ConfigSection.LoggerType);
                if (!typeof(ILogger).IsAssignableFrom(t))
                {
                    throw new ArgumentException("The loggerType '" + ConfigSection.LoggerType + "' does not inherit from ClientDependency.Core.Logging.ILogger");
                }

                Logger = (ILogger)Activator.CreateInstance(t);
            }
        }