diff options
Diffstat (limited to 'intern')
-rw-r--r-- | intern/gawain/gawain/gwn_imm_util.h | 4 | ||||
-rw-r--r-- | intern/gawain/src/gwn_imm_util.c | 34 |
2 files changed, 38 insertions, 0 deletions
diff --git a/intern/gawain/gawain/gwn_imm_util.h b/intern/gawain/gawain/gwn_imm_util.h index 730bd7c1a3c..5d17ec50669 100644 --- a/intern/gawain/gawain/gwn_imm_util.h +++ b/intern/gawain/gawain/gwn_imm_util.h @@ -16,3 +16,7 @@ // caller is reponsible for vertex format & shader void immRectf(unsigned pos, float x1, float y1, float x2, float y2); void immRecti(unsigned pos, int x1, int y1, int x2, int y2); + +// Same as immRectf/immRecti but does not call immBegin/immEnd. To use with GWN_PRIM_TRIS. +void immRectf_fast_with_color(unsigned pos, unsigned col, float x1, float y1, float x2, float y2, const float color[4]); +void immRecti_fast_with_color(unsigned pos, unsigned col, int x1, int y1, int x2, int y2, const float color[4]); diff --git a/intern/gawain/src/gwn_imm_util.c b/intern/gawain/src/gwn_imm_util.c index 45d8a7036e8..a8d2b05c8a3 100644 --- a/intern/gawain/src/gwn_imm_util.c +++ b/intern/gawain/src/gwn_imm_util.c @@ -33,6 +33,40 @@ void immRecti(unsigned pos, int x1, int y1, int x2, int y2) immEnd(); } +void immRectf_fast_with_color(unsigned pos, unsigned col, float x1, float y1, float x2, float y2, const float color[4]) + { + immAttrib4fv(col, color); + immVertex2f(pos, x1, y1); + immAttrib4fv(col, color); + immVertex2f(pos, x2, y1); + immAttrib4fv(col, color); + immVertex2f(pos, x2, y2); + + immAttrib4fv(col, color); + immVertex2f(pos, x1, y1); + immAttrib4fv(col, color); + immVertex2f(pos, x2, y2); + immAttrib4fv(col, color); + immVertex2f(pos, x1, y2); + } + +void immRecti_fast_with_color(unsigned pos, unsigned col, int x1, int y1, int x2, int y2, const float color[4]) + { + immAttrib4fv(col, color); + immVertex2i(pos, x1, y1); + immAttrib4fv(col, color); + immVertex2i(pos, x2, y1); + immAttrib4fv(col, color); + immVertex2i(pos, x2, y2); + + immAttrib4fv(col, color); + immVertex2i(pos, x1, y1); + immAttrib4fv(col, color); + immVertex2i(pos, x2, y2); + immAttrib4fv(col, color); + immVertex2i(pos, x1, y2); + } + #if 0 // more complete version in case we want that void immRecti_complete(int x1, int y1, int x2, int y2, const float color[4]) { |