Skip to content

Commit

Permalink
Added rend-halo-realistic, the realistic halo mode
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Jul 10, 2004
1 parent cac2f5e commit 511680e
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 21 deletions.
2 changes: 1 addition & 1 deletion doomsday/Include/rend_halo.h
Expand Up @@ -25,7 +25,7 @@
#include "con_decl.h"

extern int haloOccludeSpeed;
extern int haloMode, haloBright, haloSize;
extern int haloMode, haloRealistic, haloBright, haloSize;
extern float haloFadeMax, haloFadeMin, minHaloSize;

void H_Register(void);
Expand Down
4 changes: 3 additions & 1 deletion doomsday/Src/con_main.c
Expand Up @@ -2740,7 +2740,7 @@ int CCmdDir(int argc, char **argv)
Con_Printf("Directory: %s\n", dir);

// Make the pattern.
sprintf(pattern, "%s*.*", dir);
sprintf(pattern, "%s*", dir);
F_ForAll(pattern, dir, Con_PrintFileName);
}

Expand Down Expand Up @@ -3094,6 +3094,8 @@ static void registerVariables(void)
// * Render-Halo
C_VAR_INT("rend-halo", &haloMode, 0, 0, 5,
"Number of flares to draw per light.");
C_VAR_INT("rend-halo-realistic", &haloRealistic, 0, 0, 1,
"1=Use more realistic halo effects.");
C_VAR_INT("rend-halo-bright", &haloBright, 0, 0, 100,
"Halo/flare brightness.");
C_VAR_INT("rend-halo-occlusion", &haloOccludeSpeed, CVF_NO_MAX, 0, 0,
Expand Down
49 changes: 30 additions & 19 deletions doomsday/Src/rend_halo.c
Expand Up @@ -79,6 +79,7 @@ flare_t flares[NUM_FLARES] = {
// PUBLIC DATA DEFINITIONS -------------------------------------------------

int haloMode = 5, haloBright = 35, haloSize = 50;
int haloRealistic = true;
int haloOccludeSpeed = 48;
float haloZMagDiv = 100, haloMinRadius = 20;
float haloDimStart = 10, haloDimEnd = 100;
Expand Down Expand Up @@ -153,14 +154,17 @@ void H_RenderHalo(vissprite_t * sourcevis, boolean primary)
float halopos[3], occlusionfactor;
int i, k, tex;
lumobj_t *lum = sourcevis->data.mo.light;

// mobj_t *mo = lum->thing;
// float cliprange = farClip - nearClip;
float color[4], radx, rady, scale, turnangle = 0;
float fadefactor = 1, secbold, secdimfactor;
float coloraverage, f, distancedim, lum_distance;
flare_t *fl;

if(!primary && haloRealistic)
{
// In the realistic mode we don't render secondary halos.
return;
}

lum_distance = FIX2FLT(lum->distance);

if(lum->flags & LUMF_NOHALO || lum_distance == 0 ||
Expand Down Expand Up @@ -290,32 +294,33 @@ void H_RenderHalo(vissprite_t * sourcevis, boolean primary)
radius = haloMinRadius;
radius *= occlusionfactor;

/*
* (farClip - clipRange/sourcevis->distance)
+ sourcevis->distance/40);*/// * ((50 + haloSize)/100.0f);
//if(lum->flareSize/sourcevis->distance < .01f) break; // Too small!
secbold = coloraverage - 8 * (1 - secdimfactor);

/*if(i && color[CA] < .5f && lum->flareSize < minHaloSize)
break; // Don't render secondary flares. */

color[CA] *= .8f * haloBright / 100.0f;
if(i)
{
color[CA] *= secbold; // Secondary flare boldness.
}
if(color[CA] <= 0)
{
break; // Not visible.
}

/* radius = lum->flareSize/255.0f * 10;
if(radius > 1.5) radius = 1.5f;
// Determine the size of the halo.
flaresizefactor = (farClip - clipRange
*((sourcevis->distance - nearClip)/clipRange)) * radius;
size = flareSizeFactor * screenHeight/2000.0f * viewscaler;
*/
// In the realistic mode, halos are slightly dimmer.
if(haloRealistic)
{
color[CA] *= .8f;
}

gl.Color4fv(color);

if(primary && lum->flareTex)
if(haloRealistic)
{
// The 'realistic' halos just use the blurry round
// texture.
tex = GL_PrepareLSTexture(LST_DYNAMIC);
}
else if(primary && lum->flareTex)
{
// Set texture explicitly.
if(lum->flareTex == 1)
Expand Down Expand Up @@ -349,6 +354,12 @@ void H_RenderHalo(vissprite_t * sourcevis, boolean primary)
gl.TexParameter(DGL_WRAP_S, DGL_CLAMP);
gl.TexParameter(DGL_WRAP_T, DGL_CLAMP);

// In the realistic mode, halos are slightly smaller.
if(haloRealistic)
{
radius *= 0.8f;
}

// The final radius.
radx = radius * fl->size;
rady = radx / 1.2f;
Expand Down
4 changes: 4 additions & 0 deletions doomsday/Src/rend_particle.c
Expand Up @@ -569,6 +569,10 @@ void PG_RenderParticles(int rtype, boolean with_blend)
center[VZ] = FIX2FLT(pt->pos[VY]);
center[VY] = FIX2FLT(P_GetParticleZ(pt));

center[VX] += frameTimePos * FIX2FLT(pt->mov[VX]);
center[VZ] += frameTimePos * FIX2FLT(pt->mov[VY]);
center[VY] += frameTimePos * FIX2FLT(pt->mov[VZ]);

// Model particles are rendered using the normal model rendering
// routine.
if(rtype == PTC_MODEL && dst->model >= 0)
Expand Down
4 changes: 4 additions & 0 deletions doomsday/Src/ui_panel.c
Expand Up @@ -132,6 +132,7 @@ cvarbutton_t cvarbuttons[] = {
{0, "rend-light"},
{0, "rend-light-decor"},
{0, "rend-light-multitex", "Lights", "Lights"},
{0, "rend-halo-realistic"},
{0, "rend-glow"},
{0, "rend-glow-wall"},
{0, "rend-info-tris"},
Expand Down Expand Up @@ -452,6 +453,9 @@ ui_object_t ob_panel[] =
{ UI_TEXT, 0, 0, 280, 0, 0, 50, "Graphics Options: Halos", UIText_Drawer },
{ UI_TEXT, 0, 0, 300, 70, 0, 55, "Number of flares per halo", UIText_Drawer },
{ UI_SLIDER, 0, 0, 680, 70, 300, 55, "", UISlider_Drawer, UISlider_Responder, UISlider_Ticker, CP_CvarSlider, &sld_halo },
{ UI_TEXT, 0, 0, 300, 130, 0, 55, "Use realistic halos", UIText_Drawer },
{ UI_BUTTON2, 0, 0, 680, 130, 70, 55, "rend-halo-realistic", UIButton_Drawer, UIButton_Responder, 0, CP_CvarButton },
{ UI_META, 7, 0, 0, 60 },
{ UI_TEXT, 0, 0, 300, 130, 0, 55, "Halo brightness", UIText_Drawer },
{ UI_SLIDER, 0, 0, 680, 130, 300, 55, "", UISlider_Drawer, UISlider_Responder, UISlider_Ticker, CP_CvarSlider, &sld_halo_bright },
{ UI_TEXT, 0, 0, 300, 190, 0, 55, "Halo size factor", UIText_Drawer },
Expand Down

0 comments on commit 511680e

Please sign in to comment.