mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
Trying to read the light attribute
This commit is contained in:
parent
fc9dfd8d14
commit
913007939b
2 changed files with 101 additions and 18 deletions
|
@ -829,26 +829,45 @@ void GeometryReader::run() {
|
|||
return;
|
||||
}
|
||||
try {
|
||||
std::string urlname = _url.path().toLower().toStdString();
|
||||
FBXGeometry fbxgeo;
|
||||
if (_url.path().toLower().endsWith(".svo")) {
|
||||
fbxgeo = readSVO(_reply->readAll());
|
||||
} else {
|
||||
bool grabLightmaps = true;
|
||||
float lightmapLevel = 1.0f;
|
||||
// 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;
|
||||
} else if (_url.path().toLower().endsWith("apt8_reboot.fbx")) {
|
||||
lightmapLevel = 4.0f;
|
||||
} else if (_url.path().toLower().endsWith("palaceoforinthilian4.fbx")) {
|
||||
lightmapLevel = 3.5f;
|
||||
}
|
||||
fbxgeo = readFBX(_reply->readAll(), _mapping, grabLightmaps, lightmapLevel);
|
||||
if (!_reply) {
|
||||
throw QString("Reply is NULL ?!");
|
||||
}
|
||||
QMetaObject::invokeMethod(geometry.data(), "setGeometry", Q_ARG(const FBXGeometry&, fbxgeo));
|
||||
QString urlnameQ = _url.path().toLower();
|
||||
std::string urlname = _url.path().toLower().toStdString();
|
||||
bool urlValid = true;
|
||||
urlValid &= !urlname.empty();
|
||||
urlValid &= !_url.path().isEmpty();
|
||||
urlValid &= _url.path().toLower().endsWith(".fbx")
|
||||
|| _url.path().toLower().endsWith(".svo");
|
||||
|
||||
if (urlValid) {
|
||||
QString urlnameQ = _url.path().toLower();
|
||||
std::string urlnameQstd = urlnameQ.toStdString();
|
||||
QByteArray fileBinary = _reply->readAll();
|
||||
if (fileBinary.isEmpty() || fileBinary.isNull()) {
|
||||
throw QString("Read File binary is empty?!");
|
||||
}
|
||||
|
||||
FBXGeometry fbxgeo;
|
||||
if (_url.path().toLower().endsWith(".svo")) {
|
||||
fbxgeo = readSVO(fileBinary);
|
||||
} else if (_url.path().toLower().endsWith(".fbx")) {
|
||||
bool grabLightmaps = true;
|
||||
float lightmapLevel = 1.0f;
|
||||
// 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;
|
||||
} else if (_url.path().toLower().endsWith("apt8_reboot.fbx")) {
|
||||
lightmapLevel = 4.0f;
|
||||
} else if (_url.path().toLower().endsWith("palaceoforinthilian4.fbx")) {
|
||||
lightmapLevel = 3.5f;
|
||||
}
|
||||
fbxgeo = readFBX(fileBinary, _mapping, grabLightmaps, lightmapLevel);
|
||||
}
|
||||
QMetaObject::invokeMethod(geometry.data(), "setGeometry", Q_ARG(const FBXGeometry&, fbxgeo));
|
||||
} else {
|
||||
throw QString("url is invalid");
|
||||
}
|
||||
// _url.path().toLower().endsWith(".svo") ? readSVO(_reply->readAll()) : readFBX(_reply->readAll(), _mapping)));
|
||||
|
||||
} catch (const QString& error) {
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
|
||||
// TOOL: Uncomment the following line to enable the filtering of all the unkwnon fields of a node so we can break point easily while loading a model with problems...
|
||||
//#define DEBUG_FBXREADER
|
||||
#define DEBUG_FBXREADER
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -1194,6 +1194,8 @@ int matchTextureUVSetToAttributeChannel(const std::string& texUVSetName, const Q
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping, bool loadLightmaps, float lightmapLevel) {
|
||||
QHash<QString, ExtractedMesh> meshes;
|
||||
QHash<QString, QString> modelIDsToNames;
|
||||
|
@ -1632,9 +1634,39 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
|
|||
materials.insert(material.id, material);
|
||||
|
||||
} else if (object.name == "NodeAttribute") {
|
||||
std::string attributetype;
|
||||
const FBXNode* prop70Node = 0;
|
||||
foreach (const FBXNode& subobject, object.children) {
|
||||
|
||||
if (subobject.name == "TypeFlags") {
|
||||
typeFlags.insert(getID(object.properties), subobject.properties.at(0).toString());
|
||||
attributetype = subobject.properties.at(0).toString().toStdString();
|
||||
} else if (subobject.name == "Properties70") {
|
||||
prop70Node = &subobject;
|
||||
}
|
||||
}
|
||||
|
||||
if (!attributetype.empty()) {
|
||||
if (attributetype == "Light") {
|
||||
if (prop70Node) {
|
||||
foreach (const FBXNode& property, prop70Node->children) {
|
||||
int valIndex = 4;
|
||||
if (property.name == "P") {
|
||||
std::string propname = property.properties.at(0).toString().toStdString();
|
||||
if (propname == "LightType") {
|
||||
std::string type = property.properties.at(valIndex).toString().toStdString();
|
||||
} else if (propname == "Intensity") {
|
||||
float intensity = property.properties.at(valIndex).value<double>();
|
||||
}
|
||||
#if defined(DEBUG_FBXREADER)
|
||||
else {
|
||||
if (propname == "EmissiveFactor") {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (object.name == "Deformer") {
|
||||
|
@ -1674,7 +1706,20 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
|
|||
}
|
||||
}
|
||||
animationCurves.insert(getID(object.properties), curve);
|
||||
|
||||
}
|
||||
#if defined(DEBUG_FBXREADER)
|
||||
else {
|
||||
std::string objectname = object.name.data();
|
||||
if ( objectname == "Pose"
|
||||
|| objectname == "AnimationStack"
|
||||
|| objectname == "AnimationLayer"
|
||||
|| objectname == "AnimationCurveNode") {
|
||||
} else {
|
||||
unknown++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else if (child.name == "Connections") {
|
||||
foreach (const FBXNode& connection, child.children) {
|
||||
|
@ -1726,6 +1771,25 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
|
|||
}
|
||||
}
|
||||
}
|
||||
#if defined(DEBUG_FBXREADER)
|
||||
else {
|
||||
std::string objectname = child.name.data();
|
||||
if ( objectname == "Pose"
|
||||
|| objectname == "CreationTime"
|
||||
|| objectname == "FileId"
|
||||
|| objectname == "Creator"
|
||||
|| objectname == "Documents"
|
||||
|| objectname == "References"
|
||||
|| objectname == "Definitions"
|
||||
|| objectname == "Takes"
|
||||
|| objectname == "AnimationStack"
|
||||
|| objectname == "AnimationLayer"
|
||||
|| objectname == "AnimationCurveNode") {
|
||||
} else {
|
||||
unknown++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// assign the blendshapes to their corresponding meshes
|
||||
|
|
Loading…
Reference in a new issue