Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Cleanup|Client: Public API defines, namespace usage
  • Loading branch information
skyjake committed Jul 26, 2016
1 parent 4afc21a commit a0bf3c6
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 17 deletions.
20 changes: 20 additions & 0 deletions doomsday/apps/client/src/render/api_render.cpp
Expand Up @@ -45,6 +45,7 @@
using namespace de;

// m_misc.c
#undef M_ScreenShot
DENG_EXTERN_C dint M_ScreenShot(char const *name, dint bits);

#undef Models_CacheForState
Expand All @@ -59,6 +60,7 @@ DENG_EXTERN_C void Models_CacheForState(dint stateIndex)
}

// r_draw.cpp
#undef R_SetBorderGfx
DENG_EXTERN_C void R_SetBorderGfx(struct uri_s const *const *paths);

#undef Rend_CacheForMobjType
Expand Down Expand Up @@ -91,6 +93,19 @@ DENG_EXTERN_C void Rend_CacheForMobjType(dint num)
}
}

#undef R_RenderPlayerView
#undef R_SetViewOrigin
#undef R_SetViewAngle
#undef R_SetViewPitch
#undef R_ViewWindowGeometry
#undef R_ViewWindowOrigin
#undef R_ViewWindowSize
#undef R_SetViewWindowGeometry
#undef R_ViewPortGeometry
#undef R_ViewPortOrigin
#undef R_ViewPortSize
#undef R_SetViewPortPlayer

// r_main.cpp
DENG_EXTERN_C void R_RenderPlayerView(dint num);
DENG_EXTERN_C void R_SetViewOrigin(dint consoleNum, coord_t const origin[3]);
Expand All @@ -106,6 +121,7 @@ DENG_EXTERN_C dint R_ViewPortSize(dint consoleNum, Size2Raw *size);
DENG_EXTERN_C void R_SetViewPortPlayer(dint consoleNum, dint viewPlayer);

// sky.cpp
#undef R_SkyParams
DENG_EXTERN_C void R_SkyParams(dint layer, dint param, void *data);

#ifdef __CLIENT__
Expand Down Expand Up @@ -175,6 +191,10 @@ DENG_EXTERN_C dd_bool R_GetSpriteInfo(dint id, dint frame, spriteinfo_t *info)
return true;
}

#undef R_ChooseAlignModeAndScaleFactor
#undef R_ChooseScaleMode2
#undef R_ChooseScaleMode

// r_util.c
DENG_EXTERN_C dd_bool R_ChooseAlignModeAndScaleFactor(dfloat *scale, dint width, dint height, dint availWidth, dint availHeight, scalemode_t scaleMode);
DENG_EXTERN_C scalemode_t R_ChooseScaleMode2(dint width, dint height, dint availWidth, dint availHeight, scalemode_t overrideMode, dfloat stretchEpsilon);
Expand Down
33 changes: 16 additions & 17 deletions doomsday/apps/client/src/render/biastracker.cpp
Expand Up @@ -29,7 +29,7 @@
using namespace de;
using namespace world;

namespace internal {
namespace render {

struct Contributor
{
Expand All @@ -39,8 +39,7 @@ struct Contributor

typedef std::array<Contributor, BiasTracker::MAX_CONTRIBUTORS> Contributors;

} // namespace internal
using namespace ::internal;
} // namespace render

/**
* @todo Do not observe source deletion. A better solution would represent any source
Expand All @@ -49,7 +48,7 @@ using namespace ::internal;
DENG2_PIMPL_NOREF(BiasTracker)
, DENG2_OBSERVES(BiasSource, Deletion)
{
Contributors contributors;
render::Contributors contributors;

QBitArray activeContributors = QBitArray(MAX_CONTRIBUTORS);
QBitArray changedContributions = QBitArray(MAX_CONTRIBUTORS);
Expand All @@ -59,9 +58,9 @@ DENG2_PIMPL_NOREF(BiasTracker)
/// Observes BiasSource Deletion
void biasSourceBeingDeleted(BiasSource const &source)
{
for(Contributors::size_type i = 0; i < contributors.size(); ++i)
for(render::Contributors::size_type i = 0; i < contributors.size(); ++i)
{
Contributor &ctbr = contributors[i];
auto &ctbr = contributors[i];

if(ctbr.source == &source)
{
Expand Down Expand Up @@ -98,9 +97,9 @@ dint BiasTracker::addContributor(BiasSource *source, dfloat intensity)
dint slot = -1;

// Do we have a latent contribution or an unused slot?
for(Contributors::size_type i = 0; i < d->contributors.size(); ++i)
for(render::Contributors::size_type i = 0; i < d->contributors.size(); ++i)
{
Contributor const &ctbr = d->contributors[i];
auto const &ctbr = d->contributors[i];
if(!ctbr.source)
{
// Remember the first unused slot.
Expand All @@ -125,16 +124,16 @@ dint BiasTracker::addContributor(BiasSource *source, dfloat intensity)
{
// Dang, we'll need to drop the weakest.
dint weakest = -1;
for(Contributors::size_type i = 0; i < d->contributors.size(); ++i)
for(render::Contributors::size_type i = 0; i < d->contributors.size(); ++i)
{
Contributor *ctbr = &d->contributors[i];
auto *ctbr = &d->contributors[i];
DENG2_ASSERT(ctbr->source);
if(i == 0 || ctbr->influence < d->contributors[weakest].influence)
{
weakest = i;
}
}
Contributor *ctbr = &d->contributors[weakest];
auto *ctbr = &d->contributors[weakest];

if(intensity <= ctbr->influence)
return - 1;
Expand All @@ -145,7 +144,7 @@ dint BiasTracker::addContributor(BiasSource *source, dfloat intensity)
}
}

Contributor *ctbr = &d->contributors[slot];
auto *ctbr = &d->contributors[slot];

// When reactivating a latent contribution if the intensity has not
// changed we don't need to force an update.
Expand Down Expand Up @@ -180,9 +179,9 @@ duint BiasTracker::timeOfLatestContributorUpdate() const
{
duint latest = 0;

for(Contributors::size_type i = 0; i < d->contributors.size(); ++i)
for(render::Contributors::size_type i = 0; i < d->contributors.size(); ++i)
{
Contributor const &ctbr = d->contributors[i];
auto const &ctbr = d->contributors[i];

if(!d->changedContributions.testBit(i))
continue;
Expand Down Expand Up @@ -214,7 +213,7 @@ QBitArray const &BiasTracker::changedContributions() const

void BiasTracker::updateAllContributors()
{
for(Contributor &ctbr : d->contributors)
for(render::Contributor &ctbr : d->contributors)
{
if(ctbr.source)
{
Expand All @@ -227,9 +226,9 @@ void BiasTracker::applyChanges(QBitArray &changes)
{
// All contributions from changed sources will need to be updated.

for(Contributors::size_type i = 0; i < MAX_CONTRIBUTORS; ++i)
for(render::Contributors::size_type i = 0; i < MAX_CONTRIBUTORS; ++i)
{
Contributor &ctbr = d->contributors[i];
auto &ctbr = d->contributors[i];

if(!ctbr.source) continue;

Expand Down

0 comments on commit a0bf3c6

Please sign in to comment.