summaryrefslogtreecommitdiff
path: root/thirdparty/assimp/code/FBXMaterial.cpp
diff options
context:
space:
mode:
authorK. S. Ernest (iFire) Lee <ernest.lee@chibifire.com>2019-04-08 09:25:45 -0700
committerK. S. Ernest (iFire) Lee <ernest.lee@chibifire.com>2019-04-09 07:42:31 -0700
commitcc72bc6713bd1a2464f32d66f0a081d4f426c27f (patch)
treea93dd385938aa96d7fb8f3ecbf2b3a50940bee5d /thirdparty/assimp/code/FBXMaterial.cpp
parentbde77dc0b4661741b58e88861476d99d41296ff5 (diff)
Update Assimp to master at d3d98a7ec0c8d38e1952b46dfe53f7e9233dc92d
* ASCII FBX embedded content * Improved uv scaling metadata
Diffstat (limited to 'thirdparty/assimp/code/FBXMaterial.cpp')
-rw-r--r--thirdparty/assimp/code/FBXMaterial.cpp32
1 files changed, 31 insertions, 1 deletions
diff --git a/thirdparty/assimp/code/FBXMaterial.cpp b/thirdparty/assimp/code/FBXMaterial.cpp
index 08347740fa..f16f134404 100644
--- a/thirdparty/assimp/code/FBXMaterial.cpp
+++ b/thirdparty/assimp/code/FBXMaterial.cpp
@@ -55,6 +55,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/ByteSwapper.h>
#include <algorithm> // std::transform
+#include "FBXUtil.h"
namespace Assimp {
namespace FBX {
@@ -206,6 +207,20 @@ Texture::Texture(uint64_t id, const Element& element, const Document& doc, const
props = GetPropertyTable(doc,"Texture.FbxFileTexture",element,sc);
+ // 3DS Max and FBX SDK use "Scaling" and "Translation" instead of "ModelUVScaling" and "ModelUVTranslation". Use these properties if available.
+ bool ok;
+ const aiVector3D& scaling = PropertyGet<aiVector3D>(*props, "Scaling", ok);
+ if (ok) {
+ uvScaling.x = scaling.x;
+ uvScaling.y = scaling.y;
+ }
+
+ const aiVector3D& trans = PropertyGet<aiVector3D>(*props, "Translation", ok);
+ if (ok) {
+ uvTrans.x = trans.x;
+ uvTrans.y = trans.y;
+ }
+
// resolve video links
if(doc.Settings().readTextures) {
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID());
@@ -307,7 +322,22 @@ Video::Video(uint64_t id, const Element& element, const Document& doc, const std
const Token& token = GetRequiredToken(*Content, 0);
const char* data = token.begin();
if (!token.IsBinary()) {
- DOMWarning("video content is not binary data, ignoring", &element);
+ if (*data != '"') {
+ DOMError("embedded content is not surrounded by quotation marks", &element);
+ }
+ else {
+ const char* encodedData = data + 1;
+ size_t encodedDataLen = static_cast<size_t>(token.end() - token.begin());
+ // search for last quotation mark
+ while (encodedDataLen > 1 && encodedData[encodedDataLen] != '"')
+ encodedDataLen--;
+ if (encodedDataLen % 4 != 0) {
+ DOMError("embedded content is invalid, needs to be in base64", &element);
+ }
+ else {
+ contentLength = Util::DecodeBase64(encodedData, encodedDataLen, content);
+ }
+ }
}
else if (static_cast<size_t>(token.end() - data) < 5) {
DOMError("binary data array is too short, need five (5) bytes for type signature and element count", &element);