From: havoc Date: Sat, 17 Sep 2011 03:23:29 +0000 (+0000) Subject: avoid crashes on watershader surfaces in models that are off-screen (yet X-Git-Tag: xonotic-v0.6.0~163^2~192 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b3da7c5e3f841fb6bbe2fdaf85a1e3db7d312232;p=xonotic%2Fdarkplaces.git avoid crashes on watershader surfaces in models that are off-screen (yet somehow marked visible) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11360 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/gl_rmain.c b/gl_rmain.c index 8bd4e908..e92620c0 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -5633,6 +5633,10 @@ void R_Water_AddWaterPlane(msurface_t *surface, int entno) r_waterstate_waterplane_t *p; texture_t *t = R_GetCurrentTexture(surface->texture); + // if the model has no normals, it's probably off-screen and they were not generated, so don't add it anyway + if (!rsurface.modelnormal3f) + return; + RSurf_PrepareVerticesForBatch(BATCHNEED_ARRAY_VERTEX | BATCHNEED_ARRAY_NORMAL | BATCHNEED_NOGAPS, 1, ((const msurface_t **)&surface)); // average the vertex normals, find the surface bounds (after deformvertexes) VectorClear(normal);