{
int x, y, d, i, k, m;
int basex, basey, w, h;
- float dx, dy, f;
+ float dx, dy, f, s1, t1, s2, t2;
vec3_t light;
char *buf;
fs_offset_t filesize;
+ char texturename[MAX_QPATH];
// a note: decals need to modulate (multiply) the background color to
// properly darken it (stain), and they need to be able to alpha fade,
break;
if(!strcmp(com_token, "\n"))
continue; // empty line
- i = atoi(com_token) % MAX_PARTICLETEXTURES;
- particletexture[i].texture = particlefonttexture;
+ i = atoi(com_token);
- if (!COM_ParseToken_Simple(&bufptr, true, false))
- break;
- if (!strcmp(com_token, "\n"))
- {
- Con_Printf("particlefont file: syntax should be texnum texturename or texnum x y w h\n");
- continue;
- }
- particletexture[i].s1 = atof(com_token);
+ texturename[0] = 0;
+ s1 = 0;
+ t1 = 0;
+ s2 = 1;
+ t2 = 1;
- if (!COM_ParseToken_Simple(&bufptr, true, false))
- break;
- if (!strcmp(com_token, "\n"))
+ if (COM_ParseToken_Simple(&bufptr, true, false) && strcmp(com_token, "\n"))
{
- Con_Printf("particlefont file: syntax should be texnum texturename or texnum x y w h\n");
- continue;
+ s1 = atof(com_token);
+ if (COM_ParseToken_Simple(&bufptr, true, false) && strcmp(com_token, "\n"))
+ {
+ t1 = atof(com_token);
+ if (COM_ParseToken_Simple(&bufptr, true, false) && strcmp(com_token, "\n"))
+ {
+ s2 = atof(com_token);
+ if (COM_ParseToken_Simple(&bufptr, true, false) && strcmp(com_token, "\n"))
+ {
+ t2 = atof(com_token);
+ strlcpy(texturename, "particles/particlefont.tga", sizeof(texturename));
+ if (COM_ParseToken_Simple(&bufptr, true, false) && strcmp(com_token, "\n"))
+ strlcpy(texturename, com_token, sizeof(texturename));
+ }
+ }
+ }
+ else
+ {
+ s1 = 0;
+ strlcpy(texturename, com_token, sizeof(texturename));
+ }
}
- particletexture[i].t1 = atof(com_token);
-
- if (!COM_ParseToken_Simple(&bufptr, true, false))
- break;
- if (!strcmp(com_token, "\n"))
+ if (!texturename[0])
{
- Con_Printf("particlefont file: syntax should be texnum texturename or texnum x y w h\n");
+ Con_Printf("particles/particlefont.txt: syntax should be texnum x1 y1 x2 y2 texturename or texnum x1 y1 x2 y2 or texnum texturename\n");
continue;
}
- particletexture[i].s2 = atof(com_token);
-
- if (!COM_ParseToken_Simple(&bufptr, true, false))
- break;
- if (!strcmp(com_token, "\n"))
+ if (i < 0 || i >= MAX_PARTICLETEXTURES)
{
- Con_Printf("particlefont file: syntax should be texnum texturename or texnum x y w h\n");
+ Con_Printf("particles/particlefont.txt: texnum %i outside valid range (0 to %i)\n", i, MAX_PARTICLETEXTURES);
continue;
}
- particletexture[i].t2 = atof(com_token);
+ particletexture[i].texture = R_SkinFrame_LoadExternal(texturename, TEXF_ALPHA | TEXF_FORCELINEAR, false)->base;
+ particletexture[i].s1 = s1;
+ particletexture[i].t1 = t1;
+ particletexture[i].s2 = s2;
+ particletexture[i].t2 = t2;
}
Mem_Free(buf);
}
GL_DepthRange(0, 1);
GL_PolygonOffset(0, 0);
GL_DepthTest(true);
+ GL_AlphaTest(false);
GL_CullFace(GL_NONE);
// first generate all the vertices at once
VectorCopy(decal->vertex3f[2], v3f + 6);
}
+ if (r_refdef.fogenabled)
+ {
+ alpha = RSurf_FogVertex(v3f);
+ VectorScale(c4f, alpha, c4f);
+ alpha = RSurf_FogVertex(v3f + 3);
+ VectorScale(c4f + 4, alpha, c4f + 4);
+ alpha = RSurf_FogVertex(v3f + 6);
+ VectorScale(c4f + 8, alpha, c4f + 8);
+ }
+
v3f += 9;
c4f += 12;
t2f += 6;
{
r_refdef.stats.drawndecals += numtris;
- if (r_refdef.fogenabled)
- {
- switch(vid.renderpath)
- {
- case RENDERPATH_GL20:
- case RENDERPATH_CGGL:
- case RENDERPATH_GL13:
- case RENDERPATH_GL11:
- for (i = 0, v3f = decalsystem->vertex3f, c4f = decalsystem->color4f;i < numtris*3;i++, v3f += 3, c4f += 4)
- {
- alpha = RSurf_FogVertex(v3f);
- c4f[0] *= alpha;
- c4f[1] *= alpha;
- c4f[2] *= alpha;
- }
- break;
- }
- }
-
// now render the decals all at once
// (this assumes they all use one particle font texture!)
RSurf_ActiveCustomEntity(&rsurface.matrix, &rsurface.inversematrix, rsurface.ent_flags, rsurface.ent_shadertime, 1, 1, 1, 1, numdecals*3, decalsystem->vertex3f, decalsystem->texcoord2f, NULL, NULL, NULL, decalsystem->color4f, numtris, decalsystem->element3i, decalsystem->element3s, false, false);
#define CACHEPICHASHSIZE 256
#define MAX_PARTICLEEFFECTNAME 256
#define MAX_PARTICLEEFFECTINFO 1024
-#define MAX_PARTICLETEXTURES 96
+#define MAX_PARTICLETEXTURES 256
#define MAXCLVIDEOS 1
#define MAX_GECKO_INSTANCES 1
#define MAX_DYNAMIC_TEXTURE_COUNT 2
#define CACHEPICHASHSIZE 256 ///< number of hash buckets for accelerating 2D pic name lookups
#define MAX_PARTICLEEFFECTNAME 256 ///< maximum number of unique names of particle effects (for particleeffectnum)
#define MAX_PARTICLEEFFECTINFO 4096 ///< maximum number of unique particle effects (each name may associate with several of these)
-#define MAX_PARTICLETEXTURES 1024 ///< maximum number of unique particle textures in the particle font
+#define MAX_PARTICLETEXTURES 256 ///< maximum number of unique particle textures in the particle font
#define MAXCLVIDEOS 65 ///< maximum number of video streams being played back at once (1 is reserved for the playvideo command)
#define MAX_GECKO_INSTANCES 16 ///< maximum number of web browser textures active at once
#define MAX_DYNAMIC_TEXTURE_COUNT 64 ///< maximum number of dynamic textures (web browsers, playvideo, etc)