More LOD renaming with focus on angles

This commit is contained in:
sabrina-shanman 2019-08-06 16:35:41 -07:00
parent 6db6890bac
commit 0d5260bccc
6 changed files with 15 additions and 15 deletions

View file

@ -6818,7 +6818,7 @@ void Application::updateRenderArgs(float deltaTime) {
_viewFrustum.calculate();
}
appRenderArgs._renderArgs = RenderArgs(_graphicsEngine.getGPUContext(), lodManager->getVisibilityDistance(),
lodManager->getBoundaryLevelAdjust(), lodManager->getLODAngleHalfTan(), RenderArgs::DEFAULT_RENDER_MODE,
lodManager->getBoundaryLevelAdjust(), lodManager->getLODHalfAngleTan(), RenderArgs::DEFAULT_RENDER_MODE,
RenderArgs::MONO, RenderArgs::DEFERRED, RenderArgs::RENDER_DEBUG_NONE);
appRenderArgs._renderArgs._scene = getMain3DScene();

View file

@ -173,12 +173,12 @@ void LODManager::autoAdjustLOD(float realTimeDelta) {
}
}
float LODManager::getLODAngleHalfTan() const {
return getPerspectiveAccuracyAngleTan(_visibilityDistance, _boundaryLevelAdjust);
float LODManager::getLODHalfAngleTan() const {
return getPerspectiveAccuracyHalfAngleTan(_visibilityDistance, _boundaryLevelAdjust);
}
float LODManager::getLODAngle() const {
return 2.0f * atanf(getLODAngleHalfTan());
return 2.0f * atanf(getLODHalfAngleTan());
}
float LODManager::getLODAngleDeg() const {
return glm::degrees(getLODAngle());

View file

@ -201,7 +201,7 @@ public:
float getLODAngleDeg() const;
void setLODAngleDeg(float lodAngle);
float getLODAngleHalfTan() const;
float getLODHalfAngleTan() const;
float getLODAngle() const;
float getVisibilityDistance() const;
void setVisibilityDistance(float distance);

View file

@ -18,17 +18,17 @@
#include <AABox.h>
#include <AACube.h>
float boundaryDistanceForRenderLevel(unsigned int renderLevel, float voxelSizeScale) {
return voxelSizeScale / powf(2.0f, renderLevel);
float boundaryDistanceForRenderLevel(unsigned int renderLevel, float visibilityDistance) {
return visibilityDistance / powf(2.0f, renderLevel);
}
float getPerspectiveAccuracyAngleTan(float visibilityDistance, int boundaryLevelAdjust) {
float getPerspectiveAccuracyHalfAngleTan(float visibilityDistance, int boundaryLevelAdjust) {
float visibleDistanceAtMaxScale = boundaryDistanceForRenderLevel(boundaryLevelAdjust, visibilityDistance);
return UNIT_ELEMENT_MAX_EXTENT / visibleDistanceAtMaxScale; // TODO: consider renaming this function to half tangent because we're taking into account a factor of 1/2
return UNIT_ELEMENT_MAX_EXTENT / visibleDistanceAtMaxScale;
}
float getPerspectiveAccuracyAngle(float visibilityDistance, int boundaryLevelAdjust) {
return atan(getPerspectiveAccuracyAngleTan(visibilityDistance, boundaryLevelAdjust));
float getPerspectiveAccuracyHalfAngle(float visibilityDistance, int boundaryLevelAdjust) {
return atan(getPerspectiveAccuracyHalfAngleTan(visibilityDistance, boundaryLevelAdjust));
}
float getOrthographicAccuracySize(float visibilityDistance, int boundaryLevelAdjust) {

View file

@ -20,10 +20,10 @@ class AABox;
class AACube;
class QJsonDocument;
float boundaryDistanceForRenderLevel(unsigned int renderLevel, float voxelSizeScale);
float boundaryDistanceForRenderLevel(unsigned int renderLevel, float visibilityDistance);
float getPerspectiveAccuracyAngleTan(float visibilityDistance, int boundaryLevelAdjust);
float getPerspectiveAccuracyAngle(float visibilityDistance, int boundaryLevelAdjust);
float getPerspectiveAccuracyHalfAngleTan(float visibilityDistance, int boundaryLevelAdjust);
float getPerspectiveAccuracyHalfAngle(float visibilityDistance, int boundaryLevelAdjust);
float getOrthographicAccuracySize(float visibilityDistance, int boundaryLevelAdjust);
// MIN_ELEMENT_ANGULAR_DIAMETER = angular diameter of 1x1x1m cube at 400m = sqrt(3) / 400 = 0.0043301 radians ~= 0.25 degrees

View file

@ -120,7 +120,7 @@ void DrawSceneOctree::run(const RenderContextPointer& renderContext, const ItemS
// Draw the LOD Reticle
{
float angle = glm::degrees(getPerspectiveAccuracyAngle(args->_sizeScale, args->_boundaryLevelAdjust));
float angle = glm::degrees(getPerspectiveAccuracyHalfAngle(args->_sizeScale, args->_boundaryLevelAdjust));
Transform crosshairModel;
crosshairModel.setTranslation(glm::vec3(0.0, 0.0, -1000.0));
crosshairModel.setScale(1000.0f * tanf(glm::radians(angle))); // Scaling at the actual tan of the lod angle => Multiplied by TWO