mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 21:57:00 +02:00
support for models in root element
This commit is contained in:
parent
1278470a91
commit
e7425a8128
4 changed files with 28 additions and 4 deletions
|
@ -41,6 +41,7 @@ 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 rootElementHasData() const { return true; }
|
||||||
virtual void update();
|
virtual void update();
|
||||||
|
|
||||||
void storeModel(const ModelItem& model, const SharedNodePointer& senderNode = SharedNodePointer());
|
void storeModel(const ModelItem& model, const SharedNodePointer& senderNode = SharedNodePointer());
|
||||||
|
|
|
@ -53,8 +53,6 @@ PacketVersion versionForPacketType(PacketType type) {
|
||||||
return 1;
|
return 1;
|
||||||
case PacketTypeEnvironmentData:
|
case PacketTypeEnvironmentData:
|
||||||
return 1;
|
return 1;
|
||||||
case PacketTypeParticleData:
|
|
||||||
return 1;
|
|
||||||
case PacketTypeDomainList:
|
case PacketTypeDomainList:
|
||||||
case PacketTypeDomainListRequest:
|
case PacketTypeDomainListRequest:
|
||||||
return 3;
|
return 3;
|
||||||
|
@ -66,8 +64,10 @@ PacketVersion versionForPacketType(PacketType type) {
|
||||||
return 1;
|
return 1;
|
||||||
case PacketTypeOctreeStats:
|
case PacketTypeOctreeStats:
|
||||||
return 1;
|
return 1;
|
||||||
|
case PacketTypeParticleData:
|
||||||
|
return 1;
|
||||||
case PacketTypeModelData:
|
case PacketTypeModelData:
|
||||||
return 1;
|
return 2;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -301,6 +301,13 @@ 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 (destinationElement == _rootElement && rootElementHasData() && (bytesLeftToRead - bytesRead) > 0) {
|
||||||
|
// tell the element to read the subsequent data
|
||||||
|
bytesRead += _rootElement->readElementDataFromBuffer(nodeData + bytesRead, bytesLeftToRead - bytesRead, args);
|
||||||
|
}
|
||||||
|
|
||||||
return bytesRead;
|
return bytesRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1524,7 +1531,22 @@ 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...
|
// 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...
|
||||||
|
if (continueThisLevel && element == _rootElement && rootElementHasData()) {
|
||||||
|
int bytesBeforeChild = packetData->getUncompressedSize();
|
||||||
|
continueThisLevel = element->appendElementData(packetData, params);
|
||||||
|
int bytesAfterChild = packetData->getUncompressedSize();
|
||||||
|
|
||||||
|
if (continueThisLevel) {
|
||||||
|
bytesAtThisLevel += (bytesAfterChild - bytesBeforeChild); // keep track of byte count for this child
|
||||||
|
|
||||||
|
if (params.stats) {
|
||||||
|
params.stats->colorSent(element);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 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) {
|
||||||
|
|
|
@ -211,6 +211,7 @@ public:
|
||||||
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 bool recurseChildrenWithData() const { return true; }
|
||||||
|
virtual bool rootElementHasData() const { return false; }
|
||||||
|
|
||||||
|
|
||||||
virtual void update() { }; // nothing to do by default
|
virtual void update() { }; // nothing to do by default
|
||||||
|
|
Loading…
Reference in a new issue