mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 09:43:25 +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;
|
||||
bytesRead += bytes;
|
||||
|
||||
// animationURL
|
||||
uint16_t animationURLLength;
|
||||
memcpy(&animationURLLength, dataAt, sizeof(animationURLLength));
|
||||
dataAt += sizeof(animationURLLength);
|
||||
bytesRead += sizeof(animationURLLength);
|
||||
QString animationURLString((const char*)dataAt);
|
||||
setAnimationURL(animationURLString);
|
||||
dataAt += animationURLLength;
|
||||
bytesRead += animationURLLength;
|
||||
|
||||
qDebug() << "readModelDataFromBuffer()... animationURL=" << qPrintable(animationURLString);
|
||||
if (args.bitstreamVersion >= VERSION_MODELS_HAVE_ANIMATION) {
|
||||
// animationURL
|
||||
uint16_t animationURLLength;
|
||||
memcpy(&animationURLLength, dataAt, sizeof(animationURLLength));
|
||||
dataAt += sizeof(animationURLLength);
|
||||
bytesRead += sizeof(animationURLLength);
|
||||
QString animationURLString((const char*)dataAt);
|
||||
setAnimationURL(animationURLString);
|
||||
dataAt += animationURLLength;
|
||||
bytesRead += animationURLLength;
|
||||
|
||||
qDebug() << "readModelDataFromBuffer()... animationURL=" << qPrintable(animationURLString);
|
||||
}
|
||||
|
||||
//printf("ModelItem::readModelDataFromBuffer()... "); debugDump();
|
||||
}
|
||||
|
|
|
@ -51,6 +51,8 @@ const QString MODEL_DEFAULT_MODEL_URL("");
|
|||
const glm::quat MODEL_DEFAULT_MODEL_ROTATION;
|
||||
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
|
||||
/// 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
|
||||
|
|
|
@ -1556,6 +1556,7 @@ int Octree::encodeTreeBitstreamRecursion(OctreeElement* element,
|
|||
|
||||
bool Octree::readFromSVOFile(const char* fileName) {
|
||||
bool fileOk = false;
|
||||
PacketVersion gotVersion = 0;
|
||||
std::ifstream file(fileName, std::ios::in|std::ios::binary|std::ios::ate);
|
||||
if(file.is_open()) {
|
||||
emit importSize(1.0f, 1.0f, 1.0f);
|
||||
|
@ -1587,7 +1588,7 @@ bool Octree::readFromSVOFile(const char* fileName) {
|
|||
dataAt += sizeof(expectedType);
|
||||
dataLength -= sizeof(expectedType);
|
||||
PacketVersion expectedVersion = versionForPacketType(expectedType);
|
||||
PacketVersion gotVersion = *dataAt;
|
||||
gotVersion = *dataAt;
|
||||
if (gotVersion == expectedVersion) {
|
||||
dataAt += sizeof(expectedVersion);
|
||||
dataLength -= sizeof(expectedVersion);
|
||||
|
@ -1602,7 +1603,8 @@ bool Octree::readFromSVOFile(const char* fileName) {
|
|||
fileOk = true; // assume the file is ok
|
||||
}
|
||||
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);
|
||||
}
|
||||
delete[] entireFile;
|
||||
|
|
|
@ -170,6 +170,7 @@ public:
|
|||
QUuid sourceUUID;
|
||||
SharedNodePointer sourceNode;
|
||||
bool wantImportProgress;
|
||||
PacketVersion bitstreamVersion;
|
||||
|
||||
ReadBitstreamToTreeParams(
|
||||
bool includeColor = WANT_COLOR,
|
||||
|
@ -177,13 +178,15 @@ public:
|
|||
OctreeElement* destinationElement = NULL,
|
||||
QUuid sourceUUID = QUuid(),
|
||||
SharedNodePointer sourceNode = SharedNodePointer(),
|
||||
bool wantImportProgress = false) :
|
||||
bool wantImportProgress = false,
|
||||
PacketVersion bitstreamVersion = 0) :
|
||||
includeColor(includeColor),
|
||||
includeExistsBits(includeExistsBits),
|
||||
destinationElement(destinationElement),
|
||||
sourceUUID(sourceUUID),
|
||||
sourceNode(sourceNode),
|
||||
wantImportProgress(wantImportProgress)
|
||||
wantImportProgress(wantImportProgress),
|
||||
bitstreamVersion(bitstreamVersion)
|
||||
{}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue