summaryrefslogtreecommitdiff
path: root/src/engine/animmodel.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/animmodel.h')
-rw-r--r--src/engine/animmodel.h81
1 files changed, 10 insertions, 71 deletions
diff --git a/src/engine/animmodel.h b/src/engine/animmodel.h
index a7ed257..13705f4 100644
--- a/src/engine/animmodel.h
+++ b/src/engine/animmodel.h
@@ -68,9 +68,9 @@ struct animmodel : model
struct shaderparams
{
- float spec, ambient, fullbright, envmapmin, envmapmax, scrollu, scrollv, alphatest;
+ float spec, ambient, fullbright, scrollu, scrollv, alphatest;
- shaderparams() : spec(1.0f), ambient(0.3f), fullbright(0), envmapmin(0), envmapmax(0), scrollu(0), scrollv(0), alphatest(0.9f) {}
+ shaderparams() : spec(1.0f), ambient(0.3f), fullbright(0), scrollu(0), scrollv(0), alphatest(0.9f) {}
};
struct shaderparamskey
@@ -105,15 +105,14 @@ struct animmodel : model
struct skin : shaderparams
{
part *owner;
- Texture *tex, *masks, *envmap, *normalmap;
+ Texture *tex, *masks, *normalmap;
Shader *shader;
bool alphablend, cullface;
shaderparamskey *key;
- skin() : owner(0), tex(notexture), masks(notexture), envmap(NULL), normalmap(NULL), shader(NULL), alphablend(true), cullface(true), key(NULL) {}
+ skin() : owner(0), tex(notexture), masks(notexture), normalmap(NULL), shader(NULL), alphablend(true), cullface(true), key(NULL) {}
bool masked() const { return masks != notexture; }
- bool envmapped() { return envmapmax>0 && envmapmodels; }
bool bumpmapped() { return normalmap && bumpmodels; }
bool tangents() { return bumpmapped(); }
bool alphatested() const { return alphatest > 0 && tex->type&Texture::ALPHA; }
@@ -152,15 +151,7 @@ struct animmodel : model
minshade = scale*max(ambient, mincolor);
LOCALPARAMF(lightscale, scale - minshade, scale, minshade + bias);
}
- float curglow = glow;
- if(glowpulse > 0)
- {
- float curpulse = lastmillis*glowpulse;
- curpulse -= floor(curpulse);
- curglow += glowdelta*2*fabs(curpulse - 0.5f);
- }
LOCALPARAMF(texscroll, scrollu*lastmillis/1000.0f, scrollv*lastmillis/1000.0f);
- if(envmapped()) LOCALPARAMF(envmapscale, envmapmin-envmapmax, envmapmax);
}
Shader *loadshader()
@@ -180,7 +171,6 @@ struct animmodel : model
if(alphatested()) opts[optslen++] = 'a';
if(owner->tangents()) opts[optslen++] = 'q';
if(bumpmapped()) opts[optslen++] = 'n';
- if(envmapped()) opts[optslen++] = 'e';
if(masked()) opts[optslen++] = 'm';
if(!fullbright && (masked() || spec>=0.01f)) opts[optslen++] = 's';
opts[optslen++] = '\0';
@@ -259,17 +249,6 @@ struct animmodel : model
glBindTexture(GL_TEXTURE_2D, masks->id);
lastmasks = masks;
}
- if(envmapped())
- {
- GLuint emtex = envmap ? envmap->id : closestenvmaptex;
- if(lastenvmaptex!=emtex)
- {
- glActiveTexture_(GL_TEXTURE2);
- activetmu = 2;
- glBindTexture(GL_TEXTURE_CUBE_MAP, emtex);
- lastenvmaptex = emtex;
- }
- }
if(activetmu != 0) glActiveTexture_(GL_TEXTURE0);
}
};
@@ -314,8 +293,7 @@ struct animmodel : model
virtual void setshader(Shader *s)
{
- if(glaring) s->setvariant(0, 1);
- else s->set();
+ s->set();
}
template<class V, class T> void smoothnorms(V *verts, int numverts, T *tris, int numtris, float limit, bool areaweight)
@@ -716,12 +694,6 @@ struct animmodel : model
}
}
- bool envmapped()
- {
- loopv(skins) if(skins[i].envmapped()) return true;
- return false;
- }
-
bool tangents()
{
loopv(skins) if(skins[i].tangents()) return true;
@@ -902,8 +874,6 @@ struct animmodel : model
if(!(anim&ANIM_NOSKIN))
{
- if(envmapped()) GLOBALPARAM(modelworld, matrix3(matrixstack[matrixpos]));
-
vec odir, ocampos;
matrixstack[matrixpos].transposedtransformnormal(lightdir, odir);
GLOBALPARAM(lightdir, odir);
@@ -1077,14 +1047,6 @@ struct animmodel : model
transparent = trans;
lightdir = dir;
lightcolor = color;
-
- if(envmapped())
- {
- setupenvmap:
- closestenvmaptex = lookupenvmap(closestenvmap(o));
- GLOBALPARAM(lightdirworld, dir);
- }
- else if(a) for(int i = 0; a[i].tag; i++) if(a[i].m && a[i].m->envmapped()) goto setupenvmap;
}
if(depthoffset && !enabledepthoffset)
@@ -1104,7 +1066,7 @@ struct animmodel : model
{
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
render(anim|ANIM_NOSKIN, basetime, basetime2, pitch, axis, forward, d, a);
- glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, fading ? GL_FALSE : GL_TRUE);
+ glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glDepthFunc(GL_LEQUAL);
}
@@ -1196,12 +1158,6 @@ struct animmodel : model
return parts[0]->unlink(p);
}
- bool envmapped()
- {
- loopv(parts) if(parts[i]->envmapped()) return true;
- return false;
- }
-
virtual bool flipy() const { return false; }
virtual bool loadconfig() { return false; }
virtual bool loaddefaultparts() { return false; }
@@ -1241,21 +1197,6 @@ struct animmodel : model
loopv(parts) loopvj(parts[i]->skins) parts[i]->skins[j].shader = shader;
}
- void setenvmap(float envmapmin, float envmapmax, Texture *envmap)
- {
- if(parts.empty()) loaddefaultparts();
- loopv(parts) loopvj(parts[i]->skins)
- {
- skin &s = parts[i]->skins[j];
- if(envmapmax)
- {
- s.envmapmin = envmapmin;
- s.envmapmax = envmapmax;
- }
- if(envmap) s.envmap = envmap;
- }
- }
-
void setspec(float spec)
{
if(parts.empty()) loaddefaultparts();
@@ -1316,7 +1257,7 @@ struct animmodel : model
static bool enabletc, enablealphablend, enablecullface, enablenormals, enabletangents, enablebones, enabledepthoffset;
static vec lightdir, lightcolor;
static float transparent, lastalphatest;
- static GLuint lastvbuf, lasttcbuf, lastnbuf, lastxbuf, lastbbuf, lastebuf, lastenvmaptex, closestenvmaptex;
+ static GLuint lastvbuf, lasttcbuf, lastnbuf, lastxbuf, lastbbuf, lastebuf;
static Texture *lasttex, *lastmasks, *lastnormalmap;
static int matrixpos;
static matrix4 matrixstack[64];
@@ -1326,7 +1267,7 @@ struct animmodel : model
enabletc = enablealphablend = enablenormals = enabletangents = enablebones = enabledepthoffset = false;
enablecullface = true;
lastalphatest = -1;
- lastvbuf = lasttcbuf = lastxbuf = lastnbuf = lastbbuf = lastebuf = lastenvmaptex = closestenvmaptex = 0;
+ lastvbuf = lasttcbuf = lastxbuf = lastnbuf = lastbbuf = lastebuf = 0;
lasttex = lastmasks = lastnormalmap = NULL;
transparent = 1;
shaderparamskey::invalidate();
@@ -1387,7 +1328,7 @@ bool animmodel::enabletc = false, animmodel::enablealphablend = false,
vec animmodel::lightdir(0, 0, 1), animmodel::lightcolor(1, 1, 1);
float animmodel::transparent = 1, animmodel::lastalphatest = -1;
GLuint animmodel::lastvbuf = 0, animmodel::lasttcbuf = 0, animmodel::lastnbuf = 0, animmodel::lastxbuf = 0, animmodel::lastbbuf = 0,
- animmodel::lastebuf = 0, animmodel::lastenvmaptex = 0, animmodel::closestenvmaptex = 0;
+ animmodel::lastebuf = 0;
Texture *animmodel::lasttex = NULL, *animmodel::lastmasks = NULL, *animmodel::lastnormalmap = NULL;
int animmodel::matrixpos = 0;
matrix4 animmodel::matrixstack[64];
@@ -1468,14 +1409,12 @@ template<class MDL, class MESH> struct modelcommands
#define loopskins(meshname, s, body) loopmeshes(meshname, m, { skin &s = mdl.skins[i]; body; })
static void setskin(char *meshname, char *tex, char *masks, float *envmapmax, float *envmapmin)
- {
+ {(void)envmapmax;(void)envmapmin;
loopskins(meshname, s,
s.tex = textureload(makerelpath(MDL::dir, tex), 0, true, false);
if(*masks)
{
s.masks = textureload(makerelpath(MDL::dir, masks), 0, true, false);
- s.envmapmax = *envmapmax;
- s.envmapmin = *envmapmin;
}
);
}