mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-06 01:03:19 +02:00
Trying to simplify the LOD culling test
This commit is contained in:
parent
8f8bcc1901
commit
294fe51fde
8 changed files with 39 additions and 5 deletions
|
@ -5987,7 +5987,7 @@ void Application::updateRenderArgs(float deltaTime) {
|
|||
_viewFrustum.calculate();
|
||||
}
|
||||
appRenderArgs._renderArgs = RenderArgs(_gpuContext, lodManager->getOctreeSizeScale(),
|
||||
lodManager->getBoundaryLevelAdjust(), RenderArgs::DEFAULT_RENDER_MODE,
|
||||
lodManager->getBoundaryLevelAdjust(), lodManager->getSolidAngleHalfTan(), RenderArgs::DEFAULT_RENDER_MODE,
|
||||
RenderArgs::MONO, RenderArgs::RENDER_DEBUG_NONE);
|
||||
appRenderArgs._renderArgs._scene = getMain3DScene();
|
||||
|
||||
|
|
|
@ -319,3 +319,9 @@ float LODManager::getWorldDetailQuality() const {
|
|||
}
|
||||
return HIGH;
|
||||
}
|
||||
|
||||
|
||||
float LODManager::getSolidAngleHalfTan() const {
|
||||
return getPerspectiveAccuracyAngleTan(_octreeSizeScale, _boundaryLevelAdjust);
|
||||
}
|
||||
|
||||
|
|
|
@ -69,6 +69,8 @@ class LODManager : public QObject, public Dependency {
|
|||
|
||||
Q_PROPERTY(float worldDetailQuality READ getWorldDetailQuality WRITE setWorldDetailQuality NOTIFY worldDetailQualityChanged)
|
||||
|
||||
Q_PROPERTY(float solidAngleHalfTan READ getSolidAngleHalfTan)
|
||||
|
||||
public:
|
||||
|
||||
/**jsdoc
|
||||
|
@ -184,6 +186,8 @@ public:
|
|||
void setWorldDetailQuality(float quality);
|
||||
float getWorldDetailQuality() const;
|
||||
|
||||
float getSolidAngleHalfTan() const;
|
||||
|
||||
signals:
|
||||
|
||||
/**jsdoc
|
||||
|
|
|
@ -64,10 +64,14 @@ float boundaryDistanceForRenderLevel(unsigned int renderLevel, float voxelSizeSc
|
|||
return voxelSizeScale / powf(2.0f, renderLevel);
|
||||
}
|
||||
|
||||
float getPerspectiveAccuracyAngle(float octreeSizeScale, int boundaryLevelAdjust) {
|
||||
float getPerspectiveAccuracyAngleTan(float octreeSizeScale, int boundaryLevelAdjust) {
|
||||
const float maxScale = (float)TREE_SCALE;
|
||||
float visibleDistanceAtMaxScale = boundaryDistanceForRenderLevel(boundaryLevelAdjust, octreeSizeScale) / OCTREE_TO_MESH_RATIO;
|
||||
return atan(maxScale / visibleDistanceAtMaxScale);
|
||||
return (maxScale / visibleDistanceAtMaxScale);
|
||||
}
|
||||
|
||||
float getPerspectiveAccuracyAngle(float octreeSizeScale, int boundaryLevelAdjust) {
|
||||
return atan(getPerspectiveAccuracyAngleTan(octreeSizeScale, boundaryLevelAdjust));
|
||||
}
|
||||
|
||||
float getOrthographicAccuracySize(float octreeSizeScale, int boundaryLevelAdjust) {
|
||||
|
|
|
@ -29,6 +29,7 @@ float calculateRenderAccuracy(const glm::vec3& position,
|
|||
|
||||
float boundaryDistanceForRenderLevel(unsigned int renderLevel, float voxelSizeScale);
|
||||
|
||||
float getPerspectiveAccuracyAngleTan(float octreeSizeScale, int boundaryLevelAdjust);
|
||||
float getPerspectiveAccuracyAngle(float octreeSizeScale, int boundaryLevelAdjust);
|
||||
float getOrthographicAccuracySize(float octreeSizeScale, int boundaryLevelAdjust);
|
||||
|
||||
|
|
|
@ -73,12 +73,14 @@ namespace render {
|
|||
Args(const gpu::ContextPointer& context,
|
||||
float sizeScale = 1.0f,
|
||||
int boundaryLevelAdjust = 0,
|
||||
float solidAngleHalfTan = 0.1f,
|
||||
RenderMode renderMode = DEFAULT_RENDER_MODE,
|
||||
DisplayMode displayMode = MONO,
|
||||
DebugFlags debugFlags = RENDER_DEBUG_NONE,
|
||||
gpu::Batch* batch = nullptr) :
|
||||
_context(context),
|
||||
_sizeScale(sizeScale),
|
||||
_solidAngleHalfTan(solidAngleHalfTan),
|
||||
_boundaryLevelAdjust(boundaryLevelAdjust),
|
||||
_renderMode(renderMode),
|
||||
_displayMode(displayMode),
|
||||
|
@ -105,8 +107,11 @@ namespace render {
|
|||
std::stack<ViewFrustum> _viewFrustums;
|
||||
glm::ivec4 _viewport { 0.0f, 0.0f, 1.0f, 1.0f };
|
||||
glm::vec3 _boomOffset { 0.0f, 0.0f, 1.0f };
|
||||
|
||||
float _sizeScale { 1.0f };
|
||||
int _boundaryLevelAdjust { 0 };
|
||||
float _solidAngleHalfTan{ 0.1f };
|
||||
|
||||
RenderMode _renderMode { DEFAULT_RENDER_MODE };
|
||||
DisplayMode _displayMode { MONO };
|
||||
DebugFlags _debugFlags { RENDER_DEBUG_NONE };
|
||||
|
|
|
@ -158,7 +158,21 @@ Item {
|
|||
color: "#9999FF"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
PlotPerf {
|
||||
title: "Solid Angle Half Tan"
|
||||
height: parent.evalEvenHeight()
|
||||
object: LODManager
|
||||
valueScale: 1.0
|
||||
valueUnit: ""
|
||||
plots: [
|
||||
{
|
||||
prop: "solidAngleHalfTan",
|
||||
label: "SAHT",
|
||||
color: "#9999FF"
|
||||
}
|
||||
]
|
||||
}
|
||||
Separator {
|
||||
id: bottomLine
|
||||
}
|
||||
|
|
|
@ -659,7 +659,7 @@ private:
|
|||
update();
|
||||
|
||||
_initContext.makeCurrent();
|
||||
RenderArgs renderArgs(_renderThread._gpuContext, DEFAULT_OCTREE_SIZE_SCALE, 0, RenderArgs::DEFAULT_RENDER_MODE,
|
||||
RenderArgs renderArgs(_renderThread._gpuContext, DEFAULT_OCTREE_SIZE_SCALE, 0, getPerspectiveAccuracyAngleTan(DEFAULT_OCTREE_SIZE_SCALE, 0), RenderArgs::DEFAULT_RENDER_MODE,
|
||||
RenderArgs::MONO, RenderArgs::RENDER_DEBUG_NONE);
|
||||
|
||||
QSize windowSize = _size;
|
||||
|
|
Loading…
Reference in a new issue