mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 06:10:52 +02:00
first cut at adding version parsing to model items, not really working
This commit is contained in:
parent
ed6f828b36
commit
02ca7c75eb
4 changed files with 23 additions and 15 deletions
|
@ -246,18 +246,19 @@ int ModelItem::readModelDataFromBuffer(const unsigned char* data, int bytesLeftT
|
||||||
dataAt += bytes;
|
dataAt += bytes;
|
||||||
bytesRead += bytes;
|
bytesRead += bytes;
|
||||||
|
|
||||||
// animationURL
|
if (args.bitstreamVersion >= VERSION_MODELS_HAVE_ANIMATION) {
|
||||||
uint16_t animationURLLength;
|
// animationURL
|
||||||
memcpy(&animationURLLength, dataAt, sizeof(animationURLLength));
|
uint16_t animationURLLength;
|
||||||
dataAt += sizeof(animationURLLength);
|
memcpy(&animationURLLength, dataAt, sizeof(animationURLLength));
|
||||||
bytesRead += sizeof(animationURLLength);
|
dataAt += sizeof(animationURLLength);
|
||||||
QString animationURLString((const char*)dataAt);
|
bytesRead += sizeof(animationURLLength);
|
||||||
setAnimationURL(animationURLString);
|
QString animationURLString((const char*)dataAt);
|
||||||
dataAt += animationURLLength;
|
setAnimationURL(animationURLString);
|
||||||
bytesRead += animationURLLength;
|
dataAt += animationURLLength;
|
||||||
|
bytesRead += animationURLLength;
|
||||||
qDebug() << "readModelDataFromBuffer()... animationURL=" << qPrintable(animationURLString);
|
|
||||||
|
|
||||||
|
qDebug() << "readModelDataFromBuffer()... animationURL=" << qPrintable(animationURLString);
|
||||||
|
}
|
||||||
|
|
||||||
//printf("ModelItem::readModelDataFromBuffer()... "); debugDump();
|
//printf("ModelItem::readModelDataFromBuffer()... "); debugDump();
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,8 @@ const QString MODEL_DEFAULT_MODEL_URL("");
|
||||||
const glm::quat MODEL_DEFAULT_MODEL_ROTATION;
|
const glm::quat MODEL_DEFAULT_MODEL_ROTATION;
|
||||||
const QString MODEL_DEFAULT_ANIMATION_URL("");
|
const QString MODEL_DEFAULT_ANIMATION_URL("");
|
||||||
|
|
||||||
|
const PacketVersion VERSION_MODELS_HAVE_ANIMATION = 1;
|
||||||
|
|
||||||
/// 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
|
||||||
/// model item properties via JavaScript hashes/QScriptValues
|
/// model item properties via JavaScript hashes/QScriptValues
|
||||||
|
|
|
@ -1556,6 +1556,7 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
|
||||||
|
|
||||||
bool Octree::readFromSVOFile(const char* fileName) {
|
bool Octree::readFromSVOFile(const char* fileName) {
|
||||||
bool fileOk = false;
|
bool fileOk = false;
|
||||||
|
PacketVersion gotVersion = 0;
|
||||||
std::ifstream file(fileName, std::ios::in|std::ios::binary|std::ios::ate);
|
std::ifstream file(fileName, std::ios::in|std::ios::binary|std::ios::ate);
|
||||||
if(file.is_open()) {
|
if(file.is_open()) {
|
||||||
emit importSize(1.0f, 1.0f, 1.0f);
|
emit importSize(1.0f, 1.0f, 1.0f);
|
||||||
|
@ -1587,7 +1588,7 @@ bool Octree::readFromSVOFile(const char* fileName) {
|
||||||
dataAt += sizeof(expectedType);
|
dataAt += sizeof(expectedType);
|
||||||
dataLength -= sizeof(expectedType);
|
dataLength -= sizeof(expectedType);
|
||||||
PacketVersion expectedVersion = versionForPacketType(expectedType);
|
PacketVersion expectedVersion = versionForPacketType(expectedType);
|
||||||
PacketVersion gotVersion = *dataAt;
|
gotVersion = *dataAt;
|
||||||
if (gotVersion == expectedVersion) {
|
if (gotVersion == expectedVersion) {
|
||||||
dataAt += sizeof(expectedVersion);
|
dataAt += sizeof(expectedVersion);
|
||||||
dataLength -= sizeof(expectedVersion);
|
dataLength -= sizeof(expectedVersion);
|
||||||
|
@ -1602,7 +1603,8 @@ bool Octree::readFromSVOFile(const char* fileName) {
|
||||||
fileOk = true; // assume the file is ok
|
fileOk = true; // assume the file is ok
|
||||||
}
|
}
|
||||||
if (fileOk) {
|
if (fileOk) {
|
||||||
ReadBitstreamToTreeParams args(WANT_COLOR, NO_EXISTS_BITS, NULL, 0, SharedNodePointer(), wantImportProgress);
|
ReadBitstreamToTreeParams args(WANT_COLOR, NO_EXISTS_BITS, NULL, 0,
|
||||||
|
SharedNodePointer(), wantImportProgress, gotVersion);
|
||||||
readBitstreamToTree(dataAt, dataLength, args);
|
readBitstreamToTree(dataAt, dataLength, args);
|
||||||
}
|
}
|
||||||
delete[] entireFile;
|
delete[] entireFile;
|
||||||
|
|
|
@ -170,6 +170,7 @@ public:
|
||||||
QUuid sourceUUID;
|
QUuid sourceUUID;
|
||||||
SharedNodePointer sourceNode;
|
SharedNodePointer sourceNode;
|
||||||
bool wantImportProgress;
|
bool wantImportProgress;
|
||||||
|
PacketVersion bitstreamVersion;
|
||||||
|
|
||||||
ReadBitstreamToTreeParams(
|
ReadBitstreamToTreeParams(
|
||||||
bool includeColor = WANT_COLOR,
|
bool includeColor = WANT_COLOR,
|
||||||
|
@ -177,13 +178,15 @@ public:
|
||||||
OctreeElement* destinationElement = NULL,
|
OctreeElement* destinationElement = NULL,
|
||||||
QUuid sourceUUID = QUuid(),
|
QUuid sourceUUID = QUuid(),
|
||||||
SharedNodePointer sourceNode = SharedNodePointer(),
|
SharedNodePointer sourceNode = SharedNodePointer(),
|
||||||
bool wantImportProgress = false) :
|
bool wantImportProgress = false,
|
||||||
|
PacketVersion bitstreamVersion = 0) :
|
||||||
includeColor(includeColor),
|
includeColor(includeColor),
|
||||||
includeExistsBits(includeExistsBits),
|
includeExistsBits(includeExistsBits),
|
||||||
destinationElement(destinationElement),
|
destinationElement(destinationElement),
|
||||||
sourceUUID(sourceUUID),
|
sourceUUID(sourceUUID),
|
||||||
sourceNode(sourceNode),
|
sourceNode(sourceNode),
|
||||||
wantImportProgress(wantImportProgress)
|
wantImportProgress(wantImportProgress),
|
||||||
|
bitstreamVersion(bitstreamVersion)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue