mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 22:36:57 +02:00
fix two bugs in models not rendering
This commit is contained in:
parent
b7cc97534f
commit
0e446d0fc5
4 changed files with 15 additions and 12 deletions
|
@ -108,6 +108,7 @@ bool FindAndUpdateModelOperator::PostRecursion(OctreeElement* element) {
|
||||||
return !_found; // if we haven't yet found it, keep looking
|
return !_found; // if we haven't yet found it, keep looking
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: improve this to not use multiple recursions
|
||||||
void ModelTree::storeModel(const ModelItem& model, const SharedNodePointer& senderNode) {
|
void ModelTree::storeModel(const ModelItem& model, const SharedNodePointer& senderNode) {
|
||||||
// First, look for the existing model in the tree..
|
// First, look for the existing model in the tree..
|
||||||
FindAndUpdateModelOperator theOperator(model);
|
FindAndUpdateModelOperator theOperator(model);
|
||||||
|
@ -118,8 +119,13 @@ void ModelTree::storeModel(const ModelItem& model, const SharedNodePointer& send
|
||||||
AABox modelBox = model.getAABox();
|
AABox modelBox = model.getAABox();
|
||||||
ModelTreeElement* element = (ModelTreeElement*)getOrCreateChildElementContaining(model.getAABox());
|
ModelTreeElement* element = (ModelTreeElement*)getOrCreateChildElementContaining(model.getAABox());
|
||||||
element->storeModel(model);
|
element->storeModel(model);
|
||||||
|
|
||||||
|
// In the case where we stored it, we also need to mark the entire "path" down to the model as
|
||||||
|
// having changed. Otherwise viewers won't see this change. So we call this recursion now that
|
||||||
|
// we know it will be found, this find/update will correctly mark the tree as changed.
|
||||||
|
recurseTreeWithOperator(&theOperator);
|
||||||
}
|
}
|
||||||
// what else do we need to do here to get reaveraging to work
|
|
||||||
_isDirty = true;
|
_isDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,8 @@ public:
|
||||||
virtual int processEditPacketData(PacketType packetType, const unsigned char* packetData, int packetLength,
|
virtual int processEditPacketData(PacketType packetType, const unsigned char* packetData, int packetLength,
|
||||||
const unsigned char* editData, int maxLength, const SharedNodePointer& senderNode);
|
const unsigned char* editData, int maxLength, const SharedNodePointer& senderNode);
|
||||||
|
|
||||||
|
virtual bool recurseChildrenWithData() const { return false; }
|
||||||
|
|
||||||
virtual void update();
|
virtual void update();
|
||||||
|
|
||||||
void storeModel(const ModelItem& model, const SharedNodePointer& senderNode = SharedNodePointer());
|
void storeModel(const ModelItem& model, const SharedNodePointer& senderNode = SharedNodePointer());
|
||||||
|
|
|
@ -1389,6 +1389,7 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
|
||||||
keepDiggingDeeper = (inViewNotLeafCount > 0);
|
keepDiggingDeeper = (inViewNotLeafCount > 0);
|
||||||
|
|
||||||
if (continueThisLevel && keepDiggingDeeper) {
|
if (continueThisLevel && keepDiggingDeeper) {
|
||||||
|
|
||||||
// at this point, we need to iterate the children who are in view, even if not colored
|
// at this point, we need to iterate the children who are in view, even if not colored
|
||||||
// and we need to determine if there's a deeper tree below them that we care about.
|
// and we need to determine if there's a deeper tree below them that we care about.
|
||||||
//
|
//
|
||||||
|
@ -1424,6 +1425,8 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
|
||||||
|
|
||||||
int childTreeBytesOut = 0;
|
int childTreeBytesOut = 0;
|
||||||
|
|
||||||
|
// TODO - UPDATE THIS COMMENT!!!
|
||||||
|
//
|
||||||
// XXXBHG - Note, this seems like the correct logic here, if we included the color in this packet, then
|
// XXXBHG - Note, this seems like the correct logic here, if we included the color in this packet, then
|
||||||
// the LOD logic determined that the child nodes would not be visible... and if so, we shouldn't recurse
|
// the LOD logic determined that the child nodes would not be visible... and if so, we shouldn't recurse
|
||||||
// them further. But... for some time now the code has included and recursed into these child nodes, which
|
// them further. But... for some time now the code has included and recursed into these child nodes, which
|
||||||
|
@ -1433,7 +1436,7 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
|
||||||
//
|
//
|
||||||
// This only applies in the view frustum case, in other cases, like file save and copy/past where
|
// This only applies in the view frustum case, in other cases, like file save and copy/past where
|
||||||
// no viewFrustum was requested, we still want to recurse the child tree.
|
// no viewFrustum was requested, we still want to recurse the child tree.
|
||||||
if (!params.viewFrustum || !oneAtBit(childrenColoredBits, originalIndex)) {
|
if (recurseChildrenWithData() || !params.viewFrustum || !oneAtBit(childrenColoredBits, originalIndex)) {
|
||||||
childTreeBytesOut = encodeTreeBitstreamRecursion(childElement, packetData, bag, params,
|
childTreeBytesOut = encodeTreeBitstreamRecursion(childElement, packetData, bag, params,
|
||||||
thisLevel, nodeLocationThisView);
|
thisLevel, nodeLocationThisView);
|
||||||
}
|
}
|
||||||
|
@ -1519,16 +1522,6 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
|
||||||
} // end keepDiggingDeeper
|
} // end keepDiggingDeeper
|
||||||
|
|
||||||
// At this point all our BitMasks are complete... so let's output them to see how they compare...
|
// At this point all our BitMasks are complete... so let's output them to see how they compare...
|
||||||
/**
|
|
||||||
printf("This Level's BitMasks: childInTree:");
|
|
||||||
outputBits(childrenExistInTreeBits, false, true);
|
|
||||||
printf(" childInPacket:");
|
|
||||||
outputBits(childrenExistInPacketBits, false, true);
|
|
||||||
printf(" childrenColored:");
|
|
||||||
outputBits(childrenColoredBits, false, true);
|
|
||||||
qDebug("");
|
|
||||||
**/
|
|
||||||
|
|
||||||
// if we were unable to fit this level in our packet, then rewind and add it to the element bag for
|
// if we were unable to fit this level in our packet, then rewind and add it to the element bag for
|
||||||
// sending later...
|
// sending later...
|
||||||
if (continueThisLevel) {
|
if (continueThisLevel) {
|
||||||
|
|
|
@ -209,6 +209,8 @@ public:
|
||||||
virtual bool handlesEditPacketType(PacketType packetType) const { return false; }
|
virtual bool handlesEditPacketType(PacketType packetType) const { return false; }
|
||||||
virtual int processEditPacketData(PacketType packetType, const unsigned char* packetData, int packetLength,
|
virtual int processEditPacketData(PacketType packetType, const unsigned char* packetData, int packetLength,
|
||||||
const unsigned char* editData, int maxLength, const SharedNodePointer& sourceNode) { return 0; }
|
const unsigned char* editData, int maxLength, const SharedNodePointer& sourceNode) { return 0; }
|
||||||
|
|
||||||
|
virtual bool recurseChildrenWithData() const { return true; }
|
||||||
|
|
||||||
|
|
||||||
virtual void update() { }; // nothing to do by default
|
virtual void update() { }; // nothing to do by default
|
||||||
|
|
Loading…
Reference in a new issue