From 9234eeb1d2954a3dae6c84ffa8ed8643953272c5 Mon Sep 17 00:00:00 2001 From: xolatile Date: Tue, 5 Aug 2025 15:27:57 +0200 Subject: Experimental MD3 to OBJ to IQM converter and code removal, shit compiles... --- src/engine/renderva.cpp | 154 ++++-------------------------------------------- 1 file changed, 11 insertions(+), 143 deletions(-) (limited to 'src/engine/renderva.cpp') diff --git a/src/engine/renderva.cpp b/src/engine/renderva.cpp index 4f6e7a5..854f569 100644 --- a/src/engine/renderva.cpp +++ b/src/engine/renderva.cpp @@ -591,54 +591,6 @@ void renderoutline() gle::disablevertex(); } -HVAR(blendbrushcolor, 0, 0x0000C0, 0xFFFFFF); - -void renderblendbrush(GLuint tex, float x, float y, float w, float h) -{ - SETSHADER(blendbrush); - - gle::enablevertex(); - - glDepthFunc(GL_LEQUAL); - - glEnable(GL_BLEND); - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - - glBindTexture(GL_TEXTURE_2D, tex); - gle::color(vec::hexcolor(blendbrushcolor), 0.25f); - - LOCALPARAMF(texgenS, 1.0f/w, 0, 0, -x/w); - LOCALPARAMF(texgenT, 0, 1.0f/h, 0, -y/h); - - vtxarray *prev = NULL; - for(vtxarray *va = visibleva; va; va = va->next) - { - if(!va->texs || va->occluded >= OCCLUDE_GEOM) continue; - if(va->o.x + va->size <= x || va->o.y + va->size <= y || va->o.x >= x + w || va->o.y >= y + h) continue; - - if(!prev || va->vbuf != prev->vbuf) - { - gle::bindvbo(va->vbuf); - gle::bindebo(va->ebuf); - const vertex *ptr = 0; - gle::vertexpointer(sizeof(vertex), ptr->pos.v); - } - - drawvatris(va, 3*va->tris, va->edata); - xtravertsva += va->verts; - - prev = va; - } - - glDisable(GL_BLEND); - - glDepthFunc(GL_LESS); - - gle::clearvbo(); - gle::clearebo(); - gle::disablevertex(); -} - void rendershadowmapreceivers() { SETSHADER(shadowmapreceiver); @@ -689,67 +641,6 @@ void rendershadowmapreceivers() gle::disablevertex(); } -void renderdepthobstacles(const vec &bbmin, const vec &bbmax, float scale, float *ranges, int numranges) -{ - float scales[4] = { 0, 0, 0, 0 }, offsets[4] = { 0, 0, 0, 0 }; - if(numranges < 0) - { - SETSHADER(depthfxsplitworld); - - loopi(-numranges) - { - if(!i) scales[i] = 1.0f/scale; - else scales[i] = scales[i-1]*256; - } - } - else - { - SETSHADER(depthfxworld); - - if(!numranges) loopi(4) scales[i] = 1.0f/scale; - else loopi(numranges) - { - scales[i] = 1.0f/scale; - offsets[i] = -ranges[i]/scale; - } - } - LOCALPARAMF(depthscale, scales[0], scales[1], scales[2], scales[3]); - LOCALPARAMF(depthoffsets, offsets[0], offsets[1], offsets[2], offsets[3]); - - gle::enablevertex(); - - vtxarray *prev = NULL; - for(vtxarray *va = visibleva; va; va = va->next) - { - if(!va->texs || va->occluded >= OCCLUDE_GEOM || - va->o.x > bbmax.x || va->o.y > bbmax.y || va->o.z > bbmax.z || - va->o.x + va->size < bbmin.x || va->o.y + va->size < bbmin.y || va->o.z + va->size < bbmin.z) - continue; - - if(!prev || va->vbuf != prev->vbuf) - { - gle::bindvbo(va->vbuf); - gle::bindebo(va->ebuf); - const vertex *ptr = 0; - gle::vertexpointer(sizeof(vertex), ptr->pos.v); - } - - drawvatris(va, 3*va->tris, va->edata); - xtravertsva += va->verts; - if(va->alphatris > 0) - { - drawvatris(va, 3*va->alphatris, va->edata + 3*(va->tris + va->blendtris)); - xtravertsva += 3*va->alphatris; - } - - prev = va; - } - - gle::clearvbo(); - gle::clearebo(); - gle::disablevertex(); -} - VAR(oqdist, 0, 256, 1024); VAR(zpass, 0, 1, 1); VAR(envpass, 0, 1, 1); @@ -843,8 +734,6 @@ struct geombatch if(es.texture > b.es.texture) return 1; if(es.lmid < b.es.lmid) return -1; if(es.lmid > b.es.lmid) return 1; - if(es.envmap < b.es.envmap) return -1; - if(es.envmap > b.es.envmap) return 1; if(es.dim < b.es.dim) return -1; if(es.dim > b.es.dim) return 1; return 0; @@ -998,16 +887,7 @@ static void changebatchtmus(renderstate &cur, int pass, geombatch &b) } tmu++; } - if(b.vslot.slot->shader->type&SHADER_ENVMAP && b.es.envmap!=EMID_CUSTOM) - { - GLuint emtex = lookupenvmap(b.es.envmap); - if(cur.textures[tmu]!=emtex) - { - glActiveTexture_(GL_TEXTURE0+tmu); - glBindTexture(GL_TEXTURE_CUBE_MAP, cur.textures[tmu] = emtex); - changed = true; - } - } + if(changed) glActiveTexture_(GL_TEXTURE0); if(cur.dynlightmask != b.va->dynlightmask) @@ -1041,30 +921,18 @@ static void changeslottmus(renderstate &cur, int pass, Slot &slot, VSlot &vslot) cur.colorscale = vslot.colorscale; GLOBALPARAMF(colorparams, 2*vslot.colorscale.x, 2*vslot.colorscale.y, 2*vslot.colorscale.z, 1); } - int tmu = 2, envmaptmu = -1; + int tmu = 2; if(slot.shader->type&SHADER_NORMALSLMS) tmu++; - if(slot.shader->type&SHADER_ENVMAP) envmaptmu = tmu++; loopvj(slot.sts) { Slot::Tex &t = slot.sts[j]; if(t.type==TEX_DIFFUSE || t.combined>=0) continue; - if(t.type==TEX_ENVMAP) + if(cur.textures[tmu]!=t.t->id) { - if(envmaptmu>=0 && t.t && cur.textures[envmaptmu]!=t.t->id) - { - glActiveTexture_(GL_TEXTURE0+envmaptmu); - glBindTexture(GL_TEXTURE_CUBE_MAP, cur.textures[envmaptmu] = t.t->id); - } - } - else - { - if(cur.textures[tmu]!=t.t->id) - { - glActiveTexture_(GL_TEXTURE0+tmu); - glBindTexture(GL_TEXTURE_2D, cur.textures[tmu] = t.t->id); - } - if(++tmu >= 8) break; + glActiveTexture_(GL_TEXTURE0+tmu); + glBindTexture(GL_TEXTURE_2D, cur.textures[tmu] = t.t->id); } + if(++tmu >= 8) break; } glActiveTexture_(GL_TEXTURE0); @@ -1074,7 +942,7 @@ static void changeslottmus(renderstate &cur, int pass, Slot &slot, VSlot &vslot) static void changeshader(renderstate &cur, Shader *s, Slot &slot, VSlot &vslot, bool shadowed) { - if(fading && !cur.blending && !cur.alphaing) + if(!cur.blending && !cur.alphaing) { if(shadowed) s->setvariant(cur.visibledynlights, 3, slot, vslot); else s->setvariant(cur.visibledynlights, 2, slot, vslot); @@ -1257,7 +1125,7 @@ void renderva(renderstate &cur, vtxarray *va, int pass = RENDERPASS_LIGHTMAP, bo if(!cur.alphaing) vverts += va->verts; va->shadowed = false; va->dynlightmask = 0; - if(!drawtex && !glaring && !cur.alphaing) + if(!drawtex && !cur.alphaing) { va->shadowed = isshadowmapreceiver(va); calcdynlightmask(va); @@ -1326,10 +1194,10 @@ VAR(oqgeom, 0, 1, 1); void rendergeom(void) { - bool mainpass = !drawtex && !glaring, + bool mainpass = !drawtex, doOQ = oqfrags && oqgeom && mainpass, doZP = doOQ && zpass, - doSM = shadowmap && !drawtex && !glaring; + doSM = shadowmap && !drawtex; renderstate cur; if(mainpass) { @@ -1518,5 +1386,5 @@ void renderalphageom(void) if(!front) glCullFace(GL_BACK); } - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, fading ? GL_FALSE : GL_TRUE); + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); } -- cgit v1.2.3