Skip to content

Commit

Permalink
Renderer|Client: Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed May 2, 2015
1 parent 1328c46 commit c7fc315
Show file tree
Hide file tree
Showing 8 changed files with 455 additions and 466 deletions.
1 change: 0 additions & 1 deletion doomsday/client/include/de_render.h
Expand Up @@ -37,7 +37,6 @@
#include "render/rendpoly.h"
#include "render/billboard.h"
#include "render/cameralensfx.h"
#include "render/vissprite.h"
#endif

#include "r_util.h"
Expand Down
74 changes: 41 additions & 33 deletions doomsday/client/include/render/billboard.h
@@ -1,6 +1,4 @@
/** @file billboard.h Rendering billboard "sprites".
*
* @ingroup render
*
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2007-2015 Daniel Swanson <danij@dengine.net>
Expand All @@ -20,62 +18,68 @@
* 02110-1301 USA</small>
*/

#ifndef DENG_CLIENT_RENDER_BILLBOARD_H
#define DENG_CLIENT_RENDER_BILLBOARD_H
#ifndef CLIENT_RENDER_BILLBOARD_H
#define CLIENT_RENDER_BILLBOARD_H

#include "dd_types.h"
#include "Material"
#include "MaterialAnimator"
#include "MaterialVariantSpec"

class BspLeaf;
struct vissprite_t;

/**
* Billboard drawing arguments for a masked wall.
*
* A sort of a sprite, I guess... Masked walls must be rendered sorted with
* sprites, so no artifacts appear when sprites are seen behind masked walls.
*
* @ingroup render
*/
struct drawmaskedwallparams_t
{
MaterialAnimator *animator;
blendmode_t blendMode; ///< Blendmode to be used when drawing (two sided mid textures only)
blendmode_t blendMode; ///< Blendmode to be used when drawing (two sided mid textures only)

struct wall_vertex_s {
float pos[3]; ///< x y and z coordinates.
float color[4];
de::dfloat pos[3]; ///< x y and z coordinates.
de::dfloat color[4];
} vertices[4];

double texOffset[2];
float texCoord[2][2]; ///< u and v coordinates.
de::ddouble texOffset[2];
de::dfloat texCoord[2][2]; ///< u and v coordinates.

DGLuint modTex; ///< Texture to modulate with.
float modTexCoord[2][2]; ///< [top-left, bottom-right][x, y]
float modColor[4];
DGLuint modTex; ///< Texture to modulate with.
de::dfloat modTexCoord[2][2]; ///< [top-left, bottom-right][x, y]
de::dfloat modColor[4];
};

void Rend_DrawMaskedWall(drawmaskedwallparams_t const &parms);

/**
* Billboard drawing arguments for a "player" sprite (HUD sprite).
* @ingroup render
*/
struct rendpspriteparams_t
{
float pos[2]; ///< [X, Y] Screen-space position.
float width, height;
de::dfloat pos[2]; ///< [X, Y] Screen-space position.
de::dfloat width;
de::dfloat height;

Material *mat;
float texOffset[2];
dd_bool texFlip[2]; ///< [X, Y] Flip along the specified axis.
de::dfloat texOffset[2];
dd_bool texFlip[2]; ///< [X, Y] Flip along the specified axis.

float ambientColor[4];
uint vLightListIdx;
de::dfloat ambientColor[4];
de::duint vLightListIdx;
};

void Rend_DrawPSprite(rendpspriteparams_t const &parms);

/**
* Billboard drawing arguments for a map entity, sprite visualization.
* @ingroup render
*/
struct drawspriteparams_t
{
Expand All @@ -86,12 +90,13 @@ struct drawspriteparams_t
BspLeaf *bspLeaf;
};

void Rend_DrawSprite(struct vissprite_s const &spr);
void Rend_DrawSprite(vissprite_t const &spr);

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

/**
* @defgroup rendFlareFlags Flare renderer flags
* @ingroup render
* @{
*/
#define RFF_NO_PRIMARY 0x1 ///< Do not draw a primary flare (aka halo).
Expand All @@ -102,26 +107,29 @@ de::MaterialVariantSpec const &Rend_SpriteMaterialSpec(int tclass = 0, int tmap
* Billboard drawing arguments for a lens flare.
*
* @see H_RenderHalo()
* @ingroup render
*/
struct drawflareparams_t
{
byte flags; ///< @ref rendFlareFlags.
int size;
float color[3];
byte factor;
float xOff;
de::dbyte flags; ///< @ref rendFlareFlags.
de::dint size;
de::dfloat color[3];
de::dbyte factor;
de::dfloat xOff;
DGLuint tex; ///< Flaremap if flareCustom ELSE (flaretexName id. Zero = automatical)
float mul; ///< Flare brightness factor.
de::dfloat mul; ///< Flare brightness factor.
dd_bool isDecoration;
int lumIdx;
de::dint lumIdx;
};

DENG_EXTERN_C int alwaysAlign;
DENG_EXTERN_C int spriteLight, useSpriteAlpha, useSpriteBlend;
DENG_EXTERN_C int noSpriteZWrite;
DENG_EXTERN_C byte noSpriteTrans;
DENG_EXTERN_C byte devNoSprites;
DENG_EXTERN_C de::dint alwaysAlign;
DENG_EXTERN_C de::dint spriteLight;
DENG_EXTERN_C de::dint useSpriteAlpha;
DENG_EXTERN_C de::dint useSpriteBlend;
DENG_EXTERN_C de::dint noSpriteZWrite;
DENG_EXTERN_C de::dbyte noSpriteTrans;
DENG_EXTERN_C de::dbyte devNoSprites;

DENG_EXTERN_C void Rend_SpriteRegister();

#endif // DENG_CLIENT_RENDER_BILLBOARD_H
#endif // CLIENT_RENDER_BILLBOARD_H
78 changes: 38 additions & 40 deletions doomsday/client/include/render/rend_model.h
@@ -1,9 +1,7 @@
/** @file rend_model.h Model renderer (v2.1).
*
* @ingroup render
*
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2007-2013 Daniel Swanson <danij@dengine.net>
* @authors Copyright © 2007-2015 Daniel Swanson <danij@dengine.net>
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
Expand All @@ -20,63 +18,63 @@
* 02110-1301 USA</small>
*/

#ifndef DENG_CLIENT_RENDER_MODEL_H
#define DENG_CLIENT_RENDER_MODEL_H
#ifndef CLIENT_RENDER_MODEL_H
#define CLIENT_RENDER_MODEL_H

#include "ModelDef"
#include "rend_main.h"
#include <de/Vector>
#include <de/ModelDrawable>

class TextureVariantSpec;
struct vissprite_t;

/// Absolute maximum number of vertices per submodel supported by this module.
#define RENDER_MAX_MODEL_VERTS 16192

/// @todo Split this large inflexible structure into logical subcomponent pieces.
/**
* @todo Split this large inflexible structure into logical subcomponent pieces.
* @ingroup render
*/
struct drawmodelparams_t
{
// Animation, frame interpolation:
ModelDef *mf, *nextMF;
float inter;
dd_bool alwaysInterpolate;
int id; // For a unique skin offset.
int selector;

// Position/Orientation/Scale:
//VisModelPose pose;

// Appearance:
int flags; // Mobj flags.
int tmap;

// Lighting/color:
//VisModelLighting light;
// Animation, frame interpolation:
ModelDef *mf;
ModelDef *nextMF;
de::dfloat inter;
dd_bool alwaysInterpolate;
de::dint id; ///< For a unique skin offset.
de::dint selector;

// Appearance:
de::dint flags; ///< Mobj flags.
de::dint tmap;

// Shiney texture mapping:
float shineYawOffset;
float shinePitchOffset;
dd_bool shineTranslateWithViewerPos;
dd_bool shinepspriteCoordSpace; // Use the psprite coordinate space hack.
de::dfloat shineYawOffset;
de::dfloat shinePitchOffset;
dd_bool shineTranslateWithViewerPos;
dd_bool shinepspriteCoordSpace; ///< Use the psprite coordinate space hack.
};

/// @ingroup render
struct drawmodel2params_t
{
struct mobj_s const *object;
de::ModelDrawable const *model;
de::ModelDrawable::Animator const *animator;
};

DENG_EXTERN_C byte useModels;
DENG_EXTERN_C int modelLight;
DENG_EXTERN_C int frameInter;
DENG_EXTERN_C float modelAspectMod;
DENG_EXTERN_C int mirrorHudModels;
DENG_EXTERN_C int modelShinyMultitex;
DENG_EXTERN_C float modelSpinSpeed;
DENG_EXTERN_C int maxModelDistance;
DENG_EXTERN_C float rendModelLOD;
DENG_EXTERN_C byte precacheSkins;
DENG_EXTERN_C de::dbyte useModels;
DENG_EXTERN_C de::dint modelLight;
DENG_EXTERN_C de::dint frameInter;
DENG_EXTERN_C de::dfloat modelAspectMod;
DENG_EXTERN_C de::dint mirrorHudModels;
DENG_EXTERN_C de::dint modelShinyMultitex;
DENG_EXTERN_C de::dfloat modelSpinSpeed;
DENG_EXTERN_C de::dint maxModelDistance;
DENG_EXTERN_C de::dfloat rendModelLOD;
DENG_EXTERN_C de::dbyte precacheSkins;

/**
* Registers the console commands and variables used by this module.
Expand Down Expand Up @@ -110,7 +108,7 @@ void Rend_ModelShutdown();
* @return @c true= successfully expanded. May fail if @a numVertices is larger
* than RENDER_MAX_MODEL_VERTS.
*/
bool Rend_ModelExpandVertexBuffers(uint numVertices);
bool Rend_ModelExpandVertexBuffers(de::duint numVertices);

/**
* Lookup the texture specification for diffuse model skins.
Expand All @@ -130,13 +128,13 @@ TextureVariantSpec const &Rend_ModelShinyTextureSpec();
/**
* Render all the submodels of a model.
*/
void Rend_DrawModel(struct vissprite_s const &spr);
void Rend_DrawModel(vissprite_t const &spr);

/**
* Render a GL2 model.
*
* @param parms Parameters for the draw operation.
*/
void Rend_DrawModel2(struct vissprite_s const &spr);
void Rend_DrawModel2(vissprite_t const &spr);

#endif // DENG_CLIENT_RENDER_MODEL_H
#endif // CLIENT_RENDER_MODEL_H

0 comments on commit c7fc315

Please sign in to comment.