Skip to content

Commit

Permalink
Renderer: Disabled old code for halo/flare rendering completely
Browse files Browse the repository at this point in the history
The objective of this branch is to recreate halo/flare rendering
using GL2.

After that is done, we should evaluate how to integrate it into the
resource management system (or how the resource management system
can co-operate with libgui; probably mostly at the level of locating
the right images to use for the flares).

The terminology should be clarified: a "halo" is the lit 3D volume
around a light source. It is most visible in fog. A "flare" is a
lens flare occurring inside the camera lens(es).
  • Loading branch information
skyjake committed Nov 3, 2013
1 parent a813549 commit e160b5a
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 9 deletions.
15 changes: 15 additions & 0 deletions doomsday/client/include/render/rend_halo.h
Expand Up @@ -20,6 +20,19 @@
#ifndef DENG_CLIENT_RENDER_HALO_H
#define DENG_CLIENT_RENDER_HALO_H

#include <de/libdeng1.h>

DENG_EXTERN_C int haloOccludeSpeed;

void H_Register();

#endif

#if 0

#ifndef DENG_CLIENT_RENDER_HALO_H
#define DENG_CLIENT_RENDER_HALO_H

#include <de/Vector>

#include "TextureVariantSpec"
Expand Down Expand Up @@ -69,3 +82,5 @@ bool H_RenderHalo(de::Vector3d const &origin, float size,
D_CMD(FlareConfig);

#endif // DENG_CLIENT_RENDER_HALO_H

#endif // 0
12 changes: 11 additions & 1 deletion doomsday/client/src/gl/gl_texmanager.cpp
Expand Up @@ -1102,11 +1102,13 @@ void GL_LoadSystemTextures()

GL_PrepareSysFlaremap(FXT_ROUND);
GL_PrepareSysFlaremap(FXT_FLARE);

/*
if(!haloRealistic)
{
GL_PrepareSysFlaremap(FXT_BRFLARE);
GL_PrepareSysFlaremap(FXT_BIGFLARE);
}
}*/

Rend_ParticleLoadSystemTextures();
}
Expand Down Expand Up @@ -1834,6 +1836,8 @@ DGLuint GL_PrepareLSTexture(lightingtexid_t which)

DGLuint GL_PrepareSysFlaremap(flaretexid_t which)
{
DENG_UNUSED(which);
#if 0
if(novideo) return 0;
if(which < 0 || which >= NUM_SYSFLARE_TEXTURES) return 0;

Expand Down Expand Up @@ -1871,10 +1875,15 @@ DGLuint GL_PrepareSysFlaremap(flaretexid_t which)

DENG_ASSERT(sysFlareTextures[which] != 0);
return sysFlareTextures[which];
#endif
return 0;
}

DGLuint GL_PrepareFlaremap(de::Uri const &resourceUri)
{
DENG_UNUSED(resourceUri);
#if 0
return 0;
if(resourceUri.path().length() == 1)
{
// Select a system flare by numeric identifier?
Expand All @@ -1893,6 +1902,7 @@ DGLuint GL_PrepareFlaremap(de::Uri const &resourceUri)
}
// Dang...
}
#endif
return 0;
}

Expand Down
3 changes: 2 additions & 1 deletion doomsday/client/src/render/lumobj.cpp
Expand Up @@ -230,7 +230,8 @@ void Lumobj::generateFlare(Vector3d const &eye, double distFromEye)
vis->distance = distFromEye;
V3f_Set(vis->data.flare.color, d->color.x, d->color.y, d->color.z);
vis->data.flare.mul = d->source->occlusion(eye) * attenuation(distFromEye);
vis->data.flare.size = d->flareSize > 0? de::max(1.f, d->flareSize * 60 * (50 + haloSize) / 100.0f) : 0;
//vis->data.flare.size = d->flareSize > 0? de::max(1.f, d->flareSize * 60 * (50 + haloSize) / 100.0f) : 0;
vis->data.flare.size = 1;
vis->data.flare.tex = d->flareTex;
vis->data.flare.lumIdx = indexInMap();
vis->data.flare.isDecoration = true;
Expand Down
6 changes: 3 additions & 3 deletions doomsday/client/src/render/r_things.cpp
Expand Up @@ -476,9 +476,9 @@ void R_ProjectSprite(mobj_t *mo)
vis->data.flare.flags = def->flags;
}

vis->data.flare.size = flareSize * 60 * (50 + haloSize) / 100.0f;
if(vis->data.flare.size < 8)
vis->data.flare.size = 8;
vis->data.flare.size = 1; //flareSize * 60 * (50 + haloSize) / 100.0f;
/*if(vis->data.flare.size < 8)
vis->data.flare.size = 8;*/

// Color is taken from the associated lumobj.
V3f_Set(vis->data.flare.color, lum->color().x, lum->color().y, lum->color().z);
Expand Down
19 changes: 18 additions & 1 deletion doomsday/client/src/render/rend_halo.cpp
Expand Up @@ -17,6 +17,23 @@
* http://www.gnu.org/licenses</small>
*/

#include "de_base.h"
#include "de_console.h"
#include "render/rend_halo.h"

int haloOccludeSpeed = 48;

void H_Register(void)
{
cvartemplate_t cvars[] = {
{"rend-halo-occlusion", CVF_NO_MAX, CVT_INT, &haloOccludeSpeed, 0, 0},
{NULL}
};
Con_AddVariableList(cvars);
}

#if 0

#include <cmath>

#include "de_base.h"
Expand Down Expand Up @@ -47,7 +64,6 @@ D_CMD(FlareConfig);

int haloMode = 5, haloBright = 45, haloSize = 80;
int haloRealistic = true;
int haloOccludeSpeed = 48;
float haloZMagDiv = 62, haloMinRadius = 20;
float haloDimStart = 10, haloDimEnd = 100;

Expand Down Expand Up @@ -399,3 +415,4 @@ D_CMD(FlareConfig)

return true;
}
#endif
9 changes: 9 additions & 0 deletions doomsday/client/src/render/sprite.cpp
Expand Up @@ -687,6 +687,12 @@ static void setupModelParamsForVisPSprite(rendmodelparams_t *params, vispsprite_

static bool generateHaloForVisSprite(vissprite_t const *spr, bool primary = false)
{
/// @todo Rethink how to draw the 3D halo around the object. Needs to be done
/// in the vissprite order.
DENG_UNUSED(spr);
DENG_UNUSED(primary);
return false;
#if 0
float occlusionFactor;

if(primary && (spr->data.flare.flags & RFF_NO_PRIMARY))
Expand Down Expand Up @@ -714,6 +720,7 @@ static bool generateHaloForVisSprite(vissprite_t const *spr, bool primary = fals
occlusionFactor, spr->data.flare.mul,
spr->data.flare.xOff, primary,
(spr->data.flare.flags & RFF_NO_TURN) == 0);
#endif
}

void Rend_DrawMasked()
Expand Down Expand Up @@ -757,6 +764,7 @@ void Rend_DrawMasked()
}
}

#if 0
// Draw secondary halos?
if(primaryHaloDrawn && haloMode > 1)
{
Expand All @@ -774,6 +782,7 @@ void Rend_DrawMasked()
// And we're done...
H_SetupState(false);
}
#endif
}
}

Expand Down
4 changes: 4 additions & 0 deletions doomsday/client/src/resource/materialsnapshot.cpp
Expand Up @@ -177,6 +177,9 @@ MaterialSnapshot::Decoration &MaterialSnapshot::decoration(int index) const
*/
static DGLuint prepareFlaremap(Texture *texture, int oldIdx)
{
DENG_UNUSED(texture);
DENG_UNUSED(oldIdx);
#if 0
if(texture)
{
if(TextureVariant const *variant = texture->prepareVariant(Rend_HaloTextureSpec()))
Expand All @@ -189,6 +192,7 @@ static DGLuint prepareFlaremap(Texture *texture, int oldIdx)
{
return GL_PrepareSysFlaremap(flaretexid_t(oldIdx - 1));
}
#endif
return 0; // Use the automatic selection logic.
}

Expand Down
7 changes: 4 additions & 3 deletions doomsday/client/src/ui/editors/rendererappearanceeditor.cpp
Expand Up @@ -402,6 +402,7 @@ DENG2_OBSERVES(App, GameChange)
haloGroup->addLabel(tr("Vignette Width:"));
haloGroup->addSlider("rend-vignette-width");

#if 0
haloGroup->addSpace();
haloGroup->addToggle("rend-halo-realistic", tr("Realistic Halos"));

Expand All @@ -413,10 +414,10 @@ DENG2_OBSERVES(App, GameChange)

haloGroup->addLabel(tr("Halo Size Factor:"));
haloGroup->addSlider("rend-halo-size");

#endif
haloGroup->addLabel(tr("Occlusion Fading:"));
haloGroup->addSlider("rend-halo-occlusion", Ranged(1, 256), 1, 0);

#if 0
haloGroup->addLabel(tr("Min Halo Radius:"));
haloGroup->addSlider("rend-halo-radius-min", Ranged(1, 80), .1, 1);

Expand All @@ -431,7 +432,7 @@ DENG2_OBSERVES(App, GameChange)

haloGroup->addLabel(tr("Z-Mag Divisor:"));
haloGroup->addSlider("rend-halo-zmag-div", Ranged(1, 100), .1, 1);

#endif
haloGroup->commit();

// Material settings.
Expand Down

0 comments on commit e160b5a

Please sign in to comment.