Merge branch 'master' into sgold/readme/weblink-style

pull/5364/head
Kim Kulling 2023-12-21 22:18:57 +01:00 committed by GitHub
commit 9d3fa41c82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 6 deletions

View File

@ -1234,7 +1234,10 @@ void IRRImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
// Parse the XML
// Find the scene root from document root.
const pugi::xml_node &sceneRoot = documentRoot.child("irr_scene");
if (!sceneRoot) throw new DeadlyImportError("IRR: <irr_scene> not found in file");
if (!sceneRoot) {
delete root;
throw new DeadlyImportError("IRR: <irr_scene> not found in file");
}
for (pugi::xml_node &child : sceneRoot.children()) {
// XML elements are either nodes, animators, attributes, or materials
if (!ASSIMP_stricmp(child.name(), "node")) {

View File

@ -395,7 +395,10 @@ void Q3BSPFileImporter::createTriangleTopology(const Q3BSP::Q3BSPModel *pModel,
m_pCurrentFace->mIndices = new unsigned int[3];
m_pCurrentFace->mIndices[idx] = vertIdx;
}
}
} else {
m_pCurrentFace->mIndices[idx] = vertIdx;
}
pMesh->mVertices[vertIdx].Set(pVertex->vPosition.x, pVertex->vPosition.y, pVertex->vPosition.z);
pMesh->mNormals[vertIdx].Set(pVertex->vNormal.x, pVertex->vNormal.y, pVertex->vNormal.z);

View File

@ -99,12 +99,12 @@ bool DefaultIOSystem::Exists(const char *pFile) const {
return false;
}
#else
FILE *file = ::fopen(pFile, "rb");
if (!file) {
struct stat statbuf;
stat(pFile, &statbuf);
// test for a regular file
if (!S_ISREG(statbuf.st_mode)) {
return false;
}
::fclose(file);
#endif
return true;
@ -116,6 +116,7 @@ IOStream *DefaultIOSystem::Open(const char *strFile, const char *strMode) {
ai_assert(strFile != nullptr);
ai_assert(strMode != nullptr);
FILE *file;
#ifdef _WIN32
std::wstring name = Utf8ToWide(strFile);
if (name.empty()) {
@ -126,6 +127,7 @@ IOStream *DefaultIOSystem::Open(const char *strFile, const char *strMode) {
#else
file = ::fopen(strFile, strMode);
#endif
if (!file) {
return nullptr;
}