summaryrefslogtreecommitdiff
path: root/src/engine/renderva.cpp
diff options
context:
space:
mode:
authorxolatile2025-08-05 10:40:01 +0200
committerxolatile2025-08-05 10:40:01 +0200
commita2a16b85572b1d28b0cd4901ea7348750732a740 (patch)
tree6287cdf8331e821f9fe1e0adadc664a59634a812 /src/engine/renderva.cpp
parent6762e292d02e37a69a807e01493d4e14319cca33 (diff)
downloadxolatile-badassbug-a2a16b85572b1d28b0cd4901ea7348750732a740.tar.xz
xolatile-badassbug-a2a16b85572b1d28b0cd4901ea7348750732a740.tar.zst
Few more changes, please do not compile...
Diffstat (limited to 'src/engine/renderva.cpp')
-rw-r--r--src/engine/renderva.cpp99
1 files changed, 15 insertions, 84 deletions
diff --git a/src/engine/renderva.cpp b/src/engine/renderva.cpp
index e0b74e2..4f6e7a5 100644
--- a/src/engine/renderva.cpp
+++ b/src/engine/renderva.cpp
@@ -32,7 +32,6 @@ int isvisiblesphere(float rad, const vec &cv)
if(dist < rad) v = VFC_PART_VISIBLE;
}
- if(dist > rad) return VFC_FOGGED; //VFC_NOT_VISIBLE; // culling when fog is closer than size of world results in HOM
if(dist > -rad) v = VFC_PART_VISIBLE;
return v;
@@ -56,7 +55,6 @@ int isvisiblecube(const ivec &o, int size)
if(dist < -vfcDnear[i]*size) v = VFC_PART_VISIBLE;
}
- if(dist > -vfcDnear[4]*size) return VFC_FOGGED;
if(dist > -vfcDfar[4]*size) v = VFC_PART_VISIBLE;
return v;
@@ -388,7 +386,7 @@ void findvisiblemms(const vector<extentity *> &ents, bool doquery)
lastvisiblemms = &visiblemms;
for(vtxarray *va = visibleva; va; va = va->next)
{
- if(va->mapmodels.empty() || va->curvfc >= VFC_FOGGED || va->occluded >= OCCLUDE_BB) continue;
+ if(va->mapmodels.empty() || va->occluded >= OCCLUDE_BB) continue;
loopv(va->mapmodels)
{
octaentities *oe = va->mapmodels[i];
@@ -502,7 +500,7 @@ static inline bool bboccluded(const ivec &bo, const ivec &br, cube *c, const ive
if(c[i].ext && c[i].ext->va)
{
vtxarray *va = c[i].ext->va;
- if(va->curvfc >= VFC_FOGGED || (va->occluded >= OCCLUDE_BB && bbinsideva(bo, br, va))) continue;
+ if(va->occluded >= OCCLUDE_BB && bbinsideva(bo, br, va)) continue;
}
if(c[i].children && bboccluded(bo, br, c[i].children, co, size>>1)) continue;
return false;
@@ -520,7 +518,7 @@ bool bboccluded(const ivec &bo, const ivec &br)
if(c->ext && c->ext->va)
{
vtxarray *va = c->ext->va;
- if(va->curvfc >= VFC_FOGGED || (va->occluded >= OCCLUDE_BB && bbinsideva(bo, br, va))) return true;
+ if(va->occluded >= OCCLUDE_BB && bbinsideva(bo, br, va)) return true;
}
scale--;
while(c->children && !(diff&(1<<scale)))
@@ -529,7 +527,7 @@ bool bboccluded(const ivec &bo, const ivec &br)
if(c->ext && c->ext->va)
{
vtxarray *va = c->ext->va;
- if(va->curvfc >= VFC_FOGGED || (va->occluded >= OCCLUDE_BB && bbinsideva(bo, br, va))) return true;
+ if(va->occluded >= OCCLUDE_BB && bbinsideva(bo, br, va)) return true;
}
scale--;
}
@@ -661,7 +659,7 @@ void rendershadowmapreceivers()
vtxarray *prev = NULL;
for(vtxarray *va = visibleva; va; va = va->next)
{
- if(!va->texs || va->curvfc >= VFC_FOGGED || !isshadowmapreceiver(va)) continue;
+ if(!va->texs || !isshadowmapreceiver(va)) continue;
if(!prev || va->vbuf != prev->vbuf)
{
@@ -815,8 +813,6 @@ enum
{
RENDERPASS_LIGHTMAP = 0,
RENDERPASS_Z,
- RENDERPASS_CAUSTICS,
- RENDERPASS_FOG,
RENDERPASS_LIGHTMAP_BLEND
};
@@ -1253,7 +1249,7 @@ void renderzpass(renderstate &cur, vtxarray *va)
VAR(batchgeom, 0, 1, 1);
-void renderva(renderstate &cur, vtxarray *va, int pass = RENDERPASS_LIGHTMAP, bool fogpass = false, bool doquery = false)
+void renderva(renderstate &cur, vtxarray *va, int pass = RENDERPASS_LIGHTMAP, bool doquery = false)
{
switch(pass)
{
@@ -1281,12 +1277,6 @@ void renderva(renderstate &cur, vtxarray *va, int pass = RENDERPASS_LIGHTMAP, bo
break;
}
- case RENDERPASS_FOG:
- if(cur.vbuf!=va->vbuf) changevbuf(cur, pass, va);
- drawvatris(va, 3*va->tris, va->edata);
- xtravertsva += va->verts;
- break;
-
case RENDERPASS_Z:
if(doquery) startvaquery(va, );
renderzpass(cur, va);
@@ -1318,7 +1308,7 @@ void cleanupgeom(renderstate &cur)
if(cur.vbuf) disablevbuf(cur);
}
-static void rendergeommultipass(renderstate &cur, int pass, bool fogpass)
+static void rendergeommultipass(renderstate &cur, int pass)
{
if(cur.vbuf) disablevbuf(cur);
if(!cur.vattribs) enablevattribs(cur, false);
@@ -1327,14 +1317,14 @@ static void rendergeommultipass(renderstate &cur, int pass, bool fogpass)
{
if(!va->texs) continue;
if(va->occluded >= OCCLUDE_GEOM) continue;
- renderva(cur, va, pass, fogpass);
+ renderva(cur, va, pass);
}
if(geombatches.length()) renderbatches(cur, pass);
}
VAR(oqgeom, 0, 1, 1);
-void rendergeom(bool fogpass)
+void rendergeom(void)
{
bool mainpass = !drawtex && !glaring,
doOQ = oqfrags && oqgeom && mainpass,
@@ -1392,7 +1382,7 @@ void rendergeom(bool fogpass)
}
if(!doZP) blends += va->blends;
- renderva(cur, va, doZP ? RENDERPASS_Z : RENDERPASS_LIGHTMAP, fogpass, doOQ);
+ renderva(cur, va, doZP ? RENDERPASS_Z : RENDERPASS_LIGHTMAP, doOQ);
}
if(geombatches.length()) renderbatches(cur, RENDERPASS_LIGHTMAP);
@@ -1421,7 +1411,7 @@ void rendergeom(bool fogpass)
{
if(!va->texs || va->occluded >= OCCLUDE_GEOM) continue;
blends += va->blends;
- renderva(cur, va, RENDERPASS_LIGHTMAP, fogpass);
+ renderva(cur, va, RENDERPASS_LIGHTMAP);
}
if(geombatches.length()) renderbatches(cur, RENDERPASS_LIGHTMAP);
for(vtxarray *va = visibleva; va; va = va->next)
@@ -1435,7 +1425,7 @@ void rendergeom(bool fogpass)
}
blends += va->blends;
- renderva(cur, va, RENDERPASS_LIGHTMAP, fogpass);
+ renderva(cur, va, RENDERPASS_LIGHTMAP);
}
if(geombatches.length()) renderbatches(cur, RENDERPASS_LIGHTMAP);
}
@@ -1456,7 +1446,7 @@ void rendergeom(bool fogpass)
{
if(!va->blends) continue;
if(va->occluded >= OCCLUDE_GEOM) continue;
- renderva(cur, va, RENDERPASS_LIGHTMAP_BLEND, fogpass);
+ renderva(cur, va, RENDERPASS_LIGHTMAP_BLEND);
}
if(geombatches.length()) renderbatches(cur, RENDERPASS_LIGHTMAP);
cur.blending = false;
@@ -1475,7 +1465,7 @@ void rendergeom(bool fogpass)
cleanupgeom(cur);
}
-void renderalphageom(bool fogpass)
+void renderalphageom(void)
{
static vector<vtxarray *> alphavas;
alphavas.setsize(0);
@@ -1517,7 +1507,7 @@ void renderalphageom(bool fogpass)
cur.texgendim = -1;
cur.colorscale = vec(1, 1, 1);
cur.alphascale = -1;
- loopv(alphavas) if(front || alphavas[i]->alphabacktris) renderva(cur, alphavas[i], RENDERPASS_LIGHTMAP, fogpass);
+ loopv(alphavas) if(front || alphavas[i]->alphabacktris) renderva(cur, alphavas[i], RENDERPASS_LIGHTMAP);
if(geombatches.length()) renderbatches(cur, RENDERPASS_LIGHTMAP);
cleanupgeom(cur);
@@ -1530,62 +1520,3 @@ void renderalphageom(bool fogpass)
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, fading ? GL_FALSE : GL_TRUE);
}
-
-static vtxarray *prevskyva = NULL;
-
-void renderskyva(vtxarray *va, bool explicitonly = false)
-{
- if(!prevskyva || va->vbuf != prevskyva->vbuf)
- {
- gle::bindvbo(va->vbuf);
- gle::bindebo(va->skybuf);
- const vertex *ptr = 0;
- gle::vertexpointer(sizeof(vertex), ptr->pos.v);
- if(!prevskyva) gle::enablevertex();
- }
-
- drawvatris(va, explicitonly ? va->explicitsky : va->sky+va->explicitsky, explicitonly ? va->skydata+va->sky : va->skydata);
-
- if(!explicitonly) xtraverts += va->sky/3;
- xtraverts += va->explicitsky/3;
-
- prevskyva = va;
-}
-
-int renderedsky = 0, renderedexplicitsky = 0, renderedskyfaces = 0, renderedskyclip = INT_MAX;
-
-static inline void updateskystats(vtxarray *va)
-{
- renderedsky += va->sky;
- renderedexplicitsky += va->explicitsky;
- renderedskyfaces |= va->skyfaces&0x3F;
- if(!(va->skyfaces&0x1F) || camera1->o.z < va->skyclip) renderedskyclip = min(renderedskyclip, va->skyclip);
- else renderedskyclip = 0;
-}
-
-bool rendersky(bool explicitonly)
-{
- prevskyva = NULL;
- renderedsky = renderedexplicitsky = renderedskyfaces = 0;
- renderedskyclip = INT_MAX;
-
- for(vtxarray *va = visibleva; va; va = va->next)
- {
- if((va->occluded >= OCCLUDE_BB && va->skyfaces&0x80) || !(va->sky+va->explicitsky)) continue;
-
- // count possibly visible sky even if not actually rendered
- updateskystats(va);
- if(explicitonly && !va->explicitsky) continue;
- renderskyva(va, explicitonly);
- }
-
- if(prevskyva)
- {
- gle::disablevertex();
- gle::clearvbo();
- gle::clearebo();
- }
-
- return renderedsky+renderedexplicitsky > 0;
-}
-