gawain update: immAttribute for 2i

This commit is contained in:
Dalai Felinto 2016-09-20 14:43:13 +00:00
parent 6ebf5c18c3
commit 04bc828fb6
2 changed files with 38 additions and 0 deletions

View File

@ -468,6 +468,26 @@ void immAttrib4f(unsigned attrib_id, float x, float y, float z, float w)
data[3] = w;
}
void immAttrib2i(unsigned attrib_id, int x, int y)
{
Attrib* attrib = imm.vertex_format.attribs + attrib_id;
#if TRUST_NO_ONE
assert(attrib_id < imm.vertex_format.attrib_ct);
assert(attrib->comp_type == GL_INT);
assert(attrib->comp_ct == 2);
assert(imm.vertex_idx < imm.vertex_ct);
assert(imm.primitive != PRIM_NONE); // make sure we're between a Begin/End pair
#endif
setAttribValueBit(attrib_id);
int* data = (int*)(imm.vertex_data + attrib->offset);
data[0] = x;
data[1] = y;
}
void immAttrib3fv(unsigned attrib_id, const float data[3])
{
immAttrib3f(attrib_id, data[0], data[1], data[2]);
@ -581,6 +601,12 @@ void immVertex3f(unsigned attrib_id, float x, float y, float z)
immEndVertex();
}
void immVertex2i(unsigned attrib_id, int x, int y)
{
immAttrib2i(attrib_id, x, y);
immEndVertex();
}
void immVertex2fv(unsigned attrib_id, const float data[2])
{
immAttrib2f(attrib_id, data[0], data[1]);
@ -604,6 +630,12 @@ void immUniform4f(const char* name, float x, float y, float z, float w)
glUniform4f(loc, x, y, z, w);
}
void immVertex2iv(unsigned attrib_id, const int data[2])
{
immAttrib2i(attrib_id, data[0], data[1]);
immEndVertex();
}
void immUniformColor3ubv(const unsigned char rgb[3])
{
const float scale = 1.0f / 255.0f;

View File

@ -41,6 +41,8 @@ void immAttrib2f(unsigned attrib_id, float x, float y);
void immAttrib3f(unsigned attrib_id, float x, float y, float z);
void immAttrib4f(unsigned attrib_id, float x, float y, float z, float w);
void immAttrib2i(unsigned attrib_id, int x, int y);
void immAttrib3fv(unsigned attrib_id, const float data[3]);
void immAttrib4fv(unsigned attrib_id, const float data[4]);
@ -56,9 +58,13 @@ void immEndVertex(void); // and move on to the next vertex
void immVertex2f(unsigned attrib_id, float x, float y);
void immVertex3f(unsigned attrib_id, float x, float y, float z);
void immVertex2i(unsigned attrib_id, int x, int y);
void immVertex2fv(unsigned attrib_id, const float data[2]);
void immVertex3fv(unsigned attrib_id, const float data[3]);
void immVertex2iv(unsigned attrib_id, const int data[2]);
// provide values that don't change for the entire draw call
void immUniform4f(const char* name, float x, float y, float z, float w);