Commit Graph

42 Commits

Author SHA1 Message Date
Paul Chote
a754a96b77 Convert SpriteRenderer to TriangleList. 2015-12-26 12:46:54 +00:00
Paul Chote
83949b250a Add a visualisation mode for depth sprites.
For now this displays the raw sprites.  It will
eventually be repurposed for rendering the proper
depth data.
2015-10-17 22:35:47 +01:00
RoosterDragon
92389916a6 Cache the simpler delegates used in IShader.Render calls. 2015-07-15 21:09:11 +01:00
RoosterDragon
1e60a0ca76 Create only one scratch vertex buffer for rendering.
Previously several buffers were created but only one was ever used.
2015-06-05 21:32:07 +01:00
Paul Chote
629f877032 Extract terrain vertex buffer into a reusable class. 2015-05-29 19:06:11 +01:00
Paul Chote
5532ed4fc9 Remove now-redundant blend code. 2015-05-23 08:50:28 +01:00
Matthias Mailänder
63e4d40770 add alpha channel to every possible blend mode 2015-04-26 09:22:19 +02:00
RoosterDragon
4d5101a7c4 Vastly improve shroud rendering performance.
Changes in the shroud are now tracked. If a cell changes it will mark itself and its neighbors as dirty. During the render phase all dirty cells will have their vertices calculated and cached. If a cell is not dirty, the pre-calculated vertices are retrieved from cache. Then the sprite renderer is provided the sprite and the pre-calculated vertices to draw.

This prevents constant recalculation of vertices for the shroud in the render phase, requiring instead only dirty cells in the visible area. The update phase is reduced to a practical noop, instead incurring the cost only of changed cells each frame, rather than checking the visible area.
2015-02-20 20:03:42 +00:00
Paul Chote
3ea70e891d Merge pull request #7291 from RoosterDragon/dynamic-palette-sizing
Implement dynamic hardware palette sizing.
2015-01-13 17:41:15 +13:00
abcdefg30
8ca61aa917 Updated all year numbers 2015-01-09 21:18:05 +01:00
RoosterDragon
53f06ba093 Implement dynamic hardware palette sizing.
The HardwarePalette will now grow its palette buffer and texture in power-of-2 increments. This avoids it having to allocate memory for a full 256x256 texture up front. In practice the default mods use 22 or 23 palettes so a 32x256 texture is used. This means both the buffer and texture save neatly on memory. Additionally, HardwarePalette.ApplyModifiers sees a nice speedup as it has to transfer a much smaller amount of memory from the buffer to the texture.

To facilitate this change, the MaxPalettes constant is no more. Instead the PaletteReference deals with the calculation of the index and this is passed into the appropriate methods.
2015-01-07 22:41:51 +00:00
Matthias Mailänder
bc3acfeee7 StyleCop clean OpenRA.Game 2015-01-04 15:38:54 +01:00
RoosterDragon
9cbac2d5e1 Clean up style of files affected by the last commit. 2014-12-22 17:34:02 +00:00
RoosterDragon
f0f02dff5c Dispose of graphics resources deterministically.
Textures, FrameBuffers and VertexBuffers allocated by the Sdl2 Renderer were only being released via finalizers. This could lead to OpenGL out of memory errors since resources may not be cleaned up in a timely manner. To avoid this, IDisposable has been implemented and transitively applied to classes that use these resources.

As a side-effect some static state is no longer static, particularly in Renderer, in order to facilitate this change and just for nicer design in general.

Also dispose some bitmaps.
2014-12-22 17:34:01 +00:00
RoosterDragon
a6f5a21ed4 Made Sheet.Texture into Sheet.GetTexture() since we will want to call it for side-effects.
Do the same for Sheet.Data since it has the side effect of generating a buffer.
2014-11-29 12:04:50 +00:00
huwpascoe
7d96a6ac96 Fixed SpriteRenderer offset bug. 2014-08-21 20:08:33 +01:00
Alexander Fast
070d00c678 Fixes year numbers in license text in file headers. 2014-08-21 11:27:52 +02:00
RoosterDragon
a2ed4fd5f9 Avoid redundantly setting viewport parameters in BeginFrame.
- Cache the old resolution, scroll and zoom in BeginFrame, and don't bother updating the viewport parameters again until they change.
- Pass around scroll as an int2 to reduce the number of back-and-forth casts.
2014-06-10 17:06:25 +01:00
Paul Chote
4935266945 Merge FileFormats dll into Game and reorganise namespaces. 2014-04-17 01:20:47 +12:00
Paul Chote
a1dd7cff7b Support additive blending for D2K explosions. 2013-08-14 17:31:02 +12:00
Paul Chote
52335a37bf Allow/require renderers to enable alpha blending when needed. Fixes voxel shadow issues. 2013-06-15 19:31:52 +12:00
Paul Chote
2215f74959 Support rendering sprites into non-rectangular quads. 2013-06-15 19:16:09 +12:00
Paul Chote
18311be3ae Remove nearest-int position rounding from SpriteRenderer.
The things that want to be rounded already do this
much earlier (wr.ScreenPxPosition, etc).
2013-06-15 19:16:08 +12:00
Paul Chote
7beef85a64 Use PaletteReferences everywhere. 2013-06-15 19:16:08 +12:00
Paul Chote
e5bcb88b0e Support sprites with an internal offset. 2013-06-15 19:16:08 +12:00
Matthias Mailänder
6c6f5601d8 make PaletteTexture private and only use it for sprite renders 2013-04-06 08:44:32 +02:00
Paul Chote
8a53819f50 Redirect IShader calls via respective *Renderers. 2013-03-08 18:21:35 +13:00
Paul Chote
786c3b1f1a Rename uniform setters to avoid future ambiguity. 2013-03-04 19:06:42 +13:00
Paul Chote
e9665cf9f3 Remove WorldRenderer.GetPaletteIndex. 2013-02-26 09:35:41 +13:00
Chris Forbes
55036cd58c fix trailing whitespace everywhere 2011-09-26 08:40:39 +13:00
Chris Forbes
4d6b2c7954 IBOless rendering with quads; considerably reduces renderer complexity 2011-05-18 20:42:10 +12:00
Chris Forbes
16cb275a5f fix rendering of very large maps 2011-03-08 19:24:15 +13:00
Paul Chote
094907c1a9 Update copyright header. Normalize line endings to LF. 2011-02-13 10:38:57 +13:00
Bob
ab1e930ba3 pass worldRenderer around as necessary 2010-10-12 17:24:07 +13:00
Bob
14e517cab5 Autoflush renderer. Sprite.DrawAt convenience function. 2010-09-24 18:11:03 +12:00
Bob
cdcfeb6276 render perf improvement: BufferSubData, and don't use the same buffer back-to-back 2010-09-24 18:11:00 +12:00
Paul Chote
8e42dd95fc RGBASpriteRender doesn't care about palettes 2010-08-25 20:15:44 +12:00
alzeih
222b29cec6 Bye Bye Chrome! 2010-07-21 17:57:06 +12:00
Chris Forbes
d5f12dd8ee trim down license spam in all files 2010-07-18 16:48:21 +12:00
Bob
96af8b037a unbug prev, and remove misleading code that no longer works 2010-04-11 22:44:39 +12:00
Bob
8a3e5b8ccc remove allowAlpha from SpriteRenderer 2010-04-11 20:05:08 +12:00
alzeih
7881deca30 Everything is now OpenRA, not OpenRa 2010-02-27 21:10:22 +13:00