Merge branch 'master' into fix/cross-platform-filepaths
This commit is contained in:
commit
87b8d887f8
|
@ -18,6 +18,8 @@
|
|||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
const std::string FBX2GLTF_VERSION = "0.9.5";
|
||||
|
||||
#include <fmt/printf.h>
|
||||
#include <fbxsdk.h>
|
||||
|
||||
|
|
|
@ -1263,7 +1263,7 @@ static void ReadAnimations(RawModel &raw, FbxScene *pScene)
|
|||
for (int targetIx = 0; targetIx < targetCount; targetIx++) {
|
||||
if (curve) {
|
||||
float result = findInInterval(influence, targetIx-1);
|
||||
if (!isnan(result)) {
|
||||
if (!std::isnan(result)) {
|
||||
// we're transitioning into targetIx
|
||||
channel.weights.push_back(result);
|
||||
hasMorphs = true;
|
||||
|
@ -1271,7 +1271,7 @@ static void ReadAnimations(RawModel &raw, FbxScene *pScene)
|
|||
}
|
||||
if (targetIx != targetCount-1) {
|
||||
result = findInInterval(influence, targetIx);
|
||||
if (!isnan(result)) {
|
||||
if (!std::isnan(result)) {
|
||||
// we're transitioning AWAY from targetIx
|
||||
channel.weights.push_back(1.0f - result);
|
||||
hasMorphs = true;
|
||||
|
|
|
@ -1191,10 +1191,12 @@ ModelData *Raw2Gltf(
|
|||
}
|
||||
|
||||
json glTFJson {
|
||||
{"asset", {{"generator", "FBX2glTF"}, {"version", "2.0"}}},
|
||||
{"scene", rootScene.ix}};
|
||||
if (!extensionsUsed.empty())
|
||||
{
|
||||
{ "asset", {
|
||||
{ "generator", "FBX2glTF v" + FBX2GLTF_VERSION },
|
||||
{ "version", "2.0" }}},
|
||||
{ "scene", rootScene.ix }
|
||||
};
|
||||
if (!extensionsUsed.empty()) {
|
||||
glTFJson["extensionsUsed"] = extensionsUsed;
|
||||
}
|
||||
if (!extensionsRequired.empty())
|
||||
|
|
|
@ -269,11 +269,20 @@ void RawModel::Condense()
|
|||
|
||||
surfaces.clear();
|
||||
|
||||
std::set<int> survivingSurfaceIds;
|
||||
for (auto &triangle : triangles) {
|
||||
int oldSurfaceIndex = triangle.surfaceIndex;
|
||||
const RawSurface &surface = oldSurfaces[triangle.surfaceIndex];
|
||||
const int surfaceIndex = AddSurface(surface.name.c_str(), surface.id);
|
||||
surfaces[surfaceIndex] = surface;
|
||||
triangle.surfaceIndex = surfaceIndex;
|
||||
survivingSurfaceIds.emplace(surface.id);
|
||||
}
|
||||
// clear out references to meshes that no longer exist
|
||||
for (auto &node : nodes) {
|
||||
if (node.surfaceId != 0 && survivingSurfaceIds.find(node.surfaceId) == survivingSurfaceIds.end()) {
|
||||
node.surfaceId = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -341,7 +350,9 @@ void RawModel::TransformGeometry(ComputeNormalsOption normals)
|
|||
|
||||
if (verboseOutput) {
|
||||
if (normals == ComputeNormalsOption::BROKEN) {
|
||||
if (computedNormalsCount > 0) {
|
||||
fmt::printf("Repaired %lu empty normals.\n", computedNormalsCount);
|
||||
}
|
||||
} else {
|
||||
fmt::printf("Computed %lu normals.\n", computedNormalsCount);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,8 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
cxxopts::Options options(
|
||||
"FBX2glTF",
|
||||
"FBX2glTF 2.0: Generate a glTF 2.0 representation of an FBX model.");
|
||||
fmt::sprintf("FBX2glTF %s: Generate a glTF 2.0 representation of an FBX model.", FBX2GLTF_VERSION)
|
||||
);
|
||||
|
||||
std::string inputPath;
|
||||
std::string outputPath;
|
||||
|
@ -98,11 +99,7 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
if (options.count("version")) {
|
||||
fmt::printf(
|
||||
R"(
|
||||
FBX2glTF version 2.0
|
||||
Copyright (c) 2016-2017 Oculus VR, LLC.
|
||||
)");
|
||||
fmt::printf("FBX2glTF version %s\nCopyright (c) 2016-2017 Oculus VR, LLC.\n", FBX2GLTF_VERSION);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue