Inheritance: IDisposable
Example #1
0
        public Renderer(GraphicSettings graphicSettings, ServerSettings serverSettings)
        {
            var resolution = GetResolution(graphicSettings);

            var rendererName = serverSettings.Dedicated ? "Null" : graphicSettings.Renderer;
            var rendererPath = Platform.ResolvePath(".", "OpenRA.Renderer." + rendererName + ".dll");

            Device = CreateDevice(Assembly.LoadFile(rendererPath), resolution.Width, resolution.Height, graphicSettings.Mode);

            if (!serverSettings.Dedicated)
            {
                TempBufferSize  = graphicSettings.BatchSize;
                TempBufferCount = graphicSettings.NumTempBuffers;
                SheetSize       = graphicSettings.SheetSize;
            }

            WorldSpriteRenderer     = new SpriteRenderer(this, Device.CreateShader("shp"));
            WorldRgbaSpriteRenderer = new SpriteRenderer(this, Device.CreateShader("rgba"));
            WorldLineRenderer       = new LineRenderer(this, Device.CreateShader("line"));
            WorldVoxelRenderer      = new VoxelRenderer(this, Device.CreateShader("vxl"));
            LineRenderer            = new LineRenderer(this, Device.CreateShader("line"));
            WorldQuadRenderer       = new QuadRenderer(this, Device.CreateShader("line"));
            RgbaSpriteRenderer      = new SpriteRenderer(this, Device.CreateShader("rgba"));
            SpriteRenderer          = new SpriteRenderer(this, Device.CreateShader("shp"));

            for (var i = 0; i < TempBufferCount; i++)
            {
                tempBuffers.Enqueue(Device.CreateVertexBuffer(TempBufferSize));
            }
        }
Example #2
0
        public Renderer()
        {
            TempBufferSize  = Game.Settings.Graphics.BatchSize;
            TempBufferCount = Game.Settings.Graphics.NumTempBuffers;
            SheetSize       = Game.Settings.Graphics.SheetSize;

            WorldSpriteRenderer     = new SpriteRenderer(this, device.CreateShader("shp"));
            WorldRgbaSpriteRenderer = new SpriteRenderer(this, device.CreateShader("rgba"));
            WorldLineRenderer       = new LineRenderer(this, device.CreateShader("line"));
            WorldVoxelRenderer      = new VoxelRenderer(this, device.CreateShader("vxl"));
            LineRenderer            = new LineRenderer(this, device.CreateShader("line"));
            WorldQuadRenderer       = new QuadRenderer(this, device.CreateShader("line"));
            RgbaSpriteRenderer      = new SpriteRenderer(this, device.CreateShader("rgba"));
            SpriteRenderer          = new SpriteRenderer(this, device.CreateShader("shp"));

            for (int i = 0; i < TempBufferCount; i++)
            {
                tempBuffers.Enqueue(device.CreateVertexBuffer(TempBufferSize));
            }
        }