t->currentmaterialflags |= MATERIALFLAG_ALPHA | MATERIALFLAG_TRANSPARENT;
if (ent->effects & EF_NODEPTHTEST)
t->currentmaterialflags |= MATERIALFLAG_NODEPTHTEST;
+ if (t->currentmaterialflags & MATERIALFLAG_WATER && r_waterscroll.value != 0)
+ t->currenttexmatrix = r_waterscrollmatrix;
+ else
+ t->currenttexmatrix = r_identitymatrix;
}
void R_UpdateAllTextureInfo(entity_render_t *ent)
qboolean doglow;
qboolean dofogpass;
qboolean fogallpasses;
- qboolean waterscrolling;
qboolean dopants;
qboolean doshirt;
qboolean dofullbrightpants;
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
else
GL_BlendFunc(GL_ONE, GL_ZERO);
- // water waterscrolling in texture matrix
- waterscrolling = (texture->currentmaterialflags & MATERIALFLAG_WATER) && r_waterscroll.value != 0;
if (texture->textureflags & Q3TEXTUREFLAG_TWOSIDED)
qglDisable(GL_CULL_FACE);
if (texture->currentmaterialflags & MATERIALFLAG_SKY)
m.texcombinergb[0] = GL_REPLACE;
m.texcombinergb[1] = GL_REPLACE;
Matrix4x4_CreateFromQuakeEntity(&m.texmatrix[0], 0, 0, 0, 0, 0, 0, r_watershader.value);
- m.texmatrix[1] = r_waterscrollmatrix;
+ m.texmatrix[1] = texture->currenttexmatrix;
R_Mesh_State(&m);
GL_Color(1, 1, 1, texture->currentalpha);
{
memset(&m, 0, sizeof(m));
m.tex[1] = R_GetTexture(basetexture);
- if (waterscrolling)
- m.texmatrix[1] = r_waterscrollmatrix;
+ m.texmatrix[1] = texture->currenttexmatrix;
m.texrgbscale[1] = 2;
m.pointer_color = varray_color4f;
R_Mesh_State(&m);
GL_Color(r_lightmapintensity * ent->colormod[0], r_lightmapintensity * ent->colormod[1], r_lightmapintensity * ent->colormod[2], 1);
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(basetexture);
- if (waterscrolling)
- m.texmatrix[0] = r_waterscrollmatrix;
+ m.texmatrix[0] = texture->currenttexmatrix;
R_Mesh_State(&m);
for (texturesurfaceindex = 0;texturesurfaceindex < texturenumsurfaces;texturesurfaceindex++)
{
{
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(basetexture);
- if (waterscrolling)
- m.texmatrix[0] = r_waterscrollmatrix;
+ m.texmatrix[0] = texture->currenttexmatrix;
m.pointer_color = varray_color4f;
colorscale = 2;
if (gl_combine.integer)
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(texture->skin.pants);
- if (waterscrolling)
- m.texmatrix[0] = r_waterscrollmatrix;
+ m.texmatrix[0] = texture->currenttexmatrix;
m.pointer_color = varray_color4f;
colorscale = 2;
if (gl_combine.integer)
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(texture->skin.shirt);
- if (waterscrolling)
- m.texmatrix[0] = r_waterscrollmatrix;
+ m.texmatrix[0] = texture->currenttexmatrix;
m.pointer_color = varray_color4f;
colorscale = 2;
if (gl_combine.integer)
GL_DepthMask(false);
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(texture->skin.base);
- if (waterscrolling)
- m.texmatrix[0] = r_waterscrollmatrix;
+ m.texmatrix[0] = texture->currenttexmatrix;
m.pointer_color = varray_color4f;
colorscale = 1;
if (gl_combine.integer && (ent->colormod[0] > 1 || ent->colormod[1] > 1 || ent->colormod[2] > 1))
GL_DepthMask(false);
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(texture->skin.glow);
- if (waterscrolling)
- m.texmatrix[0] = r_waterscrollmatrix;
+ m.texmatrix[0] = texture->currenttexmatrix;
m.pointer_color = varray_color4f;
R_Mesh_State(&m);
r = 1;
GL_DepthMask(false);
memset(&m, 0, sizeof(m));
m.tex[0] = R_GetTexture(texture->skin.fog);
- if (waterscrolling)
- m.texmatrix[0] = r_waterscrollmatrix;
+ m.texmatrix[0] = texture->currenttexmatrix;
R_Mesh_State(&m);
r = fogcolor[0];
g = fogcolor[1];
"void main(void)\n"
"{\n"
" // copy the surface texcoord\n"
-" TexCoord = gl_MultiTexCoord0.st;\n"
+" TexCoord = vec2(gl_TextureMatrix[0] * glMultiTexCoord0);\n"
"\n"
" // transform vertex position into light attenuation/cubemap space\n"
" // (-1 to +1 across the light box)\n"
qboolean doambientshirt = r_shadow_rtlight->ambientscale * VectorLength2(lightcolorshirt) > 0.00001 && shirttexture != r_texture_black;
qboolean dodiffuseshirt = r_shadow_rtlight->diffusescale * VectorLength2(lightcolorshirt) > 0.00001 && shirttexture != r_texture_black;
qboolean dospecular = specularscale * VectorLength2(lightcolorbase) > 0.00001 && glosstexture != r_texture_black;
+ //qboolean dowatershader = (texture->currentmaterialflags & MATERIALFLAG_WATER) && r_watershader.value;
// TODO: add direct pants/shirt rendering
if (doambientpants || dodiffusepants)
R_Shadow_RenderSurfacesLighting_Light_GLSL(ent, texture, numsurfaces, surfacelist, lightcolorpants, vec3_origin, vec3_origin, pantstexture, r_texture_black, r_texture_black, normalmaptexture, r_texture_black, 0, modelorg);
R_Shadow_RenderSurfacesLighting_Light_GLSL(ent, texture, numsurfaces, surfacelist, lightcolorshirt, vec3_origin, vec3_origin, shirttexture, r_texture_black, r_texture_black, normalmaptexture, r_texture_black, 0, modelorg);
if (!doambientbase && !dodiffusebase && !dospecular)
return;
+ R_Mesh_TexMatrix(0, &texture->currenttexmatrix);
R_Mesh_TexBind(0, R_GetTexture(normalmaptexture));
R_Mesh_TexBind(1, R_GetTexture(basetexture));
R_Mesh_TexBind(2, R_GetTexture(glosstexture));
rsurface_normal3f = varray_normal3f;
Mod_BuildTextureVectorsAndNormals(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, rsurface_vertex3f, surface->groupmesh->data_texcoordtexture2f, surface->groupmesh->data_element3i + surface->num_firsttriangle * 3, rsurface_svector3f, rsurface_tvector3f, rsurface_normal3f, r_smoothnormals_areaweighting.integer);
}
- R_Mesh_VertexPointer(rsurface_vertex3f);
R_Mesh_TexCoordPointer(0, 2, surface->groupmesh->data_texcoordtexture2f);
R_Mesh_TexCoordPointer(1, 3, rsurface_svector3f);
R_Mesh_TexCoordPointer(2, 3, rsurface_tvector3f);
#endif
m.tex[1] = R_GetTexture(basetexture);
m.pointer_texcoord[1] = surface->groupmesh->data_texcoordtexture2f;
+ m.texmatrix[1] = texture->currenttexmatrix;
m.texcubemap[2] = R_GetTexture(r_shadow_lightcubemap);
#ifdef USETEXMATRIX
m.pointer_texcoord3f[2] = rsurface_vertex3f;
#endif
m.tex[1] = R_GetTexture(basetexture);
m.pointer_texcoord[1] = surface->groupmesh->data_texcoordtexture2f;
+ m.texmatrix[1] = texture->currenttexmatrix;
GL_BlendFunc(GL_ONE, GL_ONE);
}
else if (r_textureunits.integer >= 4 && r_shadow_lightcubemap != r_texture_whitecube)
#endif
m.tex[2] = R_GetTexture(basetexture);
m.pointer_texcoord[2] = surface->groupmesh->data_texcoordtexture2f;
+ m.texmatrix[2] = texture->currenttexmatrix;
if (r_shadow_lightcubemap != r_texture_whitecube)
{
m.texcubemap[3] = R_GetTexture(r_shadow_lightcubemap);
#endif
m.tex[2] = R_GetTexture(basetexture);
m.pointer_texcoord[2] = surface->groupmesh->data_texcoordtexture2f;
+ m.texmatrix[2] = texture->currenttexmatrix;
GL_BlendFunc(GL_ONE, GL_ONE);
}
else
m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(basetexture);
m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.texmatrix[0] = texture->currenttexmatrix;
if (r_shadow_lightcubemap != r_texture_whitecube)
{
m.texcubemap[1] = R_GetTexture(r_shadow_lightcubemap);
m.tex[0] = R_GetTexture(normalmaptexture);
m.texcombinergb[0] = GL_REPLACE;
m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.texmatrix[0] = texture->currenttexmatrix;
m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
m.pointer_texcoord3f[1] = varray_texcoord3f[1];
m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(basetexture);
m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.texmatrix[0] = texture->currenttexmatrix;
if (r_shadow_lightcubemap != r_texture_whitecube)
{
m.texcubemap[1] = R_GetTexture(r_shadow_lightcubemap);
m.tex[0] = R_GetTexture(normalmaptexture);
m.texcombinergb[0] = GL_REPLACE;
m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.texmatrix[0] = texture->currenttexmatrix;
m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
m.pointer_texcoord3f[1] = varray_texcoord3f[1];
m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(basetexture);
m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.texmatrix[0] = texture->currenttexmatrix;
if (r_shadow_lightcubemap != r_texture_whitecube)
{
m.texcubemap[1] = R_GetTexture(r_shadow_lightcubemap);
m.tex[0] = R_GetTexture(normalmaptexture);
m.texcombinergb[0] = GL_REPLACE;
m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.texmatrix[0] = texture->currenttexmatrix;
m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
m.pointer_texcoord3f[1] = varray_texcoord3f[1];
m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(basetexture);
m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.texmatrix[0] = texture->currenttexmatrix;
m.tex3d[1] = R_GetTexture(r_shadow_attenuation3dtexture);
#ifdef USETEXMATRIX
m.pointer_texcoord3f[1] = rsurface_vertex3f;
m.tex[0] = R_GetTexture(normalmaptexture);
m.texcombinergb[0] = GL_REPLACE;
m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.texmatrix[0] = texture->currenttexmatrix;
m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
m.pointer_texcoord3f[1] = varray_texcoord3f[1];
m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(basetexture);
m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.texmatrix[0] = texture->currenttexmatrix;
if (r_shadow_lightcubemap != r_texture_whitecube)
{
m.texcubemap[1] = R_GetTexture(r_shadow_lightcubemap);
m.tex[0] = R_GetTexture(normalmaptexture);
m.texcombinergb[0] = GL_REPLACE;
m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.texmatrix[0] = texture->currenttexmatrix;
m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
m.pointer_texcoord3f[1] = varray_texcoord3f[1];
m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(basetexture);
m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.texmatrix[0] = texture->currenttexmatrix;
if (r_shadow_lightcubemap != r_texture_whitecube)
{
m.texcubemap[1] = R_GetTexture(r_shadow_lightcubemap);
m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(normalmaptexture);
m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.texmatrix[0] = texture->currenttexmatrix;
m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
m.pointer_texcoord3f[1] = varray_texcoord3f[1];
m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(glosstexture);
m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.texmatrix[0] = texture->currenttexmatrix;
if (r_shadow_lightcubemap != r_texture_whitecube)
{
m.texcubemap[1] = R_GetTexture(r_shadow_lightcubemap);
m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(normalmaptexture);
m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.texmatrix[0] = texture->currenttexmatrix;
m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
m.pointer_texcoord3f[1] = varray_texcoord3f[1];
m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(glosstexture);
m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.texmatrix[0] = texture->currenttexmatrix;
m.tex3d[1] = R_GetTexture(r_shadow_attenuation3dtexture);
#ifdef USETEXMATRIX
m.pointer_texcoord3f[1] = rsurface_vertex3f;
m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(normalmaptexture);
m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.texmatrix[0] = texture->currenttexmatrix;
m.texcubemap[1] = R_GetTexture(r_texture_normalizationcube);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
m.pointer_texcoord3f[1] = varray_texcoord3f[1];
m.pointer_vertex = rsurface_vertex3f;
m.tex[0] = R_GetTexture(glosstexture);
m.pointer_texcoord[0] = surface->groupmesh->data_texcoordtexture2f;
+ m.texmatrix[0] = texture->currenttexmatrix;
if (r_shadow_lightcubemap != r_texture_whitecube)
{
m.texcubemap[1] = R_GetTexture(r_shadow_lightcubemap);
Mod_BuildTextureVectorsAndNormals(surface->num_firstvertex, surface->num_vertices, surface->num_triangles, rsurface_vertex3f, surface->groupmesh->data_texcoordtexture2f, surface->groupmesh->data_element3i + surface->num_firsttriangle * 3, rsurface_svector3f, rsurface_tvector3f, rsurface_normal3f, r_smoothnormals_areaweighting.integer);
}
// OpenGL 1.1 path (anything)
- R_Mesh_VertexPointer(rsurface_vertex3f);
R_Mesh_TexCoordPointer(0, 2, surface->groupmesh->data_texcoordtexture2f);
+ R_Mesh_TexMatrix(0, &texture->currenttexmatrix);
if (r_textureunits.integer >= 2)
{
// voodoo2 or TNT