Merge branch 'master' into tdb/pbrt3_exporter
commit
11a17ebfe6
|
@ -61,12 +61,12 @@ namespace Assimp {
|
|||
void AMFImporter::ParseNode_Mesh(XmlNode &node) {
|
||||
AMFNodeElementBase *ne = nullptr;
|
||||
|
||||
// create new mesh object.
|
||||
ne = new AMFMesh(mNodeElement_Cur);
|
||||
// Check for child nodes
|
||||
if (0 != ASSIMP_stricmp(node.name(), "mesh")) {
|
||||
return;
|
||||
}
|
||||
// create new mesh object.
|
||||
ne = new AMFMesh(mNodeElement_Cur);
|
||||
bool found_verts = false, found_volumes = false;
|
||||
if (!node.empty()) {
|
||||
ParseHelper_Node_Enter(ne);
|
||||
|
|
|
@ -165,15 +165,15 @@ void AMFImporter::ParseNode_Texture(XmlNode &node) {
|
|||
std::string type = node.attribute("type").as_string();
|
||||
bool tiled = node.attribute("tiled").as_bool();
|
||||
|
||||
// create new texture object.
|
||||
AMFNodeElementBase *ne = new AMFTexture(mNodeElement_Cur);
|
||||
|
||||
AMFTexture& als = *((AMFTexture*)ne);// alias for convenience
|
||||
|
||||
if (node.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// create new texture object.
|
||||
AMFNodeElementBase *ne = new AMFTexture(mNodeElement_Cur);
|
||||
|
||||
AMFTexture& als = *((AMFTexture*)ne);// alias for convenience
|
||||
|
||||
std::string enc64_data = node.value();
|
||||
// Check for child nodes
|
||||
|
||||
|
|
|
@ -60,19 +60,32 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
using namespace Assimp;
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
const std::wstring wdummy;
|
||||
|
||||
static std::wstring Utf8ToWide(const char *in) {
|
||||
if (nullptr == in) {
|
||||
return wdummy;
|
||||
}
|
||||
int size = MultiByteToWideChar(CP_UTF8, 0, in, -1, nullptr, 0);
|
||||
// size includes terminating null; std::wstring adds null automatically
|
||||
std::wstring out(static_cast<size_t>(size) - 1, L'\0');
|
||||
MultiByteToWideChar(CP_UTF8, 0, in, -1, &out[0], size);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
const std::string dummy;
|
||||
|
||||
static std::string WideToUtf8(const wchar_t *in) {
|
||||
if (nullptr == in) {
|
||||
return dummy;
|
||||
}
|
||||
int size = WideCharToMultiByte(CP_UTF8, 0, in, -1, nullptr, 0, nullptr, nullptr);
|
||||
// size includes terminating null; std::string adds null automatically
|
||||
std::string out(static_cast<size_t>(size) - 1, '\0');
|
||||
WideCharToMultiByte(CP_UTF8, 0, in, -1, &out[0], size, nullptr, nullptr);
|
||||
|
||||
return out;
|
||||
}
|
||||
#endif
|
||||
|
@ -104,7 +117,12 @@ IOStream *DefaultIOSystem::Open(const char *strFile, const char *strMode) {
|
|||
ai_assert(strMode != nullptr);
|
||||
FILE *file;
|
||||
#ifdef _WIN32
|
||||
file = ::_wfopen(Utf8ToWide(strFile).c_str(), Utf8ToWide(strMode).c_str());
|
||||
std::wstring name = Utf8ToWide(strFile);
|
||||
if (name.empty()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
file = ::_wfopen(name.c_str(), Utf8ToWide(strMode).c_str());
|
||||
#else
|
||||
file = ::fopen(strFile, strMode);
|
||||
#endif
|
||||
|
|
|
@ -152,7 +152,7 @@ zlib_filefunc_def IOSystem2Unzip::get(IOSystem *pIOHandler) {
|
|||
mapping.ztell_file = (tell_file_func)tell;
|
||||
mapping.zseek_file = (seek_file_func)seek;
|
||||
mapping.zclose_file = (close_file_func)close;
|
||||
mapping.zerror_file = (error_file_func)testerror;
|
||||
mapping.zerror_file = testerror;
|
||||
|
||||
mapping.opaque = reinterpret_cast<voidpf>(pIOHandler);
|
||||
|
||||
|
|
Loading…
Reference in New Issue