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


C++ SubEntity::setMaterial方法代码示例

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


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

示例1: replace_texture_now

void LIRenAttachmentEntity::replace_texture_now (const Ogre::String& name, Ogre::TexturePtr& texture)
{
	if (mesh.isNull () || entity == NULL)
		return;

	// Translate the name if already replaced before.
	std::map<Ogre::String, Ogre::String>::const_iterator iter;
	iter = applied_texture_replaces.find(name);
	Ogre::String real_name;
	if (iter != applied_texture_replaces.end())
		real_name = iter->second;
	else
		real_name = name;

	// Save the replaced name for future translations.
	applied_texture_replaces[name] = texture->getName ();

	// Replace in each submesh.
	for (size_t subent_idx = 0 ; subent_idx < entity->getNumSubEntities () ; ++subent_idx)
	{
		// Get the material of the subent.
		Ogre::SubEntity* subent = entity->getSubEntity (subent_idx);
		Ogre::MaterialPtr submat = subent->getMaterial ();
		if (submat.isNull ())
			continue;

		// Check if there are replaceable textures.
		if (!render->material_utils->has_overridable_texture (submat, real_name))
			continue;

		// Create a modified version of the material.
		Ogre::String new_name = render->id.next ();
		Ogre::MaterialPtr material = submat->clone (new_name, true, LIREN_RESOURCES_TEMPORARY);
		render->material_utils->replace_texture (material, real_name, texture->getName ());
		subent->setMaterial (material);
	}
}
开发者ID:bsmr-games,项目名称:lipsofsuna,代码行数:37,代码来源:render-attachment-entity.cpp


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