shader params can stay inside Renderer
This commit is contained in:
@@ -41,14 +41,13 @@ namespace OpenRA
|
|||||||
public static XRandom CosmeticRandom = new XRandom(); // not synced
|
public static XRandom CosmeticRandom = new XRandom(); // not synced
|
||||||
|
|
||||||
public static Renderer Renderer;
|
public static Renderer Renderer;
|
||||||
static int2 clientSize;
|
|
||||||
public static Session LobbyInfo = new Session();
|
public static Session LobbyInfo = new Session();
|
||||||
|
|
||||||
static void LoadMap(string uid)
|
static void LoadMap(string uid)
|
||||||
{
|
{
|
||||||
var map = modData.PrepareMap(uid);
|
var map = modData.PrepareMap(uid);
|
||||||
|
|
||||||
viewport = new Viewport(clientSize, map.TopLeft, map.BottomRight, Renderer);
|
viewport = new Viewport(new float2(Renderer.Resolution), map.TopLeft, map.BottomRight, Renderer);
|
||||||
world = null; // trying to access the old world will NRE, rather than silently doing it wrong.
|
world = null; // trying to access the old world will NRE, rather than silently doing it wrong.
|
||||||
Timer.Time("viewport: {0}");
|
Timer.Time("viewport: {0}");
|
||||||
world = new World(modData.Manifest, map);
|
world = new World(modData.Manifest, map);
|
||||||
@@ -268,7 +267,6 @@ namespace OpenRA
|
|||||||
modData = new ModData( LobbyInfo.GlobalSettings.Mods );
|
modData = new ModData( LobbyInfo.GlobalSettings.Mods );
|
||||||
|
|
||||||
Renderer.SheetSize = Settings.Game.SheetSize;
|
Renderer.SheetSize = Settings.Game.SheetSize;
|
||||||
|
|
||||||
Renderer.Initialize( Game.Settings.Graphics.Mode );
|
Renderer.Initialize( Game.Settings.Graphics.Mode );
|
||||||
|
|
||||||
Sound.Initialize();
|
Sound.Initialize();
|
||||||
@@ -278,7 +276,6 @@ namespace OpenRA
|
|||||||
PerfHistory.items["cursor"].hasNormalTick = false;
|
PerfHistory.items["cursor"].hasNormalTick = false;
|
||||||
|
|
||||||
Renderer = new Renderer();
|
Renderer = new Renderer();
|
||||||
clientSize = new int2(Renderer.Resolution);
|
|
||||||
|
|
||||||
JoinLocal();
|
JoinLocal();
|
||||||
StartGame(modData.Manifest.ShellmapUid);
|
StartGame(modData.Manifest.ShellmapUid);
|
||||||
|
|||||||
@@ -56,11 +56,14 @@ namespace OpenRA.Graphics
|
|||||||
|
|
||||||
public IGraphicsDevice Device { get { return device; } }
|
public IGraphicsDevice Device { get { return device; } }
|
||||||
|
|
||||||
public void BeginFrame(float2 r1, float2 r2, float2 scroll)
|
public void BeginFrame(float2 scroll)
|
||||||
{
|
{
|
||||||
device.Begin();
|
device.Begin();
|
||||||
device.Clear(Color.Black);
|
device.Clear(Color.Black);
|
||||||
|
|
||||||
|
float2 r1 = new float2(2f/Resolution.Width, -2f/Resolution.Height);
|
||||||
|
float2 r2 = new float2(-1, 1);
|
||||||
|
|
||||||
SetShaderParams( SpriteShader, r1, r2, scroll );
|
SetShaderParams( SpriteShader, r1, r2, scroll );
|
||||||
SetShaderParams( LineShader, r1, r2, scroll );
|
SetShaderParams( LineShader, r1, r2, scroll );
|
||||||
SetShaderParams( RgbaSpriteShader, r1, r2, scroll );
|
SetShaderParams( RgbaSpriteShader, r1, r2, scroll );
|
||||||
|
|||||||
@@ -50,10 +50,7 @@ namespace OpenRA.Graphics
|
|||||||
{
|
{
|
||||||
Timer.Time( "DrawRegions start" );
|
Timer.Time( "DrawRegions start" );
|
||||||
|
|
||||||
float2 r1 = new float2(2, -2) / screenSize;
|
renderer.BeginFrame(scrollPosition.ToInt2());
|
||||||
float2 r2 = new float2(-1, 1);
|
|
||||||
|
|
||||||
renderer.BeginFrame(r1, r2, scrollPosition.ToInt2());
|
|
||||||
world.WorldRenderer.Draw();
|
world.WorldRenderer.Draw();
|
||||||
Timer.Time( "worldRenderer: {0}" );
|
Timer.Time( "worldRenderer: {0}" );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user