GWN: IMM: Add util function to batch several immRecti/immRectf
This commit is contained in:
parent
de6289e79e
commit
5559abf31d
|
@ -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]);
|
||||
|
|
|
@ -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])
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue