Пример #1
0
        private void CreateRenderTargets()
        {
            var renderer = (Renderer)services.GetService(typeof(Renderer));

            depthArrayHolder = new DepthStencilBufferArrayHolder(renderer.Device, renderer.Configuration, configuration);
            foreach (RenderTargetDescription description in configuration.RenderTargets)
            {
                var target = new RenderTargetArrayHolder(renderer.Device, description, renderer.Configuration, configuration);
                RenderTargetLayerType layerType = ConvertLayerTypeDescToLayerType(description.LayerType);
                renderTargetArraysByLayerType.Add(layerType, target);
            }

            renderTargetViewsByLayer = new RenderTargetView[configuration.LayerCount][];
            for (int i = 0; i < configuration.LayerCount; ++i)
            {
                int j = 0;
                renderTargetViewsByLayer[i] = new RenderTargetView[renderTargetArraysByLayerType.Count];
                foreach (RenderTargetArrayHolder targetArrayHolder in renderTargetArraysByLayerType.Values)
                {
                    renderTargetViewsByLayer[i][j++] = targetArrayHolder.RenderTargetViews[i];
                }
            }
        }
        private void CreateRenderTargets()
        {
            var renderer = (Renderer)services.GetService(typeof(Renderer));

            depthArrayHolder = new DepthStencilBufferArrayHolder(renderer.Device, renderer.Configuration, configuration);
            foreach (RenderTargetDescription description in configuration.RenderTargets)
            {
                var target = new RenderTargetArrayHolder(renderer.Device, description, renderer.Configuration, configuration);
                RenderTargetLayerType layerType = ConvertLayerTypeDescToLayerType(description.LayerType);
                renderTargetArraysByLayerType.Add(layerType, target);
            }

            renderTargetViewsByLayer = new RenderTargetView[configuration.LayerCount][];
            for (int i = 0; i < configuration.LayerCount; ++i)
            {
                int j = 0;
                renderTargetViewsByLayer[i] = new RenderTargetView[renderTargetArraysByLayerType.Count];
                foreach (RenderTargetArrayHolder targetArrayHolder in renderTargetArraysByLayerType.Values)
                    renderTargetViewsByLayer[i][j++] = targetArrayHolder.RenderTargetViews[i];
            }
        }