make horizon culling optional (and a property)

This commit is contained in:
Joakim Kilby
2023-11-09 14:28:57 +01:00
parent 63a28cbd47
commit 3187042a96
2 changed files with 12 additions and 4 deletions

View File

@@ -72,7 +72,6 @@ namespace {
// Global flags to modify the RenderableGlobe
constexpr bool LimitLevelByAvailableData = true;
constexpr bool PreformHorizonCulling = true;
// Shadow structure
struct ShadowRenderingStruct {
@@ -133,6 +132,13 @@ namespace {
openspace::properties::Property::Visibility::AdvancedUser
};
constexpr openspace::properties::Property::PropertyInfo PerformHorizonCullingInfo = {
"PerformHorizonCulling",
"Perform horizon culling",
"If this value is set to 'true', horizon culling will be performed.",
openspace::properties::Property::Visibility::AdvancedUser
};
constexpr openspace::properties::Property::PropertyInfo ResetTileProviderInfo = {
"ResetTileProviders",
"Reset tile providers",
@@ -577,6 +583,7 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary)
BoolProperty(LevelProjectedAreaInfo, true),
BoolProperty(ResetTileProviderInfo, false),
BoolProperty(PerformFrustumCullingInfo, true),
BoolProperty(PerformHorizonCullingInfo, true),
IntProperty(ModelSpaceRenderingInfo, 14, 1, 22),
IntProperty(DynamicLodIterationCountInfo, 16, 4, 128)
})
@@ -708,6 +715,7 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary)
_debugPropertyOwner.addProperty(_debugProperties.levelByProjectedAreaElseDistance);
_debugPropertyOwner.addProperty(_debugProperties.resetTileProviders);
_debugPropertyOwner.addProperty(_debugProperties.performFrustumCulling);
_debugPropertyOwner.addProperty(_debugProperties.performHorizonCulling);
_debugPropertyOwner.addProperty(_debugProperties.modelSpaceRenderingCutoffLevel);
_debugPropertyOwner.addProperty(_debugProperties.dynamicLodIterationCount);
@@ -2073,9 +2081,8 @@ bool RenderableGlobe::testIfCullable(const Chunk& chunk,
{
ZoneScoped;
return (PreformHorizonCulling && isCullableByHorizon(chunk, renderData, heights)) ||
(_debugProperties.performFrustumCulling &&
isCullableByFrustum(chunk, renderData, mvp));
return (_debugProperties.performHorizonCulling && isCullableByHorizon(chunk, renderData, heights)) ||
(_debugProperties.performFrustumCulling && isCullableByFrustum(chunk, renderData, mvp));
}
int RenderableGlobe::desiredLevel(const Chunk& chunk, const RenderData& renderData,

View File

@@ -136,6 +136,7 @@ private:
properties::BoolProperty levelByProjectedAreaElseDistance;
properties::BoolProperty resetTileProviders;
properties::BoolProperty performFrustumCulling;
properties::BoolProperty performHorizonCulling;
properties::IntProperty modelSpaceRenderingCutoffLevel;
properties::IntProperty dynamicLodIterationCount;
} _debugProperties;