// pick a new currentskinframe if the material is animated
if (t->numskinframes >= 2)
t->currentskinframe = t->skinframes + ((int)(t->skinframerate * (cl.time - ent->frame2time)) % t->numskinframes);
+ if (t->backgroundnumskinframes >= 2)
+ t->backgroundcurrentskinframe = t->backgroundskinframes + ((int)(t->backgroundskinframerate * (cl.time - ent->frame2time)) % t->backgroundnumskinframes);
t->currentmaterialflags = t->basematerialflags;
t->currentalpha = ent->alpha;
t->currenttexmatrix = r_waterscrollmatrix;
else
t->currenttexmatrix = identitymatrix;
+ if (t->backgroundnumskinframes && !(t->currentmaterialflags & MATERIALFLAG_TRANSPARENT))
+ t->currentmaterialflags |= MATERIALFLAG_VERTEXTEXTUREBLEND;
t->colormapping = VectorLength2(ent->colormap_pantscolor) + VectorLength2(ent->colormap_shirtcolor) >= (1.0f / 1048576.0f);
t->basetexture = (!t->colormapping && t->currentskinframe->merged) ? t->currentskinframe->merged : t->currentskinframe->base;
t->glosstexture = r_texture_white;
+ t->backgroundbasetexture = t->backgroundnumskinframes ? ((!t->colormapping && t->backgroundcurrentskinframe->merged) ? t->backgroundcurrentskinframe->merged : t->backgroundcurrentskinframe->base) : r_texture_white;
+ t->backgroundglosstexture = r_texture_white;
t->specularpower = r_shadow_glossexponent.value;
t->specularscale = 0;
if (r_shadow_gloss.integer > 0)
{
- if (t->currentskinframe->gloss)
+ if (t->currentskinframe->gloss || (t->backgroundcurrentskinframe && t->backgroundcurrentskinframe->gloss))
{
if (r_shadow_glossintensity.value > 0)
{
- t->glosstexture = t->currentskinframe->gloss;
+ t->glosstexture = t->currentskinframe->gloss ? t->currentskinframe->gloss : r_texture_black;
+ t->backgroundglosstexture = (t->backgroundcurrentskinframe && t->backgroundcurrentskinframe->gloss) ? t->backgroundcurrentskinframe->gloss : r_texture_black;
t->specularscale = r_shadow_glossintensity.value;
}
}
R_Mesh_TexBind(8, R_GetTexture(texturesurfacelist[0]->deluxemaptexture));
}
RSurf_DrawBatch_Simple(texturenumsurfaces, texturesurfacelist);
+ if (rsurface_texture->backgroundnumskinframes && !(rsurface_texture->currentmaterialflags & MATERIALFLAG_TRANSPARENT))
+ {
+ }
}
static void R_DrawTextureSurfaceList_GL13(int texturenumsurfaces, msurface_t **texturesurfacelist)
tx->skinframerate = 1;
tx->currentskinframe = tx->skinframes;
tx->skinframes[0].base = r_texture_notexture;
+ tx->backgroundcurrentskinframe = tx->backgroundskinframes;
tx->basematerialflags = 0;
if (i == loadmodel->num_textures - 1)
{
if (!Mod_LoadSkinFrame(&out->skinframes[j], shader->primarylayer->texturename[j], ((shader->surfaceparms & Q3SURFACEPARM_NOMIPMAPS) ? 0 : TEXF_MIPMAP) | TEXF_ALPHA | TEXF_PRECACHE | (shader->textureflags & Q3TEXTUREFLAG_NOPICMIP ? 0 : TEXF_PICMIP) | (shader->primarylayer->clampmap ? TEXF_CLAMP : 0), false, true))
Con_Printf("%s: could not load texture \"%s\" (frame %i) for shader \"%s\"\n", loadmodel->name, shader->primarylayer->texturename[j], j, out->name);
}
+ if (shader->backgroundlayer && cls.state != ca_dedicated)
+ {
+ int j;
+ out->backgroundnumskinframes = shader->backgroundlayer->numframes;
+ out->backgroundskinframerate = shader->backgroundlayer->framerate;
+ for (j = 0;j < shader->backgroundlayer->numframes;j++)
+ if (!Mod_LoadSkinFrame(&out->backgroundskinframes[j], shader->backgroundlayer->texturename[j], ((shader->surfaceparms & Q3SURFACEPARM_NOMIPMAPS) ? 0 : TEXF_MIPMAP) | TEXF_ALPHA | TEXF_PRECACHE | (shader->textureflags & Q3TEXTUREFLAG_NOPICMIP ? 0 : TEXF_PICMIP) | (shader->backgroundlayer->clampmap ? TEXF_CLAMP : 0), false, true))
+ Con_Printf("%s: could not load texture \"%s\" (frame %i) for shader \"%s\"\n", loadmodel->name, shader->backgroundlayer->texturename[j], j, out->name);
+ }
}
else
{
// init the animation variables
out->currentframe = out;
out->currentskinframe = &out->skinframes[0];
+ out->backgroundcurrentskinframe = &out->backgroundskinframes[0];
}
if (c)
Con_DPrintf("%s: %i textures missing shaders\n", loadmodel->name, c);
#define MATERIALFLAG_CUSTOMBLEND 8192
// do not cast shadows from this material
#define MATERIALFLAG_NOSHADOW 16384
+// render using vertex alpha (q3bsp) as texture blend parameter between foreground (normal) skinframe and background skinframe
+#define MATERIALFLAG_VERTEXTEXTUREBLEND 32768
typedef struct medge_s
{
int numskinframes;
float skinframerate;
skinframe_t skinframes[TEXTURE_MAXFRAMES];
+ // background layer (for terrain texture blending)
+ skinframe_t *backgroundcurrentskinframe;
+ int backgroundnumskinframes;
+ float backgroundskinframerate;
+ skinframe_t backgroundskinframes[TEXTURE_MAXFRAMES];
// total frames in sequence and alternate sequence
int anim_total[2];
qboolean colormapping;
rtexture_t *basetexture;
rtexture_t *glosstexture;
+ rtexture_t *backgroundbasetexture;
+ rtexture_t *backgroundglosstexture;
float specularscale;
float specularpower;