Skip to content

Commit

Permalink
Fix empty mesh handling
Browse files Browse the repository at this point in the history
  • Loading branch information
kimkulling committed Nov 10, 2023
1 parent 28ab0a0 commit 0b0ec71
Show file tree
Hide file tree
Showing 9 changed files with 144 additions and 137 deletions.
4 changes: 0 additions & 4 deletions code/AssetLib/3DS/3DSLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,6 @@ Discreet3DSImporter::Discreet3DSImporter() :
// empty
}

// ------------------------------------------------------------------------------------------------
// Destructor, private as well
Discreet3DSImporter::~Discreet3DSImporter() = default;

// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.
bool Discreet3DSImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool /*checkSig*/) const {
Expand Down
3 changes: 1 addition & 2 deletions code/AssetLib/3DS/3DSLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ struct aiNode;

namespace Assimp {


using namespace D3DS;

// ---------------------------------------------------------------------------------
Expand All @@ -68,7 +67,7 @@ using namespace D3DS;
class Discreet3DSImporter : public BaseImporter {
public:
Discreet3DSImporter();
~Discreet3DSImporter() override;
~Discreet3DSImporter() override = default;

// -------------------------------------------------------------------
/** Returns whether the class can handle the format of the given file.
Expand Down
2 changes: 1 addition & 1 deletion code/AssetLib/FBX/FBXImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ FBXImporter::FBXImporter() = default;
// Returns whether the class can handle the format of the given file.
bool FBXImporter::CanRead(const std::string & pFile, IOSystem * pIOHandler, bool /*checkSig*/) const {
// at least ASCII-FBX files usually have a 'FBX' somewhere in their head
static const char *tokens[] = { "fbx" };
static const char *tokens[] = { " \n\r\n " };
return SearchFileHeaderForToken(pIOHandler, pFile, tokens, AI_COUNT_OF(tokens));
}

Expand Down
7 changes: 0 additions & 7 deletions code/AssetLib/IQM/IQMImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,6 @@ bool IQMImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool c
if (!pIOHandler) {
return true;
}
/*
* don't use CheckMagicToken because that checks with swapped bytes too, leading to false
* positives. This magic is not uint32_t, but char[4], so memcmp is the best way
const char* tokens[] = {"3DMO", "3dmo"};
return CheckMagicToken(pIOHandler,pFile,tokens,2,0,4);
*/
std::unique_ptr<IOStream> pStream(pIOHandler->Open(pFile, "rb"));
unsigned char data[15];
if (!pStream || 15 != pStream->Read(data, 1, 15)) {
Expand Down
6 changes: 4 additions & 2 deletions code/AssetLib/Obj/ObjFileImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ using namespace std;
ObjFileImporter::ObjFileImporter() :
m_Buffer(),
m_pRootObject(nullptr),
m_strAbsPath(std::string(1, DefaultIOSystem().getOsSeparator())) {}
m_strAbsPath(std::string(1, DefaultIOSystem().getOsSeparator())) {
// empty
}

// ------------------------------------------------------------------------------------------------
// Destructor.
Expand All @@ -102,7 +104,7 @@ const aiImporterDesc *ObjFileImporter::GetInfo() const {
// Obj-file import implementation
void ObjFileImporter::InternReadFile(const std::string &file, aiScene *pScene, IOSystem *pIOHandler) {
// Read file into memory
static const std::string mode = "rb";
static constexpr char mode[] = "rb";
auto streamCloser = [&](IOStream *pStream) {
pIOHandler->Close(pStream);
};
Expand Down
Loading

0 comments on commit 0b0ec71

Please sign in to comment.