mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 17:58:45 +02:00
fix HEADER_LENGTH in Octree
This commit is contained in:
parent
07c8bb24b4
commit
ecb6309932
1 changed files with 84 additions and 84 deletions
|
@ -190,13 +190,13 @@ bool Octree::recurseElementWithOperator(OctreeElement* element, RecurseOctreeOpe
|
||||||
if (operatorObject->preRecursion(element)) {
|
if (operatorObject->preRecursion(element)) {
|
||||||
for (int i = 0; i < NUMBER_OF_CHILDREN; i++) {
|
for (int i = 0; i < NUMBER_OF_CHILDREN; i++) {
|
||||||
OctreeElement* child = element->getChildAtIndex(i);
|
OctreeElement* child = element->getChildAtIndex(i);
|
||||||
|
|
||||||
// If there is no child at that location, the Operator may want to create a child at that location.
|
// If there is no child at that location, the Operator may want to create a child at that location.
|
||||||
// So give the operator a chance to do so....
|
// So give the operator a chance to do so....
|
||||||
if (!child) {
|
if (!child) {
|
||||||
child = operatorObject->possiblyCreateChildAt(element, i);
|
child = operatorObject->possiblyCreateChildAt(element, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (child) {
|
if (child) {
|
||||||
if (!recurseElementWithOperator(child, operatorObject, recursionCount + 1)) {
|
if (!recurseElementWithOperator(child, operatorObject, recursionCount + 1)) {
|
||||||
break; // stop recursing if operator returns false...
|
break; // stop recursing if operator returns false...
|
||||||
|
@ -204,7 +204,7 @@ bool Octree::recurseElementWithOperator(OctreeElement* element, RecurseOctreeOpe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return operatorObject->postRecursion(element);
|
return operatorObject->postRecursion(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,20 +282,20 @@ int Octree::readElementData(OctreeElement* destinationElement, const unsigned ch
|
||||||
|
|
||||||
// give this destination element the child mask from the packet
|
// give this destination element the child mask from the packet
|
||||||
const unsigned char ALL_CHILDREN_ASSUMED_TO_EXIST = 0xFF;
|
const unsigned char ALL_CHILDREN_ASSUMED_TO_EXIST = 0xFF;
|
||||||
|
|
||||||
if ((size_t)bytesLeftToRead < sizeof(unsigned char)) {
|
if ((size_t)bytesLeftToRead < sizeof(unsigned char)) {
|
||||||
qCDebug(octree) << "UNEXPECTED: readElementData() only had " << bytesLeftToRead << " bytes. "
|
qCDebug(octree) << "UNEXPECTED: readElementData() only had " << bytesLeftToRead << " bytes. "
|
||||||
"Not enough for meaningful data.";
|
"Not enough for meaningful data.";
|
||||||
return bytesAvailable; // assume we read the entire buffer...
|
return bytesAvailable; // assume we read the entire buffer...
|
||||||
}
|
}
|
||||||
|
|
||||||
if (destinationElement->getScale() < SCALE_AT_DANGEROUSLY_DEEP_RECURSION) {
|
if (destinationElement->getScale() < SCALE_AT_DANGEROUSLY_DEEP_RECURSION) {
|
||||||
qCDebug(octree) << "UNEXPECTED: readElementData() destination element is unreasonably small ["
|
qCDebug(octree) << "UNEXPECTED: readElementData() destination element is unreasonably small ["
|
||||||
<< destinationElement->getScale() << " meters] "
|
<< destinationElement->getScale() << " meters] "
|
||||||
<< " Discarding " << bytesAvailable << " remaining bytes.";
|
<< " Discarding " << bytesAvailable << " remaining bytes.";
|
||||||
return bytesAvailable; // assume we read the entire buffer...
|
return bytesAvailable; // assume we read the entire buffer...
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char colorInPacketMask = *nodeData;
|
unsigned char colorInPacketMask = *nodeData;
|
||||||
bytesRead += sizeof(colorInPacketMask);
|
bytesRead += sizeof(colorInPacketMask);
|
||||||
bytesLeftToRead -= sizeof(colorInPacketMask);
|
bytesLeftToRead -= sizeof(colorInPacketMask);
|
||||||
|
@ -303,13 +303,13 @@ int Octree::readElementData(OctreeElement* destinationElement, const unsigned ch
|
||||||
for (int i = 0; i < NUMBER_OF_CHILDREN; i++) {
|
for (int i = 0; i < NUMBER_OF_CHILDREN; i++) {
|
||||||
// check the colors mask to see if we have a child to color in
|
// check the colors mask to see if we have a child to color in
|
||||||
if (oneAtBit(colorInPacketMask, i)) {
|
if (oneAtBit(colorInPacketMask, i)) {
|
||||||
// addChildAtIndex() should actually be called getOrAddChildAtIndex().
|
// addChildAtIndex() should actually be called getOrAddChildAtIndex().
|
||||||
// When it adds the child it automatically sets the detinationElement dirty.
|
// When it adds the child it automatically sets the detinationElement dirty.
|
||||||
OctreeElement* childElementAt = destinationElement->addChildAtIndex(i);
|
OctreeElement* childElementAt = destinationElement->addChildAtIndex(i);
|
||||||
|
|
||||||
int childElementDataRead = childElementAt->readElementDataFromBuffer(nodeData + bytesRead, bytesLeftToRead, args);
|
int childElementDataRead = childElementAt->readElementDataFromBuffer(nodeData + bytesRead, bytesLeftToRead, args);
|
||||||
childElementAt->setSourceUUID(args.sourceUUID);
|
childElementAt->setSourceUUID(args.sourceUUID);
|
||||||
|
|
||||||
bytesRead += childElementDataRead;
|
bytesRead += childElementDataRead;
|
||||||
bytesLeftToRead -= childElementDataRead;
|
bytesLeftToRead -= childElementDataRead;
|
||||||
|
|
||||||
|
@ -327,7 +327,7 @@ int Octree::readElementData(OctreeElement* destinationElement, const unsigned ch
|
||||||
|
|
||||||
unsigned char childrenInTreeMask = ALL_CHILDREN_ASSUMED_TO_EXIST;
|
unsigned char childrenInTreeMask = ALL_CHILDREN_ASSUMED_TO_EXIST;
|
||||||
unsigned char childInBufferMask = 0;
|
unsigned char childInBufferMask = 0;
|
||||||
int bytesForMasks = args.includeExistsBits ? sizeof(childrenInTreeMask) + sizeof(childInBufferMask)
|
int bytesForMasks = args.includeExistsBits ? sizeof(childrenInTreeMask) + sizeof(childInBufferMask)
|
||||||
: sizeof(childInBufferMask);
|
: sizeof(childInBufferMask);
|
||||||
|
|
||||||
if (bytesLeftToRead < bytesForMasks) {
|
if (bytesLeftToRead < bytesForMasks) {
|
||||||
|
@ -337,7 +337,7 @@ int Octree::readElementData(OctreeElement* destinationElement, const unsigned ch
|
||||||
}
|
}
|
||||||
return bytesAvailable; // assume we read the entire buffer...
|
return bytesAvailable; // assume we read the entire buffer...
|
||||||
}
|
}
|
||||||
|
|
||||||
childrenInTreeMask = args.includeExistsBits ? *(nodeData + bytesRead) : ALL_CHILDREN_ASSUMED_TO_EXIST;
|
childrenInTreeMask = args.includeExistsBits ? *(nodeData + bytesRead) : ALL_CHILDREN_ASSUMED_TO_EXIST;
|
||||||
childInBufferMask = *(nodeData + bytesRead + (args.includeExistsBits ? sizeof(childrenInTreeMask) : 0));
|
childInBufferMask = *(nodeData + bytesRead + (args.includeExistsBits ? sizeof(childrenInTreeMask) : 0));
|
||||||
|
|
||||||
|
@ -378,7 +378,7 @@ int Octree::readElementData(OctreeElement* destinationElement, const unsigned ch
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if this is the root, and there is more data to read, allow it to read it's element data...
|
// if this is the root, and there is more data to read, allow it to read it's element data...
|
||||||
if (destinationElement == _rootElement && rootElementHasData() && bytesLeftToRead > 0) {
|
if (destinationElement == _rootElement && rootElementHasData() && bytesLeftToRead > 0) {
|
||||||
// tell the element to read the subsequent data
|
// tell the element to read the subsequent data
|
||||||
|
@ -420,13 +420,13 @@ void Octree::readBitstreamToTree(const unsigned char * bitstream, unsigned long
|
||||||
"This buffer is corrupt. Returning.";
|
"This buffer is corrupt. Returning.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numberOfThreeBitSectionsInStream == OVERFLOWED_OCTCODE_BUFFER) {
|
if (numberOfThreeBitSectionsInStream == OVERFLOWED_OCTCODE_BUFFER) {
|
||||||
qCDebug(octree) << "UNEXPECTED: parsing of the octal code would overflow the buffer. "
|
qCDebug(octree) << "UNEXPECTED: parsing of the octal code would overflow the buffer. "
|
||||||
"This buffer is corrupt. Returning.";
|
"This buffer is corrupt. Returning.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int numberOfThreeBitSectionsFromNode = numberOfThreeBitSectionsInCode(bitstreamRootElement->getOctalCode());
|
int numberOfThreeBitSectionsFromNode = numberOfThreeBitSectionsInCode(bitstreamRootElement->getOctalCode());
|
||||||
|
|
||||||
// if the octal code returned is not on the same level as the code being searched for, we have OctreeElements to create
|
// if the octal code returned is not on the same level as the code being searched for, we have OctreeElements to create
|
||||||
|
@ -583,11 +583,11 @@ void Octree::deleteOctalCodeFromTreeRecursion(OctreeElement* element, void* extr
|
||||||
void Octree::eraseAllOctreeElements(bool createNewRoot) {
|
void Octree::eraseAllOctreeElements(bool createNewRoot) {
|
||||||
delete _rootElement; // this will recurse and delete all children
|
delete _rootElement; // this will recurse and delete all children
|
||||||
_rootElement = NULL;
|
_rootElement = NULL;
|
||||||
|
|
||||||
if (createNewRoot) {
|
if (createNewRoot) {
|
||||||
_rootElement = createNewElement();
|
_rootElement = createNewElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
_isDirty = true;
|
_isDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -678,7 +678,7 @@ OctreeElement* Octree::getOctreeElementAt(float x, float y, float z, float s) co
|
||||||
OctreeElement* Octree::getOctreeEnclosingElementAt(float x, float y, float z, float s) const {
|
OctreeElement* Octree::getOctreeEnclosingElementAt(float x, float y, float z, float s) const {
|
||||||
unsigned char* octalCode = pointToOctalCode(x,y,z,s);
|
unsigned char* octalCode = pointToOctalCode(x,y,z,s);
|
||||||
OctreeElement* element = nodeForOctalCode(_rootElement, octalCode, NULL);
|
OctreeElement* element = nodeForOctalCode(_rootElement, octalCode, NULL);
|
||||||
|
|
||||||
delete[] octalCode; // cleanup memory
|
delete[] octalCode; // cleanup memory
|
||||||
#ifdef HAS_AUDIT_CHILDREN
|
#ifdef HAS_AUDIT_CHILDREN
|
||||||
if (element) {
|
if (element) {
|
||||||
|
@ -713,7 +713,7 @@ public:
|
||||||
bool findRayIntersectionOp(OctreeElement* element, void* extraData) {
|
bool findRayIntersectionOp(OctreeElement* element, void* extraData) {
|
||||||
RayArgs* args = static_cast<RayArgs*>(extraData);
|
RayArgs* args = static_cast<RayArgs*>(extraData);
|
||||||
bool keepSearching = true;
|
bool keepSearching = true;
|
||||||
if (element->findRayIntersection(args->origin, args->direction, keepSearching,
|
if (element->findRayIntersection(args->origin, args->direction, keepSearching,
|
||||||
args->element, args->distance, args->face, args->intersectedObject, args->precisionPicking)) {
|
args->element, args->distance, args->face, args->intersectedObject, args->precisionPicking)) {
|
||||||
args->found = true;
|
args->found = true;
|
||||||
}
|
}
|
||||||
|
@ -723,7 +723,7 @@ bool findRayIntersectionOp(OctreeElement* element, void* extraData) {
|
||||||
bool Octree::findRayIntersection(const glm::vec3& origin, const glm::vec3& direction,
|
bool Octree::findRayIntersection(const glm::vec3& origin, const glm::vec3& direction,
|
||||||
OctreeElement*& element, float& distance, BoxFace& face, void** intersectedObject,
|
OctreeElement*& element, float& distance, BoxFace& face, void** intersectedObject,
|
||||||
Octree::lockType lockType, bool* accurateResult, bool precisionPicking) {
|
Octree::lockType lockType, bool* accurateResult, bool precisionPicking) {
|
||||||
RayArgs args = { origin, direction, element, distance, face,
|
RayArgs args = { origin, direction, element, distance, face,
|
||||||
intersectedObject, false, precisionPicking};
|
intersectedObject, false, precisionPicking};
|
||||||
distance = FLT_MAX;
|
distance = FLT_MAX;
|
||||||
|
|
||||||
|
@ -742,7 +742,7 @@ bool Octree::findRayIntersection(const glm::vec3& origin, const glm::vec3& direc
|
||||||
}
|
}
|
||||||
|
|
||||||
recurseTreeWithOperation(findRayIntersectionOp, &args);
|
recurseTreeWithOperation(findRayIntersectionOp, &args);
|
||||||
|
|
||||||
if (gotLock) {
|
if (gotLock) {
|
||||||
unlock();
|
unlock();
|
||||||
}
|
}
|
||||||
|
@ -772,7 +772,7 @@ bool findSpherePenetrationOp(OctreeElement* element, void* extraData) {
|
||||||
if (element->hasContent()) {
|
if (element->hasContent()) {
|
||||||
glm::vec3 elementPenetration;
|
glm::vec3 elementPenetration;
|
||||||
if (element->findSpherePenetration(args->center, args->radius, elementPenetration, &args->penetratedObject)) {
|
if (element->findSpherePenetration(args->center, args->radius, elementPenetration, &args->penetratedObject)) {
|
||||||
// NOTE: it is possible for this penetration accumulation algorithm to produce a
|
// NOTE: it is possible for this penetration accumulation algorithm to produce a
|
||||||
// final penetration vector with zero length.
|
// final penetration vector with zero length.
|
||||||
args->penetration = addPenetrations(args->penetration, elementPenetration);
|
args->penetration = addPenetrations(args->penetration, elementPenetration);
|
||||||
args->found = true;
|
args->found = true;
|
||||||
|
@ -817,7 +817,7 @@ bool Octree::findSpherePenetration(const glm::vec3& center, float radius, glm::v
|
||||||
if (gotLock) {
|
if (gotLock) {
|
||||||
unlock();
|
unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (accurateResult) {
|
if (accurateResult) {
|
||||||
*accurateResult = true; // if user asked to accuracy or result, let them know this is accurate
|
*accurateResult = true; // if user asked to accuracy or result, let them know this is accurate
|
||||||
}
|
}
|
||||||
|
@ -867,14 +867,14 @@ bool findCapsulePenetrationOp(OctreeElement* element, void* extraData) {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint qHash(const glm::vec3& point) {
|
uint qHash(const glm::vec3& point) {
|
||||||
// NOTE: TREE_SCALE = 16384 (15 bits) and multiplier is 1024 (11 bits),
|
// NOTE: TREE_SCALE = 16384 (15 bits) and multiplier is 1024 (11 bits),
|
||||||
// so each component (26 bits) uses more than its alloted 21 bits.
|
// so each component (26 bits) uses more than its alloted 21 bits.
|
||||||
// however we don't expect to span huge cubes so it is ok if we wrap
|
// however we don't expect to span huge cubes so it is ok if we wrap
|
||||||
// (every 2^21 / 2^10 = 2048 meters).
|
// (every 2^21 / 2^10 = 2048 meters).
|
||||||
const uint BITS_PER_COMPONENT = 21;
|
const uint BITS_PER_COMPONENT = 21;
|
||||||
const quint64 MAX_SCALED_COMPONENT = 2097152; // 2^21
|
const quint64 MAX_SCALED_COMPONENT = 2097152; // 2^21
|
||||||
const float RESOLUTION_PER_METER = 1024.0f; // 2^10
|
const float RESOLUTION_PER_METER = 1024.0f; // 2^10
|
||||||
return qHash((quint64)(point.x * RESOLUTION_PER_METER) % MAX_SCALED_COMPONENT +
|
return qHash((quint64)(point.x * RESOLUTION_PER_METER) % MAX_SCALED_COMPONENT +
|
||||||
(((quint64)(point.y * RESOLUTION_PER_METER)) % MAX_SCALED_COMPONENT << BITS_PER_COMPONENT) +
|
(((quint64)(point.y * RESOLUTION_PER_METER)) % MAX_SCALED_COMPONENT << BITS_PER_COMPONENT) +
|
||||||
(((quint64)(point.z * RESOLUTION_PER_METER)) % MAX_SCALED_COMPONENT << 2 * BITS_PER_COMPONENT));
|
(((quint64)(point.z * RESOLUTION_PER_METER)) % MAX_SCALED_COMPONENT << 2 * BITS_PER_COMPONENT));
|
||||||
}
|
}
|
||||||
|
@ -899,9 +899,9 @@ bool findContentInCubeOp(OctreeElement* element, void* extraData) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Octree::findCapsulePenetration(const glm::vec3& start, const glm::vec3& end, float radius,
|
bool Octree::findCapsulePenetration(const glm::vec3& start, const glm::vec3& end, float radius,
|
||||||
glm::vec3& penetration, Octree::lockType lockType, bool* accurateResult) {
|
glm::vec3& penetration, Octree::lockType lockType, bool* accurateResult) {
|
||||||
|
|
||||||
CapsuleArgs args = { start, end, radius, penetration, false };
|
CapsuleArgs args = { start, end, radius, penetration, false };
|
||||||
penetration = glm::vec3(0.0f, 0.0f, 0.0f);
|
penetration = glm::vec3(0.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
|
@ -920,7 +920,7 @@ bool Octree::findCapsulePenetration(const glm::vec3& start, const glm::vec3& end
|
||||||
}
|
}
|
||||||
|
|
||||||
recurseTreeWithOperation(findCapsulePenetrationOp, &args);
|
recurseTreeWithOperation(findCapsulePenetrationOp, &args);
|
||||||
|
|
||||||
if (gotLock) {
|
if (gotLock) {
|
||||||
unlock();
|
unlock();
|
||||||
}
|
}
|
||||||
|
@ -967,7 +967,7 @@ OctreeElement* Octree::getElementEnclosingPoint(const glm::vec3& point, Octree::
|
||||||
GetElementEnclosingArgs args;
|
GetElementEnclosingArgs args;
|
||||||
args.point = point;
|
args.point = point;
|
||||||
args.element = NULL;
|
args.element = NULL;
|
||||||
|
|
||||||
bool gotLock = false;
|
bool gotLock = false;
|
||||||
if (lockType == Octree::Lock) {
|
if (lockType == Octree::Lock) {
|
||||||
lockForRead();
|
lockForRead();
|
||||||
|
@ -983,7 +983,7 @@ OctreeElement* Octree::getElementEnclosingPoint(const glm::vec3& point, Octree::
|
||||||
}
|
}
|
||||||
|
|
||||||
recurseTreeWithOperation(getElementEnclosingOperation, (void*)&args);
|
recurseTreeWithOperation(getElementEnclosingOperation, (void*)&args);
|
||||||
|
|
||||||
if (gotLock) {
|
if (gotLock) {
|
||||||
unlock();
|
unlock();
|
||||||
}
|
}
|
||||||
|
@ -1040,7 +1040,7 @@ int Octree::encodeTreeBitstream(OctreeElement* element,
|
||||||
params.stopReason = EncodeBitstreamParams::DIDNT_FIT;
|
params.stopReason = EncodeBitstreamParams::DIDNT_FIT;
|
||||||
return bytesWritten;
|
return bytesWritten;
|
||||||
}
|
}
|
||||||
|
|
||||||
bytesWritten += codeLength; // keep track of byte count
|
bytesWritten += codeLength; // keep track of byte count
|
||||||
|
|
||||||
int currentEncodeLevel = 0;
|
int currentEncodeLevel = 0;
|
||||||
|
@ -1126,7 +1126,7 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
|
||||||
return bytesAtThisLevel;
|
return bytesAtThisLevel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewFrustum::location nodeLocationThisView = ViewFrustum::INSIDE; // assume we're inside
|
ViewFrustum::location nodeLocationThisView = ViewFrustum::INSIDE; // assume we're inside
|
||||||
|
|
||||||
// caller can pass NULL as viewFrustum if they want everything
|
// caller can pass NULL as viewFrustum if they want everything
|
||||||
|
@ -1216,7 +1216,7 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
|
||||||
// If the user also asked for occlusion culling, check if this element is occluded, but only if it's not a leaf.
|
// If the user also asked for occlusion culling, check if this element is occluded, but only if it's not a leaf.
|
||||||
// leaf occlusion is handled down below when we check child nodes
|
// leaf occlusion is handled down below when we check child nodes
|
||||||
if (params.wantOcclusionCulling && !element->isLeaf()) {
|
if (params.wantOcclusionCulling && !element->isLeaf()) {
|
||||||
OctreeProjectedPolygon* voxelPolygon =
|
OctreeProjectedPolygon* voxelPolygon =
|
||||||
new OctreeProjectedPolygon(params.viewFrustum->getProjectedPolygon(element->getAACube()));
|
new OctreeProjectedPolygon(params.viewFrustum->getProjectedPolygon(element->getAACube()));
|
||||||
|
|
||||||
// In order to check occlusion culling, the shadow has to be "all in view" otherwise, we will ignore occlusion
|
// In order to check occlusion culling, the shadow has to be "all in view" otherwise, we will ignore occlusion
|
||||||
|
@ -1256,13 +1256,13 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
|
||||||
if (params.includeExistsBits) {
|
if (params.includeExistsBits) {
|
||||||
requiredBytes += sizeof(childrenExistInTreeBits);
|
requiredBytes += sizeof(childrenExistInTreeBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If this datatype allows root elements to include data, and this is the root, then ask the tree for the
|
// If this datatype allows root elements to include data, and this is the root, then ask the tree for the
|
||||||
// minimum bytes needed for root data and reserve those also
|
// minimum bytes needed for root data and reserve those also
|
||||||
if (element == _rootElement && rootElementHasData()) {
|
if (element == _rootElement && rootElementHasData()) {
|
||||||
requiredBytes += minimumRequiredRootDataBytes();
|
requiredBytes += minimumRequiredRootDataBytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool continueThisLevel = packetData->reserveBytes(requiredBytes);
|
bool continueThisLevel = packetData->reserveBytes(requiredBytes);
|
||||||
|
|
||||||
// If we can't reserve our minimum bytes then we can discard this level and return as if none of this level fits
|
// If we can't reserve our minimum bytes then we can discard this level and return as if none of this level fits
|
||||||
|
@ -1327,10 +1327,10 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
|
||||||
OctreeElement* childElement = sortedChildren[i];
|
OctreeElement* childElement = sortedChildren[i];
|
||||||
int originalIndex = indexOfChildren[i];
|
int originalIndex = indexOfChildren[i];
|
||||||
|
|
||||||
bool childIsInView = (childElement &&
|
bool childIsInView = (childElement &&
|
||||||
( !params.viewFrustum || // no view frustum was given, everything is assumed in view
|
( !params.viewFrustum || // no view frustum was given, everything is assumed in view
|
||||||
(nodeLocationThisView == ViewFrustum::INSIDE) || // parent was fully in view, we can assume ALL children are
|
(nodeLocationThisView == ViewFrustum::INSIDE) || // parent was fully in view, we can assume ALL children are
|
||||||
(nodeLocationThisView == ViewFrustum::INTERSECT &&
|
(nodeLocationThisView == ViewFrustum::INTERSECT &&
|
||||||
childElement->isInView(*params.viewFrustum)) // the parent intersects and the child is in view
|
childElement->isInView(*params.viewFrustum)) // the parent intersects and the child is in view
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -1450,7 +1450,7 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: the childrenDataBits indicates that there is an array of child element data included in this packet.
|
// NOTE: the childrenDataBits indicates that there is an array of child element data included in this packet.
|
||||||
// We wil write this bit mask but we may come back later and update the bits that are actually included
|
// We wil write this bit mask but we may come back later and update the bits that are actually included
|
||||||
packetData->releaseReservedBytes(sizeof(childrenDataBits));
|
packetData->releaseReservedBytes(sizeof(childrenDataBits));
|
||||||
continueThisLevel = packetData->appendBitMask(childrenDataBits);
|
continueThisLevel = packetData->appendBitMask(childrenDataBits);
|
||||||
|
@ -1463,10 +1463,10 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
|
||||||
if (params.stats) {
|
if (params.stats) {
|
||||||
params.stats->colorBitsWritten(); // really data bits not just color bits
|
params.stats->colorBitsWritten(); // really data bits not just color bits
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOW might be a good time to give our tree subclass and this element a chance to set up and check any extra encode data
|
// NOW might be a good time to give our tree subclass and this element a chance to set up and check any extra encode data
|
||||||
element->initializeExtraEncodeData(params);
|
element->initializeExtraEncodeData(params);
|
||||||
|
|
||||||
// write the child element data... NOTE: includeColor means include element data
|
// write the child element data... NOTE: includeColor means include element data
|
||||||
// NOTE: the format of the bitstream is generally this:
|
// NOTE: the format of the bitstream is generally this:
|
||||||
// [octalcode]
|
// [octalcode]
|
||||||
|
@ -1486,31 +1486,31 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
|
||||||
// processed and sent the data bits for. Let our tree subclass determine if it really wants to send the
|
// processed and sent the data bits for. Let our tree subclass determine if it really wants to send the
|
||||||
// data for this child at this point
|
// data for this child at this point
|
||||||
if (childElement && element->shouldIncludeChildData(i, params)) {
|
if (childElement && element->shouldIncludeChildData(i, params)) {
|
||||||
|
|
||||||
int bytesBeforeChild = packetData->getUncompressedSize();
|
int bytesBeforeChild = packetData->getUncompressedSize();
|
||||||
|
|
||||||
// a childElement may "partially" write it's data. for example, the model server where the entire
|
// a childElement may "partially" write it's data. for example, the model server where the entire
|
||||||
// contents of the element may be larger than can fit in a single MTU/packetData. In this case,
|
// contents of the element may be larger than can fit in a single MTU/packetData. In this case,
|
||||||
// we want to allow the appendElementData() to respond that it produced partial data, which should be
|
// we want to allow the appendElementData() to respond that it produced partial data, which should be
|
||||||
// written, but that the childElement needs to be reprocessed in an additional pass or passes
|
// written, but that the childElement needs to be reprocessed in an additional pass or passes
|
||||||
// to be completed.
|
// to be completed.
|
||||||
LevelDetails childDataLevelKey = packetData->startLevel();
|
LevelDetails childDataLevelKey = packetData->startLevel();
|
||||||
|
|
||||||
OctreeElement::AppendState childAppendState = childElement->appendElementData(packetData, params);
|
OctreeElement::AppendState childAppendState = childElement->appendElementData(packetData, params);
|
||||||
|
|
||||||
// allow our tree subclass to do any additional bookkeeping it needs to do with encoded data state
|
// allow our tree subclass to do any additional bookkeeping it needs to do with encoded data state
|
||||||
element->updateEncodedData(i, childAppendState, params);
|
element->updateEncodedData(i, childAppendState, params);
|
||||||
|
|
||||||
// Continue this level so long as some part of this child element was appended.
|
// Continue this level so long as some part of this child element was appended.
|
||||||
bool childFit = (childAppendState != OctreeElement::NONE);
|
bool childFit = (childAppendState != OctreeElement::NONE);
|
||||||
|
|
||||||
// some datatypes (like Voxels) assume that all child data will fit, if it doesn't fit
|
// some datatypes (like Voxels) assume that all child data will fit, if it doesn't fit
|
||||||
// the data type wants to bail on this element level completely
|
// the data type wants to bail on this element level completely
|
||||||
if (!childFit && mustIncludeAllChildData()) {
|
if (!childFit && mustIncludeAllChildData()) {
|
||||||
continueThisLevel = false;
|
continueThisLevel = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the child was partially or fully appended, then mark the actualChildrenDataBits as including
|
// If the child was partially or fully appended, then mark the actualChildrenDataBits as including
|
||||||
// this child data
|
// this child data
|
||||||
if (childFit) {
|
if (childFit) {
|
||||||
|
@ -1527,9 +1527,9 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
|
||||||
elementAppendState = OctreeElement::PARTIAL;
|
elementAppendState = OctreeElement::PARTIAL;
|
||||||
params.stopReason = EncodeBitstreamParams::DIDNT_FIT;
|
params.stopReason = EncodeBitstreamParams::DIDNT_FIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bytesAfterChild = packetData->getUncompressedSize();
|
int bytesAfterChild = packetData->getUncompressedSize();
|
||||||
|
|
||||||
bytesAtThisLevel += (bytesAfterChild - bytesBeforeChild); // keep track of byte count for this child
|
bytesAtThisLevel += (bytesAfterChild - bytesBeforeChild); // keep track of byte count for this child
|
||||||
|
|
||||||
// don't need to check childElement here, because we can't get here with no childElement
|
// don't need to check childElement here, because we can't get here with no childElement
|
||||||
|
@ -1540,7 +1540,7 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mustIncludeAllChildData() && !continueThisLevel) {
|
if (!mustIncludeAllChildData() && !continueThisLevel) {
|
||||||
qCDebug(octree) << "WARNING UNEXPECTED CASE: reached end of child element data loop with continueThisLevel=FALSE";
|
qCDebug(octree) << "WARNING UNEXPECTED CASE: reached end of child element data loop with continueThisLevel=FALSE";
|
||||||
qCDebug(octree) << "This is not expected!!!! -- continueThisLevel=FALSE....";
|
qCDebug(octree) << "This is not expected!!!! -- continueThisLevel=FALSE....";
|
||||||
|
@ -1753,7 +1753,7 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
|
||||||
// If we made it this far, then we've written all of our child data... if this element is the root
|
// If we made it this far, then we've written all of our child data... if this element is the root
|
||||||
// element, then we also allow the root element to write out it's data...
|
// element, then we also allow the root element to write out it's data...
|
||||||
if (continueThisLevel && element == _rootElement && rootElementHasData()) {
|
if (continueThisLevel && element == _rootElement && rootElementHasData()) {
|
||||||
|
|
||||||
int bytesBeforeChild = packetData->getUncompressedSize();
|
int bytesBeforeChild = packetData->getUncompressedSize();
|
||||||
|
|
||||||
// release the bytes we reserved...
|
// release the bytes we reserved...
|
||||||
|
@ -1772,7 +1772,7 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
|
||||||
} else {
|
} else {
|
||||||
packetData->discardLevel(rootDataLevelKey);
|
packetData->discardLevel(rootDataLevelKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!allOfRootFit) {
|
if (!allOfRootFit) {
|
||||||
elementAppendState = OctreeElement::PARTIAL;
|
elementAppendState = OctreeElement::PARTIAL;
|
||||||
params.stopReason = EncodeBitstreamParams::DIDNT_FIT;
|
params.stopReason = EncodeBitstreamParams::DIDNT_FIT;
|
||||||
|
@ -1804,7 +1804,7 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
|
||||||
continueThisLevel = packetData->endLevel(thisLevelKey);
|
continueThisLevel = packetData->endLevel(thisLevelKey);
|
||||||
} else {
|
} else {
|
||||||
packetData->discardLevel(thisLevelKey);
|
packetData->discardLevel(thisLevelKey);
|
||||||
|
|
||||||
if (!mustIncludeAllChildData()) {
|
if (!mustIncludeAllChildData()) {
|
||||||
qCDebug(octree) << "WARNING UNEXPECTED CASE: Something failed in attempting to pack this element";
|
qCDebug(octree) << "WARNING UNEXPECTED CASE: Something failed in attempting to pack this element";
|
||||||
qCDebug(octree) << "This is not expected!!!! -- continueThisLevel=FALSE....";
|
qCDebug(octree) << "This is not expected!!!! -- continueThisLevel=FALSE....";
|
||||||
|
@ -1831,7 +1831,7 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
|
||||||
params.stopReason = EncodeBitstreamParams::DIDNT_FIT;
|
params.stopReason = EncodeBitstreamParams::DIDNT_FIT;
|
||||||
bytesAtThisLevel = 0; // didn't fit
|
bytesAtThisLevel = 0; // didn't fit
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// assuming we made it here with continueThisLevel == true, we STILL might want
|
// assuming we made it here with continueThisLevel == true, we STILL might want
|
||||||
// to add our element back to the bag for additional encoding, specifically if
|
// to add our element back to the bag for additional encoding, specifically if
|
||||||
// the appendState is PARTIAL, in this case, we re-add our element to the bag
|
// the appendState is PARTIAL, in this case, we re-add our element to the bag
|
||||||
|
@ -1841,7 +1841,7 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
|
||||||
bag.insert(element);
|
bag.insert(element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If our element is completed let the element know so it can do any cleanup it of extra wants
|
// If our element is completed let the element know so it can do any cleanup it of extra wants
|
||||||
if (elementAppendState == OctreeElement::COMPLETED) {
|
if (elementAppendState == OctreeElement::COMPLETED) {
|
||||||
element->elementEncodeComplete(params, &bag);
|
element->elementEncodeComplete(params, &bag);
|
||||||
|
@ -1866,13 +1866,13 @@ bool Octree::readFromFile(const char* fileName) {
|
||||||
emit importProgress(0);
|
emit importProgress(0);
|
||||||
|
|
||||||
qCDebug(octree) << "Loading file" << qFileName << "...";
|
qCDebug(octree) << "Loading file" << qFileName << "...";
|
||||||
|
|
||||||
fileOk = readFromStream(fileLength, fileInputStream);
|
fileOk = readFromStream(fileLength, fileInputStream);
|
||||||
|
|
||||||
emit importProgress(100);
|
emit importProgress(100);
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return fileOk;
|
return fileOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1881,19 +1881,19 @@ bool Octree::readFromURL(const QString& urlString) {
|
||||||
|
|
||||||
// determine if this is a local file or a network resource
|
// determine if this is a local file or a network resource
|
||||||
QUrl url(urlString);
|
QUrl url(urlString);
|
||||||
|
|
||||||
if (url.isLocalFile()) {
|
if (url.isLocalFile()) {
|
||||||
readOk = readFromFile(qPrintable(url.toLocalFile()));
|
readOk = readFromFile(qPrintable(url.toLocalFile()));
|
||||||
} else {
|
} else {
|
||||||
QNetworkRequest request;
|
QNetworkRequest request;
|
||||||
request.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
request.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
||||||
request.setUrl(url);
|
request.setUrl(url);
|
||||||
|
|
||||||
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
||||||
QNetworkReply* reply = networkAccessManager.get(request);
|
QNetworkReply* reply = networkAccessManager.get(request);
|
||||||
|
|
||||||
qCDebug(octree) << "Downloading svo at" << qPrintable(urlString);
|
qCDebug(octree) << "Downloading svo at" << qPrintable(urlString);
|
||||||
|
|
||||||
QEventLoop loop;
|
QEventLoop loop;
|
||||||
QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
|
QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
|
||||||
loop.exec();
|
loop.exec();
|
||||||
|
@ -1933,7 +1933,7 @@ bool Octree::readSVOFromStream(unsigned long streamLength, QDataStream& inputStr
|
||||||
PacketVersion gotVersion = 0;
|
PacketVersion gotVersion = 0;
|
||||||
|
|
||||||
unsigned long headerLength = 0; // bytes in the header
|
unsigned long headerLength = 0; // bytes in the header
|
||||||
|
|
||||||
bool wantImportProgress = true;
|
bool wantImportProgress = true;
|
||||||
|
|
||||||
PacketType::Value expectedType = expectedDataPacketType();
|
PacketType::Value expectedType = expectedDataPacketType();
|
||||||
|
@ -1944,10 +1944,10 @@ bool Octree::readSVOFromStream(unsigned long streamLength, QDataStream& inputStr
|
||||||
if (getWantSVOfileVersions()) {
|
if (getWantSVOfileVersions()) {
|
||||||
|
|
||||||
// read just enough of the file to parse the header...
|
// read just enough of the file to parse the header...
|
||||||
const unsigned long HEADER_LENGTH = sizeof(PacketType) + sizeof(PacketVersion);
|
const unsigned long HEADER_LENGTH = sizeof(PacketType::Value) + sizeof(PacketVersion);
|
||||||
unsigned char fileHeader[HEADER_LENGTH];
|
unsigned char fileHeader[HEADER_LENGTH];
|
||||||
inputStream.readRawData((char*)&fileHeader, HEADER_LENGTH);
|
inputStream.readRawData((char*)&fileHeader, HEADER_LENGTH);
|
||||||
|
|
||||||
headerLength = HEADER_LENGTH; // we need this later to skip to the data
|
headerLength = HEADER_LENGTH; // we need this later to skip to the data
|
||||||
|
|
||||||
unsigned char* dataAt = (unsigned char*)&fileHeader;
|
unsigned char* dataAt = (unsigned char*)&fileHeader;
|
||||||
|
@ -1960,22 +1960,22 @@ bool Octree::readSVOFromStream(unsigned long streamLength, QDataStream& inputStr
|
||||||
dataAt += sizeof(expectedType);
|
dataAt += sizeof(expectedType);
|
||||||
dataLength -= sizeof(expectedType);
|
dataLength -= sizeof(expectedType);
|
||||||
gotVersion = *dataAt;
|
gotVersion = *dataAt;
|
||||||
|
|
||||||
if (gotType == expectedType) {
|
if (gotType == expectedType) {
|
||||||
if (canProcessVersion(gotVersion)) {
|
if (canProcessVersion(gotVersion)) {
|
||||||
dataAt += sizeof(gotVersion);
|
dataAt += sizeof(gotVersion);
|
||||||
dataLength -= sizeof(gotVersion);
|
dataLength -= sizeof(gotVersion);
|
||||||
fileOk = true;
|
fileOk = true;
|
||||||
qCDebug(octree, "SVO file version match. Expected: %d Got: %d",
|
qCDebug(octree, "SVO file version match. Expected: %d Got: %d",
|
||||||
versionForPacketType(expectedDataPacketType()), gotVersion);
|
versionForPacketType(expectedDataPacketType()), gotVersion);
|
||||||
|
|
||||||
hasBufferBreaks = versionHasSVOfileBreaks(gotVersion);
|
hasBufferBreaks = versionHasSVOfileBreaks(gotVersion);
|
||||||
} else {
|
} else {
|
||||||
qCDebug(octree, "SVO file version mismatch. Expected: %d Got: %d",
|
qCDebug(octree, "SVO file version mismatch. Expected: %d Got: %d",
|
||||||
versionForPacketType(expectedDataPacketType()), gotVersion);
|
versionForPacketType(expectedDataPacketType()), gotVersion);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qCDebug(octree) << "SVO file type mismatch. Expected: " << nameForPacketType(expectedType)
|
qCDebug(octree) << "SVO file type mismatch. Expected: " << nameForPacketType(expectedType)
|
||||||
<< " Got: " << nameForPacketType(gotType);
|
<< " Got: " << nameForPacketType(gotType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1983,7 +1983,7 @@ bool Octree::readSVOFromStream(unsigned long streamLength, QDataStream& inputStr
|
||||||
qCDebug(octree) << " NOTE: this file type does not include type and version information.";
|
qCDebug(octree) << " NOTE: this file type does not include type and version information.";
|
||||||
fileOk = true; // assume the file is ok
|
fileOk = true; // assume the file is ok
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasBufferBreaks) {
|
if (hasBufferBreaks) {
|
||||||
qCDebug(octree) << " this version includes buffer breaks";
|
qCDebug(octree) << " this version includes buffer breaks";
|
||||||
} else {
|
} else {
|
||||||
|
@ -1991,18 +1991,18 @@ bool Octree::readSVOFromStream(unsigned long streamLength, QDataStream& inputStr
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileOk) {
|
if (fileOk) {
|
||||||
|
|
||||||
// if this version of the file does not include buffer breaks, then we need to load the entire file at once
|
// if this version of the file does not include buffer breaks, then we need to load the entire file at once
|
||||||
if (!hasBufferBreaks) {
|
if (!hasBufferBreaks) {
|
||||||
|
|
||||||
// read the entire file into a buffer, WHAT!? Why not.
|
// read the entire file into a buffer, WHAT!? Why not.
|
||||||
unsigned long dataLength = streamLength - headerLength;
|
unsigned long dataLength = streamLength - headerLength;
|
||||||
unsigned char* entireFileDataSection = new unsigned char[dataLength];
|
unsigned char* entireFileDataSection = new unsigned char[dataLength];
|
||||||
inputStream.readRawData((char*)entireFileDataSection, dataLength);
|
inputStream.readRawData((char*)entireFileDataSection, dataLength);
|
||||||
|
|
||||||
unsigned char* dataAt = entireFileDataSection;
|
unsigned char* dataAt = entireFileDataSection;
|
||||||
|
|
||||||
ReadBitstreamToTreeParams args(WANT_COLOR, NO_EXISTS_BITS, NULL, 0,
|
ReadBitstreamToTreeParams args(WANT_COLOR, NO_EXISTS_BITS, NULL, 0,
|
||||||
SharedNodePointer(), wantImportProgress, gotVersion);
|
SharedNodePointer(), wantImportProgress, gotVersion);
|
||||||
|
|
||||||
readBitstreamToTree(dataAt, dataLength, args);
|
readBitstreamToTree(dataAt, dataLength, args);
|
||||||
|
@ -2010,38 +2010,38 @@ bool Octree::readSVOFromStream(unsigned long streamLength, QDataStream& inputStr
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
||||||
unsigned long dataLength = streamLength - headerLength;
|
unsigned long dataLength = streamLength - headerLength;
|
||||||
unsigned long remainingLength = dataLength;
|
unsigned long remainingLength = dataLength;
|
||||||
const unsigned long MAX_CHUNK_LENGTH = MAX_OCTREE_PACKET_SIZE * 2;
|
const unsigned long MAX_CHUNK_LENGTH = MAX_OCTREE_PACKET_SIZE * 2;
|
||||||
unsigned char* fileChunk = new unsigned char[MAX_CHUNK_LENGTH];
|
unsigned char* fileChunk = new unsigned char[MAX_CHUNK_LENGTH];
|
||||||
|
|
||||||
while (remainingLength > 0) {
|
while (remainingLength > 0) {
|
||||||
quint16 chunkLength = 0;
|
quint16 chunkLength = 0;
|
||||||
|
|
||||||
inputStream.readRawData((char*)&chunkLength, sizeof(chunkLength));
|
inputStream.readRawData((char*)&chunkLength, sizeof(chunkLength));
|
||||||
remainingLength -= sizeof(chunkLength);
|
remainingLength -= sizeof(chunkLength);
|
||||||
|
|
||||||
if (chunkLength > remainingLength) {
|
if (chunkLength > remainingLength) {
|
||||||
qCDebug(octree) << "UNEXPECTED chunk size of:" << chunkLength
|
qCDebug(octree) << "UNEXPECTED chunk size of:" << chunkLength
|
||||||
<< "greater than remaining length:" << remainingLength;
|
<< "greater than remaining length:" << remainingLength;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chunkLength > MAX_CHUNK_LENGTH) {
|
if (chunkLength > MAX_CHUNK_LENGTH) {
|
||||||
qCDebug(octree) << "UNEXPECTED chunk size of:" << chunkLength
|
qCDebug(octree) << "UNEXPECTED chunk size of:" << chunkLength
|
||||||
<< "greater than MAX_CHUNK_LENGTH:" << MAX_CHUNK_LENGTH;
|
<< "greater than MAX_CHUNK_LENGTH:" << MAX_CHUNK_LENGTH;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
inputStream.readRawData((char*)fileChunk, chunkLength);
|
inputStream.readRawData((char*)fileChunk, chunkLength);
|
||||||
|
|
||||||
remainingLength -= chunkLength;
|
remainingLength -= chunkLength;
|
||||||
|
|
||||||
unsigned char* dataAt = fileChunk;
|
unsigned char* dataAt = fileChunk;
|
||||||
unsigned long dataLength = chunkLength;
|
unsigned long dataLength = chunkLength;
|
||||||
|
|
||||||
ReadBitstreamToTreeParams args(WANT_COLOR, NO_EXISTS_BITS, NULL, 0,
|
ReadBitstreamToTreeParams args(WANT_COLOR, NO_EXISTS_BITS, NULL, 0,
|
||||||
SharedNodePointer(), wantImportProgress, gotVersion);
|
SharedNodePointer(), wantImportProgress, gotVersion);
|
||||||
|
|
||||||
readBitstreamToTree(dataAt, dataLength, args);
|
readBitstreamToTree(dataAt, dataLength, args);
|
||||||
|
@ -2051,7 +2051,7 @@ bool Octree::readSVOFromStream(unsigned long streamLength, QDataStream& inputStr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return fileOk;
|
return fileOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2136,7 +2136,7 @@ void Octree::writeToSVOFile(const char* fileName, OctreeElement* element) {
|
||||||
} else {
|
} else {
|
||||||
qCDebug(octree) << " this version does not include buffer breaks";
|
qCDebug(octree) << " this version does not include buffer breaks";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
OctreeElementBag elementBag;
|
OctreeElementBag elementBag;
|
||||||
OctreeElementExtraEncodeData extraEncodeData;
|
OctreeElementExtraEncodeData extraEncodeData;
|
||||||
|
@ -2153,7 +2153,7 @@ void Octree::writeToSVOFile(const char* fileName, OctreeElement* element) {
|
||||||
|
|
||||||
while (!elementBag.isEmpty()) {
|
while (!elementBag.isEmpty()) {
|
||||||
OctreeElement* subTree = elementBag.extract();
|
OctreeElement* subTree = elementBag.extract();
|
||||||
|
|
||||||
lockForRead(); // do tree locking down here so that we have shorter slices and less thread contention
|
lockForRead(); // do tree locking down here so that we have shorter slices and less thread contention
|
||||||
EncodeBitstreamParams params(INT_MAX, IGNORE_VIEW_FRUSTUM, WANT_COLOR, NO_EXISTS_BITS);
|
EncodeBitstreamParams params(INT_MAX, IGNORE_VIEW_FRUSTUM, WANT_COLOR, NO_EXISTS_BITS);
|
||||||
params.extraEncodeData = &extraEncodeData;
|
params.extraEncodeData = &extraEncodeData;
|
||||||
|
@ -2188,7 +2188,7 @@ void Octree::writeToSVOFile(const char* fileName, OctreeElement* element) {
|
||||||
}
|
}
|
||||||
file.write((const char*)packetData.getFinalizedData(), packetData.getFinalizedSize());
|
file.write((const char*)packetData.getFinalizedData(), packetData.getFinalizedSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
releaseSceneEncodeData(&extraEncodeData);
|
releaseSceneEncodeData(&extraEncodeData);
|
||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
|
|
Loading…
Reference in a new issue