本文整理汇总了C++中assimp::Importer::GetExtensionList方法的典型用法代码示例。如果您正苦于以下问题:C++ Importer::GetExtensionList方法的具体用法?C++ Importer::GetExtensionList怎么用?C++ Importer::GetExtensionList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assimp::Importer
的用法示例。
在下文中一共展示了Importer::GetExtensionList方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RegisterAssimpModelParsers
static void RegisterAssimpModelParsers(C3DModelLoader::ParserMap& parsers, CAssParser* assParser) {
std::string extension;
std::string extensions;
Assimp::Importer importer;
// get a ";" separated list of format extensions ("*.3ds;*.lwo;*.mesh.xml;...")
importer.GetExtensionList(extensions);
// do not ignore the last extension
extensions += ";";
LOG("[%s] supported Assimp model formats: %s",
__FUNCTION__, extensions.c_str());
size_t i = 0;
size_t j = 0;
// split the list, strip off the "*." extension prefixes
while ((j = extensions.find(";", i)) != std::string::npos) {
extension = extensions.substr(i, j - i);
extension = extension.substr(extension.find("*.") + 2);
StringToLowerInPlace(extension);
if (parsers.find(extension) == parsers.end()) {
parsers[extension] = assParser;
}
i = j + 1;
}
}
示例2: RegisterAssimpModelFormats
static void RegisterAssimpModelFormats(C3DModelLoader::FormatMap& formats) {
std::string extension;
std::string extensions;
Assimp::Importer importer;
// get a ";" separated list of format extensions ("*.3ds;*.lwo;*.mesh.xml;...")
importer.GetExtensionList(extensions);
// do not ignore the last extension
extensions += ";";
LOG("[%s] supported Assimp model formats: %s",
__FUNCTION__, extensions.c_str());
size_t curIdx = 0;
size_t nxtIdx = 0;
// split the list, strip off the "*." extension prefixes
while ((nxtIdx = extensions.find(";", curIdx)) != std::string::npos) {
extension = extensions.substr(curIdx, nxtIdx - curIdx);
extension = extension.substr(extension.find("*.") + 2);
extension = StringToLower(extension);
if (formats.find(extension) == formats.end()) {
formats[extension] = MODELTYPE_ASS;
}
curIdx = nxtIdx + 1;
}
}
示例3: aiGetExtensionList
// ------------------------------------------------------------------------------------------------
// Get a list of all file extensions supported by ASSIMP
void aiGetExtensionList(aiString* szOut)
{
ai_assert(NULL != szOut);
ASSIMP_BEGIN_EXCEPTION_REGION();
// FIXME: no need to create a temporary Importer instance just for that ..
Assimp::Importer tmp;
tmp.GetExtensionList(*szOut);
ASSIMP_END_EXCEPTION_REGION(void);
}
示例4: aiGetExtensionList
// ------------------------------------------------------------------------------------------------
// Get a list of all file extensions supported by ASSIMP
void aiGetExtensionList(aiString* szOut)
{
ai_assert(NULL != szOut);
ASSIMP_BEGIN_EXCEPTION_REGION();
#ifdef AI_C_THREADSAFE
boost::mutex::scoped_lock lock(gMutex);
#endif
if (!gActiveImports.empty()) {
(*(gActiveImports.begin())).second->GetExtensionList(*szOut);
return;
}
// fixme: no need to create a temporary Importer instance just for that ..
Assimp::Importer tmp;
tmp.GetExtensionList(*szOut);
ASSIMP_END_EXCEPTION_REGION(void);
}
示例5: aiGetExtensionList
// ------------------------------------------------------------------------------------------------
// Get a list of all file extensions supported by ASSIMP
void aiGetExtensionList(aiString* szOut)
{
ai_assert(NULL != szOut);
// lock the mutex
#if (defined AI_C_THREADSAFE)
boost::mutex::scoped_lock lock(gMutex);
#endif
if (!gActiveImports.empty())
{
(*(gActiveImports.begin())).second->GetExtensionList(*szOut);
return;
}
// need to create a temporary Importer instance.
// TODO: Find a better solution ...
Assimp::Importer* pcTemp = new Assimp::Importer();
pcTemp->GetExtensionList(*szOut);
delete pcTemp;
}
示例6: addSourceModelsTriggered
void HKWindow::addSourceModelsTriggered() {
Assimp::Importer importer;
std::string extensions_assimp = "";
importer.GetExtensionList(extensions_assimp);
QStringList extensions= QString(extensions_assimp.c_str()).split(";");
extensions.removeOne("*");
// Build Extensions String for Open Dialog
QString extensions_str = "All supported formats (";
foreach(QString extension, extensions)
extensions_str += extension + " ";
extensions_str += ");;";
// Specific filters
foreach(QString extension, extensions) {
size_t index = importer.GetImporterIndex(extension.toStdString().c_str());
if (index != -1) {
const aiImporterDesc *description = importer.GetImporterInfo(index);
extensions_str += QString("%1 (%2);;").arg(description->mName).arg(extension);
}
}
示例7: main
int main (int argc, char *argv[], char **env_var_ptr)
{
int i=0;
int mtlIndex=0;
char out_filename[256];
char mdl_filename[256];
bool skinned=false;
bool all=false;
uint32_t hash=0;
Hash_key simplek("SIMPLE");
hash=simplek;
printf("SIMPLE %u\n",hash);
char *filename=argv[argc-1];
strcpy(out_filename,filename);
for (i=1; i< argc; i++) {
if (!strcmp(argv[i],"-h"))
{
printHelp(argc,argv);
exit(1);
}
if (!strcmp(argv[i],"-t"))
{
Hash_key key(argv[i+1]);
hash=key;
}
if (!strcmp(argv[i],"-d"))
{
printAll=true;
}
if (!strcmp(argv[i],"-s"))
{
skinned=true;
}
if (!strcmp(argv[i],"-a"))
{
all=true;
}
if (!strcmp(argv[i],"-i"))
{
mtlIndex=atoi(argv[i+1]);
}
if (!strcmp(argv[i],"-o"))
{
strcpy(out_filename,argv[i+1]);
}
// printf("\narg%d=%s", i, argv[i]);
}
// Extract base
char *pExt = strrchr(out_filename, '.');
if (pExt != NULL)
strcpy(pExt, ".pkg");
else
strcat(out_filename, ".pkg");
Assimp::Importer importer;
//const aiScene* scene = importer.ReadFile(filename,NULL);
// aiProcess_GenSmoothNormals |
// | aiProcess_SortByPType
const aiScene* scene = importer.ReadFile(filename,
aiProcess_RemoveRedundantMaterials |
aiProcess_Triangulate | aiProcess_GenSmoothNormals
);
if (scene==NULL)
{
std::string tmp;
printf("Not able to read file error:%s\n",importer.GetErrorString());
importer.GetExtensionList(tmp);
printf("Supported extensions %s \n",tmp.c_str());
exit(-1);
}
printf ("Found %d meshes\n",scene->mNumMeshes);
printf ("Found %d materials\n",scene->mNumMaterials);
printf ("Found %d animations\n",scene->mNumAnimations);
std::vector<unsigned short int> indexTotal;
//.........这里部分代码省略.........
示例8: main
// ------------------------------------------------------------------------------
// Application entry point
int main (int argc, char* argv[])
{
if (argc <= 1) {
printf("assimp: No command specified. Use \'assimp help\' for a detailed command list\n");
return 0;
}
// assimp version
// Display version information
if (! strcmp(argv[1], "version")) {
const unsigned int flags = aiGetCompileFlags();
printf(AICMD_MSG_ABOUT,
aiGetVersionMajor(),
aiGetVersionMinor(),
(flags & ASSIMP_CFLAGS_DEBUG ? "-debug " : ""),
(flags & ASSIMP_CFLAGS_NOBOOST ? "-noboost " : ""),
(flags & ASSIMP_CFLAGS_SHARED ? "-shared " : ""),
(flags & ASSIMP_CFLAGS_SINGLETHREADED ? "-st " : ""),
(flags & ASSIMP_CFLAGS_STLPORT ? "-stlport " : ""),
aiGetVersionRevision());
return 0;
}
// assimp help
// Display some basic help (--help and -h work as well
// because people could try them intuitively)
if (!strcmp(argv[1], "help") || !strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) {
printf("%s",AICMD_MSG_HELP);
return 0;
}
// assimp cmpdump
// Compare two mini model dumps (regression suite)
if (! strcmp(argv[1], "cmpdump")) {
return Assimp_CompareDump (&argv[2],argc-2);
}
// construct global importer and exporter instances
Assimp::Importer imp;
imp.SetPropertyBool("GLOB_MEASURE_TIME",true);
globalImporter = &imp;
#ifndef ASSIMP_BUILD_NO_EXPORT
//
Assimp::Exporter exp;
globalExporter = &exp;
#endif
// assimp listext
// List all file extensions supported by Assimp
if (! strcmp(argv[1], "listext")) {
aiString s;
imp.GetExtensionList(s);
printf("%s\n",s.data);
return 0;
}
#ifndef ASSIMP_BUILD_NO_EXPORT
// assimp listexport
// List all export file formats supported by Assimp (not the file extensions, just the format identifiers!)
if (! strcmp(argv[1], "listexport")) {
aiString s;
for(size_t i = 0, end = exp.GetExportFormatCount(); i < end; ++i) {
const aiExportFormatDesc* const e = exp.GetExportFormatDescription(i);
s.Append( e->id );
if (i!=end-1) {
s.Append("\n");
}
}
printf("%s\n",s.data);
return 0;
}
// assimp exportinfo
// stat an export format
if (! strcmp(argv[1], "exportinfo")) {
aiString s;
if (argc<3) {
printf("Expected file format id\n");
return -11;
}
for(size_t i = 0, end = exp.GetExportFormatCount(); i < end; ++i) {
const aiExportFormatDesc* const e = exp.GetExportFormatDescription(i);
if (!strcmp(e->id,argv[2])) {
printf("%s\n%s\n%s\n",e->id,e->fileExtension,e->description);
return 0;
}
}
printf("Unknown file format id: \'%s\'\n",argv[2]);
return -12;
//.........这里部分代码省略.........
示例9: main
int main(int argc, char **argv)
{
//Initializes console Position
HWND hWnd = GetConsoleWindow();
MoveWindow(hWnd, 1350, 0, 500, 1000, TRUE);
std::cout << "GameArtsEngine" << std::endl;
//Initializes SDL and gets everything set up
SDL_Init(SDL_INIT_VIDEO);
SDL_Window *window = SDL_CreateWindow("GameArtsEngine", 40, 40, windowWidth, windowHeight, SDL_WINDOW_OPENGL);
SDL_GLContext glcontext = SDL_GL_CreateContext(window);
//Initializes our Glew
glewInit();
//Initializes our Engine
iGAEngine->initGL(windowWidth, windowHeight);
aiString list;
Assimp::Importer imp;
imp.GetExtensionList(list);
std::cout << list.C_Str() << std::endl;
/**************************************ALL THE ONE TIME SCENE SETUP GOES HERE*******************************************/
//Creates a basic Light for our scene --> will eventually be moved to the Engine itself
mainLight = new Light(LIGHT_POINT);
mainLight->setDiffuse(2, 2, 2, 1);
mainLight->setExponent(10);
mainLight->setPosition(-5,25,5);
//Load Textures
defaultTexture = iGAEngine->loadTexture("Assets/Textures/ModelgridTexture.jpg");
//Load Models->Primitives ------------------------ENABLE IF YOU NEED PRIMITIVES---------------------------------
teapodModel = new meshLoader("Assets/Models/Primitives/teapod.dae");
cylinderModel = new meshLoader("Assets/Models/Primitives/cylinder.dae");
sphereModel = new meshLoader("Assets/Models/Primitives/sphere.dae");
cubeModel = new meshLoader("Assets/Models/Primitives/cube.dae");
//Load Models->GameModels
//-----------------------------------------------------------------------------------------SHADERSETUP--------------------------------------------
if (GLEW_ARB_vertex_shader && GLEW_ARB_fragment_shader){
cout << endl << "SHADER LOG: -------------------------------------------------------- BEGIN" << endl;
// Simple Normal Shader without SpecMap
normalShader = new Shader("normal.vert", "normal.frag");
normalShader->useShader();
normalShader->setAttribute1i("diffuseMap0", 0);
normalShader->setAttribute1i("normalMap1", 1);
normalShader->setAttribute1f("SpecularPower", 2.0f);
normalShader->setAttribute4f("Specular", 0.5, 0.5, 0.5, 1.0);
normalShader->setAttribute4f("Ambient", 0.3, 0.3, 0.3, 1.0);
normalShader->setAttribute4f("Diffuse", 1, 1, 1, 1.0);
normalShader->setAttribute3f("fvLightPosition", 50.3f, 18.9f, 27.2f);
// Normal Shader with SpecMap
normalSpecShader = new Shader("normalSpec.vert", "normalSpec.frag");
normalSpecShader->useShader();
normalSpecShader->setAttribute1i("diffuseMap0", 0);
normalSpecShader->setAttribute1i("normalMap1", 1);
normalSpecShader->setAttribute1i("specularMap2", 2);
normalSpecShader->setAttribute1f("SpecularPower", 2.0f);
normalSpecShader->setAttribute4f("Specular", 0.5, 0.5, 0.5, 1.0);
normalSpecShader->setAttribute4f("Ambient", 0.3, 0.3, 0.3, 1.0);
normalSpecShader->setAttribute4f("Diffuse", 1, 1, 1, 1.0);
normalSpecShader->setAttribute3f("fvLightPosition", 50.3f, 18.9f, 27.2f);
// Simple LambertShader with DiffuseMap
diffuseShader = new Shader("lambertDiffuse.vert", "lambertDiffuse.frag");
diffuseShader->useShader();
diffuseShader->setAttribute4f("Ambient", 0.3, 0.3, 0.3, 1.0);
diffuseShader->setAttribute4f("Diffuse", 1, 1, 1, 1.0);
diffuseShader->setAttribute3f("fvLightPosition", 50.3f, 18.9f, 27.2f);
lambertShader_static = new Shader("lambert_static.vert", "lambert_static.frag");
lambertShader_static->useShader();
lambertShader_static->setAttribute4f("Ambient", 0.3, 0.3, 0.3, 1.0);
lambertShader_static->setAttribute4f("Diffuse", 1, 1, 1, 1.0);
lambertShader_static->setAttribute3f("fvLightPosition", 50.3f, 18.9f, 27.2f);
cout << endl << "SHADER LOG: ---------------------------------------------------------- END" << endl;
}
else{
cout << endl << "GLSL not supported" << endl;
}
//.........这里部分代码省略.........