1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-09 12:50:35 +00:00

Update Assimp to master at d3d98a7ec0c8d38e1952b46dfe53f7e9233dc92d

* ASCII FBX embedded content
* Improved uv scaling metadata
This commit is contained in:
K. S. Ernest (iFire) Lee
2019-04-08 09:25:45 -07:00
parent bde77dc0b4
commit cc72bc6713
8 changed files with 133 additions and 18 deletions

View File

@@ -78,6 +78,16 @@ namespace Assimp {
FBXConverter::FBXConverter(aiScene* out, const Document& doc)
: defaultMaterialIndex()
, lights()
, cameras()
, textures()
, materials_converted()
, textures_converted()
, meshes_converted()
, node_anim_chain_bits()
, mNodeNameInstances()
, mNodeNames()
, anim_fps()
, out(out)
, doc(doc) {
// animations need to be converted first since this will
@@ -410,19 +420,24 @@ namespace Assimp {
void FBXConverter::GetUniqueName(const std::string &name, std::string &uniqueName)
{
int i = 0;
uniqueName = name;
while (mNodeNames.find(uniqueName) != mNodeNames.end())
int i = 0;
auto it = mNodeNameInstances.find(name); // duplicate node name instance count
if (it != mNodeNameInstances.end())
{
++i;
std::stringstream ext;
ext << name << std::setfill('0') << std::setw(3) << i;
uniqueName = ext.str();
i = it->second;
while (mNodeNames.find(uniqueName) != mNodeNames.end())
{
i++;
std::stringstream ext;
ext << name << std::setfill('0') << std::setw(3) << i;
uniqueName = ext.str();
}
}
mNodeNameInstances[name] = i;
mNodeNames.insert(uniqueName);
}
const char* FBXConverter::NameTransformationComp(TransformationComp comp) {
switch (comp) {
case TransformationComp_Translation:
@@ -2041,6 +2056,12 @@ namespace Assimp {
CalculatedOpacity = 1.0f - ((Transparent.r + Transparent.g + Transparent.b) / 3.0f);
}
// try to get the transparency factor
const float TransparencyFactor = PropertyGet<float>(props, "TransparencyFactor", ok);
if (ok) {
out_mat->AddProperty(&TransparencyFactor, 1, AI_MATKEY_TRANSPARENCYFACTOR);
}
// use of TransparencyFactor is inconsistent.
// Maya always stores it as 1.0,
// so we can't use it to set AI_MATKEY_OPACITY.