summaryrefslogtreecommitdiffstats
path: root/src/render
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2019-10-05 16:32:01 +0200
committerSergeanur <s.anureev@yandex.ua>2019-10-05 16:32:01 +0200
commit365f9e9caff6f61ef08ca67526fd85f9a010d965 (patch)
tree685c0033f54e2a1210a92ad213e950dceef33940 /src/render
parentMerge pull request #224 from erorcun/erorcun (diff)
downloadre3-365f9e9caff6f61ef08ca67526fd85f9a010d965.tar
re3-365f9e9caff6f61ef08ca67526fd85f9a010d965.tar.gz
re3-365f9e9caff6f61ef08ca67526fd85f9a010d965.tar.bz2
re3-365f9e9caff6f61ef08ca67526fd85f9a010d965.tar.lz
re3-365f9e9caff6f61ef08ca67526fd85f9a010d965.tar.xz
re3-365f9e9caff6f61ef08ca67526fd85f9a010d965.tar.zst
re3-365f9e9caff6f61ef08ca67526fd85f9a010d965.zip
Diffstat (limited to '')
-rw-r--r--src/render/Sprite2d.cpp14
-rw-r--r--src/render/Sprite2d.h2
2 files changed, 16 insertions, 0 deletions
diff --git a/src/render/Sprite2d.cpp b/src/render/Sprite2d.cpp
index 4ed27fa1..c4dbcdaa 100644
--- a/src/render/Sprite2d.cpp
+++ b/src/render/Sprite2d.cpp
@@ -457,6 +457,20 @@ CSprite2d::DrawRectXLU(const CRect &r, const CRGBA &c0, const CRGBA &c1, const C
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
}
+void CSprite2d::Draw2DPolygon(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, const CRGBA &color)
+{
+ SetVertices(x1, y1, x2, y2, x3, y3, x4, y4, color, color, color, color);
+ RwRenderStateSet(rwRENDERSTATETEXTURERASTER, 0);
+ RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEFLAT);
+ RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
+ RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)(color.a != 255));
+ RwIm2DRenderPrimitive(rwPRIMTYPETRIFAN, CSprite2d::maVertices, 4);
+ RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
+ RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
+ RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEGOURAUD);
+}
+
STARTPATCHES
#define C4 const CRGBA&, const CRGBA&, const CRGBA&, const CRGBA&
#define F8 float, float, float, float, float, float, float, float
diff --git a/src/render/Sprite2d.h b/src/render/Sprite2d.h
index e0f19ef1..268c7d2b 100644
--- a/src/render/Sprite2d.h
+++ b/src/render/Sprite2d.h
@@ -47,5 +47,7 @@ public:
static void DrawRect(const CRect &r, const CRGBA &col);
static void DrawRectXLU(const CRect &r, const CRGBA &c0, const CRGBA &c1, const CRGBA &c2, const CRGBA &c3);
+ static void Draw2DPolygon(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, const CRGBA &color);
+
static RwIm2DVertex* GetVertices() { return maVertices; };
};