summaryrefslogtreecommitdiff
path: root/external/collada2gltf
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-05-22 15:56:19 +0200
committerZolnai Tamás <tamas.zolnai@collabora.com>2014-05-22 16:15:41 +0200
commit1dd84fc4674141449c78f6c5838e2254c5a28f35 (patch)
tree581129ffd9b1df710b64cc3f88140261b4ed1c64 /external/collada2gltf
parentd466f926f8dc07ec23efa5807fff35a0b6dd4146 (diff)
collada2gltf: fix URL problems
collada2gltf does not handle Windows pathes, the used COLLADABU::URI class can't parse native Windows pathes so call COLLADA2GLTFWriter with URL only. Other problems: collada2gltf uses the URL path for creating/opening files, instead of native ones. collada2gltf initializes _outputFilePath member in different way, sometimes as an URL path, sometimes as a native one, but handle it on the same way(as an URL). Change-Id: I104182653c07e7dcf6fc5b6e32c7031d59246b84
Diffstat (limited to 'external/collada2gltf')
-rw-r--r--external/collada2gltf/UnpackedTarball_collada2gltf.mk1
-rw-r--r--external/collada2gltf/wrong_uri_usage.patch.177
2 files changed, 78 insertions, 0 deletions
diff --git a/external/collada2gltf/UnpackedTarball_collada2gltf.mk b/external/collada2gltf/UnpackedTarball_collada2gltf.mk
index 3112cd98c9b7..0ced364061cf 100644
--- a/external/collada2gltf/UnpackedTarball_collada2gltf.mk
+++ b/external/collada2gltf/UnpackedTarball_collada2gltf.mk
@@ -16,6 +16,7 @@ $(eval $(call gb_UnpackedTarball_add_file,collada2gltf,.,external/collada2gltf/G
$(eval $(call gb_UnpackedTarball_add_patches,collada2gltf,\
external/collada2gltf/add-unzip-kmz-files-to-collada-files-module.patch.3 \
external/collada2gltf/write-only-.dae-file-which-we-need.patch.0 \
+ external/collada2gltf/wrong_uri_usage.patch.1 \
))
# vim: set noet sw=4 ts=4:
diff --git a/external/collada2gltf/wrong_uri_usage.patch.1 b/external/collada2gltf/wrong_uri_usage.patch.1
new file mode 100644
index 000000000000..050fdaa1ac98
--- /dev/null
+++ b/external/collada2gltf/wrong_uri_usage.patch.1
@@ -0,0 +1,77 @@
+diff -ur collada2gltf.org/GLTF/GLTFAsset.cpp collada2gltf/GLTF/GLTFAsset.cpp
+--- collada2gltf.org/GLTF/GLTFAsset.cpp 2014-05-22 11:12:21.823216900 +0200
++++ collada2gltf/GLTF/GLTFAsset.cpp 2014-05-22 14:59:04.963439700 +0200
+@@ -191,12 +191,9 @@
+ shared_ptr<GLTFOutputStream> GLTFAsset::createOutputStreamIfNeeded(const std::string& streamName) {
+
+ if (this->_nameToOutputStream.count(streamName) == 0) {
+- COLLADABU::URI inputURI(this->getInputFilePath().c_str());
+ COLLADABU::URI outputURI(this->getOutputFilePath().c_str());
+
+- std::string folder = outputURI.getPathDir();
+- std::string fileName = inputURI.getPathFileBase();
+-
++ std::string folder = COLLADABU::URI(outputURI.getPathDir()).toNativePath();
+ shared_ptr<GLTFOutputStream> outputStream = shared_ptr <GLTFOutputStream> (new GLTFOutputStream(folder, streamName, ""));
+ this->_nameToOutputStream[streamName] = outputStream;
+ }
+@@ -280,13 +277,13 @@
+ this->_bundleOutputPath = outputBundlePathURI.toNativePath();
+
+ COLLADABU::URI outputPathURI(outputBundlePathURI.getURIString() + "/" + outputBundlePathURI.getPathFileBase() + "." + "json");
+- this->_outputFilePath = outputPathURI.toNativePath();
++ this->_outputFilePath = outputPathURI.getURIString();
+ // this->log("outputBundlePath:%s\n",outputBundlePathURI.toNativePath().c_str());
+ // this->log("outputPath:%s\n",outputPathURI.toNativePath().c_str());
+ } else {
+ this->_bundleOutputPath = outputBundlePathURI.toNativePath();
+ COLLADABU::URI outputPathURI(outputBundlePathURI.getURIString() + "/" + outputBundlePathURI.getPathFileBase() + "." + "json");
+- this->_outputFilePath = outputPathURI.toNativePath();
++ this->_outputFilePath = outputPathURI.getURIString();
+ }
+ COLLADABU::Utils::createDirectoryIfNeeded(this->_bundleOutputPath.c_str());
+ }
+@@ -376,9 +373,9 @@
+ COLLADABU::URI outputImagePathURI(inputImagePath.c_str());
+
+ COLLADABU::URI outputURI(this->getOutputFilePath().c_str());
+- std::string folder = outputURI.getPathDir();
++ std::string folder = COLLADABU::URI(outputURI.getPathDir()).toNativePath();
+ std::string outputPath = folder + outputImagePathURI.getPathFile();
+-
++
+ std::ifstream f1(inputImagePath.c_str(), std::fstream::binary);
+ std::ofstream f2(outputPath.c_str(), std::fstream::binary);
+
+@@ -397,8 +394,8 @@
+ this->_root = shared_ptr <GLTF::JSONObject> (new GLTF::JSONObject());
+ this->_root->setString(kProfile, profile->id());
+ this->_root->createObjectIfNeeded(kNodes);
+-
+- this->_writer.initWithPath(this->getOutputFilePath().c_str());
++ COLLADABU::URI outputURI(this->getOutputFilePath().c_str());
++ this->_writer.initWithPath(outputURI.toNativePath().c_str());
+ }
+
+ static void __eval(JSONValue* value, void *context) {
+@@ -427,7 +424,7 @@
+ void GLTFAsset::_writeJSONResource(const std::string &path, shared_ptr<JSONObject> obj) {
+ GLTF::GLTFWriter resultsWriter;
+ COLLADABU::URI outputURI(this->resourceOuputPathForPath(path));
+- std::string aPath = this->getOutputFolderPath() + outputURI.getPathFile();
++ std::string aPath = COLLADABU::URI(this->getOutputFolderPath() + outputURI.getPathFile()).toNativePath();
+ resultsWriter.initWithPath(aPath);
+ obj->write(&resultsWriter);
+
+diff -ur collada2gltf.org/shaders/commonProfileShaders.cpp collada2gltf/shaders/commonProfileShaders.cpp
+--- collada2gltf.org/shaders/commonProfileShaders.cpp 2014-05-22 11:12:21.854416900 +0200
++++ collada2gltf/shaders/commonProfileShaders.cpp 2014-05-22 14:24:57.063126800 +0200
+@@ -294,7 +294,7 @@
+ //also write the file on disk
+ if (shaderString.size() > 0) {
+ COLLADABU::URI outputURI(asset->getOutputFilePath());
+- std::string shaderPath = outputURI.getPathDir() + path;
++ std::string shaderPath = COLLADABU::URI(outputURI.getPathDir()).toNativePath() + path;
+ GLTF::GLTFUtils::writeData(shaderPath, "w",(unsigned char*)shaderString.c_str(), shaderString.size());
+ if (!CONFIG_BOOL(asset, "outputProgress") && asset->converterConfig()->boolForKeyPath("verboseLogging")) {
+ asset->log("[shader]: %s\n", shaderPath.c_str());