Step-Importer: introduce new files.

pull/2175/head
Kim Kulling 2018-08-26 19:05:21 +02:00
parent 8ceca4daaf
commit c75bc99902
5 changed files with 78 additions and 8 deletions

View File

@ -505,7 +505,6 @@ ADD_ASSIMP_IMPORTER( XGL
XGLLoader.h
)
ADD_ASSIMP_IMPORTER( FBX
FBXImporter.cpp
FBXCompileConfig.h
@ -722,9 +721,11 @@ ADD_ASSIMP_IMPORTER( MMD
)
SET( Step_SRCS
STEPFile.h
StepExporter.h
StepExporter.cpp
STEPFile.h
Importer/StepFile/StepFileImporter.h
Importer/StepFile/StepFileImporter.cpp
StepExporter.h
StepExporter.cpp
)
SOURCE_GROUP( Step FILES ${Step_SRCS})

View File

@ -119,9 +119,9 @@ bool EmbedTexturesProcess::addTexture(aiScene* pScene, std::string path) const {
}
}
aiTexel* imageContent = new aiTexel[1u + imageSize / sizeof(aiTexel)];
file.seekg(0, std::ios::beg);
file.read(reinterpret_cast<char*>(imageContent), imageSize);
aiTexel* imageContent = new aiTexel[1u + static_cast<size_t>( imageSize) / sizeof(aiTexel)];
file.seekg( 0, std::ios::beg );
file.read( reinterpret_cast<char*>(imageContent), imageSize );
// Enlarging the textures table
auto textureId = pScene->mNumTextures++;

View File

@ -0,0 +1,48 @@
#include "StepFileImporter.h"
namespace Assimp {
namespace STEP {
static const aiImporterDesc desc = { "StepFile Importer",
"",
"",
"",
0,
0,
0,
0,
0,
"stp" };
StepFileImporter::StepFileImporter()
: BaseImporter() {
}
StepFileImporter::~StepFileImporter() {
}
bool StepFileImporter::CanRead(const std::string& file, IOSystem* pIOHandler, bool checkSig) const {
const std::string &extension = GetExtension(file);
if ( extension == "stp" ) {
return true;
} else if ((!extension.length() || checkSig) && pIOHandler) {
const char* tokens[] = { "ISO-10303-21" };
const bool found(SearchFileHeaderForToken(pIOHandler, file, tokens, 1));
return found;
}
return false;
}
const aiImporterDesc *StepFileImporter::GetInfo() const {
return &desc;
}
void StepFileImporter::InternReadFile(const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler) {
}
}
}

View File

@ -0,0 +1,22 @@
#pragma once
#include <assimp/BaseImporter.h>
namespace Assimp {
namespace STEP {
class StepFileImporter : public BaseImporter {
public:
StepFileImporter();
~StepFileImporter();
bool CanRead(const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const override;
const aiImporterDesc* GetInfo() const override;
protected:
void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler ) override;
private:
};
}
}

View File

@ -416,7 +416,6 @@ namespace STEP {
}
private:
ConverterMap converters;
};
}