mirror of
https://github.com/edubart/otclient.git
synced 2025-10-19 05:53:26 +02:00
progress rect
This commit is contained in:
@@ -41,6 +41,10 @@ public:
|
||||
m_hardwareCached = false;
|
||||
}
|
||||
|
||||
void addTriangle(const Point& a, const Point& b, const Point& c) {
|
||||
m_vertexArray.addTriangle(a, b, c);
|
||||
m_hardwareCached = false;
|
||||
}
|
||||
void addRect(const Rect& dest) {
|
||||
m_vertexArray.addRect(dest);
|
||||
m_hardwareCached = false;
|
||||
|
@@ -76,6 +76,7 @@ public:
|
||||
void drawTexturedRect(const Rect& dest, const TexturePtr& texture) { drawTexturedRect(dest, texture, Rect(Point(0,0), texture->getSize())); }
|
||||
virtual void drawRepeatedTexturedRect(const Rect& dest, const TexturePtr& texture, const Rect& src) = 0;
|
||||
virtual void drawFilledRect(const Rect& dest) = 0;
|
||||
virtual void drawFilledTriangle(const Point& a, const Point& b, const Point& c) = 0;
|
||||
virtual void drawBoundingRect(const Rect& dest, int innerLineWidth = 1) = 0;
|
||||
|
||||
virtual void setProjectionMatrix(const Matrix3& projectionMatrix) { m_projectionMatrix = projectionMatrix; }
|
||||
|
@@ -167,6 +167,18 @@ void PainterOGL1::drawFilledRect(const Rect& dest)
|
||||
drawCoords(m_coordsBuffer);
|
||||
}
|
||||
|
||||
void PainterOGL1::drawFilledTriangle(const Point& a, const Point& b, const Point& c)
|
||||
{
|
||||
if(a == b || a == c || b == c)
|
||||
return;
|
||||
|
||||
setTexture(nullptr);
|
||||
|
||||
m_coordsBuffer.clear();
|
||||
m_coordsBuffer.addTriangle(a, b, c);
|
||||
drawCoords(m_coordsBuffer);
|
||||
}
|
||||
|
||||
void PainterOGL1::drawBoundingRect(const Rect& dest, int innerLineWidth)
|
||||
{
|
||||
if(dest.isEmpty() || innerLineWidth == 0)
|
||||
|
@@ -53,6 +53,7 @@ public:
|
||||
void drawTexturedRect(const Rect& dest, const TexturePtr& texture, const Rect& src);
|
||||
void drawRepeatedTexturedRect(const Rect& dest, const TexturePtr& texture, const Rect& src);
|
||||
void drawFilledRect(const Rect& dest);
|
||||
void drawFilledTriangle(const Point& a, const Point& b, const Point& c);
|
||||
void drawBoundingRect(const Rect& dest, int innerLineWidth);
|
||||
|
||||
void setMatrixMode(MatrixMode matrixMode);
|
||||
|
@@ -150,6 +150,18 @@ void PainterOGL2::drawFilledRect(const Rect& dest)
|
||||
drawCoords(m_coordsBuffer);
|
||||
}
|
||||
|
||||
void PainterOGL2::drawFilledTriangle(const Point& a, const Point& b, const Point& c)
|
||||
{
|
||||
if(a == b || a == c || b == c)
|
||||
return;
|
||||
|
||||
setDrawProgram(m_shaderProgram ? m_shaderProgram : g_shaders.getDrawSolidColorProgram().get());
|
||||
|
||||
m_coordsBuffer.clear();
|
||||
m_coordsBuffer.addTriangle(a, b, c);
|
||||
drawCoords(m_coordsBuffer);
|
||||
}
|
||||
|
||||
void PainterOGL2::drawBoundingRect(const Rect& dest, int innerLineWidth)
|
||||
{
|
||||
if(dest.isEmpty() || innerLineWidth == 0)
|
||||
|
@@ -46,6 +46,7 @@ public:
|
||||
void drawTexturedRect(const Rect& dest, const TexturePtr& texture, const Rect& src);
|
||||
void drawRepeatedTexturedRect(const Rect& dest, const TexturePtr& texture, const Rect& src);
|
||||
void drawFilledRect(const Rect& dest);
|
||||
void drawFilledTriangle(const Point& a, const Point& b, const Point& c);
|
||||
void drawBoundingRect(const Rect& dest, int innerLineWidth = 1);
|
||||
|
||||
void setDrawProgram(PainterShaderProgram *drawProgram) { m_drawProgram = drawProgram; }
|
||||
|
@@ -30,6 +30,11 @@ class VertexArray
|
||||
{
|
||||
public:
|
||||
inline void addVertex(float x, float y) { m_buffer << x << y; }
|
||||
inline void addTriangle(const Point& a, const Point& b, const Point& c) {
|
||||
addVertex(a.x, a.y);
|
||||
addVertex(b.x, b.y);
|
||||
addVertex(c.x, c.y);
|
||||
}
|
||||
inline void addRect(const Rect& rect) {
|
||||
float top = rect.top();
|
||||
float right = rect.right()+1;
|
||||
|
Reference in New Issue
Block a user