Tutorial *11*

Written by Jacques Krige (Korax)
email: [email protected]
website: http://www.excentrax.co.za

---

So, are we ready to get rid of one of the most irritating features of GL Hexen2, with one of the easiest Hexen2 tutorials out there?
Here's goes, quick and simple:
Open up the file called "gl_surf.c"
Find the function called "DrawGLWaterPoly".
When you got it, replace that function with this new one I've already modified for you:

void DrawGLWaterPoly (glpoly_t *p)

{

	int		i;

	float	*v;

	float	s, t, os, ot;

	//vec3_t	nv;



	glBegin (GL_TRIANGLE_FAN);

	v =p->verts[0];

	for (i=0; inumverts ; i++, v+=VERTEXSIZE)

	{

		glTexCoord2f (v[3], v[4]);



		//nv[0] =[0] + 8*sin(v[1]*0.05+realtime)*sin(v[2]*0.05+realtime);

		//nv[1] =[1] + 8*sin(v[0]*0.05+realtime)*sin(v[2]*0.05+realtime);

		//nv[2] =[2];

		//jkrige - commented out



		//glVertex3fv (nv);

		glVertex3fv (v);

	}

	glEnd ();

}

This takes care of the wall surface itself.
Now, lets do the lightmap.
Right below the above function you should find one called "DrawGLWaterPolyLightmap".
When you found that, again, replace it with this one I already modified for you.
void DrawGLWaterPolyLightmap (glpoly_t *p)

{

	int		i;

	float	*v;

	float	s, t, os, ot;

	//vec3_t	nv;



	glBegin (GL_TRIANGLE_FAN);

	v =p->verts[0];

	for (i=0; inumverts ; i++, v+=VERTEXSIZE)

	{

		glTexCoord2f (v[5], v[6]);



		//nv[0] =[0] + 8*sin(v[1]*0.05+realtime)*sin(v[2]*0.05+realtime);

		//nv[1] =[1] + 8*sin(v[0]*0.05+realtime)*sin(v[2]*0.05+realtime);

		//nv[2] =[2];



		//jkrige - commented out



		//glVertex3fv (nv);

		glVertex3fv (v);

	}

	glEnd ();

}

There you go!
No more waterwarps!

Does it get easier than this?

Okie, one thing you should notice is that this state is "Hard-coded".
If you really want to make it set-able, you'll have to add a new CVAR and do the needed changes to these above functions.

Hope you enjoyed the tutorial! ;)
Jacques Krige.


 
Not logged in
Sign up
Login:
Passwd: