当前位置: 首页>>代码示例>>C++>>正文


C++ Importer::ValidateFlags方法代码示例

本文整理汇总了C++中Importer::ValidateFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ Importer::ValidateFlags方法的具体用法?C++ Importer::ValidateFlags怎么用?C++ Importer::ValidateFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Importer的用法示例。


在下文中一共展示了Importer::ValidateFlags方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Import

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;
}
开发者ID:ServerGame,项目名称:ATools,代码行数:76,代码来源:Importer.cpp


注:本文中的Importer::ValidateFlags方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。