
|
Copyright info |
|
All
code in this tutorial is protected by the [GPL License]. |
|
Tutorial by: Aaron Reeves |
||||||||||||||||||||||
|
Mailto: aaronpaulreeves@yahoo.co.uk In this tutorial
I'm going to show you how to eliminate shadows on certain objects, i.e.
hyper/blaster lasers, grenades, rockets and most importantly, explosions. Firstly we
have to define a rendering flag to use to determine whether an object should
cast a shadow. Open up q_shared.h (in the game project), go to the bottom of
all the other render flags (RF_MINLIGHT, RF_VIEWERMODEL etc.) and paste
this:-
Now we have to
implement the flag where GL_DrawAliasShadow is called, and this is in
gl_mesh.c (in the ref_gl project) at the bottom (in R_DrawAliasModel.) change
the if statement that determines whether shadows should be drawn from:-
to:
This now checks
whether any of the entities have the RF_NOSHADOW flag, and if they do it
doesn't draw a shadow for that entity. Now we have to
enable the flag for the entities that we don't want a shadow cast from, so
back to the game project, go to the fire_blaster function in g_weapon.c, go
to the bottom of all the fields set for the bolt (blaster laser) entity and
add this:-
If you compile
now and set gl_shadows to 1, you'll notice that all the models cast a shadow
except for the blaster laser and hyper blaster lasers (because it uses the
same function). But we're not finished yet. Next go to fire_grenade, and
again at the bottom of all the fields add:-
Then for
rockets, in fire_rocket, at the bottom of the fields add:
That's it for all
the server side entities, now we have to do the client entities. So, now go
to cl_tent.c (where all the temporary entities are setup) and find these
bunch of cases:
in
CL_ParseTEnt. and change:-
to:
and then do
the same for:
and
This prevents a
shadow from being drawn on any of the explosions (the BFG explosion doesn't
need to be set, as it is a sprite and therefore GL_DrawAliasShadow is not
being used!) Compile the ref_gl, game and quake2 projects. startup quake2,
type gl_shadows 1, and notice that there are no shadows on lasers, grenades,
rockets and explosions.. hooray! If you haven't already implemented MrG's
shadow tut.. then do it now (especially for those spinning gib shadows, yuk!) That's it, if
you have any questions.. or if there's any problems with the tut, email me
at: aaronpaulreeves@yahoo.co.uk |
Tutorial Originally found at: