VOXELFORMAT: extract vxc content to access it
parent
33f87bafc0
commit
86ad634ad9
|
@ -3,9 +3,13 @@
|
|||
*/
|
||||
|
||||
#include "VXCFormat.h"
|
||||
#include "app/App.h"
|
||||
#include "core/Log.h"
|
||||
#include "core/StringUtil.h"
|
||||
#include "io/BufferedReadWriteStream.h"
|
||||
#include "io/FileStream.h"
|
||||
#include "io/Filesystem.h"
|
||||
#include "app/App.h"
|
||||
#include "io/ZipReadStream.h"
|
||||
#include "voxelformat/VXMFormat.h"
|
||||
#include "voxelformat/VXRFormat.h"
|
||||
|
@ -44,24 +48,30 @@ bool VXCFormat::loadGroups(const core::String &filename, io::SeekableReadStream
|
|||
|
||||
uint32_t entries;
|
||||
wrap(stream.readUInt32(entries))
|
||||
core::String vxr;
|
||||
for (uint32_t i = 0; i < entries; ++i) {
|
||||
char path[1024];
|
||||
wrapBool(stream.readString(sizeof(path), path, true))
|
||||
uint32_t fileSize;
|
||||
wrap(stream.readUInt32(fileSize))
|
||||
io::BufferedReadWriteStream substream(stream, fileSize);
|
||||
substream.seek(0);
|
||||
// TODO: currently we need them as files - we don't have a virtual filesystem that could deal with this yet...
|
||||
io::filesystem()->write(path, substream.getBuffer(), substream.size());
|
||||
const core::String &ext = core::string::extractExtension(path);
|
||||
if (ext == "vxr") {
|
||||
VXRFormat f;
|
||||
f.loadGroups(path, substream, sceneGraph);
|
||||
} else if (ext == "vxm") {
|
||||
VXMFormat f;
|
||||
f.loadGroups(path, substream, sceneGraph);
|
||||
} else {
|
||||
Log::warn("Ignore file %s in vxc (size: %u)", path, fileSize);
|
||||
vxr = path;
|
||||
}
|
||||
}
|
||||
|
||||
if (!vxr.empty()) {
|
||||
VXRFormat f;
|
||||
io::FilePtr vxrFile = io::filesystem()->open(vxr);
|
||||
if (vxrFile->validHandle()) {
|
||||
io::FileStream fstream(vxrFile);
|
||||
f.loadGroups(vxr, fstream, sceneGraph);
|
||||
}
|
||||
}
|
||||
return !sceneGraph.empty();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue