User panel stuff on forum
  9 posts on 1 page  1
Client Talk
2006-09-18, 20:01
Member
357 posts

Registered:
Mar 2006
This is code for ezQuake, adapted from my netQuake engine Qrack (http://www.quakeone.com/qrack)
thought Jonny_Z might like this...

file gl_rmain.c

in R_DrawAliasModel

add..
// #define ISUNDERWATER(x) ((x) == CONTENTS_WATER || (x) == CONTENTS_SLIME || (x) == CONTENTS_LAVA)

if ((gl_caustics.value) && (underwatertexture && gl_mtexable && ISUNDERWATER(TruePointContents(ent->origin))))
{
GL_EnableMultitexture ();
glBindTexture (GL_TEXTURE_2D, underwatertexture);

glMatrixMode (GL_TEXTURE);
glLoadIdentity ();
glScalef (0.5, 0.5, 1);
glRotatef (realtime * 10, 1, 0, 0);
glRotatef (realtime * 10, 0, 1, 0);
glMatrixMode (GL_MODELVIEW);

GL_Bind (underwatertexture);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
glBlendFunc(GL_DST_COLOR, GL_SRC_COLOR);
glEnable (GL_BLEND);

R_SetupAliasFrame (oldframe, frame, paliashdr, true);

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDisable(GL_BLEND);

GL_SelectTexture(GL_TEXTURE1_ARB);
glTexEnvi (GL_TEXTURE_ENV, GL_RGB_SCALE, 1);
glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glDisable (GL_TEXTURE_2D);

glMatrixMode (GL_TEXTURE);
glLoadIdentity ();
glMatrixMode (GL_MODELVIEW);

GL_DisableMultitexture ();
}

right before this..
...
glShadeModel (GL_FLAT);
if (gl_affinemodels.value)
glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);

glPopMatrix ();
...

Just simple eyecandy that doesnt hinder gameplay...
Though, this exact method CAN be used to create a glowing fullbright texture over a player if they have Quad or Pent
2006-09-21, 16:48
Member
151 posts

Registered:
Jan 2006
comitted http://ezquake.cvs.sourceforge.net/ezquake/ezquake/gl_rmain.c?r1=1.41&r2=1.42
on which map i can found underwatel bmodel ? =:-)
kill me now and burn my soul
2006-09-21, 19:15
Member
1102 posts

Registered:
Jan 2006
dm3, the ammoboxes in the water.
2006-09-21, 19:54
Member
357 posts

Registered:
Mar 2006
It will also be visable on the weapon models, and player model. That code is for alias models, I also have some code to allow the same effects on brush models (original ammo, health packs too)...
2006-09-21, 21:24
Member
151 posts

Registered:
Jan 2006
I got no effect on ammoboxes @ dm3 :E
May be because ammoboxes is brush models?
I found some weird map with armor in water... i got effect on this armor.
kill me now and burn my soul
2006-09-22, 10:46
Member
518 posts

Registered:
Jan 2006
do you have bmodels for dm3 disconnect?

http://www.france-quake.net/files/pez/qw/bisounours.PAK
2006-09-22, 13:35
Member
1026 posts

Registered:
Feb 2006
screenshots with the effects please
god damn hippies >_<
2006-09-22, 16:19
Member
357 posts

Registered:
Mar 2006
Okay, two things we are gonna do here, both unrelated but close to the same files and easy to add

1.> caustics on underwater brushmodels
2.> true textureless map textures, but preserving original colors (quick and easy)
The beauty of this is that u can toggle in REALTIME for ANY map!!!

First open..

gl_surf.c

somewhere near the top add this

extern int brushmodel; //Qrack
extern cvar_t gl_textureless; //Qrack

then in this fuction..

void DrawTextureChains (model_t *model)

for textureless map textures on the fly....
find this portion...
glBegin(GL_POLYGON);
v = s->polys->verts[0];
for (k = 0; k < s->polys->numverts; k++, v += VERTEXSIZE) {
if (doMtex1) {
qglMultiTexCoord2f (GL_TEXTURE0_ARB, v[3], v[4]);

if (mtex_lightmaps)
qglMultiTexCoord2f (GL_LIGHTMAP_TEXTURE, v[5], v[6]);

if (mtex_fbs)
qglMultiTexCoord2f (GL_FB_TEXTURE, v[3], v[4]);
} else {
glTexCoord2f (v[3], v[4]);
}
glVertex3fv (v);
}
glEnd ();

replace it with

glBegin (GL_POLYGON);
v = s->polys->verts[0];
for (k = 0 ; k < s->polys->numverts ; k++, v += VERTEXSIZE)
{
if (doMtex1)
{
if((gl_textureless.value) && !brushmodel) //Qrack
{
qglMultiTexCoord2f (GL_TEXTURE0_ARB, 0, 0);

if (mtex_lightmaps)
qglMultiTexCoord2f (GL_LIGHTMAP_TEXTURE, v[5], v[6]);

if (mtex_fbs)
qglMultiTexCoord2f (GL_TEXTURE2_ARB, 0, 0);
}
else
{
qglMultiTexCoord2f (GL_TEXTURE0_ARB, v[3], v[4]);

if (mtex_lightmaps)
qglMultiTexCoord2f (GL_LIGHTMAP_TEXTURE, v[5], v[6]);

if (mtex_fbs)
qglMultiTexCoord2f (GL_FB_TEXTURE, v[3], v[4]);
}
}
else
{
if((gl_textureless.value) && !brushmodel) //Qrack
{
glTexCoord2f (0, 0);
}
else
{
glTexCoord2f (v[3], v[4]);
}
}
glVertex3fv (v);
}
glEnd ();

for underwater brushmodel caustics
after..
if ((waterline && gl_caustics.value) && underwatertexture)
{
s->polys->caustics_chain = caustics_polys;
caustics_polys = s->polys;
}

add...

if ((brushmodel && gl_caustics.value && underwatertexture && ISUNDERWATER(contents)))//Qrack
{
s->polys->caustics_chain = caustics_polys;
caustics_polys = s->polys;
}

now in gl_rmain.c

near the top add..
int brushmodel = 0;
cvar_t gl_textureless = {"gl_textureless", "0"};//Qrack

in R_DrawEntitiesOnList

change to this...

case mod_brush:
brushmodel = 1;
R_DrawBrushModel (currententity);
brushmodel = 0;
break;

then finally in

R_Init add

Cvar_Register (&gl_textureless); //Qrack

also in quakedef.h
you should put this here instead

#define ISUNDERWATER(x) ((x) == CONTENTS_WATER || (x) == CONTENTS_SLIME || (x) == CONTENTS_LAVA)

That's it!


screen shots here:

http://www.quakeone.com/qrack/qrack310.png

http://www.quakeone.com/qrack/qrack311.png

2006-09-24, 20:00
Member
151 posts

Registered:
Jan 2006
comitted
kill me now and burn my soul
  9 posts on 1 page  1