1 /** @file billboard.h Rendering billboard "sprites". 2 * 3 * @authors Copyright © 2003-2017 Jaakko Keränen <jaakko.keranen@iki.fi> 4 * @authors Copyright © 2007-2015 Daniel Swanson <danij@dengine.net> 5 * 6 * @par License 7 * GPL: http://www.gnu.org/licenses/gpl.html 8 * 9 * <small>This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by the 11 * Free Software Foundation; either version 2 of the License, or (at your 12 * option) any later version. This program is distributed in the hope that it 13 * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty 14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 15 * Public License for more details. You should have received a copy of the GNU 16 * General Public License along with this program; if not, write to the Free 17 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 18 * 02110-1301 USA</small> 19 */ 20 21 #ifndef DENG_CLIENT_RENDER_BILLBOARD_H 22 #define DENG_CLIENT_RENDER_BILLBOARD_H 23 24 #include "dd_types.h" 25 #include "ClientMaterial" 26 #include "MaterialAnimator" 27 #include "MaterialVariantSpec" 28 29 namespace world { class BspLeaf; } 30 struct vissprite_t; 31 32 /** 33 * Billboard drawing arguments for a masked wall. 34 * 35 * A sort of a sprite, I guess... Masked walls must be rendered sorted with 36 * sprites, so no artifacts appear when sprites are seen behind masked walls. 37 * 38 * @ingroup render 39 */ 40 struct drawmaskedwallparams_t 41 { 42 MaterialAnimator *animator; 43 blendmode_t blendMode; ///< Blendmode to be used when drawing (two sided mid textures only) 44 45 struct wall_vertex_s { 46 de::dfloat pos[3]; ///< x y and z coordinates. 47 de::dfloat color[4]; 48 } vertices[4]; 49 50 de::ddouble texOffset[2]; 51 de::dfloat texCoord[2][2]; ///< u and v coordinates. 52 53 DGLuint modTex; ///< Texture to modulate with. 54 de::dfloat modTexCoord[2][2]; ///< [top-left, bottom-right][x, y] 55 de::dfloat modColor[4]; 56 }; 57 58 void Rend_DrawMaskedWall(drawmaskedwallparams_t const &parms); 59 60 /** 61 * Billboard drawing arguments for a "player" sprite (HUD sprite). 62 * @ingroup render 63 */ 64 struct rendpspriteparams_t 65 { 66 de::dfloat pos[2]; ///< [X, Y] Screen-space position. 67 de::dfloat width; 68 de::dfloat height; 69 70 ClientMaterial *mat; 71 de::dfloat texOffset[2]; 72 dd_bool texFlip[2]; ///< [X, Y] Flip along the specified axis. 73 74 de::dfloat ambientColor[4]; 75 de::duint vLightListIdx; 76 }; 77 78 void Rend_DrawPSprite(rendpspriteparams_t const &parms); 79 80 /** 81 * Billboard drawing arguments for a map entity, sprite visualization. 82 * @ingroup render 83 */ 84 struct drawspriteparams_t 85 { 86 dd_bool noZWrite; 87 blendmode_t blendMode; 88 MaterialAnimator *matAnimator; 89 dd_bool matFlip[2]; ///< [S, T] Flip along the specified axis. 90 world::BspLeaf *bspLeaf; 91 }; 92 93 void Rend_DrawSprite(vissprite_t const &spr); 94 95 de::MaterialVariantSpec const &Rend_SpriteMaterialSpec(de::dint tclass = 0, de::dint tmap = 0); 96 97 /** 98 * @defgroup rendFlareFlags Flare renderer flags 99 * @ingroup render 100 * @{ 101 */ 102 #define RFF_NO_PRIMARY 0x1 ///< Do not draw a primary flare (aka halo). 103 #define RFF_NO_TURN 0x2 ///< Flares do not turn in response to viewangle/viewdir 104 /**@}*/ 105 106 /** 107 * Billboard drawing arguments for a lens flare. 108 * 109 * @see H_RenderHalo() 110 * @ingroup render 111 */ 112 struct drawflareparams_t 113 { 114 de::dbyte flags; ///< @ref rendFlareFlags. 115 de::dint size; 116 de::dfloat color[3]; 117 de::dbyte factor; 118 de::dfloat xOff; 119 DGLuint tex; ///< Flaremap if flareCustom ELSE (flaretexName id. Zero = automatical) 120 de::dfloat mul; ///< Flare brightness factor. 121 dd_bool isDecoration; 122 de::dint lumIdx; 123 }; 124 125 DENG_EXTERN_C de::dint alwaysAlign; 126 DENG_EXTERN_C de::dint spriteLight; 127 DENG_EXTERN_C de::dint useSpriteAlpha; 128 DENG_EXTERN_C de::dint useSpriteBlend; 129 DENG_EXTERN_C de::dint noSpriteZWrite; 130 DENG_EXTERN_C de::dbyte noSpriteTrans; 131 DENG_EXTERN_C de::dbyte devNoSprites; 132 133 DENG_EXTERN_C void Rend_SpriteRegister(); 134 135 #endif // CLIENT_RENDER_BILLBOARD_H 136