Dynamic lights on moving brush models
Moderator: InsideQC Admins
34 posts
• Page 3 of 3 • 1, 2, 3
Re: Dynamic lights on moving brush models
Software Quake version

In the dlight_t struct, add a new member:
In R_MarkLights, replace occurrances of "light->origin" with "light->transformed".
In R_PushDlights, before the call to R_MarkLights, add:
In R_DrawBEntitiesOnList, before the call to R_MarkLights, add:
In R_AddDynamicLights, before the calculation of "rad = cl_dlights[lnum].radius;", add:
Elsewhere in R_AddDynamicLights, replace occurrances of "cl_dlights[lnum].origin" with "cl_dlights[lnum].transformed".
Done.
This is obviously the non-rotated version.

In the dlight_t struct, add a new member:
- Code: Select all
vec3_t transformed;
In R_MarkLights, replace occurrances of "light->origin" with "light->transformed".
In R_PushDlights, before the call to R_MarkLights, add:
- Code: Select all
l->transformed[0] = l->origin[0];
l->transformed[1] = l->origin[1];
l->transformed[2] = l->origin[2];
In R_DrawBEntitiesOnList, before the call to R_MarkLights, add:
- Code: Select all
cl_dlights[k].transformed[0] = cl_dlights[k].origin[0] - currententity->origin[0];
cl_dlights[k].transformed[1] = cl_dlights[k].origin[1] - currententity->origin[1];
cl_dlights[k].transformed[2] = cl_dlights[k].origin[2] - currententity->origin[2];
In R_AddDynamicLights, before the calculation of "rad = cl_dlights[lnum].radius;", add:
- Code: Select all
if (currententity == &cl_entities[0])
{
cl_dlights[lnum].transformed[0] = cl_dlights[lnum].origin[0];
cl_dlights[lnum].transformed[1] = cl_dlights[lnum].origin[1];
cl_dlights[lnum].transformed[2] = cl_dlights[lnum].origin[2];
}
else
{
cl_dlights[lnum].transformed[0] = cl_dlights[lnum].origin[0] - currententity->origin[0];
cl_dlights[lnum].transformed[1] = cl_dlights[lnum].origin[1] - currententity->origin[1];
cl_dlights[lnum].transformed[2] = cl_dlights[lnum].origin[2] - currententity->origin[2];
}
Elsewhere in R_AddDynamicLights, replace occurrances of "cl_dlights[lnum].origin" with "cl_dlights[lnum].transformed".
Done.
This is obviously the non-rotated version.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
We knew the words, we knew the score, we knew what we were fighting for
-
mh - Posts: 2286
- Joined: Sat Jan 12, 2008 1:38 am
Re: Dynamic lights on moving brush models
So cool mh, thanks for sharing! I've always been fascinated by software rendering!
PS: what do you mean by "non-rotated version?"
PS: what do you mean by "non-rotated version?"
- toneddu2000
- Posts: 1280
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
Re: Dynamic lights on moving brush models
Originally Quake had no support to rotate BSP models like doors or plats. This was introduced later when the source code was released.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC
(LordHavoc)

-
frag.machine - Posts: 2052
- Joined: Sat Nov 25, 2006 1:49 pm
Re: Dynamic lights on moving brush models
Ah, thanks a lot frag.machine! Always helpful!
- toneddu2000
- Posts: 1280
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
34 posts
• Page 3 of 3 • 1, 2, 3
Return to Programming Tutorials
Who is online
Users browsing this forum: No registered users and 1 guest