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); }
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"); }
static Size GetResolution(GraphicSettings graphicsSettings) { // var size = (graphicsSettings.Mode == WindowMode.Windowed) // ? graphicsSettings.WindowedSize // : graphicsSettings.FullscreenSize; return(new Size(800, 800)); }
static Size GetResolution(GraphicSettings graphicsSettings) { var size = (graphicsSettings.Mode == WindowMode.Windowed) ? graphicsSettings.WindowedSize : graphicsSettings.FullscreenSize; return(new Size(size.X, size.Y)); }
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; }
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); }