mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 19:13:38 +02:00
improvements to delta sending
This commit is contained in:
parent
dc70675c22
commit
ab8e2916d3
3 changed files with 31 additions and 9 deletions
|
@ -1331,10 +1331,6 @@ int VoxelTree::encodeTreeBitstreamRecursion(VoxelNode* node, unsigned char* outp
|
|||
} // wants occlusion culling & isLeaf()
|
||||
|
||||
|
||||
bool childWasInView = (childNode && params.deltaViewFrustum &&
|
||||
|
||||
(params.lastViewFrustum && ViewFrustum::INSIDE == childNode->inFrustum(*params.lastViewFrustum)));
|
||||
|
||||
// There are two types of nodes for which we want to send colors:
|
||||
// 1) Leaves - obviously
|
||||
// 2) Non-leaves who's children would be visible and beyond our LOD.
|
||||
|
@ -1360,15 +1356,34 @@ int VoxelTree::encodeTreeBitstreamRecursion(VoxelNode* node, unsigned char* outp
|
|||
}
|
||||
// if any of our grandchildren ARE in view, then we don't want to include our color. If none are, then
|
||||
// we do want to include our color
|
||||
if (grandChildrenInView > 0 && grandChildrenInLOD==0) {
|
||||
if (grandChildrenInView > 0 && grandChildrenInLOD == 0) {
|
||||
isLeafOrLOD = true;
|
||||
}
|
||||
}
|
||||
|
||||
// track children with actual color, only if the child wasn't previously in view!
|
||||
if (childNode && isLeafOrLOD && childNode->isColored() && !childWasInView && !childIsOccluded) {
|
||||
childrenColoredBits += (1 << (7 - originalIndex));
|
||||
inViewWithColorCount++;
|
||||
if (childNode && isLeafOrLOD && childNode->isColored() && !childIsOccluded) {
|
||||
bool childWasInView = false;
|
||||
|
||||
if (childNode && params.deltaViewFrustum && params.lastViewFrustum) {
|
||||
ViewFrustum::location location = childNode->inFrustum(*params.lastViewFrustum);
|
||||
|
||||
// If we're a leaf, then either intersect or inside is considered "formerly in view"
|
||||
if (childNode->isLeaf()) {
|
||||
childWasInView = location != ViewFrustum::OUTSIDE;
|
||||
} else {
|
||||
childWasInView = location == ViewFrustum::INSIDE;
|
||||
}
|
||||
}
|
||||
|
||||
// If our child wasn't in view (or we're ignoring wasInView) then we add it to our sending items
|
||||
if (!childWasInView) {
|
||||
childrenColoredBits += (1 << (7 - originalIndex));
|
||||
inViewWithColorCount++;
|
||||
} else {
|
||||
// otherwise just track stats of the items we discarded
|
||||
params.childWasInViewDiscarded++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,6 +45,8 @@ public:
|
|||
bool deltaViewFrustum;
|
||||
const ViewFrustum* lastViewFrustum;
|
||||
bool wantOcclusionCulling;
|
||||
long childWasInViewDiscarded;
|
||||
|
||||
CoverageMap* map;
|
||||
|
||||
EncodeBitstreamParams(
|
||||
|
@ -66,6 +68,7 @@ public:
|
|||
deltaViewFrustum (deltaViewFrustum),
|
||||
lastViewFrustum (lastViewFrustum),
|
||||
wantOcclusionCulling(wantOcclusionCulling),
|
||||
childWasInViewDiscarded(0),
|
||||
map (map)
|
||||
{}
|
||||
};
|
||||
|
|
|
@ -127,7 +127,7 @@ void deepestLevelVoxelDistributor(NodeList* nodeList,
|
|||
long long start = usecTimestampNow();
|
||||
|
||||
// FOR NOW... node tells us if it wants to receive only view frustum deltas
|
||||
bool wantDelta = nodeData->getWantDelta();
|
||||
bool wantDelta = viewFrustumChanged && nodeData->getWantDelta();
|
||||
const ViewFrustum* lastViewFrustum = wantDelta ? &nodeData->getLastKnownViewFrustum() : NULL;
|
||||
|
||||
if (::debugVoxelSending) {
|
||||
|
@ -233,6 +233,10 @@ void deepestLevelVoxelDistributor(NodeList* nodeList,
|
|||
|
||||
bytesWritten = serverTree.encodeTreeBitstream(subTree, &tempOutputBuffer[0], MAX_VOXEL_PACKET_SIZE - 1,
|
||||
nodeData->nodeBag, params);
|
||||
|
||||
if (::debugVoxelSending && wantDelta) {
|
||||
printf("encodeTreeBitstream() childWasInViewDiscarded=%ld\n", params.childWasInViewDiscarded);
|
||||
}
|
||||
|
||||
if (nodeData->getAvailable() >= bytesWritten) {
|
||||
nodeData->writeToPacket(&tempOutputBuffer[0], bytesWritten);
|
||||
|
|
Loading…
Reference in a new issue