Fix csqc polygon issue (using explicit glsl that doesn't need normals).

Added gl_texture_lodbias cvar for the luls.
Fix some serious-but-situational traceline issues.



git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5402 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2019-02-19 06:49:03 +00:00
parent 3867760e75
commit 3250de5851
40 changed files with 2781 additions and 2475 deletions

View File

@ -2227,13 +2227,7 @@ void CLQ1_AddOrientedHalfSphere(shader_t *shader, float radius, float gap, float
}
if (cl_numstrisvert + latsteps*lngsteps > cl_maxstrisvert)
{
cl_maxstrisvert = cl_numstrisvert + latsteps*lngsteps;
cl_strisvertv = BZ_Realloc(cl_strisvertv, sizeof(*cl_strisvertv)*cl_maxstrisvert);
cl_strisvertt = BZ_Realloc(cl_strisvertt, sizeof(vec2_t)*cl_maxstrisvert);
cl_strisvertc = BZ_Realloc(cl_strisvertc, sizeof(vec4_t)*cl_maxstrisvert);
}
cl_stris_ExpandVerts(cl_numstrisvert + latsteps*lngsteps);
if (cl_maxstrisidx < cl_numstrisidx+latsteps*(lngsteps-1)*6)
{
cl_maxstrisidx = cl_numstrisidx+latsteps*(lngsteps-1)*6 + 64;
@ -2358,13 +2352,7 @@ void CLQ1_AddOrientedCylinder(shader_t *shader, float radius, float height, qboo
}
if (cl_numstrisvert + sides*2 > cl_maxstrisvert)
{
cl_maxstrisvert = cl_numstrisvert + sides*2;
cl_strisvertv = BZ_Realloc(cl_strisvertv, sizeof(*cl_strisvertv)*cl_maxstrisvert);
cl_strisvertt = BZ_Realloc(cl_strisvertt, sizeof(vec2_t)*cl_maxstrisvert);
cl_strisvertc = BZ_Realloc(cl_strisvertc, sizeof(vec4_t)*cl_maxstrisvert);
}
cl_stris_ExpandVerts(cl_numstrisvert + sides*2);
if (cl_maxstrisidx < cl_numstrisidx+sides*6)
{
cl_maxstrisidx = cl_numstrisidx+sides*6 + 64;
@ -2451,13 +2439,7 @@ void CLQ1_DrawLine(shader_t *shader, vec3_t v1, vec3_t v2, float r, float g, flo
t->flags = flags;
}
if (cl_numstrisvert + 2 > cl_maxstrisvert)
{
cl_maxstrisvert = cl_numstrisvert + 2;
cl_strisvertv = BZ_Realloc(cl_strisvertv, sizeof(*cl_strisvertv)*cl_maxstrisvert);
cl_strisvertt = BZ_Realloc(cl_strisvertt, sizeof(vec2_t)*cl_maxstrisvert);
cl_strisvertc = BZ_Realloc(cl_strisvertc, sizeof(vec4_t)*cl_maxstrisvert);
}
cl_stris_ExpandVerts(cl_numstrisvert + 2);
if (cl_maxstrisidx < cl_numstrisidx+2)
{
cl_maxstrisidx = cl_numstrisidx+2;
@ -2517,12 +2499,7 @@ void CLQ1_AddSpriteQuad(shader_t *shader, vec3_t mid, float radius)
cl_strisidx = BZ_Realloc(cl_strisidx, sizeof(*cl_strisidx)*cl_maxstrisidx);
}
if (cl_numstrisvert+4 > cl_maxstrisvert)
{
cl_maxstrisvert+=64;
cl_strisvertv = BZ_Realloc(cl_strisvertv, sizeof(*cl_strisvertv)*cl_maxstrisvert);
cl_strisvertt = BZ_Realloc(cl_strisvertt, sizeof(*cl_strisvertt)*cl_maxstrisvert);
cl_strisvertc = BZ_Realloc(cl_strisvertc, sizeof(*cl_strisvertc)*cl_maxstrisvert);
}
cl_stris_ExpandVerts(cl_maxstrisvert+64);
{
VectorMA(mid, radius, vright, cl_strisvertv[cl_numstrisvert]);
@ -2589,12 +2566,7 @@ void CL_DrawDebugPlane(float *normal, float dist, float r, float g, float b, qbo
cl_strisidx = BZ_Realloc(cl_strisidx, sizeof(*cl_strisidx)*cl_maxstrisidx);
}
if (cl_numstrisvert+4 > cl_maxstrisvert)
{
cl_maxstrisvert+=64;
cl_strisvertv = BZ_Realloc(cl_strisvertv, sizeof(*cl_strisvertv)*cl_maxstrisvert);
cl_strisvertt = BZ_Realloc(cl_strisvertt, sizeof(*cl_strisvertt)*cl_maxstrisvert);
cl_strisvertc = BZ_Realloc(cl_strisvertc, sizeof(*cl_strisvertc)*cl_maxstrisvert);
}
cl_stris_ExpandVerts(cl_maxstrisvert+64);
{
vec3_t tmp = {0,0.04,0.96};
@ -2686,13 +2658,8 @@ void CLQ1_AddOrientedCube(shader_t *shader, vec3_t mins, vec3_t maxs, float *mat
if (cl_numstrisvert + 8 > cl_maxstrisvert)
{
cl_maxstrisvert = cl_numstrisvert + 8 + 1024;
cl_stris_ExpandVerts(cl_numstrisvert + 8 + 1024);
cl_strisvertv = BZ_Realloc(cl_strisvertv, sizeof(*cl_strisvertv)*cl_maxstrisvert);
cl_strisvertt = BZ_Realloc(cl_strisvertt, sizeof(vec2_t)*cl_maxstrisvert);
cl_strisvertc = BZ_Realloc(cl_strisvertc, sizeof(vec4_t)*cl_maxstrisvert);
}
if (cl_maxstrisidx < cl_numstrisidx+6*6)
{
cl_maxstrisidx = cl_numstrisidx + 6*6 + 1024;
@ -2956,13 +2923,7 @@ static void CL_AddDecal_Callback(void *vctx, vec3_t *fte_restrict points, size_t
if (cl_numstrisvert + numpoints > cl_maxstrisvert)
{
cl_maxstrisvert = cl_numstrisvert + numpoints;
cl_strisvertv = BZ_Realloc(cl_strisvertv, sizeof(*cl_strisvertv)*cl_maxstrisvert);
cl_strisvertt = BZ_Realloc(cl_strisvertt, sizeof(vec2_t)*cl_maxstrisvert);
cl_strisvertc = BZ_Realloc(cl_strisvertc, sizeof(vec4_t)*cl_maxstrisvert);
}
cl_stris_ExpandVerts(cl_numstrisvert + numpoints);
if (cl_maxstrisidx < cl_numstrisidx+numpoints)
{
cl_maxstrisidx = cl_numstrisidx+numpoints + 64;

View File

@ -60,8 +60,8 @@ cvar_t cl_disconnectreason = CVARAFD("_cl_disconnectreason", "", "com_errorMessa
cvar_t cl_pure = CVARD("cl_pure", "0", "0=standard quake rules.\n1=clients should prefer files within packages present on the server.\n2=clients should use *only* files within packages present on the server.\nDue to quake 1.01/1.06 differences, a setting of 2 is only reliable with total conversions.\nIf sv_pure is set, the client will prefer the highest value set.");
cvar_t cl_sbar = CVARFC("cl_sbar", "0", CVAR_ARCHIVE, CL_Sbar_Callback);
cvar_t cl_hudswap = CVARF("cl_hudswap", "0", CVAR_ARCHIVE);
cvar_t cl_maxfps = CVARFD("cl_maxfps", "500", CVAR_ARCHIVE, "Sets the maximum allowed framerate. If you're using vsync or want to uncap framerates entirely then you should probably set this to 0. Set cl_yieldcpu 0 if you're trying to benchmark.");
cvar_t cl_idlefps = CVARFD("cl_idlefps", "30", CVAR_ARCHIVE, "This is the maximum framerate to attain while idle/paused/unfocused.");
cvar_t cl_maxfps = CVARFD("cl_maxfps", "250", CVAR_ARCHIVE, "Sets the maximum allowed framerate. If you're using vsync or want to uncap framerates entirely then you should probably set this to 0. Set cl_yieldcpu 0 if you're trying to benchmark.");
cvar_t cl_idlefps = CVARFD("cl_idlefps", "60", CVAR_ARCHIVE, "This is the maximum framerate to attain while idle/paused/unfocused.");
cvar_t cl_yieldcpu = CVARFD("cl_yieldcpu", "1", CVAR_ARCHIVE, "Attempt to yield between frames. This can resolve issues with certain drivers and background software, but can mean less consistant frame times. Will reduce power consumption/heat generation so should be set on laptops or similar (over-hot/battery powered) devices.");
cvar_t cl_nopext = CVARF("cl_nopext", "0", CVAR_ARCHIVE);
cvar_t cl_pext_mask = CVAR("cl_pext_mask", "0xffffffff");

View File

@ -467,12 +467,7 @@ void VQ3_AddPoly(shader_t *s, int num, q3polyvert_t *verts)
}
if (cl_maxstrisvert < cl_numstrisvert+num)
{
cl_maxstrisvert = cl_numstrisvert+num + 64;
cl_strisvertv = BZ_Realloc(cl_strisvertv, sizeof(*cl_strisvertv)*cl_maxstrisvert);
cl_strisvertt = BZ_Realloc(cl_strisvertt, sizeof(vec2_t)*cl_maxstrisvert);
cl_strisvertc = BZ_Realloc(cl_strisvertc, sizeof(vec4_t)*cl_maxstrisvert);
}
cl_stris_ExpandVerts(cl_numstrisvert+num + 64);
if (cl_maxstrisidx < cl_numstrisidx+(num-2)*3)
{
cl_maxstrisidx = cl_numstrisidx+(num-2)*3 + 64;

View File

@ -1119,14 +1119,28 @@ extern scenetris_t *cl_stris;
extern vecV_t *fte_restrict cl_strisvertv;
extern vec4_t *fte_restrict cl_strisvertc;
extern vec2_t *fte_restrict cl_strisvertt;
extern vec3_t *fte_restrict cl_strisvertn[3];
extern index_t *fte_restrict cl_strisidx;
extern unsigned int cl_numstrisidx;
extern unsigned int cl_maxstrisidx;
extern unsigned int cl_numstrisvert;
extern unsigned int cl_maxstrisvert;
extern unsigned int cl_numstrisnormals;
extern unsigned int cl_maxstrisnormals;
extern unsigned int cl_numstris;
extern unsigned int cl_maxstris;
#define cl_stris_ExpandVerts(max) \
do { \
cl_maxstrisvert = max; \
cl_strisvertv = BZ_Realloc(cl_strisvertv, sizeof(*cl_strisvertv)*cl_maxstrisvert); \
cl_strisvertt = BZ_Realloc(cl_strisvertt, sizeof(*cl_strisvertt)*cl_maxstrisvert); \
cl_strisvertc = BZ_Realloc(cl_strisvertc, sizeof(*cl_strisvertc)*cl_maxstrisvert); \
/* cl_strisvertn[0] = BZ_Realloc(cl_strisvertn[0], sizeof(*cl_strisvertn[0])*cl_maxstrisvert); \
cl_strisvertn[1] = BZ_Realloc(cl_strisvertn[1], sizeof(*cl_strisvertn[1])*cl_maxstrisvert); \
cl_strisvertn[2] = BZ_Realloc(cl_strisvertn[2], sizeof(*cl_strisvertn[2])*cl_maxstrisvert); \
*/ } while(0)
extern char emodel_name[], pmodel_name[], prespawn_name[], modellist_name[], soundlist_name[];
//CL_TraceLine traces against network(positive)+csqc(negative) ents. returns frac(1 on failure), and impact, normal, ent values

View File

@ -8870,9 +8870,9 @@ static void Image_ParseTextureMode(char *cvarname, char *modename, int modes[3])
void QDECL Image_TextureMode_Callback (struct cvar_s *var, char *oldvalue)
{
int mip[3]={1,0,1}, pic[3]={1,-1,1}, mipcap[2] = {0, 1000};
float anis = 1;
float anis = 1, lodbias = 0;
char *s;
extern cvar_t gl_texturemode, gl_texturemode2d, gl_texture_anisotropic_filtering, gl_mipcap;
extern cvar_t gl_texturemode, gl_texturemode2d, gl_texture_anisotropic_filtering, gl_texture_lodbias, gl_mipcap;
Image_ParseTextureMode(gl_texturemode.name, gl_texturemode.string, mip);
Image_ParseTextureMode(gl_texturemode2d.name, gl_texturemode2d.string, pic);
@ -8886,9 +8886,10 @@ void QDECL Image_TextureMode_Callback (struct cvar_s *var, char *oldvalue)
mipcap[1] = *com_token?atoi(com_token):1000;
if (mipcap[1] < mipcap[0])
mipcap[1] = mipcap[0];
lodbias = gl_texture_lodbias.value;
if (rf && rf->IMG_UpdateFiltering)
rf->IMG_UpdateFiltering(imagelist, mip, pic, mipcap, anis);
rf->IMG_UpdateFiltering(imagelist, mip, pic, mipcap, lodbias, anis);
}
qboolean Image_UnloadTexture(image_t *tex)
{

View File

@ -414,7 +414,7 @@ typedef struct rendererinfo_s {
void (*Draw_Init) (void);
void (*Draw_Shutdown) (void);
void (*IMG_UpdateFiltering) (image_t *imagelist, int filtermip[3], int filterpic[3], int mipcap[2], float anis);
void (*IMG_UpdateFiltering) (image_t *imagelist, int filtermip[3], int filterpic[3], int mipcap[2], float lodbias, float anis);
qboolean (*IMG_LoadTextureMips) (texid_t tex, const struct pendingtextureinfo *mips);
void (*IMG_DestroyTexture) (texid_t tex);

View File

@ -488,12 +488,7 @@ static void PClassic_DrawParticles(void)
#ifdef POLYS
if (cl_numstrisvert+3 > cl_maxstrisvert)
{
cl_maxstrisvert+=1024*3;
cl_strisvertv = BZ_Realloc(cl_strisvertv, sizeof(*cl_strisvertv)*cl_maxstrisvert);
cl_strisvertt = BZ_Realloc(cl_strisvertt, sizeof(*cl_strisvertt)*cl_maxstrisvert);
cl_strisvertc = BZ_Realloc(cl_strisvertc, sizeof(*cl_strisvertc)*cl_maxstrisvert);
}
cl_stris_ExpandVerts(cl_numstrisvert+1024*3);
// Vector4Set(cl_strisvertc[cl_numstrisvert+0],1,1,1,1);
// Vector4Set(cl_strisvertc[cl_numstrisvert+1],1,1,1,1);

View File

@ -6187,12 +6187,7 @@ static void GL_DrawTrifanParticle(int count, particle_t **plist, plooks_t *type)
static void R_AddLineSparkParticle(scenetris_t *t, particle_t *p, plooks_t *type)
{
if (cl_numstrisvert+2 > cl_maxstrisvert)
{
cl_maxstrisvert+=64*2;
cl_strisvertv = BZ_Realloc(cl_strisvertv, sizeof(*cl_strisvertv)*cl_maxstrisvert);
cl_strisvertt = BZ_Realloc(cl_strisvertt, sizeof(*cl_strisvertt)*cl_maxstrisvert);
cl_strisvertc = BZ_Realloc(cl_strisvertc, sizeof(*cl_strisvertc)*cl_maxstrisvert);
}
cl_stris_ExpandVerts(cl_maxstrisvert+64*2);
Vector4Copy(p->rgba, cl_strisvertc[cl_numstrisvert+0]);
VectorCopy(p->rgba, cl_strisvertc[cl_numstrisvert+1]);
@ -6223,12 +6218,7 @@ static void R_AddTSparkParticle(scenetris_t *t, particle_t *p, plooks_t *type)
// float scale;
if (cl_numstrisvert+4 > cl_maxstrisvert)
{
cl_maxstrisvert+=64*4;
cl_strisvertv = BZ_Realloc(cl_strisvertv, sizeof(*cl_strisvertv)*cl_maxstrisvert);
cl_strisvertt = BZ_Realloc(cl_strisvertt, sizeof(*cl_strisvertt)*cl_maxstrisvert);
cl_strisvertc = BZ_Realloc(cl_strisvertc, sizeof(*cl_strisvertc)*cl_maxstrisvert);
}
cl_stris_ExpandVerts(cl_maxstrisvert+64*4);
/* if (type->scalefactor == 1)
scale = p->scale*0.25;
@ -6501,12 +6491,7 @@ static void GL_DrawParticleBeam(int count, beamseg_t **blist, plooks_t *type)
static void R_AddClippedDecal(scenetris_t *t, clippeddecal_t *d, plooks_t *type)
{
if (cl_numstrisvert+4 > cl_maxstrisvert)
{
cl_maxstrisvert+=64*4;
cl_strisvertv = BZ_Realloc(cl_strisvertv, sizeof(*cl_strisvertv)*cl_maxstrisvert);
cl_strisvertt = BZ_Realloc(cl_strisvertt, sizeof(*cl_strisvertt)*cl_maxstrisvert);
cl_strisvertc = BZ_Realloc(cl_strisvertc, sizeof(*cl_strisvertc)*cl_maxstrisvert);
}
cl_stris_ExpandVerts(cl_maxstrisvert+64*4);
if (d->entity > 0)
{
@ -6578,12 +6563,7 @@ static void R_AddUnclippedDecal(scenetris_t *t, particle_t *p, plooks_t *type)
vec3_t sdir, tdir;
if (cl_numstrisvert+4 > cl_maxstrisvert)
{
cl_maxstrisvert+=64*4;
cl_strisvertv = BZ_Realloc(cl_strisvertv, sizeof(*cl_strisvertv)*cl_maxstrisvert);
cl_strisvertt = BZ_Realloc(cl_strisvertt, sizeof(*cl_strisvertt)*cl_maxstrisvert);
cl_strisvertc = BZ_Realloc(cl_strisvertc, sizeof(*cl_strisvertc)*cl_maxstrisvert);
}
cl_stris_ExpandVerts(cl_maxstrisvert+64*4);
if (type->premul)
{
@ -6668,12 +6648,7 @@ static void R_AddTexturedParticle(scenetris_t *t, particle_t *p, plooks_t *type)
float scale, x, y;
if (cl_numstrisvert+4 > cl_maxstrisvert)
{
cl_maxstrisvert+=64*4;
cl_strisvertv = BZ_Realloc(cl_strisvertv, sizeof(*cl_strisvertv)*cl_maxstrisvert);
cl_strisvertt = BZ_Realloc(cl_strisvertt, sizeof(*cl_strisvertt)*cl_maxstrisvert);
cl_strisvertc = BZ_Realloc(cl_strisvertc, sizeof(*cl_strisvertc)*cl_maxstrisvert);
}
cl_stris_ExpandVerts(cl_maxstrisvert+64*4);
if (type->scalefactor == 1)
scale = p->scale*0.25;

View File

@ -1544,13 +1544,49 @@ static void CSQC_PolyFlush(void)
csqc_poly_shader = NULL;
}
static void Shader_PolygonShader(const char *shortname, shader_t *s, const void *args)
{
Shader_DefaultScript(shortname, s,
"{\n"
"if $lpp\n"
"program lpp_skin\n"
"else\n"
"program defaultskin#NONORMALS\n"
"endif\n"
"{\n"
"map $diffuse\n"
"rgbgen vertex\n"
"alphagen vertex\n"
"}\n"
"{\n"
"map $fullbright\n"
"blendfunc add\n"
"}\n"
"}\n"
);
if (!s->defaulttextures->base && (s->flags & SHADER_HASDIFFUSE))
R_BuildDefaultTexnums(NULL, s, 0);
}
static shader_t *PR_R_PolygonShader(const char *shadername, qboolean twod)
{
extern shader_t *shader_draw_fill_trans;
shader_t *shader;
if (!*shadername)
shader = shader_draw_fill_trans; //dp compat...
else if (twod)
shader = R_RegisterPic(shadername, NULL);
else
shader = R_RegisterCustom(shadername, 0, Shader_PolygonShader, NULL);
return shader;
}
// #306 void(string texturename) R_BeginPolygon (EXT_CSQC_???)
void QCBUILTIN PF_R_PolygonBegin(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
const char *shadername = PR_GetStringOfs(prinst, OFS_PARM0);
int qcflags = (prinst->callargc > 1)?G_FLOAT(OFS_PARM1):0;
shader_t *shader;
extern shader_t *shader_draw_fill_trans;
int beflags;
qboolean twod;
@ -1571,16 +1607,7 @@ void QCBUILTIN PF_R_PolygonBegin(pubprogfuncs_t *prinst, struct globalvars_s *pr
if (csqc_isdarkplaces || (qcflags & DRAWFLAG_TWOSIDED))
beflags |= BEF_FORCETWOSIDED;
if (!*shadername)
shader = shader_draw_fill_trans; //dp compat...
else if (twod)
shader = R_RegisterPic(shadername, NULL);
else
{
shader = R_RegisterSkin(shadername, NULL);
if (!shader->defaulttextures->base && (shader->flags & SHADER_HASDIFFUSE))
R_BuildDefaultTexnums(NULL, shader, 0);
}
shader = PR_R_PolygonShader(shadername, twod);
if (R2D_Flush && (R2D_Flush != CSQC_PolyFlush || csqc_poly_shader != shader || csqc_poly_flags != beflags || csqc_poly_2d != twod))
R2D_Flush();
@ -1603,12 +1630,7 @@ void QCBUILTIN PF_R_PolygonBegin(pubprogfuncs_t *prinst, struct globalvars_s *pr
void QCBUILTIN PF_R_PolygonVertex(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
if (cl_numstrisvert == cl_maxstrisvert)
{
cl_maxstrisvert+=64;
cl_strisvertv = BZ_Realloc(cl_strisvertv, sizeof(*cl_strisvertv)*cl_maxstrisvert);
cl_strisvertt = BZ_Realloc(cl_strisvertt, sizeof(*cl_strisvertt)*cl_maxstrisvert);
cl_strisvertc = BZ_Realloc(cl_strisvertc, sizeof(*cl_strisvertc)*cl_maxstrisvert);
}
cl_stris_ExpandVerts(cl_numstrisvert+64);
VectorCopy(G_VECTOR(OFS_PARM0), cl_strisvertv[cl_numstrisvert]);
Vector2Copy(G_VECTOR(OFS_PARM1), cl_strisvertt[cl_numstrisvert]);
@ -1706,6 +1728,7 @@ typedef struct
void QCBUILTIN PF_R_AddTrisoup_Simple(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
shader_t *shader; //parm 0
const char *shadername = PR_GetStringOfs(prinst, OFS_PARM0);
unsigned int qcflags = G_INT(OFS_PARM1);
unsigned int vertsptr = G_INT(OFS_PARM2);
unsigned int indexesptr = G_INT(OFS_PARM3);
@ -1728,14 +1751,7 @@ void QCBUILTIN PF_R_AddTrisoup_Simple(pubprogfuncs_t *prinst, struct globalvars_
if (qcflags & DRAWFLAG_LINES)
beflags |= BEF_LINES;
if (1)//twod)
shader = R_RegisterPic(PR_GetStringOfs(prinst, OFS_PARM0), NULL);
else
{
shader = R_RegisterSkin(PR_GetStringOfs(prinst, OFS_PARM0), NULL);
if (!shader->defaulttextures->base && (shader->flags & SHADER_HASDIFFUSE))
R_BuildDefaultTexnums(NULL, shader, 0);
}
shader = PR_R_PolygonShader(shadername, twod);
if (R2D_Flush && (R2D_Flush != CSQC_PolyFlush || csqc_poly_shader != shader || csqc_poly_flags != beflags || csqc_poly_2d != twod))
R2D_Flush();
@ -1788,12 +1804,7 @@ void QCBUILTIN PF_R_AddTrisoup_Simple(pubprogfuncs_t *prinst, struct globalvars_
cl_strisidx = BZ_Realloc(cl_strisidx, sizeof(*cl_strisidx)*cl_maxstrisidx);
}
if (cl_numstrisvert+numindexes > cl_maxstrisvert)
{
cl_maxstrisvert=cl_numstrisvert+numindexes;
cl_strisvertv = BZ_Realloc(cl_strisvertv, sizeof(*cl_strisvertv)*cl_maxstrisvert);
cl_strisvertt = BZ_Realloc(cl_strisvertt, sizeof(*cl_strisvertt)*cl_maxstrisvert);
cl_strisvertc = BZ_Realloc(cl_strisvertc, sizeof(*cl_strisvertc)*cl_maxstrisvert);
}
cl_stris_ExpandVerts(cl_numstrisvert+numindexes);
for (i = 0; i < numindexes; i++)
{
j = *idx++;

View File

@ -470,12 +470,12 @@ void D3D8_DestroyTexture (texid_t tex);
#endif
#ifdef D3D9QUAKE
void D3D9_Set2D (void);
void D3D9_UpdateFiltering (image_t *imagelist, int filtermip[3], int filterpic[3], int mipcap[2], float anis);
void D3D9_UpdateFiltering (image_t *imagelist, int filtermip[3], int filterpic[3], int mipcap[2], float lodbias, float anis);
qboolean D3D9_LoadTextureMips (texid_t tex, const struct pendingtextureinfo *mips);
void D3D9_DestroyTexture (texid_t tex);
#endif
#ifdef D3D11QUAKE
void D3D11_UpdateFiltering (image_t *imagelist, int filtermip[3], int filterpic[3], int mipcap[2], float anis);
void D3D11_UpdateFiltering (image_t *imagelist, int filtermip[3], int filterpic[3], int mipcap[2], float lodbias, float anis);
qboolean D3D11_LoadTextureMips (texid_t tex, const struct pendingtextureinfo *mips);
void D3D11_DestroyTexture (texid_t tex);
#endif

View File

@ -406,15 +406,18 @@ cvar_t gl_specular_fallbackexp = CVARF ("gl_specular_fallbackexp", "1", CVAR
#endif
// The callbacks are not in D3D yet (also ugly way of seperating this)
cvar_t gl_texture_anisotropic_filtering = CVARFC("gl_texture_anisotropic_filtering", "0",
cvar_t gl_texture_anisotropic_filtering = CVARFCD("gl_texture_anisotropic_filtering", "0",
CVAR_ARCHIVE | CVAR_RENDERERCALLBACK,
Image_TextureMode_Callback);
Image_TextureMode_Callback, "Allows for higher quality textures on surfaces that slope away from the camera (like the floor). Set to 16 or something. Only supported with trilinear filtering.");
cvar_t gl_texturemode = CVARFCD("gl_texturemode", "GL_LINEAR_MIPMAP_LINEAR",
CVAR_ARCHIVE | CVAR_RENDERERCALLBACK | CVAR_SAVE, Image_TextureMode_Callback,
"Specifies how world/model textures appear. Typically 3 letters eg lln.\nFirst letter can be l(inear) or n(earest) and says how to sample from the mip (when downsampling).\nThe middle letter can . to disable mipmaps, or l or n to describe whether to blend between mipmaps.\nThe third letter says what to do when the texture is too low resolution and is thus the most noticable with low resolution textures, a n will make it look like lego, while an l will keep it smooth.");
cvar_t gl_mipcap = CVARAFC("d_mipcap", "0 1000", "gl_miptexLevel",
cvar_t gl_texture_lodbias = CVARAFCD("d_lodbias", "0", "gl_texture_lodbias",
CVAR_ARCHIVE | CVAR_RENDERERCALLBACK,
Image_TextureMode_Callback);
Image_TextureMode_Callback, "Biases choice of mipmap levels. Positive values will give more blury textures, while negative values will give crisper images (but will also give some mid-surface aliasing artifacts).");
cvar_t gl_mipcap = CVARAFCD("d_mipcap", "0 1000", "gl_miptexLevel",
CVAR_ARCHIVE | CVAR_RENDERERCALLBACK,
Image_TextureMode_Callback, "Specifies the range of mipmap levels to use.");
cvar_t gl_texturemode2d = CVARFCD("gl_texturemode2d", "GL_LINEAR",
CVAR_ARCHIVE | CVAR_RENDERERCALLBACK, Image_TextureMode_Callback,
"Specifies how 2d images are sampled. format is a 3-tupple ");
@ -983,6 +986,7 @@ void Renderer_Init(void)
Cvar_Register (&gl_texturemode2d, GLRENDEREROPTIONS);
Cvar_Register (&r_font_linear, GLRENDEREROPTIONS);
Cvar_Register (&gl_mipcap, GLRENDEREROPTIONS);
Cvar_Register (&gl_texture_lodbias, GLRENDEREROPTIONS);
Cvar_Register (&gl_texture_anisotropic_filtering, GLRENDEREROPTIONS);
Cvar_Register (&r_max_gpu_bones, GRAPHICALNICETIES);
Cvar_Register (&r_drawflat, GRAPHICALNICETIES);

View File

@ -19,7 +19,7 @@ static void Headless_Draw_Shutdown(void)
{
Shader_Shutdown();
}
static void Headless_IMG_UpdateFiltering (image_t *imagelist, int filtermip[3], int filterpic[3], int mipcap[2], float anis)
static void Headless_IMG_UpdateFiltering (image_t *imagelist, int filtermip[3], int filterpic[3], int mipcap[2], float lodbias, float anis)
{
}
static qboolean Headless_IMG_LoadTextureMips (texid_t tex, const struct pendingtextureinfo *mips)

View File

@ -1518,13 +1518,7 @@ static void Alias_DrawSkeletalBones(galiasbone_t *bones, float const*bonepose, i
t->flags = flags;
}
if (cl_numstrisvert + bonecount*2 > cl_maxstrisvert)
{
cl_maxstrisvert = cl_numstrisvert + bonecount*2;
cl_strisvertv = BZ_Realloc(cl_strisvertv, sizeof(*cl_strisvertv)*cl_maxstrisvert);
cl_strisvertt = BZ_Realloc(cl_strisvertt, sizeof(vec2_t)*cl_maxstrisvert);
cl_strisvertc = BZ_Realloc(cl_strisvertc, sizeof(vec4_t)*cl_maxstrisvert);
}
cl_stris_ExpandVerts(cl_numstrisvert + bonecount*2);
if (cl_maxstrisidx < cl_numstrisidx+bonecount*2)
{
cl_maxstrisidx = cl_numstrisidx+bonecount*2;
@ -2106,12 +2100,7 @@ void Mod_AddSingleSurface(entity_t *ent, int surfaceidx, shader_t *shader, qbool
cl_strisidx = BZ_Realloc(cl_strisidx, sizeof(*cl_strisidx)*cl_maxstrisidx);
}
if (cl_numstrisvert+t->numvert > cl_maxstrisvert)
{
cl_maxstrisvert=cl_numstrisvert+t->numvert;
cl_strisvertv = BZ_Realloc(cl_strisvertv, sizeof(*cl_strisvertv)*cl_maxstrisvert);
cl_strisvertt = BZ_Realloc(cl_strisvertt, sizeof(*cl_strisvertt)*cl_maxstrisvert);
cl_strisvertc = BZ_Realloc(cl_strisvertc, sizeof(*cl_strisvertc)*cl_maxstrisvert);
}
cl_stris_ExpandVerts(cl_numstrisvert+t->numvert);
for (i = 0; i < mod->numverts; i++)
{
VectorMA(ent->origin, posedata[i][0], ent->axis[0], cl_strisvertv[t->firstvert+i*2+0]);
@ -2158,12 +2147,7 @@ void Mod_AddSingleSurface(entity_t *ent, int surfaceidx, shader_t *shader, qbool
cl_strisidx = BZ_Realloc(cl_strisidx, sizeof(*cl_strisidx)*cl_maxstrisidx);
}
if (cl_numstrisvert+mod->numverts > cl_maxstrisvert)
{
cl_maxstrisvert=cl_numstrisvert+mod->numverts;
cl_strisvertv = BZ_Realloc(cl_strisvertv, sizeof(*cl_strisvertv)*cl_maxstrisvert);
cl_strisvertt = BZ_Realloc(cl_strisvertt, sizeof(*cl_strisvertt)*cl_maxstrisvert);
cl_strisvertc = BZ_Realloc(cl_strisvertc, sizeof(*cl_strisvertc)*cl_maxstrisvert);
}
cl_stris_ExpandVerts(cl_numstrisvert+mod->numverts);
for (i = 0; i < mod->numverts; i++)
{
VectorMA(ent->origin, posedata[i][0], ent->axis[0], cl_strisvertv[t->firstvert+i]);

View File

@ -250,6 +250,9 @@ static qboolean PM_TransformedHullCheck (model_t *model, framestate_t *framestat
return false;
}
memset (trace, 0, sizeof(trace_t));
trace->fraction = 1;
trace->allsolid = true;
Q1BSP_RecursiveHullCheck (&box_hull, box_hull.firstclipnode, start_l, end_l, MASK_PLAYERSOLID, trace);
}

View File

@ -304,7 +304,7 @@ static d3d11backend_t shaderstate;
extern int be_maxpasses;
void D3D11_UpdateFiltering(image_t *imagelist, int filtermip[3], int filterpic[3], int mipcap[2], float anis)
void D3D11_UpdateFiltering(image_t *imagelist, int filtermip[3], int filterpic[3], int mipcap[2], float lodbias, float anis)
{
D3D11_SAMPLER_DESC sampdesc;
int flags;
@ -348,7 +348,7 @@ void D3D11_UpdateFiltering(image_t *imagelist, int filtermip[3], int filterpic[3
sampdesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
sampdesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
}
sampdesc.MipLODBias = 0.0f;
sampdesc.MipLODBias = lodbias;
sampdesc.MaxAnisotropy = bound(1, anis, 16);
sampdesc.BorderColor[0] = 0;
sampdesc.BorderColor[1] = 0;

View File

@ -323,7 +323,7 @@ static void BE_ApplyTMUState(unsigned int tu, unsigned int flags)
}
//d3d9 is all sampler state
void D3D9_UpdateFiltering(image_t *imagelist, int filtermip[3], int filterpic[3], int mipcap[2], float anis)
void D3D9_UpdateFiltering(image_t *imagelist, int filtermip[3], int filterpic[3], int mipcap[2], float miplod, float anis)
{
int i;
memcpy(shaderstate.mipfilter, filtermip, sizeof(shaderstate.mipfilter));
@ -338,6 +338,7 @@ void D3D9_UpdateFiltering(image_t *imagelist, int filtermip[3], int filterpic[3]
for (i = 0; i < MAX_TMUS; i++)
{
IDirect3DDevice9_SetSamplerState(pD3DDev9, i, D3DSAMP_MIPMAPLODBIAS, miplod);
IDirect3DDevice9_SetSamplerState(pD3DDev9, i, D3DSAMP_MAXANISOTROPY, anis);
// IDirect3DDevice9_SetSamplerState(pD3DDev9, i, D3DSAMP_MIPMAPLODBIAS, 0); //negative lod bias? :s

View File

@ -2356,12 +2356,7 @@ static void R_Beam_GenerateTrisoup(entity_t *e, int bemode)
cl_strisidx = BZ_Realloc(cl_strisidx, sizeof(*cl_strisidx)*cl_maxstrisidx);
}
if (cl_numstrisvert+4 > cl_maxstrisvert)
{
cl_maxstrisvert+=64;
cl_strisvertv = BZ_Realloc(cl_strisvertv, sizeof(*cl_strisvertv)*cl_maxstrisvert);
cl_strisvertt = BZ_Realloc(cl_strisvertt, sizeof(*cl_strisvertt)*cl_maxstrisvert);
cl_strisvertc = BZ_Realloc(cl_strisvertc, sizeof(*cl_strisvertc)*cl_maxstrisvert);
}
cl_stris_ExpandVerts(cl_numstrisvert+64);
xyz = &cl_strisvertv[cl_numstrisvert];
st = &cl_strisvertt[cl_numstrisvert];
@ -2560,12 +2555,7 @@ static void R_Sprite_GenerateTrisoup(entity_t *e, int bemode)
cl_strisidx = BZ_Realloc(cl_strisidx, sizeof(*cl_strisidx)*cl_maxstrisidx);
}
if (cl_numstrisvert+4 > cl_maxstrisvert)
{
cl_maxstrisvert+=64;
cl_strisvertv = BZ_Realloc(cl_strisvertv, sizeof(*cl_strisvertv)*cl_maxstrisvert);
cl_strisvertt = BZ_Realloc(cl_strisvertt, sizeof(*cl_strisvertt)*cl_maxstrisvert);
cl_strisvertc = BZ_Realloc(cl_strisvertc, sizeof(*cl_strisvertc)*cl_maxstrisvert);
}
cl_stris_ExpandVerts(cl_numstrisvert+64);
xyz = &cl_strisvertv[cl_numstrisvert];
st = &cl_strisvertt[cl_numstrisvert];
@ -2699,6 +2689,9 @@ static void R_DB_Poly(batch_t *batch)
mesh.xyz_array = cl_strisvertv + cl_stris[i].firstvert;
mesh.st_array = cl_strisvertt + cl_stris[i].firstvert;
// mesh.normals_array = cl_strisvertn[0];// + cl_stris[i].firstvert;
// mesh.snormals_array = cl_strisvertn[1];// + cl_stris[i].firstvert;
// mesh.tnormals_array = cl_strisvertn[2];// + cl_stris[i].firstvert;
mesh.colors4f_array[0] = cl_strisvertc + cl_stris[i].firstvert;
mesh.indexes = cl_strisidx + cl_stris[i].firstidx;
mesh.numindexes = cl_stris[i].numidx;

View File

@ -42,6 +42,7 @@ static int gl_filter_pic[3]; //ui elements
static int gl_filter_mip[3]; //everything else
int gl_mipcap_min = 0;
int gl_mipcap_max = 1000;
int gl_mip_lod_bias = 0;
void GL_DestroyTexture(texid_t tex)
{
@ -611,6 +612,11 @@ static void GL_Texturemode_Apply(GLenum targ, unsigned int flags)
}
}
if (sh_config.can_mipbias)
#define GL_TEXTURE_LOD_BIAS 0x8501
if (flags & IF_MIPCAP)
qglTexParameterf(targ, GL_TEXTURE_LOD_BIAS, (flags & IF_MIPCAP)?gl_mip_lod_bias:0);
qglTexParameteri(targ, GL_TEXTURE_MIN_FILTER, min);
qglTexParameteri(targ, GL_TEXTURE_MAG_FILTER, mag);
if (gl_anisotropy_factor) //0 means driver doesn't support
@ -742,9 +748,12 @@ qboolean GL_LoadTextureMips(texid_t tex, const struct pendingtextureinfo *mips)
{
qglTexParameteri(targ, GL_TEXTURE_BASE_LEVEL, 0);
qglTexParameteri(targ, GL_TEXTURE_MAX_LEVEL, nummips-1);
qglTexParameteri(targ, GL_TEXTURE_LOD_BIAS, 0);
}
}
}
if (sh_config.can_mipbias)
qglTexParameteri(targ, GL_TEXTURE_LOD_BIAS, (tex->flags & IF_MIPCAP)?gl_mip_lod_bias:0);
// tex->width = mips->mip[0].width;
// tex->height = mips->mip[0].height;
@ -982,13 +991,14 @@ qboolean GL_LoadTextureMips(texid_t tex, const struct pendingtextureinfo *mips)
return true;
}
void GL_UpdateFiltering(image_t *imagelist, int filtermip[3], int filterpic[3], int mipcap[2], float anis)
void GL_UpdateFiltering(image_t *imagelist, int filtermip[3], int filterpic[3], int mipcap[2], float lodbias, float anis)
{
int targ;
image_t *img;
gl_mipcap_min = mipcap[0];
gl_mipcap_max = mipcap[1];
gl_mip_lod_bias = lodbias;
VectorCopy(filterpic, gl_filter_pic);
VectorCopy(filtermip, gl_filter_mip);

View File

@ -310,13 +310,19 @@ typedef struct font_s
vec3_t alttint;
} font_t;
union byte_vec4_u
{
byte_vec4_t rgba;
quint32_t c;
};
//shared between fonts.
typedef struct {
texid_t texnum[FONTIMAGES];
texid_t defaultfont;
texid_t trackerimage;
unsigned char plane[PLANEWIDTH*PLANEHEIGHT][4]; //tracks the current plane
union byte_vec4_u plane[PLANEWIDTH*PLANEHEIGHT]; //tracks the current plane
FIMAGEIDXTYPE activeplane;
unsigned short planerowx;
unsigned short planerowy;
@ -329,20 +335,20 @@ typedef struct {
shader_t *backshader;
} fontplanes_t;
static fontplanes_t fontplanes;
#define FONT_CHAR_BUFFER 512
static index_t font_indicies[FONT_CHAR_BUFFER*6];
static vecV_t font_coord[FONT_CHAR_BUFFER*4];
static vecV_t font_backcoord[FONT_CHAR_BUFFER*4];
static vec2_t font_texcoord[FONT_CHAR_BUFFER*4];
static byte_vec4_t font_forecoloura[FONT_CHAR_BUFFER*4];
static byte_vec4_t font_backcoloura[FONT_CHAR_BUFFER*4];
static union byte_vec4_u font_forecoloura[FONT_CHAR_BUFFER*4];
static union byte_vec4_u font_backcoloura[FONT_CHAR_BUFFER*4];
static mesh_t font_foremesh;
static mesh_t font_backmesh;
static texid_t font_texture;
static int font_colourmask;
static byte_vec4_t font_forecolour;
static byte_vec4_t font_backcolour;
static union byte_vec4_u font_forecolour;
static union byte_vec4_u font_backcolour;
static avec4_t font_foretint;
static struct font_s *curfont;
@ -422,12 +428,12 @@ void Font_Init(void)
font_foremesh.indexes = font_indicies;
font_foremesh.xyz_array = font_coord;
font_foremesh.st_array = font_texcoord;
font_foremesh.colors4b_array = font_forecoloura;
font_foremesh.colors4b_array = &font_forecoloura->rgba;
font_backmesh.indexes = font_indicies;
font_backmesh.xyz_array = font_backcoord;
font_backmesh.st_array = font_texcoord;
font_backmesh.colors4b_array = font_backcoloura;
font_backmesh.colors4b_array = &font_backcoloura->rgba;
for (i = 0; i < FONT_CHAR_BUFFER; i++)
{
@ -622,7 +628,7 @@ static struct charcache_s *Font_CopyChar(font_t *f, unsigned int oldcharidx, uns
static struct charcache_s *Font_LoadGlyphData(font_t *f, CHARIDXTYPE charidx, FT_Pixel_Mode pixelmode, void *data, unsigned int bmw, unsigned int bmh, unsigned int pitch)
{
int x, y;
unsigned char *out;
union byte_vec4_u *out;
struct charcache_s *c = Font_GetCharStore(f, charidx);
int pad = 0;
#define BORDERCOLOUR 0
@ -658,31 +664,31 @@ static struct charcache_s *Font_LoadGlyphData(font_t *f, CHARIDXTYPE charidx, FT
fontplanes.planerowh = bmh+pad*2;
fontplanes.planerowx += bmw+pad*2;
out = (unsigned char *)&fontplanes.plane[c->bmx+((int)c->bmy-pad)*PLANEHEIGHT];
out = &fontplanes.plane[c->bmx+((int)c->bmy-pad)*PLANEHEIGHT];
if (pixelmode == FT_PIXEL_MODE_GRAY)
{ //8bit font
for (y = -pad; y < 0; y++)
{
for (x = -pad; x < (int)bmw+pad; x++)
*(unsigned int *)&out[x*4] = BORDERCOLOUR;
out += PLANEWIDTH*4;
out[x].c = BORDERCOLOUR;
out += PLANEWIDTH;
}
for (; y < bmh; y++)
{
for (x = -pad; x < 0; x++)
*(unsigned int *)&out[x*4] = BORDERCOLOUR;
out[x].c = BORDERCOLOUR;
for (; x < bmw; x++)
*(unsigned int *)&out[x*4] = 0x01010101 * ((unsigned char*)data)[x];
out[x].c = 0x01010101 * ((unsigned char*)data)[x];
for (; x < bmw+pad; x++)
*(unsigned int *)&out[x*4] = BORDERCOLOUR;
out[x].c = BORDERCOLOUR;
data = (char*)data + pitch;
out += PLANEWIDTH*4;
out += PLANEWIDTH;
}
for (; y < bmh+pad; y++)
{
for (x = -pad; x < (int)bmw+pad; x++)
*(unsigned int *)&out[x*4] = BORDERCOLOUR;
out += PLANEWIDTH*4;
out[x].c = BORDERCOLOUR;
out += PLANEWIDTH;
}
}
else if ((unsigned int)pixelmode == FT_PIXEL_MODE_RGBA_SA)
@ -691,35 +697,35 @@ static struct charcache_s *Font_LoadGlyphData(font_t *f, CHARIDXTYPE charidx, FT
for (y = -pad; y < 0; y++)
{
for (x = -pad; x < (int)bmw+pad; x++)
*(unsigned int *)&out[x*4] = BORDERCOLOUR;
out += PLANEWIDTH*4;
out[x].c = BORDERCOLOUR;
out += PLANEWIDTH;
}
for (; y < bmh; y++)
{
for (x = -pad; x < 0; x++)
*(unsigned int *)&out[x*4] = BORDERCOLOUR;
out[x].c = BORDERCOLOUR;
for (; x < bmw; x++)
{
if (((unsigned char*)data)[x*4+3] == 255)
((unsigned int*)out)[x] = ((unsigned int*)data)[x];
out[x] = ((union byte_vec4_u*)data)[x];
else
{
out[x*4+0] = (((unsigned char*)data)[x*4+3]*((unsigned char*)data)[x*4+0])<<8;
out[x*4+1] = (((unsigned char*)data)[x*4+3]*((unsigned char*)data)[x*4+1])<<8;
out[x*4+2] = (((unsigned char*)data)[x*4+3]*((unsigned char*)data)[x*4+2])<<8;
out[x*4+3] = ((unsigned char*)data)[x*4+3];
out[x].rgba[0] = (((unsigned char*)data)[x*4+3]*((unsigned char*)data)[x*4+0])<<8;
out[x].rgba[1] = (((unsigned char*)data)[x*4+3]*((unsigned char*)data)[x*4+1])<<8;
out[x].rgba[2] = (((unsigned char*)data)[x*4+3]*((unsigned char*)data)[x*4+2])<<8;
out[x].rgba[3] = ((unsigned char*)data)[x*4+3];
}
}
for (; x < bmw+pad; x++)
*(unsigned int *)&out[x*4] = BORDERCOLOUR;
out[x].c = BORDERCOLOUR;
data = (char*)data + pitch;
out += PLANEWIDTH*4;
out += PLANEWIDTH;
}
for (; y < (int)bmh+pad; y++)
{
for (x = -pad; x < (int)bmw+pad; x++)
*(unsigned int *)&out[x*4] = BORDERCOLOUR;
out += PLANEWIDTH*4;
out[x].c = BORDERCOLOUR;
out += PLANEWIDTH;
}
}
else if (pixelmode == FT_PIXEL_MODE_BGRA)
@ -727,30 +733,30 @@ static struct charcache_s *Font_LoadGlyphData(font_t *f, CHARIDXTYPE charidx, FT
for (y = -pad; y < 0; y++)
{
for (x = -pad; x < (int)bmw+pad; x++)
*(unsigned int *)&out[x*4] = BORDERCOLOUR;
out += PLANEWIDTH*4;
out[x].c = BORDERCOLOUR;
out += PLANEWIDTH;
}
for (; y < bmh; y++)
{
for (x = -pad; x < 0; x++)
*(unsigned int *)&out[x*4] = BORDERCOLOUR;
out[x].c = BORDERCOLOUR;
for (; x < bmw; x++)
{
out[x*4+0] = ((unsigned char*)data)[x*4+2];
out[x*4+1] = ((unsigned char*)data)[x*4+1];
out[x*4+2] = ((unsigned char*)data)[x*4+0];
out[x*4+3] = ((unsigned char*)data)[x*4+3];
out[x].rgba[0] = ((unsigned char*)data)[x*4+2];
out[x].rgba[1] = ((unsigned char*)data)[x*4+1];
out[x].rgba[2] = ((unsigned char*)data)[x*4+0];
out[x].rgba[3] = ((unsigned char*)data)[x*4+3];
}
for (; x < bmw+pad; x++)
*(unsigned int *)&out[x*4] = BORDERCOLOUR;
out[x].c = BORDERCOLOUR;
data = (char*)data + pitch;
out += PLANEWIDTH*4;
out += PLANEWIDTH;
}
for (; y < bmh+pad; y++)
{
for (x = -pad; x < (int)bmw+pad; x++)
*(unsigned int *)&out[x*4] = BORDERCOLOUR;
out += PLANEWIDTH*4;
out[x].c = BORDERCOLOUR;
out += PLANEWIDTH;
}
c->flags = CHARF_FORCEWHITE; //private glyph colours
@ -760,25 +766,25 @@ static struct charcache_s *Font_LoadGlyphData(font_t *f, CHARIDXTYPE charidx, FT
for (y = -pad; y < 0; y++)
{
for (x = -pad; x < (int)bmw+pad; x++)
*(unsigned int *)&out[x*4] = BORDERCOLOUR;
out += PLANEWIDTH*4;
out[x].c = BORDERCOLOUR;
out += PLANEWIDTH;
}
for (; y < bmh; y++)
{
for (x = -pad; x < 0; x++)
*(unsigned int *)&out[x*4] = BORDERCOLOUR;
out[x].c = BORDERCOLOUR;
for (; x < bmw; x++)
((unsigned int*)out)[x] = ((unsigned int*)data)[x];
out[x].c = ((unsigned int*)data)[x];
for (; x < bmw+pad; x++)
*(unsigned int *)&out[x*4] = BORDERCOLOUR;
out[x].c = BORDERCOLOUR;
data = (char*)data + pitch;
out += PLANEWIDTH*4;
out += PLANEWIDTH;
}
for (; y < bmh+pad; y++)
{
for (x = -pad; x < (int)bmw+pad; x++)
*(unsigned int *)&out[x*4] = BORDERCOLOUR;
out += PLANEWIDTH*4;
out[x].c = BORDERCOLOUR;
out += PLANEWIDTH;
}
c->flags = CHARF_FORCEWHITE; //private glyph colours
@ -2638,9 +2644,9 @@ void Font_InvalidateColour(vec4_t newcolour)
VectorScale(newcolour, newcolour[3], font_foretint);
font_foretint[3] = newcolour[3];
Vector4Scale(font_foretint, 255, font_forecolour);
Vector4Scale(font_foretint, 255, font_forecolour.rgba);
font_backcolour[3] = 0;
font_backcolour.rgba[3] = 0;
/*Any drawchars that are now drawn will get the forced colour*/
}
@ -2712,10 +2718,7 @@ int Font_DrawChar(int px, int py, unsigned int charflags, unsigned int codepoint
rgba[2] = ((col>>CON_RICHBSHIFT)&0xf)*0x11;
rgba[3] = 255;
font_backcolour[0] = 0;
font_backcolour[1] = 0;
font_backcolour[2] = 0;
font_backcolour[3] = 0;
font_backcolour.c = 0;
if (charflags & CON_2NDCHARSETTEXT)
{
rgba[0] *= font->alttint[0];
@ -2737,10 +2740,10 @@ int Font_DrawChar(int px, int py, unsigned int charflags, unsigned int codepoint
float a = (sin(realtime*3)+1)*0.4 + 0.2;
Vector4Scale(rgba, a, rgba);
}
font_forecolour[0] = min(rgba[0], 255);
font_forecolour[1] = min(rgba[1], 255);
font_forecolour[2] = min(rgba[2], 255);
font_forecolour[3] = min(rgba[3], 255);
font_forecolour.rgba[0] = min(rgba[0], 255);
font_forecolour.rgba[1] = min(rgba[1], 255);
font_forecolour.rgba[2] = min(rgba[2], 255);
font_forecolour.rgba[3] = min(rgba[3], 255);
}
}
else
@ -2782,13 +2785,13 @@ int Font_DrawChar(int px, int py, unsigned int charflags, unsigned int codepoint
col = (charflags&CON_BGMASK)>>CON_BGSHIFT;
if (charflags & CON_NONCLEARBG)
{
font_backcolour[0] = consolecolours[col].fr*255;
font_backcolour[1] = consolecolours[col].fg*255;
font_backcolour[2] = consolecolours[col].fb*255;
font_backcolour[3] = (charflags & CON_NONCLEARBG)?0xc0:0;
font_backcolour.rgba[0] = consolecolours[col].fr*255;
font_backcolour.rgba[1] = consolecolours[col].fg*255;
font_backcolour.rgba[2] = consolecolours[col].fb*255;
font_backcolour.rgba[3] = (charflags & CON_NONCLEARBG)?0xc0:0;
}
else
Vector4Set(font_backcolour, 0, 0, 0, 0);
font_backcolour.c = 0;
if (charflags & CON_2NDCHARSETTEXT)
{
@ -2811,10 +2814,10 @@ int Font_DrawChar(int px, int py, unsigned int charflags, unsigned int codepoint
float a = (sin(realtime*3)+1)*0.4 + 0.2;
Vector4Scale(rgba, a, rgba);
}
font_forecolour[0] = min(rgba[0], 255);
font_forecolour[1] = min(rgba[1], 255);
font_forecolour[2] = min(rgba[2], 255);
font_forecolour[3] = min(rgba[3], 255);
font_forecolour.rgba[0] = min(rgba[0], 255);
font_forecolour.rgba[1] = min(rgba[1], 255);
font_forecolour.rgba[2] = min(rgba[2], 255);
font_forecolour.rgba[3] = min(rgba[3], 255);
}
}
@ -2884,17 +2887,17 @@ int Font_DrawChar(int px, int py, unsigned int charflags, unsigned int codepoint
if (c->flags&CHARF_FORCEWHITE)
{
*(int*)font_forecoloura[v+0] =
*(int*)font_forecoloura[v+1] =
*(int*)font_forecoloura[v+2] =
*(int*)font_forecoloura[v+3] = 0xffffffff;
font_forecoloura[v+0].c =
font_forecoloura[v+1].c =
font_forecoloura[v+2].c =
font_forecoloura[v+3].c = 0xffffffff;
}
else
{
*(int*)font_forecoloura[v+0] =
*(int*)font_forecoloura[v+1] =
*(int*)font_forecoloura[v+2] =
*(int*)font_forecoloura[v+3] = *(int*)font_forecolour;
font_forecoloura[v+0] =
font_forecoloura[v+1] =
font_forecoloura[v+2] =
font_forecoloura[v+3] = font_forecolour;
}
if (font_colourmask & CON_NONCLEARBG)
@ -2914,10 +2917,10 @@ int Font_DrawChar(int px, int py, unsigned int charflags, unsigned int codepoint
font_backcoord[v+3][0] = sx;
font_backcoord[v+3][1] = sh;
*(int*)font_backcoloura[v+0] = *(int*)font_backcolour;
*(int*)font_backcoloura[v+1] = *(int*)font_backcolour;
*(int*)font_backcoloura[v+2] = *(int*)font_backcolour;
*(int*)font_backcoloura[v+3] = *(int*)font_backcolour;
font_backcoloura[v+0] = font_backcolour;
font_backcoloura[v+1] = font_backcolour;
font_backcoloura[v+2] = font_backcolour;
font_backcoloura[v+3] = font_backcolour;
}
return nextx;
@ -2981,7 +2984,7 @@ float Font_DrawScaleChar(float px, float py, unsigned int charflags, unsigned in
if (col != font_colourmask)
{
vec4_t rgba;
if (font_backcolour[3])
if (font_backcolour.rgba[3])
{
Font_Flush();
R2D_Flush = Font_Flush;
@ -2993,10 +2996,7 @@ float Font_DrawScaleChar(float px, float py, unsigned int charflags, unsigned in
rgba[2] = ((col>>CON_RICHBSHIFT)&0xf)*0x11;
rgba[3] = 255;
font_backcolour[0] = 0;
font_backcolour[1] = 0;
font_backcolour[2] = 0;
font_backcolour[3] = 0;
font_backcolour.c = 0;
if (charflags & CON_2NDCHARSETTEXT)
{
@ -3014,10 +3014,10 @@ float Font_DrawScaleChar(float px, float py, unsigned int charflags, unsigned in
rgba[1] *= font_foretint[1];
rgba[2] *= font_foretint[2];
rgba[3] *= font_foretint[3];
font_forecolour[0] = min(rgba[0], 255);
font_forecolour[1] = min(rgba[1], 255);
font_forecolour[2] = min(rgba[2], 255);
font_forecolour[3] = min(rgba[3], 255);
font_forecolour.rgba[0] = min(rgba[0], 255);
font_forecolour.rgba[1] = min(rgba[1], 255);
font_forecolour.rgba[2] = min(rgba[2], 255);
font_forecolour.rgba[3] = min(rgba[3], 255);
}
}
else
@ -3026,7 +3026,7 @@ float Font_DrawScaleChar(float px, float py, unsigned int charflags, unsigned in
if (col != font_colourmask)
{
vec4_t rgba;
if (font_backcolour[3] != ((charflags & CON_NONCLEARBG)?127:0))
if (font_backcolour.rgba[3] != ((charflags & CON_NONCLEARBG)?127:0))
{
Font_Flush();
R2D_Flush = Font_Flush;
@ -3052,13 +3052,13 @@ float Font_DrawScaleChar(float px, float py, unsigned int charflags, unsigned in
col = (charflags&CON_BGMASK)>>CON_BGSHIFT;
if (charflags & CON_NONCLEARBG)
{
font_backcolour[0] = consolecolours[col].fr*0xc0;
font_backcolour[1] = consolecolours[col].fg*0xc0;
font_backcolour[2] = consolecolours[col].fb*0xc0;
font_backcolour[3] = 0xc0;
font_backcolour.rgba[0] = consolecolours[col].fr*0xc0;
font_backcolour.rgba[1] = consolecolours[col].fg*0xc0;
font_backcolour.rgba[2] = consolecolours[col].fb*0xc0;
font_backcolour.rgba[3] = 0xc0;
}
else
Vector4Set(font_backcolour, 0, 0, 0, 0);
font_backcolour.c = 0;
if (charflags & CON_2NDCHARSETTEXT)
{
@ -3076,10 +3076,10 @@ float Font_DrawScaleChar(float px, float py, unsigned int charflags, unsigned in
rgba[1] *= font_foretint[1];
rgba[2] *= font_foretint[2];
rgba[3] *= font_foretint[3];
font_forecolour[0] = min(rgba[0], 255);
font_forecolour[1] = min(rgba[1], 255);
font_forecolour[2] = min(rgba[2], 255);
font_forecolour[3] = min(rgba[3], 255);
font_forecolour.rgba[0] = min(rgba[0], 255);
font_forecolour.rgba[1] = min(rgba[1], 255);
font_forecolour.rgba[2] = min(rgba[2], 255);
font_forecolour.rgba[3] = min(rgba[3], 255);
}
}
@ -3135,10 +3135,10 @@ float Font_DrawScaleChar(float px, float py, unsigned int charflags, unsigned in
font_coord[v+3][0] = sx;
font_coord[v+3][1] = sy+sh;
*(int*)font_forecoloura[v+0] = *(int*)font_forecolour;
*(int*)font_forecoloura[v+1] = *(int*)font_forecolour;
*(int*)font_forecoloura[v+2] = *(int*)font_forecolour;
*(int*)font_forecoloura[v+3] = *(int*)font_forecolour;
font_forecoloura[v+0] = font_forecolour;
font_forecoloura[v+1] = font_forecolour;
font_forecoloura[v+2] = font_forecolour;
font_forecoloura[v+3] = font_forecolour;
if (font_colourmask & CON_NONCLEARBG)
{
@ -3162,10 +3162,10 @@ float Font_DrawScaleChar(float px, float py, unsigned int charflags, unsigned in
font_backcoord[v+3][0] = sx;
font_backcoord[v+3][1] = sh;
*(int*)font_backcoloura[v+0] = *(int*)font_backcolour;
*(int*)font_backcoloura[v+1] = *(int*)font_backcolour;
*(int*)font_backcoloura[v+2] = *(int*)font_backcolour;
*(int*)font_backcoloura[v+3] = *(int*)font_backcolour;
font_backcoloura[v+0] = font_backcolour;
font_backcoloura[v+1] = font_backcolour;
font_backcoloura[v+2] = font_backcolour;
font_backcoloura[v+3] = font_backcolour;
}
return nextx;

View File

@ -2239,12 +2239,7 @@ void Terr_DrawTerrainWater(heightmap_t *hm, float *mins, float *maxs, struct hmw
cl_strisidx = BZ_Realloc(cl_strisidx, sizeof(*cl_strisidx)*cl_maxstrisidx);
}
if (cl_numstrisvert+9*9 > cl_maxstrisvert)
{
cl_maxstrisvert+=9*9+64;
cl_strisvertv = BZ_Realloc(cl_strisvertv, sizeof(*cl_strisvertv)*cl_maxstrisvert);
cl_strisvertt = BZ_Realloc(cl_strisvertt, sizeof(*cl_strisvertt)*cl_maxstrisvert);
cl_strisvertc = BZ_Realloc(cl_strisvertc, sizeof(*cl_strisvertc)*cl_maxstrisvert);
}
cl_stris_ExpandVerts(cl_numstrisvert+9*9+64);
firstv = t->numvert;
for (y = 0; y < 9; y++)
@ -2286,12 +2281,7 @@ void Terr_DrawTerrainWater(heightmap_t *hm, float *mins, float *maxs, struct hmw
cl_strisidx = BZ_Realloc(cl_strisidx, sizeof(*cl_strisidx)*cl_maxstrisidx);
}
if (cl_numstrisvert+4 > cl_maxstrisvert)
{
cl_maxstrisvert+=64;
cl_strisvertv = BZ_Realloc(cl_strisvertv, sizeof(*cl_strisvertv)*cl_maxstrisvert);
cl_strisvertt = BZ_Realloc(cl_strisvertt, sizeof(*cl_strisvertt)*cl_maxstrisvert);
cl_strisvertc = BZ_Realloc(cl_strisvertc, sizeof(*cl_strisvertc)*cl_maxstrisvert);
}
cl_stris_ExpandVerts(cl_numstrisvert+64);
{
VectorSet(cl_strisvertv[cl_numstrisvert], mins[0], mins[1], w->maxheight);

View File

@ -5800,7 +5800,7 @@ void Shader_DefaultScript(const char *shortname, shader_t *s, const void *args)
if (*f == '{')
{
f++;
Shader_ReadShader(s, (void*)f, 0);
Shader_ReadShader(s, (void*)f, NULL);
}
}

View File

@ -1583,6 +1583,25 @@ static const char *glsl_hdrs[] =
"w = (vec4(v_position.xyz, 1.0) * wmat).xyz;"
"return m_modelviewprojection * (vec4(v_position.xyz, 1.0) * wmat);"
"}\n"
"vec4 skeletaltransform_wnst(out vec3 w)"
"{"
"mat4 wmat;"
"wmat[0] = m_bones_packed[0+3*int(v_bone.x)] * v_weight.x;"
"wmat[0] += m_bones_packed[0+3*int(v_bone.y)] * v_weight.y;"
"wmat[0] += m_bones_packed[0+3*int(v_bone.z)] * v_weight.z;"
"wmat[0] += m_bones_packed[0+3*int(v_bone.w)] * v_weight.w;"
"wmat[1] = m_bones_packed[1+3*int(v_bone.x)] * v_weight.x;"
"wmat[1] += m_bones_packed[1+3*int(v_bone.y)] * v_weight.y;"
"wmat[1] += m_bones_packed[1+3*int(v_bone.z)] * v_weight.z;"
"wmat[1] += m_bones_packed[1+3*int(v_bone.w)] * v_weight.w;"
"wmat[2] = m_bones_packed[2+3*int(v_bone.x)] * v_weight.x;"
"wmat[2] += m_bones_packed[2+3*int(v_bone.y)] * v_weight.y;"
"wmat[2] += m_bones_packed[2+3*int(v_bone.z)] * v_weight.z;"
"wmat[2] += m_bones_packed[2+3*int(v_bone.w)] * v_weight.w;"
"wmat[3] = vec4(0.0,0.0,0.0,1.0);"
"w = (vec4(v_position.xyz, 1.0) * wmat).xyz;"
"return m_modelviewprojection * (vec4(v_position.xyz, 1.0) * wmat);"
"}\n"
"vec4 skeletaltransform_n(out vec3 n)"
"{"
"mat4 wmat;"
@ -1637,6 +1656,16 @@ static const char *glsl_hdrs[] =
"w = vec4(v_position.xyz, 1.0) * wmat;"
"return m_modelviewprojection * vec4(w, 1.0);"
"}\n"
"vec4 skeletaltransform_w(out vec3 w)"
"{"
"mat3x4 wmat;"
"wmat = m_bones_mat3x4[int(v_bone.x)] * v_weight.x;"
"wmat += m_bones_mat3x4[int(v_bone.y)] * v_weight.y;"
"wmat += m_bones_mat3x4[int(v_bone.z)] * v_weight.z;"
"wmat += m_bones_mat3x4[int(v_bone.w)] * v_weight.w;"
"w = vec4(v_position.xyz, 1.0) * wmat;"
"return m_modelviewprojection * vec4(w, 1.0);"
"}\n"
"vec4 skeletaltransform_n(out vec3 n)"
"{"
"mat3x4 wmat;"
@ -1658,6 +1687,11 @@ static const char *glsl_hdrs[] =
"w = v_position.xyz;"
"return ftetransform();"
"}\n"
"vec4 skeletaltransform_w(out vec3 w)"
"{"
"w = v_position.xyz;"
"return ftetransform();"
"}\n"
"vec4 skeletaltransform_nst(out vec3 n, out vec3 t, out vec3 b)"
"{"
"n = v_normal;"
@ -3344,14 +3378,16 @@ qboolean GL_Init(rendererstate_t *info, void *(*getglfunction) (char *name))
sh_config.shadernamefmt = "%s_gles";
sh_config.can_mipcap = gl_config.glversion >= 3.0;
sh_config.can_mipbias = false;
sh_config.havecubemaps = gl_config.glversion >= 2.0;
}
else
{
sh_config.can_mipcap = gl_config.glversion >= 1.2;
sh_config.can_mipbias = gl_config.glversion >= 1.4;//||GL_CheckExtension("GL_EXT_texture_lod_bias");
sh_config.havecubemaps = gl_config.glversion >= 1.3||GL_CheckExtension("GL_ARB_texture_cube_map");; //cubemaps AND clamp-to-edge.
sh_config.havecubemaps = gl_config.glversion >= 1.3||GL_CheckExtension("GL_ARB_texture_cube_map"); //cubemaps AND clamp-to-edge.
if (gl_config.nofixedfunc)
{ //core contexts don't normally support glsl < 140 (such glsl versions have lots of compat syntax still, which will not function on core. drivers might accept it anyway, but yeah, lots of crap that shouldn't work)

View File

@ -257,7 +257,7 @@ extern gl_config_t gl_config;
extern float gldepthmin, gldepthmax;
void GL_UpdateFiltering(image_t *imagelist, int filtermip[3], int filterpic[3], int mipcap[2], float anis);
void GL_UpdateFiltering(image_t *imagelist, int filtermip[3], int filterpic[3], int mipcap[2], float lodbias, float anis);
qboolean GL_LoadTextureMips(texid_t tex, const struct pendingtextureinfo *mips);
void GL_DestroyTexture(texid_t tex);
void GL_SetupFormats(void);

View File

@ -893,6 +893,13 @@ typedef void (APIENTRY * PFNGLUNLOCKARRAYSEXTPROC) (void);
#define GL_TEXTURE_MAX_LEVEL 0x813d
#endif
#ifndef GL_TEXTURE_LOD_BIAS
#define GL_TEXTURE_LOD_BIAS 0x8501 //gl1.4
#endif
#ifndef GL_RGBA16
#define GL_RGBA16 0x805B //gl1.1, but not in gles.
#endif
#ifndef GL_RGBA16F
#define GL_RGBA16F 0x881A
#define GL_RGBA32F 0x8814

View File

@ -2958,6 +2958,10 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"!!cvardf r_tessellation_level=5\n"
"!!samps !EIGHTBIT diffuse normalmap specular fullbright upper lower reflectmask reflectcube\n"
"!!samps =EIGHTBIT paletted 1\n"
//!!permu VC -- adds rgba vertex colour multipliers
//!!permu SPECULAR -- auto-added when gl_specular>0
//!!permu OFFSETMAPPING -- auto-added when r_glsl_offsetmapping is set
//!!permu NONORMALS -- states that there's no normals available, which affects lighting.
"#include \"sys/defs.h\"\n"
@ -2972,7 +2976,12 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"#endif\n"
"#ifdef NONORMALS //lots of things need normals to work properly. make sure nothing breaks simply because they added an extra texture.\n"
"#undef BUMP\n"
"#undef SPECULAR\n"
"#undef OFFSETMAPPING\n"
"#undef REFLECTCUBEMASK\n"
"#endif\n"
@ -2996,9 +3005,22 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"void main ()\n"
"{\n"
"light.rgba = vec4(e_light_ambient, 1.0);\n"
"#ifdef NONORMALS\n"
"vec3 n, w;\n"
"gl_Position = skeletaltransform_w(w);\n"
"n = vec3(0.0);\n"
"#else\n"
"vec3 n, s, t, w;\n"
"gl_Position = skeletaltransform_wnst(w,n,s,t);\n"
"n = normalize(n);\n"
"float d = dot(n,e_light_dir);\n"
"if (d < 0.0) //vertex shader. this might get ugly, but I don't really want to make it per vertex.\n"
"d = 0.0; //this avoids the dark side going below the ambient level.\n"
"light.rgb += (d*e_light_mul);\n"
"#endif\n"
"#if defined(SPECULAR)||defined(OFFSETMAPPING) || defined(REFLECTCUBEMASK)\n"
"vec3 eyeminusvertex = e_eyepos - w.xyz;\n"
"eyevector.x = dot(eyeminusvertex, s.xyz);\n"
@ -3013,11 +3035,6 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"tc = v_texcoord;\n"
"float d = dot(n,e_light_dir);\n"
"if (d < 0.0) //vertex shader. this might get ugly, but I don't really want to make it per vertex.\n"
"d = 0.0; //this avoids the dark side going below the ambient level.\n"
"light.rgb = e_light_ambient + (d*e_light_mul);\n"
"light.a = 1.0;\n"
"#ifdef VC\n"
"light *= v_colour;\n"
"#endif\n"

View File

@ -737,20 +737,21 @@ void Shader_ReleaseGeneric(program_t *prog);
image_t *Mod_CubemapForOrigin(model_t *wmodel, vec3_t org);
mfog_t *Mod_FogForOrigin(model_t *wmodel, vec3_t org);
#define BEF_FORCEDEPTHWRITE 1
#define BEF_FORCEDEPTHTEST 2
#define BEF_FORCEADDITIVE 4 //blend dest = GL_ONE
#define BEF_FORCETRANSPARENT 8 //texenv replace -> modulate
#define BEF_FORCENODEPTH 16 //disables any and all depth.
#define BEF_FORCEDEPTHWRITE (1u<<0)
#define BEF_FORCEDEPTHTEST (1u<<1)
#define BEF_FORCEADDITIVE (1u<<2) //blend dest = GL_ONE
#define BEF_FORCETRANSPARENT (1u<<3) //texenv replace -> modulate
#define BEF_FORCENODEPTH (1u<<4) //disables any and all depth.
#ifndef NOLEGACY
#define BEF_PUSHDEPTH 32 //additional polygon offset
#define BEF_PUSHDEPTH (1u<<5) //additional polygon offset
#endif
//FIXME: the above should really be legacy-only
#define BEF_NODLIGHT 64 //don't use a dlight pass
#define BEF_NOSHADOWS 128 //don't appear in shadows
#define BEF_FORCECOLOURMOD 256 //q3 shaders default to 'rgbgen identity', and ignore ent colours. this forces ent colours to be considered
#define BEF_LINES 512 //draw line pairs instead of triangles.
#define BEF_FORCETWOSIDED 1024 //more evilness.
#define BEF_NODLIGHT (1u<<6) //don't use a dlight pass
#define BEF_NOSHADOWS (1u<<7) //don't appear in shadows
#define BEF_FORCECOLOURMOD (1u<<8) //q3 shaders default to 'rgbgen identity', and ignore ent colours. this forces ent colours to be considered
#define BEF_LINES (1u<<9) //draw line pairs instead of triangles.
#define BEF_FORCETWOSIDED (1u<<10) //more evilness.s
//#define BEFF_POLYHASNORMALS (1u<<31) //false flag - for cl_scenetries and not actually used by the backend.
typedef struct
{
@ -793,7 +794,8 @@ typedef struct
qboolean tex_env_combine;
qboolean nv_tex_env_combine4;
qboolean env_add;
qboolean can_mipcap; //
qboolean can_mipcap; //gl1.2+
qboolean can_mipbias; //gl1.4+
qboolean havecubemaps; //since gl1.3, so pretty much everyone will have this... should probably only be set if we also have seamless or clamp-to-edge.
void (*pDeleteProg) (program_t *prog);

View File

@ -4873,7 +4873,7 @@ static void QCC_VerifyArgs_setviewprop (const char *funcname, QCC_ref_t **arglis
{"VF_CL_VIEWANGLES_X", 36, ev_float},
{"VF_PERSPECTIVE", 200, ev_float},
//201
{"VF_ACTIVESEAT", 202, ev_float},
{"VF_ACTIVESEAT", 202, ev_float, ev_float},
{"VF_AFOV", 203, ev_float},
// {"VF_SCREENVSIZE", 204, ev_vector},
// {"VF_SCREENPSIZE", 205, ev_vector},

View File

@ -5,8 +5,6 @@
variables/watch list.
calltips for argument info
autocompletion calltips, for people who can't remember function names
ctrl+f/f3 stuff
options window
initial open project prompt
shpuld's styling
decompiler output saving
@ -894,6 +892,8 @@ public:
document_s *FindFile(const char *filename)
{
if (!filename)
return curdoc;
for (int i = 0; i < numdocuments; i++)
{
if (!strcasecmp(filename, docs[i]->fname))
@ -1106,7 +1106,17 @@ public:
DebuggerSendCommand("qcjump \"%s\" %i\n", curdoc->fname, curdoc->cursorline);
}
void EditFile(const char *filename, int linenum=-1, bool setcontrol=false);
void EditFile(document_s *doc, const char *filename, int linenum=-1, bool setcontrol=false);
void EditFile(const char *filename, int linenum=-1, bool setcontrol=false)
{
EditFile(NULL, filename, linenum, setcontrol);
}
void EditFile(QModelIndex idx, int linenum=-1, bool setcontrol=false)
{
auto d = getItem(idx);
if (d)
EditFile(d, d->fname, linenum, setcontrol);
}
};
template<class T>
@ -1161,7 +1171,7 @@ class optionswindow : public QDialog
}
else if (lev == 5)
w->setCheckState((optimisations[id].flags&FLAG_ASDEFAULT)?Qt::Checked:Qt::Unchecked);
w->setEnabled(fl_nondfltopts);
w->setEnabled(fl_nondfltopts); //FIXME: should use tristate on a per-setting basis
}
}
@ -1283,15 +1293,36 @@ public:
private:
void CreateMenus(void)
{
auto fileMenu = menuBar()->addMenu(tr("&File"));
//editor UI things
auto fileopen = new QAction(tr("Open"), this);
fileMenu->addAction(fileopen);
fileopen->setShortcuts(QKeySequence::listFromString("Ctrl+O"));
connect(fileopen, &QAction::triggered, [=]()
{
GUIprintf("Ctrl+O hit\n");
});
auto filesave = new QAction(tr("Save"), this);
fileMenu->addAction(filesave);
filesave->setShortcuts(QKeySequence::listFromString("Ctrl+S"));
connect(filesave, &QAction::triggered, [=]()
{
if (!docs.saveDocument(NULL))
QMessageBox::critical(nullptr, "Error", QString::asprintf("Unable to save"));
});
auto prefs = new QAction(tr("&Preferences"), this);
fileMenu->addAction(prefs);
prefs->setShortcuts(QKeySequence::Preferences);
prefs->setStatusTip(tr("Reconfigure stuff"));
connect(prefs, &QAction::triggered, [](){(new optionswindow())->show();});
auto grep = new QAction(tr("&Grep"), this);
grep->setShortcuts(QKeySequence::listFromString("Ctrl+G"));
grep->setStatusTip(tr("Search through all project files"));
connect(grep, &QAction::triggered, [=]()
auto goline = new QAction(tr("Go to line"), this);
fileMenu->addAction(goline);
goline->setShortcuts(QKeySequence::listFromString("Ctrl+G"));
goline->setStatusTip(tr("Jump to line"));
connect(goline, &QAction::triggered, [=]()
{
struct grepargs_s
{
@ -1303,7 +1334,86 @@ private:
auto l = new QVBoxLayout;
l->addWidget(args.t);
args.d->setLayout(l);
args.d->setWindowTitle("FTEQCC Grep");
args.d->setWindowTitle("FTEQCC Go To Line");
args.t->installEventFilter(new keyEnterReceiver<grepargs_s>([](grepargs_s &ctx)
{
ctx.mw->docs.EditFile(NULL, atoi(ctx.t->text().toUtf8().data()));
ctx.d->done(0);
}, args));
args.d->show();
});
auto godef = new QAction(tr("Go To Definition"), this);
fileMenu->addAction(godef);
godef->setShortcuts(QKeySequence::listFromString("F12"));
connect(godef, &QAction::triggered, [=]()
{
struct grepargs_s
{
guimainwindow *mw;
QDialog *d;
QLineEdit *t;
} args = {this, new QDialog()};
args.t = new QLineEdit(this->s.selectedText());
auto l = new QVBoxLayout;
l->addWidget(args.t);
args.d->setLayout(l);
args.d->setWindowTitle("Go To Definition");
args.t->installEventFilter(new keyEnterReceiver<grepargs_s>([](grepargs_s &ctx)
{
GoToDefinition(ctx.t->text().toUtf8().data());
ctx.d->done(0);
}, args));
args.d->show();
});
auto find = new QAction(tr("Find"), this);
fileMenu->addAction(find);
find->setShortcuts(QKeySequence::listFromString("Ctrl+F"));
find->setStatusTip(tr("Search through all project files"));
connect(find, &QAction::triggered, [=]()
{
struct grepargs_s
{
guimainwindow *mw;
QDialog *d;
QLineEdit *t;
} args = {this, new QDialog()};
args.t = new QLineEdit(this->s.selectedText());
auto l = new QVBoxLayout;
l->addWidget(args.t);
args.d->setLayout(l);
args.d->setWindowTitle("FTEQCC Find");
args.t->installEventFilter(new keyEnterReceiver<grepargs_s>([](grepargs_s &ctx)
{
ctx.mw->s.findFirst(ctx.t->text(), false, false, false, true);
ctx.d->done(0);
}, args));
args.d->show();
});
connect(new QShortcut(QKeySequence(tr("F3", "File|FindNext")), this), &QShortcut::activated,
[=]()
{
s.findNext();
});
auto grep = new QAction(tr("Grep"), this);
fileMenu->addAction(grep);
grep->setShortcuts(QKeySequence::listFromString("Ctrl+Shift+G"));
grep->setStatusTip(tr("Search through all project files"));
connect(grep, &QAction::triggered, [=]()
{
struct grepargs_s
{
guimainwindow *mw;
QDialog *d;
QLineEdit *t;
} args = {this, new QDialog()};
args.t = new QLineEdit(this->s.selectedText());
auto l = new QVBoxLayout;
l->addWidget(args.t);
args.d->setLayout(l);
args.d->setWindowTitle("FTEQCC Grep Project Files");
args.t->installEventFilter(new keyEnterReceiver<grepargs_s>([](grepargs_s &ctx)
{
ctx.mw->files.GrepAll(ctx.t->text().toUtf8().data());
@ -1312,9 +1422,86 @@ private:
args.d->show();
});
auto fileMenu = menuBar()->addMenu(tr("&File"));
fileMenu->addAction(prefs);
fileMenu->addAction(grep);
//convert to utf-8 chars
//convert to Quake chars
auto convertunix = new QAction(tr("Convert to Unix Endings"), this);
fileMenu->addAction(convertunix);
connect(convertunix, &QAction::triggered, [=]()
{
s.convertEols(QsciScintilla::EolUnix);
s.setEolVisibility(false);
});
auto convertdos = new QAction(tr("Convert to DOS Endings"), this);
fileMenu->addAction(convertdos);
connect(convertdos, &QAction::triggered, [=]()
{
s.convertEols(QsciScintilla::EolWindows);
s.setEolVisibility(false);
});
auto quit = new QAction(tr("Quit"), this);
fileMenu->addAction(quit);
connect(quit, &QAction::triggered, [=]()
{
this->close();
});
auto debugMenu = menuBar()->addMenu(tr("&Debug"));
auto debugrebuild = new QAction(tr("Rebuild"), this);
debugMenu->addAction(debugrebuild);
debugrebuild->setShortcuts(QKeySequence::listFromString("F7"));
connect(debugrebuild, &QAction::triggered, [=]()
{
RunCompiler("", false);
});
auto debugsetnext = new QAction(tr("Set Next Statement"), this);
debugMenu->addAction(debugsetnext);
debugsetnext->setShortcuts(QKeySequence::listFromString("F8"));
connect(debugsetnext, &QAction::triggered, [=]()
{
//FIXME
});
auto debugresume = new QAction(tr("Resume"), this);
debugMenu->addAction(debugresume);
debugresume->setShortcuts(QKeySequence::listFromString("F5"));
connect(debugresume, &QAction::triggered, [=]()
{
if (!DebuggerSendCommand("qcresume\n"))
DebuggerStart(); //unable to send? assume its not running.
});
auto debugover = new QAction(tr("Step Over"), this);
debugMenu->addAction(debugover);
debugover->setShortcuts(QKeySequence::listFromString("F10"));
connect(debugover, &QAction::triggered, [=]()
{
if (!DebuggerSendCommand("qcstep over\n"))
DebuggerStart();
});
auto debuginto = new QAction(tr("Step Into"), this);
debugMenu->addAction(debuginto);
debuginto->setShortcuts(QKeySequence::listFromString("F11"));
connect(debuginto, &QAction::triggered, [=]()
{
if (!DebuggerSendCommand("qcstep into\n"))
DebuggerStart();
});
auto debugout = new QAction(tr("Step Out"), this);
debugMenu->addAction(debugout);
debugout->setShortcuts(QKeySequence::listFromString("Shift+F11"));
connect(debugout, &QAction::triggered, [=]()
{
if (!DebuggerSendCommand("qcstep out\n"))
DebuggerStart();
});
auto debugbreak = new QAction(tr("Toggle Breakpoint"), this);
debugMenu->addAction(debugbreak);
debugbreak->setShortcuts(QKeySequence::listFromString("F9"));
connect(debugbreak, &QAction::triggered, [=]()
{
docs.toggleBreak();
});
}
public:
@ -1355,6 +1542,12 @@ public:
log.setReadOnly(true);
log.clear();
connect(&docs_w, &QAbstractItemView::clicked,
[=](const QModelIndex &index)
{
docs.EditFile(index);
});
connect(&log, &QTextEdit::selectionChanged,
[=]()
{
@ -1375,56 +1568,6 @@ public:
}
});
//editor UI things
connect(new QShortcut(QKeySequence(tr("Ctrl+O", "File|Open")), this), &QShortcut::activated,
[=]()
{
GUIprintf("Ctrl+O hit\n");
});
connect(new QShortcut(QKeySequence(tr("Ctrl+S", "File|Save")), this), &QShortcut::activated,
[=]()
{
GUIprintf("Ctrl+S hit\n");
});
//compiler things
connect(new QShortcut(QKeySequence(tr("F7", "File|Compile")), this), &QShortcut::activated,
[=]()
{
RunCompiler("", false);
});
//debug things.
connect(new QShortcut(QKeySequence(tr("F5", "File|Debug")), this), &QShortcut::activated,
[=]()
{
if (!DebuggerSendCommand("qcresume\n"))
DebuggerStart(); //unable to send? assume its not running.
});
connect(new QShortcut(QKeySequence(tr("F10", "File|DebugOver")), this), &QShortcut::activated,
[=]()
{
if (!DebuggerSendCommand("qcstep over\n"))
DebuggerStart();
});
connect(new QShortcut(QKeySequence(tr("F11", "File|DebugInto")), this), &QShortcut::activated,
[=]()
{
if (!DebuggerSendCommand("qcstep into\n"))
DebuggerStart();
});
connect(new QShortcut(QKeySequence(tr("Shift+F1", "File|DebugOut")), this), &QShortcut::activated,
[=]()
{
if (!DebuggerSendCommand("qcstep out\n"))
DebuggerStart();
});
connect(new QShortcut(QKeySequence(tr("F9", "File|DebugToggle")), this), &QShortcut::activated,
[=]()
{
docs.toggleBreak();
});
CreateMenus();
}
} *mainwnd;
@ -1725,7 +1868,7 @@ void documentlist::UpdateTitle(void)
else
mainwnd->setWindowTitle("FTEQCC");
}
void documentlist::EditFile(const char *filename, int linenum, bool setcontrol)
void documentlist::EditFile(document_s *c, const char *filename, int linenum, bool setcontrol)
{
if (setcontrol)
{
@ -1737,7 +1880,8 @@ void documentlist::EditFile(const char *filename, int linenum, bool setcontrol)
}
}
auto c = FindFile(filename);
if (!c)
c = FindFile(filename);
if (!c)
{
c = new document_s();
@ -1849,10 +1993,19 @@ static bool DebuggerSendCommand(const char *msg, ...)
static void DebuggerStart(void)
{
DebuggerStop();
const char *engine = enginebinary;
const char *cmdline = enginecommandline;
if (!*enginebinary)
{
engine = "fteqw";
if(!*cmdline)
cmdline = "-window";
}
qcdebugger = new QProcess(mainwnd);
qcdebugger->setProgram(enginebinary);
qcdebugger->setProgram(engine);
qcdebugger->setWorkingDirectory(enginebasedir);
qcdebugger->setArguments(QStringList(enginecommandline));
qcdebugger->setArguments(QStringList(cmdline));
QObject::connect(qcdebugger, static_cast<void(QProcess::*)(int)>(&QProcess::finished),
[=](int exitcode)

View File

@ -13190,7 +13190,7 @@ void PR_DumpPlatform_f(void)
"accessor infostring : string\n{\n"
"\tget string[string] = infoget;\n"
#ifdef QCGC
"\tinline seti& string[string fld] = {this = infoadd(this, fld, value);};\n"
"\tinline set& string[string fld] = {this = infoadd(this, fld, value);};\n"
#endif
"};\n");
VFS_PRINTF(f,

View File

@ -340,8 +340,11 @@ void SV_EmitCSQCUpdate(client_t *client, sizebuf_t *msg, qbyte svcnumber)
if (lognum > maxlog)
{
if (maxlog == client->max_net_ents)
break;
SV_ExpandNackFrames(client, lognum+1, &frame);
break;
resend = frame->resend;
maxlog = frame->maxresend;
}
resend[lognum].entnum = entnum;
resend[lognum].bits = 0;
@ -393,8 +396,11 @@ void SV_EmitCSQCUpdate(client_t *client, sizebuf_t *msg, qbyte svcnumber)
if (lognum > maxlog)
{
if (maxlog == client->max_net_ents)
break;
SV_ExpandNackFrames(client, lognum+1, &frame);
break;
resend = frame->resend;
maxlog = frame->maxresend;
}
resend[lognum].entnum = entnum;
resend[lognum].bits = 0;
@ -427,8 +433,11 @@ void SV_EmitCSQCUpdate(client_t *client, sizebuf_t *msg, qbyte svcnumber)
if (lognum > maxlog)
{
if (maxlog == client->max_net_ents)
break;
SV_ExpandNackFrames(client, lognum+1, &frame);
break;
resend = frame->resend;
maxlog = frame->maxresend;
}
resend[lognum].entnum = entnum;
resend[lognum].bits = 0;
@ -463,8 +472,11 @@ void SV_EmitCSQCUpdate(client_t *client, sizebuf_t *msg, qbyte svcnumber)
if (lognum > maxlog)
{
if (maxlog == client->max_net_ents)
break;
SV_ExpandNackFrames(client, lognum+1, &frame);
break;
resend = frame->resend;
maxlog = frame->maxresend;
}
resend[lognum].entnum = entnum;
resend[lognum].bits = 0;
@ -1516,8 +1528,11 @@ qboolean SVFTE_EmitPacketEntities(client_t *client, packet_entities_t *to, sizeb
}
if (outno >= outmax)
{ //expand the frames. may need some copying...
if (outmax == client->max_net_ents)
break;
SV_ExpandNackFrames(client, outno+1, &frame);
break;
resend = frame->resend;
outmax = frame->maxresend;
}
if (bits & UF_REMOVE)
@ -1989,8 +2004,11 @@ void SVDP_EmitEntitiesUpdate (client_t *client, client_frame_t *frame, packet_en
break; /*give up if it gets full. FIXME: bone data is HUGE.*/
if (outno >= outmax)
{ //expand the frames. may need some copying...
if (outmax == client->max_net_ents)
break;
SV_ExpandNackFrames(client, outno+1, &frame);
break;
resend = frame->resend;
outmax = frame->maxresend;
}
if (bits & E5_SERVERREMOVE)

View File

@ -55,7 +55,7 @@ cvar_t sv_friction = CVAR( "sv_friction", "4");
cvar_t sv_waterfriction = CVAR( "sv_waterfriction", "4");
cvar_t sv_wallfriction = CVARD( "sv_wallfriction", "1", "Additional friction when running into walls");
cvar_t sv_gameplayfix_noairborncorpse = CVAR( "sv_gameplayfix_noairborncorpse", "0");
cvar_t sv_gameplayfix_multiplethinks = CVARD( "sv_gameplayfix_multiplethinks", "1", "Enables multiple thinks per entity per frame so small nextthink times are accurate. QuakeWorld mods expect a value of 1.");
cvar_t sv_gameplayfix_multiplethinks = CVARD( "sv_gameplayfix_multiplethinks", "1", "Enables multiple thinks per entity per frame so small nextthink times are accurate. QuakeWorld mods expect a value of 1, while NQ expects 0.");
cvar_t sv_gameplayfix_stepdown = CVARD( "sv_gameplayfix_stepdown", "0", "Attempt to step down steps, instead of only up them. Affects non-predicted movetype_walk.");
cvar_t sv_gameplayfix_bouncedownslopes = CVARD( "sv_gameplayfix_grenadebouncedownslopes", "0", "MOVETYPE_BOUNCE speeds are calculated relative to the impacted surface, instead of the vertical, reducing the chance of grenades just sitting there on slopes.");
#if !defined(CLIENTONLY) && defined(NQPROT) && !defined(NOLEGACY)

View File

@ -345,7 +345,10 @@ static void World_ClearWorld_AreaGrid (world_t *w, qboolean relink)
size[i] /= w->gridsize[i];
//enforce a minimum grid size, so things don't end up getting added to every single node
if (size[i] < 128)
{
mins[i] -= (128-size[i])/2 * w->gridsize[i];
size[i] = 128;
}
w->gridscale[i] = size[i];
w->gridbias[i] = -mins[i];
@ -654,8 +657,9 @@ void QDECL World_LinkEdict (world_t *w, wedict_t *ent, qboolean touch_triggers)
int ming[2], maxg[2], g[2], ga;
CALCAREAGRIDBOUNDS(w, ent->v->absmin, ent->v->absmax);
if ((maxg[0]-ming[0])*(maxg[1]-ming[1]) > countof(ent->gridareas))
{ //entity is too large to fit in our grid. shove it in the overflow
if ((maxg[0]-ming[0])*(maxg[1]-ming[1]) > countof(ent->gridareas) //entity is too large to fit in our grid.
|| ming[0]<0||ming[1]<0||maxg[0]>=w->gridsize[0]||maxg[1]>=w->gridsize[1]) //entity crosses the boundary of the world.
{ //shove it in the overflow
ent->gridareas[0].ed = ent;
InsertLinkBefore (&ent->gridareas[0].l, &w->jumboarea.l);
}
@ -2239,7 +2243,7 @@ static void World_ClipToNetwork (world_t *w, moveclip_t *clip)
trace_t trace;
static framestate_t framestate; //meh
if (clip->type & MOVE_ENTCHAIN)
if ((clip->type & MOVE_ENTCHAIN) || !pe)
return;
for (i = 0; i < pe->num_entities; i++)

View File

@ -13,6 +13,10 @@
!!cvardf r_tessellation_level=5
!!samps !EIGHTBIT diffuse normalmap specular fullbright upper lower reflectmask reflectcube
!!samps =EIGHTBIT paletted 1
//!!permu VC -- adds rgba vertex colour multipliers
//!!permu SPECULAR -- auto-added when gl_specular>0
//!!permu OFFSETMAPPING -- auto-added when r_glsl_offsetmapping is set
//!!permu NONORMALS -- states that there's no normals available, which affects lighting.
#include "sys/defs.h"
@ -27,7 +31,12 @@
#endif
#ifdef NONORMALS //lots of things need normals to work properly. make sure nothing breaks simply because they added an extra texture.
#undef BUMP
#undef SPECULAR
#undef OFFSETMAPPING
#undef REFLECTCUBEMASK
#endif
@ -51,9 +60,22 @@ varying vec3 normal;
void main ()
{
light.rgba = vec4(e_light_ambient, 1.0);
#ifdef NONORMALS
vec3 n, w;
gl_Position = skeletaltransform_w(w);
n = vec3(0.0);
#else
vec3 n, s, t, w;
gl_Position = skeletaltransform_wnst(w,n,s,t);
n = normalize(n);
float d = dot(n,e_light_dir);
if (d < 0.0) //vertex shader. this might get ugly, but I don't really want to make it per vertex.
d = 0.0; //this avoids the dark side going below the ambient level.
light.rgb += (d*e_light_mul);
#endif
#if defined(SPECULAR)||defined(OFFSETMAPPING) || defined(REFLECTCUBEMASK)
vec3 eyeminusvertex = e_eyepos - w.xyz;
eyevector.x = dot(eyeminusvertex, s.xyz);
@ -68,11 +90,6 @@ void main ()
tc = v_texcoord;
float d = dot(n,e_light_dir);
if (d < 0.0) //vertex shader. this might get ugly, but I don't really want to make it per vertex.
d = 0.0; //this avoids the dark side going below the ambient level.
light.rgb = e_light_ambient + (d*e_light_mul);
light.a = 1.0;
#ifdef VC
light *= v_colour;
#endif

View File

@ -1100,7 +1100,7 @@ void VK_CreateSampler(unsigned int flags, vk_image_t *img)
lmsampinfo.addressModeU = clamptoedge?VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE:VK_SAMPLER_ADDRESS_MODE_REPEAT;
lmsampinfo.addressModeV = clamptoedge?VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE:VK_SAMPLER_ADDRESS_MODE_REPEAT;
lmsampinfo.addressModeW = clamptoedge?VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE:VK_SAMPLER_ADDRESS_MODE_REPEAT;
lmsampinfo.mipLodBias = 0.0;
lmsampinfo.mipLodBias = vk.lodbias;
lmsampinfo.anisotropyEnable = (flags & IF_NEAREST)?false:(vk.max_anistophy > 1);
lmsampinfo.maxAnisotropy = vk.max_anistophy;
lmsampinfo.compareEnable = VK_FALSE;
@ -1117,7 +1117,7 @@ static void VK_DestroySampler(void *w)
VkSampler s = *(VkSampler*)w;
vkDestroySampler(vk.device, s, vkallocationcb);
}
void VK_UpdateFiltering(image_t *imagelist, int filtermip[3], int filterpic[3], int mipcap[2], float anis)
void VK_UpdateFiltering(image_t *imagelist, int filtermip[3], int filterpic[3], int mipcap[2], float lodbias, float anis)
{
uint32_t i;
for (i = 0; i < countof(vk.filtermip); i++)
@ -1126,6 +1126,7 @@ void VK_UpdateFiltering(image_t *imagelist, int filtermip[3], int filterpic[3],
vk.filterpic[i] = filterpic[i];
for (i = 0; i < countof(vk.mipcap); i++)
vk.mipcap[i] = mipcap[i];
vk.lodbias = lodbias;
vk.max_anistophy = bound(1.0, anis, vk.max_anistophy_limit);
while(imagelist)

View File

@ -314,6 +314,7 @@ extern struct vulkaninfo_s
int filtermip[3];
int filterpic[3];
int mipcap[2];
float lodbias;
float max_anistophy;
float max_anistophy_limit;
@ -510,7 +511,7 @@ void *VK_AtFrameEnd(void (*passed)(void *work), void *data, size_t worksize);
void VK_Draw_Init(void);
void VK_Draw_Shutdown(void);
void VK_UpdateFiltering (image_t *imagelist, int filtermip[3], int filterpic[3], int mipcap[2], float anis);
void VK_UpdateFiltering (image_t *imagelist, int filtermip[3], int filterpic[3], int mipcap[2], float lodbias, float anis);
qboolean VK_LoadTextureMips (texid_t tex, const struct pendingtextureinfo *mips);
void VK_DestroyTexture (texid_t tex);
void VK_DestroyVkTexture (vk_image_t *img);

View File

@ -5,6 +5,8 @@
//#pragma flag enable typeexplicit
#define CSQC
#define _ACCESSORS
#pragma target FTE
csplat.qc
csfixups.qc

File diff suppressed because it is too large Load Diff

View File

@ -268,14 +268,11 @@ void(entedit_t *nent) editor_ents_updated =
if (nent->isbsp)
nent->ang = '0 0 0'; //bsp entities should not be displayed rotated, because that just messes everything up.
nent->bboxverts[0].xyz = (vec3)((__variant)nent->org);
nent->bboxverts[0].st = (vec2){0,0};
nent->bboxverts[0].rgba = (vec4){nent->colourmod[0], nent->colourmod[1], nent->colourmod[2], nent->alpha?nent->alpha:1};
nent->bboxverts[7] = nent->bboxverts[6] = nent->bboxverts[5] = nent->bboxverts[4] = nent->bboxverts[3] = nent->bboxverts[2] = nent->bboxverts[1] = nent->bboxverts[0];
for (i = 0; i < 8; i++)
{
nent->bboxverts[i].st = (vec2){0,0};
nent->bboxverts[i].rgba = (vec4){nent->colourmod[0], nent->colourmod[1], nent->colourmod[2], nent->alpha?nent->alpha:1};
nent->bboxverts[i].xyz[0] = nent->org[0] + ((i&1i)?nent->maxs[0]:nent->mins[0]);
nent->bboxverts[i].xyz[1] = nent->org[1] + (((i&2i)?nent->maxs[1]:nent->mins[1]));
nent->bboxverts[i].xyz[2] = nent->org[2] + ((i&4)?nent->maxs[2]:nent->mins[2]);

View File

@ -90,7 +90,7 @@ static string(int fld, float foredit) readfield =
ret = strcat(ret, (fl & LFLAG_NOSHADOWS)?"c":"");
ret = strcat(ret, (fl & LFLAG_SHADOWMAP)?"s":"");
ret = strcat(ret, (fl & LFLAG_CREPUSCULAR)?"r":"");
ret = strcat(ret, (fl & LFLAG_ORTHO)?"o":"");
ret = strcat(ret, (fl & LFLAG_ORTHOSUN)?"o":"");
return ret;
case 6:
return ftos(dynamiclight_get(selectedlight, LFIELD_STYLE));
@ -142,7 +142,7 @@ static void(float fld, string newval) writefield =
if (strstrofs(newval, "c")>=0) fl |= LFLAG_NOSHADOWS;
if (strstrofs(newval, "s")>=0) fl |= LFLAG_SHADOWMAP;
if (strstrofs(newval, "r")>=0) fl |= LFLAG_CREPUSCULAR;
if (strstrofs(newval, "o")>=0) fl |= LFLAG_ORTHO;
if (strstrofs(newval, "o")>=0) fl |= LFLAG_ORTHOSUN;
dynamiclight_set(selectedlight, LFIELD_FLAGS, (float)fl);
return;
case 6:

View File

@ -449,7 +449,7 @@ void(vector mousepos) editor_terrain_addentities =
float a;
if (curtool == ter_tex_paint || curtool == ter_tex_paint_single || curtool == ter_tex)
terrain_edit(22, tex[painttex]);
terrain_edit(TEREDIT_TEX_SETMASK, tex[painttex]);
if (mousepos_x < 128)
return;
@ -515,7 +515,7 @@ void(vector mousepos) editor_terrain_overlay =
vector colour;
// if (curtool == ter_tex_paint || curtool == ter_tex_paint_single || curtool == ter_tex)
terrain_edit(22, 0);
terrain_edit(TEREDIT_TEX_SETMASK, 0);
float ctime = gettime(5);
if (mautorepeattime)