1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-22 07:13:07 +01:00

Fix indentation

This commit is contained in:
Alexander Overvoorde
2016-07-22 22:58:52 +02:00
parent afd83fa13d
commit f8f996dfd6
2 changed files with 153 additions and 151 deletions

View File

@@ -21,30 +21,30 @@
#include "GLSLTypes.h" #include "GLSLTypes.h"
struct DrawRectCommand { struct DrawRectCommand {
uint32 flags; uint32 flags;
GLuint sourceFramebuffer; GLuint sourceFramebuffer;
vec4f colours[2]; vec4f colours[2];
sint32 clip[4]; sint32 clip[4];
sint32 bounds[4]; sint32 bounds[4];
}; };
struct DrawLineCommand { struct DrawLineCommand {
vec4f colour; vec4f colour;
sint32 clip[4]; sint32 clip[4];
sint32 pos[4]; sint32 pos[4];
}; };
struct DrawImageCommand { struct DrawImageCommand {
uint32 flags; uint32 flags;
vec4f colour; vec4f colour;
sint32 clip[4]; sint32 clip[4];
GLuint texColour; GLuint texColour;
sint32 bounds[4]; sint32 bounds[4];
}; };
struct DrawImageMaskedCommand { struct DrawImageMaskedCommand {
sint32 clip[4]; sint32 clip[4];
GLuint texMask; GLuint texMask;
GLuint texColour; GLuint texColour;
sint32 bounds[4]; sint32 bounds[4];
}; };

View File

@@ -192,12 +192,12 @@ private:
sint32 _clipRight; sint32 _clipRight;
sint32 _clipBottom; sint32 _clipBottom;
struct { struct {
std::vector<DrawRectCommand> rectangles; std::vector<DrawRectCommand> rectangles;
std::vector<DrawLineCommand> lines; std::vector<DrawLineCommand> lines;
std::vector<DrawImageCommand> images; std::vector<DrawImageCommand> images;
std::vector<DrawImageMaskedCommand> maskedImages; std::vector<DrawImageMaskedCommand> maskedImages;
} _commandBuffers; } _commandBuffers;
public: public:
explicit OpenGLDrawingContext(OpenGLDrawingEngine * engine); explicit OpenGLDrawingContext(OpenGLDrawingEngine * engine);
@@ -218,12 +218,12 @@ public:
void DrawSpriteSolid(uint32 image, sint32 x, sint32 y, uint8 colour) override; void DrawSpriteSolid(uint32 image, sint32 x, sint32 y, uint8 colour) override;
void DrawGlyph(uint32 image, sint32 x, sint32 y, uint8 * palette) override; void DrawGlyph(uint32 image, sint32 x, sint32 y, uint8 * palette) override;
void FlushCommandBuffers(); void FlushCommandBuffers();
void FlushRectangles(); void FlushRectangles();
void FlushLines(); void FlushLines();
void FlushImages(); void FlushImages();
void FlushMaskedImages(); void FlushMaskedImages();
void SetDPI(rct_drawpixelinfo * dpi); void SetDPI(rct_drawpixelinfo * dpi);
}; };
@@ -340,13 +340,13 @@ public:
gfx_draw_pickedup_peep(&_bitsDPI); gfx_draw_pickedup_peep(&_bitsDPI);
_drawingContext->FlushCommandBuffers(); _drawingContext->FlushCommandBuffers();
_swapFramebuffer->SwapCopy(); _swapFramebuffer->SwapCopy();
rct2_draw(&_bitsDPI); rct2_draw(&_bitsDPI);
} }
_drawingContext->FlushCommandBuffers(); _drawingContext->FlushCommandBuffers();
// Scale up to window // Scale up to window
_screenFramebuffer->Bind(); _screenFramebuffer->Bind();
@@ -530,7 +530,7 @@ void OpenGLDrawingContext::Initialise()
void OpenGLDrawingContext::Resize(sint32 width, sint32 height) void OpenGLDrawingContext::Resize(sint32 width, sint32 height)
{ {
FlushCommandBuffers(); FlushCommandBuffers();
_drawImageShader->Use(); _drawImageShader->Use();
_drawImageShader->SetScreenSize(width, height); _drawImageShader->SetScreenSize(width, height);
@@ -544,7 +544,7 @@ void OpenGLDrawingContext::Resize(sint32 width, sint32 height)
void OpenGLDrawingContext::ResetPalette() void OpenGLDrawingContext::ResetPalette()
{ {
FlushCommandBuffers(); FlushCommandBuffers();
_textureCache->SetPalette(_engine->Palette); _textureCache->SetPalette(_engine->Palette);
_drawImageShader->Use(); _drawImageShader->Use();
@@ -565,9 +565,9 @@ void OpenGLDrawingContext::FillRect(uint32 colour, sint32 left, sint32 top, sint
right += _offsetX; right += _offsetX;
bottom += _offsetY; bottom += _offsetY;
DrawRectCommand command = {}; DrawRectCommand command = {};
command.sourceFramebuffer = _fillRectShader->GetSourceFramebuffer(); command.sourceFramebuffer = _fillRectShader->GetSourceFramebuffer();
vec4f paletteColour[2]; vec4f paletteColour[2];
paletteColour[0] = _engine->GLPalette[(colour >> 0) & 0xFF]; paletteColour[0] = _engine->GLPalette[(colour >> 0) & 0xFF];
@@ -576,7 +576,7 @@ void OpenGLDrawingContext::FillRect(uint32 colour, sint32 left, sint32 top, sint
{ {
paletteColour[1].a = 0; paletteColour[1].a = 0;
command.flags = 0; command.flags = 0;
} }
else if (colour & 0x2000000) else if (colour & 0x2000000)
{ {
@@ -593,31 +593,31 @@ void OpenGLDrawingContext::FillRect(uint32 colour, sint32 left, sint32 top, sint
paletteColour[1] = paletteColour[0]; paletteColour[1] = paletteColour[0];
GLuint srcTexture = _engine->SwapCopyReturningSourceTexture(); GLuint srcTexture = _engine->SwapCopyReturningSourceTexture();
command.flags = 1; command.flags = 1;
command.sourceFramebuffer = srcTexture; command.sourceFramebuffer = srcTexture;
} }
else else
{ {
command.flags = 0; command.flags = 0;
} }
command.colours[0] = paletteColour[0]; command.colours[0] = paletteColour[0];
command.colours[1] = paletteColour[1]; command.colours[1] = paletteColour[1];
command.clip[0] = _clipLeft; command.clip[0] = _clipLeft;
command.clip[1] = _clipTop; command.clip[1] = _clipTop;
command.clip[2] = _clipRight; command.clip[2] = _clipRight;
command.clip[3] = _clipBottom; command.clip[3] = _clipBottom;
command.bounds[0] = left; command.bounds[0] = left;
command.bounds[1] = top; command.bounds[1] = top;
command.bounds[2] = right + 1; command.bounds[2] = right + 1;
command.bounds[3] = bottom + 1; command.bounds[3] = bottom + 1;
_commandBuffers.rectangles.push_back(command); _commandBuffers.rectangles.push_back(command);
// Must be rendered in order, depends on already rendered contents // Must be rendered in order, depends on already rendered contents
FlushCommandBuffers(); FlushCommandBuffers();
} }
void OpenGLDrawingContext::DrawLine(uint32 colour, sint32 x1, sint32 y1, sint32 x2, sint32 y2) void OpenGLDrawingContext::DrawLine(uint32 colour, sint32 x1, sint32 y1, sint32 x2, sint32 y2)
@@ -629,24 +629,24 @@ void OpenGLDrawingContext::DrawLine(uint32 colour, sint32 x1, sint32 y1, sint32
vec4f paletteColour = _engine->GLPalette[colour & 0xFF]; vec4f paletteColour = _engine->GLPalette[colour & 0xFF];
DrawLineCommand command = {}; DrawLineCommand command = {};
command.colour = paletteColour; command.colour = paletteColour;
command.clip[0] = _clipLeft; command.clip[0] = _clipLeft;
command.clip[1] = _clipTop; command.clip[1] = _clipTop;
command.clip[2] = _clipRight; command.clip[2] = _clipRight;
command.clip[3] = _clipBottom; command.clip[3] = _clipBottom;
command.pos[0] = x1; command.pos[0] = x1;
command.pos[1] = y1; command.pos[1] = y1;
command.pos[2] = x2; command.pos[2] = x2;
command.pos[3] = y2; command.pos[3] = y2;
_commandBuffers.lines.push_back(command); _commandBuffers.lines.push_back(command);
// Must be rendered in order right now, because it does not yet use depth // Must be rendered in order right now, because it does not yet use depth
FlushCommandBuffers(); FlushCommandBuffers();
} }
void OpenGLDrawingContext::DrawSprite(uint32 image, sint32 x, sint32 y, uint32 tertiaryColour) void OpenGLDrawingContext::DrawSprite(uint32 image, sint32 x, sint32 y, uint32 tertiaryColour)
@@ -716,21 +716,21 @@ void OpenGLDrawingContext::DrawSprite(uint32 image, sint32 x, sint32 y, uint32 t
DrawImageCommand command = {}; DrawImageCommand command = {};
command.flags = 0; command.flags = 0;
command.clip[0] = _clipLeft; command.clip[0] = _clipLeft;
command.clip[1] = _clipTop; command.clip[1] = _clipTop;
command.clip[2] = _clipRight; command.clip[2] = _clipRight;
command.clip[3] = _clipBottom; command.clip[3] = _clipBottom;
command.texColour = texture; command.texColour = texture;
command.bounds[0] = left; command.bounds[0] = left;
command.bounds[1] = top; command.bounds[1] = top;
command.bounds[2] = right; command.bounds[2] = right;
command.bounds[3] = bottom; command.bounds[3] = bottom;
_commandBuffers.images.push_back(command); _commandBuffers.images.push_back(command);
} }
void OpenGLDrawingContext::DrawSpriteRawMasked(sint32 x, sint32 y, uint32 maskImage, uint32 colourImage) void OpenGLDrawingContext::DrawSpriteRawMasked(sint32 x, sint32 y, uint32 maskImage, uint32 colourImage)
@@ -777,22 +777,22 @@ void OpenGLDrawingContext::DrawSpriteRawMasked(sint32 x, sint32 y, uint32 maskIm
right += _clipLeft; right += _clipLeft;
bottom += _clipTop; bottom += _clipTop;
DrawImageMaskedCommand command = {}; DrawImageMaskedCommand command = {};
command.clip[0] = _clipLeft; command.clip[0] = _clipLeft;
command.clip[1] = _clipTop; command.clip[1] = _clipTop;
command.clip[2] = _clipRight; command.clip[2] = _clipRight;
command.clip[3] = _clipBottom; command.clip[3] = _clipBottom;
command.texMask = textureMask; command.texMask = textureMask;
command.texColour = textureColour; command.texColour = textureColour;
command.bounds[0] = left; command.bounds[0] = left;
command.bounds[1] = top; command.bounds[1] = top;
command.bounds[2] = right; command.bounds[2] = right;
command.bounds[3] = bottom; command.bounds[3] = bottom;
_commandBuffers.maskedImages.push_back(command); _commandBuffers.maskedImages.push_back(command);
// Currently not properly ordered with regular images yet // Currently not properly ordered with regular images yet
FlushCommandBuffers(); FlushCommandBuffers();
@@ -831,24 +831,24 @@ void OpenGLDrawingContext::DrawSpriteSolid(uint32 image, sint32 x, sint32 y, uin
right += _offsetX; right += _offsetX;
bottom += _offsetY; bottom += _offsetY;
DrawImageCommand command = {}; DrawImageCommand command = {};
command.flags = 1; command.flags = 1;
command.colour = paletteColour; command.colour = paletteColour;
command.clip[0] = _clipLeft; command.clip[0] = _clipLeft;
command.clip[1] = _clipTop; command.clip[1] = _clipTop;
command.clip[2] = _clipRight; command.clip[2] = _clipRight;
command.clip[3] = _clipBottom; command.clip[3] = _clipBottom;
command.texColour = texture; command.texColour = texture;
command.bounds[0] = left; command.bounds[0] = left;
command.bounds[1] = top; command.bounds[1] = top;
command.bounds[2] = right; command.bounds[2] = right;
command.bounds[3] = bottom; command.bounds[3] = bottom;
_commandBuffers.images.push_back(command); _commandBuffers.images.push_back(command);
} }
void OpenGLDrawingContext::DrawGlyph(uint32 image, sint32 x, sint32 y, uint8 * palette) void OpenGLDrawingContext::DrawGlyph(uint32 image, sint32 x, sint32 y, uint8 * palette)
@@ -882,81 +882,83 @@ void OpenGLDrawingContext::DrawGlyph(uint32 image, sint32 x, sint32 y, uint8 * p
right += _offsetX; right += _offsetX;
bottom += _offsetY; bottom += _offsetY;
DrawImageCommand command = {}; DrawImageCommand command = {};
command.flags = 0; command.flags = 0;
command.clip[0] = _clipLeft; command.clip[0] = _clipLeft;
command.clip[1] = _clipTop; command.clip[1] = _clipTop;
command.clip[2] = _clipRight; command.clip[2] = _clipRight;
command.clip[3] = _clipBottom; command.clip[3] = _clipBottom;
command.texColour = texture; command.texColour = texture;
command.bounds[0] = left; command.bounds[0] = left;
command.bounds[1] = top; command.bounds[1] = top;
command.bounds[2] = right; command.bounds[2] = right;
command.bounds[3] = bottom; command.bounds[3] = bottom;
_commandBuffers.images.push_back(command); _commandBuffers.images.push_back(command);
} }
void OpenGLDrawingContext::FlushCommandBuffers() { void OpenGLDrawingContext::FlushCommandBuffers() {
FlushRectangles(); FlushRectangles();
FlushLines(); FlushLines();
FlushImages(); FlushImages();
FlushMaskedImages(); FlushMaskedImages();
} }
void OpenGLDrawingContext::FlushRectangles() { void OpenGLDrawingContext::FlushRectangles() {
for (const auto& command : _commandBuffers.rectangles) { for (const auto& command : _commandBuffers.rectangles) {
_fillRectShader->Use(); _fillRectShader->Use();
_fillRectShader->SetFlags(command.flags); _fillRectShader->SetFlags(command.flags);
_fillRectShader->SetSourceFramebuffer(command.sourceFramebuffer); _fillRectShader->SetSourceFramebuffer(command.sourceFramebuffer);
_fillRectShader->SetColour(0, command.colours[0]); _fillRectShader->SetColour(0, command.colours[0]);
_fillRectShader->SetColour(1, command.colours[1]); _fillRectShader->SetColour(1, command.colours[1]);
_fillRectShader->SetClip(command.clip[0], command.clip[1], command.clip[2], command.clip[3]); _fillRectShader->SetClip(command.clip[0], command.clip[1], command.clip[2], command.clip[3]);
_fillRectShader->Draw(command.bounds[0], command.bounds[1], command.bounds[2], command.bounds[3]); _fillRectShader->Draw(command.bounds[0], command.bounds[1], command.bounds[2], command.bounds[3]);
} }
_commandBuffers.rectangles.clear(); _commandBuffers.rectangles.clear();
} }
void OpenGLDrawingContext::FlushLines() { void OpenGLDrawingContext::FlushLines() {
for (const auto& command : _commandBuffers.lines) { for (const auto& command : _commandBuffers.lines) {
_drawLineShader->Use(); _drawLineShader->Use();
_drawLineShader->SetColour(command.colour); _drawLineShader->SetColour(command.colour);
_drawLineShader->SetClip(command.clip[0], command.clip[1], command.clip[2], command.clip[3]); _drawLineShader->SetClip(command.clip[0], command.clip[1], command.clip[2], command.clip[3]);
_drawLineShader->Draw(command.pos[0], command.pos[1], command.pos[2], command.pos[3]); _drawLineShader->Draw(command.pos[0], command.pos[1], command.pos[2], command.pos[3]);
} }
_commandBuffers.lines.clear(); _commandBuffers.lines.clear();
} }
void OpenGLDrawingContext::FlushImages() { void OpenGLDrawingContext::FlushImages() {
for (const auto& command : _commandBuffers.images) { // DEBUG: disabled until new array based texture cache is finished
_drawImageShader->Use(); /*for (const auto& command : _commandBuffers.images) {
_drawImageShader->SetClip(command.clip[0], command.clip[1], command.clip[2], command.clip[3]); _drawImageShader->Use();
_drawImageShader->SetTexture(command.texColour); _drawImageShader->SetClip(command.clip[0], command.clip[1], command.clip[2], command.clip[3]);
_drawImageShader->SetFlags(command.flags); _drawImageShader->SetTexture(command.texColour);
_drawImageShader->SetColour(command.colour); _drawImageShader->SetFlags(command.flags);
_drawImageShader->Draw(command.bounds[0], command.bounds[1], command.bounds[2], command.bounds[3]); _drawImageShader->SetColour(command.colour);
} _drawImageShader->Draw(command.bounds[0], command.bounds[1], command.bounds[2], command.bounds[3]);
}*/
_commandBuffers.images.clear(); _commandBuffers.images.clear();
} }
void OpenGLDrawingContext::FlushMaskedImages() { void OpenGLDrawingContext::FlushMaskedImages() {
for (const auto& command : _commandBuffers.maskedImages) { // DEBUG: disabled until new array based texture cache is finished
_drawImageMaskedShader->Use(); /*for (const auto& command : _commandBuffers.maskedImages) {
_drawImageMaskedShader->SetClip(command.clip[0], command.clip[1], command.clip[2], command.clip[3]); _drawImageMaskedShader->Use();
_drawImageMaskedShader->SetTextureMask(command.texMask); _drawImageMaskedShader->SetClip(command.clip[0], command.clip[1], command.clip[2], command.clip[3]);
_drawImageMaskedShader->SetTextureColour(command.texColour); _drawImageMaskedShader->SetTextureMask(command.texMask);
_drawImageMaskedShader->Draw(command.bounds[0], command.bounds[1], command.bounds[2], command.bounds[3]); _drawImageMaskedShader->SetTextureColour(command.texColour);
} _drawImageMaskedShader->Draw(command.bounds[0], command.bounds[1], command.bounds[2], command.bounds[3]);
}*/
_commandBuffers.maskedImages.clear(); _commandBuffers.maskedImages.clear();
} }
void OpenGLDrawingContext::SetDPI(rct_drawpixelinfo * dpi) void OpenGLDrawingContext::SetDPI(rct_drawpixelinfo * dpi)