// if the surface has a deformation, increase the bounds switch ( surf->shader->Deform() ) { case DFRM_NONE: break; case DFRM_PARTICLE2: { // expand surface bounds to include any emitted particles srfTriangles_t *tri = surf->geometry; const idDeclParticle *particleSystem = (idDeclParticle *)surf->shader->GetDeformDecl(); tri->bounds.AddBounds(particleSystem->bounds); } break; default: { // the amount here is somewhat arbitrary, designed to handle // autosprites and flares, but could be done better with exact // deformation information. // Note that this doesn't handle deformations that are skinned in // at run time... srfTriangles_t *tri = surf->geometry; idVec3 mid = ( tri->bounds[1] + tri->bounds[0] ) * 0.5f; float radius = ( tri->bounds[0] - mid ).Length(); radius += 20.0f; tri->bounds[0][0] = mid[0] - radius; tri->bounds[0][1] = mid[1] - radius; tri->bounds[0][2] = mid[2] - radius; tri->bounds[1][0] = mid[0] + radius; tri->bounds[1][1] = mid[1] + radius; tri->bounds[1][2] = mid[2] + radius; } break; }
Link to entry in the The Dark Mod issue tracker: http://bugs.thedarkmod.com/view.php?id=3278
