void ResourceManager::on_bImportExternal_clicked()
{
    Importer *importer = new Importer;
    importer->exec();
    delete importer;
    buildResourceTree();
}
Beispiel #2
0
bool AutoImporter::validate(const DataDescriptor* pDescriptor,
                            const vector<const DataDescriptor*>& importedDescriptors,
                            string& errorMessage) const
{
    if (pDescriptor == NULL)
    {
        return NULL;
    }

    bool bValid = false;

    Importer* pImporter = const_cast<AutoImporter*>(this)->findImporter(pDescriptor);
    if (pImporter != NULL)
    {
        bValid = pImporter->validate(pDescriptor, importedDescriptors, errorMessage);
        if (errorMessage.empty() == false)
        {
            VERIFY(mpPlugIn != NULL);
            string importerName = mpPlugIn->getName();
            errorMessage.insert(0, importerName + ":\n");
        }
    }

    return bValid;
}
Beispiel #3
0
Map* FileFormatTest::saveAndLoadMap(Map* input, const FileFormat* format)
{
	try {
		QBuffer buffer;
		buffer.open(QIODevice::ReadWrite);
		
		Exporter* exporter = format->createExporter(&buffer, input, NULL);
		if (!exporter)
			return NULL;
		exporter->doExport();
		delete exporter;
		
		buffer.seek(0);
		
		Map* out = new Map;
		Importer* importer = format->createImporter(&buffer, out, NULL);
		if (!importer)
			return NULL;
		importer->doImport(false);
		importer->finishImport();
		delete importer;
		
		buffer.close();
		
		return out;
	}
	catch (std::exception& e)
	{
		return NULL;
	}
}
void register_protobuf_file(string filePath, string fileName, int proto_hadoop)
{
    if ( g_listPBFile.end() != find(g_listPBFile.begin(), g_listPBFile.end(), filePath + fileName ) )
    {
        return;
    }
    g_listPBFile.push_back( filePath + fileName );
      
    DiskSourceTree sourceTree;
    sourceTree.MapPath("", filePath);
    
    // keep the Descriptor data in memory  
    Importer* importer = new Importer(&sourceTree, NULL);
                
    const FileDescriptor* file = NULL;
    file = importer->Import(fileName);
    if (NULL == file)
    {
        return;
    }

    // recursive parse import file
    for (int iDependencyIndex = 0; iDependencyIndex < file->dependency_count(); iDependencyIndex++)
    {
        const FileDescriptor* dependencyFile = NULL;
        dependencyFile = file->dependency(iDependencyIndex);
        if (NULL == dependencyFile)
        {
            return;
        }

        register_protobuf_file(filePath, dependencyFile->name(), proto_hadoop);
    }
    
    // parse message
    for (int iMsgIndex = 0; iMsgIndex < file->message_type_count(); iMsgIndex++)
    {
        const Descriptor* message = file->message_type(iMsgIndex);
        register_protobuf_message(message, proto_hadoop);
    }
      
    // parse service
    for (int iServiceIndex = 0; iServiceIndex < file->service_count(); iServiceIndex++)
    {
        const ServiceDescriptor* service = file->service(iServiceIndex);
        for (int iMethodIndex = 0; iMethodIndex < service->method_count(); iMethodIndex++)
        {
            const MethodDescriptor* method = service->method(iMethodIndex);
            
            MethodInfo methodInfo;
            methodInfo.methodParamType = method->input_type()->full_name();
            methodInfo.methodReturnType = method->output_type()->full_name();
            
            g_mapMethod.insert(pair<string, MethodInfo>(method->name(), methodInfo));
        }
    } // end parse service
    
}
    virtual bool exporterTest() {
        Importer importer;
        Exporter exporter;
        const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/PLY/cube.ply", 0);
        EXPECT_NE(nullptr, scene);
        EXPECT_EQ(aiReturn_SUCCESS, exporter.Export(scene, "ply", ASSIMP_TEST_MODELS_DIR "/PLY/cube_test.ply"));

        return true;
    }
Beispiel #6
0
bool AutoImporter::isProcessingLocationSupported(ProcessingLocation location) const
{
    bool bSupported = false;

    Importer* pImporter = dynamic_cast<Importer*>(mpPlugIn);
    if (pImporter != NULL)
    {
        bSupported = pImporter->isProcessingLocationSupported(location);
    }

    return bSupported;
}
Beispiel #7
0
vector<ImportDescriptor*> AutoImporter::getImportDescriptors(const string& filename)
{
    vector<ImportDescriptor*> descriptors;

    Importer* pImporter = findImporter(filename);
    if (pImporter != NULL)
    {
        descriptors = pImporter->getImportDescriptors(filename);
    }

    return descriptors;
}
Beispiel #8
0
void AutoImporter::polishDataDescriptor(DataDescriptor* pDescriptor)
{
    if (pDescriptor == NULL)
    {
        return;
    }

    Importer* pImporter = findImporter(pDescriptor);
    if (pImporter != NULL)
    {
        pImporter->polishDataDescriptor(pDescriptor);
    }
}
Beispiel #9
0
void PFImporterTest::scrubCommandsNew()
{
    platform = "pf";

    std::istringstream instream(
        openTestFile("test_data/pf-scrub-commands-new.conf"));

    Importer* imp = new PFImporter(lib, instream, logger, "test_fw");
    imp->setAddStandardCommentsFlag(true);
    CPPUNIT_ASSERT_NO_THROW( imp->run() );
    imp->finalize();

    compareResults(logger,
                   "test_data/pf-scrub-commands-new.output",
                   "pf-scrub-commands-new.output");
}
Beispiel #10
0
QWidget* AutoImporter::getImportOptionsWidget(DataDescriptor* pDescriptor)
{
    if (pDescriptor == NULL)
    {
        return NULL;
    }

    QWidget* pWidget = NULL;

    Importer* pImporter = findImporter(pDescriptor);
    if (pImporter != NULL)
    {
        pWidget = pImporter->getImportOptionsWidget(pDescriptor);
    }

    return pWidget;
}
Beispiel #11
0
QWidget* AutoImporter::getPreview(const DataDescriptor* pDescriptor, Progress* pProgress)
{
    if (pDescriptor == NULL)
    {
        return NULL;
    }

    QWidget* pPreviewWidget = NULL;

    Importer* pImporter = findImporter(pDescriptor);
    if (pImporter != NULL)
    {
        pPreviewWidget = pImporter->getPreview(pDescriptor, pProgress);
    }

    return pPreviewWidget;
}
Beispiel #12
0
void PFImporterTest::routeTo47Test()
{
    platform = "pf";

    std::istringstream instream(
        openTestFile("test_data/pf-route-to-4.7.conf"));

    Importer* imp = new PFImporter(lib, instream, logger, "test_fw");
    imp->setAddStandardCommentsFlag(true);
    CPPUNIT_ASSERT_NO_THROW( imp->run() );
    imp->finalize();

    db->setPredictableIds();
    db->saveFile("pf-route-to-4.7.fwb");

    compareResults(logger, "test_data/pf-route-to-4.7.output", "pf-route-to-4.7.output");
    compareFwbFiles("test_data/pf-route-to-4.7.fwb", "pf-route-to-4.7.fwb");
}
Beispiel #13
0
Module * PackageMgr::loadModule(StringRef qname) {
  // First, attempt to search the modules already loaded.
  ModuleMap::iterator it = modules_.find(qname);
  if (it != modules_.end()) {
    if (ShowImports && it->second != NULL) {
      diag.debug() << "Import: Found module '" << qname << "' in module cache";
    }

    return it->second;
  }

  // If it's a regular file.
  Module * mod = NULL;

  // Search each element on the import path list.
  for (PathList::iterator it = importers_.begin(); it != importers_.end(); ++it) {
    Importer * imp = *it;
    if (imp->load(qname, mod)) {
      // If the module was there but failed to load (NULL) then we're done
      if (mod == NULL) {
        break;
      }
    }
  }

  if (!mod && ShowImports) {
    diag.debug() << "Import: module '" << qname << "' NOT FOUND";
  }

  // Regardless of whether the module was found, record this result in the map
  // so we don't have to look it up again.
  modules_[qname] = mod;

  // Do this *after* we add the module to the map, because createMembers() might
  // do other module lookups.
  if (mod != NULL) {
    mod->createMembers();
  }
  return mod;
}
Beispiel #14
0
bool AssimpWrapper::importAsset( const IO::Uri &file, ui32 flags ) {
    if ( !file.isValid() ) {
        osre_error( Tag, "URI " + file.getUri() + " is invalid " );
        return false;
    }

    unsigned int importFlags = aiProcess_CalcTangentSpace
        | aiProcess_GenSmoothNormals
        | aiProcess_JoinIdenticalVertices
        | aiProcess_ImproveCacheLocality
        | aiProcess_LimitBoneWeights
        | aiProcess_RemoveRedundantMaterials
        | aiProcess_SplitLargeMeshes
        | aiProcess_Triangulate
        | aiProcess_GenUVCoords
        | aiProcess_SortByPType;
    flags = importFlags;

    m_root = AssetRegistry::getPath( "media" );
    m_absPathWithFile = AssetRegistry::resolvePathFromUri( file );

    String filename;
    Directory::getDirectoryAndFile(m_absPathWithFile, m_root, filename);
    filename = m_root + filename;
    Importer myImporter;
    const aiScene *scene = myImporter.ReadFile( filename, flags );
    if ( nullptr == scene ) {
        m_root = "";
        m_absPathWithFile = "";
        return false;
    }
    convertSceneToModel( scene );
    m_model->setMeshArray( m_meshArray );

    return true;
}
Beispiel #15
0
 void importNext()
 {
     if (mUrlList.empty()) {
         q->finalizeImport();
         return;
     }
     mCurrentUrl = mUrlList.takeFirst();
     KUrl dst = mTempImportDir;
     dst.addPath(mCurrentUrl.fileName());
     KIO::Job* job = KIO::copy(mCurrentUrl, dst, KIO::HideProgressInfo);
     if (job->ui()) {
         job->ui()->setWindow(mAuthWindow);
     }
     QObject::connect(job, SIGNAL(result(KJob*)),
                      q, SLOT(slotCopyDone(KJob*)));
     QObject::connect(job, SIGNAL(percent(KJob*,ulong)),
                      q, SLOT(slotPercent(KJob*,ulong)));
 }
Beispiel #16
0
    void renameImportedUrl(const KUrl& src)
    {
        KUrl dst = src;
        dst.cd("..");
        QString fileName;
        if (mFileNameFormater.get()) {
            KFileItem item(KFileItem::Unknown, KFileItem::Unknown, src, true /* delayedMimeTypes */);
            // Get the document time, but do not cache the result because the
            // 'src' url is temporary: if we import "foo/image.jpg" and
            // "bar/image.jpg", both images will be temporarily saved in the
            // 'src' url.
            KDateTime dateTime = TimeUtils::dateTimeForFileItem(item, TimeUtils::SkipCache);
            fileName = mFileNameFormater->format(src, dateTime);
        } else {
            fileName = src.fileName();
        }
        dst.setFileName(fileName);

        FileUtils::RenameResult result = FileUtils::rename(src, dst, mAuthWindow);
        switch (result) {
        case FileUtils::RenamedOK:
            mImportedUrlList << mCurrentUrl;
            break;
        case FileUtils::RenamedUnderNewName:
            mRenamedCount++;
            mImportedUrlList << mCurrentUrl;
            break;
        case FileUtils::Skipped:
            mSkippedUrlList << mCurrentUrl;
            break;
        case FileUtils::RenameFailed:
            kWarning() << "Rename failed for" << mCurrentUrl;
        }
        q->advance();
        importNext();
    }
			shared_ptr<drawBasement::IModel> load(drawBasement::IDrawFactory* df,IFileService* ff,shared_ptr<IFile> fi){
				using namespace Assimp;
				Importer Imp;
				u32 size = fi->getFileSize();
				void* buf = malloc(size);
				fi->read((char*)buf,size);
				const aiScene* pScene = Imp.ReadFile(fi->getAbsolutePath().c_str(),aiProcess_Triangulate | aiProcess_GenSmoothNormals);
				free(buf);

				const aiVector3D Zero3D(0.0f, 0.0f, 0.0f);
				auto model = new drawBasement::CModel;
				model->modelPath = fi->getAbsolutePath();
				//骨骼动画初始化
				if(pScene->HasAnimations()){
					model->mBoneAnimator = shared_ptr<drawBasement::CBoneAnimator>(new drawBasement::CBoneAnimator);
					buildBoneAnimations(pScene->mAnimations[0],pScene->mRootNode,model);
					model->mBoneAnimator->mMaxFrames = pScene->mAnimations[0]->mDuration;
					model->mBoneAnimator->mFramePerSecond = pScene->mAnimations[0]->mTicksPerSecond;
				}
				mat4 zeroMat;
				ZeroMemory(&zeroMat,sizeof(mat4));
				//模型数据初始化
				for(unsigned int i=0;i<pScene->mNumMeshes;++i){
					const aiMesh* paiMesh = pScene->mMeshes[i];
					auto vbuf = df->createVertexBuffer();
					vbuf->setElemtSize(3);
					vbuf->reSizeBuffer(sizeof(vector3df)*paiMesh->mNumVertices);
					vector3df* vb = (vector3df*)vbuf->lock();

					auto nbuf = df->createVertexBuffer();
					nbuf->setElemtSize(3);
					nbuf->reSizeBuffer(sizeof(vector3df)*paiMesh->mNumVertices);
					vector3df* nb = (vector3df*)nbuf->lock();

					auto tbuf = df->createVertexBuffer();
					tbuf->setElemtSize(2);
					tbuf->reSizeBuffer(sizeof(vector2df)*paiMesh->mNumVertices);
					vector2df* tb = (vector2df*)tbuf->lock();
					
					for (unsigned int i = 0 ; i < paiMesh->mNumVertices ; i++) {
						const aiVector3D* pPos      = &(paiMesh->mVertices[i]);
						const aiVector3D* pNormal   = &(paiMesh->mNormals[i]);
						const aiVector3D* pTexCoord = paiMesh->HasTextureCoords(0) ? &(paiMesh->mTextureCoords[0][i]) : &Zero3D;
						vb[i].X=pPos->x;
						vb[i].Y=pPos->y;
						vb[i].Z=pPos->z;

						tb[i].X=pTexCoord->x;
						tb[i].Y=pTexCoord->y;

						nb[i].X=pNormal->x;
						nb[i].Y=pNormal->y;
						nb[i].Z=pNormal->z;
						
					}

					auto ibuf = df->createIndexBuffer();
					ibuf->setIndexNums(paiMesh->mNumFaces*3);
					ibuf->setPrimityType(drawBasement::EPT_TRIANGLES);
					ibuf->reSizeBuffer(paiMesh->mNumFaces*3*ibuf->getIndexType());
					u16* ib = (u16*)ibuf->lock();
					for (unsigned int i = 0 ; i < paiMesh->mNumFaces ; i++) {
						const aiFace& Face = paiMesh->mFaces[i];
						ib[i*3+0]=Face.mIndices[0];
						ib[i*3+1]=Face.mIndices[1];
						ib[i*3+2]=Face.mIndices[2];
					}
					tbuf->initialBuffer();
					nbuf->initialBuffer();
					vbuf->initialBuffer();
					ibuf->initialBuffer();
					u32 bsize = 4*sizeof(u32)*paiMesh->mNumVertices;
					shared_ptr<drawBasement::IDrawBuffer> bbuf = 0;
					shared_ptr<drawBasement::IDrawBuffer> bwbuf = 0;
					if(paiMesh->HasBones()){
						bbuf = df->createVertexBuffer();
						bwbuf = df->createVertexBuffer();
						bbuf->reSizeBuffer(bsize);
						bbuf->setElemtSize(4);
						bbuf->setDataType(drawBasement::EDT_UINT);
						bwbuf->reSizeBuffer(bsize);
						bwbuf->setElemtSize(4);


						u32* bb = (u32*)bbuf->lock();
						f32* bwb = (f32*)bwbuf->lock();
						ZeroMemory(bb,bsize);
						ZeroMemory(bwb,bsize);
						for(u32 i=0;i<paiMesh->mNumBones;++i){
							auto bone = model->mBoneAnimator->findBones(paiMesh->mBones[i]->mName.C_Str());
							if(((drawBasement::CBone*)bone.get())->isinitial){
								((drawBasement::CBone*)bone.get())->isinitial=false;
								memcpy(&((drawBasement::CBone*)bone.get())->boneOffset,&paiMesh->mBones[i]->mOffsetMatrix,sizeof(f32)*16);
								((drawBasement::CBone*)bone.get())->boneOffset=((drawBasement::CBone*)bone.get())->boneOffset.getTransposed();
							}
							u32 bid = bone->getBoneIdx();
							for(u32 bi=0;bi<paiMesh->mBones[i]->mNumWeights;++bi){
								u32 vid = paiMesh->mBones[i]->mWeights[bi].mVertexId;
								f32 vw = paiMesh->mBones[i]->mWeights[bi].mWeight;
								AddBoneData(bb+vid*4,bwb+vid*4,bid,vw);
							}
						}
						bbuf->initialBuffer();
						bwbuf->initialBuffer();
					}
					drawBasement::ModelMeshInfo inf;
					auto vbo = df->createVertexBufferObject(vbuf,ibuf,tbuf,nbuf,bbuf,bwbuf);
					inf.mVbo = vbo;
					inf.materialIdx = paiMesh->mMaterialIndex;
					model->addObj(inf);
				}
				string path = fi->getAbsolutePath();
				bool linustyle = true;
				auto p = path.findLast('/');
				if(p == -1){
					p = path.findLast('\\');
					linustyle=false;
				}
				if(p == -1){
					throw exception();
				}
				string dir = path.subString(0,p);
				if(!linustyle)
					dir+="\\";
				else
					dir+='/';
				//纹理初始化
				for (u32 i=0;i<pScene->mNumMaterials;++i)
				{
					if(pScene->mMaterials[i]->GetTextureCount(aiTextureType_DIFFUSE) == 1){
						aiString filename;
						pScene->mMaterials[i]->GetTexture(aiTextureType_DIFFUSE,0,&filename);
						string filenamew(filename.C_Str());
						auto p = dir+filenamew;
						auto tex = df->getTextureFactory()->createTextureFromImage(ff->createImageFromFile(p.c_str()).get());
						drawBasement::ModelMatrials mat;
						mat.texture =tex;
						u32 idx = model->mMatarials.size();
						
						model->mMatarials.insert(make_pair(idx,mat));
					}else{
						throw exception();
					}
				}
				return shared_ptr<drawBasement::IModel>(model);
			}
Beispiel #18
0
void DDEngine::ModelObject::loadGeometry(std::vector<Mesh>& meshes)
{
	Importer importer;
	const aiScene* scene = importer.ReadFile(modelPath,
		aiProcess_Triangulate |
		aiProcess_ConvertToLeftHanded |
		aiProcess_FlipUVs |
		aiProcess_SortByPType |
		aiProcess_OptimizeMeshes |
		aiProcess_OptimizeGraph |
		aiProcess_FixInfacingNormals |
		aiProcess_CalcTangentSpace
		);

	if (!scene) {
		Win32Utils::showMessage("Error during loading object.", importer.GetErrorString());
		return;
	}

	const aiVector3D nullVec(0.0f, 0.0f, 0.0f);

	for (size_t i = 0; i < scene->mNumMeshes; i++) {
		const aiMesh* mesh = scene->mMeshes[i];
		Mesh ddeMesh;

		for (size_t j = 0; j < mesh->mNumVertices; j++) {

			const aiVector3D* pos = &(mesh->mVertices[j]);
			const aiVector3D* nor = mesh->HasNormals() ? &(mesh->mNormals[j]) : &nullVec;
			const aiVector3D* tan = mesh->HasTangentsAndBitangents() ? &(mesh->mTangents[j]) : &nullVec;
			const aiVector3D* tex = mesh->HasTextureCoords(0) ? &(mesh->mTextureCoords[0][j]) : &nullVec;

			#define VB(x, y, z, u, v, nx, ny, nz, tx, ty, tz, tw) ddeMesh.VB(VertexPositionNormalTangentTexture(XMFLOAT3(x, y, z), XMFLOAT3(nx, ny, nz), XMFLOAT4(tx, ty, tz, tw), XMFLOAT2(u, v)))

			VB(
				pos->x, pos->y, pos->z,
				tex->x, tex->y,
				nor->x, nor->y, nor->z,
				tan->x, tan->y, tan->z, 0.0f
			);

			ddeMesh.materialIndex = mesh->mMaterialIndex;

		}

		for (size_t j = 0; j < mesh->mNumFaces; j++) {

			const aiFace& face = mesh->mFaces[j];

			switch (face.mNumIndices) {
				case 1: ddeMesh.topology = PrimitiveTopology::POINT_LIST; break;
				case 2: ddeMesh.topology = PrimitiveTopology::LINE_LIST; break;
				case 3: ddeMesh.topology = PrimitiveTopology::TRIANGLE_LIST; break;
				default: ddeMesh.topology = PrimitiveTopology::UNDEFINED; break;
			}

			for (size_t index = 0; index < face.mNumIndices; index++) {
				ddeMesh.IB(face.mIndices[index]);
			}

		}

		meshes.push_back(ddeMesh);
	}

	for (size_t i = 0; i < scene->mNumMaterials; i++) {
		const aiMaterial* material = scene->mMaterials[i];
		Material ddeMaterial;
		ddeMaterial.index = i;

		if (material->GetTextureCount(aiTextureType_DIFFUSE) > 0) {
			aiString Path;

			if (material->GetTexture(aiTextureType_DIFFUSE, 0, &Path, NULL, NULL, NULL, NULL, NULL) == AI_SUCCESS) {
				Texture tex;
				tex.type = Texture::TextureType::DIFFUSE;

				ShaderResourceView* texture = nullptr;

				std::string path = Path.data;
				std::size_t ext = path.find(".tga");
				ScratchImage image;
				HRESULT hr = -1;

				std::string currentPath = FileUtils::getPath(modelPath) + "/";
				tex.path = currentPath + path;

				if (ext != std::string::npos) {
					hr = LoadFromTGAFile(StringUtils::toWstring(currentPath + path).c_str(), nullptr, image);
				}
				else {
					texture = TextureUtils::createTexture(currentPath + path, *Ctx);
				}

				if (SUCCEEDED(hr)) {
					hr = CreateShaderResourceView(Ctx->device, image.GetImages(), image.GetImageCount(), image.GetMetadata(), &texture);
				}

				if (texture) {
					tex.texture = texture;
					ddeMaterial.textureArray[Texture::TextureType::DIFFUSE] = texture;
					ddeMaterial.textures.push_back(tex);
				}
			}
		
		}

		materials.push_back(ddeMaterial);

	}

}
Beispiel #19
0
bool CImporter::Import(const string& filename)
{
	unsigned int flags = aiProcess_JoinIdenticalVertices;
	flags |= aiProcess_FlipUVs;
	flags |= aiProcess_Triangulate;
	flags |= aiProcess_GenSmoothNormals;
	flags |= aiProcess_LimitBoneWeights;
	flags |= aiProcess_ValidateDataStructure;
	flags |= aiProcess_ImproveCacheLocality;
	flags |= aiProcess_RemoveRedundantMaterials;
	flags |= aiProcess_FixInfacingNormals;
	flags |= aiProcess_FindInvalidData;
	flags |= aiProcess_OptimizeMeshes;
	flags |= aiProcess_SplitByBoneCount;
	flags |= aiProcess_TransformUVCoords;
	flags |= aiProcess_SortByPType;
	flags |= aiProcess_RemoveComponent;
	flags |= aiProcess_MakeLeftHanded;
	//flags |= aiProcess_FlipWindingOrder;
	//flags |= aiProcess_OptimizeGraph;

	Importer importer;
	if (!importer.ValidateFlags(flags))
	{
		qCritical("Import flags not supported");
		return false;
	}

	if (!importer.IsExtensionSupported(('.' % GetExtension(filename)).toLocal8Bit().constData()))
	{
		qCritical("This file format isn't supported");
		return false;
	}

	importer.SetPropertyInteger(AI_CONFIG_PP_LBW_MAX_WEIGHTS, 2);
	importer.SetPropertyInteger(AI_CONFIG_PP_SBBC_MAX_BONES, MAX_BONES);
	importer.SetPropertyInteger(AI_CONFIG_PP_RVC_FLAGS, aiComponent_TANGENTS_AND_BITANGENTS
		| aiComponent_COLORS
		| aiComponent_TEXTURES
		| aiComponent_LIGHTS
		| aiComponent_CAMERAS);

	m_scene = (aiScene*)importer.ReadFile(filename.toLocal8Bit().constData(), flags);
	if (!m_scene)
	{
		qCritical(importer.GetErrorString());
		return false;
	}

	if (!m_scene->HasMeshes() || !m_scene->mRootNode || m_scene->mRootNode->mNumChildren == 0)
	{
		qCritical("No meshes in this scene");
		return false;
	}

	m_obj3D = m_mesh->m_elements[0].obj = new CObject3D(m_mesh->m_device);
	m_obj3D->m_ID = _getNewID();

	const string filenameToLower = QFileInfo(filename).fileName().toLower();

	if (filenameToLower.startsWith("mvr")
		|| filenameToLower.startsWith("part")
		|| filenameToLower.startsWith("item"))
		m_externBones = true;

	_importScene();

	if (!m_obj3D->InitDeviceObjects())
	{
		qCritical(("Can't init object3D device objects '" % filename % "'").toLocal8Bit().data());
		return false;
	}

	importer.FreeScene();
	return true;
}
Beispiel #20
0
Importer* AutoImporter::findImporter(const string& filename)
{
    map<string, pair<string, unsigned char> >::iterator fileIter = mFilenames.find(filename);
    if (fileIter != mFilenames.end())
    {
        map<string, PlugIn*>::iterator plugInIter = mPlugIns.find(fileIter->second.first);
        if (plugInIter != mPlugIns.end())
        {
            mpPlugIn = plugInIter->second;
            return dynamic_cast<Importer*>(mpPlugIn);
        }
    }

    mpPlugIn = NULL;

    if (filename.empty() == true)
    {
        return NULL;
    }

    // Create the list of importers to search
    vector<PlugInDescriptor*> importers = mpPlugInManager->getPlugInDescriptors(PlugInManagerServices::ImporterType());

    //remove self from list of importers
    vector<PlugInDescriptor*>::iterator newEnd =
        remove_if(importers.begin(), importers.end(), FindDescriptor(getName()));
    importers.erase(newEnd, importers.end());

    // Check importers first based on file extension
    list<PlugInDescriptor*> remainingImporters;
    PlugIn* pPlugIn = NULL;
    unsigned char maxFileAffinity = Importer::CAN_NOT_LOAD;

    for (vector<PlugInDescriptor*>::iterator iter = importers.begin(); iter != importers.end(); ++iter)
    {
        PlugInDescriptor* pDescriptor = *iter;
        if (pDescriptor == NULL)
        {
            continue;
        }

        if (checkExtension(pDescriptor, filename))
        {
            PlugIn* pCurrentPlugIn = NULL;
            const string& plugInName = pDescriptor->getName();

            map<string, PlugIn*>::iterator plugInIter = mPlugIns.find(plugInName);
            if (plugInIter != mPlugIns.end())
            {
                pCurrentPlugIn = plugInIter->second;
            }
            else
            {
                PlugInResource pImporterRes(plugInName);
                pCurrentPlugIn = pImporterRes.release();
                if (pCurrentPlugIn != NULL)
                {
                    mPlugIns[plugInName] = pCurrentPlugIn;
                }
            }

            Importer* pImporter = dynamic_cast<Importer*>(pCurrentPlugIn);
            if (pImporter != NULL)
            {
                unsigned char fileAffinity = pImporter->getFileAffinity(filename);
                if (fileAffinity > maxFileAffinity)
                {
                    maxFileAffinity = fileAffinity;
                    pPlugIn = pCurrentPlugIn;
                }
            }
        }
        else
        {
            remainingImporters.push_back(pDescriptor);
        }
    }

    if ((pPlugIn != NULL) && (maxFileAffinity >= Importer::CAN_LOAD))
    {
        mpPlugIn = pPlugIn;
        mFilenames[filename] = make_pair(mpPlugIn->getName(), maxFileAffinity);
        return dynamic_cast<Importer*>(mpPlugIn);
    }

    // Check the remaining importers
    for (list<PlugInDescriptor*>::iterator iter = remainingImporters.begin(); iter != remainingImporters.end(); ++iter)
    {
        PlugInDescriptor* pDescriptor = *iter;
        if (pDescriptor == NULL)
        {
            continue;
        }

        PlugIn* pCurrentPlugIn = NULL;
        const string& plugInName = pDescriptor->getName();

        map<string, PlugIn*>::iterator plugInIter = mPlugIns.find(plugInName);
        if (plugInIter != mPlugIns.end())
        {
            pCurrentPlugIn = plugInIter->second;
        }
        else
        {
            PlugInResource pImporterRes(plugInName);
            pCurrentPlugIn = pImporterRes.release();
            if (pCurrentPlugIn != NULL)
            {
                mPlugIns[plugInName] = pCurrentPlugIn;
            }
        }

        Importer* pImporter = dynamic_cast<Importer*>(pCurrentPlugIn);
        if (pImporter != NULL)
        {
            unsigned char fileAffinity = pImporter->getFileAffinity(filename);
            if (fileAffinity > maxFileAffinity)
            {
                maxFileAffinity = fileAffinity;
                pPlugIn = pCurrentPlugIn;
            }
        }
    }

    // If an importer was found, assign it.
    if ((pPlugIn != NULL) && (maxFileAffinity > Importer::CAN_NOT_LOAD))
    {
        mpPlugIn = pPlugIn;
        mFilenames[filename] = make_pair(mpPlugIn->getName(), maxFileAffinity);
        return dynamic_cast<Importer*>(mpPlugIn);
    }

    return NULL;
}
Beispiel #21
0
Modell::Modell(glm::mat4& matrix, const char * modelpath)
{
	mat = matrix;

	Importer importer;
	const aiScene* scene = NULL;
	
	//gibt es die Datei
	std::ifstream fin(modelpath);
	if(!fin.fail()) {
		fin.close();
	}
	else{
		printf("Fehler beim laden des Modells: %s\n", modelpath);
		printf("%s\n", importer.GetErrorString());
		system("PAUSE");
		exit(EXIT_FAILURE);
	}

	scene = importer.ReadFile( modelpath,/* aiProcess_Triangulate | */aiProcessPreset_TargetRealtime_Quality);

	if( !scene)
	{
		printf("%s\n", importer.GetErrorString());
		system("PAUSE");
		exit(EXIT_FAILURE);
	}else{
		mesh = scene->mMeshes[0];

		int indexcount = mesh->mNumFaces * 3;
		int vertexcount = mesh->mNumVertices *3;
		int normcount = mesh->mNumVertices *3;
		int uvCoordcount = mesh->mNumVertices *2;

		for (unsigned int i = 0; i < mesh->mNumFaces; ++i) 
		{
            const aiFace* face = &mesh->mFaces[i];
			
			unsigned int index = face->mIndices[0];
			indices.push_back(index);

			index = face->mIndices[1];
			indices.push_back(index);

			index = face->mIndices[2];
			indices.push_back(index);
        }


		//index = 0;
		for (unsigned int i = 0; i < mesh->mNumVertices; ++i) 
		{
			glm::vec3 positions;

			positions.x = mesh->mVertices[i].x;
			positions.y = mesh->mVertices[i].y;
			positions.z = mesh->mVertices[i].z;

			pos.push_back(positions);

			glm::vec3 norm;
			norm.x = mesh->mNormals[i].x;
			norm.y = mesh->mNormals[i].y;
			norm.z = mesh->mNormals[i].z;

			normals.push_back(norm);

			glm::vec2 tex;
			//es koennten auch mehrere texturen am objekt sein. Wir supporten vorerst nur eine
			if (mesh->mTextureCoords[0]) 
			{
				tex.x = mesh->mTextureCoords[0][i].x;
				tex.y = mesh->mTextureCoords[0][i].y;

				uvs.push_back(tex);
			}
		}
		if (mesh->mMaterialIndex >= 0) {

		aiMaterial* material = scene->mMaterials[mesh->mMaterialIndex];
		aiColor3D colorDIF (0.f,0.f,0.f);
		aiColor3D colorSPEC (0.f,0.f,0.f);
		material->Get(AI_MATKEY_COLOR_DIFFUSE,colorDIF);
		material->Get(AI_MATKEY_COLOR_DIFFUSE,colorSPEC);

		diffuseMAT.r = colorDIF.r;
		diffuseMAT.g = colorDIF.g;
		diffuseMAT.b = colorDIF.b;

		specularMAT.r = colorSPEC.r;
		specularMAT.g = colorSPEC.g;
		specularMAT.b = colorSPEC.b;

		Texture textureloader;
		diffuseMaps = textureloader.loadMaterialTextures(modelpath, material, aiTextureType_DIFFUSE, "diffuse");
		//textures.insert(textures.end(), diffuseMaps.begin(), diffuseMaps.end());

		specularMaps = textureloader.loadMaterialTextures(modelpath, material, aiTextureType_SPECULAR, "specular");
		//textures.insert(textures.end(), specularMaps.begin(), specularMaps.end());
	}
	calcHitbox();
	
	positioncount = vertexcount;
	indicescount = indexcount;
	normalscount = normcount;
	uvcount = uvCoordcount;

	glGenBuffers(1, &positionBuffer);
	glBindBuffer(GL_ARRAY_BUFFER, positionBuffer);
	glBufferData(GL_ARRAY_BUFFER, positioncount/*Anzahl Knoten*/  * sizeof(float), &pos[0], GL_STATIC_DRAW); 
	glBindBuffer(GL_ARRAY_BUFFER, 0);

	glGenBuffers(1, &indexBuffer);
	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);
	glBufferData(GL_ELEMENT_ARRAY_BUFFER, indicescount /*Anzahl Indizes*/ * sizeof(unsigned int), &indices[0], GL_STATIC_DRAW);
	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);

	glGenBuffers(1, &normalBuffer);
	glBindBuffer(GL_ARRAY_BUFFER, normalBuffer);
	glBufferData(GL_ARRAY_BUFFER, normalscount /*Anzahl Indizes*/ * sizeof(float), &normals[0], GL_STATIC_DRAW);
	glBindBuffer(GL_ARRAY_BUFFER, 0);

	glGenBuffers(1, &uvBuffer);
	glBindBuffer(GL_ARRAY_BUFFER, uvBuffer);
	glBufferData(GL_ARRAY_BUFFER, uvcount /*Anzahl Indizes*/ * sizeof(float), &uvs[0], GL_STATIC_DRAW);
	glBindBuffer(GL_ARRAY_BUFFER, 0);

	glGenVertexArrays(1, &vao);
	glBindVertexArray(vao);

	glBindBuffer(GL_ARRAY_BUFFER, positionBuffer);
	glEnableVertexAttribArray(0);
	glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);

	glBindBuffer(GL_ARRAY_BUFFER, normalBuffer);
	glEnableVertexAttribArray(1);
	glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, 0);

	glBindBuffer(GL_ARRAY_BUFFER, uvBuffer);
	glEnableVertexAttribArray(2);
	glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 0, 0);

	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);

	glBindVertexArray(0);
	glBindBuffer(GL_ARRAY_BUFFER, 0);
	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
	}

	minX = getMinX();
	minY = getMinY();
	minZ = getMinZ();
	maxX = getMaxX();
	maxY = getMaxY();
	maxZ = getMaxZ();
	box = calcBox();
}
Beispiel #22
0
void importConfig(const string &import_config,
                  FWObject *library,
                  const string &fw_name,
                  bool deduplicate)
{
    QFile f(QString::fromUtf8(import_config.c_str()));
    f.open(QFile::ReadOnly);
    string buffer = QString(f.readAll()).toStdString();
    f.close();

    std::istringstream instream(buffer);
    QueueLogger *logger = new QueueLogger();
    logger->copyToStderr();
    Importer* imp = nullptr;

    QStringList sl_buf = QString::fromUtf8(buffer.c_str()).split("\n");
    PreImport pi(&sl_buf);
    pi.scan();

    switch (pi.getPlatform())
    {
    case PreImport::PIX:
    case PreImport::FWSM:
        imp = new PIXImporter(library, instream, logger, fw_name);
        break;

    case PreImport::IOSACL:
        imp = new IOSImporter(library, instream, logger, fw_name);
        break;

    case PreImport::IPTABLES:
        imp = new IPTImporter(library, instream, logger, fw_name);
        break;

    case PreImport::IPTABLES_WITH_COUNTERS:
        cerr << "This appears to be iptables configuration saved using "
            "command \"iptables-save -c\""
            "and it includes packet counters. Please save configuration "
            "using command \"iptables-save\" without option \"-c\" and "
            "try to import it again."
             << endl;
        exit(1);

    default:
        cerr << "Can not import configuration file: unrecognized firewall platform"
             << endl;
        exit(1);
    }

    if (deduplicate) imp->prepareForDeduplication();
    
    try
    {
        imp->run();
    } catch(ImporterException &e)
    {
        *logger << e.toString() << "\n";
    } catch(ObjectMakerException &e)
    {
        *logger << e.toString() << "\n";
    }

    imp->finalize();

}
XERCES_CPP_NAMESPACE_USE

PlugInDescriptorImp::PlugInDescriptorImp(const string& id, PlugIn* pPlugIn) :
   SessionItemImp(id),
   mPlugInNumber(0),
   mProductionStatus(false),
   mAllowMultipleInstances(false),
   mExecutableInterface(false),
   mExecuteOnStartup(false),
   mDestroyAfterExecute(true),
   mAbort(false),
   mWizardSupport(false),
   mBatchSupport(false),
   mInteractiveSupport(false),
   mpBatchInArgList(NULL),
   mpInteractiveInArgList(NULL),
   mpBatchOutArgList(NULL),
   mpInteractiveOutArgList(NULL),
   mImporterInterface(false),
   mExporterInterface(false),
   mInterpreterInterface(false),
   mTestableInterface(false),
   mTestable(false)
{
   if (pPlugIn != NULL)
   {
      setName(pPlugIn->getName());
      mVersion = pPlugIn->getVersion();
      mProductionStatus = pPlugIn->isProduction();
      mCreator = pPlugIn->getCreator();
      mCopyright = pPlugIn->getCopyright();
      mDependencyCopyright = pPlugIn->getDependencyCopyright();
      mDescription = pPlugIn->getDescription();
      mShortDescription = pPlugIn->getShortDescription();
      mType = pPlugIn->getType();
      mSubtype = pPlugIn->getSubtype();
      mAllowMultipleInstances = pPlugIn->areMultipleInstancesAllowed();

      if (Service<ApplicationServices>()->isInteractive())
      {
         setIcon(pPlugIn->getIcon());
      }

      Executable* pExecutable = dynamic_cast<Executable*>(pPlugIn);
      if (pExecutable != NULL)
      {
         mExecutableInterface = true;
         mExecuteOnStartup = pExecutable->isExecutedOnStartup();
         mDestroyAfterExecute = pExecutable->isDestroyedAfterExecute();
         mMenuLocations = pExecutable->getMenuLocations();

         mAbort = pExecutable->hasAbort();
         mWizardSupport = pExecutable->hasWizardSupport();

         mBatchSupport = pExecutable->setBatch();
         if (mBatchSupport)
         {
            pExecutable->getInputSpecification(mpBatchInArgList);
            pExecutable->getOutputSpecification(mpBatchOutArgList);
         }

         mInteractiveSupport = pExecutable->setInteractive();
         if (mInteractiveSupport)
         {
            pExecutable->getInputSpecification(mpInteractiveInArgList);
            pExecutable->getOutputSpecification(mpInteractiveOutArgList);
         }
      }

      Importer* pImporter = dynamic_cast<Importer*>(pPlugIn);
      if (pImporter != NULL)
      {
         mImporterInterface = true;
         mFileExtensions = pImporter->getDefaultExtensions();
      }

      Exporter* pExporter = dynamic_cast<Exporter*>(pPlugIn);
      if (pExporter != NULL)
      {
         mExporterInterface = true;
         mFileExtensions = pExporter->getDefaultExtensions();
      }

      InterpreterManager* pInterpreter = dynamic_cast<InterpreterManager*>(pPlugIn);
      if (pInterpreter != NULL)
      {
         mInterpreterInterface = true;
         mFileExtensions = pInterpreter->getFileExtensions();
      }

      Testable* pTestable = dynamic_cast<Testable*>(pPlugIn);
      if (pTestable != NULL)
      {
         mTestableInterface = true;
         mTestable = true;
      }
   }

   addPropertiesPage(PropertiesPlugInDescriptor::getName());
}
Beispiel #24
0
int main(int argc, char* argv[])
{
	using namespace std;
	using namespace Assimp;
	using namespace DirectX;


#pragma region Exporter
	Importer importer;
	unsigned int flags = 
		aiProcess_GenSmoothNormals |
		aiProcess_Triangulate |
		aiProcess_JoinIdenticalVertices |
		aiProcess_SortByPType |
		aiProcess_FlipWindingOrder;
	const aiScene* scene = importer.ReadFile(argv[1], flags);
	string modelFileName;
	for (size_t i = 0; argv[1][i] != '.'; i++)
	{
		modelFileName.push_back(argv[1][i]);
	}
	modelFileName.append(".mesh");
	ofstream bout(modelFileName.c_str(), ios_base::binary);
	if (bout.is_open() && scene)
	{
		if (scene->HasMeshes())
		{
			//Flag Header
			char headerString[] = { 'F','U', 'L', 'L', 'S', 'A', 'I', 'L' };
			bout.write(headerString, sizeof headerString / sizeof(char));

			//File Name
			uint8_t modelNameLength = static_cast<uint8_t>(modelFileName.size());
			bout.write(reinterpret_cast<char*>(&modelNameLength), sizeof modelNameLength);
			bout.write(modelFileName.c_str(), modelNameLength);

			//Number of Meshes
			uint8_t numOfMeshes = static_cast<uint8_t>(scene->mNumMeshes);
			bout.write(reinterpret_cast<char*>(&numOfMeshes), sizeof numOfMeshes);
			for (size_t meshIndex = 0; meshIndex < numOfMeshes; meshIndex++)
			{
				auto currentMesh = scene->mMeshes[meshIndex];

				//Pos
				uint32_t numOfVertices = currentMesh->mNumVertices;
				bout.write(reinterpret_cast<char*>(&numOfVertices), sizeof numOfVertices);
				bout.write(reinterpret_cast<char*>(currentMesh->mVertices), numOfVertices * sizeof(aiVector3D));

				//Normal
				bout.write(reinterpret_cast<char*>(currentMesh->mNormals), numOfVertices * sizeof(aiVector3D));

				//UV
				bout.write(reinterpret_cast<char*>(currentMesh->mTextureCoords[0]), numOfVertices * sizeof(aiVector3D));

				//Indices
				uint32_t numOfIndices = currentMesh->mNumFaces * 3;
				bout.write(reinterpret_cast<char*>(&numOfIndices), sizeof numOfIndices);
				for (size_t eachFace = 0; eachFace < currentMesh->mNumFaces; eachFace++)
				{
					for (size_t i = 0; i < 3; i++)
					{
						bout.write(reinterpret_cast<char*>(&currentMesh->mFaces[eachFace].mIndices[i]), sizeof(unsigned int));
					}
					
				}
				
			}
		}
	}
#pragma endregion

#pragma region Importer
	ifstream bin(modelFileName, ios_base::binary);
	ofstream text("log.txt");
	if (bin.is_open())
	{
		char header[8];
		bin.read(header, 8);
		if (strcmp(header,"FULLSAIL"))
		{
			uint8_t modelNameLength = 0;
			bin.read(reinterpret_cast<char*>(&modelNameLength), sizeof modelNameLength);
			text << "Model Name Length: " << (int)modelNameLength << "\n";

			string modelName;
			modelName.resize(modelNameLength);
			bin.read(&modelName[0],  modelNameLength * sizeof (char));
			text << "Model Name: "<< modelName << endl;

			uint8_t numOfMeshes = 0;
			bin.read(reinterpret_cast<char*>(&numOfMeshes), sizeof numOfMeshes);
			text << "Number of meshes: " << (int)numOfMeshes << "\n";


			for (size_t eachMesh = 0; eachMesh < numOfMeshes; eachMesh++)
			{
				uint32_t numOfVertices = 0;
				bin.read(reinterpret_cast<char*>(&numOfVertices), sizeof numOfVertices);
				text << "Number of Vertices for " << eachMesh << ": " << (int)numOfVertices << "\n";
				vector<XMFLOAT3> pos;
				vector<XMFLOAT3> nor;
				vector<XMFLOAT3> uvs;
				pos.resize(numOfVertices);
				nor.resize(numOfVertices);
				uvs.resize(numOfVertices);

				bin.read(reinterpret_cast<char*>(pos.data()), sizeof (XMFLOAT3) *  numOfVertices);
				bin.read(reinterpret_cast<char*>(nor.data()), sizeof(XMFLOAT3) *  numOfVertices);
				bin.read(reinterpret_cast<char*>(uvs.data()), sizeof(XMFLOAT3) *  numOfVertices);


				for (size_t eachVertex = 0; eachVertex < numOfVertices; eachVertex++)
				{
					text << "Pos: " << pos[eachVertex].x << " " << pos[eachVertex].y << " " << pos[eachVertex].z << "\t";
					text << "Nor: " << nor[eachVertex].x << " " << nor[eachVertex].y << " " << nor[eachVertex].z << "\t";
					text << "UVs: " << uvs[eachVertex].x << " " << uvs[eachVertex].y << " " << uvs[eachVertex].z << "\n";
				}
				

				vector<unsigned int> indices;
				uint32_t numOfIndices = 0;
				bin.read(reinterpret_cast<char*>(&numOfIndices), sizeof numOfIndices);
				text << "Number of Indices for " << eachMesh << ": " << (int)numOfIndices << "\n";
				indices.resize(numOfIndices);
				bin.read(reinterpret_cast<char*>(indices.data()), sizeof(unsigned int) *  numOfIndices);
				for (size_t eachIndex = 0; eachIndex < numOfIndices; eachIndex++)
				{
					text << indices[eachIndex] << " ";
				}
				text << "\n";

			}
		}
	}
#pragma endregion


	
	return 0;
}
Beispiel #25
0
int main()
{
	Importer importer;
	if (!importer.importFile("C://Users/Litet/Documents/GitHub/SmallGameProject/FBX Export/FBX Export/rekt.bin"))
	{
		std::cout << "IMPORTER FAIL!!!" << endl;
	}

	ofstream out("C://Users/Litet/Documents/GitHub/SmallGameProject/FBX Export/FBX Export/Portal_test_FBX_ImporterTest.txt");
	//out << importer.headers << endl;

	const ImporterTransform* transforms = importer.getTransform();
	for (unsigned int i = 0; i < importer.getNumTransforms(); i++)
	{
		out << transforms[i].name << endl;
		out << transforms[i].rotation[0] << " " << transforms[i].rotation[1] << " " << transforms[i].rotation[2] << " " << transforms[i].rotation[3] << " " << endl;
	}

	const ImporterMesh* meshes = importer.getMesh();
	for (unsigned int i = 0; i < importer.getNumMeshes(); i++)
	{
		out << meshes[i].position_count << endl;
		for (unsigned int j = 0; j < meshes[i].position_count; j++)
			out << meshes[i].position[j] << endl;

		for (unsigned int j = 0; j < meshes[i].uv_count; j++)
			out << meshes[i].uv[j] << endl;

		for (unsigned int j = 0; j < meshes[i].normal_count; j++)
			out << meshes[i].normal[j] << endl;

		for (unsigned int j = 0; j < meshes[i].indice_count; j++)
			out << meshes[i].vertices[j] << endl;
	}

	//for (unsigned int i = 0; i < importer.headers.joint_count; i++)
	//	out << importer.joints[i] << endl;

	//for (unsigned int i = 0; i < importer.headers.camera_count; i++)
	//	out << importer.cameras[i] << endl;

	//for (unsigned int i = 0; i < importer.headers.mesh_count; i++)
	//	out << importer.meshes[i] << endl;

	//for (unsigned int i = 0; i < importer.headers.light_count; i++)
	//	out << importer.lights[i] << endl;

	//for (unsigned int i = 0; i < importer.headers.nurb_count; i++)
	//	out << importer.nurbs[i] << endl;

	//for (unsigned int i = 0; i < importer.headers.morph_count; i++)
	//	out << importer.morph[i] << endl;

	//for (unsigned int i = 0; i < importer.headers.skin_count; i++)
	//	out << importer.skins[i] << endl;

	//for (unsigned int i = 0; i < importer.headers.anim_curve_count; i++)
	//	out << importer.getCurves()[i] << endl;

	//for (unsigned int i = 0; i < importer.headers.material_count; i++)
	//{
	//	out << importer.materials[i].name_length;
	//	out << importer.materials[i].duffuse_map_length;
	//	out << importer.materials[i].normal_map_length;
	//	out << importer.materials[i].specular_map_length;
	//	out << importer.materials[i].mtrl_type;
	//	out << importer.materials[i].normal_depth;
	//	out << importer.materials[i].specular[0];
	//	out << importer.materials[i].specular[1];
	//	out << importer.materials[i].specular[2];
	//	out << importer.materials[i].specular_factor;
	//	out << importer.materials[i].shininess;
	//	out << importer.materials[i].reflection[0];
	//	out << importer.materials[i].reflection[1];
	//	out << importer.materials[i].reflection[2];
	//	out << importer.materials[i].reflection_factor;
	//	out << importer.materials[i].ambient[0];
	//	out << importer.materials[i].ambient[1];
	//	out << importer.materials[i].ambient[2];
	//	out << importer.materials[i].diffuse[0];
	//	out << importer.materials[i].diffuse[1];
	//	out << importer.materials[i].diffuse[2];
	//	out << importer.materials[i].diffuse_factor;
	//	out << importer.materials[i].transparency_color[0];
	//	out << importer.materials[i].transparency_color[1];
	//	out << importer.materials[i].transparency_color[2];
	//	out << importer.materials[i].incandescence[0];
	//	out << importer.materials[i].incandescence[1];
	//	out << importer.materials[i].incandescence[2];
	//	out << importer.materials[i].name;
	//	//out << importer.materials[i].diffuse_map;
	//	//out << importer.materials[i].normal_map;
	//	//out << importer.materials[i].specular_map;
	//};


	//for (unsigned int i = 0; i < importer.headers.group_count; i++)
	//{
	//	out << importer.transforms[i].name_Length;
	//	out << importer.transforms[i].parentID;
	//	out << importer.transforms[i].position[0];
	//	out << importer.transforms[i].position[1];
	//	out << importer.transforms[i].position[2];
	//	out << importer.transforms[i].rotation[0];
	//	out << importer.transforms[i].rotation[1];
	//	out << importer.transforms[i].rotation[2];
	//	out << importer.transforms[i].rotation[3];
	//	out << importer.transforms[i].scale[0];
	//	out << importer.transforms[i].scale[1];
	//	out << importer.transforms[i].scale[2];
	//	out << importer.transforms[i].name;
	//};

	//struct ImporterJoint
	//{
	//	double jointOrientation[4];
	//	ImporterTransform transform;
	//};

	//struct ImporterMesh
	//{
	//	unsigned int name_length;
	//	unsigned int vertex_count;
	//	unsigned int indice_count;
	//	unsigned int position_count;
	//	unsigned int uv_count;
	//	unsigned int normal_count;
	//	unsigned int tangent_count;
	//	unsigned int biTangent_count;
	//	unsigned int material_count;
	//	unsigned int transform_count;
	//	bool has_Animation;

	//	double* position;
	//	float* uv;
	//	double* normal;
	//	double* tangent;
	//	double* bi_tangent;

	//	int* transform_Id;
	//	int* material_Id;
	//	Vertex* vertices;
	//	char*  name;
	//};

	//struct ImporterCamera
	//{
	//	unsigned int name_length;
	//	unsigned int nrOfParents;
	//	double position[3];
	//	double up_vector[3];
	//	double interest_position[3];
	//	double field_of_view_x;
	//	double field_of_view_y;
	//	double near_plane;
	//	double far_plane;
	//	projection_type projection;
	//	unsigned int* parentID;
	//	char*  name;
	//};

	//struct ImporterLight
	//{
	//	unsigned int name_Length;
	//	light_type type;
	//	double color[3];
	//	float intensity;
	//	decay_type dType;
	//	bool cast_shadows;
	//	double shadow_color[3];
	//	char* name;
	//};

	//struct ImporterNurb
	//{
	//	unsigned int name_Length;
	//	unsigned int numberOfParent;
	//	float radius;
	//	int* ParentID;
	//	char* name;
	//};

	//struct ImporterMorphAnimation
	//{
	//	unsigned int blendShape_name_length;
	//	unsigned int nrOfWeights;
	//	unsigned int nrOfTargets;
	//	unsigned int nrOfVertsPerMesh;
	//	unsigned int meshID;
	//	unsigned int nrOfPositions;

	//	double* positions;
	//	char* name;
	//};

	//struct ImporterWeights
	//{
	//	unsigned int numberOfInfluences;
	//	unsigned int skinMeshIndex;
	//	unsigned int skinVertexCount;
	//	int * influenceIndices;
	//	VertexInfluence* Weights;
	//};

	/*out << "getNumModels(): " << importer.getNumModels() << endl;
	out << "getNumMeshes(): " << importer.getNumMeshes() << endl;
	out << "getNumMaterials(): " << importer.getNumMaterials() << endl;
	out << "getModels(): " << endl;
	for (unsigned int i = 0; i < importer.getNumModels(); i++)
	{
	out << "Model " << i << ": " << endl;
	out << importer.getModels()[i].MaterialID << endl;
	out << importer.getModels()[i].MeshID << endl;
	out << importer.getModels()[i].position[0] << " " << importer.getModels()[i].position[1] << " " << importer.getModels()[i].position[2] << endl;
	out << importer.getModels()[i].rotation[0] << " " << importer.getModels()[i].rotation[1] << " " << importer.getModels()[i].rotation[2] << " " << importer.getModels()[i].rotation[3] << endl;
	out << importer.getModels()[i].scale[0] << " " << importer.getModels()[i].scale[1] << " " << importer.getModels()[i].scale[2] << endl;
	}

	for (unsigned int i = 0; i < importer.getNumMeshes(); i++)
	{
	out << "Mesh " << i << ": " << endl;
	for (unsigned int j = 0; j < importer.getMeshVertexCount(i); j++)
	{
	out << "Vertex " << j << ": " << endl;
	out << importer.getMesh(i)[j].position[0] << " " << importer.getMesh(i)[j].position[1] << " " << importer.getMesh(i)[j].position[2] << endl;
	out << importer.getMesh(i)[j].texCoord[0] << " " << importer.getMesh(i)[j].texCoord[1] << endl;
	out << importer.getMesh(i)[j].normal[0] << " " << importer.getMesh(i)[j].normal[1] << " " << importer.getMesh(i)[j].normal[2] << endl;
	out << importer.getMesh(i)[j].biNormal[0] << " " << importer.getMesh(i)[j].biNormal[1] << " " << importer.getMesh(i)[j].biNormal[2] << endl;
	out << importer.getMesh(i)[j].tangent[0] << " " << importer.getMesh(i)[j].tangent[1] << " " << importer.getMesh(i)[j].tangent[2] << endl;
	}
	}

	for (unsigned int i = 0; i < importer.getNumMaterials(); i++)
	{
	out << "Material " << i << ": " << endl;
	out << importer.getMatrials()[i].diffuse[0] << " " << importer.getMatrials()[i].diffuse[1] << " " << importer.getMatrials()[i].diffuse[2] << endl;
	out << importer.getMatrials()[i].diffuse_factor << endl;
	out << importer.getMatrials()[i].ambient[0] << " " << importer.getMatrials()[i].ambient[1] << " " << importer.getMatrials()[i].ambient[2] << endl;
	out << importer.getMatrials()[i].specular[0] << " " << importer.getMatrials()[i].specular[1] << " " << importer.getMatrials()[i].specular[2] << endl;
	out << importer.getMatrials()[i].specular_factor << endl;
	out << importer.getMatrials()[i].shininess << endl;
	out << importer.getMatrials()[i].incandescence[0] << " " << importer.getMatrials()[i].incandescence[1] << " " << importer.getMatrials()[i].incandescence[2] << endl;
	out << importer.getMatrials()[i].transparency_color[0] << " " << importer.getMatrials()[i].transparency_color[1] << " " << importer.getMatrials()[i].transparency_color[2] << endl;
	out << importer.getMatrials()[i].mtrl_type << endl;
	out << importer.getMatrials()[i].reflection[0] << " " << importer.getMatrials()[i].reflection[1] << " " << importer.getMatrials()[i].reflection[2] << endl;
	out << importer.getMatrials()[i].reflection_factor << endl;
	out << importer.getMatrials()[i].node_name << endl;
	if (importer.getMatrials()[i].normal_map != nullptr)
	out << importer.getMatrials()[i].normal_map << endl;
	out << importer.getMatrials()[i].normal_depth << endl;
	if (importer.getMatrials()[i].specular_map != nullptr)
	out << importer.getMatrials()[i].specular_map << endl;
	}

	out << "getNumBoundingSphere(): " << importer.getNumBoundingSphere() << endl;

	out << "getNumBoundingSphere(): " << endl;
	for (unsigned int i = 0; i < importer.getNumBoundingSphere(); i++)
	{
	out << "Sphere " << i << ": " << endl;
	out << importer.spheres[i].position[0] << " " << importer.spheres[i].position[1] << " " << importer.spheres[i].position[2] << endl;
	out << importer.spheres[i].radius << endl;
	}*/
	getchar();
	return 0;
}