Sfoglia il codice sorgente

add info + header check

Gargaj 11 anni fa
parent
commit
5b512dd9dd
1 ha cambiato i file con 27 aggiunte e 5 eliminazioni
  1. 27 5
      code/AssbinLoader.cpp

+ 27 - 5
code/AssbinLoader.cpp

@@ -53,19 +53,41 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
 using namespace Assimp;
 using namespace Assimp;
 
 
-bool Assimp::AssbinImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig ) const
+static const aiImporterDesc desc = {
+  ".assbin Importer",
+  "Gargaj / Conspiracy",
+  "",
+  "",
+  aiImporterFlags_SupportBinaryFlavour | aiImporterFlags_SupportCompressedFlavour,
+  0,
+  0,
+  0,
+  0,
+  "assbin" 
+};
+
+const aiImporterDesc* Assimp::AssbinImporter::GetInfo() const
 {
 {
-  return false;
+  return &desc;
 }
 }
 
 
-const aiImporterDesc* Assimp::AssbinImporter::GetInfo() const
+bool Assimp::AssbinImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig ) const
 {
 {
-  return NULL;
+  IOStream * in = pIOHandler->Open(pFile);
+  if (!in)
+    return false;
+
+  char s[32];
+  in->Read( s, sizeof(char), 32 );
+
+  pIOHandler->Close(in);
+
+  return strncmp( s, "ASSIMP.binary-dump.", 19 ) == 0;
 }
 }
 
 
 void Assimp::AssbinImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler )
 void Assimp::AssbinImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler )
 {
 {
-
+  // TODO
 }
 }
 
 
 #endif // !! ASSIMP_BUILD_NO_ASSBIN_IMPORTER
 #endif // !! ASSIMP_BUILD_NO_ASSBIN_IMPORTER