Merge pull request #3877 from samcake/fbx

Hack for avoiding lightmaps loading in starchamber
This commit is contained in:
Brad Hefta-Gaub 2014-11-30 15:30:39 -08:00
commit b8be76d597
3 changed files with 12 additions and 7 deletions

View file

@ -834,7 +834,12 @@ void GeometryReader::run() {
if (_url.path().toLower().endsWith(".svo")) { if (_url.path().toLower().endsWith(".svo")) {
fbxgeo = readSVO(_reply->readAll()); fbxgeo = readSVO(_reply->readAll());
} else { } else {
fbxgeo = readFBX(_reply->readAll(), _mapping); bool grabLightmaps = true;
// HACK: For monday 12/01/2014 we need to kill lighmaps loading in starchamber...
if (_url.path().toLower().endsWith("loungev4_11-18.fbx")) {
grabLightmaps = false;
}
fbxgeo = readFBX(_reply->readAll(), _mapping, grabLightmaps);
} }
QMetaObject::invokeMethod(geometry.data(), "setGeometry", Q_ARG(const FBXGeometry&, fbxgeo)); QMetaObject::invokeMethod(geometry.data(), "setGeometry", Q_ARG(const FBXGeometry&, fbxgeo));

View file

@ -1194,7 +1194,7 @@ int matchTextureUVSetToAttributeChannel(const std::string& texUVSetName, const Q
} }
} }
FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping) { FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping, bool loadLightmaps) {
QHash<QString, ExtractedMesh> meshes; QHash<QString, ExtractedMesh> meshes;
QHash<QString, QString> modelIDsToNames; QHash<QString, QString> modelIDsToNames;
QHash<QString, int> meshIDsToMeshIndices; QHash<QString, int> meshIDsToMeshIndices;
@ -1704,10 +1704,10 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping)
} else if (type.contains("shininess")) { } else if (type.contains("shininess")) {
counter++; counter++;
} else if (type.contains("emissive")) { } else if (loadLightmaps && type.contains("emissive")) {
emissiveTextures.insert(getID(connection.properties, 2), getID(connection.properties, 1)); emissiveTextures.insert(getID(connection.properties, 2), getID(connection.properties, 1));
} else if (type.contains("ambient")) { } else if (loadLightmaps && type.contains("ambient")) {
ambientTextures.insert(getID(connection.properties, 2), getID(connection.properties, 1)); ambientTextures.insert(getID(connection.properties, 2), getID(connection.properties, 1));
} else { } else {
std::string typenam = type.data(); std::string typenam = type.data();
@ -2372,10 +2372,10 @@ QByteArray writeMapping(const QVariantHash& mapping) {
return buffer.data(); return buffer.data();
} }
FBXGeometry readFBX(const QByteArray& model, const QVariantHash& mapping) { FBXGeometry readFBX(const QByteArray& model, const QVariantHash& mapping, bool loadLightmaps) {
QBuffer buffer(const_cast<QByteArray*>(&model)); QBuffer buffer(const_cast<QByteArray*>(&model));
buffer.open(QIODevice::ReadOnly); buffer.open(QIODevice::ReadOnly);
return extractFBXGeometry(parseFBX(&buffer), mapping); return extractFBXGeometry(parseFBX(&buffer), mapping, loadLightmaps);
} }
bool addMeshVoxelsOperation(OctreeElement* element, void* extraData) { bool addMeshVoxelsOperation(OctreeElement* element, void* extraData) {

View file

@ -253,7 +253,7 @@ QByteArray writeMapping(const QVariantHash& mapping);
/// Reads FBX geometry from the supplied model and mapping data. /// Reads FBX geometry from the supplied model and mapping data.
/// \exception QString if an error occurs in parsing /// \exception QString if an error occurs in parsing
FBXGeometry readFBX(const QByteArray& model, const QVariantHash& mapping); FBXGeometry readFBX(const QByteArray& model, const QVariantHash& mapping, bool loadLightmaps = true);
/// Reads SVO geometry from the supplied model data. /// Reads SVO geometry from the supplied model data.
FBXGeometry readSVO(const QByteArray& model); FBXGeometry readSVO(const QByteArray& model);