added VF_USERDATA to set new w_user glsl uniform.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5178 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
f715f38b08
commit
f21322d251
8 changed files with 50 additions and 12 deletions
|
@ -2232,6 +2232,26 @@ void QCBUILTIN PF_R_SetViewFlag(pubprogfuncs_t *prinst, struct globalvars_s *pr_
|
||||||
BE_RenderToTextureUpdate2d(false);
|
BE_RenderToTextureUpdate2d(false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case VF_USERDATA:
|
||||||
|
{
|
||||||
|
int qcptr = G_INT(OFS_PARM1);
|
||||||
|
int size = G_INT(OFS_PARM2);
|
||||||
|
void *ptr;
|
||||||
|
|
||||||
|
if (size > sizeof(r_refdef.userdata))
|
||||||
|
size = sizeof(r_refdef.userdata);
|
||||||
|
|
||||||
|
//validates the pointer.
|
||||||
|
if (qcptr < 0 || qcptr+size >= prinst->stringtablesize || size < 0)
|
||||||
|
{
|
||||||
|
PR_BIError(prinst, "PF_R_SetViewFlag: invalid pointer\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ptr = (struct reverbproperties_s*)(prinst->stringtable + qcptr);
|
||||||
|
memcpy(r_refdef.userdata, ptr, size);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Con_DPrintf("SetViewFlag: %i not recognised\n", parametertype);
|
Con_DPrintf("SetViewFlag: %i not recognised\n", parametertype);
|
||||||
G_FLOAT(OFS_RETURN) = 0;
|
G_FLOAT(OFS_RETURN) = 0;
|
||||||
|
|
|
@ -301,6 +301,8 @@ typedef struct
|
||||||
qbyte *forcedvis; /*set if forcevis is set*/
|
qbyte *forcedvis; /*set if forcevis is set*/
|
||||||
qboolean areabitsknown;
|
qboolean areabitsknown;
|
||||||
qbyte areabits[MAX_MAP_AREA_BYTES];
|
qbyte areabits[MAX_MAP_AREA_BYTES];
|
||||||
|
|
||||||
|
vec4_t userdata[16]; /*for custom glsl*/
|
||||||
} refdef_t;
|
} refdef_t;
|
||||||
|
|
||||||
extern refdef_t r_refdef;
|
extern refdef_t r_refdef;
|
||||||
|
|
|
@ -691,6 +691,7 @@ typedef enum
|
||||||
VF_RT_DESTCOLOUR6 = 218,
|
VF_RT_DESTCOLOUR6 = 218,
|
||||||
VF_RT_DESTCOLOUR7 = 219,
|
VF_RT_DESTCOLOUR7 = 219,
|
||||||
VF_ENVMAP = 220, //cubemap image for reflectcube
|
VF_ENVMAP = 220, //cubemap image for reflectcube
|
||||||
|
VF_USERDATA = 221,
|
||||||
} viewflags;
|
} viewflags;
|
||||||
|
|
||||||
/*FIXME: this should be changed*/
|
/*FIXME: this should be changed*/
|
||||||
|
|
|
@ -3465,6 +3465,9 @@ static void BE_Program_Set_Attributes(const program_t *prog, unsigned int perm,
|
||||||
case SP_W_FOG:
|
case SP_W_FOG:
|
||||||
qglUniform4fvARB(ph, 2, r_refdef.globalfog.colour); //and density
|
qglUniform4fvARB(ph, 2, r_refdef.globalfog.colour); //and density
|
||||||
break;
|
break;
|
||||||
|
case SP_W_USER:
|
||||||
|
qglUniform4fvARB(ph, countof(r_refdef.userdata), r_refdef.userdata); //and density
|
||||||
|
break;
|
||||||
case SP_V_EYEPOS:
|
case SP_V_EYEPOS:
|
||||||
qglUniform3fvARB(ph, 1, r_origin);
|
qglUniform3fvARB(ph, 1, r_origin);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1945,6 +1945,7 @@ struct shader_field_names_s shader_unif_names[] =
|
||||||
/*viewer properties*/
|
/*viewer properties*/
|
||||||
{"v_eyepos", SP_V_EYEPOS},
|
{"v_eyepos", SP_V_EYEPOS},
|
||||||
{"w_fog", SP_W_FOG},
|
{"w_fog", SP_W_FOG},
|
||||||
|
{"w_user", SP_W_USER},
|
||||||
|
|
||||||
/*ent properties*/
|
/*ent properties*/
|
||||||
{"e_vblend", SP_E_VBLEND},
|
{"e_vblend", SP_E_VBLEND},
|
||||||
|
|
|
@ -1380,6 +1380,7 @@ static const char *glsl_hdrs[] =
|
||||||
"#define w_fogalpha w_fog[0].a\n"
|
"#define w_fogalpha w_fog[0].a\n"
|
||||||
"#define w_fogdensity w_fog[1].x\n"
|
"#define w_fogdensity w_fog[1].x\n"
|
||||||
"#define w_fogdepthbias w_fog[1].y\n"
|
"#define w_fogdepthbias w_fog[1].y\n"
|
||||||
|
"uniform vec4 w_user[16];\n"
|
||||||
|
|
||||||
/*ent properties*/
|
/*ent properties*/
|
||||||
//"uniform vec2 e_vblend;\n"
|
//"uniform vec2 e_vblend;\n"
|
||||||
|
|
|
@ -428,6 +428,7 @@ typedef struct {
|
||||||
SP_E_EYEPOS, /*viewer's eyepos, in model space*/
|
SP_E_EYEPOS, /*viewer's eyepos, in model space*/
|
||||||
SP_V_EYEPOS, /*viewer's eyepos, in world space*/
|
SP_V_EYEPOS, /*viewer's eyepos, in world space*/
|
||||||
SP_W_FOG,
|
SP_W_FOG,
|
||||||
|
SP_W_USER, //user-specified blob of data.
|
||||||
|
|
||||||
SP_M_ENTBONES,
|
SP_M_ENTBONES,
|
||||||
SP_M_VIEW,
|
SP_M_VIEW,
|
||||||
|
|
|
@ -262,22 +262,29 @@ pbool PDECL ED_CanFree (edict_t *ed)
|
||||||
ed->v->frame = 0;
|
ed->v->frame = 0;
|
||||||
VectorClear (ed->v->origin);
|
VectorClear (ed->v->origin);
|
||||||
VectorClear (ed->v->angles);
|
VectorClear (ed->v->angles);
|
||||||
ed->v->nextthink = 0;
|
|
||||||
ed->v->solid = 0;
|
ed->v->solid = 0;
|
||||||
ed->xv->pvsflags = 0;
|
ed->xv->pvsflags = 0;
|
||||||
|
|
||||||
|
#ifdef QUAKETC
|
||||||
|
//ideal world...
|
||||||
|
ed->v->nextthink = 0;
|
||||||
|
ed->v->think = 0;
|
||||||
ed->v->classname = 0;
|
ed->v->classname = 0;
|
||||||
|
ed->v->health = 0;
|
||||||
|
#else
|
||||||
|
//yay compat
|
||||||
|
ed->v->nextthink = -1;
|
||||||
|
if (progstype == PROG_QW)
|
||||||
|
{
|
||||||
|
ed->v->classname = 0; //this should be below, but 0 is a nicer choice, and matches all qw servers that we actually care about, even if wrong.
|
||||||
if (pr_imitatemvdsv.value)
|
if (pr_imitatemvdsv.value)
|
||||||
{
|
{
|
||||||
|
|
||||||
ed->v->health = 0;
|
ed->v->health = 0;
|
||||||
ed->v->nextthink = -1;
|
|
||||||
ed->v->impulse = 0; //this is not true imitation, but it seems we need this line to get out of some ktpro infinate loops.
|
ed->v->impulse = 0; //this is not true imitation, but it seems we need this line to get out of some ktpro infinate loops.
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
ed->v->think = 0;
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
ed->xv->SendEntity = 0;
|
ed->xv->SendEntity = 0;
|
||||||
sv.csqcentversion[ed->entnum] += 1;
|
sv.csqcentversion[ed->entnum] += 1;
|
||||||
|
@ -11564,6 +11571,7 @@ void PR_DumpPlatform_f(void)
|
||||||
{"m_shutdown", "void()", MENU},
|
{"m_shutdown", "void()", MENU},
|
||||||
{"m_draw", "void(vector screensize)", MENU, "Provides the menuqc with a chance to draw. Will be called even if the menu does not have focus, so be sure to avoid that. COMPAT: screensize is not provided in DP."},
|
{"m_draw", "void(vector screensize)", MENU, "Provides the menuqc with a chance to draw. Will be called even if the menu does not have focus, so be sure to avoid that. COMPAT: screensize is not provided in DP."},
|
||||||
{"m_drawloading", "void(vector screensize, float opaque)", MENU, "Additional drawing function to draw loading screens. If opaque is set, then this function must ensure that the entire screen is overdrawn (even if just by a black drawfill)."},
|
{"m_drawloading", "void(vector screensize, float opaque)", MENU, "Additional drawing function to draw loading screens. If opaque is set, then this function must ensure that the entire screen is overdrawn (even if just by a black drawfill)."},
|
||||||
|
{"Menu_InputEvent", "float(float evtype, float scanx, float chary, float devid)", MENU, "If present, this is called instead of m_keydown and m_keyup\nCalled whenever a key is pressed, the mouse is moved, etc. evtype will be one of the IE_* constants. The other arguments vary depending on the evtype. Key presses are not guarenteed to have both scan and unichar values set at the same time."},
|
||||||
{"m_keydown", "void(float scan, float chr)", MENU},
|
{"m_keydown", "void(float scan, float chr)", MENU},
|
||||||
{"m_keyup", "void(float scan, float chr)", MENU},
|
{"m_keyup", "void(float scan, float chr)", MENU},
|
||||||
{"m_toggle", "void(float wantmode)", MENU},
|
{"m_toggle", "void(float wantmode)", MENU},
|
||||||
|
@ -11987,6 +11995,7 @@ void PR_DumpPlatform_f(void)
|
||||||
{"VF_RT_DEPTH", "const float", CS|MENU, D("The texture name to use as a depth buffer. Also used for shaders that specify $sourcedepth. 1-based. Additional arguments are: format (16bit=4,24bit=5,32bit=6), sizexy."), VF_RT_DEPTH},
|
{"VF_RT_DEPTH", "const float", CS|MENU, D("The texture name to use as a depth buffer. Also used for shaders that specify $sourcedepth. 1-based. Additional arguments are: format (16bit=4,24bit=5,32bit=6), sizexy."), VF_RT_DEPTH},
|
||||||
{"VF_RT_RIPPLE", "const float", CS|MENU, D("The texture name to use as a ripplemap (target for shaders with 'sort ripple'). Also used for shaders that specify $ripplemap. 1-based. Additional arguments are: format, sizexy."), VF_RT_RIPPLE},
|
{"VF_RT_RIPPLE", "const float", CS|MENU, D("The texture name to use as a ripplemap (target for shaders with 'sort ripple'). Also used for shaders that specify $ripplemap. 1-based. Additional arguments are: format, sizexy."), VF_RT_RIPPLE},
|
||||||
{"VF_ENVMAP", "const float", CS|MENU, D("The cubemap name to use as a fallback for $reflectcube, if a shader was unable to load one. Note that this doesn't automatically change shader permutations or anything."), VF_ENVMAP},
|
{"VF_ENVMAP", "const float", CS|MENU, D("The cubemap name to use as a fallback for $reflectcube, if a shader was unable to load one. Note that this doesn't automatically change shader permutations or anything."), VF_ENVMAP},
|
||||||
|
{"VF_USERDATA", "const float", CS|MENU, D("Pointer (and byte size) to an array of vec4s. This data is then globally visible to all glsl via the w_user uniform."), VF_USERDATA},
|
||||||
|
|
||||||
{"RF_VIEWMODEL", "const float", CS, D("Specifies that the entity is a view model, and that its origin is relative to the current view position. These entities are also subject to viewweapon bob."), CSQCRF_VIEWMODEL},
|
{"RF_VIEWMODEL", "const float", CS, D("Specifies that the entity is a view model, and that its origin is relative to the current view position. These entities are also subject to viewweapon bob."), CSQCRF_VIEWMODEL},
|
||||||
{"RF_EXTERNALMODEL", "const float", CS, D("Specifies that this entity should be displayed in mirrors (and may still cast shadows), but will not otherwise be visible."), CSQCRF_EXTERNALMODEL},
|
{"RF_EXTERNALMODEL", "const float", CS, D("Specifies that this entity should be displayed in mirrors (and may still cast shadows), but will not otherwise be visible."), CSQCRF_EXTERNALMODEL},
|
||||||
|
|
Loading…
Reference in a new issue