mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-14 11:46:34 +02:00
remove cruft and add comments
This commit is contained in:
parent
3ae41b9b75
commit
1c30f7424e
8 changed files with 12 additions and 54 deletions
|
@ -17,7 +17,6 @@
|
|||
|
||||
#include "EntityServer.h"
|
||||
|
||||
#define SEND_SORTED_ENTITIES
|
||||
|
||||
EntityTreeSendThread::EntityTreeSendThread(OctreeServer* myServer, const SharedNodePointer& node) :
|
||||
OctreeSendThread(myServer, node)
|
||||
|
@ -144,32 +143,15 @@ void EntityTreeSendThread::traverseTreeAndSendContents(SharedNodePointer node, O
|
|||
if (!_traversal.finished()) {
|
||||
quint64 startTime = usecTimestampNow();
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
const uint64_t TIME_BUDGET = 400; // usec
|
||||
#else
|
||||
#else
|
||||
const uint64_t TIME_BUDGET = 200; // usec
|
||||
#endif
|
||||
#endif
|
||||
_traversal.traverse(TIME_BUDGET);
|
||||
OctreeServer::trackTreeTraverseTime((float)(usecTimestampNow() - startTime));
|
||||
}
|
||||
|
||||
#ifndef SEND_SORTED_ENTITIES
|
||||
if (!_sendQueue.empty()) {
|
||||
uint64_t sendTime = usecTimestampNow();
|
||||
// print what needs to be sent
|
||||
while (!_sendQueue.empty()) {
|
||||
PrioritizedEntity entry = _sendQueue.top();
|
||||
EntityItemPointer entity = entry.getEntity();
|
||||
if (entity) {
|
||||
std::cout << "adebug send '" << entity->getName().toStdString() << "'" << " : " << entry.getPriority() << std::endl; // adebug
|
||||
_knownState[entity.get()] = sendTime;
|
||||
}
|
||||
_sendQueue.pop();
|
||||
_entitiesInQueue.erase(entry.getRawEntityPointer());
|
||||
}
|
||||
}
|
||||
#endif // SEND_SORTED_ENTITIES
|
||||
|
||||
OctreeSendThread::traverseTreeAndSendContents(node, nodeData, viewFrustumChanged, isFullScene);
|
||||
}
|
||||
|
||||
|
@ -400,8 +382,6 @@ void EntityTreeSendThread::startNewTraversal(const ViewFrustum& view, EntityTree
|
|||
}
|
||||
|
||||
bool EntityTreeSendThread::traverseTreeAndBuildNextPacketPayload(EncodeBitstreamParams& params, const QJsonObject& jsonFilters) {
|
||||
#ifdef SEND_SORTED_ENTITIES
|
||||
//auto entityTree = std::static_pointer_cast<EntityTree>(_myServer->getOctree());
|
||||
if (_sendQueue.empty()) {
|
||||
OctreeServer::trackEncodeTime(OctreeServer::SKIP_TIME);
|
||||
return false;
|
||||
|
@ -485,10 +465,6 @@ bool EntityTreeSendThread::traverseTreeAndBuildNextPacketPayload(EncodeBitstream
|
|||
_packetData.updatePriorBytes(_numEntitiesOffset, (const unsigned char*)&_numEntities, sizeof(_numEntities));
|
||||
OctreeServer::trackEncodeTime((float)(usecTimestampNow() - encodeStart));
|
||||
return true;
|
||||
|
||||
#else // SEND_SORTED_ENTITIES
|
||||
return OctreeSendThread::traverseTreeAndBuildNextPacketPayload(params);
|
||||
#endif // SEND_SORTED_ENTITIES
|
||||
}
|
||||
|
||||
void EntityTreeSendThread::editingEntityPointer(const EntityItemPointer entity) {
|
||||
|
|
|
@ -5429,7 +5429,6 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node
|
|||
<< perUnknownServer << " to send us jurisdiction.";
|
||||
}
|
||||
|
||||
// TODO: remove this hackery: it no longer makes sense for streaming of entities in scene.
|
||||
// set the query's position/orientation to be degenerate in a manner that will get the scene quickly
|
||||
// If there's only one server, then don't do this, and just let the normal voxel query pass through
|
||||
// as expected... this way, we will actually get a valid scene if there is one to be seen
|
||||
|
|
|
@ -236,17 +236,6 @@ void DiffTraversal::setScanCallback(std::function<void (DiffTraversal::VisibleEl
|
|||
}
|
||||
}
|
||||
|
||||
// DEBUG method: delete later
|
||||
std::ostream& operator<<(std::ostream& s, const DiffTraversal& traversal) {
|
||||
for (size_t i = 0; i < traversal._path.size(); ++i) {
|
||||
s << (int32_t)(traversal._path[i].getNextIndex());
|
||||
if (i < traversal._path.size() - 1) {
|
||||
s << ":";
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
void DiffTraversal::traverse(uint64_t timeBudget) {
|
||||
uint64_t expiry = usecTimestampNow() + timeBudget;
|
||||
DiffTraversal::VisibleElement next;
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
#ifndef hifi_DiffTraversal_h
|
||||
#define hifi_DiffTraversal_h
|
||||
|
||||
#include <ostream> // DEBUG
|
||||
|
||||
#include <ViewFrustum.h>
|
||||
|
||||
#include "EntityTreeElement.h"
|
||||
|
@ -74,8 +72,6 @@ public:
|
|||
void setScanCallback(std::function<void (VisibleElement&)> cb);
|
||||
void traverse(uint64_t timeBudget);
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& s, const DiffTraversal& traversal); // DEBUG
|
||||
|
||||
private:
|
||||
void getNextVisibleElement(VisibleElement& next);
|
||||
|
||||
|
|
|
@ -192,21 +192,14 @@ int EntityTree::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
|
|||
if (!isDeletedEntity(entityItemID)) {
|
||||
_entitiesToAdd.insert(entityItemID, entity);
|
||||
|
||||
/*
|
||||
addEntityMapEntry(entity);
|
||||
oldElement->addEntityItem(entity); // add this new entity to this elements entities
|
||||
entityItemID = entity->getEntityItemID();
|
||||
postAddEntity(entity);
|
||||
*/
|
||||
|
||||
if (entity->getCreated() == UNKNOWN_CREATED_TIME) {
|
||||
entity->recordCreationTime();
|
||||
}
|
||||
#ifdef WANT_DEBUG
|
||||
} else {
|
||||
#ifdef WANT_DEBUG
|
||||
qCDebug(entities) << "Received packet for previously deleted entity [" <<
|
||||
entityItemID << "] ignoring. (inside " << __FUNCTION__ << ")";
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,9 @@ const int NUMBER_OF_CHILDREN = 8;
|
|||
|
||||
const int MAX_TREE_SLICE_BYTES = 26;
|
||||
|
||||
// The oversend below is 20 degrees because that is the minimum oversend necessary to prevent missing entities
|
||||
// near the edge of the view. The value here is determined by hard-coded values in ViewFrsutum::isVerySimilar().
|
||||
// TODO: move this parameter to the OctreeQueryNode context.
|
||||
const float VIEW_FRUSTUM_FOV_OVERSEND = 20.0f;
|
||||
|
||||
// These are guards to prevent our voxel tree recursive routines from spinning out of control
|
||||
|
|
|
@ -27,8 +27,9 @@ float boundaryDistanceForRenderLevel(unsigned int renderLevel, float voxelSizeSc
|
|||
|
||||
float getAccuracyAngle(float octreeSizeScale, int boundaryLevelAdjust);
|
||||
|
||||
const float MIN_ELEMENT_APPARENT_ANGLE = 0.0087266f; // ~0.57 degrees in radians
|
||||
// NOTE: the entity bounding cube is larger than the smallest containing octree element by sqrt(3)
|
||||
// MIN_ELEMENT_APPARENT_ANGLE = angular diameter of 1x1x1m cube at 400m = sqrt(3) / 400 = 0.0043301f;
|
||||
const float MIN_ELEMENT_APPARENT_ANGLE = 0.0043301f;
|
||||
// NOTE: the entity bounding cube is larger than the smallest possible containing octree element by sqrt(3)
|
||||
const float SQRT_THREE = 1.73205080f;
|
||||
const float MIN_ENTITY_APPARENT_ANGLE = MIN_ELEMENT_APPARENT_ANGLE * SQRT_THREE;
|
||||
const float MIN_VISIBLE_DISTANCE = 0.0001f; // helps avoid divide-by-zero check
|
||||
|
|
|
@ -328,6 +328,7 @@ bool closeEnough(float a, float b, float relativeError) {
|
|||
return fabsf(a - b) / (0.5f * fabsf(a + b) + EPSILON) < relativeError;
|
||||
}
|
||||
|
||||
// TODO: the slop and relative error should be passed in by argument rather than hard-coded.
|
||||
bool ViewFrustum::isVerySimilar(const ViewFrustum& other) const {
|
||||
const float MIN_POSITION_SLOP_SQUARED = 25.0f; // 5 meters squared
|
||||
const float MIN_ORIENTATION_DOT = 0.9924039f; // dot product of two quaternions 10 degrees apart
|
||||
|
|
Loading…
Reference in a new issue