mirror of
https://git.code.sf.net/p/quake/newtree
synced 2024-11-29 07:12:30 +00:00
More changes, rendering effects like alpha and colormod SHOULD work :)
This commit is contained in:
parent
0802498b8b
commit
68ae22b1ac
4 changed files with 50 additions and 16 deletions
|
@ -280,6 +280,7 @@ typedef struct
|
||||||
byte glowsize;
|
byte glowsize;
|
||||||
byte glowcolor;
|
byte glowcolor;
|
||||||
byte colormod;
|
byte colormod;
|
||||||
|
byte alpha;
|
||||||
} entity_state_t;
|
} entity_state_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -258,10 +258,12 @@ void CL_ParseDelta (entity_state_t *from, entity_state_t *to, int bits)
|
||||||
if (bits & U_GLOWCOLOR)
|
if (bits & U_GLOWCOLOR)
|
||||||
to->glowcolor = MSG_ReadByte();
|
to->glowcolor = MSG_ReadByte();
|
||||||
|
|
||||||
if (bits & U_COLORMOD) {
|
if (bits & U_COLORMOD)
|
||||||
to->colormod = MSG_ReadByte();
|
to->colormod = MSG_ReadByte();
|
||||||
Con_DPrintf("CM: %f\n)", (float) to->colormod);
|
|
||||||
}
|
if (bits & U_ALPHA)
|
||||||
|
to->alpha = MSG_ReadByte();
|
||||||
|
|
||||||
|
|
||||||
if (bits & U_SOLID)
|
if (bits & U_SOLID)
|
||||||
{
|
{
|
||||||
|
@ -524,6 +526,12 @@ void CL_LinkPacketEntities (void)
|
||||||
//
|
//
|
||||||
ent->glowsize = s1->glowsize < 128 ? s1->glowsize * 8.0 : (s1->glowsize - 256) * 8.0;
|
ent->glowsize = s1->glowsize < 128 ? s1->glowsize * 8.0 : (s1->glowsize - 256) * 8.0;
|
||||||
ent->glowcolor = s1->glowcolor;
|
ent->glowcolor = s1->glowcolor;
|
||||||
|
|
||||||
|
if (ent->alpha != 1)
|
||||||
|
ent->alpha = s1->alpha / 255;
|
||||||
|
else
|
||||||
|
ent->alpha = 1;
|
||||||
|
|
||||||
if (s1->colormod) {
|
if (s1->colormod) {
|
||||||
ent->colormod[0] = (float) ((s1->colormod >> 5) & 7) * (1.0 / 7.0);
|
ent->colormod[0] = (float) ((s1->colormod >> 5) & 7) * (1.0 / 7.0);
|
||||||
ent->colormod[1] = (float) ((s1->colormod >> 2) & 7) * (1.0 / 7.0);
|
ent->colormod[1] = (float) ((s1->colormod >> 2) & 7) * (1.0 / 7.0);
|
||||||
|
|
|
@ -90,6 +90,7 @@ int d_lightstylevalue[256]; // 8.8 fraction of base light value
|
||||||
|
|
||||||
|
|
||||||
vec3_t shadecolor; // Ender (Extend) Colormod
|
vec3_t shadecolor; // Ender (Extend) Colormod
|
||||||
|
float modelalpha; // Ender (EXtend) Alpha
|
||||||
|
|
||||||
void R_MarkLeaves (void);
|
void R_MarkLeaves (void);
|
||||||
|
|
||||||
|
@ -370,6 +371,14 @@ void GL_DrawAliasFrame (aliashdr_t *paliashdr, int posenum)
|
||||||
verts += posenum * paliashdr->poseverts;
|
verts += posenum * paliashdr->poseverts;
|
||||||
order = (int *)((byte *)paliashdr + paliashdr->commands);
|
order = (int *)((byte *)paliashdr + paliashdr->commands);
|
||||||
|
|
||||||
|
if (modelalpha != 1.0)
|
||||||
|
{
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glDepthMask(0);
|
||||||
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
|
}
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
// get the vertex count and primitive type
|
// get the vertex count and primitive type
|
||||||
|
@ -394,10 +403,10 @@ void GL_DrawAliasFrame (aliashdr_t *paliashdr, int posenum)
|
||||||
l = shadedots[verts->lightnormalindex] * shadelight;
|
l = shadedots[verts->lightnormalindex] * shadelight;
|
||||||
|
|
||||||
// Ender: Test (Colormod) [QSG Begin]
|
// Ender: Test (Colormod) [QSG Begin]
|
||||||
if (shadecolor[0] || shadecolor[1] || shadecolor[2]) {
|
if (modelalpha) {
|
||||||
glColor3f(shadecolor[0] * l, shadecolor[1] * l, shadecolor[2] * l);
|
glColor4f(shadecolor[0] * l, shadecolor[1] * l, shadecolor[2] * l, modelalpha);
|
||||||
} else {
|
} else {
|
||||||
glColor3f (l, l, l);
|
glColor3f(shadecolor[0] * l, shadecolor[1] * l, shadecolor[2] * l);
|
||||||
}
|
}
|
||||||
// Ender: Test (Colormod) [QSG End]
|
// Ender: Test (Colormod) [QSG End]
|
||||||
|
|
||||||
|
@ -407,6 +416,13 @@ void GL_DrawAliasFrame (aliashdr_t *paliashdr, int posenum)
|
||||||
|
|
||||||
glEnd ();
|
glEnd ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (modelalpha != 1.0) {
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // normal alpha blend
|
||||||
|
glDisable(GL_BLEND);
|
||||||
|
glDepthMask(1);
|
||||||
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -540,11 +556,6 @@ void R_DrawAliasModel (entity_t *e)
|
||||||
|
|
||||||
ambientlight = shadelight = R_LightPoint (currententity->origin);
|
ambientlight = shadelight = R_LightPoint (currententity->origin);
|
||||||
|
|
||||||
// Ender (Extend)
|
|
||||||
shadecolor[0] = currententity->colormod[0];
|
|
||||||
shadecolor[1] = currententity->colormod[1];
|
|
||||||
shadecolor[2] = currententity->colormod[2];
|
|
||||||
|
|
||||||
// allways give the gun some light
|
// allways give the gun some light
|
||||||
if (e == &cl.viewent && ambientlight < 24)
|
if (e == &cl.viewent && ambientlight < 24)
|
||||||
ambientlight = shadelight = 24;
|
ambientlight = shadelight = 24;
|
||||||
|
@ -673,6 +684,11 @@ void R_DrawEntitiesOnList (void)
|
||||||
|
|
||||||
if (!r_drawentities->value)
|
if (!r_drawentities->value)
|
||||||
return;
|
return;
|
||||||
|
// Ender (Extend)
|
||||||
|
modelalpha = currententity->alpha;
|
||||||
|
shadecolor[0] = currententity->colormod[0];
|
||||||
|
shadecolor[1] = currententity->colormod[1];
|
||||||
|
shadecolor[2] = currententity->colormod[2];
|
||||||
|
|
||||||
// draw sprites seperately, because of alpha blending
|
// draw sprites seperately, because of alpha blending
|
||||||
for (i=0 ; i<cl_numvisedicts ; i++)
|
for (i=0 ; i<cl_numvisedicts ; i++)
|
||||||
|
@ -751,6 +767,8 @@ void R_DrawViewModel (void)
|
||||||
ambientlight = j;
|
ambientlight = j;
|
||||||
shadelight = j;
|
shadelight = j;
|
||||||
|
|
||||||
|
shadecolor[0] = shadecolor[1] = shadecolor[2] = 0;
|
||||||
|
|
||||||
// add dynamic lights
|
// add dynamic lights
|
||||||
for (lnum=0 ; lnum<MAX_DLIGHTS ; lnum++)
|
for (lnum=0 ; lnum<MAX_DLIGHTS ; lnum++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -223,8 +223,8 @@ void SV_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qb
|
||||||
if (stdver > 1) {
|
if (stdver > 1) {
|
||||||
if (to->glowsize != from->glowsize) bits |= U_GLOWSIZE;
|
if (to->glowsize != from->glowsize) bits |= U_GLOWSIZE;
|
||||||
if (to->glowcolor != from->glowcolor) bits |= U_GLOWCOLOR;
|
if (to->glowcolor != from->glowcolor) bits |= U_GLOWCOLOR;
|
||||||
// LordHavocFIX
|
if (to->colormod != from->colormod) bits |= U_COLORMOD;
|
||||||
// if (to->colormod != from->colormod) bits |= U_COLORMOD;
|
if (to->alpha != from->alpha) bits |= U_ALPHA;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bits >= 16777216)
|
if (bits >= 16777216)
|
||||||
|
@ -294,6 +294,8 @@ void SV_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qb
|
||||||
MSG_WriteByte(msg, to->glowcolor);
|
MSG_WriteByte(msg, to->glowcolor);
|
||||||
if (bits & U_COLORMOD)
|
if (bits & U_COLORMOD)
|
||||||
MSG_WriteByte(msg, to->colormod);
|
MSG_WriteByte(msg, to->colormod);
|
||||||
|
if (bits & U_ALPHA)
|
||||||
|
MSG_WriteByte(msg, to->colormod);
|
||||||
// Ender (QSG - End)
|
// Ender (QSG - End)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -571,7 +573,7 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg)
|
||||||
state->glowsize = 0;
|
state->glowsize = 0;
|
||||||
state->glowcolor = 254;
|
state->glowcolor = 254;
|
||||||
state->colormod = 0;
|
state->colormod = 0;
|
||||||
|
state->alpha = 1;
|
||||||
if ((val = GETEDICTFIELDVALUE(ent, eval_glowsize))) {
|
if ((val = GETEDICTFIELDVALUE(ent, eval_glowsize))) {
|
||||||
tmp = (int)val->_float >> 3;
|
tmp = (int)val->_float >> 3;
|
||||||
state->glowsize = bound(-128, tmp, 127);
|
state->glowsize = bound(-128, tmp, 127);
|
||||||
|
@ -582,10 +584,15 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg)
|
||||||
state->glowcolor = (int) val->_float;
|
state->glowcolor = (int) val->_float;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((val = GETEDICTFIELDVALUE(ent, eval_alpha))) {
|
||||||
|
if (val->_float != 0)
|
||||||
|
state->alpha = (int) val->_float;
|
||||||
|
}
|
||||||
|
|
||||||
if ((val = GETEDICTFIELDVALUE(ent, eval_colormod))) {
|
if ((val = GETEDICTFIELDVALUE(ent, eval_colormod))) {
|
||||||
if (val->vector[0] != 0 || val->vector[1] != 0 || val->vector[2] != 0) {
|
if (val->vector[0] != 0 || val->vector[1] != 0 || val->vector[2] != 0) {
|
||||||
int modred, modgreen, modblue;
|
int modred, modgreen, modblue;
|
||||||
Con_Printf("Setting colormod! :)\n");
|
|
||||||
modred = val->vector[0] * 8.0;
|
modred = val->vector[0] * 8.0;
|
||||||
if (modred < 0) modred = 0;
|
if (modred < 0) modred = 0;
|
||||||
if (modred > 7) modred = 7;
|
if (modred > 7) modred = 7;
|
||||||
|
|
Loading…
Reference in a new issue