diff options
| author | xolatile | 2025-08-17 18:28:28 +0200 |
|---|---|---|
| committer | xolatile | 2025-08-17 18:28:28 +0200 |
| commit | bffe8d11bd1dfec49280fb64a17f0ae529ac3f5d (patch) | |
| tree | 9f4f7b6f5003585e5a170bd55ccaa335b8f26f90 /src/engine/animmodel.h | |
| parent | bec4167d29a68efd0cd2da36143e7f1c78a119a0 (diff) | |
| download | xolatile-badassbug-master.tar.xz xolatile-badassbug-master.tar.zst | |
Diffstat (limited to 'src/engine/animmodel.h')
| -rw-r--r-- | src/engine/animmodel.h | 67 |
1 files changed, 4 insertions, 63 deletions
diff --git a/src/engine/animmodel.h b/src/engine/animmodel.h index e94aea5..da90969 100644 --- a/src/engine/animmodel.h +++ b/src/engine/animmodel.h @@ -133,9 +133,6 @@ struct animmodel : model { void cleanup() { if(shader && shader->standard) shader = NULL; } - void preloadBIH() { - if(tex->type&Texture::ALPHA && !tex->alphamask) loadalphamask(tex); - } void preloadshader() { //~if(force) cleanup(); loadshader(); @@ -148,8 +145,7 @@ struct animmodel : model { else if(cullface && !enablecullface) { glEnable(GL_CULL_FACE); enablecullface = true; } if(as->cur.anim&ANIM_NOSKIN) { if(enablealphablend) { glDisable(GL_BLEND); enablealphablend = false; } - if(shadowmapping) SETMODELSHADER(b, shadowmapcaster); - else /*if(as->cur.anim&ANIM_SHADOW)*/ SETMODELSHADER(b, notexturemodel); + else SETMODELSHADER(b, notexturemodel); return; } setshader(b); @@ -196,22 +192,6 @@ struct animmodel : model { DELETEA(name); } virtual void calcbb(vec &bbmin, vec &bbmax, const matrix4x3 &m) = 0; - virtual void genBIH(BIH::mesh &m) = 0; - void genBIH(skin &s, vector<BIH::mesh> &bih, const matrix4x3 &t) { - BIH::mesh &m = bih.add(); - m.xform = t; - m.tex = s.tex; - if(s.tex->type&Texture::ALPHA) m.flags |= BIH::MESH_ALPHA; - if(noclip) m.flags |= BIH::MESH_NOCLIP; - if(s.cullface) m.flags |= BIH::MESH_CULLFACE; - genBIH(m); - while(bih.last().numtris > BIH::mesh::MAXTRIS) { - BIH::mesh &overflow = bih.dup(); - overflow.tris += BIH::mesh::MAXTRIS; - overflow.numtris -= BIH::mesh::MAXTRIS; - bih[bih.length()-2].numtris = BIH::mesh::MAXTRIS; - } - } virtual void setshader(Shader *s) { s->set(); } @@ -357,9 +337,6 @@ struct animmodel : model { void calcbb(vec &bbmin, vec &bbmax, const matrix4x3 &m) { loopv(meshes) meshes[i]->calcbb(bbmin, bbmax, m); } - void genBIH(vector<skin> &skins, vector<BIH::mesh> &bih, const matrix4x3 &t) { - loopv(meshes) meshes[i]->genBIH(skins[i], bih, t); - } virtual void *animkey() { return this; } virtual int totalframes() const { return 1; } bool hasframe(int i) const { return i>=0 && i<totalframes(); } @@ -476,18 +453,6 @@ struct animmodel : model { links[i].p->calcbb(bbmin, bbmax, n); } } - void genBIH(vector<BIH::mesh> &bih, const matrix4x3 &m) { - matrix4x3 t = m; - t.scale(model->scale); - t.translate(translate); - meshes->genBIH(skins, bih, t); - loopv(links) { - matrix4x3 n; - meshes->concattagtransform(this, links[i].tag, m, n); - n.translate(links[i].translate, model->scale); - links[i].p->genBIH(bih, n); - } - } bool link(part *p, const char *tag, const vec &translate = vec(0, 0, 0), int anim = -1, int basetime = 0, vec *pos = NULL) { int i = meshes ? meshes->findtag(tag) : -1; if(i<0) { @@ -524,9 +489,6 @@ struct animmodel : model { loopv(skins) if(skins[i].tangents()) return true; return false; } - void preloadBIH() { - loopv(skins) skins[i].preloadBIH(); - } void preloadshaders() { loopv(skins) skins[i].preloadshader(); } @@ -600,11 +562,7 @@ struct animmodel : model { animinterpinfo &ai = d->animinterp[interp]; if((info.anim&ANIM_CLAMP)==ANIM_CLAMP) aitime = min(aitime, int(info.range*info.speed*0.5e-3f)); void *ak = meshes->animkey(); - if(d->ragdoll && !(anim&ANIM_RAGDOLL)) { - ai.prev.range = ai.cur.range = 0; - ai.lastswitch = -1; - } - else if(ai.lastmodel!=ak || ai.lastswitch<0 || lastmillis-d->lastrendered>aitime) { + if(ai.lastmodel!=ak || ai.lastswitch<0 || lastmillis-d->lastrendered>aitime) { ai.prev = ai.cur = info; ai.lastswitch = lastmillis-aitime*2; } @@ -653,7 +611,7 @@ struct animmodel : model { matrixstack[matrixpos].transposedtransformnormal(forward, oforward); if(!(anim&ANIM_NORENDER)) { matrix4 modelmatrix; - modelmatrix.mul(shadowmapping ? shadowmatrix : camprojmatrix, matrixstack[matrixpos]); + modelmatrix.mul(camprojmatrix, matrixstack[matrixpos]); if(model->scale!=1) modelmatrix.scale(model->scale); if(!translate.iszero()) modelmatrix.translate(translate); GLOBALPARAM(modelmatrix, modelmatrix); @@ -769,7 +727,7 @@ struct animmodel : model { vec axis(0, -1, 0), forward(1, 0, 0); matrixpos = 0; matrixstack[0].identity(); - if(!d || !d->ragdoll || anim&ANIM_RAGDOLL) { + if(!d) { matrixstack[0].settranslation(o); matrixstack[0].rotate_around_z(yaw*RAD); matrixstack[0].transformnormal(vec(axis), axis); @@ -836,23 +794,6 @@ struct animmodel : model { if(offsetyaw) m.rotate_around_z(offsetyaw*RAD); if(offsetpitch) m.rotate_around_y(-offsetpitch*RAD); } - void genBIH(vector<BIH::mesh> &bih) { - if(parts.empty()) return; - matrix4x3 m; - initmatrix(m); - parts[0]->genBIH(bih, m); - } - void preloadBIH() { - model::preloadBIH(); - if(bih) loopv(parts) parts[i]->preloadBIH(); - } - BIH *setBIH() { - if(bih) return bih; - vector<BIH::mesh> meshes; - genBIH(meshes); - bih = new BIH(meshes); - return bih; - } bool link(part *p, const char *tag, const vec &translate = vec(0, 0, 0), int anim = -1, int basetime = 0, vec *pos = NULL) { if(parts.empty()) return false; return parts[0]->link(p, tag, translate, anim, basetime, pos); |
