-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
rend_model.h
137 lines (120 loc) · 4.17 KB
/
rend_model.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/** @file rend_model.h Model renderer (v2.1).
*
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2007-2015 Daniel Swanson <danij@dengine.net>
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
*
* <small>This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. This program is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details. You should have received a copy of the GNU
* General Public License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA</small>
*/
#ifndef CLIENT_RENDER_MODEL_H
#define CLIENT_RENDER_MODEL_H
#include "ModelDef"
#include "rend_main.h"
#include "render/modelrenderer.h"
#include <de/Vector>
#include <de/ModelBank>
#include <de/ModelDrawable>
class TextureVariantSpec;
class StateAnimator;
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.
* @ingroup render
*/
struct drawmodelparams_t
{
// 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:
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;
ModelRenderer::AuxiliaryData const *auxData;
StateAnimator const *animator;
};
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.
*/
void Rend_ModelRegister();
/**
* Initialize this module.
*/
void Rend_ModelInit();
/**
* Shuts down this module.
*/
void Rend_ModelShutdown();
/**
* Expand the render buffer to accommodate rendering models containing at most
* this number of vertices.
*
* @note It is not actually necessary to call this. The vertex buffer will be
* enlarged automatically at render time to accommodate a given model so
* long as it contains less than RENDER_MAX_MODEL_VERTS. If not the model
* will simply not be rendered at all.
*
* @note Buffer reallocation is deferred until necessary, so repeatedly calling
* this routine during initialization is OK.
*
* @param numVertices New maximum number of vertices we'll be required to handle.
*
* @return @c true= successfully expanded. May fail if @a numVertices is larger
* than RENDER_MAX_MODEL_VERTS.
*/
bool Rend_ModelExpandVertexBuffers(de::duint numVertices);
/**
* Lookup the texture specification for diffuse model skins.
*
* @param noCompression @c true= disable texture compression.
* @return Specification to be used when preparing such textures.
*/
TextureVariantSpec const &Rend_ModelDiffuseTextureSpec(bool noCompression);
/**
* Lookup the texture specification for shiny model skins.
*
* @return Specification to be used when preparing such textures.
*/
TextureVariantSpec const &Rend_ModelShinyTextureSpec();
/**
* Render all the submodels of a model.
*/
void Rend_DrawModel(vissprite_t const &spr);
#endif // CLIENT_RENDER_MODEL_H