remove fixed-function vertex attributes
parent
e323ea1e41
commit
115b7906fd
|
@ -216,9 +216,10 @@ fxaadefs = [
|
|||
]
|
||||
|
||||
shader 0 [fxaa@fxaapreset@fxaaopts] [
|
||||
attribute vec4 vvertex;
|
||||
void main(void)
|
||||
{
|
||||
gl_Position = gl_Vertex;
|
||||
gl_Position = vvertex;
|
||||
}
|
||||
] [
|
||||
#extension GL_ARB_texture_rectangle : enable
|
||||
|
|
710
data/glsl.cfg
710
data/glsl.cfg
File diff suppressed because it is too large
Load Diff
|
@ -88,13 +88,15 @@ smaadefs = [
|
|||
]
|
||||
|
||||
shader 0 [SMAALumaEdgeDetection@smaapreset@smaaopts] [
|
||||
attribute vec4 vvertex;
|
||||
attribute vec2 vtexcoord0;
|
||||
void main(void)
|
||||
{
|
||||
gl_Position = gl_Vertex;
|
||||
gl_TexCoord[0].xy = gl_MultiTexCoord0.xy;
|
||||
gl_TexCoord[1] = gl_MultiTexCoord0.xyxy + vec4(-1.0, 0.0, 0.0, -1.0);
|
||||
gl_TexCoord[2] = gl_MultiTexCoord0.xyxy + vec4( 1.0, 0.0, 0.0, 1.0);
|
||||
gl_TexCoord[3] = gl_MultiTexCoord0.xyxy + vec4(-2.0, 0.0, 0.0, -2.0);
|
||||
gl_Position = vvertex;
|
||||
gl_TexCoord[0].xy = vtexcoord0;
|
||||
gl_TexCoord[1] = vtexcoord0.xyxy + vec4(-1.0, 0.0, 0.0, -1.0);
|
||||
gl_TexCoord[2] = vtexcoord0.xyxy + vec4( 1.0, 0.0, 0.0, 1.0);
|
||||
gl_TexCoord[3] = vtexcoord0.xyxy + vec4(-2.0, 0.0, 0.0, -2.0);
|
||||
}
|
||||
] [
|
||||
#extension GL_ARB_texture_rectangle : enable
|
||||
|
@ -155,13 +157,15 @@ shader 0 [SMAALumaEdgeDetection@smaapreset@smaaopts] [
|
|||
]
|
||||
|
||||
shader 0 [SMAAColorEdgeDetection@smaapreset@smaaopts] [
|
||||
attribute vec4 vvertex;
|
||||
attribute vec2 vtexcoord0;
|
||||
void main(void)
|
||||
{
|
||||
gl_Position = gl_Vertex;
|
||||
gl_TexCoord[0].xy = gl_MultiTexCoord0.xy;
|
||||
gl_TexCoord[1] = gl_MultiTexCoord0.xyxy + vec4(-1.0, 0.0, 0.0, -1.0);
|
||||
gl_TexCoord[2] = gl_MultiTexCoord0.xyxy + vec4( 1.0, 0.0, 0.0, 1.0);
|
||||
gl_TexCoord[3] = gl_MultiTexCoord0.xyxy + vec4(-2.0, 0.0, 0.0, -2.0);
|
||||
gl_Position = vvertex;
|
||||
gl_TexCoord[0].xy = vtexcoord0;
|
||||
gl_TexCoord[1] = vtexcoord0.xyxy + vec4(-1.0, 0.0, 0.0, -1.0);
|
||||
gl_TexCoord[2] = vtexcoord0.xyxy + vec4( 1.0, 0.0, 0.0, 1.0);
|
||||
gl_TexCoord[3] = vtexcoord0.xyxy + vec4(-2.0, 0.0, 0.0, -2.0);
|
||||
}
|
||||
] [
|
||||
#extension GL_ARB_texture_rectangle : enable
|
||||
|
@ -210,14 +214,16 @@ shader 0 [SMAAColorEdgeDetection@smaapreset@smaaopts] [
|
|||
|
||||
shader 0 [SMAABlendingWeightCalculation@smaapreset@smaaopts] [
|
||||
@smaadefs
|
||||
attribute vec4 vvertex;
|
||||
attribute vec2 vtexcoord0;
|
||||
void main(void)
|
||||
{
|
||||
gl_Position = gl_Vertex;
|
||||
gl_TexCoord[0].xy = gl_MultiTexCoord0.xy;
|
||||
gl_Position = vvertex;
|
||||
gl_TexCoord[0].xy = vtexcoord0;
|
||||
|
||||
// We will use these offsets for the searches later on (see PSEUDO_GATHER4):
|
||||
gl_TexCoord[1] = gl_MultiTexCoord0.xyxy + vec4(-0.25, -0.125, 1.25, -0.125);
|
||||
gl_TexCoord[2] = gl_MultiTexCoord0.xyxy + vec4(-0.125, -0.25, -0.125, 1.25);
|
||||
gl_TexCoord[1] = vtexcoord0.xyxy + vec4(-0.25, -0.125, 1.25, -0.125);
|
||||
gl_TexCoord[2] = vtexcoord0.xyxy + vec4(-0.125, -0.25, -0.125, 1.25);
|
||||
|
||||
@(if (smaaopt "m") [result [
|
||||
gl_TexCoord[3].xy = gl_MultiTexCoord1.xy;
|
||||
|
@ -551,12 +557,14 @@ shader 0 [SMAABlendingWeightCalculation@smaapreset@smaaopts] [
|
|||
]
|
||||
|
||||
shader 0 [SMAANeighborhoodBlending@smaapreset@smaaopts] [
|
||||
attribute vec4 vvertex;
|
||||
attribute vec2 vtexcoord0;
|
||||
void main(void)
|
||||
{
|
||||
gl_Position = gl_Vertex;
|
||||
gl_TexCoord[0].xy = gl_MultiTexCoord0.xy;
|
||||
gl_TexCoord[1].xy = gl_MultiTexCoord0.xy + vec2(0.0, 1.0);
|
||||
gl_TexCoord[2].xy = gl_MultiTexCoord0.xy + vec2(1.0, 0.0);
|
||||
gl_Position = vvertex;
|
||||
gl_TexCoord[0].xy = vtexcoord0;
|
||||
gl_TexCoord[1].xy = vtexcoord0 + vec2(0.0, 1.0);
|
||||
gl_TexCoord[2].xy = vtexcoord0 + vec2(1.0, 0.0);
|
||||
}
|
||||
] [
|
||||
#extension GL_ARB_texture_rectangle : enable
|
||||
|
|
|
@ -317,7 +317,7 @@ struct gui : g3d_gui
|
|||
if(overlaid && hit && actionon)
|
||||
{
|
||||
hudnotextureshader->set();
|
||||
glColor4f(0, 0, 0, 0.75f);
|
||||
varray::colorf(0, 0, 0, 0.75f);
|
||||
rect_(xi+SHADOW, yi+SHADOW, xs, ys, -1);
|
||||
hudshader->set();
|
||||
}
|
||||
|
@ -337,13 +337,13 @@ struct gui : g3d_gui
|
|||
{
|
||||
hudnotextureshader->set();
|
||||
glBlendFunc(GL_ZERO, GL_SRC_COLOR);
|
||||
glColor3f(1, 0.5f, 0.5f);
|
||||
varray::colorf(1, 0.5f, 0.5f);
|
||||
rect_(xi, yi, xs, ys, -1);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
hudshader->set();
|
||||
}
|
||||
if(!overlaytex) overlaytex = textureload("data/guioverlay.png", 3);
|
||||
glColor3f(1, 1, 1);
|
||||
varray::colorf(1, 1, 1);
|
||||
glBindTexture(GL_TEXTURE_2D, overlaytex->id);
|
||||
rect_(xi, yi, xs, ys, 0);
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ struct gui : g3d_gui
|
|||
if(overlaid && hit && actionon)
|
||||
{
|
||||
hudnotextureshader->set();
|
||||
glColor4f(0, 0, 0, 0.75f);
|
||||
varray::colorf(0, 0, 0, 0.75f);
|
||||
rect_(xi+SHADOW, yi+SHADOW, xs, ys, -1);
|
||||
hudshader->set();
|
||||
}
|
||||
|
@ -391,13 +391,13 @@ struct gui : g3d_gui
|
|||
{
|
||||
hudnotextureshader->set();
|
||||
glBlendFunc(GL_ZERO, GL_SRC_COLOR);
|
||||
glColor3f(1, 0.5f, 0.5f);
|
||||
varray::colorf(1, 0.5f, 0.5f);
|
||||
rect_(xi, yi, xs, ys, -1);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
hudshader->set();
|
||||
}
|
||||
if(!overlaytex) overlaytex = textureload("data/guioverlay.png", 3);
|
||||
glColor3f(1, 1, 1);
|
||||
varray::colorf(1, 1, 1);
|
||||
glBindTexture(GL_TEXTURE_2D, overlaytex->id);
|
||||
rect_(xi, yi, xs, ys, 0);
|
||||
}
|
||||
|
@ -512,8 +512,8 @@ struct gui : g3d_gui
|
|||
|
||||
hudnotextureshader->set();
|
||||
glDisable(GL_BLEND);
|
||||
if(editing) glColor3f(1, 0, 0);
|
||||
else glColor3ub(color>>16, (color>>8)&0xFF, color&0xFF);
|
||||
if(editing) varray::colorf(1, 0, 0);
|
||||
else varray::color(vec::hexcolor(color));
|
||||
rect_(curx, cury, w, h, -1, true);
|
||||
glEnable(GL_BLEND);
|
||||
hudshader->set();
|
||||
|
@ -571,7 +571,7 @@ struct gui : g3d_gui
|
|||
{
|
||||
if(layoutpass) return;
|
||||
hudnotextureshader->set();
|
||||
glColor4ub(color>>16, (color>>8)&0xFF, color&0xFF, 0x80);
|
||||
varray::color(vec::hexcolor(color), 0.5f);
|
||||
int w = xsize, h = ysize;
|
||||
if(inheritw>0)
|
||||
{
|
||||
|
@ -603,17 +603,17 @@ struct gui : g3d_gui
|
|||
glBindTexture(GL_TEXTURE_2D, t->id);
|
||||
if(hit && actionon)
|
||||
{
|
||||
glColor4f(0, 0, 0, 0.75f);
|
||||
varray::colorf(0, 0, 0, 0.75f);
|
||||
rect_(x+SHADOW, y+SHADOW, xs, ys, 0);
|
||||
}
|
||||
glColor3fv(color.v);
|
||||
varray::color(color);
|
||||
rect_(x, y, xs, ys, 0);
|
||||
|
||||
if(overlaid)
|
||||
{
|
||||
if(!overlaytex) overlaytex = textureload("data/guioverlay.png", 3);
|
||||
glBindTexture(GL_TEXTURE_2D, overlaytex->id);
|
||||
glColor3f(1, 1, 1);
|
||||
varray::colorf(1, 1, 1);
|
||||
rect_(x, y, xs, ys, 0);
|
||||
}
|
||||
}
|
||||
|
@ -642,7 +642,7 @@ struct gui : g3d_gui
|
|||
if(hit && actionon)
|
||||
{
|
||||
hudnotextureshader->set();
|
||||
glColor4f(0, 0, 0, 0.75f);
|
||||
varray::colorf(0, 0, 0, 0.75f);
|
||||
rect_(x+SHADOW, y+SHADOW, xs, ys);
|
||||
hudshader->set();
|
||||
}
|
||||
|
@ -657,8 +657,7 @@ struct gui : g3d_gui
|
|||
if(vslot.rotation <= 2 || vslot.rotation == 5) { yoff *= -1; loopk(4) tc[k].y *= -1; }
|
||||
}
|
||||
loopk(4) { tc[k].x = tc[k].x/xt - float(xoff)/t->xs; tc[k].y = tc[k].y/yt - float(yoff)/t->ys; }
|
||||
if(slot.loaded) glColor3f(color.x*vslot.colorscale.x, color.y*vslot.colorscale.y, color.z*vslot.colorscale.z);
|
||||
else glColor3fv(color.v);
|
||||
varray::color(slot.loaded ? vec(color).mul(vslot.colorscale) : color);
|
||||
glBindTexture(GL_TEXTURE_2D, t->id);
|
||||
varray::defvertex(2);
|
||||
varray::deftexcoord0();
|
||||
|
@ -672,8 +671,7 @@ struct gui : g3d_gui
|
|||
{
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
glBindTexture(GL_TEXTURE_2D, glowtex->id);
|
||||
if(hit || overlaid) glColor3f(color.x*vslot.glowcolor.x, color.y*vslot.glowcolor.y, color.z*vslot.glowcolor.z);
|
||||
else glColor3fv(vslot.glowcolor.v);
|
||||
varray::color(hit || overlaid ? vec(color).mul(vslot.glowcolor) : vslot.glowcolor);
|
||||
varray::begin(GL_TRIANGLE_STRIP);
|
||||
varray::attribf(x, y); varray::attrib(tc[0]);
|
||||
varray::attribf(x+xs, y); varray::attrib(tc[1]);
|
||||
|
@ -685,7 +683,7 @@ struct gui : g3d_gui
|
|||
if(layertex)
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, layertex->id);
|
||||
glColor3f(color.x*layer->colorscale.x, color.y*layer->colorscale.y, color.z*layer->colorscale.z);
|
||||
varray::color(vec(color).mul(layer->colorscale));
|
||||
varray::begin(GL_TRIANGLE_STRIP);
|
||||
varray::attribf(x+xs/2, y+ys/2); varray::attrib(tc[0]);
|
||||
varray::attribf(x+xs, y+ys/2); varray::attrib(tc[1]);
|
||||
|
@ -699,7 +697,7 @@ struct gui : g3d_gui
|
|||
{
|
||||
if(!overlaytex) overlaytex = textureload("data/guioverlay.png", 3);
|
||||
glBindTexture(GL_TEXTURE_2D, overlaytex->id);
|
||||
glColor3f(1, 1, 1);
|
||||
varray::colorf(1, 1, 1);
|
||||
rect_(x, y, xs, ys, 0);
|
||||
}
|
||||
}
|
||||
|
@ -712,13 +710,13 @@ struct gui : g3d_gui
|
|||
glBindTexture(GL_TEXTURE_2D, slidertex->id);
|
||||
if(percent < 0.99f)
|
||||
{
|
||||
glColor4f(1, 1, 1, 0.375f);
|
||||
varray::colorf(1, 1, 1, 0.375f);
|
||||
if(ishorizontal())
|
||||
rect_(curx + FONTH/2 - size/2, cury, size, ysize, 0);
|
||||
else
|
||||
rect_(curx, cury + FONTH/2 - size/2, xsize, size, 1);
|
||||
}
|
||||
glColor3f(1, 1, 1);
|
||||
varray::colorf(1, 1, 1);
|
||||
if(ishorizontal())
|
||||
rect_(curx + FONTH/2 - size/2, cury + ysize*(1-percent), size, ysize*percent, 0);
|
||||
else
|
||||
|
@ -780,7 +778,7 @@ struct gui : g3d_gui
|
|||
int gapx1 = INT_MAX, gapy1 = INT_MAX, gapx2 = INT_MAX, gapy2 = INT_MAX;
|
||||
float wscale = 1.0f/(SKIN_W*SKIN_SCALE), hscale = 1.0f/(SKIN_H*SKIN_SCALE);
|
||||
bool quads = false;
|
||||
glColor4f(1, 1, 1, alpha);
|
||||
varray::colorf(1, 1, 1, alpha);
|
||||
loopi(n)
|
||||
{
|
||||
const patch &p = patches[start+i];
|
||||
|
|
|
@ -599,7 +599,7 @@ void viewsmaa()
|
|||
{
|
||||
int w = min(screen->w, screen->h)*1.0f, h = (w*screen->h)/screen->w, tw = gw, th = gh;
|
||||
SETSHADER(hudrect);
|
||||
glColor3f(1, 1, 1);
|
||||
varray::colorf(1, 1, 1);
|
||||
switch(debugsmaa)
|
||||
{
|
||||
case 1: glBindTexture(GL_TEXTURE_RECTANGLE_ARB, smaatex[0]); break;
|
||||
|
|
|
@ -439,8 +439,8 @@ struct animmodel : model
|
|||
if(lastvbuf!=vbuf)
|
||||
{
|
||||
glBindBuffer_(GL_ARRAY_BUFFER_ARB, vbuf);
|
||||
if(!lastvbuf) glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glVertexPointer(3, GL_FLOAT, stride, v);
|
||||
if(!lastvbuf) varray::enablevertex();
|
||||
varray::vertexpointer(stride, v);
|
||||
lastvbuf = vbuf;
|
||||
}
|
||||
}
|
||||
|
@ -449,12 +449,12 @@ struct animmodel : model
|
|||
{
|
||||
if(!enabletc)
|
||||
{
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
varray::enabletexcoord0();
|
||||
enabletc = true;
|
||||
}
|
||||
if(lasttcbuf!=lastvbuf)
|
||||
{
|
||||
glTexCoordPointer(2, GL_FLOAT, stride, v);
|
||||
varray::texcoord0pointer(stride, v);
|
||||
lasttcbuf = lastvbuf;
|
||||
}
|
||||
}
|
||||
|
@ -463,12 +463,12 @@ struct animmodel : model
|
|||
{
|
||||
if(!enablenormals)
|
||||
{
|
||||
glEnableClientState(GL_NORMAL_ARRAY);
|
||||
varray::enablenormal();
|
||||
enablenormals = true;
|
||||
}
|
||||
if(lastnbuf!=lastvbuf)
|
||||
{
|
||||
glNormalPointer(GL_FLOAT, stride, v);
|
||||
varray::normalpointer(stride, v);
|
||||
lastnbuf = lastvbuf;
|
||||
}
|
||||
}
|
||||
|
@ -477,12 +477,12 @@ struct animmodel : model
|
|||
{
|
||||
if(!enabletangents)
|
||||
{
|
||||
glEnableVertexAttribArray_(1);
|
||||
varray::enabletangent();
|
||||
enabletangents = true;
|
||||
}
|
||||
if(lastxbuf!=lastvbuf)
|
||||
{
|
||||
glVertexAttribPointer_(1, 4, GL_FLOAT, GL_FALSE, stride, v);
|
||||
varray::tangentpointer(stride, v);
|
||||
lastxbuf = lastvbuf;
|
||||
}
|
||||
}
|
||||
|
@ -491,14 +491,14 @@ struct animmodel : model
|
|||
{
|
||||
if(!enablebones)
|
||||
{
|
||||
glEnableVertexAttribArray_(6);
|
||||
glEnableVertexAttribArray_(7);
|
||||
varray::enableboneweight();
|
||||
varray::enableboneindex();
|
||||
enablebones = true;
|
||||
}
|
||||
if(lastbbuf!=lastvbuf)
|
||||
{
|
||||
glVertexAttribPointer_(6, 4, GL_UNSIGNED_BYTE, GL_TRUE, stride, wv);
|
||||
glVertexAttribPointer_(7, 4, GL_UNSIGNED_BYTE, GL_FALSE, stride, bv);
|
||||
varray::boneweightpointer(stride, wv);
|
||||
varray::boneindexpointer(stride, bv);
|
||||
lastbbuf = lastvbuf;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -209,16 +209,16 @@ struct decalrenderer
|
|||
glDepthMask(GL_FALSE);
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
varray::enablevertex();
|
||||
varray::enabletexcoord0();
|
||||
varray::enablecolor();
|
||||
}
|
||||
|
||||
static void cleanuprenderstate()
|
||||
{
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
varray::disablevertex();
|
||||
varray::disabletexcoord0();
|
||||
varray::disablecolor();
|
||||
|
||||
glDepthMask(GL_TRUE);
|
||||
glDisable(GL_BLEND);
|
||||
|
@ -251,9 +251,9 @@ struct decalrenderer
|
|||
|
||||
glBindTexture(GL_TEXTURE_2D, tex->id);
|
||||
|
||||
glVertexPointer(3, GL_FLOAT, sizeof(decalvert), &verts->pos);
|
||||
glTexCoordPointer(2, GL_FLOAT, sizeof(decalvert), &verts->u);
|
||||
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(decalvert), &verts->color);
|
||||
varray::vertexpointer(sizeof(decalvert), &verts->pos);
|
||||
varray::texcoord0pointer(sizeof(decalvert), &verts->u);
|
||||
varray::colorpointer(sizeof(decalvert), &verts->color);
|
||||
|
||||
int count = endvert < startvert ? maxverts - startvert : endvert - startvert;
|
||||
glDrawArrays(GL_TRIANGLES, startvert, count);
|
||||
|
|
|
@ -156,8 +156,8 @@ static void setupexplosion()
|
|||
glBindBuffer_(GL_ARRAY_BUFFER_ARB, hemivbuf);
|
||||
glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, hemiebuf);
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glVertexPointer(3, GL_FLOAT, sizeof(vec), hemiverts);
|
||||
varray::vertexpointer(sizeof(vec), hemiverts);
|
||||
varray::enablevertex();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -166,10 +166,10 @@ static void setupexplosion()
|
|||
glBindBuffer_(GL_ARRAY_BUFFER_ARB, spherevbuf);
|
||||
glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, sphereebuf);
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glVertexPointer(3, GL_FLOAT, sizeof(spherevert), &sphereverts->pos);
|
||||
glTexCoordPointer(2, GL_FLOAT, sizeof(spherevert), &sphereverts->s);
|
||||
varray::vertexpointer(sizeof(spherevert), &sphereverts->pos);
|
||||
varray::texcoord0pointer(sizeof(spherevert), &sphereverts->s);
|
||||
varray::enablevertex();
|
||||
varray::enabletexcoord0();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -195,7 +195,7 @@ static void drawexplosion(bool inside, float r, float g, float b, float a)
|
|||
LOCALPARAMF(side, (inside ? -1 : 1));
|
||||
loopi(inside ? 2 : 1)
|
||||
{
|
||||
glColor4f(r, g, b, i ? a/2 : a);
|
||||
varray::colorf(r, g, b, i ? a/2 : a);
|
||||
if(i) glDepthFunc(GL_GEQUAL);
|
||||
drawexpverts(spherenumverts, spherenumindices, sphereindices);
|
||||
if(i) glDepthFunc(GL_LESS);
|
||||
|
@ -204,7 +204,7 @@ static void drawexplosion(bool inside, float r, float g, float b, float a)
|
|||
}
|
||||
loopi(inside ? 2 : 1)
|
||||
{
|
||||
glColor4f(r, g, b, i ? a/2 : a);
|
||||
varray::colorf(r, g, b, i ? a/2 : a);
|
||||
LOCALPARAMF(side, (1));
|
||||
if(i) glDepthFunc(GL_GEQUAL);
|
||||
if(inside)
|
||||
|
@ -221,8 +221,8 @@ static void drawexplosion(bool inside, float r, float g, float b, float a)
|
|||
|
||||
static void cleanupexplosion()
|
||||
{
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
if(!explosion2d) glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
varray::disablevertex();
|
||||
if(!explosion2d) varray::disabletexcoord0();
|
||||
|
||||
glBindBuffer_(GL_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
||||
|
@ -266,7 +266,7 @@ struct fireballrenderer : listrenderer
|
|||
pe.extendbb(o, (size+1+pe.ent->attr2)*WOBBLE);
|
||||
}
|
||||
|
||||
void renderpart(listparticle *p, const vec &o, const vec &d, int blend, int ts, uchar *color)
|
||||
void renderpart(listparticle *p, const vec &o, const vec &d, int blend, int ts)
|
||||
{
|
||||
float pmax = p->val,
|
||||
size = p->fade ? float(ts)/p->fade : 1,
|
||||
|
@ -324,7 +324,7 @@ struct fireballrenderer : listrenderer
|
|||
LOCALPARAMF(softparams, (0, -1, inside ? blend/(2*255.0f) : 0));
|
||||
}
|
||||
|
||||
drawexplosion(inside, color[0]*ldrscaleb, color[1]*ldrscaleb, color[2]*ldrscaleb, blend/255.0f);
|
||||
drawexplosion(inside, p->color.r*ldrscaleb, p->color.g*ldrscaleb, p->color.b*ldrscaleb, blend/255.0f);
|
||||
}
|
||||
};
|
||||
static fireballrenderer fireballs("packages/particles/explosion.png"), bluefireballs("packages/particles/plasma.png");
|
||||
|
|
|
@ -244,15 +244,13 @@ void rendergrass()
|
|||
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glVertexPointer(3, GL_FLOAT, sizeof(grassvert), grassverts[0].pos.v);
|
||||
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(grassvert), grassverts[0].color);
|
||||
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glTexCoordPointer(2, GL_FLOAT, sizeof(grassvert), &grassverts[0].u);
|
||||
|
||||
varray::vertexpointer(sizeof(grassvert), grassverts[0].pos.v);
|
||||
varray::colorpointer(sizeof(grassvert), grassverts[0].color);
|
||||
varray::texcoord0pointer(sizeof(grassvert), &grassverts[0].u);
|
||||
varray::enablevertex();
|
||||
varray::enablecolor();
|
||||
varray::enabletexcoord0();
|
||||
|
||||
static Shader *grassshader = NULL;
|
||||
if(!grassshader) grassshader = lookupshaderbyname("grass");
|
||||
|
||||
|
@ -286,9 +284,9 @@ void rendergrass()
|
|||
xtravertsva += 4*g.numquads;
|
||||
}
|
||||
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
varray::disablevertex();
|
||||
varray::disablecolor();
|
||||
varray::disabletexcoord0();
|
||||
|
||||
glEnable(GL_CULL_FACE);
|
||||
}
|
||||
|
|
|
@ -110,13 +110,13 @@ struct lightningrenderer : listrenderer
|
|||
pe.extendbb(d, size);
|
||||
}
|
||||
|
||||
void renderpart(listparticle *p, const vec &o, const vec &d, int blend, int ts, uchar *color)
|
||||
void renderpart(listparticle *p, const vec &o, const vec &d, int blend, int ts)
|
||||
{
|
||||
blend = min(blend<<2, 255);
|
||||
if(type&PT_MOD) //multiply alpha into color
|
||||
glColor3ub((color[0]*blend)>>8, (color[1]*blend)>>8, (color[2]*blend)>>8);
|
||||
varray::colorub((p->color.r*blend)>>8, (p->color.g*blend)>>8, (p->color.b*blend)>>8);
|
||||
else
|
||||
glColor4ub(color[0], color[1], color[2], blend);
|
||||
varray::color(p->color, blend);
|
||||
renderlightning(tex, o, d, p->size);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -192,7 +192,7 @@ void renderbackground(const char *caption, Texture *mapshot, const char *mapname
|
|||
varray::defvertex(2);
|
||||
varray::deftexcoord0();
|
||||
|
||||
glColor3f(1, 1, 1);
|
||||
varray::colorf(1, 1, 1);
|
||||
settexture("data/background.png", 0);
|
||||
float bu = w*0.67f/256.0f + backgroundu, bv = h*0.67f/256.0f + backgroundv;
|
||||
bgquad(0, 0, w, h, 0, 0, bu, bv);
|
||||
|
@ -331,7 +331,7 @@ void renderprogress(float bar, const char *text, GLuint tex, bool background)
|
|||
varray::defvertex(2);
|
||||
varray::deftexcoord0();
|
||||
|
||||
glColor3f(1, 1, 1);
|
||||
varray::colorf(1, 1, 1);
|
||||
|
||||
float fh = 0.075f*min(w, h), fw = fh*10,
|
||||
fx = renderedframe ? w - fw - fh/4 : 0.5f*(w - fw),
|
||||
|
|
|
@ -496,7 +496,7 @@ void rendermatgrid()
|
|||
case MAT_ALPHA: color = bvec(85, 0, 85); break; // pink
|
||||
default: continue;
|
||||
}
|
||||
glColor3f(color.x*ldrscaleb, color.y*ldrscaleb, color.z*ldrscaleb);
|
||||
varray::colorf(color.x*ldrscaleb, color.y*ldrscaleb, color.z*ldrscaleb);
|
||||
lastmat = m.material;
|
||||
}
|
||||
drawmaterial(m, -0.1f);
|
||||
|
@ -802,7 +802,7 @@ void rendereditmaterials()
|
|||
case MAT_ALPHA: color = bvec( 0, 255, 0); break; // pink
|
||||
default: continue;
|
||||
}
|
||||
glColor3ub(color.x, color.y, color.z);
|
||||
varray::color(color);
|
||||
lastmat = m.material;
|
||||
}
|
||||
drawmaterial(m, -0.1f);
|
||||
|
|
|
@ -443,9 +443,9 @@ void rendereditcursor()
|
|||
if(!moving && !hovering && !hidecursor)
|
||||
{
|
||||
if(hmapedit==1)
|
||||
glColor3ub(0, hmapsel ? 255 : 40, 0);
|
||||
varray::colorub(0, hmapsel ? 255 : 40, 0);
|
||||
else
|
||||
glColor3ub(120,120,120);
|
||||
varray::colorub(120,120,120);
|
||||
boxs(orient, lu.tovec(), vec(lusize));
|
||||
}
|
||||
|
||||
|
@ -453,11 +453,11 @@ void rendereditcursor()
|
|||
if(havesel)
|
||||
{
|
||||
d = dimension(sel.orient);
|
||||
glColor3ub(50,50,50); // grid
|
||||
varray::colorub(50,50,50); // grid
|
||||
boxsgrid(sel.orient, sel.o.tovec(), sel.s.tovec(), sel.grid);
|
||||
glColor3ub(200,0,0); // 0 reference
|
||||
varray::colorub(200,0,0); // 0 reference
|
||||
boxs3D(sel.o.tovec().sub(0.5f*min(gridsize*0.25f, 2.0f)), vec(min(gridsize*0.25f, 2.0f)), 1);
|
||||
glColor3ub(200,200,200);// 2D selection box
|
||||
varray::colorub(200,200,200);// 2D selection box
|
||||
vec co(sel.o.v), cs(sel.s.v);
|
||||
co[R[d]] += 0.5f*(sel.cx*gridsize);
|
||||
co[C[d]] += 0.5f*(sel.cy*gridsize);
|
||||
|
@ -466,9 +466,9 @@ void rendereditcursor()
|
|||
cs[D[d]] *= gridsize;
|
||||
boxs(sel.orient, co, cs);
|
||||
if(hmapedit==1) // 3D selection box
|
||||
glColor3ub(0,120,0);
|
||||
varray::colorub(0,120,0);
|
||||
else
|
||||
glColor3ub(0,0,120);
|
||||
varray::colorub(0,0,120);
|
||||
boxs3D(sel.o.tovec(), sel.s.tovec(), sel.grid);
|
||||
}
|
||||
|
||||
|
@ -2317,12 +2317,12 @@ void rendertexturepanel(int w, int h)
|
|||
glBindTexture(GL_TEXTURE_2D, tex->id);
|
||||
loopj(glowtex ? 3 : 2)
|
||||
{
|
||||
if(j < 2) glColor4f(j*vslot.colorscale.x, j*vslot.colorscale.y, j*vslot.colorscale.z, texpaneltimer/1000.0f);
|
||||
if(j < 2) varray::color(vec(vslot.colorscale).mul(j), texpaneltimer/1000.0f);
|
||||
else
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, glowtex->id);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
glColor4f(vslot.glowcolor.x, vslot.glowcolor.y, vslot.glowcolor.z, texpaneltimer/1000.0f);
|
||||
varray::color(vslot.glowcolor, texpaneltimer/1000.0f);
|
||||
}
|
||||
varray::begin(GL_TRIANGLE_STRIP);
|
||||
varray::attribf(x, y); varray::attrib(tc[0]);
|
||||
|
@ -2332,7 +2332,7 @@ void rendertexturepanel(int w, int h)
|
|||
xtraverts += varray::end();
|
||||
if(j==1 && layertex)
|
||||
{
|
||||
glColor4f(layer->colorscale.x, layer->colorscale.y, layer->colorscale.z, texpaneltimer/1000.0f);
|
||||
varray::color(layer->colorscale, texpaneltimer/1000.0f);
|
||||
glBindTexture(GL_TEXTURE_2D, layertex->id);
|
||||
varray::begin(GL_TRIANGLE_STRIP);
|
||||
varray::attribf(x+r/2, y+r/2); varray::attrib(tc[0]);
|
||||
|
|
|
@ -272,11 +272,10 @@ struct vacollect : verthash
|
|||
f++; \
|
||||
} \
|
||||
} while(0)
|
||||
#define GENVERTSPOSNORMUV(type, ptr, body) GENVERTS(type, ptr, { f->pos = v.pos; f->norm = v.norm; f->norm.flip(); f->reserved = 0; f->u = v.u; f->v = v.v; body; })
|
||||
|
||||
void genverts(void *buf)
|
||||
{
|
||||
GENVERTS(vertex, buf, { *f = v; f->norm.flip(); });
|
||||
GENVERTS(vertex, buf, { *f = v; f->norm.flip(); f->tangent.flip(); f->bitangent -= 128; });
|
||||
}
|
||||
|
||||
void setupdata(vtxarray *va)
|
||||
|
|
|
@ -23,10 +23,6 @@ PFNGLGETBUFFERSUBDATAARBPROC glGetBufferSubData_ = NULL;
|
|||
|
||||
// GL_ARB_multitexture
|
||||
PFNGLACTIVETEXTUREARBPROC glActiveTexture_ = NULL;
|
||||
PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTexture_ = NULL;
|
||||
PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2f_ = NULL;
|
||||
PFNGLMULTITEXCOORD3FARBPROC glMultiTexCoord3f_ = NULL;
|
||||
PFNGLMULTITEXCOORD4FARBPROC glMultiTexCoord4f_ = NULL;
|
||||
|
||||
// GL_ARB_occlusion_query
|
||||
PFNGLGENQUERIESARBPROC glGenQueries_ = NULL;
|
||||
|
@ -322,10 +318,6 @@ void gl_checkextensions()
|
|||
if(hasext(exts, "GL_ARB_multitexture"))
|
||||
{
|
||||
glActiveTexture_ = (PFNGLACTIVETEXTUREARBPROC) getprocaddress("glActiveTextureARB");
|
||||
glClientActiveTexture_ = (PFNGLCLIENTACTIVETEXTUREARBPROC)getprocaddress("glClientActiveTextureARB");
|
||||
glMultiTexCoord2f_ = (PFNGLMULTITEXCOORD2FARBPROC) getprocaddress("glMultiTexCoord2fARB");
|
||||
glMultiTexCoord3f_ = (PFNGLMULTITEXCOORD3FARBPROC) getprocaddress("glMultiTexCoord3fARB");
|
||||
glMultiTexCoord4f_ = (PFNGLMULTITEXCOORD4FARBPROC) getprocaddress("glMultiTexCoord4fARB");
|
||||
hasMT = true;
|
||||
if(dbgexts) conoutf(CON_INIT, "Using GL_ARB_multitexture extension.");
|
||||
}
|
||||
|
@ -1797,7 +1789,7 @@ static void setfog(int fogmat, float below = 0, float blend = 1, int abovemat =
|
|||
GLOBALPARAMF(fogparams, (start, end, 1/(end - start)));
|
||||
}
|
||||
|
||||
static void blendfogoverlay(int fogmat, float below, float blend, float *overlay)
|
||||
static void blendfogoverlay(int fogmat, float below, float blend, vec &overlay)
|
||||
{
|
||||
float maxc;
|
||||
switch(fogmat&MATF_VOLUME)
|
||||
|
@ -1807,23 +1799,21 @@ static void blendfogoverlay(int fogmat, float below, float blend, float *overlay
|
|||
const bvec &wcol = getwatercolor(fogmat), &wdeepcol = getwaterdeepcolor(fogmat);
|
||||
int wfog = getwaterfog(fogmat), wdeep = getwaterdeep(fogmat);
|
||||
float deepfade = clamp(below/max(wdeep, wfog), 0.0f, 1.0f);
|
||||
vec color;
|
||||
loopk(3) color[k] = wcol[k]*(1-deepfade) + wdeepcol[k]*deepfade;
|
||||
maxc = max(color[0], max(color[1], color[2]));
|
||||
loopk(3) overlay[k] += blend*max(0.4f, color[k]/min(32.0f + maxc*7.0f/8.0f, 255.0f));
|
||||
vec color = vec(wcol.r, wcol.g, wcol.b).lerp(vec(wdeepcol.r, wdeepcol.g, wdeepcol.b), deepfade);
|
||||
overlay.add(color.div(min(32.0f + max(color.r, max(color.g, color.b))*7.0f/8.0f, 255.0f)).max(0.4f).mul(blend));
|
||||
break;
|
||||
}
|
||||
|
||||
case MAT_LAVA:
|
||||
{
|
||||
const bvec &lcol = getlavacolor(fogmat);
|
||||
maxc = max(lcol[0], max(lcol[1], lcol[2]));
|
||||
loopk(3) overlay[k] += blend*max(0.4f, lcol[k]/min(32.0f + maxc*7.0f/8.0f, 255.0f));
|
||||
maxc = max(lcol.r, max(lcol.g, lcol.b));
|
||||
overlay.add(vec(lcol.r, lcol.g, lcol.b).div(min(32.0f + maxc*7.0f/8.0f, 255.0f)).max(0.4f).mul(blend));
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
loopk(3) overlay[k] += blend;
|
||||
overlay.add(blend);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1834,11 +1824,11 @@ void drawfogoverlay(int fogmat, float fogbelow, float fogblend, int abovemat)
|
|||
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_ZERO, GL_SRC_COLOR);
|
||||
float overlay[3] = { 0, 0, 0 };
|
||||
vec overlay(0, 0, 0);
|
||||
blendfogoverlay(fogmat, fogbelow, fogblend, overlay);
|
||||
blendfogoverlay(abovemat, 0, 1-fogblend, overlay);
|
||||
|
||||
glColor3fv(overlay);
|
||||
varray::color(overlay);
|
||||
screenquad();
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
|
@ -2354,7 +2344,7 @@ void drawdamagecompass(int w, int h)
|
|||
if(!dirs)
|
||||
{
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glColor4f(1, 0, 0, damagecompassalpha/100.0f);
|
||||
varray::colorf(1, 0, 0, damagecompassalpha/100.0f);
|
||||
varray::defvertex();
|
||||
varray::begin(GL_TRIANGLES);
|
||||
}
|
||||
|
@ -2411,7 +2401,7 @@ void drawdamagescreen(int w, int h)
|
|||
float fade = damagescreenalpha/100.0f;
|
||||
if(damageblendmillis - lastmillis < damagescreenfade)
|
||||
fade *= float(damageblendmillis - lastmillis)/damagescreenfade;
|
||||
glColor4f(fade, fade, fade, fade);
|
||||
varray::colorf(fade, fade, fade, fade);
|
||||
|
||||
hudquad(0, 0, w, h);
|
||||
}
|
||||
|
@ -2495,7 +2485,7 @@ void drawcrosshair(int w, int h)
|
|||
}
|
||||
if(crosshair->type&Texture::ALPHA) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
else glBlendFunc(GL_ONE, GL_ONE);
|
||||
glColor3f(r, g, b);
|
||||
varray::colorf(r, g, b);
|
||||
float x = cx*w - (windowhit ? 0 : chsize/2.0f);
|
||||
float y = cy*h - (windowhit ? 0 : chsize/2.0f);
|
||||
glBindTexture(GL_TEXTURE_2D, crosshair->id);
|
||||
|
@ -2526,7 +2516,7 @@ void gl_drawhud(int w, int h)
|
|||
resethudmatrix();
|
||||
hudshader->set();
|
||||
|
||||
glColor3f(1, 1, 1);
|
||||
varray::colorf(1, 1, 1);
|
||||
|
||||
debuglights();
|
||||
|
||||
|
|
|
@ -241,7 +241,7 @@ void viewao()
|
|||
if(!ao) return;
|
||||
int w = min(screen->w, screen->h)/2, h = (w*screen->h)/screen->w;
|
||||
SETSHADER(hudrect);
|
||||
glColor3f(1, 1, 1);
|
||||
varray::colorf(1, 1, 1);
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, aotex[2] ? aotex[2] : aotex[0]);
|
||||
int tw = aotex[2] ? gw : aow, th = aotex[2] ? gh : aoh;
|
||||
debugquad(0, 0, w, h, 0, 0, tw, th);
|
||||
|
@ -1263,7 +1263,7 @@ void viewdepth()
|
|||
{
|
||||
int w = min(screen->w, screen->h)/2, h = (w*screen->h)/screen->w;
|
||||
SETSHADER(hudrect);
|
||||
glColor3f(1, 1, 1);
|
||||
varray::colorf(1, 1, 1);
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, gdepthtex);
|
||||
debugquad(0, 0, w, h, 0, 0, gw, gh);
|
||||
}
|
||||
|
@ -1274,7 +1274,7 @@ void viewrefract()
|
|||
{
|
||||
int w = min(screen->w, screen->h)/2, h = (w*screen->h)/screen->w;
|
||||
SETSHADER(hudrect);
|
||||
glColor3f(1, 1, 1);
|
||||
varray::colorf(1, 1, 1);
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, refracttex);
|
||||
debugquad(0, 0, w, h, 0, 0, gw, gh);
|
||||
}
|
||||
|
@ -1408,7 +1408,7 @@ void viewrsm()
|
|||
{
|
||||
int w = min(screen->w, screen->h)/2, h = (w*screen->h)/screen->w, x = screen->w-w, y = screen->h-h;
|
||||
SETSHADER(hudrect);
|
||||
glColor3f(1, 1, 1);
|
||||
varray::colorf(1, 1, 1);
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, debugrsm == 2 ? rsmnormaltex : rsmcolortex);
|
||||
debugquad(x, y, w, h, 0, 0, rsmsize, rsmsize);
|
||||
}
|
||||
|
@ -1418,7 +1418,7 @@ void viewrh()
|
|||
{
|
||||
int w = min(screen->w, screen->h)/2, h = (w*screen->h)/screen->w, x = screen->w-w, y = screen->h-h;
|
||||
SETSHADER(hud3d);
|
||||
glColor3f(1, 1, 1);
|
||||
varray::colorf(1, 1, 1);
|
||||
glBindTexture(GL_TEXTURE_3D, rhtex[1]);
|
||||
float z = (debugrh-1+0.5f)/float((rhgrid+2*rhborder)*rhsplits);
|
||||
varray::defvertex(2);
|
||||
|
@ -1551,7 +1551,7 @@ void viewshadowatlas()
|
|||
SETSHADER(hudrect);
|
||||
}
|
||||
else hudshader->set();
|
||||
glColor3f(1, 1, 1);
|
||||
varray::colorf(1, 1, 1);
|
||||
glBindTexture(shadowatlastarget, shadowatlastex);
|
||||
if(usesmcomparemode()) setsmnoncomparemode();
|
||||
debugquad(x, y, w, h, 0, 0, tw, th);
|
||||
|
@ -2426,8 +2426,8 @@ void renderlights(float bsx1 = -1, float bsy1 = -1, float bsx2 = 1, float bsy2 =
|
|||
if(!lightspherevbuf) initlightsphere(10, 5);
|
||||
glBindBuffer_(GL_ARRAY_BUFFER_ARB, lightspherevbuf);
|
||||
glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, lightsphereebuf);
|
||||
glVertexPointer(3, GL_FLOAT, sizeof(vec), lightsphereverts);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
varray::vertexpointer(sizeof(vec), lightsphereverts);
|
||||
varray::enablevertex();
|
||||
|
||||
if(hasDC && depthclamplights) glEnable(GL_DEPTH_CLAMP_NV);
|
||||
|
||||
|
@ -2535,7 +2535,7 @@ void renderlights(float bsx1 = -1, float bsy1 = -1, float bsx2 = 1, float bsy2 =
|
|||
|
||||
if(hasDC && depthclamplights) glDisable(GL_DEPTH_CLAMP_NV);
|
||||
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
varray::disablevertex();
|
||||
glBindBuffer_(GL_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
||||
}
|
||||
|
@ -2707,7 +2707,7 @@ void viewlightscissor()
|
|||
{
|
||||
lightinfo &l = lights[j];
|
||||
if(l.sx1 >= l.sx2 || l.sy1 >= l.sy2 || l.sz1 >= l.sz2) break;
|
||||
glColor3f(l.color.x/255, l.color.y/255, l.color.z/255);
|
||||
varray::colorf(l.color.x/255, l.color.y/255, l.color.z/255);
|
||||
float x1 = (l.sx1+1)/2*screen->w, x2 = (l.sx2+1)/2*screen->w,
|
||||
y1 = (1-l.sy1)/2*screen->h, y2 = (1-l.sy2)/2*screen->h;
|
||||
varray::begin(GL_TRIANGLE_STRIP);
|
||||
|
|
|
@ -329,7 +329,7 @@ struct listrenderer : partrenderer
|
|||
|
||||
virtual void startrender() = 0;
|
||||
virtual void endrender() = 0;
|
||||
virtual void renderpart(listparticle *p, const vec &o, const vec &d, int blend, int ts, uchar *color) = 0;
|
||||
virtual void renderpart(listparticle *p, const vec &o, const vec &d, int blend, int ts) = 0;
|
||||
|
||||
void render()
|
||||
{
|
||||
|
@ -347,7 +347,7 @@ struct listrenderer : partrenderer
|
|||
calc(p, blend, ts, o, d);
|
||||
if(blend > 0)
|
||||
{
|
||||
renderpart(p, o, d, blend, ts, p->color.v);
|
||||
renderpart(p, o, d, blend, ts);
|
||||
|
||||
if(p->fade > 5)
|
||||
{
|
||||
|
@ -386,7 +386,7 @@ struct meterrenderer : listrenderer
|
|||
glEnable(GL_BLEND);
|
||||
}
|
||||
|
||||
void renderpart(listparticle *p, const vec &o, const vec &d, int blend, int ts, uchar *color)
|
||||
void renderpart(listparticle *p, const vec &o, const vec &d, int blend, int ts)
|
||||
{
|
||||
int basetype = type&0xFF;
|
||||
float scale = FONTH*p->size/80.0f, right = 8, left = p->progress/100.0f*right;
|
||||
|
@ -398,7 +398,7 @@ struct meterrenderer : listrenderer
|
|||
|
||||
if(outlinemeters)
|
||||
{
|
||||
glColor3f(0, 0.8f, 0);
|
||||
varray::colorf(0, 0.8f, 0);
|
||||
varray::begin(GL_TRIANGLE_STRIP);
|
||||
loopk(10)
|
||||
{
|
||||
|
@ -410,8 +410,8 @@ struct meterrenderer : listrenderer
|
|||
varray::end();
|
||||
}
|
||||
|
||||
if(basetype==PT_METERVS) glColor3ubv(p->color2);
|
||||
else glColor3f(0, 0, 0);
|
||||
if(basetype==PT_METERVS) varray::colorub(p->color2[0], p->color2[1], p->color2[2]);
|
||||
else varray::colorf(0, 0, 0);
|
||||
varray::begin(GL_TRIANGLE_STRIP);
|
||||
loopk(10)
|
||||
{
|
||||
|
@ -424,7 +424,7 @@ struct meterrenderer : listrenderer
|
|||
|
||||
if(outlinemeters)
|
||||
{
|
||||
glColor3f(0, 0.8f, 0);
|
||||
varray::colorf(0, 0.8f, 0);
|
||||
varray::begin(GL_TRIANGLE_FAN);
|
||||
loopk(10)
|
||||
{
|
||||
|
@ -435,7 +435,7 @@ struct meterrenderer : listrenderer
|
|||
varray::end();
|
||||
}
|
||||
|
||||
glColor3ubv(color);
|
||||
varray::color(p->color);
|
||||
varray::begin(GL_TRIANGLE_STRIP);
|
||||
loopk(10)
|
||||
{
|
||||
|
@ -468,7 +468,7 @@ struct textrenderer : listrenderer
|
|||
if(p->text && p->flags&1) delete[] p->text;
|
||||
}
|
||||
|
||||
void renderpart(listparticle *p, const vec &o, const vec &d, int blend, int ts, uchar *color)
|
||||
void renderpart(listparticle *p, const vec &o, const vec &d, int blend, int ts)
|
||||
{
|
||||
float scale = p->size/80.0f, xoff = -text_width(p->text)/2, yoff = 0;
|
||||
if((type&0xFF)==PT_TEXTUP) { xoff += detrnd((size_t)p, 100)-50; yoff -= detrnd((size_t)p, 101); }
|
||||
|
@ -480,7 +480,7 @@ struct textrenderer : listrenderer
|
|||
m.translate(xoff, yoff, 50);
|
||||
|
||||
textmatrix = &m;
|
||||
draw_text(p->text, 0, 0, color[0], color[1], color[2], blend);
|
||||
draw_text(p->text, 0, 0, p->color.r, p->color.g, p->color.b, blend);
|
||||
textmatrix = NULL;
|
||||
}
|
||||
};
|
||||
|
@ -770,9 +770,9 @@ struct varenderer : partrenderer
|
|||
{
|
||||
if(!tex) tex = textureload(texname, texclamp);
|
||||
glBindTexture(GL_TEXTURE_2D, tex->id);
|
||||
glVertexPointer(3, GL_FLOAT, sizeof(partvert), &verts->pos);
|
||||
glTexCoordPointer(2, GL_FLOAT, sizeof(partvert), &verts->u);
|
||||
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(partvert), &verts->color);
|
||||
varray::vertexpointer(sizeof(partvert), &verts->pos);
|
||||
varray::texcoord0pointer(sizeof(partvert), &verts->u);
|
||||
varray::colorpointer(sizeof(partvert), &verts->color);
|
||||
glDrawArrays(GL_QUADS, 0, numparts*4);
|
||||
}
|
||||
};
|
||||
|
@ -919,15 +919,15 @@ void renderparticles()
|
|||
{
|
||||
if(flags&0x01)
|
||||
{
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
varray::enablevertex();
|
||||
varray::enabletexcoord0();
|
||||
varray::enablecolor();
|
||||
}
|
||||
else
|
||||
{
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
varray::disablevertex();
|
||||
varray::disabletexcoord0();
|
||||
varray::disablecolor();
|
||||
}
|
||||
}
|
||||
if(changedbits&PT_LERP) { if(flags&PT_LERP) resetfogcolor(); else zerofogcolor(); }
|
||||
|
@ -966,9 +966,9 @@ void renderparticles()
|
|||
if(!(lastflags&PT_LERP)) resetfogcolor();
|
||||
if(lastflags&0x01)
|
||||
{
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
varray::disablevertex();
|
||||
varray::disabletexcoord0();
|
||||
varray::disablecolor();
|
||||
}
|
||||
glDisable(GL_BLEND);
|
||||
glDepthMask(GL_TRUE);
|
||||
|
|
|
@ -147,7 +147,7 @@ void draw_env_overlay(int w, Texture *overlay = NULL, float tx = 0, float ty = 0
|
|||
float z = w*cloudheight, tsz = 0.5f*(1-cloudfade)/cloudscale, psz = w*(1-cloudfade);
|
||||
glBindTexture(GL_TEXTURE_2D, overlay ? overlay->id : notexture->id);
|
||||
vec color = vec::hexcolor(cloudcolour);
|
||||
glColor4f(color.r, color.g, color.b, cloudalpha);
|
||||
varray::color(color, cloudalpha);
|
||||
varray::defvertex();
|
||||
varray::deftexcoord0();
|
||||
varray::begin(GL_TRIANGLE_FAN);
|
||||
|
@ -333,18 +333,18 @@ static void drawdome()
|
|||
glBindBuffer_(GL_ARRAY_BUFFER_ARB, domevbuf);
|
||||
glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, domeebuf);
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
glVertexPointer(3, GL_FLOAT, sizeof(domevert), &domeverts->pos);
|
||||
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(domevert), &domeverts->color);
|
||||
varray::vertexpointer(sizeof(domevert), &domeverts->pos);
|
||||
varray::colorpointer(sizeof(domevert), &domeverts->color);
|
||||
varray::enablevertex();
|
||||
varray::enablecolor();
|
||||
|
||||
if(hasDRE) glDrawRangeElements_(GL_TRIANGLES, 0, domenumverts-1, domenumindices + fogdomecap*domecapindices, GL_UNSIGNED_SHORT, domeindices);
|
||||
else glDrawElements(GL_TRIANGLES, domenumindices + fogdomecap*domecapindices, GL_UNSIGNED_SHORT, domeindices);
|
||||
xtraverts += domenumverts;
|
||||
glde++;
|
||||
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
varray::disablevertex();
|
||||
varray::disablecolor();
|
||||
|
||||
glBindBuffer_(GL_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
||||
|
@ -413,8 +413,7 @@ void drawskybox(int farplane)
|
|||
|
||||
if(clampsky) glDepthRange(1, 1);
|
||||
|
||||
vec color = vec::hexcolor(skyboxcolour);
|
||||
glColor3f(color.r, color.g, color.b);
|
||||
varray::color(vec::hexcolor(skyboxcolour));
|
||||
|
||||
glmatrix skymatrix = cammatrix, skyprojmatrix;
|
||||
skymatrix.d = vec4(0, 0, 0, 1);
|
||||
|
@ -436,8 +435,7 @@ void drawskybox(int farplane)
|
|||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
color = vec::hexcolor(cloudboxcolour);
|
||||
glColor4f(color.r, color.g, color.b, cloudboxalpha);
|
||||
varray::color(vec::hexcolor(cloudboxcolour), cloudboxalpha);
|
||||
|
||||
skymatrix = cammatrix;
|
||||
skymatrix.d = vec4(0, 0, 0, 1);
|
||||
|
|
|
@ -233,7 +233,7 @@ static void text_color(char c, char *stack, int size, int &sp, bvec color, int a
|
|||
case '7': color = bvec(255, 255, 255); break; // white
|
||||
// provided color: everything else
|
||||
}
|
||||
glColor4ub(color.x, color.y, color.z, a);
|
||||
varray::color(color, a);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -362,7 +362,7 @@ void draw_text(const char *str, int left, int top, int r, int g, int b, int a, i
|
|||
Texture *tex = curfont->texs[0];
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glBindTexture(GL_TEXTURE_2D, tex->id);
|
||||
glColor4ub(color.x, color.y, color.z, a);
|
||||
varray::color(color, a);
|
||||
varray::defvertex(textmatrix ? 3 : 2);
|
||||
varray::deftexcoord0();
|
||||
varray::begin(GL_QUADS);
|
||||
|
@ -371,7 +371,7 @@ void draw_text(const char *str, int left, int top, int r, int g, int b, int a, i
|
|||
xtraverts += varray::end();
|
||||
if(cursor >= 0 && (totalmillis/250)&1)
|
||||
{
|
||||
glColor4ub(r, g, b, a);
|
||||
varray::color(color, a);
|
||||
if(maxwidth != -1 && cx >= maxwidth) { cx = 0; cy += FONTH; }
|
||||
draw_char(tex, '_', left+cx, top+cy, scale);
|
||||
xtraverts += varray::end();
|
||||
|
|
|
@ -522,11 +522,10 @@ void renderoutline()
|
|||
{
|
||||
ldrnotextureshader->set();
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
varray::enablevertex();
|
||||
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
vec color = vec::hexcolor(outlinecolour);
|
||||
glColor3f(color.x, color.y, color.z);
|
||||
varray::color(vec::hexcolor(outlinecolour));
|
||||
|
||||
enablepolygonoffset(GL_POLYGON_OFFSET_LINE);
|
||||
|
||||
|
@ -541,7 +540,7 @@ void renderoutline()
|
|||
{
|
||||
glBindBuffer_(GL_ARRAY_BUFFER_ARB, va->vbuf);
|
||||
glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, va->ebuf);
|
||||
glVertexPointer(3, GL_FLOAT, sizeof(vertex), ((vertex *)0)->pos.v);
|
||||
varray::vertexpointer(sizeof(vertex), ((vertex *)0)->pos.v);
|
||||
}
|
||||
|
||||
if(va->texs && va->occluded < OCCLUDE_GEOM)
|
||||
|
@ -566,7 +565,7 @@ void renderoutline()
|
|||
|
||||
glBindBuffer_(GL_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
varray::disablevertex();
|
||||
}
|
||||
|
||||
HVAR(blendbrushcolor, 0, 0x0000C0, 0xFFFFFF);
|
||||
|
@ -575,7 +574,7 @@ void renderblendbrush(GLuint tex, float x, float y, float w, float h)
|
|||
{
|
||||
SETSHADER(blendbrush);
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
varray::enablevertex();
|
||||
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
|
||||
|
@ -583,8 +582,7 @@ void renderblendbrush(GLuint tex, float x, float y, float w, float h)
|
|||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, tex);
|
||||
vec color = vec::hexcolor(blendbrushcolor);
|
||||
glColor4f(color.x, color.y, color.z, 0.25f);
|
||||
varray::color(vec::hexcolor(blendbrushcolor), 0.25f);
|
||||
|
||||
LOCALPARAMF(texgenS, (1.0f/w, 0, 0, -x/w));
|
||||
LOCALPARAMF(texgenT, (0, 1.0f/h, 0, -y/h));
|
||||
|
@ -598,7 +596,7 @@ void renderblendbrush(GLuint tex, float x, float y, float w, float h)
|
|||
{
|
||||
glBindBuffer_(GL_ARRAY_BUFFER_ARB, va->vbuf);
|
||||
glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, va->ebuf);
|
||||
glVertexPointer(3, GL_FLOAT, sizeof(vertex), ((vertex *)0)->pos.v);
|
||||
varray::vertexpointer(sizeof(vertex), ((vertex *)0)->pos.v);
|
||||
}
|
||||
|
||||
drawvatris(va, 3*va->tris, 0);
|
||||
|
@ -613,7 +611,7 @@ void renderblendbrush(GLuint tex, float x, float y, float w, float h)
|
|||
|
||||
glBindBuffer_(GL_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
varray::disablevertex();
|
||||
}
|
||||
|
||||
int calcbbsidemask(const ivec &bbmin, const ivec &bbmax, const vec &lightpos, float lightradius, float bias)
|
||||
|
@ -910,7 +908,7 @@ void rendershadowmapworld()
|
|||
{
|
||||
SETSHADER(shadowmapworld);
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
varray::enablevertex();
|
||||
|
||||
vtxarray *prev = NULL;
|
||||
for(vtxarray *va = shadowva; va; va = va->rnext) if(va->tris && va->shadowmask&(1<<shadowside))
|
||||
|
@ -919,7 +917,7 @@ void rendershadowmapworld()
|
|||
{
|
||||
glBindBuffer_(GL_ARRAY_BUFFER_ARB, va->vbuf);
|
||||
glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, va->ebuf);
|
||||
glVertexPointer(3, GL_FLOAT, sizeof(vertex), ((vertex *)0)->pos.v);
|
||||
varray::vertexpointer(sizeof(vertex), ((vertex *)0)->pos.v);
|
||||
}
|
||||
|
||||
if(!smnodraw) drawvatris(va, 3*va->tris, 0);
|
||||
|
@ -937,7 +935,7 @@ void rendershadowmapworld()
|
|||
{
|
||||
glBindBuffer_(GL_ARRAY_BUFFER_ARB, va->vbuf);
|
||||
glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, va->skybuf);
|
||||
glVertexPointer(3, GL_FLOAT, sizeof(vertex), ((vertex *)0)->pos.v);
|
||||
varray::vertexpointer(sizeof(vertex), ((vertex *)0)->pos.v);
|
||||
}
|
||||
|
||||
if(!smnodraw) drawvaskytris(va);
|
||||
|
@ -949,7 +947,7 @@ void rendershadowmapworld()
|
|||
|
||||
glBindBuffer_(GL_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
varray::disablevertex();
|
||||
}
|
||||
|
||||
static octaentities *shadowmms = NULL;
|
||||
|
@ -1202,24 +1200,24 @@ static void mergetexs(renderstate &cur, vtxarray *va, elementset *texs = NULL, i
|
|||
|
||||
static inline void enablevattribs(renderstate &cur, bool all = true)
|
||||
{
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
varray::enablevertex();
|
||||
if(all)
|
||||
{
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glEnableClientState(GL_NORMAL_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
varray::enabletexcoord0();
|
||||
varray::enablenormal();
|
||||
varray::enablecolor();
|
||||
}
|
||||
cur.vattribs = true;
|
||||
}
|
||||
|
||||
static inline void disablevattribs(renderstate &cur, bool all = true)
|
||||
{
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
varray::disablevertex();
|
||||
if(all)
|
||||
{
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glDisableClientState(GL_NORMAL_ARRAY);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
varray::disabletexcoord0();
|
||||
varray::disablenormal();
|
||||
varray::disablecolor();
|
||||
}
|
||||
cur.vattribs = false;
|
||||
}
|
||||
|
@ -1231,13 +1229,13 @@ static void changevbuf(renderstate &cur, int pass, vtxarray *va)
|
|||
cur.vbuf = va->vbuf;
|
||||
|
||||
vertex *vdata = (vertex *)0;
|
||||
glVertexPointer(3, GL_FLOAT, sizeof(vertex), vdata->pos.v);
|
||||
varray::vertexpointer(sizeof(vertex), vdata->pos.v);
|
||||
|
||||
if(pass==RENDERPASS_GBUFFER || pass==RENDERPASS_RSM)
|
||||
{
|
||||
glTexCoordPointer(2, GL_FLOAT, sizeof(vertex), vdata->tc.v);
|
||||
glNormalPointer(GL_BYTE, sizeof(vertex), vdata->norm.v);
|
||||
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(vertex), vdata->tangent.v);
|
||||
varray::texcoord0pointer(sizeof(vertex), vdata->tc.v);
|
||||
varray::normalpointer(sizeof(vertex), vdata->norm.v, GL_BYTE);
|
||||
varray::colorpointer(sizeof(vertex), vdata->tangent.v);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1537,7 +1535,6 @@ void cleanupva()
|
|||
void setupgeom(renderstate &cur)
|
||||
{
|
||||
glActiveTexture_(GL_TEXTURE0_ARB);
|
||||
glClientActiveTexture_(GL_TEXTURE0_ARB);
|
||||
GLOBALPARAMF(colorparams, (1, 1, 1, 1));
|
||||
GLOBALPARAMF(blendlayer, (1.0f));
|
||||
}
|
||||
|
@ -1721,7 +1718,7 @@ void renderrsmgeom(bool dyntex)
|
|||
{
|
||||
glBindBuffer_(GL_ARRAY_BUFFER_ARB, va->vbuf);
|
||||
glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, va->skybuf);
|
||||
glVertexPointer(3, GL_FLOAT, sizeof(vertex), ((vertex *)0)->pos.v);
|
||||
varray::vertexpointer(sizeof(vertex), ((vertex *)0)->pos.v);
|
||||
}
|
||||
|
||||
drawvaskytris(va);
|
||||
|
@ -1821,7 +1818,7 @@ int findalphavas()
|
|||
|
||||
void renderrefractmask()
|
||||
{
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
varray::enablevertex();
|
||||
|
||||
vtxarray *prev = NULL;
|
||||
loopv(alphavas)
|
||||
|
@ -1833,7 +1830,7 @@ void renderrefractmask()
|
|||
{
|
||||
glBindBuffer_(GL_ARRAY_BUFFER_ARB, va->vbuf);
|
||||
glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, va->ebuf);
|
||||
glVertexPointer(3, GL_FLOAT, sizeof(vertex), ((vertex *)0)->pos.v);
|
||||
varray::vertexpointer(sizeof(vertex), ((vertex *)0)->pos.v);
|
||||
}
|
||||
|
||||
drawvatris(va, 3*va->refracttris, 3*(va->tris + va->blendtris + va->alphabacktris + va->alphafronttris));
|
||||
|
@ -1842,7 +1839,7 @@ void renderrefractmask()
|
|||
|
||||
glBindBuffer_(GL_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
varray::disablevertex();
|
||||
}
|
||||
|
||||
void renderalphageom(int side)
|
||||
|
@ -1882,12 +1879,11 @@ bool renderexplicitsky(bool outline)
|
|||
{
|
||||
if(!prev)
|
||||
{
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
varray::enablevertex();
|
||||
if(outline)
|
||||
{
|
||||
ldrnotextureshader->set();
|
||||
vec color = vec::hexcolor(explicitskycolour);
|
||||
glColor3f(color.x, color.y, color.z);
|
||||
varray::color(vec::hexcolor(explicitskycolour));
|
||||
glDepthMask(GL_FALSE);
|
||||
enablepolygonoffset(GL_POLYGON_OFFSET_LINE);
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
|
@ -1900,7 +1896,7 @@ bool renderexplicitsky(bool outline)
|
|||
}
|
||||
glBindBuffer_(GL_ARRAY_BUFFER_ARB, va->vbuf);
|
||||
glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, va->skybuf);
|
||||
glVertexPointer(3, GL_FLOAT, sizeof(vertex), ((vertex *)0)->pos.v);
|
||||
varray::vertexpointer(sizeof(vertex), ((vertex *)0)->pos.v);
|
||||
}
|
||||
drawvaskytris(va);
|
||||
xtraverts += va->sky/3;
|
||||
|
@ -1917,7 +1913,7 @@ bool renderexplicitsky(bool outline)
|
|||
{
|
||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
}
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
varray::disablevertex();
|
||||
glBindBuffer_(GL_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
||||
return true;
|
||||
|
@ -2138,20 +2134,20 @@ void rendershadowmesh(shadowmesh *m)
|
|||
|
||||
SETSHADER(shadowmapworld);
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
varray::enablevertex();
|
||||
|
||||
GLuint ebuf = 0, vbuf = 0;
|
||||
while(draw >= 0)
|
||||
{
|
||||
shadowdraw &d = shadowdraws[draw];
|
||||
if(ebuf != d.ebuf) { glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, d.ebuf); ebuf = d.ebuf; }
|
||||
if(vbuf != d.vbuf) { glBindBuffer_(GL_ARRAY_BUFFER_ARB, d.vbuf); vbuf = d.vbuf; glVertexPointer(3, GL_FLOAT, sizeof(vec), 0); }
|
||||
if(vbuf != d.vbuf) { glBindBuffer_(GL_ARRAY_BUFFER_ARB, d.vbuf); vbuf = d.vbuf; varray::vertexpointer(sizeof(vec), 0); }
|
||||
drawtris(3*d.tris, (ushort *)0 + d.offset, d.minvert, d.maxvert);
|
||||
xtravertsva += 3*d.tris;
|
||||
draw = d.next;
|
||||
}
|
||||
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
varray::disablevertex();
|
||||
glBindBuffer_(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBuffer_(GL_ARRAY_BUFFER_ARB, 0);
|
||||
}
|
||||
|
|
|
@ -148,11 +148,14 @@ static void linkglslprogram(Shader &s, bool msg = true)
|
|||
{
|
||||
glAttachShader_(s.program, s.vsobj);
|
||||
glAttachShader_(s.program, s.psobj);
|
||||
uint attribs = 0;
|
||||
loopv(s.attriblocs)
|
||||
{
|
||||
AttribLoc &a = s.attriblocs[i];
|
||||
glBindAttribLocation_(s.program, a.loc, a.name);
|
||||
attribs |= 1<<a.loc;
|
||||
}
|
||||
loopi(varray::MAXATTRIBS) if(!(attribs&(1<<i))) glBindAttribLocation_(s.program, i, varray::attribnames[i]);
|
||||
glLinkProgram_(s.program);
|
||||
glGetProgramiv_(s.program, GL_LINK_STATUS, &success);
|
||||
}
|
||||
|
@ -592,31 +595,41 @@ void setupshaders()
|
|||
|
||||
standardshader = true;
|
||||
nullshader = newshader(0, "<init>null",
|
||||
"attribute vec4 vvertex;\n"
|
||||
"void main(void) {\n"
|
||||
" gl_Position = gl_Vertex;\n"
|
||||
" gl_Position = vvertex;\n"
|
||||
"}\n",
|
||||
"void main(void) {\n"
|
||||
" gl_FragColor = vec4(1.0, 0.0, 1.0, 1.0);\n"
|
||||
"}\n");
|
||||
hudshader = newshader(0, "<init>hud",
|
||||
"attribute vec4 vvertex, vcolor;\n"
|
||||
"attribute vec2 vtexcoord0;\n"
|
||||
"uniform mat4 hudmatrix;\n"
|
||||
"varying vec2 texcoord0;\n"
|
||||
"varying vec4 color;\n"
|
||||
"void main(void) {\n"
|
||||
" gl_Position = hudmatrix * gl_Vertex;\n"
|
||||
" gl_TexCoord[0].xy = gl_MultiTexCoord0.xy;\n"
|
||||
" gl_FrontColor = gl_Color;\n"
|
||||
" gl_Position = hudmatrix * vvertex;\n"
|
||||
" texcoord0 = vtexcoord0;\n"
|
||||
" color = vcolor;\n"
|
||||
"}\n",
|
||||
"uniform sampler2D tex0;\n"
|
||||
"varying vec2 texcoord0;\n"
|
||||
"varying vec4 color;\n"
|
||||
"void main(void) {\n"
|
||||
" gl_FragColor = gl_Color * texture2D(tex0, gl_TexCoord[0].xy);\n"
|
||||
" gl_FragColor = color * texture2D(tex0, texcoord0);\n"
|
||||
"}\n");
|
||||
hudnotextureshader = newshader(0, "<init>hudnotexture",
|
||||
"attribute vec4 vvertex, vcolor;\n"
|
||||
"uniform mat4 hudmatrix;"
|
||||
"varying vec4 color;\n"
|
||||
"void main(void) {\n"
|
||||
" gl_Position = hudmatrix * gl_Vertex;\n"
|
||||
" gl_FrontColor = gl_Color;\n"
|
||||
" gl_Position = hudmatrix * vvertex;\n"
|
||||
" color = vcolor;\n"
|
||||
"}\n",
|
||||
"varying vec4 color;\n"
|
||||
"void main(void) {\n"
|
||||
" gl_FragColor = gl_Color;\n"
|
||||
" gl_FragColor = color;\n"
|
||||
"}\n");
|
||||
standardshader = false;
|
||||
|
||||
|
|
|
@ -598,7 +598,7 @@ struct editor
|
|||
if(ey > maxy) { ey = maxy; pey = pixelheight - FONTH; pex = pixelwidth; }
|
||||
|
||||
hudnotextureshader->set();
|
||||
glColor3ub(0xA0, 0x80, 0x80);
|
||||
varray::colorub(0xA0, 0x80, 0x80);
|
||||
varray::defvertex(2);
|
||||
varray::begin(GL_QUADS);
|
||||
if(psy == pey)
|
||||
|
@ -641,7 +641,7 @@ struct editor
|
|||
if(linewrap && height > FONTH) // line wrap indicator
|
||||
{
|
||||
hudnotextureshader->set();
|
||||
glColor3ub(0x80, 0xA0, 0x80);
|
||||
varray::colorub(0x80, 0xA0, 0x80);
|
||||
varray::defvertex(2);
|
||||
varray::begin(GL_TRIANGLE_STRIP);
|
||||
varray::attribf(x, y+h+FONTH);
|
||||
|
|
|
@ -617,14 +617,14 @@ void renderentradius(extentity &e, bool color)
|
|||
switch(e.type)
|
||||
{
|
||||
case ET_LIGHT:
|
||||
if(color) glColor3f(e.attr2/255.0f, e.attr3/255.0f, e.attr4/255.0f);
|
||||
if(color) varray::colorf(e.attr2/255.0f, e.attr3/255.0f, e.attr4/255.0f);
|
||||
renderentsphere(e, e.attr1);
|
||||
break;
|
||||
|
||||
case ET_SPOTLIGHT:
|
||||
if(e.attached)
|
||||
{
|
||||
if(color) glColor3f(0, 1, 1);
|
||||
if(color) varray::colorf(0, 1, 1);
|
||||
float radius = e.attached->attr1;
|
||||
if(!radius) radius = 2*e.o.dist(e.attached->o);
|
||||
vec dir = vec(e.o).sub(e.attached->o).normalize();
|
||||
|
@ -635,14 +635,14 @@ void renderentradius(extentity &e, bool color)
|
|||
break;
|
||||
|
||||
case ET_SOUND:
|
||||
if(color) glColor3f(0, 1, 1);
|
||||
if(color) varray::colorf(0, 1, 1);
|
||||
renderentsphere(e, e.attr2);
|
||||
break;
|
||||
|
||||
case ET_ENVMAP:
|
||||
{
|
||||
extern int envmapradius;
|
||||
if(color) glColor3f(0, 1, 1);
|
||||
if(color) varray::colorf(0, 1, 1);
|
||||
renderentsphere(e, e.attr1 ? max(0, min(10000, int(e.attr1))) : envmapradius);
|
||||
break;
|
||||
}
|
||||
|
@ -650,7 +650,7 @@ void renderentradius(extentity &e, bool color)
|
|||
case ET_MAPMODEL:
|
||||
case ET_PLAYERSTART:
|
||||
{
|
||||
if(color) glColor3f(0, 1, 1);
|
||||
if(color) varray::colorf(0, 1, 1);
|
||||
entities::entradius(e, color);
|
||||
vec dir;
|
||||
vecfromyawpitch(e.attr1, 0, 1, 0, dir);
|
||||
|
@ -661,7 +661,7 @@ void renderentradius(extentity &e, bool color)
|
|||
default:
|
||||
if(e.type>=ET_GAMESPECIFIC)
|
||||
{
|
||||
if(color) glColor3f(0, 1, 1);
|
||||
if(color) varray::colorf(0, 1, 1);
|
||||
entities::entradius(e, color);
|
||||
}
|
||||
break;
|
||||
|
@ -673,7 +673,7 @@ void renderentselection(const vec &o, const vec &ray, bool entmoving)
|
|||
if(noentedit()) return;
|
||||
vec eo, es;
|
||||
|
||||
glColor3ub(0, 40, 0);
|
||||
varray::colorub(0, 40, 0);
|
||||
loopv(entgroup) entfocus(entgroup[i],
|
||||
entselectionbox(e, eo, es);
|
||||
boxs3D(eo, es, 1);
|
||||
|
@ -686,12 +686,12 @@ void renderentselection(const vec &o, const vec &ray, bool entmoving)
|
|||
if(entmoving && entmovingshadow==1)
|
||||
{
|
||||
vec a, b;
|
||||
glColor3ub(20, 20, 20);
|
||||
varray::colorub(20, 20, 20);
|
||||
(a = eo).x = eo.x - fmod(eo.x, worldsize); (b = es).x = a.x + worldsize; boxs3D(a, b, 1);
|
||||
(a = eo).y = eo.y - fmod(eo.y, worldsize); (b = es).y = a.x + worldsize; boxs3D(a, b, 1);
|
||||
(a = eo).z = eo.z - fmod(eo.z, worldsize); (b = es).z = a.x + worldsize; boxs3D(a, b, 1);
|
||||
}
|
||||
glColor3ub(150,0,0);
|
||||
varray::colorub(150,0,0);
|
||||
glLineWidth(5);
|
||||
boxs(entorient, eo, es);
|
||||
glLineWidth(1);
|
||||
|
@ -700,7 +700,7 @@ void renderentselection(const vec &o, const vec &ray, bool entmoving)
|
|||
if(showentradius && (entgroup.length() || enthover >= 0))
|
||||
{
|
||||
glDepthFunc(GL_GREATER);
|
||||
glColor3f(0.25f, 0.25f, 0.25f);
|
||||
varray::colorf(0.25f, 0.25f, 0.25f);
|
||||
loopv(entgroup) entfocus(entgroup[i], renderentradius(e, false));
|
||||
if(enthover>=0) entfocus(enthover, renderentradius(e, false));
|
||||
glDepthFunc(GL_LESS);
|
||||
|
|
|
@ -472,12 +472,12 @@ struct captureclientmode : clientmode
|
|||
{
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
int s = 1800/4, x = 1800*w/h - s - s/10, y = s/10;
|
||||
glColor4f(1, 1, 1, minimapalpha);
|
||||
varray::colorf(1, 1, 1, minimapalpha);
|
||||
if(minimapalpha >= 1) glDisable(GL_BLEND);
|
||||
bindminimap();
|
||||
drawminimap(d, x, y, s);
|
||||
if(minimapalpha >= 1) glEnable(GL_BLEND);
|
||||
glColor3f(1, 1, 1);
|
||||
varray::colorf(1, 1, 1);
|
||||
float margin = 0.04f, roffset = s*margin, rsize = s + 2*roffset;
|
||||
settexture("packages/hud/radar.png", 3);
|
||||
drawradar(x - roffset, y - roffset, rsize);
|
||||
|
|
|
@ -454,12 +454,12 @@ struct collectclientmode : clientmode
|
|||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
int s = 1800/4, x = 1800*w/h - s - s/10, y = s/10;
|
||||
glColor4f(1, 1, 1, minimapalpha);
|
||||
varray::colorf(1, 1, 1, minimapalpha);
|
||||
if(minimapalpha >= 1) glDisable(GL_BLEND);
|
||||
bindminimap();
|
||||
drawminimap(d, x, y, s);
|
||||
if(minimapalpha >= 1) glEnable(GL_BLEND);
|
||||
glColor3f(1, 1, 1);
|
||||
varray::colorf(1, 1, 1);
|
||||
float margin = 0.04f, roffset = s*margin, rsize = s + 2*roffset;
|
||||
settexture("packages/hud/radar.png", 3);
|
||||
drawradar(x - roffset, y - roffset, rsize);
|
||||
|
|
|
@ -512,12 +512,12 @@ struct ctfclientmode : clientmode
|
|||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
int s = 1800/4, x = 1800*w/h - s - s/10, y = s/10;
|
||||
glColor4f(1, 1, 1, minimapalpha);
|
||||
varray::colorf(1, 1, 1, minimapalpha);
|
||||
if(minimapalpha >= 1) glDisable(GL_BLEND);
|
||||
bindminimap();
|
||||
drawminimap(d, x, y, s);
|
||||
if(minimapalpha >= 1) glEnable(GL_BLEND);
|
||||
glColor3f(1, 1, 1);
|
||||
varray::colorf(1, 1, 1);
|
||||
float margin = 0.04f, roffset = s*margin, rsize = s + 2*roffset;
|
||||
settexture("packages/hud/radar.png", 3);
|
||||
drawradar(x - roffset, y - roffset, rsize);
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
// GL_ARB_multitexture
|
||||
extern PFNGLACTIVETEXTUREARBPROC glActiveTexture_;
|
||||
extern PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTexture_;
|
||||
extern PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2f_;
|
||||
extern PFNGLMULTITEXCOORD3FARBPROC glMultiTexCoord3f_;
|
||||
extern PFNGLMULTITEXCOORD4FARBPROC glMultiTexCoord4f_;
|
||||
|
||||
// GL_ARB_vertex_buffer_object
|
||||
extern PFNGLGENBUFFERSARBPROC glGenBuffers_;
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace varray
|
|||
MAXATTRIBS = 8
|
||||
};
|
||||
|
||||
extern const char * const attribnames[MAXATTRIBS];
|
||||
extern vector<uchar> data;
|
||||
|
||||
extern void begin(GLenum mode);
|
||||
|
@ -37,14 +38,44 @@ namespace varray
|
|||
static inline void name##suffix(type x, type y) { glVertexAttrib2##suffix##_(index, x, y); } \
|
||||
static inline void name##suffix(type x, type y, type z) { glVertexAttrib3##suffix##_(index, x, y, z); } \
|
||||
static inline void name##suffix(type x, type y, type z, type w) { glVertexAttrib4##suffix##_(index, x, y, z, w); }
|
||||
#define VARRAY_INITATTRIBF(name, index) \
|
||||
VARRAY_INITATTRIB(name, index, f, float) \
|
||||
static inline void name(const vec &v) { glVertexAttrib3fv_(index, v.v); } \
|
||||
static inline void name(const vec &v, float w) { glVertexAttrib4f_(index, v.x, v.y, v.z, w); } \
|
||||
static inline void name(const vec2 &v) { glVertexAttrib2fv_(index, v.v); } \
|
||||
static inline void name(const vec4 &v) { glVertexAttrib4fv_(index, v.v); }
|
||||
#define VARRAY_INITATTRIBN(name, index, suffix, type, defaultw) \
|
||||
static inline void name##suffix(type x, type y, type z, type w = defaultw) { glVertexAttrib4N##suffix##_(index, x, y, z, w); }
|
||||
|
||||
VARRAY_INITATTRIB(vertex, ATTRIB_VERTEX, f, float)
|
||||
VARRAY_INITATTRIB(color, ATTRIB_COLOR, f, float)
|
||||
VARRAY_INITATTRIBF(vertex, ATTRIB_VERTEX)
|
||||
VARRAY_INITATTRIBF(color, ATTRIB_COLOR)
|
||||
VARRAY_INITATTRIBN(color, ATTRIB_COLOR, ub, uchar, 255)
|
||||
VARRAY_INITATTRIB(texcoord0, ATTRIB_TEXCOORD0, f, float)
|
||||
VARRAY_INITATTRIB(texcoord1, ATTRIB_TEXCOORD1, f, float)
|
||||
static inline void color(const bvec &v, uchar alpha = 255) { glVertexAttrib4Nub_(ATTRIB_COLOR, v.x, v.y, v.z, alpha); }
|
||||
VARRAY_INITATTRIBF(texcoord0, ATTRIB_TEXCOORD0)
|
||||
VARRAY_INITATTRIBF(texcoord1, ATTRIB_TEXCOORD1)
|
||||
static inline void normal(float x, float y, float z) { glVertexAttrib4f_(ATTRIB_NORMAL, x, y, z, 0.0f); }
|
||||
static inline void normal(const vec &v) { glVertexAttrib4f_(ATTRIB_NORMAL, v.x, v.y, v.z, 0.0f); }
|
||||
static inline void tangent(float x, float y, float z, float w = 1.0f) { glVertexAttrib4f_(ATTRIB_TANGENT, x, y, z, w); }
|
||||
static inline void tangent(const vec &v, float w = 1.0f) { glVertexAttrib4f_(ATTRIB_TANGENT, v.x, v.y, v.z, w); }
|
||||
static inline void tangent(const vec4 &v) { glVertexAttrib4fv_(ATTRIB_TANGENT, v.v); }
|
||||
|
||||
#define VARRAY_ATTRIBPOINTER(name, index, normalized, defaultsize, defaulttype) \
|
||||
static inline void enable##name() { glEnableVertexAttribArray_(index); } \
|
||||
static inline void disable##name() { glDisableVertexAttribArray_(index); } \
|
||||
static inline void name##pointer(int stride, const void *data, GLenum type = defaulttype, int size = defaultsize) { \
|
||||
glVertexAttribPointer_(index, size, type, normalized, stride, data); \
|
||||
}
|
||||
|
||||
static inline void enableattrib(int index) { glEnableVertexAttribArray_(index); }
|
||||
static inline void disableattrib(int index) { glDisableVertexAttribArray_(index); }
|
||||
VARRAY_ATTRIBPOINTER(vertex, ATTRIB_VERTEX, GL_FALSE, 3, GL_FLOAT)
|
||||
VARRAY_ATTRIBPOINTER(color, ATTRIB_COLOR, GL_TRUE, 4, GL_UNSIGNED_BYTE)
|
||||
VARRAY_ATTRIBPOINTER(texcoord0, ATTRIB_TEXCOORD0, GL_FALSE, 2, GL_FLOAT)
|
||||
VARRAY_ATTRIBPOINTER(texcoord1, ATTRIB_TEXCOORD1, GL_FALSE, 2, GL_FLOAT)
|
||||
VARRAY_ATTRIBPOINTER(normal, ATTRIB_NORMAL, GL_TRUE, 3, GL_FLOAT)
|
||||
VARRAY_ATTRIBPOINTER(tangent, ATTRIB_TANGENT, GL_TRUE, 4, GL_FLOAT)
|
||||
VARRAY_ATTRIBPOINTER(boneweight, ATTRIB_BONEWEIGHT, GL_TRUE, 4, GL_UNSIGNED_BYTE)
|
||||
VARRAY_ATTRIBPOINTER(boneindex, ATTRIB_BONEINDEX, GL_FALSE, 4, GL_UNSIGNED_BYTE)
|
||||
|
||||
template<class T>
|
||||
static inline void attrib(T x)
|
||||
|
@ -131,6 +162,7 @@ namespace varray
|
|||
}
|
||||
};
|
||||
|
||||
extern const char * const attribnames[MAXATTRIBS] = { "vvertex", "vcolor", "vtexcoord0", "vtexcoord1", "vnormal", "vtangent", "vboneweight", "vboneindex" };
|
||||
vector<uchar> data;
|
||||
static attribinfo attribdefs[MAXATTRIBS], lastattribs[MAXATTRIBS];
|
||||
static int enabled = 0, numattribs = 0, attribmask = 0, numlastattribs = 0, lastattribmask = 0, vertexsize = 0, lastvertexsize = 0;
|
||||
|
@ -199,70 +231,28 @@ namespace varray
|
|||
switch(a.type)
|
||||
{
|
||||
case ATTRIB_VERTEX:
|
||||
if(!(enabled&(1<<ATTRIB_VERTEX))) glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glVertexPointer(a.size, a.format, vertexsize, buf);
|
||||
case ATTRIB_TEXCOORD0:
|
||||
case ATTRIB_TEXCOORD1:
|
||||
case ATTRIB_BONEINDEX:
|
||||
glVertexAttribPointer_(a.type, a.size, a.format, GL_FALSE, vertexsize, buf);
|
||||
break;
|
||||
case ATTRIB_COLOR:
|
||||
if(!(enabled&(1<<ATTRIB_COLOR))) glEnableClientState(GL_COLOR_ARRAY);
|
||||
glColorPointer(a.size, a.format, vertexsize, buf);
|
||||
break;
|
||||
case ATTRIB_TEXCOORD0:
|
||||
if(!(enabled&(1<<ATTRIB_TEXCOORD0))) glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glTexCoordPointer(a.size, a.format, vertexsize, buf);
|
||||
break;
|
||||
case ATTRIB_TEXCOORD1:
|
||||
glClientActiveTexture_(GL_TEXTURE1_ARB);
|
||||
if(!(enabled&(1<<ATTRIB_TEXCOORD1))) glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glTexCoordPointer(a.size, a.format, vertexsize, buf);
|
||||
glClientActiveTexture_(GL_TEXTURE0_ARB);
|
||||
break;
|
||||
case ATTRIB_NORMAL:
|
||||
if(!(enabled&(1<<ATTRIB_NORMAL))) glEnableClientState(GL_NORMAL_ARRAY);
|
||||
glNormalPointer(a.format, vertexsize, buf);
|
||||
break;
|
||||
case ATTRIB_TANGENT:
|
||||
if(!(enabled&(1<<ATTRIB_TANGENT))) glEnableVertexAttribArray_(ATTRIB_TANGENT);
|
||||
glVertexAttribPointer_(ATTRIB_TANGENT, a.size, a.format, GL_TRUE, vertexsize, buf);
|
||||
break;
|
||||
case ATTRIB_BONEWEIGHT:
|
||||
if(!(enabled&(1<<ATTRIB_BONEWEIGHT))) glEnableVertexAttribArray_(ATTRIB_BONEWEIGHT);
|
||||
glVertexAttribPointer_(ATTRIB_BONEWEIGHT, a.size, a.format, GL_TRUE, vertexsize, buf);
|
||||
break;
|
||||
case ATTRIB_BONEINDEX:
|
||||
if(!(enabled&(1<<ATTRIB_BONEINDEX))) glEnableVertexAttribArray_(ATTRIB_BONEINDEX);
|
||||
glVertexAttribPointer_(ATTRIB_BONEINDEX, a.size, a.format, GL_FALSE, vertexsize, buf);
|
||||
glVertexAttribPointer_(a.type, a.size, a.format, GL_TRUE, vertexsize, buf);
|
||||
break;
|
||||
}
|
||||
enabled |= 1<<a.type;
|
||||
if(!(enabled&(1<<a.type)))
|
||||
{
|
||||
glEnableVertexAttribArray_(a.type);
|
||||
enabled |= 1<<a.type;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void unsetattrib(const attribinfo &a)
|
||||
{
|
||||
switch(a.type)
|
||||
{
|
||||
case ATTRIB_VERTEX:
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
break;
|
||||
case ATTRIB_COLOR:
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
break;
|
||||
case ATTRIB_TEXCOORD0:
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
break;
|
||||
case ATTRIB_TEXCOORD1:
|
||||
glClientActiveTexture_(GL_TEXTURE1_ARB);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glClientActiveTexture_(GL_TEXTURE0_ARB);
|
||||
break;
|
||||
case ATTRIB_NORMAL:
|
||||
glDisableClientState(GL_NORMAL_ARRAY);
|
||||
break;
|
||||
case ATTRIB_TANGENT:
|
||||
case ATTRIB_BONEWEIGHT:
|
||||
case ATTRIB_BONEINDEX:
|
||||
glDisableVertexAttribArray_(a.type);
|
||||
break;
|
||||
}
|
||||
glDisableVertexAttribArray_(a.type);
|
||||
enabled &= ~(1<<a.type);
|
||||
}
|
||||
|
||||
|
@ -305,20 +295,7 @@ namespace varray
|
|||
void disable()
|
||||
{
|
||||
if(!enabled) return;
|
||||
if(enabled&(1<<ATTRIB_VERTEX)) glDisableClientState(GL_VERTEX_ARRAY);
|
||||
if(enabled&(1<<ATTRIB_COLOR)) glDisableClientState(GL_COLOR_ARRAY);
|
||||
if(enabled&(1<<ATTRIB_TEXCOORD0)) glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
if(enabled&(1<<ATTRIB_TEXCOORD1))
|
||||
{
|
||||
glClientActiveTexture_(GL_TEXTURE1_ARB);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glClientActiveTexture_(GL_TEXTURE0_ARB);
|
||||
}
|
||||
if(enabled&(1<<ATTRIB_NORMAL)) glDisableClientState(GL_NORMAL_ARRAY);
|
||||
if(enabled&(1<<ATTRIB_TANGENT)) glDisableVertexAttribArray_(ATTRIB_TANGENT);
|
||||
if(enabled&(1<<ATTRIB_BONEWEIGHT)) glDisableVertexAttribArray_(ATTRIB_BONEWEIGHT);
|
||||
if(enabled&(1<<ATTRIB_BONEINDEX)) glDisableVertexAttribArray_(ATTRIB_BONEINDEX);
|
||||
enabled = 0;
|
||||
for(int i = 0; enabled; i++) if(enabled&(1<<i)) { glDisableVertexAttribArray_(i); enabled &= ~(1<<i); }
|
||||
numlastattribs = lastattribmask = lastvertexsize = 0;
|
||||
lastbuf = NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue