improves groundcover view distance (#3219)

This PR aims to solve all issues with `Groundcover` view distance handling in a satisfying way while preserving other optimisations that benefit other features. The main idea here is not to rely on `ViewData` updates for distance culling calculations because we can not accurately determine distance against lazily updated views. Instead, we perform an accurate measurement in a cull callback we can run every frame in `Groundcover` itself. While we do have to add some code to handle this feature, it is quite loosely coupled code that could be useful elsewhere in the future. These changes should address a performance regression @akortunov experienced.
This commit is contained in:
Bo Svensson 2021-11-08 09:27:42 +00:00 committed by GitHub
parent b6718ecb10
commit 5f1bf89369
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 98 additions and 65 deletions

View file

@ -12,8 +12,8 @@ namespace
template <typename IndexArrayType>
osg::ref_ptr<IndexArrayType> createIndexBuffer(unsigned int flags, unsigned int verts)
{
// LOD level n means every 2^n-th vertex is kept
size_t lodLevel = (flags >> (4*4));
// LOD level n means every 2^n-th vertex is kept, but we currently handle LOD elsewhere.
size_t lodLevel = 0;//(flags >> (4*4));
size_t lodDeltas[4];
for (int i=0; i<4; ++i)