Comments (19)
Do you have a patch?
CC: @andrei-drexler, @ericwa
from quakespasm.
I'll add a guard against outputting those <3 vert faces in ericw-tools in the future..
Not sure where the best place to patch it in QS is though. BuildSurfaceDisplayList
maybe, and set the msurface_t::polys
member to null for these degenerate faces, plus check the codebase that all msurface_t::polys
accesses can handle null?
from quakespasm.
Would it not be OK to simply Sys_Error with any such bad maps in Mod_LoadEdges ??
[bad patch deleted]
Also: Can you give links to such bad maps please?
from quakespasm.
It looks like that patch is checking the wrong thing - that's checking total edge count in the .bsp being < 3. This issue is about otherwise well-formed maps that have one degenerate face (0, 1, or 2 edges just for a specific bad face.)
I've fixed this in ericw-tools a while ago so hopefully it won't be a problem on many .bsp's.
from quakespasm.
OK, should I close this then? Or, do you have a better patch?
from quakespasm.
.. and the correct check should be something like this I guess ?
diff --git a/Quake/gl_model.c b/Quake/gl_model.c
index 6e5cfd7..52bad53 100644
--- a/Quake/gl_model.c
+++ b/Quake/gl_model.c
@@ -1281,6 +1281,9 @@ static void Mod_LoadFaces (lump_t *l, qboolean bsp2)
ins++;
}
+ if (out->numedges < 3)
+ Sys_Error ("surfnum %d: bad numedges %d", surfnum, out->numedges);
+
out->flags = 0;
if (side)
from quakespasm.
OK, I just tried several (surely not all) mods with the following:
diff --git a/Quake/gl_model.c b/Quake/gl_model.c
index 6e5cfd7..70b1689 100644
--- a/Quake/gl_model.c
+++ b/Quake/gl_model.c
@@ -1282,6 +1282,8 @@ static void Mod_LoadFaces (lump_t *l, qboolean bsp2)
}
out->flags = 0;
+ if (out->numedges < 3)
+ Con_Warning("surfnum %d: bad numedges %d\n", surfnum, out->numedges);
if (side)
out->flags |= SURF_PLANEBACK;
It resulted in the following:
-
Alkaline 1.2: Only one map:
alk_dancing:
surfnum 54053: bad numedges 2 -
Explore jam3: Only one map:
ej3_bizz:
surfnum 5688: bad numedges 2
surfnum 10190: bad numedges 2
surfnum 10191: bad numedges 2
surfnum 10192: bad numedges 2 -
Rotting jam: Only one map:
rotj_entsoy: surfnum 20737: bad numedges 2 -
'mjolnir' mod: Multiple maps:
start2: surfnum 70379: bad numedges 2
mj4m1: surfnum 179825: bad numedges 2
mj4m2: surfnum 82355: bad numedges 2
mj4m3: surfnum 69430: bad numedges 2
mj4m4: surfnum 156826: bad numedges 2
mj4m6: surfnum 14105: bad numedges 2
Then applied the following to r_world.c:
diff --git a/Quake/r_world.c b/Quake/r_world.c
index 5cc9667..1cab21b 100644
--- a/Quake/r_world.c
+++ b/Quake/r_world.c
@@ -319,7 +319,7 @@
//
//==============================================================================
-static unsigned int R_NumTriangleIndicesForSurf (msurface_t *s)
+static int R_NumTriangleIndicesForSurf (msurface_t *s)
{
return 3 * (s->numedges - 2);
}
@@ -384,9 +384,12 @@ using VBOs.
*/
static void R_BatchSurface (msurface_t *s)
{
- int num_surf_indices;
+ int num_surf_indices = R_NumTriangleIndicesForSurf (s);
- num_surf_indices = R_NumTriangleIndicesForSurf (s);
+ if (num_surf_indices < 0) {
+ Con_Warning("bad numedges for surface\n");
+ return;
+ }
if (num_vbo_indices + num_surf_indices > MAX_BATCH_SIZE)
R_FlushBatch();
... and noclip'ed around in alk_dancing and ej3_bizz, hoping to see what
would happen and whether I hit that warning message: nothing did..
I want to apply the first warning patch to Mod_LoadFaces
so the issue
won't go unnoticed.
However, I don't know whether on not the change to r_world.c is correct
(minus the warning). @ericwa: What do you think?
from quakespasm.
Related Issues (20)
- Stack buffer overrun on loading of `lim_daviddg` map HOT 2
- Increase default gl_farclip HOT 14
- [BUG] - USB audio headset not outputting any sound, prevents the engine from gracefully shutting down HOT 24
- Crash in `SV_AreaTriggerEdicts()` function HOT 9
- Mac Windowed Mode Out Of Focus Input HOT 20
- Alpha sorting issues HOT 3
- Center Print Deletes Con Notify HOT 1
- SZ_GetSpace: overflow in certain maps with sv_protocol 999 HOT 1
- Fog blending/banding issues HOT 8
- gl_overbright cvar not working HOT 25
- Issue with depth clamp extension HOT 4
- Geometry Rendering Distortion (Mac) HOT 7
- Case sensitive game command HOT 20
- Host & play on localhost HOT 11
- Flatpak distribution HOT 5
- Border on screenshot HOT 1
- bad loop HOT 1
- moving bmodels receive dynamic lighting from original position HOT 3
- Any plans to add minimal HUD and water warp from Quake Remaster? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quakespasm.