Пример #1
0
        public Renderer(GraphicSettings graphicSettings, ServerSettings serverSettings)
        {
            var resolution = GetResolution(graphicSettings);

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

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

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

            WorldSpriteRenderer     = new SpriteRenderer(this, Device.CreateShader("shp"));
            WorldRgbaSpriteRenderer = new SpriteRenderer(this, Device.CreateShader("rgba"));
            WorldRgbaColorRenderer  = new RgbaColorRenderer(this, Device.CreateShader("color"));
            WorldVoxelRenderer      = new VoxelRenderer(this, Device.CreateShader("vxl"));
            RgbaColorRenderer       = new RgbaColorRenderer(this, Device.CreateShader("color"));
            RgbaSpriteRenderer      = new SpriteRenderer(this, Device.CreateShader("rgba"));
            SpriteRenderer          = new SpriteRenderer(this, Device.CreateShader("shp"));

            tempBuffer = Device.CreateVertexBuffer(TempBufferSize);
        }
Пример #2
0
        public Renderer(DefaultPlatform platform, GraphicSettings graphicSettings)
        {
            this.platform = platform;
            var resolution = GetResolution(graphicSettings);

            Window  = platform.CreateWindow(new Size(resolution.Width, resolution.Height), graphicSettings.Mode, graphicSettings.BatchSize, Game.Settings.Graphics.DisableWindowsDPIScaling, Game.Settings.Game.LockMouseWindow, Game.Settings.Graphics.DisableWindowsRenderThread);
            Context = Window.Context;

            TempBufferSize = graphicSettings.BatchSize;
            SheetSize      = graphicSettings.SheetSize;

            WorldSpriteRenderer     = new SpriteRenderer("WorldSpriteRenderer", this, Context.CreateShader("combined"));         // каждый имеет vertex массив, VAO это tempbuffer.
            WorldRgbaSpriteRenderer = new RgbaSpriteRenderer(WorldSpriteRenderer);
            WorldRgbaColorRenderer  = new RgbaColorRenderer(WorldSpriteRenderer);
            WorldModelRenderer      = new ModelRenderer(this, Context.CreateShader("model"));                               // каждый имеет vertex массив, VAO это tempbuffer
            SpriteRenderer          = new SpriteRenderer("SpriteRenderer", this, Context.CreateShader("combined"));         // каждый имеет vertex массив, VAO это tempbuffer.
            RgbaSpriteRenderer      = new RgbaSpriteRenderer(SpriteRenderer);                                               // эти пишут в родительский VBO
            RgbaColorRenderer       = new RgbaColorRenderer(SpriteRenderer);                                                // эти пишут в родительский VBO
            FontSpriteRenderer      = new SpriteRenderer("FontSpriteRenderer", this, Context.CreateShader("text"));         // каждый имеет свой vertex массив, VAO это tempbuffer.
            ImguiSpriteRenderer     = new SpriteRenderer("ImguiSpriteRenderer", this, Context.CreateShader("combined"));    // для ImGui
            PixelDumpRenderer       = new PixelDumpRenderer("ImguiSpriteRenderer", this, Context.CreateShader("combined")); // для ImGui

            sproc = new ShaderIF_API();
            IntPtr context = ImGui.CreateContext();

            ImGui.SetCurrentContext(context);

            RendererVertexBuffer = Context.CreateVertexBuffer(TempBufferSize, "Renderer");
        }
Пример #3
0
 static Size GetResolution(GraphicSettings graphicsSettings)
 {
     // var size = (graphicsSettings.Mode == WindowMode.Windowed)
     //  ? graphicsSettings.WindowedSize
     //  : graphicsSettings.FullscreenSize;
     return(new Size(800, 800));
 }
Пример #4
0
        static Size GetResolution(GraphicSettings graphicsSettings)
        {
            var size = (graphicsSettings.Mode == WindowMode.Windowed)
                                ? graphicsSettings.WindowedSize
                                : graphicsSettings.FullscreenSize;

            return(new Size(size.X, size.Y));
        }
Пример #5
0
        public Renderer(GraphicSettings graphicSettings)
        {
            Device = null;

            TempBufferSize = graphicSettings.BatchSize;
            SheetSize      = graphicSettings.SheetSize;

            WorldSpriteRenderer     = null;
            WorldRgbaSpriteRenderer = null;
            WorldRgbaColorRenderer  = null;
            WorldModelRenderer      = null;
            RgbaColorRenderer       = null;
            RgbaSpriteRenderer      = null;
            SpriteRenderer          = null;

            tempBuffer = null;
        }
Пример #6
0
        public Renderer(IPlatform platform, GraphicSettings graphicSettings)
        {
            var resolution = GetResolution(graphicSettings);

            Device = platform.CreateGraphics(new Size(resolution.Width, resolution.Height), graphicSettings.Mode);

            TempBufferSize = graphicSettings.BatchSize;
            SheetSize      = graphicSettings.SheetSize;

            WorldSpriteRenderer     = new SpriteRenderer(this, Device.CreateShader("shp"));
            WorldRgbaSpriteRenderer = new SpriteRenderer(this, Device.CreateShader("rgba"));
            WorldRgbaColorRenderer  = new RgbaColorRenderer(this, Device.CreateShader("color"));
            WorldVoxelRenderer      = new VoxelRenderer(this, Device.CreateShader("vxl"));
            RgbaColorRenderer       = new RgbaColorRenderer(this, Device.CreateShader("color"));
            RgbaSpriteRenderer      = new SpriteRenderer(this, Device.CreateShader("rgba"));
            SpriteRenderer          = new SpriteRenderer(this, Device.CreateShader("shp"));

            tempBuffer = Device.CreateVertexBuffer(TempBufferSize);
        }
        public Renderer(IPlatform platform, GraphicSettings graphicSettings)
        {
            var resolution = GetResolution(graphicSettings);

            Window  = platform.CreateWindow(new Size(resolution.Width, resolution.Height), graphicSettings.Mode, graphicSettings.BatchSize);
            Context = Window.Context;

            TempBufferSize = graphicSettings.BatchSize;
            SheetSize      = graphicSettings.SheetSize;

            WorldSpriteRenderer     = new SpriteRenderer(this, Context.CreateShader("combined"));
            WorldRgbaSpriteRenderer = new RgbaSpriteRenderer(WorldSpriteRenderer);
            WorldRgbaColorRenderer  = new RgbaColorRenderer(WorldSpriteRenderer);
            WorldModelRenderer      = new ModelRenderer(this, Context.CreateShader("model"));
            SpriteRenderer          = new SpriteRenderer(this, Context.CreateShader("combined"));
            RgbaSpriteRenderer      = new RgbaSpriteRenderer(SpriteRenderer);
            RgbaColorRenderer       = new RgbaColorRenderer(SpriteRenderer);

            tempBuffer = Context.CreateVertexBuffer(TempBufferSize);
        }