CR feedback, dead code cleanup

This commit is contained in:
Brad Hefta-Gaub 2016-01-18 12:09:21 -08:00
parent 88af387214
commit d10e1cc39d
12 changed files with 13 additions and 51 deletions

View file

@ -3507,14 +3507,6 @@ glm::vec3 Application::getSunDirection() {
// FIXME, preprocessor guard this check to occur only in DEBUG builds
static QThread * activeRenderingThread = nullptr;
float Application::getSizeScale() const {
return DependencyManager::get<LODManager>()->getOctreeSizeScale();
}
int Application::getBoundaryLevelAdjust() const {
return DependencyManager::get<LODManager>()->getBoundaryLevelAdjust();
}
PickRay Application::computePickRay(float x, float y) const {
vec2 pickPoint { x, y };
PickRay result;

View file

@ -170,8 +170,6 @@ public:
virtual ViewFrustum* getCurrentViewFrustum() { return getDisplayViewFrustum(); }
virtual QThread* getMainThread() { return thread(); }
virtual float getSizeScale() const;
virtual int getBoundaryLevelAdjust() const;
virtual PickRay computePickRay(float x, float y) const;
virtual glm::vec3 getAvatarPosition() const;
virtual void overrideEnvironmentData(const EnvironmentData& newData) { _environment.override(newData); }

View file

@ -183,7 +183,6 @@ void LODManager::autoAdjustLOD(float currentFPS) {
if (changed) {
calculateAvatarLODDistanceMultiplier();
_shouldRenderTableNeedsRebuilding = true;
auto lodToolsDialog = DependencyManager::get<DialogsManager>()->getLodToolsDialog();
if (lodToolsDialog) {
lodToolsDialog->reloadSliders();
@ -294,7 +293,6 @@ bool LODManager::shouldRender(const RenderArgs* args, const AABox& bounds) {
void LODManager::setOctreeSizeScale(float sizeScale) {
_octreeSizeScale = sizeScale;
calculateAvatarLODDistanceMultiplier();
_shouldRenderTableNeedsRebuilding = true;
}
void LODManager::calculateAvatarLODDistanceMultiplier() {
@ -303,7 +301,6 @@ void LODManager::calculateAvatarLODDistanceMultiplier() {
void LODManager::setBoundaryLevelAdjust(int boundaryLevelAdjust) {
_boundaryLevelAdjust = boundaryLevelAdjust;
_shouldRenderTableNeedsRebuilding = true;
}

View file

@ -135,9 +135,6 @@ private:
SimpleMovingAverage _fpsAverageDownWindow = DOWN_SHIFT_SAMPLES_OF_FRAMES;
SimpleMovingAverage _fpsAverageUpWindow = UP_SHIFT_SAMPLES_OF_FRAMES;
bool _shouldRenderTableNeedsRebuilding = true;
QMap<float, float> _shouldRenderTable;
PIDController _renderDistanceController{};
SimpleMovingAverage _renderDistanceAverage{ 10 };
};

View file

@ -417,15 +417,6 @@ const FBXGeometry* EntityTreeRenderer::getCollisionGeometryForEntity(EntityItemP
return result;
}
float EntityTreeRenderer::getSizeScale() const {
return _viewState->getSizeScale();
}
int EntityTreeRenderer::getBoundaryLevelAdjust() const {
return _viewState->getBoundaryLevelAdjust();
}
void EntityTreeRenderer::processEraseMessage(ReceivedMessage& message, const SharedNodePointer& sourceNode) {
std::static_pointer_cast<EntityTree>(_tree)->processEraseMessage(message, sourceNode);
}

View file

@ -41,8 +41,6 @@ public:
virtual char getMyNodeType() const { return NodeType::EntityServer; }
virtual PacketType getMyQueryMessageType() const { return PacketType::EntityQuery; }
virtual PacketType getExpectedPacketType() const { return PacketType::EntityData; }
virtual float getSizeScale() const;
virtual int getBoundaryLevelAdjust() const;
virtual void setTree(OctreePointer newTree);
void shutdown();

View file

@ -321,7 +321,7 @@ OctreeElement::AppendState EntityTreeElement::appendElementData(OctreePacketData
if (renderAccuracy <= 0.0f) {
includeThisEntity = false; // too small, don't include it
#ifdef WANT_LOD_DEBUGGING
#if 1 //def WANT_LOD_DEBUGGING
qDebug() << "skipping entity - TOO SMALL - \n"
<< "......id:" << entity->getID() << "\n"
<< "....name:" << entity->getName() << "\n"
@ -337,11 +337,10 @@ OctreeElement::AppendState EntityTreeElement::appendElementData(OctreePacketData
}
if (includeThisEntity) {
#ifdef WANT_LOD_DEBUGGING
#if 1 //def WANT_LOD_DEBUGGING
qDebug() << "including entity - \n"
<< "......id:" << entity->getID() << "\n"
<< "....name:" << entity->getName() << "\n"
<< "..bounds:" << entityBounds << "\n"
<< "....cell:" << getAACube();
#endif
indexesOfEntitiesToInclude << i;

View file

@ -14,11 +14,7 @@
#include "OctreeLogging.h"
#include "OctreeHeadlessViewer.h"
OctreeHeadlessViewer::OctreeHeadlessViewer() :
OctreeRenderer(),
_voxelSizeScale(DEFAULT_OCTREE_SIZE_SCALE),
_boundaryLevelAdjust(0),
_maxPacketsPerSecond(DEFAULT_MAX_OCTREE_PPS)
OctreeHeadlessViewer::OctreeHeadlessViewer() : OctreeRenderer()
{
_viewFrustum.setProjection(glm::perspective(glm::radians(DEFAULT_FIELD_OF_VIEW_DEGREES), DEFAULT_ASPECT_RATIO, DEFAULT_NEAR_CLIP, DEFAULT_FAR_CLIP));
}
@ -57,9 +53,8 @@ void OctreeHeadlessViewer::queryOctree() {
_octreeQuery.setCameraFarClip(_viewFrustum.getFarClip());
_octreeQuery.setCameraEyeOffsetPosition(glm::vec3());
_octreeQuery.setKeyholeRadius(_viewFrustum.getKeyholeRadius());
_octreeQuery.setOctreeSizeScale(getVoxelSizeScale());
_octreeQuery.setBoundaryLevelAdjust(getBoundaryLevelAdjust());
_octreeQuery.setOctreeSizeScale(_voxelSizeScale);
_octreeQuery.setBoundaryLevelAdjust(_boundaryLevelAdjust);
// Iterate all of the nodes, and get a count of how many voxel servers we have...
int totalServers = 0;

View file

@ -59,7 +59,7 @@ public slots:
// getters for LOD and PPS
float getVoxelSizeScale() const { return _voxelSizeScale; }
int getBoundaryLevelAdjust() const override { return _boundaryLevelAdjust; }
int getBoundaryLevelAdjust() const { return _boundaryLevelAdjust; }
int getMaxPacketsPerSecond() const { return _maxPacketsPerSecond; }
unsigned getOctreeElementsCount() const { return _tree->getOctreeElementsCount(); }
@ -68,9 +68,10 @@ private:
ViewFrustum _viewFrustum;
JurisdictionListener* _jurisdictionListener = nullptr;
OctreeQuery _octreeQuery;
float _voxelSizeScale;
int _boundaryLevelAdjust;
int _maxPacketsPerSecond;
float _voxelSizeScale { DEFAULT_OCTREE_SIZE_SCALE };
int _boundaryLevelAdjust { 0 };
int _maxPacketsPerSecond { DEFAULT_MAX_OCTREE_PPS };
};
#endif // hifi_OctreeHeadlessViewer_h

View file

@ -39,8 +39,6 @@ public:
virtual PacketType getMyQueryMessageType() const = 0;
virtual PacketType getExpectedPacketType() const = 0;
virtual void renderElement(OctreeElementPointer element, RenderArgs* args) { }
virtual float getSizeScale() const { return DEFAULT_OCTREE_SIZE_SCALE; }
virtual int getBoundaryLevelAdjust() const { return 0; }
virtual void setTree(OctreePointer newTree);

View file

@ -758,9 +758,9 @@ float ViewFrustum::calculateRenderAccuracy(const AABox& bounds, float octreeSize
const float maxScale = (float)TREE_SCALE;
float visibleDistanceAtMaxScale = boundaryDistanceForRenderLevel(boundaryLevelAdjust, octreeSizeScale) / OCTREE_TO_MESH_RATIO;
static bool shouldRenderTableNeedsBuilding = true;
static std::once_flag once;
static QMap<float, float> shouldRenderTable;
if (shouldRenderTableNeedsBuilding) {
std::call_once(once, [&] {
float SMALLEST_SCALE_IN_TABLE = 0.001f; // 1mm is plenty small
float scale = maxScale;
float factor = 1.0f;
@ -770,9 +770,7 @@ float ViewFrustum::calculateRenderAccuracy(const AABox& bounds, float octreeSize
factor /= 2.0f;
shouldRenderTable[scale] = factor;
}
shouldRenderTableNeedsBuilding = false;
}
});
float closestScale = maxScale;
float visibleDistanceAtClosestScale = visibleDistanceAtMaxScale;

View file

@ -41,8 +41,6 @@ public:
virtual QThread* getMainThread() = 0;
virtual float getSizeScale() const = 0;
virtual int getBoundaryLevelAdjust() const = 0;
virtual PickRay computePickRay(float x, float y) const = 0;
virtual glm::vec3 getAvatarPosition() const = 0;