mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 03:17:02 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into animenu
This commit is contained in:
commit
ef9407b1a6
11 changed files with 69 additions and 14 deletions
|
@ -436,8 +436,12 @@ Extents Model::getMeshExtents() const {
|
||||||
return Extents();
|
return Extents();
|
||||||
}
|
}
|
||||||
const Extents& extents = _geometry->getFBXGeometry().meshExtents;
|
const Extents& extents = _geometry->getFBXGeometry().meshExtents;
|
||||||
glm::vec3 scale = _scale * _geometry->getFBXGeometry().fstScaled;
|
|
||||||
Extents scaledExtents = { extents.minimum * scale, extents.maximum * scale };
|
// even though our caller asked for "unscaled" we need to include any fst scaling, translation, and rotation, which
|
||||||
|
// is captured in the offset matrix
|
||||||
|
glm::vec3 minimum = glm::vec3(_geometry->getFBXGeometry().offset * glm::vec4(extents.minimum, 1.0));
|
||||||
|
glm::vec3 maximum = glm::vec3(_geometry->getFBXGeometry().offset * glm::vec4(extents.maximum, 1.0));
|
||||||
|
Extents scaledExtents = { minimum * _scale, maximum * _scale };
|
||||||
return scaledExtents;
|
return scaledExtents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -448,9 +452,12 @@ Extents Model::getUnscaledMeshExtents() const {
|
||||||
|
|
||||||
const Extents& extents = _geometry->getFBXGeometry().meshExtents;
|
const Extents& extents = _geometry->getFBXGeometry().meshExtents;
|
||||||
|
|
||||||
// even though our caller asked for "unscaled" we need to include any fst scaling
|
// even though our caller asked for "unscaled" we need to include any fst scaling, translation, and rotation, which
|
||||||
float scale = _geometry->getFBXGeometry().fstScaled;
|
// is captured in the offset matrix
|
||||||
Extents scaledExtents = { extents.minimum * scale, extents.maximum * scale };
|
glm::vec3 minimum = glm::vec3(_geometry->getFBXGeometry().offset * glm::vec4(extents.minimum, 1.0));
|
||||||
|
glm::vec3 maximum = glm::vec3(_geometry->getFBXGeometry().offset * glm::vec4(extents.maximum, 1.0));
|
||||||
|
Extents scaledExtents = { minimum, maximum };
|
||||||
|
|
||||||
return scaledExtents;
|
return scaledExtents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,24 @@ void VoxelPacketProcessor::processPacket(const SharedNodePointer& sendingNode, c
|
||||||
} // fall through to piggyback message
|
} // fall through to piggyback message
|
||||||
|
|
||||||
voxelPacketType = packetTypeForPacket(mutablePacket);
|
voxelPacketType = packetTypeForPacket(mutablePacket);
|
||||||
|
PacketVersion packetVersion = mutablePacket[1];
|
||||||
|
PacketVersion expectedVersion = versionForPacketType(voxelPacketType);
|
||||||
|
|
||||||
|
// check version of piggyback packet against expected version
|
||||||
|
if (packetVersion != expectedVersion) {
|
||||||
|
static QMultiMap<QUuid, PacketType> versionDebugSuppressMap;
|
||||||
|
|
||||||
|
QUuid senderUUID = uuidFromPacketHeader(packet);
|
||||||
|
if (!versionDebugSuppressMap.contains(senderUUID, voxelPacketType)) {
|
||||||
|
qDebug() << "Packet version mismatch on" << voxelPacketType << "- Sender"
|
||||||
|
<< senderUUID << "sent" << (int)packetVersion << "but"
|
||||||
|
<< (int)expectedVersion << "expected.";
|
||||||
|
|
||||||
|
versionDebugSuppressMap.insert(senderUUID, voxelPacketType);
|
||||||
|
}
|
||||||
|
return; // bail since piggyback version doesn't match
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) {
|
if (Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) {
|
||||||
app->trackIncomingVoxelPacket(mutablePacket, sendingNode, wasStatsPacket);
|
app->trackIncomingVoxelPacket(mutablePacket, sendingNode, wasStatsPacket);
|
||||||
|
|
|
@ -1399,7 +1399,6 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping)
|
||||||
|
|
||||||
// get offset transform from mapping
|
// get offset transform from mapping
|
||||||
float offsetScale = mapping.value("scale", 1.0f).toFloat();
|
float offsetScale = mapping.value("scale", 1.0f).toFloat();
|
||||||
geometry.fstScaled = offsetScale;
|
|
||||||
glm::quat offsetRotation = glm::quat(glm::radians(glm::vec3(mapping.value("rx").toFloat(),
|
glm::quat offsetRotation = glm::quat(glm::radians(glm::vec3(mapping.value("rx").toFloat(),
|
||||||
mapping.value("ry").toFloat(), mapping.value("rz").toFloat())));
|
mapping.value("ry").toFloat(), mapping.value("rz").toFloat())));
|
||||||
geometry.offset = glm::translate(glm::vec3(mapping.value("tx").toFloat(), mapping.value("ty").toFloat(),
|
geometry.offset = glm::translate(glm::vec3(mapping.value("tx").toFloat(), mapping.value("ty").toFloat(),
|
||||||
|
|
|
@ -211,8 +211,6 @@ public:
|
||||||
Extents bindExtents;
|
Extents bindExtents;
|
||||||
Extents meshExtents;
|
Extents meshExtents;
|
||||||
|
|
||||||
float fstScaled;
|
|
||||||
|
|
||||||
QVector<FBXAnimationFrame> animationFrames;
|
QVector<FBXAnimationFrame> animationFrames;
|
||||||
|
|
||||||
QVector<FBXAttachment> attachments;
|
QVector<FBXAttachment> attachments;
|
||||||
|
|
|
@ -56,6 +56,7 @@ const QString MODEL_DEFAULT_ANIMATION_URL("");
|
||||||
const float MODEL_DEFAULT_ANIMATION_FPS = 30.0f;
|
const float MODEL_DEFAULT_ANIMATION_FPS = 30.0f;
|
||||||
|
|
||||||
const PacketVersion VERSION_MODELS_HAVE_ANIMATION = 1;
|
const PacketVersion VERSION_MODELS_HAVE_ANIMATION = 1;
|
||||||
|
const PacketVersion VERSION_ROOT_ELEMENT_HAS_DATA = 2;
|
||||||
|
|
||||||
/// A collection of properties of a model item used in the scripting API. Translates between the actual properties of a model
|
/// A collection of properties of a model item used in the scripting API. Translates between the actual properties of a model
|
||||||
/// and a JavaScript style hash/QScriptValue storing a set of properties. Used in scripting to set/get the complete set of
|
/// and a JavaScript style hash/QScriptValue storing a set of properties. Used in scripting to set/get the complete set of
|
||||||
|
|
|
@ -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());
|
||||||
|
|
|
@ -324,6 +324,14 @@ bool ModelTreeElement::removeModelWithID(uint32_t id) {
|
||||||
int ModelTreeElement::readElementDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
|
int ModelTreeElement::readElementDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
|
||||||
ReadBitstreamToTreeParams& args) {
|
ReadBitstreamToTreeParams& args) {
|
||||||
|
|
||||||
|
// If we're the root, but this bitstream doesn't support root elements with data, then
|
||||||
|
// return without reading any bytes
|
||||||
|
if (this == _myTree->getRoot() && args.bitstreamVersion < VERSION_ROOT_ELEMENT_HAS_DATA) {
|
||||||
|
qDebug() << "ROOT ELEMENT: no root data for "
|
||||||
|
"bitstreamVersion=" << (int)args.bitstreamVersion << " bytesLeftToRead=" << bytesLeftToRead;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
const unsigned char* dataAt = data;
|
const unsigned char* dataAt = data;
|
||||||
int bytesRead = 0;
|
int bytesRead = 0;
|
||||||
uint16_t numberOfModels = 0;
|
uint16_t numberOfModels = 0;
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ enum PacketType {
|
||||||
PacketTypeVoxelSet,
|
PacketTypeVoxelSet,
|
||||||
PacketTypeVoxelSetDestructive,
|
PacketTypeVoxelSetDestructive,
|
||||||
PacketTypeVoxelErase,
|
PacketTypeVoxelErase,
|
||||||
PacketTypeOctreeStats,
|
PacketTypeOctreeStats, // 26
|
||||||
PacketTypeJurisdiction,
|
PacketTypeJurisdiction,
|
||||||
PacketTypeJurisdictionRequest,
|
PacketTypeJurisdictionRequest,
|
||||||
PacketTypeParticleQuery,
|
PacketTypeParticleQuery,
|
||||||
|
@ -62,7 +62,7 @@ enum PacketType {
|
||||||
PacketTypeDomainServerRequireDTLS,
|
PacketTypeDomainServerRequireDTLS,
|
||||||
PacketTypeNodeJsonStats,
|
PacketTypeNodeJsonStats,
|
||||||
PacketTypeModelQuery,
|
PacketTypeModelQuery,
|
||||||
PacketTypeModelData,
|
PacketTypeModelData, // 41
|
||||||
PacketTypeModelAddOrEdit,
|
PacketTypeModelAddOrEdit,
|
||||||
PacketTypeModelErase,
|
PacketTypeModelErase,
|
||||||
PacketTypeModelAddResponse,
|
PacketTypeModelAddResponse,
|
||||||
|
|
|
@ -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