Skip to content

Commit

Permalink
Refactor: Moved MaterialVariantSpec into namespace de
Browse files Browse the repository at this point in the history
Plus various other minor cleanup refactorings.
  • Loading branch information
danij-deng committed Jan 6, 2013
1 parent d091cfc commit 705db31
Show file tree
Hide file tree
Showing 23 changed files with 358 additions and 351 deletions.
76 changes: 38 additions & 38 deletions doomsday/engine/include/render/rend_main.h
Expand Up @@ -35,82 +35,82 @@
#endif
#include "r_things.h"

struct materialvariantspecification_s;

#ifdef __cplusplus
extern "C" {
#endif
struct materialvariantspec_s;

#define GLOW_HEIGHT_MAX (1024.f) /// Absolute maximum

#define OMNILIGHT_SURFACE_LUMINOSITY_ATTRIBUTION_MIN (.05f)

#define SHADOW_SURFACE_LUMINOSITY_ATTRIBUTION_MIN (.05f)

extern coord_t vOrigin[3];
extern float vang, vpitch, fieldOfView, yfov;
extern byte smoothTexAnim, devMobjVLights;
extern float viewsidex, viewsidey;
extern boolean usingFog;
extern float fogColor[4];
extern int rAmbient;
extern float rendLightDistanceAttentuation;
extern float lightModRange[255];
extern int devRendSkyMode;
extern int gameDrawHUD;
DENG_EXTERN_C coord_t vOrigin[3];
DENG_EXTERN_C float vang, vpitch, fieldOfView, yfov;
DENG_EXTERN_C byte smoothTexAnim, devMobjVLights;
DENG_EXTERN_C float viewsidex, viewsidey;
DENG_EXTERN_C boolean usingFog;
DENG_EXTERN_C float fogColor[4];
DENG_EXTERN_C int rAmbient;
DENG_EXTERN_C float rendLightDistanceAttentuation;
DENG_EXTERN_C float lightModRange[255];
DENG_EXTERN_C int devRendSkyMode;
DENG_EXTERN_C int gameDrawHUD;

DENG_EXTERN_C int useDynLights;
DENG_EXTERN_C float dynlightFactor, dynlightFogBright;

extern int useDynLights;
extern float dynlightFactor, dynlightFogBright;
DENG_EXTERN_C int useWallGlow;
DENG_EXTERN_C float glowFactor, glowHeightFactor;
DENG_EXTERN_C int glowHeightMax;

extern int useWallGlow;
extern float glowFactor, glowHeightFactor;
extern int glowHeightMax;
DENG_EXTERN_C int useShadows;
DENG_EXTERN_C float shadowFactor;
DENG_EXTERN_C int shadowMaxRadius;
DENG_EXTERN_C int shadowMaxDistance;

extern int useShadows;
extern float shadowFactor;
extern int shadowMaxRadius;
extern int shadowMaxDistance;
DENG_EXTERN_C int useShinySurfaces;

extern int useShinySurfaces;
DENG_EXTERN_C byte devRendSkyAlways;
DENG_EXTERN_C byte freezeRLs;

extern byte devRendSkyAlways;
extern byte freezeRLs;
#ifdef __cplusplus
extern "C" {
#endif

void Rend_Register(void);

void Rend_Init(void);
void Rend_Shutdown(void);
void Rend_Reset(void);

void Rend_RenderMap(void);
void Rend_ModelViewMatrix(boolean use_angles);
void Rend_RenderMap(void);
void Rend_ModelViewMatrix(boolean use_angles);

#define Rend_PointDist2D(c) (fabs((vOrigin[VZ]-c[VY])*viewsidex - (vOrigin[VX]-c[VX])*viewsidey))

const struct materialvariantspecification_s* Rend_MapSurfaceDiffuseMaterialSpec(void);

coord_t Rend_PointDist3D(coord_t const point[3]);
void Rend_ApplyTorchLight(float* color, float distance);
coord_t Rend_PointDist3D(coord_t const point[3]);
void Rend_ApplyTorchLight(float *color, float distance);

/**
* Apply range compression delta to @a lightValue.
* @param lightValue Address of the value for adaptation.
*/
void Rend_ApplyLightAdaptation(float* lightValue);
void Rend_ApplyLightAdaptation(float *lightValue);

/// Same as Rend_ApplyLightAdaptation except the delta is returned.
float Rend_LightAdaptationDelta(float lightvalue);

void Rend_CalcLightModRange(void);
void Rend_CalcLightModRange(void);

/**
* Number of vertices needed for this leaf's trifan.
*/
uint Rend_NumFanVerticesForBspLeaf(BspLeaf* bspLeaf);
uint Rend_NumFanVerticesForBspLeaf(BspLeaf *bspLeaf);

void R_DrawLightRange(void);
void R_DrawLightRange(void);

#ifdef __cplusplus
de::MaterialVariantSpec const &Rend_MapSurfaceDiffuseMaterialSpec();

} // extern "C"
#endif

Expand Down
20 changes: 10 additions & 10 deletions doomsday/engine/include/render/sprite.h
Expand Up @@ -44,13 +44,15 @@ DENG_EXTERN_C int spriteLight, useSpriteAlpha, useSpriteBlend;
DENG_EXTERN_C byte noSpriteTrans;
DENG_EXTERN_C byte devNoSprites;

DENG_EXTERN_C void Rend_SpriteRegister(void);

#ifdef __CLIENT__
#ifdef __cplusplus
extern "C" {
#endif

void Rend_SpriteRegister(void);
de::MaterialVariantSpec const &Rend_SpriteMaterialSpec(int tclass = 0, int tmap = 0);

#ifdef __CLIENT__
extern "C" {
#endif // __cplusplus

/**
* Render sprites, 3D models, masked wall segments and halos, ordered
Expand All @@ -71,16 +73,14 @@ void Rend_Draw2DPlayerSprites(void);

void Rend_Draw3DPlayerSprites(void);

materialvariantspecification_t const* Sprite_MaterialSpec(int tclass, int tmap);

void Rend_RenderSprite(rendspriteparams_t const* params);

#endif // __CLIENT__

///@}

#ifdef __cplusplus
} // extern "C"
#endif

#endif // __CLIENT__

///@}

#endif /* LIBDENG_RENDER_SPRITE_H */
12 changes: 6 additions & 6 deletions doomsday/engine/include/resource/materials.h
Expand Up @@ -249,9 +249,9 @@ namespace de {
*
* @return Rationalized (and interned) copy of the final specification.
*/
materialvariantspecification_t const *variantSpecificationForContext(
materialcontext_t materialContext, int flags, byte border, int tClass,
int tMap, int wrapS, int wrapT, int minFilter, int magFilter, int anisoFilter,
MaterialVariantSpec const &variantSpecForContext(materialcontext_t materialContext,
int flags, byte border, int tClass, int tMap, int wrapS, int wrapT,
int minFilter, int magFilter, int anisoFilter,
bool mipmapped, bool gammaCorrection, bool noStretch, bool toAlpha);

/**
Expand All @@ -263,7 +263,7 @@ namespace de {
* @param cacheGroups @c true= variants for all Materials in any applicable animation
* groups are desired, else just this specific Material.
*/
void cache(material_t &material, materialvariantspecification_t const &spec,
void cache(material_t &material, MaterialVariantSpec const &spec,
bool smooth, bool cacheGroups = true);

/**
Expand All @@ -282,7 +282,7 @@ namespace de {
*
* @return Snapshot for the chosen and prepared variant of Material.
*/
MaterialSnapshot const &prepare(material_t &material, materialvariantspecification_t const &spec,
MaterialSnapshot const &prepare(material_t &material, MaterialVariantSpec const &spec,
bool smooth, bool forceSnapshotUpdate = false);

/**
Expand All @@ -308,7 +308,7 @@ namespace de {
*
* @return Chosen variant; otherwise @c NULL if none suitable and not creating.
*/
MaterialVariant *chooseVariant(material_t &material, materialvariantspecification_t const &spec,
MaterialVariant *chooseVariant(material_t &material, MaterialVariantSpec const &spec,
bool smoothed, bool canCreate);

/// @todo Refactor away -ds
Expand Down

0 comments on commit 705db31

Please sign in to comment.